Add a "acinclude.m4" file that defines a "AC_ETHEREAL_STRUCT_SA_LEN"
[obnox/wireshark/wip.git] / configure.in
1 # $Id: configure.in,v 1.14 1998/11/17 02:17:27 guy Exp $
2 dnl Process this file with autoconf to produce a configure script.
3 AC_INIT(etypes.h)
4
5 AM_INIT_AUTOMAKE(ethereal, 0.4.1)
6
7 dnl Check for CPU / vendor / OS
8 AC_CANONICAL_HOST
9
10 dnl Checks for programs.
11 AC_PROG_CC
12 AC_PROG_RANLIB
13
14 # Create DATAFILE_DIR #define for config.h
15 DATAFILE_DIR=$sysconfdir
16 DATAFILE_DIR=`(
17     test "x$prefix" = xNONE && prefix=$ac_default_prefix
18     test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
19     eval echo "$DATAFILE_DIR"
20 )`
21 AC_DEFINE_UNQUOTED(DATAFILE_DIR,"$DATAFILE_DIR")
22 AC_SUBST(DATAFILE_DIR)
23
24 # If we're running Solaris, and LD_LIBRARY_PATH is defined, add it as a
25 # link directory.
26 case "$host_os" in
27   solaris*)
28     AC_MSG_CHECKING(for LD_LIBRARY_PATH, since you appear to be running Solaris)
29     if test x$LD_LIBRARY_PATH != x ; then
30       LIBS="$LIBS -R$LD_LIBRARY_PATH"
31       AC_MSG_RESULT(yes -- added LD_LIBRARY_PATH to run-time linker path)
32     else
33       AC_MSG_RESULT(no -- this may be a problem in a few seconds)
34     fi
35   ;;
36 esac
37
38 # GTK checks
39 AM_PATH_GTK(1.0.0, CFLAGS="$CFLAGS $GTK_CFLAGS" LIBS="$LIBS $GTK_LIBS",
40                    AC_MSG_ERROR(GTK+ distribution not found.))
41
42 # Pcap checks
43 AC_CHECK_HEADER(net/bpf.h,, AC_MSG_ERROR(Header file net/bpf.h not found.))
44 AC_CHECK_HEADER(pcap.h,, AC_MSG_ERROR(Header file pcap.h not found.))
45 AC_CHECK_LIB(pcap, pcap_open_offline,, AC_MSG_ERROR(Library libpcap not found.))
46
47 # Evidently, some systems have pcap.h, etc. in */include/pcap
48 AC_MSG_CHECKING(for extraneous pcap header directories)
49 found_pcap_dir=""
50 for pcap_dir in /usr/include/pcap /usr/local/include/pcap
51 do
52   if test -d $pcap_dir ; then
53     LIBS="$LIBS -L$pcap_dir"
54     found_pcap_dir=" $found_pcap_dir -L$pcap_dir"
55   fi
56 done
57
58 if test "$found_pcap_dir" != "" ; then
59   AC_MSG_RESULT(found --$found_pcap_dir added to LIBS)
60 else
61   AC_MSG_RESULT(not found)
62 fi
63
64 # Wiretap check
65 AC_MSG_CHECKING(whether to include wiretap library)
66 AC_ARG_WITH(wiretap,
67 [  --with-wiretap          Include wiretap library.
68   --without-wiretap       Don't include wiretap library (default)],
69         [ case "$withval" in
70                 yes)
71                         AC_MSG_RESULT(yes)
72                         AC_DEFINE(WITH_WIRETAP)
73                         CFLAGS="$CFLAGS -Iwiretap"
74                         LIBWIRETAP_A="wiretap/libwiretap.a"
75                         ;;
76                 *)
77                         AC_MSG_RESULT(no)
78                         LIBWIRETAP_A=""
79                         ;;
80         esac ],
81         AC_MSG_RESULT(no)
82 )
83 AC_SUBST(LIBWIRETAP_A)
84
85 dnl Checks for header files.
86 AC_HEADER_STDC
87 AC_CHECK_HEADERS(fcntl.h strings.h sys/ioctl.h sys/time.h unistd.h stdarg.h)
88
89 AC_CHECK_HEADERS(sys/sockio.h sys/types.h netinet/in.h)
90
91 dnl Checks for typedefs, structures, and compiler characteristics.
92 # AC_C_CONST
93
94 # We need to know whether "struct sockaddr" has an "sa_len" member
95 # for get_interface_list().
96
97 AC_ETHEREAL_STRUCT_SA_LEN
98
99 # We must know our byte order
100 AC_C_BIGENDIAN
101
102 dnl Checks for library functions.
103 AC_PROG_GCC_TRADITIONAL
104 AC_CHECK_FUNC(socket,, AC_MSG_ERROR(Function 'socket' not found.))
105
106 # If there's a system out there that has snprintf and _doesn't_ have vsnprintf,
107 # then this won't work.
108 SNPRINTF_C=""
109 SNPRINTF_O=""
110 AC_CHECK_FUNC(snprintf, SNPRINTF_O="",
111   SNPRINTF_O="snprintf.o" [AC_DEFINE(NEED_SNPRINTF_H)])
112 if test "$ac_cv_func_snprintf" = no ; then
113   SNPRINTF_C="snprintf.c"
114   SNPRINTF_O="snprintf.o"
115 fi
116 AC_SUBST(SNPRINTF_C)
117 AC_SUBST(SNPRINTF_O)
118
119 AM_CONFIG_HEADER(config.h)
120 AC_CONFIG_SUBDIRS(wiretap)
121 AC_OUTPUT(Makefile)