File: configure.in

package info (click to toggle)
kismet 2008-05-R1-4
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 3,232 kB
  • ctags: 3,998
  • sloc: cpp: 33,568; sh: 5,544; ansic: 459; makefile: 457; perl: 62; sql: 41
file content (1062 lines) | stat: -rw-r--r-- 31,224 bytes parent folder | download | duplicates (2)
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
# Process this file with autoconf to produce a configure script.
AC_INIT
AC_CONFIG_SRCDIR([kismet.h])

AC_PREREQ(2.57)

# Check for host type
AC_CANONICAL_HOST

# Checks for programs.
AC_PROG_CC
AC_PROG_CXX
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AC_PROG_CPP

# Liberated from ethereal's configure.in
#
# Add any platform-specific compiler flags needed.
#
AC_MSG_CHECKING(for platform-specific compiler flags)
if test "x$GCC" = x
then
    #
    # Not GCC - assume it's the vendor's compiler.
    #
    case "$host_os" in
    hpux*)
        #
        # HP's ANSI C compiler; flags suggested by Jost Martin.
        # "-Ae" for ANSI C plus extensions such as "long long".
        # "+O2", for optimization.  XXX - works with "-g"?
        #
        CFLAGS="-Ae +O2 $CFLAGS"
        AC_MSG_RESULT(HP ANSI C compiler - added -Ae +O2)
        ;;
    darwin*)
        #
        # It may be called "cc", but it's really a GCC derivative
        # with a problematic special precompiler and precompiled
        # headers; turn off the special precompiler, as some
        # apparently-legal code won't compile with its precompiled
        # headers.
        #
		AC_DEFINE(SYS_DARWIN, 1, Compiling for Darwin/OSX)
        CFLAGS="-no-cpp-precomp $CFLAGS"
		LDFLAGS="$LDFLAGS -framework Foundation -framework CoreFoundation -F/System/Library/PrivateFrameworks -framework Apple80211 -framework IOKit"
		objc_link='$(OBJC_CONTROL_O)'
        AC_MSG_RESULT(Apple GCC - added Apple80211 frameworks and no-precomp)
		darwin="yes"
        ;;
	linux*)
		AC_MSG_RESULT(none needed)
		AC_DEFINE(SYS_LINUX, 1, Compiling for Linux OS)
        linux="yes"
		;;
	freebsd*)
		AC_MSG_RESULT(none needed)
		AC_DEFINE(SYS_FREEBSD, 1, Compiling for FreeBSD)
		bsd="yes"
		;;
	openbsd*)
		AC_MSG_RESULT(none needed)
		AC_DEFINE(SYS_OPENBSD, 1, Compiling for OpenBSD)
		bsd="yes"
		;;
	netbsd*)
		AC_MSG_RESULT(adding pkgsrc locations)
		CPPFLAGS="$CPPFLAGS -I/usr/pkg/include"
		LDFLAGS="$LDFLAGS -L/usr/pkg/lib"
		AC_DEFINE(SYS_NETBSD, 1, Compiling for NetBSD)
		bsd="yes"
		;;
	cygwin*)
		AC_MSG_RESULT(none needed)
		AC_DEFINE(SYS_CYGWIN, 1, Compiling for Cygwin)
		cygwin="yes"
		;;
    *)
        AC_MSG_RESULT(none needed)
        ;;
    esac
else
    case "$host_os" in
    solaris*)
        # the X11 headers don't automatically include prototype info
        # and a lot don't include the return type
        CFLAGS="$CFLAGS -Wno-return-type -DFUNCPROTO=15"
        AC_MSG_RESULT(GCC on Solaris - added -Wno-return-type -DFUNCPROTO=15)
        ;;
    darwin*)
        #
        # See comments above about Apple's lovely C compiler.
        #
		AC_DEFINE(SYS_DARWIN, 1, Compiling for Darwin/OSX)
        CFLAGS="-no-cpp-precomp $CFLAGS"
		LDFLAGS="$LDFLAGS -framework Foundation -framework CoreFoundation -F/System/Library/PrivateFrameworks -framework Apple80211 -framework IOKit"
		objc_link='$(OBJC_CONTROL_O)'
        AC_MSG_RESULT(Apple GCC - added Apple80211 frameworks and no-precomp)
		darwin="yes"
        ;;
	linux*)
		AC_MSG_RESULT(none needed)
		AC_DEFINE(SYS_LINUX, 1, Compiling for Linux OS)
        linux="yes"
		;;
    freebsd*)
        AC_MSG_RESULT(none needed)
        AC_DEFINE(SYS_FREEBSD, 1, Compiling for FreeBSD)
		bsd="yes"
        ;;
    openbsd*)
        AC_MSG_RESULT(none needed)
        AC_DEFINE(SYS_OPENBSD, 1, Compiling for OpenBSD)
		bsd="yes"
        ;;
    netbsd*)
		AC_MSG_RESULT(adding pkgsrc locations)
		CPPFLAGS="$CPPFLAGS -I/usr/pkg/include"
		LDFLAGS="$LDFLAGS -L/usr/pkg/lib"
        AC_DEFINE(SYS_NETBSD, 1, Compiling for NetBSD)
		bsd="yes"
        ;;
	cygwin*)
		AC_MSG_RESULT(none needed)
		AC_DEFINE(SYS_CYGWIN, 1, Compiling for Cygwin)
		cygwin="yes"
		;;
    *)
        AC_MSG_RESULT(none needed)
        ;;
    esac
