dnl NOTE: dnl This 'configure' and 'Imakefile.in' are written to be directory dnl independent (using srcdir), however, xmkmf and Imake.tmpl do not dnl allow us to switch compilation directory. dnl dnl $Id: configure.in,v 1.98 2007/01/12 10:38:55 nishida Exp $ AC_INIT(image/imagetypes.c) dnl Checks for programs. AC_PROG_MAKE_SET AC_CANONICAL_HOST dnl AC_PROG_CC cannot be specified here, since imake may not like the dnl compiler probed by AC_PROG_CC (i.e. gcc). dnl AC_PROG_CC AC_PROG_CPP AC_PROG_AWK AC_PROG_YACC AC_PROG_LEX AC_PATH_PROGS(mgp_cv_path_perl, perl5 perl, no) AC_SUBST(mgp_cv_path_perl) AC_PATH_PROGS(mgp_cv_path_uuencode, uuencode, no) AC_SUBST(mgp_cv_path_uuencode) AC_PATH_PROGS(mgp_cv_path_gzip, gzip, no) AC_SUBST(mgp_cv_path_gzip) AC_PATH_PROGS(mgp_cv_path_uudecode, uudecode, no) AC_PATH_PROGS(mgp_cv_path_gunzip, gunzip, no) OPTFLAGS= AC_SUBST(OPTFLAGS) DEPLIBS= AC_SUBST(DEPLIBS) dnl AS_15_01_2005: Added Variable SHLIBEXT which contains extensions of shared libaries SHLIBEXT=so case $host_os in freebsd5*|freebsd4*|freebsd3*|freebsd2.2.6*|freebsd2.2.7*|freebsd2.2.8*) OPTFLAGS="$OPTFLAGS -DUUDECODEOPT=\\\"-s\\\"" ;; darwin*) SHLIBEXT=dylib ;; esac OPTFLAGS="$OPTFLAGS -DUUDECODE=\\\"$mgp_cv_path_uudecode\\\"" OPTFLAGS="$OPTFLAGS -DGUNZIP=\\\"$mgp_cv_path_gunzip\\\"" dnl Checks for debugging option. AC_MSG_CHECKING(if debugging is enabled) AC_ARG_ENABLE(debug, [ --enable-debug compile debugging information in.], [mgp_debug="$enableval"], [mgp_debug="no"]) if test "$mgp_debug" = "yes"; then OPTFLAGS="$OPTFLAGS -g -DDEBUG -Wall" fi AC_MSG_RESULT($mgp_debug) dnl Checks for locale option. AC_MSG_CHECKING(if setlocale() should be used) AC_ARG_ENABLE(locale, [ --enable-locale perform setlocale() on invocation.], [mgp_locale="$enableval"], [mgp_locale="no"]) if test $mgp_locale = "yes"; then OPTFLAGS="$OPTFLAGS -DUSE_SETLOCALE" fi AC_MSG_RESULT($mgp_locale) AC_HEADER_STDC AC_HEADER_SYS_WAIT AC_CHECK_HEADERS(fcntl.h strings.h sys/file.h unistd.h sys/time.h sys/select.h stdarg.h varargs.h termios.h locale.h) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_C_INLINE AC_TYPE_PID_T AC_TYPE_SIZE_T AC_HEADER_TIME AC_CHECK_TYPE(u_int, unsigned int) AC_CHECK_TYPE(u_char, unsigned char) dnl Checks for library functions. AC_FUNC_MEMCMP AC_TYPE_SIGNAL AC_CHECK_FUNCS(poll strstr _setbufend) AC_REPLACE_FUNCS(usleep strsep strdup mkstemp snprintf memcmp strlcpy strlcat) dnl Checks for libraries. LIBS="-lm $LIBS" dnl AS_15_01_2005 dnl Addes Path Variable for Libs/Includes searching AC_ARG_WITH(searchpath, [ --with-searchpath=PATH additional path for searching includes & libaries.], [SEARCHPATH="$SEARCHPATH $withval"], []) AC_MSG_CHECKING(if freetype1 is used) AC_ARG_ENABLE(freetype, [ --disable-freetype DON'T use freetype1 routines.], [mgp_use_freetype="$enableval"], [mgp_use_freetype="yes"]) AC_MSG_RESULT($mgp_use_freetype) dnl echo $target if test "$mgp_use_freetype" = "yes"; then # XXX: freetype2 may use freetype-config AC_MSG_CHECKING(for freetype1 library/header) for dir in $SEARCHPATH /usr/local/freetype /usr/local /opt/freetype /usr/pkg /usr /usr/include/freetype1; do ac_cv_ft_lib=no ac_cv_ft_include=no shlib=`echo $dir/lib/libttf.$SHLIBEXT* | head -1 | sed -e 's/.*\///'` if test x$shlib = x; then shlib=no fi if test -d $dir/lib -a -f $dir/lib/$shlib; then ac_cv_ft_lib="$dir/lib" ac_cv_ft_libpath="$shlib" elif test -d $dir/lib -a -f $dir/lib/libttf.a; then ac_cv_ft_lib="$dir/lib" ac_cv_ft_libpath="libttf.a" fi if test -d $dir/include -a -f $dir/include/freetype.h; then ac_cv_ft_include="$dir/include" elif test -d $dir/include/freetype -a -f $dir/include/freetype/freetype.h; then ac_cv_ft_include="$dir/include/freetype" fi if test "$ac_cv_ft_lib" != "no" -a "$ac_cv_ft_include" != "no"; then LIBS="-L$ac_cv_ft_lib $LIBS" CFLAGS="-I$ac_cv_ft_include $CFLAGS" break fi done if test "$ac_cv_ft_lib" = "no" -a "$ac_cv_ft_include" = "no"; then AC_MSG_RESULT(no - not using freetype) mgp_use_freetype=no else AC_MSG_RESULT($ac_cv_ft_lib and $ac_cv_ft_include) fi if test "$mgp_use_freetype" = "yes"; then LIBS="-L$ac_cv_ft_lib $LIBS" OPTFLAGS="-I$ac_cv_ft_include $OPTFLAGS" DEPLIBS="$ac_cv_ft_lib/$ac_cv_ft_libpath $DEPLIBS" AC_CHECK_LIB(intl, dgettext) AC_CHECK_LIB(ttf, TT_Init_FreeType, [], [echo "Fatal: libttf.a not found" exit 1]) AC_TRY_COMPILE([#include ], [], [], [dnl echo "Fatal: freetype.h not found" exit 1]) AC_DEFINE(FREETYPE) AC_MSG_CHECKING(for num_CharMaps field in TT_Face_Properties) AC_TRY_COMPILE([#include ], [TT_Face_Properties x; return x.num_CharMaps;], [result=yes; AC_DEFINE(HAVE_TT_FACE_PROPERTIES_CHARMAPS)], [result=no]) AC_MSG_RESULT($result) fi fi AC_MSG_CHECKING(if vflib is used) AC_ARG_ENABLE(vflib, [ --disable-vflib DON'T use vflib routines.], [mgp_use_vflib="$enableval"], [mgp_use_vflib="yes"]) AC_MSG_RESULT($mgp_use_vflib) if test "$mgp_use_vflib" = "yes"; then AC_MSG_CHECKING(for VFlib library/header) for dir in $SEARCHPATH /usr/local/VFlib /usr/local/vflib /usr/local /usr/pkg /usr; do ac_cv_vf_libname=VFlib ac_cv_vf_libdir=no ac_cv_vf_hdrdir=no shlib1=`echo $dir/lib/libVFlib.so* | head -1 | sed -e 's/.*\///'` shlib2=`echo $dir/lib/libVFlib2.so* | head -1 | sed -e 's/.*\///'` if test x$shlib1 = x; then $shlib1=no fi if test x$shlib2 = x; then $shlib2=no fi if test -d $dir/lib -a -f $dir/lib/$shlib1; then ac_cv_vf_libdir="$dir/lib" ac_cv_vf_libpath=$shlib1 elif test -d $dir/lib -a -f $dir/lib/libVFlib.a; then ac_cv_vf_libdir="$dir/lib" ac_cv_vf_libpath="libVFlib.a" elif test -d $dir/lib -a -f $dir/lib/$shlib2; then ac_cv_vf_libname=VFlib2 ac_cv_vf_libdir="$dir/lib" ac_cv_vf_libpath=$shlib2 elif test -d $dir/lib -a -f $dir/lib/libVFlib2.a; then ac_cv_vf_libname=VFlib2 ac_cv_vf_libdir="$dir/lib" ac_cv_vf_libpath="libVFlib2.a" fi if test -d $dir/include -a -f $dir/include/VF.h; then ac_cv_vf_hdrdir="$dir/include" fi if test "$ac_cv_vf_libdir" != "no" -a "$ac_cv_vf_hdrdir" != "no"; then LIBS="-L$ac_cv_vf_libdir $LIBS" CFLAGS="-I$ac_cv_vf_hdrdir $CFLAGS" break fi done if test "$ac_cv_vf_libdir" = "no" -o "$ac_cv_vf_hdrdir" = "no"; then AC_MSG_RESULT(no - not using VFlib) mgp_use_vflib=no else AC_MSG_RESULT($ac_cv_vf_libdir and $ac_cv_vf_hdrdir) fi fi if test "$mgp_use_vflib" = "yes"; then LIBS="-L$ac_cv_vf_libdir -l$ac_cv_vf_libname $LIBS" OPTFLAGS="-I$ac_cv_vf_hdrdir $OPTFLAGS" DEPLIBS="$ac_cv_vf_libdir/$ac_cv_vf_libpath $DEPLIBS" AC_CHECK_LIB($ac_cv_vf_libname, VF_Init, [mgp_cv_vflib_a=$ac_cv_vf_libpath], [echo "Fatal: $ac_cv_vf_libpath not found" exit 1]) AC_TRY_COMPILE([#include ], [], [], [dnl echo "Fatal: VF.h not found" exit 1]) AC_DEFINE(VFLIB) AC_MSG_CHECKING(for VFlib configuration file) AC_ARG_WITH(vfontcap, [ --with-vfontcap=PATH use PATH as vfontcap]) ac_cv_vf_fontcap="no" if test -f "$with_vfontcap"; then ac_cv_vf_fontcap=$with_vfontcap; else for ac_dir in /usr/local/lib /usr/local/lib/tex \ /usr/local/lib/VFlib /usr/local/lib/fonts/vf \ /usr/local/lib /usr/local/etc /etc \ /usr/local/libdata/vflib /usr/local/share/VFlib \ /usr/local/share/VFlib/* \ ../../VFlib* ../VFlib* VFlib*; do if test -d $ac_dir -a -f $ac_dir/vfontcap; then ac_cv_vf_fontcap=$ac_dir/vfontcap; break fi done fi AC_MSG_RESULT($ac_cv_vf_fontcap) if test "$ac_cv_vf_fontcap" = "no"; then echo Fatal: no vfontcap file found. cannot continue. echo Please use the option --with-vfontcap=PATH to specify the path to vfontcap. exit 1 fi AC_DEFINE_UNQUOTED(VFCAP, "$ac_cv_vf_fontcap") AC_SUBST(mgp_cv_vflib_a) fi if test "$mgp_use_freetype" = "yes"; then AC_MSG_CHECKING(if freetype-charset16 is enabled) AC_ARG_ENABLE(freetype-charset16, [ --enable-freetype-charset16 use freetype for chaset16.], [mgp_use_freetype_c16="$enableval"], [mgp_use_freetype_c16="no"]) AC_MSG_RESULT($mgp_use_freetype_c16) if test "$mgp_use_freetype_c16" = "yes"; then AC_DEFINE(FREETYPE_CHARSET16) fi fi if type pkg-config > /dev/null 2>&1; then for pnglib in libpng libpng12 libpng10 do if pkg-config $pnglib; then LIBS="$LIBS `pkg-config --libs $pnglib`" OPTFLAGS="$OPTFLAGS `pkg-config --cflags $pnglib`" AC_DEFINE(USE_PNG) break fi done fi if test "$use_libpng" = ""; then for i in $SEARCHPATH /usr/pkg /usr/local /usr; do if test -f $i/include/png.h; then if test -f $i/lib/libpng.a ; then DEPLIBS="$DEPLIBS $i/lib/libpng.a" elif test -f $i/lib/libpng.so ; then DEPLIBS="$DEPLIBS $i/lib/libpng.so" else break; fi LIBS="$LIBS -L$i/lib" OPTFLAGS="$OPTFLAGS -I$i/include" AC_CHECK_LIB(png, png_read_image, [LIBS="$LIBS -lpng" AC_DEFINE(USE_PNG)], [AC_CHECK_LIB(png, png_set_gray_1_2_4_to_8, [LIBS="$LIBS -lpng -lz" AC_DEFINE(USE_PNG)], [], [-lz])]) break fi done fi for i in /usr/pkg /usr/local /usr; do if test -f $i/include/libmng.h; then if test -f $i/lib/libmng.a ; then DEPLIBS="$DEPLIBS $i/lib/libmng.a" elif test -f $i/lib/libmng.so ; then DEPLIBS="$DEPLIBS $i/lib/libmng.so" else break; fi LIBS="$LIBS -L$i/lib" OPTFLAGS="$OPTFLAGS -I$i/include" AC_CHECK_LIB(mng, mng_initialize, [LIBS="$LIBS -lmng" AC_DEFINE(MNG)], [AC_CHECK_LIB(mng, mng_readdisplay, [LIBS="$LIBS -lmng -ljpeg" AC_DEFINE(MNG)], [], [-ljpeg])]) break fi done dnl Checks for header files. AC_PATH_X if test "$no_x" != yes; then LIBS="$LIBS -L$x_libraries" OPTFLAGS="$OPTFLAGS -I$x_includes" fi AC_MSG_CHECKING(if Xft2 is used) AC_ARG_ENABLE(xft2, [ --disable-xft2 DON'T use xft2 libraries.], [mgp_use_xft2="$enableval"], [mgp_use_xft2="yes"]) AC_MSG_RESULT($mgp_use_xft2) if test "$mgp_use_xft2" = "yes"; then if type pkg-config > /dev/null 2>&1; then if pkg-config xft; then OPTFLAGS="`pkg-config --cflags xft` $OPTFLAGS" LIBS="$LIBS `pkg-config --libs xft`" AC_DEFINE(USE_XFT2) mgp_xft2_found="yes"; fi fi if test "$mgp_xft2_found" != "yes"; then AC_MSG_CHECKING(for xft2 and ft2 and fc header..) for dir in /usr/include /usr/include/Xft2 /usr/X11R6/include \ /usr/X11R6/include/freetype2 \ /usr/local/include /usr/include/freetype2; do if test -f $dir/X11/Xft/Xft.h; then ac_cv_xft2_hdrdir="$dir" fi if test -f $dir/fontconfig/fontconfig.h; then ac_cv_fc_hdrdir="$dir" fi if test -f $dir/freetype/freetype.h; then ac_cv_ft2_hdrdir="$dir" fi done if test -z "$ac_cv_xft2_hdrdir" -o -z "$ac_cv_fc_hdrdir"; then AC_MSG_RESULT(no - not using xft2) mgp_use_xft2=no else AC_MSG_RESULT($ac_cv_xft2_hdrdir and $ac_cv_ft2_hdrdir and $ac_cv_fc_hdrdir) if test $ac_cv_xft2_hdrdir != "/usr/include" ; then OPTFLAGS="-I$ac_cv_xft2_hdrdir $OPTFLAGS" fi if test $ac_cv_ft2_hdrdir != "/usr/include" ; then OPTFLAGS="-I$ac_cv_ft2_hdrdir $OPTFLAGS" fi if test $ac_cv_fc_hdrdir != "/usr/include" ; then OPTFLAGS="-I$ac_cv_fc_hdrdir $OPTFLAGS" fi fi if test "$mgp_use_xft2" = "yes"; then AC_MSG_CHECKING(for xft2 library..) AC_CHECK_LIB(Xft, XftFontOpen, [LIBS="$LIBS -lXft -lfontconfig" AC_DEFINE(USE_XFT2) mgp_xft2_found=yes], [], [-lfontconfig]) fi fi fi if test "$mgp_xft2_found" = "yes"; then AC_MSG_CHECKING(for iconv..) AC_CHECK_FUNC(iconv_open, [AC_DEFINE(HAVE_ICONV)], [AC_CHECK_LIB(iconv, iconv_open, [LIBS="$LIBS -liconv"; AC_DEFINE(HAVE_ICONV)], [AC_CHECK_LIB(iconv, libiconv_open, [LIBS="$LIBS -liconv"; AC_DEFINE(HAVE_ICONV)])])]) fi AC_CHECK_HEADERS(fontconfig/fontconfig.h) AC_MSG_CHECKING(if gif handling is enabled) AC_ARG_ENABLE(gif, [ --enable-gif compile gif support in (need libungif).], [mgp_gif="$enableval"], [mgp_gif="no"]) AC_MSG_RESULT($mgp_gif) if test $mgp_gif = "yes"; then AC_CHECK_LIB(ungif, DGifOpenFileHandle, [gif_ok=yes GIFLIB="-lungif" AC_DEFINE(USE_GIF)], [AC_CHECK_LIB(gif, DGifOpenFileHandle, [gif_ok=yes GIFLIB="-lgif" AC_DEFINE(USE_GIF)], [AC_CHECK_LIB(ungif, DGifOpenFileName, [gif_ok=yes GIFLIB="-lungif" AC_DEFINE(USE_GIF)], [AC_CHECK_LIB(gif, DGifOpenFilename, [gif_ok=yes GIFLIB="-lgif" AC_DEFINE(USE_GIF)], [], [-L$x_libraries -lX11])], [-L$x_libraries -lX11])])]) if test "x$gif_ok" != "xyes"; then echo 'FATAL: You need libungif to use gif images. pass proper LIBS to configure.' exit 1 fi for i in /usr/pkg /usr/local /usr; do if test -f $i/include/gif_lib.h; then gif_h_ok=yes OPTFLAGS="$OPTFLAGS -I$i/include" break fi done if test -f /usr/include/gif_lib.h; then gif_h_ok=yes fi if test "x$gif_h_ok" != "xyes"; then echo 'FATAL: cannot find gif_lib.h. pass proper CPPFLAGS to configure.' exit 1 fi fi USE_IMLIB=0 AC_SUBST(USE_IMLIB) AC_MSG_CHECKING(if imlib is used) AC_ARG_ENABLE(imlib, [ --enable-imlib use imlib exclusively to load images.], [mgp_imlib="$enableval"], [mgp_imlib="no"]) AC_MSG_RESULT($mgp_imlib) if test $mgp_imlib = "yes"; then if type pkg-config > /dev/null 2>&1; then if pkg-config imlib; then LIBS="$LIBS `pkg-config --libs imlib`" OPTFLAGS="$OPTFLAGS `pkg-config --cflags imlib`" AC_DEFINE(USE_IMLIB) USE_IMLIB=1 fi else AC_CHECK_LIB(Imlib, Imlib_init, [imlib_ok=yes LIBS="$LIBS -lImlib" AC_DEFINE(USE_IMLIB) USE_IMLIB=1], [], [-L$x_libraries -lX11 -lXext]) if test "x$imlib_ok" != "xyes"; then echo 'FATAL: You need libImlib to use Imlib loading. pass proper LIBS to configure.' exit 1 fi for i in /usr/pkg /usr/local; do if test -f $i/include/Imlib.h; then imlib_h_ok=yes OPTFLAGS="$OPTFLAGS -I$i/include" break fi done if test -f /usr/include/Imlib.h; then imlib_h_ok=yes fi if test "x$imlib_h_ok" != "xyes"; then echo 'FATAL: cannot find Imlib.h. pass proper CPPFLAGS to configure.' exit 1 fi fi fi dnl add GIFLIB to LIBS if test -n "$GIFLIB"; then LIBS="$LIBS $GIFLIB" fi AC_ARG_WITH(m17n-lib, [ --with-m17n-lib use the m17n library]) if test "x$with_m17n_lib" = "xyes"; then AC_CHECK_PROG(HAVE_M17NLIB, m17n-config, yes) if test "x$HAVE_M17NLIB" = "xyes"; then AC_DEFINE(USE_M17N) OPTFLAGS="$OPTFLAGS `m17n-config X --cflags`" LIBS="$LIBS `m17n-config X --libs` -lm17n-core" fi fi dnl keyword substitution. mgp_keywords=`$mgp_cv_path_perl $srcdir/keywords.pl $srcdir/globals.c` AC_SUBST(mgp_keywords) AC_OUTPUT(Imakefile image/Imakefile sample/Imakefile contrib/mgp2html.pl contrib/mgp2latex.pl contrib/mgpnet mgpembed.pl) /bin/rm -f Makefile image/Makefile echo "be sure to generate Makefile from Imakefile, by xmkmf and make Makefiles"