File: ompi_check_func_lib.m4

package info (click to toggle)
openmpi 1.6.5-9.1%2Bdeb8u1
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 91,628 kB
  • ctags: 44,305
  • sloc: ansic: 408,966; cpp: 44,454; sh: 27,828; makefile: 10,486; asm: 3,882; python: 1,239; lex: 805; perl: 549; csh: 253; fortran: 232; f90: 126; tcl: 12
file content (48 lines) | stat: -rw-r--r-- 2,092 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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) 2010      Cisco Systems, Inc.  All rights reserved.
dnl $COPYRIGHT$
dnl 
dnl Additional copyrights may follow
dnl 
dnl $HEADER$
dnl

# OMPI_CHECK_FUNC_LIB(func, lib, [action-if-found], [action-if-not-found])
# ------------------------------
# Try to find function func, first with the present LIBS, second with
# lib added to LIBS.  If func is found with the libraries listed in
# LIBS, no modification to LIBS is made.  If func is in lib (but not
# in LIBS) then lib is added to LIBS.  If func is not in lib, then
# LIBS is not modified.
AC_DEFUN([OMPI_CHECK_FUNC_LIB],[
    AS_VAR_PUSHDEF([ompi_var], [ompi_cv_func_lib_$1_$2])dnl
    AC_CACHE_CHECK([if we need -l$2 for $1],
        ompi_var,
        [AC_LINK_IFELSE([AC_LANG_FUNC_LINK_TRY([$1])],
            [AS_VAR_SET(ompi_var, "no")],
            [LIBS_save="$LIBS"
             LIBS="$LIBS -l$2"
             AC_LINK_IFELSE([AC_LANG_FUNC_LINK_TRY([$1])],
                 [AS_VAR_SET(ompi_var, "yes")],
                 [AS_VAR_SET(ompi_var, "not found")])
             LIBS="$LIBS_save"])])
    AS_VAR_IF(ompi_var, [yes],
              [LIBS="$LIBS -l$2"])

    # see if we actually have $1.  Use AC_CHECK_FUNCS so that it
    # does the glibc "not implemented" check.  Will use the current LIBS,
    # so will check in -l$2 if we decided we needed it above
    AC_CHECK_FUNCS([$1], $3, $4)
    AS_VAR_POPDEF([ompi_var])dnl
])