fi

if test "$cygwin" = "yes"; then
	AC_MSG_CHECKING(cygwin compile flags)
	AC_MSG_RESULT(__MINGW32__)
	CXXFLAGS="$CXXFLAGS -D__MINGW32__"
fi

AC_CONFIG_SRCDIR([kismet_server.cc])
AC_CONFIG_HEADER([config.h])

# Config location for code to default to
CONFFILE_DIR=$sysconfdir
CONFFILE_DIR=`(
    test "$prefix" = NONE && prefix=$ac_default_prefix
    test "$exec_prefix" = NONE && exec_prefix=${prefix}
    eval echo "$CONFFILE_DIR"
)`
AC_DEFINE_UNQUOTED(SYSCONF_LOC, "$CONFFILE_DIR", system config directory)

LOCALSTATE_DIR=$localstatedir
LOCALSTATE_DIR=`(
                 test "$prefix" = NONE && prefix=$ac_default_prefix
                 test "$exec_prefix" = NONE && exec_prefix=${prefix}
                 eval echo "$LOCALSTATE_DIR"
                )`
AC_DEFINE_UNQUOTED(LOCALSTATE_DIR, "$LOCALSTATE_DIR", system state directory)

BIN_DIR=$bindir
BIN_DIR=`(
    test "$prefix" = NONE && prefix=$ac_default_prefix
    test "$exec_prefix" = NONE && exec_prefix=${prefix}
    eval echo "$BIN_DIR"
)`
AC_DEFINE_UNQUOTED(BIN_LOC, "$BIN_DIR", system binary directory)

# Check for endian
AC_C_BIGENDIAN

# Checks for header files.
AC_CHECK_HEADERS([errno.h stdlib.h string.h sys/socket.h sys/time.h sys/wait.h unistd.h sys/types.h netdb.h], 
	AC_DEFINE(HAVE_SYSHEADERS, 1, System headers are there), 
	AC_MSG_ERROR(Missing required system header))

AC_CHECK_HEADERS([getopt.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_HEADER_TIME
AC_STRUCT_TM

# Checks for library functions.
AC_HEADER_STDC
AC_TYPE_SIGNAL
AC_FUNC_STAT
AC_CHECK_FUNCS([gettimeofday memset select socket strcasecmp strftime strstr])

# Do we have getopt_long natively?
AC_MSG_CHECKING([for system-level getopt_long()])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
		#include <stdio.h>
		#include <unistd.h>
		#ifdef HAVE_GETOPT_H
		#include <getopt.h>
		#endif
		]], [[
		static struct option long_options[] = {   /* options table */
			   { "null-arg", required_argument, 0, 'n' },
			   { 0, 0, 0, 0 }
		};

		int s;
		int option_index;
		int argc;
		char **argv;

		s = getopt_long(argc, argv, "n:", long_options, &option_index);

		]])],[sys_getopt=yes],[sys_getopt=no])
if test "$sys_getopt" = "yes"; then
	AC_MSG_RESULT([yes])
	AC_DEFINE(HAVE_GETOPT_LONG, 1, system defines getopt_long)
else
	AC_MSG_RESULT([no])
fi

# Look for something to define standard int types
stdint=yes
AC_CHECK_HEADER([stdint.h],
	AC_DEFINE(HAVE_STDINT_H, 1, stdint.h is present) stdint=yes,
	stdint=no)

if test "$stdint" = "no"; then
    inttypes=no
	AC_CHECK_HEADER([inttypes.h],
		AC_DEFINE(HAVE_INTTYPES_H, 1, inttypes.h is present) inttypes=yes, 
		inttypes=no)
fi

if test "$stdint" = "no"; then
	if test "$inttypes" = "no"; then
		AC_MSG_RESULT([failed])
		AC_MSG_ERROR([could not find stdint.h or inttypes.h.])
	fi
fi

# How does accept() work on this system?
AC_MSG_CHECKING([for accept() addrlen type])
OCFL="$CFLAGS"
CFLAGS="-Werror $CFLAGS"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
		#include <stdio.h>
		#include <netdb.h>
		#include <sys/types.h>
		#include <sys/socket.h>
		]], [[
		int s = 0;
		struct sockaddr *addr = NULL;
		socklen_t *addrlen = NULL;

		accept(s, addr, addrlen);
		return 0;
		]])],[accept_socklen=yes],[accept_socklen=no])
if test "$accept_socklen" = "yes"; then
	AC_MSG_RESULT([socklen_t])
	AC_DEFINE(HAVE_SOCKLEN_T, 1, accept() takes type socklen_t for addrlen)
else
	AC_MSG_RESULT([int])
fi
CFLAGS="$OCFL"

# Do we have large file support?
AC_SYS_LARGEFILE

# Do we use libstdc++?
AC_CHECK_LIB([uClibc++], [main], 
			 foundcxxl="uclibc" LIBS="$LIBS -luClibc++")

# Do we use uclibc++?
if test "$foundcxxl"x == "x"; then
	AC_CHECK_LIB([stdc++], [main], 
				 foundcxxl="stdc++" LIBS="$LIBS -lstdc++ -lm",,"-lm")
fi

