bug-guile
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CVS-060720 compilation failure on Solaris 10, patch


From: Claes Wallin
Subject: CVS-060720 compilation failure on Solaris 10, patch
Date: Thu, 20 Jul 2006 05:48:04 +0200
User-agent: Thunderbird 1.5.0.4 (Macintosh/20060516)

Yes, this time I checked it against the CVS. :-)

guile-CVS-060720 doesn't compile on Solaris 10. Attaching patch.

Comments:
 - Compiles and passes standalone tests now. Gets stack overflows on
   elisp.test and when trying to start 'guile'.

 - The sethostname and PTHREAD_ONCE_INIT conditions should be tested for
   instead of just slapping a __sun__ on the workarounds. Please help.

 - Does any __GNUC__ platform _not_ want alloca.h?

 - The patch touches a few files, but only few rows in each. Splitting
   it up would simply mean splitting it into the individual files.
   The only interdependency is the pthread_getattr_np check and guard.

   /c
2006-07-20  Claes Wallin  <address@hidden>

        * configure.in:
                demand C99 for math functions
                check for pthread_getattr_np

        * libguile/threads.c:
                include <string.h> (FD_ZERO evals to memset)
             (get_thread_stack_base):
                require pthread_getattr_np

        * libguile/eval.c:
        * libguile/filesys.c:
                __GNUC__ on __sun__ needs <alloca.h>

        * libguile/posix.c:
                declare sethostname on __sun__

        * libguile/pthreads-threads.h:
                add {} around PTHREAD_ONCE_INIT on __sun__

        * test-suite/standalone/*.c:
                scm_init_guile -> scm_boot_guile

        * test-suite/standalone/test-require-extension:
                "!" not understood by /bin/sh on Solaris 10
diff -ur ../guile-core/configure.in ./configure.in
--- ../guile-core/configure.in  2006-06-18 01:15:59.000000000 +0200
+++ ./configure.in      2006-07-20 03:40:51.000000000 +0200
@@ -59,6 +59,7 @@
 
 AC_PROG_INSTALL
 AC_PROG_CC
+AC_PROG_CC_C99
 AC_PROG_CPP
 AC_PROG_AWK
 
@@ -66,8 +67,6 @@
 AC_ISC_POSIX
 AC_MINIX
 
-AM_PROG_CC_STDC
-
 AC_LIBTOOL_DLOPEN
 AC_PROG_LIBTOOL
 AC_CHECK_LIB([ltdl], [lt_dlinit], ,
@@ -1006,7 +1005,7 @@
 
     old_CFLAGS="$CFLAGS"
     CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
-    AC_CHECK_FUNCS(pthread_attr_getstack)
+    AC_CHECK_FUNCS([[pthread_attr_getstack pthread_getattr_np]])
     CFLAGS="$old_CFLAGS"
 
     # On Solaris, sched_yield lives in -lrt.
diff -ur ../guile-core/libguile/eval.c ./libguile/eval.c
--- ../guile-core/libguile/eval.c       2006-06-18 01:05:03.000000000 +0200
+++ ./libguile/eval.c   2006-07-20 04:59:57.000000000 +0200
@@ -40,19 +40,21 @@
 /* AIX requires this to be the first thing in the file.  The #pragma
    directive is indented so pre-ANSI compilers will ignore it, rather
    than choke on it.  */
-#ifndef __GNUC__
+
+#if !defined(__GNUC__) || defined(__sun__)
 # if HAVE_ALLOCA_H
 #  include <alloca.h>
-# else
+# else /* !HAVE_ALLOCA_H */
 #  ifdef _AIX
 #   pragma alloca
-#  else
+#  else /* !_AIX */
 #   ifndef alloca /* predefined by HP cc +Olibcalls */
 char *alloca ();
-#   endif
-#  endif
-# endif
-#endif
+#   endif /* !alloca */
+#  endif /* !_AIX */
+# endif /* !HAVE_ALLOCA_H */
+#endif /* !__GNUC__ || __sun__ */
+
 #if HAVE_MALLOC_H
 #include <malloc.h> /* alloca on mingw */
 #endif
