summaryrefslogtreecommitdiffstats
path: root/kdeprint/configure.in.in
blob: 3165cc4c42d45545702fce0dfe3862128e2e8c70 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
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)