Bug 18829
Summary: | autoconf broken with c++ in AC_TRY_RUN | ||
---|---|---|---|
Product: | [Retired] Red Hat Linux | Reporter: | Stefan Sorensen <sts> |
Component: | autoconf | Assignee: | Jens Petersen <petersen> |
Status: | CLOSED RAWHIDE | QA Contact: | David Lawrence <dkl> |
Severity: | medium | Docs Contact: | |
Priority: | medium | ||
Version: | 7.0 | CC: | kkaugars, murrayc, petersen, swebster, tanner |
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | i386 | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2001-07-10 11:02:46 UTC | Type: | --- |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Stefan Sorensen
2000-10-10 16:35:25 UTC
This bug also cause a fatal error when we install the gtkmm and make new apps that uses AM_PATH_GTKMM macro in its configure.in. But I think this is better patch for this. Thank you. --- autoconf-2.13/acgeneral.m4.orig Tue Jan 5 22:27:37 1999 +++ autoconf-2.13/acgeneral.m4 Sun Nov 12 04:17:10 2000 @@ -1818,7 +1818,7 @@ [#]line __oline__ "configure" #include "confdefs.h" ifelse(AC_LANG, CPLUSPLUS, [#ifdef __cplusplus -extern "C" void exit(int); +extern "C" void exit(int) throw(); #endif ])dnl [$1] Looks like there functional prototype is in more then just acgeneral.m4 . # pwd /usr/share/autoconf # grep -i 'extern "C" void exit(int)' * acgeneral.m4:extern "C" void exit(int) throw(); autoconf.m4f:extern "C" void exit(int); autoheader.m4f:extern "C" void exit(int); Trying to compile gnomemm-1.1.14 on Redhat 7.0 I applied the above patch to acgeneral.m4 $ pwd /usr/src/redhat/BUILD/gnomemm-1.1.14 Make sure to remove old configure and rebuild it $ rm configure $ automake ; autoconf $ ./configure --prefix=/usr --disable-maintainer-mode --disable-static --enable-shared --enable-docs checking for GTK-- - version >= 1.2.3... no *** Could not run GTK-- test program, checking why... $ grep -i 'extern "C" void exit(int)' * config.log:extern "C" void exit(int); configure:extern "C" void exit(int); configure:extern "C" void exit(int); That patch is not pickedup by automake or autoconf. So how wil this be resolved? Is it an autoconf bug, or a gcc bug? [Yukihiro Nakai's patch is in autoconf-2.13-10 (Red Hat 7.1).] And I checked that AC_LANG_CPLUSPLUS AC_TRY_RUN([#include <stdlib.h>], , AC_MSG_ERROR(Aaaaargh)) autoconf'ed ok with autoconf-2.13-10. Also configure of gnomemm runs ok (both 1.1.14 and 1.1.21). So since all the above seems to have been fixed in 7.1, I suggest that this bug can be closed. No, gnomemm configure works because we patched our own copies of aclocal, or edited the generated configure scripts before distributing gnomemm. Yukihiro Nakai's patch would not work because it would create configure scripts that worked on Redhat but not on other platforms. Our solution was to remove the void exit declaration line completely. To test any solution, you would need to autogen.sh gnomemm on both Redhat and an older distribution, then try to configure the resultant distributions on the other distributions. Thanks for the comment. So I back-ported _AC_PROG_CXX_EXIT_DECLARATION from autoconf-2.50, where this problem has already be addressed. The patch below should hopefully allow autoconf to generate configure files for C++ that will work on many platforms. I hope this makes C++ users happy. --- autoconf-2.13/acgeneral.m4~ Tue Jun 26 17:00:28 2001 +++ autoconf-2.13/acgeneral.m4 Tue Jun 26 17:00:28 2001 @@ -1817,10 +1817,6 @@ [cat > conftest.$ac_ext <<EOF [#]line __oline__ "configure" #include "confdefs.h" -ifelse(AC_LANG, CPLUSPLUS, [#ifdef __cplusplus -extern "C" void exit(int); -#endif -])dnl [$1] EOF if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null --- autoconf-2.13/acspecific.m4~ Tue Jun 26 17:04:34 2001 +++ autoconf-2.13/acspecific.m4 Tue Jun 26 17:04:34 2001 @@ -152,8 +152,41 @@ CXXFLAGS= fi fi + +AC_PROG_CXX_EXIT_DECLARATION ]) + +# AC_PROG_CXX_EXIT_DECLARATION +# ----------------------------- +# Find a valid prototype for exit and declare it in confdefs.h. +AC_DEFUN(AC_PROG_CXX_EXIT_DECLARATION, +[for ac_declaration in \ + ''\ + '#include <stdlib.h>' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + AC_TRY_COMPILE([#include <stdlib.h> +$ac_declaration], + [exit (42);], + [], + [continue]) + AC_TRY_COMPILE([$ac_declaration], + [exit (42);], + [break]) +done +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi +])# AC_PROG_CXX_EXIT_DECLARATION + + dnl Determine a Fortran 77 compiler to use. If `F77' is not already set dnl in the environment, check for `g77', `f77' and `f2c', in that order. dnl Set the output variable `F77' to the name of the compiler found. |