[pure-lang-svn] SF.net SVN: pure-lang:[745] pure/trunk
Status: Beta
Brought to you by:
agraef
|
From: <ag...@us...> - 2008-09-08 14:25:25
|
Revision: 745
http://pure-lang.svn.sourceforge.net/pure-lang/?rev=745&view=rev
Author: agraef
Date: 2008-09-08 14:25:33 +0000 (Mon, 08 Sep 2008)
Log Message:
-----------
Add checks for signal functions (requires reconfigure).
Modified Paths:
--------------
pure/trunk/config/aclocal.m4
pure/trunk/config.h.in
pure/trunk/configure
pure/trunk/configure.ac
Modified: pure/trunk/config/aclocal.m4
===================================================================
--- pure/trunk/config/aclocal.m4 2008-09-08 14:24:48 UTC (rev 744)
+++ pure/trunk/config/aclocal.m4 2008-09-08 14:25:33 UTC (rev 745)
@@ -82,3 +82,105 @@
[Define if you have <langinfo.h> and nl_langinfo(CODESET).])
fi
])
+
+dnl Check type of signal routines (posix, 4.2bsd, 4.1bsd or v7).
+
+AC_DEFUN([AC_SIGNAL_CHECK],
+[AC_REQUIRE([AC_TYPE_SIGNAL])
+AC_MSG_CHECKING(for type of signal functions)
+AC_CACHE_VAL(q_cv_signal_vintage,
+[
+ AC_TRY_LINK([#include <signal.h>],[
+ sigset_t ss;
+ struct sigaction sa;
+ sigemptyset(&ss); sigsuspend(&ss);
+ sigaction(SIGINT, &sa, (struct sigaction *) 0);
+ sigprocmask(SIG_BLOCK, &ss, (sigset_t *) 0);
+ ], q_cv_signal_vintage=posix,
+ [
+ AC_TRY_LINK([#include <signal.h>], [
+ int mask = sigmask(SIGINT);
+ sigsetmask(mask); sigblock(mask); sigpause(mask);
+ ], q_cv_signal_vintage=4.2bsd,
+ [
+ AC_TRY_LINK([
+ #include <signal.h>
+ RETSIGTYPE foo() { }], [
+ int mask = sigmask(SIGINT);
+ sigset(SIGINT, foo); sigrelse(SIGINT);
+ sighold(SIGINT); sigpause(SIGINT);
+ ], q_cv_signal_vintage=svr3, q_cv_signal_vintage=v7
+ )]
+ )]
+)
+])
+AC_MSG_RESULT($q_cv_signal_vintage)
+if test "$q_cv_signal_vintage" = posix; then
+AC_DEFINE(HAVE_POSIX_SIGNALS, 1, [Define if POSIX signal functions are available.])
+elif test "$q_cv_signal_vintage" = "4.2bsd"; then
+AC_DEFINE(HAVE_BSD_SIGNALS, 1, [Define if BSD signal functions are available.])
+elif test "$q_cv_signal_vintage" = svr3; then
+AC_DEFINE(HAVE_USG_SIGHOLD, 1, [Define if SVR3 signal functions are available.])
+fi
+])
+
+dnl Check whether signal handlers must be reinstalled when invoked.
+
+AC_DEFUN([AC_REINSTALL_SIGHANDLERS],
+[AC_REQUIRE([AC_TYPE_SIGNAL])
+AC_REQUIRE([AC_SIGNAL_CHECK])
+AC_MSG_CHECKING([if signal handlers must be reinstalled when invoked])
+AC_CACHE_VAL(q_cv_must_reinstall_sighandlers,
+[AC_TRY_RUN([
+#include <signal.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+typedef RETSIGTYPE sigfunc();
+int nsigint;
+#ifdef HAVE_POSIX_SIGNALS
+sigfunc *
+set_signal_handler(sig, handler)
+ int sig;
+ sigfunc *handler;
+{
+ struct sigaction act, oact;
+ act.sa_handler = handler;
+ act.sa_flags = 0;
+ sigemptyset (&act.sa_mask);
+ sigemptyset (&oact.sa_mask);
+ sigaction (sig, &act, &oact);
+ return (oact.sa_handler);
+}
+#else
+#define set_signal_handler(s, h) signal(s, h)
+#endif
+RETSIGTYPE
+sigint(s)
+ int s;
+{
+ nsigint++;
+}
+main()
+{
+ nsigint = 0;
+ set_signal_handler(SIGINT, sigint);
+ kill((int)getpid(), SIGINT);
+ kill((int)getpid(), SIGINT);
+ exit(nsigint != 2);
+}
+], q_cv_must_reinstall_sighandlers=no, q_cv_must_reinstall_sighandlers=yes,
+if test "$q_cv_signal_vintage" = svr3; then
+ q_cv_must_reinstall_sighandlers=yes
+else
+ q_cv_must_reinstall_sighandlers=no
+fi)])
+if test "$cross_compiling" = yes; then
+ AC_MSG_RESULT([$q_cv_must_reinstall_sighandlers assumed for cross compilation])
+else
+ AC_MSG_RESULT($q_cv_must_reinstall_sighandlers)
+fi
+if test "$q_cv_must_reinstall_sighandlers" = yes; then
+ AC_DEFINE(MUST_REINSTALL_SIGHANDLERS, 1, [Define if signal handlers must be reinstalled by handler.])
+fi
+])
Modified: pure/trunk/config.h.in
===================================================================
--- pure/trunk/config.h.in 2008-09-08 14:24:48 UTC (rev 744)
+++ pure/trunk/config.h.in 2008-09-08 14:25:33 UTC (rev 745)
@@ -18,6 +18,9 @@
*/
#undef HAVE_ALLOCA_H
+/* Define if BSD signal functions are available. */
+#undef HAVE_BSD_SIGNALS
+
/* Define to 1 if you have the `ftime' function. */
#undef HAVE_FTIME
@@ -54,6 +57,9 @@
/* Define to 1 if you have the `nanosleep' function. */
#undef HAVE_NANOSLEEP
+/* Define if POSIX signal functions are available. */
+#undef HAVE_POSIX_SIGNALS
+
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
@@ -75,6 +81,9 @@
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
+/* Define if SVR3 signal functions are available. */
+#undef HAVE_USG_SIGHOLD
+
/* Define to 1 if you have the `usleep' function. */
#undef HAVE_USLEEP
@@ -90,6 +99,9 @@
/* Define as const if the declaration of iconv() needs const. */
#undef ICONV_CONST
+/* Define if signal handlers must be reinstalled by handler. */
+#undef MUST_REINSTALL_SIGHANDLERS
+
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
@@ -105,6 +117,9 @@
/* Define to the version of this package. */
#undef PACKAGE_VERSION
+/* Define as the return type of signal handlers (`int' or `void'). */
+#undef RETSIGTYPE
+
/* The size of `void *', as computed by sizeof. */
#undef SIZEOF_VOID_P
Modified: pure/trunk/configure
===================================================================
--- pure/trunk/configure 2008-09-08 14:24:48 UTC (rev 744)
+++ pure/trunk/configure 2008-09-08 14:25:33 UTC (rev 745)
@@ -5472,6 +5472,352 @@
fi
done
+{ echo "$as_me:$LINENO: checking return type of signal handlers" >&5
+echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6; }
+if test "${ac_cv_type_signal+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+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 <signal.h>
+
+int
+main ()
+{
+return *(signal (0, 0)) (0) == 1;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+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_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_type_signal=int
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_type_signal=void
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5
+echo "${ECHO_T}$ac_cv_type_signal" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define RETSIGTYPE $ac_cv_type_signal
+_ACEOF
+
+
+
+{ echo "$as_me:$LINENO: checking for type of signal functions" >&5
+echo $ECHO_N "checking for type of signal functions... $ECHO_C" >&6; }
+if test "${q_cv_signal_vintage+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <signal.h>
+int
+main ()
+{
+
+ sigset_t ss;
+ struct sigaction sa;
+ sigemptyset(&ss); sigsuspend(&ss);
+ sigaction(SIGINT, &sa, (struct sigaction *) 0);
+ sigprocmask(SIG_BLOCK, &ss, (sigset_t *) 0);
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext 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>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
+ q_cv_signal_vintage=posix
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <signal.h>
+int
+main ()
+{
+
+ int mask = sigmask(SIGINT);
+ sigsetmask(mask); sigblock(mask); sigpause(mask);
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext 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>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
+ q_cv_signal_vintage=4.2bsd
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+ #include <signal.h>
+ RETSIGTYPE foo() { }
+int
+main ()
+{
+
+ int mask = sigmask(SIGINT);
+ sigset(SIGINT, foo); sigrelse(SIGINT);
+ sighold(SIGINT); sigpause(SIGINT);
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext 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>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
+ q_cv_signal_vintage=svr3
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ q_cv_signal_vintage=v7
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+
+fi
+
+{ echo "$as_me:$LINENO: result: $q_cv_signal_vintage" >&5
+echo "${ECHO_T}$q_cv_signal_vintage" >&6; }
+if test "$q_cv_signal_vintage" = posix; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_POSIX_SIGNALS 1
+_ACEOF
+
+elif test "$q_cv_signal_vintage" = "4.2bsd"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_BSD_SIGNALS 1
+_ACEOF
+
+elif test "$q_cv_signal_vintage" = svr3; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_USG_SIGHOLD 1
+_ACEOF
+
+fi
+
+
+
+{ echo "$as_me:$LINENO: checking if signal handlers must be reinstalled when invoked" >&5
+echo $ECHO_N "checking if signal handlers must be reinstalled when invoked... $ECHO_C" >&6; }
+if test "${q_cv_must_reinstall_sighandlers+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test "$cross_compiling" = yes; then
+ if test "$q_cv_signal_vintage" = svr3; then
+ q_cv_must_reinstall_sighandlers=yes
+else
+ q_cv_must_reinstall_sighandlers=no
+fi
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+#include <signal.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+typedef RETSIGTYPE sigfunc();
+int nsigint;
+#ifdef HAVE_POSIX_SIGNALS
+sigfunc *
+set_signal_handler(sig, handler)
+ int sig;
+ sigfunc *handler;
+{
+ struct sigaction act, oact;
+ act.sa_handler = handler;
+ act.sa_flags = 0;
+ sigemptyset (&act.sa_mask);
+ sigemptyset (&oact.sa_mask);
+ sigaction (sig, &act, &oact);
+ return (oact.sa_handler);
+}
+#else
+#define set_signal_handler(s, h) signal(s, h)
+#endif
+RETSIGTYPE
+sigint(s)
+ int s;
+{
+ nsigint++;
+}
+main()
+{
+ nsigint = 0;
+ set_signal_handler(SIGINT, sigint);
+ kill((int)getpid(), SIGINT);
+ kill((int)getpid(), SIGINT);
+ exit(nsigint != 2);
+}
+
+_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
+ q_cv_must_reinstall_sighandlers=no
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+q_cv_must_reinstall_sighandlers=yes
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+
+if test "$cross_compiling" = yes; then
+ { echo "$as_me:$LINENO: result: $q_cv_must_reinstall_sighandlers assumed for cross compilation" >&5
+echo "${ECHO_T}$q_cv_must_reinstall_sighandlers assumed for cross compilation" >&6; }
+else
+ { echo "$as_me:$LINENO: result: $q_cv_must_reinstall_sighandlers" >&5
+echo "${ECHO_T}$q_cv_must_reinstall_sighandlers" >&6; }
+fi
+if test "$q_cv_must_reinstall_sighandlers" = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define MUST_REINSTALL_SIGHANDLERS 1
+_ACEOF
+
+fi
+
{ echo "$as_me:$LINENO: checking for _Complex float" >&5
echo $ECHO_N "checking for _Complex float... $ECHO_C" >&6; }
if test "${ac_cv_type__Complex_float+set}" = set; then
Modified: pure/trunk/configure.ac
===================================================================
--- pure/trunk/configure.ac 2008-09-08 14:24:48 UTC (rev 744)
+++ pure/trunk/configure.ac 2008-09-08 14:25:33 UTC (rev 745)
@@ -91,6 +91,8 @@
AC_FUNC_ALLOCA
dnl Platform-dependent time functions.
AC_CHECK_FUNCS(ftime gettimeofday nanosleep usleep)
+dnl Platform specifics of signal handlers.
+AC_REINSTALL_SIGHANDLERS
dnl Check to see whether we have POSIX/ISOC99 complex numbers.
AC_CHECK_TYPES([_Complex float, _Complex double])
AC_CONFIG_FILES([Makefile])
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|