bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

lock.m4 fix


From: Bruno Haible
Subject: lock.m4 fix
Date: Wed, 4 Oct 2006 18:38:55 +0200
User-agent: KMail/1.9.1

Hi,

In lock.m4 the separation into an "early" part and a normal part was not
done right: It was still not possible to invoke AC_GNU_SOURCE after
gl_LOCK_EARLY.

I fixed it now.


2006-10-01  Bruno Haible  <address@hidden>

        Make it possible to invoke AC_GNU_SOURCE after gl_LOCK_EARLY.
        * m4/lock.m4 (gl_LOCK_EARLY_BODY): New macro, extracted code from
        gl_LOCK_BODY.
        (gl_LOCK_EARLY): Require gl_LOCK_EARLY_BODY, not gl_LOCK_BODY.
        (gl_LOCK_BODY): Remove settings of CPPFLAGS, now done in
        gl_LOCK_EARLY_BODY.
        (gl_LOCK): Require gl_LOCK_BODY.

diff -r -c3 --exclude='*.po*' --exclude='*.info*' --exclude='*_*.html' 
--exclude='*.*.html' --exclude='*.[13]' --exclude='*.1.in' 
--exclude=Makefile.in --exclude=aclocal.m4 --exclude=configure 
--exclude=version.texi --exclude=stamp-vti --exclude='po-*-gen*.[ch]' 
--exclude='*.o' --exclude='*.lo' --exclude='*.gmo' --exclude=ABOUT-NLS 
--exclude=gnulib-lib --exclude=gnulib-m4 --exclude='javadoc[12]' --exclude=CVS 
gettext-cvs/gettext-runtime/m4/lock.m4 gettext-6/gettext-runtime/m4/lock.m4
*** lock.m4     Fri Sep 29 01:28:53 2006
--- lock.m4     Sun Oct  1 21:30:26 2006
***************
*** 1,4 ****
! # lock.m4 serial 5 (gettext-0.15.1)
  dnl Copyright (C) 2005-2006 Free Software Foundation, Inc.
  dnl This file is free software; the Free Software Foundation
  dnl gives unlimited permission to copy and/or distribute it,
--- 1,4 ----
! # lock.m4 serial 6 (gettext-0.15.1)
  dnl Copyright (C) 2005-2006 Free Software Foundation, Inc.
  dnl This file is free software; the Free Software Foundation
  dnl gives unlimited permission to copy and/or distribute it,
***************
*** 21,32 ****
  
  AC_DEFUN([gl_LOCK_EARLY],
  [
!   AC_REQUIRE([gl_LOCK_BODY])
  ])
  
  dnl The guts of gl_LOCK_EARLY. Needs to be expanded only once.
  
! AC_DEFUN([gl_LOCK_BODY],
  [
    dnl Ordering constraints: This macro modifies CPPFLAGS in a way that
    dnl influences the result of the autoconf tests that test for *_unlocked
--- 21,32 ----
  
  AC_DEFUN([gl_LOCK_EARLY],
  [
!   AC_REQUIRE([gl_LOCK_EARLY_BODY])
  ])
  
  dnl The guts of gl_LOCK_EARLY. Needs to be expanded only once.
  
! AC_DEFUN([gl_LOCK_EARLY_BODY],
  [
    dnl Ordering constraints: This macro modifies CPPFLAGS in a way that
    dnl influences the result of the autoconf tests that test for *_unlocked
***************
*** 49,54 ****
--- 49,82 ----
         *)    gl_use_threads=yes ;;
       esac
      ])
+   if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then
+     # For using <pthread.h>:
+     case "$host_os" in
+       osf*)
+         # On OSF/1, the compiler needs the flag -D_REENTRANT so that it
+         # groks <pthread.h>. cc also understands the flag -pthread, but
+         # we don't use it because 1. gcc-2.95 doesn't understand -pthread,
+         # 2. putting a flag into CPPFLAGS that has an effect on the linker
+         # causes the AC_TRY_LINK test below to succeed unexpectedly,
+         # leading to wrong values of LIBTHREAD and LTLIBTHREAD.
+         CPPFLAGS="$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" ;;
+     esac
+   fi
+ ])
+ 
+ dnl The guts of gl_LOCK. Needs to be expanded only once.
+ 
+ AC_DEFUN([gl_LOCK_BODY],
+ [
+   AC_REQUIRE([gl_LOCK_EARLY_BODY])
    gl_threads_api=none
    LIBTHREAD=
    LTLIBTHREAD=
***************
*** 63,88 ****
      AC_MSG_RESULT([$gl_have_weak])
      if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then
        # On OSF/1, the compiler needs the flag -pthread or -D_REENTRANT so that
!       # it groks <pthread.h>.
!       gl_save_CPPFLAGS="$CPPFLAGS"
!       CPPFLAGS="$CPPFLAGS -D_REENTRANT"
        AC_CHECK_HEADER(pthread.h, gl_have_pthread_h=yes, gl_have_pthread_h=no)
-       CPPFLAGS="$gl_save_CPPFLAGS"
        if test "$gl_have_pthread_h" = yes; then
          # Other possible tests:
          #   -lpthreads (FSU threads, PCthreads)
          #   -lgthreads
-         case "$host_os" in
-           osf*)
-             # On OSF/1, the compiler needs the flag -D_REENTRANT so that it
-             # groks <pthread.h>. cc also understands the flag -pthread, but
-             # we don't use it because 1. gcc-2.95 doesn't understand -pthread,
-             # 2. putting a flag into CPPFLAGS that has an effect on the linker
-             # causes the AC_TRY_LINK test below to succeed unexpectedly,
-             # leading to wrong values of LIBTHREAD and LTLIBTHREAD.
-             CPPFLAGS="$CPPFLAGS -D_REENTRANT"
-             ;;
-         esac
          gl_have_pthread=
          # Test whether both pthread_mutex_lock and pthread_mutexattr_init 
exist
          # in libc. IRIX 6.5 has the first one in both libc and libpthread, but
--- 91,102 ----
      AC_MSG_RESULT([$gl_have_weak])
      if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then
        # On OSF/1, the compiler needs the flag -pthread or -D_REENTRANT so that
!       # it groks <pthread.h>. It's added above, in gl_LOCK_EARLY_BODY.
        AC_CHECK_HEADER(pthread.h, gl_have_pthread_h=yes, gl_have_pthread_h=no)
        if test "$gl_have_pthread_h" = yes; then
          # Other possible tests:
          #   -lpthreads (FSU threads, PCthreads)
          #   -lgthreads
          gl_have_pthread=
          # Test whether both pthread_mutex_lock and pthread_mutexattr_init 
exist
          # in libc. IRIX 6.5 has the first one in both libc and libpthread, but
***************
*** 151,163 ****
  #endif],
              [AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE], 1,
                 [Define if the <pthread.h> defines PTHREAD_MUTEX_RECURSIVE.])])
-           # 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" ;;
-           esac
          fi
        fi
      fi
--- 165,170 ----
***************
*** 240,246 ****
  
  AC_DEFUN([gl_LOCK],
  [
!   AC_REQUIRE([gl_LOCK_EARLY])
    gl_PREREQ_LOCK
  ])
  
--- 247,254 ----
  
  AC_DEFUN([gl_LOCK],
  [
!   AC_REQUIRE([gl_LOCK_EARLY])
!   AC_REQUIRE([gl_LOCK_BODY])
    gl_PREREQ_LOCK
  ])
  




reply via email to

[Prev in Thread] Current Thread [Next in Thread]