aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2005-03-31 14:40:41 +0000
committerNick Clifton <nickc@redhat.com>2005-03-31 14:40:41 +0000
commite46eba98aea90cf780f66f7633c2e3417a2a6a76 (patch)
tree900100573fb8f51fda9d16b32f47e780a2ea4d23
parent0f2d00bca88a013fcd12d7a09ddb3a5bde378322 (diff)
downloadbinutils-e46eba98aea90cf780f66f7633c2e3417a2a6a76.zip
binutils-e46eba98aea90cf780f66f7633c2e3417a2a6a76.tar.gz
binutils-e46eba98aea90cf780f66f7633c2e3417a2a6a76.tar.bz2
Add a check for <unistd.h> providing a prototype for getopt() which is compatible
with the one in include/getopt.h. If so then define HAVE_DECL_GETOPT.
-rw-r--r--binutils/ChangeLog11
-rw-r--r--binutils/aclocal.m427
-rw-r--r--binutils/addr2line.c1
-rw-r--r--binutils/config.in3
-rwxr-xr-xbinutils/configure76
-rw-r--r--binutils/configure.in10
6 files changed, 83 insertions, 45 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 9ce07ec..c03762c 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,14 @@
+2005-03-31 Nick Clifton <nickc@redhat.com>
+
+ * configure.in: Add a check for <unistd.h> 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 <jbglaw@lug-owl.de>
* doc/binutils.texi: Document new VAX disassembler-specific option
diff --git a/binutils/aclocal.m4 b/binutils/aclocal.m4
index 49cfc4c..97e3b92 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 31e0b2f..18d8753 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 <string.h>
#include "bfd.h"
diff --git a/binutils/config.in b/binutils/config.in
index 76d3b81..abb8ee2 100644
--- a/binutils/config.in
+++ b/binutils/config.in
@@ -178,6 +178,9 @@
/* Is the type time_t defined in <sys/types.h>? */
#undef HAVE_TIME_T_IN_TYPES_H
+/* Is the prototype for getopt in <unistd.h> in the expected format? */
+#undef HAVE_DECL_GETOPT
+
/* Does <utime.h> define struct utimbuf? */
#undef HAVE_GOOD_UTIME_H
diff --git a/binutils/configure b/binutils/configure
index 518ac84..ef5f29a 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 <<EOF
+#line 5263 "configure"
+#include "confdefs.h"
+#include <unistd.h>
+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 <utime.h> 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 <<EOF
-#line 5264 "configure"
+#line 5304 "configure"
#include "confdefs.h"
#include <sys/types.h>
#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 <<EOF
-#line 5301 "configure"
+#line 5341 "configure"
#include "confdefs.h"
#include <stdio.h>
@@ -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 <<EOF
-#line 5348 "configure"
+#line 5388 "configure"
#include "confdefs.h"
#include <stdio.h>
@@ -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 <<EOF
-#line 5395 "configure"
+#line 5435 "configure"
#include "confdefs.h"
#include <stdio.h>
@@ -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 <<EOF
-#line 5442 "configure"
+#line 5482 "configure"
#include "confdefs.h"
#include <stdio.h>
@@ -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 <<EOF
-#line 5489 "configure"
+#line 5529 "configure"
#include "confdefs.h"
#include <stdio.h>
@@ -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 767d237..0a03811 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 <sys/types.h>?])
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 <unistd.h>], [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 <unistd.h> in the expected format?])
+fi
+
# Under Next 3.2 <utime.h> apparently does not define struct utimbuf
# by default.
AC_MSG_CHECKING([for utime.h])