if test "$foundcxxl"x == "x"; then
	AC_MSG_ERROR(Neither uclibc uClibc++ or standard gcc stdc++ libraries found.)
fi

AC_MSG_CHECKING([for group 'root'])
if test "`grep -e ^root: /etc/group`" = ""; then
	AC_MSG_RESULT([no.  Using 'wheel'])
	instgrp="wheel"
else
	AC_MSG_RESULT([yes])
	instgrp="root"
fi
AC_SUBST(instgrp)

AC_MSG_CHECKING([for group 'man'])
if test "`grep -e ^man: /etc/group`" = ""; then
	AC_MSG_RESULT([no.  Using '$instgrp'])
	mangrp="$instgrp"
else
	mangrp="man"
fi
AC_SUBST(mangrp)

# Check for Hildon and friends (Maemo environment)
PKG_CHECK_MODULES(pkghildon, [hildon-1 hildon-help dbus-1 conic], pkghildon=yes, pkghildon=no)
if test "$pkghildon" = "yes"; then
	AC_DEFINE(HAVE_HILDON, 1, we have libhildon)
	CFLAGS="$CFLAGS `pkg-config hildon-1 hildon-help dbus-1 conic --cflags`"
	LIBS="$LIBS -lgpsmgr -lgpsbt -lgps `pkg-config hildon-1 hildon-help dbus-1 conic --libs`"
fi

# Checks for libraries.
# AC_CHECK_LIB([ibs], [main])
AC_ARG_ENABLE(curses, [  --disable-curses        disable libcurses interface],,wantecurses=yes)
buildcurses=no
if test "$wantecurses" = "yes"; then
	AC_DEFINE(BUILD_CURSES, 1, Build curses-based UI)
	buildcurses=yes
fi

AC_ARG_ENABLE(panel, [  --disable-panel         disable libpanels interface],,wantepanel=yes)

ncurses=no
wantpanel=no
if test "$wantecurses" = "yes" -o "$wantepanel" = "yes"; then
	AC_CHECK_LIB([ncurses], [initscr], 
		AC_DEFINE(HAVE_LIBNCURSES, 1, NCurses terminal lib) ncurses=yes curseaux="-lncurses", 
		AC_MSG_WARN(Unable to find libncurses))

	if test "$ncurses" = no; then
		AC_CHECK_LIB([curses], [initscr],
			AC_DEFINE(HAVE_LIBNCURSES, 1, NCurses terminal lib) 
				AC_DEFINE(HAVE_LIBCURSES, 1, Curses terminal lib)
				curses=yes ncurses=yes curseaux="-lcurses",
			AC_MSG_ERROR(Unable to find libncurses or libcurses))
	fi

	if test "$ncurses" = yes -a "$wantepanel" = yes; then
		AC_CHECK_LIB([panel], [new_panel], 
			AC_DEFINE(HAVE_LIBPANEL, 1, Panel terminal lib) 
				AC_DEFINE(BUILD_PANEL, 1, Build panel UI) panel=yes, 
			AC_MSG_WARN(*** Unable to find libpanel - panel UI will not be built. ***), $curseaux)
	fi

	if test "$panel" = yes; then
		CLIBS="$CLIBS -lpanel"
		if test "$curses" = "yes"; then
        	AC_CHECK_LIB([curses], [assume_default_colors],
				AC_DEFINE(HAVE_ASSUME_DEFAULT_COLORS, 1, AssumeDefaultColors present),
				AC_MSG_WARN(*** Your curses does not have assume_default_colors. ***))
		else
        	AC_CHECK_LIB([ncurses], [assume_default_colors],
				AC_DEFINE(HAVE_ASSUME_DEFAULT_COLORS, 1, AssumeDefaultColors present),
				AC_MSG_WARN(*** Your curses does not have assume_default_colors. ***))
		fi
	fi

	if test "$ncurses" = yes; then
		if test "$curses" = yes; then
			CLIBS="$CLIBS -lcurses"
		else
			CLIBS="$CLIBS -lncurses"
		fi
	fi
else
	AC_MSG_WARN(*** Neither ncurses or panel interface will be built. ***)
fi
AC_SUBST(CLIBS)

AC_ARG_WITH(linuxheaders,
[  --with-linuxheaders[=DIR]     Custom location of the Linux kernel headers if the glibc copies are insufficient ],
[
    if test "$withval" != no -a "$withval" != "yes"; then
        CPPFLAGS="$CPPFLAGS -I$withval"   
    fi
])

# ,[
#         CPPFLAGS="$CPPFLAGS -I/lib/modules/$(uname -r)/build/include/"   
# ])

AC_ARG_ENABLE(netlink, [  --disable-netlink       disable linux netlink socket capture],,wantnetlink=yes)
AC_SUBST(wantnetlink)

if test "$wantnetlink" = yes; then
netlink=no
AC_CHECK_HEADER([linux/netlink.h],
	[AC_DEFINE(HAVE_LINUX_NETLINK, 1, Linux netlink socket capture present) netlink=yes],
	[AC_MSG_WARN([*** Missing Linux netlink headers.  wlanng_legacy source will not be built. ***])],
	[
	#include <sys/types.h>
	#include <netdb.h>
	#include <linux/socket.h>
	])
else
	AC_MSG_WARN([*** Compiling without Linux netlink headers.  wlanng_legacy source will not be built. ***])
fi

