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: Tue, 10 Oct 2006 14:14:55 +0200
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.50 (gnu/linux)

Bruno Haible <address@hidden> writes:

>> @@ -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"
>
> I would use 'i' and 'sed_drop_objext' instead of the two identifiers
> starting with ac_. The prefix ac_ should be reserved to autoconf.
>
> I wouldn't use $U, because it's not a documented internal of autoconf.
> And we don't need it since we assume ANSI C.

Done.

> The use of LIBOBJDIR is wrong; you need to use ${sourcebase} instead.
> (Because there can be only one LIBOBJDIR per configure script, and
> we are doing this effort precisely to use several gnulib-tool invocations
> in a single configure script.)

Ok.  But is ${sourcebase} right?  It seems LIBOBJDIR would correspond
to the builddir of ${sourcebase}, which may be different from
${sourcebase}.

> Also, when you're done with the modification in func_import, please do the
> same to func_create_testdir, so that any problems that some modules might
> have in func_import already show up in func_create_testdir.

Meanwhile, here's an updated patch. I'll be testing it further.

/Simon

Index: gnulib-tool
===================================================================
RCS file: /sources/gnulib/gnulib/gnulib-tool,v
retrieving revision 1.176
diff -u -p -u -w -r1.176 gnulib-tool
--- gnulib-tool 7 Oct 2006 14:54:51 -0000       1.176
+++ gnulib-tool 10 Oct 2006 12:13:39 -0000
@@ -1067,6 +1067,7 @@ func_modules_to_filelist ()
 # - 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 ()
 {
@@ -1137,7 +1138,7 @@ func_emit_lib_Makefile_am ()
   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
@@ -1880,6 +1881,8 @@ func_import ()
     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"
@@ -1925,7 +1928,33 @@ func_import ()
       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 i in : \$${macro_prefix}_LIBOBJS; do test \"x\$i\" = x: && 
continue"
+    echo "      # 1. Remove the extension."
+    echo "      sed_drop_objext='s/\.o\$//;s/\.obj\$//'"
+    echo "      i=\`echo \"\$i\" | sed \"\$sed_drop_objext\"\`"
+    echo "      # 2. Prepend gnulib \${sourcebase}"
+    echo "      ${macro_prefix}_libobjs=\"\$${macro_prefix}_libobjs 
${sourcebase}\$i.\$ac_objext\""
+    echo "      ${macro_prefix}_ltlibobjs=\"\$${macro_prefix}_ltlibobjs 
${sourcebase}\$i.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]