Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wrappers: Fix user argument handling #10

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 0 additions & 21 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2668,27 +2668,6 @@ AC_PATH_PROG(BASH_SHELL,bash)
# compliation scripts) by taking advantage of the array features in
# bash.
bashWorks=no
if test -x "$BASH_SHELL" ; then
changequote(%%,::)dnl
cat >>conftest <<EOF
#! $BASH_SHELL
A[0]="b"
A[1]="c"
rc=1
if test \${A[1]} != "c" ; then rc=2 ; else rc=0 ; fi
exit \$rc
EOF
changequote([,])dnl
AC_MSG_CHECKING([whether $BASH_SHELL supports arrays])
chmod +x conftest
if ./conftest 2>&1 >/dev/null ; then
bashWorks=yes
else
bashWorks=no
fi
rm -f conftest*
AC_MSG_RESULT($bashWorks)
fi
dnl BUILD_BASH_SCRIPTS used to be an AC_SUBST
AM_CONDITIONAL([BUILD_BASH_SCRIPTS], [test "x$bashWorks" = xyes])

Expand Down
24 changes: 5 additions & 19 deletions src/env/mpicc.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ static_mpi=no
for arg in "$@" ; do
# Set addarg to no if this arg should be ignored by the C compiler
addarg=yes
qarg=$arg
case $arg in
# ----------------------------------------------------------------
# Compiler options that affect whether we are linking or no
Expand Down Expand Up @@ -184,24 +183,11 @@ for arg in "$@" ; do
fi
fi
exit 0
;;
# -----------------------------------------------------------------
# Other arguments. We are careful to handle arguments with
# quotes (we try to quote all arguments in case they include
# any spaces)
*\"*)
qarg="'"$arg"'"
;;
*\'*)
qarg='\"'"$arg"'\"'
;;
*)
qarg="'$arg'"
;;

esac
if [ $addarg = yes ] ; then
allargs="$allargs $qarg"
allargs="$allargs $arg"
fi
done

Expand Down Expand Up @@ -257,18 +243,18 @@ fi
# suppressing linking, such as -c or -M.
if [ "$linking" = yes ] ; then
if [ "$nativelinking" = yes ] ; then
$Show $CC ${final_cppflags} $PROFILE_INCPATHS ${final_cflags} ${final_ldflags} $allargs -I$includedir
$Show $CC ${final_cppflags} $PROFILE_INCPATHS ${final_cflags} ${final_ldflags} ${allargs} -I$includedir
rc=$?
else
if [ "$static_mpi" = no ] ; then
$Show $CC ${final_cppflags} $PROFILE_INCPATHS ${final_cflags} ${final_ldflags} "${allargs[@]}" -I$includedir -L$libdir $PROFILE_PRELIB $PROFILE_FOO ${wrapper_dl_type_flags} -l@MPILIBNAME@ @LPMPILIBNAME@ $PROFILE_POSTLIB ${final_libs}
$Show $CC ${final_cppflags} $PROFILE_INCPATHS ${final_cflags} ${final_ldflags} ${allargs} -I$includedir -L$libdir $PROFILE_PRELIB $PROFILE_FOO ${wrapper_dl_type_flags} -l@MPILIBNAME@ @LPMPILIBNAME@ $PROFILE_POSTLIB ${final_libs}
else
$Show $CC ${final_cppflags} $PROFILE_INCPATHS ${final_cflags} ${final_ldflags} "${allargs[@]}" -I$includedir -L$libdir $PROFILE_PRELIB $PROFILE_FOO ${wrapper_dl_type_flags} $libdir/lib@[email protected] @LPMPILIBNAME@ $PROFILE_POSTLIB ${final_libs}
$Show $CC ${final_cppflags} $PROFILE_INCPATHS ${final_cflags} ${final_ldflags} ${allargs} -I$includedir -L$libdir $PROFILE_PRELIB $PROFILE_FOO ${wrapper_dl_type_flags} $libdir/lib@[email protected] @LPMPILIBNAME@ $PROFILE_POSTLIB ${final_libs}
fi
rc=$?
fi
else
$Show $CC ${final_cppflags} $PROFILE_INCPATHS ${final_cflags} $allargs -I$includedir
$Show $CC ${final_cppflags} $PROFILE_INCPATHS ${final_cflags} ${allargs} -I$includedir
rc=$?
fi

Expand Down
24 changes: 5 additions & 19 deletions src/env/mpicxx.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ static_mpi=no
for arg in "$@" ; do
# Set addarg to no if this arg should be ignored by the C compiler
addarg=yes
qarg=$arg
case $arg in
# ----------------------------------------------------------------
# Compiler options that affect whether we are linking or no
Expand Down Expand Up @@ -186,24 +185,11 @@ for arg in "$@" ; do
fi
fi
exit 0
;;
# -----------------------------------------------------------------
# Other arguments. We are careful to handle arguments with
# quotes (we try to quote all arguments in case they include
# any spaces)
*\"*)
qarg="'"$arg"'"
;;
*\'*)
qarg='\"'"$arg"'\"'
;;
*)
qarg="'$arg'"
;;

