1 dnl -*- shell-script -*-
3 dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
4 dnl University Research and Technology
5 dnl Corporation. All rights reserved.
6 dnl Copyright (c) 2004-2005 The University of Tennessee and The University
7 dnl of Tennessee Research Foundation. All rights
9 dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
10 dnl University of Stuttgart. All rights reserved.
11 dnl Copyright (c) 2004-2005 The Regents of the University of California.
12 dnl All rights reserved.
15 dnl Additional copyrights may follow
20 # OMPI_CHECK_FUNC_LIB(func, lib)
21 # ------------------------------
22 # Try to find function func, first with the present LIBS, second with
23 # lib added to LIBS. If func is found with the libraries listed in
24 # LIBS, no modification to LIBS is made. If func is in lib (but not
25 # in LIBS) then lib is added to LIBS. If func is not in lib, then
26 # LIBS is not modified.
27 AC_DEFUN([OMPI_CHECK_FUNC_LIB],[
28 AS_VAR_PUSHDEF([ompi_var], [ompi_cv_func_lib_$1_$2])dnl
29 AC_CACHE_CHECK([if we need -l$2 for $1],
31 [AC_LINK_IFELSE([AC_LANG_FUNC_LINK_TRY([$1])],
32 [AS_VAR_SET(ompi_var, "no")],
35 AC_LINK_IFELSE([AC_LANG_FUNC_LINK_TRY([$1])],
36 [AS_VAR_SET(ompi_var, "yes")],
37 [AS_VAR_SET(ompi_var, "not found")])
39 AS_IF([test "AS_VAR_GET(ompi_var)" = "yes"],
42 # see if we actually have $1. Use AC_CHECK_FUNCS so that it
43 # does the glibc "not implemented" check. Will use the current LIBS,
44 # so will check in -l$2 if we decided we needed it above
46 AS_VAR_POPDEF([ompi_var])dnl