diff configure.in @ 415:104f32d04cd1

Fixed building with pthreads and the pth library
author Sam Lantinga <slouken@libsdl.org>
date Thu, 13 Jun 2002 21:36:25 +0000
parents 2a1486305412
children 3d8ad40ef561
line wrap: on
line diff
--- a/configure.in	Thu Jun 13 17:52:43 2002 +0000
+++ b/configure.in	Thu Jun 13 21:36:25 2002 +0000
@@ -1138,8 +1138,6 @@
     AC_ARG_ENABLE(pthread-sem,
 [  --enable-pthread-sem    use pthread semaphores [default=yes]],
                   , enable_pthread_sem=yes)
-    ac_save_cflags="$CFLAGS"
-    ac_save_libs="$LIBS"
     case "$target" in
         *-*-bsdi*)
             pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
@@ -1187,9 +1185,12 @@
             pthread_lib="-lpthread"
             ;;
     esac
-    CFLAGS="$CFLAGS $pthread_cflags"
-    LIBS="$LIBS $pthread_lib"
     if test x$enable_threads = xyes -a x$enable_pthreads = xyes; then
+        # Save the original compiler flags and libraries
+        ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
+        # Add the pthread compiler flags and libraries
+        CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
+        # Check to see if we have pthread support on this system
         AC_MSG_CHECKING(for pthreads)
         use_pthreads=no
         AC_TRY_LINK([
@@ -1201,6 +1202,9 @@
         use_pthreads=yes
         ])
         AC_MSG_RESULT($use_pthreads)
+        # Restore the compiler flags and libraries
+        CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
+        # Do futher testing if we have pthread support...
         if test x$use_pthreads = xyes; then
             CFLAGS="$CFLAGS $pthread_cflags -DSDL_USE_PTHREADS"
             SDL_CFLAGS="$SDL_CFLAGS $pthread_cflags"
@@ -1269,8 +1273,6 @@
             esac
         fi
     fi
-    CFLAGS="$ac_save_cflags"
-    LIBS="$ac_save_libs"
 
     AC_MSG_CHECKING(whether semun is defined in /usr/include/sys/sem.h)
     have_semun=no