diff options
author | Richard Hughes <richard@hughsie.com> | 2007-01-24 22:56:55 +0000 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2007-01-24 22:56:55 +0000 |
commit | 5b00f8182312dfa3df7856c9ec330cc5ff28e25f (patch) | |
tree | 882f9c3332d5e31206a734b7bccfd7ff886528de /configure.in | |
parent | 5e592719e3c971e6a970b8b9ef2181606ebc2dc0 (diff) |
properly clean the la files, and disable the dpms plugin for now
Properly clean the la files, and disable the dpms plugin for now.
Diffstat (limited to 'configure.in')
-rw-r--r-- | configure.in | 140 |
1 files changed, 140 insertions, 0 deletions
diff --git a/configure.in b/configure.in index 4466333..182a34a 100644 --- a/configure.in +++ b/configure.in @@ -145,6 +145,144 @@ fi AC_SUBST(DBUS_SYS_DIR) AC_DEFINE_UNQUOTED(DBUS_SYSTEMD_DIR, "$DBUS_SYS_DIR", [Where system.d dir for DBUS is]) +dnl --------------------------------------------------------------------------- +dnl - Some utility functions to make checking for X things easier. +dnl --------------------------------------------------------------------------- +# Like AC_CHECK_HEADER, but it uses the already-computed -I directories. +AC_DEFUN(AC_CHECK_X_HEADER, [ + ac_save_CPPFLAGS="$CPPFLAGS" + if test \! -z "$includedir" ; then + CPPFLAGS="$CPPFLAGS -I$includedir" + fi + CPPFLAGS="$CPPFLAGS $X_CFLAGS" + AC_CHECK_HEADER([$1],[$2],[$3],[$4]) + CPPFLAGS="$ac_save_CPPFLAGS"]) + +# Like AC_TRY_COMPILE, but it uses the already-computed -I directories. +AC_DEFUN(AC_TRY_X_COMPILE, [ + ac_save_CPPFLAGS="$CPPFLAGS" + if test \! -z "$includedir" ; then + CPPFLAGS="$CPPFLAGS -I$includedir" + fi + CPPFLAGS="$CPPFLAGS $X_CFLAGS" + AC_TRY_COMPILE([$1], [$2], [$3], [$4]) + CPPFLAGS="$ac_save_CPPFLAGS"]) + +# Like AC_CHECK_LIB, but it uses the already-computed -I and -L directories. +# Use this sparingly; it probably doesn't work very well on X programs. +AC_DEFUN(AC_CHECK_X_LIB, [ + ac_save_CPPFLAGS="$CPPFLAGS" + ac_save_LDFLAGS="$LDFLAGS" +# ac_save_LIBS="$LIBS" + if test \! -z "$includedir" ; then + CPPFLAGS="$CPPFLAGS -I$includedir" + fi + # note: $X_CFLAGS includes $x_includes + CPPFLAGS="$CPPFLAGS $X_CFLAGS" + if test \! -z "$libdir" ; then + LDFLAGS="$LDFLAGS -L$libdir" + fi + # note: $X_LIBS includes $x_libraries + LDFLAGS="$LDFLAGS $ALL_X_LIBS" + AC_CHECK_LIB([$1], [$2], [$3], [$4], [$5]) + CPPFLAGS="$ac_save_CPPFLAGS" + LDFLAGS="$ac_save_LDFLAGS" +# LIBS="$ac_save_LIBS" + ]) + +# Usage: HANDLE_X_PATH_ARG([variable_name], +# [--command-line-option], +# [descriptive string]) +# +# All of the --with options take three forms: +# +# --with-foo (or --with-foo=yes) +# --without-foo (or --with-foo=no) +# --with-foo=/DIR +# +# This function, HANDLE_X_PATH_ARG, deals with the /DIR case. When it sees +# a directory (string beginning with a slash) it checks to see whether +# /DIR/include and /DIR/lib exist, and adds them to $X_CFLAGS and $X_LIBS +# as appropriate. +AC_DEFUN(HANDLE_X_PATH_ARG, [ + case "$[$1]" in + yes) ;; + no) ;; + /*) + AC_MSG_CHECKING([for [$3] headers]) + d=$[$1]/include + if test -d $d; then + X_CFLAGS="-I$d $X_CFLAGS" + AC_MSG_RESULT($d) + else + AC_MSG_RESULT(not found ($d: no such directory)) + fi + AC_MSG_CHECKING([for [$3] libs]) + d=$[$1]/lib + if test -d $d; then + X_LIBS="-L$d $X_LIBS" + AC_MSG_RESULT($d) + else + AC_MSG_RESULT(not found ($d: no such directory)) + fi + # replace the directory string with "yes". + [$1]_req="yes" + [$1]=$[$1]_req + ;; + *) + echo "" + echo "error: argument to [$2] must be \"yes\", \"no\", or a directory." + echo " If it is a directory, then \`DIR/include' will be added to" + echo " the -I list, and \`DIR/lib' will be added to the -L list." + exit 1 + ;; + esac + ]) + + +dnl --------------------------------------------------------------------------- +dnl - Check for the DPMS server extension. +dnl --------------------------------------------------------------------------- + +have_dpms=no +with_dpms_req=unspecified +GPM_EXTRA_LIBS="-lresolv" +AC_ARG_WITH(dpms-ext, +[ --with-dpms-ext Include support for the DPMS extension.], + [with_dpms="$withval"; with_dpms_req="$withval"],[with_dpms=yes]) + +HANDLE_X_PATH_ARG(with_dpms, --with-dpms-ext, DPMS) + +if test "$with_dpms" = yes; then + + # first check for dpms.h + AC_CHECK_X_HEADER(X11/extensions/dpms.h, [have_dpms=yes],, + [#include <X11/Xlib.h> + #include <X11/Xmd.h>]) + # if that succeeded, then check for the DPMS code in the libraries + if test "$have_dpms" = yes; then + # first look in -lXext (this is where it is with XFree86 4.0) + have_dpms=no + AC_CHECK_X_LIB(Xext, DPMSInfo, [have_dpms=yes], [true], -lXext -lX11) + # if that failed, look in -lXdpms (this is where it was in XFree86 3.x) + if test "$have_dpms" = no; then + AC_CHECK_X_LIB(Xdpms, DPMSInfo, + [have_dpms=yes; XDPMS_LIBS="-lXdpms"], [true], + -lXext -lX11) + fi + fi + # if that succeeded, then we've really got it. + if test "$have_dpms" = yes; then + AC_DEFINE(HAVE_DPMS_EXTENSION, 1, [Define if the DPMS extension is available]) + GPM_EXTRA_LIBS="$GPM_EXTRA_LIBS -lXext" + fi +elif test "$with_dpms" != no; then + echo "error: must be yes or no: --with-dpms-ext=$with_dpms" + exit 1 +fi + +AC_SUBST(GPM_EXTRA_LIBS) + AC_OUTPUT([ ohm.pc ohm.conf @@ -152,6 +290,7 @@ Makefile etc/Makefile plugins/Makefile plugins/acadapter/Makefile +plugins/dpms/Makefile plugins/idle/Makefile plugins/powerstatus/Makefile plugins/timeremaining/Makefile @@ -183,5 +322,6 @@ echo " documentation dir: $DOCDIR compiler: ${CC} cflags: ${CFLAGS} + DPMS support: ${have_dpms} Docbook support: ${enable_docbook_docs} " |