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 .gitarchivever]),
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 dnl Fix default variables - "prefix" variable if not specified
29 if test "$prefix" = "NONE"; then
32 dnl Fix "localstatedir" variable if not specified
33 if test "$localstatedir" = "\${prefix}/var"; then
36 dnl Fix "sysconfdir" variable if not specified
37 if test "$sysconfdir" = "\${prefix}/etc"; then
40 dnl Fix "libdir" variable if not specified
41 if test "$libdir" = "\${exec_prefix}/lib"; then
42 if test -e /usr/lib64; then
50 if test "$srcdir" = "."; then
51 AC_MSG_NOTICE([building in place srcdir:$srcdir])
52 AC_DEFINE([BUILDING_IN_PLACE], 1, [building in place])
54 AC_MSG_NOTICE([building out of tree srcdir:$srcdir])
57 # Checks for programs.
59 # check stolen from gnulib/m4/gnu-make.m4
60 if ! ${MAKE-make} --version /cannot/make/this >/dev/null 2>&1; then
61 AC_MSG_ERROR([you don't seem to have GNU make; it is required])
70 if test "x$ac_cv_prog_cc_c99" = "xno"; then
71 AC_MSG_ERROR(["C99 support is required"])
77 AC_PATH_PROG([BASHPATH], [bash])
78 AC_CHECK_PROGS([GROFF], [groff])
80 # Checks for typedefs.
93 # Checks for libraries.
94 PKG_CHECK_MODULES([nss],[nss])
95 PKG_CHECK_MODULES([qb], [libqb])
96 PKG_CHECK_MODULES([corosync_common], [libcorosync_common])
97 PKG_CHECK_MODULES([cmap], [libcmap])
98 PKG_CHECK_MODULES([votequorum], [libvotequorum])
100 AC_CONFIG_FILES([Makefile
106 # ===============================================
108 # ===============================================
110 ## helper for CC stuff
113 CPPFLAGS="$CPPFLAGS $@ $unknown_warnings_as_errors"
114 AC_MSG_CHECKING([whether $CC supports "$@"])
115 AC_PREPROC_IFELSE([AC_LANG_PROGRAM([])],
116 [RC=0; AC_MSG_RESULT([yes])],
117 [RC=1; AC_MSG_RESULT([no])])
126 AC_ARG_ENABLE([fatal-warnings],
127 [ --enable-fatal-warnings : enable fatal warnings. ],
130 AC_ARG_ENABLE([debug],
131 [ --enable-debug : enable debug build. ],
134 AC_ARG_ENABLE([secure-build],
135 [ --enable-secure-build : enable PIE/RELRO build. ],
137 [enable_secure_build="yes"])
139 AC_ARG_ENABLE([systemd],
140 [ --enable-systemd : Build with libsystemd and install systemd service files],,
141 [ enable_systemd="no" ])
142 AM_CONDITIONAL(INSTALL_SYSTEMD, test x$enable_systemd = xyes)
144 AC_ARG_WITH([initconfigdir],
145 [AS_HELP_STRING([--with-initconfigdir=DIR],
146 [configuration directory @<:@SYSCONFDIR/sysconfig@:>@])],
147 [INITCONFIGDIR="$withval"],
148 [INITCONFIGDIR='${sysconfdir}/sysconfig'])
149 AC_SUBST([INITCONFIGDIR])
151 AC_ARG_WITH([initddir],
152 [ --with-initddir=DIR : path to init script directory. ],
153 [ INITDDIR="$withval" ],
154 [ INITDDIR="$sysconfdir/init.d" ])
156 AC_ARG_WITH([systemddir],
157 [ --with-systemddir=DIR : path to systemd unit files directory. ],
158 [ SYSTEMDDIR="$withval" ],
159 [ SYSTEMDDIR="/lib/systemd/system" ])
161 AC_ARG_ENABLE([qdevices],
162 [ --disable-qdevices : Quorum devices support ],,
163 [ enable_qdevices="yes" ])
164 AM_CONDITIONAL(BUILD_QDEVICES, test x$enable_qdevices = xyes)
165 AC_ARG_ENABLE([qnetd],
166 [ --disable-qnetd : Quorum Net Daemon support ],,
167 [ enable_qnetd="yes" ])
168 AM_CONDITIONAL(BUILD_QNETD, test x$enable_qnetd = xyes)
169 AC_ARG_ENABLE([runautogen],
170 [ --enable-runautogen : run autogen.sh (RPM specfile)],,
171 [ enable_runautogen="no" ])
172 AM_CONDITIONAL([BUILD_RUNAUTOGEN], [test x$enable_runautogen = xyes])
174 # *FLAGS handling goes here
177 ENV_CPPFLAGS="$CPPFLAGS"
178 ENV_LDFLAGS="$LDFLAGS"
181 if test "x${enable_debug}" = xyes; then
182 AC_DEFINE_UNQUOTED([DEBUG], [1], [Compiling Debugging code])
184 PACKAGE_FEATURES="$PACKAGE_FEATURES debug"
190 if test "x${GCC}" = xyes; then
196 if test "x${enable_systemd}" = xyes; then
197 PKG_CHECK_MODULES([libsystemd], [libsystemd])
198 AC_DEFINE([HAVE_LIBSYSTEMD], [1], [have systemd interface library])
199 PACKAGE_FEATURES="$PACKAGE_FEATURES systemd"
201 if test "x${enable_qdevices}" = xyes; then
202 PACKAGE_FEATURES="$PACKAGE_FEATURES qdevices"
204 if test "x${enable_qnetd}" = xyes; then
205 PACKAGE_FEATURES="$PACKAGE_FEATURES qnetd"
217 declaration-after-statement
222 missing-format-attribute
232 for j in $WARNLIST; do
233 if cc_supports_flag -W$j; then
234 EXTRA_WARNINGS="$EXTRA_WARNINGS -W$j";
238 if test "x${enable_fatal_warnings}" = xyes && \
239 cc_supports_flag -Werror ; then
240 AC_MSG_NOTICE([Enabling Fatal Warnings (-Werror)])
241 WERROR_CFLAGS="-Werror"
242 PACKAGE_FEATURES="$PACKAGE_FEATURES fatal-warnings"
247 if test "x${enable_secure_build}" = xyes; then
248 # stolen from apache configure snippet
249 AC_CACHE_CHECK([whether $CC accepts PIE flags], [ap_cv_cc_pie], [
251 save_LDFLAGS=$LDFLAGS
252 CFLAGS="$CFLAGS -fPIE"
253 LDFLAGS="$LDFLAGS -pie"
254 AC_TRY_RUN([static int foo[30000]; int main () { return 0; }],
255 [ap_cv_cc_pie=yes], [ap_cv_cc_pie=no], [ap_cv_cc_pie=yes])
257 LDFLAGS=$save_LDFLAGS
259 if test "$ap_cv_cc_pie" = "yes"; then
260 SEC_FLAGS="$SEC_FLAGS -fPIE"
261 SEC_LDFLAGS="$SEC_LDFLAGS -pie"
262 PACKAGE_FEATURES="$PACKAGE_FEATURES pie"
266 AC_CACHE_CHECK([whether $CC accepts RELRO flags], [ap_cv_cc_relro], [
267 save_LDFLAGS=$LDFLAGS
268 LDFLAGS="$LDFLAGS -Wl,-z,relro"
269 AC_TRY_RUN([static int foo[30000]; int main () { return 0; }],
270 [ap_cv_cc_relro=yes], [ap_cv_cc_relro=no], [ap_cv_cc_relro=yes])
271 LDFLAGS=$save_LDFLAGS
273 if test "$ap_cv_cc_relro" = "yes"; then
274 SEC_LDFLAGS="$SEC_LDFLAGS -Wl,-z,relro"
275 PACKAGE_FEATURES="$PACKAGE_FEATURES relro"
278 AC_CACHE_CHECK([whether $CC accepts BINDNOW flags], [ap_cv_cc_bindnow], [
279 save_LDFLAGS=$LDFLAGS
280 LDFLAGS="$LDFLAGS -Wl,-z,now"
281 AC_TRY_RUN([static int foo[30000]; int main () { return 0; }],
282 [ap_cv_cc_bindnow=yes], [ap_cv_cc_bindnow=no], [ap_cv_cc_bindnow=yes])
283 LDFLAGS=$save_LDFLAGS
285 if test "$ap_cv_cc_bindnow" = "yes"; then
286 SEC_LDFLAGS="$SEC_LDFLAGS -Wl,-z,now"
287 PACKAGE_FEATURES="$PACKAGE_FEATURES bindnow"
291 AC_CACHE_CHECK([whether $CC accepts "--as-needed"], [ap_cv_cc_as_needed], [
292 save_LDFLAGS=$LDFLAGS
293 LDFLAGS="$LDFLAGS -Wl,--as-needed"
294 AC_TRY_RUN([static int foo[30000]; int main () { return 0; }],
295 [ap_cv_cc_as_needed=yes], [ap_cv_cc_as_needed=no], [ap_cv_cc_as_needed=yes])
296 LDFLAGS=$save_LDFLAGS
299 # define global include dirs
300 INCLUDE_DIRS="$INCLUDE_DIRS -I\$(top_builddir)/include -I\$(top_srcdir)/include"
302 # final build of *FLAGS
303 CFLAGS="$ENV_CFLAGS $lt_prog_compiler_pic $SEC_FLAGS $OPT_CFLAGS $GDB_FLAGS \
306 CPPFLAGS="$ENV_CPPFLAGS $INCLUDE_DIRS"
307 LDFLAGS="$ENV_LDFLAGS $lt_prog_compiler_pic $SEC_LDFLAGS"
309 if test "$ap_cv_cc_as_needed" = "yes"; then
310 LDFLAGS="$LDFLAGS -Wl,--as-needed"
313 # substitute what we need:
316 AC_SUBST([SYSTEMDDIR])
318 AC_SUBST([LOGROTATEDIR])
325 AC_SUBST([NSS_LDFLAGS])
327 AM_CONDITIONAL(BUILD_HTML_DOCS, test -n "${GROFF}")
329 AC_DEFINE_UNQUOTED([LOCALSTATEDIR], "$(eval echo ${localstatedir})", [localstate directory])
331 COROSYSCONFDIR=${sysconfdir}/corosync
332 AC_SUBST([COROSYSCONFDIR])
333 AC_DEFINE_UNQUOTED([COROSYSCONFDIR], "$(eval echo ${COROSYSCONFDIR})", [corosync-qdevice config directory])
335 AC_DEFINE_UNQUOTED([PACKAGE_FEATURES], "${PACKAGE_FEATURES}", [corosync-qdevice built-in features])
340 AC_MSG_RESULT([$PACKAGE configuration:])
341 AC_MSG_RESULT([ Version = ${VERSION}])
342 AC_MSG_RESULT([ Prefix = ${prefix}])
343 AC_MSG_RESULT([ Executables = ${sbindir}])
344 AC_MSG_RESULT([ Man pages = ${mandir}])
345 AC_MSG_RESULT([ Doc dir = ${docdir}])
346 AC_MSG_RESULT([ Libraries = ${libdir}])
347 AC_MSG_RESULT([ Header files = ${includedir}])
348 AC_MSG_RESULT([ Arch-independent files = ${datadir}])
349 AC_MSG_RESULT([ State information = ${localstatedir}])
350 AC_MSG_RESULT([ System configuration = ${sysconfdir}])
351 AC_MSG_RESULT([ System init.d directory = ${INITDDIR}])
352 AC_MSG_RESULT([ System systemd directory = ${SYSTEMDDIR}])
353 AC_MSG_RESULT([ Log directory = ${LOGDIR}])
354 AC_MSG_RESULT([ Log rotate directory = ${LOGROTATEDIR}])
355 AC_MSG_RESULT([ corosync config dir = ${COROSYSCONFDIR}])
356 AC_MSG_RESULT([ init config directory = ${INITCONFIGDIR}])
357 AC_MSG_RESULT([ Features = ${PACKAGE_FEATURES}])
359 AC_MSG_RESULT([$PACKAGE build info:])
360 AC_MSG_RESULT([ Default optimization = ${OPT_CFLAGS}])
361 AC_MSG_RESULT([ Default debug options = ${GDB_CFLAGS}])
362 AC_MSG_RESULT([ Extra compiler warnings = ${EXTRA_WARNING}])
363 AC_MSG_RESULT([ Env. defined CFLAG = ${ENV_CFLAGS}])
364 AC_MSG_RESULT([ Env. defined CPPFLAGS = ${ENV_CPPFLAGS}])
365 AC_MSG_RESULT([ Env. defined LDFLAGS = ${ENV_LDFLAGS}])
366 AC_MSG_RESULT([ Fatal War. CFLAGS = ${WERROR_CFLAGS}])
367 AC_MSG_RESULT([ Final CFLAGS = ${CFLAGS}])
368 AC_MSG_RESULT([ Final CPPFLAGS = ${CPPFLAGS}])
369 AC_MSG_RESULT([ Final LDFLAGS = ${LDFLAGS}])