dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59c)
AC_INIT(PolicyKit, 0.7, david@fubar.dk)
AM_INIT_AUTOMAKE(PolicyKit, 0.7)
AM_CONFIG_HEADER(config.h)
AM_MAINTAINER_MODE
# libtool versioning - this applies to all libraries in this package
#
# See http://sources.redhat.com/autobook/autobook/autobook_91.html#SEC91 for details
#
LT_CURRENT=2
LT_REVISION=0
LT_AGE=0
AC_SUBST(LT_CURRENT)
AC_SUBST(LT_REVISION)
AC_SUBST(LT_AGE)
AC_ISC_POSIX
AC_PROG_CC
AM_PROG_CC_STDC
AC_HEADER_STDC
AM_PROG_LIBTOOL
AC_PROG_MAKE_SET
AC_PROG_LN_S
AC_SYS_LARGEFILE
AM_PROG_CC_C_O
# Taken from dbus
AC_ARG_ENABLE(ansi, [ --enable-ansi enable -ansi -pedantic gcc flags],enable_ansi=$enableval,enable_ansi=no)
AC_ARG_ENABLE(verbose-mode, [ --enable-verbose-mode support verbose debug mode],enable_verbose_mode=$enableval,enable_verbose_mode=$USE_MAINTAINER_MODE)
AC_ARG_ENABLE(tests, AS_HELP_STRING([--enable-tests],[enable unit test code]),enable_tests=$enableval,enable_tests=$USE_MAINTAINER_MODE)
AC_ARG_ENABLE(gcov, AS_HELP_STRING([--enable-gcov],[compile with coverage profiling instrumentation (gcc only)]),enable_gcov=$enableval,enable_gcov=no)
AC_ARG_ENABLE(man-pages, [ --enable-man-pages build manual pages],enable_man_pages=$enableval,enable_man_pages=yes)
AM_CONDITIONAL(POLKIT_BUILD_TESTS, test x$enable_tests = xyes)
if test x$enable_tests = xyes; then
AC_DEFINE(POLKIT_BUILD_TESTS,1,[Build test code])
fi
if test x$enable_gcov = xyes; then
## so that config.h changes when you toggle gcov support
AC_DEFINE_UNQUOTED(POLKIT_GCOV_ENABLED, 1, [Defined if gcov is enabled to force a rebuild due to config.h changing])
AC_MSG_CHECKING([for gcc 3.3 version of gcov file format])
have_gcc33_gcov=no
AC_RUN_IFELSE( [AC_LANG_PROGRAM( , [[ if (__GNUC__ >=3 && __GNUC_MINOR__ >= 3) exit (0); else exit (1); ]])],
have_gcc33_gcov=yes)
if test x$have_gcc33_gcov = xyes ; then
AC_DEFINE_UNQUOTED(POLKIT_HAVE_GCC33_GCOV, 1, [Defined if we have gcc 3.3 and thus the new gcov format])
fi
AC_MSG_RESULT($have_gcc33_gcov)
fi
AM_CONDITIONAL(POLKIT_GCOV_ENABLED, test x$enable_gcov = xyes)
if test "${enable_man_page}" != no; then
dnl
dnl Check for xsltproc
dnl
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.3])
#### gcc warning flags
if test "x$GCC" = "xyes"; then
changequote(,)dnl
case " $CFLAGS " in
*[\ \ ]-Wall[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -Wall" ;;
esac
case " $CFLAGS " in
*[\ \ ]-Wchar-subscripts[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -Wchar-subscripts" ;;
esac
case " $CFLAGS " in
*[\ \ ]-Wmissing-declarations[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -Wmissing-declarations" ;;
esac
case " $CFLAGS " in
*[\ \ ]-Wnested-externs[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -Wnested-externs" ;;
esac
case " $CFLAGS " in
*[\ \ ]-Wpointer-arith[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -Wpointer-arith" ;;
esac
case " $CFLAGS " in
*[\ \ ]-Wcast-align[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -Wcast-align" ;;
esac
case " $CFLAGS " in
*[\ \ ]-Wsign-compare[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -Wsign-compare" ;;
esac
if test "x$enable_ansi" = "xyes"; then
case " $CFLAGS " in
*[\ \ ]-ansi[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -ansi" ;;
esac
case " $CFLAGS " in
*[\ \ ]-D_POSIX_C_SOURCE*) ;;
*) CFLAGS="$CFLAGS -D_POSIX_C_SOURCE=199309L" ;;
esac
case " $CFLAGS " in
*[\ \ ]-D_BSD_SOURCE[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -D_BSD_SOURCE" ;;
esac
case " $CFLAGS " in
*[\ \ ]-pedantic[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -pedantic" ;;
esac
fi
if test x$enable_gcov = xyes; then
case " $CFLAGS " in
*[\ \ ]-fprofile-arcs[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -fprofile-arcs" ;;
esac
case " $CFLAGS " in
*[\ \ ]-ftest-coverage[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -ftest-coverage" ;;
esac
## remove optimization
CFLAGS=`echo "$CFLAGS" | sed -e 's/-O[0-9]*//g'`
fi
changequote([,])dnl
else
if test x$enable_gcov = xyes; then
AC_MSG_ERROR([--enable-gcov can only be used with gcc])
fi
fi
AM_CONDITIONAL(GCOV, test x$enable_gcov = xyes)
PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.6.0])
AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBS)
PKG_CHECK_MODULES(DBUS, [dbus-1 >= 1.0])
AC_SUBST(DBUS_CFLAGS)
AC_SUBST(DBUS_LIBS)
PKG_CHECK_MODULES(DBUS_GLIB, [dbus-glib-1 >= 0.73])
AC_SUBST(DBUS_GLIB_CFLAGS)
AC_SUBST(DBUS_GLIB_LIBS)
AC_CHECK_FUNCS(getgrouplist)
EXPAT_LIB=""
AC_ARG_WITH(expat, [ --with-expat=
Use expat from here],
[
expat=$withval
CPPFLAGS="$CPPFLAGS -I$withval/include"
LDFLAGS="$LDFLAGS -L$withval/lib"
]
)
AC_CHECK_HEADERS(expat.h, [AC_DEFINE(HAVE_EXPAT_H)],
[AC_MSG_ERROR([Can't find expat.h. Please install expat.])])
AC_CHECK_LIB(expat,XML_ParserCreate,[EXPAT_LIBS="-lexpat"],
[AC_MSG_ERROR([Can't find expat library. Please install expat.])])
AC_SUBST(EXPAT_LIBS)
if test "x$GCC" = "xyes"; then
LDFLAGS="-Wl,--as-needed $LDFLAGS"
fi
dnl ---------------------------------------------------------------------------
dnl - User and group
dnl ---------------------------------------------------------------------------
AC_ARG_WITH(polkit_user,[ --with-polkit-user= user for PolicyKit])
if test -z "$with_polkit_user" ; then
POLKIT_USER=polkituser
else
POLKIT_USER=$with_polkit_user
fi
AC_SUBST(POLKIT_USER)
AC_DEFINE_UNQUOTED(POLKIT_USER, "$POLKIT_USER", [User for PolicyKit])
AC_ARG_WITH(polkit_group,[ --with-polkit-group= group for PolicyKit])
if test -z "$with_polkit_group" ; then
POLKIT_GROUP=polkituser
else
POLKIT_GROUP=$with_polkit_group
fi
AC_SUBST(POLKIT_GROUP)
AC_DEFINE_UNQUOTED(POLKIT_GROUP,"$POLKIT_GROUP", [Group for PolicyKit])
dnl ---------------------------------------------------------------------------
dnl - SELinux
dnl ---------------------------------------------------------------------------
AC_ARG_ENABLE(selinux, AS_HELP_STRING([--enable-selinux],[build with SELinux support]),enable_selinux=$enableval,enable_selinux=auto)
# SELinux detection
if test x$enable_selinux = xno ; then
have_selinux=no;
else
# See if we have SELinux library
AC_CHECK_LIB(selinux, is_selinux_enabled,
have_selinux=yes, have_selinux=no)
if test x$enable_selinux = xauto ; then
if test x$have_selinux = xno ; then
AC_MSG_WARN([SELinux library not found])
fi
else
if test x$have_selinux = xno ; then
AC_MSG_ERROR([SElinux explicitly required, and SELinux library not found])
fi
fi
fi
AM_CONDITIONAL(HAVE_SELINUX, test x$have_selinux = xyes)
if test x$have_selinux = xyes ; then
# the selinux code creates threads
# which requires libpthread even on linux
AC_CHECK_FUNC(pthread_create,,[AC_CHECK_LIB(pthread,pthread_create,
[SELINUX_THREAD_LIBS="-lpthread"])])
SELINUX_LIBS="-lselinux $SELINUX_THREAD_LIBS"
AC_DEFINE(HAVE_SELINUX,1,[SELinux support])
else
SELINUX_LIBS=
fi
AC_SUBST(SELINUX_LIBS)
dnl ---------------------------------------------------------------------------
dnl - Select what authorization database to use
dnl ---------------------------------------------------------------------------
AC_ARG_WITH([authdb],
AS_HELP_STRING([--with-authdb=],
[Authorization database (default/dummy)]))
if ! test -z "$with_authdb" ; then
POLKIT_AUTHDB=$with_authdb
else
POLKIT_AUTHDB=default
fi
AC_SUBST(POLKIT_AUTHDB)
AC_DEFINE_UNQUOTED(POLKIT_AUTHDB,"$POLKIT_AUTHDB", [Authorization Database to use])
case $POLKIT_AUTHDB in
dummy)
need_pam=no
AC_DEFINE(POLKIT_AUTHDB_DUMMY, 1, [If using the dummy authorization database])
;;
default)
need_pam=yes
AC_DEFINE(POLKIT_AUTHDB_DEFAULT, 1, [If using the default authorization database])
;;
*)
AC_MSG_ERROR([Unknown Authorization Database: $POLKIT_AUTHDB])
;;
esac
AM_CONDITIONAL(POLKIT_AUTHDB_DUMMY, [test x$POLKIT_AUTHDB = xdummy], [Using dummy authdb])
AM_CONDITIONAL(POLKIT_AUTHDB_DEFAULT, [test x$POLKIT_AUTHDB = xdefault], [Using default authdb])
dnl ---------------------------------------------------------------------------
dnl - Check for PAM
dnl ---------------------------------------------------------------------------
withval=""
AC_ARG_WITH(pam-prefix,
[ --with-pam-prefix= specify where pam files go],[
if test x$withval != x; then
AC_MSG_RESULT("PAM files will be installed in prefix ${withval}.")
fi])
if test x$withval != x; then
PAM_PREFIX_UNEXPANDED="$withval"
else
PAM_PREFIX_UNEXPANDED="$sysconfdir"
fi
PAM_PREFIX=`eval echo $PAM_PREFIX_UNEXPANDED`
AC_SUBST(PAM_PREFIX)
have_pam=no
if test "$need_pam" = yes ; then
AC_CHECK_LIB(pam, pam_start, have_pam=yes)
fi
if test x$have_pam = xno; then
if test "$need_pam" = yes ; then
AC_ERROR([Could not find pam/pam-devel, please install the needed packages.])
fi
else
AUTH_LIBS="${AUTH_LIBS} -lpam"
AC_DEFINE(HAVE_PAM, 1, [Define if PAM support is included])
# On Linux, sigtimedwait() is in libc; on Solaris, it's in librt.
have_timedwait=no
AC_CHECK_LIB(c, sigtimedwait, [have_timedwait=yes])
if test "$have_timedwait" = no ; then
AC_CHECK_LIB(rt, sigtimedwait, [AUTH_LIBS="${AUTH_LIBS} -lrt"])
fi
AC_MSG_CHECKING(how to call pam_strerror)
AC_CACHE_VAL(ac_cv_pam_strerror_args,
[AC_TRY_COMPILE([#include
#include
#include ],
[pam_handle_t *pamh = 0;
char *s = pam_strerror(pamh, PAM_SUCCESS);],
[ac_pam_strerror_args=2],
[AC_TRY_COMPILE([#include
#include
#include ],
[char *s =
pam_strerror(PAM_SUCCESS);],
[ac_pam_strerror_args=1],
[ac_pam_strerror_args=0])])
ac_cv_pam_strerror_args=$ac_pam_strerror_args])
ac_pam_strerror_args=$ac_cv_pam_strerror_args
if test "$ac_pam_strerror_args" = 1 ; then
AC_MSG_RESULT(one argument)
elif test "$ac_pam_strerror_args" = 2 ; then
AC_DEFINE(PAM_STRERROR_TWO_ARGS, 1, [Define if pam_strerror takes two arguments])
AC_MSG_RESULT(two arguments)
else
AC_MSG_RESULT(unknown)
fi
fi
AM_CONDITIONAL(HAVE_PAM, test x$have_pam = xyes)
AC_SUBST(HAVE_PAM)
AC_SUBST(AUTH_LIBS)
AC_CHECK_HEADER(security/pam_modutil.h, [AC_DEFINE(HAVE_PAM_MODUTIL_H, [], "Have pam_modutil.h")])
AC_CHECK_HEADER(security/pam_ext.h, [AC_DEFINE(HAVE_PAM_EXT_H, [], "Have pam_ext.h")])
AC_CHECK_LIB(pam, pam_vsyslog, [AC_DEFINE(HAVE_PAM_VSYSLOG, [], "Have pam_vsyslog")])
AC_ARG_WITH(pam-module-dir, [ --with-pam-module-dir=[dirname] directory to install PAM security module])
if ! test -z "$with_pam_module_dir"; then
PAM_MODULE_DIR=$with_pam_module_dir
else
PAM_MODULE_DIR="/lib/security"
fi
AC_SUBST(PAM_MODULE_DIR)
AC_ARG_WITH(os-type, [ --with-os-type= distribution or OS (redhat/suse/gentoo/pardus)])
#### Check our operating system (distro-tweaks required)
if test "z$with_os_type" = "z"; then
AC_CHECK_FILE(/etc/redhat-release,distro_type="redhat")
AC_CHECK_FILE(/etc/SuSE-release,distro_type="suse")
AC_CHECK_FILE(/etc/gentoo-release,distro_type="gentoo")
AC_CHECK_FILE(/etc/pardus-release,distro_type="pardus")
if test "z$distro_type" = "z"; then
echo "Linux distribution autodetection failed, specify the distribution to target using --with-os-type="
else
operating_system=`echo ${distro_type} | tr '[[:upper:]]' '[[:lower:]]' `
fi
fi
#### Sort out OS (distro-tweaks required)
if test x$with_os_type = x; then
if test x$operating_system = xredhat ; then
with_os_type=redhat
elif test x$operating_system = xsuse ; then
with_os_type=suse
elif test x$operating_system = xgentoo ; then
with_os_type=gentoo
elif test x$operating_system = xpardus ; then
with_os_type=pardus
else
with_os_type=unknown
fi
fi
# (distro-tweaks required)
AM_CONDITIONAL(OS_TYPE_UNKNOWN, test x$with_os_type = xunknown, [Running on unknown OS])
AM_CONDITIONAL(OS_TYPE_RED_HAT, test x$with_os_type = xredhat, [Running on Red Hat OS'es])
AM_CONDITIONAL(OS_TYPE_SUSE, test x$with_os_type = xsuse, [Running on SUSE OS'es])
AM_CONDITIONAL(OS_TYPE_GENTOO, test x$with_os_type = xgentoo, [Running on Gentoo OS'es])
AM_CONDITIONAL(OS_TYPE_PARDUS, test x$with_os_type = xpardus, [Running on Pardus OS'es])
AC_ARG_WITH(pam-include, [ --with-pam-include= pam file to include])
#### Set up pam file to include (distro-tweaks required)
if ! test -z "$with_pam_include"; then
PAM_FILE_INCLUDE_AUTH=$with_pam_include
PAM_FILE_INCLUDE_ACCOUNT=$with_pam_include
PAM_FILE_INCLUDE_PASSWORD=$with_pam_include
PAM_FILE_INCLUDE_SESSION=$with_pam_include
elif test x$with_os_type = xredhat -o x$with_os_type = xgentoo -o x$with_os_type = xpardus ; then
PAM_FILE_INCLUDE_AUTH=system-auth
PAM_FILE_INCLUDE_ACCOUNT=system-auth
PAM_FILE_INCLUDE_PASSWORD=system-auth
PAM_FILE_INCLUDE_SESSION=system-auth
elif test x$with_os_type = xsuse ; then
PAM_FILE_INCLUDE_AUTH=common-auth
PAM_FILE_INCLUDE_ACCOUNT=common-account
PAM_FILE_INCLUDE_PASSWORD=common-password
PAM_FILE_INCLUDE_SESSION=common-session
else
PAM_FILE_INCLUDE_AUTH=system-auth
PAM_FILE_INCLUDE_ACCOUNT=system-auth
PAM_FILE_INCLUDE_PASSWORD=system-auth
PAM_FILE_INCLUDE_SESSION=system-auth
fi
AC_SUBST(PAM_FILE_INCLUDE_AUTH)
AC_SUBST(PAM_FILE_INCLUDE_ACCOUNT)
AC_SUBST(PAM_FILE_INCLUDE_PASSWORD)
AC_SUBST(PAM_FILE_INCLUDE_SESSION)
AC_DEFINE_UNQUOTED(PAM_FILE_INCLUDE_AUTH, "$PAM_FILE_INCLUDE_AUTH", [pam file auth])
AC_DEFINE_UNQUOTED(PAM_FILE_INCLUDE_ACCOUNT, "$PAM_FILE_INCLUDE_ACCOUNT", [pam file account])
AC_DEFINE_UNQUOTED(PAM_FILE_INCLUDE_PASSWORD, "$PAM_FILE_INCLUDE_PASSWORD", [pam file password])
AC_DEFINE_UNQUOTED(PAM_FILE_INCLUDE_SESSION, "$PAM_FILE_INCLUDE_SESSION", [pam file session])
# ********************
# Internationalisation
# ********************
IT_PROG_INTLTOOL([0.36.0])
GETTEXT_PACKAGE=PolicyKit
AC_SUBST([GETTEXT_PACKAGE])
AM_GLIB_GNU_GETTEXT
AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[gettext domain])
AC_OUTPUT([
Makefile
data/Makefile
data/polkit
data/polkit.pc
data/polkit-dbus.pc
data/polkit-grant.pc
polkit/Makefile
polkit-dbus/Makefile
polkit-grant/Makefile
polkitd/Makefile
tools/Makefile
doc/Makefile
doc/version.xml
doc/man/Makefile
policy/Makefile
po/Makefile.in
test/Makefile
])
dnl ==========================================================================
echo "
PolicyKit $VERSION
=================
prefix: ${prefix}
libdir: ${libdir}
libexecdir: ${libexecdir}
bindir: ${bindir}
sbindir: ${sbindir}
datadir: ${datadir}
sysconfdir: ${sysconfdir}
localstatedir: ${localstatedir}
docdir: ${docdir}
compiler: ${CC}
cflags: ${CFLAGS}
cppflags: ${CPPFLAGS}
xsltproc: ${XSLTPROC}
user for PolicyKit: ${POLKIT_USER}
group for PolicyKit: ${POLKIT_GROUP}
authorization database: ${POLKIT_AUTHDB}
Distribution/OS: ${with_os_type}
SELinux support: ${have_selinux}
PAM support: ${have_pam}"
if test "$have_pam" = yes ; then
echo " PAM file auth: ${PAM_FILE_INCLUDE_AUTH}
PAM file account: ${PAM_FILE_INCLUDE_ACCOUNT}
PAM file password: ${PAM_FILE_INCLUDE_PASSWORD}
PAM file session: ${PAM_FILE_INCLUDE_SESSION}"
fi
echo "
Maintainer mode: ${USE_MAINTAINER_MODE}
Building unit tests: ${enable_tests}
GCC coverage profiling: ${enable_gcov}
Building verbose mode: ${enable_verbose_mode}
Building api docs: ${enable_gtk_doc}
Building man pages: ${enable_man_pages}
"
if test x$enable_tests = xyes; then
echo "NOTE: Building with unit tests increases the size of the installed "
echo " library and may render it insecure."
echo
fi
if test x$enable_gcov = xyes; then
echo "NOTE: Building with coverage profiling is definitely for developers only."
echo
fi
if test "${POLKIT_AUTHDB}" = default ; then
echo "NOTE: Remember to create user ${POLKIT_USER} and group ${POLKIT_GROUP}"
echo " before 'make install'"
echo
echo "NOTE: The directories ${localstatedir}/run/PolicyKit and ${localstatedir}/lib/PolicyKit will be"
echo " owned by group ${POLKIT_GROUP} and will be mode 770."
echo
echo "NOTE: ${libexecdir}/polkit-read-auth-helper will be owned by"
echo " group ${POLKIT_GROUP} and installed with mode 2755 (setgid binary)."
echo
echo "NOTE: ${libexecdir}/polkit-revoke-helper will be owned by"
echo " group '${POLKIT_GROUP} and installed with mode 2755 (setgid binary)."
echo
echo "NOTE: ${libexecdir}/polkit-grant-helper will be owned by"
echo " group ${POLKIT_GROUP} and installed with mode 2755 (setgid binary)."
echo
echo "NOTE: ${libexecdir}/polkit-explicit-grant-helper will be owned by"
echo " group ${POLKIT_GROUP} and installed with mode 2755 (setgid binary)."
echo
echo "NOTE: ${libexecdir}/polkit-grant-helper-pam will be setuid root."
echo
echo "NOTE: For packaging, remember to retain the modes and ownership."
echo
fi