Skip to content

Commit e686669

Browse files
committed
Save work on libpng PNG loader (Issue #90)
1 parent 1e5cc6f commit e686669

File tree

4 files changed

+290
-20
lines changed

4 files changed

+290
-20
lines changed

CHANGES.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
Changes in PDFio
22
================
33

4-
v1.?.? - YYYY-MM-DD
4+
v1.5.0 - YYYY-MM-DD
55
-------------------
66

7+
- Added support for using libpng to embed PNG images in PDF output (Issue #90)
78
- Updated the pdf2txt example to support font encodings.
89

910

configure

Lines changed: 65 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#! /bin/sh
22
# Guess values for system-dependent variables and create Makefiles.
3-
# Generated by GNU Autoconf 2.71 for pdfio 1.4.1.
3+
# Generated by GNU Autoconf 2.71 for pdfio 1.5.0.
44
#
55
# Report bugs to <https://github.com/michaelrsweet/pdfio/issues>.
66
#
@@ -610,8 +610,8 @@ MAKEFLAGS=
610610
# Identity of this package.
611611
PACKAGE_NAME='pdfio'
612612
PACKAGE_TARNAME='pdfio'
613-
PACKAGE_VERSION='1.4.1'
614-
PACKAGE_STRING='pdfio 1.4.1'
613+
PACKAGE_VERSION='1.5.0'
614+
PACKAGE_STRING='pdfio 1.5.0'
615615
PACKAGE_BUGREPORT='https://github.com/michaelrsweet/pdfio/issues'
616616
PACKAGE_URL='https://www.msweet.org/pdfio'
617617

@@ -653,6 +653,7 @@ WARNINGS
653653
CSFLAGS
654654
LIBPDFIO_STATIC
655655
LIBPDFIO
656+
PKGCONFIG_LIBPNG
656657
PKGCONFIG_REQUIRES
657658
PKGCONFIG_LIBS_PRIVATE
658659
PKGCONFIG_LIBS
@@ -729,6 +730,7 @@ SHELL'
729730
ac_subst_files=''
730731
ac_user_opts='
731732
enable_option_checking
733+
enable_libpng
732734
enable_static
733735
enable_shared
734736
enable_debug
@@ -1293,7 +1295,7 @@ if test "$ac_init_help" = "long"; then
12931295
# Omit some internal or obsolete options to make the list less imposing.
12941296
# This message is too long to be a string in the A/UX 3.1 sh.
12951297
cat <<_ACEOF
1296-
\`configure' configures pdfio 1.4.1 to adapt to many kinds of systems.
1298+
\`configure' configures pdfio 1.5.0 to adapt to many kinds of systems.
12971299
12981300
Usage: $0 [OPTION]... [VAR=VALUE]...
12991301
@@ -1359,14 +1361,16 @@ fi
13591361

13601362
if test -n "$ac_init_help"; then
13611363
case $ac_init_help in
1362-
short | recursive ) echo "Configuration of pdfio 1.4.1:";;
1364+
short | recursive ) echo "Configuration of pdfio 1.5.0:";;
13631365
esac
13641366
cat <<\_ACEOF
13651367
13661368
Optional Features:
13671369
--disable-option-checking ignore unrecognized --enable/--with options
13681370
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
13691371
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
1372+
--enable-libpng use libpng for pdfioFileCreateImageObjFromFile,
1373+
default=auto
13701374
--disable-static do not install static library
13711375
--enable-shared install shared library
13721376
--enable-debug turn on debugging, default=no
@@ -1456,7 +1460,7 @@ fi
14561460
test -n "$ac_init_help" && exit $ac_status
14571461
if $ac_init_version; then
14581462
cat <<\_ACEOF
1459-
pdfio configure 1.4.1
1463+
pdfio configure 1.5.0
14601464
generated by GNU Autoconf 2.71
14611465
14621466
Copyright (C) 2021 Free Software Foundation, Inc.
@@ -1612,7 +1616,7 @@ cat >config.log <<_ACEOF
16121616
This file contains any messages produced by compilers while
16131617
running configure, to aid debugging if configure makes a mistake.
16141618
1615-
It was created by pdfio $as_me 1.4.1, which was
1619+
It was created by pdfio $as_me 1.5.0, which was
16161620
generated by GNU Autoconf 2.71. Invocation command line was
16171621
16181622
$ $0$ac_configure_args_raw
@@ -2368,9 +2372,9 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
23682372
23692373
23702374
2371-
PDFIO_VERSION="1.4.1"
2372-
PDFIO_VERSION_MAJOR="`echo 1.4.1 | awk -F. '{print $1}'`"
2373-
PDFIO_VERSION_MINOR="`echo 1.4.1 | awk -F. '{printf("%d\n",$2);}'`"
2375+
PDFIO_VERSION="1.5.0"
2376+
PDFIO_VERSION_MAJOR="`echo 1.5.0 | awk -F. '{print $1}'`"
2377+
PDFIO_VERSION_MINOR="`echo 1.5.0 | awk -F. '{printf("%d\n",$2);}'`"
23742378
23752379
23762380
@@ -4099,6 +4103,55 @@ fi
40994103
fi
41004104
41014105
4106+
# Check whether --enable-libpng was given.
4107+
if test ${enable_libpng+y}
4108+
then :
4109+
enableval=$enable_libpng;
4110+
fi
4111+
4112+
4113+
PKGCONFIG_LIBPNG=""
4114+
4115+
4116+
if test "x$PKGCONFIG" != x -a x$enable_libpng != xno
4117+
then :
4118+
4119+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libpng-1.6.x" >&5
4120+
printf %s "checking for libpng-1.6.x... " >&6; }
4121+
if $PKGCONFIG --exists libpng16
4122+
then :
4123+
4124+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
4125+
printf "%s\n" "yes" >&6; };
4126+
4127+
printf "%s\n" "#define HAVE_LIBPNG 1" >>confdefs.h
4128+
4129+
CPPFLAGS="$($PKGCONFIG --cflags libpng16) -DHAVE_LIBPNG=1 $CPPFLAGS"
4130+
LIBS="$($PKGCONFIG --libs libpng16) -lz $LIBS"
4131+
PKGCONFIG_LIBPNG="libpng >= 1.6,"
4132+
PKGCONFIG_LIBS_PRIVATE="$($PKGCONFIG --libs libpng16) $PKGCONFIG_LIBS_PRIVATE"
4133+
4134+
else $as_nop
4135+
4136+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
4137+
printf "%s\n" "no" >&6; };
4138+
if test x$enable_libpng = xyes
4139+
then :
4140+
4141+
as_fn_error $? "libpng-dev 1.6 or later required for --enable-libpng." "$LINENO" 5
4142+
4143+
fi
4144+
4145+
fi
4146+
4147+
elif test x$enable_libpng = xyes
4148+
then :
4149+
4150+
as_fn_error $? "libpng-dev 1.6 or later required for --enable-libpng." "$LINENO" 5
4151+
4152+
fi
4153+
4154+
41024155
# Check whether --enable-static was given.
41034156
if test ${enable_static+y}
41044157
then :
@@ -4935,7 +4988,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
49354988
# report actual input values of CONFIG_FILES etc. instead of their
49364989
# values after options handling.
49374990
ac_log="
4938-
This file was extended by pdfio $as_me 1.4.1, which was
4991+
This file was extended by pdfio $as_me 1.5.0, which was
49394992
generated by GNU Autoconf 2.71. Invocation command line was
49404993
49414994
CONFIG_FILES = $CONFIG_FILES
@@ -4991,7 +5044,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
49915044
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
49925045
ac_cs_config='$ac_cs_config_escaped'
49935046
ac_cs_version="\\
4994-
pdfio config.status 1.4.1
5047+
pdfio config.status 1.5.0
49955048
configured by $0, generated by GNU Autoconf 2.71,
49965049
with options \\"\$ac_cs_config\\"
49975050

configure.ac

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
dnl
22
dnl Configuration script for PDFio
33
dnl
4-
dnl Copyright © 2023-2024 by Michael R Sweet
4+
dnl Copyright © 2023-2025 by Michael R Sweet
55
dnl
66
dnl Licensed under Apache License v2.0. See the file "LICENSE" for more
77
dnl information.
@@ -21,7 +21,7 @@ AC_PREREQ([2.70])
2121

2222

2323
dnl Package name and version...
24-
AC_INIT([pdfio], [1.4.1], [https://github.com/michaelrsweet/pdfio/issues], [pdfio], [https://www.msweet.org/pdfio])
24+
AC_INIT([pdfio], [1.5.0], [https://github.com/michaelrsweet/pdfio/issues], [pdfio], [https://www.msweet.org/pdfio])
2525

2626
PDFIO_VERSION="AC_PACKAGE_VERSION"
2727
PDFIO_VERSION_MAJOR="`echo AC_PACKAGE_VERSION | awk -F. '{print $1}'`"
@@ -121,6 +121,32 @@ AS_IF([$PKGCONFIG --exists zlib], [
121121
])
122122

123123

124+
dnl libpng...
125+
AC_ARG_ENABLE([libpng], AS_HELP_STRING([--enable-libpng], [use libpng for pdfioFileCreateImageObjFromFile, default=auto]))
126+
127+
PKGCONFIG_LIBPNG=""
128+
AC_SUBST([PKGCONFIG_LIBPNG])
129+
130+
AS_IF([test "x$PKGCONFIG" != x -a x$enable_libpng != xno], [
131+
AC_MSG_CHECKING([for libpng-1.6.x])
132+
AS_IF([$PKGCONFIG --exists libpng16], [
133+
AC_MSG_RESULT([yes]);
134+
AC_DEFINE([HAVE_LIBPNG], 1, [Have PNG library?])
135+
CPPFLAGS="$($PKGCONFIG --cflags libpng16) -DHAVE_LIBPNG=1 $CPPFLAGS"
136+
LIBS="$($PKGCONFIG --libs libpng16) -lz $LIBS"
137+
PKGCONFIG_LIBPNG="libpng >= 1.6,"
138+
PKGCONFIG_LIBS_PRIVATE="$($PKGCONFIG --libs libpng16) $PKGCONFIG_LIBS_PRIVATE"
139+
], [
140+
AC_MSG_RESULT([no]);
141+
AS_IF([test x$enable_libpng = xyes], [
142+
AC_MSG_ERROR([libpng-dev 1.6 or later required for --enable-libpng.])
143+
])
144+
])
145+
], [test x$enable_libpng = xyes], [
146+
AC_MSG_ERROR([libpng-dev 1.6 or later required for --enable-libpng.])
147+
])
148+
149+
124150
dnl Library target...
125151
AC_ARG_ENABLE([static], AS_HELP_STRING([--disable-static], [do not install static library]))
126152
AC_ARG_ENABLE([shared], AS_HELP_STRING([--enable-shared], [install shared library]))

0 commit comments

Comments
 (0)