summaryrefslogtreecommitdiff
path: root/gcc/aclocal.m4
diff options
context:
space:
mode:
authorghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>1998-09-03 06:52:00 +0000
committerghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>1998-09-03 06:52:00 +0000
commit259a120e2ed841f4806427ef156d99cf3646d9e7 (patch)
tree9e61a0b27315e42bdf092bca252dacbc8c333d21 /gcc/aclocal.m4
parent016523bb897c93ae63ac79d635c718f48f585353 (diff)
downloadgcc-259a120e2ed841f4806427ef156d99cf3646d9e7.tar.gz
* aclocal.m4 (GCC_HEADER_STRING): New macro to detect if it is
safe to include both string.h and strings.h together. (GCC_NEED_DECLARATION): Test STRING_WITH_STRINGS when deciding which headers to search for function declarations. Continue to prefer string.h over strings.h when both are not acceptable. * acconfig.h (STRING_WITH_STRINGS): Add stub. * configure.in: Call GCC_HEADER_STRING. * system.h: Test STRING_WITH_STRINGS when deciding which headers to include. Continue to prefer string.h over strings.h when both are not acceptable. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@22204 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/aclocal.m4')
-rw-r--r--gcc/aclocal.m426
1 files changed, 21 insertions, 5 deletions
diff --git a/gcc/aclocal.m4 b/gcc/aclocal.m4
index febe8a70054..ce44ba19eb9 100644
--- a/gcc/aclocal.m4
+++ b/gcc/aclocal.m4
@@ -1,3 +1,14 @@
+dnl See whether we can include both string.h and strings.h.
+AC_DEFUN(GCC_HEADER_STRING,
+[AC_CACHE_CHECK([whether string.h and strings.h may both be included],
+ gcc_cv_header_string,
+[AC_TRY_COMPILE([#include <string.h>
+#include <strings.h>], , gcc_cv_header_string=yes, gcc_cv_header_string=no)])
+if test $gcc_cv_header_string = yes; then
+ AC_DEFINE(STRING_WITH_STRINGS)
+fi
+])
+
dnl See whether we need a declaration for a function.
dnl GCC_NEED_DECLARATION(FUNCTION [, EXTRA-HEADER-FILES])
AC_DEFUN(GCC_NEED_DECLARATION,
@@ -5,12 +16,17 @@ AC_DEFUN(GCC_NEED_DECLARATION,
AC_CACHE_VAL(gcc_cv_decl_needed_$1,
[AC_TRY_COMPILE([
#include <stdio.h>
-#ifdef HAVE_STRING_H
-#include <string.h>
+#ifdef STRING_WITH_STRINGS
+# include <string.h>
+# include <strings.h>
#else
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
+# ifdef HAVE_STRING_H
+# include <string.h>
+# else
+# ifdef HAVE_STRINGS_H
+# include <strings.h>
+# endif
+# endif
#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>