AC_DEFUN([STP_CUPS_LIBS],
[AC_CHECK_LIB(m,pow,
CUPS_LIBS="${CUPS_LIBS} -lm")
if test x${BUILD_CUPS} = xyes ; then
AC_CHECK_LIB(z,gzgets,
HAVE_LIBZ=true, HAVE_LIBZ=false)
if test x${HAVE_LIBZ} = xtrue ; then
GENPPD_LIBS="-lz"
AC_DEFINE(HAVE_LIBZ,, [Define if libz is present.])
fi
AC_PATH_PROG(CUPS_CONFIG, cups-config)
if test "x$CUPS_CONFIG" != x; then
CUPS_LIBS="`$CUPS_CONFIG --ldflags` `$CUPS_CONFIG --image --libs`"
CUPS_CFLAGS="`$CUPS_CONFIG --cflags`"
else
SAVELIBS="$LIBS"
LIBS="$LIBS ${CUPS_LIBS}"
AC_CHECK_LIB(socket,socket,
if test x${OSTYPE} != xirix ; then
CUPS_LIBS="${CUPS_LIBS} -lsocket"
LIBS="$LIBS -lsocket"
fi)
AC_CHECK_LIB(nsl,gethostbyaddr,
if test x${OSTYPE} != xirix ; then
CUPS_LIBS="${CUPS_LIBS} -lnsl"
LIBS="$LIBS -lnsl"
fi)
AC_CHECK_HEADER(openssl/ssl.h,
SSL="no"
for libcrypto in \
"-lcrypto" \
"-lcrypto -lrsaref" \
"-lcrypto -lRSAglue -lrsaref"
do
AC_CHECK_LIB(ssl,SSL_new,
[CUPS_LIBS="${CUPS_LIBS} -lssl $libcrypto"
SSL="yes"],,
$libcrypto)
if test x$SSL = xyes; then
break
fi
done)
AC_CHECK_LIB(cups,cupsPrintFiles,
CUPS_LIBS="${CUPS_LIBS} -lcups",
LIBS="$LIBS -lcups"
AC_MSG_ERROR([Cannot find CUPS libraries (libcups)]))
AC_CHECK_LIB(cupsimage,cupsRasterOpen,
CUPS_LIBS="${CUPS_LIBS} -lcupsimage",
AC_MSG_ERROR([Cannot find CUPS libraries (libcupsimage)]),
-lcups)
LIBS="$SAVELIBS"
if test "x${cups_prefix}" != "x/usr" -a "x${cups_prefix}" != x; then
CUPS_CFLAGS="-I${cups_prefix}/include"
else
CUPS_CFLAGS=""
fi
fi
fi
])
AC_DEFUN([STP_CUPS_PROGS],
[if test x${BUILD_CUPS} = xyes; then
AC_PATH_PROG(DIALOG, dialog)
fi
])
AC_DEFUN([STP_CUPS_PATH],
[if test x${cups_prefix} = xNONE ; then
cups_prefix="/usr"
fi
if test x${exec_prefix} = xNONE ; then
if test "${cups_prefix}" = "/" ; then
cups_exec_prefix="/usr"
else
cups_exec_prefix="${cups_prefix}"
fi
fi
if test "${bindir}" = "\${prefix}/bin" -a "${cups_prefix}" = "/" ; then
cups_bindir="/usr/bin"
else
cups_bindir="${cups_prefix}/bin"
fi
if test "${sbindir}" = "\${prefix}/sbin" -a "${cups_prefix}" = "/" ; then
cups_sbindir="/usr/sbin"
else
cups_sbindir="${cups_prefix}/sbin"
fi
if test "x$CUPS_CONFIG" != x; then
cups_conf_datadir="`$CUPS_CONFIG --datadir`"
cups_conf_serverbin="`$CUPS_CONFIG --serverbin`"
cups_conf_serverroot="`$CUPS_CONFIG --serverroot`"
else
if test "${datadir}" = "\${prefix}/share" -a "${cups_prefix}" = "/" ; then
cups_conf_datadir="/usr/share/cups"
else
cups_conf_datadir="${cups_prefix}/share/cups"
fi
if test "${libdir}" = "\${prefix}/lib" -a "${cups_prefix}" = "/" ; then
cups_conf_serverbin="/usr/lib/cups"
else
cups_conf_serverbin="${cups_prefix}/lib/cups"
fi
if test "${sysconfdir}" = "\${prefix}/etc"; then
if test "${cups_prefix}" = "/usr" ; then
cups_conf_serverroot="/etc/cups"
else
cups_conf_serverroot="${cups_prefix}/etc/cups"
fi
fi
fi
])