Underscore prefix detection fix

Werner Koch wk at gnupg.org
Thu Jul 26 11:23:00 CEST 2007


On Wed,  4 Jul 2007 18:31, seto-kun at freesurf.ch said:

> The hardest part was to fix the problem in a clean way, which is
> somehow difficult with the way autoconf et al. works. It's also very

The actual problem is that some years ago we replaced our own parser for
symnols by the one provided by libtool.  Either we did this wrong (which
is entirely possible) ot libtool changed the name and semantic at some
point.  Because of the syntax error in the test (see below) I assume we
never really tested the test code on platforms which require an
underscore.

> One of the two things I fixed is independent of the autoconf version,
> though: a closing brace was forgotten in the conftest.c code.

Yes this is a major fault and lurking there since 2003 :-(.

> I hope it works for other people and can be integrated into the next
> version.

I applied this to the libgcrypt trunk (soon to be 1.3.1) for testing.
I'd appreciate if you can do that.  Here is the actual patch which might
also work for 1.2.4:

Index: acinclude.m4
===================================================================
--- acinclude.m4        (revision 1258)
+++ acinclude.m4        (working copy)
@@ -93,12 +93,12 @@
   [ac_cv_sys_symbol_underscore=no
    cat > conftest.$ac_ext <<EOF
       void nm_test_func(){}
-      int main(){nm_test_func;return 0;
+      int main(){nm_test_func;return 0;}
 EOF
   if AC_TRY_EVAL(ac_compile); then
     # Now try to grab the symbols.
     ac_nlist=conftest.nm
-    if AC_TRY_EVAL(NM conftest.$ac_objext \| $global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then
+    if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \| cut -d \' \' -f 2 \> $ac_nlist) && test -s "$ac_nlist"; then
       # See whether the symbols have a leading underscore.
       if egrep '^_nm_test_func' "$ac_nlist" >/dev/null; then
         ac_cv_sys_symbol_underscore=yes
@@ -110,7 +110,7 @@
         fi
       fi
     else
-      echo "configure: cannot run $global_symbol_pipe" >&AC_FD_CC
+      echo "configure: cannot run $lt_cv_sys_global_symbol_pipe" >&AC_FD_CC
     fi
   else
     echo "configure: failed program was:" >&AC_FD_CC


It is probably not a coincidence that this patch looks identical to
yours.  Note that pacthign configure is not suggested as this is build
by autoconf.  Run ./autogen.sh to re-create it.


Thanks,

  Werner




More information about the Gcrypt-devel mailing list