forked from libstorage/libstoragemgmt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
334 lines (286 loc) · 12 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
dnl Process this file with autoconf to produce a configure script.
dnl Copyright (C) 2011-2015 Red Hat, Inc.
dnl See COPYING.LIB for the License of this software
AC_INIT(
[libstoragemgmt], [1.3.0], [libstoragemgmt-devel@lists.fedorahosted.org],
[], [https://github.com/libstorage/libstoragemgmt/])
AC_CONFIG_SRCDIR([configure.ac])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
dnl Make automake keep quiet about wildcards & other GNUmake-isms
AM_INIT_AUTOMAKE([-Wno-portability subdir-objects])
AM_MAINTAINER_MODE([enable])
# Enable silent build when available (Automake 1.11)
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
PKG_PROG_PKG_CONFIG
AC_CANONICAL_HOST
LIBSM_MAJOR_VERSION=`echo $VERSION | awk -F. '{print $1}'`
LIBSM_MINOR_VERSION=`echo $VERSION | awk -F. '{print $2}'`
LIBSM_MICRO_VERSION=`echo $VERSION | awk -F. '{print $3}'`
LIBSM_VERSION=$LIBSM_MAJOR_VERSION.$LIBSM_MINOR_VERSION.$LIBSM_MICRO_VERSION$LIBSM_MICRO_VERSION_SUFFIX
LIBSM_VERSION_INFO=`expr $LIBSM_MAJOR_VERSION + $LIBSM_MINOR_VERSION`:$LIBSM_MICRO_VERSION:$LIBSM_MINOR_VERSION
LIBSM_VERSION_NUMBER=`expr $LIBSM_MAJOR_VERSION \* 1000000 + $LIBSM_MINOR_VERSION \* 1000 + $LIBSM_MICRO_VERSION`
# Our intention is that we will always be backward compatible. Thus we will
# set the library version in such a way so that we will always be
# libstoragemgmt.so.1.n.n once we officially release our ver 1.0.0.
#
# To make this happen we will use the minor version as the libtool current and
# age set to minor - 1 and the micro used for revision. Basically this will get
# us what we expect while utilizing the libtool revision system.
#
# For this to work we need to make sure that when we add to the interface we
# increment minor and set micro to 0. If we make a code change which doesn't
# change the API we can just bump micro.
#
# 0.1.0 -> libstoragemgmt.so.0.1.0
# 1.0.0 -> libstoragemgmt.so.1.0.0
# 1.1.0 -> libstoragemgmt.so.1.1.0
# 1.1.1 -> libstoragemgmt.so.1.1.1
CURRENT=`expr $LIBSM_MAJOR_VERSION '*' 1 + $LIBSM_MINOR_VERSION`
AGE=$LIBSM_MINOR_VERSION
REVISION=$LIBSM_MICRO_VERSION
LIBSM_LIBTOOL_VERSION=$CURRENT:$REVISION:$AGE
AC_SUBST([LIBSM_MAJOR_VERSION])
AC_SUBST([LIBSM_MINOR_VERSION])
AC_SUBST([LIBSM_MICRO_VERSION])
AC_SUBST([LIBSM_VERSION])
AC_SUBST([LIBSM_VERSION_INFO])
AC_SUBST([LIBSM_VERSION_NUMBER])
AC_SUBST([LIBSM_LIBTOOL_VERSION])
dnl Required minimum versions of all libs we depend on
LIBXML_REQUIRED="2.5.0"
dnl Checks for C compiler.
AC_PROG_CC
AC_PROG_CXX
AC_PROG_AWK
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_CPP
AM_PROG_CC_STDC
AM_PROG_LIBTOOL
AM_PROG_CC_C_O
AM_PROG_LD
AC_CHECK_HEADERS([stdint.h stdlib.h string.h sys/socket.h syslog.h unistd.h])
AC_LANG_PUSH([C++])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
[], [AC_MSG_ERROR([C++ compiler missing or inoperational])])
AC_LANG_POP([C++])
#Make sure all types are covered
AC_HEADER_STDBOOL
AC_TYPE_INT32_T
AC_TYPE_INT64_T
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
AC_TYPE_UINT8_T
AC_FUNC_ERROR_AT_LINE
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_CHECK_FUNCS([getpass memset socket strchr strdup strtol strtoul])
dnl Availability of various common headers (non-fatal if missing).
AC_CHECK_HEADERS([dlfcn.h])
#Check for openssl development libs, we are using in simc_lsmplugin
AC_CHECK_LIB([crypto], [MD5_Final], [SSL_LIBS=-lcrypto], AC_MSG_ERROR([Missing openssl-devel libraries]))
AC_SUBST([SSL_LIBS])
#Check for json parser yajl
AC_CHECK_HEADERS([yajl/yajl_gen.h yajl/yajl_parse.h], [] , AC_MSG_ERROR([Missing yajl development headers]) )
AC_CHECK_HEADERS([yajl/yajl_version.h])
AC_CHECK_LIB([yajl], [yajl_parse], [YAJL_LIBS=-lyajl], AC_MSG_ERROR([Missing yajl library]))
AC_SUBST([YAJL_LIBS])
dnl if --prefix is /usr, don't use /usr/var for localstatedir
dnl or /usr/etc for sysconfdir
dnl as this makes a lot of things break in testing situations
if test "$prefix" = "/usr" && test "$localstatedir" = '${prefix}/var' ; then
localstatedir='/var'
fi
if test "$prefix" = "/usr" && test "$sysconfdir" = '${prefix}/etc' ; then
sysconfdir='/etc'
fi
dnl ==========================================================================
dnl find libxml2 library, borrowed from xmlsec
dnl ==========================================================================
PKG_CHECK_MODULES([LIBXML], [libxml-2.0])
PKG_CHECK_MODULES([LIBGLIB], [glib-2.0 >= 2.22.5])
want_c_unit="yes"
AC_ARG_ENABLE([build-c-unit],
[AC_HELP_STRING([--disable-build-c-unit], [disable building C unit test case.])],
[want_c_unit=${enableval}], [])
if test "x${want_c_unit}" = "xyes"; then
PKG_CHECK_MODULES([LIBCHECK], [check >= 0.9.8 ])
fi
AM_CONDITIONAL([BUILD_C_UNIT], [test "x${want_c_unit}" = "xyes"])
dnl =========================================================================
dnl Check for perl, used for code constants checking
dnl =========================================================================
AC_PATH_PROGS(PERL, perl)
if test -z $PERL ;then
AC_MSG_ERROR([Need 'perl' to run test cases])
fi
dnl =========================================================================
dnl Check for chrpath, valgrind, wc, used for make check
dnl =========================================================================
AC_PATH_PROG([CHRPATH], chrpath)
if test -z $CHRPATH ;then
AC_MSG_ERROR([Need 'chrpath' to run test cases])
fi
AC_PATH_PROG([VALGRIND], valgrind)
if test -z $VALGRIND ;then
AC_MSG_ERROR([Need 'valgrind' to run memory leak test])
fi
AC_PATH_PROG([WC], wc)
if test -z $WC ;then
AC_MSG_ERROR([Need 'wc' to run test cases])
fi
dnl ==========================================================================
dnl Check for python2 as it is needed for the base cmd line function
dnl ==========================================================================
AC_PATH_PROGS(PYTHON, python2.7 python2.6 python, [Python is required])
AC_MSG_CHECKING([Check for Python major version])
PYTHON_MAJOR_VERSION=`$PYTHON -c "import sys; print(sys.version_info[[0]])"`
case "$PYTHON_MAJOR_VERSION" in
2)
;;
*)
AC_MSG_ERROR(
[we need Python version 2.x but found $PYTHON_MAJOR_VERSION.x]) ;;
esac
AC_MSG_RESULT([$PYTHON_MAJOR_VERSION])
AM_PATH_PYTHON([2.6], [], AC_MSG_ERROR([Python interpreter 2.6 or 2.7 required]) )
AC_PYTHON_MODULE([pywbem], [Required])
AC_PYTHON_MODULE([M2Crypto], [Required])
AC_PYTHON_MODULE([argparse], [Required])
PKG_CHECK_MODULES([LIBUDEV], [libudev])
PKG_CHECK_MODULES([PYTHON2], [python2], [], [not_found_py_pkg=yes])
if test "x$not_found_py_pkg" == "xyes"; then
AC_CHECK_PROG([PY_CONFIG_CHECK], [python-config], [yes])
if test "x${PY_CONFIG_CHECK}" != "xyes"; then
AC_MSG_ERROR([Python2 development libraries required])
fi
PYTHON2_CFLAGS=`python-config --cflags`
PYTHON2_LIBS=`python-config --libs`
AC_SUBST(PYTHON2_CFLAGS)
AC_SUBST(PYTHON2_LIBS)
fi
dnl ==========================================================================
dnl Check for libmicrohttpd and json-c as it is needed for REST API daemon
dnl ==========================================================================
AC_ARG_WITH([rest-api],
[AS_HELP_STRING([--without-rest-api],
[Do not build the REST API daemon])],
[],
[with_rest_api=yes])
if test "x$with_rest_api" = "xyes"; then
PKG_CHECK_MODULES([LIBMICROHTTPD], [libmicrohttpd >= 0.9])
PKG_CHECK_MODULES([JSON], [json >= 0.10], [], [
PKG_CHECK_MODULES([JSON], [json-c], [], [
AC_MSG_ERROR([json-c development libraries 0.10 or later required])
])
])
fi
AM_CONDITIONAL([WITH_REST_API], [test "x$with_rest_api" = "xyes"])
dnl ==========================================================================
dnl Add option '--without-megaraid' to exclude megaraid plugin.
dnl ==========================================================================
AC_ARG_WITH([megaraid],
[AS_HELP_STRING([--without-megaraid],
[Do not build the MegaRAID plugin])],
[],
[with_megaraid=yes])
AM_CONDITIONAL([WITH_MEGARAID], [test "x$with_megaraid" = "xyes"])
dnl ==========================================================================
dnl Add option '--without-hpsa' to exclude hpsa plugin.
dnl ==========================================================================
AC_ARG_WITH([hpsa],
[AS_HELP_STRING([--without-hpsa],
[Do not build the HP SmartArray plugin])],
[],
[with_hpsa=yes])
AM_CONDITIONAL([WITH_HPSA], [test "x$with_hpsa" = "xyes"])
dnl ==========================================================================
dnl Check for libconfig as it is needed for lsmd daemon
dnl ==========================================================================
PKG_CHECK_MODULES(
[LIBCONFIG], [libconfig >= 1.3.2],,
AC_MSG_ERROR([libconfig 1.3.2 or newer not found.])
)
dnl ==========================================================================
dnl Add option '--without-bash-completion' to exclude bash completion script.
dnl ==========================================================================
AC_ARG_WITH([bash-completion],
[AS_HELP_STRING([--without-bash-completion],
[Do not install the bash auto-completion script])],
[],
[with_bash_completion=yes])
AM_CONDITIONAL(
[WITH_BASH_COMPLETION], [test "x$with_bash_completion" = "xyes"])
dnl ==========================================================================
dnl Add option '--with-bash-completion-dir' to specific bash completion dir,
dnl if not defined, if pkg-config file for bash-completion found, use its
dnl 'completionsdir', else use /etc/bash_completion.d
dnl ==========================================================================
AC_ARG_WITH([bash-completion-dir],
AS_HELP_STRING(
[--with-bash-completion-dir=DIR],
[Bash completions directory]),
[],
[AS_IF(
[$($PKG_CONFIG --exists bash-completion)],
[with_bash_completion_dir=$(
$PKG_CONFIG --variable=completionsdir bash-completion)],
# EPEL 6 is still shipping bash-completion version 1.x
# which does not provide pkg-config support.
# So, for EPEL 6 or anyone not installed bash-compeltion, we
# use fallback folder '/etc/bash_completion.d'
[with_bash_completion_dir=$sysconfdir/bash_completion.d])])
AC_SUBST([bashcompletiondir], [$with_bash_completion_dir])
#Setup the unit directory for systemd stuff
PKG_PROG_PKG_CONFIG
AC_ARG_WITH([systemdsystemunitdir],
AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
[], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
if test "x$with_systemdsystemunitdir" != xno; then
AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
fi
AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ])
AC_OUTPUT(libstoragemgmt.pc \
Makefile \
c_binding/Makefile \
c_binding/include/Makefile \
c_binding/include/libstoragemgmt/Makefile \
c_binding/include/libstoragemgmt/libstoragemgmt_version.h \
python_binding/Makefile \
python_binding/lsm/version.py \
plugin/Makefile \
plugin/simc/Makefile \
plugin/megaraid/Makefile \
plugin/hpsa/Makefile \
daemon/Makefile \
config/Makefile \
doc/Makefile \
doc/man/lsmcli.1 \
doc/man/lsmd.1 \
doc/man/sim_lsmplugin.1 \
doc/man/simc_lsmplugin.1 \
doc/man/smispy_lsmplugin.1 \
doc/man/ontap_lsmplugin.1 \
doc/man/targetd_lsmplugin.1 \
doc/man/nstor_lsmplugin.1 \
doc/doxygen.conf \
doc/man/lsmd.conf.5 \
doc/man/megaraid_lsmplugin.1 \
doc/man/hpsa_lsmplugin.1 \
tools/Makefile \
tools/udev/Makefile \
tools/lsmcli/Makefile \
tools/utility/Makefile \
tools/bash_completion/Makefile \
packaging/Makefile \
packaging/daemon/Makefile \
packaging/libstoragemgmt.spec \
doc/man/Makefile \
test/runtests.sh \
test/Makefile)
chmod +x test/runtests.sh