Eric Blake wrote: > > m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.62]),[-1], > > [AC_REQUIRE([AC_GNU_SOURCE])], > > [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])]) > > Why not the simpler: > > m4_ifndef([AC_USE_SYSTEM_EXTENSIONS], > [AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS], [AC_GNU_SOURCE])])
After verifying that AC_USE_SYSTEM_EXTENSIONS subsumed AC_GNU_SOURCE from the beginning, this is as good. Indeed, no need to use m4_PACKAGE_VERSION in this case. > *************** > *** 35,41 **** > AC_BEFORE([$0], [gl_ARGP])dnl > > AC_REQUIRE([AC_CANONICAL_HOST]) > ! AC_REQUIRE([AC_GNU_SOURCE]) dnl needed for pthread_rwlock_t on glibc > systems > dnl Check for multithreading. > AC_ARG_ENABLE(threads, > AC_HELP_STRING([--enable-threads={posix|solaris|pth|win32}], [specify > multithreading API]) > --- 35,41 ---- > AC_BEFORE([$0], [gl_ARGP])dnl > > AC_REQUIRE([AC_CANONICAL_HOST]) > ! AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) dnl needed for pthread_rwlock_t on > glibc systems > dnl Check for multithreading. > AC_ARG_ENABLE(threads, > AC_HELP_STRING([--enable-threads={posix|solaris|pth|win32}], [specify > multithreading API]) > *************** > *** 257,262 **** > --- 257,270 ---- > AC_REQUIRE([AC_C_INLINE]) > ]) > > + # AC_USE_SYSTEM_EXTENSIONS was only added in autoconf 2.60, but lock.m4 > + # wants to work with autoconf 2.54. Add a fallback until such time as > + # a newer autoconf is standard, if one is not already provided by gnulib > + # extensions.m4. > + m4_if(m4_version_compare(m4_PACKAGE_VERSION, [2.60]), [-1], > + [m4_ifndef([AC_USE_SYSTEM_EXTENSIONS], > + [AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS], [AC_GNU_SOURCE])])]) > + > dnl Survey of platforms: > dnl > dnl Platform Available Compiler Supports test-lock This is more fragile than a simple 'ifdef'. I don't want gettext's lock.m4 to compete with gnulib's extensions.m4 - otherwise it means that in some circumstances, gnulib's extensions.m4 will not work. Changing it like this: 2007-09-12 Bruno Haible <[EMAIL PROTECTED]> * m4/lock.m4: Don't provide an AC_USE_SYSTEM_EXTENSIONS definition. (gl_LOCK_EARLY_BODY): Use AC_GNU_SOURCE when AC_USE_SYSTEM_EXTENSIONS is not defined. --- m4/lock.m4 12 Sep 2007 15:59:57 -0000 1.10 +++ m4/lock.m4 12 Sep 2007 23:22:42 -0000 @@ -1,4 +1,4 @@ -# lock.m4 serial 7 (gettext-0.16) +# lock.m4 serial 7 (gettext-0.16.2) dnl Copyright (C) 2005-2007 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -35,7 +35,12 @@ AC_BEFORE([$0], [gl_ARGP])dnl AC_REQUIRE([AC_CANONICAL_HOST]) - AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) dnl needed for pthread_rwlock_t on glibc systems + dnl _GNU_SOURCE is needed for pthread_rwlock_t on glibc systems. + dnl AC_USE_SYSTEM_EXTENSIONS was introduced in autoconf 2.60 and obsoletes + dnl AC_GNU_SOURCE. + m4_ifdef([AC_USE_SYSTEM_EXTENSIONS], + [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])], + [AC_REQUIRE([AC_GNU_SOURCE])]) dnl Check for multithreading. AC_ARG_ENABLE(threads, AC_HELP_STRING([--enable-threads={posix|solaris|pth|win32}], [specify multithreading API]) @@ -257,14 +262,6 @@ AC_REQUIRE([AC_C_INLINE]) ]) -# AC_USE_SYSTEM_EXTENSIONS was only added in autoconf 2.60, but lock.m4 -# wants to work with autoconf 2.54. Add a fallback until such time as -# a newer autoconf is standard, if one is not already provided by gnulib -# extensions.m4. -m4_if(m4_version_compare(m4_PACKAGE_VERSION, [2.60]), [-1], - [m4_ifndef([AC_USE_SYSTEM_EXTENSIONS], - [AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS], [AC_GNU_SOURCE])])]) - dnl Survey of platforms: dnl dnl Platform Available Compiler Supports test-lock