there was an #include directive missing
[openmpi-llc.git] / config / ompi_check_func_lib.m4
blob837c8b12ecdbe995a6290a08786db78a6cdcd627
1 dnl -*- shell-script -*-
2 dnl
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
8 dnl                         reserved.
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.
13 dnl $COPYRIGHT$
14 dnl 
15 dnl Additional copyrights may follow
16 dnl 
17 dnl $HEADER$
18 dnl
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],
30         ompi_var,
31         [AC_LINK_IFELSE([AC_LANG_FUNC_LINK_TRY([$1])],
32             [AS_VAR_SET(ompi_var, "no")],
33             [LIBS_save="$LIBS"
34              LIBS="$LIBS -l$2"
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")])
38              LIBS="$LIBS_save"])])
39     AS_IF([test "AS_VAR_GET(ompi_var)" = "yes"],
40           [LIBS="$LIBS -l$2"])
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
45     AC_CHECK_FUNCS([$1])
46     AS_VAR_POPDEF([ompi_var])dnl