Skip to content
This repository has been archived by the owner on Jan 18, 2024. It is now read-only.

Commit

Permalink
added: support for compiling under cygwin.
Browse files Browse the repository at this point in the history
  • Loading branch information
binf authored and firnsy committed Nov 14, 2011
1 parent deb8603 commit f71a8d3
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 3 deletions.
67 changes: 66 additions & 1 deletion configure.in
Expand Up @@ -109,6 +109,10 @@ case "$host" in
AC_DEFINE([BROKEN_SIOCGIFMTU],[1],[Define if broken SIOCGIFMTU])
LDFLAGS="${LDFLAGS} -L/sw/lib"
extra_incl="-I/sw/include"
;;
*-cygwin*)
AC_DEFINE([CYGWIN],[1],[Define if CYGWIN])
;;
esac

# This is really meant for Solaris Sparc v9 where it has 32bit and 64bit
Expand Down Expand Up @@ -311,8 +315,51 @@ if test "x$with_libpfring_libraries" != "xno"; then
LDFLAGS="${LDFLAGS} -L${with_libpfring_libraries}"
fi


PCAP_HEADERS=""
# Test for pcap headers

AC_CHECK_HEADERS(pcap.h,,PCAP_HEADERS="no")

if test "x$PCAP_HEADERS" = "xno"; then

if test "x$CYGWIN" = "x1" ; then

echo
echo " ERROR: You will need to get Winpcap, install libraries and headers in your path"
echo " Downlad from http://www.winpcap.org, uncompress it and copy */Lib/* to your lib path (/lib)"
echo " and */Include/* to your include path (/usr/include)"
echo " or use the --with-libpcap-* options, if you have it installed"
echo " in unusual place. Also check if your libpcap depends on another"
echo " shared library that may be installed in an unusual place"

exit 1

else

echo
echo " ERROR! Libpcap library/headers (libpcap.a (or .so)/pcap.h)"
echo " not found, go get it from http://www.tcpdump.org"
echo " or use the --with-libpcap-* options, if you have it installed"
echo " in unusual place. Also check if your libpcap depends on another"
echo " shared library that may be installed in an unusual place"
exit 1

fi

fi


LPCAP=""
AC_CHECK_LIB(pcap, pcap_datalink,, LPCAP="no")

if test "x$with_libpcap_libraries" != "xyes"; then
if test "x$CYGWIN" = "x1"; then
AC_CHECK_LIB(wpcap, pcap_datalink,, LPCAP="no")
else
AC_CHECK_LIB(pcap, pcap_datalink,, LPCAP="no")
fi
fi


# If the normal AC_CHECK_LIB for pcap fails then check to see if we are
# using a pfring-enabled pcap.
Expand All @@ -336,13 +383,31 @@ fi
# If both the AC_CHECK_LIB for normal pcap and pfring-enabled pcap fail then exit.
if test "x$LPCAP" = "xno"; then
if test "x$LPFRING_PCAP" = "xno"; then

if test "x$CYGWIN" = "1" ; then

echo
echo " ERROR: You will need to get Winpcap, install libraries and headers in your path"
echo " Downlad from http://www.winpcap.org, uncompress it and copy */Lib/* to your lib path (/lib)"
echo " and */Include/* to your include path (/usr/include)"
echo " or use the --with-libpcap-* options, if you have it installed"
echo " in unusual place. Also check if your libpcap depends on another"
echo " shared library that may be installed in an unusual place"

exit 1

else

echo
echo " ERROR! Libpcap library/headers (libpcap.a (or .so)/pcap.h)"
echo " not found, go get it from http://www.tcpdump.org"
echo " or use the --with-libpcap-* options, if you have it installed"
echo " in unusual place. Also check if your libpcap depends on another"
echo " shared library that may be installed in an unusual place"
exit 1

fi

fi
fi

Expand Down
3 changes: 2 additions & 1 deletion src/barnyard2.c
Expand Up @@ -1825,7 +1825,8 @@ static void SetNoCores(void)

static void InitSignals(void)
{
#ifndef WIN32
#if !defined(WIN32) && !defined(__CYGWIN32__) && !defined(__CYGWIN__) && \
!defined( __CYGWIN64__)
# if defined(LINUX) || defined(FREEBSD) || defined(OPENBSD) || \
defined(SOLARIS) || defined(BSD) || defined(MACOS)
sigset_t set;
Expand Down
3 changes: 3 additions & 0 deletions src/plugbase.h
Expand Up @@ -45,7 +45,10 @@
# include <sys/socket.h>
#endif

#if !defined(__SOLARIS__) && !defined(__CYGWIN32__) && !defined(__CYGWIN__) && \
!defined( __CYGWIN64__)
#include <net/route.h>
#endif

#ifdef ENABLE_SSL
# undef Free
Expand Down
3 changes: 2 additions & 1 deletion src/util.c
Expand Up @@ -1986,7 +1986,8 @@ int GetLocalTimezone()
time(&ut);
ltm = localtime(&ut);

#if defined(WIN32) || defined(SOLARIS) || defined(AIX) || defined(HPUX)
#if defined(WIN32) || defined(SOLARIS) || defined(AIX) || defined(HPUX) ||\
defined(__CYGWIN__) || defined( __CYGWIN64__) || defined(__CYGWIN__)
/* localtime() sets the global timezone variable,
which is defined in <time.h> */
seconds_away_from_utc = timezone;
Expand Down

0 comments on commit f71a8d3

Please sign in to comment.