Changeset 1798

Show
Ignore:
Timestamp:
04/14/07 13:49:51 (21 months ago)
Author:
aturner
Message:

OpenBSD has an old version of GCC which doesn't know about a lot of -W flags
Also, OpenBSD has some strange header prerequisites, which I had to handle.
Anyways, the code now configures & compiles under OpenBSD 4.0, which hopefully
means 3.9 too. If not, too bad, someone else will have to figure it out.
fixes #146

Location:
trunk
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • trunk/configure.in

    r1794 r1798  
    2424AC_SUBST(TCPREPLAY_RELEASE) 
    2525 
    26 CFLAGS="$CFLAGS -Wall -O2 -funroll-loops -std=gnu99" # -std=c99 -Wno-variadic-macros" 
     26CFLAGS="$CFLAGS -Wall -O2 -funroll-loops -std=gnu99" 
    2727 
    2828dnl Determine OS 
     
    7979AC_CHECK_TYPE(u_int64_t, uint64_t) 
    8080 
     81dnl Older versions of GCC don't support these options 
     82AC_MSG_CHECKING(for $CC -Wextra support) 
     83OLD_CFLAGS=$CFLAGS 
     84CFLAGS="$CFLAGS -Wextra" 
     85wextra="" 
     86AC_COMPILE_IFELSE([#include <stdlib.h> 
     87    int main(int argc, char *argv[]) { return(0); }], 
     88    [ AC_MSG_RESULT(yes)  
     89      wextra="-Wextra" ], 
     90    [ AC_MSG_RESULT(no) ]) 
     91CFLAGS="$OLD_CFLAGS $wextra" 
     92 
     93AC_MSG_CHECKING(for $CC -Wno-variadic-macros support) 
     94OLD_CFLAGS=$CFLAGS 
     95CFLAGS="$CFLAGS -Wno-variadic-macros" 
     96wno_variadic_macros="" 
     97AC_COMPILE_IFELSE([#include <stdlib.h> 
     98    int main(int argc, char *argv[]) { return(0); }], 
     99    [ AC_MSG_RESULT(yes)  
     100      wno_variadic_macros="-Wno-variadic-macros" ], 
     101    [ AC_MSG_RESULT(no) ]) 
     102CFLAGS="$OLD_CFLAGS $wno_variadic_macros" 
     103 
     104AC_MSG_CHECKING(for $CC -Wfatal-errors support) 
     105OLD_CFLAGS=$CFLAGS 
     106CFLAGS="$CFLAGS -Wfatal-erors" 
     107wfatal_errors="" 
     108AC_COMPILE_IFELSE([#include <stdlib.h> 
     109    int main(int argc, char *argv[]) { return(0); }], 
     110    [ AC_MSG_RESULT(yes)  
     111      wfatal_errors="-Wfatal-errors" ], 
     112    [ AC_MSG_RESULT(no) ]) 
     113CFLAGS="$OLD_CFLAGS $wfatal_errors" 
     114 
     115 
    81116dnl Check for other header files 
    82 AC_CHECK_HEADERS([fcntl.h stddef.h sys/socket.h  arpa/inet.h sys/time.h signal.h string.h strings.h sys/types.h sys/select.h netinet/in.h poll.h sys/poll.h unistd.h net/route.h sys/sysctl.h]) 
     117AC_CHECK_HEADERS([fcntl.h stddef.h sys/socket.h  arpa/inet.h sys/time.h signal.h string.h strings.h sys/types.h sys/select.h netinet/in.h poll.h sys/poll.h unistd.h sys/param.h]) 
     118 
     119dnl OpenBSD has special requirements 
     120AC_CHECK_HEADERS([sys/sysctl.h net/route.h], [], [], [ 
     121[#if HAVE_SYS_PARAM_H 
     122#include <sys/param.h> 
     123#endif 
     124#if HAVE_SYS_TYPES_H 
     125#include <sys/types.h> 
     126#endif 
     127#if HAVE_SYS_SOCKET_H 
     128#include <sys/socket.h> 
     129#endif 
     130]]) 
     131 
    83132 
    84133dnl Checks for libraries. 
     
    92141AC_TYPE_SIGNAL 
    93142AC_FUNC_VPRINTF 
     143AC_CHECK_MEMBERS([struct timeval.tv_sec]) 
     144 
    94145AC_CHECK_FUNCS([gettimeofday ctime memset regcomp strdup strchr strerror strtol strncpy strtoull poll ntohll mmap snprintf vsnprintf]) 
    95146 
     
    98149AM_CONDITIONAL(SYSTEM_STRLCPY, [test x$have_strlcpy = xtrue]) 
    99150 
    100 AC_CHECK_MEMBERS([struct timeval.tv_sec]) 
    101  
    102151AC_C_BIGENDIAN 
    103152AM_CONDITIONAL([WORDS_BIGENDIAN], [ test x$ac_cv_c_bigendian = xyes ]) 
     153 
    104154 
    105155dnl Enable debugging in code/compiler options 
     
    108158    AC_HELP_STRING([--enable-debug], [Enable debugging code and support for the -d option]), 
    109159    [ if test x$enableval = xyes; then 
    110          debug=yes 
    111                 # check for gcc 4.0 flags -Wfatal-errors & -Wno-variadic-macros support 
    112                 CFLAGS="-ggdb -std=gnu99 -Wall -Wextra -Wfatal-errors -Wno-variadic-macros" 
    113                  AC_COMPILE_IFELSE([#include <stdlib.h> 
    114                         int main(int argc, char *argv[]) { return(0); }],  
    115                         [CFLAGS="-ggdb -std=gnu99 -Wall -Wextra -Wfatal-errors -Wno-variadic-macros"], 
    116                         [CFLAGS="-ggdb -std=gnu99 -Wall -Wextra"]) 
     160        debug=yes 
     161        CFLAGS="-ggdb -std=gnu99 -Wall $wextra $wfatal_errors $wno_variadic_macros" 
    117162# We may also want to add: 
    118163#         -Wformat-security -Wswitch-default -Wunused-paramter -Wpadded" 
     
    120165         AC_DEFINE([DEBUG], [1], [Enable debuging code and support for the -d option])  
    121166      fi]) 
     167 
    122168 
    123169AC_ARG_ENABLE(pedantic, 
  • trunk/src/common/sendpacket.c

    r1792 r1798  
    107107#include <sys/ioctl.h> 
    108108#include <sys/file.h> 
     109#include <sys/socket.h> 
     110#ifdef HAVE_SYS_PARAM_H 
     111#include <sys/param.h> 
     112#endif 
    109113#ifdef HAVE_SYS_SYSCTL_H 
    110114#include <sys/sysctl.h> 
     
    118122#ifdef HAVE_PF_PACKET 
    119123#include <fcntl.h> 
    120 #include <sys/socket.h> 
    121124#include <sys/utsname.h> 
    122125#include <net/if.h> 
  • trunk/src/common/tcpdump.c

    r1773 r1798  
    5555#include <errno.h> 
    5656#include <string.h> 
     57#ifdef HAVE_SIGNAL_H 
     58#include <signal.h> 
     59#endif 
    5760 
    5861#include "tcpdump.h" 
  • trunk/src/config.h.in

    r1795 r1798  
    1515/* Enable building flowreplay (alpha) */ 
    1616#undef ENABLE_FLOWREPLAY 
    17  
    18 /* Do we have tcpdump and pcap_dump_fopen()? */ 
    19 #undef ENABLE_VERBOSE 
    2017 
    2118/* fopen(3) accepts a 'b' in the mode flag */ 
  • trunk/src/flow/flownode.c

    r1757 r1798  
    4444#include <errno.h> 
    4545#include <unistd.h> 
     46#ifdef HAVE_SYS_SOCKET_H 
     47#include <sys/socket.h> 
     48#endif 
    4649 
    4750extern struct session_tree tcproot, udproot;