
This patch removes the circular dependency on AC_GNU_SOURCE in
AC_USE_SYSTEM_EXTENSIONS.

Thanks to Mark Hatle for the timely pointers and fixes.

Upstream-Status: Inappropriate [licensing]

Signed-off-by Saul Wold <sgw@linux.intel.com>

diff -ru gettext-0.16.1/gettext-runtime/gnulib-m4/extensions.m4 gettext.patched/gettext-runtime/gnulib-m4/extensions.m4
--- gettext-0.16.1/gettext-runtime/gnulib-m4/extensions.m4	2006-11-27 09:14:38.000000000 -0800
+++ gettext.patched/gettext-runtime/gnulib-m4/extensions.m4	2011-03-16 23:54:01.711923448 -0700
@@ -16,43 +16,47 @@
 # ------------------------
 # Enable extensions on systems that normally disable them,
 # typically due to standards-conformance issues.
-AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS],
-[
-  AC_BEFORE([$0], [AC_COMPILE_IFELSE])
-  AC_BEFORE([$0], [AC_RUN_IFELSE])
-
-  AC_REQUIRE([AC_GNU_SOURCE])
-  AC_REQUIRE([AC_AIX])
-  AC_REQUIRE([AC_MINIX])
-
-  AH_VERBATIM([__EXTENSIONS__],
-[/* Enable extensions on Solaris.  */
-#ifndef __EXTENSIONS__
-# undef __EXTENSIONS__
-#endif
-#ifndef _POSIX_PTHREAD_SEMANTICS
-# undef _POSIX_PTHREAD_SEMANTICS
-#endif
-#ifndef _TANDEM_SOURCE
-# undef _TANDEM_SOURCE
-#endif])
-  AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__],
-    [ac_cv_safe_to_define___extensions__],
-    [AC_COMPILE_IFELSE(
-       [AC_LANG_PROGRAM([
-#	  define __EXTENSIONS__ 1
-	  AC_INCLUDES_DEFAULT])],
-       [ac_cv_safe_to_define___extensions__=yes],
-       [ac_cv_safe_to_define___extensions__=no])])
-  test $ac_cv_safe_to_define___extensions__ = yes &&
-    AC_DEFINE([__EXTENSIONS__])
-  AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
-  AC_DEFINE([_TANDEM_SOURCE])
-])
+#AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS],
+#[
+#  AC_BEFORE([$0], [AC_COMPILE_IFELSE])
+#  AC_BEFORE([$0], [AC_RUN_IFELSE])
+#
+#  AC_REQUIRE([AC_GNU_SOURCE])
+#  AC_REQUIRE([AC_AIX])
+#  AC_REQUIRE([AC_MINIX])
+#
+#  AH_VERBATIM([__EXTENSIONS__],
+#[/* Enable extensions on Solaris.  */
+##ifndef __EXTENSIONS__
+## undef __EXTENSIONS__
+##endif
+##ifndef _POSIX_PTHREAD_SEMANTICS
+## undef _POSIX_PTHREAD_SEMANTICS
+##endif
+##ifndef _TANDEM_SOURCE
+## undef _TANDEM_SOURCE
+##endif])
+#  AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__],
+#    [ac_cv_safe_to_define___extensions__],
+#    [AC_COMPILE_IFELSE(
+#       [AC_LANG_PROGRAM([
+##	  define __EXTENSIONS__ 1
+#	  AC_INCLUDES_DEFAULT])],
+#       [ac_cv_safe_to_define___extensions__=yes],
+#       [ac_cv_safe_to_define___extensions__=no])])
+#  test $ac_cv_safe_to_define___extensions__ = yes &&
+#    AC_DEFINE([__EXTENSIONS__])
+#  AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
+#  AC_DEFINE([_TANDEM_SOURCE])
+#])
 
 # gl_USE_SYSTEM_EXTENSIONS
 # ------------------------
 # Enable extensions on systems that normally disable them,
 # typically due to standards-conformance issues.
 AC_DEFUN([gl_USE_SYSTEM_EXTENSIONS],
-  [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])])
+[
+   AC_REQUIRE([AC_GNU_SOURCE])
+
+   AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+])
diff -ru gettext-0.16.1/gettext-runtime/gnulib-m4/gnulib-comp.m4 gettext.patched/gettext-runtime/gnulib-m4/gnulib-comp.m4
--- gettext-0.16.1/gettext-runtime/gnulib-m4/gnulib-comp.m4	2006-11-27 09:33:19.000000000 -0800
+++ gettext.patched/gettext-runtime/gnulib-m4/gnulib-comp.m4	2011-03-16 23:50:17.471531838 -0700
@@ -25,7 +25,7 @@
   m4_pattern_allow([^gl_LIBOBJS$])dnl a variable
   m4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable
   AC_REQUIRE([AC_PROG_RANLIB])
