configure.in 22.1 KB
Newer Older
David Zeuthen's avatar
David Zeuthen committed
1 2
dnl Process this file with autoconf to produce a configure script.

3
AC_PREREQ(2.59c)
4 5
AC_INIT(PolicyKit, 0.90, http://lists.freedesktop.org/mailman/listinfo/polkit-devel)
AM_INIT_AUTOMAKE(PolicyKit, 0.90)
David Zeuthen's avatar
David Zeuthen committed
6 7 8
AM_CONFIG_HEADER(config.h)
AM_MAINTAINER_MODE

David Zeuthen's avatar
David Zeuthen committed
9
# libtool versioning - this applies to all libraries in this package
David Zeuthen's avatar
David Zeuthen committed
10 11 12
#
# See http://sources.redhat.com/autobook/autobook/autobook_91.html#SEC91 for details
#
13
LT_CURRENT=1
David Zeuthen's avatar
David Zeuthen committed
14 15 16 17 18 19 20 21 22 23 24 25 26 27
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
28
AM_PROG_CC_C_O
David Zeuthen's avatar
David Zeuthen committed
29 30 31 32

# 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)
33 34
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)
35
AC_ARG_ENABLE(man-pages,        [  --enable-man-pages      build manual pages],enable_man_pages=$enableval,enable_man_pages=yes)
36

37
AM_CONDITIONAL(KIT_BUILD_TESTS, test x$enable_tests = xyes)
38 39
AM_CONDITIONAL(POLKIT_BUILD_TESTS, test x$enable_tests = xyes)
if test x$enable_tests = xyes; then
40
    AC_DEFINE(KIT_BUILD_TESTS,1,[Build test code])
41 42 43 44
    AC_DEFINE(POLKIT_BUILD_TESTS,1,[Build test code])
fi

if test x$enable_gcov = xyes; then
45 46 47
     if test x$enable_tests = xno; then
          AC_ERROR([It only makes sense to use gcov if tests are enabled.])
     fi
48
     ## so that config.h changes when you toggle gcov support
49
     AC_DEFINE_UNQUOTED(KIT_GCOV_ENABLED, 1, [Defined if gcov is enabled to force a rebuild due to config.h changing])
50 51
     AC_DEFINE_UNQUOTED(POLKIT_GCOV_ENABLED, 1, [Defined if gcov is enabled to force a rebuild due to config.h changing])
fi
52
AM_CONDITIONAL(KIT_GCOV_ENABLED, test x$enable_gcov = xyes)
53 54
AM_CONDITIONAL(POLKIT_GCOV_ENABLED, test x$enable_gcov = xyes)

55 56 57 58 59 60 61 62
if test "${enable_verbose_mode}" != no; then
    # To get -rdynamic you pass -export-dynamic to libtool.
    AC_DEFINE(BUILT_R_DYNAMIC,1,[whether -export-dynamic was passed to libtool])
    R_DYNAMIC_LDFLAG=-export-dynamic
else
    R_DYNAMIC_LDFLAG=
fi
AC_SUBST(R_DYNAMIC_LDFLAG)
63

David Zeuthen's avatar
David Zeuthen committed
64 65 66 67 68 69 70 71 72
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
73
AM_CONDITIONAL(MAN_PAGES_ENABLED, test x$enable_man_pages = xyes)
David Zeuthen's avatar
David Zeuthen committed
74

David Zeuthen's avatar
David Zeuthen committed
75

David Zeuthen's avatar
David Zeuthen committed
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
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

117 118 119 120 121 122 123 124 125 126
  case " $CFLAGS " in
  *[\ \	]-Wformat[\ \	]*) ;;
  *) CFLAGS="$CFLAGS -Wformat" ;;
  esac

  case " $CFLAGS " in
  *[\ \	]-Wformat-security[\ \	]*) ;;
  *) CFLAGS="$CFLAGS -Wformat-security" ;;
  esac

David Zeuthen's avatar
David Zeuthen committed
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
  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)

174 175 176 177
PKG_CHECK_MODULES(DBUS, [dbus-1 >= 1.0])
AC_SUBST(DBUS_CFLAGS)
AC_SUBST(DBUS_LIBS)

