File: configure.in

package info (click to toggle)
lft 2.2-4
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd, wheezy
  • size: 588 kB
  • ctags: 938
  • sloc: ansic: 2,850; sh: 2,803; makefile: 78
file content (137 lines) | stat: -rw-r--r-- 3,294 bytes parent folder | download | duplicates (5)
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
dnl Process this file with autoconf to produce a configure script.
AC_INIT(lft_ifname.h)
AC_CONFIG_HEADER(acconfig.h)

AC_CYGWIN

AC_DEFINE_UNQUOTED(HOST_SYSTEM_TYPE, "$host")

dnl Checks for programs.
AC_PROG_CC
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_INSTALL

AC_CHECK_LIB(nsl, gethostbyname)
AC_CHECK_LIB(socket, connect)
AC_CHECK_LIB(resolv, inet_aton)
AC_CHECK_LIB(m, sin)

dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h limits.h strings.h sys/ioctl.h sys/time.h unistd.h)

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_SIZE_T
AC_HEADER_TIME

dnl Checks for library functions.
AC_FUNC_ALLOCA
AC_CHECK_FUNCS(gettimeofday select socket strdup strstr)
AC_CHECK_LIB(nsl, gethostbyname)
AC_CHECK_LIB(socket, connect)

dnl OS specific checks
case "$host" in
*darwin*)
  AC_DEFINE(BSD_IP_STACK)
;;
*bsd*)
  AC_DEFINE(BSD_IP_STACK)
;;
*linux*)
  AC_DEFINE(_BSD_SOURCE)
;;
*solaris*)
  dnl some versions of solaris need special treatment
  dnl for the th_sum field, and it varies
  dnl between versions...
  case "$host" in
  *solaris2.4*)
    AC_DEFINE(SOLARIS_LENGTH_IN_CHECKSUM)
    ;;
  *solaris2.5*)
    AC_DEFINE(SOLARIS_LENGTH_IN_CHECKSUM)
    ;;
  esac
;;
esac


case "$host" in
*cygwin*)
: we do not require pcap, but we do require special win32 libraries.
LIBS="-lws2_32 $LIBS"
;;
*)
dnl Make sure we have pcap
AC_ARG_WITH(pcap,
[  --with-pcap=PATH        Specify path to pcap library.],
    [
        AC_MSG_CHECKING(for --with-pcap option)
        case "$withval" in
          yes|no)
            AC_MSG_ERROR(PATH required with pcap option)
            ;;
          *)
            if test '!' -d "$withval"; then
                AC_MSG_ERROR($withval does not exist!)
            else
                AC_MSG_RESULT($withval)
                if test -d "$withval/include"; then
                  CFLAGS="$CFLAGS -I$withval/include"
                  CPPFLAGS="$CPPFLAGS -I$withval/include"
                else
                  CFLAGS="$CFLAGS -I$withval"
                  CPPFLAGS="$CPPFLAGS -I$withval"
                fi
                if test -d "$withval/lib"; then
                  LIBS="$LIBS -L$withval/lib"
                else
                  LIBS="$LIBS -L$withval"
                fi
            fi
            ;;
          esac
    ]
)


for incdir in /usr/local/include /usr/include
do
  if test -d $incdir/pcap
  then
    CFLAGS="$CFLAGS -I$incdir/pcap"
    CPPFLAGS="$CFLAGS -I$incdir/pcap"
  fi
done

AC_TRY_COMPILE([
#       include <sys/types.h>
#       include <sys/socket.h>],
        [u_int i = sizeof(((struct sockaddr *)0)->sa_len)],
        AC_DEFINE(HAVE_SOCKADDR_SA_LEN))


AC_CHECK_LIB(pcap, pcap_lookupdev, , [
        AC_MSG_ERROR([
Can't find the pcap library (libpcap.a); install the pcap library (from
ftp://ftp.ee.lbl.gov/libpcap.tar.Z ) and/or use
--with-pcap to specify the path to it on your system

When installing libpcap do both 'make install' and 'make install-incl'])
])

AC_CHECK_HEADER(pcap.h, , [
        AC_MSG_ERROR([
Can't find pcap.h; install the pcap library (from
ftp://ftp.ee.lbl.gov/libpcap.tar.Z ) and/or use
--with-pcap to specify the path to it on your system

When installing libpcap do both 'make install' and 'make install-incl'])
])

esac

AC_OUTPUT(Makefile)