From c02838ad5e127fc501db958212be9aa615c7f7d7 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Wed, 17 Jul 2002 23:25:18 +0000 Subject: [PATCH] FreeBSD patches; appears to be fully functional now. --- configure.in | 20 ++++++++++++++++++-- platform/unix.c | 18 ++++++++++++------ 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/configure.in b/configure.in index f12a45c..34d7e76 100644 --- a/configure.in +++ b/configure.in @@ -226,6 +226,17 @@ if test x$we_have_sed = xyes; then AC_MSG_RESULT([$this_is_macosx]) fi +this_is_freebsd=no +if test x$we_have_sed = xyes; then + AC_MSG_CHECKING([if this is FreeBSD]) + x=`echo $build_os |tr A-Z a-z |sed "s/.*freebsd.*/freebsd/"` + if test x$x = xfreebsd; then + this_is_freebsd=yes + fi + + AC_MSG_RESULT([$this_is_freebsd]) +fi + # Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS([stdlib.h string.h]) @@ -242,6 +253,13 @@ dnl AC_TYPE_SIZE_T AC_FUNC_MEMCMP AC_CHECK_FUNCS([memset strrchr]) +CFLAGS="$CFLAGS -D_REENTRANT -D_THREAD_SAFE" +LDFLAGS="$LDFLAGS -no-undefined" + +if test x$this_is_freebsd = x$yes; then + LDFLAGS="$LDFLAGS -pthread" +fi + dnl Add Makefile conditionals AM_CONDITIONAL(BUILD_ZLIB, test x$enable_internal_zlib = xyes) AM_CONDITIONAL(BUILD_TEST_PHYSFS, test x$enable_testprog = xyes) @@ -249,8 +267,6 @@ AM_CONDITIONAL(BUILD_MACOSX, test x$this_is_macosx = xyes) AM_CONDITIONAL(BUILD_BEOS, test x$this_is_beos = xyes) AM_CONDITIONAL(BUILD_CYGWIN, test x$this_is_cygwin = xyes) -LDFLAGS="$LDFLAGS -no-undefined" - AC_OUTPUT([ Makefile archivers/Makefile diff --git a/platform/unix.c b/platform/unix.c index 3e42616..7fe5660 100644 --- a/platform/unix.c +++ b/platform/unix.c @@ -13,9 +13,15 @@ /* BeOS uses beos.cpp and posix.c ... Cygwin and such use win32.c ... */ #if ((!defined __BEOS__) && (!defined WIN32)) +#ifdef __FreeBSD__ +# if (!defined __BSD__) +# define __BSD__ +# endif +#endif + #if ((defined __APPLE__) && (defined __MACH__)) -# if (!defined __DARWIN__) -# define __DARWIN__ +# if (!defined __BSD__) +# define __BSD__ # endif #endif @@ -33,10 +39,10 @@ #include #include -#if (!defined __DARWIN__) -#include -#else +#if (defined __BSD__) #include +#else +#include #endif #include @@ -62,7 +68,7 @@ int __PHYSFS_platformDeinit(void) -#if (defined __DARWIN__) +#if (defined __BSD__) char **__PHYSFS_platformDetectAvailableCDs(void) {