From 75b309856071124362b06d2c77f09141a8caa619 Mon Sep 17 00:00:00 2001
From: Raja R Harinath <harinath@src.gnome.org>
Date: Sun, 15 Feb 1998 23:13:49 +0000
Subject: Add `gnome-pthread-check.m4'. New file. Moved pthread check from

* Makefile.am (MACROS): Add `gnome-pthread-check.m4'.
* gnome-pthread-check.m4: New file.  Moved pthread check from
gnome-x-checks.m4 to here.
* gnome-objc-checks.m4: Use `gnome-pthread-check'.
(OBJC_LIBS): New config var.
* gnome-x-checks.m4: Add `AC_DEFINE(HAVE_LIBSM)' if `-lSM' is
already part of `$x_libs'.
Move pthread check to new file.

- Hari

svn path=/trunk/; revision=37
---
 macros/ChangeLog              | 11 +++++++++++
 macros/Makefile.am            |  2 +-
 macros/gnome-objc-checks.m4   | 13 +++++++------
 macros/gnome-pthread-check.m4 |  7 +++++++
 macros/gnome-x-checks.m4      |  6 ++----
 5 files changed, 28 insertions(+), 11 deletions(-)
 create mode 100644 macros/gnome-pthread-check.m4

diff --git a/macros/ChangeLog b/macros/ChangeLog
index c40333455d..72e47bd22b 100644
--- a/macros/ChangeLog
+++ b/macros/ChangeLog
@@ -1,3 +1,14 @@
+1998-02-15  Raja R Harinath  <harinath@cs.umn.edu>
+
+	* Makefile.am (MACROS): Add `gnome-pthread-check.m4'.
+	* gnome-pthread-check.m4: New file.  Moved pthread check from
+	gnome-x-checks.m4 to here.
+	* gnome-objc-checks.m4: Use `gnome-pthread-check'.
+	(OBJC_LIBS): New config var.
+	* gnome-x-checks.m4: Add `AC_DEFINE(HAVE_LIBSM)' if `-lSM' is
+	already part of `$x_libs'.
+	Move pthread check to new file.
+	
 Sat Feb 14 12:45:35 1998  Tom Tromey  <tromey@cygnus.com>
 
 	* Makefile.am (macros.dep): Use single quotes, not double quotes.
diff --git a/macros/Makefile.am b/macros/Makefile.am
index 8896eb18ab..0ea65e484e 100644
--- a/macros/Makefile.am
+++ b/macros/Makefile.am
@@ -1,7 +1,7 @@
 ## Please update this variable if any new macros are created
 MACROS= aclocal-include.m4 gnome-guile-checks.m4 \
 	gnome-objc-checks.m4 gnome-x-checks.m4 \
-	gnome-support.m4 gnome.m4 
+	gnome-support.m4 gnome-pthread-check.m4 gnome.m4 
 
 EXTRA_DIST=$(MACROS) autogen.sh macros.dep
 MAINTAINERCLEANFILES=macros.dep
diff --git a/macros/gnome-objc-checks.m4 b/macros/gnome-objc-checks.m4
index 472e46d891..bdf38a4d91 100644
--- a/macros/gnome-objc-checks.m4
+++ b/macros/gnome-objc-checks.m4
@@ -4,12 +4,13 @@ dnl Look for an ObjC compiler.
 dnl FIXME: extend list of possible names of ObjC compilers.
   AC_CHECK_PROGS(OBJC, $OBJC gcc, "")
 
-  oLIBS=$LIBS
-  LIBS="$LIBS $PTHREAD_LIB"
-  AC_SUBST(PTHREAD_LIB)
+  AC_REQUIRE([GNOME_PTHREAD_CHECK])
+
+  OBJC_LIBS="-lobjc $PTHREAD_LIB"
   AC_CHECK_FUNC(sched_yield,,[
-    AC_CHECK_LIB(posix4,sched_yield,PTHREAD_LIB="$PTHREAD_LIB -lposix4")])
-  LIBS=$oLIBS
+    AC_CHECK_LIB(posix4,sched_yield,
+		OBJC_LIBS="$OBJC_LIBS -lposix4",, $OBJC_LIBS)])
+  AC_SUBST(OBJC_LIBS)
 
   AC_CACHE_CHECK([if Objective C compiler ($OBJC) works],
 		 ac_cv_prog_objc_works, [
@@ -31,7 +32,7 @@ int main () {
 }
 EOF
 
-      $OBJC -o conftest $LDFLAGS conftest.m -lobjc $PTHREAD_LIB 1>&AC_FD_CC 2>&1
+      $OBJC -o conftest $LDFLAGS conftest.m $OBJC_LIBS 1>&AC_FD_CC 2>&1
       result=$?
       rm -f conftest*
 
diff --git a/macros/gnome-pthread-check.m4 b/macros/gnome-pthread-check.m4
new file mode 100644
index 0000000000..d7fec3fb41
--- /dev/null
+++ b/macros/gnome-pthread-check.m4
@@ -0,0 +1,7 @@
+AC_DEFUN([GNOME_PTHREAD_CHECK],[
+	PTHREAD_LIB=""
+	AC_CHECK_LIB(pthread, pthread_create, PTHREAD_LIB="-lpthread",
+		[AC_CHECK_LIB(c_r, pthread_create, PTHREAD_LIB="-lc_r")])
+	AC_SUBST(PTHREAD_LIB)
+	AC_PROVIDE([GNOME_PTHREAD_CHECK])
+])
diff --git a/macros/gnome-x-checks.m4 b/macros/gnome-x-checks.m4
index fef8a8fec8..c016435702 100644
--- a/macros/gnome-x-checks.m4
+++ b/macros/gnome-x-checks.m4
@@ -32,6 +32,7 @@ AC_DEFUN([GNOME_X_CHECKS],
 	case "$x_libs" in
 	 *-lSM*)
 	    # Already found it.
+	    AC_DEFINE(HAVE_LIBSM)
 	    ;;
 	 *)
 	    AC_CHECK_LIB(SM, SmcSaveYourselfDone,
@@ -55,10 +56,7 @@ AC_DEFUN([GNOME_X_CHECKS],
 	AC_CHECK_LIB(Xpm, XpmFreeXpmImage, [XPM_LIBS="-lXpm"], , $x_libs)
 	AC_SUBST(XPM_LIBS)
 
-	PTHREAD_LIB=""
-	AC_CHECK_LIB(pthread, pthread_create, PTHREAD_LIB="-lpthread",
-		[AC_CHECK_LIB(c_r, pthread_create, PTHREAD_LIB="-lc_r")])
-	AC_SUBST(PTHREAD_LIB)
+	AC_REQUIRE([GNOME_PTHREAD_CHECK])
 
         CFLAGS="$saved_cflags $X_CFLAGS"
         LDFLAGS="$saved_ldflags"
-- 
cgit