~ubuntu-branches/ubuntu/hardy/gnupg2/hardy

« back to all changes in this revision

Viewing changes to m4/lock.m4

  • Committer: Bazaar Package Importer
  • Author(s): Michael Bienia
  • Date: 2007-05-15 13:54:55 UTC
  • mfrom: (1.1.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20070515135455-89qfyalmgjy6gcqw
Tags: 2.0.4-1ubuntu1
* Merge from debian unstable, remaining changes:
  - Remove libpcsclite-dev, libopensc2-dev build dependencies (they are in
    universe).
  - Build-depend on libcurl3-gnutls-dev
  - g10/call-agent.c: set DBG_ASSUAN to 0 to suppress a debug message
  - Include /doc files as done with gnupg
  - debian/rules: add doc/com-certs.pem to the docs for gpgsm
  - debian/copyright: update download url
  - debian/README.Debian: remove note the gnupg2 isn't released yet.
  - debian/control: Change Maintainer/XSBC-Original-Maintainer field.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# lock.m4 serial 2 (gettext-0.15)
2
 
dnl Copyright (C) 2005 Free Software Foundation, Inc.
 
1
# lock.m4 serial 6 (gettext-0.16)
 
2
dnl Copyright (C) 2005-2006 Free Software Foundation, Inc.
3
3
dnl This file is free software; the Free Software Foundation
4
4
dnl gives unlimited permission to copy and/or distribute it,
5
5
dnl with or without modifications, as long as this notice is preserved.
19
19
dnl Adds to CPPFLAGS the flag -D_REENTRANT or -D_THREAD_SAFE if needed for
20
20
dnl multithread-safe programs.
21
21
 
22
 
AC_DEFUN([gl_LOCK],
 
22
AC_DEFUN([gl_LOCK_EARLY],
23
23
[
24
 
  AC_REQUIRE([gl_LOCK_BODY])
 
24
  AC_REQUIRE([gl_LOCK_EARLY_BODY])
25
25
])
26
26
 
27
 
dnl The guts of gl_LOCK. Needs to be expanded only once.
 
27
dnl The guts of gl_LOCK_EARLY. Needs to be expanded only once.
28
28
 
29
 
AC_DEFUN([gl_LOCK_BODY],
 
29
AC_DEFUN([gl_LOCK_EARLY_BODY],
30
30
[
31
31
  dnl Ordering constraints: This macro modifies CPPFLAGS in a way that
32
32
  dnl influences the result of the autoconf tests that test for *_unlocked
40
40
  AC_ARG_ENABLE(threads,
41
41
AC_HELP_STRING([--enable-threads={posix|solaris|pth|win32}], [specify multithreading API])
42
42
AC_HELP_STRING([--disable-threads], [build without multithread safety]),
43
 
    gl_use_threads=$enableval, gl_use_threads=yes)
 
43
    [gl_use_threads=$enableval],
 
44
    [case "$host_os" in
 
45
       dnl Disable multithreading by default on OSF/1, because it interferes
 
46
       dnl with fork()/exec(): When msgexec is linked with -lpthread, its child
 
47
       dnl process gets an endless segmentation fault inside execvp().
 
48
       osf*) gl_use_threads=no ;;
 
49
       *)    gl_use_threads=yes ;;
 
50
     esac
 
51
    ])
 
52
  if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then
 
53
    # For using <pthread.h>:
 
54
    case "$host_os" in
 
55
      osf*)
 
56
        # On OSF/1, the compiler needs the flag -D_REENTRANT so that it
 
57
        # groks <pthread.h>. cc also understands the flag -pthread, but
 
58
        # we don't use it because 1. gcc-2.95 doesn't understand -pthread,
 
59
        # 2. putting a flag into CPPFLAGS that has an effect on the linker
 
60
        # causes the AC_TRY_LINK test below to succeed unexpectedly,
 
61
        # leading to wrong values of LIBTHREAD and LTLIBTHREAD.
 
62
        CPPFLAGS="$CPPFLAGS -D_REENTRANT"
 
63
        ;;
 
64
    esac
 
65
    # Some systems optimize for single-threaded programs by default, and
 
66
    # need special flags to disable these optimizations. For example, the
 
67
    # definition of 'errno' in <errno.h>.
 
68
    case "$host_os" in
 
69
      aix* | freebsd*) CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" ;;
 
