Build-Depends libpcap-dev instead of libpcap0.8-dev.
[yaz-ziffy.git] / configure.ac
1 dnl $Id: configure.ac,v 1.2 2008-01-24 21:53:15 adam Exp $
2
3 AC_PREREQ(2.60)
4 AC_INIT([yaz-ziffy],[1.0],[yaz-help@indexdata.dk])
5
6 AC_CONFIG_SRCDIR([configure.ac]) 
7 AC_CONFIG_AUX_DIR([config])
8 AC_CANONICAL_SYSTEM
9
10 AM_INIT_AUTOMAKE([1.9])
11
12 AC_PROG_CC
13 AC_PROG_RANLIB
14
15 AC_LANG(C)
16
17 YAZ_INIT([static],[3.0.4])
18 if test -z "$YAZLIB"; then
19         AC_MSG_ERROR([YAZ development libraries missing])
20 fi
21 AC_CHECK_HEADERS([unistd.h sys/select.h sys/socket.h sys/stat.h sys/time.h sys/times.h sys/types.h arpa/inet.h netinet/tcp.h netinet/in_systm.h])
22 AC_CHECK_HEADERS([net/if.h netinet/in.h netinet/if_ether.h],[],[],[
23  #if HAVE_SYS_TYPES_H
24  #include <sys/types.h>
25  #endif
26  #if HAVE_SYS_SOCKET_H
27  #include <sys/socket.h>
28  #endif
29  #if HAVE_NET_IF_H
30  #include <net/if.h>
31  #endif
32  #if HAVE_NETINET_IN_H
33  #include <netinet/in.h>
34  #endif
35 ])
36
37 dnl ------ libpcap
38 AC_SUBST(PCAP_LIBS)
39 AC_SUBST(PCAP_CFLAGS)
40 AC_ARG_WITH(pcap, [  --with-pcap[=DIR]         libpcap root dir located in (dir)], [PCAP_DIR="$withval"],[PCAP_DIR=default])
41
42 if test "${PCAP_DIR}" != "no"; then
43     if test "${ac_cv_header_netinet_if_ether_h}" = "no"; then
44         :
45     elif test "${PCAP_DIR}" != "yes" && test "${PCAP_DIR}" != "default"; then
46         PCAP_LIBS="-lpcap"
47         if test "$PCAP_DIR" != "/usr"; then
48             PCAP_LIBS="-L$PCAP_DIR $PCAP_LIBS"
49             PCAP_CFLAGS="-I$PCAP_DIR"
50         fi
51     else
52         oldLibs=$LIBS
53         AC_CHECK_LIB([pcap], [main])
54         if test "$ac_cv_lib_pcap_main" = "yes"; then
55             AC_CHECK_HEADER([pcap.h])
56             if test "$ac_cv_header_pcap_h" = "yes"; then
57                 PCAP_LIBS="-lpcap"
58             fi
59         fi
60         LIBS=$oldLibs
61     fi
62 fi
63 AC_MSG_CHECKING([for libpcap (required for ziffy)])
64 if test -z "${PCAP_LIBS}"; then
65     AC_MSG_ERROR([not found])
66 else
67     AC_MSG_RESULT([found in $PCAP_DIR])
68 fi
69
70 dnl
71 dnl ------ Makefiles
72 dnl
73 AC_OUTPUT([Makefile src/Makefile])
74
75 dnl Local Variables:
76 dnl mode:shell-script
77 dnl sh-indentation: 2
78 dnl sh-basic-offset: 4
79 dnl End: