File: configure.ac

package info (click to toggle)
gdm3 3.30.2-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 15,696 kB
  • sloc: ansic: 27,919; sh: 5,307; makefile: 1,144; xml: 817; sed: 16
file content (1538 lines) | stat: -rw-r--r-- 50,374 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538

AC_PREREQ([2.60])
AC_INIT([gdm],
        [3.30.2],
        [http://bugzilla.gnome.org/enter_bug.cgi?product=gdm])

AC_CONFIG_SRCDIR([daemon/gdm-manager.c])

AM_INIT_AUTOMAKE([1.11.2 no-dist-gzip dist-xz tar-ustar -Wall foreign])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
AM_MAINTAINER_MODE([enable])

# for utmpx stuff
AC_GNU_SOURCE

AC_STDC_HEADERS
AC_PROG_CXX
AM_PROG_CC_C_O
AC_PROG_LIBTOOL()

## increment if the plugin interface has additions, changes, removals.
LT_CURRENT=1

## increment any time the source changes; set to
##  0 if you increment CURRENT
LT_REVISION=0

## increment if any interfaces have been added; set to 0
## if any interfaces have been changed or removed. removal has
## precedence over adding, so set to 0 if both happened.
LT_AGE=0

AC_SUBST(LT_CURRENT)
AC_SUBST(LT_REVISION)
AC_SUBST(LT_AGE)

AC_HEADER_STDC

AC_SUBST(VERSION)

AC_CONFIG_HEADERS(config.h)
AC_CONFIG_MACRO_DIR([m4])

# Documentation
enable_documentation=no
m4_ifdef([YELP_HELP_INIT],[
YELP_HELP_INIT
enable_documentation=yes
])
AM_CONDITIONAL(ENABLE_DOCUMENTATION, test x$enable_documentation = xyes)

# i18n stuff
AM_GNU_GETTEXT([external])
AM_GNU_GETTEXT_VERSION([0.19.8])

GETTEXT_PACKAGE=gdm
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [gettext package])

dnl ---------------------------------------------------------------------------
dnl - Dependencies
dnl ---------------------------------------------------------------------------

GLIB_REQUIRED_VERSION=2.44.0
GTK_REQUIRED_VERSION=2.91.1
LIBCANBERRA_GTK_REQUIRED_VERSION=0.4
ACCOUNTS_SERVICE_REQUIRED_VERSION=0.6.35

EXTRA_COMPILE_WARNINGS(yes)

PKG_CHECK_MODULES(GTHREAD, gthread-2.0)
AC_SUBST(GTHREAD_CFLAGS)
AC_SUBST(GTHREAD_LIBS)

PKG_CHECK_MODULES(COMMON,
        gobject-2.0 >= $GLIB_REQUIRED_VERSION
        gio-2.0 >= $GLIB_REQUIRED_VERSION
        gio-unix-2.0 >= $GLIB_REQUIRED_VERSION
)
AC_SUBST(COMMON_CFLAGS)
AC_SUBST(COMMON_LIBS)

PKG_CHECK_MODULES(DAEMON,
        gobject-2.0 >= $GLIB_REQUIRED_VERSION
        gio-2.0 >= $GLIB_REQUIRED_VERSION
        gio-unix-2.0 >= $GLIB_REQUIRED_VERSION
        accountsservice >= $ACCOUNTS_SERVICE_REQUIRED_VERSION
        xcb
)
AC_SUBST(DAEMON_CFLAGS)
AC_SUBST(DAEMON_LIBS)

GLIB_GSETTINGS

PKG_CHECK_MODULES(XLIB, x11 xau, ,
  [AC_PATH_XTRA
    if test "x$no_x" = xyes; then
      AC_MSG_ERROR("no (requires X development libraries)")
    else
      XLIB_LIBS="$X_PRE_LIBS $X_LIBS -lXau -lX11 -lXext $X_EXTRA_LIBS"
      XLIB_CFLAGS=$X_CFLAGS
    fi])
AC_SUBST(XLIB_CFLAGS)
AC_SUBST(XLIB_LIBS)

PKG_CHECK_MODULES(GTK,
        gtk+-3.0 >= $GTK_REQUIRED_VERSION
)
AC_SUBST(GTK_CFLAGS)
AC_SUBST(GTK_LIBS)

PKG_CHECK_MODULES(CANBERRA_GTK,
        libcanberra-gtk3 >= $LIBCANBERRA_GTK_REQUIRED_VERSION
)
AC_SUBST(CANBERRA_GTK_CFLAGS)
AC_SUBST(CANBERRA_GTK_LIBS)

AC_ARG_WITH(selinux,
            AS_HELP_STRING([--with-selinux],
                           [Add SELinux support]),,
            with_selinux=auto)

PKG_CHECK_MODULES(LIBSELINUX, libselinux, have_selinux=yes, have_selinux=no)

use_selinux=no
if test "x$have_selinux" = "xyes" && test "x$with_selinux" != "xno" ; then
        AC_DEFINE(HAVE_SELINUX, 1, [Define if have selinux])
        use_selinux=yes
fi
AC_SUBST(LIBSELINUX_CFLAGS)
AC_SUBST(LIBSELINUX_LIBS)

PKG_CHECK_MODULES(SIMPLE_CHOOSER,
        gtk+-3.0 >= $GTK_REQUIRED_VERSION
)
AC_SUBST(SIMPLE_CHOOSER_CFLAGS)
AC_SUBST(SIMPLE_CHOOSER_LIBS)

PLUGIN_LIBTOOL_FLAGS="-export_dynamic -module -avoid-version"
AC_SUBST(PLUGIN_LIBTOOL_FLAGS)

AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
AC_PATH_XTRA

# Unit testing framework
PKG_CHECK_MODULES(CHECK,
                  [check >= 0.9.4],
                  have_check=yes,
                  have_check=no)
AM_CONDITIONAL([HAVE_CHECK],[test "x$CHECK_CFLAGS" != "x"])

PKG_CHECK_MODULES(LIBGDM, glib-2.0 gio-2.0 gio-unix-2.0);
GOBJECT_INTROSPECTION_CHECK([0.9.12])
LIBGDM_GIR_INCLUDES="GLib-2.0 GObject-2.0 Gio-2.0"
AC_SUBST(LIBGDM_GIR_INCLUDES)

dnl ---------------------------------------------------------------------------
dnl - Configuration file stuff
dnl ---------------------------------------------------------------------------

AC_ARG_WITH(sysconfsubdir,
            AS_HELP_STRING([--with-sysconfsubdir],
                           [directory name used under sysconfdir, default=gdm]),
            sysconfsubdir=${withval}, sysconfsubdir=gdm)
AC_SUBST(sysconfsubdir)

if test x"${sysconfsubdir}" != xno -a x"${sysconfsubdir}" != x; then
    gdmconfdir='${sysconfdir}/${sysconfsubdir}'
else
    gdmconfdir='${sysconfdir}'
fi
AC_SUBST(gdmconfdir)

AC_ARG_WITH(dmconfdir,
            AS_HELP_STRING([--with-dmconfdir],
                           [directory where Sessions are stored, default=SYSCONFDIR/dm]),
            dmconfdir=${withval}, dmconfdir=${sysconfdir}/dm)
AC_SUBST(dmconfdir)

dnl ---------------------------------------------------------------------------
dnl - Configure arguments
dnl ---------------------------------------------------------------------------
AC_ARG_ENABLE(gdm-xsession,
              AS_HELP_STRING([--enable-gdm-xsession],
                             [Enable installing the gdm Xsession file @<:@default=no@:>@]),,
              enable_gdm_xsession=no)
AM_CONDITIONAL(ENABLE_GDM_XSESSION, test x$enable_gdm_xsession = xyes)

AC_ARG_ENABLE(user-display-server,
	      AS_HELP_STRING([--enable-user-display-server],
                             [Enable running X server as user @<:@default=yes@:>@]),,
              enable_user_display_server=yes)
AM_CONDITIONAL(ENABLE_USER_DISPLAY_SERVER, test x$user_display_server = xyes)

if test x$enable_user_display_server = xyes; then
  AC_DEFINE(ENABLE_USER_DISPLAY_SERVER, 1, [Define if user display servers are supported])
fi

AC_ARG_WITH(default-pam-config,
	    AS_HELP_STRING([--with-default-pam-config: One of redhat, openembedded, exherbo, lfs, arch, none @<:@default=auto@:>@]))
dnl If not given, try autodetecting from release files (see NetworkManager source) 
if test x$with_default_pam_config = x; then
	AC_CHECK_FILE(/etc/redhat-release,with_default_pam_config="redhat")
	AC_CHECK_FILE(/etc/fedora-release,with_default_pam_config="redhat")
	AC_CHECK_FILE(/etc/exherbo-release,with_default_pam_config="exherbo")
	AC_CHECK_FILE(/etc/arch-release,with_default_pam_config="arch")
	AC_CHECK_FILE(/etc/lfs-release,with_default_pam_config="lfs")
	dnl If not autodetected, default to none
	if test x$with_default_pam_config = x; then
	  with_default_pam_config=none
	fi
fi
case x$with_default_pam_config in
     xredhat|xopenembedded|xexherbo|xlfs|xarch|xnone) ;;
     *)
       AC_MSG_ERROR([Invalid --with-default-pam-config ${with_default_pam_config}])
       exit 1
       ;;
