summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2014-01-09 19:14:09 +0100
committerWerner Koch <wk@gnupg.org>2014-01-24 17:41:20 +0100
commitf209d163a8167caa6910cd367aba923f703ac69e (patch)
treeda4a07bdfa7648ce05c0165b68c53b83b577b555 /m4
parent4e8a88e7632b1f1d2b31ae738a159802549882c3 (diff)
downloadlibgpg-error-f209d163a8167caa6910cd367aba923f703ac69e.tar.gz
Make multi-threading flags available via gpg-error-config.
* m4/threadlib.m4: Set THREADLIB_CPPFLAGS. * src/gpg-error-config.in: Add option --mt. * configure.ac: Add support for the --mt option. * src/gpg-error.m4: Add ac_subst GPG_ERROR_MT_CFLAGS and GPG_ERROR_MT_LIBS. -- Although, libgpg-error does not yet provide an API for multi-thread support, it is useful to add the already available detection to the config script. This allows the latest Libgcrypt to take advantage of this in its regression tests. In particular for the regression tests a gpgrt_thread functions would be useful and eventually added to libgpg-error. The new gpg-error.m4 script should already be used by other packages to be prepared for future updates.
Diffstat (limited to 'm4')
-rw-r--r--m4/threadlib.m420
1 files changed, 14 insertions, 6 deletions
diff --git a/m4/threadlib.m4 b/m4/threadlib.m4
index a91e819..b015365 100644
--- a/m4/threadlib.m4
+++ b/m4/threadlib.m4
@@ -1,4 +1,4 @@
-# threadlib.m4 serial 10 (gettext-0.18.2) modified by wk 2014-01-15.
+# threadlib.m4 serial 10 (gettext-0.18.2) modified by wk 2014-01-24.
dnl Copyright (C) 2005-2014 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -23,8 +23,8 @@ dnl Sets the variables LIBMULTITHREAD and LTLIBMULTITHREAD similarly, for
dnl programs that really need multithread functionality. The difference
dnl between LIBTHREAD and LIBMULTITHREAD is that on platforms supporting weak
dnl symbols, typically LIBTHREAD="" whereas LIBMULTITHREAD="-lpthread".
-dnl Adds to CPPFLAGS the flag -D_REENTRANT or -D_THREAD_SAFE if needed for
-dnl multithread-safe programs.
+dnl Sets THREADLIB_CPPFLAGS to -D_REENTRANT or -D_THREAD_SAFE if needed for
+dnl multithread-safe programs and adds THREADLIB_CPPFLAGS to CPPFLAGS.
AC_DEFUN([gl_THREADLIB_EARLY],
[
@@ -49,6 +49,7 @@ AC_DEFUN([gl_THREADLIB_EARLY_BODY],
[AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])],
[AC_REQUIRE([AC_GNU_SOURCE])])
dnl Check for multithreading.
+ THREADLIB_CPPFLAGS=""
m4_ifdef([gl_THREADLIB_DEFAULT_NO],
[m4_divert_text([DEFAULTS], [gl_use_threads_default=no])],
[m4_divert_text([DEFAULTS], [gl_use_threads_default=])])
@@ -89,17 +90,24 @@ changequote([,])dnl
# 2. putting a flag into CPPFLAGS that has an effect on the linker
# causes the AC_LINK_IFELSE test below to succeed unexpectedly,
# leading to wrong values of LIBTHREAD and LTLIBTHREAD.
- CPPFLAGS="$CPPFLAGS -D_REENTRANT"
+ THREADLIB_CPPFLAGS="$THREADLIB_CPPFLAGS -D_REENTRANT"
;;
esac
# Some systems optimize for single-threaded programs by default, and
# need special flags to disable these optimizations. For example, the
# definition of 'errno' in <errno.h>.
case "$host_os" in
- aix* | freebsd*) CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" ;;
- solaris*) CPPFLAGS="$CPPFLAGS -D_REENTRANT" ;;
+ aix* | freebsd*)
+ THREADLIB_CPPFLAGS="$THREADLIB_CPPFLAGS -D_THREAD_SAFE"
+ ;;
+ solaris*)
+ THREADLIB_CPPFLAGS="$THREADLIB_CPPFLAGS -D_REENTRANT"
+ ;;
esac
fi
+ if test x"$THREADLIB_CPPFLAGS" != x ; then
+ CPPFLAGS="$CPPFLAGS $THREADLIB_CPPFLAGS"
+ fi
])
dnl The guts of gl_THREADLIB. Needs to be expanded only once.