70
      solaris*) CPPFLAGS="$CPPFLAGS -D_REENTRANT" ;;
 
71
    esac
 
72
  fi
 
73
])
 
74
 
 
75
dnl The guts of gl_LOCK. Needs to be expanded only once.
 
76
 
 
77
AC_DEFUN([gl_LOCK_BODY],
 
78
[
 
79
  AC_REQUIRE([gl_LOCK_EARLY_BODY])
44
80
  gl_threads_api=none
45
81
  LIBTHREAD=
46
82
  LTLIBTHREAD=
55
91
    AC_MSG_RESULT([$gl_have_weak])
56
92
    if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then
57
93
      # On OSF/1, the compiler needs the flag -pthread or -D_REENTRANT so that
58
 
      # it groks <pthread.h>.
59
 
      gl_save_CPPFLAGS="$CPPFLAGS"
60
 
      CPPFLAGS="$CPPFLAGS -D_REENTRANT"
 
94
      # it groks <pthread.h>. It's added above, in gl_LOCK_EARLY_BODY.
61
95
      AC_CHECK_HEADER(pthread.h, gl_have_pthread_h=yes, gl_have_pthread_h=no)
62
 
      CPPFLAGS="$gl_save_CPPFLAGS"
63
96
      if test "$gl_have_pthread_h" = yes; then
64
97
        # Other possible tests:
65
98
        #   -lpthreads (FSU threads, PCthreads)
66
99
        #   -lgthreads
67
 
        case "$host_os" in
68
 
          osf*)
69
 
            # On OSF/1, the compiler needs the flag -D_REENTRANT so that it
70
 
            # groks <pthread.h>. cc also understands the flag -pthread, but
71
 
            # we don't use it because 1. gcc-2.95 doesn't understand -pthread,
72
 
            # 2. putting a flag into CPPFLAGS that has an effect on the linker
73
 
            # causes the AC_TRY_LINK test below to succeed unexpectedly,
74
 
            # leading to wrong values of LIBTHREAD and LTLIBTHREAD.
75
 
            CPPFLAGS="$CPPFLAGS -D_REENTRANT"
76
 
            ;;
77
 
        esac
78
100
        gl_have_pthread=
79
101
        # Test whether both pthread_mutex_lock and pthread_mutexattr_init exist
80
102
        # in libc. IRIX 6.5 has the first one in both libc and libpthread, but
139
161
error "No, in FreeBSD 4.0 recursive mutexes actually don't work."
140
162
#else
141
163
int x = (int)PTHREAD_MUTEX_RECURSIVE;
 
164
return !x;
142
165
#endif],
143
166
            [AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE], 1,
144
167
               [Define if the <pthread.h> defines PTHREAD_MUTEX_RECURSIVE.])])
145
 
          # Some systems optimize for single-threaded programs by default, and
146
 
          # need special flags to disable these optimizations. For example, the
147
 
          # definition of 'errno' in <errno.h>.
148
 
          case "$host_os" in
149
 
            aix* | freebsd*) CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" ;;
150
 
            solaris*) CPPFLAGS="$CPPFLAGS -D_REENTRANT" ;;
151
 
          esac
152
168
        fi
153
169
      fi
154
170
    fi
227
243
  AC_SUBST(LTLIBTHREAD)
228
244
  AC_SUBST(LIBMULTITHREAD)
229
245
  AC_SUBST(LTLIBMULTITHREAD)
 
246
])
 
247
 
 
248
AC_DEFUN([gl_LOCK],
 
249
[
 
250
  AC_REQUIRE([gl_LOCK_EARLY])
 
251
  AC_REQUIRE([gl_LOCK_BODY])
230
252
  gl_PREREQ_LOCK
231
253
])
232
254