esac
AM_CONDITIONAL(ENABLE_REDHAT_PAM_CONFIG, test x$with_default_pam_config = xredhat)
AM_CONDITIONAL(ENABLE_OPENEMBEDDED_PAM_CONFIG, test x$with_default_pam_config = xopenembedded)
AM_CONDITIONAL(ENABLE_EXHERBO_PAM_CONFIG, test x$with_default_pam_config = xexherbo)
AM_CONDITIONAL(ENABLE_LFS_PAM_CONFIG, test x$with_default_pam_config = xlfs)
AM_CONDITIONAL(ENABLE_ARCH_PAM_CONFIG, test x$with_default_pam_config = xarch)

AC_CHECK_HEADERS([security/pam_modules.h security/pam_modutil.h security/pam_ext.h],
                 [have_pam=yes],
                 [if test "x$have_pam" = xyes ; then
                        AC_MSG_ERROR([PAM development files not found.])
                 fi])

AC_ARG_ENABLE(console-helper,
	      AS_HELP_STRING([--enable-console-helper],
                             [Enable PAM console helper @<:@default=auto@:>@]),,
              enable_console_helper=auto)

AC_ARG_ENABLE(authentication-scheme,
              AS_HELP_STRING([--enable-authentication-scheme=@<:@pam/crypt/shadow@:>@],
	                     [Choose a specific authentication scheme @<:@default=auto@:>@]),,
              enable_authentication_scheme=auto)

AC_ARG_WITH(xinerama,
            AS_HELP_STRING([--with-xinerama],
                           [Add Xinerama support @<:@default=auto@:>@]),,
            with_xinerama=auto)

AC_ARG_WITH(xdmcp,
            AS_HELP_STRING([--with-xdmcp],
	                   [Add XDMCP (remote login) support @<:@default=auto@:>@]),,
            with_xdmcp=auto)

AC_ARG_WITH(tcp-wrappers,
            AS_HELP_STRING([--with-tcp-wrappers],
                           [Use TCP Wrappers @<:@default=auto@:>@]),,
            with_tcp_wrappers=auto)

AC_ARG_WITH([udevdir],
            AS_HELP_STRING([--with-udevdir=DIR],
                           [Directory for udev files]),
                [with_udevdir=$withval], [with_udevdir=$($PKG_CONFIG --variable=udevdir udev)])
AC_ARG_WITH([systemdsystemunitdir],
            AS_HELP_STRING([--with-systemdsystemunitdir=DIR],
                           [Directory for systemd service files]),
                [with_systemdsystemunitdir=$withval], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
AC_ARG_ENABLE(systemd-journal,
            AS_HELP_STRING([--enable-systemd-journal],
                           [Add journald support @<:@default=auto@:>@]),
            [enable_systemd_journal=$enableval], [enable_systemd_journal=auto])
AC_ARG_ENABLE(wayland-support,
	      AS_HELP_STRING([--enable-wayland-support],
                             [Enable support for wayland sessions  @<:@default=auto@:>@]),
              [enable_wayland_support=$enableval],
              [enable_wayland_support=yes])

AC_ARG_WITH(plymouth,
            AS_HELP_STRING([--with-plymouth],
                           [Add plymouth support @<:@default=yes@:>@]),,
                           [with_plymouth=yes])

AC_ARG_WITH(at-spi-registryd-directory,
            AS_HELP_STRING([--with-at-spi-registryd-directory],
	                   [Specify the directory of at-spi-registryd @<:@default=libexecdir@:>@])],,
            [with_at_spi_registryd_directory="${libexecdir}"])

AT_SPI_REGISTRYD_DIR=$with_at_spi_registryd_directory
AC_SUBST(AT_SPI_REGISTRYD_DIR)