178 179 180 181
PKG_CHECK_MODULES(DBUS_GLIB, [dbus-glib-1 >= 0.73])
AC_SUBST(DBUS_GLIB_CFLAGS)
AC_SUBST(DBUS_GLIB_LIBS)

Joe Clarke's avatar
Joe Clarke committed
182
AC_CHECK_FUNCS(getgrouplist readdir64 getline strndup clearenv)
David Zeuthen's avatar
David Zeuthen committed
183

184 185 186 187 188 189 190 191 192 193 194 195 196 197
EXPAT_LIB=""
AC_ARG_WITH(expat, [  --with-expat=<dir>      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)

198 199
if test "x$GCC" = "xyes"; then
  LDFLAGS="-Wl,--as-needed $LDFLAGS"
200 201
fi

202 203 204 205 206 207
dnl ---------------------------------------------------------------------------
dnl - User and group
dnl ---------------------------------------------------------------------------

AC_ARG_WITH(polkit_user,[  --with-polkit-user=<user>  user for PolicyKit])
if test -z "$with_polkit_user" ; then
David Zeuthen's avatar
David Zeuthen committed
208
    POLKIT_USER=polkituser
209 210 211 212 213 214 215 216
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=<grp>  group for PolicyKit])
if test -z "$with_polkit_group" ; then
David Zeuthen's avatar
David Zeuthen committed
217
    POLKIT_GROUP=polkituser
218 219 220 221 222 223
else
    POLKIT_GROUP=$with_polkit_group
fi
AC_SUBST(POLKIT_GROUP)
AC_DEFINE_UNQUOTED(POLKIT_GROUP,"$POLKIT_GROUP", [Group for PolicyKit])

224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263
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)

264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296
dnl ---------------------------------------------------------------------------
dnl - Select what authorization database to use
dnl ---------------------------------------------------------------------------

AC_ARG_WITH([authdb],
	    AS_HELP_STRING([--with-authdb=<name>], 
                           [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)
    AC_DEFINE(POLKIT_AUTHDB_DUMMY, 1, [If using the dummy authorization database])
    ;;

  default)
    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])

297 298 299 300 301 302
dnl ---------------------------------------------------------------------------
dnl - Select which authentication framework to use
dnl ---------------------------------------------------------------------------

AC_ARG_WITH([authfw],
	    AS_HELP_STRING([--with-authfw=<name>], 
303
                           [Authentication framework (none/pam/shadow)]))
304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336
if ! test -z "$with_authfw" ; then
  if test x$with_authdb = xdummy ; then
    if ! test x$with_authfw = xnone ; then
      AC_MSG_ERROR([Only 'none' is a valid authentication framework for the dummy authorization database])
    fi
  else
      if test x$with_authfw = xnone ; then
        AC_MSG_ERROR(['none' is only a valid authentication framework for the dummy authorization database])
      fi
  fi
  POLKIT_AUTHFW=$with_authfw
else
  if test x$with_authdb = xdummy ; then
    POLKIT_AUTHFW=none
  else
    POLKIT_AUTHFW=pam
  fi
fi

AC_SUBST(POLKIT_AUTHFW)
AC_DEFINE_UNQUOTED(POLKIT_AUTHFW,"$POLKIT_AUTHFW", [Authentication Framework to use])

case $POLKIT_AUTHFW in
  none)
    need_pam=no
    AC_DEFINE(POLKIT_AUTHFW_NONE, 1, [If using no authentication framework])
    ;;

  pam)
    need_pam=yes
    AC_DEFINE(POLKIT_AUTHFW_PAM, 1, [If using the PAM authentication framework])
    ;;

337 338 339 340 341 342
  shadow)
    need_pam=no
    AUTH_LIBS="${AUTH_LIBS} -lcrypt"
    AC_DEFINE(POLKIT_AUTHFW_SHADOW, 1, [If using the Shadow authentication framework])
    ;;

343 344 345 346 347 348 349
  *)
    AC_MSG_ERROR([Unknown Authentication Framework: $POLKIT_AUTHFW])
    ;;
