+Wed Aug 7 14:19:03 1996 Philippe De Muyter <phdm@info.ucl.ac.be>
+
+ * configure.in: Make GAS_CHECK_DECL_NEEDED include <string.h> or
+ <strings.h> 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 <strings.h> 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 <ian@cygnus.com>
* config/tc-mips.c (md_section_align): Do align if OBJ_ELF, but
#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
#ifdef HAVE_STRING_H
#include <string.h>
#else
+#ifdef HAVE_STRINGS_H
#include <strings.h>
#endif
+#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#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 ();
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 ();
\f
#include "flonum.h"
#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
#endif
#ifdef HAVE_STRING_H
#include <string.h>
+#else
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#endif
#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#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 <<EOF
+#line 2126 "configure"
+#include "confdefs.h"
+$gas_test_headers
+int main() { return 0; }
+int t() {
+
+typedef char *(*f)();
+f x;
+x = (f) strstr;
+
+; return 0; }
+EOF
+if { (eval echo configure:2138: \"$ac_link\") 1>&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 <<EOF
-#line 2122 "configure"
+#line 2162 "configure"
#include "confdefs.h"
$gas_test_headers
int main() { return 0; }
; return 0; }
EOF
-if { (eval echo configure:2134: \"$ac_link\") 1>&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
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2158 "configure"
+#line 2198 "configure"
#include "confdefs.h"
$gas_test_headers
int main() { return 0; }
; return 0; }
EOF
-if { (eval echo configure:2170: \"$ac_link\") 1>&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
}
+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 <<EOF
+#line 2234 "configure"
+#include "confdefs.h"
+$gas_test_headers
+int main() { return 0; }
+int t() {
+
+typedef char *(*f)();
+f x;
+x = (f) sbrk;
+
+; return 0; }
+EOF
+if { (eval echo configure:2246: \"$ac_link\") 1>&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?
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2197 "configure"
+#line 2273 "configure"
#include "confdefs.h"
#ifdef HAVE_ERRNO_H
; return 0; }
EOF
-if { (eval echo configure:2213: \"$ac_link\") 1>&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
#endif
#ifdef HAVE_STRING_H
#include <string.h>
+#else
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#endif
#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#include <unistd.h>
#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?