2015-02-03 09:33:13 +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.
2016-04-20 18:38:57 +03:00
dnl Copyright (c) 2006-2016 Cisco Systems, Inc. All rights reserved.
2017-07-12 04:01:56 +03:00
dnl Copyright (c) 2015-2017 Research Organization for Information Science
2015-02-03 09:33:13 +03:00
dnl and Technology (RIST). All rights reserved.
2016-03-01 21:01:51 +03:00
dnl Copyright (c) 2016 Los Alamos National Security, LLC. All rights
dnl reserved.
2015-02-03 09:33:13 +03:00
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
2008-10-28 20:22:29 +03:00
2009-10-24 05:04:35 +04:00
# ORTE_CHECK_TM_LIBS_FLAGS(prefix, [LIBS or LDFLAGS])
2008-10-28 20:22:29 +03:00
# ---------------------------------------------------
2009-10-24 05:04:35 +04:00
AC_DEFUN([ORTE_CHECK_TM_LIBS_FLAGS],[
2013-12-07 03:40:34 +04:00
OPAL_VAR_SCOPE_PUSH([orte_check_tm_flags])
2009-10-24 05:04:35 +04:00
orte_check_tm_flags=`$orte_check_tm_pbs_config --libs`
for orte_check_tm_val in $orte_check_tm_flags; do
if test "`echo $orte_check_tm_val | cut -c1-2`" = "-l"; then
2008-10-28 20:22:29 +03:00
if test "$2" = "LIBS"; then
2009-10-24 05:04:35 +04:00
$1_$2="$$1_$2 $orte_check_tm_val"
2008-10-28 20:22:29 +03:00
fi
else
if test "$2" = "LDFLAGS"; then
2009-10-24 05:04:35 +04:00
$1_$2="$$1_$2 $orte_check_tm_val"
2008-10-28 20:22:29 +03:00
fi
fi
done
2013-12-07 03:40:34 +04:00
OPAL_VAR_SCOPE_POP
2008-10-28 20:22:29 +03:00
])
2009-10-24 05:04:35 +04:00
# ORTE_CHECK_TM(prefix, [action-if-found], [action-if-not-found])
2008-10-28 20:22:29 +03:00
# --------------------------------------------------------
2009-10-24 05:04:35 +04:00
AC_DEFUN([ORTE_CHECK_TM],[
2016-03-01 21:01:51 +03:00
if test -z $orte_check_tm_happy ; then
OPAL_VAR_SCOPE_PUSH([orte_check_tm_found orte_check_tm_dir orte_check_tm_pbs_config orte_check_tm_LDFLAGS_save orte_check_tm_CPPFLAGS_save orte_check_tm_LIBS_save])
AC_ARG_WITH([tm],
[AC_HELP_STRING([--with-tm(=DIR)],
[Build TM (Torque, PBSPro, and compatible) support, optionally adding DIR/include, DIR/lib, and DIR/lib64 to the search path for headers and libraries])])
OPAL_CHECK_WITHDIR([tm], [$with_tm], [include/tm.h])
orte_check_tm_found=no
AS_IF([test "$with_tm" = "no"],
[orte_check_tm_happy="no"],
[orte_check_tm_happy="yes"
AS_IF([test ! -z "$with_tm" && test "$with_tm" != "yes"],
[orte_check_tm_dir="$with_tm"],
[orte_check_tm_dir=""])])
AS_IF([test "$orte_check_tm_happy" = "yes"],
[AC_MSG_CHECKING([for pbs-config])
orte_check_tm_pbs_config="not found"
AS_IF([test "$orte_check_tm_dir" != "" && test -d "$orte_check_tm_dir" && test -x "$orte_check_tm_dir/bin/pbs-config"],
[orte_check_tm_pbs_config="$orte_check_tm_dir/bin/pbs-config"],
[AS_IF([pbs-config --prefix >/dev/null 2>&1],
[orte_check_tm_pbs_config="pbs-config"])])
AC_MSG_RESULT([$orte_check_tm_pbs_config])])
# If we have pbs-config, get the flags we need from there and then
# do simplistic tests looking for the tm headers and symbols
AS_IF([test "$orte_check_tm_happy" = "yes" && test "$orte_check_tm_pbs_config" != "not found"],
[orte_check_tm_CPPFLAGS=`$orte_check_tm_pbs_config --cflags`
OPAL_LOG_MSG([orte_check_tm_CPPFLAGS from pbs-config: $orte_check_tm_CPPFLAGS], 1)
ORTE_CHECK_TM_LIBS_FLAGS([orte_check_tm], [LDFLAGS])
OPAL_LOG_MSG([orte_check_tm_LDFLAGS from pbs-config: $orte_check_tm_LDFLAGS], 1)
ORTE_CHECK_TM_LIBS_FLAGS([orte_check_tm], [LIBS])
OPAL_LOG_MSG([orte_check_tm_LIBS from pbs-config: $orte_check_tm_LIBS], 1)
# Now that we supposedly have the right flags, try them out.
orte_check_tm_CPPFLAGS_save="$CPPFLAGS"
orte_check_tm_LDFLAGS_save="$LDFLAGS"
orte_check_tm_LIBS_save="$LIBS"
CPPFLAGS="$CPPFLAGS $orte_check_tm_CPPFLAGS"
LIBS="$LIBS $orte_check_tm_LIBS"
LDFLAGS="$LDFLAGS $orte_check_tm_LDFLAGS"
AC_CHECK_HEADER([tm.h],
[AC_CHECK_FUNC([tm_finalize],
[orte_check_tm_found="yes"])])
CPPFLAGS="$orte_check_tm_CPPFLAGS_save"
LDFLAGS="$orte_check_tm_LDFLAGS_save"
LIBS="$orte_check_tm_LIBS_save"])
# If we don't have pbs-config, then we have to look around
# manually.
# Note that Torque 2.1.0 changed the name of their back-end
# library to "libtorque". So we have to check for both libpbs and
# libtorque. First, check for libpbs.
orte_check_package_$1_save_CPPFLAGS="$CPPFLAGS"
orte_check_package_$1_save_LDFLAGS="$LDFLAGS"
orte_check_package_$1_save_LIBS="$LIBS"
AS_IF([test "$orte_check_tm_found" = "no"],
[AS_IF([test "$orte_check_tm_happy" = "yes"],
[_OPAL_CHECK_PACKAGE_HEADER([orte_check_tm],
[tm.h],
[$orte_check_tm_dir],
[orte_check_tm_found="yes"],
[orte_check_tm_found="no"])])
AS_IF([test "$orte_check_tm_found" = "yes"],
[_OPAL_CHECK_PACKAGE_LIB([orte_check_tm],
[pbs],
[tm_init],
[],
[$orte_check_tm_dir],
[$orte_check_tm_libdir],
[orte_check_tm_found="yes"],
2017-07-12 04:01:56 +03:00
[_OPAL_CHECK_PACKAGE_LIB([orte_check_tm],
[pbs],
[tm_init],
[-lcrypto],
[$orte_check_tm_dir],
[$orte_check_tm_libdir],
[orte_check_tm_found="yes"],
[_OPAL_CHECK_PACKAGE_LIB([orte_check_tm],
[torque],
[tm_init],
[],
[$orte_check_tm_dir],
[$orte_check_tm_libdir],
[orte_check_tm_found="yes"],
[orte_check_tm_found="no"])])])])])
2016-03-01 21:01:51 +03:00
CPPFLAGS="$orte_check_package_$1_save_CPPFLAGS"
LDFLAGS="$orte_check_package_$1_save_LDFLAGS"
LIBS="$orte_check_package_$1_save_LIBS"
if test "$orte_check_tm_found" = "no" ; then
orte_check_tm_happy=no
fi
2016-04-20 18:38:57 +03:00
OPAL_SUMMARY_ADD([[Resource Managers]],[[Torque]],[$1],[$orte_check_tm_happy])
2016-03-01 21:01:51 +03:00
OPAL_VAR_SCOPE_POP
fi
2014-12-04 00:29:04 +03:00
2008-10-28 20:22:29 +03:00
# Did we find the right stuff?
2016-03-01 21:01:51 +03:00
AS_IF([test "$orte_check_tm_happy" = "yes"],
[$1_LIBS="[$]$1_LIBS $orte_check_tm_LIBS"
$1_LDFLAGS="[$]$1_LDFLAGS $orte_check_tm_LDFLAGS"
$1_CPPFLAGS="[$]$1_CPPFLAGS $orte_check_tm_CPPFLAGS"
# add the TM libraries to static builds as they are required
$1_WRAPPER_EXTRA_LDFLAGS=[$]$1_LDFLAGS
$1_WRAPPER_EXTRA_LIBS=[$]$1_LIBS
$2],
2015-02-03 09:33:13 +03:00
[AS_IF([test ! -z "$with_tm" && test "$with_tm" != "no"],
2008-10-28 20:22:29 +03:00
[AC_MSG_ERROR([TM support requested but not found. Aborting])])
2016-03-01 21:01:51 +03:00
orte_check_tm_happy="no"
$3])
2008-10-28 20:22:29 +03:00
])