dnl Copyright (C) 2004-2007 by Carnegie Mellon University. dnl dnl @OPENSOURCE_HEADER_START@ dnl dnl Use of the SILK system and related source code is subject to the terms dnl of the following licenses: dnl dnl GNU Public License (GPL) Rights pursuant to Version 2, June 1991 dnl Government Purpose License Rights (GPLR) pursuant to DFARS 252.225-7013 dnl dnl NO WARRANTY dnl dnl ANY INFORMATION, MATERIALS, SERVICES, INTELLECTUAL PROPERTY OR OTHER dnl PROPERTY OR RIGHTS GRANTED OR PROVIDED BY CARNEGIE MELLON UNIVERSITY dnl PURSUANT TO THIS LICENSE (HEREINAFTER THE "DELIVERABLES") ARE ON AN dnl "AS-IS" BASIS. CARNEGIE MELLON UNIVERSITY MAKES NO WARRANTIES OF ANY dnl KIND, EITHER EXPRESS OR IMPLIED AS TO ANY MATTER INCLUDING, BUT NOT dnl LIMITED TO, WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE, dnl MERCHANTABILITY, INFORMATIONAL CONTENT, NONINFRINGEMENT, OR ERROR-FREE dnl OPERATION. CARNEGIE MELLON UNIVERSITY SHALL NOT BE LIABLE FOR INDIRECT, dnl SPECIAL OR CONSEQUENTIAL DAMAGES, SUCH AS LOSS OF PROFITS OR INABILITY dnl TO USE SAID INTELLECTUAL PROPERTY, UNDER THIS LICENSE, REGARDLESS OF dnl WHETHER SUCH PARTY WAS AWARE OF THE POSSIBILITY OF SUCH DAMAGES. dnl LICENSEE AGREES THAT IT WILL NOT MAKE ANY WARRANTY ON BEHALF OF dnl CARNEGIE MELLON UNIVERSITY, EXPRESS OR IMPLIED, TO ANY PERSON dnl CONCERNING THE APPLICATION OF OR THE RESULTS TO BE OBTAINED WITH THE dnl DELIVERABLES UNDER THIS LICENSE. dnl dnl Licensee hereby agrees to defend, indemnify, and hold harmless Carnegie dnl Mellon University, its trustees, officers, employees, and agents from dnl all claims or demands made against them (and any related losses, dnl expenses, or attorney's fees) arising out of, or relating to Licensee's dnl and/or its sub licensees' negligent use or willful misuse of or dnl negligent conduct or willful misconduct regarding the Software, dnl facilities, or other rights or assistance granted by Carnegie Mellon dnl University under this License, including, but not limited to, any dnl claims of product liability, personal injury, death, damage to dnl property, or violation of any laws or regulations. dnl dnl Carnegie Mellon University Software Engineering Institute authored dnl documents are sponsored by the U.S. Department of Defense under dnl Contract F19628-00-C-0003. Carnegie Mellon University retains dnl copyrights in all material produced under this contract. The U.S. dnl Government retains a non-exclusive, royalty-free license to publish or dnl reproduce these documents, or allow others to do so, for U.S. dnl Government purposes only pursuant to the copyright license under the dnl contract clause at 252.227.7013. dnl dnl @OPENSOURCE_HEADER_END@ dnl RCSIDENT("$SiLK: acinclude.m4 8598 2007-08-22 15:00:30Z mthomas $") # --------------------------------------------------------------------------- # SILK_AC_CHECK_VARIOUS_DECLS # # Check for a bunch of random declarations # AC_DEFUN([SILK_AC_CHECK_VARIOUS_DECLS],[ # The following big block is use to test for these r-values: # EPROTO in # GLOB_ABORTED in # GLOB_NOMATCH in # INADDR_NONE in or # INT*_MAX in or or # UINT*_MAX in or or # ULLONG_MAX in or or # PRIu32, PRIu64 in or or # AC_CHECK_DECLS([EPROTO, GLOB_ABORTED, GLOB_NOMATCH, INADDR_NONE, INT8_MAX, UINT8_MAX, INT16_MAX, UINT16_MAX, INT32_MAX, UINT32_MAX, INT64_MAX, UINT64_MAX, ULLONG_MAX, PRIu32, PRIu64], , ,[ #include #if HAVE_SYS_TYPES_H # include #endif #if HAVE_SYS_STAT_H # include #endif #if STDC_HEADERS # include # include #else # if HAVE_STDLIB_H # include # endif #endif #if HAVE_STRING_H # if !STDC_HEADERS && HAVE_MEMORY_H # include # endif # include #endif #if HAVE_STRINGS_H # include #endif #if HAVE_INTTYPES_H # include #else # if HAVE_STDINT_H # include # endif #endif #if HAVE_UNISTD_H # include #endif #if HAVE_ERRNO_H # include #endif #if HAVE_GLOB_H # include #endif #if HAVE_LIMITS_H # include #endif #if HAVE_NETINET_IN_H # include #endif ]) ])#SILK_AC_CHECK_VARIOUS_DECLS # --------------------------------------------------------------------------- # SILK_AC_COMPILER # # Set the compiler and compilation flags # AC_DEFUN([SILK_AC_COMPILER],[ AC_PROG_CC AC_PROG_CPP AC_SUBST(AM_CPPFLAGS) AC_SUBST(AM_CFLAGS) AC_SUBST(AM_LDFLAGS) AM_CPPFLAGS="$AM_CPPFLAGS -I"'$(top_srcdir)'"/src/include -DNDEBUG" # Add platform specific linking flags case $build_os in # The following allows 2GB address space. aix*) AM_LDFLAGS="$AM_LDFLAGS -Wl,-bmaxdata:0x80000000" ;; esac # Make compiler adjustments SILK_AC_OPT_DISABLE_OPTIMIZATION SILK_AC_OPT_ENABLE_DEBUGGING # Add additional compiler flags to AM_CFLAGS SILK_AC_COMP_ADDITIONAL_FLAGS([AM_CFLAGS],[-Wall -W -Wmissing-prototypes -fno-strict-aliasing]) SILK_AC_OPT_ENABLE_ASSERT SILK_AC_OPT_ENABLE_GCOV SILK_AC_OPT_ENABLE_GPROF # Additional characteristics AC_C_CONST AC_C_INLINE AC_C_VOLATILE SILK_AC_COMP_ATTRIBUTE_USED ])#SILK_AC_COMPILER # --------------------------------------------------------------------------- # SILK_AC_COMP_ADDITIONAL_FLAGS(var, flag_list) # # For each flag listed in FLAG_LIST, add it to the specified VAR if # the compiler understands it. # AC_DEFUN([SILK_AC_COMP_ADDITIONAL_FLAGS],[ AC_LANG_CONFTEST([[ int main(int argc, char **argv) { int x = 0; if (argv[argc-1]) { ++x; } return 0; } ]]) for sk_cc_flag in $2 do AC_MSG_CHECKING([whether ${CC-cc} understands $sk_cc_flag]) sk_cc_cmd="${CC-cc} $sk_cc_flag -c conftest.c" sk_cc_out="`$sk_cc_cmd 2>&1`" if test "X$sk_cc_out" = X then $1="$$1 $sk_cc_flag" AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) echo "$as_me:$LINENO: failed command was" >&5 echo "$as_me:$LINENO: $sk_cc_cmd" >&5 echo "$as_me:$LINENO: $sk_cc_out" >&5 fi done ])#SILK_AC_COMP_ADDITIONAL_FLAGS # --------------------------------------------------------------------------- # SILK_AC_COMP_ATTRIBUTE_USED # # Check whether the compile understands the __attribute__((__used__)) # AC_DEFUN([SILK_AC_COMP_ATTRIBUTE_USED], [AC_MSG_CHECKING([whether the compiler understands __attribute__((__used__))]) # Don't use AC_LANG_WERROR since it applies to *ALL* configure # tests and there is no way to disable it once enabled, nor a way # to enable it only for this test. sk_save_CFLAGS="$CFLAGS" CFLAGS="-Werror $CFLAGS" AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([],[ static char *x __attribute__((__used__)) = "used"; ]) ],[ AC_DEFINE(HAVE_COMP_ATTRIBUTE_USED, 1, [Define to 1 if your compiler understands __attribute__((__used__)).]) AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])]) CFLAGS="$sk_save_CFLAGS" ])# SILK_AC_COMP_ATTRIBUTE_USED # --------------------------------------------------------------------------- # SILK_AC_COMP_INCLUDE_TO_CFLAG # # Some defines really need to be set before any header files are # read, but this creates a problem for C files generated by YACC # and LEX. # # So, for defines that the system headers use, grep their values # out of the confdefs.h file and add them to CPPFLAGS. # AC_DEFUN([SILK_AC_COMP_INCLUDE_TO_CFLAG],[ for sk_defined in _ALL_SOURCE _GNU_SOURCE _FILE_OFFSET_BITS _LARGEFILE_SOURCE _LARGE_FILES SK_NEED_REENTRANT,_REENTRANT do sk_def_test=`echo $sk_defined | sed -e 's/,.*$//'` sk_def_flag=`echo $sk_defined | sed -e 's/^.*,//'` val=`awk '/^# *define[ \t]+'$sk_def_test'[ \t]/ { print $NF }' confdefs.h` if test "X$val" != X then AM_CPPFLAGS="$AM_CPPFLAGS -D$sk_def_flag=$val" fi done ])# SILK_AC_COMP_EXTRA_CFLAGS # --------------------------------------------------------------------------- # SILK_AC_HEADER_DEFINES_SYMBOL(hdr, sym, var) # # Check for symbol SYM in header HDR, defining VAR if it exists # # NOTE: It is probably better to use AC_CHECK_DECLS() for this # AC_DEFUN([SILK_AC_HEADER_DEFINES_SYMBOL],[ sk_acfg_hdr="$1" sk_acfg_sym="$2" sk_acfg_var="$3" AC_MSG_CHECKING([whether <$sk_acfg_hdr> defines $sk_acfg_sym]) AC_COMPILE_IFELSE([ AC_LANG_PROGRAM([#include <$sk_acfg_hdr>], [return $sk_acfg_sym ;])],[ AC_DEFINE_UNQUOTED(${sk_acfg_var},[1], [Define to 1 if <${sk_acfg_hdr}> defines ${sk_acfg_sym}]) AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])]) ])# SILK_AC_HEADER_DEFINES_SYMBOL # --------------------------------------------------------------------------- # SILK_AC_HEADER_DEFINES_VARIABLE(hdr, varname, type, var) # # Check for variable VARNAME as reducable to type TYPE in header # HDR, defining VAR if it exists # AC_DEFUN([SILK_AC_HEADER_DEFINES_VARIABLE],[ sk_acfg_hdr="$1" sk_acfg_varname="$2" sk_acfg_type="$3" sk_acfg_var="$4" AC_MSG_CHECKING([whether <$sk_acfg_hdr> defines $sk_acfg_varname as $sk_acfg_type]) AC_RUN_IFELSE([ AC_LANG_PROGRAM([#include <$sk_acfg_hdr>],[ $sk_acfg_type somevar = $sk_acfg_varname; return (sizeof($sk_acfg_type) != sizeof($sk_acfg_varname));])],[ AC_DEFINE_UNQUOTED(${sk_acfg_var},[1], [Define to 1 if <${sk_acfg_hdr}> defines ${sk_acfg_sym} as ${sk_acfg_type}]) AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])], [AC_MSG_RESULT([no])]) ])# SILK_AC_HEADER_DEFINES_VARIABLE # --------------------------------------------------------------------------- # SILK_AC_FIND_SOURCE_MAKEFILES # # Find all the subdirectories to build. # # Output variables: SK_LIBRARY_MAKEFILES, SK_ANALYSIS_MAKEFILES, # SK_PACKING_MAKEFILES, SK_EXTRA_MAKEFILES # AC_DEFUN([SILK_AC_FIND_SOURCE_MAKEFILES],[ AC_SUBST(SRC_SUBDIRS) AC_SUBST(SRC_DIST_SUBDIRS) # The list of subdirectories is anything that we added to # AC_CONFIG_FILES() that looks like src/DIR/Makefile SRC_SUBDIRS="" # Common libraries silk_ac_config_files="$ac_config_files" ac_config_files= AC_CONFIG_FILES([ src/libsilk/Makefile src/libredblack/Makefile src/libsksetbag/Makefile ]) for skdir in $ac_config_files do case "$skdir" in src/*/Makefile) skdir=`echo $skdir | sed 's,^src/\(.*\)/Makefile$,\1,'` SRC_SUBDIRS="$SRC_SUBDIRS $skdir" ;; esac done silk_ac_config_files="$silk_ac_config_files $ac_config_files" # Things needed for rwfilter (libraries and plugins) ac_config_files= AC_CONFIG_FILES([ src/rwfilter/Makefile src/libaddrtype/Makefile src/libccfilter/Makefile src/libpmapfilter/Makefile src/plugins/Makefile ]) if test "0$silk_enable_analysis_tools" -eq 1 || test "x$silk_enable_mpi_cluster" = "xyes" then for skdir in $ac_config_files do case "$skdir" in src/*/Makefile) skdir=`echo $skdir | sed 's,^src/\(.*\)/Makefile$,\1,'` SRC_SUBDIRS="$SRC_SUBDIRS $skdir" ;; esac done fi silk_ac_config_files="$silk_ac_config_files $ac_config_files" # Additional analysis tools and support libraries ac_config_files= AC_CONFIG_FILES([ src/libhash/Makefile src/libheap/Makefile src/mapsid/Makefile src/num2dot/Makefile src/rwaddrcount/Makefile src/rwappend/Makefile src/rwbag/Makefile src/rwcat/Makefile src/rwconvert/Makefile src/rwcount/Makefile src/rwcut/Makefile src/rwfileinfo/Makefile src/rwgroup/Makefile src/rwipa/Makefile src/rwmatch/Makefile src/rwnetmask/Makefile src/rwpmatch/Makefile src/rwrandomizeip/Makefile src/rwresolve/Makefile src/rwscan/Makefile src/rwset/Makefile src/rwsort/Makefile src/rwsplit/Makefile src/rwstats/Makefile src/rwswapbytes/Makefile src/rwtotal/Makefile src/rwtuc/Makefile src/rwuniq/Makefile ]) if test "0$silk_enable_analysis_tools" -eq 1 then for skdir in $ac_config_files do case "$skdir" in src/*/Makefile) skdir=`echo $skdir | sed 's,^src/\(.*\)/Makefile$,\1,'` SRC_SUBDIRS="$SRC_SUBDIRS $skdir" ;; esac done fi silk_ac_config_files="$silk_ac_config_files $ac_config_files" ac_config_files= AC_CONFIG_FILES([src/libskipfix/Makefile]) if test "0$sk_fixbuf_found" -gt 0 then for skdir in $ac_config_files do case "$skdir" in src/*/Makefile) skdir=`echo $skdir | sed 's,^src/\(.*\)/Makefile$,\1,'` SRC_SUBDIRS="$SRC_SUBDIRS $skdir" ;; esac done fi silk_ac_config_files="$silk_ac_config_files $ac_config_files" # Packing tools ac_config_files= AC_CONFIG_FILES([ src/libflowsource/Makefile src/libflowsource/probeconfsite.c src/libskdeque/Makefile src/libskpolldir/Makefile src/libskmsg/Makefile src/libsktransfer/Makefile src/rwflowpack/Makefile src/rwflowpack/rwflowpack.conf src/rwflowpack/rwflowpack.init.d src/sendrcv/Makefile src/sendrcv/rwflowappend.conf src/sendrcv/rwflowappend.init.d src/sendrcv/rwreceiver.conf src/sendrcv/rwreceiver.init.d src/sendrcv/rwsender.conf src/sendrcv/rwsender.init.d ]) if test "0$silk_enable_packing_tools" -eq 1 then for skdir in $ac_config_files do case "$skdir" in src/*/Makefile) skdir=`echo $skdir | sed 's,^src/\(.*\)/Makefile$,\1,'` SRC_SUBDIRS="$SRC_SUBDIRS $skdir" ;; esac done fi silk_ac_config_files="$silk_ac_config_files $ac_config_files" ac_config_files= AC_CONFIG_FILES([ src/flowcap/Makefile src/flowcap/flowcap.conf src/flowcap/flowcap.init.d ]) if test "0$silk_enable_packing_tools" -eq 1 && test "0$sk_lzo_found" -gt 0 then for skdir in $ac_config_files do case "$skdir" in src/*/Makefile) skdir=`echo $skdir | sed 's,^src/\(.*\)/Makefile$,\1,'` SRC_SUBDIRS="$SRC_SUBDIRS $skdir" ;; esac done fi silk_ac_config_files="$silk_ac_config_files $ac_config_files" # Done with contional addition; reset ac_config_files ac_config_files="$silk_ac_config_files" # The list of subdirectories to distribute is anything that we # added to AC_CONFIG_FILES() that looks like src/DIR/Makefile SRC_DIST_SUBDIRS="" for skdir in $ac_config_files do case "$skdir" in src/*/Makefile) skdir=`echo $skdir | sed 's,^src/\(.*\)/Makefile$,\1,'` SRC_DIST_SUBDIRS="$SRC_DIST_SUBDIRS $skdir" ;; esac done ])# SILK_AC_FIND_SOURCE_MAKEFILES # --------------------------------------------------------------------------- # SILK_AC_INIT - initialize SiLK autoconf magic # # All configure.in files should start with an invocation of # SILK_AC_INIT # AC_DEFUN([SILK_AC_INIT],[ SPLINT_FLAGS="+posixlib +unixlib -weak" PACKAGE=silk PACKAGENAME=silk SILK_SITE_DEFAULT=twoway SILK_SITE_DIR_DEFAULT=/site SILK_DATA_ROOTDIR_DEFAULT=/data SILK_FINAL_MSG="Done." # Stash the current CFLAGS value silk_init_cflags="$CFLAGS" # Groups of Makefile.in's to create silk_enable_analysis_tools=1 silk_enable_packing_tools=1 # things turned on by --enable silk_enable_localtime=default_no silk_enable_initial_tcpflags=default_no silk_enable_legacy_timestamp=default_no # add $(prefix)/lib/pkgconfig to PKG_CONFIG_PATH. We should # really use $(libdir)/pkgconfig, but trying to get that value is # difficult. silk_extra_pkg_config="$prefix/lib/pkgconfig" if test "x$PKG_CONFIG_PATH" = "x" then PKG_CONFIG_PATH="$silk_extra_pkg_config" else PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$silk_extra_pkg_config" fi export PKG_CONFIG_PATH ])# SILK_AC_INIT # --------------------------------------------------------------------------- # SILK_AC_PTHREAD_LDFLAGS # # Determine how to use pthreads. Output variables: PTHREAD_LDFLAGS # AC_DEFUN([SILK_AC_PTHREAD_LDFLAGS],[ AC_SUBST(PTHREAD_LDFLAGS) # libexc is required for OSF/1 or TruUNIX or Tru64 or whatever # DEC/Compaq/HP is calling it now AC_CHECK_LIB([exc], [exc_resume], [PTHREAD_LDFLAGS="-lexc $PTHREAD_LDFLAGS"]) AC_CHECK_LIB([pthread], [pthread_key_delete], [PTHREAD_LDFLAGS="-lpthread $PTHREAD_LDFLAGS"], ,[$PTHREAD_LDFLAGS]) if test "X" = "X$PTHREAD_LDFLAGS" then # FreeBSD just needs -pthread on link line AC_MSG_CHECKING([whether -pthread is required for pthread support]) sk_save_LIBS="$LIBS" LIBS="$LIBS -pthread" AC_LINK_IFELSE([ AC_LANG_PROGRAM([ #if HAVE_PTHREAD_H #include #endif ],[ pthread_key_t x; pthread_key_delete(x)])],[ PTHREAD_LDFLAGS="-pthread" AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])]) LIBS="$sk_save_LIBS" fi ])# SILK_AC_PTHREAD_LDFLAGS # --------------------------------------------------------------------------- # SILK_AC_NEED_REENTRANT # # Check whether -D_REENTRANT is required for certain functions # (Solaris) # # Output definitions: SK_NEED_REENTRANT # AC_DEFUN([SILK_AC_NEED_REENTRANT],[ AC_CHECK_DECL(gmtime_r, ,[ AC_MSG_CHECKING([whether gmtime_r is declared with -D_REENTRANT]) AC_COMPILE_IFELSE([ AC_LANG_PROGRAM([ #define _REENTRANT 1 #include #if HAVE_SYS_TYPES_H # include #endif #if TIME_WITH_SYS_TIME # include # include #else # if HAVE_SYS_TIME_H # include # else # include # endif #endif ],[ #ifndef gmtime_r char *p = (char *) gmtime_r; #endif ])],[ AC_DEFINE(SK_NEED_REENTRANT, 1, [Define to 1 if your system requires _REENTRANT to be defined for multi-threaded programs]) AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])]) ],[ #include #if HAVE_SYS_TYPES_H # include #endif #if TIME_WITH_SYS_TIME # include # include #else # if HAVE_SYS_TIME_H # include # else # include # endif #endif ]) ])#SILK_AC_NEED_REENTRANT # --------------------------------------------------------------------------- # SILK_AC_OPT_DATA_ROOTDIR # # Let the user specify the base directory where the packed data # should be stored and from where it will be read. # # Output variable: SILK_DATA_ROOTDIR # AC_DEFUN([SILK_AC_OPT_DATA_ROOTDIR],[ AC_ARG_ENABLE([data-rootdir], [AS_HELP_STRING([--enable-data-rootdir=DIR], [location of packed data files [/data]])[]dnl ],[[ if test "x$enableval" != "xyes" then SILK_DATA_ROOTDIR="$enableval" fi ]]) if test "x${SILK_DATA_ROOTDIR}" = "x" then SILK_DATA_ROOTDIR="${SILK_DATA_ROOTDIR_DEFAULT}" fi AC_SUBST(SILK_DATA_ROOTDIR) AC_DEFINE_UNQUOTED(SILK_DATA_ROOTDIR,"$SILK_DATA_ROOTDIR", [Path to root directory of packed data files]) ])# SILK_AC_OPT_DATA_ROOTDIR # --------------------------------------------------------------------------- # SILK_AC_OPT_DISABLE_ANALYSIS_TOOLS # # Do not build the analysis tools # AC_DEFUN([SILK_AC_OPT_DISABLE_ANALYSIS_TOOLS],[ AC_ARG_ENABLE([analysis-tools], [AS_HELP_STRING([--disable-analysis-tools], [do not descend into the analysis tools directories when building the software])[]dnl ],[[ if test "x$enableval" = "xno" then silk_enable_analysis_tools=0 fi]]) ]) # SILK_AC_OPT_DISABLE_ANALYSIS_TOOLS # --------------------------------------------------------------------------- # SILK_AC_OPT_DISABLE_OPTIMIZATION # # Remove optimization from the CFLAGS; if -O2 was added by # AC_PROG_CC # AC_DEFUN([SILK_AC_OPT_DISABLE_OPTIMIZATION],[ # See if compiler understands -03 sk_cc_o3="" SILK_AC_COMP_ADDITIONAL_FLAGS(sk_cc_o3, [-O3]) AC_ARG_ENABLE([optimization], [AS_HELP_STRING([--disable-optimization], [disable optimization (default is to build SiLK with -O3); use --enable-optimization=VAL to set optimization to VAL])[]dnl ],[[ if test "x$enableval" = "xno" then # User said "--disable-optimization". Unconditionally # remove -O[0-9] from the CFLAGS. CFLAGS=`echo " $CFLAGS " | sed 's/ -O[0-9] / /g'` elif test "x$enableval" != "xyes" then # User passed in their own optimation flags on this switch CFLAGS=`echo " $CFLAGS " | sed 's/ -O[0-9] / /g'` CFLAGS="$CFLAGS $enableval" fi ]],[[ # User didn't specify the switch; if the user didn't specify # any CFLAGS to configure (i.e., "$silk_init_cflags" is empty) # remove any optimization added by AC_PROG_CC and add -O3 now # if the compiler understands it. if test "x$silk_init_flags" = "x" && test "xsk_cc_o3" != "x" then CFLAGS=`echo " $CFLAGS " | sed 's/ -O[0-9] / /g'` CFLAGS="$CFLAGS $sk_cc_o3" fi]]) ])# SILK_AC_OPT_DISABLE_OPTIMIZATION # --------------------------------------------------------------------------- # SILK_AC_OPT_DISABLE_PACKING_TOOLS # # Do not build the packing tools # AC_DEFUN([SILK_AC_OPT_DISABLE_PACKING_TOOLS],[ AC_ARG_ENABLE([packing-tools], [AS_HELP_STRING([--disable-packing-tools], [do not descend into the packing tools directories when buiding the software])[]dnl ],[[ if test "x$enableval" = "xno" then silk_enable_packing_tools=0 fi]]) ]) # SILK_AC_OPT_DISABLE_PACKING_TOOLS # --------------------------------------------------------------------------- # SILK_AC_OPT_DISABLE_SPLIT_WEB # # Do not pack the web flows separately # AC_DEFUN([SILK_AC_OPT_DISABLE_SPLIT_WEB],[ AC_ARG_ENABLE([web-split], [AS_HELP_STRING([--disable-web-split], [in the packer, do not pack the web flows separately from other flows])[]dnl ],[[ if test "x$enableval" = "xno" then silk_enable_web_split=0 fi]]) ]) # SILK_AC_OPT_DISABLE_SPLIT_WEB # --------------------------------------------------------------------------- # SILK_AC_OPT_ENABLE_ASSERT # # Remove -DNDEBUG from the AM_CPPFLAGS to enable assert()'s # AC_DEFUN([SILK_AC_OPT_ENABLE_ASSERT],[ AC_ARG_ENABLE([assert], [AS_HELP_STRING([--enable-assert], [enable run-time checks with assert()])[]dnl ],[[ if test "x$enableval" = "xyes" then AM_CPPFLAGS=`echo " $AM_CPPFLAGS " | sed 's/ -DNDEBUG / /'` fi]]) ])# SILK_AC_OPT_ENABLE_ASSERT # --------------------------------------------------------------------------- # SILK_AC_OPT_ENABLE_DEBUGGING # # Add the -g switch to CFLAGS if and only if the switch is # provided; i.e., remove -g if the switch is not provided. # AC_DEFUN([SILK_AC_OPT_ENABLE_DEBUGGING],[ # Remove -g from CFLAGS unless it was specified in the CFLAGS # value the passed to configure sk_have_g=`echo " $silk_init_cflags " | grep '. -g '` if test -z "$sk_have_g" then # Remove it CFLAGS=`echo " $CFLAGS " | sed 's/ -g / /g'` fi AC_ARG_ENABLE([debugging], [AS_HELP_STRING([--enable-debugging], [add compiler flags to build with debugging symbols])[]dnl ],[[ if test "x$enableval" != "xno" then # Add the switch CFLAGS="$CFLAGS -g" fi]]) ])# SILK_AC_OPT_ENABLE_DEBUGGING # --------------------------------------------------------------------------- # SILK_AC_OPT_ENABLE_SPLIT_ICMP # # Do not pack the web flows separately # AC_DEFUN([SILK_AC_OPT_ENABLE_SPLIT_ICMP],[ AC_ARG_ENABLE([icmp-split], [AS_HELP_STRING([--enable-icmp-split], [in the packer, pack ICMP flow records separately from other flows])[]dnl ],[[ if test "x$enableval" != "xno" then silk_enable_icmp_split=1 fi]]) ]) # SILK_AC_OPT_ENABLE_SPLIT_ICMP # --------------------------------------------------------------------------- # SILK_AC_OPT_ENABLE_OUTPUT_COMPRESSION # # Set the default compression method to use for binary output files. # # Output variables: SK_ENABLE_OUTPUT_COMPRESSION # AC_DEFUN([SILK_AC_OPT_ENABLE_OUTPUT_COMPRESSION],[ # The default compression method sk_output_comp=none # Come up with a default value if the user gives the switch but no # argument to the switch sk_output_comp_yes_default=none if test "0$sk_zlib_found" -gt 0 then sk_output_comp_yes_default=zlib fi if test "0$sk_lzo_found" -gt 0 then sk_output_comp_yes_default=lzo1x fi AC_ARG_ENABLE([output-compression], [AS_HELP_STRING([--enable-output-compression], [enable or set the default compression method for binary SiLK output files. Choices (subject to library availability): none, zlib, lzo1x. [none]])[]dnl ],[[sk_output_comp="$enableval"]]) case "$sk_output_comp" in yes) sk_output_comp="$sk_output_comp_yes_default" ;; no|none) sk_output_comp=none ;; zlib) if test "0$sk_zlib_found" -lt 1 then AC_ERROR([output-compression=$sk_output_comp is not available because zlib was not found]) fi ;; lzo1x) if test "0$sk_lzo_found" -lt 1 then AC_ERROR([output-compression=$sk_output_comp is not available because LZO was not found]) fi ;; *) AC_ERROR([output-compression=$sk_output_comp is not valid]) ;; esac # Be certain to keep this list up-to-date with the C code in # silk_files.h and sksite.[ch] silk_enable_output_comp='SK_COMPMETHOD_'`echo $sk_output_comp | tr '[[a-z]]' '[[A-Z]]'` AC_MSG_NOTICE([(${PACKAGE}) Default output compression is $sk_output_comp]) AC_DEFINE_UNQUOTED([SK_ENABLE_OUTPUT_COMPRESSION], $silk_enable_output_comp, [Define to the compression method to use by default for binary SiLK output files (see silk_files.h for valid methods).]) ])# SILK_AC_OPT_ENABLE_DEBUGGING # --------------------------------------------------------------------------- # SILK_AC_OPT_ENABLE_GCOV # # Add the -fprofile-arcs -ftest-coverage switches to AM_CFLAGS # and disable optimization # AC_DEFUN([SILK_AC_OPT_ENABLE_GCOV],[ AC_ARG_ENABLE([gcov], [AS_HELP_STRING([--enable-gcov], [add compiler flags to support gcov testing])[]dnl ],[[ if test "x$enableval" != "xno" then CFLAGS=`echo " $CFLAGS " | sed 's/ -O[0-9] / /g'` AM_CFLAGS="$AM_CFLAGS -fprofile-arcs -ftest-coverage" fi ]]) ])# SILK_AC_OPT_ENABLE_GCOV # --------------------------------------------------------------------------- # SILK_AC_OPT_ENABLE_GPROF # # Add the -pg switch to AM_CFLAGS and enable debugging symbols # AC_DEFUN([SILK_AC_OPT_ENABLE_GPROF],[ AC_ARG_ENABLE([gprof], [AS_HELP_STRING([--enable-gprof], [add compiler flags to support gprof profiling])[]dnl ],[[ if test "x$enableval" != "xno" then CFLAGS="$CFLAGS -g" AM_CFLAGS="$AM_CFLAGS -pg" fi ]]) ])# SILK_AC_OPT_ENABLE_GPROF # --------------------------------------------------------------------------- # SILK_AC_OPT_ENABLE_INITIAL_TCPFLAGS # # Enable extra fields that we get from special flow-collection # software # # Output variable: SK_ENABLE_INITIAL_TCPFLAGS # AC_DEFUN([SILK_AC_OPT_ENABLE_INITIAL_TCPFLAGS],[ if test 0"$sk_fixbuf_found" -gt 0 then silk_enable_initial_tcpflags=yes sk_initial_flags_reason="(libfixbuf found)" fi AC_ARG_ENABLE([initial-tcpflags], [AS_HELP_STRING([--enable-initial-tcpflags], [enable the flags-initial switch in rwfilter and initialFlags field in rwcut; requires special flow-collection software--will be enabled if that software is found])[]dnl ],[[ if test "x$enableval" = "xyes" then silk_enable_initial_tcpflags=yes elif test "x$enableval" = "xno" then silk_enable_initial_tcpflags=no fi]]) ])# SILK_AC_OPT_ENABLE_INITIAL_TCPFLAGS # --------------------------------------------------------------------------- # SILK_AC_OPT_ENABLE_LEGACY_TIMESTAMP # # Default to using the old timestamp format instead of the new # format. # # Old format: "MM/DD/YYYY hh:mm:ss" # New format: "YYYY/MM/DD:hh:mm:ss[.sss]" # AC_DEFUN([SILK_AC_OPT_ENABLE_LEGACY_TIMESTAMP],[ AC_ARG_ENABLE([legacy-timestamp], [AS_HELP_STRING([--enable-legacy-timestamp], [default to using the old timestamp format of "MM/DD/YYYY hh:mm:ss". Default is "YYYY/MM/DDThh:mm:ss".])[]dnl ],[[ if test "x$enableval" = "xyes" then silk_enable_legacy_timestamp=yes elif test "x$enableval" = "xno" then silk_enable_legacy_timestamp=no fi]]) ])# SILK_AC_OPT_ENABLE_LEGACY_TIMESTAMP # --------------------------------------------------------------------------- # SILK_AC_OPT_ENABLE_LOCALTIME # # Use the local timezone for command inputs and printing records # AC_DEFUN([SILK_AC_OPT_ENABLE_LOCALTIME],[ AC_ARG_ENABLE([localtime], [AS_HELP_STRING([--enable-localtime], [use the local timezone for command inputs and for printing records. Default is to use UTC. (Files continue to be stored by UTC time).])[]dnl ],[[ if test "x$enableval" = "xyes" then silk_enable_localtime=yes elif test "x$enableval" = "xno" then silk_enable_localtime=no fi]]) ])# SILK_AC_OPT_ENABLE_LOCALTIME # --------------------------------------------------------------------------- # SILK_AC_OPT_SILK_SITE # # Choose a specific site file. # # Output variables: SILK_SITE, SILK_SITE_HEADER_PATH, # SILK_SITE_PROBECONF_PATH # AC_DEFUN([SILK_AC_OPT_SILK_SITE],[ AC_MSG_NOTICE([(${PACKAGE}) Verifying presence of site files]) AC_ARG_ENABLE([silk-site], AS_HELP_STRING([--enable-silk-site=SITENAME], [configure the software for the SITENAME site [[twoway]]; requires silk_site_SITENAME.h and probeconf-SITENAME.c to exist either in "$srcdir/site/SITENAME/" or the in the directory named by --enable-silk-site-dir]), [ if test "x$enableval" != "xyes" then SILK_SITE="$enableval" fi ]) SILK_SITE_DIR= AC_ARG_ENABLE([silk-site-dir], AS_HELP_STRING([--enable-silk-site-dir=PATH], [configure the software to find silk_site_SITENAME.h and probeconf-SITENAME.c in the directory PATH. See --enable-silk-site [[$srcdir/site/SITENAME]]]), [ if test "x$enableval" != "xyes" then SILK_SITE_DIR="$enableval" fi ]) if test "x$SILK_SITE" = "x" then SILK_SITE="$SILK_SITE_DEFAULT" fi if test "x$SILK_SITE_DIR" = "x" then SILK_SITE_DIR='$(top_srcdir)'"$SILK_SITE_DIR_DEFAULT/$SILK_SITE" sk_site_dir="$srcdir$SILK_SITE_DIR_DEFAULT/$SILK_SITE" else sk_site_dir="$SILK_SITE_DIR" fi SILK_SITE_HEADER_NAME="silk_site_$SILK_SITE.h" sk_site_header="$sk_site_dir/$SILK_SITE_HEADER_NAME" sk_site_probeconf="$sk_site_dir/probeconf-$SILK_SITE.c" # Now see if we can find the files AC_CHECK_FILE($sk_site_header, , AC_ERROR([Cannot find site specific header $sk_site_header])) AC_CHECK_FILE($sk_site_probeconf, , AC_ERROR([Cannot find site probe rules $sk_site_probeconf])) AC_DEFINE_UNQUOTED([SILK_SITE],"$SILK_SITE", [Define to the name of the site for which the package was configured.]) AC_DEFINE_UNQUOTED([SILK_SITE_HEADER_NAME],"$SILK_SITE_HEADER_NAME", [Define to the name of the site-specific header]) AC_SUBST(SILK_SITE) AC_SUBST(SILK_SITE_DIR) AC_SUBST(SILK_SITE_HEADER_NAME) AM_CPPFLAGS="$AM_CPPFLAGS -I$SILK_SITE_DIR" AC_MSG_NOTICE([(${PACKAGE}) Configured for the $SILK_SITE site]) dnl # Now see if cpp finds the header. dnl sk_save_CPPFLAGS="$CPPFLAGS" dnl CPPFLAGS="-I. -I$srcdir/src/include -D_SILK_SITE_H $CPPFLAGS" dnl AC_MSG_CHECKING([for the silk_site_$SILK_SITE.h header]) dnl AC_PREPROC_IFELSE( dnl [AC_LANG_PROGRAM([#include "silk_site_$SILK_SITE.h" dnl ],[])],[]dnl dnl [AC_MSG_RESULT([ok])], dnl [AC_ERROR([Cannot find header silk_site_$SILK_SITE.h])]) dnl dnl CPPFLAGS="$sk_save_CPPFLAGS" ])# SILK_AC_OPT_SILK_SITE # --------------------------------------------------------------------------- # SILK_AC_OPT_WITH_FIXBUF # # Determine how to use fixbuf # # Output variables: FIXBUF_CFLAGS, FIXBUF_LDFLAGS # Output definition: HAVE_FIXBUF_PUBLIC_H # AC_DEFUN([SILK_AC_OPT_WITH_FIXBUF],[ AC_SUBST(FIXBUF_CFLAGS) AC_SUBST(FIXBUF_LDFLAGS) AC_ARG_WITH([libfixbuf],[AS_HELP_STRING([--with-libfixbuf=DIR], [find libfixbuf package configuration file (libfixbuf.pc) in the directory DIR (adds DIR to the PKG_CONFIG_PATH)])[]dnl ],[ if test "x$withval" != "xyes" then fixbuf_config="$withval" fi ]) sk_fixbuf_found=0 if test "x$fixbuf_config" != "xno" then if test "x$fixbuf_config" != "x" then PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$fixbuf_config" export PKG_CONFIG_PATH fi PKG_CHECK_MODULES([LIBFIXBUF], [libfixbuf >= 0.6.0], [sk_fixbuf_found=1], [sk_fixbuf_found=0]) fi if test "$sk_fixbuf_found" -gt 0 then # Cache current values sk_save_LDFLAGS="$LDFLAGS" sk_save_LIBS="$LIBS" sk_save_CFLAGS="$CFLAGS" sk_save_CPPFLAGS="$CPPFLAGS" FIXBUF_LDFLAGS="$LIBFIXBUF_LIBS" LDFLAGS="" LIBS="$FIXBUF_LDFLAGS" FIXBUF_CFLAGS="$LIBFIXBUF_CFLAGS" CFLAGS="$FIXBUF_CFLAGS" CPPFLAGS="$CFLAGS" AC_MSG_CHECKING([usability of libfixbuf library and headers]) AC_LINK_IFELSE( [AC_LANG_PROGRAM([ #include ],[ fbInfoModel_t *m = fbInfoModelAlloc(); ])],[ AC_MSG_RESULT([yes]) sk_fixbuf_found=1 ],[ AC_MSG_RESULT([no]) sk_fixbuf_found=0]) # Restore cached values LDFLAGS="$sk_save_LDFLAGS" LIBS="$sk_save_LIBS" CFLAGS="$sk_save_CFLAGS" CPPFLAGS="$sk_save_CPPFLAGS" fi if test "$sk_fixbuf_found" -eq 0 then FIXBUF_LDFLAGS= FIXBUF_CFLAGS= else sk_fixbuf_found=1 AC_DEFINE(HAVE_FIXBUF_PUBLIC_H, 1, [Define to 1 if you have the header file.]) fi AM_CONDITIONAL(HAVE_FIXBUF, [test "x$sk_fixbuf_found" = x1]) ])# SILK_AC_OPT_WITH_FIXBUF # --------------------------------------------------------------------------- # SILK_AC_OPT_WITH_GNUTLS # # Determine how to use GNUTLS. # # Output variables: GNUTLS_CFLAGS, GNUTLS_LDFLAGS. # Output definition: HAVE_GNUTLS_GNUTLS_H # AC_DEFUN([SILK_AC_OPT_WITH_GNUTLS],[ AC_SUBST(GNUTLS_CFLAGS) AC_SUBST(GNUTLS_LDFLAGS) AC_ARG_WITH([gnutls],[AS_HELP_STRING([--with-gnutls=DIR], [find the gnutls package configuration file (gnutls.pc) in the directory DIR (adds DIR to the PKG_CONFIG_PATH)])[]dnl ],[ if test "x$withval" != "xyes" then gnutls_config="$withval" fi ]) sk_gnutls_found=0 if test "x$gnutls_config" != "xno" then if test "x$gnutls_config" != "x" then PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$gnutls_config" export PKG_CONFIG_PATH fi PKG_CHECK_MODULES([GNUTLS], [gnutls >= 1.4.1], [sk_gnutls_found=1], [sk_gnutls_found=0]) fi if test "$sk_gnutls_found" -gt 0 then # Cache current values sk_save_LDFLAGS="$LDFLAGS" sk_save_LIBS="$LIBS" sk_save_CFLAGS="$CFLAGS" sk_save_CPPFLAGS="$CPPFLAGS" GNUTLS_LDFLAGS="$GNUTLS_LIBS" LDFLAGS="" LIBS="$GNUTLS_LDFLAGS" CFLAGS="$GNUTLS_CFLAGS" CPPFLAGS="$CFLAGS" AC_MSG_CHECKING([usability of gnutls library and headers]) AC_LINK_IFELSE( [AC_LANG_PROGRAM([ #include #include #ifdef HAVE_PTHREAD_H #include #endif #ifdef HAVE_ERRNO_H #include #endif GCRY_THREAD_OPTION_PTHREAD_IMPL; ],[ gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread); gnutls_global_init(); ])],[ AC_MSG_RESULT([yes]) sk_gnutls_found="1$sk_gnutls_found" ],[ AC_MSG_RESULT([no])]) # Restore cached values LDFLAGS="$sk_save_LDFLAGS" LIBS="$sk_save_LIBS" CFLAGS="$sk_save_CFLAGS" CPPFLAGS="$sk_save_CPPFLAGS" fi if test "$sk_gnutls_found" -eq 0 then GNUTLS_LDFLAGS= GNUTLS_CFLAGS= else sk_gnutls_found=1 AC_DEFINE(HAVE_GNUTLS_GNUTLS_H, 1, [Define to 1 if you have the header file.]) fi ])# SILK_AC_OPT_WITH_GNUTLS # --------------------------------------------------------------------------- # SILK_AC_OPT_WITH_IPA # # Determine how to use IPA # # Output variables: LIBIPA_CFLAGS, LIBIPA_LDFLAGS # Output definitions: HAVE_IPA_IPA_H # AC_DEFUN([SILK_AC_OPT_WITH_IPA],[ AC_SUBST(LIBIPA_CFLAGS) AC_SUBST(LIBIPA_LDFLAGS) AC_ARG_WITH([libipa],[AS_HELP_STRING([--with-libipa=DIR], [find libipa package configuration file (libipa.pc) in the directory DIR (adds DIR to the PKG_CONFIG_PATH)])[]dnl ],[ if test "x$withval" != "xyes" then IPA_config="$withval" fi ]) sk_ipa_found=0 if test "x$IPA_config" != "xno" then if test "x$IPA_config" != "x" then PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$IPA_config" export PKG_CONFIG_PATH fi PKG_CHECK_MODULES([LIBIPA], [libipa >= 0.2.0], [sk_ipa_found=1], [sk_ipa_found=0]) fi if test "$sk_ipa_found" -gt 0 then # Cache current values sk_save_LDFLAGS="$LDFLAGS" sk_save_LIBS="$LIBS" sk_save_CFLAGS="$CFLAGS" sk_save_CPPFLAGS="$CPPFLAGS" LIBIPA_LDFLAGS="$LIBIPA_LIBS" LDFLAGS="" LIBS="$LIBIPA_LDFLAGS" CFLAGS="$LIBIPA_CFLAGS" CPPFLAGS="$CFLAGS" AC_MSG_CHECKING([usability of libipa library and headers]) AC_LINK_IFELSE( [AC_LANG_PROGRAM([ #include ],[ IPAContext *ctx; ])],[ AC_MSG_RESULT([yes]) sk_ipa_found=1 ],[ AC_MSG_RESULT([no]) sk_ipa_found=0]) # Restore cached values LDFLAGS="$sk_save_LDFLAGS" LIBS="$sk_save_LIBS" CFLAGS="$sk_save_CFLAGS" CPPFLAGS="$sk_save_CPPFLAGS" fi if test "$sk_ipa_found" -eq 0 then IPA_LDFLAGS= IPA_CFLAGS= else sk_ipa_found=1 AC_DEFINE(HAVE_IPA_IPA_H, 1, [Define to 1 if you have the header file.]) fi AM_CONDITIONAL(HAVE_IPA, [test "x$sk_ipa_found" = x1]) ])# SILK_AC_OPT_WITH_IPA # --------------------------------------------------------------------------- # SILK_AC_OPT_WITH_LZO # # Try to find the lzo library. If we don't, print a warning about # not being able to build the packing tools. # # Version 2 of LZO (released May-2005) puts the headers into an # "lzo" subdirectory (DarwinPorts uses an lzo2 subdirectory) while # version 1 did not. # # Output variables: SK_LZO_HEADER_NAME # AC_DEFUN([SILK_AC_OPT_WITH_LZO],[ AC_ARG_WITH([lzo], AS_HELP_STRING([--with-lzo=DIR], [find lzo1x.h in DIR/include, liblzo in DIR/lib]), [ if test "x$withval" != "xyes" then lzo_dir="$withval" fi ]) sk_lzo_found=0 if test "x$lzo_dir" != "xno" then # Cache current values sk_save_LDFLAGS="$LDFLAGS" sk_save_LIBS="$LIBS" sk_save_CFLAGS="$CFLAGS" sk_save_CPPFLAGS="$CPPFLAGS" if test "x$lzo_dir" = "x" then AC_MSG_CHECKING([for LZO library and headers]) else AC_MSG_CHECKING([for LZO library and headers under $lzo_dir]) fi # Loop over all the various library and header combinations. for lzo_library in "lzo2" "lzo" do for lzo_include_prefix in "lzo2/" "lzo/" "" do LIBS="-l$lzo_library" SK_LZO_HEADER_NAME="<${lzo_include_prefix}lzo1x.h>" if test "x$lzo_dir" = "x" then # Use default LDFLAGS, CFLAGS, CPPFLAGS LZO_LDFLAGS="-l$lzo_library" LZO_CFLAGS= else # When explicit directory given, ignore previous # LDFLAGS, CFLAGS, CPPFLAGS values. LDFLAGS="-L$lzo_dir/lib" LZO_LDFLAGS="$LDFLAGS -l$lzo_library" LZO_CFLAGS="-I$lzo_dir/include" CFLAGS="$LZO_CFLAGS" CPPFLAGS="$LZO_CFLAGS" fi AC_LINK_IFELSE([ AC_LANG_PROGRAM([ #include $SK_LZO_HEADER_NAME ],[ lzo1_compress (); ])],[ sk_lzo_found=12 ]) if test "$sk_lzo_found" -ge 11 then break fi done if test "$sk_lzo_found" -ge 11 then break fi done if test "$sk_lzo_found" -lt 11 then AC_MSG_RESULT([no]) else AC_MSG_RESULT([yes]) fi # Still not found and no explicit path from user, so look # under the curent directory---as it is in our repository if test "x$lzo_dir" = "x" && test "$sk_lzo_found" -lt 11 then sk_try_lzo_dir="./lzo-compressor" LDFLAGS="-L$sk_try_lzo_dir/lib" LZO_LDFLAGS="$LDFLAGS -llzo" LZO_CFLAGS="-I$sk_try_lzo_dir/include" CFLAGS="$LZO_CFLAGS" CPPFLAGS="$LZO_CFLAGS" SK_LZO_HEADER_NAME="" AC_MSG_CHECKING([for LZO library and headers under $sk_try_lzo_dir]) AC_LINK_IFELSE( [AC_LANG_PROGRAM([ #include $SK_LZO_HEADER_NAME ],[ lzo1_compress (); ])],[ AC_MSG_RESULT([yes]) sk_lzo_found=12 LZO_LDFLAGS="-L\$(abs_top_builddir)/$sk_try_lzo_dir/lib -llzo" LZO_CFLAGS="-I\$(abs_top_builddir)/$sk_try_lzo_dir/include" ],[AC_MSG_RESULT([no])]) fi # Still not found and no explicit path from user, so look # under the current directory in the lzo-compressor source if test "x$lzo_dir" = "x" && test "$sk_lzo_found" -lt 11 then sk_try_lzo_dir="./lzo-compressor/lzo" LDFLAGS="-L$sk_try_lzo_dir/src/.libs" LZO_LDFLAGS="$LDFLAGS -llzo" LZO_CFLAGS="-I$sk_try_lzo_dir/include" CFLAGS="$LZO_CFLAGS" CPPFLAGS="$LZO_CFLAGS" AC_MSG_CHECKING([for LZO library and headers under $sk_try_lzo_dir]) AC_LINK_IFELSE( [AC_LANG_PROGRAM([ #include $SK_LZO_HEADER_NAME ],[ lzo1_compress (); ])],[ AC_MSG_RESULT([yes]) sk_lzo_found=12 LZO_LDFLAGS="-L\$(abs_top_builddir)/$sk_try_lzo_dir/src/.libs -llzo" LZO_CFLAGS="-I\$(abs_top_builddir)/$sk_try_lzo_dir/include" ],[AC_MSG_RESULT([no])]) fi # Still not found, look for the LZO sources if test "x$lzo_dir" = "x" && test "$sk_lzo_found" -lt 11 then if test -d $sk_try_lzo_dir then AC_CONFIG_SUBDIRS(lzo-compressor/lzo) sk_lzo_found=12 LZO_LDFLAGS="-L\$(abs_top_builddir)/$sk_try_lzo_dir/src/.libs -llzo" LZO_CFLAGS="-I\$(abs_top_builddir)/$sk_try_lzo_dir/include" fi fi # Restore cached values LDFLAGS="$sk_save_LDFLAGS" LIBS="$sk_save_LIBS" CFLAGS="$sk_save_CFLAGS" CPPFLAGS="$sk_save_CPPFLAGS" fi if test "$sk_lzo_found" -lt 11 then sk_lzo_found=0 LZO_LDFLAGS= LZO_CFLAGS= else sk_lzo_found=1 AC_DEFINE_UNQUOTED([SK_LZO_HEADER_NAME],$SK_LZO_HEADER_NAME, [Define to the location of the lzo1x.h header file, if available]) AM_CPPFLAGS="$AM_CPPFLAGS $LZO_CFLAGS" LIBS="$LZO_LDFLAGS $LIBS" fi AM_CONDITIONAL(HAVE_LZO, [test "x$sk_lzo_found" = x1]) ])# SILK_AC_OPT_WITH_LZO # --------------------------------------------------------------------------- # SILK_AC_OPT_WITH_PCAP # # Determine how to use pcap. Output variable: PCAP_LDFLAGS # Output definition: HAVE_PCAP_H # AC_DEFUN([SILK_AC_OPT_WITH_PCAP],[ AC_SUBST(PCAP_LDFLAGS) AC_ARG_WITH([pcap],[AS_HELP_STRING([--with-pcap=DIR], [find pcap.h in DIR/include, libpcap in DIR/lib])[]dnl ],[ if test "x$withval" != "xyes" then pcap_dir="$withval" fi ]) sk_pcap_found=0 if test "x$pcap_dir" != "xno" then # Cache current values sk_save_LDFLAGS="$LDFLAGS" sk_save_LIBS="$LIBS" sk_save_CFLAGS="$CFLAGS" sk_save_CPPFLAGS="$CPPFLAGS" if test "x$pcap_dir" = "x" then PCAP_LDFLAGS="-lpcap" PCAP_CFLAGS= else # When explicit directory given, ignore previous LDFLAGS, # CFLAGS, CPPFLAGS values. LDFLAGS="-L$pcap_dir/lib" PCAP_LDFLAGS="$LDFLAGS -lpcap" PCAP_CFLAGS="-I$pcap_dir/include" CFLAGS="$PCAP_CFLAGS" CPPFLAGS="$PCAP_CFLAGS" fi AC_CHECK_LIB([pcap], [pcap_open_dead],[ sk_pcap_found=1]) AC_CHECK_HEADER([pcap.h],[sk_pcap_found="1$sk_pcap_found"]) if test "$sk_pcap_found" -ge 11 then AC_MSG_CHECKING([usability of PCAP library and headers]) LIBS="$PCAP_LDFLAGS" AC_LINK_IFELSE( [AC_LANG_PROGRAM([ #include ],[ pcap_t *pc; u_char *pkt; struct pcap_pkthdr hdr; pcap_dumper_t *dump; pc = pcap_open_dead(0, 0); dump = pcap_dump_open(pc, "/dev/null"); pkt = (u_char*)(pcap_next(pc, &hdr)); pcap_dump((u_char*)dump, &hdr, pkt); pcap_dump_flush((u_char*)dump); ])],[ AC_MSG_RESULT([yes]) sk_pcap_found="1$sk_pcap_found" ],[ AC_MSG_RESULT([no])]) fi # Restore cached values LDFLAGS="$sk_save_LDFLAGS" LIBS="$sk_save_LIBS" CFLAGS="$sk_save_CFLAGS" CPPFLAGS="$sk_save_CPPFLAGS" fi if test "$sk_pcap_found" -lt 111 then AC_MSG_NOTICE([(${PACKAGE}) Cannot build rwp* tools without pcap]) sk_pcap_found=0 PCAP_LDFLAGS= PCAP_CFLAGS= else sk_pcap_found=1 AM_CPPFLAGS="$AM_CPPFLAGS $PCAP_CFLAGS" AC_DEFINE([HAVE_PCAP_H], 1, [Define to 1 if you have the header file.]) fi AM_CONDITIONAL(HAVE_PCAP, [test "x$sk_pcap_found" = x1]) ])# SILK_AC_OPT_WITH_PCAP # --------------------------------------------------------------------------- # SILK_AC_OPT_WITH_PCRE # # Determine how to use pcre # # Output variables: PCRE_CFLAGS PCRE_LDFLAGS # Output defines: HAVE_PCRE_H # AC_DEFUN([SILK_AC_OPT_WITH_PCRE],[ AC_SUBST(PCRE_CFLAGS) AC_SUBST(PCRE_LDFLAGS) AC_ARG_WITH([pcre],[AS_HELP_STRING([--with-pcre=DIR], [find pcre package configuration file at DIR/libpcre.pc])[]dnl ],[ if test "x$withval" != "xyes" then pcre_config="$withval" fi ]) sk_pcre_found=0 if test "x$pcre_config" != "xno" then if test "x$pcre_config" != "x" then PKG_CONFIG_PATH="$pcre_config:$PKG_CONFIG_PATH" export PKG_CONFIG_PATH fi PKG_CHECK_MODULES([PCRE], [libpcre], [sk_pcre_found=1], [sk_pcre_found=0]) fi if test "$sk_pcre_found" -gt 0 then # Cache current values sk_save_LDFLAGS="$LDFLAGS" sk_save_LIBS="$LIBS" sk_save_CFLAGS="$CFLAGS" sk_save_CPPFLAGS="$CPPFLAGS" PCRE_LDFLAGS="$PCRE_LIBS" LDFLAGS="" LIBS="$PCRE_LDFLAGS" CFLAGS="$PCRE_CFLAGS" CPPFLAGS="$CFLAGS" AC_MSG_CHECKING([usability of PCRE library and headers]) AC_LINK_IFELSE( [AC_LANG_PROGRAM([ #include ],[ (void) pcre_version (); ])],[ AC_MSG_RESULT([yes]) sk_pcre_found=1 ],[ AC_MSG_RESULT([no]) sk_pcre_found=0]) # Restore cached values LDFLAGS="$sk_save_LDFLAGS" LIBS="$sk_save_LIBS" CFLAGS="$sk_save_CFLAGS" CPPFLAGS="$sk_save_CPPFLAGS" fi if test "$sk_pcre_found" -eq 0 then PCRE_LDFLAGS= PCRE_CFLAGS= else AM_CPPFLAGS="$AM_CPPFLAGS $PRCE_CFLAGS" AC_DEFINE(HAVE_PCRE_H, 1, [Define to 1 if you have the header file.]) fi ])# SILK_AC_OPT_WITH_PCRE # --------------------------------------------------------------------------- # SILK_AC_OPT_WITH_ZLIB # # Determine how to use zlib # AC_DEFUN([SILK_AC_OPT_WITH_ZLIB],[ AC_ARG_WITH([zlib],[AS_HELP_STRING([--with-zlib=DIR], [find zlib.h in DIR/include, libz in DIR/lib])[]dnl ],[ if test "x$withval" != "xyes" then zlib_dir="$withval" fi ]) sk_zlib_found=0 if test "x$zlib_dir" != "xno" then # Cache current values sk_save_LDFLAGS="$LDFLAGS" sk_save_CFLAGS="$CFLAGS" sk_save_CPPFLAGS="$CPPFLAGS" if test "x$zlib_dir" = "x" then ZLIB_LDFLAGS="-lz" ZLIB_CFLAGS= else # When explicit directory given, ignore previous LDFLAGS, # CFLAGS, CPPFLAGS values. LDFLAGS="-L$zlib_dir/lib" ZLIB_LDFLAGS="$LDFLAGS -lz" ZLIB_CFLAGS="-I$zlib_dir/include" CFLAGS="$ZLIB_CFLAGS" CPPFLAGS="$ZLIB_CFLAGS" fi AC_CHECK_LIB([z], [gzopen],[ sk_zlib_found=1]) AC_CHECK_HEADER([zlib.h],[sk_zlib_found="1$sk_zlib_found"]) if test "$sk_zlib_found" -ge 11 then # found zlib, now look for the compressBound() function AC_CHECK_LIB([z], [compressBound], AC_DEFINE(HAVE_COMPRESSBOUND, 1, [Define to 1 if your zlib library provides compressBound().])) fi # Restore cached values LDFLAGS="$sk_save_LDFLAGS" CFLAGS="$sk_save_CFLAGS" CPPFLAGS="$sk_save_CPPFLAGS" fi if test "$sk_zlib_found" -lt 11 then sk_zlib_found=0 ZLIB_LDFLAGS= ZLIB_CFLAGS= else sk_zlib_found=1 AC_DEFINE(HAVE_ZLIB_H, 1, [Define to 1 if you have the header file.]) AM_CPPFLAGS="$AM_CPPFLAGS $ZLIB_CFLAGS" LIBS="$ZLIB_LDFLAGS $LIBS" fi AM_CONDITIONAL(HAVE_ZLIB, [test "x$sk_zlib_found" = x1]) ])# SILK_AC_OPT_WITH_ZLIB # --------------------------------------------------------------------------- # SILK_AC_PREPROC_ADDITIONAL_FLAGS(var, flag_list) # # For each flag listed in FLAG_LIST, add it to the specified VAR if # the preprocessor understands it. # AC_DEFUN([SILK_AC_PREPROC_ADDITIONAL_FLAGS],[ # cache the old CPPFLAGS value sk_save_CPPFLAGS="$CPPFLAGS" for sk_cpp_flag in $2 do CPPFLAGS="$sk_cpp_flag $sk_save_CPPFLAGS" AC_MSG_CHECKING([whether the preprocessor understands $sk_cpp_flag]) AC_PREPROC_IFELSE( [AC_LANG_PROGRAM([],[ int x; x++; ]) ],[ $1="$$1 $sk_cpp_flag" AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])]) done CPPFLAGS="$sk_save_CPPFLAGS" ])#SILK_AC_PREPROC_ADDITIONAL_FLAGS # --------------------------------------------------------------------------- # SILK_AC_PRINT_SUMMARY # # Print a summary # AC_DEFUN([SILK_AC_PRINT_SUMMARY],[ AC_MSG_NOTICE([$SILK_FINAL_MSG]) ]) # SILK_AC_PRINT_SUMMARY # --------------------------------------------------------------------------- # SILK_AC_STD_SUBSTS # # Do final substitutions # AC_DEFUN([SILK_AC_STD_SUBSTS],[ SILK_FINAL_MSG="$SILK_FINAL_MSG * Configured package: ${PACKAGE_STRING} * Root of packed data tree: $SILK_DATA_ROOTDIR * Site files: $SILK_SITE * Source files (\$top_srcdir): $srcdir * Site file location: $SILK_SITE_DIR * Install directory: $prefix" AC_SUBST(SPLINT_FLAGS) if test -n "$ac_cv_path_MAILX" then AC_DEFINE_UNQUOTED([SK_MAILER],"$ac_cv_path_MAILX",[Path to mail program used for sending alerts]) fi if test "x$silk_enable_localtime" = "xyes" then AC_DEFINE([SK_ENABLE_LOCALTIME],[1],[Define to 1 to use the local timezone for command input and printing records; if not defined, use UTC.]) AC_MSG_NOTICE([(${PACKAGE}) Using the local timezone for command input and output]) SILK_FINAL_MSG="$SILK_FINAL_MSG * Timezone support: local" else SILK_FINAL_MSG="$SILK_FINAL_MSG * Timezone support: UTC" fi if test "x$silk_enable_legacy_timestamp" = "xyes" then AC_DEFINE([SK_ENABLE_LEGACY_TIMESTAMP],[1],[Define to 1 to use the old timestamp format of "MM/DD/YYYY hh:mm:ss"; if not defined, use "YYYY/MM/DDThh:mm:ss".]) AC_MSG_NOTICE([(${PACKAGE}) Using legacy timestamps by default]) SILK_FINAL_MSG="$SILK_FINAL_MSG * Timestamp format: '03/25/2006 04:34:52' (old-style)" else SILK_FINAL_MSG="$SILK_FINAL_MSG * Timestamp format: '2006/03/25T04:34:52' (new-style)" fi SILK_FINAL_MSG="$SILK_FINAL_MSG * Default Compression method: $silk_enable_output_comp" if test "x$sk_fixbuf_found" = "x1" then SILK_FINAL_MSG="$SILK_FINAL_MSG * IPFIX collection support: YES ($FIXBUF_LDFLAGS)" else SILK_FINAL_MSG="$SILK_FINAL_MSG * IPFIX collection support: NO" fi if test "x$silk_enable_initial_tcpflags" = "xyes" then AC_DEFINE([SK_ENABLE_INITIAL_TCPFLAGS],[1],[Define to 1 to build with support for the --flags-initial switch in rwfilter and initialFlags field in rwcut.]) AC_MSG_NOTICE([(${PACKAGE}) Including support for initial TCP flags]) SILK_FINAL_MSG="$SILK_FINAL_MSG * Initial TCP flag support: YES $sk_initial_flags_reason" else SILK_FINAL_MSG="$SILK_FINAL_MSG * Initial TCP flag support: NO" fi if test "0$sk_gnutls_found" -eq 0 then SILK_FINAL_MSG="$SILK_FINAL_MSG * Transport encryption support NO (gnutls not found)" else SILK_FINAL_MSG="$SILK_FINAL_MSG * Transport encryption support YES ($GNUTLS_LDFLAGS)" fi if test "0$silk_enable_analysis_tools" -eq 0 then SILK_FINAL_MSG="$SILK_FINAL_MSG * Build analysis tools: NO (--disable-analysis-tools)" else SILK_FINAL_MSG="$SILK_FINAL_MSG * Build analysis tools: YES" fi if test "0$silk_enable_packing_tools" -eq 0 then SILK_FINAL_MSG="$SILK_FINAL_MSG * Build rwflowpack: NO (--disable-packing-tools)" else SILK_FINAL_MSG="$SILK_FINAL_MSG * Build rwflowpack: YES" fi if test "0$silk_enable_packing_tools" -eq 0 then SILK_FINAL_MSG="$SILK_FINAL_MSG * Build flowcap: NO (--disable-packing-tools)" elif test "0$sk_lzo_found" -eq 0 then AC_MSG_NOTICE([(${PACKAGE}) Flowcap support will not be built (lzo not found)]) SILK_FINAL_MSG="$SILK_FINAL_MSG * Build flowcap: NO (liblzo not found)" else SILK_FINAL_MSG="$SILK_FINAL_MSG * Build flowcap: YES" fi # Remove leading whitespace sk_msg_cflags=`echo "$CPPFLAGS $AM_CPPFLAGS $CFLAGS $AM_CFLAGS" | sed 's/^ *//' | sed 's/ */ /g'` sk_msg_ldflags=`echo "$AM_LDFLAGS $LDFLAGS" | sed 's/^ *//' | sed 's/ */ /g'` SILK_FINAL_MSG="$SILK_FINAL_MSG * Compiler (CC): $CC * Compiler flags (CFLAGS): $sk_msg_cflags * Linker flags (LDFLAGS): $sk_msg_ldflags * Libraries (LIBS): $LIBS " ]) # SILK_AC_STD_SUBSTS