diff options
author | Didier Raboud <odyx@debian.org> | 2019-09-13 17:56:14 +0200 |
---|---|---|
committer | Didier Raboud <odyx@debian.org> | 2019-09-13 17:56:14 +0200 |
commit | b38516f13a1f563aa1eb7faf80965755ac63e3e6 (patch) | |
tree | fd60cd4095a45f7327d28dfe04bbfb34b7d7215a /m4local | |
parent | e50542121e724e851fc5d6c68bb773f80c0bc12c (diff) |
New upstream version 5.3.3
Diffstat (limited to 'm4local')
-rw-r--r-- | m4local/stp.m4 | 37 | ||||
-rw-r--r-- | m4local/stp_cups.m4 | 148 | ||||
-rw-r--r-- | m4local/stp_option.m4 | 172 |
3 files changed, 357 insertions, 0 deletions
diff --git a/m4local/stp.m4 b/m4local/stp.m4 new file mode 100644 index 0000000..d572d4a --- /dev/null +++ b/m4local/stp.m4 @@ -0,0 +1,37 @@ +# This file is part of Gutenprint. -*- Autoconf -*- +# Gutenprint Autoconf support. +# Copyright 2001-2002 Roger Leigh +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. +# 02111-1307, USA. + +## Table of Contents: +## 1. Autoconf support + + +## ---------------- ## +## Autoconf support ## +## ---------------- ## + + +# STP_INIT +# -------- +# Initialise Gutenprint autoconf macros. Turn on error detection of +# STP_* macros +AC_DEFUN([STP_INIT], +[m4_pattern_forbid([STP_])]) + +AC_DEFUN([CONFIG_FILE_EXEC], +[AC_CONFIG_FILES([$1], [chmod +x $1])]) + diff --git a/m4local/stp_cups.m4 b/m4local/stp_cups.m4 new file mode 100644 index 0000000..03e77c3 --- /dev/null +++ b/m4local/stp_cups.m4 @@ -0,0 +1,148 @@ +# This file is part of Gutenprint. -*- Autoconf -*- +# CUPS support. +# Copyright 2000-2002 Roger Leigh +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. +# 02111-1307, USA. + + +## ------------ ## +## CUPS support ## +## ------------ ## + + +# STP_CUPS_LIBS +# ------------- +# Check for CUPS libraries. +AC_DEFUN([STP_CUPS_LIBS], +[dnl CUPS library checks +dnl check for libm, and also add to CUPS LIBS +AC_CHECK_LIB(m,pow, + CUPS_LIBS="${CUPS_LIBS} -lm") +dnl CUPS library checks +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 + dnl Use values from CUPS config... + CUPS_LIBS="`$CUPS_CONFIG --ldflags` `$CUPS_CONFIG --image --libs`" + CUPS_CFLAGS="`$CUPS_CONFIG --cflags`" + else + dnl Save current library list... + 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) + + dnl Some OS's need to link against crypto stuff too if CUPS is compiled + dnl with crypto support... :( + AC_CHECK_HEADER(openssl/ssl.h, + dnl Some ELF systems can't resolve all the symbols in libcrypto + dnl if libcrypto was linked against RSAREF, and fail to link the + dnl test program correctly, even though a correct installation + dnl of OpenSSL exists. So we test the linking three times in + dnl case the RSAREF libraries are needed. + + 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) + + dnl Require CUPS 1.1... + 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) + dnl Restore old library list... + LIBS="$SAVELIBS" + + dnl Add CUPS include directory as needed... + 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 +]) + +# STP_CUPS_PATH +# ------------- +# Set CUPS install paths +AC_DEFUN([STP_CUPS_PATH], +[# CUPS path setup + +# Fix "cups_prefix" variable if it hasn't been specified... +if test "x${cups_prefix}" = xNONE -o "x{$cups_prefix}" = x ; then + if test "x${prefix}" = xNONE -o "x${prefix}" = x ; then + cups_prefix="/usr" + else + cups_prefix="${prefix}" + fi +fi + +# Fix "cups_exec_prefix" variable if it hasn't been specified... +if test "x${cups_exec_prefix}" = xNONE -o "x${cups_exec_prefix}" = x ; then + if test x"${exec_prefix}" = xNONE -o "x${exec_prefix}" = x ; then + cups_exec_prefix="${cups_prefix}" + else + cups_exec_prefix="${exec_prefix}" + fi +fi + +# Get explicit CUPS directories if possible +if test "x$CUPS_CONFIG" != x -a "x$NO_PKGCONFIG_PATHS" = x; then + cups_conf_datadir="`$CUPS_CONFIG --datadir`" + cups_conf_serverroot="`$CUPS_CONFIG --serverroot`" + cups_conf_serverbin="`$CUPS_CONFIG --serverbin`" +else + cups_conf_datadir="${cups_prefix}/share/cups" + cups_conf_serverroot="${cups_prefix}/etc/cups" + cups_conf_serverbin="${cups_exec_prefix}/lib/cups" +fi + +# And the rest! +cups_bindir="${cups_exec_prefix}/bin" +cups_sbindir="${cups_exec_prefix}/sbin" + +]) diff --git a/m4local/stp_option.m4 b/m4local/stp_option.m4 new file mode 100644 index 0000000..31757fa --- /dev/null +++ b/m4local/stp_option.m4 @@ -0,0 +1,172 @@ +# This file is part of Gutenprint. -*- Autoconf -*- +# Convenience macros. +# Copyright 2001-2002 Roger Leigh +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. +# 02111-1307, USA. + +## Table of Contents: +## 1. Option handling +## 2. Conditionals + + +## ------------------ ## +## 1. Option handling ## +## ------------------ ## + + +## STP_ARG_WITH_DETAILED [(NAME, [NAME_OPTION], HELP, [HELP_OPTION], +## VARIABLE, DEFAULT, [OPTION_TRUE], [OPTION_FALSE])] +## ------------------------------------------------------------------- +## Create a standardised configure option. +## NAME Option name i.e. --with-foo or --enable-foo. +## NAME_OPTION Optional input for use with NAME (informational). +## HELP Help string to display. +## HELP_OPTION Additional defaults information in addition to +## DEFAULT. +## VARIABLE Variable to set with command-line results. +## DEFAULT Default value of VARIABLE. +## OPTION_TRUE case statement body if an option is supplied. +## This replaces the default actions. +## OPTION_FALSE Shell commands to run if no option is supplied. + +AC_DEFUN([STP_ARG_WITH_DETAILED], +[# create custom command-line --with option +AC_MSG_CHECKING([whether to $3]) +AC_ARG_WITH($1, + [AC_HELP_STRING([--with-$1]m4_if([$2], , , [$2]), + [$3 ]m4_if([$4], , , [$4 ])[@<:@]$6[@:>@])], + [case "${withval}" in + m4_if([$7], ,[ + yes) [$5]="yes" ; AC_MSG_RESULT(${[$5]}) ;; + no) [$5]="no" ; AC_MSG_RESULT(${[$5]}) ;; + *) AC_MSG_RESULT([unknown]) + AC_MSG_ERROR([bad value ${withval} for --with-$1]) ;; + ], [$7]) + esac], + [if test -z "${[$5]}" ; then + [$5]="$6" + fi + AC_MSG_RESULT(${[$5]}) ; m4_if([$8], , , [$8])]) +if test -z "${[$5]}" ; then + [$5]="$6" +fi +]) + + +## STP_ARG_ENABLE_DETAILED [(NAME, [NAME_OPTION], HELP, [HELP_OPTION], +## VARIABLE, DEFAULT, [OPTION_TRUE], [OPTION_FALSE])] +## ------------------------------------------------------------------- +## Create a standardised configure option. +## Identical to ATP_ARG_WITH_DETAILED. +AC_DEFUN([STP_ARG_ENABLE_DETAILED], +[# create custom command-line --enable option +AC_MSG_CHECKING([whether to $3]) +AC_ARG_ENABLE($1, + [AC_HELP_STRING([--enable-$1]m4_if([$2], , , [$2]), + [$3 ]m4_if([$4], , , [$4 ])[@<:@]$6[@:>@])], + [case "${enableval}" in + m4_if([$7], ,[ + yes) [$5]="yes" ; AC_MSG_RESULT(${[$5]}) ;; + no) [$5]="no" ; AC_MSG_RESULT(${[$5]}) ;; + *) AC_MSG_RESULT([unknown]) + AC_MSG_ERROR([bad value ${enableval} for --enable-$1]) ;; + ], [$7]) + esac], + [if test -z "${[$5]}" ; then + [$5]="$6" + fi + AC_MSG_RESULT(${[$5]}) ; m4_if([$8], , , [$8])]) +if test -z "${[$5]}" ; then + [$5]="$6" +fi +]) + + +## STP_ARG_WITH (NAME, HELP, VARIABLE, DEFAULT, [OPTION_TRUE], [OPTION_FALSE]) +## --------------------------------------------------------------------------- +## NAME Option name i.e. --with-foo or --enable-foo. +## HELP Help string to display. +## VARIABLE Variable to set with command-line results. +## DEFAULT Default value of VARIABLE. +## OPTION_TRUE case statement body if an option is supplied. +## This replaces the default actions. +## OPTION_FALSE shell commands to run if no option is supplied. +AC_DEFUN([STP_ARG_WITH], +[STP_ARG_WITH_DETAILED([$1], , [$2], , [$3], [$4], [$5], [$6])]) + +## STP_ARG_ENABLE (NAME, HELP, VARIABLE, DEFAULT, [OPTION_TRUE], [OPTION_FALSE]) +## ----------------------------------------------------------------------------- +## Identical to STP_ARG_WITH. +AC_DEFUN([STP_ARG_ENABLE], +[STP_ARG_ENABLE_DETAILED([$1], , [$2], , [$3], [$4], [$5], [$6])]) + + + + +## --------------- ## +## 2. Conditionals ## +## --------------- ## + + +# STP_CONDITIONAL (OPTION) +# ------------------------ +# Define automake conditional based on STP_ARG* results. Until +# automake uses autoconf traces, this breaks automake +AC_DEFUN([STP_CONDITIONAL], +[AM_CONDITIONAL(BUILD_$1, test x${BUILD_$1} = xyes)]) + + +## STP_ADD_COMPILER_ARG (ARG, COMPILER, VARIABLE) +## --------------------------------------------------------------------------- +## ARG Compiler option +## COMPILER Compiler name +## VARIABLE Variable to add option to (default CFLAGS). +AC_DEFUN([STP_ADD_COMPILER_ARG],[ + AC_MSG_CHECKING(if m4_ifval([$2], [$2 ], [${CC} ])supports $1) + stp_acOLDCFLAGS="${CFLAGS}" + NCFLAGS="${m4_ifval([$3], [$3], [CFLAGS])} $1" + CFLAGS="$NCFLAGS -Werror" + AC_TRY_COMPILE(,, + [ AC_MSG_RESULT(yes); + stp_newCFLAGS="$NCFLAGS"], + [ AC_MSG_RESULT(no); + stp_newCFLAGS="$stp_acOLDCFLAGS"]) + CFLAGS="$stp_acOLDCFLAGS" + m4_ifval([$3], [$3], [CFLAGS])="${stp_newCFLAGS}" +]) + +## STP_ADD_FIRST_COMPILER_ARG (ARGS, COMPILER, VARIABLE) +## --------------------------------------------------------------------------- +## ARGS Compiler options +## COMPILER Compiler name +## VARIABLE Variable to add option to (default CFLAGS). +AC_DEFUN([STP_ADD_FIRST_COMPILER_ARG],[ + for stp_ac_arg in $1 ; do + stp_ac_save_CFLAGS="${m4_ifval([$3], [$3], [CFLAGS])}" + STP_ADD_COMPILER_ARG([${stp_ac_arg}], [$2], [$3]) + test "${stp_ac_save_CFLAGS}" != "${m4_ifval([$3], [$3], [CFLAGS])}" && break + done +]) + +## STP_ADD_COMPILER_ARGS (ARGS, COMPILER, VARIABLE) +## --------------------------------------------------------------------------- +## ARGS Compiler options +## COMPILER Compiler name +## VARIABLE Variable to add option to (default CFLAGS). +AC_DEFUN([STP_ADD_COMPILER_ARGS],[ + for stp_ac_arg in $1 ; do + STP_ADD_COMPILER_ARG([${stp_ac_arg}], [$2], [$3]) + done +]) |