Author: gherzan Date: Fri Apr 16 16:45:34 2010 New Revision: 2298 Log: Make the project build on FreeBSD 8.0 RELEASE. Modified: trunk/configure.ac trunk/libpisa/arp.c trunk/libpisa/debug.h trunk/libpisa/global.h trunk/libpisa/hitlist.c trunk/libpisa/nat.c trunk/libpisa/sysdep_fw.c trunk/libpisa/sysdep_tun.c trunk/pairing/libconfig_wrapper.c trunk/pairing/packet_handler.c Modified: trunk/configure.ac ============================================================================== --- trunk/configure.ac Thu Apr 15 17:44:27 2010 (r2297) +++ trunk/configure.ac Fri Apr 16 16:45:34 2010 (r2298) @@ -83,15 +83,23 @@ AC_MSG_RESULT([$enable_logging]) # Set the preprocessor flags for the entire project -AC_SUBST(AM_CPPFLAGS, "-D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=500") +AC_SUBST(AM_CPPFLAGS, "-D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=700") if test "$(uname -s)" = "Darwin"; then AC_SUBST(AM_CPPFLAGS, "$AM_CPPFLAGS -D_DARWIN_C_SOURCE") fi +if test "$(uname -s)" = "FreeBSD"; then + AC_SUBST(AM_CPPFLAGS, "$AM_CPPFLAGS -D__BSD_VISIBLE") +fi + # Set default AM_CFLAGS for the complete project. AC_SUBST(AM_CFLAGS, "-std=c99 -Werror -Wall -Wextra -Winline -Wredundant-decls -Wstrict-prototypes -Wdisabled-optimization -Wpointer-arith -Wundef -Wno-deprecated-declarations -Wmissing-prototypes -Wwrite-strings -Wcast-qual -Wshadow") +if test "$(uname -s)" = "FreeBSD"; then + AC_SUBST(AM_CFLAGS, "$AM_CFLAGS -fno-strict-aliasing") +fi + # If no --prefix option is passed to configure, $prefix is empty. But we want # to expand $sysconfdir, which defaults to ${prefix}/etc. So set $prefix. if test "x$prefix" = "xNONE"; then Modified: trunk/libpisa/arp.c ============================================================================== --- trunk/libpisa/arp.c Thu Apr 15 17:44:27 2010 (r2297) +++ trunk/libpisa/arp.c Fri Apr 16 16:45:34 2010 (r2298) @@ -15,6 +15,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <sys/socket.h> #include "arp.h" #include "global.h" Modified: trunk/libpisa/debug.h ============================================================================== --- trunk/libpisa/debug.h Thu Apr 15 17:44:27 2010 (r2297) +++ trunk/libpisa/debug.h Fri Apr 16 16:45:34 2010 (r2298) @@ -20,6 +20,7 @@ #include <stdarg.h> #include <stdint.h> #include <netinet/in.h> +#include <sys/socket.h> #include "config.h" Modified: trunk/libpisa/global.h ============================================================================== --- trunk/libpisa/global.h Thu Apr 15 17:44:27 2010 (r2297) +++ trunk/libpisa/global.h Fri Apr 16 16:45:34 2010 (r2298) @@ -19,6 +19,7 @@ #include <stdint.h> #include <string.h> #include <netinet/in.h> +#include <arpa/inet.h> /* ntohl in FreeBSD */ #include "config.h" Modified: trunk/libpisa/hitlist.c ============================================================================== --- trunk/libpisa/hitlist.c Thu Apr 15 17:44:27 2010 (r2297) +++ trunk/libpisa/hitlist.c Fri Apr 16 16:45:34 2010 (r2298) @@ -8,6 +8,7 @@ #include <stdlib.h> #include <string.h> #include <time.h> +#include <sys/socket.h> #include "cfg.h" #include "global.h" Modified: trunk/libpisa/nat.c ============================================================================== --- trunk/libpisa/nat.c Thu Apr 15 17:44:27 2010 (r2297) +++ trunk/libpisa/nat.c Fri Apr 16 16:45:34 2010 (r2298) @@ -20,6 +20,7 @@ #include <stdint.h> #include <stdlib.h> #include <string.h> +#include <sys/types.h> #include <arpa/inet.h> Modified: trunk/libpisa/sysdep_fw.c ============================================================================== --- trunk/libpisa/sysdep_fw.c Thu Apr 15 17:44:27 2010 (r2297) +++ trunk/libpisa/sysdep_fw.c Fri Apr 16 16:45:34 2010 (r2298) @@ -61,7 +61,7 @@ return system(line); } -#elif defined(__APPLE__) +#elif defined(__APPLE__) || defined(__FreeBSD__) /** * Bernstein's hash applied to a firewall command structure. Modified: trunk/libpisa/sysdep_tun.c ============================================================================== --- trunk/libpisa/sysdep_tun.c Thu Apr 15 17:44:27 2010 (r2297) +++ trunk/libpisa/sysdep_tun.c Fri Apr 16 16:45:34 2010 (r2298) @@ -27,7 +27,7 @@ #ifdef __linux__ # include <linux/if_tun.h> #elif defined(__FreeBSD__) -# include <net/tun.h> +# include <net/if_tun.h> #endif Modified: trunk/pairing/libconfig_wrapper.c ============================================================================== --- trunk/pairing/libconfig_wrapper.c Thu Apr 15 17:44:27 2010 (r2297) +++ trunk/pairing/libconfig_wrapper.c Fri Apr 16 16:45:34 2010 (r2298) @@ -15,6 +15,7 @@ #include <assert.h> #include <libconfig.h> #include <string.h> +#include <sys/socket.h> #include <arpa/inet.h> #include <netinet/in.h> Modified: trunk/pairing/packet_handler.c ============================================================================== --- trunk/pairing/packet_handler.c Thu Apr 15 17:44:27 2010 (r2297) +++ trunk/pairing/packet_handler.c Fri Apr 16 16:45:34 2010 (r2298) @@ -17,6 +17,7 @@ #include <stdlib.h> #include <string.h> #include <time.h> +#include <sys/socket.h> #include <arpa/inet.h> #include <netinet/in.h> #include <openssl/sha.h>