bug-gnulib
[Top][All Lists]
Advanced

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

Re: gnulib taking over libobjs?


From: Simon Josefsson
Subject: Re: gnulib taking over libobjs?
Date: Thu, 05 Oct 2006 15:47:37 +0200
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.50 (gnu/linux)

Here is a working prototype.  It solved the problem with two gnulib
directories for me in libidn, i.e., no more complaints that AC_LIBOBJ
files are not found in all gnulib directories.

It was slightly more complicated than I thought, because of libtool,
and I had to copy a function from autoconf and modify it somewhat.

Unfortunately (or not), my host doesn't trigger any AC_LIBOBJ's to be
built in any of libidn's two gnulib directories, so I'm not certain
that this works fully.

I'll do further tests on other platforms, but if someone else wants to
experiment, here is the patch to gnulib-tool.

/Simon

--- gnulib-tool 02 Oct 2006 16:44:03 +0200      1.175
+++ gnulib-tool 05 Oct 2006 15:39:23 +0200      
@@ -1067,6 +1067,7 @@
 # - libname         library name
 # - makefile_name   from --makefile-name
 # - libtool         true if libtool will be used, false or blank otherwise
+# - macro_prefix    prefix of gl_LIBOBJS macros to use
 # - actioncmd       (optional) command that will reproduce this invocation
 func_emit_lib_Makefile_am ()
 {
@@ -1136,7 +1137,7 @@
   echo "${libname}_${libext}_SOURCES ="
   # Here we use $(LIBOBJS), not @address@hidden The value is the same. However,
   # automake during its analyses looks for $(LIBOBJS), not for @address@hidden
-  echo "${libname}_${libext}_LIBADD = \$(${perhapsLT}LIBOBJS)"
+  echo "${libname}_${libext}_LIBADD = \$(${macro_prefix}_${perhapsLT}LIBOBJS)"
   if test "$libtool" = true; then
     echo "${libname}_${libext}_LDFLAGS = \$(AM_LDFLAGS)"
   fi
@@ -1877,6 +1878,8 @@
     echo "# \"Check for header files, types and library functions\"."
     echo "AC_DEFUN([${macro_prefix}_INIT],"
     echo "["
+    echo "  m4_pushdef([AC_LIBOBJ], m4_defn([${macro_prefix}_LIBOBJ]))"
+    echo "  m4_pushdef([AC_REPLACE_FUNCS], 
m4_defn([${macro_prefix}_REPLACE_FUNCS]))"
     if test "$libtool" = true; then
       echo "  AM_CONDITIONAL([GL_COND_LIBTOOL], [true])"
       echo "  gl_cond_libtool=true"
@@ -1922,7 +1925,34 @@
       echo "  ${libname_upper}_LTLIBDEPS=\"\$gl_ltlibdeps\""
       echo "  AC_SUBST([${libname_upper}_LTLIBDEPS])"
     fi
+    echo "  m4_popdef([AC_REPLACE_FUNCS])"
+    echo "  m4_popdef([AC_LIBOBJ])"
+    echo "  AC_CONFIG_COMMANDS_PRE(["
+    echo "    ${macro_prefix}_libobjs="
+    echo "    ${macro_prefix}_ltlibobjs="
+    echo "    for ac_i in : \$${macro_prefix}_LIBOBJS; do test \"x\$ac_i\" = 
x: && continue"
+    echo "      # 1. Remove the extension, and \$U if already installed."
+    echo "      ac_script='s/\\\$U\././;s/\.o\$//;s/\.obj\$//'"
+    echo "      ac_i=\`echo \"\$ac_i\" | sed \"\$ac_script\"\`"
+    echo "      # 2. Prepend LIBOBJDIR.  When used with automake>=1.10 
LIBOBJDIR"
+    echo "      #    will be set to the directory where 
${macro_prefix}_LIBOBJS objects are built."
+    echo "      ${macro_prefix}_libobjs=\"\$${macro_prefix}_libobjs 
\\\${LIBOBJDIR}\$ac_i\\\$U.\$ac_objext\""
+    echo "      ${macro_prefix}_ltlibobjs=\"\$${macro_prefix}_ltlibobjs 
\\\${LIBOBJDIR}\$ac_i\"'\$U.lo'"
+    echo "    done"
+    echo "    AC_SUBST([${macro_prefix}_LIBOBJS], [\$${macro_prefix}_libobjs])"
+    echo "    AC_SUBST([${macro_prefix}_LTLIBOBJS], 
[\$${macro_prefix}_ltlibobjs])"
+    echo "  ])"
     echo "])"
+
+    echo "# Like AC_LIBOBJ, except that the module name goes"
+    echo "# into ${macro_prefix}_LIBOBJS instead of into LIBOBJS."
+    echo "AC_DEFUN([${macro_prefix}_LIBOBJ],"
+    echo "  [${macro_prefix}_LIBOBJS=\"${macro_prefix}_LIBOBJS 
\$1.\$ac_objext\"])"
+    echo
+    echo "# Like AC_REPLACE_FUNCS, except that the module name goes"
+    echo "# into ${macro_prefix}_LIBOBJS instead of into LIBOBJS."
+    echo "AC_DEFUN([${macro_prefix}_REPLACE_FUNCS],"
+    echo "  [AC_CHECK_FUNCS([\$1], , [${macro_prefix}_LIBOBJ(\$ac_func)])])"
     echo
     echo "# This macro records the list of files which have been installed by"
     echo "# gnulib-tool and may be removed by future gnulib-tool invocations."




reply via email to

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