summaryrefslogtreecommitdiff
blob: dbbac65466c72564a30e438abad844e96946dd26 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
commit d6eab2e70fc5ccc82a73e5c988b76a229e4cd3d5
Author: Pádraig Brady <P@draigBrady.com>
Date:   Tue Jan 14 16:59:07 2014 +0000

    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.

diff --git a/m4/spawn_h.m4 b/m4/spawn_h.m4
index 87fe122..3eb835c 100644
--- a/m4/spawn_h.m4
+++ b/m4/spawn_h.m4
@@ -64,7 +64,15 @@ AC_DEFUN([gl_HAVE_POSIX_SPAWN],
   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