2 dnl osmvsel.m4: an autoconf for OpenSM Vendor Selection option
4 dnl To use this macro, just do OPENIB_APP_OSMV_SEL.
5 dnl the new configure option --with-osmv will be defined.
6 dnl current supported values are: openib(default),sim,gen1
7 dnl The following variables are defined:
8 dnl OSMV_LDADD - LDADD additional libs for linking the vendor lib
9 AC_DEFUN([OPENIB_APP_OSMV_SEL], [
10 # --- BEGIN OPENIB_APP_OSMV_SEL ---
12 dnl Define a way for the user to provide the osm vendor type
14 AC_HELP_STRING([--with-osmv=<type>],
15 [define the osm vendor type to build]),
16 AC_MSG_NOTICE(Using OSM Vendor Type:$with_osmv),
19 dnl Define a way for the user to provide the path to the ibumad installation
20 AC_ARG_WITH(umad-prefix,
21 AC_HELP_STRING([--with-umad-prefix=<dir>],
22 [define the dir used as prefix for ibumad installation]),
23 AC_MSG_NOTICE(Using ibumad installation prefix:$with_umad_prefix),
26 dnl Define a way for the user to provide the path to the ibumad includes
27 AC_ARG_WITH(umad-includes,
28 AC_HELP_STRING([--with-umad-includes=<dir>],
29 [define the dir where ibumad includes are installed]),
30 AC_MSG_NOTICE(Using ibumad includes from:$with_umad_includes),
31 with_umad_includes="")
33 if test x$with_umad_includes = x; then
34 if test x$with_umad_prefix != x; then
35 with_umad_includes=$with_umad_prefix/include
39 dnl Define a way for the user to provide the path to the ibumad libs
40 AC_ARG_WITH(umad-libs,
41 AC_HELP_STRING([--with-umad-libs=<dir>],
42 [define the dir where ibumad libs are installed]),
43 AC_MSG_NOTICE(Using ibumad libs from:$with_umad_libs),
46 if test x$with_umad_libs = x; then
47 if test x$with_umad_prefix != x; then
48 dnl 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
52 with_umad_libs=$with_umad_prefix/lib
57 dnl Define a way for the user to provide the path to the simulator installation
59 AC_HELP_STRING([--with-sim=<dir>],
60 [define the simulator prefix for building sim vendor (default /usr)]),
61 AC_MSG_NOTICE(Using Simulator from:$with_sim),
64 dnl based on the with_osmv we can try the vendor flag
65 if 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"
70 if test "x$with_umad_libs" != "x"; then
71 OSMV_LDADD="-L$with_umad_libs $OSMV_LDADD"
74 if test "x$with_umad_includes" != "x"; then
75 OSMV_INCLUDES="-I$with_umad_includes $OSMV_INCLUDES"
77 AC_DEFINE(DUAL_SIDED_RMPP, 1, [Define as 1 if you want Dual Sided RMPP Support])
78 elif 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"
82 elif test $with_osmv = "gen1"; then
83 AC_DEFINE(OSM_VENDOR_INTF_TS, 1, [Define as 1 for ts vendor])
85 if test -z $MTHOME; then
86 MTHOME=/usr/local/ibgd/driver/infinihost
89 OSMV_INCLUDES="-I$MTHOME/include -I\$(srcdir)/../include"
91 dnl we need to find the TS includes somewhere...
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"
103 if test -f $TSHOME/ts_ib_useraccess.h; then
104 OSMV_INCLUDES="$OSMV_INCLUDES -I$TSHOME"
108 if test $osmv_found = 0; then
109 AC_MSG_ERROR([Fail to find gen1 include files dir])
111 OSMV_LDADD="-L/usr/local/ibgd/driver/infinihost/lib -lvapi -lmosal -lmtl_common -lmpga"
112 elif 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"
117 AC_MSG_ERROR([Invalid Vendor Type provided:$with_osmv should be either openib,sim,gen1])
120 AM_CONDITIONAL(OSMV_VAPI, test $with_osmv = "vapi")
121 AM_CONDITIONAL(OSMV_GEN1, test $with_osmv = "gen1")
122 AM_CONDITIONAL(OSMV_SIM, test $with_osmv = "sim")
123 AM_CONDITIONAL(OSMV_OPENIB, test $with_osmv = "openib")
124 AC_DEFINE(VENDOR_RMPP_SUPPORT, 1, [Define as 1 if you want Vendor RMPP Support])
127 AC_SUBST(OSMV_INCLUDES)
129 # --- END OPENIB_APP_OSMV_SEL ---
130 ]) dnl OPENIB_APP_OSMV_SEL
132 dnl Check for the vendor lib dependency
133 AC_DEFUN([OPENIB_APP_OSMV_CHECK_LIB], [
134 # --- BEGIN OPENIB_APP_OSMV_CHECK_LIB ---
135 if test "$disable_libcheck" != "yes"; then
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])
154 # --- END OPENIB_APP_OSMV_CHECK_LIB ---
155 ]) dnl OPENIB_APP_OSMV_CHECK_LIB
157 dnl Check for the vendor lib dependency
158 AC_DEFUN([OPENIB_APP_OSMV_CHECK_HEADER], [
159 # --- BEGIN OPENIB_APP_OSMV_CHECK_HEADER ---
161 dnl we might be required to ignore this check
162 if 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
169 elif test $with_osmv = "vapi"; then
172 AC_MSG_ERROR([OSM Vendor Type not defined: please make sure OPENIB_APP_OSMV SEL is run before CHECK_HEADER])
174 if test "x$osmv_headers" != "x"; then
175 AC_CHECK_HEADERS($osmv_headers)
178 # --- END OPENIB_APP_OSMV_CHECK_HEADER ---
179 ]) dnl OPENIB_APP_OSMV_CHECK_HEADER
181 dnl Check if they want the socket console
182 AC_DEFUN([OPENIB_OSM_CONSOLE_SOCKET_SEL], [
183 # --- BEGIN OPENIB_OSM_CONSOLE_SOCKET_SEL ---
185 dnl Console over a socket connection
186 AC_ARG_ENABLE(console-socket,
187 [ --enable-console-socket Enable a console socket, requires tcp_wrappers (default no)],
189 yes) console_socket=yes ;;
190 no) console_socket=no ;;
193 if 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,
198 [Define as 1 if you want to enable a console on a socket connection])
200 # --- END OPENIB_OSM_CONSOLE_SOCKET_SEL ---
201 ]) dnl OPENIB_OSM_CONSOLE_SOCKET_SEL
203 dnl Check if they want the PerfMgr
204 AC_DEFUN([OPENIB_OSM_PERF_MGR_SEL], [
205 # --- BEGIN OPENIB_OSM_PERF_MGR_SEL ---
207 dnl enable the perf-mgr
208 AC_ARG_ENABLE(perf-mgr,
209 [ --enable-perf-mgr Enable the performance manager (default no)],
215 AC_ARG_ENABLE(perf-mgr-profile,
216 [ --enable-perf-mgr-profile Enable the performance manager profiling (default no)],
218 yes) perf_mgr_profile=yes ;;
219 no) perf_mgr_profile=no ;;
222 if test $perf_mgr = yes; then
223 AC_DEFINE(ENABLE_OSM_PERF_MGR,
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,
229 [Define as 1 if you want to enable the performance manager profiling code])
232 # --- END OPENIB_OSM_PERF_MGR_SEL ---
233 ]) dnl OPENIB_OSM_PERF_MGR_SEL
236 dnl Check if they want the event plugin
237 AC_DEFUN([OPENIB_OSM_DEFAULT_EVENT_PLUGIN_SEL], [
238 # --- BEGIN OPENIB_OSM_DEFAULT_EVENT_PLUGIN_SEL ---
240 dnl enable the default-event-plugin
241 AC_ARG_ENABLE(default-event-plugin,
242 [ --enable-default-event-plugin Enable a default event plugin "osmeventplugin" (default no)],
244 yes) default_event_plugin=yes ;;
245 no) default_event_plugin=no ;;
247 default_event_plugin=no)
248 if test $default_event_plugin = yes; then
249 AC_DEFINE(ENABLE_OSM_DEFAULT_EVENT_PLUGIN,
251 [Define as 1 if you want to enable the event plugin])
252 DEFAULT_EVENT_PLUGIN=osmeventplugin
254 DEFAULT_EVENT_PLUGIN=
256 AC_SUBST([DEFAULT_EVENT_PLUGIN])
258 # --- END OPENIB_OSM_DEFAULT_EVENT_PLUGIN_SEL ---
259 ]) dnl OPENIB_OSM_DEFAULT_EVENT_PLUGIN_SEL