more ppd works for foomatic-rip
author"Luc Saillard <luc@saillard.org>"
Wed May 21 19:14:29 2008 +0200 (7 months ago)
changeset 476abc5e22df29
parent 463c34d8914e3a
child 480d8dac517565
more ppd works for foomatic-rip
autogen.sh
m4/gettext.m4
m4/lib-link.m4
po/Makefile.in.in
src/Makefile.am
src/foomatic-rip.c
src/ppd.c
src/ppd.h
--- a/autogen.sh Wed May 21 10:34:34 2008 +0200
+++ b/autogen.sh Wed May 21 19:14:29 2008 +0200
@@ -3,5 +3,5 @@ if [ ! -d po ]; then
if [ ! -d po ]; then
gettextize --copy --no-changelog
fi
-autoreconf --install
+autoreconf --install --force
--- a/m4/gettext.m4 Wed May 21 10:34:34 2008 +0200
+++ b/m4/gettext.m4 Wed May 21 19:14:29 2008 +0200
@@ -1,4 +1,4 @@
-# gettext.m4 serial 59 (gettext-0.16.1)
+# gettext.m4 serial 53 (gettext-0.15)
dnl Copyright (C) 1995-2006 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -15,7 +15,7 @@ dnl They are *not* in the public domain.
dnl Authors:
dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
-dnl Bruno Haible <haible@clisp.cons.org>, 2000-2006.
+dnl Bruno Haible <haible@clisp.cons.org>, 2000-2005.
dnl Macro to add for using GNU gettext.
@@ -63,13 +63,8 @@ AC_DEFUN([AM_GNU_GETTEXT],
ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], ,
[errprint([ERROR: invalid second argument to AM_GNU_GETTEXT
])])])])
- define([gt_included_intl],
- ifelse([$1], [external],
- ifdef([AM_GNU_GETTEXT_][INTL_SUBDIR], [yes], [no]),
- [yes]))
+ define([gt_included_intl], ifelse([$1], [external], [no], [yes]))
define([gt_libtool_suffix_prefix], ifelse([$1], [use-libtool], [l], []))
- gt_NEEDS_INIT
- AM_GNU_GETTEXT_NEED([$2])
AC_REQUIRE([AM_PO_SUBDIRS])dnl
ifelse(gt_included_intl, yes, [
@@ -83,7 +78,7 @@ AC_DEFUN([AM_GNU_GETTEXT],
dnl Sometimes libintl requires libiconv, so first search for libiconv.
dnl Ideally we would do this search only after the
dnl if test "$USE_NLS" = "yes"; then
- dnl if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then
+ dnl if test "$gt_cv_func_gnugettext_libc" != "yes"; then
dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT
dnl the configure script would need to contain the same shell code
dnl again, outside any 'if'. There are two solutions:
@@ -109,15 +104,6 @@ AC_DEFUN([AM_GNU_GETTEXT],
LTLIBINTL=
POSUB=
- dnl Add a version number to the cache macros.
- case " $gt_needs " in
- *" need-formatstring-macros "*) gt_api_version=3 ;;
- *" need-ngettext "*) gt_api_version=2 ;;
- *) gt_api_version=1 ;;
- esac
- gt_func_gnugettext_libc="gt_cv_func_gnugettext${gt_api_version}_libc"
- gt_func_gnugettext_libintl="gt_cv_func_gnugettext${gt_api_version}_libintl"
-
dnl If we use NLS figure out what method
if test "$USE_NLS" = "yes"; then
gt_use_preinstalled_gnugettext=no
@@ -136,35 +122,26 @@ AC_DEFUN([AM_GNU_GETTEXT],
dnl to use. If GNU gettext is available we use this. Else we have
dnl to fall back to GNU NLS library.
- if test $gt_api_version -ge 3; then
- gt_revision_test_code='
-#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
+ dnl Add a version number to the cache macros.
+ define([gt_api_version], ifelse([$2], [need-formatstring-macros], 3, ifelse([$2], [need-ngettext], 2, 1)))
+ define([gt_cv_func_gnugettext_libc], [gt_cv_func_gnugettext]gt_api_version[_libc])
+ define([gt_cv_func_gnugettext_libintl], [gt_cv_func_gnugettext]gt_api_version[_libintl])
+
+ AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,
+ [AC_TRY_LINK([#include <libintl.h>
+]ifelse([$2], [need-formatstring-macros],
+[[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
#endif
-changequote(,)dnl
typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
-changequote([,])dnl
-'
- else
- gt_revision_test_code=
- fi
- if test $gt_api_version -ge 2; then
- gt_expression_test_code=' + * ngettext ("", "", 0)'
- else
- gt_expression_test_code=
- fi
-
- AC_CACHE_CHECK([for GNU gettext in libc], [$gt_func_gnugettext_libc],
- [AC_TRY_LINK([#include <libintl.h>
-$gt_revision_test_code
-extern int _nl_msg_cat_cntr;
+]], [])[extern int _nl_msg_cat_cntr;
extern int *_nl_domain_bindings;],
[bindtextdomain ("", "");
-return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_domain_bindings],
- [eval "$gt_func_gnugettext_libc=yes"],
- [eval "$gt_func_gnugettext_libc=no"])])
-
- if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then
+return * gettext ("")]ifelse([$2], [need-ngettext], [ + * ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings],
+ gt_cv_func_gnugettext_libc=yes,
+ gt_cv_func_gnugettext_libc=no)])
+
+ if test "$gt_cv_func_gnugettext_libc" != "yes"; then
dnl Sometimes libintl requires libiconv, so first search for libiconv.
ifelse(gt_included_intl, yes, , [
AM_ICONV_LINK
@@ -175,40 +152,48 @@ return * gettext ("")$gt_expression_test
dnl even if libiconv doesn't exist.
AC_LIB_LINKFLAGS_BODY([intl])
AC_CACHE_CHECK([for GNU gettext in libintl],
- [$gt_func_gnugettext_libintl],
+ gt_cv_func_gnugettext_libintl,
[gt_save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $INCINTL"
gt_save_LIBS="$LIBS"
LIBS="$LIBS $LIBINTL"
dnl Now see whether libintl exists and does not depend on libiconv.
AC_TRY_LINK([#include <libintl.h>
-$gt_revision_test_code
-extern int _nl_msg_cat_cntr;
+]ifelse([$2], [need-formatstring-macros],
+[[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
+#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
+#endif
+typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
+]], [])[extern int _nl_msg_cat_cntr;
extern
#ifdef __cplusplus
"C"
#endif
const char *_nl_expand_alias (const char *);],
[bindtextdomain ("", "");
-return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("")],
- [eval "$gt_func_gnugettext_libintl=yes"],
- [eval "$gt_func_gnugettext_libintl=no"])
+return * gettext ("")]ifelse([$2], [need-ngettext], [ + * ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias ("")],
+ gt_cv_func_gnugettext_libintl=yes,
+ gt_cv_func_gnugettext_libintl=no)
dnl Now see whether libintl exists and depends on libiconv.
- if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" != yes; } && test -n "$LIBICONV"; then
+ if test "$gt_cv_func_gnugettext_libintl" != yes && test -n "$LIBICONV"; then
LIBS="$LIBS $LIBICONV"
AC_TRY_LINK([#include <libintl.h>
-$gt_revision_test_code
-extern int _nl_msg_cat_cntr;
+]ifelse([$2], [need-formatstring-macros],
+[[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
+#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
+#endif
+typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
+]], [])[extern int _nl_msg_cat_cntr;
extern
#ifdef __cplusplus
"C"
#endif
const char *_nl_expand_alias (const char *);],
[bindtextdomain ("", "");
-return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("")],
+return * gettext ("")]ifelse([$2], [need-ngettext], [ + * ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias ("")],
[LIBINTL="$LIBINTL $LIBICONV"
LTLIBINTL="$LTLIBINTL $LTLIBICONV"
- eval "$gt_func_gnugettext_libintl=yes"
+ gt_cv_func_gnugettext_libintl=yes
])
fi
CPPFLAGS="$gt_save_CPPFLAGS"
@@ -219,8 +204,8 @@ return * gettext ("")$gt_expression_test
dnl use it. But if this macro is used in GNU gettext, and GNU
dnl gettext is already preinstalled in libintl, we update this
dnl libintl. (Cf. the install rule in intl/Makefile.in.)
- if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" = "yes"; } \
- || { { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; } \
+ if test "$gt_cv_func_gnugettext_libc" = "yes" \
+ || { test "$gt_cv_func_gnugettext_libintl" = "yes" \
&& test "$PACKAGE" != gettext-runtime \
&& test "$PACKAGE" != gettext-tools; }; then
gt_use_preinstalled_gnugettext=yes
@@ -280,7 +265,7 @@ return * gettext ("")$gt_expression_test
if test "$USE_NLS" = "yes"; then
AC_MSG_CHECKING([where the gettext function comes from])
if test "$gt_use_preinstalled_gnugettext" = "yes"; then
- if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then
+ if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
gt_source="external libintl"
else
gt_source="libc"
@@ -294,7 +279,7 @@ return * gettext ("")$gt_expression_test
if test "$USE_NLS" = "yes"; then
if test "$gt_use_preinstalled_gnugettext" = "yes"; then
- if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then
+ if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
AC_MSG_CHECKING([how to link with libintl])
AC_MSG_RESULT([$LIBINTL])
AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL])
@@ -359,6 +344,228 @@ return * gettext ("")$gt_expression_test
AC_SUBST(LIBINTL)
AC_SUBST(LTLIBINTL)
AC_SUBST(POSUB)
+])
+
+
+dnl Checks for all prerequisites of the intl subdirectory,
+dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS,
+dnl USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL.
+AC_DEFUN([AM_INTL_SUBDIR],
+[
+ AC_REQUIRE([AC_PROG_INSTALL])dnl
+ AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake
+ AC_REQUIRE([AC_PROG_CC])dnl
+ AC_REQUIRE([AC_CANONICAL_HOST])dnl
+ AC_REQUIRE([gt_GLIBC2])dnl
+ AC_REQUIRE([AC_PROG_RANLIB])dnl
+ AC_REQUIRE([gl_VISIBILITY])dnl
+ AC_REQUIRE([gt_INTL_SUBDIR_CORE])dnl
+ AC_REQUIRE([bh_C_SIGNED])dnl
+ AC_REQUIRE([gl_AC_TYPE_LONG_LONG])dnl
+ AC_REQUIRE([gt_TYPE_LONGDOUBLE])dnl
+ AC_REQUIRE([gt_TYPE_WCHAR_T])dnl
+ AC_REQUIRE([gt_TYPE_WINT_T])dnl
+ AC_REQUIRE([gl_AC_HEADER_INTTYPES_H])
+ AC_REQUIRE([gt_TYPE_INTMAX_T])
+ AC_REQUIRE([gt_PRINTF_POSIX])
+ AC_REQUIRE([gl_GLIBC21])dnl
+ AC_REQUIRE([gl_XSIZE])dnl
+ AC_REQUIRE([gt_INTL_MACOSX])dnl
+
+ AC_CHECK_TYPE([ptrdiff_t], ,
+ [AC_DEFINE([ptrdiff_t], [long],
+ [Define as the type of the result of subtracting two pointers, if the system doesn't define it.])
+ ])
+ AC_CHECK_HEADERS([stddef.h stdlib.h string.h])
+ AC_CHECK_FUNCS([asprintf fwprintf putenv setenv setlocale snprintf wcslen])
+
+ dnl Use the _snprintf function only if it is declared (because on NetBSD it
+ dnl is defined as a weak alias of snprintf; we prefer to use the latter).
+ gt_CHECK_DECL(_snprintf, [#include <stdio.h>])
+ gt_CHECK_DECL(_snwprintf, [#include <stdio.h>])
+
+ dnl Use the *_unlocked functions only if they are declared.
+ dnl (because some of them were defined without being declared in Solaris
+ dnl 2.5.1 but were removed in Solaris 2.6, whereas we want binaries built
+ dnl on Solaris 2.5.1 to run on Solaris 2.6).
+ dnl Don't use AC_CHECK_DECLS because it isn't supported in autoconf-2.13.
+ gt_CHECK_DECL(getc_unlocked, [#include <stdio.h>])
+
+ case $gt_cv_func_printf_posix in
+ *yes) HAVE_POSIX_PRINTF=1 ;;
+ *) HAVE_POSIX_PRINTF=0 ;;
+ esac
+ AC_SUBST([HAVE_POSIX_PRINTF])
+ if test "$ac_cv_func_asprintf" = yes; then
+ HAVE_ASPRINTF=1
+ else
+ HAVE_ASPRINTF=0
+ fi
+ AC_SUBST([HAVE_ASPRINTF])
+ if test "$ac_cv_func_snprintf" = yes; then
+ HAVE_SNPRINTF=1
+ else
+ HAVE_SNPRINTF=0
+ fi
+ AC_SUBST([HAVE_SNPRINTF])
+ if test "$ac_cv_func_wprintf" = yes; then
+ HAVE_WPRINTF=1
+ else
+ HAVE_WPRINTF=0
+ fi
+ AC_SUBST([HAVE_WPRINTF])
+
+ AM_LANGINFO_CODESET
+ gt_LC_MESSAGES
+
+ dnl Compilation on mingw and Cygwin needs special Makefile rules, because
+ dnl 1. when we install a shared library, we must arrange to export
+ dnl auxiliary pointer variables for every exported variable,
+ dnl 2. when we install a shared library and a static library simultaneously,
+ dnl the include file specifies __declspec(dllimport) and therefore we
+ dnl must arrange to define the auxiliary pointer variables for the
+ dnl exported variables _also_ in the static library.
+ if test "$enable_shared" = yes; then
+ case "$host_os" in
+ cygwin*) is_woe32dll=yes ;;
+ *) is_woe32dll=no ;;
+ esac
+ else
+ is_woe32dll=no
+ fi
+ WOE32DLL=$is_woe32dll
+ AC_SUBST([WOE32DLL])
+
+ dnl Rename some macros and functions used for locking.
+ AH_BOTTOM([
+#define __libc_lock_t gl_lock_t
+#define __libc_lock_define gl_lock_define
+#define __libc_lock_define_initialized gl_lock_define_initialized
+#define __libc_lock_init gl_lock_init
+#define __libc_lock_lock gl_lock_lock
+#define __libc_lock_unlock gl_lock_unlock
+#define __libc_lock_recursive_t gl_recursive_lock_t
+#define __libc_lock_define_recursive gl_recursive_lock_define
+#define __libc_lock_define_initialized_recursive gl_recursive_lock_define_initialized
+#define __libc_lock_init_recursive gl_recursive_lock_init
+#define __libc_lock_lock_recursive gl_recursive_lock_lock
+#define __libc_lock_unlock_recursive gl_recursive_lock_unlock
+#define glthread_in_use libintl_thread_in_use
+#define glthread_lock_init libintl_lock_init
+#define glthread_lock_lock libintl_lock_lock
+#define glthread_lock_unlock libintl_lock_unlock
+#define glthread_lock_destroy libintl_lock_destroy
+#define glthread_rwlock_init libintl_rwlock_init
+#define glthread_rwlock_rdlock libintl_rwlock_rdlock
+#define glthread_rwlock_wrlock libintl_rwlock_wrlock
+#define glthread_rwlock_unlock libintl_rwlock_unlock
+#define glthread_rwlock_destroy libintl_rwlock_destroy
+#define glthread_recursive_lock_init libintl_recursive_lock_init
+#define glthread_recursive_lock_lock libintl_recursive_lock_lock
+#define glthread_recursive_lock_unlock libintl_recursive_lock_unlock
+#define glthread_recursive_lock_destroy libintl_recursive_lock_destroy
+#define glthread_once libintl_once
+#define glthread_once_call libintl_once_call
+#define glthread_once_singlethreaded libintl_once_singlethreaded
+])
+])
+
+
+dnl Checks for the core files of the intl subdirectory:
+dnl dcigettext.c
+dnl eval-plural.h
+dnl explodename.c
+dnl finddomain.c
+dnl gettextP.h
+dnl gmo.h
+dnl hash-string.h hash-string.c
+dnl l10nflist.c
+dnl libgnuintl.h.in (except the *printf stuff)
+dnl loadinfo.h
+dnl loadmsgcat.c
+dnl localealias.c
+dnl log.c
+dnl plural-exp.h plural-exp.c
+dnl plural.y
+dnl Used by libglocale.
+AC_DEFUN([gt_INTL_SUBDIR_CORE],
+[
+ AC_REQUIRE([AC_C_INLINE])dnl
+ AC_REQUIRE([AC_TYPE_SIZE_T])dnl
+ AC_REQUIRE([gl_AC_HEADER_STDINT_H])
+ AC_REQUIRE([AC_FUNC_ALLOCA])dnl
+ AC_REQUIRE([AC_FUNC_MMAP])dnl
+ AC_REQUIRE([gt_INTDIV0])dnl
+ AC_REQUIRE([gl_AC_TYPE_UINTMAX_T])dnl
+ AC_REQUIRE([gl_HEADER_INTTYPES_H])dnl
+ AC_REQUIRE([gt_INTTYPES_PRI])dnl
+ AC_REQUIRE([gl_LOCK])dnl
+
+ AC_TRY_LINK(
+ [int foo (int a) { a = __builtin_expect (a, 10); return a == 10 ? 0 : 1; }],
+ [],
+ [AC_DEFINE([HAVE_BUILTIN_EXPECT], 1,
+ [Define to 1 if the compiler understands __builtin_expect.])])
+
+ AC_CHECK_HEADERS([argz.h limits.h unistd.h sys/param.h])
+ AC_CHECK_FUNCS([getcwd getegid geteuid getgid getuid mempcpy munmap \
+ stpcpy strcasecmp strdup strtoul tsearch argz_count argz_stringify \
+ argz_next __fsetlocking])
+
+ dnl Use the *_unlocked functions only if they are declared.
+ dnl (because some of them were defined without being declared in Solaris
+ dnl 2.5.1 but were removed in Solaris 2.6, whereas we want binaries built
+ dnl on Solaris 2.5.1 to run on Solaris 2.6).
+ dnl Don't use AC_CHECK_DECLS because it isn't supported in autoconf-2.13.
+ gt_CHECK_DECL(feof_unlocked, [#include <stdio.h>])
+ gt_CHECK_DECL(fgets_unlocked, [#include <stdio.h>])
+
+ AM_ICONV
+
+ dnl glibc >= 2.4 has a NL_LOCALE_NAME macro when _GNU_SOURCE is defined,
+ dnl and a _NL_LOCALE_NAME macro always.
+ AC_CACHE_CHECK([for NL_LOCALE_NAME macro], gt_cv_nl_locale_name,
+ [AC_TRY_LINK([#include <langinfo.h>
+#include <locale.h>],
+ [char* cs = nl_langinfo(_NL_LOCALE_NAME(LC_MESSAGES));],
+ gt_cv_nl_locale_name=yes,
+ gt_cv_nl_locale_name=no)
+ ])
+ if test $gt_cv_nl_locale_name = yes; then
+ AC_DEFINE(HAVE_NL_LOCALE_NAME, 1,
+ [Define if you have <langinfo.h> and it defines the NL_LOCALE_NAME macro if _GNU_SOURCE is defined.])
+ fi
+
+ dnl intl/plural.c is generated from intl/plural.y. It requires bison,
+ dnl because plural.y uses bison specific features. It requires at least
+ dnl bison-1.26 because earlier versions generate a plural.c that doesn't
+ dnl compile.
+ dnl bison is only needed for the maintainer (who touches plural.y). But in
+ dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put
+ dnl the rule in general Makefile. Now, some people carelessly touch the
+ dnl files or have a broken "make" program, hence the plural.c rule will
+ dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not
+ dnl present or too old.
+ AC_CHECK_PROGS([INTLBISON], [bison])
+ if test -z "$INTLBISON"; then
+ ac_verc_fail=yes
+ else
+ dnl Found it, now check the version.
+ AC_MSG_CHECKING([version of bison])
+changequote(<<,>>)dnl
+ ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
+ case $ac_prog_version in
+ '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
+ 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*)
+changequote([,])dnl
+ ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
+ *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
+ esac
+ AC_MSG_RESULT([$ac_prog_version])
+ fi
+ if test $ac_verc_fail = yes; then
+ INTLBISON=:
+ fi
])
@@ -400,18 +607,23 @@ AC_DEFUN([gt_INTL_MACOSX],
])
-dnl gt_NEEDS_INIT ensures that the gt_needs variable is initialized.
-m4_define([gt_NEEDS_INIT],
+dnl gt_CHECK_DECL(FUNC, INCLUDES)
+dnl Check whether a function is declared.
+AC_DEFUN([gt_CHECK_DECL],
[
- m4_divert_text([DEFAULTS], [gt_needs=])
- m4_define([gt_NEEDS_INIT], [])
-])
-
-
-dnl Usage: AM_GNU_GETTEXT_NEED([NEEDSYMBOL])
-AC_DEFUN([AM_GNU_GETTEXT_NEED],
-[
- m4_divert_text([INIT_PREPARE], [gt_needs="$gt_needs $1"])
+ AC_CACHE_CHECK([whether $1 is declared], ac_cv_have_decl_$1,
+ [AC_TRY_COMPILE([$2], [
+#ifndef $1
+ char *p = (char *) $1;
+#endif
+], ac_cv_have_decl_$1=yes, ac_cv_have_decl_$1=no)])
+ if test $ac_cv_have_decl_$1 = yes; then
+ gt_value=1
+ else
+ gt_value=0
+ fi
+ AC_DEFINE_UNQUOTED([HAVE_DECL_]translit($1, [a-z], [A-Z]), [$gt_value],
+ [Define to 1 if you have the declaration of `$1', and to 0 if you don't.])
])
--- a/m4/lib-link.m4 Wed May 21 10:34:34 2008 +0200
+++ b/m4/lib-link.m4 Wed May 21 19:14:29 2008 +0200
@@ -1,4 +1,4 @@
-# lib-link.m4 serial 9 (gettext-0.16)
+# lib-link.m4 serial 8 (gettext-0.15)
dnl Copyright (C) 2001-2006 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -198,16 +198,9 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
found_so=
found_a=
if test $use_additional = yes; then
- if test -n "$shlibext" \
- && { test -f "$additional_libdir/lib$name.$shlibext" \
- || { test "$shlibext" = dll \
- && test -f "$additional_libdir/lib$name.dll.a"; }; }; then
+ if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
found_dir="$additional_libdir"
- if test -f "$additional_libdir/lib$name.$shlibext"; then
- found_so="$additional_libdir/lib$name.$shlibext"
- else
- found_so="$additional_libdir/lib$name.dll.a"
- fi
+ found_so="$additional_libdir/lib$name.$shlibext"
if test -f "$additional_libdir/lib$name.la"; then
found_la="$additional_libdir/lib$name.la"
fi
@@ -227,16 +220,9 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
case "$x" in
-L*)
dir=`echo "X$x" | sed -e 's/^X-L//'`
- if test -n "$shlibext" \
- && { test -f "$dir/lib$name.$shlibext" \
- || { test "$shlibext" = dll \
- && test -f "$dir/lib$name.dll.a"; }; }; then
+ if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
found_dir="$dir"
- if test -f "$dir/lib$name.$shlibext"; then
- found_so="$dir/lib$name.$shlibext"
- else
- found_so="$dir/lib$name.dll.a"
- fi
+ found_so="$dir/lib$name.$shlibext"
if test -f "$dir/lib$name.la"; then
found_la="$dir/lib$name.la"
fi
--- a/po/Makefile.in.in Wed May 21 10:34:34 2008 +0200
+++ b/po/Makefile.in.in Wed May 21 19:14:29 2008 +0200
@@ -8,7 +8,7 @@
# Please note that the actual code of GNU gettext is covered by the GNU
# General Public License and is *not* in the public domain.
#
-# Origin: gettext-0.16
+# Origin: gettext-0.15
PACKAGE = @PACKAGE@
VERSION = @VERSION@
@@ -30,17 +30,7 @@ gettextsrcdir = $(datadir)/gettext/po
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
-
-# We use $(mkdir_p).
-# In automake <= 1.9.x, $(mkdir_p) is defined either as "mkdir -p --" or as
-# "$(mkinstalldirs)" or as "$(install_sh) -d". For these automake versions,
-# @install_sh@ does not start with $(SHELL), so we add it.
-# In automake >= 1.10, @mkdir_p@ is derived from ${MKDIR_P}, which is defined
-# either as "/path/to/mkdir -p" or ".../install-sh -c -d". For these automake
-# versions, $(mkinstalldirs) and $(install_sh) are unused.
mkinstalldirs = $(SHELL) @install_sh@ -d
-install_sh = $(SHELL) @install_sh@
-MKDIR_P = @MKDIR_P@
mkdir_p = @mkdir_p@
GMSGFMT_ = @GMSGFMT@
--- a/src/Makefile.am Wed May 21 10:34:34 2008 +0200
+++ b/src/Makefile.am Wed May 21 19:14:29 2008 +0200
@@ -30,10 +30,9 @@ udev_printer_CFLAGS=$(GTK2_CFLAGS)
udev_printer_CFLAGS=$(GTK2_CFLAGS)
udev_printer_LDADD=$(GTK2_LIBS) $(LIBINTL)
-foomatic_rip_SOURCES=foomatic-rip.c utils.h
+foomatic_rip_SOURCES=foomatic-rip.c utils.h ppd.c ppd.h
foomatic_rip_CFLAGS=$(GLIB2_CFLAGS)
foomatic_rip_LDADD=$(GLIB2_LIBS)
foomatic_rip_CPPFLAGS = \
- -D__WITHOUT_GTK=1 \
-DLOCALEDIR=\"$(localedir)\"
--- a/src/foomatic-rip.c Wed May 21 10:34:34 2008 +0200
+++ b/src/foomatic-rip.c Wed May 21 19:14:29 2008 +0200
@@ -27,13 +27,17 @@
#include <glib/gi18n-lib.h>
#include <stdlib.h>
#include <stdio.h>
-
+#include <stdlib.h>
+#include <string.h>
+
+#include "ppd.h"
#define SPOOLER_UNKNOWN 0
#define SPOOLER_CUPS 1
-
+static const char *cups_filters_path = "/usr/lib/cups/filter";
+static const char *ghostscript_for_cups = "gs -dQUIET -dDEBUG -dPARANOIDSAFER -dNOPAUSE -dBATCH -dNOMEDIAATTRS -sDEVICE=cups -sOutputFile=-%W -";
static int opt_ps_accounting = 1;
static int opt_debug;
@@ -51,6 +55,7 @@ static int copies;
static int copies;
static char *job_options;
+static char *cups_filter_command;
@@ -58,11 +63,15 @@ static char *job_options;
static int parse_options(int *argc, char ***argv);
static char *string_remove_shell_escapes(char *string);
-static char *string_remove_unprintables(char *string);
+//static char *string_remove_unprintables(char *string);
static void cups_setup_font_path_for_ghostscript(void);
static void cups_get_parameters(int argc, char **argv);
-static void error(const char *fmt, ... );
-static void real_trace(const char *fname, const char *fmt, ... );
+static int cups_setup_with_ppd(struct ppd_t *ppd);
+static char *cups_get_filter_from_mime_type(const char *mime_type, const char *program);
+static char *cups_get_filter_command(struct ppd_t *ppd);
+ void die(const char *fmt, ...);
+ void error(const char *fmt, ... );
+ void real_trace(const char *fname, const char *fmt, ... );
#if defined(__GNUC__)
# define GCC_ATTRIBUTE_PRINTF(x,y) __attribute__((__format__(__printf__,x,y)))
# define GCC_ATTRIBUTE_NORETURN __attribute__ ((noreturn))
@@ -201,6 +210,7 @@ int
int
main(int argc, char **argv)
{
+ struct ppd_t *ppd = NULL;
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
@@ -218,6 +228,16 @@ main(int argc, char **argv)
cups_setup_font_path_for_ghostscript();
cups_get_parameters(argc, argv);
+ ppd = load_and_parse_ppd(opt_ppdfile);
+ if (ppd == NULL)
+ die("PPD %s can't be parse\n", opt_ppdfile);
+
+ if (opt_debug)
+ ppd_print_options(ppd);
+
+ cups_setup_with_ppd(ppd);
+
+ trace("printer command line = %s\n", cups_filter_command);
return 0;
@@ -380,22 +400,109 @@ cups_get_parameters(int argc, char **arg
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+static int
+cups_setup_with_ppd(struct ppd_t *ppd)
+{
+ const char *foomatic_no_page_accounting;
+
+ /* Disable accounting ? */
+ foomatic_no_page_accounting = ppd_get_option_value_by_keyword_name(ppd, "FoomaticNoPageAccounting");
+ if (foomatic_no_page_accounting)
+ {
+ if (strcmp(foomatic_no_page_accounting, "True") == 0)
+ opt_ps_accounting = 0;
+ }
+
+ /* Get the filter command line to use */
+ cups_filter_command = cups_get_filter_command(ppd);
+
+ return 0;
+}
+
+static char *
+cups_get_filter_command(struct ppd_t *ppd)
+{
+ char **cupsfilter_elements;
+ char *cups_filter_mime_type, *cups_filter_program;
+ char *filter_command;
+ const char *cups_filter;
+
+ cups_filter = ppd_get_option_value_by_keyword_name(ppd, "cupsFilter");
+ if (cups_filter == NULL)
+ die("no cupsFilter found in the PPD file ???\n");
+ trace("*cupsFilter = %s\n", cups_filter);
+ cupsfilter_elements = g_strsplit(cups_filter, " ", -1);
+ if (cupsfilter_elements == NULL)
+ die("Cannot split the string return for cupsFilter\n");
+
+ cups_filter_mime_type = cupsfilter_elements[0];
+ cups_filter_program = cupsfilter_elements[2];
+
+ filter_command = cups_get_filter_from_mime_type(cups_filter_mime_type, cups_filter_program);
+
+ g_strfreev(cupsfilter_elements);
+
+ return filter_command;
+}
+
+/*
+ * Sometime the ppd contains several mime-type (to be use for another cups ...
+ * ?)
+ *
+ * But this fonction construct something like that
+ *
+ * cat postscript | pstoraster | cupsfilter
+ *
+ */
+static char *
+cups_get_filter_from_mime_type(const char *mime_type, const char *program)
+{
+ char *cups_filter_path, *cups_pstoraster_path, *filter_command;
+
+ /* Get the cups filter to use */
+ /* transform the cups filter into our own command line to use */
+ if (strcmp(mime_type, "application/vnd.cups-postscript") == 0)
+ {
+ cups_filter_path = g_strdup_printf("%s/%s", cups_filters_path, program);
+ if (g_file_test(cups_filter_path, G_FILE_TEST_IS_EXECUTABLE) == FALSE)
+ die("%s cannot be used to filter the file because it is not executable\n", cups_filter_path);
+
+ cups_pstoraster_path = g_strdup_printf("%s/pstoraster", cups_filters_path);
+ if (g_file_test(cups_filter_path, G_FILE_TEST_IS_EXECUTABLE) == FALSE)
+ {
+ trace("pstoraster not found, using ghostscript directly\n");
+ filter_command = g_strdup_printf("%s | %s 0 '' '' 0 '%%Y%%X' ", ghostscript_for_cups, cups_filter_path);
+ }
+ else
+ {
+ /* Build a cups filter command line (we need to simulate the job-id user title copies options [file] */
+ filter_command = g_strdup_printf("%s 0 '' '' 0 '%%X' | %s 0 '' '' 0 '%%Y%%X' ", cups_pstoraster_path, cups_filter_path);
+ }
+
+ g_free(cups_filter_path);
+ g_free(cups_pstoraster_path);
+ }
+ else
+ {
+ error("Unsupported cups mime-type filter (%s)\n", mime_type);
+ filter_command = "cat %%A %%B %%C %%D %%E %%F %%G %%H %%I %%J %%K %%L %%M %%Z";
+ }
+
+ return filter_command;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+#if 0
static char *
string_remove_unprintables(char *string)
{
@@ -413,6 +520,7 @@ string_remove_unprintables(char *string)
*d = 0;
return string;
}
+#endif
static char *
string_remove_shell_escapes(char *string)
@@ -452,8 +560,8 @@ string_remove_shell_escapes(char *string
return string;
}
-static void
-error(const char *fmt, ... )
+void
+die(const char *fmt, ...)
{
char buf[1024];
va_list ap;
@@ -463,10 +571,24 @@ error(const char *fmt, ... )
vfprintf(log_fd, buf, ap);
va_end(ap);
fflush(log_fd);
+ exit(1);
+}
+
+void
+error(const char *fmt, ... )
+{
+ char buf[1024];
+ va_list ap;
+
+ va_start(ap, fmt);
+ snprintf(buf, sizeof(buf), "%s", fmt);
+ vfprintf(log_fd, buf, ap);
+ va_end(ap);
+ fflush(log_fd);
}
#if ENABLE_DEBUG_TRACE
-static void
+void
real_trace(const char *fname, const char *fmt, ... )
{
char buf[512];
--- a/src/ppd.c Wed May 21 10:34:34 2008 +0200
+++ b/src/ppd.c Wed May 21 19:14:29 2008 +0200
@@ -310,7 +310,7 @@ ppd_parse_line(struct ppd_stream_t *cont
if (*pbegin == '*')
pbegin++;
else
- die(_("Invalid syntax in PPD file.\nA keyword must begin with a '*'."));
+ error(_("Invalid syntax in PPD file.\nA keyword must begin with a '*'."));
if (keyword_end == NULL)
{
@@ -469,7 +469,7 @@ ppd_parse_line(struct ppd_stream_t *cont
{
value[value_index++] = *p;
if (value_index >= MAX_PPD_STRINGLEN)
- die(_("Invalid PPD file.\nYou need to increase MAX_PPD_STRINGLEN (current value is %d)"),
+ error(_("Invalid PPD file.\nYou need to increase MAX_PPD_STRINGLEN (current value is %d)"),
value_index);
}
@@ -592,8 +592,8 @@ static void
static void
ppd_fill_order_dependency(struct ppd_t *ppd)
{
- const struct ppd_keyword *keyword;
- const struct ppd_keyword *keyword_target;
+ struct ppd_keyword *keyword;
+ struct ppd_keyword *keyword_target;
GList *options;
keyword = ppd_get_keyword_by_name(ppd, "OrderDependency");
@@ -616,13 +616,13 @@ ppd_fill_order_dependency(struct ppd_t *
trace("Order: %d for %s\n", order, keyword_name);
keyword_target = ppd_get_keyword_by_name(ppd, keyword_name);
if (keyword_target)
- ((struct ppd_keyword *)keyword_target)->order = order;
+ keyword_target->order = order;
else
error("Keyword %s was not found\n", keyword_name);
}
else
{
- die("Cannot parse *OrderDependency tag\n");
+ error("Cannot parse *OrderDependency tag\n");
}
options = options->next;
}
@@ -631,7 +631,7 @@ ppd_fill_order_dependency(struct ppd_t *
if (keyword == NULL)
return;
- ppd_reorder_keyword(ppd, (struct ppd_keyword *)keyword);
+ ppd_reorder_keyword(ppd, keyword);
}
@@ -725,13 +725,13 @@ print_ppd_option(struct ppd_option *opti
print_ppd_option(struct ppd_option *option)
{
if (option->name == NULL)
- trace(" %s\n", option->value);
+ trace(" %s\n", option->value);
else if (option->enum_value)
- trace(" %s=%s: %s\n", option->name, option->enum_value, option->value);
+ trace(" %s=%s: %s\n", option->name, option->enum_value, option->value);
else if (option->long_name)
- trace(" %s/%s: %s\n", option->name, option->long_name, option->value);
+ trace(" %s/%s: %s\n", option->name, option->long_name, option->value);
else
- trace(" %s: %s\n", option->name, option->value);
+ trace(" %s: %s\n", option->name, option->value);
}
static void
@@ -741,9 +741,9 @@ print_ppd_keyword(gpointer key, gpointer
GList *options;
if (keyword->default_option)
- trace("*%s [%s]\n", keyword->name, keyword->default_option);
+ trace("*%s [%s]::\n", keyword->name, keyword->default_option);
else
- trace("*%s\n", keyword->name);
+ trace("*%s::\n", keyword->name);
options = keyword->options;
while (options)
@@ -893,19 +893,28 @@ ppd_get_option_value_full(const struct p
}
-static const char *
+const char *
ppd_get_option_value_by_keyword_name(const struct ppd_t *ppd,
const char *keyword_name)
{
const struct ppd_keyword *keyword;
+ const struct ppd_option *option;
GList *options;
- struct ppd_option *option;
keyword = ppd_get_keyword_by_name(ppd, keyword_name);
+ if (keyword == NULL)
+ {
+ trace("No key [*%s] found\n", keyword_name);
+ return NULL;
+ }
+
options = keyword->options;
-
if (options == NULL)
- return NULL;
+ {
+ trace("No options for key [*%s] found\n", keyword_name);
+ return NULL;
+ }
+
option = options->data;
return option->value;
}
@@ -1220,7 +1229,7 @@ ppd_add_ppd_options_to_cmdline(const str
break;
default:
- die("Unknown foomatic rip option: \"%s\"\n", option->value);
+ error("Unknown foomatic rip option: \"%s\"\n", option->value);
break;
}
@@ -1239,7 +1248,7 @@ ppd_add_ppd_options_to_cmdline(const str
break;
default:
- die(" style unknown (%d)\n", opt.style);
+ error(" style unknown (%d)\n", opt.style);
break;
}
--- a/src/ppd.h Wed May 21 10:34:34 2008 +0200
+++ b/src/ppd.h Wed May 21 19:14:29 2008 +0200
@@ -34,6 +34,9 @@ void ppd_set_options_and_free_it(struct
void ppd_set_options_and_free_it(struct ppd_t *ppd, GList *options);
void ppd_set_options(struct ppd_t *ppd, GList *options);
+const char *ppd_get_option_value_by_keyword_name(const struct ppd_t *ppd,
+ const char *keyword_name);
+
struct ppd_keyword *ppd_get_keyword_by_name(const struct ppd_t *ppd,
const char *keyword_name);