diff -ur ../guile-core/libguile/filesys.c ./libguile/filesys.c
--- ../guile-core/libguile/filesys.c    2006-06-18 01:05:03.000000000 +0200
+++ ./libguile/filesys.c        2006-07-20 05:00:48.000000000 +0200
@@ -32,19 +32,21 @@
 /* AIX requires this to be the first thing in the file.  The #pragma
    directive is indented so pre-ANSI compilers will ignore it, rather
    than choke on it.  */
-#ifndef __GNUC__
+
+#if !defined(__GNUC__) || defined(__sun__)
 # if HAVE_ALLOCA_H
 #  include <alloca.h>
-# else
+# else /* !HAVE_ALLOCA_H */
 #  ifdef _AIX
 #   pragma alloca
-#  else
+#  else /* !_AIX */
 #   ifndef alloca /* predefined by HP cc +Olibcalls */
 char *alloca ();
-#   endif
-#  endif
-# endif
-#endif
+#   endif /* !alloca */
+#  endif /* !_AIX */
+# endif /* !HAVE_ALLOCA_H */
+#endif /* !__GNUC__ || __sun__ */
+
 #if HAVE_MALLOC_H
 #include <malloc.h> /* alloca on mingw, though its not used on that system */
 #endif
diff -ur ../guile-core/libguile/posix.c ./libguile/posix.c
--- ../guile-core/libguile/posix.c      2006-06-18 01:05:03.000000000 +0200
+++ ./libguile/posix.c  2006-07-20 05:23:30.000000000 +0200
@@ -65,6 +65,10 @@
 #endif
 #endif
 
+#ifdef __sun__
+int sethostname(char *name, int namelen);
+#endif
+
 #ifdef LIBC_H_WITH_UNISTD_H
 #include <libc.h>
 #endif
diff -ur ../guile-core/libguile/pthread-threads.h ./libguile/pthread-threads.h
--- ../guile-core/libguile/pthread-threads.h    2006-04-17 02:05:40.000000000 
+0200
+++ ./libguile/pthread-threads.h        2006-07-20 05:20:11.000000000 +0200
@@ -66,9 +66,15 @@
 /* Onces
  */
 #define scm_i_pthread_once_t                pthread_once_t
-#define SCM_I_PTHREAD_ONCE_INIT             PTHREAD_ONCE_INIT
 #define scm_i_pthread_once                  pthread_once
 
+#ifdef __sun__
+/* workaround for broken Solaris 10 headers */
+#define SCM_I_PTHREAD_ONCE_INIT             { PTHREAD_ONCE_INIT }
+#else /* !__sun__ */
+#define SCM_I_PTHREAD_ONCE_INIT             PTHREAD_ONCE_INIT
+#endif /* !__sun__ */
+
 /* Thread specific storage
  */
 #define scm_i_pthread_key_t                 pthread_key_t
diff -ur ../guile-core/libguile/threads.c ./libguile/threads.c
--- ../guile-core/libguile/threads.c    2006-04-17 02:05:42.000000000 +0200
+++ ./libguile/threads.c        2006-07-20 03:53:36.000000000 +0200
@@ -30,6 +30,9 @@
 #if HAVE_SYS_TIME_H
 #include <sys/time.h>
 #endif
+#if HAVE_STRING_H      /* On Solaris 10, FD_ZERO uses memset */
+#include <string.h>
+#endif
 
 #include "libguile/validate.h"
 #include "libguile/root.h"
@@ -567,6 +570,7 @@
 
 #if SCM_USE_PTHREAD_THREADS
 #ifdef HAVE_PTHREAD_ATTR_GETSTACK
+#ifdef HAVE_PTHREAD_GETATTR_NP
 
 #define HAVE_GET_THREAD_STACK_BASE
 
@@ -600,6 +604,7 @@
     }
 }
 
+#endif /* HAVE_PTHREAD_GETATTR_NP */
 #endif /* HAVE_PTHREAD_ATTR_GETSTACK */
 
 #else /* !SCM_USE_PTHREAD_THREADS */
diff -ur ../guile-core/test-suite/standalone/test-conversion.c 
./test-suite/standalone/test-conversion.c
--- ../guile-core/test-suite/standalone/test-conversion.c       2006-04-17 
01:27:13.000000000 +0200
+++ ./test-suite/standalone/test-conversion.c   2006-07-20 04:38:09.000000000 
+0200
@@ -1010,10 +1010,7 @@
   test_11 ("(string #\\f #\\nul)", NULL, 1, 0);
 }
 
