changeset 17617:098e9f7b62e9

spawn: fix link error on uclibc * m4/spawn_h.m4 (gl_HAVE_POSIX_SPAWN): use AC_SEARCH_LIBS, to incorporate -lrt if needed (on uclibc for example). * modules/posix_spawn: Reference the substituted LIB.
author Pádraig Brady <P@draigBrady.com>
date Tue, 14 Jan 2014 16:59:07 +0000
parents 4d899884c95c
children 4941d0da6e24
files ChangeLog m4/spawn_h.m4 modules/posix_spawn
diffstat 3 files changed, 19 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sat Feb 22 00:41:38 2014 +0100
+++ b/ChangeLog	Tue Jan 14 16:59:07 2014 +0000
@@ -1,3 +1,10 @@
+2014-02-21  Pádraig Brady <P@draigBrady.com>
+
+	spawn: fix link error on uclibc
+	* m4/spawn_h.m4 (gl_HAVE_POSIX_SPAWN): use AC_SEARCH_LIBS,
+	to incorporate -lrt if needed (on uclibc for example).
+	* modules/posix_spawn: Reference the substituted LIB.
+
 2014-02-21  Thomas Petazzoni  <thomas.petazzoni@free-electrons.com>  (tiny change)
 	timer: fix uClibc detection of threading
 	* m4/time_time.m4 (gl_TIMER_TIME): Detect whether threads are
--- a/m4/spawn_h.m4	Sat Feb 22 00:41:38 2014 +0100
+++ b/m4/spawn_h.m4	Tue Jan 14 16:59:07 2014 +0000
@@ -64,7 +64,15 @@
   dnl once only, before all statements that occur in other macros.
   AC_REQUIRE([gl_SPAWN_H_DEFAULTS])
 
-  AC_CHECK_FUNCS_ONCE([posix_spawn])
+  LIB_POSIX_SPAWN=
+  AC_SUBST([LIB_POSIX_SPAWN])
+  gl_saved_libs=$LIBS
+    AC_SEARCH_LIBS([posix_spawn], [rt],
+                   [test "$ac_cv_search_posix_spawn" = "none required" ||
+                    LIB_POSIX_SPAWN=$ac_cv_search_posix_spawn])
+    AC_CHECK_FUNCS([posix_spawn])
+  LIBS=$gl_saved_libs
+
   if test $ac_cv_func_posix_spawn != yes; then
     HAVE_POSIX_SPAWN=0
   fi
--- a/modules/posix_spawn	Sat Feb 22 00:41:38 2014 +0100
+++ b/modules/posix_spawn	Tue Jan 14 16:59:07 2014 +0000
@@ -23,6 +23,9 @@
 Include:
 <spawn.h>
 
+Link:
+$(LIB_POSIX_SPAWN)
+
 License:
 LGPLv2+