aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorIain Sandoe <iain@sandoe.co.uk>2025-03-13 17:23:33 +0000
committerIain Sandoe <iain@sandoe.co.uk>2025-03-25 19:29:51 +0000
commit87d60bcba534b53255c19aae7d2d24ff7a1be414 (patch)
tree5661e16028d01042759d2c41192c34a89862e41c /gcc
parentf3d07779fdb729c7ee81b8e764921becf8ecf1d0 (diff)
downloadgcc-87d60bcba534b53255c19aae7d2d24ff7a1be414.zip
gcc-87d60bcba534b53255c19aae7d2d24ff7a1be414.tar.gz
gcc-87d60bcba534b53255c19aae7d2d24ff7a1be414.tar.bz2
gcc, configure: When checking for basename, use the same process as libiberty [PR119250].
We need the configure result from the decl check for basename() in the GCC configuration to match that obtained when configuring libiberty or we get conflicts when <libgen.h> is included in any TU that also includes "system.h" or "libiberty.h" directly. PR other/119250 gcc/ChangeLog: * config.in: Regenerate. * configure: Regenerate. * configure.ac: Match the configure test in libiberty when checking the basename decl. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
Diffstat (limited to 'gcc')
-rw-r--r--gcc/config.in10
-rwxr-xr-xgcc/configure18
-rw-r--r--gcc/configure.ac12
3 files changed, 29 insertions, 11 deletions
diff --git a/gcc/config.in b/gcc/config.in
index bc60d36..0d8a6ba 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -941,8 +941,8 @@
#endif
-/* Define to 1 if you have the declaration of `basename(const char*)', and to
- 0 if you don't. */
+/* Define to 1 if you have the declaration of `basename(char*)', and to 0 if
+ you don't. */
#ifndef USED_FOR_TARGET
#undef HAVE_DECL_BASENAME
#endif
@@ -1888,6 +1888,12 @@
#endif
+/* Define to 1 if you have the <libgen.h> header file. */
+#ifndef USED_FOR_TARGET
+#undef HAVE_LIBGEN_H
+#endif
+
+
/* Define to 1 if you have the <limits.h> header file. */
#ifndef USED_FOR_TARGET
#undef HAVE_LIMITS_H
diff --git a/gcc/configure b/gcc/configure
index ae1d349..063b9ce 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -9508,7 +9508,7 @@ fi
for ac_header in limits.h stddef.h string.h strings.h stdlib.h time.h iconv.h \
fcntl.h ftw.h unistd.h sys/auxv.h sys/file.h sys/time.h sys/mman.h \
sys/resource.h sys/param.h sys/times.h sys/stat.h sys/locking.h \
- direct.h malloc.h langinfo.h ldfcn.h locale.h wchar.h
+ direct.h malloc.h langinfo.h ldfcn.h locale.h wchar.h libgen.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_cxx_check_header_preproc "$LINENO" "$ac_header" "$as_ac_Header"
@@ -12121,10 +12121,14 @@ CXXFLAGS="$CXXFLAGS -I${srcdir} -I${srcdir}/../include $GMPINC"
# normal autoconf function for these. But force definition of
# HAVE_DECL_BASENAME like gcc_AC_CHECK_DECLS does, to suppress the bizarre
# basename handling in libiberty.h.
-as_ac_Symbol=`$as_echo "ac_cv_have_decl_basename(const char*)" | $as_tr_sh`
-ac_fn_cxx_check_decl "$LINENO" "basename(const char*)" "$as_ac_Symbol" "
+# Match the configure test in libiberty so that we have a consistent result.
+as_ac_Symbol=`$as_echo "ac_cv_have_decl_basename(char*)" | $as_tr_sh`
+ac_fn_cxx_check_decl "$LINENO" "basename(char*)" "$as_ac_Symbol" "
#undef HAVE_DECL_BASENAME
#define HAVE_DECL_BASENAME 1
+#if HAVE_LIBGEN_H
+# include <libgen.h>
+#endif
#include \"ansidecl.h\"
#include \"system.h\"
"
@@ -12137,10 +12141,10 @@ fi
cat >>confdefs.h <<_ACEOF
#define HAVE_DECL_BASENAME $ac_have_decl
_ACEOF
+
+
as_ac_Symbol=`$as_echo "ac_cv_have_decl_strstr(const char*,const char*)" | $as_tr_sh`
ac_fn_cxx_check_decl "$LINENO" "strstr(const char*,const char*)" "$as_ac_Symbol" "
-#undef HAVE_DECL_BASENAME
-#define HAVE_DECL_BASENAME 1
#include \"ansidecl.h\"
#include \"system.h\"
"
@@ -21480,7 +21484,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 21483 "configure"
+#line 21487 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -21586,7 +21590,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 21589 "configure"
+#line 21593 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 8ef11e3..3243472 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -1366,7 +1366,7 @@ AC_HEADER_TIOCGWINSZ
AC_CHECK_HEADERS(limits.h stddef.h string.h strings.h stdlib.h time.h iconv.h \
fcntl.h ftw.h unistd.h sys/auxv.h sys/file.h sys/time.h sys/mman.h \
sys/resource.h sys/param.h sys/times.h sys/stat.h sys/locking.h \
- direct.h malloc.h langinfo.h ldfcn.h locale.h wchar.h)
+ direct.h malloc.h langinfo.h ldfcn.h locale.h wchar.h libgen.h)
# Check for thread headers.
AC_CHECK_HEADER(thread.h, [have_thread_h=yes], [have_thread_h=])
@@ -1645,9 +1645,17 @@ CXXFLAGS="$CXXFLAGS -I${srcdir} -I${srcdir}/../include $GMPINC"
# normal autoconf function for these. But force definition of
# HAVE_DECL_BASENAME like gcc_AC_CHECK_DECLS does, to suppress the bizarre
# basename handling in libiberty.h.
-AC_CHECK_DECLS([basename(const char*), strstr(const char*,const char*)], , ,[
+# Match the configure test in libiberty so that we have a consistent result.
+AC_CHECK_DECLS([basename(char*)], , ,[
#undef HAVE_DECL_BASENAME
#define HAVE_DECL_BASENAME 1
+#if HAVE_LIBGEN_H
+# include <libgen.h>
+#endif
+#include "ansidecl.h"
+#include "system.h"])
+
+AC_CHECK_DECLS([strstr(const char*,const char*)], , ,[
#include "ansidecl.h"
#include "system.h"])