You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
100 lines
2.9 KiB
100 lines
2.9 KiB
AC_DEFUN([AC_CHECK_CUPS_VERSION],
|
|
[
|
|
kde_save_cflags="$CFLAGS"
|
|
kde_save_libs="$LIBS"
|
|
LIBS="$all_libraries $USER_LDFLAGS $kde_cups_libs"
|
|
CFLAGS="$CFLAGS $all_includes $USER_INCLUDES"
|
|
AC_MSG_CHECKING(CUPS version >= $1)
|
|
kde_save_link=$ac_link
|
|
ac_link='${CC} $CFLAGS -o conftest conftest.c $LIBS 1>&5'
|
|
cat > conftest.c <<EOF
|
|
#include <cups/cups.h>
|
|
#include <stdio.h>
|
|
int main()
|
|
{
|
|
if (CUPS_VERSION <
|
|
EOF
|
|
echo "$1" >> conftest.c
|
|
cat >> conftest.c <<EOF
|
|
)
|
|
printf("no\n");
|
|
else
|
|
printf("yes\n");
|
|
}
|
|
EOF
|
|
if AC_TRY_EVAL(ac_link) && test -x conftest; then
|
|
ac_have_new_cups=`./conftest`
|
|
else
|
|
dnl don't bail out if not found!
|
|
dnl AC_MSG_ERROR([Unable to compile test program. See config.log for more informations])
|
|
dnl echo "configure: failed program was:" >&AC_FD_CC
|
|
dnl cat conftest.c >&AC_FD_CC
|
|
ac_have_new_cups="no"
|
|
fi
|
|
rm -f conftest*
|
|
ac_link="$kde_save_link"
|
|
CFLAGS="$kde_save_cflags"
|
|
LIBS="$kde_save_libs"
|
|
AC_MSG_RESULT($ac_have_new_cups)
|
|
])
|
|
|
|
dnl CUPS stuffs (to be changed)
|
|
ac_use_cups="yes"
|
|
ac_have_new_cups="yes"
|
|
ac_cups_libs=0
|
|
CUPSSUBDIR=
|
|
LIB_CUPS=
|
|
AC_ARG_ENABLE(cups,[ --disable-cups disable CUPS support [default=auto]],ac_use_cups=$enableval, ac_use_cups=yes)
|
|
if test "$ac_use_cups" = "yes"; then
|
|
ac_CPPFLAGS_save="$CPPFLAGS"
|
|
CPPFLAGS="$CPPFLAGS $all_includes"
|
|
ac_LDFLAGS_save="$LDFLAGS"
|
|
LDFLAGS="$LDFLAGS $all_libraries"
|
|
kde_cups_config=
|
|
kde_cups_libs="-lcups"
|
|
AC_PATH_PROG(kde_cups_config,cups-config)
|
|
if test -n "$kde_cups_config"; then
|
|
# kde_cups_libs=`$kde_cups_config --libs`
|
|
kde_cups_libs="$kde_cups_libs"
|
|
else
|
|
AC_MSG_RESULT(cups-config not found, using default libraries: $kde_cups_libs. You should consider upgrading CUPS)
|
|
fi
|
|
KDE_CHECK_LIB(cups,cupsServer,[ac_cups_libs=1],[ac_cups_libs=0],[$LIBDL $LIBSOCKET])
|
|
if test "$ac_cups_libs" = "0"; then
|
|
AC_MSG_WARN(CUPS library not found. CUPS support disabled)
|
|
ac_use_cups="no"
|
|
fi
|
|
if test "$ac_use_cups" = "yes"; then
|
|
dnl check existence of CUPS header files
|
|
ac_cups_headers=0
|
|
AC_CHECK_HEADER(cups/cups.h,[ac_cups_headers=1])
|
|
if test "$ac_cups_headers" = "0"; then
|
|
AC_MSG_WARN(CUPS headers not found. CUPS support disabled)
|
|
ac_use_cups="no"
|
|
else
|
|
dnl check that version is at least 1.1.9
|
|
AC_CHECK_CUPS_VERSION(1.0109)
|
|
if test "$ac_have_new_cups" = "no"; then
|
|
AC_MSG_WARN(CUPS version too old. You should upgrade to version >= 1.1.9)
|
|
ac_use_cups="no"
|
|
fi
|
|
|
|
dnl check if CUPS is at least 1.1.20
|
|
ac_have_new_cups="no"
|
|
AC_CHECK_CUPS_VERSION(1.0120)
|
|
if test "$ac_have_new_cups" = "yes"; then
|
|
AC_DEFINE(HAVE_CUPS_NO_PWD_CACHE, 1, CUPS doesn't have password caching)
|
|
fi
|
|
fi
|
|
fi
|
|
LDFLAGS="$ac_LDFLAGS_save"
|
|
CPPFLAGS="$ac_CPPFLAGS_save"
|
|
fi
|
|
if test "$ac_use_cups" = "yes"; then
|
|
CUPSSUBDIR="cups"
|
|
LIB_CUPS="$kde_cups_libs"
|
|
AC_DEFINE(HAVE_CUPS, 1, [Defines if you have CUPS (Common UNIX Printing System)])
|
|
fi
|
|
AM_CONDITIONAL(include_cups_SUBDIR, test -n "$CUPSSUBDIR")
|
|
AC_SUBST(LIB_CUPS)
|