aboutsummaryrefslogtreecommitdiffstats
path: root/configure
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xconfigure236
-rw-r--r--configure.ac12
2 files changed, 244 insertions, 4 deletions
diff --git a/configure b/configure
index 9cc84680..efe6649b 100755
--- a/configure
+++ b/configure
@@ -607,6 +607,11 @@ libavcodec_VERSION_MINOR
libavcodec_VERSION_MAJOR
libavcodec_VERSION
lua_LIB_NAME
+libpng_VERSION_INT
+libpng_VERSION_RELEASE
+libpng_VERSION_MINOR
+libpng_VERSION_MAJOR
+libpng_VERSION
DARWIN_VERSION
MACOSX_VERSION
MACOSX_VERSION_INT
@@ -738,6 +743,7 @@ CXX
CXXFLAGS
CCC
PKG_CONFIG
+libpng_VERSION
libavcodec_VERSION
libavformat_VERSION
libavutil_VERSION
@@ -1403,6 +1409,8 @@ Some influential environment variables:
CXX C++ compiler command
CXXFLAGS C++ compiler flags
PKG_CONFIG path to pkg-config utility
+ libpng_VERSION
+ version of libpng, overriding pkg-config
libavcodec_VERSION
version of libavcodec, overriding pkg-config
libavformat_VERSION
@@ -4314,7 +4322,8 @@ fi
# check for libraries
# -----------------------------------------
-# libpng
+# find libpng
+# pkgconfig name for 1.2 is "libpng12", for 1.4 "libpng"
have_lib="no"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libpng12" >&5
@@ -4360,7 +4369,7 @@ $as_echo "yes" >&6; }
$as_echo "no" >&6; }
# check if package is required
- if test xyes = xyes -o x"$with_libpng" = xyes ; then
+ if test xno = xyes -o x"$with_libpng" = xyes ; then
# print error message and quit
err_msg=`$PKG_CONFIG --errors-to-stdout --print-errors "libpng12"`
as_fn_error "
@@ -4376,6 +4385,229 @@ See the pkg-config man page for more details.
fi
fi
+if [ x$libpng_HAVE = xyes ]; then
+
+ if test x$libpng_HAVE = xyes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking version of libpng" >&5
+$as_echo_n "checking version of libpng... " >&6; }
+
+
+ # check if variable was defined by the user
+ if test -z "$libpng_VERSION"; then
+ # if not, get it from pkg-config
+ if test x$libpng_HAVE = xyes; then
+ if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpng12\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "libpng12") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ libpng_VERSION=`$PKG_CONFIG --modversion --silence-errors "libpng12"`
+else
+ # print error message and quit
+ err_msg=`$PKG_CONFIG --errors-to-stdout --print-errors "libpng12"`
+ as_fn_error "
+
+$err_msg
+
+If --with-libpng=nocheck is defined the environment variable
+libpng_VERSION
+must be set to avoid the need to call pkg-config.
+
+See the pkg-config man page for more details.
+" "$LINENO" 5
+
+
+fi
+ fi
+ fi
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: [$libpng_VERSION]" >&5
+$as_echo "[$libpng_VERSION]" >&6; }
+ else
+ libpng_VERSION="0.0.0"
+ fi
+
+ version=$libpng_VERSION
+
+ # strip leading non-numeric tokens
+ # (necessary for some ffmpeg-packages in ubuntu)
+ # example: 0d.51.1.0 -> 51.1.0
+ version=`echo $version | sed 's/^[^.]*[^0-9.][^.]*\.//'`
+
+ # replace "." and "-" with " " and ignore trailing tokens.
+ # 1.23.4-r2 will be splitted to [maj=1, min=23, rel=4].
+ # In addition we delete everything after the first character
+ # which is not 0-9.
+ # 1.3a4-r32 will be [maj=1, min=3, rel=0].
+ read major minor release ignore <<eof
+ `echo $version | tr '.-' ' ' | sed 's/[^0-9\ ].*//'`
+eof
+ # Note: Do NOT indent the eof-delimiter
+ # We use a here-document (<<< here-strings not POSIX compatible)
+
+ test -z $major && major=0
+ test -z $minor && minor=0
+ test -z $release && release=0
+
+ # strip preceding 0s and set unset version-parts to 0
+ libpng_VERSION_MAJOR=$(($major))
+ libpng_VERSION_MINOR=$(($minor))
+ libpng_VERSION_RELEASE=$(($release))
+ # integer representation: MMMmmmrrr (M:major,m:minor,r:release)
+ # can be used if pkg-config's comparison fails
+ libpng_VERSION_INT=$(($libpng_VERSION_MAJOR*1000000+$libpng_VERSION_MINOR*1000+$libpng_VERSION_RELEASE))
+
+
+
+
+
+
+
+else
+ # check for the generic .pc file
+
+ have_lib="no"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libpng >= 1.2" >&5
+$as_echo_n "checking for libpng >= 1.2... " >&6; }
+ if test x"$with_libpng" = xnocheck; then
+ # do not call pkg-config, use user settings
+ have_lib="yes"
+ elif test x"$with_libpng" != xno; then
+ # check if package exists
+ if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpng >= 1.2\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "libpng >= 1.2") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+
+ have_lib="yes"
+ libpng_LIBS=`$PKG_CONFIG --libs --silence-errors "libpng >= 1.2"`
+ libpng_LIBDIRS=`$PKG_CONFIG --libs-only-L --silence-errors "libpng >= 1.2"`
+ libpng_LIBDIRS=`
+ echo "$libpng_LIBDIRS" | $SED 's/^[ \t]*//' | $SED 's/[ \t]*$//'
+`
+ # add library directories to LIBS (ignore *_LIBS for now)
+ if test -n "$libpng_LIBDIRS"; then
+ LIBS="$LIBS $libpng_LIBDIRS"
+ fi
+
+fi
+ fi
+ if test x$have_lib = xyes; then
+ libpng_HAVE="yes"
+ if test -n "$libpng_LIBDIRS"; then
+ # show additional lib-dirs
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes ($libpng_LIBDIRS)" >&5
+$as_echo "yes ($libpng_LIBDIRS)" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ fi
+ else
+ libpng_HAVE="no"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+ # check if package is required
+ if test xyes = xyes -o x"$with_libpng" = xyes ; then
+ # print error message and quit
+ err_msg=`$PKG_CONFIG --errors-to-stdout --print-errors "libpng >= 1.2"`
+ as_fn_error "
+
+$err_msg
+
+Alternatively, you may set --with-libpng=nocheck and the environment
+variables libpng_[...] (see configure --help)
+to appropriate values to avoid the need to call pkg-config.
+
+See the pkg-config man page for more details.
+" "$LINENO" 5
+ fi
+ fi
+
+
+ if test x$libpng_HAVE = xyes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking version of libpng" >&5
+$as_echo_n "checking version of libpng... " >&6; }
+
+
+ # check if variable was defined by the user
+ if test -z "$libpng_VERSION"; then
+ # if not, get it from pkg-config
+ if test x$libpng_HAVE = xyes; then
+ if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpng >= 1.2\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "libpng >= 1.2") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ libpng_VERSION=`$PKG_CONFIG --modversion --silence-errors "libpng >= 1.2"`
+else
+ # print error message and quit
+ err_msg=`$PKG_CONFIG --errors-to-stdout --print-errors "libpng >= 1.2"`
+ as_fn_error "
+
+$err_msg
+
+If --with-libpng=nocheck is defined the environment variable
+libpng_VERSION
+must be set to avoid the need to call pkg-config.
+
+See the pkg-config man page for more details.
+" "$LINENO" 5
+
+
+fi
+ fi
+ fi
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: [$libpng_VERSION]" >&5
+$as_echo "[$libpng_VERSION]" >&6; }
+ else
+ libpng_VERSION="0.0.0"
+ fi
+
+ version=$libpng_VERSION
+
+ # strip leading non-numeric tokens
+ # (necessary for some ffmpeg-packages in ubuntu)
+ # example: 0d.51.1.0 -> 51.1.0
+ version=`echo $version | sed 's/^[^.]*[^0-9.][^.]*\.//'`
+
+ # replace "." and "-" with " " and ignore trailing tokens.
+ # 1.23.4-r2 will be splitted to [maj=1, min=23, rel=4].
+ # In addition we delete everything after the first character
+ # which is not 0-9.
+ # 1.3a4-r32 will be [maj=1, min=3, rel=0].
+ read major minor release ignore <<eof
+ `echo $version | tr '.-' ' ' | sed 's/[^0-9\ ].*//'`
+eof
+ # Note: Do NOT indent the eof-delimiter
+ # We use a here-document (<<< here-strings not POSIX compatible)
+
+ test -z $major && major=0
+ test -z $minor && minor=0
+ test -z $release && release=0
+
+ # strip preceding 0s and set unset version-parts to 0
+ libpng_VERSION_MAJOR=$(($major))
+ libpng_VERSION_MINOR=$(($minor))
+ libpng_VERSION_RELEASE=$(($release))
+ # integer representation: MMMmmmrrr (M:major,m:minor,r:release)
+ # can be used if pkg-config's comparison fails
+ libpng_VERSION_INT=$(($libpng_VERSION_MAJOR*1000000+$libpng_VERSION_MINOR*1000+$libpng_VERSION_RELEASE))
+
+
+
+
+
+
+
+fi
# find sdl
diff --git a/configure.ac b/configure.ac
index 36b4e4ab..99f2fb3f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -154,8 +154,16 @@ fi
# check for libraries
# -----------------------------------------
-# libpng
-PKG_HAVE([libpng], [libpng12], yes)
+# find libpng
+# pkgconfig name for 1.2 is "libpng12", for 1.4 "libpng"
+PKG_HAVE([libpng], [libpng12], no)
+if [[ x$libpng_HAVE = xyes ]]; then
+ PKG_VERSION([libpng], [libpng12])
+else
+ # check for the generic .pc file
+ PKG_HAVE([libpng], [libpng >= 1.2], yes)
+ PKG_VERSION([libpng], [libpng >= 1.2])
+fi
# find sdl
PKG_HAVE([sdl], [sdl], yes)