esac

AM_CONDITIONAL(POLKIT_AUTHFW_NONE, [test x$POLKIT_AUTHFW = xnone], [Using no authfw])
AM_CONDITIONAL(POLKIT_AUTHFW_PAM, [test x$POLKIT_AUTHFW = xpam], [Using PAM authfw])
350
AM_CONDITIONAL(POLKIT_AUTHFW_SHADOW, [test x$POLKIT_AUTHFW = xshadow], [Using Shadow authfw])
351

352

353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371
dnl ---------------------------------------------------------------------------
dnl - Check for PAM
dnl ---------------------------------------------------------------------------

withval=""
AC_ARG_WITH(pam-prefix,
[  --with-pam-prefix=<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
372 373 374 375
if test "$need_pam" = yes ; then
  AC_CHECK_LIB(pam, pam_start, have_pam=yes)
fi

376
if test x$have_pam = xno; then
377 378 379
    if test "$need_pam" = yes ; then
      AC_ERROR([Could not find pam/pam-devel, please install the needed packages.])
    fi
380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435
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 <stdio.h>
                      #include <stdlib.h>
                      #include <security/pam_appl.h>],
                     [pam_handle_t *pamh = 0;
                      char *s = pam_strerror(pamh, PAM_SUCCESS);],
                     [ac_pam_strerror_args=2],
                     [AC_TRY_COMPILE([#include <stdio.h>
                                      #include <stdlib.h>
                                      #include <security/pam_appl.h>],
                                     [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)

Jim Li's avatar
Jim Li committed
436
AC_ARG_WITH(os-type,     [  --with-os-type=<os>        distribution or OS (redhat/suse/gentoo/pardus/solaris)])
437 438 439 440 441

#### 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")
Doug Goldstein's avatar
Doug Goldstein committed
442
	AC_CHECK_FILE(/etc/gentoo-release,distro_type="gentoo")
443
	AC_CHECK_FILE(/etc/pardus-release,distro_type="pardus")
444 445 446 447 448 449 450 451 452 453 454 455 456
	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
Doug Goldstein's avatar
Doug Goldstein committed
457 458
    elif test x$operating_system = xgentoo ; then
        with_os_type=gentoo
459 460
    elif test x$operating_system = xpardus ; then
        with_os_type=pardus
Jim Li's avatar
Jim Li committed
461 462
    elif test x$operating_system = xsolaris ; then
	with_os_type=solaris
463 464 465 466 467 468 469 470 471
    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])
Doug Goldstein's avatar
Doug Goldstein committed
472
AM_CONDITIONAL(OS_TYPE_GENTOO, test x$with_os_type = xgentoo, [Running on Gentoo OS'es])
473
AM_CONDITIONAL(OS_TYPE_PARDUS, test x$with_os_type = xpardus, [Running on Pardus OS'es])
Joe Clarke's avatar
Joe Clarke committed
474 475
AM_CONDITIONAL(OS_TYPE_SOLARIS, test x$with_os_type = xsolaris, [Running os Solaris OS'es])
AM_CONDITIONAL(OS_TYPE_FREEBSD, test x$with_os_type = xfreebsd, [Running on FreeBSD OS'es])
476 477 478 479 480 481 482 483 484

AC_ARG_WITH(pam-include, [  --with-pam-include=<file>  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
485
elif test x$with_os_type = xredhat -o x$with_os_type = xgentoo -o x$with_os_type = xpardus ; then
486 487 488 489
   PAM_FILE_INCLUDE_AUTH=system-auth
   PAM_FILE_INCLUDE_ACCOUNT=system-auth
   PAM_FILE_INCLUDE_PASSWORD=system-auth
   PAM_FILE_INCLUDE_SESSION=system-auth
Jim Li's avatar
Jim Li committed
490
elif test x$with_os_type = xsuse -o x$with_os_type = xsolaris ; then
491 492 493 494
   PAM_FILE_INCLUDE_AUTH=common-auth
   PAM_FILE_INCLUDE_ACCOUNT=common-account
   PAM_FILE_INCLUDE_PASSWORD=common-password
   PAM_FILE_INCLUDE_SESSION=common-session
Joe Clarke's avatar
Joe Clarke committed
495 496 497 498 499
elif test x$with_os_type = xfreebsd ; then
    PAM_FILE_INCLUDE_AUTH=system
    PAM_FILE_INCLUDE_ACCOUNT=system
    PAM_FILE_INCLUDE_PASSWORD=system
    PAM_FILE_INCLUDE_SESSION=system
500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515
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])

Jim Li's avatar
Jim Li committed
516 517 518 519 520 521 522 523 524
dnl ---------------------------------------------------------------------------
dnl - check OS 
dnl ---------------------------------------------------------------------------
case "$host_os" in
  *linux*)
	;;
  *solaris*)
	AC_DEFINE([HAVE_SOLARIS], 1, [Is this a Solaris system?])
	;;
Joe Clarke's avatar
Joe Clarke committed
525 526 527
  *freebsd*)
  	AC_DEFINE([HAVE_FREEBSD], 1, [Is this a FreeBSD system?])
	;;
Jim Li's avatar
Jim Li committed
528 529
esac

Joe Clarke's avatar
Joe Clarke committed
530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548
have_inotify=no
AC_CHECK_HEADERS([linux/inotify.h], [have_inotify=yes])
AC_CHECK_HEADERS([sys/inotify.h], [have_inotify=yes])

AM_CONDITIONAL(HAVE_INOTIFY, test "x$have_inotify" = "xyes")

if test "x$have_inotify" = "xyes" ; then
    AC_DEFINE([HAVE_INOTIFY], 1, [Enable Linux inotify() usage])
fi

have_kqueue=yes
AC_CHECK_FUNCS([kqueue],,have_kqueue=no)

AM_CONDITIONAL(HAVE_KQUEUE, test "x$have_kqueue" = "xyes")

if test "x$have_kqueue" = "xyes" ; then
    AC_DEFINE([HAVE_KQUEUE], 1, [Enable BSD kqueue() usage])
fi

549 550 551 552 553 554 555 556 557 558 559
# ********************
# 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])


David Zeuthen's avatar
David Zeuthen committed
560 561
AC_OUTPUT([
Makefile
David Zeuthen's avatar
David Zeuthen committed
562
data/Makefile
563 564 565
data/polkit-grant-1
data/polkit-1.pc
data/polkit-grant-1.pc
566
src/Makefile
567
src/kit/Makefile
568 569
src/polkit/Makefile
src/polkit-grant/Makefile
David Zeuthen's avatar
David Zeuthen committed
570 571
tools/Makefile
doc/Makefile
David Zeuthen's avatar
David Zeuthen committed
572
doc/version.xml
573
doc/man/Makefile
David Zeuthen's avatar
David Zeuthen committed
574
policy/Makefile
575
po/Makefile.in
576
test/Makefile
David Zeuthen's avatar
David Zeuthen committed
577 578 579 580
])

dnl ==========================================================================
echo "
Kay Sievers's avatar
Kay Sievers committed
581
                  PolicyKit $VERSION
582
                =================
David Zeuthen's avatar
David Zeuthen committed
583 584

        prefix:                     ${prefix}
585 586 587 588 589 590 591 592
        libdir:                     ${libdir}
        libexecdir:                 ${libexecdir}
        bindir:                     ${bindir}
        sbindir:                    ${sbindir}
        datadir:                    ${datadir}
        sysconfdir:                 ${sysconfdir}
        localstatedir:              ${localstatedir}
        docdir:                     ${docdir}
David Zeuthen's avatar
David Zeuthen committed
593 594 595 596

        compiler:                   ${CC}
        cflags:                     ${CFLAGS}
        cppflags:                   ${CPPFLAGS}
David Zeuthen's avatar
David Zeuthen committed
597
        xsltproc:                   ${XSLTPROC}
David Zeuthen's avatar
David Zeuthen committed
598

599 600 601
        user for PolicyKit:         ${POLKIT_USER}
        group for PolicyKit:        ${POLKIT_GROUP}

602
        authorization database:     ${POLKIT_AUTHDB}
603
        authentication framework:   ${POLKIT_AUTHFW}
604

605
        Distribution/OS:            ${with_os_type}
606
        SELinux support:            ${have_selinux}
607

608 609 610 611
        PAM support:                ${have_pam}"

if test "$have_pam" = yes ; then
echo "        PAM file auth:              ${PAM_FILE_INCLUDE_AUTH}
612 613
        PAM file account:           ${PAM_FILE_INCLUDE_ACCOUNT}
        PAM file password:          ${PAM_FILE_INCLUDE_PASSWORD}
614 615
        PAM file session:           ${PAM_FILE_INCLUDE_SESSION}"
fi
616

617
echo "
David Zeuthen's avatar
David Zeuthen committed
618
        Maintainer mode:            ${USE_MAINTAINER_MODE}
619 620
        Building unit tests:        ${enable_tests}
        GCC coverage profiling:     ${enable_gcov}
David Zeuthen's avatar
David Zeuthen committed
621 622
        Building verbose mode:      ${enable_verbose_mode}
        Building api docs:          ${enable_gtk_doc}
623
        Building man pages:         ${enable_man_pages}
David Zeuthen's avatar
David Zeuthen committed
624
"
625

626 627
if test x$enable_tests = xyes; then
  echo "NOTE: Building with unit tests increases the size of the installed "
628
  echo "      library and renders it insecure."
629 630
  echo
fi
631

632 633 634 635
if test x$enable_gcov = xyes; then
  echo "NOTE: Building with coverage profiling is definitely for developers only."
  echo 
fi
636

637 638 639 640
if test "${POLKIT_AUTHDB}" = default ; then
  echo "NOTE: Remember to create user ${POLKIT_USER} and group ${POLKIT_GROUP}"
  echo "      before 'make install'"
  echo
641
  echo "NOTE: The directories ${localstatedir}/run/polkit-1 and ${localstatedir}/lib/polkit-1 will be"
642 643
  echo "      owned by group ${POLKIT_GROUP} and will be mode 770."
  echo
644
  echo "NOTE: The directory ${localstatedir}/lib/polkit-public-1 will be"
645 646
  echo "      owned by user ${POLKIT_USER} and will be mode 755."
  echo
647
  echo "NOTE: The file ${localstatedir}/lib/misc/polkit-1.reload will be"
648
  echo "      owned by user ${POLKIT_USER} and group ${POLKIT_GROUP} and will be mode 664."
649
  echo
650
  echo "NOTE: ${libexecdir}/polkit-set-default-helper-1 will be owned by"
651
  echo "      user ${POLKIT_USER} and installed with mode 4755 (setuid binary)."
652
  echo
653
  echo "NOTE: ${libexecdir}/polkit-read-auth-helper-1 will be owned by"
654 655
  echo "      group ${POLKIT_GROUP} and installed with mode 2755 (setgid binary)."
  echo
656
  echo "NOTE: ${libexecdir}/polkit-revoke-helper-1 will be owned by"
657 658
  echo "      group '${POLKIT_GROUP} and installed with mode 2755 (setgid binary)."
  echo
659
  echo "NOTE: ${libexecdir}/polkit-grant-helper-1 will be owned by"
660 661
  echo "      group ${POLKIT_GROUP} and installed with mode 2755 (setgid binary)."
  echo
662
  echo "NOTE: ${libexecdir}/polkit-explicit-grant-helper-1 will be owned by"
663 664
  echo "      group ${POLKIT_GROUP} and installed with mode 2755 (setgid binary)."
  echo
665
  echo "NOTE: ${libexecdir}/polkit-grant-helper-pam-1 will be owned by group"
666
  echo "      ${POLKIT_GROUP} and installed with mode 4754 (setuid root binary)."
667
fi
668

669
echo
670
echo "NOTE: ${libexecdir}/polkit-resolve-exe-helper-1 will be installed with"
671 672 673 674
echo "      mode 4755 (setuid root binary)."
echo
echo "NOTE: For packaging, remember to retain the modes and ownership."
echo
675 676
echo "See the README file for the rationale for these modes/permissions."
echo