~ubuntu-branches/ubuntu/saucy/ibutils/saucy

« back to all changes in this revision

Viewing changes to .pc/01-fix-with_osm_libs.patch/ibis/config/osm.m4

  • Committer: Package Import Robot
  • Author(s): Roland Dreier
  • Date: 2012-12-03 11:45:32 UTC
  • Revision ID: package-import@ubuntu.com-20121203114532-zz0zk41tw0hzdy7w
Tags: 1.5.7-1
* Acknowledge NMU. (Closes: #690603)
* Convert to minimized rules file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
dnl osm.m4: an autoconf for OpenSM (vendor and complib) reference
 
3
dnl
 
4
dnl
 
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
 
12
dnl
 
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".
 
19
 
 
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".
 
24
dnl
 
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
 
28
dnl
 
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.
 
32
dnl Heuristics is:
 
33
dnl
 
34
dnl If with_osm is not provided look fo it under:
 
35
dnl   /usr/local/ibgd/apps/osm
 
36
dnl   /usr/mellanox/osm
 
37
dnl   /usr/mellanox/osm-sim
 
38
dnl   /usr/local/lib/libopensm.a
 
39
dnl   /usr/lib/libopensm.a
 
40
dnl
 
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
 
43
dnl
 
44
dnl Now decide what vendor was built:
 
45
dnl if gen2 build
 
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
 
50
dnl if gen1 build
 
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 ----------------------------------------------------------------
 
55
 
 
56
dnl Define a way for the user to provide path to OpenSM
 
57
AC_ARG_WITH(osm,
 
58
[  --with-osm=<dir> define OSM prefix],
 
59
AC_MSG_NOTICE(Using OSM from:$with_osm),
 
60
with_osm="none")
 
61
 
 
62
dnl Define a way for the user to provide path to OpenSM libs
 
63
AC_ARG_WITH(osm-libs,
 
64
[  --with-osm-libs=<dir> define where to find OSM libs],
 
65
AC_MSG_NOTICE(Using OSM libs from:$with_osm_libs),
 
66
with_osm_libs="none")
 
67
 
 
68
osm_lib_dir="none"
 
69
 
 
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
 
82
            with_osm=$ofed_dir
 
83
         fi
 
84
      elif (test -f /usr/local/lib64/libopensm.so ||
 
85
                                test -f /usr/local/lib/libopensm.so); then
 
86
         with_osm=/usr/local
 
87
      elif (test -f /usr/lib64/libopensm.so ||
 
88
                                test -f /usr/lib/libopensm.so); then
 
89
         with_osm=/usr
 
90
      else
 
91
         AC_MSG_ERROR([OSM: --with-osm must be provided - fail to find standard OpenSM installation])
 
92
      fi
 
93
   fi
 
94
   AC_MSG_NOTICE(OSM: used from $with_osm)
 
95
 
 
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
 
102
         osm_lib_dir=lib64
 
103
      else
 
104
         osm_lib_dir=lib
 
105
      fi
 
106
   fi
 
107
   with_osm_libs=$with_osm/$osm_lib_dir
 
108
 
 
109
   dnl check what build we have gen1 or gen2
 
110
   if test -d $with_osm/include/infiniband; then
 
111
      OSM_BUILD=openib
 
112
   else
 
113
      OSM_BUILD=gen1
 
114
   fi
 
115
   AC_MSG_NOTICE(OSM: build type $OSM_BUILD)
 
116
 
 
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"
 
124
 
 
125
      if test -L $with_osm_libs/libosmvendor_gen1.so; then
 
126
         OSM_VENDOR=ts
 
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
 
130
         OSM_VENDOR=mtl
 
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
 
134
         OSM_VENDOR=sim
 
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
 
138
         OSM_VENDOR=openib
 
139
         osm_vendor_sel="-DOSM_VENDOR_INTF_OPENIB "
 
140
         OSM_LDFLAGS="$OSM_LDFLAGS -lopensm -losmvendor -losmcomp -libumad"
 
141
      else
 
142
         AC_MSG_ERROR([OSM: Fail to recognize vendor type])
 
143
      fi
 
144
      osm_vendor_sel="$osm_vendor_sel -DOSM_BUILD_OPENIB"
 
145
   else
 
146
      # we are in gen1 build
 
147
      osm_include_dir="$with_osm/include"
 
148
 
 
149
      if test -L $with_osm_libs/libosmsvc_ts.so; then
 
150
         OSM_VENDOR=ts
 
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
 
154
         OSM_VENDOR=mtl
 
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
 
158
         OSM_VENDOR=sim
 
159
         OSM_LDFLAGS="$OSM_LDFLAGS -losmsvc_sim -lcomplib"
 
160
         osm_vendor_sel="-DOSM_VENDOR_INTF_SIM"
 
161
      else
 
162
         AC_MSG_ERROR([OSM: Fail to recognize vendor type])
 
163
      fi
 
164
   fi
 
165
   AC_MSG_NOTICE(OSM: vendor type $OSM_VENDOR)
 
166
 
 
167
 
 
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]))
 
171
 
 
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)
 
178
   else
 
179
      osm_debug_flags=
 
180
   fi
 
181
 
 
182
   OSM_CFLAGS="-I$osm_include_dir $osm_extra_includes $osm_debug_flags $osm_vendor_sel -D_XOPEN_SOURCE=600 -D_BSD_SOURCE=1"
 
183
else
 
184
   dnl dummy values
 
185
   with_osm=disabled
 
186
   OSM_CLFAGS=disabled
 
187
   OSM_LDFLAGS=disabled
 
188
   OSM_VEDNOR=disabled
 
189
   OSM_BUILD=disabled
 
190
fi
 
191
 
 
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)
 
196
 
 
197
AC_SUBST(with_osm)
 
198
AC_SUBST(OSM_CFLAGS)
 
199
AC_SUBST(OSM_LDFLAGS)
 
200
AC_SUBST(OSM_VENDOR)
 
201
AC_SUBST(OSM_BUILD)
 
202
 
 
203
# --- OPENIB_APP_OSM ---
 
204
]) dnl OPENIB_APP_OSM
 
205