dnl Process this file with autoconf to produce a configure script.
m4_define([up_major_version], [0])
m4_define([up_minor_version], [99])
m4_define([up_micro_version], [7])
m4_define([up_version],
[up_major_version.up_minor_version.up_micro_version])
AC_PREREQ(2.63)
AC_INIT([upower],
[up_version],
[https://bugs.freedesktop.org/enter_bug.cgi?product=upower],
[upower],
[http://upower.freedesktop.org/])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_SRCDIR([src])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE([1.11 -Wno-portability no-dist-gzip dist-xz tar-ustar])
AM_MAINTAINER_MODE([enable])
# enable nice build output on automake1.11
AM_SILENT_RULES([yes])
GOBJECT_INTROSPECTION_CHECK([0.9.9])
# use this in up-version.h
UP_MAJOR_VERSION=up_major_version
UP_MINOR_VERSION=up_minor_version
UP_MICRO_VERSION=up_micro_version
AC_SUBST(VERSION)
AC_SUBST(UP_MAJOR_VERSION)
AC_SUBST(UP_MINOR_VERSION)
AC_SUBST(UP_MICRO_VERSION)
# libtool versioning - this applies to libupower-glib
#
# See http://sources.redhat.com/autobook/autobook/autobook_91.html#SEC91 for details
#
# increment;
# CURRENT If the API or ABI interface has changed (reset REVISION to 0)
# REVISION If the API and ABI remains the same, but bugs are fixed.
# AGE Don't use.
LT_CURRENT=3
LT_REVISION=1
LT_AGE=0
AC_SUBST(LT_CURRENT)
AC_SUBST(LT_REVISION)
AC_SUBST(LT_AGE)
# Check for programs
AC_PROG_CC
AM_PROG_CC_C_O
AC_HEADER_STDC
AC_PROG_MAKE_SET
AC_PROG_LN_S
AC_SYS_LARGEFILE
# Initialize libtool
LT_INIT
# Build deprecated functionality
AC_ARG_ENABLE(deprecated, [ --enable-deprecated build deprecated functionality],
enable_deprecated=$enableval,
enable_deprecated=no)
if test "${enable_deprecated}" != no; then
AC_DEFINE(ENABLE_DEPRECATED, 1, [Define if we should build deprecated functionalty])
fi
AM_CONDITIONAL(ENABLE_DEPRECATED, test x$enable_deprecated = xyes)
# Build man pages?
AC_ARG_ENABLE(man-pages, [ --enable-man-pages build manual pages],enable_man_pages=$enableval,enable_man_pages=yes)
if test "${enable_man_page}" != no; then
AC_PATH_PROG([XSLTPROC], [xsltproc])
if test -z "$XSLTPROC"; then
enable_man_pages=no
fi
fi
AM_CONDITIONAL(MAN_PAGES_ENABLED, test x$enable_man_pages = xyes)
GTK_DOC_CHECK([1.11],[--flavour no-tmpl])
AC_ARG_WITH([udevrulesdir],
AS_HELP_STRING([--with-udevrulesdir=DIR], [Directory for udev rules]),
[],
[with_udevrulesdir=$($PKG_CONFIG --variable=udevdir udev)"/rules.d"])
AC_SUBST([udevrulesdir], [$with_udevrulesdir])
# History/Db dir
AC_ARG_WITH([historydir],
AS_HELP_STRING([--with-historydir=
], [directory where the upower history files will be stored]))
if test "$with_historydir" != "no" -a "$with_historydir" != "" ; then
historydir=$withval
else
historydir=${localstatedir}/lib/upower
fi
AC_SUBST(historydir)
#### gcc warning flags
dnl ---------------------------------------------------------------------------
dnl - Extra verbose warning switches
dnl ---------------------------------------------------------------------------
CPPFLAGS="$CPPFLAGS -DG_DISABLE_SINGLE_INCLUDES -DGTK_DISABLE_SINGLE_INCLUDES"
CPPFLAGS="$CPPFLAGS -DG_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED"
CPPFLAGS="$CPPFLAGS -DGDK_MULTIHEAD_SAFE -DGTK_MULTIHEAD_SAFE"
CPPFLAGS="$CPPFLAGS -DGSEAL_ENABLE"
if test "$GCC" = "yes"; then
WARNINGFLAGS_C="$WARNINGFLAGS_C -Wall"
WARNINGFLAGS_C="$WARNINGFLAGS_C -Wcast-align -Wno-uninitialized"
WARNINGFLAGS_C="$WARNINGFLAGS_C -Wmissing-declarations"
# WARNINGFLAGS_C="$WARNINGFLAGS_C -Wredundant-decls"
WARNINGFLAGS_C="$WARNINGFLAGS_C -Wpointer-arith"
WARNINGFLAGS_C="$WARNINGFLAGS_C -Wcast-align"
WARNINGFLAGS_C="$WARNINGFLAGS_C -Wwrite-strings"
WARNINGFLAGS_C="$WARNINGFLAGS_C -Winit-self"
WARNINGFLAGS_C="$WARNINGFLAGS_C -Wreturn-type"
WARNINGFLAGS_C="$WARNINGFLAGS_C -Wformat-nonliteral"
WARNINGFLAGS_C="$WARNINGFLAGS_C -Wformat-security"
# WARNINGFLAGS_C="$WARNINGFLAGS_C -Wmissing-include-dirs"
WARNINGFLAGS_C="$WARNINGFLAGS_C -Wmissing-format-attribute"
# WARNINGFLAGS_C="$WARNINGFLAGS_C -Wclobbered"
# WARNINGFLAGS_C="$WARNINGFLAGS_C -Wempty-body"
# WARNINGFLAGS_C="$WARNINGFLAGS_C -Wignored-qualifiers"
WARNINGFLAGS_C="$WARNINGFLAGS_C -Wsign-compare"
# WARNINGFLAGS_C="$WARNINGFLAGS_C -Wtype-limits"
WARNINGFLAGS_C="$WARNINGFLAGS_C -O -Wuninitialized"
WARNINGFLAGS_C="$WARNINGFLAGS_C -Waggregate-return"
WARNINGFLAGS_C="$WARNINGFLAGS_C -Wdeclaration-after-statement"
# WARNINGFLAGS_C="$WARNINGFLAGS_C -Wshadow"
WARNINGFLAGS_C="$WARNINGFLAGS_C -Wno-strict-aliasing"
# WARNINGFLAGS_C="$WARNINGFLAGS_C -Winline"
# WARNINGFLAGS_C="$WARNINGFLAGS_C -Wmissing-parameter-type"
# WARNINGFLAGS_C="$WARNINGFLAGS_C -Woverride-init"
else
WARNINGFLAGS_C=""
fi
AC_SUBST(WARNINGFLAGS_C)
# check for PIE (position independent executable) support
AX_CHECK_COMPILE_FLAG([-fPIE],
[AX_CHECK_LINK_FLAG([-fPIE -pie],
[PIE_CFLAGS="-fPIE" PIE_LDFLAGS="-pie"])])
AC_SUBST(PIE_CFLAGS)
AC_SUBST(PIE_LDFLAGS)
# check for full RELRO (relocation read-only) support
AX_CHECK_LINK_FLAG([-Wl,-z,relro,-z,now],
[RELRO_LDFLAGS="-Wl,-z,relro,-z,now"])
AC_SUBST([RELRO_LDFLAGS])
PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.34.0 gobject-2.0])
PKG_CHECK_MODULES(GIO, [gio-2.0 >= 2.16.1])
PKG_CHECK_MODULES(GIO_UNIX, [gio-unix-2.0])
dnl ====================================================================
dnl Check for systemd
dnl ====================================================================
AC_ARG_WITH([systemdutildir],
AS_HELP_STRING([--with-systemdutildir=DIR], [Directory for systemd utilities]),
[],
[with_systemdutildir=$($PKG_CONFIG --variable=systemdutildir systemd)])
if test x$with_systemdutildir != xno; then
AC_SUBST([systemdutildir], [$with_systemdutildir])
fi
AM_CONDITIONAL(HAVE_SYSTEMDUTILDIR, [test -n "$systemdutildir"])
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_SYSTEMDSYSTEMUNITDIR, [test -n "$systemdsystemunitdir"])
dnl ---------------------------------------------------------------------------
dnl - Compile time default choice of backend
dnl ---------------------------------------------------------------------------
AC_ARG_WITH([backend],
AS_HELP_STRING([--with-backend=