diff options
-rw-r--r-- | gdb/ChangeLog | 10 | ||||
-rw-r--r-- | gdb/config.in | 47 | ||||
-rwxr-xr-x | gdb/configure | 966 | ||||
-rw-r--r-- | gdb/configure.ac | 14 | ||||
-rw-r--r-- | gdb/gdb_string.h | 10 | ||||
-rw-r--r-- | gdb/utils.c | 11 |
6 files changed, 431 insertions, 627 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index c6de86e..c733136 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,15 @@ 2005-01-21 Mark Kettenis <kettenis@gnu.org> + * configure.ac: Use AC_CHECK_DECLS instead of gcc_AC_CHECK_DECLS + and BFD_NEED_DECLARATION. Don't check if a declaration of strdup + is necessary. + * configure, config.in: Regenerate. + * utils.c: Adjust for usage of AC_CHECK_DECLS instead of + BFD_NEED_DECLARATION. Never provide a prototype for + caninicalize_file_name. + * gdb_string.h: Adjust for usage of AC_CHECK_DECLS instead of + BFD_NEED_DECLARATION. + * configure.ac (targ_archs): Use standard autoconf check for "struct stat.st_blocks" instead of rolling our own. * configure: Regenerated. diff --git a/gdb/config.in b/gdb/config.in index b9d8711..63b9e61 100644 --- a/gdb/config.in +++ b/gdb/config.in @@ -212,12 +212,34 @@ /* Define to 1 if you have the `dcgettext' function. */ #undef HAVE_DCGETTEXT -/* Define to 1 if we found this declaration otherwise define to 0. */ +/* Define to 1 if you have the declaration of `free', and to 0 if you don't. + */ +#undef HAVE_DECL_FREE + +/* Define to 1 if you have the declaration of `getopt', and to 0 if you don't. + */ #undef HAVE_DECL_GETOPT -/* Define to 1 if we found this declaration otherwise define to 0. */ +/* Define to 1 if you have the declaration of `malloc', and to 0 if you don't. + */ +#undef HAVE_DECL_MALLOC + +/* Define to 1 if you have the declaration of `ptrace', and to 0 if you don't. + */ #undef HAVE_DECL_PTRACE +/* Define to 1 if you have the declaration of `realloc', and to 0 if you + don't. */ +#undef HAVE_DECL_REALLOC + +/* Define to 1 if you have the declaration of `strerror', and to 0 if you + don't. */ +#undef HAVE_DECL_STRERROR + +/* Define to 1 if you have the declaration of `strstr', and to 0 if you don't. + */ +#undef HAVE_DECL_STRSTR + /* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'. */ #undef HAVE_DIRENT_H @@ -569,27 +591,6 @@ /* Define as const if the declaration of iconv() needs const. */ #undef ICONV_CONST -/* Define if canonicalize_file_name is not declared in system header files. */ -#undef NEED_DECLARATION_CANONICALIZE_FILE_NAME - -/* Define if free is not declared in system header files. */ -#undef NEED_DECLARATION_FREE - -/* Define if malloc is not declared in system header files. */ -#undef NEED_DECLARATION_MALLOC - -/* Define if realloc is not declared in system header files. */ -#undef NEED_DECLARATION_REALLOC - -/* Define if strdup is not declared in system header files. */ -#undef NEED_DECLARATION_STRDUP - -/* Define if strerror is not declared in system header files. */ -#undef NEED_DECLARATION_STRERROR - -/* Define if strstr is not declared in system header files. */ -#undef NEED_DECLARATION_STRSTR - /* Name of this package. */ #undef PACKAGE diff --git a/gdb/configure b/gdb/configure index 028e495..fb04516 100755 --- a/gdb/configure +++ b/gdb/configure @@ -13014,12 +13014,9 @@ done # Checks for declarations. # # ------------------------- # -for ac_func in getopt -do - ac_tr_decl=HAVE_DECL_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` -echo "$as_me:$LINENO: checking whether $ac_func is declared" >&5 -echo $ECHO_N "checking whether $ac_func is declared... $ECHO_C" >&6 -if eval "test \"\${gcc_cv_have_decl_$ac_func+set}\" = set"; then +echo "$as_me:$LINENO: checking whether free is declared" >&5 +echo $ECHO_N "checking whether free is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_free+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -13028,16 +13025,84 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#undef $ac_tr_decl -#define $ac_tr_decl 1 +$ac_includes_default +int +main () +{ +#ifndef free + char *p = (char *) free; +#endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_have_decl_free=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl_free=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_free" >&5 +echo "${ECHO_T}$ac_cv_have_decl_free" >&6 +if test $ac_cv_have_decl_free = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FREE 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FREE 0 +_ACEOF + +fi +echo "$as_me:$LINENO: checking whether malloc is declared" >&5 +echo $ECHO_N "checking whether malloc is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_malloc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default int main () { -#ifndef $ac_func -char *(*pfn) = (char *(*)) $ac_func ; +#ifndef malloc + char *p = (char *) malloc; #endif + ; return 0; } @@ -13064,39 +13129,318 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - eval "gcc_cv_have_decl_$ac_func=yes" + ac_cv_have_decl_malloc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -eval "gcc_cv_have_decl_$ac_func=no" +ac_cv_have_decl_malloc=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_malloc" >&5 +echo "${ECHO_T}$ac_cv_have_decl_malloc" >&6 +if test $ac_cv_have_decl_malloc = yes; then -if eval "test \"`echo '$gcc_cv_have_decl_'$ac_func`\" = yes"; then - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 ; cat >>confdefs.h <<_ACEOF -#define $ac_tr_decl 1 +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_MALLOC 1 _ACEOF + else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 ; cat >>confdefs.h <<_ACEOF -#define $ac_tr_decl 0 + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_MALLOC 0 _ACEOF + fi +echo "$as_me:$LINENO: checking whether realloc is declared" >&5 +echo $ECHO_N "checking whether realloc is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_realloc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef realloc + char *p = (char *) realloc; +#endif -done -if test x = y ; then + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_have_decl_realloc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -cat >>confdefs.h <<\_ACEOF +ac_cv_have_decl_realloc=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_realloc" >&5 +echo "${ECHO_T}$ac_cv_have_decl_realloc" >&6 +if test $ac_cv_have_decl_realloc = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_REALLOC 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_REALLOC 0 +_ACEOF + + +fi + + +echo "$as_me:$LINENO: checking whether strerror is declared" >&5 +echo $ECHO_N "checking whether strerror is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_strerror+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef strerror + char *p = (char *) strerror; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_have_decl_strerror=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl_strerror=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_strerror" >&5 +echo "${ECHO_T}$ac_cv_have_decl_strerror" >&6 +if test $ac_cv_have_decl_strerror = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_STRERROR 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_STRERROR 0 +_ACEOF + + +fi +echo "$as_me:$LINENO: checking whether strstr is declared" >&5 +echo $ECHO_N "checking whether strstr is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_strstr+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef strstr + char *p = (char *) strstr; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_have_decl_strstr=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl_strstr=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_strstr" >&5 +echo "${ECHO_T}$ac_cv_have_decl_strstr" >&6 +if test $ac_cv_have_decl_strstr = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_STRSTR 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_STRSTR 0 +_ACEOF + + +fi + + +echo "$as_me:$LINENO: checking whether getopt is declared" >&5 +echo $ECHO_N "checking whether getopt is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_getopt+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef getopt + char *p = (char *) getopt; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_have_decl_getopt=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl_getopt=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_getopt" >&5 +echo "${ECHO_T}$ac_cv_have_decl_getopt" >&6 +if test $ac_cv_have_decl_getopt = yes; then + +cat >>confdefs.h <<_ACEOF #define HAVE_DECL_GETOPT 1 _ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_GETOPT 0 +_ACEOF + + fi + # ----------------------- # # Checks for structures. # # ----------------------- # @@ -15850,12 +16194,9 @@ gdb_ptrace_headers=' #endif ' # There is no point in checking if we don't have a prototype. -for ac_func in ptrace -do - ac_tr_decl=HAVE_DECL_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` -echo "$as_me:$LINENO: checking whether $ac_func is declared" >&5 -echo $ECHO_N "checking whether $ac_func is declared... $ECHO_C" >&6 -if eval "test \"\${gcc_cv_have_decl_$ac_func+set}\" = set"; then +echo "$as_me:$LINENO: checking whether ptrace is declared" >&5 +echo $ECHO_N "checking whether ptrace is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_ptrace+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -15864,16 +16205,15 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#undef $ac_tr_decl -#define $ac_tr_decl 1 - $gdb_ptrace_headers +$gdb_ptrace_headers int main () { -#ifndef $ac_func -char *(*pfn) = (char *(*)) $ac_func ; +#ifndef ptrace + char *p = (char *) ptrace; #endif + ; return 0; } @@ -15900,40 +16240,35 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - eval "gcc_cv_have_decl_$ac_func=yes" + ac_cv_have_decl_ptrace=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -eval "gcc_cv_have_decl_$ac_func=no" +ac_cv_have_decl_ptrace=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_ptrace" >&5 +echo "${ECHO_T}$ac_cv_have_decl_ptrace" >&6 +if test $ac_cv_have_decl_ptrace = yes; then -if eval "test \"`echo '$gcc_cv_have_decl_'$ac_func`\" = yes"; then - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 ; cat >>confdefs.h <<_ACEOF -#define $ac_tr_decl 1 +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_PTRACE 1 _ACEOF + else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 ; cat >>confdefs.h <<_ACEOF -#define $ac_tr_decl 0 + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_PTRACE 0 _ACEOF + : ${gdb_cv_func_ptrace_ret='int'} : ${gdb_cv_func_ptrace_args='int,int,long,long'} fi -done -if test x = y ; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_DECL_PTRACE 1 -_ACEOF -fi # Check return type. echo "$as_me:$LINENO: checking return type of ptrace" >&5 @@ -17034,539 +17369,6 @@ _ACEOF fi -echo "$as_me:$LINENO: checking whether malloc must be declared" >&5 -echo $ECHO_N "checking whether malloc must be declared... $ECHO_C" >&6 -if test "${bfd_cv_decl_needed_malloc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -#include <stdio.h> -#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 -#ifdef HAVE_UNISTD_H -#include <unistd.h> -#endif -int -main () -{ -char *(*pfn) = (char *(*)) malloc - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - bfd_cv_decl_needed_malloc=no -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -bfd_cv_decl_needed_malloc=yes -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi - -echo "$as_me:$LINENO: result: $bfd_cv_decl_needed_malloc" >&5 -echo "${ECHO_T}$bfd_cv_decl_needed_malloc" >&6 -if test $bfd_cv_decl_needed_malloc = yes; then - -cat >>confdefs.h <<\_ACEOF -#define NEED_DECLARATION_MALLOC 1 -_ACEOF - -fi - -echo "$as_me:$LINENO: checking whether realloc must be declared" >&5 -echo $ECHO_N "checking whether realloc must be declared... $ECHO_C" >&6 -if test "${bfd_cv_decl_needed_realloc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -#include <stdio.h> -#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 -#ifdef HAVE_UNISTD_H -#include <unistd.h> -#endif -int -main () -{ -char *(*pfn) = (char *(*)) realloc - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - bfd_cv_decl_needed_realloc=no -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -bfd_cv_decl_needed_realloc=yes -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi - -echo "$as_me:$LINENO: result: $bfd_cv_decl_needed_realloc" >&5 -echo "${ECHO_T}$bfd_cv_decl_needed_realloc" >&6 -if test $bfd_cv_decl_needed_realloc = yes; then - -cat >>confdefs.h <<\_ACEOF -#define NEED_DECLARATION_REALLOC 1 -_ACEOF - -fi - -echo "$as_me:$LINENO: checking whether free must be declared" >&5 -echo $ECHO_N "checking whether free must be declared... $ECHO_C" >&6 -if test "${bfd_cv_decl_needed_free+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -#include <stdio.h> -#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 -#ifdef HAVE_UNISTD_H -#include <unistd.h> -#endif -int -main () -{ -char *(*pfn) = (char *(*)) free - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - bfd_cv_decl_needed_free=no -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -bfd_cv_decl_needed_free=yes -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi - -echo "$as_me:$LINENO: result: $bfd_cv_decl_needed_free" >&5 -echo "${ECHO_T}$bfd_cv_decl_needed_free" >&6 -if test $bfd_cv_decl_needed_free = yes; then - -cat >>confdefs.h <<\_ACEOF -#define NEED_DECLARATION_FREE 1 -_ACEOF - -fi - -echo "$as_me:$LINENO: checking whether strerror must be declared" >&5 -echo $ECHO_N "checking whether strerror must be declared... $ECHO_C" >&6 -if test "${bfd_cv_decl_needed_strerror+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -#include <stdio.h> -#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 -#ifdef HAVE_UNISTD_H -#include <unistd.h> -#endif -int -main () -{ -char *(*pfn) = (char *(*)) strerror - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - bfd_cv_decl_needed_strerror=no -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -bfd_cv_decl_needed_strerror=yes -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi - -echo "$as_me:$LINENO: result: $bfd_cv_decl_needed_strerror" >&5 -echo "${ECHO_T}$bfd_cv_decl_needed_strerror" >&6 -if test $bfd_cv_decl_needed_strerror = yes; then - -cat >>confdefs.h <<\_ACEOF -#define NEED_DECLARATION_STRERROR 1 -_ACEOF - -fi - -echo "$as_me:$LINENO: checking whether strdup must be declared" >&5 -echo $ECHO_N "checking whether strdup must be declared... $ECHO_C" >&6 -if test "${bfd_cv_decl_needed_strdup+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -#include <stdio.h> -#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 -#ifdef HAVE_UNISTD_H -#include <unistd.h> -#endif -int -main () -{ -char *(*pfn) = (char *(*)) strdup - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - bfd_cv_decl_needed_strdup=no -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -bfd_cv_decl_needed_strdup=yes -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi - -echo "$as_me:$LINENO: result: $bfd_cv_decl_needed_strdup" >&5 -echo "${ECHO_T}$bfd_cv_decl_needed_strdup" >&6 -if test $bfd_cv_decl_needed_strdup = yes; then - -cat >>confdefs.h <<\_ACEOF -#define NEED_DECLARATION_STRDUP 1 -_ACEOF - -fi - -echo "$as_me:$LINENO: checking whether strstr must be declared" >&5 -echo $ECHO_N "checking whether strstr must be declared... $ECHO_C" >&6 -if test "${bfd_cv_decl_needed_strstr+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -#include <stdio.h> -#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 -#ifdef HAVE_UNISTD_H -#include <unistd.h> -#endif -int -main () -{ -char *(*pfn) = (char *(*)) strstr - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - bfd_cv_decl_needed_strstr=no -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -bfd_cv_decl_needed_strstr=yes -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi - -echo "$as_me:$LINENO: result: $bfd_cv_decl_needed_strstr" >&5 -echo "${ECHO_T}$bfd_cv_decl_needed_strstr" >&6 -if test $bfd_cv_decl_needed_strstr = yes; then - -cat >>confdefs.h <<\_ACEOF -#define NEED_DECLARATION_STRSTR 1 -_ACEOF - -fi - -echo "$as_me:$LINENO: checking whether canonicalize_file_name must be declared" >&5 -echo $ECHO_N "checking whether canonicalize_file_name must be declared... $ECHO_C" >&6 -if test "${bfd_cv_decl_needed_canonicalize_file_name+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -#include <stdio.h> -#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 -#ifdef HAVE_UNISTD_H -#include <unistd.h> -#endif -int -main () -{ -char *(*pfn) = (char *(*)) canonicalize_file_name - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - bfd_cv_decl_needed_canonicalize_file_name=no -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -bfd_cv_decl_needed_canonicalize_file_name=yes -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi - -echo "$as_me:$LINENO: result: $bfd_cv_decl_needed_canonicalize_file_name" >&5 -echo "${ECHO_T}$bfd_cv_decl_needed_canonicalize_file_name" >&6 -if test $bfd_cv_decl_needed_canonicalize_file_name = yes; then - -cat >>confdefs.h <<\_ACEOF -#define NEED_DECLARATION_CANONICALIZE_FILE_NAME 1 -_ACEOF - -fi - - # If we are configured native on GNU/Linux, work around problems with # sys/procfs.h # Also detect which type of /proc is in use, such as for Unixware or Solaris. diff --git a/gdb/configure.ac b/gdb/configure.ac index 82c8bbe..7243cbd 100644 --- a/gdb/configure.ac +++ b/gdb/configure.ac @@ -424,7 +424,9 @@ AC_CHECK_HEADERS(ctype.h time.h) # Checks for declarations. # # ------------------------- # -gcc_AC_CHECK_DECLS(getopt) +AC_CHECK_DECLS([free, malloc, realloc]) +AC_CHECK_DECLS([strerror, strstr]) +AC_CHECK_DECLS(getopt) # ----------------------- # # Checks for structures. # @@ -477,7 +479,7 @@ gdb_ptrace_headers=' #endif ' # There is no point in checking if we don't have a prototype. -gcc_AC_CHECK_DECLS(ptrace, , [ +AC_CHECK_DECLS(ptrace, [], [ : ${gdb_cv_func_ptrace_ret='int'} : ${gdb_cv_func_ptrace_args='int,int,long,long'} ], $gdb_ptrace_headers) @@ -694,14 +696,6 @@ if test $gdb_cv_have_uintptr_t = yes; then AC_DEFINE(HAVE_UINTPTR_T, 1, [Define if <stdint.h> provides the uintptr_t type.]) fi -BFD_NEED_DECLARATION(malloc) -BFD_NEED_DECLARATION(realloc) -BFD_NEED_DECLARATION(free) -BFD_NEED_DECLARATION(strerror) -BFD_NEED_DECLARATION(strdup) -BFD_NEED_DECLARATION(strstr) -BFD_NEED_DECLARATION(canonicalize_file_name) - # If we are configured native on GNU/Linux, work around problems with # sys/procfs.h # Also detect which type of /proc is in use, such as for Unixware or Solaris. diff --git a/gdb/gdb_string.h b/gdb/gdb_string.h index f54af80..4ccb500 100644 --- a/gdb/gdb_string.h +++ b/gdb/gdb_string.h @@ -1,5 +1,7 @@ /* Portable <string.h> - Copyright 1995, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. + + Copyright 1995, 1998, 1999, 2000, 2001, 2004 + Free Software Foundation, Inc. This file is part of GDB. @@ -52,15 +54,15 @@ extern int memcmp (); #endif #endif /* STDC_HEADERS */ -#ifdef NEED_DECLARATION_STRERROR +#if !HAVE_DECL_STRERROR #ifndef strerror extern char *strerror (int); /* X3.159-1989 4.11.6.2 */ #endif #endif -#ifdef NEED_DECLARATION_STRSTR +#if !HAVE_DECL_STRSTR #ifndef strstr -extern char *strstr (const char *, const char *); /* X3.159-1989 4.11.5.7 */ +extern char *strstr (const char *, const char *); /* X3.159-1989 4.11.5.7 */ #endif #endif diff --git a/gdb/utils.c b/gdb/utils.c index 55ee7ec..1bdcb63 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -62,20 +62,15 @@ #include "readline/readline.h" -#ifdef NEED_DECLARATION_MALLOC +#if !HAVE_DECL_MALLOC extern PTR malloc (); /* OK: PTR */ #endif -#ifdef NEED_DECLARATION_REALLOC +#if !HAVE_DECL_REALLOC extern PTR realloc (); /* OK: PTR */ #endif -#ifdef NEED_DECLARATION_FREE +#if !HAVE_DECL_FREE extern void free (); #endif -/* Actually, we'll never have the decl, since we don't define _GNU_SOURCE. */ -#if defined(HAVE_CANONICALIZE_FILE_NAME) \ - && defined(NEED_DECLARATION_CANONICALIZE_FILE_NAME) -extern char *canonicalize_file_name (const char *); -#endif /* readline defines this. */ #undef savestring |