This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH: HAVE_DECL_GETOPT for getopt.c


For a reason that I can't explain, libiberty unconditionally includes
getopt.o, even if the host has the function in its system libraries.
When building getopt.o on NetBSD, GCC emits the warning:

/src/libiberty/../include/getopt.h:116: warning: function declaration isn't a prototype

This occurs because include/getopt.h contains a function declaration
that is conditional on HAVE_DECL_GETOPT, but libiberty's configure
script never tests for getopt (presumably because it's going into the
library anyway?).  This patch adds the test, which defines
HAVE_DECL_GETOPT in config.h and eliminates the warning.

Okay for mainline?

2005-07-22  Ben Elliston  <bje@gnu.org>

        * configure.ac: Check for a getopt(3) declaration.
        * configure, config.in: Regenerate.

Index: configure.ac
===================================================================
RCS file: /cvs/src/src/libiberty/configure.ac,v
retrieving revision 1.26
diff -u -r1.26 configure.ac
--- configure.ac        7 Jul 2005 02:21:57 -0000       1.26
+++ configure.ac        22 Jul 2005 01:56:49 -0000
@@ -588,7 +588,7 @@
 
   AC_CHECK_FUNCS($checkfuncs)
   AC_CHECK_DECLS([basename, ffs, asprintf, vasprintf, snprintf, vsnprintf])
-  AC_CHECK_DECLS([calloc, getenv, malloc, realloc, sbrk])
+  AC_CHECK_DECLS([calloc, getenv, getopt, malloc, realloc, sbrk])
   AC_CHECK_DECLS([strverscmp])
   libiberty_NEED_DECLARATION(canonicalize_file_name)
 fi

Attachment: pgp00000.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]