| 1 |
# This file is part of Gutenprint. -*- Autoconf -*- |
| 2 |
# CUPS support. |
| 3 |
# Copyright 2000-2002 Roger Leigh |
| 4 |
# |
| 5 |
# This program is free software; you can redistribute it and/or modify |
| 6 |
# it under the terms of the GNU General Public License as published by |
| 7 |
# the Free Software Foundation; either version 2, or (at your option) |
| 8 |
# any later version. |
| 9 |
# |
| 10 |
# This program is distributed in the hope that it will be useful, |
| 11 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
# GNU General Public License for more details. |
| 14 |
# |
| 15 |
# You should have received a copy of the GNU General Public License |
| 16 |
# along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 17 |
# 02111-1307, USA. |
| 18 |
|
| 19 |
|
| 20 |
## ------------ ## |
| 21 |
## CUPS support ## |
| 22 |
## ------------ ## |
| 23 |
|
| 24 |
|
| 25 |
# STP_CUPS_LIBS |
| 26 |
# ------------- |
| 27 |
# Check for CUPS libraries. |
| 28 |
AC_DEFUN([STP_CUPS_LIBS], |
| 29 |
[dnl CUPS library checks |
| 30 |
dnl check for libm, and also add to CUPS LIBS |
| 31 |
AC_CHECK_LIB(m,pow, |
| 32 |
CUPS_LIBS="${CUPS_LIBS} -lm") |
| 33 |
dnl CUPS library checks |
| 34 |
if test x${BUILD_CUPS} = xyes ; then |
| 35 |
AC_CHECK_LIB(z,gzgets, |
| 36 |
HAVE_LIBZ=true, HAVE_LIBZ=false) |
| 37 |
if test x${HAVE_LIBZ} = xtrue ; then |
| 38 |
GENPPD_LIBS="-lz" |
| 39 |
AC_DEFINE(HAVE_LIBZ,, [Define if libz is present.]) |
| 40 |
fi |
| 41 |
AC_PATH_PROG(CUPS_CONFIG, cups-config) |
| 42 |
if test "x$CUPS_CONFIG" != x; then |
| 43 |
dnl Use values from CUPS config... |
| 44 |
CUPS_LIBS="`$CUPS_CONFIG --ldflags` `$CUPS_CONFIG --image --libs`" |
| 45 |
CUPS_CFLAGS="`$CUPS_CONFIG --cflags`" |
| 46 |
else |
| 47 |
dnl Save current library list... |
| 48 |
SAVELIBS="$LIBS" |
| 49 |
LIBS="$LIBS ${CUPS_LIBS}" |
| 50 |
AC_CHECK_LIB(socket,socket, |
| 51 |
if test x${OSTYPE} != xirix ; then |
| 52 |
CUPS_LIBS="${CUPS_LIBS} -lsocket" |
| 53 |
LIBS="$LIBS -lsocket" |
| 54 |
fi) |
| 55 |
AC_CHECK_LIB(nsl,gethostbyaddr, |
| 56 |
if test x${OSTYPE} != xirix ; then |
| 57 |
CUPS_LIBS="${CUPS_LIBS} -lnsl" |
| 58 |
LIBS="$LIBS -lnsl" |
| 59 |
fi) |
| 60 |
|
| 61 |
dnl Some OS's need to link against crypto stuff too if CUPS is compiled |
| 62 |
dnl with crypto support... :( |
| 63 |
AC_CHECK_HEADER(openssl/ssl.h, |
| 64 |
dnl Some ELF systems can't resolve all the symbols in libcrypto |
| 65 |
dnl if libcrypto was linked against RSAREF, and fail to link the |
| 66 |
dnl test program correctly, even though a correct installation |
| 67 |
dnl of OpenSSL exists. So we test the linking three times in |
| 68 |
dnl case the RSAREF libraries are needed. |
| 69 |
|
| 70 |
SSL="no" |
| 71 |
|
| 72 |
for libcrypto in \ |
| 73 |
"-lcrypto" \ |
| 74 |
"-lcrypto -lrsaref" \ |
| 75 |
"-lcrypto -lRSAglue -lrsaref" |
| 76 |
do |
| 77 |
AC_CHECK_LIB(ssl,SSL_new, |
| 78 |
[CUPS_LIBS="${CUPS_LIBS} -lssl $libcrypto" |
| 79 |
SSL="yes"],, |
| 80 |
$libcrypto) |
| 81 |
|
| 82 |
if test x$SSL = xyes; then |
| 83 |
break |
| 84 |
fi |
| 85 |
done) |
| 86 |
|
| 87 |
dnl Require CUPS 1.1... |
| 88 |
AC_CHECK_LIB(cups,cupsPrintFiles, |
| 89 |
CUPS_LIBS="${CUPS_LIBS} -lcups", |
| 90 |
LIBS="$LIBS -lcups" |
| 91 |
AC_MSG_ERROR([Cannot find CUPS libraries (libcups)])) |
| 92 |
AC_CHECK_LIB(cupsimage,cupsRasterOpen, |
| 93 |
CUPS_LIBS="${CUPS_LIBS} -lcupsimage", |
| 94 |
AC_MSG_ERROR([Cannot find CUPS libraries (libcupsimage)]), |
| 95 |
-lcups) |
| 96 |
dnl Restore old library list... |
| 97 |
LIBS="$SAVELIBS" |
| 98 |
|
| 99 |
dnl Add CUPS include directory as needed... |
| 100 |
if test "x${cups_prefix}" != "x/usr" -a "x${cups_prefix}" != x; then |
| 101 |
CUPS_CFLAGS="-I${cups_prefix}/include" |
| 102 |
else |
| 103 |
CUPS_CFLAGS="" |
| 104 |
fi |
| 105 |
fi |
| 106 |
fi |
| 107 |
]) |
| 108 |
|
| 109 |
# STP_CUPS_PATH |
| 110 |
# ------------- |
| 111 |
# Set CUPS install paths |
| 112 |
AC_DEFUN([STP_CUPS_PATH], |
| 113 |
[# CUPS path setup |
| 114 |
|
| 115 |
# Fix "cups_prefix" variable if it hasn't been specified... |
| 116 |
if test "x${cups_prefix}" = xNONE -o "x{$cups_prefix}" = x ; then |
| 117 |
if test "x${prefix}" = xNONE -o "x${prefix}" = x ; then |
| 118 |
cups_prefix="/usr" |
| 119 |
else |
| 120 |
cups_prefix="${prefix}" |
| 121 |
fi |
| 122 |
fi |
| 123 |
|
| 124 |
# Fix "cups_exec_prefix" variable if it hasn't been specified... |
| 125 |
if test "x${cups_exec_prefix}" = xNONE -o "x${cups_exec_prefix}" = x ; then |
| 126 |
if test x"${exec_prefix}" = xNONE -o "x${exec_prefix}" = x ; then |
| 127 |
cups_exec_prefix="${cups_prefix}" |
| 128 |
else |
| 129 |
cups_exec_prefix="${exec_prefix}" |
| 130 |
fi |
| 131 |
fi |
| 132 |
|
| 133 |
# Get explicit CUPS directories if possible |
| 134 |
if test "x$CUPS_CONFIG" != x -a "x$NO_PKGCONFIG_PATHS" = x; then |
| 135 |
cups_conf_datadir="`$CUPS_CONFIG --datadir`" |
| 136 |
cups_conf_serverroot="`$CUPS_CONFIG --serverroot`" |
| 137 |
cups_conf_serverbin="`$CUPS_CONFIG --serverbin`" |
| 138 |
else |
| 139 |
cups_conf_datadir="${cups_prefix}/share/cups" |
| 140 |
cups_conf_serverroot="${cups_prefix}/etc/cups" |
| 141 |
cups_conf_serverbin="${cups_exec_prefix}/lib/cups" |
| 142 |
fi |
| 143 |
|
| 144 |
# And the rest! |
| 145 |
cups_bindir="${cups_exec_prefix}/bin" |
| 146 |
cups_sbindir="${cups_exec_prefix}/sbin" |
| 147 |
|
| 148 |
]) |