~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Tina5/tina-libs/m4/ac_find_motif.m4

Version: ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  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: ac_find_motif.m4,v 1.3 2004/11/30 16:30:33 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 # /sw/include is used for fink under OSX
 80 # Other directories are just guesses.
 81 for dir in "$x_includes" "${prefix}/include" /usr/include /usr/local/include \
 82            /usr/include/Motif2.1 /usr/include/Motif2.0 /usr/include/Motif1.2  \
 83            /usr/include/X11 /usr/include/X11R6 /usr/include/X11R5 \
 84            /usr/X11/include /usr/X11R6/include /usr/X11R5/include \
 85            /usr/dt/include /usr/openwin/include \
 86            /usr/dt/*/include /opt/*/include /usr/include/Motif* \
 87            "${prefix}"/*/include /usr/*/include /usr/local/*/include \
 88            "${prefix}"/include/* /usr/include/* /usr/local/include/* \
 89            /sw/include; do
 90 if test -f "$dir/Xm/Xm.h"; then
 91 ac_cv_motif_includes="$dir"
 92 break
 93 fi
 94 done
 95 ])
 96 #
 97 LIBS="$ac_motif_save_LIBS"
 98 INCLUDES="$ac_motif_save_INCLUDES"
 99 CPPFLAGS="$ac_motif_save_CPPFLAGS"
100 LDFLAGS="$ac_motif_save_LDFLAGS"
101 ])
102 motif_includes="$ac_cv_motif_includes"
103 fi
104 #
105 #
106 # Now for the libraries.
107 #
108 if test "$motif_libraries" = ""; then
109 AC_CACHE_VAL(ac_cv_motif_libraries,
110 [
111 ac_motif_save_LIBS="$LIBS"
112 ac_motif_save_INCLUDES="$INCLUDES"
113 ac_motif_save_CPPFLAGS="$CPPFLAGS"
114 ac_motif_save_LDFLAGS="$LDFLAGS"
115 #
116 LIBS="$X_PRE_LIBS -lXm -lXt -lX11 $X_EXTRA_LIBS $LIBS"
117 INCLUDES="$X_CFLAGS $INCLUDES"
118 CPPFLAGS="$X_CFLAGS $CPPFLAGS"
119 LDFLAGS="$X_LIBS $LDFLAGS"
120 #
121 ac_cv_motif_libraries="none"
122 AC_TRY_LINK([#include <Xm/Xm.h>],[XtToolkitInitialize();],
123 [
124 # libXm.a is in the standard search path.
125 ac_cv_motif_libraries=
126 ],
127 [
128 # libXm.a is not in the standard search path.
129 # Locate it and put its directory in `motif_libraries'
130 #
131 # /usr/lib/Motif* are used on HP-UX (Motif).
132 # /usr/lib/X11* are used on HP-UX (X and Athena).
133 # /usr/dt is used on Solaris (Motif).
134 # /usr/lesstif is used on Linux (Lesstif).
135 # /usr/openwin is used on Solaris (X and Athena).
136 # /sw/lib is used under fink on OSX
137 # Other directories are just guesses.
138 for dir in "$x_libraries" "${prefix}/lib" /usr/lib /usr/local/lib \
139            /usr/lib/Motif2.1 /usr/lib/Motif2.0 /usr/lib/Motif1.2 \
140            /usr/lib/X11 /usr/lib/X11R6 /usr/lib/X11R5 \
141            /usr/X11/lib /usr/X11R6/lib /usr/X11R5/lib \
142            /usr/dt/lib /usr/openwin/lib \
143            /usr/dt/*/lib /opt/*/lib /usr/lib/Motif* \
144            /usr/lesstif*/lib /usr/lib/Lesstif* \
145            "${prefix}"/*/lib /usr/*/lib /usr/local/*/lib \
146            "${prefix}"/lib/* /usr/lib/* /usr/local/lib/* \
147            /sw/lib; do
148 if test -d "$dir" && test "`ls $dir/libXm.* 2> /dev/null`" != ""; then
149 ac_cv_motif_libraries="$dir"
150 break
151 fi
152 done
153 ])
154 #
155 LIBS="$ac_motif_save_LIBS"
156 INCLUDES="$ac_motif_save_INCLUDES"
157 CPPFLAGS="$ac_motif_save_CPPFLAGS"
158 LDFLAGS="$ac_motif_save_LDFLAGS"
159 ])
160 #
161 motif_libraries="$ac_cv_motif_libraries"
162 fi
163 #
164 # Provide an easier way to link
165 #
166 if test "$motif_includes" = "none" -o "$motif_libraries" = "none"; then
167         with_motif="no"
168 else
169         with_motif="yes"
170 fi
171 
172 AC_FIND_LIBXP
173 if test "$LT_HAVE_XP" = "yes"; then
174         XPLIB="-lXp -lXext"
175 else
176         XPLIB=""
177 fi
178 
179 if test "$with_motif" != "no"; then
180         if test "$motif_libraries" = ""; then
181                 link_motif="-lXm $XPLIB"
182                 MOTIF_LIBS="-lXm $XPLIB"
183         else
184                 link_motif="-L$motif_libraries -lXm $XPLIB"
185                 MOTIF_LIBS="-L$motif_libraries -lXm $XPLIB"
186         fi
187         if test "$motif_includes" != ""; then
188                 include_motif="-I$motif_includes"
189                 MOTIF_CFLAGS="-I$motif_includes"
190         fi
191 # remove this until we find a use for it
192 # a.lacey@man.ac.uk
193 #       AC_DEFINE(HAVE_MOTIF)
194 else
195         with_motif="no"
196 fi
197 #
198 AC_SUBST(link_motif)
199 AC_SUBST(include_motif)
200 AC_SUBST(MOTIF_CFLAGS)
201 AC_SUBST(MOTIF_LIBS)
202 #
203 #
204 #
205 motif_libraries_result="$motif_libraries"
206 motif_includes_result="$motif_includes"
207 test "$motif_libraries_result" = "" && motif_libraries_result="in default path"
208 test "$motif_includes_result" = "" && motif_includes_result="in default path"
209 test "$motif_libraries_result" = "none" && motif_libraries_result="(none)"
210 test "$motif_includes_result" = "none" && motif_includes_result="(none)"
211 AC_MSG_RESULT(
212   [libraries $motif_libraries_result, headers $motif_includes_result])
213 ])dnl
214 
215 dnl
216 dnl Check for libXp
217 dnl In fact this check ensures that
218 dnl  - <X11/extensions/Print.h> and
219 dnl  - both libXp libXext
220 dnl are in place
221 dnl Note that a simpler check only for the libraries would not
222 dnl be sufficient perhaps.
223 dnl If the test succeeds it defines Have_Libxp within our
224 dnl Makefiles. Perhaps one should immediately add those libs
225 dnl to link commands which include libXm version2.1?!
226 dnl
227 AC_DEFUN([AC_FIND_LIBXP],
228 [AC_REQUIRE([AC_PATH_X])
229 AC_CACHE_CHECK(whether libXp is available, lt_cv_libxp,
230 [lt_save_CFLAGS="$CFLAGS"
231 lt_save_CPPFLAGS="$CPPFLAGS"
232 lt_save_LIBS="$LIBS"
233 LIBS="$X_LIBS -lXp -lXext -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS $LIBS"
234 CFLAGS="$X_CFLAGS $CFLAGS"
235 CPPFLAGS="$X_CFLAGS $CPPFLAGS"
236 AC_TRY_LINK([
237 #include <X11/Intrinsic.h>
238 #include <X11/extensions/Print.h>
239 ],[
240 int main() {
241 Display *display=NULL;
242 short   major_version, minor_version;
243 Status rc;
244 rc=XpQueryVersion(display, &major_version, &minor_version);
245 exit(0);
246 }
247 ],
248 lt_cv_libxp=yes,
249 lt_cv_libxp=no)
250 ])
251 if test "$lt_cv_libxp" = "yes"; then
252 # remove this until we find a use for it
253 # a.lacey@man.ac.uk
254 #  AC_DEFINE(HAVE_LIB_XP)
255   LT_HAVE_XP="yes"
256 else
257   LT_HAVE_XP="no"
258 fi
259 AM_CONDITIONAL(Have_Libxp, test "$lt_cv_libxp" = "yes")
260 AC_SUBST(LT_HAVE_XP)
261 CFLAGS="$lt_save_CFLAGS"
262 CPPFLAGS="$lt_save_CPPFLAGS"
263 LIBS="$lt_save_LIBS"
264 ])
265 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.