Files
MSYS2-packages/parallel/0001-support-MSys2.patch
Rafael Kitover 4727aa6665 fix GNU parallel for MSys2 and update version
Add my patch to make GNU parallel build and work correctly on MSys2, it
has been submitted upstream as well:

https://savannah.gnu.org/bugs/index.php?52737

Update to latest version as well: 20171222

Remvoe erroneous 'procps' dependency.

Tested to work correcly.
2018-01-14 07:47:54 -05:00

1028 lines
37 KiB
Diff

From c485e838936e6162dca3c4fabdf32f8979e436a8 Mon Sep 17 00:00:00 2001
From: Rafael Kitover <rkitover@gmail.com>
Date: Sun, 24 Dec 2017 14:16:41 -0500
Subject: [PATCH] support MSys2
- on MSys2 MSYS or MINGW shells, prepend `/usr/bin` to `PATH` during
configure so that the MSys perl is used rather than the native Windows
perl, making the scripts work with native Windows perl would be a lot
of work
- use the `AX_SYS_PERLSHARPBANG` m4 macro from autoconf-archive to
determine which perl to use for the Perl scripts based on the PATH,
and modify the the shebang of the scripts accordingly in the automake
`install-exec-hook`, this is overridable using the `configure` option
`--with-perl-shebang`.
- add an `autogen.sh` script to run `aclocal`, `autoconf` and `automake`
as is common to do
- when executing `perl` from the shell from inside perl scripts, use
`$^X` instead of `perl` so that the interpreter the script was run
with is used instead of the `perl` that is in the `PATH`
- use the Cygwin `ps` and process status methods for MSys2
- don't `exec 'sleep'` on MSys2, it has the same problem with this as
Cygwin
The reason I did this was so that I could use my wallpaper downloader
in MSys2:
https://github.com/macearl/Wallhaven-Downloader
:D
---
Makefile.in | 15 ++---
aclocal.m4 | 173 ++++++++++++++++++++++++++++++++++++++++++++++++++------
autogen.sh | 5 ++
configure | 154 ++++++++++++++++++++++++++++++++++++++++++++-----
configure.ac | 12 ++++
src/Makefile.am | 10 +++-
src/Makefile.in | 16 ++++--
src/niceload | 9 +--
src/parallel | 63 ++++++++++-----------
9 files changed, 376 insertions(+), 81 deletions(-)
create mode 100644 autogen.sh
diff --git a/Makefile.in b/Makefile.in
index 33af24d..d39833b 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15 from Makefile.am.
+# Makefile.in generated by automake 1.15.1 from Makefile.am.
# @configure_input@
-# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+# Copyright (C) 1994-2017 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -230,6 +230,8 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PERLINTERP = @PERLINTERP@
+PERL_SHEBANG = @PERL_SHEBANG@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
@@ -265,7 +267,6 @@ pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
-runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
@@ -500,7 +501,7 @@ distdir: $(DISTFILES)
! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
|| chmod -R a+r "$(distdir)"
dist-gzip: distdir
- tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+ tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz
$(am__post_remove_distdir)
dist-bzip2: distdir
@@ -526,7 +527,7 @@ dist-shar: distdir
@echo WARNING: "Support for shar distribution archives is" \
"deprecated." >&2
@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
- shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+ shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz
$(am__post_remove_distdir)
dist-zip: distdir
@@ -544,7 +545,7 @@ dist dist-all:
distcheck: dist
case '$(DIST_ARCHIVES)' in \
*.tar.gz*) \
- GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
+ eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\
*.tar.bz2*) \
bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
*.tar.lz*) \
@@ -554,7 +555,7 @@ distcheck: dist
*.tar.Z*) \
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
*.shar.gz*) \
- GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
+ eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\
*.zip*) \
unzip $(distdir).zip ;;\
esac
diff --git a/aclocal.m4 b/aclocal.m4
index c24039f..2fa8b41 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1,6 +1,6 @@
-# generated automatically by aclocal 1.15 -*- Autoconf -*-
+# generated automatically by aclocal 1.15.1 -*- Autoconf -*-
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2017 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -20,7 +20,146 @@ You have another version of autoconf. It may work, but is not guaranteed to.
If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically 'autoreconf'.])])
-# Copyright (C) 2002-2014 Free Software Foundation, Inc.
+# ===========================================================================
+# https://www.gnu.org/software/autoconf-archive/ax_sys_perlsharpbang.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# AX_SYS_PERLSHARPBANG
+#
+# DESCRIPTION
+#
+# Determine how the perl interpreter is located by the OS kernel and make
+# substitution variable PERL_SHEBANG available. Does AC_PATH_PROG to find
+# the path to perl. As a side-effect, that sets PERLINTERP and makes it
+# available as a substitution variable.
+#
+# Note: The macro allows for the possibility (expected to be seldom used)
+# of an explicit user override (the "user" being the operator executing
+# the final 'configure' script, in this context) by making the option
+# argument like:
+#
+# --with-perl-shebang='#! /my/funky/perlpath' # OR
+# --with-perl-shebang='/my/funky/perlpath' # we just throw away the #! anyway
+# # bec it must be absent in Makefile
+#
+# Rationale: The are various ways of starting an interpreter on different
+# *nix-like systems. Many use the simple
+#
+# #!/usr/bin/perl
+#
+# but it could be instead
+#
+# #!/usr/local/bin/perl
+#
+# and there is even the possibility that the user wants
+#
+# #!/usr/bin/env perl
+#
+# to find whichever perl comes first in the current $PATH. This is
+# preferred by some of us because we run multiple perl installations on
+# the same box. Adjusting our $PATH then allows us to set precedence over
+# other perls, even whatever the "house" version is.
+#
+# Users on very non-unix systems like MS Windows do not have a kernel that
+# does this kind of thing from the first line of script files, but instead
+# the perl on their machine is started and merely notices whatever comes
+# after the interpreter path on this first line of the script (options
+# like "-w").
+#
+# Acknowledgement: this macro was in part inspired by Dean Povey's
+# AC_PROG_PERL_VERSION.
+#
+# LICENSE
+#
+# Copyright (c) 2009 Soren Andersen <somian@pobox.com>
+#
+# Copying and distribution of this file, with or without modification, are
+# permitted in any medium without royalty provided the copyright notice
+# and this notice are preserved. This file is offered as-is, without any
+# warranty.
+
+#serial 14
+
+AC_DEFUN([AX_SYS_PERLSHARPBANG],[dnl
+
+ AC_PATH_PROG(PERLINTERP,perl,perl)
+ ac_cv_path_perlinterp="$PERLINTERP"
+ _sHpB='#!'
+
+ AC_ARG_WITH(perl-shebang,
+ AS_HELP_STRING([--with-perl-shebang],
+ [override what perl thinks is the way for the kernel to start it (seldom needed)]dnl
+ ),
+ [opt_perl_shebang="$withval"]dnl
+ ,dnl
+ [opt_perl_shebang="not_set"]dnl
+ )dnl
+
+ AC_CACHE_CHECK([whether explicit instead of detected sharpbang is to be used],
+ ax_cv_opt_perl_shebang,
+ [ case "$opt_perl_shebang" in
+ not_set ) ax_cv_opt_perl_shebang=''
+ ;;
+ * )
+ ax_cv_opt_perl_shebang=`echo "$opt_perl_shebang" | sed -e's|^#!\s*\(.*\)$|\1|'`
+ esac
+ ]dnl
+ )dnl
+
+ if test "A$ax_cv_opt_perl_shebang" != "A"
+ then
+ ac_cv_sys_kernshrpbang_perl="$ax_cv_opt_perl_shebang"
+ PERL_SHEBANG="$ac_cv_sys_kernshrpbang_perl"
+ AC_SUBST(PERL_SHEBANG)dnl
+ AC_MSG_NOTICE([OK - PERL_SHEBANG is $_sHpB$PERL_SHEBANG.])
+
+# Automatic detection of sharpbang formula starts here
+ else dnl
+
+ _somian_shbangperl=`$PERLINTERP -V:startperl`
+ negclass="[[^']]"; dnl
+# must leave this comment: m4 will remove the outer brackets for us, heheh
+ AC_CACHE_CHECK([for kernel sharpbang invocation to start perl],
+ ac_cv_sys_kernshrpbang_perl,
+ [_somian_kspb_perl=`echo "$_somian_shbangperl" | sed -ne"s|.*='\($negclass*\)';$|\1|p"`
+ if test "x$_somian_kspb_perl" == x
+ then _somian_ksbp_warn_empty='durnit'
+ else
+ case "A$_somian_kspb_perl" in
+ A#!*perl* )
+ ac_cv_sys_kernshrpbang_perl=`echo "$_somian_kspb_perl" | sed -e's|#!\(.*\)$|\1|'`
+ ;;
+ A* ) _somian_ksbp_warn_defau='trouble'
+ ac_cv_sys_kernshrpbang_perl="$PERLINTERP"
+ esac
+ fi
+])dnl Done with testing sharpbang
+
+# The above prints Checking ... result message to user.
+ PERL_SHEBANG="$ac_cv_sys_kernshrpbang_perl"
+ AC_SUBST(PERL_SHEBANG)
+ if test A${_somian_ksbp_warn_empty+set} == Aset
+ then AC_MSG_WARN([dnl
+In last check, doing $PERLINTERP -V:startperl yielded empty result! That should not happen.])
+ fi
+# Inform user after printing result value
+ if test A${_somian_ksbp_warn_defau+set} == Aset
+ then AC_MSG_NOTICE([Maybe Not good -])
+ AC_MSG_WARN([dnl
+In last check perl's Config query did not work so we bunted: $_sHpB$PERLINTERP])
+ else AC_MSG_NOTICE([OK Good result - ])
+ AC_MSG_NOTICE([dnl
+In last check we got a proper-looking answer from perl's Config: $_somian_shbangperl])
+dnl Done with user info messages
+ fi
+dnl Outer loop checked for user override term here
+ fi dnl
+
+])dnl EOMACRO DEF
+
+# Copyright (C) 2002-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -35,7 +174,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION],
[am__api_version='1.15'
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
dnl require some minimum version. Point them to the right macro.
-m4_if([$1], [1.15], [],
+m4_if([$1], [1.15.1], [],
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
])
@@ -51,14 +190,14 @@ m4_define([_AM_AUTOCONF_VERSION], [])
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.15])dnl
+[AM_AUTOMAKE_VERSION([1.15.1])dnl
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -110,7 +249,7 @@ am_aux_dir=`cd "$ac_aux_dir" && pwd`
# AM_CONDITIONAL -*- Autoconf -*-
-# Copyright (C) 1997-2014 Free Software Foundation, Inc.
+# Copyright (C) 1997-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -143,7 +282,7 @@ fi])])
# Do all the work for Automake. -*- Autoconf -*-
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -340,7 +479,7 @@ for _am_header in $config_headers :; do
done
echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -361,7 +500,7 @@ if test x"${install_sh+set}" != xset; then
fi
AC_SUBST([install_sh])])
-# Copyright (C) 2003-2014 Free Software Foundation, Inc.
+# Copyright (C) 2003-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -382,7 +521,7 @@ AC_SUBST([am__leading_dot])])
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
-# Copyright (C) 1997-2014 Free Software Foundation, Inc.
+# Copyright (C) 1997-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -421,7 +560,7 @@ fi
# Helper functions for option handling. -*- Autoconf -*-
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -452,7 +591,7 @@ AC_DEFUN([_AM_IF_OPTION],
# Check to make sure that the build environment is sane. -*- Autoconf -*-
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -533,7 +672,7 @@ AC_CONFIG_COMMANDS_PRE(
rm -f conftest.file
])
-# Copyright (C) 2009-2014 Free Software Foundation, Inc.
+# Copyright (C) 2009-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -593,7 +732,7 @@ AC_SUBST([AM_BACKSLASH])dnl
_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
])
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -621,7 +760,7 @@ fi
INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
AC_SUBST([INSTALL_STRIP_PROGRAM])])
-# Copyright (C) 2006-2014 Free Software Foundation, Inc.
+# Copyright (C) 2006-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -640,7 +779,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
# Check how to create a tarball. -*- Autoconf -*-
-# Copyright (C) 2004-2014 Free Software Foundation, Inc.
+# Copyright (C) 2004-2017 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
diff --git a/autogen.sh b/autogen.sh
new file mode 100644
index 0000000..dee27fb
--- /dev/null
+++ b/autogen.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+aclocal --force
+autoconf --force
+automake --foreign --add-missing --copy
diff --git a/configure b/configure
index 03d899d..3b455c2 100755
--- a/configure
+++ b/configure
@@ -616,6 +616,8 @@ am__isrc
INSTALL_DATA
INSTALL_SCRIPT
INSTALL_PROGRAM
+PERL_SHEBANG
+PERLINTERP
target_alias
host_alias
build_alias
@@ -635,7 +637,6 @@ infodir
docdir
oldincludedir
includedir
-runstatedir
localstatedir
sharedstatedir
sysconfdir
@@ -658,6 +659,7 @@ SHELL'
ac_subst_files=''
ac_user_opts='
enable_option_checking
+with_perl_shebang
enable_silent_rules
enable_documentation
'
@@ -702,7 +704,6 @@ datadir='${datarootdir}'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
-runstatedir='${localstatedir}/run'
includedir='${prefix}/include'
oldincludedir='/usr/include'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -955,15 +956,6 @@ do
| -silent | --silent | --silen | --sile | --sil)
silent=yes ;;
- -runstatedir | --runstatedir | --runstatedi | --runstated \
- | --runstate | --runstat | --runsta | --runst | --runs \
- | --run | --ru | --r)
- ac_prev=runstatedir ;;
- -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
- | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
- | --run=* | --ru=* | --r=*)
- runstatedir=$ac_optarg ;;
-
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1101,7 +1093,7 @@ fi
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
datadir sysconfdir sharedstatedir localstatedir includedir \
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
- libdir localedir mandir runstatedir
+ libdir localedir mandir
do
eval ac_val=\$$ac_var
# Remove trailing slashes.
@@ -1254,7 +1246,6 @@ Fine tuning of the installation directories:
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
- --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
@@ -1294,6 +1285,12 @@ Optional Features:
--disable-documentation Omit building and installing the documentation.
(default=no)
+Optional Packages:
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+ --with-perl-shebang override what perl thinks is the way for the kernel
+ to start it (seldom needed)
+
Report bugs to <bug-parallel@gnu.org>.
_ACEOF
ac_status=$?
@@ -1722,6 +1719,137 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+# on MSys2 prefer msys to native programs, especially perl
+# native windows perl does not work for the time being
+case "`uname -s`" in
+ MSYS*|MINGW*)
+ PATH="/usr/bin:$PATH"
+ export PATH
+ ;;
+esac
+
+
+ # Extract the first word of "perl", so it can be a program name with args.
+set dummy perl; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_PERLINTERP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $PERLINTERP in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_PERLINTERP="$PERLINTERP" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_PERLINTERP="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ test -z "$ac_cv_path_PERLINTERP" && ac_cv_path_PERLINTERP="perl"
+ ;;
+esac
+fi
+PERLINTERP=$ac_cv_path_PERLINTERP
+if test -n "$PERLINTERP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PERLINTERP" >&5
+$as_echo "$PERLINTERP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ ac_cv_path_perlinterp="$PERLINTERP"
+ _sHpB='#!'
+
+
+# Check whether --with-perl-shebang was given.
+if test "${with_perl_shebang+set}" = set; then :
+ withval=$with_perl_shebang; opt_perl_shebang="$withval"
+else
+ opt_perl_shebang="not_set"
+fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether explicit instead of detected sharpbang is to be used" >&5
+$as_echo_n "checking whether explicit instead of detected sharpbang is to be used... " >&6; }
+if ${ax_cv_opt_perl_shebang+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case "$opt_perl_shebang" in
+ not_set ) ax_cv_opt_perl_shebang=''
+ ;;
+ * )
+ ax_cv_opt_perl_shebang=`echo "$opt_perl_shebang" | sed -e's|^#!\s*\(.*\)$|\1|'`
+ esac
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_opt_perl_shebang" >&5
+$as_echo "$ax_cv_opt_perl_shebang" >&6; }
+ if test "A$ax_cv_opt_perl_shebang" != "A"
+ then
+ ac_cv_sys_kernshrpbang_perl="$ax_cv_opt_perl_shebang"
+ PERL_SHEBANG="$ac_cv_sys_kernshrpbang_perl"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: OK - PERL_SHEBANG is $_sHpB$PERL_SHEBANG." >&5
+$as_echo "$as_me: OK - PERL_SHEBANG is $_sHpB$PERL_SHEBANG." >&6;}
+
+# Automatic detection of sharpbang formula starts here
+ else
+ _somian_shbangperl=`$PERLINTERP -V:startperl`
+ negclass="[^']"; # must leave this comment: m4 will remove the outer brackets for us, heheh
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for kernel sharpbang invocation to start perl" >&5
+$as_echo_n "checking for kernel sharpbang invocation to start perl... " >&6; }
+if ${ac_cv_sys_kernshrpbang_perl+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ _somian_kspb_perl=`echo "$_somian_shbangperl" | sed -ne"s|.*='\($negclass*\)';$|\1|p"`
+ if test "x$_somian_kspb_perl" == x
+ then _somian_ksbp_warn_empty='durnit'
+ else
+ case "A$_somian_kspb_perl" in
+ A#!*perl* )
+ ac_cv_sys_kernshrpbang_perl=`echo "$_somian_kspb_perl" | sed -e's|#!\(.*\)$|\1|'`
+ ;;
+ A* ) _somian_ksbp_warn_defau='trouble'
+ ac_cv_sys_kernshrpbang_perl="$PERLINTERP"
+ esac
+ fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_kernshrpbang_perl" >&5
+$as_echo "$ac_cv_sys_kernshrpbang_perl" >&6; }
+# The above prints Checking ... result message to user.
+ PERL_SHEBANG="$ac_cv_sys_kernshrpbang_perl"
+
+ if test A${_somian_ksbp_warn_empty+set} == Aset
+ then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: In last check, doing $PERLINTERP -V:startperl yielded empty result! That should not happen." >&5
+$as_echo "$as_me: WARNING: In last check, doing $PERLINTERP -V:startperl yielded empty result! That should not happen." >&2;}
+ fi
+# Inform user after printing result value
+ if test A${_somian_ksbp_warn_defau+set} == Aset
+ then { $as_echo "$as_me:${as_lineno-$LINENO}: Maybe Not good -" >&5
+$as_echo "$as_me: Maybe Not good -" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: In last check perl's Config query did not work so we bunted: $_sHpB$PERLINTERP" >&5
+$as_echo "$as_me: WARNING: In last check perl's Config query did not work so we bunted: $_sHpB$PERLINTERP" >&2;}
+ else { $as_echo "$as_me:${as_lineno-$LINENO}: OK Good result - " >&5
+$as_echo "$as_me: OK Good result - " >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: In last check we got a proper-looking answer from perl's Config: $_somian_shbangperl" >&5
+$as_echo "$as_me: In last check we got a proper-looking answer from perl's Config: $_somian_shbangperl" >&6;}
+ fi
+ fi
+
+
am__api_version='1.15'
ac_aux_dir=
diff --git a/configure.ac b/configure.ac
index d3583d8..0918de7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,16 @@
AC_INIT([parallel], [20171222], [bug-parallel@gnu.org])
+
+# on MSys2 prefer msys to native programs, especially perl
+# native windows perl does not work for the time being
+case "`uname -s`" in
+ MSYS*|MINGW*)
+ PATH="/usr/bin:$PATH"
+ export PATH
+ ;;
+esac
+
+AX_SYS_PERLSHARPBANG
+
AM_INIT_AUTOMAKE([-Wall -Werror foreign])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([
diff --git a/src/Makefile.am b/src/Makefile.am
index ea12e76..1412a84 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,4 +1,6 @@
-bin_SCRIPTS = parallel sql niceload parcat env_parallel \
+PERL_BINS = parallel sql niceload parcat
+
+bin_SCRIPTS = $(PERL_BINS) env_parallel \
env_parallel.ash env_parallel.bash env_parallel.csh \
env_parallel.dash env_parallel.fish env_parallel.ksh \
env_parallel.pdksh env_parallel.sh env_parallel.tcsh \
@@ -7,6 +9,12 @@ bin_SCRIPTS = parallel sql niceload parcat env_parallel \
install-exec-hook:
rm $(DESTDIR)$(bindir)/sem || true
$(LN_S) parallel $(DESTDIR)$(bindir)/sem
+ @cd $(DESTDIR)$(bindir); \
+ for bin in $(PERL_BINS); do \
+ mv $$bin "$$bin".tmp; \
+ sed '1s|.*|#!$(PERL_SHEBANG)|' "$$bin".tmp > $$bin; \
+ rm -f "$$bin".tmp; \
+ done
if DOCUMENTATION
man_MANS = parallel.1 env_parallel.1 sem.1 sql.1 niceload.1 \
diff --git a/src/Makefile.in b/src/Makefile.in
index 0a97ec2..936e327 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15 from Makefile.am.
+# Makefile.in generated by automake 1.15.1 from Makefile.am.
# @configure_input@
-# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+# Copyright (C) 1994-2017 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -185,6 +185,8 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PERLINTERP = @PERLINTERP@
+PERL_SHEBANG = @PERL_SHEBANG@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
@@ -220,7 +222,6 @@ pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
-runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
@@ -229,7 +230,8 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-bin_SCRIPTS = parallel sql niceload parcat env_parallel \
+PERL_BINS = parallel sql niceload parcat
+bin_SCRIPTS = $(PERL_BINS) env_parallel \
env_parallel.ash env_parallel.bash env_parallel.csh \
env_parallel.dash env_parallel.fish env_parallel.ksh \
env_parallel.pdksh env_parallel.sh env_parallel.tcsh \
@@ -615,6 +617,12 @@ uninstall-man: uninstall-man1 uninstall-man7
install-exec-hook:
rm $(DESTDIR)$(bindir)/sem || true
$(LN_S) parallel $(DESTDIR)$(bindir)/sem
+ @cd $(DESTDIR)$(bindir); \
+ for bin in $(PERL_BINS); do \
+ mv $$bin "$$bin".tmp; \
+ sed '1s|.*|#!$(PERL_SHEBANG)|' "$$bin".tmp > $$bin; \
+ rm -f "$$bin".tmp; \
+ done
# Build documentation file if the tool to build exists.
# Otherwise: Use the distributed version
diff --git a/src/niceload b/src/niceload
index d0b479f..3a9aa42 100755
--- a/src/niceload
+++ b/src/niceload
@@ -146,11 +146,8 @@ exit($::exitstatus);
if(not %pid_parentpid_cmd) {
# Filter for SysV-style `ps`
- my $sysv = q( ps -ef | perl -ane '1..1 and /^(.*)CO?MM?A?N?D/ and $s=length $1;).
+ my $sysv = q( ps -ef | ).$^X.q( -ane '1..1 and /^(.*)CO?MM?A?N?D/ and $s=length $1;).
q(s/^.{$s}//; print "@F[1,2] $_"' );
- # Crazy msys: ' is not accepted on the cmd line, but " are treated as '
- my $msys = q( ps -ef | perl -ane "1..1 and /^(.*)CO?MM?A?N?D/ and $s=length $1;).
- q(s/^.{$s}//; print qq{@F[1,2] $_}" );
# BSD-style `ps`
my $bsd = q(ps -o pid,ppid,command -ax);
%pid_parentpid_cmd =
@@ -165,7 +162,7 @@ exit($::exitstatus);
'hpux' => $sysv,
'linux' => $sysv,
'mirbsd' => $bsd,
- 'msys' => $msys,
+ 'msys' => $sysv,
'MSWin32' => $sysv,
'netbsd' => $bsd,
'nto' => $sysv,
@@ -589,7 +586,7 @@ sub netsensor_script {
$self->{'remedian'} = (sort @{$rref->[2]})[$#{$rref->[2]}/2];
}
};
- return "perl -e ".shell_quote_scalar($perlscript)." $hops";
+ return "$^X -e ".shell_quote_scalar($perlscript)." $hops";
}
diff --git a/src/parallel b/src/parallel
index 1e45108..ead451d 100755
--- a/src/parallel
+++ b/src/parallel
@@ -418,7 +418,7 @@ sub cat_partial {
}
});
return "<". shell_quote_scalar($file) .
- " perl -e '$script' @start_len";
+ " $^X -e '$script' @start_len";
}
sub spreadstdin {
@@ -4608,11 +4608,8 @@ sub which {
if(not %pid_parentpid_cmd) {
# Filter for SysV-style `ps`
- my $sysv = q( ps -ef | perl -ane '1..1 and /^(.*)CO?MM?A?N?D/ and $s=length $1;).
+ my $sysv = q( ps -ef | ).$^X.q( -ane '1..1 and /^(.*)CO?MM?A?N?D/ and $s=length $1;).
q(s/^.{$s}//; print "@F[1,2] $_"' );
- # Crazy msys: ' is not accepted on the cmd line, but " are treated as '
- my $msys = q( ps -ef | perl -ane "1..1 and /^(.*)CO?MM?A?N?D/ and $s=length $1;).
- q(s/^.{$s}//; print qq{@F[1,2] $_}" );
# BSD-style `ps`
my $bsd = q(ps -o pid,ppid,command -ax);
%pid_parentpid_cmd =
@@ -4628,7 +4625,7 @@ sub which {
'hpux' => $sysv,
'linux' => $sysv,
'mirbsd' => $bsd,
- 'msys' => $msys,
+ 'msys' => $sysv,
'MSWin32' => $sysv,
'netbsd' => $bsd,
'nto' => $sysv,
@@ -5135,7 +5132,7 @@ sub memfree_recompute {
$perlscript .= 'if($^O eq "'.$os.'") { '.$script_of{$os}.'}';
}
$perlscript =~ s/[\t\n ]+/ /g;
- $script = "perl -e " . ::shell_quote_scalar($perlscript);
+ $script = "$^X -e " . ::shell_quote_scalar($perlscript);
}
return $script;
}
@@ -5158,7 +5155,7 @@ sub limit {
(tmp=$(tempfile);
LANG=C iostat -x 1 2 > $tmp;
mv $tmp $io_file) &
- perl -e '-e $ARGV[0] or exit(1);
+ !.$^X.q! -e '-e $ARGV[0] or exit(1);
for(reverse <>) {
/Device:/ and last;
/(\S+)$/ and $max = $max > $1 ? $max : $1; }
@@ -5185,7 +5182,7 @@ sub limit {
ps ax -o state,command |
grep -E '^[DOR].[^[]' |
wc -l |
- perl -ne 'exit ('$limit' < $_)';
+ !.$^X.q! -ne 'exit ('$limit' < $_)';
};
export -f load;
load %s;
@@ -5391,7 +5388,7 @@ sub swap_activity {
$perlscript .= 'if($^O eq "'.$os.'") { print `'.$vmstat{$os}[0].' | awk "{print ' .
$vmstat{$os}[1] . '}"` }';
}
- $script = "perl -e " . ::shell_quote_scalar($perlscript);
+ $script = "$^X -e " . ::shell_quote_scalar($perlscript);
}
return $script;
}
@@ -5438,7 +5435,7 @@ sub loadavg_too_high {
# aix => "ps -ae -o state,command" # state wrong
# bsd => "ps ax -o state,command"
# sysv => "ps -ef -o s -o comm"
- # cygwin => perl -ne 'close STDERR; /Name/ and print"\n"; \
+ # cygwin => $^X -ne 'close STDERR; /Name/ and print"\n"; \
# /(Name|Pid|Ppid|State):\s+(\S+)/ and print "$2\t";' /proc/*/status |
# awk '{print $2,$1}'
# dec_osf => bsd
@@ -5456,14 +5453,14 @@ sub loadavg_too_high {
# svr5 => sysv
# ultrix => ps -ax | awk '{print $3,$5}'
# unixware => ps -el|awk '{print $2,$14,$15}'
- my $ps = ::spacefree(1,q{
+ my $ps = ::spacefree(1,q[
$sysv="ps -ef -o s -o comm";
$sysv2="ps -ef -o state -o comm";
$bsd="ps ax -o state,command";
# Treat threads as processes
$bsd2="ps axH -o state,command";
$psel="ps -el|awk '{ print \$2,\$14,\$15 }'";
- $cygwin=q{ perl -ne 'close STDERR; /Name/ and print"\n";
+ $cygwin=q{ ].$^X.q[ -ne 'close STDERR; /Name/ and print"\n";
/(Name|Pid|Ppid|State):\s+(\S+)/ and print "$2\t";' /proc/*/status |
awk '{print $2,$1}' };
$dummy="echo S COMMAND;echo R dummy";
@@ -5481,7 +5478,7 @@ sub loadavg_too_high {
'linux' => $bsd2,
'minix' => "ps el|awk '{print \$1,\$11}'",
'mirbsd' => $bsd,
- 'msys' => $sysv,
+ 'msys' => $cygwin,
'MSWin32' => $sysv,
'netbsd' => $bsd,
'nto' => $dummy,
@@ -5491,7 +5488,7 @@ sub loadavg_too_high {
'ultrix' => "ps -ax | awk '{print \$3,\$5}'",
);
print `$ps{$^O}`;
- });
+ ]);
# The command is too long for csh, so base64_wrap the command
$cmd = Job::base64_wrap($ps);
}
@@ -5708,8 +5705,8 @@ sub compute_number_of_processes {
# The child takes one process slot
# It will be killed later
$SIG{'TERM'} = $Global::original_sig{'TERM'};
- if($^O eq "cygwin") {
- # The exec does not work on Cygwin
+ if($^O =~ /^(?:cygwin|msys)/) {
+ # The exec does not work on Cygwin/MSys2
sleep 10101010;
} else {
# 'exec sleep' takes less RAM than sleeping in perl
@@ -6407,7 +6404,7 @@ sub no_of_cores_hpux {
# Number of CPU cores on HP-UX
# undef if not HP-UX
my $no_of_cores =
- ::qqx(qq{ /usr/bin/mpsched -s 2>&1 | perl -ne '/Processor Count\\D+(\\d+)/ and print "\$1\n"'});
+ ::qqx(qq{ /usr/bin/mpsched -s 2>&1 | $^X -ne '/Processor Count\\D+(\\d+)/ and print "\$1\n"'});
return $no_of_cores;
}
@@ -7103,19 +7100,19 @@ sub empty_input_wrapper {
exit ($?&127 ? 128+($?&127) : 1+$?>>8)
}
});
- ::debug("run",'Empty wrap: perl -e '.::shell_quote_scalar($script)."\n");
+ ::debug("run","Empty wrap: $^X -e ".::shell_quote_scalar($script)."\n");
if($Global::cshell
and
length $command > 499) {
# csh does not like words longer than 1000 (499 quoted)
- # $command = "perl -e '".base64_zip_eval()."' ".
+ # $command = "$^X -e '".base64_zip_eval()."' ".
# join" ",string_zip_base64(
# 'exec "'.::perl_quote_scalar($command).'"');
- return 'perl -e '.::shell_quote_scalar($script)." ".
+ return "$^X -e ".::shell_quote_scalar($script)." ".
base64_wrap("exec \"$Global::shell\",'-c',\"".
::perl_quote_scalar($command).'"');
} else {
- return 'perl -e '.::shell_quote_scalar($script)." ".
+ return "$^X -e ".::shell_quote_scalar($script)." ".
$Global::shell." -c ".::shell_quote_scalar($command);
}
}
@@ -7408,7 +7405,7 @@ sub total_failed {
# Command to remove files and dirs (given as args) without
# affecting the exit value in $?/$status.
if(not $script) {
- $script = "perl -e '".
+ $script = "$^X -e '".
::spacefree(0,q{
$bash=shift;
$csh=shift;
@@ -7442,7 +7439,7 @@ sub total_failed {
# * cat > fifo
# * waitpid to get the exit code from $command
# * be less than 1000 chars long
- $script = "perl -e '".
+ $script = "$^X -e '".
(::spacefree
(0, q{
($s,$c,$f) = @ARGV;
@@ -7557,7 +7554,7 @@ sub wrapped {
$command = $self->sshlogin_wrap($command);
if(@Global::cat_prepends) {
# --pipepart: prepend:
- # < /tmp/foo perl -e 'while(@ARGV) {
+ # < /tmp/foo $^X -e 'while(@ARGV) {
# sysseek(STDIN,shift,0) || die; $left = shift;
# while($read = sysread(STDIN,$buf, ($left > 131072 ? 131072 : $left))){
# $left -= $read; syswrite(STDOUT,$buf);
@@ -7582,7 +7579,7 @@ sub wrapped {
and
length $command > 499) {
# csh does not like words longer than 1000 (499 quoted)
- # $command = "perl -e '".base64_zip_eval()."' ".
+ # $command = "$^X -e '".base64_zip_eval()."' ".
# join" ",string_zip_base64(
# 'exec "'.::perl_quote_scalar($command).'"');
$command = base64_wrap("exec \"$Global::shell\",'-c',\"".
@@ -7704,7 +7701,7 @@ sub base64_wrap {
# $shell_command = shell command that runs $eval_string
my $eval_string = shift;
return
- "perl -e ".
+ "$^X -e ".
::shell_quote_scalar(base64_zip_eval())." ".
join" ",::shell_quote(string_zip_base64($eval_string));
}
@@ -7905,7 +7902,7 @@ sub sshlogin_wrap {
# csh does not deal well with $ENV with \n
$self->{'sshlogin_wrap'} = base64_wrap($perl_code);
} else {
- $self->{'sshlogin_wrap'} = "perl -e ".::shell_quote_scalar($perl_code);
+ $self->{'sshlogin_wrap'} = "$^X -e ".::shell_quote_scalar($perl_code);
}
} else {
$self->{'sshlogin_wrap'} = $command;
@@ -7922,7 +7919,7 @@ sub sshlogin_wrap {
my $remote_command = $pwd.$envset.$bashfuncset.
'@ARGV="'.::perl_quote_scalar($command).'";'.
monitor_parent_sshd_script();
- $quoted_remote_command = "perl -e ".
+ $quoted_remote_command = "$^X -e ".
::shell_quote_scalar($remote_command);
my $dq_remote_command =
::shell_quote_scalar($quoted_remote_command);
@@ -7934,7 +7931,7 @@ sub sshlogin_wrap {
# csh does not deal well with > 1000 chars in one word
# csh does not deal well with $ENV with \n
$quoted_remote_command =
- "perl -e ".
+ "$^X -e ".
::shell_quote_scalar(::shell_quote_scalar(base64_zip_eval()))." ".
join" ",::shell_quote(::shell_quote(string_zip_base64($remote_command)));
} else {
@@ -8261,7 +8258,7 @@ sub start {
my $bash =
::shell_quote_scalar_default(
"testfun() { rm $name; }; export -f testfun; ".
- "perl -MIPC::Open3 -e ".
+ "$^X -MIPC::Open3 -e ".
::shell_quote_scalar_default($script)
);
# Redirect STDERR temporarily,
@@ -8493,14 +8490,14 @@ sub print_dryrun_and_verbose {
(
"(".$actual_command.');'.
# The triple print is needed - otherwise the testsuite fails
- q[ perl -e 'while($t++<3){ print $ARGV[0],"\n" }' $?h/$status >> ].$tmpfifo."&".
+ " $^X".q[ -e 'while($t++<3){ print $ARGV[0],"\n" }' $?h/$status >> ].$tmpfifo."&".
"echo $title; echo \007Job finished at: `date`;sleep 10"
).
# Run outside tmux
# Read a / separated line: 0h/2 for csh, 2/0 for bash.
# If csh the first will be 0h, so use the second as exit value.
# Otherwise just use the first value as exit value.
- q{; exec perl -e '$/="/";$_=<>;$c=<>;unlink $ARGV; /(\d+)h/ and exit($1);exit$c' }.$tmpfifo;
+ "; exec $^X ".q{-e '$/="/";$_=<>;$c=<>;unlink $ARGV; /(\d+)h/ and exit($1);exit$c' }.$tmpfifo;
}
}
--
2.15.1.433.g936d1b989.dirty