This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Tweak HAVE_DECL_LDGETNAME configure test for AIX

The following patch is a minor tweak to the gcc subdirectory's
configure test for HAVE_DECL_LDGETNAME.  Unfortunately on AIX,
the <ldfcn.h> system header conflicts with <fcntl.h> as both
define the macros FREAD and FWRITE.  This then leads to a spurious
failure of the configure test, which in turn leads to compile-time
warnings (or bootstrap errors) building collect2.c.

The following patch has been tested on powerpc-ibm-aix5.2.0.0 with
a top-level "make".

Ok for mainline?  Are such hacks ever obvious?

2004-11-24  Roger Sayle  <>

	* Tweak test for HAVE_DECL_LDGETNAME to avoid a
	system header conflict on AIX 5.2.
	* configure: Regenerate.

RCS file: /cvs/gcc/gcc/gcc/,v
retrieving revision 2.84
diff -c -3 -p -r2.84
***	22 Nov 2004 22:26:06 -0000	2.84
---	24 Nov 2004 15:32:59 -0000
*************** AC_TRY_COMPILE([
*** 1053,1062 ****
--- 1053,1068 ----
  ],[rlim_t l = 0;],,[AC_DEFINE([rlim_t],[long],
  [Define to \`long' if <sys/resource.h> doesn't define.])])

+ # On AIX 5.2, <ldfcn.h> conflicts with <fcntl.h>, as both define incompatible
+ # FREAD and FWRITE macros.  Fortunately, for GCC's single usage of ldgetname
+ # in collect2.c, <fcntl.h> isn't visible, but the configure test below needs
+ # to undef these macros to get the correct value for HAVE_DECL_LDGETNAME.
  gcc_AC_CHECK_DECLS(ldgetname, , ,[
  #include "ansidecl.h"
  #include "system.h"
  #ifdef HAVE_LDFCN_H
+ #undef FREAD
+ #undef FWRITE
  #include <ldfcn.h>

Roger Sayle,                         E-mail:
OpenEye Scientific Software,         WWW:
Suite 1107, 3600 Cerrillos Road,     Tel: (+1) 505-473-7385
Santa Fe, New Mexico, 87507.         Fax: (+1) 505-473-0833

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]