AC_PREREQ(2.52) AC_INIT(ohm, 0.1.1) AC_CONFIG_SRCDIR(ohmd) AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION) AM_CONFIG_HEADER(config.h) VERSION_MAJOR=0 VERSION_MINOR=0 VERSION_PATCH=1 AC_SUBST(VERSION_MAJOR) AC_SUBST(VERSION_MINOR) AC_SUBST(VERSION_PATCH) # libtool versioning - this applies to libohm # # See http://sources.redhat.com/autobook/autobook/autobook_91.html#SEC91 for details # LT_CURRENT=1 LT_REVISION=0 LT_AGE=0 AC_SUBST(LT_CURRENT) AC_SUBST(LT_REVISION) AC_SUBST(LT_AGE) AC_PROG_CC AC_PROG_INSTALL AM_PROG_LIBTOOL AC_PROG_INTLTOOL([0.33.0]) AM_GLIB_GNU_GETTEXT AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal) GTK_DOC_CHECK([1.8]) ALL_LINGUAS="en_GB" AC_SUBST(ALL_LINGUAS) dnl --------------------------------------------------------------------------- dnl - gettext stuff dnl --------------------------------------------------------------------------- AC_DEFINE(GETTEXT_PACKAGE, "AC_PACKAGE_NAME", [foo]) GETTEXT_PACKAGE=AC_PACKAGE_NAME AC_SUBST(GETTEXT_PACKAGE) dnl --------------------------------------------------------------------------- dnl - Extra verbose warning switches dnl --------------------------------------------------------------------------- if test "$GCC" = "yes"; then CPPFLAGS="$CPPFLAGS -Werror -Wall -Wcast-align -Wno-uninitialized -fno-strict-aliasing" #CPPFLAGS="$CPPFLAGS -Wall" fi AC_ARG_WITH(distro, AC_HELP_STRING([--with-distro=DISTRO], [Specify the Linux distribution to target: One of redhat, gentoo, debian, slackware, or none])) if test "z$with_distro" = "z"; then AC_CHECK_FILE(/etc/mandrake-release,with_distro="mandrake") AC_CHECK_FILE(/etc/redhat-release,with_distro="redhat") AC_CHECK_FILE(/etc/fedora-release,with_distro="redhat") AC_CHECK_FILE(/etc/gentoo-release,with_distro="gentoo") AC_CHECK_FILE(/etc/debian_version,with_distro="debian") AC_CHECK_FILE(/etc/slackware-version,with_distro="slackware") fi with_distro=`echo ${with_distro} | tr '[[:upper:]]' '[[:lower:]]' ` if test "z$with_distro" = "z"; then echo "Linux distribution autodetection failed, you must specify the distribution to target using --with-distro=DISTRO" exit 1 elif test "z$with_distro" = "znone"; then echo "No distro specific startup scripts will be built." else case $with_distro in redhat|gentoo|debian|slackware) ;; *) echo "Your distribution (${with_distro}) is not yet supported! (patches welcome)" exit 1 ;; esac fi AM_CONDITIONAL(TARGET_REDHAT, test x"$with_distro" = xredhat) AM_CONDITIONAL(TARGET_GENTOO, test x"$with_distro" = xgentoo) AM_CONDITIONAL(TARGET_DEBIAN, test x"$with_distro" = xdebian) AM_CONDITIONAL(TARGET_MANDRAKE, test x"$with_distro" = xmandrake) AM_CONDITIONAL(TARGET_SLACKWARE, test x"$with_distro" = xslackware) PKG_CHECK_MODULES(GLIB, glib-2.0 gobject-2.0) AC_SUBST(GLIB_CFLAGS) AC_SUBST(GLIB_LIBS) PKG_CHECK_MODULES(GMODULE, gmodule-2.0) AC_SUBST(GMODULE_CFLAGS) AC_SUBST(GMODULE_LIBS) PKG_CHECK_MODULES(GTHREAD, gthread-2.0) AC_SUBST(GTHREAD_CFLAGS) AC_SUBST(GTHREAD_LIBS) PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= 0.70 dbus-1 >= 0.70) AC_SUBST(DBUS_CFLAGS) AC_SUBST(DBUS_LIBS) PKG_CHECK_MODULES(HAL, hal >= 0.5.7) AC_SUBST(HAL_CFLAGS) AC_SUBST(HAL_LIBS) PKG_CHECK_MODULES(GDK, gdk-2.0 >= 2.10.0 gdk-x11-2.0 >= 2.10.0) AC_SUBST(GDK_CFLAGS) AC_SUBST(GDK_LIBS) AC_SUBST(OHM_CONF_DIR, "\$(sysconfdir)/ohm") AC_SUBST(OHM_PLUGIN_CONF_DIR, "\$(OHM_CONF_DIR)/plugins.d") AC_SUBST(OHM_PLUGIN_DIR, "\$(libdir)/ohm") AC_SUBST(OHM_PLUGIN_CFLAGS, "-I\$(top_srcdir)/ohmd $GLIB_CFLAGS $DBUS_CFLAGS $GMODULE_CFLAGS") AC_SUBST(OHM_PLUGIN_LIBS, "$GLIB_LIBS $DBUS_LIBS $GMODULE_LIBS") dnl --------------------------------------------------------------------------- dnl - Where should we put documentation ? dnl --------------------------------------------------------------------------- AC_ARG_WITH(doc-dir, [AC_HELP_STRING([--with-doc-dir=], [directory to install documentation])]) if ! test -z "$with_doc_dir"; then DOCDIR="$with_doc_dir/ohm-$VERSION" else DOCDIR="\$(docdir\)" fi AC_SUBST(DOCDIR) dnl --------------------------------------------------------------------------- dnl - DocBook Documentation dnl --------------------------------------------------------------------------- AC_ARG_ENABLE(docbook-docs, [ --enable-docbook-docs build documentation (requires xmlto)],enable_docbook_docs=$enableval,enable_docbook_docs=auto) AC_PATH_PROG(XMLTO, xmlto, no) AC_MSG_CHECKING([whether to build DocBook documentation]) if test x$XMLTO = xno ; then have_docbook=no else have_docbook=yes fi if test x$enable_docbook_docs = xauto ; then if test x$have_docbook = xno ; then enable_docbook_docs=no else enable_docbook_docs=yes fi fi if test x$enable_docbook_docs = xyes; then if test x$have_docbook = xno; then AC_MSG_ERROR([Building DocBook docs explicitly required, but DocBook not found]) fi fi AM_CONDITIONAL(DOCBOOK_DOCS_ENABLED, test x$enable_docbook_docs = xyes) AC_MSG_RESULT(yes) AC_ARG_WITH(dbus-sys, [ --with-dbus-sys= where D-BUS system.d directory is]) if ! test -z "$with_dbus_sys" ; then DBUS_SYS_DIR="$with_dbus_sys" else DBUS_SYS_DIR="\${sysconfdir}/dbus-1/system.d" 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 OHM_X11_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 #include ]) # 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]) OHM_X11_LIBS="$OHM_X11_LIBS -lXext" fi AM_CONDITIONAL(HAVE_DPMS_EXTENSION, test "$have_dpms" = yes, [DPMS extension is available]) elif test "$with_dpms" != no; then echo "error: must be yes or no: --with-dpms-ext=$with_dpms" exit 1 fi AC_SUBST(OHM_X11_LIBS) AC_OUTPUT([ ohm.pc ohm.conf Makefile etc/Makefile plugins/Makefile plugins/glue/Makefile plugins/glue/acadapter/Makefile plugins/glue/dpms/Makefile plugins/glue/idle/Makefile plugins/glue/buttons/Makefile plugins/glue/powerstatus/Makefile plugins/glue/timeremaining/Makefile plugins/glue/backlight/Makefile plugins/glue/battery/Makefile plugins/glue/xrandr/Makefile plugins/glue/xorg/Makefile plugins/policy/Makefile plugins/policy/display/Makefile plugins/policy/suspend/Makefile plugins/policy/timeouts/Makefile ohmd/Makefile po/Makefile.in docs/Makefile docs/index.xml docs/reference/Makefile docs/reference/ohm-plugin/Makefile docs/reference/libohm/Makefile libohm/Makefile libidletime/Makefile tools/Makefile initscript/Makefile initscript/RedHat/Makefile initscript/Gentoo/Makefile initscript/Debian/Makefile initscript/Slackware/Makefile ]) echo echo Distribution targeting: ${with_distro} echo 'if this is not correct, please specifiy your distro with --with-distro=DISTRO' dnl ========================================================================== echo " Open Hardware Manager $VERSION ============================== prefix: ${prefix} datadir: ${datadir} documentation dir: ${docdir} compiler: ${CC} cflags: ${CFLAGS} DPMS support: ${have_dpms} Docbook support: ${enable_docbook_docs} Gtk-doc support: ${enable_gtk_doc} "