-  AC_REQUIRE([AC_GNU_SOURCE])
+  dnl AC_REQUIRE([AC_GNU_SOURCE])
   AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
 ])
 
diff -ru gettext-0.16.1/gettext-runtime/gnulib-m4/mbchar.m4 gettext.patched/gettext-runtime/gnulib-m4/mbchar.m4
--- gettext-0.16.1/gettext-runtime/gnulib-m4/mbchar.m4	2006-11-27 09:14:38.000000000 -0800
+++ gettext.patched/gettext-runtime/gnulib-m4/mbchar.m4	2011-03-16 23:50:10.814396529 -0700
@@ -9,7 +9,7 @@
 
 AC_DEFUN([gl_MBCHAR],
 [
-  AC_REQUIRE([AC_GNU_SOURCE])
+  dnl AC_REQUIRE([AC_GNU_SOURCE])
   dnl The following line is that so the user can test HAVE_WCHAR_H
   dnl before #include "mbchar.h".
   AC_CHECK_HEADERS_ONCE([wchar.h])
diff -ru gettext-0.16.1/gettext-runtime/gnulib-m4/wcwidth.m4 gettext.patched/gettext-runtime/gnulib-m4/wcwidth.m4
--- gettext-0.16.1/gettext-runtime/gnulib-m4/wcwidth.m4	2006-11-27 09:14:38.000000000 -0800
+++ gettext.patched/gettext-runtime/gnulib-m4/wcwidth.m4	2011-03-16 23:50:08.357396247 -0700
@@ -7,7 +7,7 @@
 AC_DEFUN([gl_FUNC_WCWIDTH],
 [
   dnl Persuade glibc <wchar.h> to declare wcwidth().
-  AC_REQUIRE([AC_GNU_SOURCE])
+  dnl AC_REQUIRE([AC_GNU_SOURCE])
 
   AC_REQUIRE([AC_C_INLINE])
   AC_REQUIRE([gt_TYPE_WCHAR_T])
diff -ru gettext-0.16.1/gettext-runtime/m4/lock.m4 gettext.patched/gettext-runtime/m4/lock.m4
--- gettext-0.16.1/gettext-runtime/m4/lock.m4	2006-10-24 13:59:59.000000000 -0700
+++ gettext.patched/gettext-runtime/m4/lock.m4	2011-03-16 23:50:04.355891676 -0700
@@ -35,7 +35,7 @@
   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 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])
diff -ru gettext-0.16.1/gettext-tools/gnulib-m4/extensions.m4 gettext.patched/gettext-tools/gnulib-m4/extensions.m4
--- gettext-0.16.1/gettext-tools/gnulib-m4/extensions.m4	2006-11-27 09:14:54.000000000 -0800
+++ gettext.patched/gettext-tools/gnulib-m4/extensions.m4	2011-03-16 23:53:28.487671266 -0700
@@ -16,43 +16,47 @@
 # ------------------------
 # Enable extensions on systems that normally disable them,
 # typically due to standards-conformance issues.
-AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS],
-[
-  AC_BEFORE([$0], [AC_COMPILE_IFELSE])
-  AC_BEFORE([$0], [AC_RUN_IFELSE])
-
-  AC_REQUIRE([AC_GNU_SOURCE])
-  AC_REQUIRE([AC_AIX])
-  AC_REQUIRE([AC_MINIX])
-
-  AH_VERBATIM([__EXTENSIONS__],
-[/* Enable extensions on Solaris.  */
-#ifndef __EXTENSIONS__
-# undef __EXTENSIONS__
-#endif
-#ifndef _POSIX_PTHREAD_SEMANTICS
-# undef _POSIX_PTHREAD_SEMANTICS
-#endif
-#ifndef _TANDEM_SOURCE
-# undef _TANDEM_SOURCE
-#endif])
-  AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__],
-    [ac_cv_safe_to_define___extensions__],
-    [AC_COMPILE_IFELSE(
-       [AC_LANG_PROGRAM([
-#	  define __EXTENSIONS__ 1
-	  AC_INCLUDES_DEFAULT])],
-       [ac_cv_safe_to_define___extensions__=yes],
-       [ac_cv_safe_to_define___extensions__=no])])
-  test $ac_cv_safe_to_define___extensions__ = yes &&
-    AC_DEFINE([__EXTENSIONS__])
-  AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
-  AC_DEFINE([_TANDEM_SOURCE])
-])
+#AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS],
+#[
+#  AC_BEFORE([$0], [AC_COMPILE_IFELSE])
+#  AC_BEFORE([$0], [AC_RUN_IFELSE])
+#
+#  AC_REQUIRE([AC_GNU_SOURCE])
+#  AC_REQUIRE([AC_AIX])
+#  AC_REQUIRE([AC_MINIX])
+#
+#  AH_VERBATIM([__EXTENSIONS__],
+#[/* Enable extensions on Solaris.  */
+##ifndef __EXTENSIONS__
+## undef __EXTENSIONS__
+##endif
+##ifndef _POSIX_PTHREAD_SEMANTICS
+## undef _POSIX_PTHREAD_SEMANTICS
+##endif
+##ifndef _TANDEM_SOURCE
+## undef _TANDEM_SOURCE
+##endif])
+#  AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__],
+#    [ac_cv_safe_to_define___extensions__],
+#    [AC_COMPILE_IFELSE(
+#       [AC_LANG_PROGRAM([
+##	  define __EXTENSIONS__ 1
+#	  AC_INCLUDES_DEFAULT])],
+#       [ac_cv_safe_to_define___extensions__=yes],
+#       [ac_cv_safe_to_define___extensions__=no])])
+#  test $ac_cv_safe_to_define___extensions__ = yes &&
+#    AC_DEFINE([__EXTENSIONS__])
+#  AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
+#  AC_DEFINE([_TANDEM_SOURCE])
+#])
 
 # gl_USE_SYSTEM_EXTENSIONS
 # ------------------------
 # Enable extensions on systems that normally disable them,
 # typically due to standards-conformance issues.
 AC_DEFUN([gl_USE_SYSTEM_EXTENSIONS],
-  [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])])
+[
+   AC_REQUIRE([AC_GNU_SOURCE])
+
+   AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+])
diff -ru gettext-0.16.1/gettext-tools/gnulib-m4/fnmatch.m4 gettext.patched/gettext-tools/gnulib-m4/fnmatch.m4
--- gettext-0.16.1/gettext-tools/gnulib-m4/fnmatch.m4	2006-11-27 09:14:54.000000000 -0800
+++ gettext.patched/gettext-tools/gnulib-m4/fnmatch.m4	2011-03-16 23:52:06.477463671 -0700
@@ -91,7 +91,7 @@
 AC_DEFUN([gl_FUNC_FNMATCH_GNU],
 [
   dnl Persuade glibc <fnmatch.h> to declare FNM_CASEFOLD etc.
-  AC_REQUIRE([AC_GNU_SOURCE])
+  dnl AC_REQUIRE([AC_GNU_SOURCE])
 
   FNMATCH_H=
   _AC_FUNC_FNMATCH_IF([GNU], [ac_cv_func_fnmatch_gnu],
diff -ru gettext-0.16.1/gettext-tools/gnulib-m4/getdelim.m4 gettext.patched/gettext-tools/gnulib-m4/getdelim.m4
--- gettext-0.16.1/gettext-tools/gnulib-m4/getdelim.m4	2006-11-27 09:14:54.000000000 -0800
+++ gettext.patched/gettext-tools/gnulib-m4/getdelim.m4	2011-03-16 23:52:22.871674845 -0700
@@ -12,7 +12,7 @@
 [
 
   dnl Persuade glibc <stdio.h> to declare getdelim().
-  AC_REQUIRE([AC_GNU_SOURCE])
+  dnl AC_REQUIRE([AC_GNU_SOURCE])
 
   AC_REPLACE_FUNCS(getdelim)
   AC_CHECK_DECLS_ONCE(getdelim)
diff -ru gettext-0.16.1/gettext-tools/gnulib-m4/getline.m4 gettext.patched/gettext-tools/gnulib-m4/getline.m4
--- gettext-0.16.1/gettext-tools/gnulib-m4/getline.m4	2006-11-27 09:14:54.000000000 -0800
+++ gettext.patched/gettext-tools/gnulib-m4/getline.m4	2011-03-16 23:51:49.829971108 -0700
@@ -16,7 +16,7 @@
 AC_DEFUN([gl_FUNC_GETLINE],
 [
   dnl Persuade glibc <stdio.h> to declare getline().
-  AC_REQUIRE([AC_GNU_SOURCE])
+  dnl AC_REQUIRE([AC_GNU_SOURCE])
 
   AC_CHECK_DECLS([getline])
 
diff -ru gettext-0.16.1/gettext-tools/gnulib-m4/gnulib-comp.m4 gettext.patched/gettext-tools/gnulib-m4/gnulib-comp.m4
--- gettext-0.16.1/gettext-tools/gnulib-m4/gnulib-comp.m4	2006-11-27 09:33:36.000000000 -0800
+++ gettext.patched/gettext-tools/gnulib-m4/gnulib-comp.m4	2011-03-16 23:52:18.970450488 -0700
@@ -25,7 +25,7 @@
   m4_pattern_allow([^gl_LIBOBJS$])dnl a variable
   m4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable
   AC_REQUIRE([AC_PROG_RANLIB])
-  AC_REQUIRE([AC_GNU_SOURCE])
+  dnl AC_REQUIRE([AC_GNU_SOURCE])
   AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
   AC_REQUIRE([gl_LOCK_EARLY])
 ])
diff -ru gettext-0.16.1/gettext-tools/gnulib-m4/mbchar.m4 gettext.patched/gettext-tools/gnulib-m4/mbchar.m4
--- gettext-0.16.1/gettext-tools/gnulib-m4/mbchar.m4	2006-11-27 09:14:55.000000000 -0800
+++ gettext.patched/gettext-tools/gnulib-m4/mbchar.m4	2011-03-16 23:51:40.844410216 -0700
@@ -9,7 +9,7 @@
 
 AC_DEFUN([gl_MBCHAR],
 [
-  AC_REQUIRE([AC_GNU_SOURCE])
+  dnl AC_REQUIRE([AC_GNU_SOURCE])
   dnl The following line is that so the user can test HAVE_WCHAR_H
   dnl before #include "mbchar.h".
   AC_CHECK_HEADERS_ONCE([wchar.h])
diff -ru gettext-0.16.1/gettext-tools/gnulib-m4/stpcpy.m4 gettext.patched/gettext-tools/gnulib-m4/stpcpy.m4
--- gettext-0.16.1/gettext-tools/gnulib-m4/stpcpy.m4	2006-11-27 09:14:55.000000000 -0800
+++ gettext.patched/gettext-tools/gnulib-m4/stpcpy.m4	2011-03-16 23:52:14.691396045 -0700
@@ -7,7 +7,7 @@
 AC_DEFUN([gl_FUNC_STPCPY],
 [
   dnl Persuade glibc <string.h> to declare stpcpy().
-  AC_REQUIRE([AC_GNU_SOURCE])
+  dnl AC_REQUIRE([AC_GNU_SOURCE])
 
   AC_REPLACE_FUNCS(stpcpy)
   if test $ac_cv_func_stpcpy = no; then
diff -ru gettext-0.16.1/gettext-tools/gnulib-m4/stpncpy.m4 gettext.patched/gettext-tools/gnulib-m4/stpncpy.m4
--- gettext-0.16.1/gettext-tools/gnulib-m4/stpncpy.m4	2006-11-27 09:14:55.000000000 -0800
+++ gettext.patched/gettext-tools/gnulib-m4/stpncpy.m4	2011-03-16 23:52:10.356641459 -0700
@@ -7,7 +7,7 @@
 AC_DEFUN([gl_FUNC_STPNCPY],
 [
   dnl Persuade glibc <string.h> to declare stpncpy().
-  AC_REQUIRE([AC_GNU_SOURCE])
+  dnl AC_REQUIRE([AC_GNU_SOURCE])
 
   dnl Both glibc and AIX (4.3.3, 5.1) have an stpncpy() function
   dnl declared in <string.h>. Its side effects are the same as those
diff -ru gettext-0.16.1/gettext-tools/gnulib-m4/wcwidth.m4 gettext.patched/gettext-tools/gnulib-m4/wcwidth.m4
--- gettext-0.16.1/gettext-tools/gnulib-m4/wcwidth.m4	2006-11-27 09:14:55.000000000 -0800
+++ gettext.patched/gettext-tools/gnulib-m4/wcwidth.m4	2011-03-16 23:51:08.260324221 -0700
@@ -7,7 +7,7 @@
 AC_DEFUN([gl_FUNC_WCWIDTH],
 [
   dnl Persuade glibc <wchar.h> to declare wcwidth().
-  AC_REQUIRE([AC_GNU_SOURCE])
+  dnl AC_REQUIRE([AC_GNU_SOURCE])
 
   AC_REQUIRE([AC_C_INLINE])
   AC_REQUIRE([gt_TYPE_WCHAR_T])
diff -ru gettext-0.16.1/gettext-tools/libgettextpo/gnulib-m4/gnulib-comp.m4 gettext.patched/gettext-tools/libgettextpo/gnulib-m4/gnulib-comp.m4
--- gettext-0.16.1/gettext-tools/libgettextpo/gnulib-m4/gnulib-comp.m4	2006-11-27 09:33:45.000000000 -0800
+++ gettext.patched/gettext-tools/libgettextpo/gnulib-m4/gnulib-comp.m4	2011-03-16 23:51:02.036061317 -0700
@@ -25,7 +25,7 @@
   m4_pattern_allow([^gl_LIBOBJS$])dnl a variable
   m4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable
   AC_REQUIRE([AC_PROG_RANLIB])
-  AC_REQUIRE([AC_GNU_SOURCE])
+  dnl AC_REQUIRE([AC_GNU_SOURCE])
   AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
   AC_REQUIRE([gl_LOCK_EARLY])
 ])
diff -ru gettext-0.16.1/gettext-tools/m4/regex.m4 gettext.patched/gettext-tools/m4/regex.m4
--- gettext-0.16.1/gettext-tools/m4/regex.m4	2006-11-27 09:02:05.000000000 -0800
+++ gettext.patched/gettext-tools/m4/regex.m4	2011-03-16 23:50:53.533477195 -0700
@@ -116,7 +116,7 @@
   dnl to get them.
 
   dnl Persuade glibc <string.h> to declare mempcpy().
-  AC_REQUIRE([AC_GNU_SOURCE])
+  dnl AC_REQUIRE([AC_GNU_SOURCE])
 
   AC_REQUIRE([AC_C_RESTRICT])
   AC_REQUIRE([AC_FUNC_ALLOCA])
