- struct sigevent ev;
- timer_t timer;
- ev.sigev_notify = SIGEV_SIGNAL;
- ev.sigev_signo = SIGVTALRM;
- if (timer_create(CLOCK_PROCESS_CPUTIME_ID, &ev, &timer) != 0) {
- exit(1);
- }
-#else
- exit(1)
-#endif
- exit(0);
-}
# Extra autoconf macros for the Glasgow fptools
#
# To be a good autoconf citizen, names of local macros have prefixed with FP_ to
])# FP_EVAL_STDERR
-# FP_CHECK_FLAG(FLAG, [ACTION-IF-SUPPORTED], [ACTION-IF-NOT-SUPPORTED])
-# ---------------------------------------------------------------------
-# Check to see whether the compiler for the current language supports a
-# particular option.
-#
-# Implementation note: When given an unkown option, GCC issues an warning on
-# stderr only, but returns an exit value of 0 nevertheless. Consequently we have
-# to check stderr *and* the exit value.
-#
-# Used by ghc.
-AC_DEFUN([FP_CHECK_FLAG],
-[AC_LANG_COMPILER_REQUIRE()dnl
-AC_LANG_CASE([C], [fp_compiler="$CC" m4_pushdef([fp_Flags], [CFLAGS])],
- [C++], [fp_compiler="$CXX" m4_pushdef([fp_Flags], [CXXFLAGS])],
- [Fortran 77], [fp_compiler="$F77" m4_pushdef([fp_Flags], [FFLAGS])])
-m4_pushdef([fp_Cache], [fp_cv_[]fp_Flags[]AS_TR_SH([$1])])[]dnl
-AC_CACHE_CHECK([whether $fp_compiler accepts $1], [fp_Cache],
-[AC_LANG_CONFTEST([AC_LANG_PROGRAM()])
-fp_save_flags="$fp_Flags"
-fp_Flags="$fp_Flags $1"
-fp_Cache=no
-if FP_EVAL_STDERR([$ac_compile conftest.$ac_ext]) >/dev/null; then
- test -s conftest.err || fp_Cache=yes
-fi
-fp_Flags="$fp_save_flags"
-rm -f conftest.err conftest.$ac_ext])
-AS_IF([test $fp_Cache = yes], [$2], [$3])[]dnl
-m4_popdef([fp_Cache])[]dnl
-m4_popdef([fp_Flags])[]dnl
-])# FP_CHECK_FLAG
-
-
# FP_PROG_CONTEXT_DIFF
# --------------------
# Figure out how to do context diffs. Sets the output variable ContextDiffCmd.
[echo foo > conftest1
echo foo > conftest2
fp_cv_context_diff=no
-for fp_var in '-C 1' '-c1'
+for fp_var in '-U 1' '-u1' '-C 1' '-c1'
do
if diff $fp_var conftest1 conftest2 > /dev/null 2>&1; then
fp_cv_context_diff="diff $fp_var"
dnl
AC_DEFUN([FPTOOLS_HAPPY],
[AC_PATH_PROG(HappyCmd,happy,)
+# Happy is passed to Cabal, so we need a native path
+if test "x$HostPlatform" = "xi386-unknown-mingw32" && \
+ test "${OSTYPE}" != "msys" && \
+ test "${HappyCmd}" != ""
+then
+ # Canonicalise to <drive>:/path/to/gcc
+ HappyCmd=`cygpath -m ${HappyCmd}`
+ AC_MSG_NOTICE([normalized happy command to $HappyCmd])
+fi
+
AC_CACHE_CHECK([for version of happy], fptools_cv_happy_version,
changequote(, )dnl
[if test x"$HappyCmd" != x; then
dnl invoked with -v. We could try generating some HTML and grepping
dnl through that to find the version number, but I think we'll make
dnl do without it for now.
+# Haddock is passed to Cabal, so we need a native path
+if test "x$HostPlatform" = "xi386-unknown-mingw32" && \
+ test "${OSTYPE}" != "msys" && \
+ test "${HaddockCmd}" != ""
+then
+ # Canonicalise to <drive>:/path/to/gcc
+ HaddockCmd=`cygpath -m ${HaddockCmd}`
+ AC_MSG_NOTICE([normalized haddock command to $HaddockCmd])
+fi
])
dnl
AC_DEFUN([FPTOOLS_ALEX],
[
AC_PATH_PROG(AlexCmd,alex,)
+# Alex is passed to Cabal, so we need a native path
+if test "x$HostPlatform" = "xi386-unknown-mingw32" && \
+ test "${OSTYPE}" != "msys" && \
+ test "${AlexCmd}" != ""
+then
+ # Canonicalise to <drive>:/path/to/gcc
+ AlexCmd=`cygpath -m ${AlexCmd}`
+fi
+
AC_CACHE_CHECK([for version of alex], fptools_cv_alex_version,
changequote(, )dnl
[if test x"$AlexCmd" != x; then
)],
[])
;;
+ sparc-*-solaris2)
+ FP_COMPARE_VERSIONS([$fp_gcc_version], [-ge], [4.2],
+ [fp_cv_gcc_extra_opts="$fp_cv_gcc_extra_opts -fno-toplevel-reorder"],
+ [])
+ ;;
esac
])
AC_SUBST([GccExtraViaCOpts],$fp_cv_gcc_extra_opts)
tock = 1;
}
+static void timeout(int i)
+{
+ // timer_settime() has been known to hang, so just in case
+ // we install a 1-second timeout (see #2257)
+ exit(99);
+}
+
int main(int argc, char *argv[])
{
exit(3);
}
+ action.sa_handler = timeout;
+ action.sa_flags = 0;
+ sigemptyset(&action.sa_mask);
+ if (sigaction(SIGALRM, &action, NULL) == -1) {
+ fprintf(stderr,"SIGALRM problem\n");
+ exit(3);
+ }
+ alarm(1);
+
if (timer_create(CLOCK_PROCESS_CPUTIME_ID, &ev, &timer) != 0) {
fprintf(stderr,"No CLOCK_PROCESS_CPUTIME_ID timer\n");
exit(1);
out:
if (!tock) {
- fprintf(stderr,"no CLOCK_REALTIME signal\n");
+ fprintf(stderr,"no CLOCK_PROCESS_CPUTIME_ID signal\n");
exit(5);
}
}
it.it_value.tv_sec = 0;
- it.it_value.tv_nsec = 1;
+ it.it_value.tv_nsec = 1000000;
it.it_interval = it.it_value;
if (timer_settime(timer, 0, &it, NULL) != 0) {
fprintf(stderr,"settime problem\n");
tock = 0;
- usleep(300);
+ usleep(3000);
if (!tock) {
fprintf(stderr,"no CLOCK_REALTIME signal\n");