diff options
author | Gonzalo Paniagua Javier <gonzalo.mono@gmail.com> | 2004-04-07 01:33:21 +0400 |
---|---|---|
committer | Gonzalo Paniagua Javier <gonzalo.mono@gmail.com> | 2004-04-07 01:33:21 +0400 |
commit | be8cf2ca69e6a47e3a6163fbabd9e7bf9d91c2c0 (patch) | |
tree | 612ec7c38d875a29d782f94ed471633e300869c9 /configure.in | |
parent | 68d2803b80b33be9d8f91d87255b590036cdc731 (diff) |
2004-04-07 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* configure.in: don't try-run the tests for nptl and/or sigaltstack
if they are disabled in the command line.
svn path=/trunk/mono/; revision=25120
Diffstat (limited to 'configure.in')
-rw-r--r-- | configure.in | 224 |
1 files changed, 112 insertions, 112 deletions
diff --git a/configure.in b/configure.in index 133bee34f3e..a7e9e105039 100644 --- a/configure.in +++ b/configure.in @@ -585,145 +585,145 @@ if test x$platform_win32 = xno; then dnl *** Checks for working __thread *** dnl *********************************** AC_MSG_CHECKING(for working __thread) - AC_TRY_RUN([ - #include <pthread.h> - - __thread int i; - static int res1, res2; - - void thread_main (void *arg) - { - i = arg; - sleep (1); - if (arg == 1) - res1 = (i == arg); - else - res2 = (i == arg); - } + if test "x$with_nptl" != "xyes"; then + AC_MSG_RESULT(disabled) + else + AC_TRY_RUN([ + #include <pthread.h> - int main () { - pthread_t t1, t2; + __thread int i; + static int res1, res2; - i = 5; + void thread_main (void *arg) + { + i = arg; + sleep (1); + if (arg == 1) + res1 = (i == arg); + else + res2 = (i == arg); + } - pthread_create (&t1, NULL, thread_main, 1); - pthread_create (&t2, NULL, thread_main, 2); + int main () { + pthread_t t1, t2; - pthread_join (t1, NULL); - pthread_join (t2, NULL); + i = 5; - return !(res1 + res2 == 2); - } - ], [ - if test "x$with_nptl" != "xyes"; then - AC_MSG_RESULT(disabled) - else + pthread_create (&t1, NULL, thread_main, 1); + pthread_create (&t2, NULL, thread_main, 2); + + pthread_join (t1, NULL); + pthread_join (t2, NULL); + + return !(res1 + res2 == 2); + } + ], [ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_KW_THREAD) - fi - ], [ - AC_MSG_RESULT(no) - ]) + ], [ + AC_MSG_RESULT(no) + ]) + fi dnl ************************************** dnl *** Checks for working sigaltstack *** dnl ************************************** AC_MSG_CHECKING(for working sigaltstack) - AC_TRY_RUN([ - #include <stdio.h> - #include <stdlib.h> - #include <unistd.h> - #include <signal.h> - #include <pthread.h> - #include <sys/wait.h> - - static void - sigsegv_signal_handler (int _dummy, siginfo_t *info, void *context) - { - exit (0); - } - - static void * - loop (void *ignored) - { - char *ptr = NULL; - - *ptr = 0; - return NULL; - } - - static void - child () - { - struct sigaction sa; - struct sigaltstack sas; - pthread_t id; - pthread_attr_t attr; - - sa.sa_sigaction = sigsegv_signal_handler; - sigemptyset (&sa.sa_mask); - sa.sa_flags = SA_SIGINFO | SA_STACK; - if (sigaction (SIGSEGV, &sa, NULL) == -1) { - perror ("lala"); - return; + if test "x$with_sigaltstack" != "xyes"; then + AC_MSG_RESULT(disabled) + else + AC_TRY_RUN([ + #include <stdio.h> + #include <stdlib.h> + #include <unistd.h> + #include <signal.h> + #include <pthread.h> + #include <sys/wait.h> + + static void + sigsegv_signal_handler (int _dummy, siginfo_t *info, void *context) + { + exit (0); } - sas.ss_sp = malloc (SIGSTKSZ); - sas.ss_size = SIGSTKSZ; - sas.ss_flags = SS_ONSTACK; - if (sigaltstack (&sas, NULL) == -1) { - perror ("lala"); - return; - } + static void * + loop (void *ignored) + { + char *ptr = NULL; - pthread_attr_init (&attr); - if (pthread_create(&id, &attr, loop, &attr) != 0) { - printf ("failed\n"); - return; + *ptr = 0; + return NULL; } - sleep (100); - } + static void + child () + { + struct sigaction sa; + struct sigaltstack sas; + pthread_t id; + pthread_attr_t attr; + + sa.sa_sigaction = sigsegv_signal_handler; + sigemptyset (&sa.sa_mask); + sa.sa_flags = SA_SIGINFO | SA_STACK; + if (sigaction (SIGSEGV, &sa, NULL) == -1) { + perror ("lala"); + return; + } - int - main () - { - pid_t son; - int status; - int i; + sas.ss_sp = malloc (SIGSTKSZ); + sas.ss_size = SIGSTKSZ; + sas.ss_flags = SS_ONSTACK; + if (sigaltstack (&sas, NULL) == -1) { + perror ("lala"); + return; + } - son = fork (); - if (son == -1) { - return 1; - } + pthread_attr_init (&attr); + if (pthread_create(&id, &attr, loop, &attr) != 0) { + printf ("failed\n"); + return; + } - if (son == 0) { - child (); - return 0; + sleep (100); } - for (i = 0; i < 3; ++i) { - sleep (1); - waitpid (son, &status, WNOHANG); - if (WIFEXITED (status) && WEXITSTATUS (status) == 0) + int + main () + { + pid_t son; + int status; + int i; + + son = fork (); + if (son == -1) { + return 1; + } + + if (son == 0) { + child (); return 0; - } + } - kill (son, SIGKILL); - return 1; - } + for (i = 0; i < 3; ++i) { + sleep (1); + waitpid (son, &status, WNOHANG); + if (WIFEXITED (status) && WEXITSTATUS (status) == 0) + return 0; + } - ], [ - if test "x$with_sigaltstack" != "xyes"; then - AC_MSG_RESULT(disabled) - else + kill (son, SIGKILL); + return 1; + } + + ], [ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_WORKING_SIGALTSTACK) - fi - ], [ - with_sigaltstack=no - AC_MSG_RESULT(no) - ]) + ], [ + with_sigaltstack=no + AC_MSG_RESULT(no) + ]) + fi dnl ******************************** dnl *** Checks for semaphore lib *** |