1 dnl
2 dnl AC_FIND_XVIEW
3 dnl
4 dnl Adapted from a Xview (Lesstif) Macro
5 dnl a.lacey@man.ac.uk
6 dnl
7 dnl The variables provided are :
8 dnl link_xview
9 dnl include_xview
10 dnl xview_libraries
11 dnl xview_includes
12 dnl
13 dnl The link_xview and include_xview variables should be fit to put on
14 dnl your application's link line in your Makefile.
15 dnl
16 dnl $Id: ac_find_xview.m4,v 1.2 2004/11/30 16:30:33 paul Exp $
17 dnl
18
19 AC_DEFUN([AC_FIND_XVIEW],
20 [
21
22 AC_REQUIRE([AC_PATH_XTRA])
23 AC_REQUIRE([AC_FIND_LIBXP])
24
25 xview_includes=
26 xview_libraries=
27
28 dnl AC_ARG_WITH(xview,
29 dnl [ --without-xview do not use Xview widgets])
30 dnl Treat --without-xview like
31 dnl --without-xview-includes --without-xview-libraries.
32 dnl if test "$with_xview" = "no"
33 dnl then
34 dnl xview_includes=none
35 dnl xview_libraries=none
36 dnl fi
37
38 AC_ARG_WITH(xview-includes,
39 [ --with-xview-includes=DIR Xview include files are in DIR],
40 xview_includes="$withval")
41
42 AC_ARG_WITH(xview-libraries,
43 [ --with-xview-libraries=DIR Xview libraries are in DIR],
44 xview_libraries="$withval")
45
46 AC_MSG_CHECKING(for Xview)
47
48 #
49 #
50 # Search the include files.
51 #
52 if test "$xview_includes" = ""; then
53 AC_CACHE_VAL(ac_cv_xview_includes,
54 [
55 ac_xview_save_LIBS="$LIBS"
56 ac_xview_save_INCLUDES="$INCLUDES"
57 ac_xview_save_CPPFLAGS="$CPPFLAGS"
58 ac_xview_save_LDFLAGS="$LDFLAGS"
59 #
60 LIBS="$X_PRE_LIBS -lxview -lolgx -lX11 $X_EXTRA_LIBS $LIBS"
61 INCLUDES="$X_CFLAGS $INCLUDES"
62 CPPFLAGS="$X_CFLAGS $CPPFLAGS"
63 LDFLAGS="$X_LIBS $LDFLAGS"
64 #
65 ac_cv_xview_includes="none"
66 AC_TRY_COMPILE([#include <xview/xview.h>],[int a;],
67 [
68 # xview/xview.h is in the standard search path.
69 ac_cv_xview_includes=
70 ],
71 [
72 # xview/xview.h is not in the standard search path.
73 # Locate it and put its directory in `xview_includes'
74 #
75 # /usr/openwin is used on Solaris and Linux (usually).
76 # Other directories are just guesses.
77 for dir in "$x_includes" "${prefix}/include" /usr/include /usr/local/include \
78 /usr/openwin/include /usr/X11/include /usr/X11R6/include \
79 /usr/X11R5/include /usr/dt/include \
80 /usr/dt/*/include /opt/*/include /usr/include/xview* \
81 "${prefix}"/*/include /usr/*/include /usr/local/*/include \
82 "${prefix}"/include/* /usr/include/* /usr/local/include/*; do
83 if test -f "$dir/xview/xview.h"; then
84 ac_cv_xview_includes="$dir"
85 break
86 fi
87 done
88 ])
89 #
90 LIBS="$ac_xview_save_LIBS"
91 INCLUDES="$ac_xview_save_INCLUDES"
92 CPPFLAGS="$ac_xview_save_CPPFLAGS"
93 LDFLAGS="$ac_xview_save_LDFLAGS"
94 ])
95 xview_includes="$ac_cv_xview_includes"
96 fi
97 #
98 #
99 # Now for the libraries.
100 #
101 if test "$xview_libraries" = ""; then
102 AC_CACHE_VAL(ac_cv_xview_libraries,
103 [
104 ac_xview_save_LIBS="$LIBS"
105 ac_xview_save_INCLUDES="$INCLUDES"
106 ac_xview_save_CPPFLAGS="$CPPFLAGS"
107 ac_xview_save_LDFLAGS="$LDFLAGS"
108 #
109 LIBS="$X_PRE_LIBS -lxview -lolgx -lX11 $X_EXTRA_LIBS $LIBS"
110 INCLUDES="$X_CFLAGS $INCLUDES"
111 CPPFLAGS="$X_CFLAGS $CPPFLAGS"
112 LDFLAGS="$X_LIBS $LDFLAGS"
113 #
114 ac_cv_xview_libraries="none"
115 AC_TRY_LINK([#include <xview/xview.h>],[xv_set();],
116 [
117 # libxview.a and libolgx are in the standard search path.
118 ac_cv_xview_libraries=
119 ],
120 [
121 # libxview.a libolgx are not in the standard search path.
122 # Locate it and put its directory in `xview_libraries'
123 #
124 # /usr/openwin is used on Solaris and Linux
125 # Other directories are just guesses.
126 for dir in "$x_libraries" "${prefix}/lib" /usr/lib /usr/local/lib \
127 /usr/openwin/lib /usr/X11/lib /usr/X11R6/lib /usr/X11R5/lib \
128 /usr/dt/lib /usr/openwin/lib \
129 /usr/dt/*/lib /opt/*/lib /usr/xview/lib* \
130 "${prefix}"/*/lib /usr/*/lib /usr/local/*/lib \
131 "${prefix}"/lib/* /usr/lib/* /usr/local/lib/*; do
132 if test -d "$dir" && test "`ls $dir/libxview.* 2> /dev/null`" != ""; then
133 ac_cv_xview_libraries="$dir"
134 break
135 fi
136 done
137 ])
138 #
139 LIBS="$ac_xview_save_LIBS"
140 INCLUDES="$ac_xview_save_INCLUDES"
141 CPPFLAGS="$ac_xview_save_CPPFLAGS"
142 LDFLAGS="$ac_xview_save_LDFLAGS"
143 ])
144 #
145 xview_libraries="$ac_cv_xview_libraries"
146 fi
147 #
148 # Provide an easier way to link
149 #
150 if test "$xview_includes" = "none" -o "$xview_libraries" = "none"; then
151 with_xview="no"
152 else
153 with_xview="yes"
154 fi
155
156 if test "$with_xview" != "no"; then
157 if test "$xview_libraries" = ""; then
158 link_xview="-lxview -lolgx"
159 XVIEW_LIBS="-lxview -lolgx"
160 else
161 link_xview="-L$xview_libraries -lxview -lolgx"
162 XVIEW_LIBS="-L$xview_libraries -lxview -lolgx"
163 fi
164 if test "$xview_includes" != ""; then
165 include_xview="-I$xview_includes"
166 XVIEW_CFLAGS="-I$xview_includes"
167 fi
168 # removed until we find a use for it
169 # a.lacey@man.ac.uk
170 # AC_DEFINE(HAVE_XVIEW)
171 else
172 with_xview="no"
173 fi
174 #
175 AC_SUBST(link_xview)
176 AC_SUBST(include_xview)
177 AC_SUBST(XVIEW_CFLAGS)
178 AC_SUBST(XVIEW_LIBS)
179 #
180 #
181 #
182 xview_libraries_result="$xview_libraries"
183 xview_includes_result="$xview_includes"
184 test "$xview_libraries_result" = "" && xview_libraries_result="in default path"
185 test "$xview_includes_result" = "" && xview_includes_result="in default path"
186 test "$xview_libraries_result" = "none" && xview_libraries_result="(none)"
187 test "$xview_includes_result" = "none" && xview_includes_result="(none)"
188 AC_MSG_RESULT(
189 [libraries $xview_libraries_result, headers $xview_includes_result])
190 ])dnl
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.