dnl Process this file with autoconf to produce a configure script.

AC_PREREQ([2.57])
AC_INIT(disk-manager,[1.0.1],[http://flomertens.free.fr/disk-manager/])
AM_INIT_AUTOMAKE()
AM_MAINTAINER_MODE

# Use PAM authentification when consolhelper is found
AC_PATH_PROGS([CONSOLEHELPER], [consolehelper], no,  [/sbin /usr/sbin $PATH])
AC_ARG_WITH(force-pam,     [  --with-force-pam=(yes/no)     Force the use or not of pam authentification via consolehelper.])
# If force-pam = yes, we install the file, even if consolehelper wasn't found
if test "$with_force_pam" = "yes" && test "$CONSOLEHELPER" = "no"; then
    CONSOLEHELPER="/usr/bin/consolehelper"
fi
if test "$with_force_pam" = "no"; then
    CONSOLEHELPER="no"
fi
AM_CONDITIONAL([ENABLE_PAM], [test "$CONSOLEHELPER" != "no"])
if test "$CONSOLEHELPER" != "no"; then
    AC_SUBST([EXEC_PATH], [/bin])
else
    AC_SUBST([EXEC_PATH], [/sbin])
fi

# Check path of some program
AC_PATH_PROGS([MODPROBE], [modprobe], /sbin/modprobe, [/sbin /usr/sbin $PATH])
AC_PATH_PROGS([MOUNT], [mount], /bin/mount, [/sbin /usr/sbin $PATH])
AC_PATH_PROGS([UMOUNT], [umount], /bin/umount, [/sbin /usr/sbin $PATH])
AC_PATH_PROGS([BLKID], [blkid], /sbin/blkid, [/sbin /usr/sbin $PATH])
AC_PATH_PROGS([DMSETUP], [dmsetup], /sbin/dmsetup, [/sbin /usr/sbin $PATH])

GETTEXT_PACKAGE=disk-manager
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package])
AM_GLIB_GNU_GETTEXT
AC_PROG_INTLTOOL

# Check for python > 2.4 and pygtk > 2.6
AM_PATH_PYTHON_VERSION(2.4, 2.4.0, 2.5, 2.5.0)
AC_DEFUN([required_pygtk_version], [2.6.0])
AC_SUBST([PYOPTIONS], [-OOt])
AC_MSG_CHECKING(for pygtk >= required_pygtk_version installed)
prog="
import pygtk; pygtk.require('2.0')
import gobject
assert gobject.pygtk_version >= tuple(map(int, 'required_pygtk_version'.split('.')))
"
if $PYTHON -c "$prog" 1>&AC_FD_CC 2>&AC_FD_CC; then
    AC_MSG_RESULT(found)
else
    AC_MSG_RESULT(not found)
    AC_MSG_ERROR(required pygtk version not found)
fi

AC_CONFIG_FILES([
        Makefile
        disk-manager
        disk-manager-root
        po/Makefile.in
        DiskManager/Makefile
        DiskManager/config.py
        DiskManager/Fstab/Makefile
        DiskManager/Fstab/Fstabconfig.py
        data/Makefile
        data/disk-manager.desktop.in
        data/disk-manager-check.desktop.in
        data/pam/Makefile
        data/pam/disk-manager.consolhelper
        data/icons/Makefile
        data/icons/16x16/Makefile
        data/icons/22x22/Makefile
        data/icons/24x24/Makefile
        data/icons/scalable/Makefile
        ])
AC_OUTPUT

