-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
3111 lines (2831 loc) · 86.2 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
#
# Autoconf script for Wireshark
#
#
# Define variables for the components of the Wireshark version number.
#
m4_define([version_major], [1])
m4_define([version_minor], [99])
m4_define([version_micro], [1])
m4_define([version_micro_extra], version_micro)
m4_append([version_micro_extra], [])
AC_INIT(wireshark, [version_major.version_minor.version_micro_extra], http://bugs.wireshark.org/, , http://www.wireshark.org/)
CONFIG_ARGS="$*"
AC_SUBST(CONFIG_ARGS)
# Minimum autoconf version we require.
AC_PREREQ(2.60)
# Variable expansion doesn't work in AC_PREREQ()
AC_MIN_VERSION=2.60
AC_SUBST(AC_MIN_VERSION)
dnl Check for CPU / vendor / OS
dnl The user is encouraged to use either `AC_CANONICAL_BUILD', or
dnl `AC_CANONICAL_HOST', or `AC_CANONICAL_TARGET', depending on the
dnl needs. Using `AC_CANONICAL_TARGET' is enough to run the two other
dnl macros.
dnl
dnl As nothing in the Wireshark is itself a build tool (we are not,
dnl for example, a compiler that generates machine code), we probably
dnl don't need AC_CANONICAL_TARGET, so, in theory, we should be able
dnl to use AC_CANONICAL_BUILD and AC_CANONICAL_HOST - or perhaps just
dnl AC_CANONICAL_HOST - instead. Note that we do have tools, such as
dnl lemon, that need to be built for the build machine, not for the
dnl host machine, so we might need both.
dnl
dnl This has to be done *after* AC_INIT, otherwise autogen.sh fails.
dnl AC_CANONICAL_BUILD
dnl AC_CANONICAL_HOST
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE([1.9 tar-ustar dist-bzip2 no-dist-gzip])
# Make Wireshark's version available in config.h
AC_DEFINE(VERSION_MAJOR, version_major, [Wireshark's major version])
AC_DEFINE(VERSION_MINOR, version_minor, [Wireshark's minor version])
AC_DEFINE(VERSION_MICRO, version_micro, [Wireshark's micro version])
AM_DISABLE_STATIC
#
# Checks for programs used in the main build process.
#
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_CXX
AC_PROG_CPP
AC_PROG_MKDIR_P
dnl Work around libtool bug (fixed in the version 1.5a?)
AC_DEFUN([AC_PROVIDE_AC_LIBTOOL_DLOPEN], )
AC_LIBTOOL_DLOPEN
AC_PROG_LIBTOOL
if test ! -z "$CXX"; then
#
# OK, we found something AC_LANG_CXX thinks is a C++ compiler,
# but is it one?
#
# Some UN*Xes have, by default, a case-insensitive file
# system, and AC_PROG_CXX looks for, among other things,
# "CC" as a C++ compiler, and, if you have a case-insensitive
# file system and a C compiler named "cc" (both true, by
# default, on OS X), AC_PROG_CXX may end up thinking it's
# the C++ compiler.
#
# So we check by feeding the purported C++ compiler a
# program using C++ features (iostream).
#
# We do this after AC_PROG_LIBTOOL; if we did so before, and
# cleared CXX if what we had isn't a C++ compiler, that'd
# get undone by AC_PROG_LIBTOOL for some reason.
#
AC_MSG_CHECKING(whether $CXX is a C++ compiler)
AC_LANG_PUSH([C++])
AC_LINK_IFELSE([AC_LANG_PROGRAM(
[
#include <iostream>
],
[
std::cout << "Hello World! ";
return 0;
])],
[AC_MSG_RESULT(yes)],
[
AC_MSG_RESULT(no)
CXX=""
])
AC_LANG_POP([C++])
fi
AC_PATH_PROG(PERL, perl)
# Check for Python.
AC_PATH_PROG(PYTHON, python)
if test ! -z "$PYTHON"; then
#
# OK, we found Python; is it Python 2.5 or later?
# Note: we don't use named components for sys.version_info to get
# the major version number, as named components for version_info
# were apparently introduced in Python 2.7.
#
AC_MSG_CHECKING([whether $PYTHON is Python 2.5 or later])
python_major_version=`$PYTHON -c 'import sys; print (sys.version_info[[0]])'`
python_minor_version=`$PYTHON -c 'import sys; print (sys.version_info[[1]])'`
if test "$python_major_version" -eq 2 -a "$python_minor_version" -lt 5 ; then
AC_MSG_RESULT(no)
AC_MSG_WARN([Building with Python $python_major_version.$python_minor_version may not work])
else
AC_MSG_RESULT(yes)
fi
else
AC_MSG_ERROR(I couldn't find python; make sure it's installed and in your path)
fi
#
# XXX - should autogen.sh check for YACC/Bison and Flex? A user building
# from a distribution tarball shouldn't have to have YACC/Bison or Flex,
# as the tarball should contain the results of running YACC/Bison on .y
# files and running Flex on .l files, but a user building from SVN
# will have to run YACC/Bison and Flex to process those files.
#
# On the other hand, what about users who use a distribution tarball to
# do development? They *shouldn't* - that's what the SVN repository is
# for - but they might. They'd get errors if they modify a .y or .l
# file and try to do a build - but the error should tell them that they
# need to get YACC/Bison and/or Flex.
#
# Then again, getting them shouldn't be too big of a burden.
#
# XXX - is the same true of pod2man and pod2html, or are they needed
# even when building from a distribution tarball?
#
#
AC_PROG_YACC
AC_PATH_PROG(YACCDUMMY, $YACC)
if test "x$YACCDUMMY" = x
then
AC_MSG_ERROR(I couldn't find yacc (or bison or ...); make sure it's installed and in your path)
fi
AM_PROG_LEX
AC_PATH_PROG(LEX, flex)
if test "x$LEX" = x
then
AC_MSG_ERROR(I couldn't find flex; make sure it's installed and in your path)
fi
AC_PATH_PROG(POD2MAN, pod2man)
if test "x$POD2MAN" = x
then
#
# The alternative is not to build the man pages....
#
AC_MSG_ERROR(I couldn't find pod2man; make sure it's installed and in your path)
fi
AC_PATH_PROG(POD2HTML, pod2html)
if test "x$POD2HTML" = x
then
#
# The alternative is not to build the HTML man pages....
#
AC_MSG_ERROR(I couldn't find pod2html; make sure it's installed and in your path)
fi
#
# Checks for programs used by Wireshark/TShark/etc.
#
#
# XXX - this looks for various HTML viewers on the host, not the target;
# we really want to know what's available on the target, for cross-builds.
# That would probably require us to, at run time, look for xdg-open and,
# if we don't find it, look for mozilla, htmlview, etc.
#
AC_PATH_PROG(HTML_VIEWER, xdg-open)
if test "x$HTML_VIEWER" != x
then
#
# XXX - the HTML_VIEWER shell variable is the full path of xdg-open.
# Define some variable to be that, so we just run that?
#
AC_DEFINE(HAVE_XDG_OPEN, 1, [Define if we have xdg-open])
#
# XXX - we have to define HTML_VIEWER for the prefs.c code that
# sets the default value of the Web browser preference, even
# though that preference won't be offered.
#
AC_DEFINE_UNQUOTED(HTML_VIEWER, "xdg-open", [HTML viewer, e.g. mozilla])
else
AC_PATH_PROG(HTML_VIEWER, htmlview)
if test "x$HTML_VIEWER" = x
then
AC_DEFINE_UNQUOTED(HTML_VIEWER, "mozilla", [HTML viewer, e.g. mozilla])
else
AC_DEFINE_UNQUOTED(HTML_VIEWER, "htmlview", [HTML viewer, e.g. mozilla])
fi
fi
#
# Set "ac_supports_gcc_flags" if the compiler is known to support GCC-style
# flags such as -pedantic, -W warning flags and -f feature flags. Currently,
# we assume GCC and clang do; other compilers should be added here.
#
# This is done to avoid getting tripped up by compilers that support
# those flags but give them a different meaning.
#
if test "x$GCC" = "xyes" -o "x$CC" = "xclang" ; then
ac_supports_gcc_flags=yes
fi
if test "x$CC_FOR_BUILD" = x
then
CC_FOR_BUILD=$CC
fi
AC_SUBST(CC_FOR_BUILD)
AC_SUBST(CFLAGS_FOR_BUILD)
# Check for doxygen
AC_PATH_PROG(DOXYGEN, doxygen)
AC_CHECK_PROG(HAVE_DOXYGEN, doxygen, "yes", "no")
AM_CONDITIONAL(HAVE_DOXYGEN, test x$HAVE_DOXYGEN = xyes)
#
# Check for pkg-config and set PKG_CONFIG accordingly.
#
# This is referenced via AC_REQUIRE([PKG_PROG_PKG_CONFIG] in some macros
# like PKG_CHECK_MODULES. If the first call to such a macro is under an
# "if" statement, it's safer to call PKG_PROG_PKG_CONFIG directly, see
# the comments in acolocal.m4
#
PKG_PROG_PKG_CONFIG
AC_ARG_ENABLE(osx-deploy-target,
AC_HELP_STRING( [--enable-osx-deploy-target],
[choose an OS X deployment target @<:@default=major release on which you're building@:>@]),
[
#
# Is this OS X?
#
case "$host_os" in
darwin*)
#
# Yes.
#
# Let the user specify an OS X release to use as a
# deplayment target; if they specify that we should
# have a deployment target but don't specify the
# deployment target, then, if we have SDKs available,
# pick the OS version on which the build is being done.
# This also causes the build to be done against an SDK
# rather than against the headers and libraries in
# /usr/include and /usr/lib.
#
# Check for an OS X deployment target early, so that
# as many tests using the compiler are done using the
# flags that we'll be using when building.
#
if test $enableval = no
then
#
# The user explicitly said
# --disable-osx-deploy-target, so don't build
# against an SDK.
#
deploy_target=
elif test $enableval = yes
then
#
# The user said --enable-osx-deploy-target, but
# didn't say what version to target; target the
# major version number of the version of OS X on
# which we're running.
#
# (We quote the command so that we can use
# autoconf's M4 quoting characters, [ and ], in
# the sed expression.)
#
[deploy_target=`sw_vers -productVersion | sed 's/\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.[0-9]*/\1.\2/'`]
else
deploy_target="$enableval"
fi
;;
*)
#
# No. Fail, because whatever the user intended for us to
# do, we can't do it.
#
AC_MSG_ERROR([--enable-osx-deploy-target specified on an OS other than OS X])
;;
esac
],[
#
# Is this OS X?
#
case "$host_os" in
darwin*)
#
# Yes.
#
# If we have SDKs available, default to targeting the major
# version number of the version of OS X on which we're
# running.
#
# (We quote the command so that we can use autoconf's
# M4 quoting characters, [ and ], in the sed expression.)
#
for i in /Developer/SDKs \
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs \
/Library/Developer/CommandLineTools/SDKs
do
if test -d "$i"
then
[deploy_target=`sw_vers -productVersion | sed 's/\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.[0-9]*/\1.\2/'`]
break
fi
done
;;
*)
#
# No. There's nothing to do.
#
;;
esac
])
if test ! -z "$deploy_target"
then
AC_MSG_CHECKING([whether we can build for OS X $deploy_target])
case $deploy_target in
10.0|10.1|10.2)
#
# I'm not sure this would even work.
#
AC_MSG_RESULT(no)
AC_ERROR([We don't support building for OS X $deploy_target])
;;
10.3)
#
# XXX - never tested.
#
AC_MSG_RESULT(yes)
SDKPATH="/Developer/SDKs/MacOSX10.3.9.sdk"
;;
*)
#
# XXX - for 10.4, do we need 10.4u? We're
# not currently doing fat builds (we'd need
# fat versions of the support libraries for
# that to be useful), but, if we do, we'd
# need to use 10.4u.
#
for i in /Developer/SDKs \
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs \
/Library/Developer/CommandLineTools/SDKs
do
if test -d "$i"/"MacOSX$deploy_target.sdk"
then
SDKPATH="$i"/"MacOSX$deploy_target.sdk"
break
fi
done
if test -z "$SDKPATH"
then
AC_MSG_RESULT(no)
AC_MSG_ERROR([We couldn't find the SDK for OS X $deploy_target])
fi
AC_MSG_RESULT(yes)
;;
esac
#
# Add a -mmacosx-version-min flag to force tests that
# use the compiler, as well as the build itself, not to,
# for example, use compiler or linker features not supported
# by the minimum targeted version of the OS.
#
# Add an -isysroot flag to use the SDK.
#
CFLAGS="-mmacosx-version-min=$deploy_target -isysroot $SDKPATH $CFLAGS"
CXXFLAGS="-mmacosx-version-min=$deploy_target -isysroot $SDKPATH $CXXFLAGS"
LDFLAGS="-mmacosx-version-min=$deploy_target -isysroot $SDKPATH $LDFLAGS"
#
# Add a -sdkroot flag to use with osx-app.sh.
#
OSX_APP_FLAGS="-sdkroot $SDKPATH"
#
# XXX - do we need this to build the Wireshark wrapper?
# XXX - is this still necessary with the -mmacosx-version-min
# flag being set?
#
OSX_DEPLOY_TARGET="MACOSX_DEPLOYMENT_TARGET=$deploy_target"
#
# In the installer package XML file, give the deployment target
# as the minimum version.
#
OSX_MIN_VERSION="$deploy_target"
case $deploy_target in
10.4|10.5)
#
# Only 32-bit builds are supported. 10.5
# (and 10.4?) had a bug that causes some BPF
# functions not to work with 64-bit userland
# code, so capturing won't work.
#
CFLAGS="-m32 $CFLAGS"
CXXFLAGS="-m32 $CXXFLAGS"
LDFLAGS="-m32 $LDFLAGS"
;;
esac
else
#
# Is this OS X?
#
case "$host_os" in
darwin*)
#
# Yes.
#
# In the installer package XML file, give the current OS
# version, minor version and all, as the minimum version.
# We can't guarantee that the resulting binary will work
# on older OS versions, not even older minor versions
# (original release or earlier software updates).
#
OSX_MIN_VERSION=`sw_vers -productVersion`
;;
esac
fi
AC_SUBST(OSX_MIN_VERSION)
#
# Try to arrange for large file support.
#
AC_SYS_LARGEFILE
#
# GUI toolkit options
#
AC_ARG_WITH([qt],
AC_HELP_STRING( [--with-qt=@<:@yes/no@:>@],
[use Qt @<:@default=yes@:>@]),
with_qt="$withval", with_qt="unspecified")
AC_ARG_WITH([gtk2],
AC_HELP_STRING( [--with-gtk2=@<:@yes/no@:>@],
[use GTK+ 2.0 @<:@default=no@:>@]),
with_gtk2="$withval", with_gtk2="unspecified")
AC_ARG_WITH([gtk3],
AC_HELP_STRING( [--with-gtk3=@<:@yes/no@:>@],
[use GTK+ 3.0 instead of 2.0 @<:@default=yes@:>@]),
with_gtk3="$withval", with_gtk3="unspecified")
# GnuTLS
# Version 3.0 switched from LGPLv2.1+ to LGPLv3+, then switched back to
# LGPLv2.1+ in version 3.1.10.
# GnuTLS depends on GMP which switched from LGPLv2.1+ to LGPLv3+ in
# version 4.2.2, the switched to LGPLv3+ / GPLv2+ in version 6.0.0.
tls_message="no"
want_gnutls="if_available"
AC_ARG_WITH([gnutls],
AC_HELP_STRING( [--with-gnutls=@<:@yes/no@:>@],
[use GnuTLS library @<:@default=yes, if available@:>@]),
[ with_gnutls="$withval"; want_gnutls="yes" ], with_gnutls="yes")
if test "x$with_gnutls" = "xyes"; then
have_license_compatible_gnutls="no"
PKG_CHECK_MODULES([LIBGNUTLS], [gnutls >= 3.1.10 ],
[ have_license_compatible_gnutls="yes" ], [ echo "GnuTLS >= 3.1.10 not found " ]
)
if test "x$have_license_compatible_gnutls" != "xyes"; then
PKG_CHECK_MODULES([LIBGNUTLS], [gnutls >= 1.2.0 gnutls < 3],
[ have_license_compatible_gnutls="yes" ] , [ echo "GnuTLS >= 1.2.0, < 3.0 not found " ]
)
fi
if test "x$have_license_compatible_gnutls" = "xyes"; then
echo "GnuTLS found, enabling SSL decryption"
AC_DEFINE(HAVE_LIBGNUTLS, 1, [Define to use GnuTLS library])
tls_message="yes"
else
echo "GnuTLS with compatible license not found, disabling SSL decryption"
tls_message="no"
# Error out if the user explicitly requested gnutls
if test "x$want_gnutls" = "xyes"; then
AC_MSG_ERROR([GnuTLS crypto library was requested, but is not available])
fi
fi
fi
# libgrypt
gcrypt_message="no"
want_gcrypt="if_available"
AC_ARG_WITH([gcrypt],
AC_HELP_STRING( [--with-gcrypt=@<:@yes/no@:>@],
[use gcrypt library @<:@default=yes, if available@:>@]),
[ with_gcrypt="$withval"; want_gcrypt="yes" ], with_gcrypt="yes")
if test "x$with_gcrypt" = "xyes"; then
AM_PATH_LIBGCRYPT(1.1.92,
[
echo "libgcrypt found, enabling ipsec decryption"
AC_DEFINE(HAVE_LIBGCRYPT, 1, [Define to use libgcrypt])
gcrypt_message="yes"
]
, [
if test x$libgcrypt_config_prefix != x ; then
AC_MSG_ERROR([[libgcrypt not found; install libgcrypt-devel package for your system]])
else
echo "libgcrypt not found, disabling ipsec decryption"
gcrypt_message="no"
fi
# Error out if the user explicitly requested gcrypt
if test "x$want_gcrypt" = "xyes"; then
AC_MSG_ERROR([libgcrypt library was requested, but is not available])
fi
]
)
fi
AC_ARG_WITH(libnl,
AC_HELP_STRING([--with-libnl@<:@=VERSION@:>@],
[use libnl (force version VERSION, if supplied) @<:@default: yes, if available@:>@]),
[
if test "x$withval" = "xno"
then
want_libnl=no
elif test "x$withval" = "xyes"
then
want_libnl=yes
libnl_version=any
elif test "x$withval" = "x1"
then
want_libnl=yes
libnl_version=1
elif test "x$withval" = "x2"
then
want_libnl=yes
libnl_version=2
elif test "x$withval" = "x3"
then
want_libnl=yes
libnl_version=3
else
AC_MSG_ERROR(["$withval" is not a valid argument to --with-libnl])
fi
],[
#
# Use libnl if it's present, otherwise don't.
#
want_libnl=ifavailable
libnl_version=any
])
#
# Libnl is Linux-specific.
#
libnl_message="no"
case "$host_os" in
linux*)
AC_MSG_CHECKING(whether to use libnl for various network interface purposes)
if test x$want_libnl = "xno"; then
AC_MSG_RESULT(no)
else
AC_MSG_RESULT(yes)
#
# Test for specific libnl versions only if no version
# was specified by the user or if the version in question
# was requested by the user.
#
if test x$libnl_version = "xany" -o x$libnl_version = "x3"; then
PKG_CHECK_MODULES(LIBNL3, [libnl-route-3.0 >= 3.0 libnl-genl-3.0] >= 3.0, [have_libnl3=yes], [have_libnl3=no])
fi
if test x$libnl_version = "xany" -o x$libnl_version = "x2"; then
PKG_CHECK_MODULES(LIBNL2, libnl-2.0 >= 2.0, [have_libnl2=yes], [have_libnl2=no])
fi
if test x$libnl_version = "xany" -o x$libnl_version = "x1"; then
PKG_CHECK_MODULES(LIBNL1, libnl-1 >= 1.0, [have_libnl1=yes], [have_libnl1=no])
fi
if (test "${have_libnl3}" = "yes"); then
CFLAGS="$CFLAGS $LIBNL3_CFLAGS"
LIBS="$LIBS $LIBNL3_LIBS"
AC_DEFINE(HAVE_LIBNL, 1, [Enable libnl support])
AC_DEFINE(HAVE_LIBNL3, 1, [libnl version 3])
libnl_message="yes (v3)"
enable_airpcap=no
elif (test "${have_libnl2}" = "yes"); then
CFLAGS="$CFLAGS $LIBNL2_CFLAGS"
LIBS="$LIBS $LIBNL2_LIBS"
AC_DEFINE(HAVE_LIBNL, 1, [Enable libnl support])
AC_DEFINE(HAVE_LIBNL2, 1, [libnl version 2])
libnl_message="yes (v2)"
enable_airpcap=no
elif (test "${have_libnl1}" = "yes"); then
CFLAGS="$CFLAGS $LIBNL1_CFLAGS"
LIBS="$LIBS $LIBNL1_LIBS"
AC_DEFINE(HAVE_LIBNL, 1, [Enable libnl support])
AC_DEFINE(HAVE_LIBNL1, 1, [libnl version 1])
libnl_message="yes (v1)"
enable_airpcap=no
else
if test x$want_libnl = "xyes"; then
case "$libnl_version" in
any)
AC_MSG_ERROR("I couldn't find libnl even though you manually enabled it.")
;;
*)
AC_MSG_ERROR("I couldn't find libnl version $libnl_version even though you manually enabled it.")
;;
esac
fi
fi
fi
AC_MSG_CHECKING([if nl80211.h is new enough])
AC_TRY_COMPILE([#include <linux/nl80211.h>],
[int x = NL80211_FREQUENCY_ATTR_MAX_TX_POWER;
x = NL80211_ATTR_SUPPORTED_IFTYPES;
x = NL80211_ATTR_SUPPORTED_COMMANDS;
x = NL80211_ATTR_WIPHY_FREQ;
x = NL80211_CHAN_NO_HT;],
[AC_MSG_RESULT(yes) AC_DEFINE(HAVE_NL80211, 1, [nl80211.h is new enough])],
[AC_MSG_RESULT(no)])
AC_MSG_CHECKING([for NL80211_SET_CHANNEL])
AC_TRY_COMPILE([#include <linux/nl80211.h>],
[enum nl80211_commands x = NL80211_CMD_SET_CHANNEL;],
[AC_MSG_RESULT(yes) AC_DEFINE(HAVE_NL80211_CMD_SET_CHANNEL, 1, [SET_CHANNEL is supported])],
[AC_MSG_RESULT(no)])
AC_MSG_CHECKING([for NL80211_SPLIT_WIPHY_DUMP])
AC_TRY_COMPILE([#include <linux/nl80211.h>],
[enum nl80211_protocol_features x = NL80211_PROTOCOL_FEATURE_SPLIT_WIPHY_DUMP;],
[AC_MSG_RESULT(yes) AC_DEFINE(HAVE_NL80211_SPLIT_WIPHY_DUMP, 1, [SPLIT_WIPHY_DUMP is supported])],
[AC_MSG_RESULT(no)])
;;
*)
if test x$want_libnl != "xno" -a x$want_libnl != "xifavailable"; then
AC_MSG_WARN([libnl is Linux-specific, ignoring --with-libnl])
fi
esac
# libsmi
# FIXME: currently the path argument to with-libsmi is being ignored
AX_LIBSMI
#
# Check for programs used when building DocBook documentation.
#
# Check for a2x (convert asciidoc to another format)
AC_PATH_PROG(A2X, a2x)
AC_CHECK_PROG(HAVE_A2X, a2x, "yes", "no")
AM_CONDITIONAL(HAVE_A2X, test x$HAVE_A2X = xyes)
# Want to control a tape drive? Use mt. Want to convert HTML to text?
# Uhhhhh... elinks? lynx? w3m? pandoc? html2text?
AC_PATH_PROG(ELINKS, elinks)
AC_CHECK_PROG(HAVE_ELINKS, elinks, "yes", "no")
AM_CONDITIONAL(HAVE_ELINKS, test x$HAVE_ELINKS = xyes)
# Check for fop (translate .fo to e.g. pdf)
AC_PATH_PROG(FOP, fop)
AC_CHECK_PROG(HAVE_FOP, fop, "yes", "no")
AM_CONDITIONAL(HAVE_FOP, test x$HAVE_FOP = xyes)
# Check for lynx (html -> text)
AC_PATH_PROG(LYNX, lynx)
AC_CHECK_PROG(HAVE_LYNX, lynx, "yes", "no")
AM_CONDITIONAL(HAVE_LYNX, test x$HAVE_LYNX = xyes)
# Check for w3m (html -> text)
AC_PATH_PROG(W3M, w3m)
AC_CHECK_PROG(HAVE_W3M, w3m, "yes", "no")
AM_CONDITIONAL(HAVE_W3M, test x$HAVE_W3M = xyes)
# Check for xmllint
AC_PATH_PROG(XMLLINT, xmllint)
AC_CHECK_PROG(HAVE_XMLLINT, xmllint, "yes", "no")
AM_CONDITIONAL(HAVE_XMLLINT, test x$HAVE_XMLLINT = xyes)
# Check for xsltproc
AC_PATH_PROG(XSLTPROC, xsltproc)
AC_CHECK_PROG(HAVE_XSLTPROC, xsltproc, "yes", "no")
AM_CONDITIONAL(HAVE_XSLTPROC, test x$HAVE_XSLTPROC = xyes)
# Check for packaging utilities
# For now, we check to see if the various packaging utilites are in our
# path. I'm too lazy to write code to go hunt for them. - Gerald
#
# Source packages.
# (Lets you install the desktop files.)
#
AC_PATH_PROG(DESKTOP_FILE_INSTALL, desktop-file-install)
# SVR4/Solaris
AC_CHECK_PROG(HAVE_PKGPROTO, pkgproto, "yes", "no")
AC_CHECK_PROG(HAVE_PKGMK, pkgmk, "yes", "no")
AC_CHECK_PROG(HAVE_PKGTRANS, pkgtrans, "yes", "no")
if test x$HAVE_PKGPROTO = xyes -a x$HAVE_PKGMK = xyes \
-a x$HAVE_PKGTRANS = xyes ; then
HAVE_SVR4_PACKAGING=yes
else
HAVE_SVR4_PACKAGING=no
fi
AC_SUBST(HAVE_SVR4_PACKAGING)
# RPM
AC_WIRESHARK_RPM_CHECK
AC_SUBST(HAVE_RPM)
# Debian
AC_CHECK_PROG(HAVE_DPKG_BUILDPACKAGE, dpkg-buildpackage, "yes", "no")
# Mac OS X
AC_CHECK_PROG(HAVE_XCODEBUILD, xcodebuild, "yes", "no")
AC_CHECK_PROG(HAVE_HDIUTIL, hdiutil, "yes", "no")
AC_CHECK_PROG(HAVE_BLESS, bless, "yes", "no")
if test x$HAVE_XCODEBUILD = xyes -a x$HAVE_HDIUTIL = xyes \
-a x$HAVE_BLESS = xyes ; then
HAVE_OSX_PACKAGING=yes
else
HAVE_OSX_PACKAGING=no
fi
AC_SUBST(HAVE_OSX_PACKAGING)
#
# Some compilers have to be told to fail when passed an unknown -W flag;
# make sure we do that.
#
AC_WIRESHARK_CHECK_UNKNOWN_WARNING_OPTION_ERROR
#
# Some C++ compilers have to be told to fail when passed a -W flag that
# they don't think should apply to C++; make sure we do that.
#
AC_WIRESHARK_CHECK_NON_CXX_WARNING_OPTION_ERROR
#
# Try to add some additional checks to CFLAGS.
# These are not enabled by default, because the warnings they produce
# are very hard or impossible to eliminate.
#
AC_ARG_ENABLE(extra-compiler-warnings,
AC_HELP_STRING( [--enable-extra-compiler-warnings],
[do additional compiler warnings @<:@default=no@:>@]),
[
wireshark_extra_flags=$enableval
if test $enableval != no
then
#
# The following are for C and C++
#
AC_WIRESHARK_COMPILER_FLAGS_CHECK(-pedantic)
#
# Various code blocks this one.
#
AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Woverflow)
AC_WIRESHARK_COMPILER_FLAGS_CHECK(-fstrict-overflow -Wstrict-overflow=4)
#
# Due to various places where APIs we don't control
# require us to cast away constness, we can probably
# never enable this one with -Werror.
#
AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wcast-qual)
#
# Some generated ASN.1 dissectors block this one;
# multiple function declarations for the same
# function are being generated.
#
AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wredundant-decls)
#
# Some loops are safe, but it's hard to convince the
# compiler of that.
#
AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wunsafe-loop-optimizations)
#
# All the registration functions block these for now.
#
AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wmissing-prototypes)
AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wmissing-declarations)
#
# A bunch of "that might not work on SPARC" code blocks
# this one for now.
#
AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wcast-align)
#
# Works only with Clang
#
AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wunreachable-code)
#
# Works only with Clang but generates a lot of warnings
# (about glib library not using Doxygen)
#
AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wdocumentation)
#
# The following are C only, not C++
#
# Due to various places where APIs we don't control
# require us to cast away constness, we can probably
# never enable this one with -Werror.
#
AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wbad-function-cast, C)
fi
],)
#
# The following are for C and C++
#
AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wall -W) # -W is now known as -Wextra
AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wextra) # -W is now known as -Wextra
AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wendif-labels)
AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wpointer-arith)
AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Warray-bounds)
AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wformat-security)
AC_WIRESHARK_COMPILER_FLAGS_CHECK(-fwrapv)
AC_WIRESHARK_COMPILER_FLAGS_CHECK(-fno-strict-overflow)
AC_WIRESHARK_COMPILER_FLAGS_CHECK(-fno-delete-null-pointer-checks)
AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wvla)
AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Waddress)
AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wattributes)
AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wdiv-by-zero)
AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wignored-qualifiers)
AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wpragmas)
AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wno-overlength-strings)
AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wwrite-strings)
AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wno-long-long)
AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wheader-guard)
#
# The following are C only, not C++
#
AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wc++-compat, C)
AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wdeclaration-after-statement, C)
#
# XXX - OK for C++?
#
# Make sure -Wshadow doesn't complain about variables in function and
# function pointer declarations shadowing other variables; if not, don't
# turn it on, as some versions of GCC (including the one in at least
# some Xcode versions that came with Mac OS X 10.5) complain about
# that.
#
AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wshadow, C,
[
extern int bar(int a);
extern int foo(int);
int
foo(int a)
{
int (*fptr)(int a) = bar;
return fptr(a) * 2;
}
],
[warns about variables in function declarations shadowing other variables])
AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wno-pointer-sign, C)
AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wold-style-definition, C)
AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wstrict-prototypes, C)
# Unfortunately some versions of gcc generate logical-op warnings when strchr()
# is given a constant string.
# gcc versions 4.3.2 and 4.4.5 are known to have the problem.
AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wlogical-op, C,
[
#include <string.h>
int foo(const char *, int);
int bar(void);
int
foo(const char *sep, int c)
{
if (strchr (sep, c) != NULL)
return 1;
else
return 0;
}
int
bar(void)
{
return foo("<", 'a');
}
],
[generates warnings from strchr()])
AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wjump-misses-init, C)
# The Qt headers generate a ton of shortening errors on 64-bit systems
# so only enable this for C for now.
AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wshorten-64-to-32, C)
#
# Use the faster pre gcc 4.5 floating point precision if available.
#
AC_WIRESHARK_COMPILER_FLAGS_CHECK(-fexcess-precision=fast)
#
# Try to have the compiler default to hiding symbols, so that only
# symbols explicitly exported with WS_DLL_PUBLIC will be visible
# outside (shared) libraries; that way, more UN*X builds will catch
# failures to export symbols, rather than having that fail only on
# Windows.
#
CFLAGS_before_fvhidden="$CFLAGS"
#
# GCC and GCC-compatible compilers
#
AC_WIRESHARK_COMPILER_FLAGS_CHECK(-fvisibility=hidden)
if test "x$CFLAGS" = "x$CFLAGS_before_fvhidden"
then
#
# Sun^WOracle C.
#
AC_WIRESHARK_COMPILER_FLAGS_CHECK(-xldscope=hidden)
if test "x$CFLAGS" = "x$CFLAGS_before_fvhidden"
then
# TODO add other ways of hiding symbols
AC_MSG_WARN(Compiler will export all symbols from shared libraries)
fi
fi
AC_WIRESHARK_LDFLAGS_CHECK([-Wl,--as-needed])
###AC_WIRESHARK_LDFLAGS_CHECK([-Wl,-M])
###AC_WIRESHARK_LDFLAGS_CHECK([-Wl,--cref])
# AC_WIRESHARK_LDFLAGS_CHECK([-flto])
# AC_WIRESHARK_LDFLAGS_CHECK([-fwhopr])
# AC_WIRESHARK_LDFLAGS_CHECK([-fwhole-program])
#
# Put -fPIE in PIE_CFLAGS and -pie in PIE_LDFLAGS if we can use them,
# so that we can build dumpcap PIE - it may run with elevated
# privileges, and using PIE means the OS can run it at random locations
# in the address space to make attacks more difficult.
#
CFLAGS_before_pie="$CFLAGS"
AC_WIRESHARK_COMPILER_FLAGS_CHECK(-fPIE)
if test "x$CFLAGS" != "x$CFLAGS_before_pie"
then
# Restore CFLAGS
CFLAGS="$CFLAGS_before_pie"
LDFLAGS_before_pie="$LDFLAGS"
AC_WIRESHARK_LDFLAGS_CHECK([-fPIE -pie])
if test "x$LDFLAGS" != "x$LDFLAGS_before_pie"
then
# We can use PIE
PIE_CFLAGS="-fPIE"
PIE_LDFLAGS="-pie"
# Restore LDFLAGS
LDFLAGS="$LDFLAGS_before_pie"
fi
fi
AC_SUBST(PIE_CFLAGS)
AC_SUBST(PIE_LDFLAGS)
CFLAGS_before_simd="$CFLAGS"
AC_WIRESHARK_COMPILER_FLAGS_CHECK(-msse4.2, C)
if test "x$CFLAGS" != "x$CFLAGS_before_simd"
then
AC_MSG_CHECKING([whether there is nmmintrin.h header])
AC_TRY_COMPILE(