2015-02-02 14:24:40 +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.
|
opal_check_libnl: remove abort on libnl check failure
Per https://github.com/open-mpi/ompi/issues/3995, it should not be a
fatal error if the libnl checks fail. Instead, just fail the check
and let the upper layer decide what to do. In this case,
OPAL_CHECK_PACKAGE will mark this library as no good, and then
propagate that upward.
E.g., if libfoo fails the libnl check, and the user had specified
--with-libfoo, this will eventually cause configure to fail (because
the libnl check will fail with libfoo, which will cause
OPAL_CHECK_PACKAGE to fail with libfoo, which will ultimately cause
some upper-level logic to realize "a human asked for libfoo but we
could not provide it -- abort!").
However, if libfoo fails the libnl check and the user did *not*
specify --with-libfoo, then this will cause the upper layer to
silently skip libfoo (because the libnl check will fail libfoo, which
will cause OPAL_CHECK_PACKAGE to fail libfoo, but then the upper-level
logic will realize "oh, we can't use libfoo, but a human didn't ask
for it -- so just skip libfoo support.").
Signed-off-by: Jeff Squyres <jsquyres@cisco.com>
2017-08-03 17:30:34 +03:00
|
|
|
dnl Copyright (c) 2012-2017 Cisco Systems, Inc. All rights reserved.
|
2015-02-02 14:24:40 +03:00
|
|
|
dnl Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
|
|
|
|
dnl Copyright (c) 2014 Intel, Inc. All rights reserved.
|
2016-09-13 04:31:19 +03:00
|
|
|
dnl Copyright (c) 2015-2016 Research Organization for Information Science
|
2015-10-13 08:15:06 +03:00
|
|
|
dnl and Technology (RIST). All rights reserved.
|
2015-02-02 14:24:40 +03:00
|
|
|
dnl $COPYRIGHT$
|
|
|
|
dnl
|
|
|
|
dnl Additional copyrights may follow
|
|
|
|
dnl
|
|
|
|
dnl $HEADER$
|
|
|
|
dnl
|
2008-10-28 20:22:29 +03:00
|
|
|
|
2015-02-02 14:24:40 +03:00
|
|
|
dnl _OPAL_CHECK_PACKAGE_HEADER(prefix, header, dir-prefix,
|
|
|
|
dnl [action-if-found], [action-if-not-found],
|
|
|
|
dnl includes)
|
|
|
|
dnl --------------------------------------------------------------------
|
2014-05-01 18:24:56 +04:00
|
|
|
AC_DEFUN([_OPAL_CHECK_PACKAGE_HEADER], [
|
2008-10-28 20:22:29 +03:00
|
|
|
# This is stolen from autoconf to peek under the covers to get the
|
|
|
|
# cache variable for the library check. one should not copy this
|
|
|
|
# code into other places unless you want much pain and suffering
|
2014-05-06 23:37:10 +04:00
|
|
|
AS_VAR_PUSHDEF([opal_Header], [ac_cv_header_$2])
|
2016-09-13 04:31:19 +03:00
|
|
|
OPAL_VAR_SCOPE_PUSH([dir_prefix])
|
2008-10-28 20:22:29 +03:00
|
|
|
|
|
|
|
# so this sucks, but there's no way to get through the progression
|
|
|
|
# of header includes without killing off the cache variable and trying
|
2015-02-02 14:25:32 +03:00
|
|
|
# again...
|
2014-05-06 23:37:10 +04:00
|
|
|
unset opal_Header
|
2008-10-28 20:22:29 +03:00
|
|
|
|
2016-09-13 04:31:19 +03:00
|
|
|
# get rid of the trailing slash(es)
|
|
|
|
dir_prefix=$(echo $3 | sed -e 'sX/*$XXg')
|
2014-05-06 23:37:10 +04:00
|
|
|
opal_check_package_header_happy="no"
|
2016-09-13 04:31:19 +03:00
|
|
|
AS_IF([test "$dir_prefix" = "/usr" || \
|
2018-01-18 03:00:43 +03:00
|
|
|
test "$dir_prefix" = "/usr/local"],
|
2008-10-28 20:22:29 +03:00
|
|
|
[ # try as is...
|
|
|
|
AC_VERBOSE([looking for header without includes])
|
2014-05-06 23:37:10 +04:00
|
|
|
AC_CHECK_HEADERS([$2], [opal_check_package_header_happy="yes"], [])
|
|
|
|
AS_IF([test "$opal_check_package_header_happy" = "no"],
|
2008-10-28 20:22:29 +03:00
|
|
|
[# no go on the as is - reset the cache and try again
|
2014-05-06 23:37:10 +04:00
|
|
|
unset opal_Header])])
|
2008-10-28 20:22:29 +03:00
|
|
|
|
2014-05-06 23:37:10 +04:00
|
|
|
AS_IF([test "$opal_check_package_header_happy" = "no"],
|
2016-09-13 04:31:19 +03:00
|
|
|
[AS_IF([test "$dir_prefix" != ""],
|
|
|
|
[$1_CPPFLAGS="$$1_CPPFLAGS -I$dir_prefix/include"
|
|
|
|
CPPFLAGS="$CPPFLAGS -I$dir_prefix/include"])
|
2014-05-06 23:37:10 +04:00
|
|
|
AC_CHECK_HEADERS([$2], [opal_check_package_header_happy="yes"], [], [$6])
|
|
|
|
AS_IF([test "$opal_check_package_header_happy" = "yes"], [$4], [$5])],
|
2008-10-28 20:22:29 +03:00
|
|
|
[$4])
|
2014-05-06 23:37:10 +04:00
|
|
|
unset opal_check_package_header_happy
|
2015-02-02 14:25:32 +03:00
|
|
|
|
2016-09-13 04:31:19 +03:00
|
|
|
OPAL_VAR_SCOPE_POP([dir_prefix])
|
2014-05-06 23:37:10 +04:00
|
|
|
AS_VAR_POPDEF([opal_Header])dnl
|
2008-10-28 20:22:29 +03:00
|
|
|
])
|
|
|
|
|
|
|
|
|
2015-02-02 14:24:40 +03:00
|
|
|
dnl _OPAL_CHECK_PACKAGE_LIB(prefix, library, function, extra-libraries,
|
|
|
|
dnl dir-prefix, libdir,
|
|
|
|
dnl [action-if-found], [action-if-not-found]])
|
|
|
|
dnl --------------------------------------------------------------------
|
2014-05-01 18:24:56 +04:00
|
|
|
AC_DEFUN([_OPAL_CHECK_PACKAGE_LIB], [
|
2008-10-28 20:22:29 +03:00
|
|
|
# This is stolen from autoconf to peek under the covers to get the
|
|
|
|
# cache variable for the library check. one should not copy this
|
|
|
|
# code into other places unless you want much pain and suffering
|
2015-04-23 13:22:38 +03:00
|
|
|
AS_VAR_PUSHDEF([opal_Lib], [ac_cv_search_$3])
|
2008-10-28 20:22:29 +03:00
|
|
|
|
|
|
|
# see comment above
|
2014-05-06 23:37:10 +04:00
|
|
|
unset opal_Lib
|
|
|
|
opal_check_package_lib_happy="no"
|
2008-10-28 20:22:29 +03:00
|
|
|
AS_IF([test "$6" != ""],
|
|
|
|
[ # libdir was specified - search only there
|
|
|
|
$1_LDFLAGS="$$1_LDFLAGS -L$6"
|
|
|
|
LDFLAGS="$LDFLAGS -L$6"
|
2015-03-09 18:15:38 +03:00
|
|
|
AC_SEARCH_LIBS([$3], [$2],
|
2015-02-02 14:25:32 +03:00
|
|
|
[opal_check_package_lib_happy="yes"],
|
2014-05-06 23:37:10 +04:00
|
|
|
[opal_check_package_lib_happy="no"], [$4])
|
|
|
|
AS_IF([test "$opal_check_package_lib_happy" = "no"],
|
|
|
|
[LDFLAGS="$opal_check_package_$1_save_LDFLAGS"
|
|
|
|
$1_LDFLAGS="$opal_check_package_$1_orig_LDFLAGS"
|
|
|
|
unset opal_Lib])],
|
2008-10-28 20:22:29 +03:00
|
|
|
[ # libdir was not specified - go through search path
|
2014-05-06 23:37:10 +04:00
|
|
|
opal_check_package_libdir="$5"
|
2015-02-02 14:26:19 +03:00
|
|
|
AS_IF([test "$opal_check_package_libdir" = "" || \
|
|
|
|
test "$opal_check_package_libdir" = "/usr" || \
|
|
|
|
test "$opal_check_package_libdir" = "/usr/local"],
|
2008-10-28 20:22:29 +03:00
|
|
|
[ # try as is...
|
|
|
|
AC_VERBOSE([looking for library without search path])
|
2015-03-09 18:15:38 +03:00
|
|
|
AC_SEARCH_LIBS([$3], [$2],
|
2015-02-02 14:25:32 +03:00
|
|
|
[opal_check_package_lib_happy="yes"],
|
2014-05-06 23:37:10 +04:00
|
|
|
[opal_check_package_lib_happy="no"], [$4])
|
|
|
|
AS_IF([test "$opal_check_package_lib_happy" = "no"],
|
2008-10-28 20:22:29 +03:00
|
|
|
[ # no go on the as is.. see what happens later...
|
2014-05-06 23:37:10 +04:00
|
|
|
LDFLAGS="$opal_check_package_$1_save_LDFLAGS"
|
|
|
|
$1_LDFLAGS="$opal_check_package_$1_orig_LDFLAGS"
|
|
|
|
unset opal_Lib])])
|
|
|
|
|
|
|
|
AS_IF([test "$opal_check_package_lib_happy" = "no"],
|
|
|
|
[AS_IF([test "$opal_check_package_libdir" != ""],
|
|
|
|
[$1_LDFLAGS="$$1_LDFLAGS -L$opal_check_package_libdir/lib"
|
|
|
|
LDFLAGS="$LDFLAGS -L$opal_check_package_libdir/lib"
|
2008-10-28 20:22:29 +03:00
|
|
|
AC_VERBOSE([looking for library in lib])
|
2015-03-09 18:15:38 +03:00
|
|
|
AC_SEARCH_LIBS([$3], [$2],
|
2015-02-02 14:25:32 +03:00
|
|
|
[opal_check_package_lib_happy="yes"],
|
2014-05-06 23:37:10 +04:00
|
|
|
[opal_check_package_lib_happy="no"], [$4])
|
|
|
|
AS_IF([test "$opal_check_package_lib_happy" = "no"],
|
2008-10-28 20:22:29 +03:00
|
|
|
[ # no go on the as is.. see what happens later...
|
2014-05-06 23:37:10 +04:00
|
|
|
LDFLAGS="$opal_check_package_$1_save_LDFLAGS"
|
|
|
|
$1_LDFLAGS="$opal_check_package_$1_orig_LDFLAGS"
|
|
|
|
unset opal_Lib])])])
|
|
|
|
|
|
|
|
AS_IF([test "$opal_check_package_lib_happy" = "no"],
|
|
|
|
[AS_IF([test "$opal_check_package_libdir" != ""],
|
|
|
|
[$1_LDFLAGS="$$1_LDFLAGS -L$opal_check_package_libdir/lib64"
|
|
|
|
LDFLAGS="$LDFLAGS -L$opal_check_package_libdir/lib64"
|
2008-10-28 20:22:29 +03:00
|
|
|
AC_VERBOSE([looking for library in lib64])
|
2015-03-09 18:15:38 +03:00
|
|
|
AC_SEARCH_LIBS([$3], [$2],
|
2015-02-02 14:25:32 +03:00
|
|
|
[opal_check_package_lib_happy="yes"],
|
2014-05-06 23:37:10 +04:00
|
|
|
[opal_check_package_lib_happy="no"], [$4])
|
|
|
|
AS_IF([test "$opal_check_package_lib_happy" = "no"],
|
2008-10-28 20:22:29 +03:00
|
|
|
[ # no go on the as is.. see what happens later...
|
2014-05-06 23:37:10 +04:00
|
|
|
LDFLAGS="$opal_check_package_$1_save_LDFLAGS"
|
|
|
|
$1_LDFLAGS="$opal_check_package_$1_orig_LDFLAGS"
|
|
|
|
unset opal_Lib])])])])
|
2008-10-28 20:22:29 +03:00
|
|
|
|
opal_check_libnl: remove abort on libnl check failure
Per https://github.com/open-mpi/ompi/issues/3995, it should not be a
fatal error if the libnl checks fail. Instead, just fail the check
and let the upper layer decide what to do. In this case,
OPAL_CHECK_PACKAGE will mark this library as no good, and then
propagate that upward.
E.g., if libfoo fails the libnl check, and the user had specified
--with-libfoo, this will eventually cause configure to fail (because
the libnl check will fail with libfoo, which will cause
OPAL_CHECK_PACKAGE to fail with libfoo, which will ultimately cause
some upper-level logic to realize "a human asked for libfoo but we
could not provide it -- abort!").
However, if libfoo fails the libnl check and the user did *not*
specify --with-libfoo, then this will cause the upper layer to
silently skip libfoo (because the libnl check will fail libfoo, which
will cause OPAL_CHECK_PACKAGE to fail libfoo, but then the upper-level
logic will realize "oh, we can't use libfoo, but a human didn't ask
for it -- so just skip libfoo support.").
Signed-off-by: Jeff Squyres <jsquyres@cisco.com>
2017-08-03 17:30:34 +03:00
|
|
|
AS_IF([test "$opal_check_package_lib_happy" = "yes"],
|
|
|
|
[ # libnl v1 and libnl3 are known to *not* coexist
|
|
|
|
# harmoniously in the same process. Check to see if this
|
|
|
|
# new package will introduce such a conflict.
|
|
|
|
OPAL_LIBNL_SANITY_CHECK([$2], [$3], [$$1_LIBS],
|
|
|
|
[opal_check_package_libnl_check_ok])
|
|
|
|
AS_IF([test $opal_check_package_libnl_check_ok -eq 0],
|
|
|
|
[opal_check_package_lib_happy=no])
|
|
|
|
])
|
|
|
|
|
2014-05-06 23:37:10 +04:00
|
|
|
AS_IF([test "$opal_check_package_lib_happy" = "yes"],
|
2015-03-09 18:15:38 +03:00
|
|
|
[ # The result of AC SEARCH_LIBS is cached in $ac_cv_search_[function]
|
|
|
|
AS_IF([test "$ac_cv_search_$3" != "no" &&
|
|
|
|
test "$ac_cv_search_$3" != "none required"],
|
|
|
|
[$1_LIBS="$ac_cv_search_$3 $4"],
|
|
|
|
[$1_LIBS="$4"])
|
|
|
|
$7],
|
|
|
|
[$8])
|
2008-10-28 20:22:29 +03:00
|
|
|
|
2014-05-06 23:37:10 +04:00
|
|
|
AS_VAR_POPDEF([opal_Lib])dnl
|
2008-10-28 20:22:29 +03:00
|
|
|
])
|
2015-02-02 14:25:32 +03:00
|
|
|
|
2008-10-28 20:22:29 +03:00
|
|
|
|
2015-10-13 08:15:06 +03:00
|
|
|
dnl OPAL_CHECK_PACKAGE(prefix,
|
2015-02-02 14:24:40 +03:00
|
|
|
dnl header,
|
|
|
|
dnl library,
|
|
|
|
dnl function,
|
|
|
|
dnl extra-libraries,
|
|
|
|
dnl dir-prefix,
|
|
|
|
dnl libdir-prefix,
|
|
|
|
dnl [action-if-found], [action-if-not-found],
|
|
|
|
dnl includes)
|
|
|
|
dnl -----------------------------------------------------------
|
|
|
|
dnl Check for package defined by header and libs, and probably
|
|
|
|
dnl located in dir-prefix, possibly with libs in libdir-prefix.
|
|
|
|
dnl Both dir-prefix and libdir-prefix can be empty. Will set
|
|
|
|
dnl prefix_{CPPFLAGS, LDFLAGS, LIBS} as needed.
|
|
|
|
dnl
|
|
|
|
dnl The general intent of this macro is to provide finer-grained scoping
|
|
|
|
dnl of C preprocessor flags, linker flags, and libraries (as opposed to
|
|
|
|
dnl unconditionally adding to the top-level CPFLAGS, LDFLAGS, and LIBS,
|
|
|
|
dnl which get used to compile/link *everything*).
|
|
|
|
dnl
|
|
|
|
dnl Here is a breakdown of the parameters:
|
|
|
|
dnl
|
|
|
|
dnl * prefix: the macro sets $prefix_CPPFLAGS, $prefix_LDFLAGS, and
|
|
|
|
dnl $prefix_LIBS (and AC_SUBSTs all of them). For example, if a
|
|
|
|
dnl provider uses this macro to check for a header/library that it
|
|
|
|
dnl needs, it might well set prefix to be its provider name.
|
|
|
|
dnl * header_filename: the foo.h file to check for
|
|
|
|
dnl * library_name / function_name: check for function function_name in
|
|
|
|
dnl -llibrary_name. Specifically, for library_name, use the "foo" form,
|
|
|
|
dnl as opposed to "libfoo".
|
|
|
|
dnl * extra_libraries: if the library_name you are checking for requires
|
2018-04-09 18:44:48 +03:00
|
|
|
dnl additional -l arguments to link successfully, list them here.
|
2015-02-02 14:24:40 +03:00
|
|
|
dnl * dir_prefix: if the header/library is located in a non-standard
|
|
|
|
dnl location (e.g., /opt/foo as opposed to /usr), list it here
|
|
|
|
dnl * libdir_prefix: if the library is not under $dir_prefix/lib or
|
|
|
|
dnl $dir_prefix/lib64, list it here.
|
|
|
|
dnl * action_if_found: if both the header and library are found and
|
|
|
|
dnl usable, execute action_if_found
|
|
|
|
dnl * action_if_not_found: otherwise, execute action_if_not_found
|
|
|
|
dnl * extra_includes: if including header_filename requires additional
|
|
|
|
dnl headers to be included first, list them here
|
|
|
|
dnl
|
|
|
|
dnl The output _CPPFLAGS, _LDFLAGS, and _LIBS can be used to limit the
|
|
|
|
dnl scope various flags in Makefiles.
|
|
|
|
dnl
|
2014-05-01 18:24:56 +04:00
|
|
|
AC_DEFUN([OPAL_CHECK_PACKAGE],[
|
2014-05-06 23:37:10 +04:00
|
|
|
opal_check_package_$1_save_CPPFLAGS="$CPPFLAGS"
|
|
|
|
opal_check_package_$1_save_LDFLAGS="$LDFLAGS"
|
|
|
|
opal_check_package_$1_save_LIBS="$LIBS"
|
2008-10-28 20:22:29 +03:00
|
|
|
|
2014-05-06 23:37:10 +04:00
|
|
|
opal_check_package_$1_orig_CPPFLAGS="$$1_CPPFLAGS"
|
|
|
|
opal_check_package_$1_orig_LDFLAGS="$$1_LDFLAGS"
|
|
|
|
opal_check_package_$1_orig_LIBS="$$1_LIBS"
|
2008-10-28 20:22:29 +03:00
|
|
|
|
2015-02-02 14:25:32 +03:00
|
|
|
_OPAL_CHECK_PACKAGE_HEADER([$1], [$2], [$6],
|
2014-05-01 18:24:56 +04:00
|
|
|
[_OPAL_CHECK_PACKAGE_LIB([$1], [$3], [$4], [$5], [$6], [$7],
|
2014-05-06 23:37:10 +04:00
|
|
|
[opal_check_package_happy="yes"],
|
|
|
|
[opal_check_package_happy="no"])],
|
|
|
|
[opal_check_package_happy="no"],
|
2012-06-13 14:38:28 +04:00
|
|
|
[$10])
|
2008-10-28 20:22:29 +03:00
|
|
|
|
2014-05-06 23:37:10 +04:00
|
|
|
AS_IF([test "$opal_check_package_happy" = "yes"],
|
2008-10-28 20:22:29 +03:00
|
|
|
[$8],
|
2014-05-06 23:37:10 +04:00
|
|
|
[$1_CPPFLAGS="$opal_check_package_$1_orig_CPPFLAGS"
|
|
|
|
$1_LDFLAGS="$opal_check_package_$1_orig_LDFLAGS"
|
|
|
|
$1_LIBS="$opal_check_package_$1_orig_LIBS"
|
2008-10-28 20:22:29 +03:00
|
|
|
$9])
|
|
|
|
|
2014-05-06 23:37:10 +04:00
|
|
|
CPPFLAGS="$opal_check_package_$1_save_CPPFLAGS"
|
|
|
|
LDFLAGS="$opal_check_package_$1_save_LDFLAGS"
|
|
|
|
LIBS="$opal_check_package_$1_save_LIBS"
|
2015-02-02 14:25:32 +03:00
|
|
|
])
|