1219820Sjeffdnl Process this file with autoconf to produce a configure script.
2219820Sjeff
3219820SjeffAC_PREREQ(2.57)
4219820SjeffAC_INIT(opensm, 3.3.0, general@lists.openfabrics.org)
5219820SjeffAC_CONFIG_SRCDIR([opensm/osm_opensm.c])
6219820SjeffAC_CONFIG_AUX_DIR(config)
7219820SjeffAC_CONFIG_HEADERS(include/config.h include/opensm/osm_config.h)
8219820SjeffAM_INIT_AUTOMAKE
9219820Sjeff
10219820SjeffAC_SUBST(RELEASE, ${RELEASE:-unknown})
11219820SjeffAC_SUBST(TARBALL, ${TARBALL:-${PACKAGE}-${VERSION}.tar.gz})
12219820Sjeff
13219820Sjeffdnl NOTE: AC_DEFINE's and AC_DEFINE_UNQUOTED's which are used in header files
14219820Sjeffdnl       MUST have a corresponding entry in include/opensm/osm_config.h.in to
15219820Sjeffdnl       ensure plugin compatibility.
16219820SjeffAC_DEFINE(_OSM_CONFIG_H_, 1, mark config.h inclusion)
17219820Sjeff
18219820Sjeffdnl Defines the Language
19219820SjeffAC_LANG_C
20219820Sjeff
21219820Sjeffdnl Required for cases make defines a MAKE=make ??? Why
22219820SjeffAC_PROG_MAKE_SET
23219820SjeffAC_PROG_CC
24219820SjeffAC_PROG_LIBTOOL
25219820SjeffAC_PROG_INSTALL
26219820SjeffAC_PROG_LN_S
27219820SjeffAC_PROG_MAKE_SET
28219820SjeffAC_PROG_YACC
29219820SjeffAC_PROG_LEX
30219820Sjeff
31219820SjeffAC_CHECK_PROGS(_YACC_,$YACC,none)
32219820Sjeffif test "$_YACC_" = "none"
33219820Sjeffthen
34219820Sjeff  AC_MSG_ERROR([No bison/byacc/yacc found.])
35219820Sjefffi
36219820Sjeff
37219820SjeffAC_CHECK_PROGS(_LEX_,$LEX,none)
38219820Sjeffif test "$_LEX_" = "none"
39219820Sjeffthen
40219820Sjeff  AC_MSG_ERROR([No flex/lex found.])
41219820Sjefffi
42219820Sjeff
43219820Sjeffdnl Checks for libraries
44219820SjeffAC_CHECK_LIB(pthread, pthread_mutex_init, [],
45219820Sjeff	AC_MSG_ERROR([pthread_mutex_init() not found.  libosmcomp requires libpthread.]))
46219820SjeffAC_CHECK_LIB(dl, dlopen, [],
47219820Sjeff	AC_MSG_ERROR([dlopen() not found. OpenSM requires libdl.]))
48219820Sjeff
49219820Sjeffdnl Checks for typedefs, structures, and compiler characteristics.
50219820SjeffAC_C_CONST
51219820SjeffAC_C_INLINE
52219820SjeffAC_TYPE_PID_T
53219820SjeffAC_TYPE_SIZE_T
54219820SjeffAC_HEADER_TIME
55219820SjeffAC_STRUCT_TM
56219820SjeffAC_C_VOLATILE
57219820Sjeff
58219820Sjeffdnl We use --version-script with ld if possible
59219820SjeffAC_CACHE_CHECK(whether ld accepts --version-script, ac_cv_version_script,
60219820Sjeffif test -n "`$LD --help < /dev/null 2>/dev/null | grep version-script`"; then
61219820Sjeff	ac_cv_version_script=yes
62219820Sjeffelse
63219820Sjeff	ac_cv_version_script=no
64219820Sjefffi)
65219820SjeffAM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$ac_cv_version_script" = "yes")
66219820Sjeff
67219820Sjeffdnl Define an input config option to control debug compile
68219820SjeffAC_ARG_ENABLE(debug,    [  --enable-debug          Turn on debugging],
69219820Sjeff[case "${enableval}" in
70219820Sjeff	yes) debug=true ;;
71219820Sjeff	no)  debug=false ;;
72219820Sjeff	*) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
73219820Sjeffesac],debug=false)
74219820Sjeffif test x$debug = xtrue ; then
75219820Sjeff	AC_DEFINE(OSM_DEBUG, 1, [ define 1 if OpenSM build is in a debug mode ])
76219820Sjefffi
77219820SjeffAM_CONDITIONAL(DEBUG, test x$debug = xtrue)
78219820Sjeff
79219820SjeffAC_ARG_ENABLE(libcheck, [  --disable-libcheck      do not test for presence of ib libraries],
80219820Sjeff[if test x$enableval = xno ; then
81219820Sjeff	disable_libcheck=yes
82219820Sjefffi])
83219820Sjeff
84219820Sjeffdnl check if they want the socket console
85219820SjeffOPENIB_OSM_CONSOLE_SOCKET_SEL
86219820Sjeff
87219820Sjeffdnl select performance manager or not
88219820SjeffOPENIB_OSM_PERF_MGR_SEL
89219820Sjeff
90219820Sjeffdnl resolve <sysconfdir> config dir.
91219820Sjeffconf_dir_tmp1="`eval echo ${sysconfdir} | sed 's/^NONE/$ac_default_prefix/'`"
92219820SjeffSYS_CONFIG_DIR="`eval echo $conf_dir_tmp1`"
93219820Sjeff
94219820Sjeffdnl Check for a different subdir for the config files.
95219820SjeffOPENSM_CONFIG_SUB_DIR=opensm
96219820SjeffAC_MSG_CHECKING(for --with-opensm-conf-sub-dir)
97219820SjeffAC_ARG_WITH(opensm-conf-sub-dir,
98219820Sjeff    AC_HELP_STRING([--with-opensm-conf-sub-dir=dir],
99219820Sjeff                   [define a directory name for opensm's conf files <sysconfdir>/<dir> (default "opensm")]),
100219820Sjeff    [ case "$withval" in
101219820Sjeff    no)
102219820Sjeff        ;;
103219820Sjeff    *)
104219820Sjeff        OPENSM_CONFIG_SUB_DIR=$withval
105219820Sjeff        ;;
106219820Sjeff    esac ]
107219820Sjeff)
108219820Sjeffdnl this needs to be configured for rpmbuilds separate from the full path
109219820Sjeffdnl "OPENSM_CONFIG_DIR"
110219820SjeffAC_SUBST(OPENSM_CONFIG_SUB_DIR)
111219820Sjeff
112219820SjeffOPENSM_CONFIG_DIR=$SYS_CONFIG_DIR/$OPENSM_CONFIG_SUB_DIR
113219820SjeffAC_MSG_RESULT($OPENSM_CONFIG_DIR)
114219820SjeffAC_DEFINE_UNQUOTED(OPENSM_CONFIG_DIR,
115219820Sjeff	["$OPENSM_CONFIG_DIR"],
116219820Sjeff	[Define OpenSM config directory])
117219820SjeffAC_SUBST(OPENSM_CONFIG_DIR)
118219820Sjeff
119219820Sjeffdnl Check for a different default OpenSm config file
120219820SjeffOPENSM_CONFIG_FILE=opensm.conf
121219820SjeffAC_MSG_CHECKING(for --with-opensm-conf-file )
122219820SjeffAC_ARG_WITH(opensm-conf-file,
123219820Sjeff    AC_HELP_STRING([--with-opensm-conf-file=file],
124219820Sjeff                   [define a default OpenSM config file (default opensm.conf)]),
125219820Sjeff    [ case "$withval" in
126219820Sjeff    no)
127219820Sjeff        ;;
128219820Sjeff    *)
129219820Sjeff        OPENSM_CONFIG_FILE=$withval
130219820Sjeff        ;;
131219820Sjeff    esac ]
132219820Sjeff)
133219820SjeffAC_MSG_RESULT(${OPENSM_CONFIG_FILE})
134219820SjeffAC_DEFINE_UNQUOTED(HAVE_DEFAULT_OPENSM_CONFIG_FILE,
135219820Sjeff	["$OPENSM_CONFIG_DIR/$OPENSM_CONFIG_FILE"],
136219820Sjeff	[Define a default OpenSM config file])
137219820SjeffAC_SUBST(OPENSM_CONFIG_FILE)
138219820Sjeff
139219820Sjeffdnl Check for a different default node name map file
140219820SjeffNODENAMEMAPFILE=ib-node-name-map
141219820SjeffAC_MSG_CHECKING(for --with-node-name-map )
142219820SjeffAC_ARG_WITH(node-name-map,
143219820Sjeff    AC_HELP_STRING([--with-node-name-map=file],
144219820Sjeff                   [define a default node name map file (default ib-node-name-map)]),
145219820Sjeff    [ case "$withval" in
146219820Sjeff    no)
147219820Sjeff        ;;
148219820Sjeff    *)
149219820Sjeff        NODENAMEMAPFILE=$withval
150219820Sjeff        ;;
151219820Sjeff    esac ]
152219820Sjeff)
153219820SjeffAC_MSG_RESULT($NODENAMEMAPFILE)
154219820SjeffAC_DEFINE_UNQUOTED(HAVE_DEFAULT_NODENAME_MAP,
155219820Sjeff	["$OPENSM_CONFIG_DIR/$NODENAMEMAPFILE"],
156219820Sjeff	[Define a default node name map file])
157219820SjeffAC_SUBST(NODENAMEMAPFILE)
158219820Sjeff
159219820Sjeffdnl Check for a different partition conf file
160219820SjeffPARTITION_CONFIG_FILE=partitions.conf
161219820SjeffAC_MSG_CHECKING(for --with-partitions-conf)
162219820SjeffAC_ARG_WITH(partitions-conf,
163219820Sjeff    AC_HELP_STRING([--with-partitions-conf=file],
164219820Sjeff                   [define a partitions config file (default partitions.conf)]),
165219820Sjeff    [ case "$withval" in
166219820Sjeff    no)
167219820Sjeff        ;;
168219820Sjeff    *)
169219820Sjeff        PARTITION_CONFIG_FILE=$withval
170219820Sjeff        ;;
171219820Sjeff    esac ]
172219820Sjeff)
173219820SjeffAC_MSG_RESULT($PARTITION_CONFIG_FILE)
174219820SjeffAC_DEFINE_UNQUOTED(HAVE_DEFAULT_PARTITION_CONFIG_FILE,
175219820Sjeff	["$OPENSM_CONFIG_DIR/$PARTITION_CONFIG_FILE"],
176219820Sjeff	[Define a Partition config file])
177219820SjeffAC_SUBST(PARTITION_CONFIG_FILE)
178219820Sjeff
179219820Sjeffdnl Check for a different QOS policy file
180219820SjeffQOS_POLICY_FILE=qos-policy.conf
181219820SjeffAC_MSG_CHECKING(for --with-qos-policy-conf)
182219820SjeffAC_ARG_WITH(qos-policy-conf,
183219820Sjeff    AC_HELP_STRING([--with-qos-policy-conf=file],
184219820Sjeff                   [define a QOS policy config file (default qos-policy.conf)]),
185219820Sjeff    [ case "$withval" in
186219820Sjeff    no)
187219820Sjeff        ;;
188219820Sjeff    *)
189219820Sjeff        QOS_POLICY_FILE=$withval
190219820Sjeff        ;;
191219820Sjeff    esac ]
192219820Sjeff)
193219820SjeffAC_MSG_RESULT($QOS_POLICY_FILE)
194219820SjeffAC_DEFINE_UNQUOTED(HAVE_DEFAULT_QOS_POLICY_FILE,
195219820Sjeff	["$OPENSM_CONFIG_DIR/$QOS_POLICY_FILE"],
196219820Sjeff	[Define a QOS policy config file])
197219820SjeffAC_SUBST(QOS_POLICY_FILE)
198219820Sjeff
199219820Sjeffdnl Check for a different prefix-routes file
200219820SjeffPREFIX_ROUTES_FILE=prefix-routes.conf
201219820SjeffAC_MSG_CHECKING(for --with-prefix-routes-conf)
202219820SjeffAC_ARG_WITH(prefix-routes-conf,
203219820Sjeff    AC_HELP_STRING([--with-prefix-routes-conf=file],
204219820Sjeff                   [define a Prefix Routes config file (default is prefix-routes.conf)]),
205219820Sjeff    [ case "$withval" in
206219820Sjeff    no)
207219820Sjeff        ;;
208219820Sjeff    *)
209219820Sjeff        PREFIX_ROUTES_FILE=$withval
210219820Sjeff        ;;
211219820Sjeff    esac ]
212219820Sjeff)
213219820SjeffAC_MSG_RESULT($PREFIX_ROUTES_FILE)
214219820SjeffAC_DEFINE_UNQUOTED(HAVE_DEFAULT_PREFIX_ROUTES_FILE,
215219820Sjeff	["$OPENSM_CONFIG_DIR/$PREFIX_ROUTES_FILE"],
216219820Sjeff	[Define a Prefix Routes config file])
217219820SjeffAC_SUBST(PREFIX_ROUTES_FILE)
218219820Sjeff
219219820Sjeffdnl select example event plugin or not
220219820SjeffOPENIB_OSM_DEFAULT_EVENT_PLUGIN_SEL
221219820Sjeff
222219820Sjeffdnl Provide user option to select vendor
223219820SjeffOPENIB_APP_OSMV_SEL
224219820Sjeff
225219820Sjeffdnl Checks for headers and libraries
226219820SjeffOPENIB_APP_OSMV_CHECK_HEADER
227219820SjeffOPENIB_APP_OSMV_CHECK_LIB
228219820Sjeff
229219820SjeffAC_CONFIG_FILES([man/opensm.8 scripts/opensm.init scripts/redhat-opensm.init scripts/sldd.sh])
230219820Sjeff
231219820Sjeffdnl Create the following Makefiles
232219820SjeffAC_OUTPUT([include/opensm/osm_version.h Makefile include/Makefile complib/Makefile libvendor/Makefile opensm/Makefile osmeventplugin/Makefile osmtest/Makefile opensm.spec])
233