1dnl Based on Xpdf configure.in and evince configure.ac 2dnl Based on kde acinclude.m4.in, LGPL Licensed 3 4AC_DEFUN([AC_FIND_FILE], 5[ 6$3=NO 7for i in $2; 8do 9 for j in $1; 10 do 11 echo "configure: __oline__: $i/$j" >&AC_FD_CC 12 if test -r "$i/$j"; then 13 echo "taking that" >&AC_FD_CC 14 $3=$i 15 break 2 16 fi 17 done 18done 19]) 20 21AC_DEFUN([KDE_FIND_JPEG_HELPER], 22[ 23AC_MSG_CHECKING([for libjpeg$2]) 24AC_CACHE_VAL(ac_cv_lib_jpeg_$1, 25[ 26ac_save_LIBS="$LIBS" 27LIBS="$all_libraries $USER_LDFLAGS -ljpeg$2 -lm" 28ac_save_CFLAGS="$CFLAGS" 29CFLAGS="$CFLAGS $all_includes $USER_INCLUDES" 30AC_TRY_LINK( 31[ 32#ifdef __cplusplus 33extern "C" { 34#endif 35void jpeg_CreateDecompress(); 36#ifdef __cplusplus 37} 38#endif 39], 40[jpeg_CreateDecompress();], 41 eval "ac_cv_lib_jpeg_$1=-ljpeg$2", 42 eval "ac_cv_lib_jpeg_$1=no") 43LIBS="$ac_save_LIBS" 44CFLAGS="$ac_save_CFLAGS" 45]) 46 47if eval "test ! \"`echo $ac_cv_lib_jpeg_$1`\" = no"; then 48 enable_libjpeg=yes 49 LIBJPEG_LIBS="$ac_cv_lib_jpeg_$1" 50 AC_MSG_RESULT($ac_cv_lib_jpeg_$1) 51else 52 AC_MSG_RESULT(no) 53 $3 54fi 55]) 56 57 58AC_DEFUN([POPPLER_FIND_JPEG], 59[ 60dnl first look for libraries 61KDE_FIND_JPEG_HELPER(6b, 6b, 62 KDE_FIND_JPEG_HELPER(normal, [], 63 [ 64 LIBJPEG_LIBS= 65 ] 66 ) 67) 68 69dnl then search the headers (can't use simply AC_TRY_xxx, as jpeglib.h 70dnl requires system dependent includes loaded before it) 71AC_CHECK_HEADER([jpeglib.h], [jpeg_incdir=yes], [jpeg_incdir=NO]) 72test "x$jpeg_incdir" = xNO && jpeg_incdir= 73 74dnl if headers _and_ libraries are missing, this is no error, and we 75dnl continue with a warning (the user will get no jpeg support) 76dnl if only one is missing, it means a configuration error, but we still 77dnl only warn 78if test -n "$jpeg_incdir" && test -n "$LIBJPEG_LIBS" ; then 79 AC_DEFINE_UNQUOTED(ENABLE_LIBJPEG, 1, [Define if you have libjpeg]) 80else 81 if test -n "$jpeg_incdir" || test -n "$LIBJPEG_LIBS" ; then 82 AC_MSG_WARN([ 83There is an installation error in jpeg support. You seem to have only one 84of either the headers _or_ the libraries installed. You may need to either 85provide correct --with-extra-... options, or the development package of 86libjpeg6b. You can get a source package of libjpeg from http://www.ijg.org/ 87Disabling JPEG support. 88]) 89 else 90 AC_MSG_WARN([libjpeg not found. disable JPEG support.]) 91 fi 92 jpeg_incdir= 93 enable_libjpeg=no 94 LIBJPEG_LIBS= 95fi 96 97AC_SUBST(LIBJPEG_LIBS) 98AH_VERBATIM(_AC_CHECK_JPEG, 99[/* 100 * jpeg.h needs HAVE_BOOLEAN, when the system uses boolean in system 101 * headers and I'm too lazy to write a configure test as long as only 102 * unixware is related 103 */ 104#ifdef _UNIXWARE 105#define HAVE_BOOLEAN 106#endif 107]) 108]) 109