AC_ARG_ENABLE(wireless-extension, [  --disable-wireless-extension  Disable linux wireless extensions even if found],,
              wantwireless=yes)
AC_SUBST(wantwireless)

if test "$wantwireless" = yes; then
wireless=no
AC_CHECK_HEADER([linux/wireless.h],
	[wireless=yes],
	[AC_MSG_WARN([*** Missing Linux Wireless kernel extentions.  The majority of packet sources on Linux require this support and will not work without it.  Make sure your kernel header packages are installed.  If all else fails, try the --with-linuxheaders directive. ***])],
	[
	#include <sys/types.h>
	#include <netdb.h>
	#include <linux/socket.h>
	#include <linux/if.h>
	])
else
	AC_MSG_WARN(*** Missing Linux Wireless kernel extentions.  The majority of packet sources on Linux require this support and will not work without it.  Make sure your kernel header packages are installed.  If all else fails, try the --with-linuxheaders directive. ***)
fi

if test "$wireless" = "yes"; then
    AC_MSG_CHECKING(that linux/wireless.h is what we expect)
    AC_LINK_IFELSE([AC_LANG_PROGRAM([[
        #include <stdio.h>
		#include <sys/types.h>
		#include <netdb.h>
		#include <netinet/in.h>
        #include <sys/resource.h>
		#include <linux/if.h>
		#include <linux/wireless.h>
    ]], [[
		struct iwreq wrq;

		wrq.u.essid.flags = 0;
    ]])],[wireless=yes],[wireless=no])

	if test "$wireless" = "no"; then
		AC_MSG_RESULT(no)
		AC_MSG_WARN(*** Missing working Linux Wireless kernel extentions.  ***)
	else
		AC_MSG_RESULT(yes)
		AC_DEFINE(HAVE_LINUX_WIRELESS, 1, Linux wireless extentions present)
		# Check if we have 22+ (SIOCIWFIRSTPRIV) support
		wireless22=no
		AC_MSG_CHECKING(that wireless extentions support SIOCIWFIRSTPRIV)
    	AC_LINK_IFELSE([AC_LANG_PROGRAM([[
        	#include <stdio.h>
			#include <sys/types.h>
			#include <netinet/in.h>
        	#include <sys/resource.h>
			#include <linux/if.h>
			#include <linux/wireless.h>
    	]], [[
			int x;
			x = SIOCIWFIRSTPRIV;
	    ]])],[wireless22=yes],[wireless22=no])

		if test "$wireless22" = "no"; then
			AC_MSG_RESULT(no)
			AC_MSG_WARN([*** Your wireless extentions version is old.  This will almost certianly cause problems entering monitor mode and controlling channels. ***]);
		else
			AC_MSG_RESULT(yes)
			AC_DEFINE(HAVE_LINUX_WIRELESS22, 1, [Linux wireless extentions v22 or better present])
		fi

		iwfreqflag=no
		AC_MSG_CHECKING(can we use iw_freq.flags)
		AC_LINK_IFELSE([AC_LANG_PROGRAM([[
			#include <stdio.h>
			#include <sys/types.h>
			#include <netinet/in.h>
			#include <asm/types.h>
			#include <linux/if.h>
			#include <linux/wireless.h>
		]], [[
			struct iwreq wrq;
			wrq.u.freq.flags = IW_FREQ_FIXED;
		]])],[iwfreqflag=yes],[iwfreqflag=no])

		if test "$iwfreqflag" = "no"; then
			AC_MSG_RESULT(no)
		else
			AC_MSG_RESULT(yes)
			AC_DEFINE(HAVE_LINUX_IWFREQFLAG, 1, [Linux wireless iwfreq.flag])
		fi

	fi
fi

if test "$cygwin" = yes; then
AC_CHECK_HEADERS([windows.h Win32-Extensions.h])

AC_ARG_ENABLE(airpcap, [  --enable-airpcap        enable checking for CACE airpcap],want_airpcap=yes)

if test "$want_airpcap" = "yes"; then

airpcap_devpack="none"
AC_ARG_WITH(airpcap-devpack, 
[  --with-airpcap[=DIR]     Location of the CACE AirPcap device pack NOTE cygwin appears to have link errors if the path is not within the current directory], 
[ airpcap_devpack="$withval" ])

if test "$airpcap_devpack" = "none"; then
	AC_MSG_ERROR(No airpcap path provided use --with-airpcap-devpack)
fi # devpack none

# Set the libs and includes
LDFLAGS="$LDFLAGS -L$airpcap_devpack/WinPcap_Devpack/Lib -L$airpcap_devpack/Airpcap_Devpack/lib"
CPPFLAGS="$CPPFLAGS -I$airpcap_devpack/WinPcap_Devpack/Include -I$airpcap_devpack/Airpcap_Devpack/include"

fi # want_airpcap
fi # cygwin

AC_ARG_ENABLE(pcap, [  --disable-pcap          disable libpcap (most sources) capture support],,wantpcap=yes)
AC_SUBST(wantpcap)

