From 0761874c0bfe5da41ec10fc0835a8db233b1c11c Mon Sep 17 00:00:00 2001 From: Marcus Brinkmann Date: Tue, 16 Mar 2010 03:33:04 +0100 Subject: [PATCH 2/9] Make more signal and locale interface use conditional. --- bus/main.c | 6 ++++++ configure.in | 4 ++++ dbus/dbus-sysdeps.c | 8 +++++++- dbus/dbus-test-main.c | 5 ++++- test/test-segfault.c | 2 ++ 5 files changed, 23 insertions(+), 2 deletions(-) diff --git a/bus/main.c b/bus/main.c index 8f23896..4d45fb9 100644 --- a/bus/main.c +++ b/bus/main.c @@ -27,7 +27,9 @@ #include #include #include +#ifdef HAVE_SIGNAL_H #include +#endif #ifdef HAVE_ERRNO_H #include #endif @@ -65,9 +67,11 @@ signal_handler (int sig) } break; #endif +#ifdef SIGTERM case SIGTERM: _dbus_loop_quit (bus_context_get_loop (context)); break; +#endif } } @@ -469,7 +473,9 @@ main (int argc, char **argv) #ifdef SIGHUP _dbus_set_signal_handler (SIGHUP, signal_handler); #endif +#ifdef SIGTERM _dbus_set_signal_handler (SIGTERM, signal_handler); +#endif #ifdef DBUS_BUS_ENABLE_DNOTIFY_ON_LINUX _dbus_set_signal_handler (SIGIO, signal_handler); #endif /* DBUS_BUS_ENABLE_DNOTIFY_ON_LINUX */ diff --git a/configure.in b/configure.in index c037ec3..71e416a 100644 --- a/configure.in +++ b/configure.in @@ -475,6 +475,10 @@ AC_CHECK_HEADERS(execinfo.h, [AC_CHECK_FUNCS(backtrace)]) AC_CHECK_HEADERS(errno.h) +AC_CHECK_HEADERS(signal.h) + +AC_CHECK_HEADERS(locale.h) + AC_CHECK_HEADERS(byteswap.h) AC_CHECK_HEADERS(unistd.h) diff --git a/dbus/dbus-sysdeps.c b/dbus/dbus-sysdeps.c index 735f0b3..a22989d 100644 --- a/dbus/dbus-sysdeps.c +++ b/dbus/dbus-sysdeps.c @@ -34,7 +34,9 @@ * * These are the standard ANSI C headers... */ +#if HAVE_LOCALE_H #include +#endif #include #include #include @@ -622,10 +624,14 @@ ascii_strtod (const char *nptr, fail_pos = NULL; +#if HAVE_LOCALE_H locale_data = localeconv (); decimal_point = locale_data->decimal_point; - decimal_point_len = strlen (decimal_point); +#else + decimal_point = "."; +#endif + decimal_point_len = strlen (decimal_point); _dbus_assert (decimal_point_len != 0); decimal_point_pos = NULL; diff --git a/dbus/dbus-test-main.c b/dbus/dbus-test-main.c index 1bb7c90..2e3214b 100644 --- a/dbus/dbus-test-main.c +++ b/dbus/dbus-test-main.c @@ -26,7 +26,9 @@ #include "dbus-test.h" #include #include +#if HAVE_LOCALE_H #include +#endif int main (int argc, @@ -35,8 +37,9 @@ main (int argc, const char *test_data_dir; const char *specific_test; +#if HAVE_LOCALE_H setlocale(LC_ALL, ""); - +#endif if (argc > 1) test_data_dir = argv[1]; diff --git a/test/test-segfault.c b/test/test-segfault.c index bf4d964..329a21f 100644 --- a/test/test-segfault.c +++ b/test/test-segfault.c @@ -1,7 +1,9 @@ /* This is simply a process that segfaults */ #include #include +#ifdef HAVE_SIGNAL_H #include +#endif #ifdef HAVE_SETRLIMIT #include -- 1.6.3.3