[project @ 2001-06-26 23:12:19 by sof]
authorsof <unknown>
Tue, 26 Jun 2001 23:12:19 +0000 (23:12 +0000)
committersof <unknown>
Tue, 26 Jun 2001 23:12:19 +0000 (23:12 +0000)
Test whether $(CC) supports -mwin32 + have configure script set SRC_CC_OPTS

aclocal.m4
configure.in
mk/config.mk.in

index 9ae1145..46b5550 100644 (file)
@@ -1,4 +1,4 @@
-dnl $Id: aclocal.m4,v 1.74 2001/06/25 05:25:31 sof Exp $
+dnl $Id: aclocal.m4,v 1.75 2001/06/26 23:12:19 sof Exp $
 dnl 
 dnl Extra autoconf macros for the Glasgow fptools
 dnl
@@ -197,7 +197,9 @@ AC_DEFUN(FPTOOLS_HAPPY,
 if test -d $srcdir/happy; then
    SrcTreeHappyCmd=$hardtop/happy/src/happy-inplace
 fi
-AC_PATH_PROG(HappyCmd,happy,$SrcTreeHappyCmd)
+#AC_PATH_PROG(HappyCmd,happy,$SrcTreeHappyCmd)
+HappyCmd=$SrcTreeHappyCmd
+AC_SUBST(HappyCmd)
 AC_CACHE_CHECK([for version of happy], fptools_cv_happy_version,
 changequote(, )dnl
 [if test x"$HappyCmd" = x"$SrcTreeHappyCmd"; then
@@ -1064,3 +1066,21 @@ then
   test -z "$LEX" && AC_MSG_ERROR(['lex' or 'flex' is required to compile GHC.])
 fi
 ])
+
+dnl
+dnl Check to see whether CC (gcc) supports the -mwin32 option.
+dnl 
+AC_DEFUN(FPTOOLS_CC_MWIN32,
+[AC_CACHE_CHECK([whether $CC accepts -mwin32], ac_cv_cc_supports_mwin32,
+[save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -mwin32"
+ 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";
+else
+  CC_MWIN32_FLAG="";
+fi;
+AC_SUBST(CC_MWIN32_FLAG)
+])
index b2376fd..276804f 100644 (file)
@@ -202,12 +202,6 @@ i[[3456]]86-*-mingw32*)
         HostVendor_CPP='unknown'
         HostOS_CPP='mingw32'
        exeext='.exe'
-       # We assume you're using mingw32 via the gcc that comes
-       # with cygwin, and not the native port, so let's augment
-       # the gcc command-line used here with -mno-cygwin -mwin32
-       # to arrange for good things to happen.
-       CFLAGS="-mno-cygwin -mwin32 $CFLAGS"
-       CPPFLAGS="-mno-cygwin -mwin32 $CPPFLAGS"
         ;;
 m68k-next-nextstep2)
         HostPlatform_CPP='m68k_next_nextstep2'
@@ -525,13 +519,26 @@ 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
+
 case $HostOS_CPP in
-mingw32)
-   CPP="$CPP -mno-cygwin -mwin32"
+cygwin32|mingw32)
+   STD_CC_OPTS="-O -mno-cygwin $CC_MWIN32_FLAG"
+   CPP="$CPP $STD_CC_OPTS"
+   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 ** figure out how to do context diffs
 FPTOOLS_PROG_DIFF
@@ -955,4 +962,5 @@ FPTOOLS_END_DATA_SECTION
 dnl ** code before data?
 FPTOOLS_CODE_BEFORE_DATA
 
+
 AC_OUTPUT(mk/config.mk, echo timestamp > mk/stamp-h )
index 840e6ff..c1e77c6 100644 (file)
@@ -612,10 +612,7 @@ endif
 endif
 
 # default C compiler flags
-SRC_CC_OPTS = -O
-ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
-SRC_CC_OPTS += -mno-cygwin -mwin32
-endif
+SRC_CC_OPTS = @SRC_CC_OPTS@
 
 #-----------------------------------------------------------------------------
 # GMP Library (version 2.0.x or above)