From 10a6c56071bc1048f6b89809f31543ac97ec9447 Mon Sep 17 00:00:00 2001 From: Paul Millar Date: Tue, 7 Dec 2004 17:19:54 +0000 Subject: [PATCH] Check for features missing in mingw environment, allowing tools subdirectory to be cross-built again. --- configure | 129 ++++++++++++++++++++++++++++++++++++++++ configure.ac | 10 ++++ include/config.h.in | 9 +++ tools/winebuild/main.c | 2 + tools/winegcc/winegcc.c | 12 +++- 5 files changed, 161 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 7596753515d..e5fad70f4db 100755 --- a/configure +++ b/configure @@ -16192,6 +16192,7 @@ fi + for ac_func in \ @@ -16240,6 +16241,7 @@ for ac_func in \ sendmsg \ settimeofday \ sigaltstack \ + sigprocmask \ snprintf \ spawnvp \ statfs \ @@ -17436,6 +17438,71 @@ cat >>confdefs.h <<_ACEOF _ACEOF +fi + +echo "$as_me:$LINENO: checking for sigset_t" >&5 +echo $ECHO_N "checking for sigset_t... $ECHO_C" >&6 +if test "${ac_cv_type_sigset_t+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 + +int +main () +{ +if ((sigset_t *) 0) + return 0; +if (sizeof (sigset_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_sigset_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_sigset_t=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_sigset_t" >&5 +echo "${ECHO_T}$ac_cv_type_sigset_t" >&6 +if test $ac_cv_type_sigset_t = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_SIGSET_T 1 +_ACEOF + + fi @@ -17507,6 +17574,68 @@ _ACEOF fi +echo "$as_me:$LINENO: checking for sigaddset" >&5 +echo $ECHO_N "checking for sigaddset... $ECHO_C" >&6 +if test "${wine_cv_have_sigaddset+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 +int +main () +{ +sigset_t set; sigaddset(&set,SIGTERM); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + wine_cv_have_sigaddset=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +wine_cv_have_sigaddset=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $wine_cv_have_sigaddset" >&5 +echo "${ECHO_T}$wine_cv_have_sigaddset" >&6 +if test "$wine_cv_have_sigaddset" = "yes" +then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_SIGADDSET 1 +_ACEOF + +fi + echo "$as_me:$LINENO: checking whether we can use re-entrant gethostbyname_r Linux style" >&5 echo $ECHO_N "checking whether we can use re-entrant gethostbyname_r Linux style... $ECHO_C" >&6 diff --git a/configure.ac b/configure.ac index 3284c6bf148..321afae68c1 100644 --- a/configure.ac +++ b/configure.ac @@ -1158,6 +1158,7 @@ AC_CHECK_FUNCS(\ sendmsg \ settimeofday \ sigaltstack \ + sigprocmask \ snprintf \ spawnvp \ statfs \ @@ -1244,6 +1245,7 @@ dnl **** Check for types **** AC_C_CONST AC_C_INLINE AC_CHECK_TYPES([mode_t, off_t, pid_t, size_t, ssize_t, long long, fsblkcnt_t, fsfilcnt_t]) +AC_CHECK_TYPES([sigset_t],,,[#include ]) AC_CACHE_CHECK([whether linux/input.h is for real], wine_cv_linux_input_h, @@ -1265,6 +1267,14 @@ AC_CACHE_CHECK([whether linux/input.h is for real], [Define if we have linux/input.h AND it contains the INPUT event API]) fi +AC_CACHE_CHECK([for sigaddset],wine_cv_have_sigaddset, + AC_TRY_LINK([#include ],[sigset_t set; sigaddset(&set,SIGTERM);], + wine_cv_have_sigaddset=yes,wine_cv_have_sigaddset=no)) +if test "$wine_cv_have_sigaddset" = "yes" +then + AC_DEFINE(HAVE_SIGADDSET, 1, [Define if sigaddset is supported]) +fi + AC_CACHE_CHECK([whether we can use re-entrant gethostbyname_r Linux style], wine_cv_linux_gethostbyname_r_6, diff --git a/include/config.h.in b/include/config.h.in index a4fa411e90b..1dcd198e1f4 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -494,15 +494,24 @@ /* Define to 1 if you have the `settimeofday' function. */ #undef HAVE_SETTIMEOFDAY +/* Define if sigaddset is supported */ +#undef HAVE_SIGADDSET + /* Define to 1 if you have the `sigaltstack' function. */ #undef HAVE_SIGALTSTACK /* Define to 1 if `si_fd' is member of `siginfo_t'. */ #undef HAVE_SIGINFO_T_SI_FD +/* Define to 1 if you have the `sigprocmask' function. */ +#undef HAVE_SIGPROCMASK + /* Define to 1 if you have the sigsetjmp (and siglongjmp) function */ #undef HAVE_SIGSETJMP +/* Define to 1 if the system has the type `sigset_t'. */ +#undef HAVE_SIGSET_T + /* Define to 1 if the system has the type `size_t'. */ #undef HAVE_SIZE_T diff --git a/tools/winebuild/main.c b/tools/winebuild/main.c index 3a1c443ab5b..15f3bf8ef62 100644 --- a/tools/winebuild/main.c +++ b/tools/winebuild/main.c @@ -421,7 +421,9 @@ int main(int argc, char **argv) { DLLSPEC *spec = alloc_dll_spec(); +#ifdef SIGHUP signal( SIGHUP, exit_on_signal ); +#endif signal( SIGTERM, exit_on_signal ); signal( SIGINT, exit_on_signal ); diff --git a/tools/winegcc/winegcc.c b/tools/winegcc/winegcc.c index 5d0b854cd66..840480967e2 100644 --- a/tools/winegcc/winegcc.c +++ b/tools/winegcc/winegcc.c @@ -138,7 +138,9 @@ static const char* app_loader_template = static int keep_generated = 0; static strarray* tmp_files; +#ifdef HAVE_SIGSET_T static sigset_t signal_mask; +#endif struct options { @@ -180,11 +182,13 @@ static void exit_on_signal( int sig ) static char* get_temp_file(const char* prefix, const char* suffix) { int fd; - sigset_t old_set; char* tmp = strmake("%s-XXXXXX%s", prefix, suffix); +#ifdef HAVE_SIGPROCMASK + sigset_t old_set; /* block signals while manipulating the temp files list */ sigprocmask( SIG_BLOCK, &signal_mask, &old_set ); +#endif fd = mkstemps( tmp, strlen(suffix) ); if (fd == -1) { @@ -196,7 +200,9 @@ static char* get_temp_file(const char* prefix, const char* suffix) } close( fd ); strarray_add(tmp_files, tmp); +#ifdef HAVE_SIGPROCMASK sigprocmask( SIG_SETMASK, &old_set, NULL ); +#endif return tmp; } @@ -700,13 +706,17 @@ int main(int argc, char **argv) char* lang = 0; char* str; +#ifdef SIGHUP signal( SIGHUP, exit_on_signal ); +#endif signal( SIGTERM, exit_on_signal ); signal( SIGINT, exit_on_signal ); +#ifdef HAVE_SIGADDSET sigemptyset( &signal_mask ); sigaddset( &signal_mask, SIGHUP ); sigaddset( &signal_mask, SIGTERM ); sigaddset( &signal_mask, SIGINT ); +#endif /* setup tmp file removal at exit */ tmp_files = strarray_alloc();