-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
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
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)
+])
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'
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
dnl ** code before data?
FPTOOLS_CODE_BEFORE_DATA
+
AC_OUTPUT(mk/config.mk, echo timestamp > mk/stamp-h )
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)