esac
if [ $addarg = yes ] ; then
allargs="$allargs $qarg"
allargs="$allargs $arg"
fi
done

Expand Down Expand Up @@ -255,18 +241,18 @@ fi
# libraries
if [ "$linking" = yes ] ; then
if [ "$nativelinking" = yes ] ; then
$Show $CXX ${final_cppflags} $PROFILE_INCPATHS ${final_cxxflags} ${final_ldflags} $allargs -I$includedir
$Show $CXX ${final_cppflags} $PROFILE_INCPATHS ${final_cxxflags} ${final_ldflags} ${allargs} -I$includedir
rc=$?
else
if [ "$static_mpi" = no ] ; then
$Show $CXX ${final_cppflags} $PROFILE_INCPATHS ${final_cxxflags} ${final_ldflags} "${allargs[@]}" -I$includedir -L$libdir $cxxlibs $PROFILE_PRELIB $PROFILE_FOO ${wrapper_dl_type_flags} -l@MPILIBNAME@ @LPMPILIBNAME@ $PROFILE_POSTLIB ${final_libs}
$Show $CXX ${final_cppflags} $PROFILE_INCPATHS ${final_cxxflags} ${final_ldflags} ${allargs} -I$includedir -L$libdir $cxxlibs $PROFILE_PRELIB $PROFILE_FOO ${wrapper_dl_type_flags} -l@MPILIBNAME@ @LPMPILIBNAME@ $PROFILE_POSTLIB ${final_libs}
else
$Show $CXX ${final_cppflags} $PROFILE_INCPATHS ${final_cxxflags} ${final_ldflags} "${allargs[@]}" -I$includedir -L$libdir $cxxlibs $PROFILE_PRELIB $PROFILE_FOO ${wrapper_dl_type_flags} $libdir/lib@[email protected] @LPMPILIBNAME@ $PROFILE_POSTLIB ${final_libs}
$Show $CXX ${final_cppflags} $PROFILE_INCPATHS ${final_cxxflags} ${final_ldflags} ${allargs} -I$includedir -L$libdir $cxxlibs $PROFILE_PRELIB $PROFILE_FOO ${wrapper_dl_type_flags} $libdir/lib@[email protected] @LPMPILIBNAME@ $PROFILE_POSTLIB ${final_libs}
fi
rc=$?
fi
else
$Show $CXX ${final_cppflags} $PROFILE_INCPATHS ${final_cxxflags} $allargs -I$includedir
$Show $CXX ${final_cppflags} $PROFILE_INCPATHS ${final_cxxflags} ${allargs} -I$includedir
rc=$?
fi

Expand Down
35 changes: 5 additions & 30 deletions src/env/mpif77.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ static_mpi=no
for arg in "$@" ; do
# Set addarg to no if this arg should be ignored by the C compiler
addarg=yes
qarg=$arg
case $arg in
# ----------------------------------------------------------------
# Compiler options that affect whether we are linking or no
Expand Down Expand Up @@ -195,26 +194,6 @@ for arg in "$@" ; do
fi
fi
exit 0
;;
# -----------------------------------------------------------------
# Other arguments. We are careful to handle arguments with
# quotes (we try to quote all arguments in case they include
# any spaces)
*\"*)
qarg="'"$arg"'"
case $arg in
-D*)
cppflags="$cppflags $qarg"
;;
esac
;;
*\'*)
qarg='\"'"$arg"'\"'
case $arg in
-D*)
cppflags="$cppflags $qarg"
;;
esac
;;

# The following are special args used to handle .F files when the
Expand Down Expand Up @@ -262,13 +241,9 @@ for arg in "$@" ; do
;;
# - end of special handling for .F files

*)
qarg="'$arg'"
;;

esac
if [ $addarg = yes ] ; then
allargs="$allargs $qarg"
allargs="$allargs $arg"
fi
done

Expand Down Expand Up @@ -320,18 +295,18 @@ fi
#
if [ "$linking" = yes ] ; then
if [ "$nativelinking" = yes ] ; then
$Show $F77 $PROFILE_INCPATHS ${final_fflags} ${final_ldflags} $allargs -I$includedir
$Show $F77 $PROFILE_INCPATHS ${final_fflags} ${final_ldflags} ${allargs} -I$includedir
rc=$?
else
if [ "$static_mpi" = no ] ; then
$Show $F77 $PROFILE_INCPATHS ${final_fflags} ${final_ldflags} "${allargs[@]}" -I$includedir -L$libdir $f77libs $PROFILE_PRELIB $PROFILE_FOO ${wrapper_dl_type_flags} -l@MPILIBNAME@ @LPMPILIBNAME@ $PROFILE_POSTLIB ${final_libs} @F77_OTHER_LIBS@
$Show $F77 $PROFILE_INCPATHS ${final_fflags} ${final_ldflags} ${allargs} -I$includedir -L$libdir $f77libs $PROFILE_PRELIB $PROFILE_FOO ${wrapper_dl_type_flags} -l@MPILIBNAME@ @LPMPILIBNAME@ $PROFILE_POSTLIB ${final_libs} @F77_OTHER_LIBS@
else
$Show $F77 $PROFILE_INCPATHS ${final_fflags} ${final_ldflags} "${allargs[@]}" -I$includedir -L$libdir $f77libs $PROFILE_PRELIB $PROFILE_FOO ${wrapper_dl_type_flags} $libdir/lib@[email protected] @LPMPILIBNAME@ $PROFILE_POSTLIB ${final_libs} @F77_OTHER_LIBS@
$Show $F77 $PROFILE_INCPATHS ${final_fflags} ${final_ldflags} ${allargs} -I$includedir -L$libdir $f77libs $PROFILE_PRELIB $PROFILE_FOO ${wrapper_dl_type_flags} $libdir/lib@[email protected] @LPMPILIBNAME@ $PROFILE_POSTLIB ${final_libs} @F77_OTHER_LIBS@
fi
rc=$?
fi
else
$Show $F77 $PROFILE_INCPATHS ${final_fflags} $allargs -I$includedir
$Show $F77 $PROFILE_INCPATHS ${final_fflags} ${allargs} -I$includedir
rc=$?
fi
if [ -n "$rmfiles" ] ; then
Expand Down
35 changes: 5 additions & 30 deletions src/env/mpifort.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ static_mpi=no
for arg in "$@" ; do
# Set addarg to no if this arg should be ignored by the C compiler
addarg=yes
qarg=$arg
case $arg in
# ----------------------------------------------------------------
# Compiler options that affect whether we are linking or no
Expand Down Expand Up @@ -204,26 +203,6 @@ for arg in "$@" ; do
fi
fi
exit 0
;;
# -----------------------------------------------------------------
# Other arguments. We are careful to handle arguments with
# quotes (we try to quote all arguments in case they include
# any spaces)
*\"*)
qarg="'"$arg"'"
case $arg in
-D*)
cppflags="$cppflags $qarg"
;;
esac
;;
*\'*)
qarg='\"'"$arg"'\"'
case $arg in
-D*)
cppflags="$cppflags $qarg"
;;
esac
;;
# The following are special args used to handle .F files when the
# Fortran compiler itself does not handle these options
Expand Down Expand Up @@ -271,13 +250,9 @@ for arg in "$@" ; do
;;
# - end of special handling for .F files

*)
qarg="'$arg'"
;;

esac
if [ $addarg = yes ] ; then
allargs="$allargs $qarg"
allargs="$allargs $arg"
fi
done

Expand Down Expand Up @@ -355,18 +330,18 @@ fi
# libraries
if [ "$linking" = yes ] ; then
if [ "$nativelinking" = yes ] ; then
$Show $FC $PROFILE_INCPATHS ${final_fcflags} ${final_ldflags} $allargs
$Show $FC $PROFILE_INCPATHS ${final_fcflags} ${final_ldflags} ${allargs}
rc=$?
else
if [ "$static_mpi" = no ] ; then
$Show $FC $PROFILE_INCPATHS ${final_fcflags} ${final_ldflags} "${allargs[@]}" $FCINCDIRS $FCMODDIRS -L$libdir -l@MPIFCLIBNAME@ $PROFILE_PRELIB $PROFILE_FOO ${wrapper_dl_type_flags} -l@MPILIBNAME@ @LPMPILIBNAME@ $PROFILE_POSTLIB ${final_libs} @FC_OTHER_LIBS@
$Show $FC $PROFILE_INCPATHS ${final_fcflags} ${final_ldflags} ${allargs} $FCINCDIRS $FCMODDIRS -L$libdir -l@MPIFCLIBNAME@ $PROFILE_PRELIB $PROFILE_FOO ${wrapper_dl_type_flags} -l@MPILIBNAME@ @LPMPILIBNAME@ $PROFILE_POSTLIB ${final_libs} @FC_OTHER_LIBS@
else
$Show $FC $PROFILE_INCPATHS ${final_fcflags} ${final_ldflags} "${allargs[@]}" $FCINCDIRS $FCMODDIRS -L$libdir -l@MPIFCLIBNAME@ $PROFILE_PRELIB $PROFILE_FOO ${wrapper_dl_type_flags} $libdir/lib@[email protected] @LPMPILIBNAME@ $PROFILE_POSTLIB ${final_libs} @FC_OTHER_LIBS@
$Show $FC $PROFILE_INCPATHS ${final_fcflags} ${final_ldflags} ${allargs} $FCINCDIRS $FCMODDIRS -L$libdir -l@MPIFCLIBNAME@ $PROFILE_PRELIB $PROFILE_FOO ${wrapper_dl_type_flags} $libdir/lib@[email protected] @LPMPILIBNAME@ $PROFILE_POSTLIB ${final_libs} @FC_OTHER_LIBS@
fi
rc=$?
fi
else
$Show $FC $PROFILE_INCPATHS ${final_fcflags} $allargs $FCINCDIRS $FCMODDIRS
$Show $FC $PROFILE_INCPATHS ${final_fcflags} ${allargs} $FCINCDIRS $FCMODDIRS
rc=$?
fi
if [ -n "$rmfiles" ] ; then
Expand Down