changeset 215:098ceea4133a

[gaim-migrate @ 225] -pthread works better than -lc_r on freebsd. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Wed, 03 May 2000 22:31:49 +0000
parents 2e0c2450280b
children f7e17fb767eb
files configure.in
diffstat 1 files changed, 40 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/configure.in	Wed May 03 21:38:49 2000 +0000
+++ b/configure.in	Wed May 03 22:31:49 2000 +0000
@@ -26,6 +26,46 @@
 	)
     )
 )
+dnl This is where it came straight from Mozilla.
+rm -f conftest*
+ac_cv_have_dash_pthread=no
+AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
+echo 'int main() { return 0; }' | cat > conftest.c
+${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
+if test $? -eq 0; then
+	if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
+		ac_cv_have_dash_pthread=yes
+		CFLAGS="$CFLAGS -pthread"
+	fi
+fi
+rm -f conftest*
+case "$target" in
+	*-*-freebsd*)
+		AC_DEFINE(_REENTRANT)
+		AC_DEFINE(_THREAD_SAFE)
+		if test "$ac_cv_have_dash_pthread" = "yes"; then
+			_PTHREAD_LDFLAGS=""
+		else
+			_PTHREAD_LDFLAGS="-lc_r"
+		fi
+		;;
+	*-*-linux*)
+		AC_DEFINE(_REENTRANT)
+		;;
+	*-*-os2*)
+		_PTHREAD_LDFLAGS=
+		;;
+	alpha*-*-osf*)
+		AC_DEFINE(_REENTRANT)
+		;;
+	*-*-solaris*)
+		AC_DEFINE(_REENTRANT)
+		if test ! "$GNU_CC"; then
+			CFLAGS="$CFLAGS -mt"
+		fi
+		;;
+esac
+AC_MSG_RESULT($ac_cv_have_dash_pthread)
 
 dnl Checks for typedefs, structures, and compiler characteristics.
 AC_C_CONST