bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

relocatable-prog-wrapper thinko


From: Bruno Haible
Subject: relocatable-prog-wrapper thinko
Date: Sat, 21 May 2011 23:42:02 +0200
User-agent: KMail/1.9.9

The relocatable-prog-wrapper module compiles some source files to a
launcher program on the fly. When it does this, it requires some definitions
to be present in config.h, stdlib.h, and so on. This is the purpose of the
gl_FUNC_*_SEPARATE macro.

The comment for gl_FUNC_SETENV_SEPARATE says

  Like gl_FUNC_SETENV, except prepare for separate compilation (no AC_LIBOBJ).

The "No AC_LIBOBJ" restriction is because the relocatable-prog-wrapper does
not use libgnu.a, therefore there is no need to put these compilation units
into libgnu.a.

But there is also a second restriction: gl_FUNC_SETENV_SEPARATE must not set
REPLACE_SETENV to 1. Because if it did so, and the package uses the
setenv() function but not the 'setenv' module, then the REPLACE_SETENV=1
setting will cause stdlib.h to contain "#define setenv rpl_setenv", leading
to a link error of the package.

Likewise for the other dependencies of relocatable-prog-wrapper.


2011-05-21  Bruno Haible  <address@hidden>

        relocatable-prog-wrapper: Fix possible link error.
        * m4/setenv.m4 (gl_FUNC_SETENV_SEPARATE): Move determination of
        HAVE_SETENV and REPLACE_SETENV and AC_LIBOBJ invocation from here...
        (gl_FUNC_SETENV): ... to here.
        * m4/canonicalize.m4 (gl_CANONICALIZE_LGPL_SEPARATE): Update comment.
        * m4/readlink.m4 (gl_FUNC_READLINK_SEPARATE): Likewise.

--- m4/canonicalize.m4.orig     Sat May 21 23:36:56 2011
+++ m4/canonicalize.m4  Sat May 21 23:01:06 2011
@@ -1,4 +1,4 @@
-# canonicalize.m4 serial 18
+# canonicalize.m4 serial 19
 
 dnl Copyright (C) 2003-2007, 2009-2011 Free Software Foundation, Inc.
 
@@ -44,7 +44,7 @@
 ])
 
 # Like gl_CANONICALIZE_LGPL, except prepare for separate compilation
-# (no AC_LIBOBJ).
+# (no REPLACE_CANONICALIZE_FILE_NAME, no REPLACE_REALPATH, no AC_LIBOBJ).
 AC_DEFUN([gl_CANONICALIZE_LGPL_SEPARATE],
 [
   AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
--- m4/readlink.m4.orig Sat May 21 23:36:56 2011
+++ m4/readlink.m4      Sat May 21 22:59:45 2011
@@ -1,4 +1,4 @@
-# readlink.m4 serial 9
+# readlink.m4 serial 10
 dnl Copyright (C) 2003, 2007, 2009-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -48,7 +48,8 @@
   fi
 ])
 
-# Like gl_FUNC_READLINK, except prepare for separate compilation (no 
AC_LIBOBJ).
+# Like gl_FUNC_READLINK, except prepare for separate compilation
+# (no REPLACE_READLINK, no AC_LIBOBJ).
 AC_DEFUN([gl_FUNC_READLINK_SEPARATE],
 [
   AC_CHECK_FUNCS_ONCE([readlink])
--- m4/setenv.m4.orig   Sat May 21 23:36:56 2011
+++ m4/setenv.m4        Sat May 21 23:03:23 2011
@@ -1,4 +1,4 @@
-# setenv.m4 serial 21
+# setenv.m4 serial 22
 dnl Copyright (C) 2001-2004, 2006-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -7,20 +7,6 @@
 AC_DEFUN([gl_FUNC_SETENV],
 [
   AC_REQUIRE([gl_FUNC_SETENV_SEPARATE])
-  if test $HAVE_SETENV$REPLACE_SETENV != 10; then
-    AC_LIBOBJ([setenv])
-  fi
-])
-
-# Like gl_FUNC_SETENV, except prepare for separate compilation (no AC_LIBOBJ).
-AC_DEFUN([gl_FUNC_SETENV_SEPARATE],
-[
-  AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
-  AC_CHECK_DECLS_ONCE([setenv])
-  if test $ac_cv_have_decl_setenv = no; then
-    HAVE_DECL_SETENV=0
-  fi
-  AC_CHECK_FUNCS_ONCE([setenv])
   if test $ac_cv_func_setenv = no; then
     HAVE_SETENV=0
   else
@@ -50,9 +36,23 @@
       [gl_cv_func_setenv_works="guessing no"])])
     if test "$gl_cv_func_setenv_works" != yes; then
       REPLACE_SETENV=1
-      AC_LIBOBJ([setenv])
     fi
   fi
+  if test $HAVE_SETENV$REPLACE_SETENV != 10; then
+    AC_LIBOBJ([setenv])
+  fi
+])
+
+# Like gl_FUNC_SETENV, except prepare for separate compilation
+# (no REPLACE_SETENV, no AC_LIBOBJ).
+AC_DEFUN([gl_FUNC_SETENV_SEPARATE],
+[
+  AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
+  AC_CHECK_DECLS_ONCE([setenv])
+  if test $ac_cv_have_decl_setenv = no; then
+    HAVE_DECL_SETENV=0
+  fi
+  AC_CHECK_FUNCS_ONCE([setenv])
   gl_PREREQ_SETENV
 ])
 

-- 
In memoriam Alfred Grünberg <http://en.wikipedia.org/wiki/Alfred_Grünberg>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]