aboutsummaryrefslogtreecommitdiff
path: root/bfd/aclocal.m4
diff options
context:
space:
mode:
authorRob Savoye <rob@cygnus>1997-07-29 00:37:04 +0000
committerRob Savoye <rob@cygnus>1997-07-29 00:37:04 +0000
commitb1ee3d6a877fd1ecf17adc3e7356179aac71ebb1 (patch)
tree5cfc411234126c5c9d66481d9280251b8fb2a8b9 /bfd/aclocal.m4
parentce4450fa09dafa36b069185fe198f14d038a1985 (diff)
downloadgdb-b1ee3d6a877fd1ecf17adc3e7356179aac71ebb1.zip
gdb-b1ee3d6a877fd1ecf17adc3e7356179aac71ebb1.tar.gz
gdb-b1ee3d6a877fd1ecf17adc3e7356179aac71ebb1.tar.bz2
* aclocal.m4: Add CYGWIN and EXEEXT autoconf macros.
* configure.in: Use CYGWIN and EXEEXT autoconf macro to look for win32 dependencies. * configure: Regenerated with autoconf 2.12. * doc/Makefile.in: Add $(EXEEXT) to chew executable.
Diffstat (limited to 'bfd/aclocal.m4')
-rw-r--r--bfd/aclocal.m4129
1 files changed, 87 insertions, 42 deletions
diff --git a/bfd/aclocal.m4 b/bfd/aclocal.m4
index f08dd35..5433ef3 100644
--- a/bfd/aclocal.m4
+++ b/bfd/aclocal.m4
@@ -1,45 +1,90 @@
-dnl
-dnl This ugly hack is needed because the Cygnus configure script won't
-dnl tell us what CC is going to be, and "cc" isn't always right. (The
-dnl top-level Makefile will always override anything we choose here, so
-dnl the usual gcc/cc selection is useless.)
-dnl
-dnl It knows where it is in the tree; don't try using it elsewhere.
-dnl
-undefine([AC_PROG_CC])dnl
-AC_DEFUN(AC_PROG_CC,
-[AC_BEFORE([$0], [AC_PROG_CPP])dnl
-dnl
-dnl The ugly bit...
-dnl
-AC_MSG_CHECKING([for CC])
-dnl Don't bother with cache.
-test -z "$CC" && test -r ../Makefile && CC=`egrep '^CC *=' ../Makefile | tail -1 | sed 's/^CC *= *//'`
-test -z "$CC" && CC=cc
-AC_MSG_RESULT(setting CC to $CC)
-AC_SUBST(CC)
-dnl
-dnl Find out if we are using GNU C, under whatever name.
-dnl The semicolon is to pacify NeXT's syntax-checking cpp.
-cat > conftest.c <<EOF
-#ifdef __GNUC__
- yes;
-#endif
-EOF
-if ${CC-cc} -E conftest.c 2>&AC_FD_CC | egrep yes >/dev/null 2>&1; then
- GCC=yes
- if test "${CFLAGS+set}" != set; then
- echo 'void f(){}' > conftest.c
- if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
- CFLAGS="-g -O"
- else
- CFLAGS="-O"
- fi
+dnl See whether we need to use fopen-bin.h rather than fopen-same.h.
+AC_DEFUN(BFD_BINARY_FOPEN,
+[AC_REQUIRE([AC_CANONICAL_SYSTEM])
+case "${host}" in
+changequote(,)dnl
+i[345]86-*-msdos* | i[345]86-*-go32* | *-*-cygwin32 | *-*-windows)
+changequote([,])dnl
+ AC_DEFINE(USE_BINARY_FOPEN) ;;
+esac])dnl
+
+dnl Get a default for CC_FOR_BUILD to put into Makefile.
+AC_DEFUN(BFD_CC_FOR_BUILD,
+[# Put a plausible default for CC_FOR_BUILD in Makefile.
+if test -z "$CC_FOR_BUILD"; then
+ if test "x$cross_compiling" = "xno"; then
+ CC_FOR_BUILD='$(CC)'
+ else
+ CC_FOR_BUILD=gcc
fi
-else
- GCC=
- test "${CFLAGS+set}" = set || CFLAGS="-g"
fi
-rm -f conftest*
+AC_SUBST(CC_FOR_BUILD)])dnl
+
+dnl See whether we need a declaration for a function.
+AC_DEFUN(BFD_NEED_DECLARATION,
+[AC_MSG_CHECKING([whether $1 must be declared])
+AC_CACHE_VAL(bfd_cv_decl_needed_$1,
+[AC_TRY_COMPILE([
+#include <stdio.h>
+#ifdef HAVE_STRING_H
+#include <string.h>
+#else
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#endif
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif],
+[char *(*pfn) = (char *(*)) $1],
+bfd_cv_decl_needed_$1=no, bfd_cv_decl_needed_$1=yes)])
+AC_MSG_RESULT($bfd_cv_decl_needed_$1)
+if test $bfd_cv_decl_needed_$1 = yes; then
+ bfd_tr_decl=NEED_DECLARATION_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ AC_DEFINE_UNQUOTED($bfd_tr_decl)
+fi
])dnl
-dnl
+
+
+# Check to see if we're running under Cygwin32, without using
+# AC_CANONICAL_*. If so, set output variable CYGWIN32 to "yes".
+# Otherwise set it to "no".
+
+AC_DEFUN(CY_CYGWIN32,
+[AC_CACHE_CHECK(for Cygwin32 environment, am_cv_cygwin32,
+[AC_TRY_COMPILE(,[int main () { return __CYGWIN32__; }],
+am_cv_cygwin32=yes, am_cv_cygwin32=no)
+rm -f conftest*])
+CYGWIN32=
+test "$am_cv_cygwin32" = yes && CYGWIN32=yes])
+# Check to see if we're running under Win32, without using
+# AC_CANONICAL_*. If so, set output variable EXEEXT to ".exe".
+# Otherwise set it to "".
+
+dnl This knows we add .exe if we're building in the Cygwin32
+dnl environment. But if we're not, then it compiles a test program
+dnl to see if there is a suffix for executables.
+AC_DEFUN(CY_EXEEXT,
+dnl AC_REQUIRE([AC_PROG_CC])AC_REQUIRE([CY_CYGWIN32])
+AC_MSG_CHECKING([for executable suffix])
+[AC_CACHE_VAL(am_cv_exeext,
+[if test "$CYGWIN32" = yes; then
+am_cv_exeext=.exe
+else
+cat > am_c_test.c << 'EOF'
+int main() {
+/* Nothing needed here */
+}
+EOF
+${CC-cc} -o am_c_test $CFLAGS $CPPFLAGS $LDFLAGS am_c_test.c $LIBS 1>&5
+am_cv_exeext=`ls am_c_test.* | grep -v am_c_test.c | sed -e s/am_c_test//`
+rm -f am_c_test*])
+test x"${am_cv_exeext}" = x && am_cv_exeext=no
+fi
+EXEEXT=""
+test x"${am_cv_exeext}" != xno && EXEEXT=${am_cv_exeext}
+AC_MSG_RESULT(${am_cv_exeext})
+AC_SUBST(EXEEXT)])