dnl> test to find the hard-to-find libXpm dnl> mostly copied from AC_PATH_X & AC_PATH_DIRECT, but explictly set AC_DEFUN(VT_FIND_LIBXPM, [ AC_REQUIRE_CPP() # Initialize some more variables set by options. # The variables have the same names as the options, with # dashes changed to underlines. # If we find XPM, set shell vars xpm_includes and xpm_libraries to the # paths, otherwise set no_xpm=yes. # Uses ac_ vars as temps to allow command line to override cache and checks. AC_MSG_CHECKING(for libXpm) AC_ARG_WITH(xpm_includes, [ --with-xpm-includes=DIR use XPM includes in DIR], xpm_includes="$withval", xpm_includes=NO) AC_ARG_WITH(xpm_library, [ --with-xpm-library=DIR use XPM library in DIR], xpm_libraries="$withval", xpm_libraries=NO) # --without-xpm overrides everything else, but does not touch the cache. AC_ARG_WITH(xpm, [ --with-xpm use XPM]) if test "$with_xpm" = no; then have_xpm=disabled else AC_CACHE_VAL(ac_cv_have_xpm, [ vt_xpm_include_X11=no if test -n "$xpm_includes"; then vt_xpm_includes=$xpm_includes else vt_xpm_includes=NO fi if test -n "$xpm_libraries"; then vt_xpm_libraries=$xpm_libraries else vt_xpm_libraries=NO fi VT_XPM_DIRECT if test "$vt_xpm_includes" = NO -o "$vt_xpm_libraries" = NO; then ac_cv_have_xpm="have_xpm=no" else ac_cv_have_xpm="have_xpm=yes \ vt_xpm_includes=$vt_xpm_includes vt_xpm_libraries=$vt_xpm_libraries \ vt_xpm_include_X11=$vt_xpm_include_X11" fi])dnl eval "$ac_cv_have_xpm" fi if test "$have_xpm" != yes; then AC_MSG_RESULT($have_xpm) no_xpm=yes else if test "$xpm_includes" != NO; then if test "$xpm_includes" != "$vt_xpm_includes"; then vt_xpm_include_X11=no if test -z "$xpm_includes"; then AC_TRY_CPP([#include ], vt_xpm_include_X11=yes) else if test -r "$xpm_includes/X11/xpm.h"; then vt_xpm_include_X11=yes fi fi fi vt_xpm_includes=$xpm_includes fi if test "x$xpm_libraries" != xNO; then vt_xpm_libraries=$xpm_libraries fi # Update the cache value to reflect the command line values. ac_cv_have_xpm="have_xpm=yes \ vt_xpm_includes=$vt_xpm_includes vt_xpm_libraries=$vt_xpm_libraries \ vt_xpm_include_X11=$vt_xpm_include_X11" eval "$ac_cv_have_xpm" AC_MSG_RESULT([-I$vt_xpm_includes, -L$vt_xpm_libraries]) if test -n "$vt_xpm_includes"; then XPM_CPPFLAGS="-DHAVE_LIBXPM" fi if test -n "$vt_xpm_includes"; then XPM_CFLAGS="-I$vt_xpm_includes" fi XPM_LIBS="-lXpm" if test -n "$vt_xpm_libraries"; then XPM_LIBS="-L$vt_xpm_libraries $XPM_LIBS" dnl FIXME banish uname from this macro! # For Solaris; some versions of Sun CC require a space after -R and # others require no space. Words are not sufficient . . . . case "`(uname -sr) 2>/dev/null`" in "SunOS 5"*) AC_MSG_CHECKING(whether -R must be followed by a space) ac_xpmsave_LIBS="$LIBS"; LIBS="$LIBS -R$vt_xpm_libraries" AC_TRY_LINK(, , ac_R_nospace=yes, ac_R_nospace=no) if test $ac_R_nospace = yes; then AC_MSG_RESULT(no) XPM_LIBS="$XPM_LIBS -R$vt_xpm_libraries" else LIBS="$ac_xpmsave_LIBS -R $vt_xpm_libraries" AC_TRY_LINK(, , ac_R_space=yes, ac_R_space=no) if test $ac_R_space = yes; then AC_MSG_RESULT(yes) XPM_LIBS="$XPM_LIBS -R $vt_xpm_libraries" else AC_MSG_RESULT(neither works) fi fi LIBS="$ac_xpmsave_LIBS" esac fi if test "x$vt_xpm_include_X11" = xyes; then AC_DEFINE(XPM_INC_X11) fi fi AC_SUBST(XPM_CPPFLAGS) AC_SUBST(XPM_CFLAGS) AC_SUBST(XPM_LIBS) ]) dnl Internal subroutine of VT_FIND_LIBXPM dnl Set vt_xpm_include and vt_xpm_libr # -------------- find xpm.h and Xpm.a/Xpm.so/Xpm.sl AC_DEFUN(VT_XPM_DIRECT, [if test "$vt_xpm_includes" = NO; then # Guess where to find xpm.h # First, try using that file with no special directory specified. AC_TRY_CPP([#include ], [# We can compile using X headers with no special include directory. vt_xpm_includes= vt_xpm_include_X11=yes], [# Look for the header file in a standard set of common directories. for ac_dir in \ /usr/X11/include \ /usr/X11R6/include \ /usr/X11R5/include \ /usr/X11R4/include \ \ /usr/include/X11 \ /usr/include/X11R6 \ /usr/include/X11R5 \ /usr/include/X11R4 \ \ /usr/local/X11/include \ /usr/local/X11R6/include \ /usr/local/X11R5/include \ /usr/local/X11R4/include \ \ /usr/local/include/X11 \ /usr/local/include/X11R6 \ /usr/local/include/X11R5 \ /usr/local/include/X11R4 \ \ /usr/X386/include \ /usr/x386/include \ /usr/XFree86/include/X11 \ \ /usr/include \ /usr/local/include \ /usr/local/include/xpm \ /usr/unsupported/include \ /usr/athena/include \ /usr/local/x11r5/include \ /usr/lpp/Xamples/include \ \ /usr/openwin/include \ /usr/openwin/share/include \ ; \ do if test -r "$ac_dir/X11/xpm.h"; then vt_xpm_includes="$ac_dir" vt_xpm_include_X11=yes break else if test -r "$ac_dir/xpm.h"; then vt_xpm_includes=$ac_dir break fi fi done]) fi if test "$vt_xpm_libraries" = NO; then # Check for the libraries. # See if we find them without any special options. # Don't add to $LIBS permanently. ac_save_LIBS="$LIBS" LIBS="-lXpm $LIBS" AC_TRY_LINK(, [XpmReadFileToPixmap()], [LIBS="$ac_save_LIBS" # We can link libXpm with no special library path. vt_xpm_libraries=], [LIBS="$ac_save_LIBS" # First see if replacing the include by lib works. for ac_dir in \ `echo "$vt_xpm_includes" | sed 's,include/X11,lib,;s,include,lib,'` \ /usr/X11/lib \ /usr/X11R6/lib \ /usr/X11R5/lib \ /usr/X11R4/lib \ \ /usr/lib/X11 \ /usr/lib/X11R6 \ /usr/lib/X11R5 \ /usr/lib/X11R4 \ \ /usr/local/X11/lib \ /usr/local/X11R6/lib \ /usr/local/X11R5/lib \ /usr/local/X11R4/lib \ \ /usr/local/lib/X11 \ /usr/local/lib/X11R6 \ /usr/local/lib/X11R5 \ /usr/local/lib/X11R4 \ \ /usr/X386/lib \ /usr/x386/lib \ /usr/XFree86/lib/X11 \ \ /usr/lib \ /usr/local/lib \ /usr/local/lib/xpm \ /usr/unsupported/lib \ /usr/athena/lib \ /usr/local/x11r5/lib \ /usr/lpp/Xamples/lib \ \ /usr/openwin/lib \ /usr/openwin/share/lib \ ; \ do dnl XXX Shouldn't this really use AC_TRY_LINK to be portable & robust?? for ac_extension in a so sl; do if test -r $ac_dir/libXpm.$ac_extension; then vt_xpm_libraries=$ac_dir break 2 fi done done]) fi ]) ########################################################################## AC_DEFUN(VT_FIND_LIBZLIB, [ AC_REQUIRE_CPP() # Initialize some more variables set by options. # The variables have the same names as the options, with # dashes changed to underlines. # If we find ZLIB, set shell vars zlib_includes and zlib_libraries to the # paths, otherwise set no_zlib=yes. # Uses ac_ vars as temps to allow command line to override cache and checks. AC_MSG_CHECKING(for zlib) AC_ARG_WITH(zlib_includes, [ --with-zlib-includes=DIR use ZLIB includes in DIR], zlib_includes="$withval", zlib_includes=NO) AC_ARG_WITH(zlib_library, [ --with-zlib-library=DIR use ZLIB library in DIR], zlib_libraries="$withval", zlib_libraries=NO) # --without-zlib overrides everything else, but does not touch the cache. AC_ARG_WITH(zlib, [ --with-zlib use ZLIB]) if test "$with_zlib" = no; then have_zlib=disabled else AC_CACHE_VAL(ac_cv_have_zlib, [ if test -n "$zlib_includes"; then vt_zlib_includes=$zlib_includes else vt_zlib_includes=NO fi if test -n "$zlib_libraries"; then vt_zlib_libraries=$zlib_libraries else vt_zlib_libraries=NO fi VT_ZLIB_DIRECT if test "$vt_zlib_includes" = NO -o "$vt_zlib_libraries" = NO; then ac_cv_have_zlib="have_zlib=no" else ac_cv_have_zlib="have_zlib=yes \ vt_zlib_includes=$vt_zlib_includes vt_zlib_libraries=$vt_zlib_libraries" fi])dnl eval "$ac_cv_have_zlib" fi if test "$have_zlib" != yes; then AC_MSG_RESULT($have_zlib) no_zlib=yes else if test "$zlib_includes" != NO; then if test "$zlib_includes" != "$vt_zlib_includes"; then vt_zlib_include_X11=no if test -z "$zlib_includes"; then AC_TRY_CPP([#include ], ) else if test -r "$zlib_includes/zlib.h"; then vt_zlib_include_X11=yes fi fi fi vt_zlib_includes=$zlib_includes fi if test "x$zlib_libraries" != xNO; then vt_zlib_libraries=$zlib_libraries fi # Update the cache value to reflect the command line values. ac_cv_have_zlib="have_zlib=yes \ vt_zlib_includes=$vt_zlib_includes vt_zlib_libraries=$vt_zlib_libraries " eval "$ac_cv_have_zlib" AC_MSG_RESULT([-I$vt_zlib_includes, -L$vt_zlib_libraries]) if test -n "$vt_zlib_includes"; then ZLIB_CPPFLAGS="-DHAVE_LIBZLIB" fi if test -n "$vt_zlib_includes"; then ZLIB_CFLAGS="-I$vt_zlib_includes" fi ZLIB_LIBS="-lz" if test -n "$vt_zlib_libraries"; then ZLIB_LIBS="-L$vt_zlib_libraries $ZLIB_LIBS" dnl FIXME banish uname from this macro! # For Solaris; some versions of Sun CC require a space after -R and # others require no space. Words are not sufficient . . . . case "`(uname -sr) 2>/dev/null`" in "SunOS 5"*) AC_MSG_CHECKING(whether -R must be followed by a space) ac_zsave_LIBS="$LIBS"; LIBS="$LIBS -R$vt_zlib_libraries" AC_TRY_LINK(, , ac_R_nospace=yes, ac_R_nospace=no) if test $ac_R_nospace = yes; then AC_MSG_RESULT(no) ZLIB_LIBS="$ZLIB_LIBS -R$vt_zlib_libraries" else LIBS="$ac_zsave_LIBS -R $vt_zlib_libraries" AC_TRY_LINK(, , ac_R_space=yes, ac_R_space=no) if test $ac_R_space = yes; then AC_MSG_RESULT(yes) ZLIB_LIBS="$ZLIB_LIBS -R $vt_zlib_libraries" else AC_MSG_RESULT(neither works) fi fi LIBS="$ac_zsave_LIBS" esac fi fi AC_SUBST(ZLIB_CPPFLAGS) AC_SUBST(ZLIB_CFLAGS) AC_SUBST(ZLIB_LIBS) ]) dnl Internal subroutine of VT_FIND_LIBZLIB dnl Set vt_zlib_include and vt_zlib_libr # -------------- find zlib.h and libz.a/libz.so/libz.sl/libgz.a/libgz.sl AC_DEFUN(VT_ZLIB_DIRECT, [if test "$vt_zlib_includes" = NO; then # Guess where to find zlib.h # First, try using that file with no special directory specified. AC_TRY_CPP([#include ], [# We can compile using headers with no special include directory. vt_zlib_includes= vt_zlib_include_X11=yes], [# Look for the header file in a standard set of common directories. for ac_dir in \ /usr/include \ /usr/local/include \ /usr/local/include/zlib \ /usr/unsupported/include \ ; \ do if test -r "$ac_dir/zlib.h"; then vt_zlib_includes="$ac_dir" break fi done]) fi if test "$vt_zlib_libraries" = NO; then # Check for the libraries. # See if we find them without any special options. # Don't add to $LIBS permanently. ac_save_LIBS="$LIBS" LIBS="-lz $LIBS" AC_TRY_LINK([#include ], [gzclose()], [LIBS="$ac_save_LIBS" # We can link libz with no special library path. vt_zlib_libraries=], [LIBS="$ac_save_LIBS" # First see if replacing the include by lib works. for ac_dir in \ `echo "$vt_zlib_includes" | sed 's,include,lib,'` \ /usr/lib \ /usr/local/lib \ /usr/local/lib/zlib \ /usr/unsupported/lib \ ; \ do dnl XXX Shouldn't this really use AC_TRY_LINK to be portable & robust?? for ac_extension in so sl a; do if test -r $ac_dir/libz.$ac_extension; then vt_zlib_libraries=$ac_dir break 2 else if test -r $ac_dir/libgz.$ac_extension; then vt_zlib_libraries=$ac_dir break 2 fi fi done done]) fi ])