File: prte_check_lsf.m4

package info (click to toggle)
openmpi 5.0.7-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 202,312 kB
  • sloc: ansic: 612,441; makefile: 42,495; sh: 11,230; javascript: 9,244; f90: 7,052; java: 6,404; perl: 5,154; python: 1,856; lex: 740; fortran: 61; cpp: 20; tcl: 12
file content (176 lines) | stat: -rw-r--r-- 10,322 bytes parent folder | download | duplicates (2)
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
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) 2007-2020 Cisco Systems, Inc.  All rights reserved
dnl Copyright (c) 2015      Research Organization for Information Science
dnl                         and Technology (RIST). All rights reserved.
dnl Copyright (c) 2016      Los Alamos National Security, LLC. All rights
dnl                         reserved.
dnl Copyright (c) 2017-2021 IBM Corporation.  All rights reserved.
dnl Copyright (c) 2017-2020 Intel, Inc.  All rights reserved.
dnl Copyright (c) 2021-2022 Nanook Consulting.  All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl

# check for lsf
# PRTE_CHECK_LSF(prefix, [action-if-found], [action-if-not-found])
# --------------------------------------------------------
AC_DEFUN([PRTE_CHECK_LSF],[
       AC_ARG_WITH([lsf],
               [AS_HELP_STRING([--with-lsf(=DIR)],
                       [Build LSF support])])
       AC_ARG_WITH([lsf-libdir],
               [AS_HELP_STRING([--with-lsf-libdir=DIR],
                       [Search for LSF libraries in DIR])])

       AS_IF([test "$with_lsf" != "no"],[
          # If no directories were specified, look for LSF_LIBDIR,
          # LSF_INCLUDEDIR, and/or LSF_ENVDIR.
          AS_IF([test "${with_lsf}" = "yes" -o -z "${with_lsf}"],
                [AS_IF([test ! -z "$LSF_ENVDIR" && test -z "$LSF_INCLUDEDIR" && test -f "$LSF_ENVDIR/lsf.conf"],
                       [LSF_INCLUDEDIR=`egrep ^LSF_INCLUDEDIR= $LSF_ENVDIR/lsf.conf | cut -d= -f2-`])
                 AS_IF([test ! -z "$LSF_INCLUDEDIR"],
                       [with_lsf_incdir=`dirname $LSF_INCLUDEDIR`
                        AC_MSG_NOTICE([Setting LSF includedir to ${with_lsf_incdir}])])

                 AS_IF([test -z "${with_lsf_libdir}"],
                       [AS_IF([test ! -z "$LSF_ENVDIR" && test -z "$LSF_LIBDIR" && test -f "$LSF_ENVDIR/lsf.conf"],
                              [LSF_LIBDIR=`egrep ^LSF_LIBDIR= $LSF_ENVDIR/lsf.conf | cut -d= -f2-`])
                        AS_IF([test ! -z "$LSF_LIBDIR"],
                              [with_lsf_libdir=$LSF_LIBDIR
                               AC_MSG_NOTICE([Setting LSF libdir to ${with_lsf_libdir}])])])])

          prte_check_lsf_$1_save_CPPFLAGS="$CPPFLAGS"
          prte_check_lsf_$1_save_LDFLAGS="$LDFLAGS"
          prte_check_lsf_$1_save_LIBS="$LIBS"

          prte_check_lsf_happy="yes"

          # liblsf requires yp_all, yp_get_default_domain, and ypprot_err
          # on Linux, Solaris, NEC, and Sony NEWSs these are found in libnsl
          # on AIX it should be in libbsd
          # on HP-UX it should be in libBSD
          # on IRIX < 6 it should be in libsun (IRIX 6 and later it is in libc)
          # on RHEL: libnsl, libnsl2 AND libnsl2-devel are required to link libnsl to get yp_all.
          AS_IF([test "$prte_check_lsf_happy" = "yes"],
                [PRTE_SEARCH_LIBS_COMPONENT([yp_all_nsl], [yp_all], [nsl bsd BSD sun],
                              [prte_check_lsf_happy="yes"],
                              [AS_IF([test "${with_lsf}" = "yes"],
                                     [AC_MSG_WARN([[Could not find yp_all. Please see https://github.com/openpmix/prrte/wiki/Building-LSF-support for more details.]])
                                      AC_MSG_ERROR([Cannot build requested LSF support])])
                               prte_check_lsf_happy="no"])])

          # liblsf requires shm_open, shm_unlink, which are in librt
          AS_IF([test "$prte_check_lsf_happy" = "yes"],
                [PRTE_SEARCH_LIBS_COMPONENT([shm_open_rt], [shm_open], [rt],
                              [prte_check_lsf_happy="yes"],
                              [prte_check_lsf_happy="no"])])

          AS_IF([test "$prte_check_lsf_happy" = "yes"],
                [OAC_CHECK_PACKAGE([lsf],
                                   [ls_info_lsf],
                                   [lsf/lsf.h],
                                   [lsf $yp_all_nsl_LIBS $shm_open_rt_LIBS],
                                   [ls_info],
                                   [prte_check_lsf_happy="yes"],
                                   [prte_check_lsf_happy="no"])])

          # test function of liblsb LSF package
          AS_IF([test "$prte_check_lsf_happy" = "yes"],
                [with_lsfbatch=${with_lsf}
                 with_lsfbatch_incdir=${with_lsf_incdir}
                 with_lsfbatch_libdir=${with_lsf_libdir}
                 OAC_CHECK_PACKAGE([lsfbatch],
                                   [prte_check_lsf],
                                   [lsf/lsbatch.h],
                                   [bat $ls_info_lsf_LIBS],
                                   [lsb_launch],
                                   [prte_check_lsf_happy="yes"],
                                   [prte_check_lsf_happy="no"])])

          # Some versions of LSF ship with a libevent.so in their library path.
          # This is _not_ a copy of Libevent, but something specific to their project.
          # The PRRTE components should not need to link against LSF's libevent.so
          # However, the presence of it in the linker search path can cause a problem
          #
          # Add a check here to see if we are in a scenario where the two are conflicting.
          # In which case the earlier checks for successful compile of an LSF program will
          # have failed with messages like:
          #   lib64/libevent_pthreads.so: undefined reference to `evthread_set_condition_callbacks'
          #   lib64/libevent_pthreads.so: undefined reference to `event_mm_malloc_'
          #   lib64/libevent_pthreads.so: undefined reference to `event_mm_free_'
          #   lib64/libevent_pthreads.so: undefined reference to `evthread_set_id_callback'
          #   lib64/libevent_pthreads.so: undefined reference to `evthread_set_lock_callbacks'
          # Because it picked up -levent from LSF, but -levent_pthreads from Libevent.
          #
          # So look for a function that libevent_pthreads is looking for from libevent.so.
          # If it does appears then we have the correct libevent.so, otherwise then we picked
          # up the LSF version and a conflict has been detected.
          # If the external libevent component used 'event_core' instead of 'event'
          prte_check_lsf_event_conflict=na
          # Split libs into an array, see if -levent is in that list
          prte_check_lsf_libevent_present=`echo "$LIBS" | awk '{split([$]0, a, " "); {for (k in a) {if (a[[k]] == "-levent") {print a[[k]]}}}}' | wc -l | tr -d '[[:space:]]'`
          # (1) LSF check must have failed above. We need to know why...
          AS_IF([test "${with_lsf}" = "yes" && test "$prte_check_lsf_happy" = "no"],
                [# (2) If there is a -levent in the $LIBS then that might be the problem
                 AS_IF([test "$prte_check_lsf_libevent_present" != "0"],
                       [AS_IF([test "$prte_check_lsf_libdir" = "" ],
                              [],
                              [LDFLAGS="$LDFLAGS -L$prte_check_lsf_libdir"])
                        # Note that we do not want to set LIBS here to include -llsf since
                        # the check is not for an LSF library, but for the conflict with
                        # LDFLAGS.
                        # (3) Check to see if the -levent is from Libevent (check for a symbol it has)
                        AC_CHECK_LIB([event], [evthread_set_condition_callbacks],
                                     [AC_MSG_CHECKING([for libevent conflict])
                                      AC_MSG_RESULT([No conflict found. The correct libevent.so was linked.])
                                      prte_check_lsf_event_conflict=no],
                                     [# (4) The libevent.so is not from Libevent. Warn the user.
                                      AC_MSG_CHECKING([for libevent conflict])
                                      AC_MSG_RESULT([Conflict found. Detected a libevent.so that is not from Libevent.])
                                      prte_check_lsf_event_conflict=yes])
                       ],
                       [AC_MSG_CHECKING([for libevent conflict])
                        AC_MSG_RESULT([No conflict found. -levent is not being explicitly used.])
                        prte_check_lsf_event_conflict=na])],
                [AC_MSG_CHECKING([for libevent conflict])
                 AC_MSG_RESULT([No conflict found. LSF checks passed.])
                 prte_check_lsf_event_conflict=na])

          AS_IF([test "$prte_check_lsf_event_conflict" = "yes"],
                [AC_MSG_WARN([===================================================================])
                 AC_MSG_WARN([===================================================================])
                ])

          CPPFLAGS="$prte_check_lsf_$1_save_CPPFLAGS"
          LDFLAGS="$prte_check_lsf_$1_save_LDFLAGS"
          LIBS="$prte_check_lsf_$1_save_LIBS"

       ], [prte_check_lsf_happy="no (disabled by user)"])

       PRTE_SUMMARY_ADD([Resource Managers], [LSF], [], [$prte_check_lsf_happy])

    AS_IF([test "$prte_check_lsf_happy" = "yes"],
          [$1_LIBS="[$]$1_LIBS $prte_check_lsf_LIBS"
           $1_LDFLAGS="[$]$1_LDFLAGS $prte_check_lsf_LDFLAGS"
           $1_CPPFLAGS="[$]$1_CPPFLAGS $prte_check_lsf_CPPFLAGS"
           # add the LSF libraries to static builds as they are required
           $2],
          [AS_IF([test ! -z "$with_lsf" && test "$with_lsf" != "no"],
                 [AC_MSG_WARN([LSF support requested (via --with-lsf) but not found.])
                  AC_MSG_ERROR([Aborting.])])
           $3])
])