forked from OpenSCAP/openscap
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconfigure.ac.tpl
802 lines (677 loc) · 27.3 KB
/
configure.ac.tpl
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
# ! MAKE SURE YOU ARE EDITING THE ac_probes/configure.ac.tpl FILE,
# ! THE configure.ac FILE ITSELF IS GENERATED FROM THE TEMPLATE USING
# ! ac_probes/ac_probes.sh
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
AC_INIT([openscap], [1.2.18], [[email protected]])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_AUX_DIR([config])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([foreign tar-pax])
# If automake supports "silent rules", enable them by default
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
AC_DISABLE_STATIC
#build dll on windows(cygwin)
AC_LIBTOOL_WIN32_DLL
# Checks for programs.
AC_PROG_CC
gl_EARLY
gl_INIT
AM_PROG_LIBTOOL
AM_PROG_CC_C_O
AC_PROG_CXX
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_LIBTOOL
# swig
AC_PROG_SWIG([])
# libtool versioning
# See http://sources.redhat.com/autobook/autobook/autobook_91.html#SEC91 for details
## increment if the interface has additions, changes, removals.
LT_CURRENT=22
## increment any time the source changes; set 0 to if you increment CURRENT
LT_REVISION=1
## 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=14
LT_CURRENT_MINUS_AGE=`expr $LT_CURRENT - $LT_AGE`
AC_SUBST(LT_CURRENT)
AC_SUBST(LT_REVISION)
AC_SUBST(LT_AGE)
AC_SUBST(LT_CURRENT_MINUS_AGE)
AC_DEFINE_UNQUOTED([LT_CURRENT_MINUS_AGE], [$LT_CURRENT_MINUS_AGE], [LT_CURRENT - LT_AGE])
AC_DEFUN([canonical_wrap], [AC_REQUIRE([AC_CANONICAL_HOST])])
canonical_wrap
# Compiler flags
CFLAGS="$CFLAGS -pipe -std=c99 -W -Wall -Wnonnull -Wshadow -Wformat -Wundef -Wno-unused-parameter -Wmissing-prototypes -Wno-unknown-pragmas -D_GNU_SOURCE -DOSCAP_THREAD_SAFE -D_POSIX_C_SOURCE=200112L"
case $host in
*solaris*) :
CFLAGS="$CFLAGS -D__EXTENSIONS__" ;;
esac
CFLAGS_OPTIMIZED="-O2 -finline-functions"
CFLAGS_DEBUGGING="-fno-inline-functions -O0 -g3"
CFLAGS_NODEBUG="-Wno-unused-function"
my_save_cflags="$CFLAGS"
CFLAGS="$CFLAGS -Werror=format-security"
AC_MSG_CHECKING([whether CC supports -Werror=format-security])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
[AC_MSG_RESULT([yes])]
[AM_CFLAGS="-Werror=format-security"],
[AC_MSG_RESULT([no])]
)
CFLAGS="$my_save_cflags"
AC_SUBST([AM_CFLAGS])
@@@@PROBE_DECL@@@@
#
# env
#
AC_CHECK_PROG(
[HAVE_ENV],
[env],
[yes],,,
)
AM_CONDITIONAL(ENV_PRESENT, [test x"${HAVE_ENV}" = xyes])
#
# Valgrind
#
AC_CHECK_PROG(
[HAVE_VALGRIND],
[valgrind],
[yes],,,
)
AM_CONDITIONAL(VALGRIND_PRESENT, [test x"${HAVE_VALGRIND}" = xyes])
AC_HEADER_STDC
AC_HEADER_STDBOOL
AC_TYPE_SIZE_T
AC_FUNC_MALLOC
AC_FUNC_REALLOC
# Check for pthreads support: http://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=blob_plain;f=m4/ax_pthread.m4
AX_PTHREAD()
if test "x$ax_pthread_ok" != "xyes"; then
AC_MSG_FAILURE(pthread library is missing)
fi
SAVE_LIBS=$LIBS
SAVE_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS -D_GNU_SOURCE"
LIBS="$PTHREAD_LIBS"
AC_CHECK_FUNCS([pthread_timedjoin_np pthread_setname_np pthread_getname_np clock_gettime])
CFLAGS=$SAVE_CFLAGS
LIBS=$SAVE_LIBS
AC_SUBST([PTHREAD_CFLAGS])
AC_SUBST([PTHREAD_LIBS])
PKG_CHECK_MODULES([curl], [libcurl >= 7.12.0],[],
AC_MSG_FAILURE([libcurl devel support is missing]))
PKG_CHECK_MODULES([xml2], [libxml-2.0 >= 2.0],[],
AC_MSG_FAILURE([libxml-2.0 devel support is missing]))
PKG_CHECK_MODULES([xslt], [libxslt >= 1.1],[],
AC_MSG_FAILURE([libxslt devel support is missing]))
PKG_CHECK_MODULES([exslt], [libexslt >= 0.8],[],
AC_MSG_FAILURE([libexslt devel support is missing]))
AC_CHECK_HEADER(pcre.h, , [AC_MSG_ERROR([pcre.h is missing] )])
crapi_CFLAGS=""
crapi_LIBS=""
if test "${with_crypto}" = ""; then
with_crypto=gcrypt
fi
case "${with_crypto}" in
nss3)
PKG_CHECK_MODULES([nss3], [nss >= 3.0],[],
AC_MSG_FAILURE([libnss3 devel support is missing]))
crapi_libname="NSS 3.x"
crapi_CFLAGS=$nss3_CFLAGS
crapi_LIBS=$nss3_LIBS
AC_DEFINE([HAVE_NSS3], [1], [Define to 1 if you have 'NSS' library.])
;;
gcrypt)
SAVE_LIBS=$LIBS
AC_CHECK_LIB([gcrypt], [gcry_check_version],
[crapi_CFLAGS=`libgcrypt-config --cflags`;
crapi_LIBS=`libgcrypt-config --libs`;
crapi_libname="GCrypt";],
[AC_MSG_ERROR([library 'gcrypt' is required for GCrypt.])],
[])
AC_DEFINE([HAVE_GCRYPT], [1], [Define to 1 if you have 'gcrypt' library.])
AC_CACHE_CHECK([for GCRYCTL_SET_ENFORCED_FIPS_FLAG],
[ac_cv_gcryctl_set_enforced_fips_flag],
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include<gcrypt.h>],
[return GCRYCTL_SET_ENFORCED_FIPS_FLAG;])],
[ac_cv_gcryctl_set_enforced_fips_flag=yes],
[ac_cv_gcryctl_set_enforced_fips_flag=no])])
if test "${ac_cv_gcryctl_set_enforced_fips_flag}" == "yes"; then
AC_DEFINE([HAVE_GCRYCTL_SET_ENFORCED_FIPS_FLAG], [1], [Define to 1 if you have 'gcrypt' library with GCRYCTL_SET_ENFORCED_FIPS_FLAG.])
fi
LIBS=$SAVE_LIBS
;;
*)
AC_MSG_ERROR([unknown crypto backend])
;;
esac
AC_SUBST(crapi_CFLAGS)
AC_SUBST(crapi_LIBS)
AC_CHECK_FUNCS([fts_open posix_memalign memalign])
AC_CHECK_FUNC(sigwaitinfo, [sigwaitinfo_LIBS=""], [sigwaitinfo_LIBS="-lrt"])
AC_SUBST(sigwaitinfo_LIBS)
# libopenscap links against librpm if found. Otherwise we carry own implementation of rpmvercmp.
echo
echo '* Checking for rpm library (optional dependency of libopenscap) '
PKG_CHECK_MODULES([rpm], [rpm >= 4.4],[
SAVE_LIBS=$LIBS
AC_DEFINE([HAVE_RPMVERCMP], [1], [Define to 1 if there is rpmvercmp available.])
AC_SUBST([rpm_CFLAGS])
AC_SUBST([rpm_LIBS])
LIBS=$SAVE_LIBS
],[
AC_MSG_NOTICE([!!! librpm not found. The rpmvercmp function will be emulated. !!!])
])
PKG_CHECK_MODULES([rpm], [rpm >= 4.6],[
AC_DEFINE([HAVE_RPM46], [1], [Define to 1 if rpm is newer than 4.6.])
],[
AC_MSG_NOTICE([librpm is older than 4.6])
])
PKG_CHECK_MODULES([rpm], [rpm >= 4.7],[
AC_DEFINE([HAVE_RPM47], [1], [Define to 1 if rpm is newer than 4.7.])
],[
AC_MSG_NOTICE([librpm is older than 4.7])
])
echo
echo '* Checking for bz2 library (optional dependency of libopenscap)'
AC_CHECK_LIB([bz2], [BZ2_bzReadOpen],
[
AC_DEFINE([HAVE_BZ2], [1], [Define to 1 if there is libbz2 available.])
LIBS="$LIBS -lbz2"
AC_CHECK_PROG([HAVE_BZIP2],[bzip2],[yes],,,)
],[
AC_MSG_NOTICE([!!! libbz2 not found. Bzip2 support will be disabled !!!])
])
AM_CONDITIONAL([HAVE_BZIP2], [test "x${HAVE_BZIP2}" = xyes])
@@@@PROBE_HEADERS@@@@
@@@@PROBE_LIBRARIES@@@@
echo
#check for atomic functions
case $host_cpu in
i386 | i486 | i586 | i686)
CFLAGS="$CFLAGS -march=i686"
;;
esac
AC_CACHE_CHECK([for atomic builtins], [ac_cv_atomic_builtins],
[AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <stdint.h>
uint16_t foovar=0; uint16_t old=1; uint16_t new=2;],
[__sync_bool_compare_and_swap(&foovar,old,new); return __sync_fetch_and_add(&foovar, 1);])],
[ac_cv_atomic_builtins=yes],
[ac_cv_atomic_builtins=no])])
if test $ac_cv_atomic_builtins = yes; then
AC_DEFINE([HAVE_ATOMIC_BUILTINS], 1, [Define to 1 if the compiler supports atomic builtins.])
else
AC_MSG_NOTICE([!!! Compiler does not support atomic builtins. Atomic operation will be emulated using mutex-based locking. !!!])
fi
AC_ARG_ENABLE([probes-independent],
[AC_HELP_STRING([--enable-probes-independent], [enable compilation of probes independent of the base system (default=yes)])],
[case "${enableval}" in
yes) probes_independent=yes ;;
no) probes_independent=no ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-probes-independent]) ;;
esac],[probes_independent=yes])
AC_ARG_ENABLE([probes-unix],
[AC_HELP_STRING([--enable-probes-unix], [enable compilation of probes for UNIX based systems (default=yes)])],
[case "${enableval}" in
yes) probes_unix=yes ;;
no) probes_unix=no ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-probes-unix]) ;;
esac],[probes_unix=yes])
if test "x${probes_unix}" = xyes; then
AC_DEFINE([PLATFORM_UNIX], [1], [Indicator for a Unix type OS])
fi
probes_linux=no
case "${host}" in
*-*-linux*)
probes_linux=yes
;;
esac
AC_ARG_ENABLE([probes-linux],
[AC_HELP_STRING([--enable-probes-linux], [enable compilation of probes for Linux based systems (default=autodetect)])],
[case "${enableval}" in
yes) probes_linux=yes ;;
no) probes_linux=no ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-probes-linux]) ;;
esac],)
probes_solaris=no
case "${host}" in
*-*-solaris*)
probes_solaris=yes
;;
esac
AC_ARG_ENABLE([probes-solaris],
[AC_HELP_STRING([--enable-probes-solaris], [enable compilation of probes for Solaris based systems (default=autodetect)])],
[case "${enableval}" in
yes) probes_solaris=yes ;;
no) probes_solaris=no ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-probes-solaris]) ;;
esac],)
AC_ARG_ENABLE([cce],
[AC_HELP_STRING([--enable-cce], [include support for CCE (default=no)])],
[case "${enableval}" in
yes) cce=yes ;;
no) cce=no ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-cce]) ;;
esac],[cce=no])
AC_ARG_ENABLE([python],
[AC_HELP_STRING([--enable-python], [enable compilation of python2 bindings (default=auto)])],
[case "${enableval}" in
yes) python2_bind=yes ;;
no) python2_bind=no ;;
auto) python2_bind=auto ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-python]) ;;
esac],[python2_bind=auto])
AC_ARG_ENABLE([python3],
[AC_HELP_STRING([--enable-python3], [enable compilation of python3 bindings (default=auto)])],
[case "${enableval}" in
yes) python3_bind=yes ;;
no) python3_bind=no ;;
auto) python3_bind=auto ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-python3]);;
esac],[python3_bind=auto])
AC_ARG_ENABLE([perl],
[AC_HELP_STRING([--enable-perl], [enable compilation of perl bindings (default=no)])],
[case "${enableval}" in
yes) perl_bind=yes ;;
no) perl_bind=no ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-perl]) ;;
esac],[perl_bind=no])
AC_ARG_ENABLE([regex-posix],
[AC_HELP_STRING([--enable-regex-posix], [compile with POSIX instead of PCRE regex (default=no)])],
[case "${enableval}" in
yes) regex_posix=yes ;;
no) regex_posix=no ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-regex-posix]) ;;
esac],[regex_posix=no])
AC_ARG_ENABLE([debug],
[AC_HELP_STRING([--enable-debug], [enable debugging flags (default=no)])],
[case "${enableval}" in
yes) debug=yes ;;
no) debug=no ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;;
esac], [debug=no])
AC_ARG_ENABLE([valgrind],
[AC_HELP_STRING([--enable-valgrind], [enable valgrind checks (default=no)])],
[case "${enableval}" in
yes) vgdebug=yes ;;
no) vgdebug=no ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-valgrind]) ;;
esac], [vgdebug=no])
AC_ARG_ENABLE([ssp],
[AC_HELP_STRING([--enable-ssp], [enable SSP (fstack-protector, default=no)])],
[case "${enableval}" in
yes) ssp=yes ;;
no) ssp=no ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-ssp]) ;;
esac], [ssp=no])
AC_ARG_WITH([crypto],
[AS_HELP_STRING([--with-crypto],
[use different crypto backend. Available options: nss3, gcrypt [default=gcrypt]])],
[],
[crypto=gcrypt])
if test "x${libexecdir}" = xNONE; then
probe_dir="/usr/local/libexec/openscap"
else
EXPAND_DIR(probe_dir,"${libexecdir}/openscap")
fi
AC_SUBST(probe_dir)
if test "x${prefix}" = xNONE; then
AC_DEFINE_UNQUOTED([OSCAP_DEFAULT_SCHEMA_PATH], ["/usr/local/share/openscap/schemas"], [Path to xml schemas])
else
AC_DEFINE_UNQUOTED([OSCAP_DEFAULT_SCHEMA_PATH], ["${prefix}/share/openscap/schemas"], [Path to xml schemas])
fi
if test "x${prefix}" = xNONE; then
AC_DEFINE_UNQUOTED([OSCAP_DEFAULT_XSLT_PATH], ["/usr/local/share/openscap/xsl"], [Path to xslt files])
else
AC_DEFINE_UNQUOTED([OSCAP_DEFAULT_XSLT_PATH], ["${prefix}/share/openscap/xsl"], [Path to xslt files])
fi
if test "x${prefix}" = xNONE; then
AC_DEFINE_UNQUOTED([OSCAP_DEFAULT_CPE_PATH], ["/usr/local/share/openscap/cpe"], [Path to cpe files])
else
AC_DEFINE_UNQUOTED([OSCAP_DEFAULT_CPE_PATH], ["${prefix}/share/openscap/cpe"], [Path to cpe files])
fi
if test "$regex_posix" = "yes"; then
AC_DEFINE([USE_REGEX_POSIX], [1], [Use POSIX regular expressions])
else
AC_DEFINE([USE_REGEX_PCRE], [1], [Use PCRE])
fi
if test "$ssp" = "yes"; then
GCC_STACK_PROTECT_CC
GCC_STACK_PROTECT_CXX
fi
if test "$debug" = "yes"; then
CFLAGS="$CFLAGS $CFLAGS_DEBUGGING"
else
CFLAGS="$CFLAGS $CFLAGS_NODEBUG"
AC_DEFINE([NDEBUG], [1], [No Debug defined])
fi
AC_ARG_ENABLE([sce],
[AC_HELP_STRING([--enable-sce], [enable script check engine (default=no)])],
[case "${enableval}" in
yes) sce=yes ;;
no) sce=no ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-sce]) ;;
esac],[sce=no])
AC_ARG_WITH([oscap-temp-dir],
[AS_HELP_STRING([--with-oscap-temp-dir],
[use different temporary directory to execute sce scripts [default=/tmp]])],
[],
[with_oscap_temp_dir="/tmp"])
if test "x${sce}" = xyes; then
AC_DEFINE([ENABLE_SCE], [1], [compilation of script check engine enabled])
CFLAGS="$CFLAGS -DOSCAP_TEMP_DIR=\\\"${with_oscap_temp_dir}\\\"" # double escape needed for compilation on some systems
fi
AC_ARG_ENABLE([util-oscap],
[AC_HELP_STRING([--enable-util-oscap], [enable compilation of the oscap utility (default=yes)])],
[case "${enableval}" in
yes) util_oscap=yes ;;
no) util_oscap=no ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-util-oscap]) ;;
esac],[util_oscap=yes])
AC_ARG_ENABLE([util-scap-as-rpm],
[AC_HELP_STRING([--enable-util-scap-as-rpm], [enable compilation of the scap-as-rpm utility (default=yes)])],
[case "${enableval}" in
yes) util_scap_as_rpm=yes ;;
no) util_scap_as_rpm=no ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-util-scap-as-rpm]) ;;
esac],[util_scap_as_rpm=yes])
AC_ARG_ENABLE([util-oscap-ssh],
[AC_HELP_STRING([--enable-util-oscap-ssh], [enable compilation of the oscap-ssh utility (default=yes)])],
[case "${enableval}" in
yes) util_oscap_ssh=yes ;;
no) util_oscap_ssh=no ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-util-oscap-ssh]) ;;
esac],[util_oscap_ssh=yes])
AC_ARG_ENABLE([util-oscap-docker],
[AC_HELP_STRING([--enable-util-oscap-docker], [enable compilation of the oscap-docker utility (default=yes)])],
[case "${enableval}" in
yes) util_oscap_docker=yes ;;
no) util_oscap_docker=no ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-util-oscap-docker]) ;;
esac],[util_oscap_docker=yes])
AC_ARG_ENABLE([util-oscap-vm],
[AC_HELP_STRING([--enable-util-oscap-vm], [enable compilation of the oscap-vm utility (default=yes)])],
[case "${enableval}" in
yes) util_oscap_vm=yes ;;
no) util_oscap_vm=no ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-util-oscap-vm]) ;;
esac],[util_oscap_vm=yes])
AC_ARG_ENABLE([util-oscap-chroot],
[AC_HELP_STRING([--enable-util-oscap-chroot], [enable compilation of the oscap-chroot utility (default=yes)])],
[case "${enableval}" in
yes) util_oscap_chroot=yes ;;
no) util_oscap_chroot=no ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-util-oscap-chroot]) ;;
esac],[util_oscap_chroot=yes])
if test "$vgdebug" = "yes"; then
if test "$HAVE_VALGRIND" = "yes"; then
vgcheck="yes"
else
AC_MSG_ERROR([valgrind not installed])
fi
else
vgcheck="no"
fi
AC_SUBST([vgcheck])
if test "x${util_oscap_docker}" = "xyes"; then
if test ! "x${HAVE_BZIP2}" = xyes; then
AC_MSG_FAILURE(oscap-docker requires bzip2! Either disable oscap-docker or install bzip2 development support.)
fi
fi
if test "x${perl_bind}" = xyes; then
AC_PATH_PROG(PERL, perl)
PERL_INCLUDES="`$PERL -e 'use Config; print $Config{archlib}'`/CORE"
vendorlib="$( $PERL -e 'use Config; print $Config{vendorlib}' | sed "s|$($PERL -e 'use Config; print $Config{prefix}')||" )"
vendorarch="$( $PERL -e 'use Config; print $Config{vendorarch}' | sed "s|$($PERL -e 'use Config; print $Config{prefix}')||" )"
AC_SUBST([PERL_INCLUDES], ["-I$PERL_INCLUDES"])
AC_SUBST([perl_vendorlibdir], ['${prefix}'$vendorlib])
AC_SUBST([perl_vendorarchdir], ['${prefix}'$vendorarch])
save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $PERL_INCLUDES"
AC_CHECK_HEADERS([EXTERN.h],[],[AC_MSG_ERROR(Perl development librarier are needed for perl bindings)],[-])
CPPFLAGS="$save_CPPFLAGS"
fi
dnl $1: Python major version
dnl $2: How to announce it
m4_define([TELL_PYTHON_NOT_PRESENT], [$2(
[python $1 bindings were requested, but the appropriate python interpreter was not found in the search path.
Please ensure that it is installed and available, or run configure with --disable-python$1 option.])])
dnl $1: Python major version
dnl $2: How to announce it
m4_define([TELL_PYTHON_DEVEL_NOT_PRESENT], [$2(
[python $1 bindings were requested and there is an interpreter, but the development support is missing.
Please ensure that it is installed and available, or run configure with --disable-python$1 option.])])
# TODO: Handle the bindings yes/no -> interpreter yes/no -> devel yes/no situation
dnl python_bind can be set either to yes, no or auto. It will be set to yes or no after the evaluation.
dnl
dnl $1: Python major version
m4_define([EVALUATE_PYTHON_CHECK_RESULT],
[m4_if([$1], , [m4_fatal([The $0 macro needs Python major version as its first argument.])])
AS_IF([test "x${python$1_bind}" = xyes && test "x$HAVE_PYTHON$1" = xno],
[python$1_bind=no
TELL_PYTHON_NOT_PRESENT([$1], [AC_MSG_ERROR])],
[test "x$python$1_bind" = xauto && test "x$HAVE_PYTHON$1" = xno],
[python$1_bind=no
TELL_PYTHON_NOT_PRESENT([$1], [AC_MSG_NOTICE])],
[test "x$python$1_bind" != xno && test "x$HAVE_PYTHON$1" = xyes],
[AM_CONFIGURE_PYTHON_FLAGS([PYTHON$1],
[${PYTHON$1}],
[python$1_bind=yes],
[AS_IF([test "x$python$1_bind" = xauto],
[python$1_bind=no
TELL_PYTHON_DEVEL_NOT_PRESENT([$1], [AC_MSG_NOTICE])],
[TELL_PYTHON_DEVEL_NOT_PRESENT([$1], [AC_MSG_ERROR])])])])])
dnl
dnl $1: The Python interpreter to check
dnl $2: The module to check
dnl $3: Action if OK
dnl $4: Action if not OK
m4_define([PYTHON_CHECK_FOR_INSTALLED_MODULE],
[AS_IF(["$1" -c 'import $2' 2> /dev/null],
[$3], [$4])])
dnl
dnl $1: Python major version
m4_define([_ATTEMPT_TO_SET_PREFERRED_PYTHON_FOR_OSCAP_DOCKER],
[AS_IF([test "$HAVE_PYTHON$1" = yes],
[AC_MSG_CHECKING([whether ${PYTHON$1} can import Atomic])
PYTHON_CHECK_FOR_INSTALLED_MODULE(
[${PYTHON$1}], [Atomic],
[AC_MSG_RESULT([yes])
preferred_python="${PYTHON$1}"],
AC_MSG_RESULT([no]))])])
AM_PATH_PYTHON_OF_MAJOR_VERSION([2], [2.6], [HAVE_PYTHON2=yes], [HAVE_PYTHON2=no])
AM_PATH_PYTHON_OF_MAJOR_VERSION([3], [3.4], [HAVE_PYTHON3=yes], [HAVE_PYTHON3=no])
EVALUATE_PYTHON_CHECK_RESULT(3)
EVALUATE_PYTHON_CHECK_RESULT(2)
# Just to have PYTHON defined so Automake doesn't freak out.
# Therefore, we define it to one of available interpreters in favor of Python 3
PYTHON=:
test "x$HAVE_PYTHON2" = xyes && PYTHON="$PYTHON2"
test "x$HAVE_PYTHON3" = xyes && PYTHON="$PYTHON3"
AC_SUBST([PYTHON])
preferred_python=:
AS_IF([test "x$util_oscap_docker" = xyes],
[_ATTEMPT_TO_SET_PREFERRED_PYTHON_FOR_OSCAP_DOCKER(2)
_ATTEMPT_TO_SET_PREFERRED_PYTHON_FOR_OSCAP_DOCKER(3)
AS_IF([test "$preferred_python" = :],
[AS_IF([test "$PYTHON" != :],
[AC_MSG_NOTICE([Couldnt detect preferred python interpreter for oscap-docker. If you can, make sure one can import the 'Atomic' module and re-run the configure script.])
AC_MSG_NOTICE([Setting the oscap-docker python to '$PYTHON'.])
preferred_python="$PYTHON"],
[AC_MSG_ERROR([Not found a working Python interpreter and oscap-docker needs it. Aborting, as oscap-docker has been requested.])])])])
# oscap-docker determine python dir on default python version
OSCAPDOCKER_PYTHONDIR=`$preferred_python -c "import distutils.sysconfig; print(distutils.sysconfig.get_python_lib(0,0,prefix='$' '{prefix}'))"`
# oscap-docker uses preferred_python substitution
AC_SUBST([preferred_python])
AC_SUBST(oscapdocker_pythondir, $OSCAPDOCKER_PYTHONDIR)
@@@@PROBE_EVAL@@@@
AM_CONDITIONAL([WANT_CCE], test "$cce" = yes)
AM_CONDITIONAL([WANT_PROBES_INDEPENDENT], test "$probes_independent" = yes)
AM_CONDITIONAL([WANT_PROBES_UNIX], test "$probes_unix" = yes)
AM_CONDITIONAL([WANT_PROBES_LINUX], test "$probes_linux" = yes)
AM_CONDITIONAL([WANT_PROBES_SOLARIS], test "$probes_solaris" = yes)
AM_CONDITIONAL([WANT_SCE], test "$sce" = yes)
AM_CONDITIONAL([WANT_UTIL_OSCAP], test "$util_oscap" = yes)
AM_CONDITIONAL([WANT_UTIL_SCAP_AS_RPM], test "$util_scap_as_rpm" = yes)
AM_CONDITIONAL([WANT_UTIL_OSCAP_SSH], test "$util_oscap_ssh" = yes)
AM_CONDITIONAL([WANT_UTIL_OSCAP_DOCKER], test "$util_oscap_docker" = yes)
AM_CONDITIONAL([WANT_UTIL_OSCAP_VM], test "$util_oscap_vm" = yes)
AM_CONDITIONAL([WANT_UTIL_OSCAP_CHROOT], test "$util_oscap_chroot" = yes)
AM_CONDITIONAL([WANT_PYTHON2], test "$python2_bind" = yes)
AM_CONDITIONAL([WANT_PYTHON3], test "$python3_bind" = yes)
AM_CONDITIONAL([WANT_PERL], test "$perl_bind" = yes)
AM_CONDITIONAL([ENABLE_VALGRIND_TESTS], test "$vgcheck" = yes)
#
# Core
#
AC_CONFIG_FILES([Makefile
lib/Makefile
src/Makefile
xsl/Makefile
schemas/Makefile
cpe/Makefile
libopenscap.pc
src/common/Makefile
src/source/Makefile
tests/Makefile
tests/API/Makefile
swig/Makefile
swig/perl/Makefile
swig/python2/Makefile
swig/python3/Makefile
utils/Makefile
src/OVAL/Makefile
src/OVAL/adt/Makefile
src/OVAL/results/Makefile
tests/API/OVAL/Makefile
tests/API/OVAL/glob_to_regex/Makefile
tests/API/OVAL/schema_version/Makefile
tests/oscap_string/Makefile
tests/API/OVAL/unittests/Makefile
tests/API/OVAL/validate/Makefile
tests/API/OVAL/report_variable_values/Makefile
tests/mitre/Makefile
src/OVAL/probes/Makefile
src/OVAL/probes/probe/Makefile
src/OVAL/probes/crapi/Makefile
src/OVAL/probes/SEAP/Makefile
src/OVAL/probes/SEAP/generic/rbt/Makefile
tests/probes/Makefile
tests/API/crypt/Makefile
tests/API/SEAP/Makefile
tests/API/probes/Makefile
tests/sources/Makefile
tests/CPE/Makefile
tests/probes/file/Makefile
tests/probes/fileextendedattribute/Makefile
tests/probes/uname/Makefile
tests/probes/shadow/Makefile
tests/probes/sql57/Makefile
tests/probes/symlink/Makefile
tests/probes/family/Makefile
tests/probes/process58/Makefile
tests/probes/sysinfo/Makefile
tests/probes/rpminfo/Makefile
tests/probes/rpmverifyfile/Makefile
tests/probes/rpmverifypackage/Makefile
tests/probes/rpmverify/Makefile
tests/probes/systemdunitproperty/Makefile
tests/probes/systemdunitdependency/Makefile
tests/probes/runlevel/Makefile
tests/probes/filehash/Makefile
tests/probes/filehash58/Makefile
tests/probes/password/Makefile
tests/probes/interface/Makefile
tests/probes/textfilecontent54/Makefile
tests/probes/environmentvariable/Makefile
tests/probes/environmentvariable58/Makefile
tests/probes/xinetd/Makefile
tests/probes/selinuxboolean/Makefile
tests/probes/isainfo/Makefile
tests/probes/iflisteners/Makefile
tests/probes/maskattr/Makefile
tests/probes/sysctl/Makefile
src/CVSS/Makefile
tests/API/CVSS/Makefile
src/CVE/Makefile
tests/API/CVE/Makefile
src/CVRF/Makefile
tests/API/CVRF/Makefile
src/CPE/Makefile
tests/API/CPE/Makefile
tests/API/CPE/name/Makefile
tests/API/CPE/lang/Makefile
tests/API/CPE/dict/Makefile
tests/API/CPE/inbuilt/Makefile
src/CCE/Makefile
tests/API/CCE/Makefile
src/DS/Makefile
tests/DS/Makefile
tests/DS/ds_sds_index/Makefile
tests/DS/signed/Makefile
tests/DS/validate/Makefile
tests/bindings/Makefile
src/XCCDF/Makefile
src/XCCDF_POLICY/Makefile
tests/API/XCCDF/Makefile
tests/API/XCCDF/applicability/Makefile
tests/API/XCCDF/default_cpe/Makefile
tests/API/XCCDF/fix/Makefile
tests/API/XCCDF/guide/Makefile
tests/API/XCCDF/unittests/Makefile
tests/API/XCCDF/parser/Makefile
tests/API/XCCDF/progress/Makefile
tests/API/XCCDF/report/Makefile
tests/API/XCCDF/result_files/Makefile
tests/API/XCCDF/tailoring/Makefile
tests/API/XCCDF/variable_instance/Makefile
tests/schemas/Makefile
tests/bz2/Makefile
tests/codestyle/Makefile
tests/oval_details/Makefile
tests/nist/Makefile
tests/offline_mode/Makefile
src/SCE/Makefile
tests/sce/Makefile])
AC_CONFIG_FILES([run],
[chmod +x,-w run])
AC_CONFIG_FILES([tests/test_common.sh],
[chmod +x,-w tests/test_common.sh])
AC_CONFIG_FILES([utils/oscap-docker],
[chmod +x,-w utils/oscap-docker])
AC_OUTPUT
echo "******************************************************"
echo "OpenSCAP will be compiled with the following settings:"
echo
echo "oscap tool: $util_oscap"
echo "scap-as-rpm tool: $util_scap_as_rpm"
echo "oscap-ssh tool: $util_oscap_ssh"
echo "oscap-docker tool: $util_oscap_docker"
echo "oscap-vm tool: $util_oscap_vm"
echo "oscap-chroot tool: $util_oscap_chroot"
echo "python2 bindings enabled: $python2_bind"
echo "python3 bindings enabled: $python3_bind"
echo "perl bindings enabled: $perl_bind"
echo "use POSIX regex: $regex_posix"
echo "SCE enabled $sce"
echo "debugging flags enabled: $debug"
echo "CCE enabled: $cce"
echo
@@@@PROBE_TABLE@@@@
echo " system_info: always enabled"
echo
echo " === configuration ==="
echo " probe directory set to: $probe_dir"
echo ""
echo " === crypto === "
echo " library: $crapi_libname"
echo " libs: $crapi_LIBS"
echo " cflags: $crapi_CFLAGS"
echo ""
echo "Valgrind checks enabled: $vgcheck"
echo "CFLAGS: $CFLAGS"
echo "CXXFLAGS: $CXXFLAGS"