From 5cece5267784495835c2fb2fb4141612d4c3c02b Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 7 Aug 1996 18:23:08 +0000 Subject: [PATCH] Wed Aug 7 14:19:03 1996 Philippe De Muyter * configure.in: Make GAS_CHECK_DECL_NEEDED include or if they exist. Call GAS_CHECK_DECL_NEEDED on strstr and sbrk. * acconfig.h (NEED_DECLARATION_STRSTR): New macro. (NEED_DECLARATION_SBRK): New macro. * configure, conf.in: Rebuild. * as.h: Only include if HAVE_STRINGS_H. (strstr): Declare if NEED_DECLARATION_STRSTR. * as.c: If HAVE_SBRK and NEED_DECLARATION_SBRK, declare sbrk. --- gas/ChangeLog | 12 +++++++ gas/acconfig.h | 6 ++++ gas/as.h | 10 +++--- gas/conf.in | 6 ++++ gas/configure | 88 ++++++++++++++++++++++++++++++++++++++++++++---- gas/configure.in | 6 ++++ 6 files changed, 117 insertions(+), 11 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 2fe618d645..6380931873 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,15 @@ +Wed Aug 7 14:19:03 1996 Philippe De Muyter + + * configure.in: Make GAS_CHECK_DECL_NEEDED include or + if they exist. Call GAS_CHECK_DECL_NEEDED on strstr + and sbrk. + * acconfig.h (NEED_DECLARATION_STRSTR): New macro. + (NEED_DECLARATION_SBRK): New macro. + * configure, conf.in: Rebuild. + * as.h: Only include if HAVE_STRINGS_H. + (strstr): Declare if NEED_DECLARATION_STRSTR. + * as.c: If HAVE_SBRK and NEED_DECLARATION_SBRK, declare sbrk. + Wed Aug 7 11:50:26 1996 Ian Lance Taylor * config/tc-mips.c (md_section_align): Do align if OBJ_ELF, but diff --git a/gas/acconfig.h b/gas/acconfig.h index 1626d38b5d..d2ca454c74 100644 --- a/gas/acconfig.h +++ b/gas/acconfig.h @@ -17,12 +17,18 @@ #undef TARGET_OS #undef TARGET_VENDOR +/* Sometimes the system header files don't declare strstr. */ +#undef NEED_DECLARATION_STRSTR + /* Sometimes the system header files don't declare malloc and realloc. */ #undef NEED_DECLARATION_MALLOC /* Sometimes the system header files don't declare free. */ #undef NEED_DECLARATION_FREE +/* Sometimes the system header files don't declare sbrk. */ +#undef NEED_DECLARATION_SBRK + /* Sometimes errno.h doesn't declare errno itself. */ #undef NEED_DECLARATION_ERRNO diff --git a/gas/as.h b/gas/as.h index f796178ebf..66d385c7df 100644 --- a/gas/as.h +++ b/gas/as.h @@ -79,8 +79,10 @@ void *alloca (); #ifdef HAVE_STRING_H #include #else +#ifdef HAVE_STRINGS_H #include #endif +#endif #ifdef HAVE_STDLIB_H #include #endif @@ -145,6 +147,9 @@ void *alloca (); #endif /* !__MWERKS__ */ /* Other stuff from config.h. */ +#ifdef NEED_DECLARATION_STRSTR +extern char *strstr (); +#endif #ifdef NEED_DECLARATION_MALLOC extern PTR malloc (); extern PTR realloc (); @@ -212,11 +217,6 @@ extern PTR bfd_alloc_by_size_t PARAMS ((bfd *abfd, size_t sz)); as_fatal("Case value %ld unexpected at line %d of file \"%s\"\n", \ (long) val, __LINE__, __FILE__); \ } - -/* Version 2.1 of Solaris had problems with this declaration, but I - think that bug has since been fixed. If it causes problems on your - system, just delete it. */ -extern char *strstr (); #include "flonum.h" diff --git a/gas/conf.in b/gas/conf.in index 5260c3063e..29288ba7da 100644 --- a/gas/conf.in +++ b/gas/conf.in @@ -44,12 +44,18 @@ #undef TARGET_OS #undef TARGET_VENDOR +/* Sometimes the system header files don't declare strstr. */ +#undef NEED_DECLARATION_STRSTR + /* Sometimes the system header files don't declare malloc and realloc. */ #undef NEED_DECLARATION_MALLOC /* Sometimes the system header files don't declare free. */ #undef NEED_DECLARATION_FREE +/* Sometimes the system header files don't declare sbrk. */ +#undef NEED_DECLARATION_SBRK + /* Sometimes errno.h doesn't declare errno itself. */ #undef NEED_DECLARATION_ERRNO diff --git a/gas/configure b/gas/configure index 5cb7b8df3e..459c9fdfed 100755 --- a/gas/configure +++ b/gas/configure @@ -2104,6 +2104,10 @@ gas_test_headers=" #endif #ifdef HAVE_STRING_H #include +#else +#ifdef HAVE_STRINGS_H +#include +#endif #endif #ifdef HAVE_STDLIB_H #include @@ -2113,12 +2117,48 @@ gas_test_headers=" #endif " +echo $ac_n "checking whether declaration is required for strstr""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'gas_cv_decl_needed_strstr'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; }; then + rm -rf conftest* + gas_cv_decl_needed_strstr=no +else + rm -rf conftest* + gas_cv_decl_needed_strstr=yes +fi +rm -f conftest* + +fi +echo "$ac_t""$gas_cv_decl_needed_strstr" 1>&6 +test $gas_cv_decl_needed_strstr = no || { + cat >> confdefs.h <<\EOF +#define NEED_DECLARATION_STRSTR 1 +EOF + +} + + echo $ac_n "checking whether declaration is required for malloc""... $ac_c" 1>&6 if eval "test \"`echo '$''{'gas_cv_decl_needed_malloc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; }; then +if { (eval echo configure:2174: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then rm -rf conftest* gas_cv_decl_needed_malloc=no else @@ -2154,7 +2194,7 @@ if eval "test \"`echo '$''{'gas_cv_decl_needed_free'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; }; then +if { (eval echo configure:2210: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then rm -rf conftest* gas_cv_decl_needed_free=no else @@ -2185,6 +2225,42 @@ EOF } +echo $ac_n "checking whether declaration is required for sbrk""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'gas_cv_decl_needed_sbrk'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; }; then + rm -rf conftest* + gas_cv_decl_needed_sbrk=no +else + rm -rf conftest* + gas_cv_decl_needed_sbrk=yes +fi +rm -f conftest* + +fi +echo "$ac_t""$gas_cv_decl_needed_sbrk" 1>&6 +test $gas_cv_decl_needed_sbrk = no || { + cat >> confdefs.h <<\EOF +#define NEED_DECLARATION_SBRK 1 +EOF + +} + + # Does errno.h declare errno, or do we have to add a separate declaration # for it? @@ -2193,7 +2269,7 @@ if eval "test \"`echo '$''{'gas_cv_decl_needed_errno'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; }; then +if { (eval echo configure:2289: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then rm -rf conftest* gas_cv_decl_needed_errno=no else diff --git a/gas/configure.in b/gas/configure.in index 0b535c6d20..98977c23d4 100644 --- a/gas/configure.in +++ b/gas/configure.in @@ -656,6 +656,10 @@ gas_test_headers=" #endif #ifdef HAVE_STRING_H #include +#else +#ifdef HAVE_STRINGS_H +#include +#endif #endif #ifdef HAVE_STDLIB_H #include @@ -664,8 +668,10 @@ gas_test_headers=" #include #endif " +GAS_CHECK_DECL_NEEDED(strstr, f, char *(*f)(), $gas_test_headers) GAS_CHECK_DECL_NEEDED(malloc, f, char *(*f)(), $gas_test_headers) GAS_CHECK_DECL_NEEDED(free, f, void (*f)(), $gas_test_headers) +GAS_CHECK_DECL_NEEDED(sbrk, f, char *(*f)(), $gas_test_headers) # Does errno.h declare errno, or do we have to add a separate declaration # for it? -- 2.34.1