From bd4f7a8f3985986b4f3d9df49310053a92eaa81f Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Thu, 31 Mar 2005 14:40:41 +0000 Subject: [PATCH] Add a check for providing a prototype for getopt() which is compatible with the one in include/getopt.h. If so then define HAVE_DECL_GETOPT. --- binutils/ChangeLog | 11 ++++++++ binutils/aclocal.m4 | 27 ------------------ binutils/addr2line.c | 1 + binutils/config.in | 3 ++ binutils/configure | 76 +++++++++++++++++++++++++++++++++++++++------------ binutils/configure.in | 10 +++++++ 6 files changed, 83 insertions(+), 45 deletions(-) diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 9ce07ec38..c03762c7b 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,14 @@ +2005-03-31 Nick Clifton + + * configure.in: Add a check for providing a prototype + for getopt() which is compatible with the one in + include/getopt.h. If so then define HAVE_DECL_GETOPT. + * configure: Regenerate. + * config.in (HAVE_DECL_GETOPT): Add. + * aclocal.m4: Regenerate. + * addr2line.c: Include "config.h" before "bfd.h" so that + HAVE_DECL_GETOPT is defined before getopt.h is included. + 2005-03-21 Jan-Benedict Glaw * doc/binutils.texi: Document new VAX disassembler-specific option diff --git a/binutils/aclocal.m4 b/binutils/aclocal.m4 index 49cfc4c66..97e3b92d9 100644 --- a/binutils/aclocal.m4 +++ b/binutils/aclocal.m4 @@ -37,33 +37,6 @@ AC_CHECK_PROGS(LEX, flex lex, [$missing_dir/missing flex]) AC_PROG_LEX AC_DECL_YYTEXT]) -# isc-posix.m4 serial 2 (gettext-0.11.2) -dnl Copyright (C) 1995-2002 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. - -# This file is not needed with autoconf-2.53 and newer. Remove it in 2005. - -# This test replaces the one in autoconf. -# Currently this macro should have the same name as the autoconf macro -# because gettext's gettext.m4 (distributed in the automake package) -# still uses it. Otherwise, the use in gettext.m4 makes autoheader -# give these diagnostics: -# configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX -# configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX - -undefine([AC_ISC_POSIX]) - -AC_DEFUN([AC_ISC_POSIX], - [ - dnl This test replaces the obsolescent AC_ISC_POSIX kludge. - AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"]) - ] -) - # Do all the work for Automake. This macro actually does too much -- # some checks are only needed if your package does certain things. # But this isn't really a big deal. diff --git a/binutils/addr2line.c b/binutils/addr2line.c index 31e0b2f37..18d875389 100644 --- a/binutils/addr2line.c +++ b/binutils/addr2line.c @@ -29,6 +29,7 @@ both forms write results to stdout, the second form reads addresses to be converted from stdin. */ +#include "config.h" #include #include "bfd.h" diff --git a/binutils/config.in b/binutils/config.in index 76d3b815b..abb8ee283 100644 --- a/binutils/config.in +++ b/binutils/config.in @@ -178,6 +178,9 @@ /* Is the type time_t defined in ? */ #undef HAVE_TIME_T_IN_TYPES_H +/* Is the prototype for getopt in in the expected format? */ +#undef HAVE_DECL_GETOPT + /* Does define struct utimbuf? */ #undef HAVE_GOOD_UTIME_H diff --git a/binutils/configure b/binutils/configure index 518ac843f..ef5f29ad0 100755 --- a/binutils/configure +++ b/binutils/configure @@ -5252,15 +5252,55 @@ EOF fi + +echo $ac_n "checking for an known getopt prototype in unistd.h""... $ac_c" 1>&6 +echo "configure:5258: checking for an known getopt prototype in unistd.h" >&5 +if eval "test \"`echo '$''{'bu_cv_decl_getopt_unistd_h'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +int main() { +extern int getopt (int, char *const*, const char *); +; return 0; } +EOF +if { (eval echo configure:5270: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + bu_cv_decl_getopt_unistd_h=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + bu_cv_decl_getopt_unistd_h=no +fi +rm -f conftest* +fi + +echo "$ac_t""$bu_cv_decl_getopt_unistd_h" 1>&6 +if test $bu_cv_decl_getopt_unistd_h = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_DECL_GETOPT 1 +EOF + +fi + + + + + + + # Under Next 3.2 apparently does not define struct utimbuf # by default. echo $ac_n "checking for utime.h""... $ac_c" 1>&6 -echo "configure:5259: checking for utime.h" >&5 +echo "configure:5299: checking for utime.h" >&5 if eval "test \"`echo '$''{'bu_cv_header_utime_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #ifdef HAVE_TIME_H @@ -5271,7 +5311,7 @@ int main() { struct utimbuf s; ; return 0; } EOF -if { (eval echo configure:5275: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5315: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bu_cv_header_utime_h=yes else @@ -5292,12 +5332,12 @@ EOF fi echo $ac_n "checking whether fprintf must be declared""... $ac_c" 1>&6 -echo "configure:5296: checking whether fprintf must be declared" >&5 +echo "configure:5336: checking whether fprintf must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_fprintf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -5318,7 +5358,7 @@ int main() { char *(*pfn) = (char *(*)) fprintf ; return 0; } EOF -if { (eval echo configure:5322: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5362: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_fprintf=no else @@ -5339,12 +5379,12 @@ EOF fi echo $ac_n "checking whether strstr must be declared""... $ac_c" 1>&6 -echo "configure:5343: checking whether strstr must be declared" >&5 +echo "configure:5383: checking whether strstr must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_strstr'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -5365,7 +5405,7 @@ int main() { char *(*pfn) = (char *(*)) strstr ; return 0; } EOF -if { (eval echo configure:5369: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5409: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_strstr=no else @@ -5386,12 +5426,12 @@ EOF fi echo $ac_n "checking whether sbrk must be declared""... $ac_c" 1>&6 -echo "configure:5390: checking whether sbrk must be declared" >&5 +echo "configure:5430: checking whether sbrk must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_sbrk'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -5412,7 +5452,7 @@ int main() { char *(*pfn) = (char *(*)) sbrk ; return 0; } EOF -if { (eval echo configure:5416: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5456: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_sbrk=no else @@ -5433,12 +5473,12 @@ EOF fi echo $ac_n "checking whether getenv must be declared""... $ac_c" 1>&6 -echo "configure:5437: checking whether getenv must be declared" >&5 +echo "configure:5477: checking whether getenv must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_getenv'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -5459,7 +5499,7 @@ int main() { char *(*pfn) = (char *(*)) getenv ; return 0; } EOF -if { (eval echo configure:5463: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5503: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_getenv=no else @@ -5480,12 +5520,12 @@ EOF fi echo $ac_n "checking whether environ must be declared""... $ac_c" 1>&6 -echo "configure:5484: checking whether environ must be declared" >&5 +echo "configure:5524: checking whether environ must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_environ'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -5506,7 +5546,7 @@ int main() { char *(*pfn) = (char *(*)) environ ; return 0; } EOF -if { (eval echo configure:5510: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5550: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_environ=no else diff --git a/binutils/configure.in b/binutils/configure.in index 767d237f9..0a0381127 100644 --- a/binutils/configure.in +++ b/binutils/configure.in @@ -180,6 +180,16 @@ if test $bu_cv_decl_time_t_types_h = yes; then [Is the type time_t defined in ?]) fi +AC_MSG_CHECKING(for a known getopt prototype in unistd.h) +AC_CACHE_VAL(bu_cv_decl_getopt_unistd_h, +[AC_TRY_COMPILE([#include ], [extern int getopt (int, char *const*, const char *);], +bu_cv_decl_getopt_unistd_h=yes, bu_cv_decl_getopt_unistd_h=no)]) +AC_MSG_RESULT($bu_cv_decl_getopt_unistd_h) +if test $bu_cv_decl_getopt_unistd_h = yes; then + AC_DEFINE([HAVE_DECL_GETOPT], 1, + [Is the prototype for getopt in in the expected format?]) +fi + # Under Next 3.2 apparently does not define struct utimbuf # by default. AC_MSG_CHECKING([for utime.h]) -- 2.11.4.GIT