if test "$wantpcap" = yes; then
	foundsyspcap=no

	if test "$cygwin" = yes; then
		pcaplib="wpcap";
	else
		pcaplib="pcap";
	fi

	AC_CHECK_LIB([${pcaplib}], [pcap_open_live],
	    AC_DEFINE(HAVE_LIBPCAP, 1, libpcap packet capture lib) foundsyspcap=yes,
	    AC_MSG_WARN(Compiling without libpcap support.))

	if test "$foundsyspcap" = yes; then
	## if we don't have a pcap.h, do a search for pcap/pcap.h
	AC_CHECK_HEADER([pcap.h],
		AC_DEFINE(HAVE_PCAP_H, 1, libpcap header) foundsyspcaph=yes)
	    if test "$foundsyspcaph" != yes; then 
			AC_CHECK_HEADER([pcap/pcap.h], 
			AC_DEFINE(HAVE_PCAP_H, 1, libpcap header) AC_DEFINE(HAVE_PCAPPCAP_H, 1, pcap/pcap.h),
			AC_MSG_ERROR([found libpcap but unable to find pcap.h]))
	    fi
	# Look for the new PCAP stuff
	AC_CHECK_LIB([pcap], [pcap_setnonblock],
	    AC_DEFINE(HAVE_PCAP_NONBLOCK, 1, Nonblocking-capable libpcap),
	    AC_MSG_WARN(*** You don't appear to have a version of libpcap which supports non-blocking IO.  We'll fake it, but you REALLY should upgrade your libpcap, as it may not support 802.11 capture sources, either. ***))

	if test "$cygwin" != yes; then
	AC_CHECK_LIB([${pcaplib}], [pcap_get_selectable_fd],
		AC_DEFINE(HAVE_PCAP_GETSELFD, 1, Selectablefd-capable libpcap),
		AC_MSG_ERROR(installed libpcap version does not support features Kismet requires.  Upgrade to a current version of libpcap))
	else
	AC_CHECK_LIB([${pcaplib}], [pcap_fileno],
		AC_DEFINE(HAVE_PCAP_FILENO, 1, pcapfileno-capable libwpcap),
		AC_MSG_ERROR(installed libpcap version does not support features Kismet requires.  Upgrade to a current version of libwpcap))
	fi

	pcaplnk="-l${pcaplib}"
	AC_SUBST(pcaplnk)
	pcap="yes"
	fi
fi

if test "$wantpcap" != "yes" -o "$pcap" != "yes"; then
    AC_MSG_WARN(Compiling without libpcap support.  Many capture sources will be disabled.)
fi
AC_SUBST(pcap)

if test "$pcap" = "no" -a "$want_airpcap" = "yes"; then
	AC_MSG_WARN([*** Disabling AirPcap, libpcap not enabled ***]);
	want_airpcap=no;
fi

if test "$want_airpcap" = "yes" -a "$pcap" = "yes"; then
	foundairpcap=no
	AC_CHECK_LIB([airpcap], [AirpcapSetLinkType],
	    AC_DEFINE(HAVE_LIBAIRPCAP, 1, libairpcap win32 control lib) foundairpcap=yes,
	    AC_MSG_WARN(Compiling without airpcap support.))

	if test "$foundairpcap" = yes; then
	## if we don't have a pcap.h, do a search for pcap/pcap.h
	AC_CHECK_HEADER([airpcap.h],
		AC_DEFINE(HAVE_AIRPCAP_H, 1, libairpcap header) foundairpcaph=yes)
	fi

	if test "$foundairpcap" != "yes" -o "$foundairpcaph" != "yes"; then
		AC_MSG_WARN(Compiling without airpcap support)
	else
		airpcap="yes"
		LIBS="$LIBS -lairpcap"
	fi
fi

if test "$bsd" = yes; then
	AC_MSG_CHECKING(for net80211/radiotap support)
	AC_LINK_IFELSE([AC_LANG_PROGRAM([[
	    #include <stdio.h>
		#include <sys/types.h>
	    #include <sys/socket.h>
	    #include <net/if.h>
	    #include <net/if_media.h>
	    #include <net80211/ieee80211_radiotap.h>
	]], [[
	
	]])],[radiotap=yes],[radiotap=no])
	
else
	AC_MSG_WARN(Using local radiotap support on a non-bsd system)
	radiotap=yes
fi

if test "$radiotap" = yes; then
    AC_DEFINE(HAVE_RADIOTAP, 1, radiotap packet headers)
fi

AC_ARG_ENABLE(setuid, [  --disable-setuid        disable setuid/privdrop ability (not reccomended)],,suid=yes)

AC_ARG_ENABLE(viha, [  --disable-viha          disable MacOSX Viha capture source (OSX only)],want_viha=no,)

if test "$darwin" != "yes" -a "$want_viha" = "yes"; then
	AC_MSG_WARN([*** Disabling Viha on non-OSX system ***]);
	want_viha=no;
fi

if test "$want_viha" = "yes"; then
	AC_CHECK_HEADERS([WiFi/WLPacketSource.h WiFi/WLFrame.h WiFi/IEEE80211Frame.h WiFi/WFException.h], 
		AC_DEFINE(HAVE_VIHAHEADERS, 1, Viha headers are there) foundviha=yes, 
		AC_MSG_ERROR(Missing required viha headers.  Did you install the Viha drivers?))
# Enable the ldflags and cxx flags if we found it...
	if test "$foundviha" = "yes"; then
		LDFLAGS="$LDFLAGS -framework WiFi"
# Force suid disabled
        suid="no"        
        AC_MSG_WARN(*** Disabling setuid capabilities.  Viha must be controlled from the main process which makes setuid-dropping impossible. ***)
	fi
