From fef1696ffcfaeb438ebd8c519edd3baf212b76e7 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 21 Aug 1996 01:02:53 +0000 Subject: [PATCH] * aclocal.m4: Include ../bfd/aclocal.m4. * configure.in: Add stdlib.h to AC_CHECK_HEADERS. Call BFD_NEED_DECLARATION on malloc, realloc, and free. * acconfig.h: Add NEED_DECLARATION_MALLOC, NEED_DECLARATION_REALLOC, and NEED_DECLARATION_FREE. * configure, config.in: Rebuild. * defs.h: Include and based on HAVE_*_H rather than __STDC__. Only declare malloc, realloc, and free if NEED_DECLARATION_* is defined. --- gdb/ChangeLog | 12 ++++ gdb/acconfig.h | 10 ++++ gdb/aclocal.m4 | 2 + gdb/config.in | 15 +++++ gdb/configure | 152 +++++++++++++++++++++++++++++++++++++++++++++-- gdb/configure.in | 6 +- 6 files changed, 191 insertions(+), 6 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index ce80109091e..12c9c288d28 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,15 @@ +Tue Aug 20 17:59:42 1996 Ian Lance Taylor + + * aclocal.m4: Include ../bfd/aclocal.m4. + * configure.in: Add stdlib.h to AC_CHECK_HEADERS. Call + BFD_NEED_DECLARATION on malloc, realloc, and free. + * acconfig.h: Add NEED_DECLARATION_MALLOC, + NEED_DECLARATION_REALLOC, and NEED_DECLARATION_FREE. + * configure, config.in: Rebuild. + * defs.h: Include and based on HAVE_*_H + rather than __STDC__. Only declare malloc, realloc, and free if + NEED_DECLARATION_* is defined. + Tue Aug 20 15:37:03 1996 Fred Fish * solib.c (_initialize_solib): Add missing '\' chars at ends of diff --git a/gdb/acconfig.h b/gdb/acconfig.h index 34fa8c8dd3c..fc7ce7c6207 100644 --- a/gdb/acconfig.h +++ b/gdb/acconfig.h @@ -1,4 +1,14 @@ +/* Whether malloc must be declared even if is included. */ +#undef NEED_DECLARATION_MALLOC + +/* Whether realloc must be declared even if is included. */ +#undef NEED_DECLARATION_REALLOC + +/* Whether free must be declared even if is included. */ +#undef NEED_DECLARATION_FREE +@TOP@ + /* Define if fpregset_t type is available. */ #undef HAVE_FPREGSET_T diff --git a/gdb/aclocal.m4 b/gdb/aclocal.m4 index 5cfd7d470f7..770d1488524 100644 --- a/gdb/aclocal.m4 +++ b/gdb/aclocal.m4 @@ -1,6 +1,8 @@ dnl written by Rob Savoye for Cygnus Support dnl major rewriting for Tcl 7.5 by Don Libes +sinclude(../bfd/aclocal.m4) + dnl CY_AC_PATH_TCLCONFIG and CY_AC_LOAD_TCLCONFIG should be invoked dnl (in that order) before any other TCL macros. Similarly for TK. diff --git a/gdb/config.in b/gdb/config.in index ef77c89954d..a3b3e51f175 100644 --- a/gdb/config.in +++ b/gdb/config.in @@ -1,5 +1,14 @@ /* config.in. Generated automatically from configure.in by autoheader. */ +/* Whether malloc must be declared even if is included. */ +#undef NEED_DECLARATION_MALLOC + +/* Whether realloc must be declared even if is included. */ +#undef NEED_DECLARATION_REALLOC + +/* Whether free must be declared even if is included. */ +#undef NEED_DECLARATION_FREE + /* Define if on AIX 3. System headers sometimes define this. We just want to avoid a redefinition error message. */ @@ -7,6 +16,9 @@ #undef _ALL_SOURCE #endif +/* Define to empty if the keyword does not work. */ +#undef const + /* Define if the `long double' type works. */ #undef HAVE_LONG_DOUBLE @@ -77,6 +89,9 @@ /* Define if you have the header file. */ #undef HAVE_STDDEF_H +/* Define if you have the header file. */ +#undef HAVE_STDLIB_H + /* Define if you have the header file. */ #undef HAVE_STRING_H diff --git a/gdb/configure b/gdb/configure index 75f6d460110..a836d32ba07 100755 --- a/gdb/configure +++ b/gdb/configure @@ -1333,7 +1333,7 @@ EOF fi -for ac_hdr in limits.h memory.h string.h strings.h unistd.h termios.h termio.h sgtty.h stddef.h sys/procfs.h link.h endian.h +for ac_hdr in limits.h memory.h string.h strings.h unistd.h termios.h termio.h sgtty.h stddef.h stdlib.h sys/procfs.h link.h endian.h do ac_safe=`echo "$ac_hdr" | tr './\055' '___'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 @@ -1913,6 +1913,148 @@ EOF fi +echo $ac_n "checking whether malloc must be declared""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'bfd_cv_decl_needed_malloc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#ifdef HAVE_STRING_H +#include +#else +#ifdef HAVE_STRINGS_H +#include +#endif +#endif +#ifdef HAVE_STDLIB_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif +int main() { return 0; } +int t() { +char *(*pfn) = (char *(*)) malloc +; return 0; } +EOF +if { (eval echo configure:1944: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + bfd_cv_decl_needed_malloc=no +else + rm -rf conftest* + bfd_cv_decl_needed_malloc=yes +fi +rm -f conftest* + +fi + +echo "$ac_t""$bfd_cv_decl_needed_malloc" 1>&6 +if test $bfd_cv_decl_needed_malloc = yes; then + bfd_tr_decl=NEED_DECLARATION_`echo malloc | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 +if eval "test \"`echo '$''{'bfd_cv_decl_needed_realloc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#ifdef HAVE_STRING_H +#include +#else +#ifdef HAVE_STRINGS_H +#include +#endif +#endif +#ifdef HAVE_STDLIB_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif +int main() { return 0; } +int t() { +char *(*pfn) = (char *(*)) realloc +; return 0; } +EOF +if { (eval echo configure:1991: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + bfd_cv_decl_needed_realloc=no +else + rm -rf conftest* + bfd_cv_decl_needed_realloc=yes +fi +rm -f conftest* + +fi + +echo "$ac_t""$bfd_cv_decl_needed_realloc" 1>&6 +if test $bfd_cv_decl_needed_realloc = yes; then + bfd_tr_decl=NEED_DECLARATION_`echo realloc | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 +if eval "test \"`echo '$''{'bfd_cv_decl_needed_free'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#ifdef HAVE_STRING_H +#include +#else +#ifdef HAVE_STRINGS_H +#include +#endif +#endif +#ifdef HAVE_STDLIB_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif +int main() { return 0; } +int t() { +char *(*pfn) = (char *(*)) free +; return 0; } +EOF +if { (eval echo configure:2038: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + bfd_cv_decl_needed_free=no +else + rm -rf conftest* + bfd_cv_decl_needed_free=yes +fi +rm -f conftest* + +fi + +echo "$ac_t""$bfd_cv_decl_needed_free" 1>&6 +if test $bfd_cv_decl_needed_free = yes; then + bfd_tr_decl=NEED_DECLARATION_`echo free | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2316: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2458: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -2439,12 +2581,12 @@ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2448: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2590: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* diff --git a/gdb/configure.in b/gdb/configure.in index a8ffc6ad726..42ffb2e1a5e 100644 --- a/gdb/configure.in +++ b/gdb/configure.in @@ -39,7 +39,7 @@ AC_CANONICAL_SYSTEM AC_ARG_PROGRAM AC_HEADER_STDC -AC_CHECK_HEADERS(limits.h memory.h string.h strings.h unistd.h termios.h termio.h sgtty.h stddef.h sys/procfs.h link.h endian.h) +AC_CHECK_HEADERS(limits.h memory.h string.h strings.h unistd.h termios.h termio.h sgtty.h stddef.h stdlib.h sys/procfs.h link.h endian.h) AC_HEADER_STAT AC_C_CONST @@ -133,6 +133,10 @@ AC_MSG_RESULT($gdb_cv_printf_has_long_double) AC_FUNC_MMAP +BFD_NEED_DECLARATION(malloc) +BFD_NEED_DECLARATION(realloc) +BFD_NEED_DECLARATION(free) + dnl See if thread_db library is around for Solaris thread debugging. Note that dnl we must explicitly test for version 1 of the library because version 0 dnl (present on Solaris 2.4 or earlier) doesn't have the same API. -- 2.30.2