1 dnl Process this file with autoconf to produce a configure script.
4 AC_INIT(polkit, 0.106, http://lists.freedesktop.org/mailman/listinfo/polkit-devel)
5 AM_INIT_AUTOMAKE(polkit, 0.106)
6 AM_CONFIG_HEADER(config.h)
9 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
11 # Include external mocklibc tool for unit testing
12 AC_CONFIG_SUBDIRS([test/mocklibc])
14 # libtool versioning - this applies to all libraries in this package
16 # See http://sources.redhat.com/autobook/autobook/autobook_91.html#SEC91 for details
36 AC_ARG_ENABLE(ansi, [ --enable-ansi enable -ansi -pedantic gcc flags],enable_ansi=$enableval,enable_ansi=no)
37 AC_ARG_ENABLE(verbose-mode, [ --enable-verbose-mode support verbose debug mode],enable_verbose_mode=$enableval,enable_verbose_mode=$USE_MAINTAINER_MODE)
38 AC_ARG_ENABLE(man-pages, [ --enable-man-pages build manual pages],enable_man_pages=$enableval,enable_man_pages=yes)
40 if test "${enable_man_page}" != no; then
42 dnl Check for xsltproc
44 AC_PATH_PROG([XSLTPROC], [xsltproc])
45 if test -z "$XSLTPROC"; then
49 AM_CONDITIONAL(MAN_PAGES_ENABLED, test x$enable_man_pages = xyes)
53 #### gcc warning flags
55 if test "x$GCC" = "xyes"; then
58 *[\ \ ]-Wall[\ \ ]*) ;;
59 *) CFLAGS="$CFLAGS -Wall" ;;
63 *[\ \ ]-Wchar-subscripts[\ \ ]*) ;;
64 *) CFLAGS="$CFLAGS -Wchar-subscripts" ;;
68 *[\ \ ]-Wmissing-declarations[\ \ ]*) ;;
69 *) CFLAGS="$CFLAGS -Wmissing-declarations" ;;
73 *[\ \ ]-Wnested-externs[\ \ ]*) ;;
74 *) CFLAGS="$CFLAGS -Wnested-externs" ;;
78 *[\ \ ]-Wpointer-arith[\ \ ]*) ;;
79 *) CFLAGS="$CFLAGS -Wpointer-arith" ;;
83 *[\ \ ]-Wcast-align[\ \ ]*) ;;
84 *) CFLAGS="$CFLAGS -Wcast-align" ;;
88 *[\ \ ]-Wsign-compare[\ \ ]*) ;;
89 *) CFLAGS="$CFLAGS -Wsign-compare" ;;
93 *[\ \ ]-Wformat[\ \ ]*) ;;
94 *) CFLAGS="$CFLAGS -Wformat" ;;
98 *[\ \ ]-Wformat-security[\ \ ]*) ;;
99 *) CFLAGS="$CFLAGS -Wformat-security" ;;
102 if test "x$enable_ansi" = "xyes"; then
104 *[\ \ ]-ansi[\ \ ]*) ;;
105 *) CFLAGS="$CFLAGS -ansi" ;;
109 *[\ \ ]-D_POSIX_C_SOURCE*) ;;
110 *) CFLAGS="$CFLAGS -D_POSIX_C_SOURCE=199309L" ;;
114 *[\ \ ]-D_BSD_SOURCE[\ \ ]*) ;;
115 *) CFLAGS="$CFLAGS -D_BSD_SOURCE" ;;
119 *[\ \ ]-pedantic[\ \ ]*) ;;
120 *) CFLAGS="$CFLAGS -pedantic" ;;
126 PKG_CHECK_MODULES(GLIB, [gio-2.0 >= 2.30.0])
127 AC_SUBST(GLIB_CFLAGS)
130 PKG_CHECK_MODULES(LIBJS, [mozjs185])
131 AC_SUBST(LIBJS_CFLAGS)
135 AC_ARG_WITH(expat, [ --with-expat=<dir> Use expat from here],
138 CPPFLAGS="$CPPFLAGS -I$withval/include"
139 LDFLAGS="$LDFLAGS -L$withval/lib"
142 AC_CHECK_HEADERS(expat.h, [AC_DEFINE(HAVE_EXPAT_H)],
143 [AC_MSG_ERROR([Can't find expat.h. Please install expat.])])
144 AC_CHECK_LIB(expat,XML_ParserCreate,[EXPAT_LIBS="-lexpat"],
145 [AC_MSG_ERROR([Can't find expat library. Please install expat.])])
148 AC_CHECK_FUNCS(clearenv)
150 if test "x$GCC" = "xyes"; then
151 LDFLAGS="-Wl,--as-needed $LDFLAGS"
154 dnl ---------------------------------------------------------------------------
155 dnl - Select wether to use libsystemd-login or ConsoleKit for session tracking
156 dnl ---------------------------------------------------------------------------
158 have_libsystemd_login=no
159 SESSION_TRACKING=ConsoleKit
161 AC_ARG_ENABLE([libsystemd-login],
162 AS_HELP_STRING([--enable-libsystemd-login[=@<:@auto/yes/no@:>@]], [Use libsystemd-login (auto/yes/no)]),
163 [enable_libsystemd_login=$enableval],
164 [enable_libsystemd_login=auto])
165 if test "$enable_libsystemd_login" != "no"; then
166 PKG_CHECK_MODULES(LIBSYSTEMD_LOGIN,
168 have_libsystemd_login=yes,
169 have_libsystemd_login=no)
170 if test "$have_libsystemd_login" = "yes"; then
171 SESSION_TRACKING=libsystemd-login
172 AC_DEFINE([HAVE_LIBSYSTEMD_LOGIN], 1, [Define to 1 if libsystemd-login is available])
174 if test "$enable_libsystemd_login" = "yes"; then
175 AC_MSG_ERROR([libsystemd-login support requested but libsystemd-login library not found])
180 AC_SUBST(LIBSYSTEMD_LOGIN_CFLAGS)
181 AC_SUBST(LIBSYSTEMD_LOGIN_LIBS)
182 AM_CONDITIONAL(HAVE_LIBSYSTEMD_LOGIN, [test "$have_libsystemd_login" = "yes"], [Using libsystemd-login])
184 dnl ---------------------------------------------------------------------------
185 dnl - systemd unit / service files
186 dnl ---------------------------------------------------------------------------
188 AC_ARG_WITH([systemdsystemunitdir],
189 AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
191 [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
192 if test "x$with_systemdsystemunitdir" != "xno"; then
193 AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
195 AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$systemdsystemunitdir"])
197 dnl ---------------------------------------------------------------------------
198 dnl - User for running polkitd
199 dnl ---------------------------------------------------------------------------
201 AC_ARG_WITH(polkitd_user, AS_HELP_STRING([--with-polkitd-user=<user>],[User for running polkitd (polkitd)]))
203 if test -z "$with_polkitd_user" ; then
206 POLKITD_USER=$with_polkitd_user
208 AC_SUBST(POLKITD_USER)
209 AC_DEFINE_UNQUOTED(POLKITD_USER,"$POLKITD_USER", [User for running polkitd])
211 dnl ---------------------------------------------------------------------------
212 dnl - Select which authentication framework to use
213 dnl ---------------------------------------------------------------------------
215 AC_ARG_WITH([authfw],
216 AS_HELP_STRING([--with-authfw=<name>],
217 [Authentication framework (none/pam/shadow)]))
218 if ! test -z "$with_authfw" ; then
219 if test x$with_authdb = xdummy ; then
220 if ! test x$with_authfw = xnone ; then
221 AC_MSG_ERROR([Only 'none' is a valid authentication framework for the dummy authorization database])
224 if test x$with_authfw = xnone ; then
225 AC_MSG_ERROR(['none' is only a valid authentication framework for the dummy authorization database])
228 POLKIT_AUTHFW=$with_authfw
230 if test x$with_authdb = xdummy ; then
237 AC_SUBST(POLKIT_AUTHFW)
238 AC_DEFINE_UNQUOTED(POLKIT_AUTHFW,"$POLKIT_AUTHFW", [Authentication Framework to use])
240 case $POLKIT_AUTHFW in
243 AC_DEFINE(POLKIT_AUTHFW_NONE, 1, [If using no authentication framework])
248 AC_DEFINE(POLKIT_AUTHFW_PAM, 1, [If using the PAM authentication framework])
253 AUTH_LIBS="${AUTH_LIBS} -lcrypt"
254 AC_DEFINE(POLKIT_AUTHFW_SHADOW, 1, [If using the Shadow authentication framework])
258 AC_MSG_ERROR([Unknown Authentication Framework: $POLKIT_AUTHFW])
262 AM_CONDITIONAL(POLKIT_AUTHFW_NONE, [test x$POLKIT_AUTHFW = xnone], [Using no authfw])
263 AM_CONDITIONAL(POLKIT_AUTHFW_PAM, [test x$POLKIT_AUTHFW = xpam], [Using PAM authfw])
264 AM_CONDITIONAL(POLKIT_AUTHFW_SHADOW, [test x$POLKIT_AUTHFW = xshadow], [Using Shadow authfw])
267 dnl ---------------------------------------------------------------------------
269 dnl ---------------------------------------------------------------------------
272 AC_ARG_WITH(pam-prefix,
273 [ --with-pam-prefix=<prefix> specify where pam files go],[
274 if test x$withval != x; then
275 AC_MSG_RESULT("PAM files will be installed in prefix ${withval}.")
277 if test x$withval != x; then
278 PAM_PREFIX_UNEXPANDED="$withval"
280 PAM_PREFIX_UNEXPANDED="$sysconfdir"
282 PAM_PREFIX=`eval echo $PAM_PREFIX_UNEXPANDED`
286 if test "$need_pam" = yes ; then
287 AC_CHECK_LIB(pam, pam_start, have_pam=yes)
290 if test x$have_pam = xno; then
291 if test "$need_pam" = yes ; then
292 AC_ERROR([Could not find pam/pam-devel, please install the needed packages.])
295 AUTH_LIBS="${AUTH_LIBS} -lpam"
296 AC_DEFINE(HAVE_PAM, 1, [Define if PAM support is included])
298 # On Linux, sigtimedwait() is in libc; on Solaris, it's in librt.
300 AC_CHECK_LIB(c, sigtimedwait, [have_timedwait=yes])
301 if test "$have_timedwait" = no ; then
302 AC_CHECK_LIB(rt, sigtimedwait, [AUTH_LIBS="${AUTH_LIBS} -lrt"])
305 AC_MSG_CHECKING(how to call pam_strerror)
306 AC_CACHE_VAL(ac_cv_pam_strerror_args,
307 [AC_TRY_COMPILE([#include <stdio.h>
309 #include <security/pam_appl.h>],
310 [pam_handle_t *pamh = 0;
311 char *s = pam_strerror(pamh, PAM_SUCCESS);],
312 [ac_pam_strerror_args=2],
313 [AC_TRY_COMPILE([#include <stdio.h>
315 #include <security/pam_appl.h>],
317 pam_strerror(PAM_SUCCESS);],
318 [ac_pam_strerror_args=1],
319 [ac_pam_strerror_args=0])])
320 ac_cv_pam_strerror_args=$ac_pam_strerror_args])
321 ac_pam_strerror_args=$ac_cv_pam_strerror_args
322 if test "$ac_pam_strerror_args" = 1 ; then
323 AC_MSG_RESULT(one argument)
324 elif test "$ac_pam_strerror_args" = 2 ; then
325 AC_DEFINE(PAM_STRERROR_TWO_ARGS, 1, [Define if pam_strerror takes two arguments])
326 AC_MSG_RESULT(two arguments)
328 AC_MSG_RESULT(unknown)
333 AM_CONDITIONAL(HAVE_PAM, test x$have_pam = xyes)
337 AC_CHECK_HEADER(security/pam_modutil.h, [AC_DEFINE(HAVE_PAM_MODUTIL_H, [], "Have pam_modutil.h")])
338 AC_CHECK_HEADER(security/pam_ext.h, [AC_DEFINE(HAVE_PAM_EXT_H, [], "Have pam_ext.h")])
339 AC_CHECK_LIB(pam, pam_vsyslog, [AC_DEFINE(HAVE_PAM_VSYSLOG, [], "Have pam_vsyslog")])
341 AC_ARG_WITH(pam-module-dir, [ --with-pam-module-dir=[dirname] directory to install PAM security module])
342 if ! test -z "$with_pam_module_dir"; then
343 PAM_MODULE_DIR=$with_pam_module_dir
345 PAM_MODULE_DIR="/lib/security"
348 AC_SUBST(PAM_MODULE_DIR)
350 AC_ARG_WITH(os-type, [ --with-os-type=<os> distribution or OS (redhat/suse/gentoo/pardus/solaris)])
352 #### Check our operating system (distro-tweaks required)
353 if test "z$with_os_type" = "z"; then
354 AC_CHECK_FILE(/etc/redhat-release,distro_type="redhat")
355 AC_CHECK_FILE(/etc/SuSE-release,distro_type="suse")
356 AC_CHECK_FILE(/etc/gentoo-release,distro_type="gentoo")
357 AC_CHECK_FILE(/etc/pardus-release,distro_type="pardus")
358 if test "z$distro_type" = "z"; then
359 echo "Linux distribution autodetection failed, specify the distribution to target using --with-os-type="
361 operating_system=`echo ${distro_type} | tr '[[:upper:]]' '[[:lower:]]' `
365 #### Sort out OS (distro-tweaks required)
366 if test x$with_os_type = x; then
367 if test x$operating_system = xredhat ; then
369 elif test x$operating_system = xsuse ; then
371 elif test x$operating_system = xgentoo ; then
373 elif test x$operating_system = xpardus ; then
375 elif test x$operating_system = xsolaris ; then
377 elif test x$operating_system = xfreebsd ; then
384 # (distro-tweaks required)
385 AM_CONDITIONAL(OS_TYPE_UNKNOWN, test x$with_os_type = xunknown, [Running on unknown OS])
386 AM_CONDITIONAL(OS_TYPE_RED_HAT, test x$with_os_type = xredhat, [Running on Red Hat OS'es])
387 AM_CONDITIONAL(OS_TYPE_SUSE, test x$with_os_type = xsuse, [Running on SUSE OS'es])
388 AM_CONDITIONAL(OS_TYPE_GENTOO, test x$with_os_type = xgentoo, [Running on Gentoo OS'es])
389 AM_CONDITIONAL(OS_TYPE_PARDUS, test x$with_os_type = xpardus, [Running on Pardus OS'es])
390 AM_CONDITIONAL(OS_TYPE_SOLARIS, test x$with_os_type = xsolaris, [Running os Solaris OS'es])
391 AM_CONDITIONAL(OS_TYPE_FREEBSD, test x$with_os_type = xfreebsd, [Running on FreeBSD OS'es])
393 AC_ARG_WITH(pam-include, [ --with-pam-include=<file> pam file to include])
395 #### Set up pam file to include (distro-tweaks required)
396 if ! test -z "$with_pam_include"; then
397 PAM_FILE_INCLUDE_AUTH=$with_pam_include
398 PAM_FILE_INCLUDE_ACCOUNT=$with_pam_include
399 PAM_FILE_INCLUDE_PASSWORD=$with_pam_include
400 PAM_FILE_INCLUDE_SESSION=$with_pam_include
401 elif test x$with_os_type = xredhat -o x$with_os_type = xgentoo -o x$with_os_type = xpardus ; then
402 PAM_FILE_INCLUDE_AUTH=system-auth
403 PAM_FILE_INCLUDE_ACCOUNT=system-auth
404 PAM_FILE_INCLUDE_PASSWORD=system-auth
405 PAM_FILE_INCLUDE_SESSION=system-auth
406 elif test x$with_os_type = xsuse -o x$with_os_type = xsolaris ; then
407 PAM_FILE_INCLUDE_AUTH=common-auth
408 PAM_FILE_INCLUDE_ACCOUNT=common-account
409 PAM_FILE_INCLUDE_PASSWORD=common-password
410 PAM_FILE_INCLUDE_SESSION=common-session
411 elif test x$with_os_type = xfreebsd ; then
412 PAM_FILE_INCLUDE_AUTH=system
413 PAM_FILE_INCLUDE_ACCOUNT=system
414 PAM_FILE_INCLUDE_PASSWORD=system
415 PAM_FILE_INCLUDE_SESSION=system
417 PAM_FILE_INCLUDE_AUTH=system-auth
418 PAM_FILE_INCLUDE_ACCOUNT=system-auth
419 PAM_FILE_INCLUDE_PASSWORD=system-auth
420 PAM_FILE_INCLUDE_SESSION=system-auth
423 AC_SUBST(PAM_FILE_INCLUDE_AUTH)
424 AC_SUBST(PAM_FILE_INCLUDE_ACCOUNT)
425 AC_SUBST(PAM_FILE_INCLUDE_PASSWORD)
426 AC_SUBST(PAM_FILE_INCLUDE_SESSION)
427 AC_DEFINE_UNQUOTED(PAM_FILE_INCLUDE_AUTH, "$PAM_FILE_INCLUDE_AUTH", [pam file auth])
428 AC_DEFINE_UNQUOTED(PAM_FILE_INCLUDE_ACCOUNT, "$PAM_FILE_INCLUDE_ACCOUNT", [pam file account])
429 AC_DEFINE_UNQUOTED(PAM_FILE_INCLUDE_PASSWORD, "$PAM_FILE_INCLUDE_PASSWORD", [pam file password])
430 AC_DEFINE_UNQUOTED(PAM_FILE_INCLUDE_SESSION, "$PAM_FILE_INCLUDE_SESSION", [pam file session])
432 dnl ---------------------------------------------------------------------------
434 dnl ---------------------------------------------------------------------------
439 AC_DEFINE([HAVE_SOLARIS], 1, [Is this a Solaris system?])
442 AC_DEFINE([HAVE_FREEBSD], 1, [Is this a FreeBSD system?])
446 GOBJECT_INTROSPECTION_CHECK([0.6.2])
448 AC_ARG_ENABLE([examples],
449 AS_HELP_STRING([--enable-examples], [Build the example programs]),,
450 [enable_examples=yes])
452 AM_CONDITIONAL(BUILD_EXAMPLES, test "x$enable_examples" = "xyes")
454 # ********************
455 # Internationalization
456 # ********************
458 IT_PROG_INTLTOOL([0.40.0])
459 GETTEXT_PACKAGE=polkit-1
460 AC_SUBST([GETTEXT_PACKAGE])
462 AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[gettext domain])
469 data/polkit-gobject-1.pc
470 data/polkit-backend-1.pc
471 data/polkit-agent-1.pc
474 src/polkitbackend/Makefile
475 src/polkitagent/Makefile
476 src/programs/Makefile
477 src/examples/Makefile
479 docs/extensiondir.xml
486 test/polkitbackend/Makefile
489 dnl ==========================================================================
496 libexecdir: ${libexecdir}
500 sysconfdir: ${sysconfdir}
501 localstatedir: ${localstatedir}
506 cppflags: ${CPPFLAGS}
507 xsltproc: ${XSLTPROC}
508 introspection: ${found_introspection}
510 Distribution/OS: ${with_os_type}
511 Authentication framework: ${POLKIT_AUTHFW}
512 Session tracking: ${SESSION_TRACKING}
513 PAM support: ${have_pam}
514 systemdsystemunitdir: ${systemdsystemunitdir}
515 polkitd user: ${POLKITD_USER}"
517 if test "$have_pam" = yes ; then
519 PAM file auth: ${PAM_FILE_INCLUDE_AUTH}
520 PAM file account: ${PAM_FILE_INCLUDE_ACCOUNT}
521 PAM file password: ${PAM_FILE_INCLUDE_PASSWORD}
522 PAM file session: ${PAM_FILE_INCLUDE_SESSION}"
525 Maintainer mode: ${USE_MAINTAINER_MODE}
526 Building verbose mode: ${enable_verbose_mode}
527 Building api docs: ${enable_gtk_doc}
528 Building man pages: ${enable_man_pages}
529 Building examples: ${enable_examples}
533 echo "NOTE: The file ${prefix}/lib/polkit-1/polkit-agent-helper-1 must be owned"
534 echo " by root and have mode 4755 (setuid root binary)"
537 echo "NOTE: The file ${bindir}/pkexec must be owned by root and"
538 echo " have mode 4755 (setuid root binary)"
541 echo "NOTE: The directory ${sysconfdir}/polkit-1/rules.d must be owned"
542 echo " by user '$POLKITD_USER' and have mode 700"
545 echo "NOTE: The directory ${datadir}/polkit-1/rules.d must be owned"
546 echo " by user '$POLKITD_USER' and have mode 700"