fi

# Evaluate suid
if test "$cygwin" = "yes"; then
	suid="no"
fi

AC_SUBST(suid)
if test "$suid" = yes; then
	AC_MSG_CHECKING(for setuid )
	AC_MSG_RESULT(yes)
	AC_DEFINE(HAVE_SUID, 1, setuid capable)
else
	AC_MSG_CHECKING(for setuid)
	AC_MSG_RESULT(no)
# Yell if we didn't already yell about viha
    if test "$foundviha" != "yes"; then
	    AC_MSG_WARN(*** Not installing setuid capabilities.  It is more secure to install Kismet as setuid-capable so it can drop privileges.  Please consult the README file. ***)
    fi
	if test "$cygwin" = "yes"; then
		AC_MSG_WARN(*** Disabling setuid capabilities under Cygwin since they serve no purpose here. ***)
	fi
fi

wsp100=yes
AC_ARG_ENABLE(wsp100, [  --disable-wsp100        disable wsp100 remote drone source],,wsp100=no)
if test "$wsp100" = "yes"; then
	AC_DEFINE(HAVE_WSP100, 1, wsp100 remote sensor support)
fi

# Look for dbus
AC_ARG_ENABLE(dbus, [  --disable-dbus          disable dbus detection],,want_dbus=yes)
if test "$want_dbus" = "yes"; then
	PKG_CHECK_MODULES(DBUS, dbus-1, HAVE_DBUS="yes", HAVE_DBUS="no")
	if test "$HAVE_DBUS"x = "yesx"; then
		CXXFLAGS="$CFLAGS `pkg-config dbus-1 --cflags`"
		LIBS="$LIBS `pkg-config dbus-1 --libs`"
		AC_DEFINE(HAVE_DBUS, 1, dbus integration)
	fi
else
	HAVE_DBUS="no"
fi

local=no
AC_ARG_ENABLE(local-dumper, [  --enable-local-dumper   force use of local dump code even if Ethereal is available],
              local=yes,)
AC_SUBST(local)

libz="no"
AC_DEFINE(USE_LOCAL_DUMP, 1, Use local dumper code)
	local=yes

# gpsmap checks

# We include GPS handling code regardless, for now.
AC_DEFINE(HAVE_GPS, 1, GPS support will be built.)

wantgpsmap=yes

AC_ARG_ENABLE(gpsmap,  [  --disable-gpsmap        disable building gpsmap],
	wantgpsmap=no, wantgpsmap=yes)
AC_SUBST(wantgpsmap)

if test "$wantgpsmap" = "yes"; then

	# Check for expat
	expatl=no
	AC_CHECK_LIB([expat], [XML_GetCurrentLineNumber], 
		AC_DEFINE(HAVE_EXPAT, 1, Expat XML library) expatl=yes,
		AC_MSG_WARN(*** Missing Expat XML library.  gpsmap will not be built. ***))

	# Check for libgmp
	gmpl=no
	AC_CHECK_HEADER([gmp.h],
		AC_DEFINE(HAVE_GMP, 1, GMP math library) gmpl=yes,
		AC_MSG_WARN(*** Missing GMP math library.  gpsmap will not be built. ***))

	# Check for imagemagick
	magickold=no

	save_cppflags="$CPPFLAGS"
	save_cxxflags="$CXXFLAGS"
	save_libs="$LIBS"
	save_ldflags="$LDFLAGS"
	AC_CHECK_PROG(magickconfig, [pkg-config ImageMagick --modversion], yes, no)

	if test "$magickconfig" = "yes"; then
		magickversion=`pkg-config ImageMagick --modversion`
		magickmajor=`echo $magickversion | cut -d '.' -f 1`
		magickminor=`echo $magickversion | cut -d '.' -f 2`
		magicktiny=`echo $magickversion | cut -d '.' -f 3`

		if test "$magickmajor" -lt 5; then
			magickold="yes";
		elif test "$magickmajor" -eq 5 -a "$magickminor" -lt 4; then
			magickold="yes";
		elif test "$magickmajor" -eq 5 -a "$magickminor" -eq 4 -a "$magicktiny" -lt 7; then
			magickold="yes";
		fi
	fi

	if test "$magickold" = "yes"; then
		AC_MSG_WARN(*** Old version of ImageMagick ($magickversion) found.  Please upgrade to 5.4.7 or newer.  gpsmap will not be built. ***)
	elif test "$magickconfig" = "no"; then
		AC_MSG_WARN(*** Missing Magick-config (or it is not in the path).  gpsmap will not be built. ***)
	else
		#CPPFLAGS="$CPPFLAGS `Magick-config --cppflags` -I`Magick-config --prefix`/include"
		CPPFLAGS="$CPPFLAGS `pkg-config ImageMagick --cflags`"
		#CXXFLAGS="$CXXFLAGS `Magick-config --cflags`"
		#CXXFLAGS="$CXXFLAGS `Magick-config --cflags` -I`Magick-config --prefix`/include"
		#LDFLAGS="$LDFLAGS `pkg-config ImageMagick --ldflags`"
		LIBS="`pkg-config ImageMagick --libs`"
		AC_CHECK_HEADER(magick/api.h, magickhdr="yes", magickhdr="no")
		if test "$magickhdr" = "no"; then
			oldcppflags2="$CPPFLAGS"
			#CPPFLAGS="$CPPFLAGS -I`pkg-config ImageMagick --prefix`/include";
			AC_CHECK_HEADER(magick/api.h, magickhdr="yes", magickhdr="no")
			if test "$magickhdr" = "no"; then
				CPPFLAGS="$oldcppflags2";
				AC_MSG_WARN(*** Missing ImageMagick.  gpsmap will not be built. ***)
			fi
		fi

		# if test "$magickhdr" = "yes"; then
		# 	AC_CHECK_LIB([Magick], [WriteImage],
	   	# 		AC_DEFINE(HAVE_IMAGEMAGICK, 1, Imagemagick image library) gpslc="\$(GPSL)",
		# 		AC_MSG_WARN(*** Missing Imagemagick.  gpsmap will not be built. ***))
		# fi

		AC_DEFINE(HAVE_IMAGEMAGICK, 1, Imagemagick image library)
		gpslc="\$(GPSL)"

	fi
	CPPFLAGS="$save_cppflags"
	CXXFLAGS="$save_cxxflags"
	LIBS="$save_libs"
	LDFLAGS="$save_ldflags"

	if test "$expatl" = "no"; then
		if test "$gpslc" != ""; then
			AC_MSG_WARN(*** Disabling gpsmap because expat was not found. ***)
			gpslc=""
		fi
	fi

	if test "$gmpl" = "no"; then
		if test "$gpslc" != ""; then
			AC_MSG_WARN(*** Disabling gpsmap because GMP was not found. ***)
			gpslc=""
		fi
	fi

	if test "$gpslc" != ""; then
		CPPFLAGS="$CPPFLAGS `pkg-config ImageMagick --cflags`"
		#CXXFLAGS="$CXXFLAGS `Magick-config --cflags`"
	fi

	if test "$libz" = "no" -a "$gpslc" != ""; then
		AC_CHECK_LIB([z], [gzopen],
        	AC_DEFINE(HAVE_LIBZ, 1, Libz compression lib) LIBS="$LIBS -lz" libz="yes",
        	AC_MSG_WARN(Unable to find libz compression))
	fi

	AC_CHECK_HEADER(pthread.h,
	AC_CHECK_LIB([pthread], [pthread_create],
		AC_DEFINE(HAVE_PTHREAD, 1, pthread threading library) pthr="yes",
		pthr="no"),
	pthr="no")

	if test "$pthr" = "no"; then
		AC_MSG_WARN(*** GPSMap will be built without pthread support. ***);
		threadlib=""
	else
		threadlib="-lpthread"
	fi

	# Update the companion to this...
	if test "$gpslc"x != "x"; then
    		gpslco="\$(GPSLO)"
	fi
	AC_SUBST(gpslc)
	AC_SUBST(gpslco)

