ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/autoconf/xpm.m4
Revision: 1.4
Committed: Thu Jan 19 08:07:52 2006 UTC (18 years, 4 months ago) by root
Branch: MAIN
CVS Tags: HEAD
Changes since 1.3: +0 -0 lines
State: FILE REMOVED
Log Message:
*** empty log message ***

File Contents

# Content
1 dnl> test to find the hard-to-find libXpm
2 dnl> mostly copied from AC_PATH_X & AC_PATH_DIRECT, but explictly set
3
4 AC_DEFUN(VT_FIND_LIBXPM,
5 [
6 AC_REQUIRE_CPP()
7
8 # Initialize some more variables set by options.
9 # The variables have the same names as the options, with
10 # dashes changed to underlines.
11
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)
16
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)
23
24 # --without-xpm overrides everything else, but does not touch the cache.
25 AC_ARG_WITH(xpm,
26 [ --with-xpm use XPM])
27 if test "$with_xpm" = no; then
28 have_xpm=disabled
29 else
30 AC_CACHE_VAL(ac_cv_have_xpm, [
31 vt_xpm_include_X11=no
32 if test -n "$xpm_includes"; then
33 vt_xpm_includes=$xpm_includes
34 else
35 vt_xpm_includes=NO
36 fi
37 if test -n "$xpm_libraries"; then
38 vt_xpm_libraries=$xpm_libraries
39 else
40 vt_xpm_libraries=NO
41 fi
42
43 VT_XPM_DIRECT
44
45 if test "$vt_xpm_includes" = NO -o "$vt_xpm_libraries" = NO; then
46 ac_cv_have_xpm="have_xpm=no"
47 else
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"
51 fi])dnl
52 eval "$ac_cv_have_xpm"
53 fi
54
55 if test "$have_xpm" != yes; then
56 AC_MSG_RESULT($have_xpm)
57 no_xpm=yes
58 else
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
63 fi
64 else
65 vt_xpm_include_X11=no
66 if test -z "$xpm_includes"; then
67 AC_TRY_CPP([#include <X11/xpm.h>],
68 vt_xpm_include_X11=yes)
69 else
70 if test -r "$xpm_includes/X11/xpm.h"; then
71 vt_xpm_include_X11=yes
72 fi
73 fi
74 fi
75 vt_xpm_includes=$xpm_includes
76 fi
77 if test "x$xpm_libraries" != xNO; then
78 vt_xpm_libraries=$xpm_libraries
79 fi
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"
88 fi
89 if test -n "$vt_xpm_includes"; then
90 XPM_CFLAGS="-I$vt_xpm_includes"
91 fi
92 XPM_LIBS="-lXpm"
93 if test -n "$vt_xpm_libraries"; then
94 XPM_LIBS="-L$vt_xpm_libraries $XPM_LIBS"
95 fi
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))
98 fi
99 fi
100
101 AC_SUBST(XPM_CPPFLAGS)
102 AC_SUBST(XPM_CFLAGS)
103 AC_SUBST(XPM_LIBS)
104 ])
105
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
112
113 ac_save_CPPFLAGS="$CPPFLAGS"
114 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
115
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.
119 vt_xpm_includes=
120 vt_xpm_include_X11=yes],
121 [CPPFLAGS="$ac_save_CPPFLAGS"
122 # Look for the header file in a standard set of common directories.
123 for ac_dir in \
124 /usr/X11/include \
125 /usr/X11R6/include \
126 /usr/X11R5/include \
127 /usr/X11R4/include \
128 \
129 /usr/include/X11 \
130 /usr/include/X11R6 \
131 /usr/include/X11R5 \
132 /usr/include/X11R4 \
133 \
134 /usr/local/X11/include \
135 /usr/local/X11R6/include \
136 /usr/local/X11R5/include \
137 /usr/local/X11R4/include \
138 \
139 /usr/local/include/X11 \
140 /usr/local/include/X11R6 \
141 /usr/local/include/X11R5 \
142 /usr/local/include/X11R4 \
143 \
144 /usr/X386/include \
145 /usr/x386/include \
146 /usr/XFree86/include/X11 \
147 \
148 /usr/include \
149 /usr/local/include \
150 /usr/unsupported/include \
151 /usr/athena/include \
152 /usr/local/x11r5/include \
153 /usr/lpp/Xamples/include \
154 \
155 /usr/openwin/include \
156 /usr/openwin/share/include \
157 ; \
158 do
159 if test -r "$ac_dir/X11/xpm.h"; then
160 vt_xpm_includes="$ac_dir"
161 vt_xpm_include_X11=yes
162 break
163 else
164 if test -r "$ac_dir/xpm.h"; then
165 vt_xpm_includes=$ac_dir
166 break
167 fi
168 fi
169 done])
170 fi
171
172 if test "$vt_xpm_libraries" = NO; then
173 # Check for the libraries.
174
175 # See if we find them without any special options.
176 # Don't add to $LIBS permanently.
177 ac_save_LIBS="$LIBS"
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.
182 vt_xpm_libraries=],
183 [LIBS="$ac_save_LIBS"
184 # First see if replacing the include by lib works.
185 for ac_dir in \
186 `echo "$vt_xpm_includes" | sed 's,include/X11,lib,;s,include,lib,'` \
187 /usr/X11/lib \
188 /usr/X11R6/lib \
189 /usr/X11R5/lib \
190 /usr/X11R4/lib \
191 \
192 /usr/lib/X11 \
193 /usr/lib/X11R6 \
194 /usr/lib/X11R5 \
195 /usr/lib/X11R4 \
196 \
197 /usr/local/X11/lib \
198 /usr/local/X11R6/lib \
199 /usr/local/X11R5/lib \
200 /usr/local/X11R4/lib \
201 \
202 /usr/local/lib/X11 \
203 /usr/local/lib/X11R6 \
204 /usr/local/lib/X11R5 \
205 /usr/local/lib/X11R4 \
206 \
207 /usr/X386/lib \
208 /usr/x386/lib \
209 /usr/XFree86/lib/X11 \
210 \
211 /usr/lib \
212 /usr/local/lib \
213 /usr/unsupported/lib \
214 /usr/athena/lib \
215 /usr/local/x11r5/lib \
216 /usr/lpp/Xamples/lib \
217 \
218 /usr/openwin/lib \
219 /usr/openwin/share/lib \
220 ; \
221 do
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
226 break 2
227 fi
228 done
229 done])
230 fi
231 ])