1dnl -*- mode: m4 -*- 2 3AC_PREREQ(2.60) 4AC_INIT([xfce4-screensaver], 5 [4.16.0], 6 [https://www.xfce.org/]) 7 8AC_CONFIG_SRCDIR(src/xfce4-screensaver.c) 9AC_CONFIG_MACRO_DIRS([m4]) 10 11AM_INIT_AUTOMAKE([1.11 dist-bzip2 tar-ustar no-dist-gzip check-news foreign]) 12m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) 13 14AC_CONFIG_HEADERS(config.h) 15 16AM_MAINTAINER_MODE 17 18dnl Silence warning: `ar: 'u' modifier ignored since 'D' is the default` 19dnl SEE https://www.mail-archive.com/automake-patches@gnu.org/msg07705.html 20AC_SUBST(AR_FLAGS, [cr]) 21 22IT_PROG_INTLTOOL([0.50.1]) 23AC_PROG_CC 24AM_PROG_CC_C_O 25AC_STDC_HEADERS 26AC_CANONICAL_HOST 27 28AC_HEADER_STDC 29 30LT_PREREQ([2.4]) 31LT_INIT([disable-static]) 32 33AC_SUBST(VERSION) 34 35# Save flags to aclocal 36ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS" 37 38GETTEXT_PACKAGE=xfce4-screensaver 39AC_SUBST(GETTEXT_PACKAGE) 40AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Name of default gettext domain]) 41 42AM_GLIB_GNU_GETTEXT 43 44dnl 45dnl Enable gsettings schema macros 46dnl 47 48GLIB_GSETTINGS 49 50# Dependencies 51 52DBUS_REQUIRED_VERSION=0.30 53GLIB_REQUIRED_VERSION=2.50.0 54GTK_REQUIRED_VERSION=3.22.0 55X11_REQUIRED_VERSION=1.0 56LIBXKLAVIER_REQUIRED=5.2 57XRANDR_REQUIRED=1.3 58LIBXFCONF_REQUIRED=4.12.1 59LIBXFCE4UI_REQUIRED=4.12.1 60LIBXFCE4UTIL_REQUIRED=4.12.1 61LIBGARCON_REQUIRED=0.5.0 62LIBWNCK_REQUIRED=3.20 63 64AC_CHECK_HEADERS(unistd.h) 65AC_CHECK_HEADERS(crypt.h sys/select.h) 66AC_CHECK_FUNCS(select fcntl uname nice setpriority getcwd getwd putenv sbrk) 67AC_CHECK_FUNCS(sigaction syslog realpath setrlimit) 68AC_CHECK_FUNCS(getresuid) 69AC_TYPE_UID_T 70 71dnl Checks for X is RANDR extension 72 73AC_MSG_CHECKING(for xrandr) 74if $PKG_CONFIG --atleast-version $XRANDR_REQUIRED xrandr; then 75 AC_MSG_RESULT(yes) 76 AC_DEFINE(HAVE_RANDR, 1, 77 [Define if the xrandr-$XRANDR_REQUIRED library is present]) 78 have_randr=yes 79 RANDR_PACKAGE=xrandr 80else 81 AC_MSG_RESULT(no) 82 have_randr=no 83 RANDR_PACKAGE= 84fi 85 86AC_SUBST(RANDR_PACKAGE) 87 88AC_CHECK_FUNCS([setresuid setenv unsetenv clearenv]) 89PKG_CHECK_MODULES(XFCE_SCREENSAVER, 90 x11 >= $X11_REQUIRED_VERSION 91 xscrnsaver 92 gtk+-3.0 >= $GTK_REQUIRED_VERSION 93 dbus-glib-1 >= $DBUS_REQUIRED_VERSION 94 gio-2.0 >= $GLIB_REQUIRED_VERSION 95 libxklavier >= $LIBXKLAVIER_REQUIRED 96 libxfconf-0 >= $LIBXFCONF_REQUIRED 97 garcon-gtk3-1 >= $LIBGARCON_REQUIRED 98 libwnck-3.0 >= $LIBWNCK_REQUIRED 99 $RANDR_PACKAGE) 100AC_SUBST(XFCE_SCREENSAVER_CFLAGS) 101AC_SUBST(XFCE_SCREENSAVER_LIBS) 102 103PKG_CHECK_MODULES(XFCE_SCREENSAVER_DIALOG, 104 gio-2.0 >= $GLIB_REQUIRED_VERSION 105 gthread-2.0 106 gtk+-3.0 >= $GTK_REQUIRED_VERSION) 107AC_SUBST(XFCE_SCREENSAVER_DIALOG_CFLAGS) 108AC_SUBST(XFCE_SCREENSAVER_DIALOG_LIBS) 109 110PKG_CHECK_MODULES(XFCE_SCREENSAVER_CAPPLET, 111 gio-2.0 >= $GLIB_REQUIRED_VERSION 112 gtk+-3.0 >= $GTK_REQUIRED_VERSION 113 libxklavier >= $LIBXKLAVIER_REQUIRED 114 libxfce4ui-2 >= $LIBXFCE4UI_REQUIRED 115 libxfconf-0 >= $LIBXFCONF_REQUIRED 116 garcon-gtk3-1 >= $LIBGARCON_REQUIRED) 117AC_SUBST(XFCE_SCREENSAVER_CAPPLET_CFLAGS) 118AC_SUBST(XFCE_SCREENSAVER_CAPPLET_LIBS) 119 120PKG_CHECK_MODULES(XFCE_SCREENSAVER_COMMAND, 121 gobject-2.0 >= $GLIB_REQUIRED_VERSION 122 gio-2.0 >= $GLIB_REQUIRED_VERSION) 123AC_SUBST(XFCE_SCREENSAVER_COMMAND_CFLAGS) 124AC_SUBST(XFCE_SCREENSAVER_COMMAND_LIBS) 125 126PKG_CHECK_MODULES(XFCE_SCREENSAVER_SAVER, 127 gthread-2.0 128 gtk+-3.0 >= $GTK_REQUIRED_VERSION 129 gobject-2.0 >= $GLIB_REQUIRED_VERSION 130 libxfce4util-1.0 >= $LIBXFCE4UTIL_REQUIRED) 131AC_SUBST(XFCE_SCREENSAVER_SAVER_CFLAGS) 132AC_SUBST(XFCE_SCREENSAVER_SAVER_LIBS) 133 134AC_PATH_XTRA 135 136ALL_X_LIBS="$X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS" 137SAVER_LIBS="$ALL_X_LIBS" 138 139AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal) 140 141# Solaris requires libresolv for daemon() 142case "$host" in 143 *-*-solaris*) 144 AC_CHECK_LIB(resolv, daemon, [XFCE_SCREENSAVER_LIBS="$XFCE_SCREENSAVER_LIBS -lresolv"]) 145 ;; 146esac 147 148# Find out where the session service file goes 149# The sad sed hack is recomended by section 27.10 of the automake manual. 150DBUS_SESSION_SERVICE_DIR=`pkg-config --variable session_bus_services_dir dbus-1 | sed -e 's,/usr/share,${datarootdir},g'` 151AC_SUBST(DBUS_SESSION_SERVICE_DIR) 152 153# Determine PAM prefix 154 155withval="" 156AC_ARG_WITH(pam-prefix, 157[ --with-pam-prefix=<prefix> specify where pam files go],[ 158if test x$withval != x; then 159 AC_MSG_RESULT("PAM files will be installed in prefix ${withval}.") 160fi]) 161if test x$withval != x; then 162 PAM_PREFIX_UNEXPANDED="$withval" 163else 164 PAM_PREFIX_UNEXPANDED="$sysconfdir" 165fi 166PAM_PREFIX=`eval echo $PAM_PREFIX_UNEXPANDED` 167AC_SUBST(PAM_PREFIX) 168 169# Determine the PAM authentication type 170 171AC_CACHE_CHECK([for PAM auth type], ac_cv_pam_auth_type, 172 [if test -f /etc/pam.d/common-auth ; then 173 ac_cv_pam_auth_type=common 174 else 175 ac_cv_pam_auth_type=system 176 fi]) 177withval="" 178AC_ARG_WITH(pam-auth-type, 179[ --with-pam-auth-type=<auth-type> specify pam auth type (common or system)],[ 180if test x$withval != x; then 181 ac_cv_pam_auth_type="$withval" 182fi]) 183PAM_AUTH_TYPE="$ac_cv_pam_auth_type" 184AC_SUBST(PAM_AUTH_TYPE) 185 186# Translation distcheck fix 187XGETTEXT_ARGS= 188AC_SUBST(XGETTEXT_ARGS) 189 190dnl --------------------------------------------------------------------------- 191dnl - Where should we put documentation ? 192dnl --------------------------------------------------------------------------- 193AC_ARG_WITH(doc-dir, 194 [AC_HELP_STRING([--with-doc-dir=<dir>], 195 [directory to install documentation])]) 196if ! test -z "$with_doc_dir"; then 197 DOCDIR="$with_doc_dir/xfce4-screensaver-$VERSION" 198else 199 DOCDIR="$datadir/doc/xfce4-screensaver-$VERSION" 200fi 201AC_SUBST(DOCDIR) 202 203dnl --------------------------------------------------------------------------- 204dnl - DocBook Documentation 205dnl --------------------------------------------------------------------------- 206AC_ARG_ENABLE(docbook-docs, [ --enable-docbook-docs build documentation (requires xmlto)],enable_docbook_docs=$enableval,enable_docbook_docs=no) 207AC_PATH_PROG(XMLTO, xmlto, no) 208AC_MSG_CHECKING([whether to build DocBook documentation]) 209if test x$XMLTO = xno ; then 210 have_docbook=no 211else 212 have_docbook=yes 213fi 214if test x$enable_docbook_docs = xauto ; then 215 if test x$have_docbook = xno ; then 216 enable_docbook_docs=no 217 else 218 enable_docbook_docs=yes 219 fi 220fi 221if test x$enable_docbook_docs = xyes; then 222 if test x$have_docbook = xno; then 223 AC_MSG_ERROR([Building DocBook docs explicitly required, but DocBook not found]) 224 fi 225fi 226AM_CONDITIONAL(DOCBOOK_DOCS_ENABLED, test x$enable_docbook_docs = xyes) 227AC_MSG_RESULT(yes) 228 229dnl --------------------------------------------------------------------------- 230dnl - Some utility functions to make checking for X things easier. 231dnl --------------------------------------------------------------------------- 232 233# Like AC_CHECK_HEADER, but it uses the already-computed -I directories. 234# 235AC_DEFUN([AC_CHECK_X_HEADER], [ 236 ac_save_CPPFLAGS="$CPPFLAGS" 237 if test \! -z "$includedir" ; then 238 CPPFLAGS="$CPPFLAGS -I$includedir" 239 fi 240 CPPFLAGS="$CPPFLAGS $X_CFLAGS" 241 AC_CHECK_HEADER([$1],[$2],[$3],[$4]) 242 CPPFLAGS="$ac_save_CPPFLAGS"]) 243 244# Like AC_TRY_COMPILE, but it uses the already-computed -I directories. 245# 246AC_DEFUN([AC_TRY_X_COMPILE], [ 247 ac_save_CPPFLAGS="$CPPFLAGS" 248 if test \! -z "$includedir" ; then 249 CPPFLAGS="$CPPFLAGS -I$includedir" 250 fi 251 CPPFLAGS="$CPPFLAGS $X_CFLAGS" 252 AC_TRY_COMPILE([$1], [$2], [$3], [$4]) 253 CPPFLAGS="$ac_save_CPPFLAGS"]) 254 255 256# Like AC_CHECK_LIB, but it uses the already-computed -I and -L directories. 257# Use this sparingly; it probably doesn't work very well on X programs. 258# 259AC_DEFUN([AC_CHECK_X_LIB], [ 260 ac_save_CPPFLAGS="$CPPFLAGS" 261 ac_save_LDFLAGS="$LDFLAGS" 262# ac_save_LIBS="$LIBS" 263 264 if test \! -z "$includedir" ; then 265 CPPFLAGS="$CPPFLAGS -I$includedir" 266 fi 267 # note: $X_CFLAGS includes $x_includes 268 CPPFLAGS="$CPPFLAGS $X_CFLAGS" 269 270 if test \! -z "$libdir" ; then 271 LDFLAGS="$LDFLAGS -L$libdir" 272 fi 273 # note: $X_LIBS includes $x_libraries 274 LDFLAGS="$LDFLAGS $ALL_X_LIBS" 275 276 AC_CHECK_LIB([$1], [$2], [$3], [$4], [$5]) 277 CPPFLAGS="$ac_save_CPPFLAGS" 278 LDFLAGS="$ac_save_LDFLAGS" 279# LIBS="$ac_save_LIBS" 280 ]) 281 282 283# Usage: HANDLE_X_PATH_ARG([variable_name], 284# [--command-line-option], 285# [descriptive string]) 286# 287# All of the --with options take three forms: 288# 289# --with-foo (or --with-foo=yes) 290# --without-foo (or --with-foo=no) 291# --with-foo=/DIR 292# 293# This function, HANDLE_X_PATH_ARG, deals with the /DIR case. When it sees 294# a directory (string beginning with a slash) it checks to see whether 295# /DIR/include and /DIR/lib exist, and adds them to $X_CFLAGS and $X_LIBS 296# as appropriate. 297# 298AC_DEFUN([HANDLE_X_PATH_ARG], [ 299 case "$[$1]" in 300 yes) ;; 301 no) ;; 302 303 /*) 304 AC_MSG_CHECKING([for [$3] headers]) 305 d=$[$1]/include 306 if test -d $d; then 307 X_CFLAGS="-I$d $X_CFLAGS" 308 AC_MSG_RESULT($d) 309 else 310 AC_MSG_RESULT(not found ($d: no such directory)) 311 fi 312 313 AC_MSG_CHECKING([for [$3] libs]) 314 d=$[$1]/lib 315 if test -d $d; then 316 X_LIBS="-L$d $X_LIBS" 317 AC_MSG_RESULT($d) 318 else 319 AC_MSG_RESULT(not found ($d: no such directory)) 320 fi 321 322 # replace the directory string with "yes". 323 [$1]_req="yes" 324 [$1]=$[$1]_req 325 ;; 326 327 *) 328 echo "" 329 echo "error: argument to [$2] must be \"yes\", \"no\", or a directory." 330 echo " If it is a directory, then \`DIR/include' will be added to" 331 echo " the -I list, and \`DIR/lib' will be added to the -L list." 332 exit 1 333 ;; 334 esac 335 ]) 336 337dnl --------------------------------------------------------------------------- 338dnl - Check for shaped window extension 339dnl --------------------------------------------------------------------------- 340 341have_shape=no 342AC_CHECK_X_HEADER(X11/extensions/shape.h, [have_shape=yes],, 343 [#include <X11/Xlib.h>]) 344if test "$have_shape" = yes; then 345 AC_DEFINE(HAVE_SHAPE_EXT, 1, [Define if shape extension is available]) 346fi 347 348dnl --------------------------------------------------------------------------- 349dnl - Check for the XF86VMODE server extension (for gamma fading.) 350dnl --------------------------------------------------------------------------- 351 352have_xf86vmode=no 353have_xf86gamma=no 354have_xf86gamma_ramp=no 355with_xf86gamma_req=unspecified 356AC_ARG_WITH(xf86gamma-ext, 357[ --with-xf86gamma-ext Include support for XFree86 gamma fading.], 358 [with_xf86gamma="$withval"; with_xf86gamma_req="$withval"], 359 [with_xf86gamma=yes]) 360 361HANDLE_X_PATH_ARG(with_xf86gamma, --with-xf86gamma-ext, xf86gamma) 362 363if test "$with_xf86gamma" = yes; then 364 365 # first check for xf86vmode.h, if we haven't already 366 if test "$have_xf86vmode" = yes; then 367 have_xf86gamma=yes 368 else 369 AC_CHECK_X_HEADER(X11/extensions/xf86vmode.h, [have_xf86gamma=yes],, 370 [#include <X11/Xlib.h>]) 371 fi 372 373 # if that succeeded, then check for the -lXxf86vm 374 if test "$have_xf86gamma" = yes; then 375 have_xf86gamma=no 376 AC_CHECK_X_LIB(Xxf86vm, XF86VidModeSetGamma, 377 [have_xf86gamma=yes], 378 [true], -lXext -lX11) 379 fi 380 381 # check for the Ramp versions of the functions too. 382 if test "$have_xf86gamma" = yes; then 383 have_xf86gamma_ramp=no 384 AC_CHECK_X_LIB(Xxf86vm, XF86VidModeSetGammaRamp, 385 [have_xf86gamma_ramp=yes], 386 [true], -lXext -lX11) 387 fi 388 389 # if those tests succeeded, then we've really got the functions. 390 if test "$have_xf86gamma" = yes; then 391 AC_DEFINE(HAVE_XF86VMODE_GAMMA, 1, [Define if XF86VMODE Gamma is available]) 392 fi 393 394 if test "$have_xf86gamma_ramp" = yes; then 395 AC_DEFINE(HAVE_XF86VMODE_GAMMA_RAMP, 1, [Define if XF86VMODE Gamma Ramp is available]) 396 fi 397 398 # pull in the lib, if we haven't already 399 if test "$have_xf86gamma" = yes -a "$have_xf86vmode" = no; then 400 SAVER_LIBS="$SAVER_LIBS -lXxf86vm" 401 fi 402 403elif test "$with_xf86gamma" != no; then 404 echo "error: must be yes or no: --with-xf86gamma-ext=$with_xf86vmode" 405 exit 1 406fi 407 408dnl --------------------------------------------------------------------------- 409dnl - The --enable-locking option 410dnl --------------------------------------------------------------------------- 411 412AC_ARG_ENABLE(locking,[ 413Screen locking options: 414 415 --enable-locking Compile in support for locking the display. 416 --disable-locking Do not allow locking at all.], 417 [enable_locking="$enableval"],[enable_locking=yes]) 418if test "$enable_locking" = yes; then 419 true 420elif test "$enable_locking" = no; then 421 AC_DEFINE(NO_LOCKING, 1, [Define if screen locking support is disabled]) 422else 423 echo "error: must be yes or no: --enable-locking=$enable_locking" 424 exit 1 425fi 426 427# Check whether to use a xscreensaver hacks configuration directory 428AC_MSG_CHECKING([whether to use xscreensaver hacks configuration]) 429AC_ARG_WITH(xscreensaverdir, AC_HELP_STRING([--with-xscreensaverdir=dir], [Use xscreensaver hack configs found in directory],)) 430xscreensaverdir= 431if test "x$with_xscreensaverdir" = "xyes"; then 432 if test -d /usr/share/xscreensaver/config; then 433 xscreensaverdir=/usr/share/xscreensaver/config 434 elif test -d /etc/xscreensaver; then 435 xscreensaverdir=/etc/xscreensaver 436 fi 437elif test "x$with_xscreensaverdir" = "x" -o "x$with_xscreensaverdir" = "xno"; then 438 xscreensaverdir= 439else 440 xscreensaverdir="$with_xscreensaverdir" 441fi 442 443if test "x$xscreensaverdir" != "x" ; then 444 AC_DEFINE_UNQUOTED(XSCREENSAVER_CONFIG_DIR, "$xscreensaverdir", [Define to the directory containing XScreensaver configuration files]) 445 AC_MSG_RESULT([$xscreensaverdir]) 446else 447 AC_MSG_RESULT([no]) 448fi 449 450# Path to xscreensaver hack executables 451AC_ARG_WITH(xscreensaverhackdir, AC_HELP_STRING([--with-xscreensaverhackdir=dir], [Look for xscreensaver hack executables in directory],)) 452AC_MSG_CHECKING([for location of xscreensaver hack executables]) 453xscreensaverhackdir= 454if test "x$with_xscreensaverhackdir" = "xyes" -o "x$with_xscreensaverhackdir" = "x"; then 455 if test -d /usr/X11R6/lib/xscreensaver; then 456 xscreensaverhackdir=/usr/X11R6/lib/xscreensaver 457 elif test -d $prefix/libexec/xscreensaver; then 458 xscreensaverhackdir=$prefix/libexec/xscreensaver 459 elif test -d /usr/libexec/xscreensaver; then 460 xscreensaverhackdir=/usr/libexec/xscreensaver 461 elif test -d /usr/lib/xscreensaver; then 462 xscreensaverhackdir=/usr/lib/xscreensaver 463 elif test -d /usr/lib64/xscreensaver; then 464 xscreensaverhackdir=/usr/lib64/xscreensaver 465 fi 466elif test "x$with_xscreensaverhackdir" != "xno"; then 467 xscreensaverhackdir="$with_xscreensaverhackdir" 468fi 469 470if test "x$xscreensaverhackdir" != "x" ; then 471 AC_DEFINE_UNQUOTED(XSCREENSAVER_HACK_DIR, "$xscreensaverhackdir", [Define to the directory containing XScreensaver hack executables]) 472 AC_MSG_RESULT([$xscreensaverhackdir]) 473else 474 AC_MSG_RESULT([no]) 475 AC_MSG_WARN([could not find directory containing xscreensaver hacks]) 476fi 477 478dnl --------------------------------------------------------------------------- 479dnl - Check for GL 480dnl --------------------------------------------------------------------------- 481 482AC_ARG_WITH(libgl, [ --with-libgl build with GL support]) 483have_libgl=no 484GL_LIBS="" 485 486if test x$with_libgl != xno; then 487 AC_CHECK_X_HEADER(GL/gl.h, have_gl=yes, have_gl=no) 488 if test "$have_gl" = yes ; then 489 AC_CHECK_X_HEADER(GL/glx.h, have_gl=yes, have_gl=no, 490 [#include <GL/gl.h>]) 491 fi 492 493 if test "$have_gl" = yes ; then 494 AC_CHECK_X_LIB(GL, glXChooseVisual, have_libgl=yes, have_libgl=no, -lm) 495 fi 496fi 497 498if test "x$have_libgl" = "xyes"; then 499 AC_DEFINE(HAVE_LIBGL, 1, [Define if libgl is available]) 500 GL_LIBS="-lGL $GL_LIBS" 501fi 502 503dnl --------------------------------------------------------------------------- 504dnl - Check for bsd_auth(3) (OpenBSD) 505dnl --------------------------------------------------------------------------- 506have_bsdauth=no 507with_bsdauth_req=unspecified 508NEED_SETUID=no 509 510case "$host" in 511 *-openbsd*) 512 with_bsdauth=yes 513 AUTH_SCHEME=bsdauth 514 NEED_SETUID=no 515 if test "x$enable_locking" = "xyes"; then 516 with_bsdauth_req=yes 517 NEED_SETUID=yes 518 fi 519esac 520 521if test "$with_bsdauth" = yes ; then 522 AC_CACHE_CHECK([for BSD Authentication], ac_cv_bsdauth, 523 [AC_TRY_X_COMPILE([#include <stdlib.h> 524 #include <unistd.h> 525 #include <sys/types.h> 526 #include <bsd_auth.h>], 527 [int ok = auth_userokay("x", 0, "x", "x");], 528 [ac_cv_bsdauth=yes], 529 [ac_cv_bsdauth=no])]) 530 if test "$ac_cv_bsdauth" = yes; then 531 have_bsdauth=yes 532 fi 533fi 534 535if test "$have_bsdauth" = yes; then 536 AC_DEFINE(HAVE_BSDAUTH, 1, [Define to 1 if using bsd_auth(3) authentication]) 537fi 538 539AC_SUBST(NEED_SETUID) 540 541dnl --------------------------------------------------------------------------- 542dnl - Check for PAM 543dnl --------------------------------------------------------------------------- 544 545have_pam=no 546AC_ARG_ENABLE(pam, AC_HELP_STRING([--enable-pam], 547 [Enable PAM support @<:@default=auto@:>@], 548 ),,enable_pam=auto) 549 550if test "x$enable_locking" = "xyes" -a "x$enable_pam" != "xno" -a "x$have_bsdauth" = "xno"; then 551AC_CHECK_LIB(pam, pam_start, have_pam=yes) 552fi 553if test "x$have_pam" = "xyes"; then 554 555 AUTH_LIBS="${AUTH_LIBS} -lpam" 556 AC_DEFINE(HAVE_PAM, 1, [Define if PAM support is included]) 557 558 # On Linux, sigtimedwait() is in libc; on Solaris, it's in librt. 559 have_timedwait=no 560 AC_CHECK_LIB(c, sigtimedwait, [have_timedwait=yes]) 561 if test "$have_timedwait" = no ; then 562 AC_CHECK_LIB(rt, sigtimedwait, [AUTH_LIBS="${AUTH_LIBS} -lrt"]) 563 fi 564 565 AC_MSG_CHECKING(how to call pam_strerror) 566 AC_CACHE_VAL(ac_cv_pam_strerror_args, 567 [AC_TRY_COMPILE([#include <stdio.h> 568 #include <stdlib.h> 569 #include <security/pam_appl.h>], 570 [pam_handle_t *pamh = 0; 571 const char *s = pam_strerror(pamh, PAM_SUCCESS);], 572 [ac_pam_strerror_args=2], 573 [AC_TRY_COMPILE([#include <stdio.h> 574 #include <stdlib.h> 575 #include <security/pam_appl.h>], 576 [char *s = 577 pam_strerror(PAM_SUCCESS);], 578 [ac_pam_strerror_args=1], 579 [ac_pam_strerror_args=0])]) 580 ac_cv_pam_strerror_args=$ac_pam_strerror_args]) 581 ac_pam_strerror_args=$ac_cv_pam_strerror_args 582 if test "$ac_pam_strerror_args" = 1 ; then 583 AC_MSG_RESULT(one argument) 584 elif test "$ac_pam_strerror_args" = 2 ; then 585 AC_DEFINE(PAM_STRERROR_TWO_ARGS, 1, [Define if pam_strerror takes two arguments]) 586 AC_MSG_RESULT(two arguments) 587 else 588 AC_MSG_RESULT(unknown) 589 fi 590 591fi 592AM_CONDITIONAL(HAVE_PAM, test x$have_pam = xyes) 593AC_SUBST(HAVE_PAM) 594 595 596# Check for the nine billion variants of shadow passwords... 597 598need_setuid=no 599 600have_shadow=no 601have_shadow_enhanced=no 602have_shadow_adjunct=no 603have_shadow_hpux=no 604have_passwd_helper=no 605 606with_shadow_req=unspecified 607 608AC_ARG_WITH(shadow, 609[ --with-shadow Include support for shadow password authentication.], 610 [with_shadow="$withval"; with_shadow_req="$withval"],[with_shadow=yes]) 611 612HANDLE_X_PATH_ARG(with_shadow, --with-shadow, shadow password) 613 614if test "$enable_locking" = no ; then 615 with_shadow_req=no 616 with_shadow=no 617fi 618 619 620# Check for Sun "adjunct" passwords. 621 622if test "$with_shadow" = yes ; then 623 AC_CACHE_CHECK([for Sun-style shadow passwords], ac_cv_sun_adjunct, 624 [AC_TRY_X_COMPILE([#include <stdlib.h> 625 #include <unistd.h> 626 #include <sys/types.h> 627 #include <sys/label.h> 628 #include <sys/audit.h> 629 #include <pwdadj.h>], 630 [struct passwd_adjunct *p = getpwanam("nobody"); 631 const char *pw = p->pwa_passwd;], 632 [ac_cv_sun_adjunct=yes], 633 [ac_cv_sun_adjunct=no])]) 634 if test "$ac_cv_sun_adjunct" = yes; then 635 have_shadow_adjunct=yes 636 have_shadow=yes 637 need_setuid=yes 638 fi 639fi 640 641 642# Check for DEC and SCO so-called "enhanced" security. 643 644if test "$with_shadow" = yes ; then 645 AC_CACHE_CHECK([for DEC-style shadow passwords], ac_cv_enhanced_passwd, 646 [AC_TRY_X_COMPILE([#include <stdlib.h> 647 #include <unistd.h> 648 #include <sys/types.h> 649 #include <pwd.h> 650 #include <sys/security.h> 651 #include <prot.h>], 652 [struct pr_passwd *p; 653 const char *pw; 654 set_auth_parameters(0, 0); 655 check_auth_parameters(); 656 p = getprpwnam("nobody"); 657 pw = p->ufld.fd_encrypt;], 658 [ac_cv_enhanced_passwd=yes], 659 [ac_cv_enhanced_passwd=no])]) 660 if test $ac_cv_enhanced_passwd = yes; then 661 have_shadow_enhanced=yes 662 have_shadow=yes 663 need_setuid=yes 664 665 # On SCO, getprpwnam() is in -lprot (which uses nap() from -lx) 666 # (I'm told it needs -lcurses too, but I don't understand why.) 667 # But on DEC, it's in -lsecurity. 668 # 669 AC_CHECK_LIB(prot, getprpwnam, 670 [AUTH_LIBS="$AUTH_LIBS -lprot -lcurses -lx"], 671 [AC_CHECK_LIB(security, getprpwnam, 672 [AUTH_LIBS="$AUTH_LIBS -lsecurity"])], 673 [-lx]) 674 fi 675fi 676 677# Check for HP's entry in the "Not Invented Here" Sweepstakes. 678 679if test "$with_shadow" = yes ; then 680 AC_CACHE_CHECK([for HP-style shadow passwords], ac_cv_hpux_passwd, 681 [AC_TRY_X_COMPILE([#include <stdlib.h> 682 #include <unistd.h> 683 #include <sys/types.h> 684 #include <pwd.h> 685 #include <hpsecurity.h> 686 #include <prot.h>], 687 [struct s_passwd *p = getspwnam("nobody"); 688 const char *pw = p->pw_passwd;], 689 [ac_cv_hpux_passwd=yes], 690 [ac_cv_hpux_passwd=no])]) 691 if test "$ac_cv_hpux_passwd" = yes; then 692 have_shadow_hpux=yes 693 have_shadow=yes 694 need_setuid=yes 695 696 # on HPUX, bigcrypt is in -lsec 697 AC_CHECK_LIB(sec, bigcrypt, [AUTH_LIBS="$AUTH_LIBS -lsec"]) 698 fi 699fi 700 701 702# Check for FreeBSD-style shadow passwords. 703# 704# On FreeBSD, getpwnam() and friends work just like on non-shadow- 705# password systems -- except you only get stuff in the pw_passwd field 706# if the running program is setuid. So, guess that we've got this 707# lossage to contend with if /etc/master.passwd exists, and default to 708# a setuid installation. 709 710if test "$with_shadow" = yes ; then 711 AC_CACHE_CHECK([for FreeBSD-style shadow passwords], ac_cv_master_passwd, 712 [if test -f /etc/master.passwd ; then 713 ac_cv_master_passwd=yes 714 else 715 ac_cv_master_passwd=no 716 fi]) 717 if test "$ac_cv_master_passwd" = yes; then 718 need_setuid=yes 719 fi 720fi 721 722 723# Check for "traditional" shadow passwords. 724 725if test "$with_shadow" = yes ; then 726 AC_CACHE_CHECK([for generic shadow passwords], ac_cv_shadow, 727 [AC_TRY_X_COMPILE([#include <stdlib.h> 728 #include <unistd.h> 729 #include <sys/types.h> 730 #include <pwd.h> 731 #include <shadow.h>], 732 [struct spwd *p = getspnam("nobody"); 733 const char *pw = p->sp_pwdp;], 734 [ac_cv_shadow=yes], 735 [ac_cv_shadow=no])]) 736 if test "$ac_cv_shadow" = yes; then 737 have_shadow=yes 738 need_setuid=yes 739 740 # On some systems (UnixWare 2.1), getspnam() is in -lgen instead of -lc. 741 have_getspnam=no 742 AC_CHECK_LIB(c, getspnam, [have_getspnam=yes]) 743 if test "$have_getspnam" = no ; then 744 AC_CHECK_LIB(gen, getspnam, 745 [have_getspnam=yes; AUTH_LIBS="$AUTH_LIBS -lgen"]) 746 fi 747 fi 748fi 749 750 751# Check for other libraries needed for non-shadow passwords. 752 753if test "$enable_locking" = yes ; then 754 755 # On some systems (UnixWare 2.1), crypt() is in -lcrypt instead of -lc. 756 have_crypt=no 757 AC_CHECK_LIB(c, crypt, [have_crypt=yes]) 758 if test "$have_crypt" = no ; then 759 AC_CHECK_LIB(crypt, crypt, 760 [have_crypt=yes; AUTH_LIBS="${AUTH_LIBS} -lcrypt"]) 761 fi 762fi 763 764# Most of the above shadow mechanisms will have set need_setuid to yes, 765# if they were found. But, on some systems, we need setuid even when 766# using plain old vanilla passwords. 767# 768if test "$enable_locking" = yes ; then 769 case "$host" in 770 *-hpux* | *-aix* | *-netbsd* | *-freebsd* | *-openbsd* ) 771 need_setuid=yes 772 ;; 773 esac 774fi 775 776if test "$have_shadow_adjunct" = yes ; then 777 AC_DEFINE(HAVE_ADJUNCT_PASSWD, 1, [Define if system uses adjunct shadow passwords]) 778elif test "$have_shadow_enhanced" = yes ; then 779 AC_DEFINE(HAVE_ENHANCED_PASSWD, 1, [Define if system uses enhanced shadow passwords]) 780elif test "$have_shadow_hpux" = yes ; then 781 AC_DEFINE(HAVE_HPUX_PASSWD, 1, [Define if system uses HPUX shadow passwords]) 782elif test "$have_shadow" = yes ; then 783 AC_DEFINE(HAVE_SHADOW_PASSWD, 1, [Define if system uses traditional shadow passwords]) 784fi 785 786# Check for external password helper 787# On SuSE, instead of having xscreensaver be a setuid program, they 788# fork an external program that takes the password on stdin, and 789# returns true if that password is a valid one. Then only that 790# smaller program needs to be setuid. 791# 792# (Note that this external program is not a GUI: the GUI is still 793# all in xscreensaver itself; the external program just does auth.) 794 795have_passwd_helper=no 796with_passwd_helper_req=unspecified 797 798AC_ARG_WITH(passwd-helper, 799[ --with-passwd-helper Include support for an external password 800 verification helper program.], 801 [with_passwd_helper="$withval"; with_passwd_helper_req="$withval"],[with_passwd_helper=no]) 802# no HANDLE_X_PATH_ARG for this one 803 804if test "$enable_locking" = no ; then 805 with_passwd_helper_req=no 806 with_passwd_helper=no 807fi 808 809case "$with_passwd_helper" in 810 ""|no) : ;; 811 /*) 812 AC_DEFINE_UNQUOTED(PASSWD_HELPER_PROGRAM, "$with_passwd_helper", [Full pathname of password helper application]) 813 have_passwd_helper=yes;; 814 *) 815 echo "error: --with-passwd-helper needs full pathname of helper (not '$with_passwd_helper')." >&2 816 exit 1 817esac 818AM_CONDITIONAL(HAVE_PASSWD_HELPER, test x$have_passwd_helper = xyes) 819AC_SUBST(HAVE_PASSWD_HELPER) 820 821if test "$need_setuid" = yes -a "$have_pam" != yes ; then 822 NEED_SETUID=yes 823else 824 NEED_SETUID=no 825fi 826AC_SUBST(NEED_SETUID) 827 828dnl --------------------------------------------------------------------------- 829dnl Authentication scheme 830dnl --------------------------------------------------------------------------- 831 832AC_ARG_ENABLE(authentication-scheme, 833 [ --enable-authentication-scheme=[auto/pam/helper/pwent/bsdauth] Choose a specific 834 authentication scheme [default=auto]],, 835 enable_authentication_scheme=auto) 836 837AUTH_SCHEME="auth-pam" 838 839if test x$enable_authentication_scheme = xpam -a x$have_pam = xno ; then 840 AC_MSG_ERROR(PAM support requested but not available) 841fi 842if test x$enable_authentication_scheme = xhelper -a x$have_passwd_helper = xno ; then 843 AC_MSG_ERROR(Password helper support requested but not available) 844fi 845if test x$enable_authentication_scheme = xbsdauth -a x$have_bsdauth = xno ; then 846 AC_MSG_ERROR(bsd_auth(3) support requested but not available) 847fi 848 849if test x$enable_authentication_scheme = xpam ; then 850 AUTH_SCHEME="pam" 851elif test x$enable_authentication_scheme = xhelper ; then 852 AUTH_SCHEME="helper" 853elif test x$enable_authentication_scheme = xpwent ; then 854 AUTH_SCHEME="pwent" 855elif test x$enable_authentication_scheme = xbsdauth ; then 856 AUTH_SCHEME="bsdauth" 857elif test x$enable_authentication_scheme = xauto ; then 858 if test x$have_pam != xno ; then 859 AUTH_SCHEME="pam" 860 elif test x$have_passwd_helper != xno ; then 861 AUTH_SCHEME="helper" 862 elif test x$have_bsdauth != xno ; then 863 AUTH_SCHEME="bsdauth" 864 else 865 AUTH_SCHEME="pwent" 866 fi 867else 868 AC_MSG_ERROR(Unknown authentication scheme) 869fi 870 871AC_SUBST(AUTH_SCHEME) 872 873dnl --------------------------------------------------------------------------- 874dnl ConsoleKit 875dnl --------------------------------------------------------------------------- 876 877AC_ARG_WITH(console-kit, 878 AS_HELP_STRING([--with-console-kit], 879 [Add ConsoleKit support]),, 880 with_console_kit=auto) 881 882use_console_kit=no 883if test "x$with_console_kit" != "xno" ; then 884 use_console_kit=yes 885 AC_DEFINE(WITH_CONSOLE_KIT, 1, [ConsoleKit support]) 886fi 887AM_CONDITIONAL(WITH_CONSOLE_KIT, test x$use_console_kit = xyes) 888AC_SUBST(WITH_CONSOLE_KIT) 889 890dnl --------------------------------------------------------------------------- 891dnl systemd 892dnl --------------------------------------------------------------------------- 893 894AC_ARG_WITH(systemd, 895 AS_HELP_STRING([--with-systemd], 896 [Add systemd support]), 897 [with_systemd=$withval], [with_systemd=auto]) 898 899PKG_CHECK_MODULES(SYSTEMD, [libsystemd], [have_systemd=yes], 900 [PKG_CHECK_MODULES(SYSTEMD, [libsystemd-login], 901 [have_systemd=yes], [have_systemd=no])]) 902 903if test "x$with_systemd" = "xauto" ; then 904 if test x$have_systemd = xno ; then 905 use_systemd=no 906 else 907 use_systemd=yes 908 fi 909else 910 use_systemd=$with_systemd 911fi 912 913if test "x$use_systemd" = "xyes"; then 914 if test "x$have_systemd" = "xno"; then 915 AC_MSG_ERROR([Systemd support explicitly required, but systemd not found]) 916 fi 917 918 AC_DEFINE(WITH_SYSTEMD, 1, [systemd support]) 919fi 920AC_SUBST(SYSTEMD_CFLAGS) 921AC_SUBST(SYSTEMD_LIBS) 922 923dnl --------------------------------------------------------------------------- 924dnl elogind 925dnl --------------------------------------------------------------------------- 926 927AC_ARG_WITH(elogind, 928 AS_HELP_STRING([--with-elogind], 929 [Add elogind support]), 930 [with_elogind=$withval], [with_elogind=auto]) 931 932PKG_CHECK_MODULES(ELOGIND, [libelogind], [have_elogind=yes], [have_elogind=no]) 933 934if test "x$with_elogind" = "xauto" ; then 935 if test x$have_elogind = xno ; then 936 use_elogind=no 937 else 938 use_elogind=yes 939 fi 940else 941 use_elogind=$with_elogind 942fi 943 944if test "x$use_elogind" = "xyes"; then 945 if test "x$have_elogind" = "xno"; then 946 AC_MSG_ERROR([Elogind support explicitly required, but elogind not found]) 947 fi 948 949 AC_DEFINE(WITH_ELOGIND, 1, [elogind support]) 950fi 951AC_SUBST(ELOGIND_CFLAGS) 952AC_SUBST(ELOGIND_LIBS) 953 954dnl --------------------------------------------------------------------------- 955dnl libxfcekbd 956dnl --------------------------------------------------------------------------- 957 958have_libxfcekbdui=no 959AC_ARG_WITH(kbd-layout-indicator,[ --without-kbd-layout-indicator disable keyboard layout indicator], 960 [with_kbd_layout_indicator="$withval"],[with_kbd_layout_indicator=yes]) 961if test x$with_kbd_layout_indicator != xno; then 962 AC_DEFINE(WITH_KBD_LAYOUT_INDICATOR, 1, [Define if keyboard layout indicator should be built]) 963fi 964 965dnl --------------------------------------------------------------------------- 966dnl Finish 967dnl --------------------------------------------------------------------------- 968 969AC_SUBST(AUTH_LIBS) 970AC_SUBST(SAVER_LIBS) 971AC_SUBST(GL_LIBS) 972 973 974REAL_PREFIX= 975if test "x$prefix" = "xNONE"; then 976 REAL_PREFIX=$ac_default_prefix 977else 978 REAL_PREFIX=$prefix 979fi 980 981## temporarily change prefix and exec_prefix 982old_prefix=$prefix 983prefix=$REAL_PREFIX 984 985if test "x$exec_prefix" = xNONE ; then 986 REAL_EXEC_PREFIX=$REAL_PREFIX 987else 988 REAL_EXEC_PREFIX=$exec_prefix 989fi 990old_exec_prefix=$exec_prefix 991exec_prefix=$REAL_EXEC_PREFIX 992 993## eval everything 994LOCALSTATEDIR_TMP="$localstatedir" 995EXPANDED_LOCALSTATEDIR=`eval echo $LOCALSTATEDIR_TMP` 996AC_SUBST(EXPANDED_LOCALSTATEDIR) 997 998SYSCONFDIR_TMP="$sysconfdir" 999EXPANDED_SYSCONFDIR=`eval echo $SYSCONFDIR_TMP` 1000AC_SUBST(EXPANDED_SYSCONFDIR) 1001 1002BINDIR_TMP="$bindir" 1003EXPANDED_BINDIR=`eval echo $BINDIR_TMP` 1004AC_SUBST(EXPANDED_BINDIR) 1005 1006LIBDIR_TMP="$libdir" 1007EXPANDED_LIBDIR=`eval echo $LIBDIR_TMP` 1008AC_SUBST(EXPANDED_LIBDIR) 1009 1010DATADIR_TMP="$datadir" 1011EXPANDED_DATADIR=`eval echo $DATADIR_TMP` 1012AC_SUBST(EXPANDED_DATADIR) 1013 1014## put prefix and exec_prefix back 1015prefix=$old_prefix 1016exec_prefix=$old_exec_prefix 1017 1018# Turn on the additional warnings last, so -Werror doesn't affect other tests. 1019 1020AC_ARG_ENABLE(more-warnings, 1021 AC_HELP_STRING([--enable-more-warnings], [Maximum compiler warnings]), 1022set_more_warnings="$enableval",[ 1023if test -d $srcdir/.git; then 1024 is_cvs_version=true 1025 set_more_warnings=yes 1026else 1027 set_more_warnings=no 1028fi 1029]) 1030AC_MSG_CHECKING(for more warnings) 1031if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then 1032 AC_MSG_RESULT(yes) 1033 CFLAGS="\ 1034 -Wall \ 1035 -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes \ 1036 -Wnested-externs -Wpointer-arith \ 1037 -Wcast-align -Wsign-compare \ 1038 $CFLAGS" 1039 1040 for option in -Wno-strict-aliasing -Wno-sign-compare; do 1041 SAVE_CFLAGS="$CFLAGS" 1042 CFLAGS="$CFLAGS $option" 1043 AC_MSG_CHECKING([whether gcc understands $option]) 1044 AC_TRY_COMPILE([], [], 1045 has_option=yes, 1046 has_option=no,) 1047 if test $has_option = no; then 1048 CFLAGS="$SAVE_CFLAGS" 1049 fi 1050 AC_MSG_RESULT($has_option) 1051 unset has_option 1052 unset SAVE_CFLAGS 1053 done 1054 unset option 1055else 1056 AC_MSG_RESULT(no) 1057fi 1058 1059# 1060# Enable Debug 1061# 1062AC_ARG_ENABLE(debug, [AC_HELP_STRING([--enable-debug=[no/yes]], [turn on debugging])],, enable_debug=yes) 1063if test "$enable_debug" = "yes"; then 1064 DEBUG_CFLAGS="-DG_ENABLE_DEBUG" 1065else 1066 if test "x$enable_debug" = "xno"; then 1067 DEBUG_CFLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS" 1068 else 1069 DEBUG_CFLAGS="" 1070 fi 1071fi 1072AC_SUBST(DEBUG_CFLAGS) 1073 1074# Flags 1075CFLAGS="$CFLAGS -lm" 1076 1077AC_SUBST(CFLAGS) 1078AC_SUBST(CPPFLAGS) 1079AC_SUBST(LDFLAGS) 1080 1081# Saver engine stuff 1082FLOATERS_XFCE_IMAGE="${EXPANDED_DATADIR}/pixmaps/xfce-logo-white.svg" 1083AC_SUBST(FLOATERS_XFCE_IMAGE) 1084 1085# Menu stuff 1086 1087XFCE_SCREENSAVER_THEMES_DIR="${EXPANDED_DATADIR}/applications/screensavers" 1088AC_SUBST(XFCE_SCREENSAVER_THEMES_DIR) 1089 1090# Special directories 1091# Used for .pc.in file 1092 1093privlibexecdir='${libexecdir}'/xfce4-screensaver 1094AC_SUBST(privlibexecdir) 1095 1096privdatadir='${datadir}'/xfce4-screensaver 1097AC_SUBST(privdatadir) 1098 1099themesdir='${datadir}'/applications/screensavers 1100AC_SUBST(themesdir) 1101 1102 1103# Files 1104 1105AC_OUTPUT([ 1106Makefile 1107po/Makefile.in 1108src/Makefile 1109src/xfce4-screensaver.desktop.in 1110data/Makefile 1111data/xfce4-screensavers.menu 1112data/org.xfce.ScreenSaver.service 1113data/icons/Makefile 1114data/icons/16x16/Makefile 1115data/icons/24x24/Makefile 1116data/icons/32x32/Makefile 1117data/icons/48x48/Makefile 1118data/icons/128x128/Makefile 1119data/icons/scalable/Makefile 1120data/images/Makefile 1121savers/Makefile 1122doc/Makefile 1123doc/xfce4-screensaver.xml 1124 1125]) 1126 1127echo " 1128 xfce4-screensaver $VERSION 1129 ======================== 1130 1131 prefix: ${prefix} 1132 exec_prefix: ${exec_prefix} 1133 libdir: ${EXPANDED_LIBDIR} 1134 bindir: ${EXPANDED_BINDIR} 1135 sysconfdir: ${EXPANDED_SYSCONFDIR} 1136 localstatedir: ${EXPANDED_LOCALSTATEDIR} 1137 datadir: ${EXPANDED_DATADIR} 1138 PAM prefix: ${PAM_PREFIX} 1139 source code location: ${srcdir} 1140 compiler: ${CC} 1141 cflags: ${CFLAGS} 1142 Base libs: ${XFCE_SCREENSAVER_LIBS} 1143 Extension libs: ${SAVER_LIBS} 1144 Maintainer mode: ${USE_MAINTAINER_MODE} 1145 Docs enabled: ${enable_docbook_docs} 1146 1147 GL: ${have_libgl} 1148 1149 Screen locking enabled: ${enable_locking} 1150 Show keyboard indicator: ${with_kbd_layout_indicator} 1151 systemd support: ${use_systemd} 1152 elogind support: ${use_elogind} 1153 ConsoleKit support: ${use_console_kit} 1154 PAM support: ${have_pam} 1155 PAM auth type: ${PAM_AUTH_TYPE} 1156 bsd_auth(3) support: ${have_bsdauth} 1157 Have shadow passwords: ${have_shadow} 1158 Have adjunct shadow: ${have_shadow_adjunct} 1159 Have enhanced shadow: ${have_shadow_enhanced} 1160 Have HPUX shadow: ${have_shadow_hpux} 1161 Have password helper: ${have_passwd_helper} 1162 Authentication scheme: ${AUTH_SCHEME}" 1163 1164if test "x$need_setuid" = "xyes" -a "x$have_pam" != "xyes" ; then 1165echo \ 1166" Need setuid dialog: yes 1167" 1168else 1169echo \ 1170" Need setuid dialog: no 1171" 1172fi 1173 1174 1175echo "" 1176