1 AC_INIT([AccountsService],[0.6.22])
2 AM_INIT_AUTOMAKE(no-dist-gzip dist-xz tar-ustar foreign)
4 GETTEXT_PACKAGE=accounts-service
5 AC_SUBST(GETTEXT_PACKAGE)
6 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",
7 [the gettext translation domain])
9 # Support silent build rules, requires at least automake-1.11. Enable
10 # by either passing --enable-silent-rules to configure or passing V=0
12 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([no])])
14 AC_USE_SYSTEM_EXTENSIONS
18 IT_PROG_INTLTOOL([0.40.0])
28 PKG_CHECK_MODULES(GLIB, glib-2.0)
29 PKG_CHECK_MODULES(GIO, gio-2.0 gio-unix-2.0)
30 PKG_CHECK_MODULES(POLKIT, polkit-gobject-1)
32 AM_MAINTAINER_MODE([enable])
34 # client library dependencies
35 LIBACCOUNTSSERVICE_LIBS="$GLIB_LIBS $GIO_LIBS"
36 AC_SUBST(LIBACCOUNTSSERVICE_LIBS)
37 LIBACCOUNTSSERVICE_CFLAGS="$GLIB_CFLAGS $GIO_CFLAGS"
38 AC_SUBST(LIBACCOUNTSSERVICE_CFLAGS)
40 GOBJECT_INTROSPECTION_CHECK([0.9.12])
41 LIBACCOUNTSSERVICE_GIR_INCLUDES="GLib-2.0 GObject-2.0"
42 AC_SUBST(LIBACCOUNTSSERVICE_GIR_INCLUDES)
46 AC_ARG_ENABLE(more-warnings,
47 AS_HELP_STRING([--enable-more-warnings],
48 [Maximum compiler warnings]),
49 set_more_warnings="$enableval",[
50 if test -d $srcdir/.git; then
56 AC_MSG_CHECKING(for more warnings)
57 if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
61 -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes \
62 -Wwrite-strings -Wnested-externs -Wpointer-arith \
63 -Wswitch-enum -Wstrict-aliasing=2 -Winit-self -Wunsafe-loop-optimizations \
64 -Wno-missing-field-initializers -Wno-unused-parameter \
65 -Wcast-align -Wsign-compare"
66 elif test "$GCC" = "yes"; then
68 MAYBE_WARN="-Wall -Wno-sign-compare -Wno-deprecated-declarations"
73 # invalidate cached value if MAYBE_WARN has changed
74 if test "x$accountsservice_cv_warn_maybe" != "x$MAYBE_WARN"; then
75 unset accountsservice_cv_warn_cflags
78 AC_DEFUN([ACCOUNTSSERVICE_CC_TRY_FLAG], [
79 AC_MSG_CHECKING([whether $CC supports $1])
81 accountsservice_save_CFLAGS="$CFLAGS"
84 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
85 [accountsservice_cc_flag=yes],
86 [accountsservice_cc_flag=no])
87 CFLAGS="$accountsservice_save_CFLAGS"
89 if test "x$accountsservice_cc_flag" = "xyes"; then
90 ifelse([$2], , :, [$2])
92 ifelse([$3], , :, [$3])
94 AC_MSG_RESULT([$accountsservice_cc_flag])
97 AC_CACHE_CHECK([for supported warning flags], accountsservice_cv_warn_cflags, [
101 # Some warning options are not supported by all versions of
102 # gcc, so test all desired options against the current
105 # Note that there are some order dependencies
106 # here. Specifically, an option that disables a warning will
107 # have no net effect if a later option then enables that
108 # warnings, (perhaps implicitly). So we put some grouped
109 # options (-Wall and -Wextra) up front and the -Wno options
112 for W in $MAYBE_WARN; do
113 ACCOUNTSSERVICE_CC_TRY_FLAG([$W], [WARN_CFLAGS="$WARN_CFLAGS $W"])
116 accountsservice_cv_warn_cflags=$WARN_CFLAGS
117 accountsservice_cv_warn_maybe=$MAYBE_WARN
119 AC_MSG_CHECKING([which warning flags were supported])
122 WARN_CFLAGS="$accountsservice_cv_warn_cflags"
124 if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
125 # Only add this when optimizing is enabled (default)
126 AC_MSG_CHECKING([whether optimization is enabled])
127 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if __OPTIMIZE__ == 0
128 #error No optimization
131 [has_optimization=yes],
132 [has_optimization=no])
133 if test $has_optimization = yes; then
134 WARN_CFLAGS="$WARN_CFLAGS -Wp,-D_FORTIFY_SOURCE=2"
136 AC_MSG_RESULT($has_optimization)
139 AC_SUBST(WARN_CFLAGS)
141 AC_CHECK_HEADERS([shadow.h utmpx.h])
143 dnl ---------------------------------------------------------------------------
144 dnl - DocBook Documentation
145 dnl ---------------------------------------------------------------------------
147 AC_ARG_ENABLE(docbook-docs,
148 [AS_HELP_STRING([--enable-docbook-docs],[build documentation (requires xmlto)])],
149 enable_docbook_docs=$enableval,enable_docbook_docs=no)
150 AC_PATH_PROG(XMLTO, xmlto, no)
151 AC_MSG_CHECKING([whether to build DocBook documentation])
152 if test x$XMLTO = xno ; then
157 if test x$enable_docbook_docs = xauto ; then
158 if test x$have_docbook = xno ; then
159 enable_docbook_docs=no
161 enable_docbook_docs=yes
164 if test x$enable_docbook_docs = xyes; then
165 if test x$have_docbook = xno; then
166 AC_MSG_ERROR([Building DocBook docs explicitly required, but DocBook not found])
169 AM_CONDITIONAL(DOCBOOK_DOCS_ENABLED, test x$enable_docbook_docs = xyes)
171 AC_ARG_VAR([XMLTO],[Define/override the 'xmlto' location.])
172 AC_ARG_VAR([XMLTO_FLAGS],[Define/override 'xmlto' options, like '--skip-validation'.])
174 dnl ---------------------------------------------------------------------------
175 dnl Check for xsltproc
176 dnl ---------------------------------------------------------------------------
177 AC_PATH_PROG([XSLTPROC], [xsltproc])
181 AC_ARG_ENABLE([systemd],
182 AS_HELP_STRING([--enable-systemd], [Use systemd]),
183 [enable_systemd=$enableval],
184 [enable_systemd=auto])
186 if test x$enable_systemd != xno; then
187 PKG_CHECK_MODULES(SYSTEMD, [libsystemd-login >= 43 libsystemd-daemon],
188 [have_systemd=yes], [have_systemd=no])
193 AC_MSG_CHECKING([whether to use systemd])
195 if test x$enable_systemd = xauto ; then
196 if test x$have_systemd = xno ; then
203 AC_MSG_RESULT($enable_systemd)
205 if test x$enable_systemd = xyes; then
206 if test x$have_systemd = xno; then
207 AC_MSG_ERROR([Systemd support explicitly required, but systemd not found])
209 AC_DEFINE(HAVE_SYSTEMD, 1, [Define if systemd is used])
211 AC_SUBST(SYSTEMD_CFLAGS)
212 AC_SUBST(SYSTEMD_LIBS)
214 LIBACCOUNTSSERVICE_LIBS="$LIBACCOUNTSSERVICE_LIBS $SYSTEMD_LIBS"
215 LIBACCOUNTSSERVICE_CFLAGS="$LIBACCOUNTSSERVICE_CFLAGS $SYSTEMD_CFLAGS"
217 if test "x$have_systemd" != "xno" ; then
218 AC_DEFINE(WITH_SYSTEMD, 1, [Define to enable systemd support])
221 AC_ARG_WITH([systemdsystemunitdir],
222 AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
224 [with_systemdsystemunitdir=$have_systemd])
225 if test "x$with_systemdsystemunitdir" = "xyes"; then
226 with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
228 if test "x$with_systemdsystemunitdir" != "xno"; then
229 AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
231 AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != "xno" ])
233 AC_CONFIG_HEADERS([config.h])
239 src/libaccountsservice/Makefile
240 src/libaccountsservice/accountsservice.pc
243 doc/dbus/AccountsService.xml
248 AC_MSG_NOTICE([accountsservice was configured with the following options:])
249 if test "x$enable_docbook_docs" = "xyes"; then
250 AC_MSG_NOTICE([** DocBook documentation build enabled])
252 AC_MSG_NOTICE([** DocBook documentation build disabled])