2 Commits

Author SHA256 Message Date
bd1790d550 Accepting request 1281714 from graphics
OBS-URL: https://build.opensuse.org/request/show/1281714
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/autotrace?expand=0&rev=26
2025-06-02 19:59:41 +00:00
4c18b9edf3 * Update to version 0.31.10.
* Drop upstreamed or otherwise unnecessary patches:
* Drop additional pstoedit.m4 file source as not needed any more.
* Add autotrace-pkgconfig-private-libs.patch: [pkgconfig] Move some libraries to Libs.private (gh#autotrace/autotrace#124).
* Add autotrace-ac_subst-magick-vars.patch: Fix unexpanded MAGICK_* automake variables in pkgconfig file (gh#autotrace/autotrace#160).
* Use full URL for Source0.
* Split off separate lang package.
* Run tests as part of %check section; add BuildRequires: procps for pkill command used in some tests.
* Specfile cleanups.

OBS-URL: https://build.opensuse.org/package/show/graphics/autotrace?expand=0&rev=23
2025-06-02 00:12:36 +00:00
12 changed files with 146 additions and 395 deletions

View File

@@ -1,59 +0,0 @@
diff -rupN autotrace-0.31.1.old/input-png.c autotrace-0.31.1/input-png.c
--- autotrace-0.31.1.old/input-png.c 2002-10-10 13:44:14.000000000 -0700
+++ autotrace-0.31.1/input-png.c 2014-08-12 13:02:26.761764663 -0700
@@ -42,17 +42,17 @@ static png_bytep * read_png(png_structp
static void handle_warning(png_structp png, const at_string message) {
LOG1("PNG warning: %s", message);
- at_exception_warning((at_exception_type *)png->error_ptr,
+ at_exception_warning((at_exception_type *)png_get_error_ptr(png),
message);
- /* at_exception_fatal((at_exception_type *)at_png->error_ptr,
+ /* at_exception_fatal((at_exception_type *)png_get_error_ptr(png),
"PNG warning"); */
}
static void handle_error(png_structp png, const at_string message) {
LOG1("PNG error: %s", message);
- at_exception_fatal((at_exception_type *)png->error_ptr,
+ at_exception_fatal((at_exception_type *)png_get_error_ptr(png),
message);
- /* at_exception_fatal((at_exception_type *)at_png->error_ptr,
+ /* at_exception_fatal((at_exception_type *)png_get_error_ptr(at_png),
"PNG error"); */
}
@@ -157,8 +157,8 @@ read_png(png_structp png_ptr, png_infop
png_set_strip_16(png_ptr);
png_set_packing(png_ptr);
- if ((png_ptr->bit_depth < 8) ||
- (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) ||
+ if ((png_get_bit_depth(png_ptr, info_ptr) < 8) ||
+ (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_PALETTE) ||
(png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)))
png_set_expand(png_ptr);
@@ -181,20 +181,10 @@ read_png(png_structp png_ptr, png_infop
PNG_BACKGROUND_GAMMA_FILE, 1, 1.0);
} else
png_set_strip_alpha(png_ptr);
+ png_set_interlace_handling(png_ptr);
png_read_update_info(png_ptr, info_ptr);
-
- info_ptr->row_pointers = (png_bytepp)png_malloc(png_ptr,
- info_ptr->height * sizeof(png_bytep));
-#ifdef PNG_FREE_ME_SUPPORTED
- info_ptr->free_me |= PNG_FREE_ROWS;
-#endif
- for (row = 0; row < (int)info_ptr->height; row++)
- info_ptr->row_pointers[row] = (png_bytep)png_malloc(png_ptr,
- png_get_rowbytes(png_ptr, info_ptr));
-
- png_read_image(png_ptr, info_ptr->row_pointers);
- info_ptr->valid |= PNG_INFO_IDAT;
+ png_read_png(png_ptr, info_ptr, PNG_TRANSFORM_IDENTITY, NULL);
png_read_end(png_ptr, info_ptr);
return png_get_rows(png_ptr, info_ptr);
}

View File

@@ -1,28 +0,0 @@
From 64c5833e55d7672d6136a3fbfeae24bd012d36a5 Mon Sep 17 00:00:00 2001
From: Matthew Pruett <matthewtpruett@yahoo.com>
Date: Sat, 6 Feb 2021 23:09:31 -0500
Subject: [PATCH] Check for overflow in row bytes
Fixes CVE-2019-19004
---
src/input-bmp.c | 7 +++++++
1 file changed, 7 insertions(+)
Index: autotrace-0.31.1/input-bmp.c
===================================================================
--- autotrace-0.31.1.orig/input-bmp.c
+++ autotrace-0.31.1/input-bmp.c
@@ -219,6 +219,13 @@ input_bmp_reader (at_string filename,
/* Windows and OS/2 declare filler so that rows are a multiple of
* word length (32 bits == 4 bytes)
*/
+
+ unsigned long overflowTest = Bitmap_Head.biWidth * Bitmap_Head.biBitCnt;
+ if (overflowTest / Bitmap_Head.biWidth != Bitmap_Head.biBitCnt) {
+ LOG("Error reading BMP file header. Width is too large\n");
+ at_exception_fatal(&exp, "Error reading BMP file header. Width is too large");
+ goto cleanup;
+ }
rowbytes= ( (Bitmap_Head.biWidth * Bitmap_Head.biBitCnt - 1) / 32) * 4 + 4;

View File

@@ -1,46 +0,0 @@
From 268aee495bf0efbd0a548c7318203123d3bfb598 Mon Sep 17 00:00:00 2001
From: Matthew Pruett <matthewtpruett@yahoo.com>
Date: Sat, 6 Feb 2021 23:25:09 -0500
Subject: [PATCH] Check for size 0 passed to malloc and calloc
Handling of size 0 is implementation-defined and may lead to vulnerabilities based on implementation (https://wiki.sei.cmu.edu/confluence/display/c/MEM04-C.+Beware+of+zero-length+allocations). This fixes CVE-2017-9182 and CVE-2017-9190.
---
src/xstd.h | 4 ++++
1 file changed, 4 insertions(+)
Index: autotrace-0.31.1/xstd.h
===================================================================
--- autotrace-0.31.1.orig/xstd.h
+++ autotrace-0.31.1/xstd.h
@@ -20,6 +20,7 @@
#define XMALLOC(new_mem, size) \
do \
{ \
+ assert(size); \
new_mem = (at_address) malloc (size); \
assert(new_mem); \
} while (0)
@@ -28,6 +29,7 @@ do \
#define XCALLOC(new_mem, size) \
do \
{ \
+ assert(size); \
new_mem = (at_address) calloc (size, 1); \
assert(new_mem); \
} while (0)
@@ -55,6 +57,7 @@ do \
#define XMALLOC(new_mem, size) \
do \
{ \
+ assert(size); \
(at_address&)(new_mem) = (at_address) malloc (size); \
assert(new_mem); \
} while (0)
@@ -63,6 +66,7 @@ do \
#define XCALLOC(new_mem, sizex) \
do \
{ \
+ assert(sizex); \
(at_address&)(new_mem) = (void *) calloc (sizex, 1); \
assert(new_mem); \
} while (0)

View File

@@ -1,37 +0,0 @@
diff --git a/input-bmp.c b/input-bmp.c
index c32ed29..222851e 100644
--- a/input-bmp.c
+++ b/input-bmp.c
@@ -345,6 +345,10 @@ ReadImage (FILE *fd,
*(temp++)= buffer[xpos * 4 + 1];
*(temp++)= buffer[xpos * 4];
}
+
+ if (ypos == 0)
+ break;
+
--ypos; /* next line */
}
}
@@ -361,6 +365,10 @@ ReadImage (FILE *fd,
*(temp++)= buffer[xpos * 3 + 1];
*(temp++)= buffer[xpos * 3];
}
+
+ if (ypos == 0)
+ break;
+
--ypos; /* next line */
}
}
@@ -378,6 +386,10 @@ ReadImage (FILE *fd,
*(temp++)= (unsigned char)(((rgb >> 5) & 0x1f) * 8);
*(temp++)= (unsigned char)(((rgb) & 0x1f) * 8);
}
+
+ if (ypos == 0)
+ break;
+
--ypos; /* next line */
}
}

