This repository has been archived by the owner on Jan 30, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
/
configure.in
2082 lines (1875 loc) · 69.2 KB
/
configure.in
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> TODOs
dnl> should use STDC_HEADERS instead of __STDC__
dnl> Cleanup Autoconf2 (obsolete Autoconf1 macros still in use)
dnl> Solaris 8 -- libgcc_s -- need test
dnl> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
dnl>
dnl> Copyright (c) 1998 - 2012 Luca Deri <[email protected]>
dnl> Rocco Carbone <[email protected]>
dnl> and Burton M. Strauss III <[email protected]>
dnl>
dnl> Written Oct2002 by Burton M. Strauss III <[email protected]>
dnl> (Loosely based on the earlier ntop version)
dnl>
dnl> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
dnl>
dnl> This program is free software; you can redistribute it and/or modify
dnl> it under the terms of the GNU General Public License as published by
dnl> the Free Software Foundation; either version 2 of the License, or
dnl> (at your option) any later version.
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>
dnl> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
dnl> this file is processed via 'autoconf' to produce the 'configure' script
dnl> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
dnl>
dnl>
dnl> Initialization lines.
dnl> Note that the AC_INIT must, simply MUST be the first line.
dnl> Anything before it is ignored in autoconf 2.5x (and beyond?)
dnl>
dnl> Edit the version # in the AC_INIT line to roll the version.
dnl> Edit NTOP_VERSION_EXTRA to put something extra (e.g. SourceForge rpm version"
dnl> into the stamp.
dnl>
AC_INIT([ntop],[4.99.3])
dnl> The prereq is really 2.53, i.e. automake 1.6, but Darwin uses 2.52...
AC_PREREQ([2.52])
SCRIPTVER="v4.99.3-06-03-2012"
dnl>
dnl> generate the config header
dnl>
umask 002
AM_CONFIG_HEADER(config.h)
HAS_ERROR=
HAS_WARNING=
NTOP_VERSION_EXTRA=""
echo
echo "Welcome to $PACKAGE_NAME, Version $PACKAGE_VERSION $NTOP_VERSION_EXTRA"
echo "Copyright (C) 1998-2012 Luca Deri <[email protected]>"
THE_UID=`id -u`
if test $THE_UID -eq 0; then
echo "################## WARNING ##################"
echo
echo "Running configure and compiling as root might lead"
echo "to compilation issues."
echo
echo "Please run configure as normal user, not as superuser"
echo
echo "#############################################"
fi
echo
echo "Configuration script version $SCRIPTVER"
echo
echo "************************************************************************"
echo "* *"
echo "* NOTICE: I know you're used to ignoring output from ./configure *"
echo "* *"
echo "* ntop has a lot of complexity and interdependences. *"
echo "* *"
echo "* Please, please AT LEAST read the stuff in these boxes! *"
echo "* *"
echo "*>>> The ACTION taken by ./configure is shown prefixed with '>>>' *"
echo "* *"
echo "* If that ACTION is unacceptable, *"
echo "*??? Steps to take to fix the problem are shown, prefixed with '???' *"
echo "* *"
echo "************************************************************************"
echo
if test ".${NTOPCONFIGDEBUG}" = "."; then
echo "NOTE:"
echo
echo " To enable additional, debugging messages during the ./configure"
echo " execution, do this before running ./configure:"
echo
echo "$ export NTOPCONFIGDEBUG=yes"
echo
fi
CONFIGURE_PARAMETERS=$*
echo
echo "Configuring ${PACKAGE_NAME} according to your request(s):"
echo " ./configure ${CONFIGURE_PARAMETERS}"
echo
dnl> This has to be here due to some odd dependency...
AC_CANONICAL_TARGET
dnl> Basic sanity check ... does ntop.c exist?
AC_CONFIG_SRCDIR([ntop.c])
dnl> force configure to use current directory
AC_CONFIG_AUX_DIR(.)
AM_INIT_AUTOMAKE()
dnl> NTOPCONFIGDEBUG_SETTINGS([init automake])
dnl> make NTOPDIR the default for the installation
AC_PREFIX_DEFAULT(${NTOPDIR:-/usr/local})
# Set constants and defaults
SO_VERSION_PATCH=
MAKE_SHARED_LIBRARY_PARM="-shared -flat_namespace"
AS=
CCLD=
DEFS="-DHAVE_CONFIG_H"
DLLTOOL=
DYN_FLAGS=
EXEEXT=
INCS=
LIBS=
OBJDUMP=
OBJEXT=o
dnl> NTOPCONFIGDEBUG_SETTINGS([ntop defaults])
# Checks for programs.
AC_PROG_CPP
AC_PROG_CC
dnl> AC_PROG_CXX no c++ code (yet?)
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AM_ENABLE_SHARED
AM_PROG_LIBTOOL
dnl> NTOPCONFIGDEBUG_SETTINGS([After ac stuff])
dnl> The blocks of code check to see if the various gnu auto* tools are installed
dnl> have been replaced by manditory autogen.sh usage.
dnl> autoheader stuff...just ignore
AH_TEMPLATE([HAVE_INT16_T], [Define for int16 typedef])
AH_TEMPLATE([HAVE_INT32_T], [Define for int32 typedef])
AH_TEMPLATE([HAVE_INT64_T], [Define for int64 typedef])
AH_TEMPLATE([HAVE_INT8_T], [Define for int8 typedef])
AH_TEMPLATE([HAVE_UINT16_T], [Define for unsigned int 16 typedef])
AH_TEMPLATE([HAVE_UINT32_T], [Define for unsigned int 32 typedef])
AH_TEMPLATE([HAVE_UINT64_T], [Define for unsigned int 64 typedef])
AH_TEMPLATE([HAVE_UINT8_T], [Define for unsigned int 8 typedef])
AH_TEMPLATE([HAVE_U_INT16_T], [Define for unsigned int 16 typedef])
AH_TEMPLATE([HAVE_U_INT32_T], [Define for unsigned int 32 typedef])
AH_TEMPLATE([HAVE_U_INT64_T], [Define for unsigned int 64 typedef])
AH_TEMPLATE([HAVE_U_INT8_T], [Define for unsigned int 8 typedef])
dnl> end autoheader stuff
AC_ARG_ENABLE(void,
[ +--ntop-specific:------------------------------------------------------------+])
AC_ARG_WITH(void,
[ +--external-packages:--------------------------------------------------------+])
AC_ARG_WITH(ssl,
[ --without-ssl disable HTPPS support [[default=enabled]]],
if test "x$withval" = xno; then
ac_disable_openssl="yes"
else
ac_disable_openssl="no"
fi,
ac_disable_openssl="no")
AC_ARG_ENABLE(plugins,
[ --disable-plugins disable compilation of plugins [[default=enabled]]],
if test "x$enableval" = xno; then
ac_disable_plugins="yes"
else
ac_disable_plugins="no"
fi,
ac_disable_plugins="no")
AC_ARG_ENABLE(ignoresigpipe,
[ --enable-ignoresigpipe Ignore SIGPIPE errors [[default=do not ignore]]],
ac_enable_ignoresigpipe="$enableval",
ac_enable_ignoresigpipe="no")
AC_ARG_ENABLE(snmp,
[ --disable-snmp Disable SNMP support [[default=disable]]],
if test "x$enableval" = xno; then
ac_disable_snmp="yes"
else
ac_disable_snmp="no"
fi,
ac_disable_snmp="yes")
AC_ARG_ENABLE(jumbo-frames,
[ --enable-jumbo-frames Enable Jumbo (9K) Ethernet frames [[default=disabled]]],
ac_enable_jumbo_frames="$enableval",
ac_enable_jumbo_frames="no")
dnl>
dnl> Define the "WITH"s for package root directories ... deal with these later...
dnl>
AC_ARG_WITH(void,
[ +-External-source-locations:-------------------------------------------------+])
AC_ARG_WITH( rrd-home,
[ --with-rrd-home=DIR Usually /usr/local/rrdtool-1.2.x],
RRD_HOME="$withval",
RRD_HOME=/usr/local/rrdtool-1.2.19)
AC_ARG_WITH( pcap-root,
[ --with-pcap-root=DIR LBNL pcap located in DIR],
PCAP_ROOT="$withval",
PCAP_ROOT=)
AC_ARG_WITH( gdbm-root,
[ --with-gdbm-root=DIR gdbm located in DIR],
GDBM_DIRECTORY="$withval",
GDBM_DIRECTORY=)
AC_ARG_WITH( gdbm-lib,
[ --with-gdbm-lib=DIR or libgdbm located in DIR],
GDBM_LIB="$withval",
GDBM_LIB=)
AC_ARG_WITH( gdbm-include,
[ --with-gdbm-include=DIR or gdbm.h located in DIR],
GDBM_INCLUDE="$withval",
GDBM_INCLUDE=)
AC_ARG_WITH( zlib-root,
[ --with-zlib-root=DIR zlib located in DIR],
ZLIB_DIRECTORY="$withval",
ZLIB_DIRECTORY=)
AC_ARG_WITH( zlib-lib,
[ --with-zlib-lib=DIR or libz located in DIR],
ZLIB_LIB="$withval",
ZLIB_LIB=)
AC_ARG_WITH( zlib-include,
[ --with-zlib-include=DIR or zlib.h located in DIR],
ZLIB_INCLUDE="$withval",
ZLIB_INCLUDE=)
AC_ARG_WITH( ossl-root,
[ --with-ossl-root=DIR openSSL located in DIR],
OSSL_DIRECTORY="$withval",
OSSL_DIRECTORY=)
AC_ARG_WITH( ossl-lib,
[ --with-ossl-lib=DIR or libssl located in DIR],
OSSL_LIB="$withval",
OSSL_LIB=)
AC_ARG_WITH( ossl-include,
[ --with-ossl-include=DIR or ssl.h located in DIR],
OSSL_INCLUDE="$withval",
OSSL_INCLUDE=)
AC_ARG_WITH( memorydebug,
[ --with-memorydebug=VALUE Set numeric code for memory debug option],
MEMORYDEBUG="$withval",
MEMORYDEBUG=)
AC_ARG_ENABLE(void,
[ +----------------------------------------------------------------------------+])
AC_ARG_WITH(void,
[ +----------------------------------------------------------------------------+])
AC_CHECK_FILE(aclocal.m4, , [
echo ""
echo "Invoking aclocal to create aclocal.m4..."
$ACLOCAL
echo ""
])
AC_CHECK_FILE(depcomp, , [
echo ""
echo "depcomp missing... will install it in this ntop directory."
echo " Invoking automake to copy depcomp..."
$AUTOMAKE --gnu --copy --add-missing
echo ""
])
dnl> Networking libraries
AC_SEARCH_LIBS([gethostbyname], [nsl resolv])
AC_SEARCH_LIBS([socket], [xnet socket])
dnl> Handle the root -> lib/include settings
NTOP_SET_LIBINC(PCAP)
NTOP_SET_LIBINC(GDBM)
NTOP_SET_LIBINC(ZLIB)
dnl> From here on out, we only use the _INCLUDE and _LIB except for locale and glibconfig
dnl> NTOPCONFIGDEBUG_SETTINGS([After set libinc])
dnl>
dnl> Yes, we want to minimize the amount of work before we tell
dnl> the user we can't compile for this host, but this has to
dnl> to preceed the OS stuff so $CC is set.
dnl>
echo
echo "Checking C compiler program and features..."
echo
AM_PROG_CC_STDC
if test ".${ac_cv_prog_cc_stdc}" = ".no"; then
echo
echo "*******************************************************************"
echo "*"
echo "* WARNING: Attempting to configure for non ANSI standard C."
echo "*"
echo "*>>> This is unsupported."
echo "*>>> It will probably fail."
echo "*"
echo "* You are welcome to try - but please, keep the ntop-dev"
echo "* mailing list updated with your successes or failures..."
echo "*"
echo "*******************************************************************"
echo
HAS_WARNING="yes"
fi
dnl> NTOPCONFIGDEBUG_SETTINGS([After cc stdc test])
dnl> Any common settings required to support a specific OS, distribution or release
dnl> go here also.
dnl> Add include file locations to CPPFLAGS (for the preprocessor)
dnl> and add libraries (location) -L and (names) -l to LDFLAGS.
dnl> Skipping cases is, I guess, ok, but always remember that you might have
dnl> been grabbed by an earlier target.
DISTRO=""
RELEASE=""
echo ""
echo "*******************************************************************"
echo "*"
echo "* Checking for unique options for ${target}, ${CC}..."
echo "*"
case "${target}:${CC}" in
*-*-linux*:* )
DEFINEOS="LINUX"
DISTRO=`utils/linuxrelease --distro`
RELEASE=`utils/linuxrelease --release`
echo "* This appears to be ${DEFINEOS} ${DISTRO} ${RELEASE}"
;;
*-*-solaris*:* )
DEFINEOS="SOLARIS"
RELEASE=`uname -r | cut -c 3-`
echo "* This appears to be ${DEFINEOS}"
echo "*"
echo "* 1) Compilation requires various gnu tools from SunFreeware.com or other sources."
;;
*-*-darwin*:* )
DEFINEOS="DARWIN"
MAKE_SHARED_LIBRARY_PARM="-bundle -flat_namespace -undefined suppress"
echo "* This appears to be ${DEFINEOS} (MacOSX)"
;;
*-*-freebsd*:* )
DEFINEOS="FREEBSD"
RELEASE=`utils/linuxrelease --release | sed -e 's/\.//' -e 's/-.*$//g'`
echo "* This appears to be ${DEFINEOS} ${RELEASE}"
;;
*-*-mingw32*:gcc* )
DEFINEOS="MINGW"
echo "* This appears to be ${DEFINEOS} (release not checked)"
;;
* )
echo "* ${target} is an unknown/unsupported OS"
echo "*"
echo "*******************************************************************"
if test "x${ac_willfailoverride}" = "xyes"; then
echo "*"
echo "* Fasten your seat belt and good luck! If you are injured, the"
echo "* development team will disavow any knowledge of your intentions."
echo "*"
echo "* Please keep the ntop-dev mailing list updated with any"
echo "* successes you have or problems you encounter..."
echo "*"
else
exit 1
fi
;;
esac
if test ".${MEMORYDEBUG}" = "."; then
CPPFLAGS="${CPPFLAGS} -D${DEFINEOS}"
else
CPPFLAGS="${CPPFLAGS} -D${DEFINEOS} -DMEMORY_DEBUG=${MEMORYDEBUG}"
fi
if test -d ./configureextra; then
dnl> If there is a os/distro/release specific file (additional settings),
dnl> run it. Go from least specific to most specific, running ANY that match.
dnl> E.g. 'solaris 8' will match solaris 1st then solaris8.
echo "*"
echo "* Testing for extra configuration options for ${DEFINEOS} ${DISTRO} ${RELEASE}"
if test -f ./configureextra/${DEFINEOS}; then
echo "*"
echo "* Executing configureextra/${DEFINEOS}"
. ./configureextra/${DEFINEOS}
CONFIGURE_PARAMETERS="${CONFIGURE_PARAMETERS} + configureextra/${DEFINEOS}"
fi
if test ".${DISTRO}" != "."; then
if test -f ./configureextra/${DEFINEOS}${DISTRO}; then
echo "*"
echo "* Executing configureextra/${DEFINEOS}${DISTRO}"
. ./configureextra/${DEFINEOS}${DISTRO}
CONFIGURE_PARAMETERS="${CONFIGURE_PARAMETERS} + configureextra/${DEFINEOS}${DISTRO}"
fi
if test ".${RELEASE}" != "." &&
test -f ./configureextra/${DEFINEOS}${DISTRO}${RELEASE}; then
echo "*"
echo "* Executing configureextra/${DEFINEOS}${DISTRO}${RELEASE}"
. ./configureextra/${DEFINEOS}${DISTRO}${RELEASE}
CONFIGURE_PARAMETERS="${CONFIGURE_PARAMETERS} + configureextra/${DEFINEOS}${DISTRO}${RELEASE}"
fi
else
if test ".${RELEASE}" != "." &&
test -f ./configureextra/${DEFINEOS}${RELEASE}; then
echo "*"
echo "* Executing configureextra/${DEFINEOS}${RELEASE}"
. ./configureextra/${DEFINEOS}${RELEASE}
CONFIGURE_PARAMETERS="${CONFIGURE_PARAMETERS} + configureextra/${DEFINEOS}${RELEASE}"
fi
fi
fi
echo "*"
echo "*******************************************************************"
dnl>
dnl> Last chance default (if there is an os-specific value, set it above)
dnl>
if test ".${LOCALEDIR}" = "."; then
LOCALEDIR="/usr/lib/locale"
fi
dnl> Add /usr/local/ /opt/local
CFLAGS="${CFLAGS} -I/usr/local/include -I/opt/local/include"
CPPFLAGS="${CPPFLAGS} -I/usr/local/include -I/opt/local/include"
LDFLAGS="${LDFLAGS} -L/usr/local/lib -L/opt/local/lib"
PWD=`pwd`
echo
echo "Test the compiler and setup CFLAGS..."
echo
case "$CFLAGS" in
*-g* )
;;
* )
CFLAGS="$CFLAGS -g"
AC_MSG_CHECKING([if compiler accepts -g (debugging information)])
oCFLAGS=$CFLAGS
CFLAGS="-g $CFLAGS"
AC_TRY_COMPILE( ,
return 0 ,
AC_MSG_RESULT(yes),
CFLAGS="${oCFLAGS}"
AC_MSG_RESULT(no)
)
;;
esac
AC_MSG_CHECKING([if compiler accepts -W (warning flags)])
oCFLAGS=$CFLAGS
CFLAGS="$CFLAGS -Wshadow -Wpointer-arith -Wmissing-prototypes -Wmissing-declarations -Wnested-externs"
AC_TRY_COMPILE( ,
return 0 ,
AC_MSG_RESULT(yes),
CFLAGS="${oCFLAGS}"
AC_MSG_RESULT(no)
)
dnl> add pic flag in any case this makes sure all our code is relocatable
case "${target}:${CC}" in
*-*-darwin*:* )
CFLAGS="$CFLAGS "`grep pic_flag= /usr/bin/glibtool | head -n1 | sed -e 's/.*pic_flag=//' -e 's/"//g'`
;;
* )
CFLAGS="$CFLAGS "`grep pic_flag= libtool | head -n1 | sed -e 's/.*pic_flag=//' -e 's/"//g'`
;;
esac
dnl> Presets for the make flags go here...
CFLAGS="${CFLAGS}"
CPPFLAGS="${CPPFLAGS}"
LDFLAGS="${LDFLAGS}"
dnl> NTOPCONFIGDEBUG_SETTINGS([After presets])
echo
echo "Critical library/include tests..."
echo
dnl>
dnl> Without these, don't even BOTHER testing the parameters...
dnl>
dnl> We also process the ROOT/DIRECTORY entries first so we have reasonable
dnl> CPPFLAGS, LDFLAGS and LIBS values for the AC_CHECK_LIBS and AC_CHECK_HEADERS macros.
dnl>
dnl>
dnl> user defined directory passed as option at configuration time
dnl>
if test ".${PCAPRING_DIR}" != .; then
if test ".${PCAP_ROOT}" != .; then
echo
echo "*******************************************************************"
echo "*"
echo "* WARNING: libpcap checking in ${PCAP_ROOT} skipped"
echo "* we have taken libpcap from ${PCAPRING_DIR}"
echo "*"
echo "*"
echo "*******************************************************************"
echo
fi
else
TMP_ROOT=${HOME}/PF_RING/userland/libpcap/
if test ".${PCAP_ROOT}" == . &&
test -d ${TMP_ROOT} &&
test -r ${TMP_ROOT}/libpcap.a; then
PCAP_ROOT=${TMP_ROOT}
CORELIBS="${CORELIBS} -L${TMP_ROOT} -lpcap -L${HOME}/PF_RING/userland/lib -lpfring"
INCS="${INCS} -I ${PCAP_ROOT}"
AC_MSG_RESULT([found in $PCAP_ROOT])
elif test ".${PCAP_ROOT}" != .; then
if test -d $PCAP_ROOT &&
test -r $PCAP_ROOT/lib/libpcap.a &&
test -r $PCAP_ROOT/include/pcap.h; then
PCAP_ROOT=`cd ${PCAP_ROOT} && pwd`
CORELIBS="${CORELIBS} -L ${PCAP_ROOT}/lib -lpcap"
INCS="${INCS} -I ${PCAP_ROOT}/include"
AC_MSG_RESULT([found in $PCAP_ROOT])
else
AC_MSG_RESULT([not found in ${PCAP_ROOT}])
AC_MSG_RESULT([ *** FATAL ERROR *** ])
AC_MSG_RESULT([ It looks that you don't have some files needed to use the pcap library.])
AC_MSG_RESULT([ Please check the source tree, compile and, optionally, install the software.])
AC_MSG_RESULT([ When finished please re-run this program.])
AC_MSG_RESULT([ You can download the latest source tarball at http://www.tcpdump.org])
AC_MSG_ERROR([ The LBL Packet Capture Library development tree seems corrupted or incomplete!])
fi
elif test -d /usr/local &&
test -r /usr/local/lib/libpcap.a &&
test -r /usr/local/include/pcap.h; then
PCAP_ROOT="/usr/local"
CORELIBS="${CORELIBS} -L$PCAP_ROOT/lib -lpcap"
INCS="${INCS} -I$PCAP_ROOT/include"
AC_MSG_RESULT([found in $PCAP_ROOT])
dnl>
dnl> installation used by most packagers
dnl>
elif test -r /usr/lib/libpcap.a &&
test -r /usr/include/pcap.h; then
PCAP_ROOT="standard installation"
CORELIBS="${CORELIBS} -lpcap"
AC_MSG_RESULT([found in $PCAP_ROOT])
dnl>
dnl> installation used by most packagers 64-bit
dnl>
elif test -r /usr/lib64/libpcap.a &&
test -r /usr/include/pcap.h; then
PCAP_ROOT="standard installation"
CORELIBS="${CORELIBS} -lpcap"
AC_MSG_RESULT([found in $PCAP_ROOT])
dnl>
dnl> installation used by OSX
dnl>
elif test -r /usr/lib/libpcap.A.dylib &&
test -r /usr/include/pcap.h; then
PCAP_ROOT="standard OSX installation"
CORELIBS="${CORELIBS} -lpcap"
AC_MSG_RESULT([found in $PCAP_ROOT])
dnl>
dnl> unusual and more complex installation used by some packagers
dnl> (e.g. Red Hat Linux)
dnl>
elif test -r /usr/lib/libpcap.a &&
test -r /usr/include/pcap/pcap.h; then
PCAP_ROOT="semi-standard installation"
CORELIBS="${CORELIBS} -lpcap"
INCS="${INCS} -I/usr/include/pcap"
AC_MSG_RESULT([found in $PCAP_ROOT])
else
AC_CHECK_LIB(pcap, pcap_lookupdev, , [
AC_MSG_RESULT([ *** FATAL ERROR *** ])
AC_MSG_RESULT([ It looks that you don't have the libpcap distribution installed.])
AC_MSG_RESULT([ Download, compile and, optionally, install it.])
AC_MSG_RESULT([ When finished please re-run this program.])
AC_MSG_RESULT([ You can download the latest source tarball at http://www.tcpdump.org/])
AC_MSG_ERROR([ The LBL Packet Capture Library, libpcap, was not found! ])
])
fi
fi
AC_CHECK_LIB([pcap], [pcap_next_ex], AC_DEFINE_UNQUOTED(HAVE_PCAP_NEXT_EX, 1, [pcap has pcap_next_ex]))
AC_CHECK_LIB([pcap], [pcap_lib_version], AC_DEFINE_UNQUOTED(HAVE_PCAP_LIB_VERSION, 1, [pcap has pcap_lib_version]))
AC_MSG_CHECKING([for gdbm])
AC_MSG_RESULT([])
if (test ".${GDBM_LIB}" != "." &&
test ! -d ${GDBM_LIB}) ||
(test ".${GDBM_INCLUDE}" != "." &&
test ! -d ${GDBM_INCLUDE}); then
echo
echo "*******************************************************************"
echo "*"
echo "* ERROR: You specified or implied a non-existent directory for"
echo "* libgdbm:"
echo "* --with-gdbm-lib=${GDBM_LIB}"
echo "* --with-gdbm-include=${GDBM_INCLUDE}"
echo "*"
echo "*>>> Continuing without libgdbm is impossible."
echo "*"
echo "*??? 1. Correct the --with-gdbm-xxxxx option and rerun"
echo "*??? ./configure"
echo "*"
echo "*******************************************************************"
echo
exit 1
else
NTOP_APPENDS([${GDBM_INCLUDE}], [${GDBM_LIB}], [gdbm])
fi
AC_CHECK_HEADERS([gdbm.h])
AC_CHECK_LIB([gdbm], [gdbm_open])
if test ".${ac_cv_header_gdbm_h}" != ".yes" ||
test ".${ac_cv_lib_gdbm_gdbm_open}" != ".yes"; then
echo
echo "*******************************************************************"
echo "*"
echo "* ERROR: gdbm header or library routines are missing"
echo "* (yes means it was found, no means it was not found)"
echo "*"
echo "* gdbm.h...${ac_cv_header_gdbm_h}"
echo "* gdbm_open() in -lgdbm...${ac_cv_lib_gdbm_gdbm_open}"
echo "*"
echo "*>>> No way to proceed."
echo "*"
echo "*??? 1. Install libgdbm"
echo "*??? and Rerun ./configure"
echo "*??? or 2. Use the --with-gdbm-xxxxx= options"
echo "*"
echo "*******************************************************************"
echo
AC_MSG_ERROR(Unable to continue... aborting ./configure)
fi
dnl> FastBit
AC_CHECK_HEADERS([capi.h])
if test "x$ac_cv_header_capi_h" = "xyes"; then
AC_CHECK_LIB([fastbit], [fastbit_init])
if test "x$ac_cv_lib_fastbit_fastbit_init" = "xyes"; then
AC_DEFINE_UNQUOTED(HAVE_FASTBIT, 1, [use fastbit])
fi
fi
dnl> nDPI based on OpenDPI (https://code.google.com/p/opendpi/)
NDPI_LIB=./nDPI/src/lib/.libs/libndpi.a
NDPI_INC=./nDPI/src/include/
dnl> Define the arguments we accept...
dnl>
dnl> In this version of the configure file, we use AC_ARG_WITH for whole external
dnl> programs and AC_ARG_ENABLE for features of ntop itself. Since they're the
dnl> same as to processing, we don't separate them here.
dnl>
dnl> And it keeps them together in the ./configure --help output
dnl>
dnl> Remember, there shouldn't be any processing in these... that's below when
dnl> we test for libraries. It's ok to set values via AC_DEFINE_UNQUOTED().
dnl> So, we...
dnl> Test the enable, disable and with's for unreasonable combinations.
echo
echo "Plugins?"
PLUGINS=
if test ".${ac_disable_plugins}" = ".yes"; then
echo " ...Disabled via ./configure command line option --disable-plugins"
else
PLUGINS=plugins
echo " ...(Default) Requested. Disable via ./configure command line option --disable-plugins."
fi
echo
echo "Jumbo (9k) Ethernet Frames?"
if test ".$ac_enable_jumbo_frames" = ".yes"; then
echo " ...Requested via ./configure command line option --enable-jumbo-frames."
AC_DEFINE_UNQUOTED(MAKE_WITH_JUMBO_FRAMES, 1, [Define for Jumbo (9k) Ethernet Frames])
else
echo " ...(Default) Disabled. Request via ./configure command line option --enable-jumbo-frames."
fi
echo
echo "Processing the rest of the ROOT/DIRECTORY entries"
echo
dnl> So we have even more reasonable CPPFLAGS, LDFLAGS and LIBS values for
dnl> the AC_CHECK_LIB and AC_CHECK_HEADER macros.
dnl> Openssl
if test ".${ac_disable_openssl}" != ".yes"; then
if (test ".${OSSL_LIB}" != "." &&
test ! -d ${OSSL_LIB}) ||
(test ".${OSSL_INCLUDE}" != "." &&
test ! -d ${OSSL_INCLUDE}); then
echo
echo "*******************************************************************"
echo "*"
echo "* ERROR: You specified or implied a non-existent directory for"
echo "* the openSSL library:"
if test ".${OSSL_LIB}" != "."; then
echo "* --with-ossl-lib=${OSSL_LIB}"
fi
if test ".${OSSL_INCLUDE}" != "."; then
echo "* --with-ossl-include=${OSSL_INCLUDE}"
fi
echo "*"
echo "*>>> Continuing without the --with-ossl-xxxxx values"
echo "*"
echo "* ./configure should complete 'successfully'"
echo "*"
echo "* ntop may find openSSL installed in a standard location."
echo "*"
echo "* If not found, ntop will disable code dependent upon"
echo "* openSSL meaning no https:// support."
echo "*"
echo "* Read the remaining messages carefully!"
echo "*"
echo "*??? 1. Correct the --with-ossl-xxxxx option and rerun"
echo "*??? ./configure"
echo "*??? or 2. Install the openSSL package and rerun ./configure"
echo "*"
echo "*******************************************************************"
echo
OSSL_LIB=
OSSL_INCLUDE=
HAS_WARNING="yes"
else
NTOP_APPENDS([${OSSL_INCLUDE}], [${OSSL_LIB}], [gdbm])
fi
fi
if (test ".${ZLIB_LIB}" != "." &&
test ! -d ${ZLIB_LIB}) ||
(test ".${ZLIB_INCLUDE}" != "." &&
test ! -d ${ZLIB_INCLUDE}); then
echo
echo "*******************************************************************"
echo "*"
echo "* ERROR: You specified or implied a non-existent directory for"
echo "* zlib:"
if test ".${ZLIB_LIB}" != "."; then
echo "* --with-zlib-lib=${ZLIB_LIB}"
fi
if test ".${ZLIB_INCLUDE}" != "."; then
echo "* --with-zlib-include=${ZLIB_INCLUDE}"
fi
echo "*"
echo "*>>> Continuing without the --with-zlib-xxxxx values"
echo "*"
echo "* ./configure should complete 'successfully'"
echo "*"
echo "* ntop may find zlib installed in a standard location."
echo "*"
echo "* If not found, ntop will disable code dependent upon zlib"
echo "* meaning no compressed web pages or input files."
echo "*"
echo "* Read the remaining messages carefully!"
echo "*"
echo "*??? 1. Correct the --with-zlib-xxxxx option and rerun"
echo "*??? ./configure"
echo "*??? or 2. Install the zlib package and rerun ./configure"
echo "*"
echo "*******************************************************************"
echo
ZLIB_LIB=
ZLIB_INCLUDE=
HAS_WARNING="yes"
else
NTOP_APPENDS([${ZLIB_INCLUDE}], [${ZLIB_LIB}], [z])
fi
if test ".${LOCALEDIR}" != "." &&
test ! -d ${LOCALEDIR}; then
echo
echo "*******************************************************************"
echo "*"
echo "* WARNING: You specified a non-existent directory for locale files"
echo "* --with-localedir=${LOCALEDIR}"
echo "*"
echo "*>>> Since we just pass this through to the run-time, we're only"
echo "*>>> going to warn you here, but ntop might or might not function"
echo "*>>> as expected."
echo "*"
echo "*??? 1. Correct the --with-localedir option and rerun"
echo "*??? ./configure"
echo "*"
echo "*******************************************************************"
echo
HAS_WARNING="yes"
fi
dnl> Specific compiler feature tests
AC_C_CONST
AC_C_VOLATILE
AC_C_INLINE
AC_C_CHAR_UNSIGNED
AC_C_LONG_DOUBLE
AC_C_BIGENDIAN([AC_DEFINE_UNQUOTED(CFG_BIG_ENDIAN, 1, [ntop built for big endian machine])],
[AC_DEFINE_UNQUOTED(CFG_LITTLE_ENDIAN, 1, [ntop built for little endian machine])],
[AC_DEFINE_UNQUOTED(CFG_UNKNOWN_ENDIAN, 1, [ntop built for unknown machine])])
dnl> NTOPCONFIGDEBUG_SETTINGS([After libraries])
echo
echo "Testing headers and functions..."
echo
AC_HEADER_STDC
AC_HEADER_DIRENT
AC_HEADER_SYS_WAIT
AC_HEADER_TIME
# Standard c stuff - must have
AC_CHECK_HEADERS([float.h stddef.h stdlib.h string.h pcre.h])
AC_CHECK_HEADERS([errno.h fcntl.h limits.h math.h signal.h stdarg.h unistd.h])
AC_CHECK_HEADERS([stdio.h strings.h])
AC_CHECK_HEADERS([sys/ioctl.h sys/socket.h sys/time.h sys/types.h])
# Optional - have workaround...
AC_CHECK_HEADERS([setjmp.h ieeefp.h])
AC_CHECK_HEADERS([shadow.h])
AC_CHECK_HEADERS([sys/utsname.h])
# Network
AC_CHECK_HEADERS([netinet/in.h])
AC_CHECK_HEADERS([arpa/inet.h arpa/nameser.h])
AC_CHECK_HEADERS([net/ethernet.h])
AC_CHECK_LIB([z], [zlibVersion], [], [
echo "Error! You need to have zlib."
exit -1
])
# RRD
if test -d "$RRD_HOME"; then
AC_MSG_RESULT(checking for RRD home... yes)
else
RRD_HOME=/usr/local/rrdtool
if test -d "$RRD_HOME"; then
AC_MSG_RESULT(Checking rrdtool in $RRD_HOME)
else
RRD_HOME=/usr/local
fi
fi
RRD_LIB="-L${RRD_HOME}/lib -lrrd_th"
if test -f "$RRD_HOME/lib/librrd_th.so"; then
AC_MSG_RESULT(checking for rrdtool... yes)
else
if test -f "$RRD_HOME/lib/librrd_th.dylib"; then # OSX
AC_MSG_RESULT(checking for rrdtool... yes)
else
if test -f "$RRD_HOME/lib/librrd_th.a"; then
AC_MSG_RESULT(checking for rrdtool... yes)
else
AC_CHECK_LIB([rrd_th], [main])
if test ".${ac_cv_lib_rrd_th_main}" != ".yes"; then
AC_MSG_ERROR(Unable to find RRD at $RRD_HOME: please use --with-rrd-home=DIR);
AC_MSG_ERROR(RRD source can be downloaded from http://www.rrdtool.org/);
else
RRD_LIB=
fi
fi
fi
fi
RRD_INC=
if test -d "${RRD_HOME}/include"; then
RRD_INC="-I${RRD_HOME}/include"
fi
dnl> The failed recheck stuff below is courtesy of Chris Turbeville [[email protected]]
dnl> Chris developed this for Solaris 9, confirming work I had done earlier for FreeBSD
dnl> And thank to Julien TOUCHE [[email protected]] for the OpenBSD dependencies
AC_CHECK_HEADERS([net/if.h], [], [], [
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif])
AC_CHECK_HEADER([net/if_dl.h],[
AC_DEFINE_UNQUOTED(HAVE_IFLIST_SYSCTL, 1, [use sysctl support for fetch interface informations])
])
AC_CHECK_HEADERS([netinet/if_ether.h], [], [], [
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#ifdef HAVE_NET_IF_H
#include <net/if.h>
#endif])
AC_CHECK_HEADERS([netinet/in_systm.h])
AC_CHECK_HEADERS([netinet/ip.h], [], [], [
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_NETINET_IN_SYSTM_H
#include <netinet/in_systm.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif])
AC_CHECK_HEADERS([netinet/ip_icmp.h], [], [], [
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#ifdef HAVE_NETINET_IN_SYSTM_H
#include <netinet/in_systm.h>
#endif
#ifdef HAVE_NETINET_IP_H
#include <netinet/ip.h>
#endif])
AC_CHECK_HEADERS([netinet/tcp.h])
AC_CHECK_HEADERS([netinet/udp.h], [], [], [
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif])
AC_CHECK_HEADERS([sys/param.h])
AC_CHECK_HEADERS([net/if_dl.h])
AC_CHECK_HEADERS([sys/sysctl.h], [], [], [
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif])
AC_CHECK_HEADERS([net/route.h], [], [], [
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H