Package: ghc6
Severity: important
Tags: patch

Hello,

ghc6 currently FTBFS on hurd-i386 because there is no support there for
setitimer(ITIMER_VIRTUAL).  The attached patch was submitted upstream on
http://hackage.haskell.org/trac/ghc/ticket/2883
to autodetect such case and cope with.

Samuel

-- System Information:
Debian Release: 5.0
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (500, 'stable'), (1, 
'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.27 (SMP w/2 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

-- 
Samuel
 La carte réseau fournie par cybercable (sn2000) ne va-t-elle que sur
 bus isa ou peut-on aussi la mettre sur bus PCI.
 Merci de m'éclairer.
 -+- JP in le Neuneu Pète un Câble : Une carte dans chaque port -+-
diff -ur ghc6-6.8.2/configure.ac ghc6-6.8.2-mine/configure.ac
--- ghc6-6.8.2/configure.ac     2007-12-10 19:11:32.000000000 +0100
+++ ghc6-6.8.2-mine/configure.ac        2008-12-20 11:53:05.000000000 +0100
@@ -1078,6 +1078,17 @@
 dnl ** check for more functions
 dnl ** The following have been verified to be used in ghc/, but might be used 
somewhere else, too.
 AC_CHECK_FUNCS([getclock getrusage gettimeofday setitimer siginterrupt sysconf 
times ctime_r])
+AC_TRY_RUN([
+#include <sys/types.h>
+#include <sys/time.h>
+int main(void) {
+  struct itimerval tval;
+  tval.it_value.tv_sec = 1;
+  tval.it_value.tv_usec = 0;
+  tval.it_interval = tval.it_value;
+  return setitimer(ITIMER_VIRTUAL, &tval, (void*)0) != 0;
+}
+],[AC_DEFINE([HAVE_SETITIMER_VIRTUAL], [1], [Define to 1 if setitimer accepts 
ITIMER_VIRTUAL, 0 else.])])
 dnl ** On OS X 10.4 (at least), time.h doesn't declare ctime_r if
 dnl ** _POSIX_C_SOURCE is defined
 AC_CHECK_DECLS([ctime_r], , ,
diff -ur ghc6-6.8.2/configure ghc6-6.8.2-mine/configure
--- ghc6-6.8.2/configure        2007-12-10 19:27:08.000000000 +0100
+++ ghc6-6.8.2-mine/configure   2008-12-20 11:53:44.000000000 +0100
@@ -18129,6 +18129,66 @@
 fi
 done
 
+if test "$cross_compiling" = yes; then
+  { { echo "$as_me:$LINENO: error: cannot run test program while cross 
compiling
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+#include <sys/types.h>
+#include <sys/time.h>
+int main(void) {
+  struct itimerval tval;
+  tval.it_value.tv_sec = 1;
+  tval.it_value.tv_usec = 0;
+  tval.it_interval = tval.it_value;
+  return setitimer(ITIMER_VIRTUAL, &tval, (void*)0) != 0;
+}
+
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_SETITIMER_VIRTUAL 1
+_ACEOF
+
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext 
conftest.$ac_objext conftest.$ac_ext
+fi
+
+
 echo "$as_me:$LINENO: checking whether ctime_r is declared" >&5
 echo $ECHO_N "checking whether ctime_r is declared... $ECHO_C" >&6
 if test "${ac_cv_have_decl_ctime_r+set}" = set; then
diff -ur ghc6-6.8.2/mk/config.h.in ghc6-6.8.2-mine/mk/config.h.in
--- ghc6-6.8.2/mk/config.h.in   2007-12-10 19:27:08.000000000 +0100
+++ ghc6-6.8.2-mine/mk/config.h.in      2008-12-20 11:12:59.000000000 +0100
@@ -167,6 +167,9 @@
 /* Define to 1 if you have the `setitimer' function. */
 #undef HAVE_SETITIMER
 
+/* Define to 1 if setitimer accepts ITIMER_VIRTUAL, 0 else. */
+#undef HAVE_SETITIMER_VIRTUAL
+
 /* Define to 1 if you have the `siginterrupt' function. */
 #undef HAVE_SIGINTERRUPT
 
diff -ur ghc6-6.8.2/rts/posix/Itimer.c ghc6-6.8.2-mine/rts/posix/Itimer.c
--- ghc6-6.8.2/rts/posix/Itimer.c       2007-12-10 19:11:32.000000000 +0100
+++ ghc6-6.8.2-mine/rts/posix/Itimer.c  2008-12-20 11:31:53.000000000 +0100
@@ -80,7 +80,7 @@
 
 #elif defined(HAVE_SETITIMER)
 
-#  ifdef THREADED_RTS
+#  if defined(THREADED_RTS) || !defined(HAVE_SETITIMER_VIRTUAL)
 //   Oh dear, we have to use SIGALRM if there's no timer_create and
 //   we're using the THREADED_RTS.  This leads to problems, see bug #850.
 #    define ITIMER_SIGNAL  SIGALRM

Reply via email to