summaryrefslogtreecommitdiff
path: root/configure.ac
blob: 09dc2eb209e521421a2987e0da4ed9932070d734 (plain)
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
AC_INIT([AccountsService],[0.6.15])
AM_INIT_AUTOMAKE(no-dist-gzip dist-xz tar-ustar foreign)

GETTEXT_PACKAGE=accounts-service
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",
                   [the gettext translation domain])

# Support silent build rules, requires at least automake-1.11. Enable
# by either passing --enable-silent-rules to configure or passing V=0
# to make
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([no])])

AC_PROG_CC
PKG_PROG_PKG_CONFIG
AM_GLIB_GNU_GETTEXT
IT_PROG_INTLTOOL([0.40.0])
AC_USE_SYSTEM_EXTENSIONS

LT_INIT
LT_CURRENT=0
LT_REVISION=0
LT_AGE=0
AC_SUBST(LT_CURRENT)
AC_SUBST(LT_REVISION)
AC_SUBST(LT_AGE)

PKG_CHECK_MODULES(GLIB, glib-2.0)
PKG_CHECK_MODULES(GIO, gio-2.0 gio-unix-2.0)
PKG_CHECK_MODULES(DBUS_GLIB, dbus-glib-1)
PKG_CHECK_MODULES(POLKIT, polkit-gobject-1)

AM_MAINTAINER_MODE([enable])

# client library dependencies
LIBACCOUNTSSERVICE_LIBS="$GLIB_LIBS $DBUS_GLIB_LIBS"
AC_SUBST(LIBACCOUNTSSERVICE_LIBS)
LIBACCOUNTSSERVICE_CFLAGS="$GLIB_CFLAGS $DBUS_GLIB_CFLAGS"
AC_SUBST(LIBACCOUNTSSERVICE_CFLAGS)

GOBJECT_INTROSPECTION_CHECK([0.9.12])
LIBACCOUNTSSERVICE_GIR_INCLUDES="GLib-2.0 GObject-2.0 DBusGLib-1.0"
AC_SUBST(LIBACCOUNTSSERVICE_GIR_INCLUDES)


AC_ARG_ENABLE(more-warnings,
              AS_HELP_STRING([--enable-more-warnings],
                             [Maximum compiler warnings]),
              set_more_warnings="$enableval",[
              if test -d $srcdir/.git; then
                set_more_warnings=yes
              else
                set_more_warnings=no
              fi])

AC_MSG_CHECKING(for more warnings)
if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
  AC_MSG_RESULT(yes)
  MAYBE_WARN="\
   -Wall -Wextra  \
   -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes \
   -Wwrite-strings -Wnested-externs -Wpointer-arith \
   -Wswitch-enum -Wstrict-aliasing=2 -Winit-self -Wunsafe-loop-optimizations \
   -Wno-missing-field-initializers -Wno-unused-parameter \
   -Wcast-align -Wsign-compare -Wp,-D_FORTIFY_SOURCE=2"
elif test "$GCC" = "yes"; then
  AC_MSG_RESULT(no)
  MAYBE_WARN="-Wall -Wno-sign-compare -Wno-deprecated-declarations"
else
  AC_MSG_RESULT(no)
fi

# invalidate cached value if MAYBE_WARN has changed
if test "x$accountsservice_cv_warn_maybe" != "x$MAYBE_WARN"; then
  unset accountsservice_cv_warn_cflags
fi

AC_DEFUN([ACCOUNTSSERVICE_CC_TRY_FLAG], [
  AC_MSG_CHECKING([whether $CC supports $1])

  accountsservice_save_CFLAGS="$CFLAGS"
  CFLAGS="$CFLAGS $1"

  AC_COMPILE_IFELSE([ ], [accountsservice_cc_flag=yes], [accountsservice_cc_flag=no])
  CFLAGS="$accountsservice_save_CFLAGS"

  if test "x$accountsservice_cc_flag" = "xyes"; then
    ifelse([$2], , :, [$2])
  else
    ifelse([$3], , :, [$3])
  fi
  AC_MSG_RESULT([$accountsservice_cc_flag])
])

AC_CACHE_CHECK([for supported warning flags], accountsservice_cv_warn_cflags, [
  echo
  WARN_CFLAGS=""

  # Some warning options are not supported by all versions of
  # gcc, so test all desired options against the current
  # compiler.
  #
  # Note that there are some order dependencies
  # here. Specifically, an option that disables a warning will
  # have no net effect if a later option then enables that
  # warnings, (perhaps implicitly). So we put some grouped
  # options (-Wall and -Wextra) up front and the -Wno options
  # last.

  for W in $MAYBE_WARN; do
    ACCOUNTSSERVICE_CC_TRY_FLAG([$W], [WARN_CFLAGS="$WARN_CFLAGS $W"])
  done

  accountsservice_cv_warn_cflags=$WARN_CFLAGS
  accountsservice_cv_warn_maybe=$MAYBE_WARN

  AC_MSG_CHECKING([which warning flags were supported])
])

WARN_CFLAGS="$accountsservice_cv_warn_cflags"
AC_SUBST(WARN_CFLAGS)

AC_CHECK_HEADERS([shadow.h utmpx.h])
AC_CHECK_FUNCS([fgetpwent])

dnl ---------------------------------------------------------------------------
dnl - DocBook Documentation
dnl ---------------------------------------------------------------------------

AC_ARG_ENABLE(docbook-docs,
        [AS_HELP_STRING([--enable-docbook-docs],[build documentation (requires xmlto)])],
        enable_docbook_docs=$enableval,enable_docbook_docs=no)
AC_PATH_PROG(XMLTO, xmlto, no)
AC_MSG_CHECKING([whether to build DocBook documentation])
if test x$XMLTO = xno ; then
        have_docbook=no
else
        have_docbook=yes
fi
if test x$enable_docbook_docs = xauto ; then
        if test x$have_docbook = xno ; then
                enable_docbook_docs=no
        else
                enable_docbook_docs=yes
        fi
fi
if test x$enable_docbook_docs = xyes; then
        if test x$have_docbook = xno; then
                AC_MSG_ERROR([Building DocBook docs explicitly required, but DocBook not found])
        fi
fi
AM_CONDITIONAL(DOCBOOK_DOCS_ENABLED, test x$enable_docbook_docs = xyes)
AC_MSG_RESULT(yes)
AC_ARG_VAR([XMLTO],[Define/override the 'xmlto' location.])
AC_ARG_VAR([XMLTO_FLAGS],[Define/override 'xmlto' options, like '--skip-validation'.])

dnl ---------------------------------------------------------------------------
dnl Check for xsltproc
dnl ---------------------------------------------------------------------------
AC_PATH_PROG([XSLTPROC], [xsltproc])

# systemd

AC_ARG_WITH([systemdsystemunitdir],
        AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
        [],
        [with_systemdsystemunitdir=yes])
if test "x$with_systemdsystemunitdir" = "xyes"; then
    with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
fi
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_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([
Makefile
po/Makefile.in
data/Makefile
src/Makefile
src/libaccountsservice/Makefile
src/libaccountsservice/accountsservice.pc
doc/Makefile
doc/dbus/Makefile
doc/dbus/AccountsService.xml
])
AC_OUTPUT

echo
AC_MSG_NOTICE([accountsservice was configured with the following options:])
if test "x$enable_docbook_docs" = "xyes"; then
        AC_MSG_NOTICE([** DocBook documentation build enabled])
else
        AC_MSG_NOTICE([** DocBook documentation build disabled])
fi
echo