View File

@@ -1,11 +0,0 @@
--- autotrace.m4
+++ autotrace.m4
@@ -4,7 +4,7 @@
dnl AM_PATH_AUTOTRACE([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
dnl Test to see if libautotrace is installed, and define AUTOTRACE_CFLAGS, LIBS
dnl
-AC_DEFUN(AM_PATH_AUTOTRACE,
+AC_DEFUN([AM_PATH_AUTOTRACE],
[dnl
dnl Get the cflags and libraries from the autotrace-config script
dnl

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e959142b7b8aec0d4c81e10c22b64394541340269bb6683a24ffb2d7c8ef2adb
size 289529

3
autotrace-0.31.10.tar.gz Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:14627f93bb02fe14eeda0163434a7cb9b1f316c0f1727f0bdf6323a831ffe80d
size 924682

View File

@@ -0,0 +1,36 @@
---
configure.ac | 6 ++++++
1 file changed, 6 insertions(+)
Index: autotrace-0.31.10/configure.ac
===================================================================
--- autotrace-0.31.10.orig/configure.ac
+++ autotrace-0.31.10/configure.ac
@@ -88,6 +88,8 @@ else
[HAVE_MAGICK=yes
HAVE_GRAPHICSMAGICK=yes
MAGICK_LIBRARY=GraphicsMagick
+ AC_SUBST([MAGICK_CFLAGS], [${GRAPHICSMAGICK_CFLAGS}])
+ AC_SUBST([MAGICK_LIBS], [${GRAPHICSMAGICK_LIBS}])
AC_DEFINE(HAVE_GRAPHICSMAGICK, 1, [GraphicsMagick library is available.])
],
AC_MSG_WARN(GraphicsMagick >= 1.3.40 is not available. Falling back to ImageMagick...)
@@ -98,6 +100,8 @@ else
PKG_CHECK_MODULES([IMAGEMAGICK7],
[ImageMagick >= 7.0.1],
[HAVE_IMAGEMAGICK7=yes
+ AC_SUBST([MAGICK_CFLAGS], [${IMAGEMAGICK7_CFLAGS}])
+ AC_SUBST([MAGICK_LIBS], [${IMAGEMAGICK7_LIBS}])
AC_DEFINE(HAVE_IMAGEMAGICK7, 1, [ImageMagick version 7 or higher is available.])
],[]
)
@@ -106,6 +110,8 @@ else
[HAVE_MAGICK=yes
HAVE_IMAGEMAGICK=yes
MAGICK_LIBRARY=ImageMagick
+ AC_SUBST([MAGICK_CFLAGS], [${IMAGEMAGICK_CFLAGS}])
+ AC_SUBST([MAGICK_LIBS], [${IMAGEMAGICK_LIBS}])
AC_DEFINE(HAVE_IMAGEMAGICK, 1, [ImageMagick library is available.])
],
AC_MSG_ERROR([Nor GraphicsMagick neither ImageMagick are available. Try recompiling with --without-magick.])

View File

@@ -0,0 +1,28 @@
From eeeb813a416ff309804f6833729fab20d036e667 Mon Sep 17 00:00:00 2001
From: Peter Lemenkov <lemenkov@gmail.com>
Date: Mon, 19 Feb 2024 19:33:04 +0100
Subject: [PATCH] [pkgconfig] Move some libraries to Libs.private
Fixes #124.
See this link for pkgconfig file syntax:
* https://people.freedesktop.org/~dbn/pkg-config-guide.html
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
---
autotrace.pc.in | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/autotrace.pc.in b/autotrace.pc.in
index 4c2e581..d718c77 100644
--- a/autotrace.pc.in
+++ b/autotrace.pc.in
@@ -7,5 +7,6 @@ Name: Autotrace
Description: a utility that converts bitmap to vector graphics
Version: @VERSION@
Requires:
-Libs: -L@libdir@ -lautotrace @LIBPNG_LIBS@ @MAGICK_LIBS@ @LIBSWF_LIBS@ @LIBPSTOEDIT_LIBS@ @GLIB2_LIBS@
+Libs.private: -L@libdir@ @LIBPNG_LIBS@ @MAGICK_LIBS@ @LIBSWF_LIBS@ @LIBPSTOEDIT_LIBS@ @GLIB2_LIBS@
+Libs: -L@libdir@ -lautotrace
Cflags: -I@includedir@ @MAGICK_CFLAGS@ @LIBPSTOEDIT_CFLAGS@ @GLIB2_CFLAGS@

View File

@@ -1,3 +1,29 @@
-------------------------------------------------------------------
Sun Jun 1 14:22:54 UTC 2025 - Atri Bhattacharya <badshah400@gmail.com>
- Update to version 0.31.10:
* ImageMagick 7 support (gh#autotrace/autotrace#105,
gh#autotrace/autotrace#106).
* HKUST CVEs addressed (gh#autotrace/autotrace#110).
- Drop upstreamed or otherwise unnecessary patches:
* autotrace-0.31.1-quotefix.diff (autotrace.m4 dropped, commit
64823fa).
* 0001-fix_input_png.patch (commit 70b315a).
* CVE-2019-19004.patch (commit 64c5833).
* CVE-2019-19005.patch (commit 268aee4).
* CVE-2022-32323.patch (comimt aaf410d).
- Add autotrace-pkgconfig-private-libs.patch: [pkgconfig] Move
some libraries to Libs.private (gh#autotrace/autotrace#124).
- Add autotrace-ac_subst-magick-vars.patch: Fix unexpanded
MAGICK_* automake variables in pkgconfig file
(gh#autotrace/autotrace#160).
- Drop additional pstoedit.m4 file source as not needed any more.
- Use full URL for Source0.
- Split off separate lang package.
- Run tests as part of %check section; add BuildRequires: procps
for pkill command used in some tests.
- Specfile cleanups.
-------------------------------------------------------------------
Tue Feb 20 10:45:30 UTC 2024 - Dominique Leuenberger <dimstar@opensuse.org>

View File

@@ -1,7 +1,7 @@
#
# spec file for package autotrace
#
# Copyright (c) 2022 SUSE LLC
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -16,32 +16,31 @@
#
%define so_ver 3
%define sh_lib lib%{name}%{so_ver}
Name: autotrace
BuildRequires: gcc-c++
BuildRequires: libtool
BuildRequires: pstoedit-devel
Version: 0.31.10
Release: 0
Summary: Program for Converting Bitmaps to Vector Graphics
License: GPL-2.0-or-later AND LGPL-2.1-or-later
Group: Productivity/Graphics/Convertors
URL: https://github.com/autotrace/autotrace
Source: %{url}/archive/refs/tags/%{version}.tar.gz#/%{name}-%{version}.tar.gz
# PATCH-FIX-UPSTREAM autotrace-pkgconfig-private-libs.patch gh#autotrace/autotrace#124 badshah400@gmail.com -- [pkgconfig] Move some libraries to Libs.private
Patch0: https://github.com/autotrace/autotrace/commit/eeeb813a416ff309804f6833729fab20d036e667.patch#/autotrace-pkgconfig-private-libs.patch
# PATCH-FIX-UPSTREAM autotrace-ac_subst-magick-vars.patch gh#autotrace/autotrace#160 badshah400@gmail.com -- Fix unexpanded MAGICK_* variables in pkgconfig file
Patch1: autotrace-ac_subst-magick-vars.patch
BuildRequires: gcc-c++
BuildRequires: intltool
BuildRequires: libtool
BuildRequires: pkgconfig
# Tests need pkill
BuildRequires: procps
BuildRequires: pkgconfig(ImageMagick)
BuildRequires: pkgconfig(glib-2.0)
BuildRequires: pkgconfig(gmodule-2.0)
BuildRequires: pkgconfig(gobject-2.0)
BuildRequires: pkgconfig(pstoedit)
Provides: bitmap_tracing
Version: 0.31.1
Release: 0
Source: %{name}-%{version}.tar.bz2
Source1: pstoedit.m4
Patch0: %{name}-%{version}-quotefix.diff
# PATCH-FIX-OPENSUSE 0001-fix_input_png.patch sfalken@opensuse.org -- fixes build failure against libpng15
Patch1: 0001-fix_input_png.patch
# PATCH-FIX-SECURITY CVE-2019-19004.patch bsc1182158 CVE-2019-19004 -- biWidth*biBitCnt integer overflow fix
Patch2: CVE-2019-19004.patch
# PATCH-FIX-SECURITY CVE-2019-19005.patch bsc1182159 CVE-2019-19005 CVE-2017-9182, CVE-2017-9190 -- bitmap double free fix
Patch3: CVE-2019-19005.patch
# PATCH-FIX-SECURITY CVE-2022-32323.patch bsc1201529 -- Heap overflow
Patch4: CVE-2022-32323.patch
URL: http://autotrace.sourceforge.net/
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: ImageMagick-devel
# FIXME: Broken with the latest pstoedit. See Fedora patches for partial fix.
#BuildConflicts: pstoedit-devel
%description
AutoTrace is a program for converting bitmaps to vector graphics. The
@@ -51,11 +50,11 @@ it is already better. Originally created as a plug-in for the GIMP,
AutoTrace is now a stand-alone program and can be compiled on any UNIX
platform using GCC.
%package -n libautotrace3
%package -n %{sh_lib}
Summary: Library for converting bitmaps to vector graphics
Group: System/Libraries
%description -n libautotrace3
%description -n %{sh_lib}
AutoTrace is a program for converting bitmaps to vector graphics. The
aim of the AutoTrace project is the development of a freely-available
application similar to CorelTrace or Adobe Streamline. In some aspects,
@@ -64,10 +63,15 @@ AutoTrace is now a stand-alone program and can be compiled on any UNIX
platform using GCC.
%package devel
Summary: Library for converting bitmaps to vector graphics
Group: Development/Libraries/C and C++
Requires: libautotrace3 = %{version}
Requires: %{sh_lib} = %{version}
Requires: pkgconfig
Requires: pkgconfig(ImageMagick)
Requires: pkgconfig(glib-2.0)
Requires: pkgconfig(gmodule-2.0)
Requires: pkgconfig(gobject-2.0)
Requires: pkgconfig(pstoedit)
%description devel
AutoTrace is a program for converting bitmaps to vector graphics. The
@@ -77,47 +81,45 @@ it is already better. Originally created as a plug-in for the GIMP,
AutoTrace is now a stand-alone program and can be compiled on any UNIX
platform using GCC.
%lang_package
%prep
%setup -q
%patch -P 0
%patch -P 1 -p1
%patch -P 2 -p1
%patch -P 3 -p1
%patch -P 4 -p1
%autosetup -p1
%build
export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing -fno-tree-sra"
cat %{SOURCE1} >>acinclude.m4
autoreconf -f -i
%configure\
--disable-static
%{__make} %{?jobs:-j%jobs}
./autogen.sh
%configure \
--enable-magick-readers \
--disable-static \
%{nil}
%make_build
%install
%make_install
%{__rm} -f %{buildroot}%{_libdir}/*.la
find %{buildroot} -type f -name "*.la" -delete -print
%find_lang %{name} %{?no_lang_C}
%post -n libautotrace3 -p /sbin/ldconfig
%check
%make_build check
%postun -n libautotrace3 -p /sbin/ldconfig
%ldconfig_scriptlets -n %{sh_lib}
%files
%defattr(-, root, root)
%doc AUTHORS COPYING FAQ NEWS README README.MING THANKS TODO
%license COPYING
%doc AUTHORS FAQ NEWS README.md THANKS TODO
%{_bindir}/autotrace
%{_mandir}/man1/autotrace.1*
%{_mandir}/man1/autotrace.1%{?ext_man}
%files -n libautotrace3
%defattr(-, root, root)
%doc COPYING.LIB
%files -n %{sh_lib}
%license COPYING.LIB
%{_libdir}/*.so.*
%files devel
%defattr(-, root, root)
%{_bindir}/*-config
%{_datadir}/aclocal/*.m4
%license COPYING.LIB COPYING
%{_includedir}/autotrace
%{_libdir}/*.so
%{_libdir}/pkgconfig/*.pc
%files lang -f %{name}.lang
%changelog

View File

@@ -1,160 +0,0 @@
# a macro to get the libs/cflags for libpstoedit
# Copyed from gdk-pixbuf.m4
dnl AM_PATH_PSTOEDIT([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
dnl Test to see if libpstoedit is installed, and define PSTOEDIT_CFLAGS, LIBS
dnl
AC_DEFUN(AM_PATH_PSTOEDIT,
[dnl
dnl Get the cflags and libraries from the pstoedit-config script
dnl
AC_ARG_WITH(pstoedit-prefix,[ --with-pstoedit-prefix=PFX Prefix where Pstoedit is installed (optional)],
pstoedit_prefix="$withval", pstoedit_prefix="")
AC_ARG_WITH(pstoedit-exec-prefix,[ --with-pstoedit-exec-prefix=PFX Exec prefix where Pstoedit is installed (optional)],
pstoedit_exec_prefix="$withval", pstoedit_exec_prefix="")
AC_ARG_ENABLE(pstoedittest, [ --disable-pstoedittest Do not try to compile and run a test Pstoedit program],
, enable_pstoedittest=yes)
if test x$pstoedit_exec_prefix != x ; then
pstoedit_args="$pstoedit_args --exec_prefix=$pstoedit_exec_prefix"
if test x${PSTOEDIT_CONFIG+set} != xset ; then
PSTOEDIT_CONFIG=$pstoedit_exec_prefix/bin/pstoedit-config
fi
fi
if test x$pstoedit_prefix != x ; then
pstoedit_args="$pstoedit_args --prefix=$pstoedit_prefix"
if test x${PSTOEDIT_CONFIG+set} != xset ; then
PSTOEDIT_CONFIG=$pstoedit_prefix/bin/pstoedit-config
fi
fi
AC_PATH_PROG(PSTOEDIT_CONFIG, pstoedit-config, no)
min_pstoedit_version=ifelse([$1], ,3.32.0,$1)
AC_MSG_CHECKING(for PSTOEDIT - version >= $min_pstoedit_version)
no_pstoedit=""
if test "$PSTOEDIT_CONFIG" = "no" ; then
no_pstoedit=yes
else
PSTOEDIT_CFLAGS=`$PSTOEDIT_CONFIG $pstoedit_args --cflags`
PSTOEDIT_LIBS=`$PSTOEDIT_CONFIG $pstoedit_args --libs`
pstoedit_major_version=`$PSTOEDIT_CONFIG $pstoedit_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
pstoedit_minor_version=`$PSTOEDIT_CONFIG $pstoedit_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
pstoedit_micro_version=`$PSTOEDIT_CONFIG $pstoedit_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
if test "x$enable_pstoedittest" = "xyes" ; then
ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $PSTOEDIT_CFLAGS"
LIBS="$PSTOEDIT_LIBS $LIBS"
dnl
dnl Now check if the installed PSTOEDIT is sufficiently new. (Also sanity
dnl checks the results of pstoedit-config to some extent
dnl
rm -f conf.pstoedittest
AC_TRY_RUN([
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pstoedit/pstoedit.h>
char*
my_strdup (char *str)
{
char *new_str;
if (str)
{
new_str = malloc ((strlen (str) + 1) * sizeof(char));
strcpy (new_str, str);
}
else
new_str = NULL;
return new_str;
}
int main ()
{
int major, minor, micro;
char *tmp_version;
system ("touch conf.pstoedittest");
/* HP/UX 9 (%@#!) writes to sscanf strings */
tmp_version = my_strdup("$min_pstoedit_version");
if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
printf("%s, bad version string\n", "$min_pstoedit_version");
exit(1);
}
if (($pstoedit_major_version > major) ||
(($pstoedit_major_version == major) && ($pstoedit_minor_version > minor)) ||
(($pstoedit_major_version == major) && ($pstoedit_minor_version == minor) && ($pstoedit_micro_version >= micro)))
{
return 0;
}
else
{
printf("\n*** 'pstoedit-config --version' returned %d.%d.%d, but the minimum version\n", $pstoedit_major_version, $pstoedit_minor_version, $pstoedit_micro_version);
printf("*** of PSTOEDIT required is %d.%d.%d. If pstoedit-config is correct, then it is\n", major, minor, micro);
printf("*** best to upgrade to the required version.\n");
printf("*** If pstoedit-config was wrong, set the environment variable PSTOEDIT_CONFIG\n");
printf("*** to point to the correct copy of pstoedit-config, and remove the file\n");
printf("*** config.cache before re-running configure\n");
return 1;
}
}
],, no_pstoedit=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi
fi
if test "x$no_pstoedit" = x ; then
AC_MSG_RESULT(yes)
ifelse([$2], , :, [$2])
else
AC_MSG_RESULT(no)
if test "$PSTOEDIT_CONFIG" = "no" ; then
echo "*** The pstoedit-config script installed by PSTOEDIT could not be found"
echo "*** If PSTOEDIT was installed in PREFIX, make sure PREFIX/bin is in"
echo "*** your path, or set the PSTOEDIT_CONFIG environment variable to the"
echo "*** full path to pstoedit-config."
else
if test -f conf.pstoedittest ; then
:
else
echo "*** Could not run PSTOEDIT test program, checking why..."
CFLAGS="$CFLAGS $PSTOEDIT_CFLAGS"
LIBS="$LIBS $PSTOEDIT_LIBS"
AC_TRY_LINK([
#include <stdio.h>
#include <pstoedit/pstoedit.h>
], [ return 0; ],
[ echo "*** The test program compiled, but did not run. This usually means"
echo "*** that the run-time linker is not finding PSTOEDIT or finding the wrong"
echo "*** version of PSTOEDIT. If it is not finding PSTOEDIT, you'll need to set your"
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
echo "*** to the installed location Also, make sure you have run ldconfig if that"
echo "*** is required on your system"
echo "***"
echo "*** If you have an old version installed, it is best to remove it, although"
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
[ echo "*** The test program failed to compile or link. See the file config.log for the"
echo "*** exact error that occured. This usually means PSTOEDIT was incorrectly installed"
echo "*** or that you have moved PSTOEDIT since it was installed. In the latter case, you"
echo "*** may want to edit the pstoedit-config script: $PSTOEDIT_CONFIG" ])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi
fi
PSTOEDIT_CFLAGS=""
PSTOEDIT_LIBS=""
ifelse([$3], , :, [$3])
fi
AC_SUBST(PSTOEDIT_CFLAGS)
AC_SUBST(PSTOEDIT_LIBS)
rm -f conf.pstoedittest
])