1
2dnl osmvsel.m4: an autoconf for OpenSM Vendor Selection option
3dnl
4dnl To use this macro, just do OPENIB_APP_OSMV_SEL.
5dnl the new configure option --with-osmv will be defined.
6dnl current supported values are: openib(default),sim,gen1
7dnl The following variables are defined:
8dnl OSMV_LDADD - LDADD additional libs for linking the vendor lib
9AC_DEFUN([OPENIB_APP_OSMV_SEL], [
10# --- BEGIN OPENIB_APP_OSMV_SEL ---
11
12dnl Define a way for the user to provide the osm vendor type
13AC_ARG_WITH(osmv,
14    AC_HELP_STRING([--with-osmv=<type>],
15                   [define the osm vendor type to build]),
16AC_MSG_NOTICE(Using OSM Vendor Type:$with_osmv),
17with_osmv="openib")
18
19dnl Define a way for the user to provide the path to the ibumad installation
20AC_ARG_WITH(umad-prefix,
21    AC_HELP_STRING([--with-umad-prefix=<dir>],
22                   [define the dir used as prefix for ibumad installation]),
23AC_MSG_NOTICE(Using ibumad installation prefix:$with_umad_prefix),
24with_umad_prefix="")
25
26dnl Define a way for the user to provide the path to the ibumad includes
27AC_ARG_WITH(umad-includes,
28    AC_HELP_STRING([--with-umad-includes=<dir>],
29                   [define the dir where ibumad includes are installed]),
30AC_MSG_NOTICE(Using ibumad includes from:$with_umad_includes),
31with_umad_includes="")
32
33if test x$with_umad_includes = x; then
34   if test x$with_umad_prefix != x; then
35      with_umad_includes=$with_umad_prefix/include
36   fi
37fi
38
39dnl Define a way for the user to provide the path to the ibumad libs
40AC_ARG_WITH(umad-libs,
41    AC_HELP_STRING([--with-umad-libs=<dir>],
42                   [define the dir where ibumad libs are installed]),
43AC_MSG_NOTICE(Using ibumad libs from:$with_umad_libs),
44with_umad_libs="")
45
46if test x$with_umad_libs = x; then
47   if test x$with_umad_prefix != x; then
48dnl Should we use lib64 or lib
49      if test "$(uname -m)" = "x86_64" -o "$(uname -m)" = "ppc64"; then
50         with_umad_libs=$with_umad_prefix/lib64
51      else
52         with_umad_libs=$with_umad_prefix/lib
53      fi
54   fi
55fi
56
57dnl Define a way for the user to provide the path to the simulator installation
58AC_ARG_WITH(sim,
59    AC_HELP_STRING([--with-sim=<dir>],
60                   [define the simulator prefix for building sim vendor (default /usr)]),
61AC_MSG_NOTICE(Using Simulator from:$with_sim),
62with_sim="/usr")
63
64dnl based on the with_osmv we can try the vendor flag
65if test $with_osmv = "openib"; then
66   AC_DEFINE(OSM_VENDOR_INTF_OPENIB, 1, [Define as 1 for OpenIB vendor])
67   OSMV_INCLUDES="-I\$(srcdir)/../include -I\$(srcdir)/../../libibcommon/include -I\$(srcdir)/../../libibumad/include -I\$(includedir)"
68   OSMV_LDADD="-L\$(abs_srcdir)/../../libibumad/.libs -L\$(abs_srcdir)/../../libibcommon/.libs -L\$(libdir) -libumad -libcommon"
69
70   if test "x$with_umad_libs" != "x"; then
71      OSMV_LDADD="-L$with_umad_libs $OSMV_LDADD"
72   fi
73
74   if test "x$with_umad_includes" != "x"; then
75      OSMV_INCLUDES="-I$with_umad_includes $OSMV_INCLUDES"
76   fi
77   AC_DEFINE(DUAL_SIDED_RMPP, 1, [Define as 1 if you want Dual Sided RMPP Support])
78elif test $with_osmv = "sim" ; then
79   AC_DEFINE(OSM_VENDOR_INTF_SIM, 1, [Define as 1 for sim vendor])
80   OSMV_INCLUDES="-I$with_sim/include -I\$(srcdir)/../include"
81   OSMV_LDADD="-L$with_sim/lib -libmscli"
82elif test $with_osmv = "gen1"; then
83   AC_DEFINE(OSM_VENDOR_INTF_TS, 1, [Define as 1 for ts vendor])
84
85   if test -z $MTHOME; then
86      MTHOME=/usr/local/ibgd/driver/infinihost
87   fi
88
89   OSMV_INCLUDES="-I$MTHOME/include -I\$(srcdir)/../include"
90
91   dnl we need to find the TS includes somewhere...
92   osmv_found=0
93   if test -z $TSHOME; then
94      osmv_dir=`uname -r|sed 's/-smp//'`
95      osmv_dir_smp=`uname -r`
96      for d in /usr/src/linux-$osmv_dir /usr/src/linux-$osmv_dir_smp /lib/modules/$osmv_dir/build /lib/modules/$osmv_dir_smp/build/; do
97         if test -f $d/drivers/infiniband/include/ts_ib_useraccess.h; then
98            OSMV_INCLUDES="$OSMV_INCLUDES -I$d/drivers/infiniband/include"
99            osmv_found=1
100         fi
101      done
102   else
103      if test -f  $TSHOME/ts_ib_useraccess.h; then
104         OSMV_INCLUDES="$OSMV_INCLUDES -I$TSHOME"
105         osmv_found=1
106      fi
107   fi
108   if test $osmv_found = 0; then
109      AC_MSG_ERROR([Fail to find gen1 include files dir])
110   fi
111   OSMV_LDADD="-L/usr/local/ibgd/driver/infinihost/lib -lvapi -lmosal -lmtl_common -lmpga"
112elif test $with_osmv = "vapi"; then
113   AC_DEFINE(OSM_VENDOR_INTF_MTL, 1, [Define as 1 for vapi vendor])
114   OSMV_INCLUDES="-I/usr/mellanox/include -I/usr/include -I\$(srcdir)/../include"
115   OSMV_LDADD="-L/usr/lib -L/usr/mellanox/lib -lib_mgt -lvapi -lmosal -lmtl_common -lmpga"
116else
117   AC_MSG_ERROR([Invalid Vendor Type provided:$with_osmv should be either openib,sim,gen1])
118fi
119
120AM_CONDITIONAL(OSMV_VAPI, test $with_osmv = "vapi")
121AM_CONDITIONAL(OSMV_GEN1, test $with_osmv = "gen1")
122AM_CONDITIONAL(OSMV_SIM, test $with_osmv = "sim")
123AM_CONDITIONAL(OSMV_OPENIB, test $with_osmv = "openib")
124AC_DEFINE(VENDOR_RMPP_SUPPORT, 1, [Define as 1 if you want Vendor RMPP Support])
125
126AC_SUBST(OSMV_LDADD)
127AC_SUBST(OSMV_INCLUDES)
128
129# --- END OPENIB_APP_OSMV_SEL ---
130]) dnl OPENIB_APP_OSMV_SEL
131
132dnl Check for the vendor lib dependency
133AC_DEFUN([OPENIB_APP_OSMV_CHECK_LIB], [
134# --- BEGIN OPENIB_APP_OSMV_CHECK_LIB ---
135if test "$disable_libcheck" != "yes"; then
136
137 dnl based on the with_osmv we can try the vendor flag
138 if test $with_osmv = "openib"; then
139   LDADD="$LDADD $OSMV_LDADD"
140   AC_CHECK_LIB(ibumad, umad_init, [],
141	 AC_MSG_ERROR([umad_init() not found. libosmvendor of type openib requires libibumad.]))
142 elif test $with_osmv = "sim" ; then
143   LDFLAGS="$LDFLAGS -L$with_sim/lib"
144   AC_CHECK_FILE([$with_sim/lib/libibmscli.a], [],
145    AC_MSG_ERROR([ibms_bind() not found. libosmvendor of type sim requires libibmscli.]))
146 elif test $with_osmv = "gen1"; then
147   LDFLAGS="$LDFLAGS -L$MTHOME/lib -L$MTHOME/lib64 -lmosal -lmtl_common -lmpga"
148   AC_CHECK_LIB(vapi, vipul_init, [],
149    AC_MSG_ERROR([vipul_init() not found. libosmvendor of type gen1 requires libvapi.]))
150 elif test $with_osmv != "vapi"; then
151   AC_MSG_ERROR([OSM Vendor Type not defined: please make sure OPENIB_APP_OSMV SEL is run before CHECK_LIB])
152 fi
153fi
154# --- END OPENIB_APP_OSMV_CHECK_LIB ---
155]) dnl OPENIB_APP_OSMV_CHECK_LIB
156
157dnl Check for the vendor lib dependency
158AC_DEFUN([OPENIB_APP_OSMV_CHECK_HEADER], [
159# --- BEGIN OPENIB_APP_OSMV_CHECK_HEADER ---
160
161dnl we might be required to ignore this check
162if test "$disable_libcheck" != "yes"; then
163 if test $with_osmv = "openib"; then
164   osmv_headers=infiniband/umad.h
165 elif test $with_osmv = "sim" ; then
166   osmv_headers=ibmgtsim/ibms_client_api.h
167 elif test $with_osmv = "gen1"; then
168   osmv_headers=
169 elif test $with_osmv = "vapi"; then
170   osmv_headers=vapi.h
171 else
172   AC_MSG_ERROR([OSM Vendor Type not defined: please make sure OPENIB_APP_OSMV SEL is run before CHECK_HEADER])
173 fi
174 if test "x$osmv_headers" != "x"; then
175   AC_CHECK_HEADERS($osmv_headers)
176 fi
177fi
178# --- END OPENIB_APP_OSMV_CHECK_HEADER ---
179]) dnl OPENIB_APP_OSMV_CHECK_HEADER
180
181dnl Check if they want the socket console
182AC_DEFUN([OPENIB_OSM_CONSOLE_SOCKET_SEL], [
183# --- BEGIN OPENIB_OSM_CONSOLE_SOCKET_SEL ---
184
185dnl Console over a socket connection
186AC_ARG_ENABLE(console-socket,
187[  --enable-console-socket Enable a console socket, requires tcp_wrappers (default no)],
188[case $enableval in
189     yes) console_socket=yes ;;
190     no)  console_socket=no ;;
191   esac],
192   console_socket=no)
193if test $console_socket = yes; then
194  AC_CHECK_LIB(wrap, request_init, [],
195 	AC_MSG_ERROR([request_init() not found. console-socket requires libwrap.]))
196  AC_DEFINE(ENABLE_OSM_CONSOLE_SOCKET,
197	    1,
198	    [Define as 1 if you want to enable a console on a socket connection])
199fi
200# --- END OPENIB_OSM_CONSOLE_SOCKET_SEL ---
201]) dnl OPENIB_OSM_CONSOLE_SOCKET_SEL
202
203dnl Check if they want the PerfMgr
204AC_DEFUN([OPENIB_OSM_PERF_MGR_SEL], [
205# --- BEGIN OPENIB_OSM_PERF_MGR_SEL ---
206
207dnl enable the perf-mgr
208AC_ARG_ENABLE(perf-mgr,
209[  --enable-perf-mgr Enable the performance manager (default no)],
210   [case $enableval in
211     yes) perf_mgr=yes ;;
212     no)  perf_mgr=no ;;
213   esac],
214   perf_mgr=no)
215AC_ARG_ENABLE(perf-mgr-profile,
216[  --enable-perf-mgr-profile Enable the performance manager profiling (default no)],
217	[case $enableval in
218	yes) perf_mgr_profile=yes ;;
219	no)  perf_mgr_profile=no ;;
220	esac],
221	perf_mgr_profile=no)
222if test $perf_mgr = yes; then
223  AC_DEFINE(ENABLE_OSM_PERF_MGR,
224	1,
225	[Define as 1 if you want to enable the performance manager])
226  if test $perf_mgr_profile = yes; then
227	AC_DEFINE(ENABLE_OSM_PERF_MGR_PROFILE,
228		1,
229		[Define as 1 if you want to enable the performance manager profiling code])
230  fi
231fi
232# --- END OPENIB_OSM_PERF_MGR_SEL ---
233]) dnl OPENIB_OSM_PERF_MGR_SEL
234
235
236dnl Check if they want the event plugin
237AC_DEFUN([OPENIB_OSM_DEFAULT_EVENT_PLUGIN_SEL], [
238# --- BEGIN OPENIB_OSM_DEFAULT_EVENT_PLUGIN_SEL ---
239
240dnl enable the default-event-plugin
241AC_ARG_ENABLE(default-event-plugin,
242[  --enable-default-event-plugin  Enable a default event plugin "osmeventplugin" (default no)],
243   [case $enableval in
244     yes) default_event_plugin=yes ;;
245     no)  default_event_plugin=no ;;
246   esac],
247   default_event_plugin=no)
248if test $default_event_plugin = yes; then
249  AC_DEFINE(ENABLE_OSM_DEFAULT_EVENT_PLUGIN,
250	    1,
251	    [Define as 1 if you want to enable the event plugin])
252  DEFAULT_EVENT_PLUGIN=osmeventplugin
253else
254  DEFAULT_EVENT_PLUGIN=
255fi
256AC_SUBST([DEFAULT_EVENT_PLUGIN])
257
258# --- END OPENIB_OSM_DEFAULT_EVENT_PLUGIN_SEL ---
259]) dnl OPENIB_OSM_DEFAULT_EVENT_PLUGIN_SEL
260