forked from util-linux/util-linux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
2777 lines (2333 loc) · 83.6 KB
/
configure.ac
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
AC_INIT([util-linux],
m4_esyscmd([tools/git-version-gen .tarball-version]),
[kzak@redhat.com], [],
[http://www.kernel.org/pub/linux/utils/util-linux/])
AC_PREREQ([2.64])
AC_CONFIG_AUX_DIR([config])
AC_CONFIG_MACRO_DIR([m4])
dnl AC_USE_SYSTEM_EXTENSIONS must be called before any macros that run
dnl the compiler (like LT_INIT) to avoid autoconf errors.
AC_USE_SYSTEM_EXTENSIONS
AM_INIT_AUTOMAKE([-Wall -Wno-portability foreign 1.10 tar-pax no-dist-gzip dist-xz subdir-objects])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
[AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
AC_CONFIG_SRCDIR([sys-utils/mount.c])
AC_PREFIX_DEFAULT([/usr])
dnl version details from <major>.<minor>[-<suffix>]
PACKAGE_VERSION_MAJOR=$(echo $PACKAGE_VERSION | awk -F. '{print $1}')
PACKAGE_VERSION_MINOR=$(echo $PACKAGE_VERSION | awk -F. '{
sub("-.*","",$2); print $2}')
PACKAGE_VERSION_RELEASE=$(echo $PACKAGE_VERSION | awk -F. '{
sub("-.*","",$3); print $3 ~ /^@<:@0-9@:>@+$/ ? $3 : 0}')
dnl libblkid version
LIBBLKID_VERSION="$PACKAGE_VERSION_MAJOR.$PACKAGE_VERSION_MINOR.$PACKAGE_VERSION_RELEASE"
LIBBLKID_DATE="31-Jan-2022"
LIBBLKID_LT_MAJOR=1
LIBBLKID_LT_MINOR=1
LIBBLKID_LT_MICRO=0
LIBBLKID_VERSION_INFO=`expr $LIBBLKID_LT_MAJOR + $LIBBLKID_LT_MINOR`:$LIBBLKID_LT_MICRO:$LIBBLKID_LT_MINOR
dnl libuuid version
LIBUUID_VERSION="$PACKAGE_VERSION_MAJOR.$PACKAGE_VERSION_MINOR.$PACKAGE_VERSION_RELEASE"
LIBUUID_LT_MAJOR=1
LIBUUID_LT_MINOR=3
LIBUUID_LT_MICRO=0
LIBUUID_VERSION_INFO=`expr $LIBUUID_LT_MAJOR + $LIBUUID_LT_MINOR`:$LIBUUID_LT_MICRO:$LIBUUID_LT_MINOR
dnl libmount version
LIBMOUNT_VERSION="$PACKAGE_VERSION_MAJOR.$PACKAGE_VERSION_MINOR.$PACKAGE_VERSION_RELEASE"
LIBMOUNT_LT_MAJOR=1
LIBMOUNT_LT_MINOR=1
LIBMOUNT_LT_MICRO=0
LIBMOUNT_VERSION_INFO=`expr $LIBMOUNT_LT_MAJOR + $LIBMOUNT_LT_MINOR`:$LIBMOUNT_LT_MICRO:$LIBMOUNT_LT_MINOR
dnl libsmartcols version
LIBSMARTCOLS_VERSION="$PACKAGE_VERSION_MAJOR.$PACKAGE_VERSION_MINOR.$PACKAGE_VERSION_RELEASE"
LIBSMARTCOLS_LT_MAJOR=1
LIBSMARTCOLS_LT_MINOR=1
LIBSMARTCOLS_LT_MICRO=0
LIBSMARTCOLS_VERSION_INFO=`expr $LIBSMARTCOLS_LT_MAJOR + $LIBSMARTCOLS_LT_MINOR`:$LIBSMARTCOLS_LT_MICRO:$LIBSMARTCOLS_LT_MINOR
dnl libfdisk version
LIBFDISK_VERSION="$PACKAGE_VERSION_MAJOR.$PACKAGE_VERSION_MINOR.$PACKAGE_VERSION_RELEASE"
LIBFDISK_LT_MAJOR=1
LIBFDISK_LT_MINOR=1
LIBFDISK_LT_MICRO=0
LIBFDISK_VERSION_INFO=`expr $LIBFDISK_LT_MAJOR + $LIBFDISK_LT_MINOR`:$LIBFDISK_LT_MICRO:$LIBFDISK_LT_MINOR
# Check whether exec_prefix=/usr:
AS_CASE([$exec_prefix:$prefix],
[NONE:NONE | NONE:/usr | /usr:*],
[AC_MSG_NOTICE([Default --exec-prefix detected.])
AS_CASE([$bindir], ['${exec_prefix}/bin'], [bindir=/bin; AC_MSG_NOTICE([ --bindir defaults to /bin]) ])
AS_CASE([$sbindir], ['${exec_prefix}/sbin'], [sbindir=/sbin; AC_MSG_NOTICE([ --sbindir defaults to /sbin])])
AS_CASE([$libdir], ['${exec_prefix}/lib'], [libdir=/lib; AC_MSG_NOTICE([ --libdir defaults to /lib]) ])
AS_CASE([$libdir], ['${exec_prefix}/lib64'],[libdir=/lib64; AC_MSG_NOTICE([ --libdir defaults to /lib64]) ])
]
)
# Check whether prefix=/usr
AS_CASE([$prefix],
[NONE | /usr],
[AC_MSG_NOTICE([Default --prefix detected.])
AS_CASE([$localstatedir], [NONE | '${prefix}/var' | "${prefix}"/var ],
[localstatedir=/var; AC_MSG_NOTICE([ --localstatedir defaults to /var])])
AS_CASE([$sysconfdir], [NONE | '${prefix}/etc' | "${prefix}"/etc ],
[sysconfdir=/etc; AC_MSG_NOTICE([ --sysconfdir defaults to /etc])])
]
)
# default for old versions without $runstatedir
AS_IF([test x"$runstatedir" = x], [runstatedir='${localstatedir}/run'])
# our default if $localstatedir unchanged
AS_CASE([$localstatedir:$runstatedir],
[NONE:'${localstatedir}/run' | /var:'${localstatedir}/run' | NONE:'/run' ],
[runstatedir=/run; AC_MSG_NOTICE([ --runstatedir defaults to /run])]
)
AC_SUBST([runstatedir])
# The original default values of {bin,sbin,lib}dir
usrbin_execdir='${exec_prefix}/bin'
AC_SUBST([usrbin_execdir])
usrsbin_execdir='${exec_prefix}/sbin'
AC_SUBST([usrsbin_execdir])
AS_CASE([$libdir],
['${exec_prefix}/'* | '${prefix}/'* | /usr/* | "${prefix}"/* ],
[usrlib_execdir=$libdir],
[usrlib_execdir='${exec_prefix}'$libdir]
)
AC_SUBST([usrlib_execdir])
# static configuration maintaned by packages (e.g. /usr/lib)
AC_ARG_VAR([SYSCONFSTATICDIR],
[Path to static system configuration, default ${prefix}/lib])
AS_IF([test "x$SYSCONFSTATICDIR" = x],
[sysconfstaticdir='${prefix}/lib'],
[sysconfstaticdir=$SYSCONFSTATICDIR])
AC_SUBST([sysconfstaticdir])
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_MKDIR_P
AC_PROG_YACC
AC_CANONICAL_HOST
AC_C_CONST
AC_C_VOLATILE
AC_C_BIGENDIAN
dnl Compiler warnings
UL_WARN_ADD([-fno-common])
UL_WARN_ADD([-Wall])
UL_WARN_ADD([-Wextra])
UL_WARN_ADD([-Waddress-of-packed-member])
UL_WARN_ADD([-Wdiscarded-qualifiers])
UL_WARN_ADD([-Wembedded-directive])
UL_WARN_ADD([-Wextra-semi])
UL_WARN_ADD([-Wformat-security])
UL_WARN_ADD([-Wimplicit-function-declaration])
UL_WARN_ADD([-Wmissing-declarations])
UL_WARN_ADD([-Wmissing-parameter-type])
UL_WARN_ADD([-Wmissing-prototypes])
UL_WARN_ADD([-Wnested-externs])
UL_WARN_ADD([-Wno-missing-field-initializers])
UL_WARN_ADD([-Wpointer-arith])
UL_WARN_ADD([-Wredundant-decls])
UL_WARN_ADD([-Wsign-compare])
UL_WARN_ADD([-Wstrict-prototypes])
UL_WARN_ADD([-Wtype-limits])
UL_WARN_ADD([-Wuninitialized])
UL_WARN_ADD([-Wunused-but-set-parameter])
UL_WARN_ADD([-Wunused-but-set-variable])
UL_WARN_ADD([-Wunused-parameter])
UL_WARN_ADD([-Wunused-result])
UL_WARN_ADD([-Wunused-variable])
AC_ARG_ENABLE([werror],
AS_HELP_STRING([--enable-werror], [make all compiler warnings into errors]),
[], [enable_werror=no]
)
AS_IF([test "x$enable_werror" = xyes], [
UL_WARN_ADD([-Werror])
],[
UL_WARN_ADD([-Werror=sequence-point])
])
AC_SUBST([WARN_CFLAGS])
UL_WARN_ADD([-Wno-clobbered], [BSD_WARN_CFLAGS])
AC_SUBST([BSD_WARN_CFLAGS])
UL_WARN_ADD([-Wno-cast-function-type], [PYTHON_WARN_CFLAGS])
AC_SUBST([PYTHON_WARN_CFLAGS])
UL_WARN_ADD([-Wno-unused-parameter], [NO_UNUSED_WARN_CFLAGS])
AC_SUBST([NO_UNUSED_WARN_CFLAGS])
AC_ARG_ENABLE([asan],
AS_HELP_STRING([--enable-asan], [compile with Address Sanitizer]),
[], [enable_asan=no]
)
AS_IF([test "x$enable_asan" = xyes], [
UL_WARN_ADD([-fsanitize=address])
ASAN_LDFLAGS="-fsanitize=address"
])
AC_SUBST([ASAN_LDFLAGS])
AC_ARG_ENABLE([ubsan],
AS_HELP_STRING([--enable-ubsan], [compile with UBsan]),
[], [enable_ubsan=no]
)
AS_IF([test "x$enable_ubsan" = xyes], [
UL_WARN_ADD([-fsanitize=undefined])
UBSAN_LDFLAGS="-fsanitize=undefined"
])
AC_SUBST([UBSAN_LDFLAGS])
AC_ARG_ENABLE([fuzzing-engine],
AS_HELP_STRING([--enable-fuzzing-engine], [compile with fuzzing engine]),
[], [enable_fuzzing_engine=no]
)
AS_IF([test "x$enable_fuzzing_engine" = xyes && test "x$LIB_FUZZING_ENGINE" = x], [
UL_WARN_ADD([-fno-omit-frame-pointer])
UL_WARN_ADD([-gline-tables-only])
UL_WARN_ADD([-fsanitize=fuzzer-no-link])
FUZZING_ENGINE_LDFLAGS="-fsanitize=fuzzer-no-link"
])
AC_SUBST([FUZZING_ENGINE_LDFLAGS])
AC_PROG_CXX
AM_CONDITIONAL([FUZZING_ENGINE], [test "x$enable_fuzzing_engine" = xyes])
AM_CONDITIONAL([OSS_FUZZ], [test "x$LIB_FUZZING_ENGINE" != x])
dnl libtool-2
LT_INIT
dnl check supported linker flags
AX_CHECK_VSCRIPT
m4_ifndef([PKG_PROG_PKG_CONFIG],
[m4_fatal([Could not locate the pkg-config autoconf
macros. These are usually located in /usr/share/aclocal/pkg.m4.
If your macros are in a different location, try setting the
environment variable AL_OPTS="-I/other/macro/dir" before running
./autogen.sh or autoreconf again. Make sure pkg-config is installed.])])
PKG_PROG_PKG_CONFIG
PKG_INSTALLDIR(['${usrlib_execdir}/pkgconfig'])
GTK_DOC_CHECK([1.10])
AC_PATH_PROG([XSLTPROC], [xsltproc])
linux_os=no
bsd_os=no
AS_CASE([${host_os}],
[*linux*],
[linux_os=yes],
[*darwin*],
[darwin_os=yes],
[*bsd*],
[bsd_os=yes])
AM_CONDITIONAL([LINUX], [test "x$linux_os" = xyes])
AM_CONDITIONAL([DARWIN], [test "x$darwin_os" = xyes])
AM_CONDITIONAL([BSD], [test "x$bsd_os" = xyes])
AS_IF([test "x$darwin_os" = xyes], [
AC_DEFINE([_DARWIN_C_SOURCE], [1], [Enable MAP_ANON in sys/mman.h on Mac OS X])
])
dnl define ARCH_<NAME> conditionals
UL_SET_ARCH([I86], [i?86-*])
UL_SET_ARCH([86_64], [x86_64*])
UL_SET_ARCH([IA64], [ia64*])
UL_SET_ARCH([S390], [s390*])
UL_SET_ARCH([SPARC], [sparc*])
UL_SET_ARCH([PPC], [ppc*|powerpc*])
UL_SET_ARCH([M68K], [m68*])
UL_SET_ARCH([MIPS], [mips*])
UL_SET_ARCH([HPPA], [hppa*|parisc*])
AC_SYS_LARGEFILE
AC_HEADER_ASSERT
AC_STRUCT_TIMEZONE
dnl Don't forget to maintain alternatively allowed versions in autogen.sh!
AM_GNU_GETTEXT_VERSION([0.18.3])
AM_GNU_GETTEXT([external])
AS_IF([test -d "$srcdir/po"], [
ALL_LINGUAS=`cd $srcdir/po > /dev/null && echo *.po | sed 's/\.po//g'`
], [dnl echo $ALL_LINGUAS | sed 's/ /\n/g' | sort -u | column -xc 72 -o ' ' | sed 's/^/\t/'
ALL_LINGUAS="
af am ar as be bg bn bn_IN ca
cs cy da de el en_GB es et eu_ES
fa fi fr gl gu he hi hr hu
hy id is it ja ka kn ko ku
lo lt lv mk ml mr ms my nb
nl nn no nso or pa pl pt pt_BR
ro ru si sk sl sq sr sr@Latn sv
ta te th tr uk ur vi zh_CN zh_TW
zu
"])
AC_CHECK_HEADERS([linux/compiler.h linux/blkpg.h linux/major.h], [], [], [
#ifdef HAVE_LINUX_COMPILER_H
#include <linux/compiler.h>
#endif
])
AC_CHECK_HEADERS([ \
asm/io.h \
byteswap.h \
endian.h \
err.h \
errno.h \
fcntl.h \
getopt.h \
inttypes.h \
lastlog.h \
libutil.h \
linux/blkzoned.h \
linux/btrfs.h \
linux/capability.h \
linux/cdrom.h \
linux/falloc.h \
linux/fd.h \
linux/fiemap.h \
linux/kcmp.h \
linux/net_namespace.h \
linux/nsfs.h \
linux/raw.h \
linux/securebits.h \
linux/tiocl.h \
linux/version.h \
linux/watchdog.h \
linux/if_alg.h \
locale.h \
mntent.h \
net/if_dl.h \
net/if.h \
netinet/in.h \
paths.h \
pty.h \
security/pam_appl.h \
shadow.h \
stdint.h \
stdio_ext.h \
stdlib.h \
sys/disk.h \
sys/disklabel.h \
sys/endian.h \
sys/file.h \
sys/ioccom.h \
sys/ioctl.h \
sys/io.h \
sys/mkdev.h \
sys/mount.h \
sys/param.h \
sys/prctl.h \
sys/resource.h \
sys/sendfile.h \
sys/signalfd.h \
sys/socket.h \
sys/sockio.h \
sys/stat.h \
sys/swap.h \
sys/syscall.h \
sys/sysmacros.h \
sys/time.h \
sys/timex.h \
sys/ttydefaults.h \
sys/types.h \
sys/ucred.h \
sys/un.h \
sys/xattr.h \
unistd.h \
utmp.h \
utmpx.h \
])
# There is a collision in old kernel-headers. The both files mount.h and fs.h
# define MS_* macros. Fixed by kernel commit e462ec50cb5fad19f6003a3d8087f4a0945dd2b1.
#
AC_CHECK_HEADERS([linux/fs.h ], [], [],
[#ifdef HAVE_SYS_MOUNT_H
# include <linux/fs.h>
# include <sys/mount.h>
#endif
])
AC_CHECK_HEADERS([linux/gsmmux.h ], [], [],
[#ifdef LINUX_GSMMUX_H
# include <linux/gsmmux.h>
#endif
])
AC_CHECK_HEADERS([security/pam_misc.h],
[AM_CONDITIONAL([HAVE_LINUXPAM], [true])],
[AM_CONDITIONAL([HAVE_LINUXPAM], [false])], [
#ifdef HAVE_SECURITY_PAM_APPL_H
#include <security/pam_appl.h>
#endif
])
AC_CHECK_DECLS([BLK_ZONE_REP_CAPACITY], [], [], [
#include <linux/blkzoned.h>
])
AC_CHECK_HEADERS([security/openpam.h], [], [], [
#ifdef HAVE_SECURITY_PAM_APPL_H
#include <security/pam_appl.h>
#endif
])
AC_CHECK_HEADERS([langinfo.h],
[AM_CONDITIONAL([HAVE_LANGINFO_H], [true])],
[AM_CONDITIONAL([HAVE_LANGINFO_H], [false])])
AC_MSG_CHECKING([whether langinfo.h defines ALTMON_x constants])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <langinfo.h>
]], [[
char *str;
str = nl_langinfo (ALTMON_1);
str = nl_langinfo (ALTMON_2);
str = nl_langinfo (ALTMON_3);
str = nl_langinfo (ALTMON_4);
str = nl_langinfo (ALTMON_5);
str = nl_langinfo (ALTMON_6);
str = nl_langinfo (ALTMON_7);
str = nl_langinfo (ALTMON_8);
str = nl_langinfo (ALTMON_9);
str = nl_langinfo (ALTMON_10);
str = nl_langinfo (ALTMON_11);
str = nl_langinfo (ALTMON_12);
]])], [
AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_LANGINFO_ALTMON], [1],
[Define if langinfo.h defines ALTMON_x constants])
], [
AC_MSG_RESULT([no])
])
AC_MSG_CHECKING([whether langinfo.h defines _NL_ABALTMON_x constants])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <langinfo.h>
]], [[
char *str;
str = nl_langinfo (_NL_ABALTMON_1);
str = nl_langinfo (_NL_ABALTMON_2);
str = nl_langinfo (_NL_ABALTMON_3);
str = nl_langinfo (_NL_ABALTMON_4);
str = nl_langinfo (_NL_ABALTMON_5);
str = nl_langinfo (_NL_ABALTMON_6);
str = nl_langinfo (_NL_ABALTMON_7);
str = nl_langinfo (_NL_ABALTMON_8);
str = nl_langinfo (_NL_ABALTMON_9);
str = nl_langinfo (_NL_ABALTMON_10);
str = nl_langinfo (_NL_ABALTMON_11);
str = nl_langinfo (_NL_ABALTMON_12);
]])], [
AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_LANGINFO_NL_ABALTMON], [1],
[Define if langinfo.h defines _NL_ABALTMON_x constants])
], [
AC_MSG_RESULT([no])
])
dnl Convert some ac_cv_header_* variables to have_*
dnl
have_linux_blkzoned_h=$ac_cv_header_linux_blkzoned_h
have_linux_btrfs_h=$ac_cv_header_linux_btrfs_h
have_linux_capability_h=$ac_cv_header_linux_capability_h
have_linux_kcmp_h=$ac_cv_header_linux_kcmp_h
have_linux_raw_h=$ac_cv_header_linux_raw_h
have_linux_securebits_h=$ac_cv_header_linux_securebits_h
have_linux_version_h=$ac_cv_header_linux_version_h
have_linux_watchdog_h=$ac_cv_header_linux_watchdog_h
have_pty_h=$ac_cv_header_pty_h
have_security_openpam_h=$ac_cv_header_security_openpam_h
have_security_pam_appl_h=$ac_cv_header_security_pam_appl_h
have_security_pam_misc_h=$ac_cv_header_security_pam_misc_h
have_shadow_h=$ac_cv_header_shadow_h
have_sys_signalfd_h=$ac_cv_header_sys_signalfd_h
have_utmpx_h=$ac_cv_header_utmpx_h
have_mntent_h=$ac_cv_header_mntent_h
AS_CASE([$linux_os:$have_linux_version_h],
[yes:no],
[AC_MSG_ERROR([kernel headers required on Linux])]
)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <time.h>
#include <unistd.h>
]], [[
int a = 0;
struct tm *tm = localtime(0);
if (a == -1) /* false */
sleep(tm->tm_gmtoff);
]])],
[AC_DEFINE([HAVE_TM_GMTOFF], [1], [Does struct tm have a field tm_gmtoff?])
])
AC_CHECK_MEMBERS([struct termios.c_line],,,
[[#include <termios.h>]])
AC_CHECK_MEMBERS([struct stat.st_mtim.tv_nsec],,,
[#include <sys/stat.h>])
AC_CHECK_DECLS([_NL_TIME_WEEK_1STDAY],[],[],[[#include <langinfo.h>]])
AC_CHECK_DECL([environ],
[AC_DEFINE([HAVE_ENVIRON_DECL], [1],
[Define to 1 if have **environ prototype])],
)
AC_CHECK_DECL([strsignal],
[AC_DEFINE([HAVE_STRSIGNAL_DECL], [1],
[Define to 1 if have strsignal function prototype])],
)
AC_CHECK_DECL([TIOCGLCKTRMIOS],
[have_tiocglcktrmios=yes], [have_tiocglcktrmios=no],
[#include <sys/ioctl.h>])
AC_CHECK_DECL([SOCK_CLOEXEC],
[have_sock_cloexec=yes], [have_sock_cloexec=no],
[#include <sys/types.h>
#include <sys/socket.h>])
AC_CHECK_DECL([SOCK_NONBLOCK],
[have_sock_nonblock=yes], [have_sock_nonblock=no],
[#include <sys/types.h>
#include <sys/socket.h>])
AC_CHECK_DECL([SO_PASSCRED],
[have_so_passcred=yes], [have_so_passcred=no],
[#include <sys/types.h>
#include <sys/socket.h>])
AC_CHECK_FUNCS([ \
clearenv \
close_range \
eaccess \
err \
errx \
explicit_bzero \
__fpending \
__fpurge \
fpurge \
fsync \
getdomainname \
getdtablesize \
getexecname \
getmntinfo \
getrandom \
getrlimit \
getsgnam \
getttynam \
inotify_init \
jrand48 \
lchown \
lgetxattr \
llistxattr \
llseek \
newlocale \
mempcpy \
mkostemp \
nanosleep \
ntp_gettime \
personality \
pidfd_open \
pidfd_send_signal \
posix_fadvise \
prctl \
qsort_r \
rpmatch \
scandirat \
sched_setattr \
sched_setscheduler \
__secure_getenv \
secure_getenv \
sendfile \
setprogname \
setresgid \
setresuid \
sigqueue \
srandom \
strnchr \
strndup \
strnlen \
strtod_l \
sysconf \
sysinfo \
timegm \
usleep \
uselocale \
utimensat \
vwarnx \
warn \
warnx \
])
AC_FUNC_FSEEKO
AC_CHECK_FUNCS([futimens], [have_futimens=yes])
AC_CHECK_FUNCS([getusershell], [have_getusershell=yes],[have_getusershell=no])
AC_CHECK_FUNCS([inotify_init1], [have_inotify_init1=yes])
AC_CHECK_FUNCS([ioperm iopl], [have_io=yes])
AC_CHECK_FUNCS([openat fstatat unlinkat], [have_openat=yes], [have_openat=no])
AC_CHECK_FUNCS([open_memstream], [have_open_memstream=yes],[have_open_memstream=no])
AC_CHECK_FUNCS([reboot], [have_reboot=yes],[have_reboot=no])
AC_CHECK_FUNCS([updwtmpx updwtmpx], [have_gnu_utmpx=yes], [have_gnu_utmpx=no])
AM_CONDITIONAL([HAVE_OPENAT], [test "x$have_openat" = xyes])
have_setns_syscall="yes"
UL_CHECK_SYSCALL([setns])
AS_IF([test "x$ul_cv_syscall_setns" = xno], [
have_setns_syscall="no"
])
UL_CHECK_SYSCALL([pidfd_open])
UL_CHECK_SYSCALL([pidfd_send_signal])
UL_CHECK_SYSCALL([close_range])
AC_CHECK_FUNCS([isnan], [],
[AC_CHECK_LIB([m], [isnan], [MATH_LIBS="-lm"])]
[AC_CHECK_LIB([m], [__isnan], [MATH_LIBS="-lm"])]
)
AC_SUBST([MATH_LIBS])
dnl lib/mononotic.c may require -lrt
AC_CHECK_FUNCS([clock_gettime], [],
[AC_CHECK_LIB([rt], [clock_gettime], [REALTIME_LIBS="-lrt"])]
)
have_timer="no"
AC_CHECK_FUNCS([timer_create],
[have_timer="yes"],
[AC_CHECK_LIB([rt], [timer_create], [
have_timer="yes"
REALTIME_LIBS="-lrt"
AC_DEFINE_UNQUOTED([HAVE_TIMER_CREATE], [1], [Define if timer_create exist in -lrt])
],[
AC_SEARCH_LIBS([timer_create], [rt], [
AC_MSG_RESULT(yes)
have_timer="yes"
REALTIME_LIBS="-lrt -lpthread"
AC_DEFINE_UNQUOTED([HAVE_TIMER_CREATE], [1], [Define if timer_create exist in -lrt -lpthread])
],[], [-lpthread]
)
])]
)
AC_SUBST([REALTIME_LIBS])
AS_IF([test x"$have_timer" = xno], [
AC_CHECK_FUNCS([setitimer], [have_timer="yes"], [have_timer="no"])
])
AC_CHECK_LIB([rtas], [rtas_get_sysparm], [
RTAS_LIBS="-lrtas"
AC_DEFINE_UNQUOTED([HAVE_LIBRTAS], [1], [Define if librtas exists]), [],
])
AC_SUBST([RTAS_LIBS])
AC_CHECK_MEMBER([struct sockaddr.sa_len],
AC_DEFINE_UNQUOTED([HAVE_SA_LEN], [1], [Define if struct sockaddr contains sa_len]), [],
[#include <sys/types.h>
#include <sys/socket.h>])
SOCKET_LIBS=
AC_SEARCH_LIBS([socket], [socket],
[AS_IF([test x"$ac_cv_search_socket" != x"none required"],
[SOCKET_LIBS="$SOCKET_LIBS -lsocket"])
])
AC_SUBST([SOCKET_LIBS])
have_dirfd=no
AC_CHECK_FUNCS([dirfd], [have_dirfd=yes], [have_dirfd=no])
AS_IF([test x"$have_dirfd" = xno], [
AC_CHECK_DECLS([dirfd],
[have_dirfd=yes], [have_dirfd=no],
[#include <sys/types.h>
#include <dirent.h>])
])
have_ddfd=no
AS_IF([test x"$have_dirfd" = xno], [
AC_CHECK_MEMBERS([DIR.dd_fd],
[have_ddfd=yes], [have_ddfd=no],
[#include <sys/types.h>
#include <dirent.h>])
])
AM_CONDITIONAL([HAVE_DIRFD], [test "x$have_dirfd" = xyes || test "x$have_ddfd" = xyes])
AC_MSG_CHECKING([whether program_invocation_short_name is defined])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <errno.h>
]], [[
program_invocation_short_name = "test";
]])], [
AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_PROGRAM_INVOCATION_SHORT_NAME], [1],
[Define if program_invocation_short_name is defined])
], [
AC_MSG_RESULT([no])
])
AC_MSG_CHECKING([whether __progname is defined])
AC_LINK_IFELSE([AC_LANG_PROGRAM([extern char *__progname;],
[if (*__progname == 0) return 1;])],
AC_DEFINE([HAVE___PROGNAME], [1], [Define if __progname is defined])
AC_MSG_RESULT([yes]),
AC_MSG_RESULT([no]))
dnl Static compilation
m4_define([UL_STATIC_PROGRAMS], [blkid, fdisk, losetup, mount, nsenter, sfdisk, umount, unshare])
AC_ARG_ENABLE([static-programs],
[AS_HELP_STRING([--enable-static-programs=LIST],
[link static the programs in LIST (comma-separated,
supported for ]m4_defn([UL_STATIC_PROGRAMS])[)])])
AS_CASE([$enable_static_programs],
[yes],
[enable_static_programs=m4_quote(UL_STATIC_PROGRAMS)],
[no],
[enable_static_programs=]
)
dnl Set all the individual AM_CONDITIONALs
m4_foreach([UL_PRG], m4_defn([UL_STATIC_PROGRAMS]), [
AS_CASE([,$enable_static_programs,],
[*,UL_PRG,*], [static_[]UL_PRG=yes]
)
AS_IF([test "x$static_[]UL_PRG" = xyes], [AC_MSG_NOTICE([enable static build: UL_PRG.])])
AM_CONDITIONAL([HAVE_STATIC_]m4_toupper(UL_PRG),
[test "x$static_[]UL_PRG" = xyes])
])
AC_ARG_ENABLE([all-programs],
AS_HELP_STRING([--disable-all-programs], [disable everything, might be overridden by --enable-<name>]),
[], [enable_all_programs=undefined]
)
AS_CASE([$enable_all_programs],
[yes], [AC_MSG_WARN([force to build all programs by default])
ul_default_estate=check],
[no], [AC_MSG_WARN([disable all programs and man pages by default])
ul_default_estate=no]
)
AC_ARG_ENABLE([asciidoc],
AS_HELP_STRING([--disable-asciidoc], [do not generate man pages from asciidoc]),
[], [UL_DEFAULT_ENABLE([asciidoc], [check])]
)
UL_BUILD_INIT([asciidoc])
UL_REQUIRES_PROGRAM([asciidoc], [ASCIIDOCTOR], [asciidoctor], [man pages])
AM_CONDITIONAL([ENABLE_ASCIIDOC], [test "x$build_asciidoc" = xyes])
have_manpages=no
AS_IF([test -f "$srcdir/sys-utils/mount.8"], [
AC_MSG_NOTICE([re-use already generated man-pages.])
have_manpages=yes]
)
AM_CONDITIONAL([HAVE_MANPAGES], [test "x$have_manpages" = xyes])
AC_ARG_ENABLE([poman],
AS_HELP_STRING([--enable-poman], [generate translated man pages]),
[], [enable_poman=no]
)
UL_BUILD_INIT([poman])
UL_REQUIRES_PROGRAM([poman], [PO4A], [po4a], [translated man pages])
AM_CONDITIONAL([ENABLE_POMAN], [test "x$build_poman" = xyes])
AX_CHECK_TLS
have_pty=no
AC_ARG_WITH([util], AS_HELP_STRING([--without-util], [compile without libutil]),
[], [with_util=auto]
)
AS_IF([test "x$with_util" = xno], [
AM_CONDITIONAL([HAVE_UTIL], [false])
have_util=no
], [
UL_CHECK_LIB([util], [openpty])
])
AS_IF([test "x$have_pty_h" = xyes && test "x$have_sys_signalfd_h" = xyes && test "x$have_util" = xyes], [
AM_CONDITIONAL([HAVE_PTY], [true])
AC_DEFINE([HAVE_PTY], [1], [have PTY support])
have_pty=yes
], [
AM_CONDITIONAL([HAVE_PTY], [false])
])
AC_CHECK_TYPES([union semun], [], [], [[
#include <sys/sem.h>
]])
AC_CHECK_TYPES([loff_t])
AC_ARG_ENABLE([widechar],
AS_HELP_STRING([--disable-widechar], [do not compile wide character support]),
[], [enable_widechar=check]
)
UL_BUILD_INIT([widechar])
UL_REQUIRES_COMPILE([widechar], [[
#include <wchar.h>
#include <wctype.h>
#include <stdio.h>
#include <stdlib.h>
]], [[
wchar_t wc;
wint_t w;
w = fgetwc(stdin);
if (w == WEOF) exit(1);
wc = w;
fputwc(wc,stdout);
]],
[wchar_t support])
AS_IF([test "x$build_widechar" = xyes ], [
AC_DEFINE([HAVE_WIDECHAR], [1], [Do we have wide character support?])
])
AC_CHECK_TYPES([cpu_set_t], [have_cpu_set_t=yes], [], [[
#include <sched.h>
]])
AM_CONDITIONAL([HAVE_CPU_SET_T], [test "x$have_cpu_set_t" = xyes])
AC_CHECK_TYPES([sighandler_t], [], [], [[
#include <signal.h>
]])
AC_CHECK_DECLS([CPU_ALLOC], [], [], [[
#include <sched.h>
]])
# on Solaris, you can't mix and match standards, since we use c99
# apparently at this stage, XOPEN_SOURCE will conflict. As workaround,
# check for crypt.h and use that without XOPEN_SOURCE.
have_crypt=no
AC_CHECK_HEADERS([crypt.h])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#ifdef HAVE_CRYPT_H
#include <crypt.h>
#else
#define _XOPEN_SOURCE
#include <unistd.h>
#endif
]], [[
char *c = crypt("abc","pw");
]])],[
have_libcrypt=no
have_crypt=yes
],[
UL_SET_LIBS([-lcrypt])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#ifdef HAVE_CRYPT_H
#include <crypt.h>
#else
#define _XOPEN_SOURCE
#include <unistd.h>
#endif
]], [[
char *c = crypt("abc","pw");
]])],[
have_libcrypt=yes
have_crypt=yes
],[
AC_MSG_WARN([crypt() is not available])
])
UL_RESTORE_LIBS
])
AM_CONDITIONAL([HAVE_LIBCRYPT], [test "x$have_libcrypt" = xyes])
AC_ARG_WITH([selinux],
AS_HELP_STRING([--with-selinux], [compile with SELinux support]),
[], [with_selinux=no]
)
AS_IF([test "x$with_selinux" = xno], [
AM_CONDITIONAL([HAVE_SELINUX], [false])
], [
PKG_CHECK_MODULES([SELINUX], [libselinux >= 2.5], [have_selinux=yes], [have_selinux=no])
AS_CASE([$with_selinux:$have_selinux],
[yes:no], [AC_MSG_ERROR([SELinux selected but libselinux not found or too old])]
)
AS_IF([test "x$have_selinux" = xyes], [
AC_DEFINE([HAVE_LIBSELINUX], [1], [Define if SELinux is available])
UL_PKG_STATIC([SELINUX_LIBS_STATIC], [libselinux])
AM_CONDITIONAL([HAVE_SELINUX], [true])
UL_SET_LIBS([$SELINUX_LIBS])
# This function is missing in old libselinux 1.xx versions
AC_CHECK_FUNCS([security_get_initial_context])
UL_RESTORE_LIBS
])
])
AC_SUBST([SELINUX_LIBS])
AC_SUBST([SELINUX_LIBS_STATIC])
AC_ARG_WITH([audit],
AS_HELP_STRING([--with-audit], [compile with audit support]),
[], [with_audit=no]
)
AS_IF([test "x$with_audit" = xno], [
AM_CONDITIONAL([HAVE_AUDIT], [false])
], [
UL_CHECK_LIB([audit], [audit_log_user_message])
AS_CASE([$with_audit:$have_audit],
[yes:no],
[AC_MSG_ERROR([Audit selected but libaudit not found (or does not support audit_log_user_message())])]
)
])
AC_ARG_WITH([udev], AS_HELP_STRING([--without-udev], [compile without udev support]),
[], [with_udev=auto]
)
AS_IF([test "x$with_udev" = xno], [
AM_CONDITIONAL([HAVE_UDEV], [false])
], [
UL_CHECK_LIB([udev], [udev_new])
AS_CASE([$with_udev:$have_udev],
[yes:no],
[AC_MSG_ERROR([udev selected but libudev not found])]
)
])
dnl wide-char ncurses
AC_ARG_WITH([ncursesw],
AS_HELP_STRING([--without-ncursesw], [do not build with wide-char ncurses]),
[], [with_ncursesw=auto]
)
have_ncursesw=no
have_ncursesw_header=no
AS_IF([test "x$with_ncursesw" != xno], [
UL_NCURSES_CHECK([ncursesw])
AS_IF([test "x$have_ncursesw" = xyes], [
AC_CHECK_HEADERS([ncursesw/ncurses.h], [have_ncursesw_header=yes])
AC_CHECK_HEADERS([ncursesw/term.h])
# Define HAVE_NCURSES_H only if check for HAVE_NCURSESW_NCURSES_H is
# unsuccessful to avoid too many *_H permitations in config.h
AS_IF([test "x$have_ncursesw_header" = xno], [
AC_CHECK_HEADERS([ncurses.h], [have_ncursesw_header=yes])
AC_CHECK_HEADERS([term.h])
])
AS_IF([test "x$have_ncursesw_header" = xno], [have_ncursesw=no])
])
AS_IF([test "x$have_ncursesw" = xyes], [
CURSES_LIB_NAME="ncursesw"
AC_DEFINE([HAVE_LIBNCURSESW], [1], [Define if ncursesw library available])
])
])
AS_CASE([$with_ncursesw:$have_ncursesw],
[yes:no], [AC_MSG_ERROR([ncursesw selected, but library not found])])
dnl non-wide ncurses
AC_ARG_WITH([ncurses],
AS_HELP_STRING([--with-ncurses], [build with non-wide ncurses]),
[], [with_ncurses=auto]
)
have_ncurses=no
have_ncurses_header=no
AS_CASE([$with_ncurses:$build_widechar],
[yes:yes], [AC_MSG_ERROR([wide-char support enabled, but non-wide ncurses selects])])
AS_IF([test "x$have_ncursesw" = xno && test "x$with_ncurses" != xno ], [
UL_NCURSES_CHECK([ncurses])
AS_IF([test "x$have_ncurses" = xyes], [
AC_CHECK_HEADERS([ncurses/ncurses.h], [have_ncurses_header=yes])
AC_CHECK_HEADERS([ncurses/term.h])
# Define HAVE_NCURSES_H only if check for HAVE_NCURSES_NCURSES_H is
# unsuccessful to avoid too many *_H permitations in config.h
AS_IF([test "x$have_ncurses_header" = xno], [
AC_CHECK_HEADERS([ncurses.h], [have_ncurses_header=yes])
AC_CHECK_HEADERS([term.h])
])
AS_IF([test "x$have_ncurses_header" = xno], [have_ncurses=no])
])
AS_IF([test "x$have_ncurses" = xyes], [
CURSES_LIB_NAME="ncurses"
AC_DEFINE([HAVE_LIBNCURSES], [1], [Define if ncurses library available])
])
])
AS_CASE([$with_ncurses:$have_ncurses],
[yes:no], [AC_MSG_ERROR([ncurses selected, but library not found])])
AC_SUBST([NCURSES_CFLAGS])
AC_SUBST([NCURSES_LIBS])
AM_CONDITIONAL([HAVE_NCURSES], [test "x$have_ncursesw" = xyes || test "x$have_ncurses" = xyes])
AC_ARG_WITH([slang],