2 # Process this file with autoconf to produce a configure script.
7 AC_INIT([corosync-qdevice],
8 m4_esyscmd([build-aux/git-version-gen .tarball-version]),
9 [users@clusterlabs.org])
11 AC_USE_SYSTEM_EXTENSIONS
13 AM_INIT_AUTOMAKE([foreign 1.11])
18 AM_SILENT_RULES([yes])
20 AC_CONFIG_SRCDIR([qdevices/corosync-qdevice.c])
21 AC_CONFIG_HEADER([config.h])
22 AC_CONFIG_MACRO_DIR([m4])
28 AC_SUBST(WITH_LIST, [""])
30 dnl Fix default variables - "prefix" variable if not specified
31 if test "$prefix" = "NONE"; then
34 dnl Fix "localstatedir" variable if not specified
35 if test "$localstatedir" = "\${prefix}/var"; then
38 dnl Fix "sysconfdir" variable if not specified
39 if test "$sysconfdir" = "\${prefix}/etc"; then
42 dnl Fix "libdir" variable if not specified
43 if test "$libdir" = "\${exec_prefix}/lib"; then
44 if test -e /usr/lib64; then
52 if test "$srcdir" = "."; then
53 AC_MSG_NOTICE([building in place srcdir:$srcdir])
54 AC_DEFINE([BUILDING_IN_PLACE], 1, [building in place])
56 AC_MSG_NOTICE([building out of tree srcdir:$srcdir])
59 # Checks for programs.
61 # check stolen from gnulib/m4/gnu-make.m4
62 if ! ${MAKE-make} --version /cannot/make/this >/dev/null 2>&1; then
63 AC_MSG_ERROR([you don't seem to have GNU make; it is required])
72 if test "x$ac_cv_prog_cc_c99" = "xno"; then
73 AC_MSG_ERROR(["C99 support is required"])
79 AC_PATH_PROG([BASHPATH], [bash])
80 AC_CHECK_PROGS([GROFF], [groff])
82 # Checks for typedefs.
95 # Checks for libraries.
96 PKG_CHECK_MODULES([nss],[nss])
97 PKG_CHECK_MODULES([qb], [libqb])
98 PKG_CHECK_MODULES([corosync_common], [libcorosync_common])
99 PKG_CHECK_MODULES([cmap], [libcmap])
100 PKG_CHECK_MODULES([votequorum], [libvotequorum])
102 AC_CONFIG_FILES([Makefile
108 # ===============================================
110 # ===============================================
112 ## helper for CC stuff
115 CPPFLAGS="$CPPFLAGS $@ $unknown_warnings_as_errors"
116 AC_MSG_CHECKING([whether $CC supports "$@"])
117 AC_PREPROC_IFELSE([AC_LANG_PROGRAM([])],
118 [RC=0; AC_MSG_RESULT([yes])],
119 [RC=1; AC_MSG_RESULT([no])])
128 AC_ARG_ENABLE([fatal-warnings],
129 [ --enable-fatal-warnings : enable fatal warnings. ],
132 AC_ARG_ENABLE([debug],
133 [ --enable-debug : enable debug build. ],
136 AC_ARG_ENABLE([secure-build],
137 [ --enable-secure-build : enable PIE/RELRO build. ],
139 [enable_secure_build="yes"])
141 AC_ARG_ENABLE([systemd],
142 [ --enable-systemd : Install systemd service files],,
143 [ enable_systemd="no" ])
144 AM_CONDITIONAL(INSTALL_SYSTEMD, test x$enable_systemd = xyes)
146 AC_ARG_WITH([initconfigdir],
147 [AS_HELP_STRING([--with-initconfigdir=DIR],
148 [configuration directory @<:@SYSCONFDIR/sysconfig@:>@])],
149 [INITCONFIGDIR="$withval"],
150 [INITCONFIGDIR='${sysconfdir}/sysconfig'])
151 AC_SUBST([INITCONFIGDIR])
153 AC_ARG_WITH([initddir],
154 [ --with-initddir=DIR : path to init script directory. ],
155 [ INITDDIR="$withval" ],
156 [ INITDDIR="$sysconfdir/init.d" ])
158 AC_ARG_WITH([systemddir],
159 [ --with-systemddir=DIR : path to systemd unit files directory. ],
160 [ SYSTEMDDIR="$withval" ],
161 [ SYSTEMDDIR="/lib/systemd/system" ])
163 AC_ARG_ENABLE([qdevices],
164 [ --disable-qdevices : Quorum devices support ],,
165 [ enable_qdevices="yes" ])
166 AM_CONDITIONAL(BUILD_QDEVICES, test x$enable_qdevices = xyes)
167 AC_ARG_ENABLE([qnetd],
168 [ --disable-qnetd : Quorum Net Daemon support ],,
169 [ enable_qnetd="yes" ])
170 AM_CONDITIONAL(BUILD_QNETD, test x$enable_qnetd = xyes)
172 # *FLAGS handling goes here
175 ENV_CPPFLAGS="$CPPFLAGS"
176 ENV_LDFLAGS="$LDFLAGS"
179 if test "x${enable_debug}" = xyes; then
180 AC_DEFINE_UNQUOTED([DEBUG], [1], [Compiling Debugging code])
182 PACKAGE_FEATURES="$PACKAGE_FEATURES debug"
188 if test "x${GCC}" = xyes; then
194 if test "x${enable_systemd}" = xyes; then
195 PKG_CHECK_MODULES([libsystemd], [libsystemd])
196 AC_DEFINE([HAVE_LIBSYSTEMD], [1], [have systemd interface library])
197 PACKAGE_FEATURES="$PACKAGE_FEATURES systemd"
198 WITH_LIST="$WITH_LIST --with systemd"
200 if test "x${enable_qdevices}" = xyes; then
201 PACKAGE_FEATURES="$PACKAGE_FEATURES qdevices"
203 if test "x${enable_qnetd}" = xyes; then
204 PACKAGE_FEATURES="$PACKAGE_FEATURES qnetd"
216 declaration-after-statement
221 missing-format-attribute
231 for j in $WARNLIST; do
232 if cc_supports_flag -W$j; then
233 EXTRA_WARNINGS="$EXTRA_WARNINGS -W$j";
237 if test "x${enable_fatal_warnings}" = xyes && \
238 cc_supports_flag -Werror ; then
239 AC_MSG_NOTICE([Enabling Fatal Warnings (-Werror)])
240 WERROR_CFLAGS="-Werror"
241 PACKAGE_FEATURES="$PACKAGE_FEATURES fatal-warnings"
246 if test "x${enable_secure_build}" = xyes; then
247 # stolen from apache configure snippet
248 AC_CACHE_CHECK([whether $CC accepts PIE flags], [ap_cv_cc_pie], [
250 save_LDFLAGS=$LDFLAGS
251 CFLAGS="$CFLAGS -fPIE"
252 LDFLAGS="$LDFLAGS -pie"
253 AC_TRY_RUN([static int foo[30000]; int main () { return 0; }],
254 [ap_cv_cc_pie=yes], [ap_cv_cc_pie=no], [ap_cv_cc_pie=yes])
256 LDFLAGS=$save_LDFLAGS
258 if test "$ap_cv_cc_pie" = "yes"; then
259 SEC_FLAGS="$SEC_FLAGS -fPIE"
260 SEC_LDFLAGS="$SEC_LDFLAGS -pie"
261 PACKAGE_FEATURES="$PACKAGE_FEATURES pie"
265 AC_CACHE_CHECK([whether $CC accepts RELRO flags], [ap_cv_cc_relro], [
266 save_LDFLAGS=$LDFLAGS
267 LDFLAGS="$LDFLAGS -Wl,-z,relro"
268 AC_TRY_RUN([static int foo[30000]; int main () { return 0; }],
269 [ap_cv_cc_relro=yes], [ap_cv_cc_relro=no], [ap_cv_cc_relro=yes])
270 LDFLAGS=$save_LDFLAGS
272 if test "$ap_cv_cc_relro" = "yes"; then
273 SEC_LDFLAGS="$SEC_LDFLAGS -Wl,-z,relro"
274 PACKAGE_FEATURES="$PACKAGE_FEATURES relro"
277 AC_CACHE_CHECK([whether $CC accepts BINDNOW flags], [ap_cv_cc_bindnow], [
278 save_LDFLAGS=$LDFLAGS
279 LDFLAGS="$LDFLAGS -Wl,-z,now"
280 AC_TRY_RUN([static int foo[30000]; int main () { return 0; }],
281 [ap_cv_cc_bindnow=yes], [ap_cv_cc_bindnow=no], [ap_cv_cc_bindnow=yes])
282 LDFLAGS=$save_LDFLAGS
284 if test "$ap_cv_cc_bindnow" = "yes"; then
285 SEC_LDFLAGS="$SEC_LDFLAGS -Wl,-z,now"
286 PACKAGE_FEATURES="$PACKAGE_FEATURES bindnow"
290 AC_CACHE_CHECK([whether $CC accepts "--as-needed"], [ap_cv_cc_as_needed], [
291 save_LDFLAGS=$LDFLAGS
292 LDFLAGS="$LDFLAGS -Wl,--as-needed"
293 AC_TRY_RUN([static int foo[30000]; int main () { return 0; }],
294 [ap_cv_cc_as_needed=yes], [ap_cv_cc_as_needed=no], [ap_cv_cc_as_needed=yes])
295 LDFLAGS=$save_LDFLAGS
298 # define global include dirs
299 INCLUDE_DIRS="$INCLUDE_DIRS -I\$(top_builddir)/include -I\$(top_srcdir)/include"
301 # final build of *FLAGS
302 CFLAGS="$ENV_CFLAGS $lt_prog_compiler_pic $SEC_FLAGS $OPT_CFLAGS $GDB_FLAGS \
305 CPPFLAGS="$ENV_CPPFLAGS $INCLUDE_DIRS"
306 LDFLAGS="$ENV_LDFLAGS $lt_prog_compiler_pic $SEC_LDFLAGS"
308 if test "$ap_cv_cc_as_needed" = "yes"; then
309 LDFLAGS="$LDFLAGS -Wl,--as-needed"
312 # substitute what we need:
315 AC_SUBST([SYSTEMDDIR])
317 AC_SUBST([LOGROTATEDIR])
324 AC_SUBST([NSS_LDFLAGS])
326 AM_CONDITIONAL(BUILD_HTML_DOCS, test -n "${GROFF}")
328 AC_DEFINE_UNQUOTED([LOCALSTATEDIR], "$(eval echo ${localstatedir})", [localstate directory])
330 COROSYSCONFDIR=${sysconfdir}/corosync
331 AC_SUBST([COROSYSCONFDIR])
332 AC_DEFINE_UNQUOTED([COROSYSCONFDIR], "$(eval echo ${COROSYSCONFDIR})", [corosync-qdevice config directory])
334 AC_DEFINE_UNQUOTED([PACKAGE_FEATURES], "${PACKAGE_FEATURES}", [corosync-qdevice built-in features])
339 AC_MSG_RESULT([$PACKAGE configuration:])
340 AC_MSG_RESULT([ Version = ${VERSION}])
341 AC_MSG_RESULT([ Prefix = ${prefix}])
342 AC_MSG_RESULT([ Executables = ${sbindir}])
343 AC_MSG_RESULT([ Man pages = ${mandir}])
344 AC_MSG_RESULT([ Doc dir = ${docdir}])
345 AC_MSG_RESULT([ Libraries = ${libdir}])
346 AC_MSG_RESULT([ Header files = ${includedir}])
347 AC_MSG_RESULT([ Arch-independent files = ${datadir}])
348 AC_MSG_RESULT([ State information = ${localstatedir}])
349 AC_MSG_RESULT([ System configuration = ${sysconfdir}])
350 AC_MSG_RESULT([ System init.d directory = ${INITDDIR}])
351 AC_MSG_RESULT([ System systemd directory = ${SYSTEMDDIR}])
352 AC_MSG_RESULT([ Log directory = ${LOGDIR}])
353 AC_MSG_RESULT([ Log rotate directory = ${LOGROTATEDIR}])
354 AC_MSG_RESULT([ corosync config dir = ${COROSYSCONFDIR}])
355 AC_MSG_RESULT([ init config directory = ${INITCONFIGDIR}])
356 AC_MSG_RESULT([ Features = ${PACKAGE_FEATURES}])
358 AC_MSG_RESULT([$PACKAGE build info:])
359 AC_MSG_RESULT([ Default optimization = ${OPT_CFLAGS}])
360 AC_MSG_RESULT([ Default debug options = ${GDB_CFLAGS}])
361 AC_MSG_RESULT([ Extra compiler warnings = ${EXTRA_WARNING}])
362 AC_MSG_RESULT([ Env. defined CFLAG = ${ENV_CFLAGS}])
363 AC_MSG_RESULT([ Env. defined CPPFLAGS = ${ENV_CPPFLAGS}])
364 AC_MSG_RESULT([ Env. defined LDFLAGS = ${ENV_LDFLAGS}])
365 AC_MSG_RESULT([ Fatal War. CFLAGS = ${WERROR_CFLAGS}])
366 AC_MSG_RESULT([ Final CFLAGS = ${CFLAGS}])
367 AC_MSG_RESULT([ Final CPPFLAGS = ${CPPFLAGS}])
368 AC_MSG_RESULT([ Final LDFLAGS = ${LDFLAGS}])