oops, FIND_ fixes

This commit is contained in:
John Cupitt 2008-06-24 10:37:54 +00:00
parent 7f0378d962
commit 7a5fb7bd3d
2 changed files with 203 additions and 215 deletions

6
TODO
View File

@ -1,7 +1,3 @@
- FIND_TIFF etc. should not search so much
- configure should summarize missing stuff at the end
- try - try
libsrc/convolution$ grep -l offsets *.c libsrc/convolution$ grep -l offsets *.c
@ -13,7 +9,7 @@
fixed? not sure, check again fixed? not sure, check again
- unsharp should work on GREY16? shuld be easy to add GREY16->LABS - unsharp should work on GREY16? should be easy to add GREY16->LABS
no, labs is signed short, ranges are all differrent, and the scaling will be no, labs is signed short, ranges are all differrent, and the scaling will be
wrong anyway wrong anyway

View File

@ -7,8 +7,7 @@ dnl Find ZIP libraries and headers
dnl dnl
dnl Put includes stuff in ZIP_INCLUDES dnl Put includes stuff in ZIP_INCLUDES
dnl Put link stuff in ZIP_LIBS dnl Put link stuff in ZIP_LIBS
dnl dnl Define HAVE_ZIP if found
dnl Default ACTION-IF-FOUND defines HAVE_ZIP
dnl dnl
AC_DEFUN([FIND_ZIP], [ AC_DEFUN([FIND_ZIP], [
AC_REQUIRE([AC_PATH_XTRA]) AC_REQUIRE([AC_PATH_XTRA])
@ -17,69 +16,69 @@ ZIP_INCLUDES=""
ZIP_LIBS="" ZIP_LIBS=""
AC_ARG_WITH(zip, AC_ARG_WITH(zip,
[ --without-zip do not use libz]) [ --without-zip do not use libz])
# Treat --without-zip like --without-zip-includes --without-zip-libraries. # Treat --without-zip like --without-zip-includes --without-zip-libraries.
if test "$with_zip" = "no"; then if test "$with_zip" = "no"; then
ZIP_INCLUDES=no ZIP_INCLUDES=no
ZIP_LIBS=no ZIP_LIBS=no
fi fi
AC_ARG_WITH(zip-includes, AC_ARG_WITH(zip-includes,
[ --with-zip-includes=DIR ZIP include files are in DIR], [ --with-zip-includes=DIR ZIP include files are in DIR],
ZIP_INCLUDES="-I$withval") ZIP_INCLUDES="-I$withval")
AC_ARG_WITH(zip-libraries, AC_ARG_WITH(zip-libraries,
[ --with-zip-libraries=DIR ZIP libraries are in DIR], [ --with-zip-libraries=DIR ZIP libraries are in DIR],
ZIP_LIBS="-L$withval -lz") ZIP_LIBS="-L$withval -lz")
AC_MSG_CHECKING(for ZIP) AC_MSG_CHECKING(for ZIP)
# Look for zlib.h # Look for zlib.h
if test "$ZIP_INCLUDES" = ""; then if test "$ZIP_INCLUDES" = ""; then
# Check the standard search path # Check the standard search path
AC_TRY_COMPILE([#include <zlib.h>],[int a;],[ AC_TRY_COMPILE([#include <zlib.h>],[int a;],[
ZIP_INCLUDES="" ZIP_INCLUDES=""
], [ ], [
# zlib.h is not in the standard search path, try # zlib.h is not in the standard search path, try
# $prefix # $prefix
zip_save_INCLUDES="$INCLUDES" zip_save_INCLUDES="$INCLUDES"
INCLUDES="-I${prefix}/include $INCLUDES" INCLUDES="-I${prefix}/include $INCLUDES"
AC_TRY_COMPILE([#include <zlib.h>],[int a;],[ AC_TRY_COMPILE([#include <zlib.h>],[int a;],[
ZIP_INCLUDES="-I${prefix}/include" ZIP_INCLUDES="-I${prefix}/include"
], [ ], [
ZIP_INCLUDES="no" ZIP_INCLUDES="no"
]) ])
INCLUDES=$zip_save_INCLUDES INCLUDES=$zip_save_INCLUDES
]) ])
fi fi
# Now for the libraries # Now for the libraries
if test "$ZIP_LIBS" = ""; then if test "$ZIP_LIBS" = ""; then
zip_save_LIBS="$LIBS" zip_save_LIBS="$LIBS"
zip_save_INCLUDES="$INCLUDES" zip_save_INCLUDES="$INCLUDES"
LIBS="-lz $LIBS" LIBS="-lz $LIBS"
INCLUDES="$ZIP_INCLUDES $INCLUDES" INCLUDES="$ZIP_INCLUDES $INCLUDES"
# Try the standard search path first # Try the standard search path first
AC_TRY_LINK([#include <zlib.h>],[zlibVersion()], [ AC_TRY_LINK([#include <zlib.h>],[zlibVersion()], [
ZIP_LIBS="-lz" ZIP_LIBS="-lz"
], [ ], [
# libz is not in the standard search path, try $prefix # libz is not in the standard search path, try $prefix
LIBS="-L${prefix}/lib $LIBS" LIBS="-L${prefix}/lib $LIBS"
AC_TRY_LINK([#include <zlib.h>],[zlibVersion()], [ AC_TRY_LINK([#include <zlib.h>],[zlibVersion()], [
ZIP_LIBS="-L${prefix}/lib -lz" ZIP_LIBS="-L${prefix}/lib -lz"
], [ ], [
ZIP_LIBS=no ZIP_LIBS=no
]) ])
]) ])
LIBS="$zip_save_LIBS" LIBS="$zip_save_LIBS"
INCLUDES="$zip_save_INCLUDES" INCLUDES="$zip_save_INCLUDES"
fi fi
AC_SUBST(ZIP_LIBS) AC_SUBST(ZIP_LIBS)
@ -90,30 +89,29 @@ zip_libraries_result="$ZIP_LIBS"
zip_includes_result="$ZIP_INCLUDES" zip_includes_result="$ZIP_INCLUDES"
if test x"$zip_libraries_result" = x""; then if test x"$zip_libraries_result" = x""; then
zip_libraries_result="in default path" zip_libraries_result="in default path"
fi fi
if test x"$zip_includes_result" = x""; then if test x"$zip_includes_result" = x""; then
zip_includes_result="in default path" zip_includes_result="in default path"
fi fi
if test "$zip_libraries_result" = "no"; then if test "$zip_libraries_result" = "no"; then
zip_libraries_result="(none)" zip_libraries_result="(none)"
fi fi
if test "$zip_includes_result" = "no"; then if test "$zip_includes_result" = "no"; then
zip_includes_result="(none)" zip_includes_result="(none)"
fi fi
AC_MSG_RESULT( AC_MSG_RESULT([libraries $zip_libraries_result, headers $zip_includes_result])
[libraries $zip_libraries_result, headers $zip_includes_result])
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
if test "$ZIP_INCLUDES" != "no" && test "$ZIP_LIBS" != "no"; then if test "$ZIP_INCLUDES" != "no" && test "$ZIP_LIBS" != "no"; then
ifelse([$1],,AC_DEFINE(HAVE_ZIP,1,[Define if you have libz libraries and header files.]),[$1]) AC_DEFINE(HAVE_ZIP,1,[Define if you have libz libraries and header files.])
: $1
else else
ZIP_LIBS="" ZIP_LIBS=""
ZIP_INCLUDES="" ZIP_INCLUDES=""
$2 $2
fi fi
])dnl ])dnl
@ -127,8 +125,7 @@ dnl Find TIFF libraries and headers
dnl dnl
dnl Put compile stuff in TIFF_INCLUDES dnl Put compile stuff in TIFF_INCLUDES
dnl Put link stuff in TIFF_LIBS dnl Put link stuff in TIFF_LIBS
dnl dnl Define HAVE_TIFF if found
dnl Default ACTION-IF-FOUND defines HAVE_TIFF
dnl dnl
AC_DEFUN([FIND_TIFF], [ AC_DEFUN([FIND_TIFF], [
AC_REQUIRE([AC_PATH_XTRA]) AC_REQUIRE([AC_PATH_XTRA])
@ -137,69 +134,69 @@ TIFF_INCLUDES=""
TIFF_LIBS="" TIFF_LIBS=""
AC_ARG_WITH(tiff, AC_ARG_WITH(tiff,
[ --without-tiff do not use libtiff]) [ --without-tiff do not use libtiff])
# Treat --without-tiff like --without-tiff-includes --without-tiff-libraries. # Treat --without-tiff like --without-tiff-includes --without-tiff-libraries.
if test "$with_tiff" = "no"; then if test "$with_tiff" = "no"; then
TIFF_INCLUDES=no TIFF_INCLUDES=no
TIFF_LIBS=no TIFF_LIBS=no
fi fi
AC_ARG_WITH(tiff-includes, AC_ARG_WITH(tiff-includes,
[ --with-tiff-includes=DIR TIFF include files are in DIR], [ --with-tiff-includes=DIR TIFF include files are in DIR],
TIFF_INCLUDES="-I$withval") TIFF_INCLUDES="-I$withval")
AC_ARG_WITH(tiff-libraries, AC_ARG_WITH(tiff-libraries,
[ --with-tiff-libraries=DIR TIFF libraries are in DIR], [ --with-tiff-libraries=DIR TIFF libraries are in DIR],
TIFF_LIBS="-L$withval -ltiff") TIFF_LIBS="-L$withval -ltiff")
AC_MSG_CHECKING(for TIFF) AC_MSG_CHECKING(for TIFF)
# Look for tiff.h # Look for tiff.h
if test "$TIFF_INCLUDES" = ""; then if test "$TIFF_INCLUDES" = ""; then
# Check the standard search path # Check the standard search path
AC_TRY_COMPILE([#include <tiff.h>],[int a;],[ AC_TRY_COMPILE([#include <tiff.h>],[int a;],[
TIFF_INCLUDES="" TIFF_INCLUDES=""
], [ ], [
# tiff.h is not in the standard search path, try # tiff.h is not in the standard search path, try
# $prefix # $prefix
tiff_save_INCLUDES="$INCLUDES" tiff_save_INCLUDES="$INCLUDES"
INCLUDES="-I${prefix}/include $INCLUDES" INCLUDES="-I${prefix}/include $INCLUDES"
AC_TRY_COMPILE([#include <tiff.h>],[int a;],[ AC_TRY_COMPILE([#include <tiff.h>],[int a;],[
TIFF_INCLUDES="-I${prefix}/include" TIFF_INCLUDES="-I${prefix}/include"
], [ ], [
TIFF_INCLUDES="no" TIFF_INCLUDES="no"
]) ])
INCLUDES=$tiff_save_INCLUDES INCLUDES=$tiff_save_INCLUDES
]) ])
fi fi
# Now for the libraries # Now for the libraries
if test "$TIFF_LIBS" = ""; then if test "$TIFF_LIBS" = ""; then
tiff_save_LIBS="$LIBS" tiff_save_LIBS="$LIBS"
tiff_save_INCLUDES="$INCLUDES" tiff_save_INCLUDES="$INCLUDES"
LIBS="-ltiff -lm $LIBS" LIBS="-ltiff -lm $LIBS"
INCLUDES="$TIFF_INCLUDES $INCLUDES" INCLUDES="$TIFF_INCLUDES $INCLUDES"
# Try the standard search path first # Try the standard search path first
AC_TRY_LINK([#include <tiff.h>],[TIFFGetVersion()], [ AC_TRY_LINK([#include <tiff.h>],[TIFFGetVersion()], [
TIFF_LIBS="-ltiff" TIFF_LIBS="-ltiff"
], [ ], [
# libtiff is not in the standard search path, try $prefix # libtiff is not in the standard search path, try $prefix
LIBS="-L${prefix}/lib $LIBS" LIBS="-L${prefix}/lib $LIBS"
AC_TRY_LINK([#include <tiff.h>],[TIFFGetVersion()], [ AC_TRY_LINK([#include <tiff.h>],[TIFFGetVersion()], [
TIFF_LIBS="-L${prefix}/lib -ltiff" TIFF_LIBS="-L${prefix}/lib -ltiff"
], [ ], [
TIFF_LIBS=no TIFF_LIBS=no
]) ])
]) ])
LIBS="$tiff_save_LIBS" LIBS="$tiff_save_LIBS"
INCLUDES="$tiff_save_INCLUDES" INCLUDES="$tiff_save_INCLUDES"
fi fi
AC_SUBST(TIFF_LIBS) AC_SUBST(TIFF_LIBS)
@ -210,30 +207,29 @@ tiff_libraries_result="$TIFF_LIBS"
tiff_includes_result="$TIFF_INCLUDES" tiff_includes_result="$TIFF_INCLUDES"
if test x"$tiff_libraries_result" = x""; then if test x"$tiff_libraries_result" = x""; then
tiff_libraries_result="in default path" tiff_libraries_result="in default path"
fi fi
if test x"$tiff_includes_result" = x""; then if test x"$tiff_includes_result" = x""; then
tiff_includes_result="in default path" tiff_includes_result="in default path"
fi fi
if test "$tiff_libraries_result" = "no"; then if test "$tiff_libraries_result" = "no"; then
tiff_libraries_result="(none)" tiff_libraries_result="(none)"
fi fi
if test "$tiff_includes_result" = "no"; then if test "$tiff_includes_result" = "no"; then
tiff_includes_result="(none)" tiff_includes_result="(none)"
fi fi
AC_MSG_RESULT( AC_MSG_RESULT([libraries $tiff_libraries_result, headers $tiff_includes_result])
[libraries $tiff_libraries_result, headers $tiff_includes_result])
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
if test "$TIFF_INCLUDES" != "no" && test "$TIFF_LIBS" != "no"; then if test "$TIFF_INCLUDES" != "no" && test "$TIFF_LIBS" != "no"; then
ifelse([$1],,AC_DEFINE(HAVE_TIFF,1,[Define if you have tiff libraries and header files.]),[$1]) AC_DEFINE(HAVE_TIFF,1,[Define if you have tiff libraries and header files.])
: $1
else else
TIFF_INCLUDES="" TIFF_INCLUDES=""
TIFF_LIBS="" TIFF_LIBS=""
$2 $2
fi fi
])dnl ])dnl
@ -247,8 +243,7 @@ dnl Find JPEG libraries and headers
dnl dnl
dnl Put compile stuff in JPEG_INCLUDES dnl Put compile stuff in JPEG_INCLUDES
dnl Put link stuff in JPEG_LIBS dnl Put link stuff in JPEG_LIBS
dnl dnl Define HAVE_JPEG if found
dnl Default ACTION-IF-FOUND defines HAVE_JPEG
dnl dnl
AC_DEFUN([FIND_JPEG], [ AC_DEFUN([FIND_JPEG], [
AC_REQUIRE([AC_PATH_XTRA]) AC_REQUIRE([AC_PATH_XTRA])
@ -257,75 +252,75 @@ JPEG_INCLUDES=""
JPEG_LIBS="" JPEG_LIBS=""
AC_ARG_WITH(jpeg, AC_ARG_WITH(jpeg,
[ --without-jpeg do not use libjpeg]) [ --without-jpeg do not use libjpeg])
# Treat --without-jpeg like --without-jpeg-includes --without-jpeg-libraries. # Treat --without-jpeg like --without-jpeg-includes --without-jpeg-libraries.
if test "$with_jpeg" = "no"; then if test "$with_jpeg" = "no"; then
JPEG_INCLUDES=no JPEG_INCLUDES=no
JPEG_LIBS=no JPEG_LIBS=no
fi fi
AC_ARG_WITH(jpeg-includes, AC_ARG_WITH(jpeg-includes,
[ --with-jpeg-includes=DIR JPEG include files are in DIR], [ --with-jpeg-includes=DIR JPEG include files are in DIR],
JPEG_INCLUDES="-I$withval") JPEG_INCLUDES="-I$withval")
AC_ARG_WITH(jpeg-libraries, AC_ARG_WITH(jpeg-libraries,
[ --with-jpeg-libraries=DIR JPEG libraries are in DIR], [ --with-jpeg-libraries=DIR JPEG libraries are in DIR],
JPEG_LIBS="-L$withval -ljpeg") JPEG_LIBS="-L$withval -ljpeg")
AC_MSG_CHECKING(for JPEG) AC_MSG_CHECKING(for JPEG)
# Look for jpeglib.h # Look for jpeglib.h
if test "$JPEG_INCLUDES" = ""; then if test "$JPEG_INCLUDES" = ""; then
# Check the standard search path # Check the standard search path
AC_TRY_COMPILE([#include <stdio.h> AC_TRY_COMPILE([#include <stdio.h>
#include <jpeglib.h>],[int a;],[ #include <jpeglib.h>],[int a;],[
JPEG_INCLUDES="" JPEG_INCLUDES=""
], [ ], [
# jpeglib.h is not in the standard search path, try # jpeglib.h is not in the standard search path, try
# $prefix # $prefix
jpeg_save_INCLUDES="$INCLUDES" jpeg_save_INCLUDES="$INCLUDES"
INCLUDES="-I${prefix}/include $INCLUDES" INCLUDES="-I${prefix}/include $INCLUDES"
AC_TRY_COMPILE([#include <stdio.h> AC_TRY_COMPILE([#include <stdio.h>
#include <jpeglib.h>],[int a;],[ #include <jpeglib.h>],[int a;],[
JPEG_INCLUDES="-I${prefix}/include" JPEG_INCLUDES="-I${prefix}/include"
], [ ], [
JPEG_INCLUDES="no" JPEG_INCLUDES="no"
]) ])
INCLUDES=$jpeg_save_INCLUDES INCLUDES=$jpeg_save_INCLUDES
]) ])
fi fi
# Now for the libraries # Now for the libraries
if test "$JPEG_LIBS" = ""; then if test "$JPEG_LIBS" = ""; then
jpeg_save_LIBS="$LIBS" jpeg_save_LIBS="$LIBS"
jpeg_save_INCLUDES="$INCLUDES" jpeg_save_INCLUDES="$INCLUDES"
LIBS="-ljpeg $LIBS" LIBS="-ljpeg $LIBS"
INCLUDES="$JPEG_INCLUDES $INCLUDES" INCLUDES="$JPEG_INCLUDES $INCLUDES"
# Try the standard search path first # Try the standard search path first
AC_TRY_LINK([#include <stdio.h> AC_TRY_LINK([#include <stdio.h>
#include <jpeglib.h> #include <jpeglib.h>
],[jpeg_abort((void*)0)], [ ],[jpeg_abort((void*)0)], [
JPEG_LIBS="-ljpeg" JPEG_LIBS="-ljpeg"
], [ ], [
# libjpeg is not in the standard search path, try $prefix # libjpeg is not in the standard search path, try $prefix
LIBS="-L${prefix}/lib $LIBS" LIBS="-L${prefix}/lib $LIBS"
AC_TRY_LINK([#include <stdio.h> AC_TRY_LINK([#include <stdio.h>
#include <jpeg.h> #include <jpeg.h>
],[jpeg_abort((void*)0)], [ ],[jpeg_abort((void*)0)], [
JPEG_LIBS="-L${prefix}/lib -ljpeg" JPEG_LIBS="-L${prefix}/lib -ljpeg"
], [ ], [
JPEG_LIBS=no JPEG_LIBS=no
]) ])
]) ])
LIBS="$jpeg_save_LIBS" LIBS="$jpeg_save_LIBS"
INCLUDES="$jpeg_save_INCLUDES" INCLUDES="$jpeg_save_INCLUDES"
fi fi
AC_SUBST(JPEG_LIBS) AC_SUBST(JPEG_LIBS)
@ -336,30 +331,29 @@ jpeg_libraries_result="$JPEG_LIBS"
jpeg_includes_result="$JPEG_INCLUDES" jpeg_includes_result="$JPEG_INCLUDES"
if test x"$jpeg_libraries_result" = x""; then if test x"$jpeg_libraries_result" = x""; then
jpeg_libraries_result="in default path" jpeg_libraries_result="in default path"
fi fi
if test x"$jpeg_includes_result" = x""; then if test x"$jpeg_includes_result" = x""; then
jpeg_includes_result="in default path" jpeg_includes_result="in default path"
fi fi
if test "$jpeg_libraries_result" = "no"; then if test "$jpeg_libraries_result" = "no"; then
jpeg_libraries_result="(none)" jpeg_libraries_result="(none)"
fi fi
if test "$jpeg_includes_result" = "no"; then if test "$jpeg_includes_result" = "no"; then
jpeg_includes_result="(none)" jpeg_includes_result="(none)"
fi fi
AC_MSG_RESULT( AC_MSG_RESULT([libraries $jpeg_libraries_result, headers $jpeg_includes_result])
[libraries $jpeg_libraries_result, headers $jpeg_includes_result])
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
if test "$JPEG_INCLUDES" != "no" && test "$JPEG_LIBS" != "no"; then if test "$JPEG_INCLUDES" != "no" && test "$JPEG_LIBS" != "no"; then
ifelse([$1],,AC_DEFINE(HAVE_JPEG,1,[Define if you have jpeg libraries and header files.]),[$1]) AC_DEFINE(HAVE_JPEG,1,[Define if you have jpeg libraries and header files.])
: $1
else else
JPEG_INCLUDES="" JPEG_INCLUDES=""
JPEG_LIBS="" JPEG_LIBS=""
$2 $2
fi fi
])dnl ])dnl
@ -373,8 +367,7 @@ dnl Find PNG libraries and headers
dnl dnl
dnl Put compile stuff in PNG_INCLUDES dnl Put compile stuff in PNG_INCLUDES
dnl Put link stuff in PNG_LIBS dnl Put link stuff in PNG_LIBS
dnl dnl Define HAVE_PNG if found.
dnl Default ACTION-IF-FOUND defines HAVE_PNG
dnl dnl
AC_DEFUN([FIND_PNG], [ AC_DEFUN([FIND_PNG], [
AC_REQUIRE([AC_PATH_XTRA]) AC_REQUIRE([AC_PATH_XTRA])
@ -383,69 +376,69 @@ PNG_INCLUDES=""
PNG_LIBS="" PNG_LIBS=""
AC_ARG_WITH(png, AC_ARG_WITH(png,
[ --without-png do not use libpng]) [ --without-png do not use libpng])
# Treat --without-png like --without-png-includes --without-png-libraries. # Treat --without-png like --without-png-includes --without-png-libraries.
if test "$with_png" = "no"; then if test "$with_png" = "no"; then
PNG_INCLUDES=no PNG_INCLUDES=no
PNG_LIBS=no PNG_LIBS=no
fi fi
AC_ARG_WITH(png-includes, AC_ARG_WITH(png-includes,
[ --with-png-includes=DIR PNG include files are in DIR], [ --with-png-includes=DIR PNG include files are in DIR],
PNG_INCLUDES="-I$withval") PNG_INCLUDES="-I$withval")
AC_ARG_WITH(png-libraries, AC_ARG_WITH(png-libraries,
[ --with-png-libraries=DIR PNG libraries are in DIR], [ --with-png-libraries=DIR PNG libraries are in DIR],
PNG_LIBS="-L$withval -lpng") PNG_LIBS="-L$withval -lpng")
AC_MSG_CHECKING(for PNG) AC_MSG_CHECKING(for PNG)
# Look for png.h # Look for png.h
if test "$PNG_INCLUDES" = ""; then if test "$PNG_INCLUDES" = ""; then
# Check the standard search path # Check the standard search path
AC_TRY_COMPILE([#include <png.h>],[int a;],[ AC_TRY_COMPILE([#include <png.h>],[int a;],[
PNG_INCLUDES="" PNG_INCLUDES=""
], [ ], [
# png.h is not in the standard search path, try # png.h is not in the standard search path, try
# $prefix # $prefix
png_save_INCLUDES="$INCLUDES" png_save_INCLUDES="$INCLUDES"
INCLUDES="-I${prefix}/include $INCLUDES" INCLUDES="-I${prefix}/include $INCLUDES"
AC_TRY_COMPILE([#include <png.h>],[int a;],[ AC_TRY_COMPILE([#include <png.h>],[int a;],[
PNG_INCLUDES="-I${prefix}/include" PNG_INCLUDES="-I${prefix}/include"
], [ ], [
PNG_INCLUDES="no" PNG_INCLUDES="no"
]) ])
INCLUDES=$png_save_INCLUDES INCLUDES=$png_save_INCLUDES
]) ])
fi fi
# Now for the libraries # Now for the libraries
if test "$PNG_LIBS" = ""; then if test "$PNG_LIBS" = ""; then
png_save_LIBS="$LIBS" png_save_LIBS="$LIBS"
png_save_INCLUDES="$INCLUDES" png_save_INCLUDES="$INCLUDES"
LIBS="-lpng $LIBS" LIBS="-lpng $LIBS"
INCLUDES="$PNG_INCLUDES $INCLUDES" INCLUDES="$PNG_INCLUDES $INCLUDES"
# Try the standard search path first # Try the standard search path first
AC_TRY_LINK([#include <png.h>],[png_access_version_number()], [ AC_TRY_LINK([#include <png.h>],[png_access_version_number()], [
PNG_LIBS="-lpng" PNG_LIBS="-lpng"
], [ ], [
# libpng is not in the standard search path, try $prefix # libpng is not in the standard search path, try $prefix
LIBS="-L${prefix}/lib $LIBS" LIBS="-L${prefix}/lib $LIBS"
AC_TRY_LINK([#include <png.h>],[png_access_version_number()], [ AC_TRY_LINK([#include <png.h>],[png_access_version_number()], [
PNG_LIBS="-L${prefix}/lib -lpng" PNG_LIBS="-L${prefix}/lib -lpng"
], [ ], [
PNG_LIBS=no PNG_LIBS=no
]) ])
]) ])
LIBS="$png_save_LIBS" LIBS="$png_save_LIBS"
INCLUDES="$png_save_INCLUDES" INCLUDES="$png_save_INCLUDES"
fi fi
AC_SUBST(PNG_LIBS) AC_SUBST(PNG_LIBS)
@ -456,30 +449,29 @@ png_libraries_result="$PNG_LIBS"
png_includes_result="$PNG_INCLUDES" png_includes_result="$PNG_INCLUDES"
if test x"$png_libraries_result" = x""; then if test x"$png_libraries_result" = x""; then
png_libraries_result="in default path" png_libraries_result="in default path"
fi fi
if test x"$png_includes_result" = x""; then if test x"$png_includes_result" = x""; then
png_includes_result="in default path" png_includes_result="in default path"
fi fi
if test "$png_libraries_result" = "no"; then if test "$png_libraries_result" = "no"; then
png_libraries_result="(none)" png_libraries_result="(none)"
fi fi
if test "$png_includes_result" = "no"; then if test "$png_includes_result" = "no"; then
png_includes_result="(none)" png_includes_result="(none)"
fi fi
AC_MSG_RESULT( AC_MSG_RESULT([libraries $png_libraries_result, headers $png_includes_result])
[libraries $png_libraries_result, headers $png_includes_result])
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
if test "$PNG_INCLUDES" != "no" && test "$PNG_LIBS" != "no"; then if test "$PNG_INCLUDES" != "no" && test "$PNG_LIBS" != "no"; then
ifelse([$1],,AC_DEFINE(HAVE_PNG,1,[Define if you have png libraries and header files.]),[$1]) AC_DEFINE(HAVE_PNG,1,[Define if you have png libraries and header files.])
: $1
else else
PNG_INCLUDES="" PNG_INCLUDES=""
PNG_LIBS="" PNG_LIBS=""
$2 $2
fi fi
])dnl ])dnl