2015-02-03 09:19:22 +03:00
|
|
|
dnl -*- shell-script -*-
|
|
|
|
dnl
|
|
|
|
dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
|
|
|
dnl University Research and Technology
|
|
|
|
dnl Corporation. All rights reserved.
|
|
|
|
dnl Copyright (c) 2004-2005 The University of Tennessee and The University
|
|
|
|
dnl of Tennessee Research Foundation. All rights
|
|
|
|
dnl reserved.
|
|
|
|
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
dnl University of Stuttgart. All rights reserved.
|
|
|
|
dnl Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
dnl All rights reserved.
|
|
|
|
dnl Copyright (c) 2014 Intel, Inc. All rights reserved.
|
|
|
|
dnl Copyright (c) 2015 Research Organization for Information Science
|
|
|
|
dnl and Technology (RIST). All rights reserved.
|
|
|
|
dnl $COPYRIGHT$
|
|
|
|
dnl
|
|
|
|
dnl Additional copyrights may follow
|
|
|
|
dnl
|
|
|
|
dnl $HEADER$
|
|
|
|
dnl
|
2008-10-28 20:22:29 +03:00
|
|
|
|
2014-05-07 01:16:29 +04:00
|
|
|
# OPAL_LOAD_PLATFORM()
|
2008-10-28 20:22:29 +03:00
|
|
|
# --------------------
|
2014-05-07 01:16:29 +04:00
|
|
|
AC_DEFUN([OPAL_LOAD_PLATFORM], [
|
2015-10-07 16:18:48 +03:00
|
|
|
AC_ARG_WITH([platform-patches-dir],
|
|
|
|
[AC_HELP_STRING([--with-platform-patches-dir=DIR],
|
|
|
|
[Location of the platform patches directory. If you use this option, you must also use --with-platform.])])
|
|
|
|
|
2008-10-28 20:22:29 +03:00
|
|
|
AC_ARG_WITH([platform],
|
|
|
|
[AC_HELP_STRING([--with-platform=FILE],
|
|
|
|
[Load options for build from FILE. Options on the
|
|
|
|
command line not in FILE are used. Options on the
|
|
|
|
command line and in FILE are replaced by what is
|
|
|
|
in FILE.])])
|
2010-09-18 03:04:06 +04:00
|
|
|
m4_ifval([autogen_platform_file], [
|
2012-02-21 00:41:05 +04:00
|
|
|
if test "$with_platform" = "" ; then
|
2010-09-18 03:04:06 +04:00
|
|
|
with_platform=autogen_platform_file
|
|
|
|
fi])
|
2008-10-28 20:22:29 +03:00
|
|
|
if test "$with_platform" = "yes" ; then
|
|
|
|
AC_MSG_ERROR([--with-platform argument must include FILE option])
|
|
|
|
elif test "$with_platform" = "no" ; then
|
|
|
|
AC_MSG_ERROR([--without-platform is not a valid argument])
|
|
|
|
elif test "$with_platform" != "" ; then
|
2011-07-21 03:28:17 +04:00
|
|
|
# if not an absolute path, check in contrib/platform
|
2015-02-03 09:19:22 +03:00
|
|
|
if test ! "`echo $with_platform | cut -c1`" = "/" && test ! "`echo $with_platform | cut -c2`" = ".." ; then
|
2008-10-28 20:22:29 +03:00
|
|
|
if test -r "${srcdir}/contrib/platform/$with_platform" ; then
|
|
|
|
with_platform="${srcdir}/contrib/platform/$with_platform"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# make sure file exists
|
|
|
|
if test ! -r "$with_platform" ; then
|
|
|
|
AC_MSG_ERROR([platform file $with_platform not found])
|
|
|
|
fi
|
|
|
|
|
|
|
|
# eval into environment
|
2010-11-13 02:22:11 +03:00
|
|
|
OPAL_LOG_MSG([Loading environment file $with_platform, with contents below])
|
|
|
|
OPAL_LOG_FILE([$with_platform])
|
2012-07-26 20:19:23 +04:00
|
|
|
|
|
|
|
# setup by getting full pathname for the platform directories
|
|
|
|
platform_base="`dirname $with_platform`"
|
|
|
|
platform_file="`basename $with_platform`"
|
|
|
|
# get full pathname of where we are so we can return
|
|
|
|
platform_savedir="`pwd`"
|
|
|
|
# go to where the platform file is located
|
|
|
|
cd "$platform_base"
|
|
|
|
# get the full path to this location
|
|
|
|
platform_file_dir=`pwd`
|
|
|
|
|
2012-08-18 01:37:41 +04:00
|
|
|
. ./"$platform_file"
|
2008-10-28 20:22:29 +03:00
|
|
|
|
|
|
|
# see if they left us a name
|
2014-05-07 01:16:29 +04:00
|
|
|
if test "$OPAL_PLATFORM_LOADED" != "" ; then
|
|
|
|
platform_loaded="$OPAL_PLATFORM_LOADED"
|
2008-10-28 20:22:29 +03:00
|
|
|
else
|
|
|
|
platform_loaded="$with_platform"
|
|
|
|
fi
|
|
|
|
echo "Loaded platform arguments for $platform_loaded"
|
2010-11-13 02:22:11 +03:00
|
|
|
OPAL_LOG_MSG([Loaded platform arguments for $platform_loaded])
|
2008-10-28 20:22:29 +03:00
|
|
|
|
|
|
|
# look for default mca param file
|
|
|
|
|
|
|
|
# return to where we started
|
|
|
|
cd "$platform_savedir"
|
|
|
|
|
|
|
|
# define an alternate default mca param filename
|
|
|
|
platform_alt_mca_file="`basename $platform_loaded`.conf"
|
|
|
|
|
|
|
|
# look where platform file is located for platform.conf name
|
|
|
|
if test -r "${platform_file_dir}/${platform_alt_mca_file}" ; then
|
|
|
|
AC_SUBST(OPAL_DEFAULT_MCA_PARAM_CONF, [$platform_file_dir/$platform_alt_mca_file])
|
|
|
|
AC_SUBST(OPAL_PARAM_FROM_PLATFORM, "yes")
|
|
|
|
# if not, see if a file is there with the default name
|
|
|
|
elif test -r "${platform_file_dir}/openmpi-mca-params.conf" ; then
|
|
|
|
AC_SUBST(OPAL_DEFAULT_MCA_PARAM_CONF, [$platform_file_dir/openmpi-mca-params.conf])
|
|
|
|
AC_SUBST(OPAL_PARAM_FROM_PLATFORM, "yes")
|
|
|
|
# if not, then just use the default
|
|
|
|
else
|
|
|
|
AC_SUBST(OPAL_DEFAULT_MCA_PARAM_CONF, [openmpi-mca-params.conf])
|
|
|
|
AC_SUBST(OPAL_PARAM_FROM_PLATFORM, "no")
|
|
|
|
fi
|
|
|
|
|
2015-10-20 17:14:15 +03:00
|
|
|
patch_dir="${with_platform}.patches"
|
|
|
|
if test -n "$with_platform_patches_dir"; then
|
|
|
|
if test "$with_platform_patches_dir" = "yes"; then
|
|
|
|
patch_dir="${with_platform}.patches"
|
|
|
|
elif test "$with_platform_patches_dir" = "no"; then
|
|
|
|
AC_MSG_NOTICE([Disabling platform patches on user request])
|
|
|
|
patch_dir=""
|
|
|
|
elif test -d "$with_platform_patches_dir"; then
|
|
|
|
patch_dir=$with_platform_patches_dir
|
|
|
|
else
|
|
|
|
AC_MSG_ERROR([User provided patches directory: $with_platform_patches_dir not found])
|
|
|
|
fi
|
2015-10-07 16:18:48 +03:00
|
|
|
fi
|
|
|
|
|
2015-09-21 09:16:11 +03:00
|
|
|
patch_done="${srcdir}/.platform_patches"
|
|
|
|
patch_found=no
|
|
|
|
|
|
|
|
if test -d "${patch_dir}"; then
|
|
|
|
if test ! -f "${patch_done}"; then
|
|
|
|
|
2015-10-04 08:12:05 +03:00
|
|
|
AC_MSG_NOTICE([Checking patches from ${patch_dir}/ directory ])
|
2015-09-21 09:16:11 +03:00
|
|
|
for one_patch in $patch_dir/*.patch ; do
|
|
|
|
|
|
|
|
AC_MSG_CHECKING([patch: $one_patch for errors ])
|
|
|
|
patch -d ${srcdir} -p1 -t -s --dry-run < ${one_patch}
|
|
|
|
if test "$?" != "0"; then
|
|
|
|
AC_MSG_RESULT([fail])
|
|
|
|
AC_MSG_ERROR([Platform patches failed to apply])
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT([ok])
|
|
|
|
fi
|
|
|
|
|
|
|
|
AC_MSG_CHECKING([patch: $one_patch for unsupported configury changes ])
|
|
|
|
has_configury_items=$(patch -d ${srcdir} -p1 -t --dry-run < ${one_patch} 2>&1 | egrep "^patching" | egrep '*\.(am|m4)$' | wc -l)
|
|
|
|
|
|
|
|
if test $has_configury_items -ne 0; then
|
|
|
|
AC_MSG_RESULT([fail])
|
|
|
|
AC_MSG_ERROR([Platform patches should not change configury files])
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT([ok])
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
|
|
for one_patch in $patch_dir/*.patch ; do
|
2015-10-04 08:12:05 +03:00
|
|
|
AC_MSG_NOTICE([Applying patch ${one_patch}])
|
2015-09-21 09:16:11 +03:00
|
|
|
patch -d ${srcdir} -p1 -t -s < ${one_patch}
|
|
|
|
if test "$?" != "0"; then
|
|
|
|
AC_MSG_ERROR([Failed to apply patch ${one_patch}])
|
|
|
|
fi
|
|
|
|
patch_found=yes
|
|
|
|
done
|
|
|
|
|
|
|
|
if test "$patch_found" = "yes"; then
|
|
|
|
|
|
|
|
platform_root_short="$(basename $platform_base)"
|
|
|
|
|
|
|
|
# If platform file resides under platform/ root folder - use filename as ident
|
|
|
|
if [ test "$platform_root_short" = "platform" ]; then
|
|
|
|
platform_ident="$platform_file"
|
|
|
|
else
|
|
|
|
platform_ident="$(basename $platform_base)"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Set custom ident for platform patched OMPI
|
|
|
|
if [ test -z "$with_ident_string" ]; then
|
|
|
|
with_ident_string="Platform: $platform_ident"
|
|
|
|
fi
|
|
|
|
|
|
|
|
AC_MSG_NOTICE([Platform patches applied, created stamp file ${patch_done}])
|
|
|
|
touch ${patch_done}
|
2015-10-20 17:14:15 +03:00
|
|
|
else
|
|
|
|
AC_MSG_NOTICE([No platform patches in ${patch_dir}])
|
2015-09-21 09:16:11 +03:00
|
|
|
fi
|
|
|
|
|
|
|
|
else
|
|
|
|
AC_MSG_WARN([Platform patches already applied, skipping. ${patch_done} can be removed to re-apply ])
|
|
|
|
fi
|
2015-10-20 17:14:15 +03:00
|
|
|
elif test -n "${patch_dir}"; then
|
|
|
|
AC_MSG_NOTICE([No platform patches in ${patch_dir}])
|
2015-09-21 09:16:11 +03:00
|
|
|
fi
|
2008-10-28 20:22:29 +03:00
|
|
|
else
|
|
|
|
AC_SUBST(OPAL_DEFAULT_MCA_PARAM_CONF, [openmpi-mca-params.conf])
|
|
|
|
fi
|
|
|
|
])
|