1dnl Process this file with autoconf to produce a configure script.
2AC_INIT(tcptrace.c)
3
4AC_CANONICAL_SYSTEM
5
6AC_LBL_C_INIT(V_CCOPT, V_INCLS)
7
8dnl Checks for programs.
9AC_PROG_CC
10AC_PROG_MAKE_SET
11
12AC_PROG_LEX
13AC_PROG_YACC
14
15dnl Checks for libraries.
16dnl Replace `main' with a function in -lm:
17AC_CHECK_LIB(m, main)
18
19dnl See if "unsigned long long int" works
20AC_CHECK_SIZEOF(unsigned long long int)
21
22dnl Find a good type for other binary data types (in headers)
23AC_CHECK_SIZEOF(unsigned long int)
24AC_CHECK_SIZEOF(unsigned int)
25AC_CHECK_SIZEOF(unsigned short)
26
27
28dnl include additional checking if developing
29AC_LBL_DEVEL(V_CCOPT)
30
31dnl check for needed network libraries
32AC_LBL_LIBRARY_NET()
33
34dnl use fpurge if available, otherwise fflush
35AC_CHECK_FUNCS(fpurge)
36
37dnl use mkstemp if available, otherwise tempnam
38AC_CHECK_FUNCS(mkstemp)
39
40dnl use valloc if available, then memalign, then malloc
41AC_CHECK_FUNCS(valloc memalign)
42
43dnl check for the IPv6 routines inet_pton
44AC_CHECK_FUNCS(inet_pton)
45
46AC_MSG_CHECKING(how to print unsigned long long)
47AC_SUBST(FS_ULL)
48dnl AC_TRY_RUN is a test program that performs a run-time test to find out
49dnl the correct syntax to print unsigned long long ints in printf stmts.
50dnl If strcmp returns 0, we are on an enironment that uses %llu, otherwise
51dnl we are on a MacOSX environment that uses %qu
52AC_TRY_RUN([
53#include <stdio.h>
54
55#define NIX "%llu"
56
57int main ()
58{
59  char test[11];
60  unsigned long long int num = 0xdeadbeef;
61  sprintf (test, NIX, num);
62  if (strcmp (test, "3735928559") == 0)
63     exit (0);
64  else
65     exit (1);
66}],
67AC_DEFINE(USE_LLU)
68AC_MSG_RESULT(%llu),
69AC_MSG_RESULT(%qu),
70AC_MSG_ERROR(can not run test program while cross compiling))
71
72dnl Grab standard includes under weird Linux versions
73dnl case "$target_os" in
74dnl  *inux*)	V_INCLS="$V_INCLS -Ilinux-include";
75dnl esac
76
77dnl Grab includes from ./cygwin-includes under Windows versions
78case "$target" in
79  *cygwin*)	V_INCLS="$V_INCLS -I./cygwin-includes";
80esac
81
82dnl define -D__USE_BSD -D__FAVOR_BSD -D__USE_MISC -D__WIN32 for windows
83case "$target" in
84  *cygwin*)	V_DEFINES="$V_DEFINES -D__USE_BSD -D__FAVOR_BSD -D__USE_MISC -D__WIN32";
85esac
86
87dnl setting the correct PCAP_LDLIBS for windows
88V_PCAP_LDLIBS="-lpcap";
89case "$target" in
90  *cygwin*)	V_PCAP_LDLIBS="-lwpcap";
91esac
92
93dnl define _BSD_SOURCE for libc-2
94if [[ -f /lib/libc-2* ]]; then
95 V_DEFINES="$V_DEFINES -D_BSD_SOURCE"
96fi
97
98AC_SUBST(V_CCOPT)
99AC_SUBST(V_INCLS)
100AC_SUBST(V_DEFINES)
101AC_SUBST(V_PCAP_LDLIBS)
102
103AC_OUTPUT(Makefile)
104