Commit 12400475283f5081ea55f52a764e43f14032f6ba

Authored by Jay Berkenbilt
1 parent f2ef1612

Try to use pkg-config to find external dependencies (fixes #324)

ChangeLog
1 2019-06-22 Jay Berkenbilt <ejb@ql.org> 1 2019-06-22 Jay Berkenbilt <ejb@ql.org>
2 2
  3 + * If pkg-config is available, use it to local libjpeg and zlib. If
  4 + not, fall back to old behavior. Fixes #324.
  5 +
3 * The "make install" target explicitly sets a mode rather than 6 * The "make install" target explicitly sets a mode rather than
4 relying the user's umask. Fixes #326. 7 relying the user's umask. Fixes #326.
5 8
README-maintainer
@@ -121,6 +121,7 @@ RELEASE PREPARATION @@ -121,6 +121,7 @@ RELEASE PREPARATION
121 ``` 121 ```
122 cp /usr/share/automake-1.11/install-sh . 122 cp /usr/share/automake-1.11/install-sh .
123 cp /usr/share/automake-1.11/mkinstalldirs . 123 cp /usr/share/automake-1.11/mkinstalldirs .
  124 + cp /usr/share/aclocal/pkg.m4 m4
124 ``` 125 ```
125 126
126 The entire contents of the `m4` directory came from `libtool.m4`. If 127 The entire contents of the `m4` directory came from `libtool.m4`. If
aclocal.m4
@@ -18,3 +18,4 @@ m4_include([m4/ltoptions.m4]) @@ -18,3 +18,4 @@ m4_include([m4/ltoptions.m4])
18 m4_include([m4/ltsugar.m4]) 18 m4_include([m4/ltsugar.m4])
19 m4_include([m4/ltversion.m4]) 19 m4_include([m4/ltversion.m4])
20 m4_include([m4/lt~obsolete.m4]) 20 m4_include([m4/lt~obsolete.m4])
  21 +m4_include([m4/pkg.m4])
autofiles.sums
1 -5b50c329677bcc8c1d5a8b3654b79ccca8bbe80a452cc4bb14938370f316327a configure.ac 1 +2784dbb5657cdd1ce359729771d8ad768becc3751dfac2b13b3eb11d146684a7 configure.ac
  2 +9c264dc3fac489fd0178d3fa9fd29d5b0ccd37d561e926ef449fa01d99abded7 aclocal.m4
  3 +79ee40c3867f4162a847c005a73a5e388e3882f71dd185d39d9ddf0312133086 libqpdf/qpdf/qpdf-config.h.in
2 35bc5c645dc42d47f2daeea06f8f3e767c8a1aee6a35eb2b4854fd2ce66c3413 m4/ax_random_device.m4 4 35bc5c645dc42d47f2daeea06f8f3e767c8a1aee6a35eb2b4854fd2ce66c3413 m4/ax_random_device.m4
3 37f8897d5f68d7d484e5457832a8f190ddb7507fa2a467cb7ee2be40a4364643 m4/libtool.m4 5 37f8897d5f68d7d484e5457832a8f190ddb7507fa2a467cb7ee2be40a4364643 m4/libtool.m4
4 e77ebba8361b36f14b4d0927173a034b98c5d05049697a9ded84d85eb99a7990 m4/ltoptions.m4 6 e77ebba8361b36f14b4d0927173a034b98c5d05049697a9ded84d85eb99a7990 m4/ltoptions.m4
5 5a6735cda60e0ba0d1b706c0ef648f5d096298da46daefd9cdecdb6a0f4584d3 m4/ltsugar.m4 7 5a6735cda60e0ba0d1b706c0ef648f5d096298da46daefd9cdecdb6a0f4584d3 m4/ltsugar.m4
6 a27b754709de61575197bf5a980696c98ae49da3f92f0de8ee7f42dd543b7465 m4/ltversion.m4 8 a27b754709de61575197bf5a980696c98ae49da3f92f0de8ee7f42dd543b7465 m4/ltversion.m4
7 26fa3285c35dd6ab00ed1e466ba92a17e4655e01897731ec18a587a4cf5e4f8d m4/lt~obsolete.m4 9 26fa3285c35dd6ab00ed1e466ba92a17e4655e01897731ec18a587a4cf5e4f8d m4/lt~obsolete.m4
  10 +9fab676fae13feb97d5183a8ed86ae9398c76d21927c28bc59460d230f3e0884 m4/pkg.m4
autogen.sh
@@ -3,4 +3,4 @@ set -e @@ -3,4 +3,4 @@ set -e
3 aclocal -I m4 3 aclocal -I m4
4 autoheader 4 autoheader
5 autoconf 5 autoconf
6 -sha256sum configure.ac m4/* >| autofiles.sums 6 +sha256sum configure.ac aclocal.m4 libqpdf/qpdf/qpdf-config.h.in m4/* >| autofiles.sums
configure
@@ -650,6 +650,13 @@ HAVE_LD_VERSION_SCRIPT @@ -650,6 +650,13 @@ HAVE_LD_VERSION_SCRIPT
650 QPDF_LARGE_FILE_TEST_PATH 650 QPDF_LARGE_FILE_TEST_PATH
651 WINDOWS_WMAIN_LINK 651 WINDOWS_WMAIN_LINK
652 WINDOWS_WMAIN_COMPILE 652 WINDOWS_WMAIN_COMPILE
  653 +pc_libjpeg_LIBS
  654 +pc_libjpeg_CFLAGS
  655 +pc_zlib_LIBS
  656 +pc_zlib_CFLAGS
  657 +PKG_CONFIG_LIBDIR
  658 +PKG_CONFIG_PATH
  659 +PKG_CONFIG
653 WINDOWS_WORDSIZE 660 WINDOWS_WORDSIZE
654 IS_32BIT 661 IS_32BIT
655 RANDOM_DEVICE 662 RANDOM_DEVICE
@@ -791,7 +798,14 @@ CXXFLAGS @@ -791,7 +798,14 @@ CXXFLAGS
791 CCC 798 CCC
792 CPP 799 CPP
793 LT_SYS_LIBRARY_PATH 800 LT_SYS_LIBRARY_PATH
794 -CXXCPP' 801 +CXXCPP
  802 +PKG_CONFIG
  803 +PKG_CONFIG_PATH
  804 +PKG_CONFIG_LIBDIR
  805 +pc_zlib_CFLAGS
  806 +pc_zlib_LIBS
  807 +pc_libjpeg_CFLAGS
  808 +pc_libjpeg_LIBS'
795 809
796 810
797 # Initialize some variables set by options. 811 # Initialize some variables set by options.
@@ -1494,6 +1508,19 @@ Some influential environment variables: @@ -1494,6 +1508,19 @@ Some influential environment variables:
1494 LT_SYS_LIBRARY_PATH 1508 LT_SYS_LIBRARY_PATH
1495 User-defined run-time library search path. 1509 User-defined run-time library search path.
1496 CXXCPP C++ preprocessor 1510 CXXCPP C++ preprocessor
  1511 + PKG_CONFIG path to pkg-config utility
  1512 + PKG_CONFIG_PATH
  1513 + directories to add to pkg-config's search path
  1514 + PKG_CONFIG_LIBDIR
  1515 + path overriding pkg-config's built-in search path
  1516 + pc_zlib_CFLAGS
  1517 + C compiler flags for pc_zlib, overriding pkg-config
  1518 + pc_zlib_LIBS
  1519 + linker flags for pc_zlib, overriding pkg-config
  1520 + pc_libjpeg_CFLAGS
  1521 + C compiler flags for pc_libjpeg, overriding pkg-config
  1522 + pc_libjpeg_LIBS
  1523 + linker flags for pc_libjpeg, overriding pkg-config
1497 1524
1498 Use these variables to override the choices made by `configure' or to help 1525 Use these variables to override the choices made by `configure' or to help
1499 it to find libraries and programs with nonstandard names/locations. 1526 it to find libraries and programs with nonstandard names/locations.
@@ -16118,8 +16145,279 @@ fi @@ -16118,8 +16145,279 @@ fi
16118 16145
16119 16146
16120 16147
  16148 +
  16149 +
  16150 +
  16151 +
  16152 +
  16153 +
  16154 +
  16155 +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
  16156 + if test -n "$ac_tool_prefix"; then
  16157 + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
  16158 +set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
  16159 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
  16160 +$as_echo_n "checking for $ac_word... " >&6; }
  16161 +if ${ac_cv_path_PKG_CONFIG+:} false; then :
  16162 + $as_echo_n "(cached) " >&6
  16163 +else
  16164 + case $PKG_CONFIG in
  16165 + [\\/]* | ?:[\\/]*)
  16166 + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
  16167 + ;;
  16168 + *)
  16169 + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  16170 +for as_dir in $PATH
  16171 +do
  16172 + IFS=$as_save_IFS
  16173 + test -z "$as_dir" && as_dir=.
  16174 + for ac_exec_ext in '' $ac_executable_extensions; do
  16175 + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
  16176 + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
  16177 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
  16178 + break 2
  16179 + fi
  16180 +done
  16181 + done
  16182 +IFS=$as_save_IFS
  16183 +
  16184 + ;;
  16185 +esac
  16186 +fi
  16187 +PKG_CONFIG=$ac_cv_path_PKG_CONFIG
  16188 +if test -n "$PKG_CONFIG"; then
  16189 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
  16190 +$as_echo "$PKG_CONFIG" >&6; }
  16191 +else
  16192 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
  16193 +$as_echo "no" >&6; }
  16194 +fi
  16195 +
  16196 +
  16197 +fi
  16198 +if test -z "$ac_cv_path_PKG_CONFIG"; then
  16199 + ac_pt_PKG_CONFIG=$PKG_CONFIG
  16200 + # Extract the first word of "pkg-config", so it can be a program name with args.
  16201 +set dummy pkg-config; ac_word=$2
  16202 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
  16203 +$as_echo_n "checking for $ac_word... " >&6; }
  16204 +if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then :
  16205 + $as_echo_n "(cached) " >&6
  16206 +else
  16207 + case $ac_pt_PKG_CONFIG in
  16208 + [\\/]* | ?:[\\/]*)
  16209 + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
  16210 + ;;
  16211 + *)
  16212 + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  16213 +for as_dir in $PATH
  16214 +do
  16215 + IFS=$as_save_IFS
  16216 + test -z "$as_dir" && as_dir=.
  16217 + for ac_exec_ext in '' $ac_executable_extensions; do
  16218 + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
  16219 + ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
  16220 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
  16221 + break 2
  16222 + fi
  16223 +done
  16224 + done
  16225 +IFS=$as_save_IFS
  16226 +
  16227 + ;;
  16228 +esac
  16229 +fi
  16230 +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
  16231 +if test -n "$ac_pt_PKG_CONFIG"; then
  16232 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5
  16233 +$as_echo "$ac_pt_PKG_CONFIG" >&6; }
  16234 +else
  16235 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
  16236 +$as_echo "no" >&6; }
  16237 +fi
  16238 +
  16239 + if test "x$ac_pt_PKG_CONFIG" = x; then
  16240 + PKG_CONFIG=""
  16241 + else
  16242 + case $cross_compiling:$ac_tool_warned in
  16243 +yes:)
  16244 +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
  16245 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
  16246 +ac_tool_warned=yes ;;
  16247 +esac
  16248 + PKG_CONFIG=$ac_pt_PKG_CONFIG
  16249 + fi
  16250 +else
  16251 + PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
  16252 +fi
  16253 +
  16254 +fi
  16255 +if test -n "$PKG_CONFIG"; then
  16256 + _pkg_min_version=0.9.0
  16257 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5
  16258 +$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; }
  16259 + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
  16260 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
  16261 +$as_echo "yes" >&6; }
  16262 + else
  16263 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
  16264 +$as_echo "no" >&6; }
  16265 + PKG_CONFIG=""
  16266 + fi
  16267 +fi
16121 if test "$BUILD_INTERNAL_LIBS" = "0"; then 16268 if test "$BUILD_INTERNAL_LIBS" = "0"; then
16122 - ac_fn_c_check_header_mongrel "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default" 16269 + if test "$PKG_CONFIG" != ""; then
  16270 +
  16271 +pkg_failed=no
  16272 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pc_zlib" >&5
  16273 +$as_echo_n "checking for pc_zlib... " >&6; }
  16274 +
  16275 +if test -n "$pc_zlib_CFLAGS"; then
  16276 + pkg_cv_pc_zlib_CFLAGS="$pc_zlib_CFLAGS"
  16277 + elif test -n "$PKG_CONFIG"; then
  16278 + if test -n "$PKG_CONFIG" && \
  16279 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"zlib\""; } >&5
  16280 + ($PKG_CONFIG --exists --print-errors "zlib") 2>&5
  16281 + ac_status=$?
  16282 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
  16283 + test $ac_status = 0; }; then
  16284 + pkg_cv_pc_zlib_CFLAGS=`$PKG_CONFIG --cflags "zlib" 2>/dev/null`
  16285 + test "x$?" != "x0" && pkg_failed=yes
  16286 +else
  16287 + pkg_failed=yes
  16288 +fi
  16289 + else
  16290 + pkg_failed=untried
  16291 +fi
  16292 +if test -n "$pc_zlib_LIBS"; then
  16293 + pkg_cv_pc_zlib_LIBS="$pc_zlib_LIBS"
  16294 + elif test -n "$PKG_CONFIG"; then
  16295 + if test -n "$PKG_CONFIG" && \
  16296 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"zlib\""; } >&5
  16297 + ($PKG_CONFIG --exists --print-errors "zlib") 2>&5
  16298 + ac_status=$?
  16299 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
  16300 + test $ac_status = 0; }; then
  16301 + pkg_cv_pc_zlib_LIBS=`$PKG_CONFIG --libs "zlib" 2>/dev/null`
  16302 + test "x$?" != "x0" && pkg_failed=yes
  16303 +else
  16304 + pkg_failed=yes
  16305 +fi
  16306 + else
  16307 + pkg_failed=untried
  16308 +fi
  16309 +
  16310 +
  16311 +
  16312 +if test $pkg_failed = yes; then
  16313 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
  16314 +$as_echo "no" >&6; }
  16315 +
  16316 +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
  16317 + _pkg_short_errors_supported=yes
  16318 +else
  16319 + _pkg_short_errors_supported=no
  16320 +fi
  16321 + if test $_pkg_short_errors_supported = yes; then
  16322 + pc_zlib_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "zlib" 2>&1`
  16323 + else
  16324 + pc_zlib_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "zlib" 2>&1`
  16325 + fi
  16326 + # Put the nasty error message in config.log where it belongs
  16327 + echo "$pc_zlib_PKG_ERRORS" >&5
  16328 +
  16329 + :
  16330 +elif test $pkg_failed = untried; then
  16331 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
  16332 +$as_echo "no" >&6; }
  16333 + :
  16334 +else
  16335 + pc_zlib_CFLAGS=$pkg_cv_pc_zlib_CFLAGS
  16336 + pc_zlib_LIBS=$pkg_cv_pc_zlib_LIBS
  16337 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
  16338 +$as_echo "yes" >&6; }
  16339 + CFLAGS="$CFLAGS $pc_zlib_CFLAGS"
  16340 + CXXFLAGS="$CXXFLAGS $pc_zlib_CXXFLAGS"
  16341 + LIBS="$LIBS $pc_zlib_LIBS"
  16342 +
  16343 +fi
  16344 +
  16345 +pkg_failed=no
  16346 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pc_libjpeg" >&5
  16347 +$as_echo_n "checking for pc_libjpeg... " >&6; }
  16348 +
  16349 +if test -n "$pc_libjpeg_CFLAGS"; then
  16350 + pkg_cv_pc_libjpeg_CFLAGS="$pc_libjpeg_CFLAGS"
  16351 + elif test -n "$PKG_CONFIG"; then
  16352 + if test -n "$PKG_CONFIG" && \
  16353 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libjpeg\""; } >&5
  16354 + ($PKG_CONFIG --exists --print-errors "libjpeg") 2>&5
  16355 + ac_status=$?
  16356 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
  16357 + test $ac_status = 0; }; then
  16358 + pkg_cv_pc_libjpeg_CFLAGS=`$PKG_CONFIG --cflags "libjpeg" 2>/dev/null`
  16359 + test "x$?" != "x0" && pkg_failed=yes
  16360 +else
  16361 + pkg_failed=yes
  16362 +fi
  16363 + else
  16364 + pkg_failed=untried
  16365 +fi
  16366 +if test -n "$pc_libjpeg_LIBS"; then
  16367 + pkg_cv_pc_libjpeg_LIBS="$pc_libjpeg_LIBS"
  16368 + elif test -n "$PKG_CONFIG"; then
  16369 + if test -n "$PKG_CONFIG" && \
  16370 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libjpeg\""; } >&5
  16371 + ($PKG_CONFIG --exists --print-errors "libjpeg") 2>&5
  16372 + ac_status=$?
  16373 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
  16374 + test $ac_status = 0; }; then
  16375 + pkg_cv_pc_libjpeg_LIBS=`$PKG_CONFIG --libs "libjpeg" 2>/dev/null`
  16376 + test "x$?" != "x0" && pkg_failed=yes
  16377 +else
  16378 + pkg_failed=yes
  16379 +fi
  16380 + else
  16381 + pkg_failed=untried
  16382 +fi
  16383 +
  16384 +
  16385 +
  16386 +if test $pkg_failed = yes; then
  16387 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
  16388 +$as_echo "no" >&6; }
  16389 +
  16390 +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
  16391 + _pkg_short_errors_supported=yes
  16392 +else
  16393 + _pkg_short_errors_supported=no
  16394 +fi
  16395 + if test $_pkg_short_errors_supported = yes; then
  16396 + pc_libjpeg_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libjpeg" 2>&1`
  16397 + else
  16398 + pc_libjpeg_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libjpeg" 2>&1`
  16399 + fi
  16400 + # Put the nasty error message in config.log where it belongs
  16401 + echo "$pc_libjpeg_PKG_ERRORS" >&5
  16402 +
  16403 + :
  16404 +elif test $pkg_failed = untried; then
  16405 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
  16406 +$as_echo "no" >&6; }
  16407 + :
  16408 +else
  16409 + pc_libjpeg_CFLAGS=$pkg_cv_pc_libjpeg_CFLAGS
  16410 + pc_libjpeg_LIBS=$pkg_cv_pc_libjpeg_LIBS
  16411 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
  16412 +$as_echo "yes" >&6; }
  16413 + CFLAGS="$CFLAGS $pc_libjpeg_CFLAGS"
  16414 + CXXFLAGS="$CXXFLAGS $pc_libjpeg_CXXFLAGS"
  16415 + LIBS="$LIBS $pc_libjpeg_LIBS"
  16416 +
  16417 +fi
  16418 + fi
  16419 + if test "$pc_zlib_LIBS" = ""; then
  16420 + ac_fn_c_check_header_mongrel "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default"
16123 if test "x$ac_cv_header_zlib_h" = xyes; then : 16421 if test "x$ac_cv_header_zlib_h" = xyes; then :
16124 16422
16125 else 16423 else
@@ -16127,7 +16425,7 @@ else @@ -16127,7 +16425,7 @@ else
16127 fi 16425 fi
16128 16426
16129 16427
16130 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing deflate" >&5 16428 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing deflate" >&5
16131 $as_echo_n "checking for library containing deflate... " >&6; } 16429 $as_echo_n "checking for library containing deflate... " >&6; }
16132 if ${ac_cv_search_deflate+:} false; then : 16430 if ${ac_cv_search_deflate+:} false; then :
16133 $as_echo_n "(cached) " >&6 16431 $as_echo_n "(cached) " >&6
@@ -16185,7 +16483,9 @@ else @@ -16185,7 +16483,9 @@ else
16185 MISSING_ZLIB=1; MISSING_ANY=1 16483 MISSING_ZLIB=1; MISSING_ANY=1
16186 fi 16484 fi
16187 16485
16188 - ac_fn_c_check_header_mongrel "$LINENO" "jpeglib.h" "ac_cv_header_jpeglib_h" "$ac_includes_default" 16486 + fi
  16487 + if test "$pc_libjpeg_LIBS" = ""; then
  16488 + ac_fn_c_check_header_mongrel "$LINENO" "jpeglib.h" "ac_cv_header_jpeglib_h" "$ac_includes_default"
16189 if test "x$ac_cv_header_jpeglib_h" = xyes; then : 16489 if test "x$ac_cv_header_jpeglib_h" = xyes; then :
16190 16490
16191 else 16491 else
@@ -16193,7 +16493,7 @@ else @@ -16193,7 +16493,7 @@ else
16193 fi 16493 fi
16194 16494
16195 16495
16196 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing jpeg_destroy" >&5 16496 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing jpeg_destroy" >&5
16197 $as_echo_n "checking for library containing jpeg_destroy... " >&6; } 16497 $as_echo_n "checking for library containing jpeg_destroy... " >&6; }
16198 if ${ac_cv_search_jpeg_destroy+:} false; then : 16498 if ${ac_cv_search_jpeg_destroy+:} false; then :
16199 $as_echo_n "(cached) " >&6 16499 $as_echo_n "(cached) " >&6
@@ -16251,6 +16551,18 @@ else @@ -16251,6 +16551,18 @@ else
16251 MISSING_JPEG=1; MISSING_ANY=1 16551 MISSING_JPEG=1; MISSING_ANY=1
16252 fi 16552 fi
16253 16553
  16554 + fi
  16555 + if test "$LIBS" != ""; then
  16556 + nLIBS=""
  16557 + for x in $LIBS; do
  16558 + if echo $x | grep -q '^-L'; then
  16559 + LDFLAGS="$LDFLAGS $x"
  16560 + else
  16561 + nLIBS="$nLIBS $x"
  16562 + fi
  16563 + LIBS=$nLIBS
  16564 + done
  16565 + fi
16254 fi 16566 fi
16255 16567
16256 qpdf_USE_WMAIN=0 16568 qpdf_USE_WMAIN=0
configure.ac
@@ -163,11 +163,39 @@ fi @@ -163,11 +163,39 @@ fi
163 AC_SUBST(IS_32BIT) 163 AC_SUBST(IS_32BIT)
164 AC_SUBST(WINDOWS_WORDSIZE) 164 AC_SUBST(WINDOWS_WORDSIZE)
165 165
  166 +PKG_PROG_PKG_CONFIG
166 if test "$BUILD_INTERNAL_LIBS" = "0"; then 167 if test "$BUILD_INTERNAL_LIBS" = "0"; then
167 - AC_CHECK_HEADER(zlib.h,,[MISSING_ZLIB_H=1; MISSING_ANY=1])  
168 - AC_SEARCH_LIBS(deflate,z zlib,,[MISSING_ZLIB=1; MISSING_ANY=1])  
169 - AC_CHECK_HEADER(jpeglib.h,,[MISSING_JPEG_H=1; MISSING_ANY=1])  
170 - AC_SEARCH_LIBS(jpeg_destroy,jpeg,,[MISSING_JPEG=1; MISSING_ANY=1]) 168 + if test "$PKG_CONFIG" != ""; then
  169 + PKG_CHECK_MODULES([pc_zlib], [zlib],
  170 + [CFLAGS="$CFLAGS $pc_zlib_CFLAGS"
  171 + CXXFLAGS="$CXXFLAGS $pc_zlib_CXXFLAGS"
  172 + LIBS="$LIBS $pc_zlib_LIBS"
  173 + ], [:])
  174 + PKG_CHECK_MODULES([pc_libjpeg], [libjpeg],
  175 + [CFLAGS="$CFLAGS $pc_libjpeg_CFLAGS"
  176 + CXXFLAGS="$CXXFLAGS $pc_libjpeg_CXXFLAGS"
  177 + LIBS="$LIBS $pc_libjpeg_LIBS"
  178 + ],[:])
  179 + fi
  180 + if test "$pc_zlib_LIBS" = ""; then
  181 + AC_CHECK_HEADER(zlib.h,,[MISSING_ZLIB_H=1; MISSING_ANY=1])
  182 + AC_SEARCH_LIBS(deflate,z zlib,,[MISSING_ZLIB=1; MISSING_ANY=1])
  183 + fi
  184 + if test "$pc_libjpeg_LIBS" = ""; then
  185 + AC_CHECK_HEADER(jpeglib.h,,[MISSING_JPEG_H=1; MISSING_ANY=1])
  186 + AC_SEARCH_LIBS(jpeg_destroy,jpeg,,[MISSING_JPEG=1; MISSING_ANY=1])
  187 + fi
  188 + if test "$LIBS" != ""; then
  189 + nLIBS=""
  190 + for x in $LIBS; do
  191 + if echo $x | grep -q '^-L'; then
  192 + LDFLAGS="$LDFLAGS $x"
  193 + else
  194 + nLIBS="$nLIBS $x"
  195 + fi
  196 + LIBS=$nLIBS
  197 + done
  198 + fi
171 fi 199 fi
172 200
173 qpdf_USE_WMAIN=0 201 qpdf_USE_WMAIN=0
m4/pkg.m4 0 โ†’ 100644
  1 +dnl pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
  2 +dnl serial 11 (pkg-config-0.29.1)
  3 +dnl
  4 +dnl Copyright ยฉ 2004 Scott James Remnant <scott@netsplit.com>.
  5 +dnl Copyright ยฉ 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
  6 +dnl
  7 +dnl This program is free software; you can redistribute it and/or modify
  8 +dnl it under the terms of the GNU General Public License as published by
  9 +dnl the Free Software Foundation; either version 2 of the License, or
  10 +dnl (at your option) any later version.
  11 +dnl
  12 +dnl This program is distributed in the hope that it will be useful, but
  13 +dnl WITHOUT ANY WARRANTY; without even the implied warranty of
  14 +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15 +dnl General Public License for more details.
  16 +dnl
  17 +dnl You should have received a copy of the GNU General Public License
  18 +dnl along with this program; if not, write to the Free Software
  19 +dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  20 +dnl 02111-1307, USA.
  21 +dnl
  22 +dnl As a special exception to the GNU General Public License, if you
  23 +dnl distribute this file as part of a program that contains a
  24 +dnl configuration script generated by Autoconf, you may include it under
  25 +dnl the same distribution terms that you use for the rest of that
  26 +dnl program.
  27 +
  28 +dnl PKG_PREREQ(MIN-VERSION)
  29 +dnl -----------------------
  30 +dnl Since: 0.29
  31 +dnl
  32 +dnl Verify that the version of the pkg-config macros are at least
  33 +dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
  34 +dnl installed version of pkg-config, this checks the developer's version
  35 +dnl of pkg.m4 when generating configure.
  36 +dnl
  37 +dnl To ensure that this macro is defined, also add:
  38 +dnl m4_ifndef([PKG_PREREQ],
  39 +dnl [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
  40 +dnl
  41 +dnl See the "Since" comment for each macro you use to see what version
  42 +dnl of the macros you require.
  43 +m4_defun([PKG_PREREQ],
  44 +[m4_define([PKG_MACROS_VERSION], [0.29.1])
  45 +m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
  46 + [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
  47 +])dnl PKG_PREREQ
  48 +
  49 +dnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
  50 +dnl ----------------------------------
  51 +dnl Since: 0.16
  52 +dnl
  53 +dnl Search for the pkg-config tool and set the PKG_CONFIG variable to
  54 +dnl first found in the path. Checks that the version of pkg-config found
  55 +dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
  56 +dnl used since that's the first version where most current features of
  57 +dnl pkg-config existed.
  58 +AC_DEFUN([PKG_PROG_PKG_CONFIG],
  59 +[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
  60 +m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
  61 +m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
  62 +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
  63 +AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
  64 +AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
  65 +
  66 +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
  67 + AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
  68 +fi
  69 +if test -n "$PKG_CONFIG"; then
  70 + _pkg_min_version=m4_default([$1], [0.9.0])
  71 + AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
  72 + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
  73 + AC_MSG_RESULT([yes])
  74 + else
  75 + AC_MSG_RESULT([no])
  76 + PKG_CONFIG=""
  77 + fi
  78 +fi[]dnl
  79 +])dnl PKG_PROG_PKG_CONFIG
  80 +
  81 +dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
  82 +dnl -------------------------------------------------------------------
  83 +dnl Since: 0.18
  84 +dnl
  85 +dnl Check to see whether a particular set of modules exists. Similar to
  86 +dnl PKG_CHECK_MODULES(), but does not set variables or print errors.
  87 +dnl
  88 +dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
  89 +dnl only at the first occurence in configure.ac, so if the first place
  90 +dnl it's called might be skipped (such as if it is within an "if", you
  91 +dnl have to call PKG_CHECK_EXISTS manually
  92 +AC_DEFUN([PKG_CHECK_EXISTS],
  93 +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
  94 +if test -n "$PKG_CONFIG" && \
  95 + AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
  96 + m4_default([$2], [:])
  97 +m4_ifvaln([$3], [else
  98 + $3])dnl
  99 +fi])
  100 +
  101 +dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
  102 +dnl ---------------------------------------------
  103 +dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
  104 +dnl pkg_failed based on the result.
  105 +m4_define([_PKG_CONFIG],
  106 +[if test -n "$$1"; then
  107 + pkg_cv_[]$1="$$1"
  108 + elif test -n "$PKG_CONFIG"; then
  109 + PKG_CHECK_EXISTS([$3],
  110 + [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
  111 + test "x$?" != "x0" && pkg_failed=yes ],
  112 + [pkg_failed=yes])
  113 + else
  114 + pkg_failed=untried
  115 +fi[]dnl
  116 +])dnl _PKG_CONFIG
  117 +
  118 +dnl _PKG_SHORT_ERRORS_SUPPORTED
  119 +dnl ---------------------------
  120 +dnl Internal check to see if pkg-config supports short errors.
  121 +AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
  122 +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
  123 +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
  124 + _pkg_short_errors_supported=yes
  125 +else
  126 + _pkg_short_errors_supported=no
  127 +fi[]dnl
  128 +])dnl _PKG_SHORT_ERRORS_SUPPORTED
  129 +
  130 +
  131 +dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
  132 +dnl [ACTION-IF-NOT-FOUND])
  133 +dnl --------------------------------------------------------------
  134 +dnl Since: 0.4.0
  135 +dnl
  136 +dnl Note that if there is a possibility the first call to
  137 +dnl PKG_CHECK_MODULES might not happen, you should be sure to include an
  138 +dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
  139 +AC_DEFUN([PKG_CHECK_MODULES],
  140 +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
  141 +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
  142 +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
  143 +
  144 +pkg_failed=no
  145 +AC_MSG_CHECKING([for $1])
  146 +
  147 +_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
  148 +_PKG_CONFIG([$1][_LIBS], [libs], [$2])
  149 +
  150 +m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
  151 +and $1[]_LIBS to avoid the need to call pkg-config.
  152 +See the pkg-config man page for more details.])
  153 +
  154 +if test $pkg_failed = yes; then
  155 + AC_MSG_RESULT([no])
  156 + _PKG_SHORT_ERRORS_SUPPORTED
  157 + if test $_pkg_short_errors_supported = yes; then
  158 + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
  159 + else
  160 + $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
  161 + fi
  162 + # Put the nasty error message in config.log where it belongs
  163 + echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
  164 +
  165 + m4_default([$4], [AC_MSG_ERROR(
  166 +[Package requirements ($2) were not met:
  167 +
  168 +$$1_PKG_ERRORS
  169 +
  170 +Consider adjusting the PKG_CONFIG_PATH environment variable if you
  171 +installed software in a non-standard prefix.
  172 +
  173 +_PKG_TEXT])[]dnl
  174 + ])
  175 +elif test $pkg_failed = untried; then
  176 + AC_MSG_RESULT([no])
  177 + m4_default([$4], [AC_MSG_FAILURE(
  178 +[The pkg-config script could not be found or is too old. Make sure it
  179 +is in your PATH or set the PKG_CONFIG environment variable to the full
  180 +path to pkg-config.
  181 +
  182 +_PKG_TEXT
  183 +
  184 +To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
  185 + ])
  186 +else
  187 + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
  188 + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
  189 + AC_MSG_RESULT([yes])
  190 + $3
  191 +fi[]dnl
  192 +])dnl PKG_CHECK_MODULES
  193 +
  194 +
  195 +dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
  196 +dnl [ACTION-IF-NOT-FOUND])
  197 +dnl ---------------------------------------------------------------------
  198 +dnl Since: 0.29
  199 +dnl
  200 +dnl Checks for existence of MODULES and gathers its build flags with
  201 +dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
  202 +dnl and VARIABLE-PREFIX_LIBS from --libs.
  203 +dnl
  204 +dnl Note that if there is a possibility the first call to
  205 +dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
  206 +dnl include an explicit call to PKG_PROG_PKG_CONFIG in your
  207 +dnl configure.ac.
  208 +AC_DEFUN([PKG_CHECK_MODULES_STATIC],
  209 +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
  210 +_save_PKG_CONFIG=$PKG_CONFIG
  211 +PKG_CONFIG="$PKG_CONFIG --static"
  212 +PKG_CHECK_MODULES($@)
  213 +PKG_CONFIG=$_save_PKG_CONFIG[]dnl
  214 +])dnl PKG_CHECK_MODULES_STATIC
  215 +
  216 +
  217 +dnl PKG_INSTALLDIR([DIRECTORY])
  218 +dnl -------------------------
  219 +dnl Since: 0.27
  220 +dnl
  221 +dnl Substitutes the variable pkgconfigdir as the location where a module
  222 +dnl should install pkg-config .pc files. By default the directory is
  223 +dnl $libdir/pkgconfig, but the default can be changed by passing
  224 +dnl DIRECTORY. The user can override through the --with-pkgconfigdir
  225 +dnl parameter.
  226 +AC_DEFUN([PKG_INSTALLDIR],
  227 +[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
  228 +m4_pushdef([pkg_description],
  229 + [pkg-config installation directory @<:@]pkg_default[@:>@])
  230 +AC_ARG_WITH([pkgconfigdir],
  231 + [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
  232 + [with_pkgconfigdir=]pkg_default)
  233 +AC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
  234 +m4_popdef([pkg_default])
  235 +m4_popdef([pkg_description])
  236 +])dnl PKG_INSTALLDIR
  237 +
  238 +
  239 +dnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
  240 +dnl --------------------------------
  241 +dnl Since: 0.27
  242 +dnl
  243 +dnl Substitutes the variable noarch_pkgconfigdir as the location where a
  244 +dnl module should install arch-independent pkg-config .pc files. By
  245 +dnl default the directory is $datadir/pkgconfig, but the default can be
  246 +dnl changed by passing DIRECTORY. The user can override through the
  247 +dnl --with-noarch-pkgconfigdir parameter.
  248 +AC_DEFUN([PKG_NOARCH_INSTALLDIR],
  249 +[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
  250 +m4_pushdef([pkg_description],
  251 + [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
  252 +AC_ARG_WITH([noarch-pkgconfigdir],
  253 + [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
  254 + [with_noarch_pkgconfigdir=]pkg_default)
  255 +AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
  256 +m4_popdef([pkg_default])
  257 +m4_popdef([pkg_description])
  258 +])dnl PKG_NOARCH_INSTALLDIR
  259 +
  260 +
  261 +dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
  262 +dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
  263 +dnl -------------------------------------------
  264 +dnl Since: 0.28
  265 +dnl
  266 +dnl Retrieves the value of the pkg-config variable for the given module.
  267 +AC_DEFUN([PKG_CHECK_VAR],
  268 +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
  269 +AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
  270 +
  271 +_PKG_CONFIG([$1], [variable="][$3]["], [$2])
  272 +AS_VAR_COPY([$1], [pkg_cv_][$1])
  273 +
  274 +AS_VAR_IF([$1], [""], [$5], [$4])dnl
  275 +])dnl PKG_CHECK_VAR
manual/qpdf-manual.xml
@@ -4378,6 +4378,14 @@ print &quot;\n&quot;; @@ -4378,6 +4378,14 @@ print &quot;\n&quot;;
4378 some files but not others. 4378 some files but not others.
4379 </para> 4379 </para>
4380 </listitem> 4380 </listitem>
  4381 + <listitem>
  4382 + <para>
  4383 + If <command>pkg-config</command> is available, use it to
  4384 + locate <filename>libjpeg</filename> and
  4385 + <filename>zlib</filename> dependencies, falling back on old
  4386 + behavior if unsuccessful.
  4387 + </para>
  4388 + </listitem>
4381 </itemizedlist> 4389 </itemizedlist>
4382 </listitem> 4390 </listitem>
4383 <listitem> 4391 <listitem>