]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Smart pthread library linkage
authorAmos Jeffries <squid3@treenet.co.nz>
Wed, 17 Dec 2008 06:07:03 +0000 (19:07 +1300)
committerAmos Jeffries <squid3@treenet.co.nz>
Wed, 17 Dec 2008 06:07:03 +0000 (19:07 +1300)
Fixes linkage errors caused on some systes by a clash between the
DiskIO library not being in src/ directly and impicit linkage used
previously used by the auto-tools chain.

* Only link it to objects linking DiskIO which need it explicitly.

* Produce a fatal error message if its required but missing.

configure.in

index 581738559116634ba251bb35a552211822ba84ae..239cdaee2cc04a8e5db78dcd52b310c9618433ea 100644 (file)
@@ -692,6 +692,33 @@ if test "$with_aio" = "yes"; then
     )
 fi
 
+dnl Check for pthreads
+dnl We use pthreads when doing ASYNC I/O
+if test "$with_pthreads" = "yes"; then
+    SQUID_CFLAGS="$SQUID_CFLAGS -D_REENTRANT"
+    SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_REENTRANT"
+    case "$host" in
+    i386-unknown-freebsd*)
+        if test "$GCC" = "yes" ; then
+            if test -z "$PRESET_LDFLAGS"; then
+                LDFLAGS="$LDFLAGS -pthread"
+            fi
+        fi
+    ;;
+    *-solaris2.*)
+        if test "$GCC" = "yes" ; then
+           SQUID_CFLAGS="$SQUID_CFLAGS -pthreads"
+           SQUID_CXXFLAGS="$SQUID_CXXFLAGS -pthreads"
+       else
+           SQUID_CFLAGS="$SQUID_CFLAGS -mt"
+           SQUID_CXXFLAGS="$SQUID_CXXFLAGS -mt"
+        fi
+    ;;
+    esac
+    AC_CHECK_LIB(pthread, main,[DISK_LIBS="$DISK_LIBS -lpthread"],
+      [ AC_MSG_ERROR(pthread library required but cannot be found.) ])
+fi
+
 AC_SUBST(DISK_MODULES)
 AC_SUBST(DISK_LIBS)
 AC_SUBST(DISK_PROGRAMS)
@@ -2687,32 +2714,6 @@ if test "$with_dl" = "yes"; then
     AC_CHECK_LIB(dl, dlopen)
 fi
 
-dnl Check for pthreads
-dnl We use pthreads when doing ASYNC I/O
-if test "$with_pthreads" = "yes"; then
-    SQUID_CFLAGS="$SQUID_CFLAGS -D_REENTRANT"
-    SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_REENTRANT"
-    case "$host" in
-    i386-unknown-freebsd*)
-        if test "$GCC" = "yes" ; then
-            if test -z "$PRESET_LDFLAGS"; then
-                LDFLAGS="$LDFLAGS -pthread"
-            fi
-        fi
-    ;;
-    *-solaris2.*)
-        if test "$GCC" = "yes" ; then
-           SQUID_CFLAGS="$SQUID_CFLAGS -pthreads"
-           SQUID_CXXFLAGS="$SQUID_CXXFLAGS -pthreads"
-       else
-           SQUID_CFLAGS="$SQUID_CFLAGS -mt"
-           SQUID_CXXFLAGS="$SQUID_CXXFLAGS -mt"
-        fi
-    ;;
-    esac
-    AC_CHECK_LIB(pthread, main)
-fi
-
 dnl -lintl is needed on SCO version 3.2v4.2 for strftime()
 dnl Robert Side <rside@aiinc.bc.ca>
 dnl Mon, 18 Jan 1999 17:48:00 GMT