| 1 | # Process this file with autoconf to produce a configure script. |
|---|
| 2 | |
|---|
| 3 | # Now you only need to update the version number in two places - below, |
|---|
| 4 | # and in the README |
|---|
| 5 | |
|---|
| 6 | AC_INIT([libtrace],[3.0.0-beta4],[contact@wand.net.nz],[libtrace]) |
|---|
| 7 | |
|---|
| 8 | LIBTRACE_MAJOR=3 |
|---|
| 9 | LIBTRACE_MID=0 |
|---|
| 10 | LIBTRACE_MINOR=0 |
|---|
| 11 | |
|---|
| 12 | AC_CONFIG_SRCDIR(lib/trace.c) |
|---|
| 13 | AM_INIT_AUTOMAKE |
|---|
| 14 | |
|---|
| 15 | AC_DEFINE([LIBTRACE_MAJOR],${LIBTRACE_MAJOR},[libtrace major version]) |
|---|
| 16 | AC_DEFINE([LIBTRACE_MID],${LIBTRACE_MID},[libtrace mid version]) |
|---|
| 17 | AC_DEFINE([LIBTRACE_MINOR],${LIBTRACE_MINOR},[libtrace minor version]) |
|---|
| 18 | |
|---|
| 19 | AC_CONFIG_FILES([Makefile lib/Makefile docs/Makefile libpacketdump/Makefile |
|---|
| 20 | libpacketdump/parser/Makefile |
|---|
| 21 | tools/Makefile tools/traceanon/Makefile tools/tracedump/Makefile |
|---|
| 22 | tools/tracemerge/Makefile tools/tracereport/Makefile |
|---|
| 23 | tools/tracertstats/Makefile tools/tracesplit/Makefile |
|---|
| 24 | tools/tracestats/Makefile |
|---|
| 25 | docs/libtrace.doxygen |
|---|
| 26 | lib/libtrace.h |
|---|
| 27 | swig/Makefile]) |
|---|
| 28 | dnl GNU C library |
|---|
| 29 | dnl AC_GNU_SOURCE |
|---|
| 30 | |
|---|
| 31 | |
|---|
| 32 | AC_CONFIG_HEADERS([config.h]) |
|---|
| 33 | dnl Checks for programs. |
|---|
| 34 | AC_PROG_CC |
|---|
| 35 | AC_PROG_CXX |
|---|
| 36 | AC_PROG_INSTALL |
|---|
| 37 | AC_PROG_YACC |
|---|
| 38 | AM_PROG_LEX |
|---|
| 39 | |
|---|
| 40 | AC_CONFIG_LIBOBJ_DIR(lib) |
|---|
| 41 | |
|---|
| 42 | # Checks for typedefs, structures, and compiler characteristics. |
|---|
| 43 | AC_C_CONST |
|---|
| 44 | AC_C_INLINE |
|---|
| 45 | AC_C_BIGENDIAN |
|---|
| 46 | AC_TYPE_SIZE_T |
|---|
| 47 | AC_HEADER_TIME |
|---|
| 48 | AC_SYS_LARGEFILE |
|---|
| 49 | |
|---|
| 50 | AC_PROG_LIBTOOL |
|---|
| 51 | |
|---|
| 52 | AC_ARG_ENABLE(swig, |
|---|
| 53 | [ --disable-swig don't generate python bindings], |
|---|
| 54 | lt_use_python=true,lt_use_python=false) |
|---|
| 55 | |
|---|
| 56 | if test "x$lt_use_python" = "xtrue" |
|---|
| 57 | then |
|---|
| 58 | AM_PATH_PYTHON(2.3) |
|---|
| 59 | AC_PROG_SWIG(1.3.21) |
|---|
| 60 | SWIG_PYTHON |
|---|
| 61 | fi |
|---|
| 62 | |
|---|
| 63 | # Checks for library functions. |
|---|
| 64 | AC_PROG_GCC_TRADITIONAL |
|---|
| 65 | AC_CHECK_FUNCS(socket strdup strlcpy strcasecmp strncasecmp snprintf) |
|---|
| 66 | |
|---|
| 67 | AC_CHECK_SIZEOF([long int]) |
|---|
| 68 | |
|---|
| 69 | |
|---|
| 70 | |
|---|
| 71 | # Check for various broken functions |
|---|
| 72 | AC_FUNC_MALLOC |
|---|
| 73 | AC_FUNC_REALLOC |
|---|
| 74 | |
|---|
| 75 | # *BSD doesn't have strndup. Currently provide our own. |
|---|
| 76 | AC_REPLACE_FUNCS(strndup) |
|---|
| 77 | |
|---|
| 78 | # Checks for header files. |
|---|
| 79 | AC_HEADER_STDC |
|---|
| 80 | dnl AC_CHECK_HEADERS(errno.h stdlib.h stdio.h assert.h string.h netinet/in.h assert.h errno.h fcntl.h net/ethernet.h netdb.h pcap.h stdio.h stdlib.h string.h sys/stat.h sys/types.h sys/socket.h sys/un.h unistd.h time.h sys/ioctl.h net/bpf.h pcap.h zlib.h pcap-bpf.h) |
|---|
| 81 | AC_CHECK_HEADERS(pcap.h pcap-int.h pcap-bpf.h net/bpf.h zlib.h sys/limits.h stddef.h inttypes.h limits.h net/ethernet.h ) |
|---|
| 82 | |
|---|
| 83 | AC_CHECK_HEADERS(netinet/in.h) |
|---|
| 84 | AC_CHECK_HEADERS(netpacket/packet.h,[ |
|---|
| 85 | libtrace_netpacket_packet_h=true |
|---|
| 86 | AC_DEFINE(HAVE_NETPACKET_PACKET_H,1,[has net]) |
|---|
| 87 | ]) |
|---|
| 88 | AC_CHECK_HEADER(net/if.h, |
|---|
| 89 | AC_DEFINE(HAVE_NET_IF_H,1,[has net/if.h header]),,[ |
|---|
| 90 | #include <sys/types.h> |
|---|
| 91 | #include <sys/socket.h> |
|---|
| 92 | ]) |
|---|
| 93 | |
|---|
| 94 | AC_CHECK_HEADER(netinet/ether.h, |
|---|
| 95 | AC_DEFINE(HAVE_NETINET_ETHER_H,1,[has netinet/ether.h header]),,[ |
|---|
| 96 | #include <sys/types.h> |
|---|
| 97 | #include <sys/socket.h> |
|---|
| 98 | #include <netinet/in.h> |
|---|
| 99 | #include <net/if.h> |
|---|
| 100 | ]) |
|---|
| 101 | |
|---|
| 102 | AC_CHECK_HEADER(netinet/if_ether.h, |
|---|
| 103 | AC_DEFINE(HAVE_NETINET_IF_ETHER_H,1,[has netinet/if_ether.h]),,[ |
|---|
| 104 | #include <sys/types.h> |
|---|
| 105 | #include <sys/socket.h> |
|---|
| 106 | #include <netinet/in.h> |
|---|
| 107 | #include <net/if.h> |
|---|
| 108 | ]) |
|---|
| 109 | |
|---|
| 110 | AC_CHECK_HEADER(net/if_arp.h, |
|---|
| 111 | AC_DEFINE(HAVE_NET_IF_ARP_H,1,[has net/if_arp.h]),,[ |
|---|
| 112 | #include <sys/types.h> |
|---|
| 113 | #include <sys/socket.h> |
|---|
| 114 | #include <netinet/in.h> |
|---|
| 115 | #include <net/if.h> |
|---|
| 116 | ]) |
|---|
| 117 | |
|---|
| 118 | # Checking for the right bpf header to include |
|---|
| 119 | AC_CHECK_HEADER(pcap-bpf.h) |
|---|
| 120 | AC_CHECK_HEADER(net/bpf.h) |
|---|
| 121 | AC_CHECK_HEADER(gdc.h) |
|---|
| 122 | |
|---|
| 123 | # Check to see if we have libdl - *BSD has built-in libdl |
|---|
| 124 | AC_CHECK_LIB(dl, dlopen) |
|---|
| 125 | # check pcap |
|---|
| 126 | AC_CHECK_LIB(pcap,pcap_open_live) |
|---|
| 127 | AC_REPLACE_FUNCS(pcap_open_dead) |
|---|
| 128 | AC_REPLACE_FUNCS(pcap_dump_flush) |
|---|
| 129 | AC_REPLACE_FUNCS(pcap_next_ex) |
|---|
| 130 | AC_CHECK_FUNCS(pcap_inject pcap_sendpacket pcap_setnonblock) |
|---|
| 131 | |
|---|
| 132 | # configure time options for man pages |
|---|
| 133 | AC_ARG_WITH(man, |
|---|
| 134 | AS_HELP_STRING(--with-man,install man pages by default), |
|---|
| 135 | |
|---|
| 136 | if test "$withval" = yes |
|---|
| 137 | then |
|---|
| 138 | MANPAGES="docs/man/man3/[a-zA-Z]*.3]" |
|---|
| 139 | else |
|---|
| 140 | MANPAGES="" |
|---|
| 141 | fi |
|---|
| 142 | ) |
|---|
| 143 | |
|---|
| 144 | AC_PROG_CXX |
|---|
| 145 | |
|---|
| 146 | # configure time options for use of DAG cards |
|---|
| 147 | # borrowed from libpcap! |
|---|
| 148 | AC_ARG_WITH(dag, |
|---|
| 149 | AS_HELP_STRING(--with-dag[=DIR],include DAG support (located in directory DIR, if supplied)), |
|---|
| 150 | [ |
|---|
| 151 | if test "$withval" = no |
|---|
| 152 | then |
|---|
| 153 | want_dag=no |
|---|
| 154 | elif test "$withval" = yes |
|---|
| 155 | then |
|---|
| 156 | want_dag=yes |
|---|
| 157 | dag_root=/root/dag |
|---|
| 158 | else |
|---|
| 159 | want_dag=yes |
|---|
| 160 | dag_root=$withval |
|---|
| 161 | fi |
|---|
| 162 | ],[ |
|---|
| 163 | # |
|---|
| 164 | # Use DAG API if present, otherwise don't |
|---|
| 165 | # |
|---|
| 166 | want_dag=ifpresent |
|---|
| 167 | dag_root=/root/dag/ |
|---|
| 168 | ]) |
|---|
| 169 | |
|---|
| 170 | # turn the test part of the next block into a function, so it can be |
|---|
| 171 | # called multiple times for $dag_root, /root/dag, /usr/local/lib |
|---|
| 172 | libtrace_dag=false |
|---|
| 173 | libtrace_dag2_4=false |
|---|
| 174 | if test "$with_dag" != no; then |
|---|
| 175 | AC_MSG_CHECKING(whether we have DAG API) |
|---|
| 176 | |
|---|
| 177 | if test -r "$dag_root/lib"; then |
|---|
| 178 | dag_lib_dir="$dag_root/lib" |
|---|
| 179 | else |
|---|
| 180 | dag_lib_dir="$dag_root" |
|---|
| 181 | fi |
|---|
| 182 | |
|---|
| 183 | if test -r "$dag_root/tools" -a -r "$dag_root/include"; then |
|---|
| 184 | dag_tools_dir="$dag_root/tools" |
|---|
| 185 | dag_include_dir="$dag_root/include" |
|---|
| 186 | else |
|---|
| 187 | dag_tools_dir="$dag_root" |
|---|
| 188 | dag_include_dir="$dag_root" |
|---|
| 189 | fi |
|---|
| 190 | |
|---|
| 191 | if test -r "$dag_include_dir/dagapi.h" -a -r "$dag_lib_dir/libdag.a"; |
|---|
| 192 | then |
|---|
| 193 | ADD_INCLS="$ADD_INCLS -I $dag_include_dir" |
|---|
| 194 | ADD_LIBS="$ADD_LIBS -ldag" |
|---|
| 195 | ADD_LDFLAGS="$ADD_LDFLAGS -L$dag_lib_dir" |
|---|
| 196 | DAG_TOOLS_DIR=$dag_tools_dir |
|---|
| 197 | AC_SUBST([DAG_TOOLS_DIR]) |
|---|
| 198 | libtrace_dag=true |
|---|
| 199 | |
|---|
| 200 | AC_DEFINE(HAVE_DAG_API, 1, [define if you have a DAG API]) |
|---|
| 201 | AC_DEFINE(HAVE_DAG,1,[conditional for building with DAG support]) |
|---|
| 202 | else |
|---|
| 203 | if test "$want_dag" = yes; then |
|---|
| 204 | AC_MSG_ERROR(DAG API not found under directory $dag_root |
|---|
| 205 | ; use --without-dag) |
|---|
| 206 | fi |
|---|
| 207 | libtrace_dag=false |
|---|
| 208 | fi |
|---|
| 209 | AC_MSG_RESULT($libtrace_dag) |
|---|
| 210 | |
|---|
| 211 | AC_MSG_CHECKING(if we are using DAG 2.4) |
|---|
| 212 | if grep '2.4.' $dag_root/VERSION > /dev/null 2>&1; then |
|---|
| 213 | libtrace_dag2_4=true |
|---|
| 214 | AC_DEFINE(DAG_VERSION_2_4, 1, [define if using DAG 2.4]) |
|---|
| 215 | else |
|---|
| 216 | libtrace_dag2_4=false |
|---|
| 217 | fi |
|---|
| 218 | AC_MSG_RESULT($libtrace_dag2_4) |
|---|
| 219 | fi |
|---|
| 220 | |
|---|
| 221 | AC_CHECK_LIB(z, gzopen) |
|---|
| 222 | |
|---|
| 223 | libtrace_swig=false; |
|---|
| 224 | if test -n "$SWIG"; then |
|---|
| 225 | libtrace_swig=true; |
|---|
| 226 | fi |
|---|
| 227 | libtrace_python=false; |
|---|
| 228 | if test -n "$PYTHON"; then |
|---|
| 229 | libtrace_python=true; |
|---|
| 230 | fi |
|---|
| 231 | |
|---|
| 232 | AM_CONDITIONAL([HAVE_DAG], [test "$libtrace_dag" = true]) |
|---|
| 233 | AM_CONDITIONAL([DAG2_4], [test "$libtrace_dag2_4" = true]) |
|---|
| 234 | AM_CONDITIONAL([HAVE_ZLIB], [test "$ac_cv_lib_z_gzopen" = yes]) |
|---|
| 235 | AM_CONDITIONAL([HAVE_NETPACKET_PACKET_H], [test "$libtrace_netpacket_packet_h" = true]) |
|---|
| 236 | AM_CONDITIONAL([LIBGDC], [test "$ac_cv_header_gdc_h" = yes]) |
|---|
| 237 | AM_CONDITIONAL([LIBTRACE_SWIG], [test "$libtrace_swig" = true]) |
|---|
| 238 | #AM_CONDITIONAL([HAVE_PYTHON], [test "$libtrace_python" = true]) |
|---|
| 239 | |
|---|
| 240 | # Check for miscellaneous programs |
|---|
| 241 | AC_CHECK_PROG([libtrace_doxygen], [doxygen], [true], [false]) |
|---|
| 242 | |
|---|
| 243 | AM_CONDITIONAL(HAS_DOXYGEN, [test x"$libtrace_doxygen" = xtrue]) |
|---|
| 244 | |
|---|
| 245 | |
|---|
| 246 | AC_SUBST([ADD_LIBS]) |
|---|
| 247 | AC_SUBST([ADD_LDFLAGS]) |
|---|
| 248 | AC_SUBST([ADD_INCLS]) |
|---|
| 249 | AC_SUBST([LTLIBOBJS]) |
|---|
| 250 | AC_SUBST([MANPAGES]) |
|---|
| 251 | AC_SUBST([PACKAGE_VERSION]) |
|---|
| 252 | AC_SUBST([LIBTRACE_MAJOR]) |
|---|
| 253 | AC_SUBST([LIBTRACE_MID]) |
|---|
| 254 | AC_SUBST([LIBTRACE_MINOR]) |
|---|
| 255 | |
|---|
| 256 | dnl and finally, output our Makefiles |
|---|
| 257 | AC_OUTPUT |
|---|
| 258 | |
|---|
| 259 | reportopt() { |
|---|
| 260 | if test x"$2" = xtrue -o x"$2" = xyes; then |
|---|
| 261 | AC_MSG_NOTICE([$1: Yes]) |
|---|
| 262 | else |
|---|
| 263 | AC_MSG_NOTICE([$1: No]) |
|---|
| 264 | fi |
|---|
| 265 | } |
|---|
| 266 | |
|---|
| 267 | echo |
|---|
| 268 | AC_MSG_NOTICE([Libtrace version $PACKAGE_VERSION]) |
|---|
| 269 | reportopt "Compiled with PCAP support" $ac_cv_lib_pcap_pcap_open_live |
|---|
| 270 | reportopt "Compiled with compressed trace (zlib) support" $ac_cv_lib_z_gzopen |
|---|
| 271 | if test x"$libtrace_dag" = xtrue; then |
|---|
| 272 | if test x"$libtrace_dag2_4"; then |
|---|
| 273 | AC_MSG_NOTICE([Compiled with DAG support: 2.4]) |
|---|
| 274 | else |
|---|
| 275 | AC_MSG_NOTICE([Compiled with DAG support: 2.5]) |
|---|
| 276 | fi |
|---|
| 277 | else |
|---|
| 278 | AC_MSG_NOTICE([Compiled with DAG support: No]) |
|---|
| 279 | fi |
|---|
| 280 | reportopt "Building man pages/documentation" $libtrace_doxygen |
|---|
| 281 | |
|---|
| 282 | if test x"$libtrace_swig" = xtrue; then |
|---|
| 283 | if test x"$libtrace_python" = xtrue; then |
|---|
| 284 | AC_MSG_NOTICE([Building swig bindings for: python]) |
|---|
| 285 | else |
|---|
| 286 | AC_MSG_NOTICE([Building swig bindings for: Nothing]) |
|---|
| 287 | fi |
|---|
| 288 | else |
|---|
| 289 | AC_MSG_NOTICE([Not building swig bindings]) |
|---|
| 290 | fi |
|---|