Wed Jul 31 14:46:11 1996 Martin M. Hunt <hunt@pizza.cygnus.com>
[deliverable/binutils-gdb.git] / gdb / aclocal.m4
index d23d084cecdfe30a9b3de464f15a1f74cad2c2b9..c754fdcf2f7ad2efd32193a3fe564a8ada1bce93 100644 (file)
@@ -40,28 +40,7 @@ if test "$ac_cv_os_lynx" = "yes" ; then
   AC_MSG_RESULT(no)
 fi
 ])
-#
-# Sometimes the native compiler is a bogus stub for gcc or /usr/ucb/cc. This
-# makes configure think it's cross compiling. If --target wasn't used, then
-# we can't configure, so something is wrong.
-AC_DEFUN(CY_AC_C_CROSS,
-[# If we cannot run a trivial program, we must be cross compiling.
-AC_MSG_CHECKING(whether cross-compiling)
-AC_CACHE_VAL(ac_cv_c_cross,[
-AC_TRY_RUN([
-  main(){return(0);}],
-  ac_cv_c_cross=no, ac_cv_c_cross=yes, ac_cv_c_cross=yes)
-])
-if test x"${target}" = x"${host}" -a x"${ac_cv_c_cross}" = x"yes"; then
-  dnl this hack is cause the message is so long we don't call AC_MSG_ERROR
-  echo "configure: error: You need to specify --target to cross compile," 1>&2;
-  echo "       or the native compiler is broken" 1>&2;
-  exit 1;
-else
-  cross_compiling=$ac_cv_c_cross
-  AC_MSG_RESULT($ac_cv_c_cross)
-fi
-])
+
 AC_DEFUN(CY_AC_PATH_TCLH, [
 #
 # Ok, lets find the tcl source trees so we can use the headers
@@ -99,7 +78,8 @@ if test x"${ac_cv_c_tclh}" = x ; then
     fi
     # Tcl 7.5 and greater puts headers in subdirectory.
     if test -f $i/generic/tclInt.h ; then
-       ac_cv_c_tclh=`(cd $i; pwd)`/generic
+      ac_cv_c_tclh=`(cd $i; pwd)`/generic
+      break
     fi
   done
 fi
@@ -130,7 +110,7 @@ if test x"${ac_cv_c_tclh}" = x ; then
 fi
 if test x"${ac_cv_c_tclh}" != x ; then
   no_tcl=""
-  if test x"${ac_cv_c_tkh}" = x"installed" ; then
+  if test x"${ac_cv_c_tclh}" = x"installed" ; then
     AC_MSG_RESULT([is installed])
     TCLHDIR=""
   else
@@ -141,35 +121,35 @@ if test x"${ac_cv_c_tclh}" != x ; then
 fi
 
 AC_MSG_CHECKING([Tcl version])
-rm -rf tclmajor tclminor
 orig_includes="$CPPFLAGS"
 
 if test x"${TCLHDIR}" != x ; then
   CPPFLAGS="$CPPFLAGS $TCLHDIR"
 fi
 
-AC_TRY_RUN([
-#include <stdio.h>
+# Get major and minor versions of Tcl.  Use funny names to avoid
+# clashes with eg SunOS.
+cat > conftest.c <<'EOF'
 #include "tcl.h"
-main() {
-       FILE *maj = fopen("tclmajor","w");
-       FILE *min = fopen("tclminor","w");
-       fprintf(maj,"%d",TCL_MAJOR_VERSION);
-       fprintf(min,"%d",TCL_MINOR_VERSION);
-       fclose(maj);
-       fclose(min);
-       return 0;
-}],
-       tclmajor=`cat tclmajor`
-       tclminor=`cat tclminor`
-       tclversion=$tclmajor.$tclminor
-       AC_MSG_RESULT($tclversion)
-       rm -f tclmajor tclminor
-,
-       AC_MSG_RESULT([can't happen])
-,
-       AC_MSG_ERROR([can't be cross compiled])
-)
+MaJor = TCL_MAJOR_VERSION
+MiNor = TCL_MINOR_VERSION
+EOF
+
+tclmajor=
+tclminor=
+if (eval "$CPP $CPPFLAGS conftest.c") 2>/dev/null >conftest.out; then
+   # Success.
+   tclmajor=`egrep '^MaJor = ' conftest.out | sed -e 's/^MaJor = *//' -e 's/ *$//'`
+   tclminor=`egrep '^MiNor = ' conftest.out | sed -e 's/^MiNor = *//' -e 's/ *$//'`
+fi
+rm -f conftest.c conftest.out
+
+if test -z "$tclmajor" || test -z "$tclminor"; then
+   AC_MSG_RESULT([fatal error: could not find major or minor version number of Tcl])
+   exit 1
+fi
+AC_MSG_RESULT(${tclmajor}.${tclminor})
+
 CPPFLAGS="${orig_includes}"
 
 AC_PROVIDE([$0])
@@ -400,7 +380,6 @@ fi
 # if Tk is installed, extract the major/minor version
 if test x"${no_tk}" = x ; then
 AC_MSG_CHECKING([Tk version])
-rm -rf tkmajor tkminor
 orig_includes="$CPPFLAGS"
 
 if test x"${TCLHDIR}" != x ; then
@@ -413,30 +392,29 @@ if test x"${x_includes}" != x -a x"${x_includes}" != xNONE ; then
   CPPFLAGS="$CPPFLAGS -I$x_includes"
 fi
 
-AC_TRY_RUN([
-#include <stdio.h>
+# Get major and minor versions of Tk.  Use funny names to avoid
+# clashes with eg SunOS.
+cat > conftest.c <<'EOF'
 #include "tk.h"
-  main() {
-       FILE *maj = fopen("tkmajor","w");
-       FILE *min = fopen("tkminor","w");
-       fprintf(maj,"%d",TK_MAJOR_VERSION);
-       fprintf(min,"%d",TK_MINOR_VERSION);
-       fclose(maj);
-       fclose(min);
-       return 0;
-}],
-       tkmajor=`cat tkmajor`
-       tkminor=`cat tkminor`
-       tkversion=$tkmajor.$tkminor
-       AC_MSG_RESULT($tkversion)
-       rm -f tkmajor tkminor
-,
-       AC_MSG_ERROR([
-cannot compile a simple X program - suspect your xmkmf is
-misconfigured and is incorrectly reporting the location of your X
-include or libraries - report this to your system admin]) ,
-       AC_MSG_ERROR([can't be cross compiled])
-)
+MaJor = TK_MAJOR_VERSION
+MiNor = TK_MINOR_VERSION
+EOF
+
+tkmajor=
+tkminor=
+if (eval "$CPP $CPPFLAGS conftest.c") 2>/dev/null >conftest.out; then
+   # Success.
+   tkmajor=`egrep '^MaJor = ' conftest.out | sed -e 's/^MaJor = *//' -e 's/ *$//'`
+   tkminor=`egrep '^MiNor = ' conftest.out | sed -e 's/^MiNor = *//' -e 's/ *$//'`
+fi
+rm -f conftest.c conftest.out
+
+if test -z "$tkmajor" || test -z "$tkminor"; then
+   AC_MSG_RESULT([fatal error: could not find major or minor version number of Tk])
+   exit 1
+fi
+AC_MSG_RESULT(${tkmajor}.${tkminor})
+
 CPPFLAGS="${orig_includes}"
 fi
 
This page took 0.026168 seconds and 4 git commands to generate.