-
Notifications
You must be signed in to change notification settings - Fork 185
/
configure.ac
1909 lines (1565 loc) · 60 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
dnl
dnl Copyright 2021 Northern.tech AS
dnl
dnl This file is part of CFEngine 3 - written and maintained by Northern.tech AS.
dnl
dnl This program is free software; you can redistribute it and/or modify it
dnl under the terms of the GNU General Public License as published by the
dnl Free Software Foundation; version 3.
dnl
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with this program; if not, write to the Free Software
dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
dnl
dnl To the extent this program is licensed as part of the Enterprise
dnl versions of CFEngine, the applicable Commercial Open Source License
dnl (COSL) may apply to this file if you as a licensee so wish it. See
dnl included file COSL.txt.
dnl
dnl ##########################################################################
dnl #
dnl # Build CFEngine
dnl #
dnl # Run ./autogen.sh to build configure script
dnl #
dnl ##########################################################################
AC_PREREQ(2.63)
m4_define([cfversion_from_env], m4_normalize(m4_esyscmd([echo $EXPLICIT_VERSION])))
m4_define([cfversion_from_file], m4_normalize(m4_esyscmd([cat CFVERSION])))
m4_ifval(cfversion_from_env, [
m4_define([cfversion], cfversion_from_env)
], [
m4_ifval(cfversion_from_file, [
m4_define([cfversion], cfversion_from_file)
], [
m4_fatal([Could not determine CFEngine version;
please set EXPLICIT_VERSION in the environment,
or make sure all git tags are up to date and rerun autogen.sh])
])
])
AC_INIT(cfengine, cfversion)
AC_CONFIG_SRCDIR([libpromises/generic_agent.c])
AC_CANONICAL_TARGET
dnl
dnl This program needs to be checked early, as MAKEINFO variable is expanded in
dnl AM_INIT_AUTOMAKE.
dnl
AC_CHECK_PROG(MAKEINFO, makeinfo, makeinfo)
dnl Parallel unit tests are causing spurious failures across several systems,
dnl particularly those doing process testing.
dnl Unfortunately the option to disable parallel tests (serial-tests) doesn't
dnl exist in automake 1.11 and earlier, so we need to do this complicated logic
dnl to determine whether we can disable it or not. If it doesn't exist as an
dnl option, then serial tests are already the default.
AC_MSG_CHECKING([automake version])
m4_define(AUTOMAKE_VERSION, m4_normalize(m4_esyscmd([automake --version 2>&1 | sed -ne '/^automake/{s/^automake.* \([^ ][^ ]*\)$/\1/; p;}'])))
m4_define(SERIAL_TESTS, m4_bmatch(AUTOMAKE_VERSION, [^1\.\([0-9]\|1[0-1]\)\(\.\|$\)], [], [serial-tests]))
AC_MSG_RESULT(AUTOMAKE_VERSION)
AM_INIT_AUTOMAKE([tar-ustar] SERIAL_TESTS)
AM_MAINTAINER_MODE([enable])
m4_divert_text([DEFAULTS], [: "${AR_FLAGS=cr}"])
cfengine_version=cfversion
m4_undefine([cfversion])
m4_undefine([cfversion_from_file])
m4_undefine([cfversion_from_env])
AS_IF([test -n "$RELEASE"],
[AC_DEFINE_UNQUOTED(RELEASE, ["$RELEASE"], [Release number])],
[AC_DEFINE(RELEASE, ["1"], [Release number])])
AC_DEFINE(BUILD_YEAR, esyscmd([date +%Y | tr -d '\n']), "Software build year")
AC_DEFINE(CF_WEBSITE, "https://cfengine.com", "Website. To be used in help screens")
AC_DEFINE(CF_COPYRIGHT, "2023 Northern.tech AS", "Copyright. To be used in help screens")
AC_DEFINE_UNQUOTED(ABS_TOP_SRCDIR,
"`cd -- "$srcdir"; pwd`",
[Absolute path of source tree])
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
AC_CONFIG_HEADERS([config.h])
dnl Libtool madness
AC_CONFIG_MACRO_DIR([m4])
dnl
dnl hide [s]include macros, so old aclocal (automake < 1.10) won't find them and
dnl won't complain about something/something.m4 not found
dnl
m4_define(incstart,sinc)
m4_define(incend,lude)
dnl
dnl Save environment CFLAGS before autoconf starts messing with it.
dnl It is restored later.
dnl
ENV_CFLAGS="$CFLAGS"
dnl ######################################################################
dnl Checks for programs.
dnl ######################################################################
AC_PROG_CC
AC_PROG_MKDIR_P
AC_EXEEXT
dnl GCC specific flags
m4_include([m4/cf3_gcc_flags.m4])
# Use either new LT_INIT or old AC_DISABLE_STATIC/AC_PROG_LIBTOOL macros
m4_ifdef([LT_INIT],
[LT_INIT([disable-static])],
[AC_DISABLE_STATIC
AC_PROG_LIBTOOL])
AM_PROG_LEX
AC_PROG_YACC
AC_PROG_INSTALL
AC_PATH_PROG([PERL], [perl])
AC_CONFIG_LIBOBJ_DIR(libcfecompat)
CFECOMPAT_CPPFLAGS="-I$srcdir/libcfecompat"
AC_PATH_PROG(GETCONF, getconf, false, $PATH:$prefix/bin:/usr/bin:/usr/local/bin:/sw/bin)
AM_CONDITIONAL(CROSS_COMPILING, test "x$cross_compiling" = "xyes")
# Check whether `pkg-config' is available
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config])
AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to the pkg-config search path])
AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's search path])
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
fi
dnl ######################################################################
dnl Use pthreads if available
dnl ######################################################################
AC_ARG_WITH([pthreads],
[AS_HELP_STRING([--with-pthreads[[=PATH]]],
[Specify path to pthreads, if not the part of operating system])])
if test "x$with_pthreads" != x && test "x$with_pthreads" != "xyes" && test "x$with_pthreads" != "xno"; then
LIBS="$LIBS -L$with_pthreads/lib"
CPPFLAGS="-I$with_pthreads/include $CPPFLAGS"
fi
ACX_PTHREAD([],
[AC_MSG_ERROR(pthread-compatible library is required to build CFEngine)])
CC="$PTHREAD_CC"
CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
LIBS="$PTHREAD_LIBS $LIBS"
dnl ######################################################################
dnl Whether to build extensions as builtin extensions or a separate
dnl plugin. The default is plugin.
dnl --enable-builtin-extensions is the default on Windows, and can be
dnl used on other platforms for debugging purposes, but isn't otherwise
dnl supported.
dnl ######################################################################
AC_ARG_ENABLE([builtin-extensions], [AS_HELP_STRING([Build binaries with builtin extensions])],
[],
[
AS_CASE([${target_os}], [mingw*], [enable_builtin_extensions=yes], [enable_builtin_extensions=no])
])
AM_CONDITIONAL([BUILTIN_EXTENSIONS], [test "x$enable_builtin_extensions" = "xyes"])
AS_IF([test "x$enable_builtin_extensions" = "xyes"], [AC_DEFINE([BUILTIN_EXTENSIONS], [1], [Define if you want builtin Enterprise extensions])])
AC_SUBST([enable_builtin_extensions])
dnl ######################################################################
dnl Configure files layout
dnl ######################################################################
AC_ARG_ENABLE([fhs],
[AS_HELP_STRING([--enable-fhs], [Enable FHS compliance. Defaults to custom CFEngine files layout])])
#
# pkglibdir/pkgdatadir are not overridable, so use our own invention instead.
#
AS_IF([test x"$enable_fhs" = xyes], [
projlibdir='${pkglibdir}'
WORKDIR='${localstatedir}/lib/${PACKAGE}'
MASTERDIR='default'
INPUTDIR='default'
DATADIR='default'
LOGDIR='${localstatedir}/log/${PACKAGE}'
PIDDIR='${runstatedir:-${localstatedir}/run}/${PACKAGE}'
STATEDIR='default'
], [
if test x"$prefix" = xNONE || test x"$prefix" = x/var/cfengine; then
prefix=/var/cfengine
case "$target_os" in
mingw*)
WORKDIR=$(cmd /c "echo %PROGRAMFILES%\\Cfengine" | sed 's/\\/\\\\/g')
MASTERDIR=default
INPUTDIR=default
DATADIR=default
LOGDIR=$(cmd /c "echo %PROGRAMFILES%\\Cfengine" | sed 's/\\/\\\\/g')
PIDDIR=$(cmd /c "echo %PROGRAMFILES%\\Cfengine" | sed 's/\\/\\\\/g')
STATEDIR=default
;;
*)
WORKDIR=/var/cfengine
MASTERDIR=default
INPUTDIR=default
DATADIR=default
LOGDIR=/var/cfengine
PIDDIR=/var/cfengine
STATEDIR=default
;;
esac
else
WORKDIR="${localstatedir}/${PACKAGE}"
MASTERDIR="default"
INPUTDIR="default"
DATADIR="default"
LOGDIR="${localstatedir}/${PACKAGE}"
PIDDIR="${localstatedir}/${PACKAGE}"
STATEDIR="default"
fi
bindir="${bindir:-${exec_prefix}/bin}"
projlibdir='${libdir}'
])
AC_SUBST(projlibdir)
dnl ######################################################################
dnl Platform specific compiler flags.
dnl ######################################################################
AS_CASE([${target_os}],
[mingw*],
# Disable printf format warnings, because our wrapper supports more
# flags than vanilla Windows version, so they are false positives.
[CFLAGS="$CFLAGS -Wno-format"])
AS_CASE([${target_os}], [mingw*], [AM_CONDITIONAL([WINDOWS], [true])], [AM_CONDITIONAL([WINDOWS], [false])])
dnl ######################################################################
dnl Enable debugging
dnl ######################################################################
AC_ARG_ENABLE(debug,
AS_HELP_STRING([--enable-debug], [Enable debugging]),
[debug=$enableval],
[debug=no])
AM_CONDITIONAL([NDEBUG], [test x"$debug" = x"no"])
dnl Even though CFLAGS should contain the command-line CFLAGS
dnl as last, some macro seem to messes the order up and insert
dnl its own optimisation flags as well. So we append ENV_CFLAGS
dnl at the end manually, causing a bit of flag duplication.
AC_MSG_CHECKING([for debug option])
if test x"$debug" = x"yes"
then
AC_MSG_RESULT(yes)
CFLAGS="$CFLAGS -g3 -O0 $ENV_CFLAGS"
else
AC_MSG_RESULT(no)
CFLAGS="$CFLAGS -O2 -DNDEBUG $ENV_CFLAGS"
fi
dnl ######################################################################
dnl Checks for libraries.
dnl ######################################################################
dnl Now check for database connectors
# TODO remove
AC_ARG_WITH([sql],
[AS_HELP_STRING([--with-sql[[=PATH]]],
[Enable SQL database connectors (deprecated, use \
--with[[out]]-postgresql and --with[[out]]-mysql instead)])
],
[with_postgresql=$with_sql; with_mysql=$with_sql],
[])
dnl PostgreSQL
AC_ARG_WITH([postgresql],
[AS_HELP_STRING([--with-postgresql[[=PATH]]],
[Enable PostgreSQL connector])
],
[],
[with_postgresql=check])
if test "x$with_postgresql" != "xno"
then
if test "x$with_postgresql" != xyes && test "x$with_postgresql" != xcheck
then
PG_CONFIG=$with_postgresql/bin/pg_config
else
PG_CONFIG=pg_config
fi
# pg_config is only for native builds
if test "x$cross_compiling" = "xno"
then
if test x`which $PG_CONFIG` != x
then
pg_include_dir=`$PG_CONFIG --includedir`
if test -n "$pg_include_dir"
then
POSTGRESQL_CPPFLAGS="-I$pg_include_dir"
fi
fi
fi
CF3_WITH_LIBRARY(postgresql,
[AC_CHECK_LIB(pq, PQconnectdb,
[],
[if test "x$with_postgresql" != xcheck; then
AC_MSG_ERROR(Cannot find PostgreSQL client library); fi]
)
AC_CHECK_HEADERS(libpq-fe.h,
[],
[if test "x$with_postgresql" != xcheck; then
AC_MSG_ERROR(Cannot find PostgreSQL client library); fi]
)]
)
fi
dnl MySQL
AC_ARG_WITH([mysql],
[AS_HELP_STRING([--with-mysql[[=PATH]]],
[Enable MySQL connector])
],
[],
[with_mysql=check])
if test "x$with_mysql" != "xno"
then
if test "x$with_mysql" != xyes &&
test "x$with_mysql" != xcheck
then
MYSQL_CONFIG=$with_mysql/bin/mysql_config
else
MYSQL_CONFIG=mysql_config
fi
# mysql_config is only for native builds
if test "x$cross_compiling" = "xno"
then
if test x`which $MYSQL_CONFIG` != x
then
mysql_include_dir=`$MYSQL_CONFIG --include`
if test -n "$mysql_include_dir"
then
MYSQL_CPPFLAGS="$mysql_include_dir"
fi
fi
fi
CF3_WITH_LIBRARY(mysql,
[AC_CHECK_LIB(mysqlclient, mysql_real_connect,
[],
[if test "x$with_mysql" != xcheck; then
AC_MSG_ERROR(Cannot find MySQL client library); fi]
)
AC_CHECK_HEADERS(mysql.h,
[],
[if test "x$with_mysql" != xcheck; then
AC_MSG_ERROR(Cannot find MySQL clientlibrary); fi]
)
AC_CHECK_LIB(mysqlclient, EVP_CIPHER_CTX_init,
[AC_MSG_ERROR([MySQL client library exports symbols clashing \
with OpenSSL. Get the update from distribution provider, \
recompile MySQL library or disable MySQL connector. See \
http://bugs.mysql.com/bug.php?id=65055 for details.])
]
)]
)
fi
dnl
dnl In-process databases
dnl
dnl QDBM
AC_ARG_WITH([qdbm],
[AS_HELP_STRING([--with-qdbm[[=PATH]]], [use QDBM to store runtime data])])
AS_IF([test -n "$with_qdbm" && test "x$with_qdbm" != "xno"], [WITH_QDBM=1], [WITH_QDBM=0])
if test $WITH_QDBM = 1; then
CF3_WITH_LIBRARY(qdbm, [
AC_CHECK_LIB(qdbm, dpopen, [], [AC_MSG_ERROR(Cannot find QDBM)])
AC_CHECK_HEADERS(qdbm/depot.h, [], [AC_MSG_ERROR(Cannot find QDBM)])
AC_DEFINE(QDB, 1, [Define if QDBM is available])
])
fi
dnl Tokyo Cabinet
AC_ARG_WITH([tokyocabinet],
[AS_HELP_STRING([--with-tokyocabinet[[=PATH]]], [use Tokyo Cabinet to store runtime data])])
AS_IF([test $WITH_QDBM -eq 0 && test -n "$with_tokyocabinet" && test "x$with_tokyocabinet" != "xno"], [WITH_TOKYO=1], [WITH_TOKYO=0])
if test $WITH_TOKYO = 1; then
CF3_WITH_LIBRARY(tokyocabinet, [
AC_CHECK_LIB(tokyocabinet, tchdbnew, [], [AC_MSG_ERROR(Cannot find Tokyo Cabinet)])
AC_CHECK_HEADERS(tcutil.h, [], [AC_MSG_ERROR(Cannot find Tokyo Cabinet)])
AC_CHECK_HEADERS(tchdb.h, [], [AC_MSG_ERROR(Cannot find Tokyo Cabinet)])
AC_DEFINE(TCDB, 1, [Define if Tokyo Cabinet is available.])
])
fi
dnl OpenLDAP Lightning MDB
AC_ARG_WITH([lmdb],
[AS_HELP_STRING([--with-lmdb[[=PATH]]], [use Lightning MDB to store runtime data])])
AS_IF([test $WITH_TOKYO -eq 0 && test $WITH_QDBM -eq 0 && (! test -n "$with_lmdb" || test "x$with_lmdb" != "xno")], [WITH_LMDB=1], [WITH_LMDB=0])
if test $WITH_LMDB = 1; then
CF3_WITH_LIBRARY(lmdb, [
AC_CHECK_LIB(lmdb, mdb_dbi_open, [], [AC_MSG_ERROR(Cannot find Lightning MDB)])
AC_CHECK_HEADERS(lmdb.h, [], [AC_MSG_ERROR(Cannot find Lightning MDB)])
AC_DEFINE(LMDB, 1, [Define if Lightning MDB is available])
])
fi
if test $WITH_QDBM -eq 0 && test $WITH_TOKYO -eq 0 && test $WITH_LMDB -eq 0; then
AC_MSG_ERROR(Either Tokyo Cabinet, LMDB, or QDBM must be selected to compile CFEngine)
fi
dnl
dnl OpenSSL
dnl
AC_ARG_WITH(openssl,
[AS_HELP_STRING([--with-openssl[[=PATH]]],
[Specify OpenSSL path])], [], [with_openssl=yes])
if test x"$with_openssl" = xno ; then
AC_MSG_ERROR([This release of CFEngine requires OpenSSL >= 0.9.7])
fi
if test -d /usr/local/Cellar/ && \
test -d /usr/local/opt/openssl/ && \
test "x$with_openssl" = "xyes" ; then
with_openssl=$(brew --prefix openssl)
echo "OS X Homebrew detected"
echo "Defaulting to: --with-openssl=$with_openssl"
fi
CF3_WITH_LIBRARY(openssl, [
AC_CHECK_LIB(crypto, RSA_generate_key_ex, [], [])
AC_CHECK_LIB(ssl, SSL_free, [], [])
AC_CHECK_DECLS([SSL_CTX_clear_options], [], [], [[#include <openssl/ssl.h>]])
AC_CHECK_HEADERS([openssl/opensslv.h], [], [AC_MSG_ERROR(Cannot find OpenSSL)])
AC_MSG_CHECKING(for OpenSSL version)
AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
#include <openssl/opensslv.h>
#if OPENSSL_VERSION_NUMBER < 0x1000000fL
#This OpenSSL is too old
#endif
]])],[AC_MSG_RESULT(OK)],[AC_MSG_ERROR(This release of CFEngine requires OpenSSL >= 1.0.0)])
if test "x$ac_cv_lib_crypto_RSA_generate_key_ex" = "xno" ; then
AC_MSG_ERROR(Cannot find OpenSSL)
fi
AC_DEFINE([OPENSSL_SUPPRESS_DEPRECATED], [1], [Suppress deprecation warnings from OpenSSL 3])
AC_CHECK_DECL([SSL_OP_NO_TLSv1_1],
[AC_DEFINE([HAVE_TLS_1_1], [1], [Define if TLS 1.1 is supported by OpenSSL])],
[], [[#include <openssl/ssl.h>]]
)
AC_CHECK_DECL([SSL_OP_NO_TLSv1_2],
[AC_DEFINE([HAVE_TLS_1_2], [1], [Define if TLS 1.2 is supported by OpenSSL])],
[], [[#include <openssl/ssl.h>]]
)
AC_CHECK_DECL([SSL_OP_NO_TLSv1_3],
[AC_DEFINE([HAVE_TLS_1_3], [1], [Define if TLS 1.3 is supported by OpenSSL])],
[], [[#include <openssl/ssl.h>]]
)
])
dnl PCRE2
AC_ARG_WITH([pcre2], [AS_HELP_STRING([--with-pcre2[[=PATH]]], [Specify PCRE2 path])], [], [with_pcre2=yes])
if test "x$with_pcre2" = "xno"; then
AC_MSG_ERROR([PCRE2 is required])
fi
CF3_WITH_LIBRARY(pcre2, [
AC_CHECK_LIB(pcre2-8, pcre2_compile_8, [], [AC_MSG_ERROR(Cannot find PCRE2)])
AC_CHECK_HEADERS(
[pcre2.h],
[],
AC_MSG_ERROR(Cannot find PCRE2),
[#define PCRE2_CODE_UNIT_WIDTH 8]
)]
)
dnl defined for libntech
AC_DEFINE(WITH_PCRE2, 1, [Define if PCRE2 is being used])
dnl libvirt
AC_ARG_WITH([libvirt],
[AS_HELP_STRING([--with-libvirt[[=PATH]]], [support virtual machine management])],
[], [with_libvirt=check])
if test "x$with_libvirt" != xno
then
CF3_WITH_LIBRARY(libvirt, [
AC_CHECK_LIB(virt, virConnectOpen, [], [if test "x$with_libvirt" != xcheck; then AC_MSG_ERROR(Cannot find libvirt library); fi])
AC_CHECK_HEADERS(libvirt/libvirt.h, [], [if test "x$with_libvirt" != xcheck; then AC_MSG_ERROR(Cannot find libvirt library headers); fi])
])
fi
dnl BIG FAT WARNING FOR AC_CHECK_LIB: *always* leave the
dnl "action-if-yes" parameter empty else LIBS is not changed and C
dnl define is not generated! Or use AC_SEARCH_LIBS for a better
dnl interface.
dnl libacl
dnl It is enough for any of the header files [acl.h sys/acl.h acl/libacl.h] to be present
AC_ARG_WITH([libacl],
[AS_HELP_STRING([--with-libacl[[=PATH]]], [Specify libacl path])], [], [with_libacl=check])
if test "x$with_libacl" != xno
then
CF3_WITH_LIBRARY(libacl, [
AC_CHECK_LIB(acl, acl_init,
[],
[if test "x$with_libacl" != xcheck; then AC_MSG_ERROR(Cannot find libacl library); fi])
AC_CHECK_HEADERS([acl.h sys/acl.h acl/libacl.h],
[libacl_header_found=yes])
if test "x$libacl_header_found" != "xyes" && test "x$with_libacl" != xcheck;
then
AC_MSG_ERROR(Cannot find libacl library headers);
fi
])
fi
dnl libcurl
AC_ARG_WITH([libcurl],
[AS_HELP_STRING([--with-libcurl[[=PATH]]], [Specify libcurl path])], [], [with_libcurl=check])
if test "x$with_libcurl" != xno
then
CF3_WITH_LIBRARY(libcurl, [
AC_CHECK_LIB(curl, curl_global_init,
[],
[ libcurl_lib_found=no;
if test "x$with_libcurl" != xcheck;
then
AC_MSG_ERROR(Cannot find libcurl library);
fi
])
AC_CHECK_HEADERS([curl/curl.h],
[libcurl_header_found=yes],
[if test "x$with_libcurl" != xcheck; then AC_MSG_ERROR(Cannot find libcurl header files); fi])
])
fi
AM_CONDITIONAL(HAVE_LIBCURL,
[test "x$libcurl_lib_found" != xno && test "x$libcurl_header_found" = xyes])
dnl libyaml
AC_ARG_WITH([libyaml],
[AS_HELP_STRING([--with-libyaml[[=PATH]]], [Specify libyaml path])], [], [with_libyaml=check])
if test "x$with_libyaml" != xno
then
CF3_WITH_LIBRARY(libyaml, [
AC_CHECK_LIB(yaml, yaml_parser_initialize,
[],
[if test "x$with_libyaml" != xcheck; then AC_MSG_ERROR(Cannot find libyaml library); fi])
AC_CHECK_HEADERS(yaml.h,
[libyaml_header_found=yes],
[if test "x$with_libyaml" != xcheck; then AC_MSG_ERROR(Cannot find libyaml header files); fi])
])
fi
dnl libxml2
AC_ARG_WITH([libxml2],
[AS_HELP_STRING([--with-libxml2[[=PATH]]],
[Specify libxml2 path])
],
[],
[with_libxml2=check])
have_libxml2="no"
if test "x$with_libxml2" != "xno"; then
if test -n "$PKG_CONFIG"; then
AC_MSG_CHECKING([for libxml2 via pkg-config])
if `$PKG_CONFIG --exists libxml-2.0`; then
LIBXML2_CFLAGS=`$PKG_CONFIG --cflags libxml-2.0`
LIBXML2_CPPFLAGS="$LIBXML2_CFLAGS"
LIBXML2_LIBS=`$PKG_CONFIG --libs libxml-2.0`
LIBXML2_VERSION=`$PKG_CONFIG --modversion libxml-2.0`
AC_MSG_RESULT([found version $LIBXML2_VERSION])
have_libxml2="yes"
else
AC_MSG_RESULT([not found])
fi
fi
if test "x$have_libxml2" = "xno"; then
if test "x$with_libxml2" != "xyes" &&
test "x$with_libxml2" != "xcheck" &&
test -x "$with_libxml2/bin/xml2-config"
then
XML2_CONFIG=$with_libxml2/bin/xml2-config
else
AC_PATH_PROG([XML2_CONFIG], [xml2-config])
fi
# xml2-config is only for native builds
if test "x$cross_compiling" = "xno" && test -n "$XML2_CONFIG"; then
xml2_include_dir=`$XML2_CONFIG --cflags`
if test -n "$xml2_include_dir"; then
LIBXML2_CPPFLAGS="$xml2_include_dir"
fi
else # xml2-config not found
# if a path, e.g. /var/cfengine was given, then we
# must take into account that libxml2 includes are in
# /var/cfengine/include/libxml2
LIBXML2_CPPFLAGS=-I$with_libxml2/include/libxml2
fi
fi
CF3_WITH_LIBRARY(libxml2,
[AC_CHECK_LIB(xml2, xmlFirstElementChild,
[],
[if test "x$with_libxml2" != xcheck; then
AC_MSG_ERROR(Cannot find libxml2); fi]
)
AC_CHECK_HEADERS([libxml/xmlwriter.h], [break],
[if test "x$with_libxml2" != xcheck; then
AC_MSG_ERROR(Cannot find libxml2); fi]
)]
)
fi
AM_CONDITIONAL([HAVE_LIBXML2],
[test "x$with_libxml2" != xno &&
test "x$ac_cv_lib_xml2_xmlFirstElementChild" = xyes])
dnl avahi
AC_ARG_WITH([avahi],
[AS_HELP_STRING([--with-avahi@<:@=yes/no/check@:>@], [Compile with Avahi support @<:@default=no@:>@])],
[],
[with_avahi=no])
if test "x$with_avahi" != xno
then
AC_CHECK_HEADERS([avahi-client/client.h],
[AM_CONDITIONAL(HAVE_AVAHI_CLIENT, true)],
[AM_CONDITIONAL(HAVE_AVAHI_CLIENT, false)
test "x$with_avahi" != "xcheck" && AC_MSG_ERROR(Cannot find avahi-client/client.h)])
AC_CHECK_HEADERS([avahi-common/address.h],
[AM_CONDITIONAL(HAVE_AVAHI_COMMON, true)],
[AM_CONDITIONAL(HAVE_AVAHI_COMMON, false)
test "x$with_avahi" != "xcheck" && AC_MSG_ERROR(Cannot find avahi-common/address.h)])
else
AM_CONDITIONAL(HAVE_AVAHI_CLIENT, false)
AM_CONDITIONAL(HAVE_AVAHI_COMMON, false)
fi
dnl
dnl ######################################################################
dnl Checks for header files.
dnl ######################################################################
AC_CHECK_HEADERS(unistd.h stdlib.h sys/loadavg.h)
AC_CHECK_HEADERS(sys/param.h sys/resource.h)
# sys/param.h is required for sys/mount.h on OpenBSD
AC_CHECK_HEADERS(sys/mount.h, [], [], [AC_INCLUDES_DEFAULT
#ifdef HAVE_SYS_PARAM_H
# include <sys/param.h>
#endif
])
# Required on BSD to get struct sockaddr_dl (for retrieving MAC addresses from getifaddrs())
AC_CHECK_HEADERS(net/if_dl.h)
# Required on Solaris to get struct arpreq (for retrieving MAC addresses)
AC_CHECK_HEADERS(net/if_arp.h, , , [AC_INCLUDES_DEFAULT
#include <sys/socket.h>
])
AC_CHECK_HEADERS(getopt.h, [system_getopt_h=1], [system_getopt_h=0])
AM_CONDITIONAL([NO_SYSTEM_GETOPT_H], [test x$system_getopt_h = x0])
AC_CHECK_HEADERS(utime.h)
AC_CHECK_HEADERS(time.h)
AC_CHECK_HEADERS(sys/time.h)
AC_CHECK_HEADERS(malloc.h sys/malloc.h)
AC_CHECK_HEADERS(vfs.h)
AC_CHECK_HEADERS(sys/vfs.h)
AC_CHECK_HEADERS(sys/sockio.h)
AC_CHECK_HEADERS(sys/statvfs.h)
AC_CHECK_HEADERS(sys/statfs.h)
AC_CHECK_HEADERS(fcntl.h)
AC_CHECK_HEADERS(sys/filesys.h)
AC_CHECK_HEADERS(dustat.h)
AC_CHECK_HEADERS(sys/systeminfo.h)
AC_CHECK_HEADERS(ieeefp.h)
AC_CHECK_HEADERS(winsock2.h)
AC_CHECK_HEADERS(ws2tcpip.h)
AC_CHECK_HEADERS(zone.h)
AC_CHECK_HEADERS(sys/uio.h)
AC_CHECK_HEADERS_ONCE([sys/sysmacros.h]) dnl glibc deprecated inclusion in sys/type.h
AC_CHECK_HEADERS(sys/types.h)
AC_CHECK_HEADERS(sys/mpctl.h) dnl For HP-UX $(sys.cpus) - Mantis #1069
AC_CHECK_HEADERS(shadow.h)
AC_CHECK_HEADERS(sys/jail.h, [], [], [AC_INCLUDES_DEFAULT
#ifdef HAVE_SYS_PARAM_H
# include <sys/param.h>
#endif
])
AC_CHECK_HEADERS(net/route.h netinet/in.h netinet/ip.h)
AC_HEADER_STDC
AC_HEADER_TIME
AC_HEADER_SYS_WAIT
AC_HEADER_DIRENT
AC_HEADER_STDBOOL
dnl ######################################################################
dnl Checks for data types
dnl ######################################################################
AC_TYPE_MODE_T
AC_TYPE_SIZE_T
AC_TYPE_UID_T
AC_TYPE_PID_T
AC_CHECK_TYPES(clockid_t, [], [], [[
#ifdef HAVE_TIME_H
# include <time.h>
#endif
]])
AC_CHECK_TYPES(socklen_t, [], [], [[
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#include <sys/socket.h>
]])
dnl ######################################################################
dnl Checks for typedefs, structures, and compiler characteristics.
dnl ######################################################################
AC_C_CONST
AC_SYS_LARGEFILE
AC_TYPE_OFF_T
#
# AC_SYS_LARGEFILE correctly figures out necessary macros for large files, but
# on AIX there is a gotcha:
#
# Code generated by flex #includes <stdio.h> at the beginning of the file, which
# picks up 32-bit wide off_t. Then it #includes <config.h> which provides LFS
# macros, and finally it includes another system header, now with 64-bit wide
# off_t, which causes a conflict.
#
if test "x$ac_cv_sys_large_files" = x1; then
CPPFLAGS="-D_LARGE_FILES=1 $CPPFLAGS"
fi
dnl ######################################################################
dnl Check for libraries
dnl ######################################################################
AC_CHECK_LIB(m, sqrt)
AC_CHECK_LIB(rt, clock_gettime)
AC_CHECK_LIB(dl, dlopen)
dnl ######################################################################
dnl Check for special functions
dnl ######################################################################
AC_CHECK_DECLS(clock_gettime, [], [], [[#include <time.h>]])
AC_CHECK_DECLS(unsetenv)
AC_CHECK_DECLS(strnlen)
AC_CHECK_DECLS(seteuid)
AC_CHECK_DECLS(setlinebuf)
AC_CHECK_DECLS(strlcat)
AC_CHECK_DECLS(strlcpy)
AC_CHECK_DECLS(realpath)
AC_CHECK_DECLS(strdup)
AC_CHECK_DECLS(memrchr)
AC_CHECK_DECLS(round, [], [], [[#include <math.h>]])
AC_CHECK_DECLS(nanosleep)
AC_CHECK_DECLS(memdup)
AC_CHECK_DECLS(memmem)
AC_CHECK_DECLS(srand48)
AC_CHECK_DECLS(drand48)
AC_CHECK_DECLS(strerror)
AC_CHECK_DECLS(strstr)
AC_CHECK_DECLS(strcasestr)
AC_CHECK_DECLS(strcasecmp)
AC_CHECK_DECLS(strncasecmp)
AC_CHECK_DECLS(strsep)
AC_CHECK_DECLS(strsignal)
AC_CHECK_DECLS(gmtime_r, [], [], [[#include <time.h>]])
AC_CHECK_DECLS(getline, [], [], [#define _GNU_SOURCE 1
AC_INCLUDES_DEFAULT])
AC_CHECK_DECLS(strchrnul, [], [], [#define _GNU_SOURCE 1
AC_INCLUDES_DEFAULT])
AC_CHECK_DECLS(localtime_r, [], [], [[#include <time.h>]])
AC_CHECK_DECLS(fgetgrent, [], [], [[#include <grp.h>]])
AC_CHECK_DECLS(isfinite, [], [], [[#include <math.h>]])
AC_CHECK_FUNCS(getpwent setpwent endpwent)
AC_CHECK_FUNCS(fgetspent lckpwdf ulckpwdf)
AC_CHECK_LIB([sec], [fgetspent], [
AC_DEFINE([HAVE_LIBSEC], 1, [Define if -lsec is available])
AC_DEFINE([HAVE_FGETSPENT], 1, [Define if fgetspent is available])
LIBS="-lsec $LIBS"
])
AC_CHECK_DECLS(getloadavg)
AC_FUNC_GETLOADAVG
AC_C_BIGENDIAN
AC_CHECK_HEADERS([endian.h])
AC_CHECK_DECLS(le32toh, [], [], [[#include <endian.h>]])
AC_CHECK_DECLS(closefrom, [], [], [[#include <unistd.h>
#include <stdlib.h>]])
AC_CHECK_HEADERS([sys/pstat.h])
AC_CHECK_FUNCS(pstat_getfile2)
CF3_PATH_ROOT_PROG([CHPASSWD], [chpasswd], [], [/sbin:/usr/sbin:/bin:/usr/bin:$PATH])
AS_IF([test "x$CHPASSWD" != "x"],
[AC_DEFINE(HAVE_CHPASSWD, 1, [Define if chpasswd tool is present])]
[AC_DEFINE_UNQUOTED(CHPASSWD, ["$CHPASSWD"], [Path to chpasswd tool])]
)
dnl AIX has this.
CF3_PATH_ROOT_PROG([PWDADM], [pwdadm], [], [/sbin:/usr/sbin:/bin:/usr/bin:$PATH])
AS_IF([test "x$PWDADM" != "x"],
[AC_DEFINE(HAVE_PWDADM, 1, [Define if pwdadm tool is present])]
[AC_DEFINE_UNQUOTED(PWDADM, ["$PWDADM"], [Path to pwdadm tool])]
)
CF3_PATH_ROOT_PROG([USERADD], [useradd], [], [/sbin:/usr/sbin:/bin:/usr/bin:$PATH])
AS_IF([test "x$USERADD" != "x"],
[AC_DEFINE(HAVE_USERADD, 1, [Define if useradd tool is present])]
[AC_DEFINE_UNQUOTED(USERADD, ["$USERADD"], [Path to useradd tool])]
)
CF3_PATH_ROOT_PROG([USERMOD], [usermod], [], [/sbin:/usr/sbin:/bin:/usr/bin:$PATH])
AS_IF([test "x$USERMOD" != "x"],
[AC_DEFINE(HAVE_USERMOD, 1, [Define if usermod tool is present])]
[AC_DEFINE_UNQUOTED(USERMOD, ["$USERMOD"], [Path to usermod tool])]
)
CF3_PATH_ROOT_PROG([USERDEL], [userdel], [], [/sbin:/usr/sbin:/bin:/usr/bin:$PATH])
AS_IF([test "x$USERDEL" != "x"],
[AC_DEFINE(HAVE_USERDEL, 1, [Define if userdel tool is present])]
[AC_DEFINE_UNQUOTED(USERDEL, ["$USERDEL"], [Path to userdel tool])]
)
AS_IF([test "x$USERADD" != x && \
test "x$USERMOD" != x && test "x$USERDEL" != x],
[have_userprogs=yes],
[have_userprogs=no]
)
dnl FreeBSD
CF3_PATH_ROOT_PROG([CHPASS], [chpass], [], [/usr/bin:$PATH])
AS_IF([test "x$CHPASS" != "x"],
[AC_DEFINE(HAVE_CHPASS, 1, [Define if chpass tool is present])]
[AC_DEFINE_UNQUOTED(CHPASS, ["$CHPASS"], [Path to chpass tool])]
)
CF3_PATH_ROOT_PROG([PW], [pw], [], [/usr/sbin:$PATH])
AS_IF([test "x$PW" != "x"],
[AC_DEFINE(HAVE_PW, 1, [Define if pw tool is present])]
[AC_DEFINE_UNQUOTED(PW, ["$PW"], [Path to pw tool])]
)
AS_IF([test "x$CHPASS" != x && \
test "x$PW" != x],
[have_userprogs=yes],
[have_userprogs=no]
)
AC_ARG_WITH([pam], AS_HELP_STRING([--with-pam], [Compile with PAM support]))
AS_IF([test x$with_pam != xno],
[
CF3_WITH_LIBRARY(pam, [
AC_CHECK_LIB(pam, pam_start)
AC_CHECK_HEADERS([security/pam_appl.h])
])
dnl These platforms must have pam, others can have it, but not required.
AS_CASE([$target_os],
[*gnu*|*solaris*|*aix*|*hpux*|*hp-ux*], [
AS_IF([test "x$ac_cv_lib_pam_pam_start" != "xyes"],
[AC_MSG_ERROR(Cannot find PAM library)]
)
AS_IF([test "x$ac_cv_header_security_pam_appl_h" != "xyes"],
[AC_MSG_ERROR(Cannot find PAM headers)]
)]
)
AS_IF([test "x$ac_cv_lib_pam_pam_start" = "xyes" && \
test "x$ac_cv_header_security_pam_appl_h" = "xyes"],
[have_pam=yes],
[have_pam=no]
)
AC_CHECK_FUNCS(fgetpwent fgetgrent)
AS_IF([test "x$ac_cv_func_fgetpwent" = "xyes" && \
test "x$ac_cv_func_fgetgrent" = "xyes"],
[have_fgetpwent_fgetgrent=yes]
[AC_DEFINE(HAVE_FGETPWENT_FGETGRENT, 1, [Define if fgetpwent and fgetgrent functions are present])],
[have_fgetpwent_fgetgrent=no]
)
AS_CASE(["$target_os"],
[freebsd*],
[
AS_IF([test "x$have_pam" = "xyes" && \
test "x$have_userprogs" = "xyes"],
[users_promises_ok=yes],
[users_promises_ok=no])
],
[
AS_IF([test "x$have_pam" = "xyes" && \
test "x$have_userprogs" = "xyes"
test "x$ac_cv_func_fgetpwent" = "xyes" && \
test "x$ac_cv_func_fgetgrent" = "xyes"],
[users_promises_ok=yes],