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-04 11:27:16 +00:00
parent 661f7c357e
commit 34875e6487
11 changed files with 159 additions and 18 deletions

View file

@ -1,3 +1,11 @@
2005-04-04 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.
* gconfig.in (HAVE_DECL_GETOPT): Add.
2005-03-29 Nick Clifton <nickc@redhat.com>
* po/de.po: Updated German translation.

62
gprof/configure vendored
View file

@ -8287,6 +8287,68 @@ fi
done
echo "$as_me:$LINENO: checking for a known getopt prototype in unistd.h" >&5
echo $ECHO_N "checking for a known getopt prototype in unistd.h... $ECHO_C" >&6
if test "${gprof_cv_decl_getopt_unistd_h+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 <unistd.h>
int
main ()
{
extern int getopt (int, char *const*, const char *);
;
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
gprof_cv_decl_getopt_unistd_h=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
gprof_cv_decl_getopt_unistd_h=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $gprof_cv_decl_getopt_unistd_h" >&5
echo "${ECHO_T}$gprof_cv_decl_getopt_unistd_h" >&6
if test $gprof_cv_decl_getopt_unistd_h = yes; then
cat >>confdefs.h <<\_ACEOF
#define HAVE_DECL_GETOPT 1
_ACEOF
fi
build_warnings="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
# Check whether --enable-werror or --disable-werror was given.

View file

@ -32,6 +32,16 @@ AC_EXEEXT
AC_CHECK_HEADERS(sys/gmon_out.h)
AC_MSG_CHECKING(for a known getopt prototype in unistd.h)
AC_CACHE_VAL(gprof_cv_decl_getopt_unistd_h,
[AC_TRY_COMPILE([#include <unistd.h>], [extern int getopt (int, char *const*, const char *);],
gprof_cv_decl_getopt_unistd_h=yes, gprof_cv_decl_getopt_unistd_h=no)])
AC_MSG_RESULT($gprof_cv_decl_getopt_unistd_h)
if test $gprof_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
build_warnings="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
AC_ARG_ENABLE(werror,

View file

@ -139,3 +139,5 @@
/* Define as 1 if you have gettext and don't want to use GNU gettext. */
#undef HAVE_GETTEXT
/* Is the prototype for getopt in <unistd.h> in the expected format? */
#undef HAVE_DECL_GETOPT

View file

@ -1,3 +1,14 @@
2005-04-04 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.
* ldemul.c: Include config.h
* lexsup.c: Likewise.
* emultempl/elf32.sc: Likewise.
2005-03-29 Alan Modra <amodra@bigpond.net.au>
* emultempl/elf32.em (gld${EMULATION_NAME}_layout_sections_again):

View file

@ -175,3 +175,5 @@
/* Additional extension a shared object might have. */
#undef EXTRA_SHLIB_EXTENSION
/* Is the prototype for getopt in <unistd.h> in the expected format? */
#undef HAVE_DECL_GETOPT

69
ld/configure vendored
View file

@ -4824,6 +4824,39 @@ fi
fi
echo $ac_n "checking for a known getopt prototype in unistd.h""... $ac_c" 1>&6
echo "configure:4829: checking for a known getopt prototype in unistd.h" >&5
if eval "test \"`echo '$''{'ld_cv_decl_getopt_unistd_h'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 4834 "configure"
#include "confdefs.h"
#include <unistd.h>
int main() {
extern int getopt (int, char *const*, const char *);
; return 0; }
EOF
if { (eval echo configure:4841: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ld_cv_decl_getopt_unistd_h=yes
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
ld_cv_decl_getopt_unistd_h=no
fi
rm -f conftest*
fi
echo "$ac_t""$ld_cv_decl_getopt_unistd_h" 1>&6
if test $ld_cv_decl_getopt_unistd_h = yes; then
cat >> confdefs.h <<\EOF
#define HAVE_DECL_GETOPT 1
EOF
fi
case "${host}" in
*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
@ -4834,12 +4867,12 @@ EOF
esac
echo $ac_n "checking whether strstr must be declared""... $ac_c" 1>&6
echo "configure:4838: checking whether strstr must be declared" >&5
echo "configure:4871: 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 4843 "configure"
#line 4876 "configure"
#include "confdefs.h"
#include <stdio.h>
@ -4860,7 +4893,7 @@ int main() {
char *(*pfn) = (char *(*)) strstr
; return 0; }
EOF
if { (eval echo configure:4864: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:4897: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_decl_needed_strstr=no
else
@ -4881,12 +4914,12 @@ EOF
fi
echo $ac_n "checking whether free must be declared""... $ac_c" 1>&6
echo "configure:4885: checking whether free must be declared" >&5
echo "configure:4918: checking whether free must be declared" >&5
if eval "test \"`echo '$''{'bfd_cv_decl_needed_free'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 4890 "configure"
#line 4923 "configure"
#include "confdefs.h"
#include <stdio.h>
@ -4907,7 +4940,7 @@ int main() {
char *(*pfn) = (char *(*)) free
; return 0; }
EOF
if { (eval echo configure:4911: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:4944: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_decl_needed_free=no
else
@ -4928,12 +4961,12 @@ EOF
fi
echo $ac_n "checking whether sbrk must be declared""... $ac_c" 1>&6
echo "configure:4932: checking whether sbrk must be declared" >&5
echo "configure:4965: 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 4937 "configure"
#line 4970 "configure"
#include "confdefs.h"
#include <stdio.h>
@ -4954,7 +4987,7 @@ int main() {
char *(*pfn) = (char *(*)) sbrk
; return 0; }
EOF
if { (eval echo configure:4958: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:4991: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_decl_needed_sbrk=no
else
@ -4975,12 +5008,12 @@ EOF
fi
echo $ac_n "checking whether getenv must be declared""... $ac_c" 1>&6
echo "configure:4979: checking whether getenv must be declared" >&5
echo "configure:5012: 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 4984 "configure"
#line 5017 "configure"
#include "confdefs.h"
#include <stdio.h>
@ -5001,7 +5034,7 @@ int main() {
char *(*pfn) = (char *(*)) getenv
; return 0; }
EOF
if { (eval echo configure:5005: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:5038: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_decl_needed_getenv=no
else
@ -5022,12 +5055,12 @@ EOF
fi
echo $ac_n "checking whether environ must be declared""... $ac_c" 1>&6
echo "configure:5026: checking whether environ must be declared" >&5
echo "configure:5059: 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 5031 "configure"
#line 5064 "configure"
#include "confdefs.h"
#include <stdio.h>
@ -5048,7 +5081,7 @@ int main() {
char *(*pfn) = (char *(*)) environ
; return 0; }
EOF
if { (eval echo configure:5052: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:5085: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bfd_cv_decl_needed_environ=no
else
@ -5076,19 +5109,19 @@ fi
# constants, while still supporting pre-ANSI compilers which do not
# support string concatenation.
echo $ac_n "checking whether ANSI C string concatenation works""... $ac_c" 1>&6
echo "configure:5080: checking whether ANSI C string concatenation works" >&5
echo "configure:5113: checking whether ANSI C string concatenation works" >&5
if eval "test \"`echo '$''{'ld_cv_string_concatenation'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 5085 "configure"
#line 5118 "configure"
#include "confdefs.h"
int main() {
char *a = "a" "a";
; return 0; }
EOF
if { (eval echo configure:5092: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:5125: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ld_cv_string_concatenation=yes
else

View file

@ -138,6 +138,16 @@ AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h)
AC_CHECK_FUNCS(sbrk realpath glob)
AC_HEADER_DIRENT
AC_MSG_CHECKING(for a known getopt prototype in unistd.h)
AC_CACHE_VAL(ld_cv_decl_getopt_unistd_h,
[AC_TRY_COMPILE([#include <unistd.h>], [extern int getopt (int, char *const*, const char *);],
ld_cv_decl_getopt_unistd_h=yes, ld_cv_decl_getopt_unistd_h=no)])
AC_MSG_RESULT($ld_cv_decl_getopt_unistd_h)
if test $ld_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
BFD_BINARY_FOPEN
BFD_NEED_DECLARATION(strstr)

View file

@ -35,6 +35,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define TARGET_IS_${EMULATION_NAME}
#include "config.h"
#include "bfd.h"
#include "sysdep.h"
#include "libiberty.h"

View file

@ -20,6 +20,7 @@ along with GLD; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
#include "config.h"
#include "bfd.h"
#include "sysdep.h"
#include "getopt.h"

View file

@ -20,6 +20,7 @@
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
#include "config.h"
#include "bfd.h"
#include "sysdep.h"
#include "libiberty.h"