1 dnl
2 dnl AC_FIND_MOTIF : find OSF/Motif or LessTif, and provide variables
3 dnl to easily use them in a Makefile.
4 dnl
5 dnl Adapted from a macro by Andreas Zeller.
6 dnl
7 dnl The variables provided are :
8 dnl link_motif (e.g. -L/usr/lesstif/lib -lXm)
9 dnl include_motif (e.g. -I/usr/lesstif/lib)
10 dnl motif_libraries (e.g. /usr/lesstif/lib)
11 dnl motif_includes (e.g. /usr/lesstif/include)
12 dnl
13 dnl The link_motif and include_motif variables should be fit to put on
14 dnl your application's link line in your Makefile.
15 dnl
16 dnl Oleo CVS Id: motif.m4,v 1.9 1999/04/09 11:46:49 danny
17 dnl LessTif CVS $Id: acinclude.m4,v 1.2 2004/12/06 22:05:08 paul Exp $
18 dnl
19 AC_DEFUN([AC_FIND_MOTIF],
20 [
21
22 AC_REQUIRE([AC_PATH_XTRA])
23 AC_REQUIRE([AC_FIND_LIBXP])
24
25 motif_includes=
26 motif_libraries=
27
28 dnl AC_ARG_WITH(motif,
29 dnl [ --without-motif do not use Motif widgets])
30 dnl Treat --without-motif like
31 dnl --without-motif-includes --without-motif-libraries.
32 dnl if test "$with_motif" = "no"
33 dnl then
34 dnl motif_includes=none
35 dnl motif_libraries=none
36 dnl fi
37
38 AC_ARG_WITH(motif-includes,
39 [ --with-motif-includes=DIR Motif include files are in DIR],
40 motif_includes="$withval")
41
42 AC_ARG_WITH(motif-libraries,
43 [ --with-motif-libraries=DIR Motif libraries are in DIR],
44 motif_libraries="$withval")
45
46 AC_MSG_CHECKING(for Motif)
47
48 #
49 #
50 # Search the include files.
51 #
52 if test "$motif_includes" = ""; then
53 AC_CACHE_VAL(ac_cv_motif_includes,
54 [
55 ac_motif_save_LIBS="$LIBS"
56 ac_motif_save_INCLUDES="$INCLUDES"
57 ac_motif_save_CPPFLAGS="$CPPFLAGS"
58 ac_motif_save_LDFLAGS="$LDFLAGS"
59 #
60 LIBS="$X_PRE_LIBS -lXm -lXt -lX11 $X_EXTRA_LIBS $LIBS"
61 INCLUDES="$X_CFLAGS $INCLUDES"
62 CPPFLAGS="$X_CFLAGS $CPPFLAGS"
63 LDFLAGS="$X_LIBS $LDFLAGS"
64 #
65 ac_cv_motif_includes="none"
66 AC_TRY_COMPILE([#include <Xm/Xm.h>],[int a;],
67 [
68 # Xm/Xm.h is in the standard search path.
69 ac_cv_motif_includes=
70 ],
71 [
72 # Xm/Xm.h is not in the standard search path.
73 # Locate it and put its directory in `motif_includes'
74 #
75 # /usr/include/Motif* are used on HP-UX (Motif).
76 # /usr/include/X11* are used on HP-UX (X and Athena).
77 # /usr/dt is used on Solaris (Motif).
78 # /usr/openwin is used on Solaris (X and Athena).
79 # Other directories are just guesses.
80 for dir in "$x_includes" "${prefix}/include" /usr/include /usr/local/include \
81 /usr/include/Motif2.1 /usr/include/Motif2.0 /usr/include/Motif1.2 \
82 /usr/include/X11 /usr/include/X11R6 /usr/include/X11R5 \
83 /usr/X11/include /usr/X11R6/include /usr/X11R5/include \
84 /usr/dt/include /usr/openwin/include \
85 /usr/dt/*/include /opt/*/include /usr/include/Motif* \
86 "${prefix}"/*/include /usr/*/include /usr/local/*/include \
87 "${prefix}"/include/* /usr/include/* /usr/local/include/*; do
88 if test -f "$dir/Xm/Xm.h"; then
89 ac_cv_motif_includes="$dir"
90 break
91 fi
92 done
93 ])
94 #
95 LIBS="$ac_motif_save_LIBS"
96 INCLUDES="$ac_motif_save_INCLUDES"
97 CPPFLAGS="$ac_motif_save_CPPFLAGS"
98 LDFLAGS="$ac_motif_save_LDFLAGS"
99 ])
100 motif_includes="$ac_cv_motif_includes"
101 fi
102 #
103 #
104 # Now for the libraries.
105 #
106 if test "$motif_libraries" = ""; then
107 AC_CACHE_VAL(ac_cv_motif_libraries,
108 [
109 ac_motif_save_LIBS="$LIBS"
110 ac_motif_save_INCLUDES="$INCLUDES"
111 ac_motif_save_CPPFLAGS="$CPPFLAGS"
112 ac_motif_save_LDFLAGS="$LDFLAGS"
113 #
114 LIBS="$X_PRE_LIBS -lXm -lXt -lX11 $X_EXTRA_LIBS $LIBS"
115 INCLUDES="$X_CFLAGS $INCLUDES"
116 CPPFLAGS="$X_CFLAGS $CPPFLAGS"
117 LDFLAGS="$X_LIBS $LDFLAGS"
118 #
119 ac_cv_motif_libraries="none"
120 AC_TRY_LINK([#include <Xm/Xm.h>],[XtToolkitInitialize();],
121 [
122 # libXm.a is in the standard search path.
123 ac_cv_motif_libraries=
124 ],
125 [
126 # libXm.a is not in the standard search path.
127 # Locate it and put its directory in `motif_libraries'
128 #
129 # /usr/lib/Motif* are used on HP-UX (Motif).
130 # /usr/lib/X11* are used on HP-UX (X and Athena).
131 # /usr/dt is used on Solaris (Motif).
132 # /usr/lesstif is used on Linux (Lesstif).
133 # /usr/openwin is used on Solaris (X and Athena).
134 # Other directories are just guesses.
135 for dir in "$x_libraries" "${prefix}/lib" /usr/lib /usr/local/lib \
136 /usr/lib/Motif2.1 /usr/lib/Motif2.0 /usr/lib/Motif1.2 \
137 /usr/lib/X11 /usr/lib/X11R6 /usr/lib/X11R5 \
138 /usr/X11/lib /usr/X11R6/lib /usr/X11R5/lib \
139 /usr/dt/lib /usr/openwin/lib \
140 /usr/dt/*/lib /opt/*/lib /usr/lib/Motif* \
141 /usr/lesstif*/lib /usr/lib/Lesstif* \
142 "${prefix}"/*/lib /usr/*/lib /usr/local/*/lib \
143 "${prefix}"/lib/* /usr/lib/* /usr/local/lib/*; do
144 if test -d "$dir" && test "`ls $dir/libXm.* 2> /dev/null`" != ""; then
145 ac_cv_motif_libraries="$dir"
146 break
147 fi
148 done
149 ])
150 #
151 LIBS="$ac_motif_save_LIBS"
152 INCLUDES="$ac_motif_save_INCLUDES"
153 CPPFLAGS="$ac_motif_save_CPPFLAGS"
154 LDFLAGS="$ac_motif_save_LDFLAGS"
155 ])
156 #
157 motif_libraries="$ac_cv_motif_libraries"
158 fi
159 #
160 # Provide an easier way to link
161 #
162 if test "$motif_includes" = "none" -o "$motif_libraries" = "none"; then
163 with_motif="no"
164 else
165 with_motif="yes"
166 fi
167
168 AC_FIND_LIBXP
169 if test "$LT_HAVE_XP" = "yes"; then
170 XPLIB="-lXp -lXext"
171 else
172 XPLIB=""
173 fi
174
175 if test "$with_motif" != "no"; then
176 if test "$motif_libraries" = ""; then
177 link_motif="-lXm $XPLIB"
178 MOTIF_LIBS="-lXm $XPLIB"
179 else
180 link_motif="-L$motif_libraries -lXm $XPLIB"
181 MOTIF_LIBS="-L$motif_libraries -lXm $XPLIB"
182 fi
183 if test "$motif_includes" != ""; then
184 include_motif="-I$motif_includes"
185 MOTIF_CFLAGS="-I$motif_includes"
186 fi
187 # remove this until we find a use for it
188 # a.lacey@man.ac.uk
189 # AC_DEFINE(HAVE_MOTIF)
190 else
191 with_motif="no"
192 fi
193 #
194 AC_SUBST(link_motif)
195 AC_SUBST(include_motif)
196 AC_SUBST(MOTIF_CFLAGS)
197 AC_SUBST(MOTIF_LIBS)
198 #
199 #
200 #
201 motif_libraries_result="$motif_libraries"
202 motif_includes_result="$motif_includes"
203 test "$motif_libraries_result" = "" && motif_libraries_result="in default path"
204 test "$motif_includes_result" = "" && motif_includes_result="in default path"
205 test "$motif_libraries_result" = "none" && motif_libraries_result="(none)"
206 test "$motif_includes_result" = "none" && motif_includes_result="(none)"
207 AC_MSG_RESULT(
208 [libraries $motif_libraries_result, headers $motif_includes_result])
209 ])dnl
210
211 dnl
212 dnl Check for libXp
213 dnl In fact this check ensures that
214 dnl - <X11/extensions/Print.h> and
215 dnl - both libXp libXext
216 dnl are in place
217 dnl Note that a simpler check only for the libraries would not
218 dnl be sufficient perhaps.
219 dnl If the test succeeds it defines Have_Libxp within our
220 dnl Makefiles. Perhaps one should immediately add those libs
221 dnl to link commands which include libXm version2.1?!
222 dnl
223 AC_DEFUN([AC_FIND_LIBXP],
224 [AC_REQUIRE([AC_PATH_X])
225 AC_CACHE_CHECK(whether libXp is available, lt_cv_libxp,
226 [lt_save_CFLAGS="$CFLAGS"
227 lt_save_CPPFLAGS="$CPPFLAGS"
228 lt_save_LIBS="$LIBS"
229 LIBS="$X_LIBS -lXp -lXext -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS $LIBS"
230 CFLAGS="$X_CFLAGS $CFLAGS"
231 CPPFLAGS="$X_CFLAGS $CPPFLAGS"
232 AC_TRY_LINK([
233 #include <X11/Intrinsic.h>
234 #include <X11/extensions/Print.h>
235 ],[
236 int main() {
237 Display *display=NULL;
238 short major_version, minor_version;
239 Status rc;
240 rc=XpQueryVersion(display, &major_version, &minor_version);
241 exit(0);
242 }
243 ],
244 lt_cv_libxp=yes,
245 lt_cv_libxp=no)
246 ])
247 if test "$lt_cv_libxp" = "yes"; then
248 # remove this until we find a use for it
249 # a.lacey@man.ac.uk
250 # AC_DEFINE(HAVE_LIB_XP)
251 LT_HAVE_XP="yes"
252 else
253 LT_HAVE_XP="no"
254 fi
255 AM_CONDITIONAL(Have_Libxp, test "$lt_cv_libxp" = "yes")
256 AC_SUBST(LT_HAVE_XP)
257 CFLAGS="$lt_save_CFLAGS"
258 CPPFLAGS="$lt_save_CPPFLAGS"
259 LIBS="$lt_save_LIBS"
260 ])
261
262 dnl
263 dnl AC_FIND_XVIEW
264 dnl
265 dnl Adapted from a Xview (Lesstif) Macro
266 dnl a.lacey@man.ac.uk
267 dnl
268 dnl The variables provided are :
269 dnl link_xview
270 dnl include_xview
271 dnl xview_libraries
272 dnl xview_includes
273 dnl
274 dnl The link_xview and include_xview variables should be fit to put on
275 dnl your application's link line in your Makefile.
276 dnl
277 dnl $Id: acinclude.m4,v 1.2 2004/12/06 22:05:08 paul Exp $
278 dnl
279
280 AC_DEFUN([AC_FIND_XVIEW],
281 [
282
283 AC_REQUIRE([AC_PATH_XTRA])
284 AC_REQUIRE([AC_FIND_LIBXP])
285
286 xview_includes=
287 xview_libraries=
288
289 dnl AC_ARG_WITH(xview,
290 dnl [ --without-xview do not use Xview widgets])
291 dnl Treat --without-xview like
292 dnl --without-xview-includes --without-xview-libraries.
293 dnl if test "$with_xview" = "no"
294 dnl then
295 dnl xview_includes=none
296 dnl xview_libraries=none
297 dnl fi
298
299 AC_ARG_WITH(xview-includes,
300 [ --with-xview-includes=DIR Xview include files are in DIR],
301 xview_includes="$withval")
302
303 AC_ARG_WITH(xview-libraries,
304 [ --with-xview-libraries=DIR Xview libraries are in DIR],
305 xview_libraries="$withval")
306
307 AC_MSG_CHECKING(for Xview)
308
309 #
310 #
311 # Search the include files.
312 #
313 if test "$xview_includes" = ""; then
314 AC_CACHE_VAL(ac_cv_xview_includes,
315 [
316 ac_xview_save_LIBS="$LIBS"
317 ac_xview_save_INCLUDES="$INCLUDES"
318 ac_xview_save_CPPFLAGS="$CPPFLAGS"
319 ac_xview_save_LDFLAGS="$LDFLAGS"
320 #
321 LIBS="$X_PRE_LIBS -lxview -lolgx -lX11 $X_EXTRA_LIBS $LIBS"
322 INCLUDES="$X_CFLAGS $INCLUDES"
323 CPPFLAGS="$X_CFLAGS $CPPFLAGS"
324 LDFLAGS="$X_LIBS $LDFLAGS"
325 #
326 ac_cv_xview_includes="none"
327 AC_TRY_COMPILE([#include <xview/xview.h>],[int a;],
328 [
329 # xview/xview.h is in the standard search path.
330 ac_cv_xview_includes=
331 ],
332 [
333 # xview/xview.h is not in the standard search path.
334 # Locate it and put its directory in `xview_includes'
335 #
336 # /usr/openwin is used on Solaris and Linux (usually).
337 # Other directories are just guesses.
338 for dir in "$x_includes" "${prefix}/include" /usr/include /usr/local/include \
339 /usr/openwin/include /usr/X11/include /usr/X11R6/include \
340 /usr/X11R5/include /usr/dt/include \
341 /usr/dt/*/include /opt/*/include /usr/include/xview* \
342 "${prefix}"/*/include /usr/*/include /usr/local/*/include \
343 "${prefix}"/include/* /usr/include/* /usr/local/include/*; do
344 if test -f "$dir/xview/xview.h"; then
345 ac_cv_xview_includes="$dir"
346 break
347 fi
348 done
349 ])
350 #
351 LIBS="$ac_xview_save_LIBS"
352 INCLUDES="$ac_xview_save_INCLUDES"
353 CPPFLAGS="$ac_xview_save_CPPFLAGS"
354 LDFLAGS="$ac_xview_save_LDFLAGS"
355 ])
356 xview_includes="$ac_cv_xview_includes"
357 fi
358 #
359 #
360 # Now for the libraries.
361 #
362 if test "$xview_libraries" = ""; then
363 AC_CACHE_VAL(ac_cv_xview_libraries,
364 [
365 ac_xview_save_LIBS="$LIBS"
366 ac_xview_save_INCLUDES="$INCLUDES"
367 ac_xview_save_CPPFLAGS="$CPPFLAGS"
368 ac_xview_save_LDFLAGS="$LDFLAGS"
369 #
370 LIBS="$X_PRE_LIBS -lxview -lolgx -lX11 $X_EXTRA_LIBS $LIBS"
371 INCLUDES="$X_CFLAGS $INCLUDES"
372 CPPFLAGS="$X_CFLAGS $CPPFLAGS"
373 LDFLAGS="$X_LIBS $LDFLAGS"
374 #
375 ac_cv_xview_libraries="none"
376 AC_TRY_LINK([#include <xview/xview.h>],[xv_set();],
377 [
378 # libxview.a and libolgx are in the standard search path.
379 ac_cv_xview_libraries=
380 ],
381 [
382 # libxview.a libolgx are not in the standard search path.
383 # Locate it and put its directory in `xview_libraries'
384 #
385 # /usr/openwin is used on Solaris and Linux
386 # Other directories are just guesses.
387 for dir in "$x_libraries" "${prefix}/lib" /usr/lib /usr/local/lib \
388 /usr/openwin/lib /usr/X11/lib /usr/X11R6/lib /usr/X11R5/lib \
389 /usr/dt/lib /usr/openwin/lib \
390 /usr/dt/*/lib /opt/*/lib /usr/xview/lib* \
391 "${prefix}"/*/lib /usr/*/lib /usr/local/*/lib \
392 "${prefix}"/lib/* /usr/lib/* /usr/local/lib/*; do
393 if test -d "$dir" && test "`ls $dir/libxview.* 2> /dev/null`" != ""; then
394 ac_cv_xview_libraries="$dir"
395 break
396 fi
397 done
398 ])
399 #
400 LIBS="$ac_xview_save_LIBS"
401 INCLUDES="$ac_xview_save_INCLUDES"
402 CPPFLAGS="$ac_xview_save_CPPFLAGS"
403 LDFLAGS="$ac_xview_save_LDFLAGS"
404 ])
405 #
406 xview_libraries="$ac_cv_xview_libraries"
407 fi
408 #
409 # Provide an easier way to link
410 #
411 if test "$xview_includes" = "none" -o "$xview_libraries" = "none"; then
412 with_xview="no"
413 else
414 with_xview="yes"
415 fi
416
417 if test "$with_xview" != "no"; then
418 if test "$xview_libraries" = ""; then
419 link_xview="-lxview -lolgx"
420 XVIEW_LIBS="-lxview -lolgx"
421 else
422 link_xview="-L$xview_libraries -lxview -lolgx"
423 XVIEW_LIBS="-L$xview_libraries -lxview -lolgx"
424 fi
425 if test "$xview_includes" != ""; then
426 include_xview="-I$xview_includes"
427 XVIEW_CFLAGS="-I$xview_includes"
428 fi
429 # removed until we find a use for it
430 # a.lacey@man.ac.uk
431 # AC_DEFINE(HAVE_XVIEW)
432 else
433 with_xview="no"
434 fi
435 #
436 AC_SUBST(link_xview)
437 AC_SUBST(include_xview)
438 AC_SUBST(XVIEW_CFLAGS)
439 AC_SUBST(XVIEW_LIBS)
440 #
441 #
442 #
443 xview_libraries_result="$xview_libraries"
444 xview_includes_result="$xview_includes"
445 test "$xview_libraries_result" = "" && xview_libraries_result="in default path"
446 test "$xview_includes_result" = "" && xview_includes_result="in default path"
447 test "$xview_libraries_result" = "none" && xview_libraries_result="(none)"
448 test "$xview_includes_result" = "none" && xview_includes_result="(none)"
449 AC_MSG_RESULT(
450 [libraries $xview_libraries_result, headers $xview_includes_result])
451 ])dnl
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.