2
dnl osm.m4: an autoconf for OpenSM (vendor and complib) reference
5
dnl To use this macro, just do OPENIB_APP_OSM.
6
dnl The following variables are defined:
7
dnl with-osm - the osm installation prefix
8
dnl OSM_CFLAGS - CFLAGS additions required (-I and debug )
9
dnl OSM_LDFLAGS - a variable holding link directives
10
dnl OSM_VENDOR - The type of vendor library available (ts, sim)
11
dnl OSM_BUILD - The type of build used for buikding OpenSM either gen1 or openib
13
dnl Several conditionals are also defined:
14
dnl OSM_BUILD_OPENIB - set when the build type is openib (gen2)
15
dnl OSM_VENDOR_TS - should use gen1/gen2 API
16
dnl OSM_VENDOR_SIM - interface a simulator vendor
17
dnl If successful, these have stuff in them. If not, they're empty.
18
dnl If not successful, with_osm has the value "no".
20
AC_DEFUN([OPENIB_APP_OSM], [
21
# --- BEGIN OPENIB_APP_OSM ---
22
dnl To link against OpenSM Vendor or Complib, configure does several
23
dnl things to make my life "easier".
25
dnl * if the user did define where opensm is look for it in "standard" places
26
dnl * if can not be found - ask the user for --with-osm
27
dnl * figure out if OpenSM was compiles in debug mode or not
29
dnl As we might have an OpenSM installation of IBGD or OpenIB and
30
dnl different vendors too we need to use some heuristics for
31
dnl figuring out the type of both STACK and VENDOR.
34
dnl If with_osm is not provided look fo it under:
35
dnl /usr/local/ibgd/apps/osm
37
dnl /usr/mellanox/osm-sim
38
dnl /usr/local/lib/libopensm.a
39
dnl /usr/lib/libopensm.a
41
dnl Figure out what kind of BUILD it is gen1 or gen2:
42
dnl if the with_osm/include/infiniband exists we are on gen2 stack
44
dnl Now decide what vendor was built:
46
dnl if $with_osm/lib/osmvendor_gen1.so -> ts
47
dnl if $with_osm/lib/osmvendor_mtl.so -> mtl
48
dnl if $with_osm/lib/osmvendor_sim.so -> sim
49
dnl if $with_osm/lib/osmvendor.so -> openib
51
dnl if $with_osm/lib/osmsvc_ts.so -> ts
52
dnl if $with_osm/lib/osmsvc_mtl.so -> mtl
53
dnl if $with_osm/lib/osmsvc_sim.so -> sim
54
dnl ----------------------------------------------------------------
56
dnl Define a way for the user to provide path to OpenSM
58
[ --with-osm=<dir> define OSM prefix],
59
AC_MSG_NOTICE(Using OSM from:$with_osm),
62
dnl Define a way for the user to provide path to OpenSM libs
64
[ --with-osm-libs=<dir> define where to find OSM libs],
65
AC_MSG_NOTICE(Using OSM libs from:$with_osm_libs),
70
if test "x$libcheck" = "xtrue"; then
71
dnl if the user did not provide --with-osm look for it in reasonable places
72
if test "x$with_osm" = xnone; then
73
if test -d /usr/local/ibgd/apps/osm; then
74
with_osm=/usr/local/ibgd/apps/osm
75
elif test -d /usr/mellanox/osm; then
76
with_osm=/usr/mellanox
77
dnl if it is an ofed or gen2 install, we can use /etc/infiniband/info for searching opensm prefix
78
elif test -f /etc/infiniband/info; then
79
ofed_dir=`/etc/infiniband/info | grep prefix | cut -d = -f 2`
80
if (test -f $ofed_dir/lib/libopensm.so ||
81
test -f $ofed_dir/lib64/libopensm.so); then
84
elif (test -f /usr/local/lib64/libopensm.so ||
85
test -f /usr/local/lib/libopensm.so); then
87
elif (test -f /usr/lib64/libopensm.so ||
88
test -f /usr/lib/libopensm.so); then
91
AC_MSG_ERROR([OSM: --with-osm must be provided - fail to find standard OpenSM installation])
94
AC_MSG_NOTICE(OSM: used from $with_osm)
96
if test "x$with_osm_libs" = "xnone"; then
97
dnl if the user did not provide --with-osm-libs then look for it based on $with_osm
98
if (test -f $with_osm/lib64/libosmvendor_gen1.so ||
99
test -f $with_osm/lib64/libosmvendor_vapi.so ||
100
test -f $with_osm/lib64/libopensm.so ||
101
test -f $with_osm/lib64/libosmvendor_sim.so); then
106
with_osm_libs=$with_osm/$osm_lib_dir
109
dnl check what build we have gen1 or gen2
110
if test -d $with_osm/include/infiniband; then
115
AC_MSG_NOTICE(OSM: build type $OSM_BUILD)
117
OSM_LDFLAGS="-Wl,-rpath -Wl,$with_osm_libs -L$with_osm_libs"
118
dnl based on the with_osm dir and the libs available
119
dnl we can try and decide what vendor was used:
120
if test $OSM_BUILD = openib; then
121
dnl it is an OpenIB based build but can be any vendor too.
122
osm_include_dir="$with_osm/include/infiniband"
123
osm_extra_includes="-I$with_osm/include"
125
if test -L $with_osm_libs/libosmvendor_gen1.so; then
127
osm_vendor_sel="-DOSM_VENDOR_INTF_TS"
128
OSM_LDFLAGS="$OSM_LDFLAGS -lopensm -losmvendor -losmcomp"
129
elif test -L $with_osm_libs/libosmvendor_vapi.so; then
131
osm_vendor_sel="-DOSM_VENDOR_INTF_MTL"
132
OSM_LDFLAGS="$OSM_LDFLAGS -lopensm -losmvendor -losmcomp -lvapi -lib_mgt"
133
elif test -L $with_osm_libs/libosmvendor_sim.so; then
135
osm_vendor_sel="-DOSM_VENDOR_INTF_SIM"
136
OSM_LDFLAGS="$OSM_LDFLAGS -lopensm -losmvendor -libmscli -losmcomp"
137
elif test -L $with_osm_libs/libopensm.so; then
139
osm_vendor_sel="-DOSM_VENDOR_INTF_OPENIB "
140
OSM_LDFLAGS="$OSM_LDFLAGS -lopensm -losmvendor -losmcomp -libumad"
142
AC_MSG_ERROR([OSM: Fail to recognize vendor type])
144
osm_vendor_sel="$osm_vendor_sel -DOSM_BUILD_OPENIB"
146
# we are in gen1 build
147
osm_include_dir="$with_osm/include"
149
if test -L $with_osm_libs/libosmsvc_ts.so; then
151
OSM_LDFLAGS="$OSM_LDFLAGS -losmsvc_ts -lcomplib"
152
osm_vendor_sel="-DOSM_VENDOR_INTF_TS"
153
elif test -L $with_osm_libs/libosmsvc_mtl.so; then
155
OSM_LDFLAGS="$OSM_LDFLAGS -losmsvc_mtl -lcomplib -lvapi -lib_mgt"
156
osm_vendor_sel="-DOSM_VENDOR_INTF_MTL"
157
elif test -L $with_osm_libs/libosmsvc_sim.so; then
159
OSM_LDFLAGS="$OSM_LDFLAGS -losmsvc_sim -lcomplib"
160
osm_vendor_sel="-DOSM_VENDOR_INTF_SIM"
162
AC_MSG_ERROR([OSM: Fail to recognize vendor type])
165
AC_MSG_NOTICE(OSM: vendor type $OSM_VENDOR)
168
dnl validate the defined path - so the build id header is there
169
AC_CHECK_FILE($osm_include_dir/opensm/osm_config.h,,
170
AC_MSG_ERROR([OSM: could not find $with_osm/include/opensm/osm_config.h]))
172
dnl now figure out somehow if the build was for debug or not
173
grep '#define OSM_DEBUG 1' $osm_include_dir/opensm/osm_config.h > /dev/null
174
if test $? -eq 0 ; then
175
dnl why did they need so many ???
176
osm_debug_flags='-DDEBUG -D_DEBUG -D_DEBUG_ -DDBG'
177
AC_MSG_NOTICE(OSM: compiled in DEBUG mode)
182
OSM_CFLAGS="-I$osm_include_dir $osm_extra_includes $osm_debug_flags $osm_vendor_sel -D_XOPEN_SOURCE=600 -D_BSD_SOURCE=1"
192
AM_CONDITIONAL(OSM_VENDOR_TS, test "x$OSM_VENDOR" = xts)
193
AM_CONDITIONAL(OSM_VENDOR_MTL, test "x$OSM_VENDOR" = xmtl)
194
AM_CONDITIONAL(OSM_VENDOR_SIM, test "x$OSM_VENDOR" = xsim)
195
AM_CONDITIONAL(OSM_BUILD_OPENIB, test "x$OSM_BUILD" = xopenib)
199
AC_SUBST(OSM_LDFLAGS)
203
# --- OPENIB_APP_OSM ---
204
]) dnl OPENIB_APP_OSM