commit:     aaf6442f3c201cd7bffe6403c03d460702e7bbba
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Mon Apr 25 22:56:59 2016 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Mon Apr 25 22:57:39 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=aaf6442f

sys-devel/m4: fix spawn_h.m4 for uclibc, bugs #580688, #581086

Package-Manager: portage-2.2.26

 sys-devel/m4/files/m4-1.4.17-posix_spawn.patch | 111 +++++++++++++++++++++++++
 sys-devel/m4/m4-1.4.17.ebuild                  |   8 +-
 2 files changed, 117 insertions(+), 2 deletions(-)

diff --git a/sys-devel/m4/files/m4-1.4.17-posix_spawn.patch 
b/sys-devel/m4/files/m4-1.4.17-posix_spawn.patch
new file mode 100644
index 0000000..5954cc3
--- /dev/null
+++ b/sys-devel/m4/files/m4-1.4.17-posix_spawn.patch
@@ -0,0 +1,111 @@
+This fixes the search for posix_spawn() to use AC_SEARCH_LIBS which
+is needed for uClibc which puts the function in librt [1].  The fix
+is in gnulib commit d6eab2e [2], but we can't just apply that patch
+and autoreconf because that means we must depend on autotools.eclass
+and this leads to a circular dependency.  So we have to patch
+configure directlly.
+
+[1] https://bugs.gentoo.org/show_bug.cgi?id=580688
+[2] 
http://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=d6eab2e70fc5ccc82a73e5c988b76a229e4cd3d5
+[3] https://bugs.gentoo.org/show_bug.cgi?id=581086
+
+Signed-off-by: Anthony G. Basile <[email protected]>
+
+diff -Naur m4-1.4.17.orig/configure m4-1.4.17/configure
+--- m4-1.4.17.orig/configure   2013-09-22 06:38:28.000000000 +0000
++++ m4-1.4.17/configure        2016-04-25 22:27:12.774118561 +0000
+@@ -808,6 +808,7 @@
+ GNULIB_SIGNAL_H_SIGPIPE
+ GNULIB_RAISE
+ GNULIB_PTHREAD_SIGMASK
++LIB_POSIX_SPAWN
+ REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN
+ REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2
+ REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE
+@@ -3590,7 +3591,6 @@
+ as_fn_append ac_func_list " mkstemp"
+ as_fn_append ac_func_list " nl_langinfo"
+ as_fn_append ac_func_list " pipe2"
+-as_fn_append ac_func_list " posix_spawn"
+ gl_printf_safe=yes
+ as_fn_append ac_func_list " isblank"
+ as_fn_append ac_func_list " iswctype"
+@@ -15877,8 +15881,78 @@
+ 
+ 
+ 
++  LIB_POSIX_SPAWN=
++
++  gl_saved_libs=$LIBS
++    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing 
posix_spawn" >&5
++$as_echo_n "checking for library containing posix_spawn... " >&6; }
++if ${ac_cv_search_posix_spawn+:} false; then :
++  $as_echo_n "(cached) " >&6
++else
++  ac_func_search_save_LIBS=$LIBS
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h.  */
++
++/* Override any GCC internal prototype to avoid an error.
++   Use char because int might match the return type of a GCC
++   builtin and then its argument prototype would still apply.  */
++#ifdef __cplusplus
++extern "C"
++#endif
++char posix_spawn ();
++int
++main ()
++{
++return posix_spawn ();
++  ;
++  return 0;
++}
++_ACEOF
++for ac_lib in '' rt; do
++  if test -z "$ac_lib"; then
++    ac_res="none required"
++  else
++    ac_res=-l$ac_lib
++    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
++  fi
++  if ac_fn_c_try_link "$LINENO"; then :
++  ac_cv_search_posix_spawn=$ac_res
++fi
++rm -f core conftest.err conftest.$ac_objext \
++    conftest$ac_exeext
++  if ${ac_cv_search_posix_spawn+:} false; then :
++  break
++fi
++done
++if ${ac_cv_search_posix_spawn+:} false; then :
++
++else
++  ac_cv_search_posix_spawn=no
++fi
++rm conftest.$ac_ext
++LIBS=$ac_func_search_save_LIBS
++fi
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_posix_spawn" 
>&5
++$as_echo "$ac_cv_search_posix_spawn" >&6; }
++ac_res=$ac_cv_search_posix_spawn
++if test "$ac_res" != no; then :
++  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
++  test "$ac_cv_search_posix_spawn" = "none required" ||
++                    LIB_POSIX_SPAWN=$ac_cv_search_posix_spawn
++fi
++
++    for ac_func in posix_spawn
++do :
++  ac_fn_c_check_func "$LINENO" "posix_spawn" "ac_cv_func_posix_spawn"
++if test "x$ac_cv_func_posix_spawn" = xyes; then :
++  cat >>confdefs.h <<_ACEOF
++#define HAVE_POSIX_SPAWN 1
++_ACEOF
+ 
++fi
++done
+ 
++  LIBS=$gl_saved_libs
+ 
+   if test $ac_cv_func_posix_spawn != yes; then
+     HAVE_POSIX_SPAWN=0

diff --git a/sys-devel/m4/m4-1.4.17.ebuild b/sys-devel/m4/m4-1.4.17.ebuild
index 3e45c8c..59480bb 100644
--- a/sys-devel/m4/m4-1.4.17.ebuild
+++ b/sys-devel/m4/m4-1.4.17.ebuild
@@ -1,8 +1,10 @@
-# Copyright 1999-2015 Gentoo Foundation
+# Copyright 1999-2016 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 # $Id$
 
-EAPI="4"
+EAPI="5"
+
+inherit eutils
 
 DESCRIPTION="GNU macro processor"
 HOMEPAGE="https://www.gnu.org/software/m4/m4.html";
@@ -18,6 +20,8 @@ DEPEND="app-arch/xz-utils"
 RDEPEND=""
 
 src_prepare() {
+       epatch "${FILESDIR}"/${P}-posix_spawn.patch #580688, 581086
+
        # Disable gnulib build test that has no impact on the source.
        # Re-enable w/next version bump (and gnulib is updated). #554728
        [[ ${PV} != "1.4.17" ]] && die "re-enable test #554728"

Reply via email to