forked from wireshark/wireshark
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
3003 lines (2719 loc) · 83.9 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], [2])
m4_define([version_minor], [3])
m4_define([version_micro], [0])
dnl Updated by make-version.pl
m4_define([version_extra], [])
m4_define([version_micro_extra], m4_join([], version_micro, version_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.64)
# Variable expansion doesn't work in AC_PREREQ()
AC_MIN_VERSION=2.64
AC_SUBST(AC_MIN_VERSION)
dnl Make sure to keep ACLOCAL_AMFLAGS in Makefile.am and AC_CONFIG_MACRO_DIRS
dnl in configure.ac in sync, otherwise there will be an error running autogen.sh.
m4_ifdef([AC_CONFIG_MACRO_DIRS],[AC_CONFIG_MACRO_DIRS([m4])])
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.11 tar-ustar dist-bzip2 no-dist-gzip subdir-objects])
# Enable silent builds by default. Verbose builds can be enabled with "./configure
# --enable-silent-rules ..." or "make V=1 ..."
AM_SILENT_RULES([yes])
# 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])
AC_DEFINE_UNQUOTED(VERSION_FLAVOR,
["${WIRESHARK_VERSION_FLAVOR:-"Development Build"}"], [Wireshark's package flavor])
LT_PREREQ([2.2.2])
LT_INIT([disable-static dlopen])
AC_SUBST([LIBTOOL_DEPS])
AC_CONFIG_LIBOBJ_DIR([wsutil])
#
# Checks for programs used in the main build process.
#
AC_PROG_CC_STDC
if test "$ac_cv_prog_cc_stdc" = "no"
then
AC_MSG_ERROR([The C compiler does not support standard C])
fi
AC_PROG_CPP
AC_PROG_CXX
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).
#
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
# Qt 5.7 or later requires C++11
AS_IF([test -n "$CXX"],
[AX_CXX_COMPILE_STDCXX([11], [noext], [optional])])
# Set CC_FOR_BUILD (the *local* gcc to use for building e.g. lemon)
if test "x$cross_compiling" = xno -a -z "$CC_FOR_BUILD"; then
CC_FOR_BUILD="$CC"
fi
AX_PROG_CC_FOR_BUILD
#
# Check for versions of "sed" inadequate to handle, in libtool, a list
# of object files as large as the list in Wireshark.
#
AC_PROG_SED
AC_PROG_LN_S
AC_PROG_MKDIR_P
AC_PATH_PROG(PERL, perl)
# Check for Python.
AC_PATH_PROGS(PYTHON, python python3)
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
dnl
dnl Check for yacc/lex. Distribution tarballs include generated source,
dnl in which case these tools are not a mandatory requirement to build.
dnl
AC_PROG_YACC
AS_IF([test "x$YACC" = xyacc], [AS_UNSET(YACC)])
AS_IF([test -z "$YACC" -a ! -f $srcdir/wiretap/ascend.c],
[AC_MSG_ERROR([I couldn't find bison or byacc; make sure it's installed and in your path])])
AM_MISSING_PROG(YACC, bison)
AC_PROG_LEX
AS_IF([test "x$LEX" != xflex], [AS_UNSET(LEX)])
AS_IF([test -z "$LEX" -a ! -f $srcdir/wiretap/ascend_scanner.c],
[AC_MSG_ERROR([I couldn't find flex; make sure it's installed and in your path])])
AM_MISSING_PROG(LEX, flex)
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
#
# 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
# 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
#
# We want version 0.7 or better. (XXX - explain why. Is that just
# because our Qt tests were originally based on AM_PATH_GTK, and *it*
# requires 0.7 or better?)
#
PKG_PROG_PKG_CONFIG(0.7)
if test -z "$PKG_CONFIG"; then
AC_MSG_ERROR(I couldn't find pkg-config; make sure it's installed and in your path)
fi
#
# Add configure argument to select OSX deployment target.
#
AC_WIRESHARK_OSX_DEPLOY_TARGET
#
# Try to arrange for large file support.
#
AC_SYS_LARGEFILE
#
# Check if we need to link with libm
#
AC_SEARCH_LIBS([cos], [m])
#
# Check for C99 math functions.
#
AC_CHECK_FUNCS([floorl lrint])
#
# Check if we need to link with -lnsl and -lsocket
#
AX_LIB_SOCKET_NSL
#
# GUI toolkit options
#
AC_ARG_WITH([qt],
AC_HELP_STRING( [--with-qt=@<:@yes/no/4/5@:>@],
[use Qt @<:@default=yes, if available@:>@]),
with_qt="$withval", with_qt="unspecified")
AC_ARG_WITH([gtk],
AC_HELP_STRING( [--with-gtk=@<:@yes/no/2/3@:>@],
[use GTK+ @<:@default=yes, if available@:>@]),
AS_CASE([$withval],
[yes], [with_gtk="3 2 fail"],
[no], [with_gtk="no"],
[3], [with_gtk="3 fail3"],
[2], [with_gtk="2 fail2"],
[AC_MSG_ERROR([--with-gtk must be one of yes/no/2/3])]),
with_gtk="3 2")
# 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 >= 2.12.0 gnutls < 3],
[ have_license_compatible_gnutls="yes" ] , [ echo "GnuTLS >= 2.12.0, < 3.0 not found " ]
)
fi
if test "x$have_license_compatible_gnutls" != "xyes"; then
if test "x$want_gnutls" = "xyes"; then
AC_MSG_ERROR([GnuTLS crypto library was requested, but is not available])
else
AS_ECHO(["GnuTLS with compatible license not found, disabling SSL decryption"])
fi
else
AC_DEFINE(HAVE_LIBGNUTLS, 1, [Define to use GnuTLS library])
tls_message="yes"
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.4.2,
[
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
AS_ECHO(["libgcrypt not found, disabling decryption for ipsec, ssl, etc."])
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_EXISTS([libnl-3.0 libnl-route-3.0 libnl-genl-3.0], [have_libnl3=yes], [have_libnl3=no])
fi
if test x$libnl_version = "xany" -o x$libnl_version = "x2"; then
PKG_CHECK_EXISTS([libnl-2.0], [have_libnl2=yes], [have_libnl2=no])
fi
if test x$libnl_version = "xany" -o x$libnl_version = "x1"; then
PKG_CHECK_EXISTS([libnl-1], [have_libnl1=yes], [have_libnl1=no])
fi
if (test "${have_libnl3}" = "yes"); then
PKG_WIRESHARK_CHECK_SYSTEM_MODULES([LIBNL], [libnl-3.0 libnl-route-3.0 libnl-genl-3.0])
AC_DEFINE(HAVE_LIBNL, 1, [Enable libnl support])
AC_DEFINE(HAVE_LIBNL3, 1, [libnl version 3])
libnl_message="yes (v3)"
elif (test "${have_libnl2}" = "yes"); then
PKG_WIRESHARK_CHECK_SYSTEM_MODULES([LIBNL], [libnl-2.0])
AC_DEFINE(HAVE_LIBNL, 1, [Enable libnl support])
AC_DEFINE(HAVE_LIBNL2, 1, [libnl version 2])
libnl_message="yes (v2)"
elif (test "${have_libnl1}" = "yes"); then
PKG_WIRESHARK_CHECK_SYSTEM_MODULES([LIBNL], [libnl-1])
AC_DEFINE(HAVE_LIBNL, 1, [Enable libnl support])
AC_DEFINE(HAVE_LIBNL1, 1, [libnl version 1])
libnl_message="yes (v1)"
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;
(void)x;],
[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)])
AC_MSG_CHECKING([for NL80211_VHT_CAPABILITY])
AC_TRY_COMPILE([#include <linux/nl80211.h>],
[enum nl80211_attrs x = NL80211_ATTR_VHT_CAPABILITY;],
[AC_MSG_RESULT(yes) AC_DEFINE(HAVE_NL80211_VHT_CAPABILITY, 1, [VHT_CAPABILITY 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.
#
AC_CHECK_PROGS(XSLTPROC, xsltproc, xsltproc)
AC_CHECK_PROGS(A2X, a2x, a2x)
AC_CHECK_PROGS(FOP, fop, fop)
# HTML to text processor
AC_MSG_CHECKING([for an HTML to text processor])
AS_IF([w3m -version >&AS_MESSAGE_LOG_FD 2>&1], [have_a2x_text=w3m],
[lynx -version >&AS_MESSAGE_LOG_FD 2>&1], [have_a2x_text=lynx],
[have_a2x_text=no])
AC_MSG_RESULT([$have_a2x_text])
AM_CONDITIONAL(HAVE_A2X_TEXT, [test "x$have_a2x_text" != xno])
AS_IF([test $have_a2x_text = lynx], [A2X_LYNX="--lynx"])
AC_SUBST(A2X_LYNX)
# 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
#
# Looks for the rpmbuild program, and checks to see if we can redefine "_topdir".
#
AC_CHECK_PROGS(RPMBUILD, [rpmbuild], [false])
if test "x$RPMBUILD" != "xfalse" ; then
AC_MSG_CHECKING([to see if we can redefine _topdir])
rpm --define '_topdir /tmp' > /dev/null 2>&1
if test $? -eq 0 ; then
AC_MSG_RESULT(yes)
have_rpm=yes
else
AC_MSG_RESULT([no, you'll have to build packages manually])
have_rpm=no
fi
fi
AM_CONDITIONAL(HAVE_RPM, [test "x$have_rpm" = xyes])
# Debian
AC_CHECK_PROG(HAVE_DPKG_BUILDPACKAGE, dpkg-buildpackage, "yes", "no")
# 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)
#
# Use this as a proxy for "is this OS X" (just in case somebody actually
# built and installed Darwin as an OS, perhaps with some X11-based GUI,
# don't look for Darwin).
#
AC_CHECK_PROG(have_sw_vers, sw_vers, "yes", "no")
AM_CONDITIONAL(NOT_OS_X, test "x$have_sw_vers" = "xno")
#
# Check compiler vendor. For GCC this will be 'gnu' and for Clang 'clang'.
#
AX_COMPILER_VENDOR
if test "x$CXX" != "x" ; then
AC_LANG_PUSH(C++)
AX_COMPILER_VENDOR
AC_LANG_POP
fi
#
# 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
#
# The following are for C and C++
#
AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wall)
AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wextra)
AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wendif-labels)
AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wpointer-arith)
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(-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)
AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wunused-const-variable, 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)
# Clang only. Avoid "argument unused during compilation" warnings
# (for example, when getting the -gsplit-dwarf option or
# when combining -fwrapv with -fno-strict-overflow)
if test x"$ax_cv_c_compiler_vendor" = xclang; then
AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Qunused-arguments, C)
fi
if test x"$ax_cv_cxx_compiler_vendor" = xclang; then
AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Qunused-arguments, CXX)
fi
#
# 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.
#
# GCC and GCC-compatible compilers
#
AC_WIRESHARK_COMPILER_FLAGS_CHECK(-fvisibility=hidden)
if test "x$can_add_to_cflags" = "xno"
then
#
# Sun^WOracle C.
#
AC_WIRESHARK_COMPILER_FLAGS_CHECK(-xldscope=hidden)
if test "x$can_add_to_cflags" = "xno"
then
# TODO add other ways of hiding symbols
AC_MSG_WARN(Compiler will export all symbols from shared libraries)
fi
fi
#Clang only
AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wc99-extensions, C)
#
# 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(-Wpedantic)
#
# As we use variadic macros, we don't want warnings
# about them, even with -Wpedantic.
#
AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wno-variadic-macros)
#
# 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
])
# Try to add ASAN address analyze.
# Only needed for analyse
#
AC_ARG_ENABLE(asan,
AC_HELP_STRING( [--enable-asan],
[Enable AddressSanitizer (ASAN) for debugging (degrades performance)@<:@default=no@:>@]),
[
#
# With Clang >= 3.5 Leak detection is enable by default
# and no yet all leak is fixed...
# use ASAN_OPTIONS=detect_leaks=0 to disable detect_leaks
#
# XXX shouldn't this also be added to LDFLAGS?
AC_WIRESHARK_COMPILER_FLAGS_CHECK(-fsanitize=address)
])
# Add check hf conflict..
#
AC_ARG_ENABLE(checkhf-conflict,
AC_HELP_STRING( [--enable-checkhf-conflict],
[Enable hf conflict check for debugging (start-up may be slower)@<:@default=no@:>@]),
[
AC_DEFINE(ENABLE_CHECK_FILTER, 1, [Enable hf conflict check])
])
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.
#
WS_CFLAGS_saved="$WS_CFLAGS"
WS_LDFLAGS_saved="$WS_LDFLAGS"
AC_WIRESHARK_COMPILER_FLAGS_CHECK(-fPIE, C)
if test "x$can_add_to_cflags" = "xyes"
then
AC_WIRESHARK_LDFLAGS_CHECK([-fPIE -pie])
if test "x$can_add_to_ldflags" = "xyes"
then
# We can use PIE
PIE_CFLAGS="-fPIE"
PIE_LDFLAGS="-pie"
fi
fi
WS_CFLAGS="$WS_CFLAGS_saved"
WS_LDFLAGS="$WS_LDFLAGS_saved"
AC_SUBST(PIE_CFLAGS)
AC_SUBST(PIE_LDFLAGS)
WS_CFLAGS_saved="$WS_CFLAGS"
AC_WIRESHARK_COMPILER_FLAGS_CHECK(-msse4.2, C)
if test "x$can_add_to_cflags" = "xyes"
then
#
# The compiler supports -msse4.2; use that to enable SSE 4.2.
#
# We only want to apply -msse4.2 to
# wsutil/ws_mempbrk_sse42.c, as the SSE4.2 code there
# is run only if the hardware supports it, but other
# code would do no such checks.
#
ac_sse4_2_flag=-msse4.2
else
#
# Try -xarch=sse4_2; that's the flag for Sun's compiler.
#
AC_WIRESHARK_COMPILER_FLAGS_CHECK(-xarch=sse4_2, C)
if test "x$can_add_to_cflags" = "xyes"
then
#
# The compiler supports -xarch=sse4_2; use that to
# enable SSE 4.2.
ac_sse4_2_flag=-xarch=sse4_2
fi
fi
WS_CFLAGS="$WS_CFLAGS_saved"
if test "x$ac_sse4_2_flag" != x; then
#
# OK, we have a compiler flag to enable SSE 4.2.
#
# Make sure we have the necessary headers for the SSE4.2 intrinsics
# and that we can use them.
#
# First, check whether we have emmintrin.h and can use it
# *without* the SSE 4.2 flag.
#
AC_MSG_CHECKING([whether there is emmintrin.h header and we can use it])
AC_TRY_COMPILE(
[#include <emmintrin.h>],
[return 0;],
[
emmintrin_h_works=yes
AC_MSG_RESULT([yes])
],
[
emmintrin_h_works=no
AC_MSG_RESULT([no])
]
)
#
# OK, if that works, see whether we have nmmintrin.h and
# can use it *with* the SSE 4.2 flag.
#
if test "x$emmintrin_h_works" = "xyes"; then
#
# Add the SSE4.2 flags to the beginning of CFLAGS,
# in case the user explicitly specified -mno-sse4.2
# (or in case Gentoo's build tools did so); if they
# did so, we only want this to work if we can use
# the #pragma to override that for ws_mempbrk_sse42.c,
# and putting it at the beginning means that the
# CFLAGS setting in the environment will come later
# and override it.
#
AC_MSG_CHECKING([whether there is nmmintrin.h header and we can use it])
saved_CFLAGS="$CFLAGS"
CFLAGS="$ac_sse4_2_flag $WS_CFLAGS $CFLAGS"
AC_TRY_COMPILE(
[#include <nmmintrin.h>],
[return 0;],
[
have_sse42=yes
AC_DEFINE(HAVE_SSE4_2, 1, [Support SSSE4.2 (Streaming SIMD Extensions 4.2) instructions])
CFLAGS_SSE42="$ac_sse4_2_flag"
AC_MSG_RESULT([yes])
],
[
have_sse42=no
AC_MSG_RESULT([no])
]
)
CFLAGS="$saved_CFLAGS"
else
have_sse42=no
fi
else
have_sse42=no
fi
dnl build libwsutil_sse42 only if there is SSE4.2
AM_CONDITIONAL(SSE42_SUPPORTED, test "x$have_sse42" = "xyes")
AC_SUBST(CFLAGS_SSE42)
#
# If we're running GCC or clang define _U_ to be "__attribute__((unused))"
# so we can use _U_ to flag unused function parameters and not get warnings
# about them. Otherwise, define _U_ to be an empty string so that _U_ used
# to flag an unused function parameters will compile with other compilers.
#
# XXX - similar hints for other compilers?
#
if test "x$GCC" = "xyes" -o "x$CC" = "xclang" ; then
AC_DEFINE(_U_, __attribute__((unused)), [Hint to the compiler that a function parameters is not used])
AC_DEFINE(WS_NORETURN, __attribute((noreturn)), [Hint to the compiler that a function never returns])
else
AC_DEFINE(_U_, , [Hint to the compiler that a function parameters is not used])
AC_DEFINE(WS_NORETURN, , [Hint to the compiler that a function never returns])
fi
# If we're running GCC or CLang, use FORTIFY_SOURCE=2
# (only if the GCC 'optimization level' > 0).
#
# See: http://gcc.gnu.org/ml/gcc-patches/2004-09/msg02055.html
# See: http://sourceware.org/bugzilla/show_bug.cgi?id=13979
#
# Note: FORTIFY_SOURCE is only effective for gcc optimization level > 0 (-O1, etc)
AC_WIRESHARK_GCC_FORTIFY_SOURCE_CHECK
#
# If the compiler supports GCC-style flags, enable a barrier "stop on
# warning".
# This barrier is set for a very large part of the code. However, it is
# typically not set for "generated" code (flex, ans2wrs, idl2wrs, ...)
#
warnings_as_errors_default="yes"
AC_MSG_CHECKING(whether we should treat compiler warnings as errors)
AC_ARG_ENABLE(warnings-as-errors,
AC_HELP_STRING( [--enable-warnings-as-errors],
[treat warnings as errors (only for GCC or clang) @<:@default=yes, unless extra compiler warnings are enabled@:>@]),
[
if test "x$ac_supports_gcc_flags" = "xyes" -a "x$enableval" = "xyes"; then
with_warnings_as_errors="yes"
AC_MSG_RESULT(yes)
else
with_warnings_as_errors="no"
AC_MSG_RESULT(no)
fi
],
[
if test "x$ac_supports_gcc_flags" = "xyes" -a "x$wireshark_extra_flags" = "x" -a "x$warnings_as_errors_default" = "xyes"; then
with_warnings_as_errors="yes"
AC_MSG_RESULT(yes)
else
with_warnings_as_errors="no"
AC_MSG_RESULT(no)
fi
])
AS_IF([test "x$with_warnings_as_errors" = "xyes"], [WERROR="-Werror"], [WERROR=""])
AC_SUBST(WERROR)
AM_CONDITIONAL(HAVE_WARNINGS_AS_ERRORS, [test "x$with_warnings_as_errors" = "xyes"])
#
# Add any platform-specific compiler flags needed.
#
AC_MSG_CHECKING(for platform-specific compiler flags)
if test "x$GCC" = "xyes" ; then
#
# GCC - do any platform-specific tweaking necessary.
#
case "$host_os" in
solaris*)
# the X11 headers don't automatically include prototype info
# and a lot don't include the return type
WS_CPPFLAGS="$WS_CPPFLAGS -DFUNCPROTO=15"
WS_CFLAGS="$WS_CFLAGS -Wno-return-type"
WS_CXXFLAGS="$WS_CXXFLAGS -Wno-return-type"
AC_MSG_RESULT(GCC on Solaris - added -Wno-return-type -DFUNCPROTO=15)
;;
*)
AC_MSG_RESULT(none needed)