[kaffe] CVS kaffe (guilhem): Semaphore detection fix.

Kaffe CVS cvs-commits at kaffe.org
Sat Jul 23 06:34:01 PDT 2005


PatchSet 6760 
Date: 2005/07/23 13:25:43
Author: guilhem
Branch: HEAD
Tag: (none) 
Log:
Semaphore detection fix.

	* configure.ac: Swapped some commands for semaphore detection.

	* m4/solarispthread.m4: Add semaphore library to PTHREAD_LIBS.

	* m4/semaphore.m4: Add pthread libraries to LDFLAGS for the test.

	* configure: Regenerated.

Members: 
	ChangeLog:1.4285->1.4286 
	configure:1.472->1.473 
	configure.ac:1.155->1.156 
	m4/semaphore.m4:1.3->1.4 
	m4/solarispthread.m4:1.3->1.4 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.4285 kaffe/ChangeLog:1.4286
--- kaffe/ChangeLog:1.4285	Fri Jul 22 11:42:49 2005
+++ kaffe/ChangeLog	Sat Jul 23 13:25:43 2005
@@ -1,3 +1,22 @@
+2005-07-23  Guilhem Lavaux  <guilhem at kaffe.org>
+
+	* configure.ac: Swapped some commands for semaphore detection.
+
+	* m4/solarispthread.m4: Add semaphore library to PTHREAD_LIBS.
+
+	* m4/semaphore.m4: Add pthread libraries to LDFLAGS for the test.
+	
+	* configure: Regenerated.
+	
+2005-07-22  Guilhem Lavaux  <guilhem at kaffe.org>
+
+	* m4/solaris_pthread.m4: Push the detected library into
+	THREADLIBS.
+
+	* configure.ac: Detect the library needed for semaphores before
+	checking semaphores themselves.
+	
+	* configure: Regenerated.
 2005-07-22  Guilhem Lavaux  <guilhem at kaffe.org>
 
 	* libraries/clib/awt/X/gra.c,
Index: kaffe/configure
diff -u kaffe/configure:1.472 kaffe/configure:1.473
--- kaffe/configure:1.472	Fri Jul 22 11:36:18 2005
+++ kaffe/configure	Sat Jul 23 13:25:48 2005
@@ -24485,6 +24485,142 @@
 
 
 
+	oldLIBS="$LIBS"
+	LIBS=
+	echo "$as_me:$LINENO: checking for library containing sem_init" >&5
+echo $ECHO_N "checking for library containing sem_init... $ECHO_C" >&6
+if test "${ac_cv_search_sem_init+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+ac_cv_search_sem_init=no
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char sem_init ();
+int
+main ()
+{
+sem_init ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_search_sem_init="none required"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+if test "$ac_cv_search_sem_init" = no; then
+  for ac_lib in rt posix4; do
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char sem_init ();
+int
+main ()
+{
+sem_init ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_search_sem_init="-l$ac_lib"
+break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+  done
+fi
+LIBS=$ac_func_search_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_search_sem_init" >&5
+echo "${ECHO_T}$ac_cv_search_sem_init" >&6
+if test "$ac_cv_search_sem_init" != no; then
+  test "$ac_cv_search_sem_init" = "none required" || LIBS="$ac_cv_search_sem_init $LIBS"
+  PTHREAD_LIBS="$PTHREAD_LIBS $LIBS"
+fi
+
+	LIBS="$oldLIBS"
+	case $Khost_os in
+		solaris*)
+			CPPFLAGS="$CPPFLAGS -D_POSIX_PTHREAD_SEMANTICS"
+			;;
+	esac
+
+
 
 for ac_header in semaphore.h
 do
@@ -24639,7 +24775,7 @@
 echo $ECHO_N "checking for working semaphores... $ECHO_C" >&6
   old_LDFLAGS="$LDFLAGS"
   old_CFLAGS="$CFLAGS"
-  LDFLAGS="$LDFLAGS $THREADLIBS $SEMAPHORE_LIB"
+  LDFLAGS="$LDFLAGS $PTHREAD_LIBS"
   CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
 
   if test "$cross_compiling" = yes; then
@@ -24716,139 +24852,6 @@
 echo "$as_me: error: Missing library libpthread, read FAQ/FAQ.pthreads" >&2;}
    { (exit 1); exit 1; }; }
 	fi
