1 dnl> test to find the hard-to-find libXpm
2 dnl> mostly copied from AC_PATH_X & AC_PATH_DIRECT, but explictly set
4 AC_DEFUN(VT_FIND_LIBXPM,
8 # Initialize some more variables set by options.
9 # The variables have the same names as the options, with
10 # dashes changed to underlines.
12 # If we find XPM, set shell vars xpm_includes and xpm_libraries to the
13 # paths, otherwise set no_xpm=yes.
14 # Uses ac_ vars as temps to allow command line to override cache and checks.
15 AC_MSG_CHECKING(for libXpm)
17 AC_ARG_WITH(xpm_includes,
18 [ --with-xpm-includes=DIR use XPM includes in DIR],
19 xpm_includes="$withval", xpm_includes=NO)
20 AC_ARG_WITH(xpm_library,
21 [ --with-xpm-library=DIR use XPM library in DIR],
22 xpm_libraries="$withval", xpm_libraries=NO)
24 # --without-xpm overrides everything else, but does not touch the cache.
26 [ --with-xpm use XPM])
27 if test "$with_xpm" = no; then
30 AC_CACHE_VAL(ac_cv_have_xpm, [
32 if test -n "$xpm_includes"; then
33 vt_xpm_includes=$xpm_includes
37 if test -n "$xpm_libraries"; then
38 vt_xpm_libraries=$xpm_libraries
45 if test "$vt_xpm_includes" = NO -o "$vt_xpm_libraries" = NO; then
46 ac_cv_have_xpm="have_xpm=no"
48 ac_cv_have_xpm="have_xpm=yes \
49 vt_xpm_includes=$vt_xpm_includes vt_xpm_libraries=$vt_xpm_libraries \
50 vt_xpm_include_X11=$vt_xpm_include_X11"
52 eval "$ac_cv_have_xpm"
55 if test "$have_xpm" != yes; then
56 AC_MSG_RESULT($have_xpm)
59 if test "$xpm_includes" != NO; then
60 if test "$xpm_includes" = "$vt_xpm_includes"; then
61 if test -r "$xpm_includes/X11/xpm.h"; then
62 vt_xpm_include_X11=yes
66 if test -z "$xpm_includes"; then
67 AC_TRY_CPP([#include <X11/xpm.h>],
68 vt_xpm_include_X11=yes)
70 if test -r "$xpm_includes/X11/xpm.h"; then
71 vt_xpm_include_X11=yes
75 vt_xpm_includes=$xpm_includes
77 if test "x$xpm_libraries" != xNO; then
78 vt_xpm_libraries=$xpm_libraries
80 # Update the cache value to reflect the command line values.
81 ac_cv_have_xpm="have_xpm=yes \
82 vt_xpm_includes=$vt_xpm_includes vt_xpm_libraries=$vt_xpm_libraries \
83 vt_xpm_include_X11=$vt_xpm_include_X11"
84 eval "$ac_cv_have_xpm"
85 AC_MSG_RESULT([-I$vt_xpm_includes, -L$vt_xpm_libraries])
86 if test -n "$vt_xpm_includes"; then
87 XPM_CPPFLAGS="-DHAVE_LIBXPM"
89 if test -n "$vt_xpm_includes"; then
90 XPM_CFLAGS="-I$vt_xpm_includes"
93 if test -n "$vt_xpm_libraries"; then
94 XPM_LIBS="-L$vt_xpm_libraries $XPM_LIBS"
96 if test "x$vt_xpm_include_X11" = xyes; then
97 AC_DEFINE(XPM_INC_X11, 1, Define if you include <X11/xpm.h> on a normal include path (be careful))
101 AC_SUBST(XPM_CPPFLAGS)
106 dnl Internal subroutine of VT_FIND_LIBXPM
107 dnl Set vt_xpm_include and vt_xpm_libr
108 # -------------- find xpm.h and Xpm.a/Xpm.so/Xpm.sl
109 AC_DEFUN(VT_XPM_DIRECT,
110 [if test "$vt_xpm_includes" = NO; then
111 # Guess where to find xpm.h
113 ac_save_CPPFLAGS="$CPPFLAGS"
114 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
116 # First, try using that file with no special directory specified.
117 AC_TRY_CPP([#include <X11/xpm.h>],
118 [# We can compile using X headers with no special include directory.
120 vt_xpm_include_X11=yes],
121 [CPPFLAGS="$ac_save_CPPFLAGS"
122 # Look for the header file in a standard set of common directories.
134 /usr/local/X11/include \
135 /usr/local/X11R6/include \
136 /usr/local/X11R5/include \
137 /usr/local/X11R4/include \
139 /usr/local/include/X11 \
140 /usr/local/include/X11R6 \
141 /usr/local/include/X11R5 \
142 /usr/local/include/X11R4 \
146 /usr/XFree86/include/X11 \
150 /usr/unsupported/include \
151 /usr/athena/include \
152 /usr/local/x11r5/include \
153 /usr/lpp/Xamples/include \
155 /usr/openwin/include \
156 /usr/openwin/share/include \
159 if test -r "$ac_dir/X11/xpm.h"; then
160 vt_xpm_includes="$ac_dir"
161 vt_xpm_include_X11=yes
164 if test -r "$ac_dir/xpm.h"; then
165 vt_xpm_includes=$ac_dir
172 if test "$vt_xpm_libraries" = NO; then
173 # Check for the libraries.
175 # See if we find them without any special options.
176 # Don't add to $LIBS permanently.
178 LIBS="$LIBS $X_LIBS -lXpm -lX11"
179 AC_TRY_LINK(, [XpmReadFileToPixmap()],
180 [LIBS="$ac_save_LIBS"
181 # We can link libXpm with no special library path.
183 [LIBS="$ac_save_LIBS"
184 # First see if replacing the include by lib works.
186 `echo "$vt_xpm_includes" | sed 's,include/X11,lib,;s,include,lib,'` \
198 /usr/local/X11R6/lib \
199 /usr/local/X11R5/lib \
200 /usr/local/X11R4/lib \
203 /usr/local/lib/X11R6 \
204 /usr/local/lib/X11R5 \
205 /usr/local/lib/X11R4 \
209 /usr/XFree86/lib/X11 \
213 /usr/unsupported/lib \
215 /usr/local/x11r5/lib \
216 /usr/lpp/Xamples/lib \
219 /usr/openwin/share/lib \
222 dnl XXX Shouldn't this really use AC_TRY_LINK to be portable & robust??
223 for ac_extension in a so sl; do
224 if test -r $ac_dir/libXpm.$ac_extension; then
225 vt_xpm_libraries=$ac_dir