forked from nasa-jpl/ION-DTN
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
734 lines (647 loc) · 22.7 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
# configure.ac for ION
# Samuel Jero
# June 14, 2013
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.69)
AC_INIT(ion, open source 4.1.3, [email protected])
IS_NASA_B=0
# Josh Schendel removed the -Werror on 05/15/2012 per issue #355 to deal with
# all of the portability warnings introduced by autoconf v2.69 and
# automake v1.12.
#AM_INIT_AUTOMAKE([subdir-objects -Wall -Werror foreign])
AM_INIT_AUTOMAKE([subdir-objects -Wall foreign])
# some source file that will ensure that you are in the right directory.
AC_CONFIG_SRCDIR([ici/include/ion.h])
AC_CONFIG_HEADER([config.h])
AC_CONFIG_MACRO_DIR([m4])
# Moving developmental Makefiles out of the way if the user builds with autoconf
echo "Moving developmental Makefiles to Makefile.dev"
MAKEFILES=`find . -name 'Makefile'`
for f in $MAKEFILES; do
if [[ "$f" != "./Makefile" ]]; then
mv $f "$f.dev"
fi
done
## -----checking wsl type------------------------------------------------------------------- ##
virtual_device_name=`uname -r`;
SUB="Microsoft";
SUB2="wsl2";
SUB3="WSL2";
case $virtual_device_name in
*"$SUB2"*)
SUB=NULL;
;;
esac
case $virtual_device_name in
*"$SUB3"*)
SUB=NULL;
;;
esac
# check uname -r contains wsl1 or not
case $virtual_device_name in
*"$SUB"*)
echo -n "You can not install ION-DTN on WSL1 but you can install WSL2 and run ION-DTN on it."
echo
exit 0;
;;
esac
## -----checking wsl type------------------------------------------------------------------- ##
# Checks for programs.
AC_PROG_CC
AM_PROG_CC_C_O
#Automake v1.12 wants AM_PROG_AR, but it doesn't exist <v1.12 so do this
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
AC_PROG_LIBTOOL
AC_PROG_INSTALL
AC_PROG_MAKE_SET
LT_INIT
# Check for library functions
AC_CHECK_FUNCS([pow])
# Check Platform and Architecture
m4_include([./dccp_macro.m4])
AM_CFLAGS=""
AM_LDFLAGS=""
AM_LIBTOOLFLAGS=""
PLATFORM=""
case $host_os in
darwin*)
AC_DEFINE([darwin],[1],[Build Darwin specific platform code.])
AC_DEFINE([unix],[1],[Build Unix specific platform code.])
PLATFORM="darwin"
if test $host_cpu = "x86_64" ; then
AM_CFLAGS="$AM_CFLAGS -Dunix -Ddarwin -DSPACE_ORDER=3 -m64 "
echo "Build 64-bit Darwin specific platform code."
elif test $host_cpu = "aarch64" ; then
AM_CFLAGS="$AM_CFLAGS -Dunix -Ddarwin -DSPACE_ORDER=3 -m64"
echo "Build 64-bit ARM Darwin specific platform code."
elif test $host_cpu = "arm" ; then
AM_CFLAGS="$AM_CFLAGS -Dunix -Ddarwin -DSPACE_ORDER=3 -m64 "
echo "Build 64-bit ARM Darwin specific platform code."
else
AM_CFLAGS="$AM_CFLAGS -Dunix -Ddarwin -DSPACE_ORDER=2 -m32 "
echo "Build 32-bit Darwin specific platform code."
fi
;;
linux*)
PLATFORM="linux"
if test $host_cpu = "x86_64" ; then
AC_DEFINE([linux],[1],[Build 64-bit Linux specific platform code.])
AM_CFLAGS="$AM_CFLAGS -Dlinux -DSPACE_ORDER=3 -fno-strict-aliasing"
echo "Build 64-bit Linux specific platform code."
elif test $host_cpu = "aarch64" ; then
AC_DEFINE([linux],[1],[Build 64-bit Linux specific platform code.])
AM_CFLAGS="$AM_CFLAGS -Dlinux -DSPACE_ORDER=3 -fno-strict-aliasing"
echo "Build 64-bit Linux specific platform code."
else
AC_DEFINE([linux],[1],[Build 32-bit Linux specific platform code.])
AM_CFLAGS="$AM_CFLAGS -Dlinux -fno-strict-aliasing"
echo "Build 32-bit Linux specific platform code."
fi
#check for DCCP support
CHECK_DCCP()
;;
mingw*|cygwin*)
AC_DEFINE([mingw],[1],[Build Mingw specific platform code.])
PLATFORM="mingw"
AM_CFLAGS="$AM_CFLAGS -Dmingw"
build_windows=yes
;;
interix*)
AC_DEFINE([interix],[1],[Build Interix specific platform code.])
PLATFORM="iterix"
;;
*bsd*)
AC_DEFINE([freebsd],[1],[Build Freebsd specific platform code.])
PLATFORM="bsd"
case $host_cpu in
x86_64|amd64)
AM_CFLAGS="$AM_CFLAGS -Dfreebsd -DSPACE_ORDER=3 -m64 "
echo "Build 64-bit Freebsd specific platform code."
;;
*)
AM_CFLAGS="$AM_CFLAGS -Dfreebsd -DSPACE_ORDER=2 -m32 "
echo "Build 32-bit Freebsd specific platform code."
;;
esac
;;
solaris*)
PLATFORM="solaris"
build_solaris=yes
AM_CFLAGS="$AM_CFLAGS -std=gnu99"
if test "$BUILD_32_ON_64_SOLARIS" = "1"; then
if test "$CC" = "gcc"; then
AC_MSG_ERROR([You must compile with Solaris Studio CC when building 32-bit on 64-bit Solaris (configure with CC={path to Solaris Studio CC})])
fi
NO_WALL_WERROR_WALL=1
AC_DEFINE([solaris],[1],[Build Solaris specific platform code.])
AM_LDFLAGS="$AM_LDFLAGS -lrt -lsocket -lnsl"
AM_CFLAGS="$AM_CFLAGS -Dsolaris -Dunix -D__SVR4 -D_REENTRANT -DLONG_LONG_OKAY=0 -xmemalign=4i -features=extensions -xalias_level=any -xbuiltin=%none -DSPACE_ORDER=2"
echo "Build 32-bit ION on 64-bit solaris"
elif test $host_cpu = "sparc" ; then
AC_DEFINE([solaris],[1],[Build Solaris specific platform code.])
AM_LDFLAGS="$AM_LDFLAGS -lrt -lsocket -lnsl"
AM_CFLAGS="$AM_CFLAGS -Dsolaris -Dunix -D__SVR4 -D_REENTRANT -fno-strict-aliasing -fno-builtin -DSPACE_ORDER=3"
echo "Build Solaris/SPARC specific platform code."
else
AC_DEFINE([solaris],[1],[Build Solaris specific platform code.])
AM_LDFLAGS="$AM_LDFLAGS -lrt -lsocket -lnsl"
AM_CFLAGS="$AM_CFLAGS -Dsolaris -Dunix -D__SVR4 -D_REENTRANT -fno-strict-aliasing -DSPACE_ORDER=3"
echo "Build Solaris specific platform code."
fi
# Do bitness check
AS_IF([test "x$ISAINFO" != "xno"],
[isainfo_b=`isainfo -b`],
[isainfo_b="x"])
if test "$BUILD_32_ON_64_SOLARIS" = "1"; then
AM_CFLAGS="$AM_CFLAGS -m32"
echo "Build 32-bit code on 64-bit machine"
elif test "$isainfo_b" = "64"; then
AM_CFLAGS="$AM_CFLAGS -m64"
echo "Build 64-bit code"
else
AM_CFLAGS="$AM_CFLAGS -m32"
echo "Build 32-bit code"
fi
;;
vxworks*)
AC_DEFINE([vxworks],[1],[Build VXWorks specific platform code.])
PLATFORM="vxworks"
;;
*)
AC_MSG_ERROR(["OS $host_os is not supported"])
esac
##Process user flags
#
# allow the user running configure to disable ACS when using bpv6
#
AC_ARG_ENABLE(
acs,
[AC_HELP_STRING([--enable-acs], [enable Aggregate Custody Signals])],
[ENABLE_BPACS=yes],
[ENABLE_BPACS=no])
AM_CONDITIONAL(ENABLE_BPACS, test "x$ENABLE_BPACS" = "xyes")
#
# allow the user running configure to build bpv6
#
AC_ARG_ENABLE(
bpv6,
[AC_HELP_STRING([--enable-bpv6], [force build of bpv6])],
[VER="4.1.3"
VER="-DVNAME=ION-OPEN-SOURCE-$VER"
AM_CFLAGS="$AM_CFLAGS $VER -DBUILD_BPv6"
BUILD_BPv6=true
BP_DIR="bpv6"
AC_SUBST([BP_DIR])
case "${ENABLE_BPACS}" in
yes) AM_CFLAGS="$AM_CFLAGS -DENABLE_BPACS"
echo "Building ION with ACS";;
no) ENABLE_BPACS=no;;
esac
echo "Building ION with BP version 6"],
[VER="4.1.3"
VER="-DVNAME=ION-OPEN-SOURCE-$VER"
AM_CFLAGS="$AM_CFLAGS $VER -DBUILD_BPv7"
BUILD_BPv7=true
BP_DIR="bpv7"
AC_SUBST([BP_DIR])
ENABLE_BPACS=no
echo "Building ION with BP version 7"])
AM_CONDITIONAL(BUILD_BPv7, test x$BUILD_BPv7 = xtrue)
AM_CONDITIONAL(BUILD_BPv6, test x$BUILD_BPv6 = xtrue)
#
# allow the user running configure to disable IMC
#
AC_ARG_ENABLE(
imc,
[AC_HELP_STRING([--disable-imc], [disable Interplanetary Multicast])],
[],
[AM_CFLAGS="$AM_CFLAGS -DENABLE_IMC"
ENABLE_IMC=yes])
AM_CONDITIONAL(ENABLE_IMC, test "x$ENABLE_IMC" = "xyes")
#
# allow the user running configure to enable AMS_INDUSTRIAL
#
AC_ARG_ENABLE(
ams-industrial,
[AC_HELP_STRING([--enable-ams-industrial], [enable AMS_INDUSTRIAL])],
[ENABLE_AMS_INDUSTRIAL=yes
AM_CFLAGS="$AM_CFLAGS -DAMS_INDUSTRIAL"],
[ENABLE_AMS_INDUSTRIAL=no])
AM_CONDITIONAL(ENABLE_AMS_INDUSTRIAL, test "x$ENABLE_AMS_INDUSTRIAL" = "xyes")
#
# allow the user running configure to enable the enhanced watch character option
#
AC_ARG_ENABLE(
ewchar,
[AC_HELP_STRING([--enable-ewchar], [enable enhanced watch characters])],
[ENABLE_EWCHAR=yes
AM_CFLAGS="$AM_CFLAGS -DEWCHAR"],
[ENABLE_EWCHAR=no])
AM_CONDITIONAL(ENABLE_EWCHAR, test "x$ENABLE_EWCHAR" = "xyes")
#
# allow the user running configure to enable the command line history option
#
AC_ARG_ENABLE(
commandline-history,
[AC_HELP_STRING([--enable-commandline-history], [enable command line history])],
[AC_CHECK_PROG([readline_present], [readline], [1], [0])
if test "$readline_present" = 1; then
ENABLE_CMD_HIST=yes
AM_CFLAGS="$AM_CFLAGS -DINPUT_HISTORY"
else
ENABLE_CMD_HIST=no
AC_MSG_ERROR([You need to have the readline executable installed to use this option.])
fi
],
[ENABLE_CMD_HIST=no
echo "Command line history disabled."
])
AM_CONDITIONAL(ENABLE_CMD_HIST, test "x$ENABLE_CMD_HIST" = "xyes")
#
# allow the user running configure to enable high-speed ION
#
AC_ARG_ENABLE(
high-speed,
[AC_HELP_STRING([--enable-high-speed], [Enable high-speed ION, increases memory usage.])],
[AM_CFLAGS="$AM_CFLAGS -DENABLE_HIGH_SPEED"
ENABLE_HIGH_SPEED=yes],
[])
AM_CONDITIONAL(ENABLE_HIGH_SPEED, test x$ENABLE_HIGH_SPEED = xyes)
#
# allow the user running configure to force the use of Posix Named Semaphores over the
# otherwise recommended system. This might not produce a running system on some platforms
AC_ARG_ENABLE(
force-posix-named-semaphores,
[AC_HELP_STRING([--enable-force-posix-named-semaphores],
[Force the use of Posix Named Semaphores, which are faster then SVR4, but might not work on this platform])],
[AM_CFLAGS="$AM_CFLAGS -DFORCE_POSIX_NAMED_SEMAPHORES"
ENABLE_FORCE_POSIX_NAMED_SEMAPHORES=yes],
[])
#
# allow the user running configure to force the use of SVR4 Semaphores over the
# otherwise recommended system. They are supported on all process-based platforms
AC_ARG_ENABLE(
force-svr4-semaphores,
[AC_HELP_STRING([--enable-force-svr4-semaphores],
[Force the use of SVR4 Semaphores, which are supported on most platforms, but might be slower])],
[AM_CFLAGS="$AM_CFLAGS -DFORCE_SVR4_SEMAPHORES"
ENABLE_FORCE_SVR4_SEMAPHORES=yes],
[])
#
# allow the user running configure to enable bpsec debugging
#
AC_ARG_ENABLE(
bpsec-debugging,
[AC_HELP_STRING([--enable-bpsec-debugging], [Enable bpsec debugging])],
[AM_CFLAGS="$AM_CFLAGS -DBPSEC_DEBUGGING=1 -DBPSEC_DEBUG_LVL=1 -DBCB_DEBUGGING=1 -DBCB_DEBUG_LVL=1 -DBCB_TEST_LOGGING=1 -DBIB_DEBUGGING=1 -DBIB_DEBUG_LVL=1 -DBIB_TEST_LOGGING=1"
ENABLE_BPSEC_DEBUGGING=yes],
[])
#
# Try to enable DCCP support
#
AC_ARG_ENABLE(
dccp,
[AC_HELP_STRING([--enable-dccp], [Enable Support for DCCP as a convergence layer])],
[AC_DEFINE([build_dccp],[1],[DCCP only supported on Linux >=3.2.0])],
[])
#
# allow the user running configure to enable UniBo CGR
#
AC_ARG_ENABLE(
unibo-cgr,
[AC_HELP_STRING([--enable-unibo-cgr], [enable University of Bologna CGR])],
[if test "$BUILD_BPv7" == "true" ; then
UNIBO_CGR=yes
AC_DEFINE([UNIBO_CGR],[1],[Define to 1 to build Unibo-CGR])
echo "Building ION with UniBo CGR code"
else
echo "ERROR: UniBo CGR is not available with BP version 6"
AC_DEFINE([UNIBO_CGR],[0],[Define to 1 to build Unibo-CGR])
exit 1
fi],
[UNIBO_CGR=no
AC_DEFINE([UNIBO_CGR],[0],[Define to 1 to build Unibo-CGR])])
AM_CONDITIONAL(UNIBO_CGR, test "x$UNIBO_CGR" = "xyes")
#
# allow the user running configure to disable manpage creation
#
AC_ARG_ENABLE(
manpages,
[AC_HELP_STRING([--disable-manpages], [disable manpage creation])],
[],
[AM_CFLAGS="$AM_CFLAGS -DENABLE_MANPAGES"
ENABLE_MANPAGES=yes])
AM_CONDITIONAL(ENABLE_MANPAGES, test "x$ENABLE_MANPAGES" = "xyes")
#
# Control building /contrib utlities
#
AC_ARG_ENABLE(
contrib,
[AC_HELP_STRING([--disable-contrib],[Disable building third-party contributed utilities])],
[case "${enableval}" in
yes) BUILD_CONTRIB=yes;;
no) BUILD_CONTRIB=no;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-contrib]);;
esac],
[BUILD_CONTRIB=no])
AM_CONDITIONAL(BUILD_CONTRIB, test "x$BUILD_CONTRIB" = "xyes")
#
# Allow user to disable crypto... if crypto is even enabled
#
if test "$IS_NASA_B" = "1"; then
# To Disable crypto, use "./configure --disable-crypto"
AC_ARG_ENABLE([crypto],
[ --disable-crypto Turn off cryptography],
[case "${enableval}" in
yes) crypto=true ;;
no) crypto=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --disable-crypto]) ;;
esac],[crypto=true])
AM_CONDITIONAL([CRYPTO], [test x$crypto = xtrue])
if test x$crypto = xtrue; then
echo ""
#DoStuff
else
AC_SUBST( [CRYPTO_LIBS], [""] )
fi
AC_DEFINE([NASA_PROTECTED_FLIGHT_CODE],[1],[Build ION NASA protected flight code])
else
AM_CONDITIONAL([CRYPTO], [false])
AC_SUBST( [CRYPTO_LIBS], [""] )
fi
#
# Control whether AMS debugging info is printed.
#
AC_ARG_ENABLE([ams-debug],
[ --enable-ams-debug Enable AMS debugging info],
[ AC_DEFINE([AMSDEBUG], 1, [Enable AMS debugging info]) ])
#
# Dynamically choose whether or not to instrument code for gcov code coverage
# Default is not to instrument the code for gcov code coverage.
#
AC_ARG_WITH([gcov],
[AS_HELP_STRING([--with-gcov], [Turn on code coverage instrumentation])],
[gcov=yes;],
[])
if test "x$gcov" = "xyes" ; then
echo "Instrument code for gcov coverage analysis... yes"
CFLAGS="$CFLAGS -g -O0 -fprofile-arcs -ftest-coverage"
LDFLAGS="$LDFLAGS -fprofile-arcs -ftest-coverage -lgcov"
else
echo "Instrument code for gcov coverage analysis... no"
fi
AM_CONDITIONAL([ENABLE_GCOV], [test "x$gcov" = "xyes"])
#
# Allow the user to configure for debugging with gdb
#
AC_ARG_WITH([debugging],
[AS_HELP_STRING([--with-debugging], [Remove compiler optimizations])],
[debugging=yes;],
[])
if test "x$debugging" = "xyes" ; then
echo "Setting compiler optimization level to -O0"
CFLAGS="$CFLAGS -g -O0"
fi
AM_CONDITIONAL([ENABLE_DEBUGGING], [test "x$debugging" = "xyes"])
#
# Dynamically choose whether or not to build against expat libraries.
# Expat is needed by AMS if XML configuration files are used.
# Default is not to build against libexpat.
#
AC_ARG_WITH([expat],
[AS_HELP_STRING([--with-expat], [Turn on libexpat requirements])],
[expat=yes;],
[])
if test "x$expat" = "xyes" ; then
echo "Build against libexpat... yes"
else
echo "Build against libexpat... no"
CFLAGS="$CFLAGS -DNOEXPAT"
fi
AM_CONDITIONAL([ENABLE_EXPAT], [test "x$expat" = "xyes"])
#
# If valgrind is present, allow special MTAKE/MRELEASE valgrind tutors.
#
AC_ARG_ENABLE([valgrind], AC_HELP_STRING([--disable-valgrind],[Do not enable valgrind debugging [default=check]]),
[ ], [ enable_valgrind=check ])
if test "x$enable_valgrind" != xno; then
AC_CHECK_HEADER(valgrind/valgrind.h,
[AC_DEFINE([HAVE_VALGRIND_VALGRIND_H], [1], [enable valgrind macros])
valgrind_present=yes],
[valgrind_present=no])
if test "x$enable_valgrind" == xyes && test "x$valgrind_present" == xno; then
# User specifically requested valgrind but we can't find it.
AC_MSG_ERROR([valgrind/valgrind.h not found but --enable-valgrind requested])
fi
if test "x$valgrind_present" == xyes; then
# Valgrind < 3.6.1-1 (Debian/Ubuntu) and gcc >= 4.6 triggers "unused-but-set-variable"
# warnings in the valgrind macros. This version is present in debian unstable
# 10/11, and Ubuntu 11.10.
AC_MSG_CHECKING([if valgrind is compatible with -Wunused-but-set])
ORIGCFLAGS=$CFLAGS
CFLAGS="$CFLAGS -Wall -Werror"
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[#include <valgrind/valgrind.h>]],
[[VALGRIND_MALLOCLIKE_BLOCK(1, 100, 0, 1);
VALGRIND_FREELIKE_BLOCK(1, 0);]])],
[AC_MSG_RESULT([yes]); valgrind_wunused_but_set_compat=yes],
[AC_MSG_RESULT([no]); valgrind_wunused_but_set_compat=no])
CFLAGS="$ORIGCFLAGS"
# If not compatible with -Wset-but-not-used, then disable this warning.
if test "x$valgrind_wunused_but_set_compat" == "xno"; then
AC_MSG_NOTICE([adding -Wno-unused-but-set-variable to VALGRIND_COMPAT_CFLAGS])
AC_SUBST([VALGRIND_COMPAT_CFLAGS], [-Wno-unused-but-set-variable])
fi
fi
fi
AC_ARG_ENABLE([sysctl-check], AC_HELP_STRING([--disable-sysctl-check],
[Disable checking sysctl configuration on OSX and FreeBSD]),
[], [enable_sysctl_check=yes])
if test "x$enable_sysctl_check" = xyes; then
echo "checking sysctl configuration..."
echo
if ! ${ac_confdir}/sysctl_script.sh; then
echo "Reconfigure with --disable-sysctl-check to bypass this check."
echo "Update sysctl configuration by running ./install_macos_sysctl.sh"
exit 1
fi
fi
AC_ARG_WITH([mysql],
[AS_HELP_STRING([--with-mysql], [Enable MYSQL support for NM MGR])],
[mysql=yes;],
[])
if test "x$mysql" = "xyes" ; then
echo "Build against libmysql... yes"
CFLAGS="$CFLAGS -DHAVE_MYSQL"
else
echo "Build against libmysql... no"
fi
AM_CONDITIONAL([ENABLE_MYSQL], [test "x$mysql" = "xyes"])
AC_ARG_WITH([ncurses],
[AS_HELP_STRING([--with-ncurses], [Enable NCURSES support for NM MGR])],
[ncurses=yes;],
[])
if test "x$ncurses" = "xyes" ; then
echo "Build against libncurses... yes"
CFLAGS="$CFLAGS -DUSE_NCURSES"
else
echo "Build against libncurses... no"
fi
AM_CONDITIONAL([ENABLE_NCURSES], [test "x$ncurses" = "xyes"])
AC_ARG_ENABLE(
nmrest,
[AC_HELP_STRING([--enable-nmrest], [Enable REST API for NM Mgr])],
[BUILD_NM_REST=true],
[BUILD_NM_REST=false]
)
AM_CONDITIONAL([BUILD_NM_REST], [test "x$BUILD_NM_REST" = "xtrue"])
#
# allow the user running configure to declare that the platform is musl
#
AC_ARG_ENABLE(
musl,
[AC_HELP_STRING([--enable-musl], [declare that the platform is MUSL])],
[AM_CFLAGS="$AM_CFLAGS -DMUSL"
MUSL=yes],
[]
)
if test "x$MUSL" = "xyes" ; then
echo "Building for MUSL... yes"
fi
AM_CONDITIONAL([MUSL], [test "x$MUSL" = "xyes"])
#
# allow the user running configure to choose the TCPCL_LOW_CYCLE option
#
AC_ARG_ENABLE(
tcpcl-low-cycle,
[AC_HELP_STRING([--enable-tcpcl-low-cycle], [enable TCPCL_LOW_CYCLE option])],
[AM_CFLAGS="$AM_CFLAGS -DTCPCL_LOW_CYCLE"
TCPCL_LOW_CYCLE=yes],
[]
)
if test "x$TCPCL_LOW_CYCLE" = "xyes" ; then
echo "Enabling TCPCL_LOW_CYCLE... yes"
fi
AM_CONDITIONAL([TCPCL_LOW_CYCLE], [test "x$TCPCL_LOW_CYCLE" = "xyes"])
# Check for libraries.
ORIGCFLAGS="$CFLAGS"
CFLAGS="$AM_CFLAGS $CFLAGS"
AC_CHECK_LIB(
[expat],
[XML_GetCurrentLineNumber],
[ AC_SUBST( [EXPAT_LIBS], ["-lexpat"] ) ],
[ AM_COND_IF([ENABLE_EXPAT], AC_MSG_ERROR([You need to install the libexpat1-dev library to build with expat.]), AC_MSG_WARN([If you wish to use XML configuration files for AMS you will need to compile against the Expat XML development libraries. To do this install the libexpat1-dev library then recompile ION using the "./configure --with-expat" flag.]) )]
)
AC_CHECK_LIB(
[pthread],
[pthread_create],
[ AM_LDFLAGS="$AM_LDFLAGS -lpthread" ],
[AC_MSG_ERROR([You need pthread library.]) ]
)
CFLAGS="$ORIGCFLAGS"
AC_CHECK_LIB(
[mysqlclient],
[mysql_real_connect],
[ AC_SUBST( [MYSQL_LIBS], ["-lmysqlclient"] ) ],
[ AM_COND_IF([ENABLE_MYSQL], AC_MSG_ERROR([You need to install the mysqlclient library to build with MySQL. Run configure with --with-mysql to turn on this feature.]), AC_MSG_WARN([If you wish to use MySQL for NM you will need to install the libmysqlclient.]) )]
)
AC_CHECK_LIB(
[ncurses],
[initscr],
[ AC_SUBST( [NCURSES_LIBS], ["-lncurses -lform -lmenu -lpanel"] ) ],
[ AM_COND_IF([ENABLE_NCURSES], AC_MSG_ERROR([You need to install the NCURSES library to build with NCURSES TUI support. Run configure with --with-ncurses to turn on this feature.]), AC_MSG_WARN([If you wish to use the NCURSES TUI for NM you will need to install the NCURSES library.]) )]
)
# Check for programs to build documentation
AC_CHECK_PROGS([POD_DOCUMENTATION], [pod2man pod2html], [1] )
if test "$POD_DOCUMENTATION" = 1; then
echo "ERROR: You need to have pod2man for documentation."
exit -1
fi
# Check for tools to compile documentation into ION.pdf
AC_PATH_PROG([PS2PDF], [ps2pdf])
AC_PATH_PROG([PDF2PS], [pdf2ps])
AC_PATH_PROG([PSJOIN], [psjoin])
AC_PATH_PROG([PDFJOIN], [pdfjoin])
AC_MSG_CHECKING([for fallback included psjoin])
if test -x "$PWD/doc/psjoin"; then
PSJOIN="$PWD/doc/psjoin"
AC_MSG_RESULT($PSJOIN)
else
AC_MSG_RESULT([not found])
fi
AC_MSG_CHECKING([for fallback included pdfjoin])
if test -x "$PWD/doc/pdfjoin"; then
PDFJOIN="$PWD/doc/pdfjoin"
AC_MSG_RESULT($PDFJOIN)
else
AC_MSG_RESULT([not found])
fi
AC_PATH_PROG([GROFF], [groff])
AC_MSG_CHECKING([if groff suports -ms])
if test "$GROFF" && echo | $GROFF -ms - >/dev/null 2>/dev/null; then
AC_MSG_RESULT($GROFF)
GROFFMS="$GROFF"
else
AC_MSG_RESULT([not found])
AC_MSG_NOTICE([try installing groff and the ms plugin])
fi
AC_SUBST([GROFFMS], $GROFFMS)
AC_PATH_PROG([MANOPTS], [man])
AC_MSG_CHECKING([if man supports -l])
if test "$MANOPTS" && echo | $MANOPTS -l - >/dev/null 2>/dev/null; then
AC_MSG_RESULT($MANOPTS)
else
MANOPTS=""
AC_MSG_RESULT([not found])
AC_MSG_NOTICE([try installing a version of man that supports -l])
fi
AC_SUBST([MANOPTS], $MANOPTS)
AC_MSG_CHECKING([for tools to build autodoc])
if test "$PS2PDF" && test "$PDF2PS" && test "$PSJOIN" && test "$GROFFMS" && test -n "$MANOPTS"; then
AC_MSG_RESULT([(skipping autodoc)])
# Comment out line above and uncomment the two below to enable automatic generation of ION.pdf
# AC_MSG_RESULT([found])
# buildautodoc="yes"
else
AC_MSG_RESULT([not found (skipping autodoc)])
AC_MSG_NOTICE([Ensure the ghostscript, psutils, groff-base and groff packages are installed.])
fi
AM_CONDITIONAL([ENABLE_AUTODOC], [ test "$buildautodoc" ])
# Add user defined CFLAGS
CFLAGS="$CFLAGS $CUSTOM_CFLAGS"
# Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS([fcntl.h malloc.h netdb.h netinet/in.h stddef.h stdlib.h string.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h unistd.h])
AC_C_CONST
AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_STRUCT_TM
AC_TYPE_UID_T
# Checks for library functions.
# commented out library functions that should exist everywhere.
# otherwise, autoconf insisted that malloc.c, mktime.c were included in distro...
AC_FUNC_FORK
AC_PROG_GCC_TRADITIONAL
#AC_FUNC_MALLOC
#AC_FUNC_MEMCMP
#AC_FUNC_MKTIME
#AC_FUNC_SELECT_ARGTYPES
AC_TYPE_SIGNAL
#AC_FUNC_STAT
#AC_FUNC_STRFTIME
AC_CHECK_FUNCS([alarm ftruncate getcwd gethostbyaddr gethostbyname gethostname gettimeofday memset mkdir mkfifo rmdir select socket strcasecmp strchr strerror strncasecmp strstr strtoul uname])
#Write AM_* flag variables
AC_SUBST([AM_LDFLAGS],"$AM_LDFLAGS")
AC_SUBST([AM_CFLAGS],"$AM_CFLAGS")
AC_SUBST([AM_LIBTOOLFLAGS],"$AM_LIBTOOLFLAGS")
AM_CONDITIONAL([ION_NASA_B],[test "$IS_NASA_B" = "1"])
AM_CONDITIONAL([LINUX_BUILD], [test "x$PLATFORM" = "xlinux"])
AM_CONDITIONAL([SOLARIS_STUDIO_CC], [test "$BUILD_32_ON_64_SOLARIS" = "1"])
AM_CONDITIONAL([WINDOWS], [test "$build_windows" = "yes"])
AM_CONDITIONAL([SOLARIS], [test "$build_solaris" = "yes"])
#Output!
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([contrib/Makefile])
AC_OUTPUT