[project @ 2001-06-30 00:00:49 by sof]
authorsof <unknown>
Sat, 30 Jun 2001 00:00:49 +0000 (00:00 +0000)
committersof <unknown>
Sat, 30 Jun 2001 00:00:49 +0000 (00:00 +0000)
Tidy up the handling of -mno-cygwin.

aclocal.m4
configure.in

index 242138c..aa8856a 100644 (file)
@@ -1,4 +1,4 @@
-dnl $Id: aclocal.m4,v 1.76 2001/06/28 11:47:03 simonmar Exp $
+dnl $Id: aclocal.m4,v 1.77 2001/06/30 00:00:49 sof Exp $
 dnl 
 dnl Extra autoconf macros for the Glasgow fptools
 dnl
@@ -1066,19 +1066,20 @@ fi
 ])
 
 dnl
-dnl Check to see whether CC (gcc) supports the -mwin32 option.
+dnl Check to see whether CC (gcc) supports a particular option.
 dnl 
-AC_DEFUN(FPTOOLS_CC_MWIN32,
-[AC_CACHE_CHECK([whether $CC accepts -mwin32], ac_cv_cc_supports_mwin32,
+AC_DEFUN(FPTOOLS_CC_FLAG,
 [save_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS -mwin32"
+AC_CACHE_CHECK([whether $CC accepts $1], [ac_cv_cc_$2],
+[CFLAGS="$CFLAGS $1"
  AC_LANG_C
- AC_TRY_COMPILE(,[int main(){return(0);}], ac_cv_cc_supports_mwin32=yes, ac_cv_cc_supports_mwin32=no)
- CFLAGS="$CFLAGS_save"])
-if test "$ac_cv_cc_supports_mwin32" = yes; then
-  CC_MWIN32_FLAG="-mwin32";
+ AC_TRY_COMPILE(,[int main(){return(0);}],
+                 [ac_cv_cc_$2=yes],
+                [ac_cv_cc_$2=no])
+])
+if test "$ac_cv_cc_$2"x = "yesx"; then
+  $2=$extra_flag;
 else
-  CC_MWIN32_FLAG="";
+  $2=$extra_flag;
 fi;
-AC_SUBST(CC_MWIN32_FLAG)
 ])
index dd140fe..3c6316a 100644 (file)
@@ -511,20 +511,6 @@ esac
 dnl ** does #! path/to/perl work? (sometimes it's too long...)
 FPTOOLS_SHEBANG_PERL
 
-dnl ** set up extra GCC options on Win32
-case $HostOS_CPP in
-cygwin32|mingw32)
-   STD_CC_OPTS="-mno-cygwin $CC_MWIN32_FLAG"
-   CFLAGS="$STD_CC_OPTS $CFLAGS"
-   CPPFLAGS="$STD_CC_OPTS $CPPFLAGS"
-   ;;
-*)
-   STD_CC_OPTS=""
-   ;;
-esac
-SRC_CC_OPTS="-O $STD_CC_OPTS"
-AC_SUBST(SRC_CC_OPTS)
-
 dnl ** look for GCC and find out which version
 dnl     Figure out which C compiler to use.  Gcc is preferred.
 dnl     If gcc, make sure it's at least 2.1
@@ -532,17 +518,17 @@ dnl
 AC_PROG_CC
 FPTOOLS_HAVE_GCC
 
-dnl ** does the C compiler support option -mwin32 ?
-FPTOOLS_CC_MWIN32
-
 dnl ** figure out how to invoke cpp directly (gcc -E is no good)
 AC_PROG_CPP
 
-dnl ** set up extra GCC options on Win32
-case $HostOS_CPP in
-cygwin32|mingw32)
-   CPP="$CPP $STD_CC_OPTS"
-esac
+dnl ** does the C compiler support the following options?
+FPTOOLS_CC_FLAG(-mwin32,CC_SUPPORTS_MWIN32)
+FPTOOLS_CC_FLAG(-mno-cygwin,CC_SUPPORTS_MNO_CYGWIN)
+
+EXTRA_CC_OPTS="$CC_SUPPORTS_MNO_CYGWIN $CC_SUPPORTS_MWIN32"
+SRC_CC_OPTS="-O $EXTRA_CC_OPTS"
+CPPFLAGS="$EXTRA_CC_OPTS $CPPFLAGS"
+AC_SUBST(SRC_CC_OPTS)
 
 dnl ** figure out how to do context diffs
 FPTOOLS_PROG_DIFF