Commit ccc7d11a by Kaveh R. Ghazi Committed by Kaveh Ghazi

aclocal.m4 (GCC_HEADER_STRING): New macro to detect if it is safe to include…

aclocal.m4 (GCC_HEADER_STRING): New macro to detect if it is safe to include both string.h and strings.h together.

        * 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.

From-SVN: r22204
parent 127b53d5
Thu Sep 3 09:47:31 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* 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.
Wed Sep 2 23:56:29 1998 David S. Miller <davem@pierdol.cobaltmicro.com> Wed Sep 2 23:56:29 1998 David S. Miller <davem@pierdol.cobaltmicro.com>
* config/sparc/sparc.c (output_double_int): If V9 and MEDLOW, do * config/sparc/sparc.c (output_double_int): If V9 and MEDLOW, do
......
/* Define if you can safely include both <string.h> and <strings.h>. */
#undef STRING_WITH_STRINGS
/* Define if printf supports "%p". */ /* Define if printf supports "%p". */
#undef HAVE_PRINTF_PTR #undef HAVE_PRINTF_PTR
......
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 See whether we need a declaration for a function.
dnl GCC_NEED_DECLARATION(FUNCTION [, EXTRA-HEADER-FILES]) dnl GCC_NEED_DECLARATION(FUNCTION [, EXTRA-HEADER-FILES])
AC_DEFUN(GCC_NEED_DECLARATION, AC_DEFUN(GCC_NEED_DECLARATION,
...@@ -5,12 +16,17 @@ AC_DEFUN(GCC_NEED_DECLARATION, ...@@ -5,12 +16,17 @@ AC_DEFUN(GCC_NEED_DECLARATION,
AC_CACHE_VAL(gcc_cv_decl_needed_$1, AC_CACHE_VAL(gcc_cv_decl_needed_$1,
[AC_TRY_COMPILE([ [AC_TRY_COMPILE([
#include <stdio.h> #include <stdio.h>
#ifdef HAVE_STRING_H #ifdef STRING_WITH_STRINGS
#include <string.h> # include <string.h>
# include <strings.h>
#else #else
#ifdef HAVE_STRINGS_H # ifdef HAVE_STRING_H
#include <strings.h> # include <string.h>
#endif # else
# ifdef HAVE_STRINGS_H
# include <strings.h>
# endif
# endif
#endif #endif
#ifdef HAVE_STDLIB_H #ifdef HAVE_STDLIB_H
#include <stdlib.h> #include <stdlib.h>
......
/* config.in. Generated automatically from configure.in by autoheader. */ /* config.in. Generated automatically from configure.in by autoheader. */
/* Define if you can safely include both <string.h> and <strings.h>. */
#undef STRING_WITH_STRINGS
/* Define if printf supports "%p". */ /* Define if printf supports "%p". */
#undef HAVE_PRINTF_PTR #undef HAVE_PRINTF_PTR
......
...@@ -213,6 +213,7 @@ EGCS_PROG_INSTALL ...@@ -213,6 +213,7 @@ EGCS_PROG_INSTALL
AC_HEADER_STDC AC_HEADER_STDC
AC_HEADER_TIME AC_HEADER_TIME
GCC_HEADER_STRING
AC_CHECK_HEADERS(limits.h stddef.h string.h strings.h stdlib.h time.h fcntl.h unistd.h stab.h sys/file.h sys/time.h sys/resource.h sys/param.h sys/times.h wait.h sys/wait.h) AC_CHECK_HEADERS(limits.h stddef.h string.h strings.h stdlib.h time.h fcntl.h unistd.h stab.h sys/file.h sys/time.h sys/resource.h sys/param.h sys/times.h wait.h sys/wait.h)
# Check for thread headers. # Check for thread headers.
......
...@@ -88,11 +88,16 @@ ...@@ -88,11 +88,16 @@
extern int errno; extern int errno;
#endif #endif
#ifdef HAVE_STRING_H #ifdef STRING_WITH_STRINGS
# include <string.h> # include <string.h>
# include <strings.h>
#else #else
# ifdef HAVE_STRINGS_H # ifdef HAVE_STRING_H
# include <strings.h> # include <string.h>
# else
# ifdef HAVE_STRINGS_H
# include <strings.h>
# endif
# endif # endif
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment