|
Packit Service |
c5cf8c |
dnl PAC_RESET_ALL_FLAGS - Reset precious flags to those set by the user
|
|
Packit Service |
c5cf8c |
AC_DEFUN([PAC_RESET_ALL_FLAGS],[
|
|
Packit Service |
c5cf8c |
if test "$FROM_MPICH" = "yes" ; then
|
|
Packit Service |
c5cf8c |
CFLAGS="$USER_CFLAGS"
|
|
Packit Service |
c5cf8c |
CPPFLAGS="$USER_CPPFLAGS"
|
|
Packit Service |
c5cf8c |
CXXFLAGS="$USER_CXXFLAGS"
|
|
Packit Service |
c5cf8c |
FFLAGS="$USER_FFLAGS"
|
|
Packit Service |
c5cf8c |
FCFLAGS="$USER_FCFLAGS"
|
|
Packit Service |
c5cf8c |
LDFLAGS="$USER_LDFLAGS"
|
|
Packit Service |
c5cf8c |
LIBS="$USER_LIBS"
|
|
Packit Service |
c5cf8c |
fi
|
|
Packit Service |
c5cf8c |
])
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
dnl PAC_RESET_LINK_FLAGS - Reset precious link flags to those set by the user
|
|
Packit Service |
c5cf8c |
AC_DEFUN([PAC_RESET_LINK_FLAGS],[
|
|
Packit Service |
c5cf8c |
if test "$FROM_MPICH" = "yes" ; then
|
|
Packit Service |
c5cf8c |
LDFLAGS="$USER_LDFLAGS"
|
|
Packit Service |
c5cf8c |
LIBS="$USER_LIBS"
|
|
Packit Service |
c5cf8c |
fi
|
|
Packit Service |
c5cf8c |
])
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
dnl Sandbox configure with additional arguments
|
|
Packit Service |
c5cf8c |
dnl Usage: PAC_CONFIG_SUBDIR_ARGS(subdir,configure-args,action-if-success,action-if-failure)
|
|
Packit Service |
c5cf8c |
dnl
|
|
Packit Service |
c5cf8c |
dnl The subconfigure argument list is created based on "ac_precious_vars"
|
|
Packit Service |
c5cf8c |
dnl instead of explicitly use of well-known Makefile variables, like
|
|
Packit Service |
c5cf8c |
dnl CC/CFLAGS/CPPFLAGS..., this generalization is effective as long as
|
|
Packit Service |
c5cf8c |
dnl calling configure.ac declares the needed variables to be passed down
|
|
Packit Service |
c5cf8c |
dnl to subconfigure as "precious" appropriately. The precious variable
|
|
Packit Service |
c5cf8c |
dnl can be created in the following ways:
|
|
Packit Service |
c5cf8c |
dnl 1) implicit declaration through use of autoconf macros, like
|
|
Packit Service |
c5cf8c |
dnl AC_PROG_CC (declares CC/CFLAGS/CPPFLAGS/LIBS/LDFLAGS), or
|
|
Packit Service |
c5cf8c |
dnl AC_PROG_F77 (declares F77/FFLAGS/FLIBS) ...
|
|
Packit Service |
c5cf8c |
dnl which are in turns invoked by other subconfigure.
|
|
Packit Service |
c5cf8c |
dnl When in doubt, check "ac_precious_var" in the calling configure.
|
|
Packit Service |
c5cf8c |
dnl 2) explicit "precious" declaration through AC_ARG_VAR.
|
|
Packit Service |
c5cf8c |
dnl Without correct "precious" declaration in the calling configure.ac,
|
|
Packit Service |
c5cf8c |
dnl there would be variables not being included in the subconfigure
|
|
Packit Service |
c5cf8c |
dnl argument list.
|
|
Packit Service |
c5cf8c |
dnl
|
|
Packit Service |
c5cf8c |
dnl Note: I suspect this DEFUN body is underquoted in places, but it does not
|
|
Packit Service |
c5cf8c |
dnl seem to cause problems in practice yet. [goodell@ 2010-05-18]
|
|
Packit Service |
c5cf8c |
AC_DEFUN([PAC_CONFIG_SUBDIR_ARGS],[
|
|
Packit Service |
c5cf8c |
pac_dir="$1"
|
|
Packit Service |
c5cf8c |
AC_MSG_NOTICE([===== configuring $1 =====])
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
pac_abs_srcdir=`(cd $srcdir && pwd)`
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
if test -f $pac_abs_srcdir/$1/setup ; then
|
|
Packit Service |
c5cf8c |
AC_MSG_NOTICE([sourcing $pac_abs_srcdir/$1/setup])
|
|
Packit Service |
c5cf8c |
. $pac_abs_srcdir/$1/setup
|
|
Packit Service |
c5cf8c |
fi
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
# Adapted for MPICH from the autoconf-2.67 implementation of
|
|
Packit Service |
c5cf8c |
# AC_CONFIG_SUBDIRS. Search for "MPICH note:" for relevant commentary and
|
|
Packit Service |
c5cf8c |
# local modifications.
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
# Remove --cache-file, --srcdir, and --disable-option-checking arguments
|
|
Packit Service |
c5cf8c |
# so they do not pile up. Otherwise relative paths (like --srcdir=.. from
|
|
Packit Service |
c5cf8c |
# make distcheck) will be incorrect.
|
|
Packit Service |
c5cf8c |
pac_sub_configure_args="$2"
|
|
Packit Service |
c5cf8c |
pac_prev=
|
|
Packit Service |
c5cf8c |
eval "set x $ac_configure_args"
|
|
Packit Service |
c5cf8c |
shift
|
|
Packit Service |
c5cf8c |
for pac_arg
|
|
Packit Service |
c5cf8c |
do
|
|
Packit Service |
c5cf8c |
if test -n "$pac_prev"; then
|
|
Packit Service |
c5cf8c |
pac_prev=
|
|
Packit Service |
c5cf8c |
continue
|
|
Packit Service |
c5cf8c |
fi
|
|
Packit Service |
c5cf8c |
case $pac_arg in
|
|
Packit Service |
c5cf8c |
-cache-file | --cache-file | --cache-fil | --cache-fi \
|
|
Packit Service |
c5cf8c |
| --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
|
|
Packit Service |
c5cf8c |
pac_prev=cache_file ;;
|
|
Packit Service |
c5cf8c |
-cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
|
|
Packit Service |
c5cf8c |
| --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* \
|
|
Packit Service |
c5cf8c |
| --c=*)
|
|
Packit Service |
c5cf8c |
;;
|
|
Packit Service |
c5cf8c |
--config-cache | -C)
|
|
Packit Service |
c5cf8c |
;;
|
|
Packit Service |
c5cf8c |
-srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
|
|
Packit Service |
c5cf8c |
pac_prev=srcdir ;;
|
|
Packit Service |
c5cf8c |
-srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
|
|
Packit Service |
c5cf8c |
;;
|
|
Packit Service |
c5cf8c |
-prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
|
|
Packit Service |
c5cf8c |
pac_prev=prefix ;;
|
|
Packit Service |
c5cf8c |
-prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
|
|
Packit Service |
c5cf8c |
;;
|
|
Packit Service |
c5cf8c |
--disable-option-checking)
|
|
Packit Service |
c5cf8c |
;;
|
|
Packit Service |
c5cf8c |
*)
|
|
Packit Service |
c5cf8c |
# MPICH note: this is a more robust version of the "precious
|
|
Packit Service |
c5cf8c |
# variable" propagation code that was present in the previous
|
|
Packit Service |
c5cf8c |
# incarnation of this macro
|
|
Packit Service |
c5cf8c |
for pac_pvar in $ac_precious_vars ; do
|
|
Packit Service |
c5cf8c |
# check if configure argument token contains the
|
|
Packit Service |
c5cf8c |
# precious variable, i.e. "name_of_prec_var=".
|
|
Packit Service |
c5cf8c |
if ( echo $pac_arg | grep "^$pac_pvar=" >/dev/null 2>&1 ) ; then
|
|
Packit Service |
c5cf8c |
# check if current precious variable is set in env
|
|
Packit Service |
c5cf8c |
eval pvar_set=\${$pac_pvar+set}
|
|
Packit Service |
c5cf8c |
if test "$pvar_set" = "set" ; then
|
|
Packit Service |
c5cf8c |
# Append 'name_of_prec_var=value_of_prec_var'
|
|
Packit Service |
c5cf8c |
# to the subconfigure arguments list, where
|
|
Packit Service |
c5cf8c |
# value_of_prec_var is fetched from the env.
|
|
Packit Service |
c5cf8c |
# this also overrides any value set on the command line
|
|
Packit Service |
c5cf8c |
eval pac_pval=\${$pac_pvar}
|
|
Packit Service |
c5cf8c |
pac_arg="$pac_pvar=$pac_pval"
|
|
Packit Service |
c5cf8c |
break
|
|
Packit Service |
c5cf8c |
fi
|
|
Packit Service |
c5cf8c |
fi
|
|
Packit Service |
c5cf8c |
done
|
|
Packit Service |
c5cf8c |
case $pac_arg in
|
|
Packit Service |
c5cf8c |
*\'*) pac_arg=`AS_ECHO(["$pac_arg"]) | sed "s/'/'\\\\\\\\''/g"` ;;
|
|
Packit Service |
c5cf8c |
esac
|
|
Packit Service |
c5cf8c |
AS_VAR_APPEND([pac_sub_configure_args], [" '$pac_arg'"]) ;;
|
|
Packit Service |
c5cf8c |
esac
|
|
Packit Service |
c5cf8c |
done
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
# Always prepend --prefix to ensure using the same prefix
|
|
Packit Service |
c5cf8c |
# in subdir configurations.
|
|
Packit Service |
c5cf8c |
# MPICH note: see tt#983 for an example of why this is necessary
|
|
Packit Service |
c5cf8c |
pac_arg="--prefix=$prefix"
|
|
Packit Service |
c5cf8c |
case $pac_arg in
|
|
Packit Service |
c5cf8c |
*\'*) pac_arg=`AS_ECHO(["$pac_arg"]) | sed "s/'/'\\\\\\\\''/g"` ;;
|
|
Packit Service |
c5cf8c |
esac
|
|
Packit Service |
c5cf8c |
pac_sub_configure_args="'$pac_arg' $pac_sub_configure_args"
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
# Pass --silent
|
|
Packit Service |
c5cf8c |
if test "$silent" = yes; then
|
|
Packit Service |
c5cf8c |
pac_sub_configure_args="--silent $pac_sub_configure_args"
|
|
Packit Service |
c5cf8c |
fi
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
# Always prepend --disable-option-checking to silence warnings, since
|
|
Packit Service |
c5cf8c |
# different subdirs can have different --enable and --with options.
|
|
Packit Service |
c5cf8c |
pac_sub_configure_args="--disable-option-checking $pac_sub_configure_args"
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
pac_popdir=`pwd`
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
# Do not complain, so a configure script can configure whichever
|
|
Packit Service |
c5cf8c |
# parts of a large source tree are present.
|
|
Packit Service |
c5cf8c |
test -d "$srcdir/$pac_dir" || continue
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
# MPICH note: modified to remove the internal "_AS_*" macro usage, also
|
|
Packit Service |
c5cf8c |
# msg is already printed at top
|
|
Packit Service |
c5cf8c |
dnl _AS_ECHO_LOG([$pac_msg])
|
|
Packit Service |
c5cf8c |
dnl _AS_ECHO([$pac_msg])
|
|
Packit Service |
c5cf8c |
AS_MKDIR_P(["$pac_dir"])
|
|
Packit Service |
c5cf8c |
# MPICH note: we leave this internal macro reference for now. We can clone
|
|
Packit Service |
c5cf8c |
# the macro locally if this turns out to be non-portable across several autoconf
|
|
Packit Service |
c5cf8c |
# versions. It sets the following variables: ac_builddir,
|
|
Packit Service |
c5cf8c |
# ac_top_builddir_sub, ac_top_build_prefix, ac_srcdir, ac_top_srcdir,
|
|
Packit Service |
c5cf8c |
# ac_abs_top_builddir, ac_abs_builddir, ac_abs_top_srcdir, ac_abs_srcdir
|
|
Packit Service |
c5cf8c |
_AC_SRCDIRS(["$pac_dir"])
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
cd "$pac_dir"
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
# Check for guested configure; otherwise get Cygnus style configure.
|
|
Packit Service |
c5cf8c |
if test -f "$ac_srcdir/configure.gnu"; then
|
|
Packit Service |
c5cf8c |
pac_sub_configure=$ac_srcdir/configure.gnu
|
|
Packit Service |
c5cf8c |
elif test -f "$ac_srcdir/configure"; then
|
|
Packit Service |
c5cf8c |
pac_sub_configure=$ac_srcdir/configure
|
|
Packit Service |
c5cf8c |
elif test -f "$ac_srcdir/configure.ac"; then
|
|
Packit Service |
c5cf8c |
# This should be Cygnus configure.
|
|
Packit Service |
c5cf8c |
pac_sub_configure=$ac_aux_dir/configure
|
|
Packit Service |
c5cf8c |
else
|
|
Packit Service |
c5cf8c |
AC_MSG_WARN([no configuration information is in $pac_dir])
|
|
Packit Service |
c5cf8c |
pac_sub_configure=
|
|
Packit Service |
c5cf8c |
fi
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
# The recursion is here.
|
|
Packit Service |
c5cf8c |
if test -n "$pac_sub_configure"; then
|
|
Packit Service |
c5cf8c |
# MPICH note: overriding the cache file on purpose to prevent strange
|
|
Packit Service |
c5cf8c |
# issues resulting from inter-dir caching
|
|
Packit Service |
c5cf8c |
dnl # Make the cache file name correct relative to the subdirectory.
|
|
Packit Service |
c5cf8c |
dnl case $cache_file in
|
|
Packit Service |
c5cf8c |
dnl [[\\/]]* | ?:[[\\/]]* ) pac_sub_cache_file=$cache_file ;;
|
|
Packit Service |
c5cf8c |
dnl *) # Relative name.
|
|
Packit Service |
c5cf8c |
dnl pac_sub_cache_file=$ac_top_build_prefix$cache_file ;;
|
|
Packit Service |
c5cf8c |
dnl esac
|
|
Packit Service |
c5cf8c |
pac_sub_cache_file="/dev/null"
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
AC_MSG_NOTICE([running $SHELL $pac_sub_configure $pac_sub_configure_args --cache-file=$pac_sub_cache_file --srcdir=$ac_srcdir])
|
|
Packit Service |
c5cf8c |
# The eval makes quoting arguments work.
|
|
Packit Service |
c5cf8c |
# MPICH note: we want to execute the provided actions, not be silent
|
|
Packit Service |
c5cf8c |
# or error out if the subconfigure succeeded/failed
|
|
Packit Service |
c5cf8c |
dnl eval "\$SHELL \"\$pac_sub_configure\" $pac_sub_configure_args \
|
|
Packit Service |
c5cf8c |
dnl --cache-file=\"\$pac_sub_cache_file\" --srcdir=\"\$ac_srcdir\"" ||
|
|
Packit Service |
c5cf8c |
dnl AC_MSG_ERROR([$pac_sub_configure failed for $pac_dir])
|
|
Packit Service |
c5cf8c |
if eval "\$SHELL \"\$pac_sub_configure\" $pac_sub_configure_args \
|
|
Packit Service |
c5cf8c |
--cache-file=\"\$pac_sub_cache_file\" --srcdir=\"\$ac_srcdir\""
|
|
Packit Service |
c5cf8c |
then
|
|
Packit Service |
c5cf8c |
# restore the current dir for the provided actions
|
|
Packit Service |
c5cf8c |
cd "$pac_popdir"
|
|
Packit Service |
c5cf8c |
$3
|
|
Packit Service |
c5cf8c |
else
|
|
Packit Service |
c5cf8c |
# restore the current dir for the provided actions
|
|
Packit Service |
c5cf8c |
cd "$pac_popdir"
|
|
Packit Service |
c5cf8c |
$4
|
|
Packit Service |
c5cf8c |
fi
|
|
Packit Service |
c5cf8c |
fi
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
cd "$pac_popdir"
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
AC_MSG_NOTICE([===== done with $1 configure =====])
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
# Check for any localdefs files. These may be created, so we
|
|
Packit Service |
c5cf8c |
# look in the local directory first.
|
|
Packit Service |
c5cf8c |
if test -f $1/localdefs ; then
|
|
Packit Service |
c5cf8c |
AC_MSG_NOTICE([sourcing $1/localdefs])
|
|
Packit Service |
c5cf8c |
. $1/localdefs
|
|
Packit Service |
c5cf8c |
elif test -f $pac_abs_srcdir/$1/localdefs ; then
|
|
Packit Service |
c5cf8c |
AC_MSG_NOTICE([sourcing $pac_abs_srcdir/$1/localdefs])
|
|
Packit Service |
c5cf8c |
. $pac_abs_srcdir/$1/localdefs
|
|
Packit Service |
c5cf8c |
fi
|
|
Packit Service |
c5cf8c |
])
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
dnl Sandbox configure
|
|
Packit Service |
c5cf8c |
dnl Usage: PAC_CONFIG_SUBDIR(subdir,action-if-success,action-if-failure)
|
|
Packit Service |
c5cf8c |
AC_DEFUN([PAC_CONFIG_SUBDIR],[PAC_CONFIG_SUBDIR_ARGS([$1],[],[$2],[$3])])
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
dnl PAC_SUBCFG_EXPAND_SUFFIX_MACRO(MACRO_PREFIX,MACRO_PATH_SUFFIX)
|
|
Packit Service |
c5cf8c |
dnl converts the path given by MACRO_PATH_SUFFIX (with '/' chars in it) to one
|
|
Packit Service |
c5cf8c |
dnl with '_' chars in it and then appends that to MACRO_PREFIX with '_' in
|
|
Packit Service |
c5cf8c |
dnl between. The resulting macro name is then expanded, but with informative
|
|
Packit Service |
c5cf8c |
dnl "##" comments before and after the expansion.
|
|
Packit Service |
c5cf8c |
dnl
|
|
Packit Service |
c5cf8c |
dnl This is intended to be an internal helper macro for the PAC_SUBCFG
|
|
Packit Service |
c5cf8c |
dnl implementation.
|
|
Packit Service |
c5cf8c |
dnl
|
|
Packit Service |
c5cf8c |
dnl XXX DJG FIXME: need to be able to deal with PREREQ macros that potentially
|
|
Packit Service |
c5cf8c |
dnl aren't present while having safety for BODY macros when there are
|
|
Packit Service |
c5cf8c |
dnl misspellings
|
|
Packit Service |
c5cf8c |
AC_DEFUN([PAC_SUBCFG_EXPAND_PATH_SUFFIX_MACRO],[
|
|
Packit Service |
c5cf8c |
dnl convert path separators into '_', the m4_translit is intentionally unquoted
|
|
Packit Service |
c5cf8c |
m4_pushdef([subsys_uscore_name],[$1_]m4_translit([$2],[\/],[__]))dnl
|
|
Packit Service |
c5cf8c |
m4_ifdef(m4_defn([subsys_uscore_name]),[],[m4_fatal([macro ]m4_defn([subsys_uscore_name])[ is undefined])])dnl
|
|
Packit Service |
c5cf8c |
[##] begin expansion of m4_defn([subsys_uscore_name])
|
|
Packit Service |
c5cf8c |
dnl call the computed routine name with the remaining args
|
|
Packit Service |
c5cf8c |
m4_indir(m4_defn([subsys_uscore_name]),m4_shift($@))
|
|
Packit Service |
c5cf8c |
dnl there is intentionally no "dnl" on the previous line to reduce the chance of
|
|
Packit Service |
c5cf8c |
dnl a "fi## end expansion" bug when the BODY macro doesn't end in a newline
|
|
Packit Service |
c5cf8c |
[##] end expansion of m4_defn([subsys_uscore_name])
|
|
Packit Service |
c5cf8c |
])
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
dnl invokes the PAC_SUBCFG_BODY_foo macro for the "foo" subsys, when "foo" is
|
|
Packit Service |
c5cf8c |
dnl passed as the only argument to this macro. The first arg may be the '/'
|
|
Packit Service |
c5cf8c |
dnl path version instead of having underscores.
|
|
Packit Service |
c5cf8c |
AC_DEFUN([PAC_SUBCFG_CONFIGURE_SUBSYS],[PAC_SUBCFG_EXPAND_PATH_SUFFIX_MACRO([PAC_SUBCFG_BODY],[$1])])
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
dnl invokes the PAC_SUBCFG_PREREQ_foo macro for the "foo" subsys, when "foo" is
|
|
Packit Service |
c5cf8c |
dnl passed as the only argument to this macro. The first arg may be the '/'
|
|
Packit Service |
c5cf8c |
dnl path version instead of having underscores.
|
|
Packit Service |
c5cf8c |
AC_DEFUN([PAC_SUBCFG_DO_PREREQ],[PAC_SUBCFG_EXPAND_PATH_SUFFIX_MACRO([PAC_SUBCFG_PREREQ],[$1])])
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
dnl takes no arguments, expands to "foo_bar_baz" when invoked in a file named
|
|
Packit Service |
c5cf8c |
dnl "foo/bar/baz/subconfigure.m4"
|
|
Packit Service |
c5cf8c |
dnl
|
|
Packit Service |
c5cf8c |
dnl This is useful for reducing copy-paste errors when defining PREREQ and BODY
|
|
Packit Service |
c5cf8c |
dnl macros. If you tinker with this macro, watch the quoting carefully.
|
|
Packit Service |
c5cf8c |
AC_DEFUN([PAC_SUBCFG_AUTO_SUFFIX],[m4_translit(m4_bpatsubst(m4_dquote(__file__),[/[^/]+.m4],[]),[/],[_])])
|