else
	AC_MSG_WARN(*** --disable-gpsmap was specified. gpsmap will not be built ***)
	expatl="no"
	gmpl="no"
	gpslc=""
	pthr="no"
fi

# Not all OpenBSD archs have apm:
if test "$bsd" = "yes"; then
	AC_CHECK_HEADERS([machine/apmvar.h])
fi

# Substitute in the objc linkages if we need them
AC_SUBST(objc_link)


AC_ARG_ENABLE(optimization, [  --disable-optimization        disable -Ox gcc optimization],,wantopto=yes)
if test "$wantopto" != "yes"; then
	CPPFLAGS=`echo $CPPFLAGS | sed -e 's/-O.//g'`
	CXXFLAGS=`echo $CXXFLAGS | sed -e 's/-O.//g'`
fi

AC_SUBST(threadlib)

sharedatadir=$datadir
sharedatadir=`(
    test "$prefix" = NONE && prefix=$ac_default_prefix
    test "$exec_prefix" = NONE && exec_prefix=${prefix}
    eval echo "$sharedatadir"
)`
sharedatadir=${sharedatadir}
AC_SUBST(sharedatadir)

AC_CONFIG_FILES([Makefile extra/buzzme/Makefile extra/Makefile conf/kismet.conf conf/kismet_ui.conf])
AC_OUTPUT

echo
echo "Configuration complete: "
echo "         Compiling for: $host_os ($host_cpu)"
echo "           C++ Library: $foundcxxl"
echo "   Installing as group: $instgrp"
echo "    Man pages owned by: $mangrp"
echo "       Installing into: $prefix"
printf "        Setuid capable: "
if test "$suid" = "yes"; then
	echo "yes"
elif test "$cygwin" = "yes"; then
	echo "n/a (Cygwin/win32)"
elif test "$want_viha" = "yes"; then
	echo "n/a (OSX with Viha)"
else
	echo "no"
fi
printf "      Terminal Control: "
if test "$ncurses" = "yes"; then
	if test "$curses" = "yes"; then
		echo "curses"
	else
		echo "ncurses"
	fi
else
	echo "none"
fi
printf "      Curses interface: "
if test "$buildcurses" = "yes"; then
	echo "yes"
else
	echo "no"
fi
printf "      Panels interface: "
if test "$panel" = "yes"; then
	echo "yes"
else
	echo "no"
fi
printf " Linux Netlink capture: "
if test "$netlink" = "yes"; then
	echo "yes"
elif test "$linux" != "yes"; then
	echo "n/a (only Linux)"
else
	echo "no"