-int
-main (int argc, char *argv[])
-{
-  scm_init_guile();
+static void f() {
   test_is_signed_integer ();
   test_is_unsigned_integer ();
   test_to_signed_integer ();
@@ -1024,5 +1021,11 @@
   test_from_double ();
   test_to_double ();
   test_locale_strings ();
+}
+
+int
+main (int argc, char *argv[])
+{
+  scm_boot_guile(argc, argv, f, NULL);
   return 0;
 }
diff -ur ../guile-core/test-suite/standalone/test-gh.c 
./test-suite/standalone/test-gh.c
--- ../guile-core/test-suite/standalone/test-gh.c       2006-04-17 
01:27:13.000000000 +0200
+++ ./test-suite/standalone/test-gh.c   2006-07-20 04:34:28.000000000 +0200
@@ -70,8 +70,7 @@
 int 
 main (int argc, char *argv[])
 {
-  scm_init_guile ();
-  test_gh_set_substr ();
+  scm_boot_guile(argc, argv, test_gh_set_substr, NULL);
   return 0;
 }
 
diff -ur ../guile-core/test-suite/standalone/test-list.c 
./test-suite/standalone/test-list.c
--- ../guile-core/test-suite/standalone/test-list.c     2006-02-04 
00:34:48.000000000 +0100
+++ ./test-suite/standalone/test-list.c 2006-07-20 04:42:12.000000000 +0200
@@ -26,7 +26,7 @@
 /* pretty trivial, but ensure this entrypoint exists, since it was
    documented in Guile 1.6 and earlier */
 static void
-test_scm_list (void)
+test_scm_list ()
 {
   {
     if (! scm_is_eq (SCM_EOL, scm_list (SCM_EOL)))
@@ -49,7 +49,6 @@
 int
 main (int argc, char **argv)
 {
-  scm_init_guile();
-  test_scm_list ();
+  scm_boot_guile(argc, argv, test_scm_list, NULL);
   return 0;
 }
diff -ur ../guile-core/test-suite/standalone/test-num2integral.c 
./test-suite/standalone/test-num2integral.c
--- ../guile-core/test-suite/standalone/test-num2integral.c     2006-04-17 
01:27:13.000000000 +0200
+++ ./test-suite/standalone/test-num2integral.c 2006-07-20 04:37:41.000000000 
+0200
@@ -141,12 +141,15 @@
 #endif /* SCM_SIZEOF_LONG_LONG != 0 */
 }
 
+static void f() {
+  test_long_long ();
+  test_ulong_long ();
+}
+
 int
 main (int argc, char *argv[])
 {
-  scm_init_guile();
-  test_long_long ();
-  test_ulong_long ();
+  scm_boot_guile(argc, argv, f, NULL);
   return 0;
 }
 
diff -ur ../guile-core/test-suite/standalone/test-require-extension 
./test-suite/standalone/test-require-extension
--- ../guile-core/test-suite/standalone/test-require-extension  2005-02-12 
07:15:07.000000000 +0100
+++ ./test-suite/standalone/test-require-extension      2006-07-20 
04:52:27.000000000 +0200
@@ -2,9 +2,9 @@
 
 set -e
 
-! guile -c '(require-extension 7)' 2> /dev/null
-! guile -c '(require-extension (blarg))' 2> /dev/null
-! guile -c '(require-extension (srfi "foo"))' 2> /dev/null
+guile -c '(require-extension 7)'  2> /dev/null && exit 2
+guile -c '(require-extension (blarg))' 2> /dev/null && exit 2
+guile -c '(require-extension (srfi "foo"))' 2> /dev/null && exit 2
 
 guile -c '(require-extension (srfi 1)) (exit (procedure? take-right))'
 guile -c '(require-extension (srfi))'
diff -ur ../guile-core/test-suite/standalone/test-round.c 
./test-suite/standalone/test-round.c
--- ../guile-core/test-suite/standalone/test-round.c    2006-04-17 
01:27:13.000000000 +0200
+++ ./test-suite/standalone/test-round.c        2006-07-20 04:39:56.000000000 
+0200
@@ -116,7 +116,6 @@
 int
 main (int argc, char *argv[])
 {
-  scm_init_guile();
-  test_scm_c_round ();
+  scm_boot_guile(argc, argv, test_scm_c_round, NULL);
   return 0;
 }

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]