# Allow configuration of default PATH
#
withval=""
AC_ARG_WITH(default-path,
            AS_HELP_STRING([--with-default-path=<PATH>],
	                   [PATH GDM will use as the user's default PATH]),
            [if test x$withval != x; then
               AC_MSG_RESULT("PATH ${withval} will be the default PATH.")
             fi])

if test x$withval != x; then
	GDM_SESSION_DEFAULT_PATH="$withval"
else
	GDM_SESSION_DEFAULT_PATH="/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin"
fi
AC_SUBST(GDM_SESSION_DEFAULT_PATH)

dnl
dnl file that sets LANG
dnl
withval=""
AC_ARG_WITH(lang-file,
            AS_HELP_STRING([--with-lang-file=<filename>],
	                   [file containing default language setting]),
            [if test x$withval != x; then
               AC_MSG_RESULT("System locale will be looked for in file ${withval}.")
             fi])

if test x$withval != x; then
	LANG_CONFIG_FILE="$withval"
else
	LANG_CONFIG_FILE='$(sysconfdir)/locale.conf'
fi
AC_SUBST(LANG_CONFIG_FILE)

# stropts has been removed from glibc
# https://bugzilla.redhat.com/show_bug.cgi?id=436349
AC_CHECK_HEADERS(stropts.h)

dnl socklen_t may be declared, but not in a "standard" C header location
AC_CHECK_HEADERS(sys/socket.h)
AC_CHECK_TYPE(socklen_t,,
        AC_DEFINE(socklen_t, size_t, [Compatibility type]),
[AC_INCLUDES_DEFAULT]
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
)
AC_CHECK_FUNCS([setresuid setenv unsetenv clearenv])

dnl checks needed for Darwin compatibility to linux **environ.
AC_CHECK_HEADERS(crt_externs.h)
AC_CHECK_FUNCS(_NSGetEnviron)

AC_CHECK_HEADERS(sys/vt.h)

EXTRA_DAEMON_LIBS=""
EXTRA_CHOOSER_LIBS=""
EXTRA_FLEXI_LIBS=""
EXTRA_DYNAMIC_LIBS=""
EXTRA_SETUP_LIBS=""
EXTRA_TEST_LIBS=""

AC_CHECK_FUNC(socket,,[
	      AC_CHECK_LIB(socket,socket, [
			   EXTRA_DAEMON_LIBS="$EXTRA_DAEMON_LIBS -lsocket"
			   EXTRA_CHOOSER_LIBS="$EXTRA_CHOOSER_LIBS -lsocket"
			   EXTRA_FLEXI_LIBS="$EXTRA_FLEXI_LIBS -lsocket"
			   EXTRA_DYNAMIC_LIBS="$EXTRA_DYNAMIC_LIBS -lsocket"
			   EXTRA_SETUP_LIBS="$EXTRA_SETUP_LIBS -lsocket"
			   EXTRA_TEST_LIBS="$EXTRA_TEST_LIBS -lsocket"])])
AC_CHECK_FUNC(gethostbyname,,[
	      AC_CHECK_LIB(nsl,gethostbyname, [
			   EXTRA_DAEMON_LIBS="$EXTRA_DAEMON_LIBS -lnsl"
			   EXTRA_CHOOSER_LIBS="$EXTRA_CHOOSER_LIBS -lnsl"
			   EXTRA_TEST_LIBS="$EXTRA_TEST_LIBS -lnsl"])])
AC_CHECK_DECL(HOST_NAME_MAX,,[
             AC_CHECK_DECL(_POSIX_HOST_NAME_MAX,
                           AC_DEFINE(HOST_NAME_MAX, _POSIX_HOST_NAME_MAX, []),
                           AC_DEFINE(HOST_NAME_MAX, 256, [Define to 256 if neither have HOST_NAME_MAX nor _POSIX_HOST_NAME_MAX]),
                           [[#include <limits.h>]])],
             [[#include <limits.h>]])
AC_CHECK_FUNC(sched_yield,[
	      AC_DEFINE(HAVE_SCHED_YIELD, 1, [Define if we have sched yield])],[
	      AC_CHECK_LIB(rt,sched_yield, [
			   AC_DEFINE(HAVE_SCHED_YIELD, 1, [Define if we have sched yield])
			   EXTRA_DAEMON_LIBS="$EXTRA_DAEMON_LIBS -lrt"], [
			   echo "No sched_yield found"])])
AC_CHECK_FUNC(inet_aton,,[
	      AC_CHECK_LIB(resolv,inet_aton, [
			   EXTRA_CHOOSER_LIBS="$EXTRA_CHOOSER_LIBS -lresolv"])])

dnl ---------------------------------------------------------------------------
dnl - Check for IPv6
dnl ---------------------------------------------------------------------------

AC_MSG_CHECKING([whether to enable IPv6])
AC_ARG_ENABLE(ipv6,
              AS_HELP_STRING([--enable-ipv6],
                             [Enables compilation of IPv6 code @<:@default=no@:>@]),,
              enable_ipv6=no)

if test x$enable_ipv6 = xyes; then
  AC_TRY_COMPILE([
    #include <sys/types.h>
    #include <sys/socket.h>],[
    struct sockaddr_storage ss;
    socket(AF_INET6, SOCK_STREAM, 0)
    ],
    have_ipv6=yes,
    have_ipv6=no
    )
  if test x$have_ipv6 = xyes; then
    have_getaddrinfo=no
    have_inet_ntop=no
    AC_CHECK_FUNC(getaddrinfo, have_getaddrinfo=yes)
    if test x$have_getaddrinfo != xyes; then
      for lib in bsd socket inet; do
        AC_CHECK_LIB($lib,getaddrinfo,["LIBS=$LIBS -l$lib";have_getaddrinfo=yes;break])
      done
    fi

    AC_CHECK_FUNC(inet_ntop,have_inet_ntop=yes)
    if test x$have_inet_ntop != xyes; then
      for lib in bsd nsl inet; do
        AC_CHECK_LIB($lib,inet_ntop,["LIBS=$LIBS -l$lib";have_inet_ntop=yes;break])
      done
    fi

    if test x$have_getaddrinfo = xyes; then
      if test x$have_inet_ntop = xyes; then
        have_ipv6=yes
        AC_DEFINE(ENABLE_IPV6, 1, [Define if we have ipv6])
        AC_MSG_RESULT($have_ipv6)
      else
        have_ipv6=no
        AC_MSG_RESULT($have_ipv6)
      fi
    fi
  fi
else
  AC_MSG_RESULT(no)
fi

dnl ---------------------------------------------------------------------------
dnl - Check for GDM user
dnl ---------------------------------------------------------------------------

withval=""
AC_ARG_WITH(user,
            AS_HELP_STRING([--with-user=<username>],
                           [specify gdm's user name]))

if test x$withval != x; then
	GDM_USERNAME="$withval"
else
	GDM_USERNAME=gdm
fi
AC_SUBST(GDM_USERNAME)
AC_DEFINE_UNQUOTED([GDM_USERNAME], "$GDM_USERNAME", [User to use])

dnl ---------------------------------------------------------------------------
dnl - Check for GDM group
dnl ---------------------------------------------------------------------------

withval=""
AC_ARG_WITH(group,
            AS_HELP_STRING([--with-group=<group>],
                           [specify gdm's group name]))

if test x$withval != x; then
	GDM_GROUPNAME="$withval"
else
	GDM_GROUPNAME=gdm
fi
AC_SUBST(GDM_GROUPNAME)
AC_DEFINE_UNQUOTED([GDM_GROUPNAME], "$GDM_GROUPNAME", [Group to use])


dnl ---------------------------------------------------------------------------
dnl - Check for PAM stuff
dnl ---------------------------------------------------------------------------

dnl PAM prefix (configuration files)
withval=""
AC_ARG_WITH(pam-prefix,
            AS_HELP_STRING([--with-pam-prefix=<prefix>],
                           [specify where pam files go]),
            [if test x$withval != x; then
               AC_MSG_RESULT("PAM files will be installed in prefix ${withval}.")
             fi])

if test x$withval != x; then
	PAM_PREFIX="$withval"
else
	PAM_PREFIX='${sysconfdir}'
fi
AC_SUBST(PAM_PREFIX)

dnl PAM dir (dynamic modules)
AC_ARG_WITH([pam-mod-dir],
            [AS_HELP_STRING([--with-pam-mod-dir=DIR],
                            [directory to install pam modules in])],
            [], [with_pam_mod_dir='${libdir}/security'])
PAM_MOD_DIR="$with_pam_mod_dir"
AC_SUBST(PAM_MOD_DIR)

have_pam=no
AC_CHECK_LIB(pam, pam_start, have_pam=yes)

if test "x$have_pam" = "xyes"; then
        PAM_LIBS="${PAM_LIBS} -lpam"
else
	AC_MSG_ERROR("PAM libraries not found")
fi
AC_SUBST(HAVE_PAM)
AC_SUBST(PAM_LIBS)

AC_CHECK_HEADERS([security/pam_modutil.h security/pam_ext.h])
AC_CHECK_LIB(pam, pam_syslog, [AC_DEFINE(HAVE_PAM_SYSLOG, [], [Define to 1 if you have the pam_syslog function])])

dnl test whether struct pam_message is const (Linux) or not (Sun)
if test "x$have_pam" = "xyes"; then
   pam_appl_h="$ac_pam_includes/security/pam_appl.h"
   AC_MSG_CHECKING(for const pam_message)
   AC_EGREP_HEADER([struct pam_message],
      $pam_appl_h,
      [ AC_EGREP_HEADER([const struct pam_message],
                        $pam_appl_h,
                        [AC_MSG_RESULT(["const: Linux-type PAM"]) ],
                        [AC_MSG_RESULT(["nonconst: Sun-type PAM"])
                        AC_DEFINE(PAM_MESSAGE_NONCONST, 1, [Define if your PAM support takes non-const arguments (Solaris)])]
                        )],
       [AC_MSG_RESULT(["not found - assume const, Linux-type PAM"])]
       )
   AC_CHECK_DECL(PAM_BINARY_PROMPT,
                 [supports_pam_extensions=yes],
                 [supports_pam_extensions=no],
                 #include <security/pam_appl.h>
                )
fi
if test "x$supports_pam_extensions" = "xyes" ; then
	AM_CONDITIONAL(SUPPORTS_PAM_EXTENSIONS, true)
	AC_DEFINE(SUPPORTS_PAM_EXTENSIONS, 1, [Define if PAM supports GDMs custom extensions])
fi

AC_CHECK_LIB(keyutils, keyctl_read, [
        AC_DEFINE(HAVE_KEYUTILS, 1, [Define if have keyutils])
        KEYUTILS_LIBS="-lkeyutils"
        KEYUTILS_CFLAGS=""
])
AC_SUBST(KEYUTILS_LIBS)
AC_SUBST(KEYUTILS_CFLAGS)

#
# Can we use BSD's setusercontext
#
AC_CHECK_HEADER(login_cap.h, [
		EXTRA_DAEMON_LIBS="$EXTRA_DAEMON_LIBS -lutil"
		AC_DEFINE(HAVE_LOGINCAP, 1, [Define if we have logincap])])

#
# Check for sys/sockio.h
#
AC_CHECK_HEADERS(sys/sockio.h, [
		 AC_DEFINE(HAVE_SYS_SOCKIO_H, 1, [Define if we have sys/sockio.h])])


dnl ---------------------------------------------------------------------------
dnl - Check for POSIX version of getpwnam_r
dnl ---------------------------------------------------------------------------

# Checking for a posix version of getpwnam_r
# if we are cross compiling and can not run the test
# assume getpwnam_r is the posix version
# it is up to the person cross compiling to change
# this behavior if desired

AC_LANG_PUSH(C)
AC_CACHE_CHECK([for posix getpwnam_r],
		ac_cv_func_posix_getpwnam_r,
		[AC_RUN_IFELSE([AC_LANG_PROGRAM(
[[
#define _POSIX_PTHREAD_SEMANTICS
#include <errno.h>
#include <pwd.h>
]],
[[
    char buffer[10000];
    struct passwd pwd, *pwptr = &pwd;
    int error;
    errno = 0;
    error = getpwnam_r ("", &pwd, buffer,
                        sizeof (buffer), &pwptr);
   return (error < 0 && errno == ENOSYS)
	   || error == ENOSYS;
]])],
	[ac_cv_func_posix_getpwnam_r=yes],
	[ac_cv_func_posix_getpwnam_r=no],
        [ac_cv_func_posix_getpwnam_r=yes]
)])
AC_LANG_POP(C)

if test "$ac_cv_func_posix_getpwnam_r" = yes; then
	AC_DEFINE(HAVE_POSIX_GETPWNAM_R,1,
		[Have POSIX function getpwnam_r])
else
	AC_CACHE_CHECK([for nonposix getpwnam_r],
		ac_cv_func_nonposix_getpwnam_r,
		[AC_TRY_LINK([#include <pwd.h>],
                      	[char buffer[10000];
                       	struct passwd pwd;
                       	getpwnam_r ("", &pwd, buffer, 
                               		sizeof (buffer));],
			[ac_cv_func_nonposix_getpwnam_r=yes],
			[ac_cv_func_nonposix_getpwnam_r=no])])
		if test "$ac_cv_func_nonposix_getpwnam_r" = yes; then
		AC_DEFINE(HAVE_NONPOSIX_GETPWNAM_R,1,
			[Have non-POSIX function getpwnam_r])
	fi
fi


dnl ---------------------------------------------------------------------------
dnl - Check for utmp stuff
dnl ---------------------------------------------------------------------------

AC_CHECK_HEADERS(utmp.h utmpx.h libutil.h sys/param.h)
AC_CHECK_FUNCS([getutxent updwtmpx updwtmp])
AC_CHECK_LIB(util, login, [
		   AC_DEFINE(HAVE_LOGIN, 1, [Define if have login])
		       EXTRA_DAEMON_LIBS="$EXTRA_DAEMON_LIBS -lutil" ])
AC_CHECK_LIB(util, logout, [
		   AC_DEFINE(HAVE_LOGOUT, 1, [Define if have logout])
		       EXTRA_DAEMON_LIBS="$EXTRA_DAEMON_LIBS -lutil" ])
AC_CHECK_LIB(util, logwtmp, [
	  	   AC_DEFINE(HAVE_LOGWTMP, 1, [Define if have logwtmp])
		       EXTRA_DAEMON_LIBS="$EXTRA_DAEMON_LIBS -lutil" ])
GDM_CHECK_UTMP

AC_MSG_CHECKING(if utmpx structure has ut_syslen field)
AC_TRY_COMPILE([
  #include <utmpx.h>],[
  struct utmpx record;
  record.ut_syslen = sizeof (record.ut_host);
  ],
  have_ut_syslen=yes,
  have_ut_syslen=no
  )
if test x$have_ut_syslen = xyes; then
  AC_DEFINE(HAVE_UT_SYSLEN, 1, [Define if have ut_syslen record])
fi
AC_MSG_RESULT($have_ut_syslen)


dnl ---------------------------------------------------------------------------
dnl - Check for Xdmcp
dnl ---------------------------------------------------------------------------

XDMCP_LIBS=""
if test x$with_xdmcp != xno ; then
	xdmcp_save_CPPFLAGS="$CPPFLAGS"
	CPPFLAGS="$CPPFLAGS $X_CFLAGS"
	AC_CHECK_HEADER(X11/Xdmcp.h, [
		AC_CHECK_LIB(Xdmcp, XdmcpFlush, [
		     	AC_DEFINE(HAVE_LIBXDMCP, 1, [Define if have libxdmcp])
		     	XDMCP_LIBS="-lXdmcp"
		     	XDMCP_SUPPORT=yes],,[$X_LIBS -lX11 $X_EXTRA_LIBS])
	],,[#include <X11/Xproto.h>])

	if test x$with_xdmcp = xyes -a "x$XDMCP_SUPPORT" = "x" ; then
		AC_MSG_ERROR(XDMCP support requested but XDMCP libraries not found)
	fi
	CPPFLAGS="$xdmcp_save_CPPFLAGS"
fi
AC_SUBST(XDMCP_LIBS)

if test "x$XDMCP_SUPPORT" = "xyes" ; then
	AM_CONDITIONAL(XDMCP_SUPPORT, true)
	GDMCHOOSER=gdmchooser
else
        # No need for TCP Wrappers in case XDMCP is disabled
        if test x$with_tcp_wrappers != xno ; then
	        echo "TCP wrappers not needed if XDMCP is not enabled"
        fi
	with_tcp_wrappers=no
	AM_CONDITIONAL(XDMCP_SUPPORT, false)
	GDMCHOOSER=
fi
AC_SUBST(GDMCHOOSER)

dnl ---------------------------------------------------------------------------
dnl - Check OS
dnl ---------------------------------------------------------------------------

os_solaris=no
case "$host" in
   *solaris*) os_solaris=yes
   ;;
esac
AM_CONDITIONAL(OS_SOLARIS, test x$os_solaris = xyes)

dnl ---------------------------------------------------------------------------
dnl - Check for TCP Wrappers for XDMCP access control
dnl ---------------------------------------------------------------------------

if test x$with_tcp_wrappers = xno ; then
	echo "TCP wrappers disabled"
else
  LIBWRAP_PATH=""
  if test x$os_solaris = xyes ; then
	if test -f /usr/lib/libwrap.so; then
		LIBWRAP_PATH=/usr/lib/libwrap.so
		echo "Found $LIBWRAP_PATH" 1>&5
		nm $LIBWRAP_PATH | grep 'T setenv' && LIBWRAP_PATH=""
        fi

	if test -z "$LIBWRAP_PATH"; then
		if test -f /usr/sfw/lib/libwrap.so; then
			LIBWRAP_PATH=/usr/sfw/lib/libwrap.so
			echo "Found $LIBWRAP_PATH" 1>&5
			nm $LIBWRAP_PATH | grep 'T setenv' && LIBWRAP_PATH=""
        	fi
        fi

	if test -z "$LIBWRAP_PATH"; then
		echo "*********************************************************"
	        echo " You have a broken TCP wrappers library (setenv included)"
		echo " Please get the latest TCP wrappers package from your OS"
		echo " vendor, or recompile TCP wrappers to not include a"
		echo " setenv() implementation."
		echo
		echo "Not using TCP wrappers after all."
		echo "*********************************************************"
	else
		LIBWRAP_LIBS="-L/usr/sfw/lib -R/usr/sfw/lib -lwrap"
		AC_DEFINE(HAVE_TCPWRAPPERS, 1, [Define if have tcp wrappers])
	fi
  else
 	AC_CHECK_LIB([wrap], [hosts_ctl], [
 	LIBWRAP_LIBS="-lwrap"
 	LIBWRAP_PATH=auto
 	AC_DEFINE(HAVE_TCPWRAPPERS, 1, [Define if have tcp wrappers])])
  fi
 
  AC_MSG_CHECKING([whether to use TCP wrappers])
  if test -n "$LIBWRAP_PATH"; then
        AC_MSG_RESULT(yes)
  else
        AC_MSG_RESULT(no)
  fi

  dnl find out if we need -lnsl or whatever
  LIB_NSL=
  if test -n "$LIBWRAP_PATH"; then
		AC_MSG_CHECKING(whether -lwrap also requires -lnsl)
		ORIG_LIBS="$LIBS"
		LIBS="$EXTRA_DAEMON_LIBS $LIBS $LIBWRAP_LIBS"
		AC_TRY_LINK([
#include <tcpd.h>
int allow_severity, deny_severity;
], [return hosts_access;], ,[
dnl try with -lnsl
OLD_LIBS="$LIBS"
LIBS="$LIBS -lnsl"
AC_TRY_LINK([
#include <tcpd.h>
int allow_severity, deny_severity;
], [return hosts_access;], LIB_NSL="-lnsl",
LIBWRAP_PATH="")
LIBS="$OLD_LIBS"
])
		LIBS="$ORIG_LIBS"
		if test -n "$LIB_NSL"; then
			AC_MSG_RESULT(yes)
			EXTRA_DAEMON_LIBS="$EXTRA_DAEMON_LIBS $LIB_NSL"
		else
			AC_MSG_RESULT(no)
		fi
  fi
fi

AC_SUBST(LIBWRAP_LIBS)


dnl ---------------------------------------------------------------------------
dnl - Check for Xinerama
dnl ---------------------------------------------------------------------------

# X11 Xinerama extension
# Check for Xinerama extension (Solaris impl or Xfree impl)
xinerama_save_cppflags="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $X_CFLAGS"

ALL_X_LIBS="$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"

if test ! x$with_xinerama = xno ; then
  # Check for XFree
  use_xfree_xinerama=yes
  AC_CHECK_LIB(Xinerama, XineramaQueryExtension,
         [AC_CHECK_HEADER(X11/extensions/Xinerama.h,
                       if test -z "`echo $ALL_X_LIBS | grep "\-lXext" 2> /dev/null`"; then
                          X_EXTRA_LIBS="-lXext $X_EXTRA_LIBS"
                       fi
                       AC_DEFINE(HAVE_XFREE_XINERAMA, 1, [Define if have xfree xinerama])
                       AC_DEFINE(HAVE_XINERAMA, 1, [Define if have xinerama])
                       XINERAMA_LIBS="-lXinerama"
                       XINERAMA_SUPPORT=yes,
                       use_xfree_xinerama=no,
                       [#include <X11/Xlib.h>])],
         use_xfree_xinerama=no, -lXext $ALL_X_LIBS)
  AC_MSG_CHECKING(for Xinerama support on XFree86)
  AC_MSG_RESULT($use_xfree_xinerama);

  if test x$use_xfree_xinerama = xno ; then
    if test x$os_solaris = xyes ; then
	# Check for solaris
	use_solaris_xinerama=yes
	AC_CHECK_LIB(Xext, XineramaGetInfo,
                     use_solaris_xinerama=yes, use_solaris_xinerama=no,
                     $ALL_X_LIBS)
	if test "x$use_solaris_xinerama" = "xyes"; then
            AC_CHECK_HEADER(X11/extensions/xinerama.h,
                            if test -z "`echo $ALL_X_LIBS | grep "\-lXext" 2> /dev/null`"; then
 				X_EXTRA_LIBS="-lXext $X_EXTRA_LIBS"
                            fi
                            AC_DEFINE(HAVE_SOLARIS_XINERAMA, 1, [Define if have Solaris xinerama])
                            AC_DEFINE(HAVE_XINERAMA, 1, [Define if have xinerama])
		     	    XINERAMA_LIBS=""
		     	    XINERAMA_SUPPORT=yes,
                            use_solaris_xinerama=no,
                            [#include <X11/Xlib.h>])
	fi
        AC_MSG_CHECKING(for Xinerama support on Solaris)
	AC_MSG_RESULT($use_solaris_xinerama);
    fi
  fi
fi

AC_SUBST(XINERAMA_LIBS)
CPPFLAGS="$xinerama_save_cppflags"

dnl ---------------------------------------------------------------------------
dnl - Check for systemd support
dnl ---------------------------------------------------------------------------

PKG_CHECK_MODULES(SYSTEMD,
                  [libsystemd])

AC_SUBST(SYSTEMD_CFLAGS)
AC_SUBST(SYSTEMD_LIBS)

PKG_CHECK_MODULES(JOURNALD,
                  [libsystemd],
                  [have_journald=yes], [have_journald=no])

if test "x$enable_systemd_journal" = "xauto" ; then
        if test x$have_journald = xno ; then
                use_journald=no
        else
                use_journald=yes
        fi

else
        use_journald="$enable_systemd_journal"
fi

if test "x$use_journald" != "xno" ; then
        if test "x$have_journald" = "xno"; then
                AC_MSG_ERROR([journald support explicitly required, but journald not found])
        fi

        AC_DEFINE(ENABLE_SYSTEMD_JOURNAL, 1, [Define to enable systemd journal support])
fi
AC_SUBST(JOURNALD_CFLAGS)
AC_SUBST(JOURNALD_LIBS)

if test "x$enable_wayland_support" != "xno" ; then
        AC_DEFINE(ENABLE_WAYLAND_SUPPORT, 1, [Define to enable wayland support])
fi

AC_PATH_PROG(SYSTEMD_X_SERVER, systemd-multi-seat-x, [/lib/systemd/systemd-multi-seat-x], [/lib/systemd:/usr/lib/systemd:$PATH])
AC_SUBST(SYSTEMD_X_SERVER)
AC_DEFINE_UNQUOTED(SYSTEMD_X_SERVER,"$SYSTEMD_X_SERVER",[Path to systemd X server wrapper])

if test "x$with_udevdir" != xno; then
        AC_SUBST(UDEV_DIR, [$with_udevdir])
fi
AM_CONDITIONAL(INSTALL_UDEV_RULES, test x$with_udevdir != xno)

if test "x$with_systemdsystemunitdir" != xno; then
        AC_SUBST(SYSTEMD_SYSTEM_UNIT_DIR, [$with_systemdsystemunitdir])
fi

AM_CONDITIONAL(INSTALL_SYSTEMD_UNITS, test x$with_systemdsystemunitdir != xno)

dnl ---------------------------------------------------------------------------
dnl - Check for plymouth support
dnl ---------------------------------------------------------------------------
PKG_CHECK_MODULES(PLYMOUTH,
                  [ply-boot-client],
                  [have_plymouth=yes], [have_plymouth=no])

if test "x$with_plymouth" = "xauto" ; then
        if test x$have_plymouth = xno ; then
                use_plymouth=no
        else
                use_plymouth=yes
        fi
else
        use_plymouth="$with_plymouth"
fi

PLYMOUTH_QUIT_SERVICE=""
if test "x$use_plymouth" != "xno" ; then
        if test "x$have_plymouth" = "xno"; then
                AC_MSG_ERROR([Plymouth support explicitly required, but plymouth not found])
        fi

        AC_DEFINE(WITH_PLYMOUTH, 1, [Define to enable plymouth support])
        PLYMOUTH_QUIT_SERVICE="plymouth-quit.service"
fi
AC_SUBST(PLYMOUTH_CFLAGS)
AC_SUBST(PLYMOUTH_LIBS)
AC_SUBST(PLYMOUTH_QUIT_SERVICE)

dnl ---------------------------------------------------------------------------
dnl - Check for D-Bus
dnl ---------------------------------------------------------------------------

dnl - Are we specifying a different dbus root ?
AC_ARG_WITH(dbus-sys,
            AS_HELP_STRING([--with-dbus-sys=<dir>],
	                   [where D-BUS system.d directory is]))
AC_ARG_WITH(dbus-services,
            AS_HELP_STRING([--with-dbus-services=<dir>],
	                   [where D-BUS services directory is]))

if ! test -z "$with_dbus_sys" ; then
        DBUS_SYS_DIR="$with_dbus_sys"
else
        DBUS_SYS_DIR="$sysconfdir/dbus-1/system.d"
fi
AC_SUBST(DBUS_SYS_DIR)

dnl ---------------------------------------------------------------------------
dnl - Check for ISO Codes
dnl ---------------------------------------------------------------------------

AC_MSG_CHECKING([whether iso-codes has iso-639 domain])
if $PKG_CONFIG --variable=domains iso-codes | grep 639 >/dev/null ; then
	AC_MSG_RESULT([yes])
else
	AC_MSG_RESULT([no])
fi
AC_DEFINE_UNQUOTED([ISO_CODES_PREFIX],["`$PKG_CONFIG --variable=prefix iso-codes`"],[ISO codes prefix])
ISO_CODES=iso-codes


dnl ---------------------------------------------------------------------------
dnl check for RBAC
dnl ---------------------------------------------------------------------------

msg_rbac_shutdown=no
AC_ARG_ENABLE(rbac-shutdown,
              AC_HELP_STRING([--enable-rbac-shutdown=<key>],
	                     [Build with RBAC support specifying shutdown/reboot RBAC authentication key]),
              enable_rbac_shutdown=$enableval,enable_rbac_shutdown=no)

if test "x$enable_rbac_shutdown" != "xno"; then
        RBAC_LIBS="-lsecdb -lsocket -lnsl"
        AC_DEFINE(ENABLE_RBAC_SHUTDOWN, [], [Set if we build with RBAC support])
        AC_DEFINE_UNQUOTED(RBAC_SHUTDOWN_KEY, "$enable_rbac_shutdown", [Set if we build with RBAC support])
        msg_rbac_shutdown="yes, using key $enable_rbac_shutdown"
fi
AC_SUBST(RBAC_LIBS)


dnl ---------------------------------------------------------------------------
dnl check for process control
dnl ---------------------------------------------------------------------------

AC_CHECK_HEADERS(sys/prctl.h)

dnl ---------------------------------------------------------------------------
dnl - Define some variables to represent the directories we use.
dnl ---------------------------------------------------------------------------

AC_SUBST(gdmlocaledir, ${gdmconfdir})
AC_SUBST(pixmapdir, ${datadir}/pixmaps)

AC_ARG_WITH(log-dir,
            AS_HELP_STRING([--with-log-dir=<file>],
                           [log dir]))

if ! test -z "$with_log_dir"; then
   GDM_LOG_DIR=$with_log_dir
else
   GDM_LOG_DIR=/var/log/gdm
fi
AC_SUBST(logdir, $GDM_LOG_DIR)

withval=""
AC_ARG_WITH(at-bindir,
            AS_HELP_STRING([--with-at-bindir=<PATH>]
                           [PATH to Accessible Technology programs @<:@default=BINDIR@:>@]))

if test x$withval != x; then
	AT_BINDIR="$withval"
else
	AT_BINDIR='${bindir}'
fi

AC_SUBST(AT_BINDIR)

withval=""
AC_ARG_WITH(defaults_conf,
            AS_HELP_STRING([--with-defaults-conf=<FILENAME>],
                           [FILENAME to give to defaults file @<:@default=DATADIR/gdm/defaults.conf@:>@]))

if test x$withval != x; then
	GDM_DEFAULTS_CONF="$withval"
else
	GDM_DEFAULTS_CONF='${datadir}/gdm/defaults.conf'
fi

AC_SUBST(GDM_DEFAULTS_CONF)

withval=""
AC_ARG_WITH(custom_conf,
            AS_HELP_STRING([--with-custom-conf=<FILENAME>],
                           [FILENAME to give to custom configuration file @<:@default=GDMCONFDIR/custom.conf@:>@]))

if test x$withval != x; then
	GDM_CUSTOM_CONF="$withval"
else
	GDM_CUSTOM_CONF='${gdmconfdir}/custom.conf'
fi

AC_SUBST(GDM_CUSTOM_CONF)
AC_SUBST(GDM_OLD_CONF, '${gdmconfdir}/gdm.conf')

AC_ARG_WITH(gnome-settings-daemon-directory,
              [AC_HELP_STRING([--with-gnome-settings-daemon-directory],
                              [Specify the directory of gnome-settings-daemon used by the chooser @<:@default=libexecdir@:>@])],,
                              [with_gnome_settings_daemon_directory="\${libexecdir}"])

GNOME_SETTINGS_DAEMON_DIR=$with_gnome_settings_daemon_directory
AC_SUBST(GNOME_SETTINGS_DAEMON_DIR)

AC_ARG_WITH(check-accelerated-directory,
              [AC_HELP_STRING([--with-check-accelerated-directory],
                              [Specify the directory of gnome-session-check-accelerated @<:@default=libexecdir@:>@])],,
                              [with_check_accelerated_directory="\${libexecdir}"])

CHECK_ACCELERATED_DIR=$with_check_accelerated_directory
AC_SUBST(CHECK_ACCELERATED_DIR)

dnl ---------------------------------------------------------------------------
dnl - Check for XEvIE extension support
dnl ---------------------------------------------------------------------------

AC_ARG_WITH(xevie,
            AS_HELP_STRING([--with-xevie],
                           [Add XEvIE Xserver extension support @<:@default=no@:>@]),,
            with_xevie=no)

if test x$with_xevie != xno ; then
	XEVIE_OPTION="+extension XEVIE"
else
	XEVIE_OPTION=""
fi

AC_SUBST(XEVIE_OPTION)
AC_DEFINE_UNQUOTED(XEVIE_OPTION,"$XEVIE_OPTION",[Define xevie option])

dnl ---------------------------------------------------------------------------
dnl - Check for audit framework
dnl ---------------------------------------------------------------------------

# Check for Solaris auditing API
# Note, Solaris auditing not supported for Solaris 9 or earlier and
# should not be used on these versions of Solaris if auditing is
# required.  Solaris auditing is only supported on systems that
# support the ADT_USER enumeration value.
#
AC_MSG_CHECKING(for Solaris auditing API)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <bsm/adt.h>
adt_user_context = ADT_USER;
]], [[]])], [ check_sun_audit=yes ], [ check_sun_audit=no ])

if test ${check_sun_audit} = yes
then
   AC_DEFINE(HAVE_ADT, 1, [Define if have adt])
   PAM_LIBS="$PAM_LIBS -lbsm"
   AC_MSG_RESULT(yes)
else
   AC_MSG_RESULT(no)
fi
AM_CONDITIONAL(HAVE_ADT, test x$check_sun_audit = xyes)

# Check for Linux auditing API
#
AC_ARG_WITH(libaudit,
            AS_HELP_STRING([--with-libaudit],
                           [Add Linux audit support @<:@default=auto@:>@]),,
            with_libaudit=auto)

# libaudit detection
if test x$with_libaudit = xno ; then
    have_libaudit=no;
else
    # See if we have audit daemon library
    AC_CHECK_LIB(audit, audit_log_user_message,
                 have_libaudit=yes, have_libaudit=no)
fi

AM_CONDITIONAL(HAVE_LIBAUDIT, test x$have_libaudit = xyes)

if test x$have_libaudit = xyes ; then
    PAM_LIBS="$PAM_LIBS -laudit"
    AC_DEFINE(HAVE_LIBAUDIT,1,[linux audit support])
fi

#
# Subst the extra libs
#
AC_SUBST(EXTRA_DAEMON_LIBS)
AC_SUBST(EXTRA_CHOOSER_LIBS)
AC_SUBST(EXTRA_FLEXI_LIBS)
AC_SUBST(EXTRA_DYNAMIC_LIBS)
AC_SUBST(EXTRA_SETUP_LIBS)
AC_SUBST(EXTRA_TEST_LIBS)

dnl ---------------------------------------------------------------------------
dnl - Check for X Server location
dnl ---------------------------------------------------------------------------

# First check with "! -h" for /usr/X11R6 and /usr/X11 since they often
# symlink to each other, and configure should use the more stable
# location (the real directory) if possible.
#
# On Solaris, the /usr/bin/Xserver script is used to decide whether to
# use Xsun or Xorg, so this is used on Solaris.
#
# When testing for /usr/X11R6, first check with "! -h" for /usr/X11R6
# and /usr/X11 since they often symlink to each other, and configure
# should use the more stable location (the real directory) if possible.
#
if test -n "$X_PATH"; then
   # assume the user set these variables and don't second-guess them.
   true
elif test -x /usr/bin/X; then
   X_PATH="/usr/bin"
   X_SERVER_PATH="/usr/bin"
   X_SERVER="/usr/bin/X"
elif test -x /usr/X11/bin/Xserver; then
   X_PATH="/usr/X11/bin"
   X_SERVER_PATH="/usr/X11/bin"
   X_SERVER="/usr/X11/bin/Xserver"
elif test ! -h /usr/X11R6 -a -x /usr/X11R6/bin/X; then
   X_PATH="/usr/X11R6/bin"
   X_SERVER_PATH="/usr/X11R6/bin"
   X_SERVER="/usr/X11R6/bin/X"
elif test ! -h /usr/X11 -a -x /usr/X11/bin/X; then
   X_PATH="/usr/X11/bin"
   X_SERVER_PATH="/usr/X11/bin"
   X_SERVER="/usr/X11/bin/X"
elif test -x /usr/X11R6/bin/X; then
   X_PATH="/usr/X11R6/bin"
   X_SERVER_PATH="/usr/X11R6/bin"
   X_SERVER="/usr/X11R6/bin/X"
elif test -x /usr/bin/Xorg; then
   X_PATH="/usr/bin"
   X_SERVER_PATH="/usr/bin"
   X_SERVER="/usr/bin/Xorg"
elif test -x /usr/X11/bin/X; then
   X_PATH="/usr/X11/bin"
   X_SERVER_PATH="/usr/X11/bin"
   X_SERVER="/usr/X11/bin/X"
elif test -x /usr/openwin/bin/Xsun; then
   # Do not add /usr/openwin/bin here because on Solaris you need
   # /usr/openwin/bin in your PATH even if you are using the Xorg
   # Xserver.  We add this to the path below.
   X_PATH="/usr/openwin/bin"
   X_SERVER_PATH="/usr/openwin/bin"
   X_SERVER="/usr/openwin/bin/Xsun"
elif test -x /opt/X11R6/bin/X; then
   X_PATH="/opt/X11R6/bin"
   X_SERVER_PATH="/opt/X11R6/bin"
   X_SERVER="/opt/X11R6/bin/X"
else
   # what to do, what to do, this is wrong, but this just sets the
   # defaults, perhaps this user is cross compiling or some such
   X_PATH="/usr/bin/X11:/usr/X11R6/bin:/opt/X11R6/bin"
   X_SERVER_PATH="/usr/bin"
   X_SERVER="/usr/bin/X"
fi

dnl ---------------------------------------------------------------------------
dnl - Check if Xorg is new enough to require '-listen tcp' (1.17)
dnl ---------------------------------------------------------------------------

if $PKG_CONFIG --atleast-version=1.17 xorg-server; then
   AC_DEFINE([HAVE_XSERVER_THAT_DEFAULTS_TO_LOCAL_ONLY], [], [XServer disables tcp access by default])
fi

dnl ---------------------------------------------------------------------------
dnl - Expand vars
dnl ---------------------------------------------------------------------------

AS_AC_EXPAND(LOCALSTATEDIR, $localstatedir)
AS_AC_EXPAND(SYSCONFDIR, $sysconfdir)
AS_AC_EXPAND(DATADIR, $datadir)
AS_AC_EXPAND(BINDIR, $bindir)
AS_AC_EXPAND(SBINDIR, $sbindir)
AS_AC_EXPAND(LIBDIR, $libdir)
AS_AC_EXPAND(LIBEXECDIR, $libexecdir)

dnl ---------------------------------------------------------------------------
dnl - runtime directory
dnl ---------------------------------------------------------------------------

AC_ARG_WITH([run-dir],
            AS_HELP_STRING([--with-run-dir=<file>],
                           [runtime directory]))

if ! test -z "$with_run_dir"; then
   GDM_RUN_DIR=$with_run_dir
else
   GDM_RUN_DIR=${localstatedir}/run/gdm
fi

AC_SUBST([GDM_RUN_DIR])

dnl ---------------------------------------------------------------------------
dnl - PID file
dnl ---------------------------------------------------------------------------

AC_ARG_WITH(pid-file,
            AS_HELP_STRING([--with-pid-file=<file>],
                           [pid file]))

if ! test -z "$with_pid_file"; then
   GDM_PID_FILE=$with_pid_file
else
   GDM_PID_FILE=$GDM_RUN_DIR/gdm.pid
fi

AS_AC_EXPAND(GDM_PID_FILE, "$GDM_PID_FILE")
AC_DEFINE_UNQUOTED(GDM_PID_FILE, "$GDM_PID_FILE", [pid file])

dnl ---------------------------------------------------------------------------
dnl - ran once marker
dnl ---------------------------------------------------------------------------

AC_ARG_WITH(ran-once-marker-directory,
            AS_HELP_STRING([--with-ran-once-marker-directory=<dir>],
                           [ran once marker directory]))

if ! test -z "$with_ran_once_marker_directory"; then
   GDM_RAN_ONCE_MARKER_DIR=$with_ran_once_marker_directory
else
   GDM_RAN_ONCE_MARKER_DIR=$GDM_RUN_DIR
fi
AC_SUBST(GDM_RAN_ONCE_MARKER_DIR)
AS_AC_EXPAND(GDM_RAN_ONCE_MARKER_DIR_EXPANDED, $GDM_RAN_ONCE_MARKER_DIR)
AC_DEFINE_UNQUOTED(GDM_RAN_ONCE_MARKER_DIR, "$GDM_RAN_ONCE_MARKER_DIR_EXPANDED", [ran once marker dir])

GDM_RAN_ONCE_MARKER_FILE="$GDM_RAN_ONCE_MARKER_DIR/ran-once-marker"
AC_SUBST(GDM_RAN_ONCE_MARKER_FILE)
AS_AC_EXPAND(GDM_RAN_ONCE_MARKER_FILE_EXPANDED, $GDM_RAN_ONCE_MARKER_FILE)
AC_DEFINE_UNQUOTED(GDM_RAN_ONCE_MARKER_FILE, "$GDM_RAN_ONCE_MARKER_FILE_EXPANDED", [ran once marker file])

dnl ---------------------------------------------------------------------------
dnl - GREETER WORKING DIRECTORY
dnl ---------------------------------------------------------------------------

AC_ARG_WITH(working-directory,
            AS_HELP_STRING([--with-working-dir=<dir>],
                           [working directory]))

if ! test -z "$with_working_directory"; then
   GDM_WORKING_DIR=$with_working_directory
else
   GDM_WORKING_DIR=${localstatedir}/lib/gdm
fi

AC_SUBST(GDM_WORKING_DIR)

dnl ---------------------------------------------------------------------------
dnl - Directory for X auth cookies
dnl ---------------------------------------------------------------------------

AC_ARG_WITH(xauth-dir,
            AS_HELP_STRING([--with-xauth-dir=<dir>],
                           [xauth cookie directory]))

if ! test -z "$with_xauth_dir"; then
   GDM_XAUTH_DIR=$with_xauth_dir
else
   GDM_XAUTH_DIR=$GDM_RUN_DIR
fi

AC_SUBST(GDM_XAUTH_DIR)

dnl ---------------------------------------------------------------------------
dnl - Directory for greeter screenshot
dnl ---------------------------------------------------------------------------

AC_ARG_WITH(screenshot-dir,
            AS_HELP_STRING([--with-screenshot-dir=<dir>],
                           [directory to store greeter screenshot]))

if ! test -z "$with_screenshot_dir"; then
   GDM_SCREENSHOT_DIR=$with_screenshot_dir
else
   GDM_SCREENSHOT_DIR=$GDM_RUN_DIR/greeter
fi

AC_SUBST(GDM_SCREENSHOT_DIR)

dnl ---------------------------------------------------------------------------
dnl - runtime conf
dnl ---------------------------------------------------------------------------

withval=""
AC_ARG_WITH(runtime_conf,
            AS_HELP_STRING([--with-runtime-conf=<FILENAME>],
                           [FILENAME to give to runtime configuration file @<:@default=GDM_RUN_DIR/custom.conf@:>@]))

if test x$withval != x; then
	GDM_RUNTIME_CONF="$withval"
else
	GDM_RUNTIME_CONF="$GDM_RUN_DIR/custom.conf"
fi

AC_SUBST(GDM_RUNTIME_CONF)


dnl ---------------------------------------------------------------------------
dnl - Finish
dnl ---------------------------------------------------------------------------


# Turn on the additional warnings last, so -Werror doesn't affect other tests.

AC_ARG_ENABLE(more-warnings,
              AS_HELP_STRING([--enable-more-warnings],
                             [Maximum compiler warnings]),
              set_more_warnings="$enableval",[
	      if test -d $srcdir/.git; then
	        set_more_warnings=yes
	      else
	        set_more_warnings=no
              fi])

AC_MSG_CHECKING(for more warnings)
if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
        AC_MSG_RESULT(yes)
        CFLAGS="\
        -Wall \
        -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes \
        -Wnested-externs -Wpointer-arith \
        -Wcast-align -Wsign-compare \
        $CFLAGS"

        for option in -Wno-strict-aliasing -Wno-sign-compare; do
                SAVE_CFLAGS="$CFLAGS"
                CFLAGS="$CFLAGS $option"
                AC_MSG_CHECKING([whether gcc understands $option])
                AC_TRY_COMPILE([], [],
                        has_option=yes,
                        has_option=no,)
                if test $has_option = no; then
                        CFLAGS="$SAVE_CFLAGS"
                fi
                AC_MSG_RESULT($has_option)
                unset has_option
                unset SAVE_CFLAGS
        done
        unset option
else
        AC_MSG_RESULT(no)
fi

#
# Enable Debug
#
AC_ARG_ENABLE(debug,
              AS_HELP_STRING([--enable-debug],
                             [turn on debugging]),,
              enable_debug=yes)

if test "$enable_debug" = "yes"; then
	DEBUG_CFLAGS="-DG_ENABLE_DEBUG"
else
	if test "x$enable_debug" = "xno"; then
		DEBUG_CFLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS"
  	else
    		DEBUG_CFLAGS=""
  	fi
fi
AC_SUBST(DEBUG_CFLAGS)

#
# Enable Profiling
#
AC_ARG_ENABLE(profiling,
              AS_HELP_STRING([--enable-profiling],
                             [turn on profiling]),,
              enable_profiling=yes)

if test "$enable_profiling" = "yes"; then
    AC_DEFINE(ENABLE_PROFILING,1,[enable profiling])
fi

#
# Set SHELL to use in scripts.
#
if test x$os_solaris = xyes ; then
   XSESSION_SHELL=/bin/ksh
else
   XSESSION_SHELL=/bin/sh
fi

#
# Set VT to use for initial server
#
AC_ARG_WITH(initial-vt,
        AS_HELP_STRING([--with-initial-vt=<nr>],
                [Initial virtual terminal to use]))
if ! test -z "$with_initial_vt"; then
        GDM_INITIAL_VT="$with_initial_vt"
else
        GDM_INITIAL_VT="1"
fi
AC_SUBST(GDM_INITIAL_VT)
AC_DEFINE_UNQUOTED(GDM_INITIAL_VT, "$GDM_INITIAL_VT", [Initial Virtual Terminal])

# Set configuration choices.
#
AC_SUBST(XSESSION_SHELL)
AC_DEFINE_UNQUOTED(XSESSION_SHELL,"$XSESSION_SHELL",[xsession shell])
AC_SUBST(SOUND_PROGRAM)
AC_DEFINE_UNQUOTED(SOUND_PROGRAM,"$SOUND_PROGRAM",[])

AC_SUBST(X_PATH)
AC_SUBST(X_SERVER)
AC_SUBST(X_SERVER_PATH)
AC_DEFINE_UNQUOTED(X_SERVER,"$X_SERVER",[])
AC_DEFINE_UNQUOTED(X_SERVER_PATH,"$X_SERVER_PATH",[])

## Stuff for debian/changelog.in
#if test -e "debian/changelog"; then
#  DEBIAN_DATESTAMP=`head -1 debian/changelog| sed -e 's/.*cvs.//' -e 's/).*//'`
#  DEBIAN_DATE=`grep '^ --' debian/changelog | head -1 | sed -e 's/.*  //'`
#else
#  DEBIAN_DATESTAMP=`date +%Y%m%d%H%M%s`
#  DEBIAN_DATE=`date -R`
#fi
#
#AC_SUBST(DEBIAN_DATESTAMP)
#AC_SUBST(DEBIAN_DATE)

AC_CONFIG_FILES([
Makefile
pam-extensions/Makefile
pam-extensions/gdm-pam-extensions.pc
daemon/Makefile
docs/Makefile
chooser/Makefile
libgdm/Makefile
libgdm/gdm.pc
utils/Makefile
pam_gdm/Makefile
data/gdm.conf
data/Makefile
data/applications/Makefile
data/autostart/Makefile
data/pixmaps/Makefile
data/pixmaps/16x16/Makefile
data/pixmaps/32x32/Makefile
data/pixmaps/48x48/Makefile
data/dconf/gdm
common/Makefile
po/Makefile.in
tests/Makefile
])

AC_OUTPUT

dnl ---------------------------------------------------------------------------
dnl - Show summary
dnl ---------------------------------------------------------------------------

echo "
                    GDM $VERSION
                    ============

	prefix:                   ${prefix}
	exec_prefix:              ${exec_prefix}
        libdir:                   ${libdir}
        bindir:                   ${bindir}
        sbindir:                  ${sbindir}
        sysconfdir:               ${sysconfdir}
        sysconfsubdir:            ${sysconfsubdir}
        gdmconfdir:               ${gdmconfdir}
        dmconfdir:                ${dmconfdir}
        localstatedir:            ${localstatedir}
        datadir:                  ${datadir}
	gnome-settings-daemon location: ${with_gnome_settings_daemon_directory}
	gnome-session-check-accel location: ${with_check_accelerated_directory}
	source code location:	  ${srcdir}
	compiler:		  ${CC}
	cflags:		          ${CFLAGS}
        Maintainer mode:          ${USE_MAINTAINER_MODE}

        user:                     ${GDM_USERNAME}
        group:                    ${GDM_GROUPNAME}

        dbus-1 system.d dir:      ${DBUS_SYS_DIR}
        PAM prefix:               ${PAM_PREFIX}
        PAM module dir:           ${PAM_MOD_DIR}
        PAM config:               ${with_default_pam_config}
        X server:                 ${X_SERVER}
"

dnl TCP Wrappers support?
if test x"$LIBWRAP_PATH" = x ; then
	echo \
"        TCP Wrappers support:     no"
else
	echo \
"        TCP Wrappers support:     yes"
fi

echo \
"        Xinerama support:         ${XINERAMA_SUPPORT}
        XDMCP support:            ${XDMCP_SUPPORT}
        SELinux support:          ${use_selinux}
        systemd unit dir:         ${with_systemdsystemunitdir}
        udev dir:                 ${with_udevdir}
        plymouth support:         ${use_plymouth}
        wayland support:          ${enable_wayland_support}
        Build with RBAC:          ${msg_rbac_shutdown}
        Initial VT:               ${GDM_INITIAL_VT}
        Enable documentation:     ${enable_documentation}
        Install GDM's Xsession:   ${enable_gdm_xsession}
"