fi
printf "       Linux wireless : "
if test "$wireless" = "yes"; then
	echo "yes"
elif test "$linux" != "yes"; then
	echo "n/a (only Linux)"
else
	echo "no"
fi
printf " Linux wireless v.22+ : "
if test "$wireless22" = "yes"; then
	echo "yes"
elif test "$linux" != "yes"; then
	echo "n/a (only Linux)"
else
	echo "no"
fi
printf "          pcap capture: "
if test "$pcap" = "yes"; then
	echo "yes"
else
	echo "no"
fi
printf "       airpcap control: "
if test "$airpcap" = "yes"; then
	echo "yes"
elif test "$cygwin" != "yes"; then
	echo "n/a (only Cygwin/Win32)"
else
	echo "no"
fi
printf "        WSP100 capture: "
if test "$wsp100" = "yes"; then
	echo "yes";
else
	echo "no";
fi
printf "          Viha capture: "
if test "$want_viha" = "yes"; then
	echo "yes";
elif test "$darwin" != "yes"; then
	echo "n/a (only Darwin)"
else
	echo "no";
fi
printf "   OSX/Darwin capture : "
if test "$darwin" = "yes"; then
	echo "yes"
elif test "$darwin" != "yes"; then
	echo "n/a (only OSX/Darwin)"
else
	echo "no"
fi
printf "      Radiotap headers: "
if test "$radiotap" = "yes"; then
    echo "yes";
else
    echo "no";
fi
printf " Using local dump code: "
if test "$local" = "yes"; then
	echo "yes"
else
	echo "no"
fi
printf "      DBUS Integration: "
if test "$HAVE_DBUS" = "yes"; then
	echo "yes"
else
	echo "no"
fi
# printf "Using ethereal wiretap: "
# if test "$want_ethereal" = "no"; then
# 	echo "no"
# else
# 	echo "$ethereal_dir"
# fi
printf "   Imagemagick support: "
if test "$gpslc" = ""; then
	if test "$wantgpsmap" = "no"; then
		echo "disabled"
	else
		echo "no"
	fi
else
	echo "yes ($magickversion)"
fi
printf "         Expat Library: "
if test "$expatl" = "no"; then
	if test "$wantgpsmap" = "no"; then
		echo "disabled"
	else
		echo "no"
	fi
else
	echo "yes"
fi
printf "           GMP Library: "
if test "$gmpl" = "no"; then
	if test "$wantgpsmap" = "no"; then
		echo "disabled"
	else
		echo "no"
	fi
else
    echo "yes"
fi
printf "       PThread Support: "
if test "$pthr" = "no"; then
	if test "$wantgpsmap" = "no"; then
		echo "disabled"
	else
		echo "no"
	fi
else
	echo "yes"
fi
printf "      libz compression: "
if test "$libz" = "yes"; then
	echo "yes"
else
	if test "$wantgpsmap" = "no"; then
		echo "disabled"
	else	
		echo "no"
	fi
fi

if test "$wireless" != "yes" -a "$linux" = "yes"; then
    echo "*** WARNING ***"
    echo "Linux Wireless Extensions were not found.  This means that they are not"
    echo "turned on in your kernel or that your kernel source include paths on your"
    echo "distribution are broken (namely, that linux/wireless.h didn't exist or"
    echo "was unuseable).  Without wireless extentions, most of the commonly used"
    echo "packet sources (such as Cisco, Orinoco, Madwifi, Prism54, and others)"
    echo "WILL NOT BE BUILT."
    echo "*** WARNING ***"
fi

if test "$pcap" != "yes" -a "$linux" = "yes"; then
	echo "*** WARNING ***"
	echo "LibPCAP was not found.  Kismet previously included a local copy of this"
	echo "library, however it now expects libpcap to be provided by the system."
	echo "Kismet on Linux without LibPcap cannot capture data locally and will "
	echo "almost certainly NOT BE WHAT YOU WANT."
	echo "Your distribution should provide packages for libpcap, otherwise "
	echo "it can be downloaded from http://tcpdump.org"
fi

if test "`echo $host_os | grep linux`" = ""; then
	echo
	echo "Configuration complete.  You are not running a linux-based system,"
	echo "you will likely need to use 'gmake' instead of 'make'."
	echo "Run 'gmake dep' to generate dependencies and 'gmake' followed by"
	echo "'gmake install' to compile and install Kismet"
	echo "Kismet WILL NOT be installed suid-root by default.  If you wish to install"
	echo "Kismet as a suid-root utility, READ THE DOCUMENTATION and run "
	echo "'make suidinstall'."
	echo "DO NOT INSTALL KISMET AS SUID-ROOT IF YOU HAVE UNTRUSTED USERS ON YOUR SYSTEM."
else
	verminor=`uname -r | cut -d '.' -f 2`
	# Stupid redhat
	vertiny=`uname -r | cut -d '.' -f 3 | cut -f 1 -d-`

	if test "$verminor" = "4" -a "$vertiny" -lt 16 ; then
		AC_MSG_WARN(There have been a number of major improvements in the linux-wireless extentions and in the aironet drivers in recent versions.  It is recomended that you run at least kernel version 2.4.16, otherwise you may experience difficulties.)
	fi

	echo
	echo "Configuration complete.  Run 'make dep' to generate dependencies"
	echo "and 'make' followed by 'make install' to compile and install."
fi