autoconf-patches
[Top][All Lists]
Advanced

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

Re: AC_CHECK_FUNCS always succeeds on AIX with Autoconf 2.56


From: Martin Frydl
Subject: Re: AC_CHECK_FUNCS always succeeds on AIX with Autoconf 2.56
Date: Tue, 19 Nov 2002 13:36:20 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1) Gecko/20020827

Hi,

I've looked into this problem and created patch. In fact I've only put back the original code while maintaining the current one, i.e. `f' is assigned both in global initialization and also in main(). I've tried this fix on Linux with gcc 2.96, Sun with gcc 2.95 and SunCC 7.0, HP-UX with gcc 3.0.4 and AIX with gcc 3.1.1 and IBM C/C++ 3.6.6. I'm not able to check it with unbundled cc A.05.36 for ia64 so someone probably should check it (this configuration is why the old test was changed).

        * lib/autoconf/c.m4 (AC_LANG_FUNC_LINK_TRY(C)): Put f=$1 also
        to main function to avoid optimizations on AIX.

  Regards
    Martin

P.S. Please reply directly to my e-mail since I'm not in autoconf-patches list.

Martin Frydl wrote:
Hello,

I've put AC_CHECK_FUNCS(stricmp) to configure.in and it always succeeds on AIX with both IBM compiler and gcc. The test looks something like this:

char strncasecmp ();
char (*f) () = strncasecmp;

int main () {
  return 0;
}

When this is compiled and linked, no error is reported. But when test from Autoconf 2.52 is used, everything works (i.e. reports error since stricmp is not available):

char stricmp ();
char (*f) ();

int main () {
  f = stricmp;
  return 0;
}

It looks like the first test is somehow "optimized" by compiler and thus is linkable. What about putting back the original test? Why was it changed?

  My configuration:
    AIX 4.3.3
    IBM C/C++ 3.6.6
    gcc 3.1.1

  Thanks
    Martin Frydl

? aix-func-check.patch
Index: c.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/c.m4,v
retrieving revision 1.172
diff -u -r1.172 c.m4
--- c.m4        13 Nov 2002 23:34:07 -0000      1.172
+++ c.m4        19 Nov 2002 12:24:36 -0000
@@ -170,6 +170,9 @@
 # unbundled cc A.05.36 for ia64 under +O3, presumably on the basis that
 # there's no need to do that store if the program is about to exit.
 #
+# Assignment f=$1 put also to main() because compilers on AIX seem to suffer
+# similar optimization if only global assignment is used.
+#
 m4_define([AC_LANG_FUNC_LINK_TRY(C)],
 [AC_LANG_PROGRAM(
 [/* System header to define __stub macros and hopefully few prototypes,
@@ -194,6 +197,15 @@
 #ifdef __cplusplus
 }
 #endif
+],
+[/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$1) || defined (__stub___$1) 
+choke me
+#else 
+f = $1;
+#endif 
 ])])
 
 

reply via email to

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