-
-
-	echo "$as_me:$LINENO: checking for library containing sem_init" >&5
-echo $ECHO_N "checking for library containing sem_init... $ECHO_C" >&6
-if test "${ac_cv_search_sem_init+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_func_search_save_LIBS=$LIBS
-ac_cv_search_sem_init=no
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-/* Override any gcc2 internal prototype to avoid an error.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char sem_init ();
-int
-main ()
-{
-sem_init ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_search_sem_init="none required"
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-fi
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-if test "$ac_cv_search_sem_init" = no; then
-  for ac_lib in rt posix4; do
-    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-/* Override any gcc2 internal prototype to avoid an error.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char sem_init ();
-int
-main ()
-{
-sem_init ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_search_sem_init="-l$ac_lib"
-break
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-fi
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-  done
-fi
-LIBS=$ac_func_search_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_search_sem_init" >&5
-echo "${ECHO_T}$ac_cv_search_sem_init" >&6
-if test "$ac_cv_search_sem_init" != no; then
-  test "$ac_cv_search_sem_init" = "none required" || LIBS="$ac_cv_search_sem_init $LIBS"
-
-fi
-
-	case $Khost_os in
-		solaris*)
-			CPPFLAGS="$CPPFLAGS -D_POSIX_PTHREAD_SEMANTICS"
-			;;
-	esac
 
 	VMLIBS="$VM_LIBS $PTHREAD_LIBS"
 	CPPFLAGS="$CPPFLAGS -D_REENTRANT"
Index: kaffe/configure.ac
diff -u kaffe/configure.ac:1.155 kaffe/configure.ac:1.156
--- kaffe/configure.ac:1.155	Tue Jul 19 23:21:11 2005
+++ kaffe/configure.ac	Sat Jul 23 13:25:54 2005
@@ -689,13 +689,13 @@
                      CC="$PTHREAD_CC"])
 	AC_CHECK_LIB(semaphore,sem_init,SEMAPHORE_LIB="-lsemaphore")
 	AC_SUBST(SEMAPHORE_LIB)
+	KAFFE_LIB_SOLARIS_PTHREAD
 	KAFFE_CHECK_SEMAPHORE
 
 	if test -z "$THREADLIBS"; then
 		AC_MSG_ERROR([Missing library libpthread, read FAQ/FAQ.pthreads])
 	fi
 
-	KAFFE_LIB_SOLARIS_PTHREAD
 	VMLIBS="$VM_LIBS $PTHREAD_LIBS"
 	CPPFLAGS="$CPPFLAGS -D_REENTRANT"
  else
Index: kaffe/m4/semaphore.m4
diff -u kaffe/m4/semaphore.m4:1.3 kaffe/m4/semaphore.m4:1.4
--- kaffe/m4/semaphore.m4:1.3	Sun Feb  6 17:40:30 2005
+++ kaffe/m4/semaphore.m4	Sat Jul 23 13:25:55 2005
@@ -12,7 +12,7 @@
   AC_MSG_CHECKING([for working semaphores])
   old_LDFLAGS="$LDFLAGS"
   old_CFLAGS="$CFLAGS"
-  LDFLAGS="$LDFLAGS $THREADLIBS $SEMAPHORE_LIB"
+  LDFLAGS="$LDFLAGS $PTHREAD_LIBS"
   CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
 
   AC_RUN_IFELSE(AC_LANG_PROGRAM(
Index: kaffe/m4/solarispthread.m4
diff -u kaffe/m4/solarispthread.m4:1.3 kaffe/m4/solarispthread.m4:1.4
--- kaffe/m4/solarispthread.m4:1.3	Sat Jul 17 07:58:58 2004
+++ kaffe/m4/solarispthread.m4	Sat Jul 23 13:25:55 2005
@@ -5,7 +5,10 @@
 AC_DEFUN([KAFFE_LIB_SOLARIS_PTHREAD],
 
 [
-	AC_SEARCH_LIBS([sem_init],[rt posix4])
+	oldLIBS="$LIBS"
+	LIBS=
+	AC_SEARCH_LIBS([sem_init],[rt posix4],[PTHREAD_LIBS="$PTHREAD_LIBS $LIBS"])
+	LIBS="$oldLIBS"
 	case $Khost_os in
 		solaris*)
 			CPPFLAGS="$CPPFLAGS -D_POSIX_PTHREAD_SEMANTICS"




More information about the kaffe mailing list