1dnl Process this file with autoconf to produce a configure script.
2
3AC_PREREQ(2.57)
4AC_INIT(opensm, 3.3.0, general@lists.openfabrics.org)
5AC_CONFIG_SRCDIR([opensm/osm_opensm.c])
6AC_CONFIG_AUX_DIR(config)
7AC_CONFIG_HEADERS(include/config.h include/opensm/osm_config.h)
8AM_INIT_AUTOMAKE
9
10AC_SUBST(RELEASE, ${RELEASE:-unknown})
11AC_SUBST(TARBALL, ${TARBALL:-${PACKAGE}-${VERSION}.tar.gz})
12
13dnl NOTE: AC_DEFINE's and AC_DEFINE_UNQUOTED's which are used in header files
14dnl       MUST have a corresponding entry in include/opensm/osm_config.h.in to
15dnl       ensure plugin compatibility.
16AC_DEFINE(_OSM_CONFIG_H_, 1, mark config.h inclusion)
17
18dnl Defines the Language
19AC_LANG_C
20
21dnl Required for cases make defines a MAKE=make ??? Why
22AC_PROG_MAKE_SET
23AC_PROG_CC
24AC_PROG_LIBTOOL
25AC_PROG_INSTALL
26AC_PROG_LN_S
27AC_PROG_MAKE_SET
28AC_PROG_YACC
29AC_PROG_LEX
30
31AC_CHECK_PROGS(_YACC_,$YACC,none)
32if test "$_YACC_" = "none"
33then
34  AC_MSG_ERROR([No bison/byacc/yacc found.])
35fi
36
37AC_CHECK_PROGS(_LEX_,$LEX,none)
38if test "$_LEX_" = "none"
39then
40  AC_MSG_ERROR([No flex/lex found.])
41fi
42
43dnl Checks for libraries
44AC_CHECK_LIB(pthread, pthread_mutex_init, [],
45	AC_MSG_ERROR([pthread_mutex_init() not found.  libosmcomp requires libpthread.]))
46AC_CHECK_LIB(dl, dlopen, [],
47	AC_MSG_ERROR([dlopen() not found. OpenSM requires libdl.]))
48
49dnl Checks for typedefs, structures, and compiler characteristics.
50AC_C_CONST
51AC_C_INLINE
52AC_TYPE_PID_T
53AC_TYPE_SIZE_T
54AC_HEADER_TIME
55AC_STRUCT_TM
56AC_C_VOLATILE
57
58dnl We use --version-script with ld if possible
59AC_CACHE_CHECK(whether ld accepts --version-script, ac_cv_version_script,
60if test -n "`$LD --help < /dev/null 2>/dev/null | grep version-script`"; then
61	ac_cv_version_script=yes
62else
63	ac_cv_version_script=no
64fi)
65AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$ac_cv_version_script" = "yes")
66
67dnl Define an input config option to control debug compile
68AC_ARG_ENABLE(debug,    [  --enable-debug          Turn on debugging],
69[case "${enableval}" in
70	yes) debug=true ;;
71	no)  debug=false ;;
72	*) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
73esac],debug=false)
74if test x$debug = xtrue ; then
75	AC_DEFINE(OSM_DEBUG, 1, [ define 1 if OpenSM build is in a debug mode ])
76fi
77AM_CONDITIONAL(DEBUG, test x$debug = xtrue)
78
79AC_ARG_ENABLE(libcheck, [  --disable-libcheck      do not test for presence of ib libraries],
80[if test x$enableval = xno ; then
81	disable_libcheck=yes
82fi])
83
84dnl check if they want the socket console
85OPENIB_OSM_CONSOLE_SOCKET_SEL
86
87dnl select performance manager or not
88OPENIB_OSM_PERF_MGR_SEL
89
90dnl resolve <sysconfdir> config dir.
91conf_dir_tmp1="`eval echo ${sysconfdir} | sed 's/^NONE/$ac_default_prefix/'`"
92SYS_CONFIG_DIR="`eval echo $conf_dir_tmp1`"
93
94dnl Check for a different subdir for the config files.
95OPENSM_CONFIG_SUB_DIR=opensm
96AC_MSG_CHECKING(for --with-opensm-conf-sub-dir)
97AC_ARG_WITH(opensm-conf-sub-dir,
98    AC_HELP_STRING([--with-opensm-conf-sub-dir=dir],
99                   [define a directory name for opensm's conf files <sysconfdir>/<dir> (default "opensm")]),
100    [ case "$withval" in
101    no)
102        ;;
103    *)
104        OPENSM_CONFIG_SUB_DIR=$withval
105        ;;
106    esac ]
107)
108dnl this needs to be configured for rpmbuilds separate from the full path
109dnl "OPENSM_CONFIG_DIR"
110AC_SUBST(OPENSM_CONFIG_SUB_DIR)
111
112OPENSM_CONFIG_DIR=$SYS_CONFIG_DIR/$OPENSM_CONFIG_SUB_DIR
113AC_MSG_RESULT($OPENSM_CONFIG_DIR)
114AC_DEFINE_UNQUOTED(OPENSM_CONFIG_DIR,
115	["$OPENSM_CONFIG_DIR"],
116	[Define OpenSM config directory])
117AC_SUBST(OPENSM_CONFIG_DIR)
118
119dnl Check for a different default OpenSm config file
120OPENSM_CONFIG_FILE=opensm.conf
121AC_MSG_CHECKING(for --with-opensm-conf-file )
122AC_ARG_WITH(opensm-conf-file,
123    AC_HELP_STRING([--with-opensm-conf-file=file],
124                   [define a default OpenSM config file (default opensm.conf)]),
125    [ case "$withval" in
126    no)
127        ;;
128    *)
129        OPENSM_CONFIG_FILE=$withval
130        ;;
131    esac ]
132)
133AC_MSG_RESULT(${OPENSM_CONFIG_FILE})
134AC_DEFINE_UNQUOTED(HAVE_DEFAULT_OPENSM_CONFIG_FILE,
135	["$OPENSM_CONFIG_DIR/$OPENSM_CONFIG_FILE"],
136	[Define a default OpenSM config file])
137AC_SUBST(OPENSM_CONFIG_FILE)
138
139dnl Check for a different default node name map file
140NODENAMEMAPFILE=ib-node-name-map
141AC_MSG_CHECKING(for --with-node-name-map )
142AC_ARG_WITH(node-name-map,
143    AC_HELP_STRING([--with-node-name-map=file],
144                   [define a default node name map file (default ib-node-name-map)]),
145    [ case "$withval" in
146    no)
147        ;;
148    *)
149        NODENAMEMAPFILE=$withval
150        ;;
151    esac ]
152)
153AC_MSG_RESULT($NODENAMEMAPFILE)
154AC_DEFINE_UNQUOTED(HAVE_DEFAULT_NODENAME_MAP,
155	["$OPENSM_CONFIG_DIR/$NODENAMEMAPFILE"],
156	[Define a default node name map file])
157AC_SUBST(NODENAMEMAPFILE)
158
159dnl Check for a different partition conf file
160PARTITION_CONFIG_FILE=partitions.conf
161AC_MSG_CHECKING(for --with-partitions-conf)
162AC_ARG_WITH(partitions-conf,
163    AC_HELP_STRING([--with-partitions-conf=file],
164                   [define a partitions config file (default partitions.conf)]),
165    [ case "$withval" in
166    no)
167        ;;
168    *)
169        PARTITION_CONFIG_FILE=$withval
170        ;;
171    esac ]
172)
173AC_MSG_RESULT($PARTITION_CONFIG_FILE)
174AC_DEFINE_UNQUOTED(HAVE_DEFAULT_PARTITION_CONFIG_FILE,
175	["$OPENSM_CONFIG_DIR/$PARTITION_CONFIG_FILE"],
176	[Define a Partition config file])
177AC_SUBST(PARTITION_CONFIG_FILE)
178
179dnl Check for a different QOS policy file
180QOS_POLICY_FILE=qos-policy.conf
181AC_MSG_CHECKING(for --with-qos-policy-conf)
182AC_ARG_WITH(qos-policy-conf,
183    AC_HELP_STRING([--with-qos-policy-conf=file],
184                   [define a QOS policy config file (default qos-policy.conf)]),
185    [ case "$withval" in
186    no)
187        ;;
188    *)
189        QOS_POLICY_FILE=$withval
190        ;;
191    esac ]
192)
193AC_MSG_RESULT($QOS_POLICY_FILE)
194AC_DEFINE_UNQUOTED(HAVE_DEFAULT_QOS_POLICY_FILE,
195	["$OPENSM_CONFIG_DIR/$QOS_POLICY_FILE"],
196	[Define a QOS policy config file])
197AC_SUBST(QOS_POLICY_FILE)
198
199dnl Check for a different prefix-routes file
200PREFIX_ROUTES_FILE=prefix-routes.conf
201AC_MSG_CHECKING(for --with-prefix-routes-conf)
202AC_ARG_WITH(prefix-routes-conf,
203    AC_HELP_STRING([--with-prefix-routes-conf=file],
204                   [define a Prefix Routes config file (default is prefix-routes.conf)]),
205    [ case "$withval" in
206    no)
207        ;;
208    *)
209        PREFIX_ROUTES_FILE=$withval
210        ;;
211    esac ]
212)
213AC_MSG_RESULT($PREFIX_ROUTES_FILE)
214AC_DEFINE_UNQUOTED(HAVE_DEFAULT_PREFIX_ROUTES_FILE,
215	["$OPENSM_CONFIG_DIR/$PREFIX_ROUTES_FILE"],
216	[Define a Prefix Routes config file])
217AC_SUBST(PREFIX_ROUTES_FILE)
218
219dnl select example event plugin or not
220OPENIB_OSM_DEFAULT_EVENT_PLUGIN_SEL
221
222dnl Provide user option to select vendor
223OPENIB_APP_OSMV_SEL
224
225dnl Checks for headers and libraries
226OPENIB_APP_OSMV_CHECK_HEADER
227OPENIB_APP_OSMV_CHECK_LIB
228
229AC_CONFIG_FILES([man/opensm.8 scripts/opensm.init scripts/redhat-opensm.init scripts/sldd.sh])
230
231dnl Create the following Makefiles
232AC_OUTPUT([include/opensm/osm_version.h Makefile include/Makefile complib/Makefile libvendor/Makefile opensm/Makefile osmeventplugin/Makefile osmtest/Makefile opensm.spec])
233