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.
This commit is contained in:
Nick Clifton
2005-04-01 12:56:29 +00:00
parent 8a75718cb7
commit 56f366632f
4 changed files with 83 additions and 0 deletions

View File

@ -716,6 +716,16 @@ GAS_CHECK_DECL_NEEDED(errno, f, int f, [
#endif
])
AC_MSG_CHECKING(for a known getopt prototype in unistd.h)
AC_CACHE_VAL(gas_cv_decl_getopt_unistd_h,
[AC_TRY_COMPILE([#include <unistd.h>], [extern int getopt (int, char *const*, const char *);],
gas_cv_decl_getopt_unistd_h=yes, gas_cv_decl_getopt_unistd_h=no)])
AC_MSG_RESULT($gas_cv_decl_getopt_unistd_h)
if test $gas_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
GAS_CHECK_DECL_NEEDED(environ, f, char **f, $gas_test_headers)
GAS_CHECK_DECL_NEEDED(ffs, f, int (*f)(int), $gas_test_headers)
GAS_CHECK_DECL_NEEDED(free, f, void (*f)(), $gas_test_headers)