1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581
|
dnl $Header: /cvsroot/xbae/Xbae/ac_find_motif.m4,v 1.2 2004/03/04 21:38:50 dannybackx Exp $
dnl
dnl AC_FIND_MOTIF : find OSF/Motif or LessTif, and provide variables
dnl to easily use them in a Makefile.
dnl
dnl Adapted from a macro by Andreas Zeller.
dnl
dnl The variables provided are :
dnl link_motif (e.g. -L/usr/lesstif/lib -lXm)
dnl include_motif (e.g. -I/usr/lesstif/lib)
dnl motif_libraries (e.g. /usr/lesstif/lib)
dnl motif_includes (e.g. /usr/lesstif/include)
dnl
dnl The link_motif and include_motif variables should be fit to put on
dnl your application's link line in your Makefile.
dnl
dnl Oleo CVS Id: motif.m4,v 1.9 1999/04/09 11:46:49 danny
dnl LessTif CVS $Id: ac_find_motif.m4,v 1.2 2004/03/04 21:38:50 dannybackx Exp $
dnl
AC_DEFUN([AC_FIND_MOTIF],
[
AC_REQUIRE([AC_PATH_XTRA])
AC_REQUIRE([AC_FIND_LIBXP])
motif_includes=
motif_libraries=
dnl AC_ARG_WITH(motif,
dnl [ --without-motif do not use Motif widgets])
dnl Treat --without-motif like
dnl --without-motif-includes --without-motif-libraries.
dnl if test "$with_motif" = "no"
dnl then
dnl motif_includes=none
dnl motif_libraries=none
dnl fi
AC_ARG_WITH(motif-includes,
[ --with-motif-includes=DIR Motif include files are in DIR],
motif_includes="$withval")
AC_ARG_WITH(motif-libraries,
[ --with-motif-libraries=DIR Motif libraries are in DIR],
motif_libraries="$withval")
AC_MSG_CHECKING(for Motif)
#
#
# Search the include files.
#
if test "$motif_includes" = ""; then
AC_CACHE_VAL(ac_cv_motif_includes,
[
ac_motif_save_LIBS="$LIBS"
ac_motif_save_INCLUDES="$INCLUDES"
ac_motif_save_CPPFLAGS="$CPPFLAGS"
ac_motif_save_LDFLAGS="$LDFLAGS"
#
LIBS="$X_PRE_LIBS -lXm -lXt -lX11 $X_EXTRA_LIBS $LIBS"
INCLUDES="$X_CFLAGS $INCLUDES"
CPPFLAGS="$X_CFLAGS $CPPFLAGS"
LDFLAGS="$X_LIBS $LDFLAGS"
#
ac_cv_motif_includes="none"
AC_TRY_COMPILE([#include <Xm/Xm.h>],[int a;],
[
# Xm/Xm.h is in the standard search path.
ac_cv_motif_includes=
],
[
# Xm/Xm.h is not in the standard search path.
# Locate it and put its directory in `motif_includes'
#
# /usr/include/Motif* are used on HP-UX (Motif).
# /usr/include/X11* are used on HP-UX (X and Athena).
# /usr/dt is used on Solaris (Motif).
# /usr/openwin is used on Solaris (X and Athena).
# Other directories are just guesses.
for dir in "$x_includes" "${prefix}/include" /usr/include /usr/local/include \
/usr/include/Motif2.1 /usr/include/Motif2.0 /usr/include/Motif1.2 \
/usr/include/X11 /usr/include/X11R6 /usr/include/X11R5 \
/usr/X11/include /usr/X11R6/include /usr/X11R5/include \
/usr/dt/include /usr/openwin/include \
/usr/dt/*/include /opt/*/include /usr/include/Motif* \
"${prefix}"/*/include /usr/*/include /usr/local/*/include \
"${prefix}"/include/* /usr/include/* /usr/local/include/*; do
if test -f "$dir/Xm/Xm.h"; then
ac_cv_motif_includes="$dir"
break
fi
done
])
#
LIBS="$ac_motif_save_LIBS"
INCLUDES="$ac_motif_save_INCLUDES"
CPPFLAGS="$ac_motif_save_CPPFLAGS"
LDFLAGS="$ac_motif_save_LDFLAGS"
])
motif_includes="$ac_cv_motif_includes"
fi
#
#
# Now for the libraries.
#
if test "$motif_libraries" = ""; then
AC_CACHE_VAL(ac_cv_motif_libraries,
[
ac_motif_save_LIBS="$LIBS"
ac_motif_save_INCLUDES="$INCLUDES"
ac_motif_save_CPPFLAGS="$CPPFLAGS"
ac_motif_save_LDFLAGS="$LDFLAGS"
#
LIBS="$X_PRE_LIBS -lXm -lXt -lX11 $X_EXTRA_LIBS $LIBS"
INCLUDES="$X_CFLAGS $INCLUDES"
CPPFLAGS="$X_CFLAGS $CPPFLAGS"
LDFLAGS="$X_LIBS $LDFLAGS"
#
ac_cv_motif_libraries="none"
AC_TRY_LINK([#include <Xm/Xm.h>],[XtToolkitInitialize();],
[
# libXm.a is in the standard search path.
ac_cv_motif_libraries=
],
[
# libXm.a is not in the standard search path.
# Locate it and put its directory in `motif_libraries'
#
# /usr/lib/Motif* are used on HP-UX (Motif).
# /usr/lib/X11* are used on HP-UX (X and Athena).
# /usr/dt is used on Solaris (Motif).
# /usr/lesstif is used on Linux (Lesstif).
# /usr/openwin is used on Solaris (X and Athena).
# Other directories are just guesses.
for dir in "$x_libraries" "${prefix}/lib" /usr/lib /usr/local/lib \
/usr/lib/Motif2.1 /usr/lib/Motif2.0 /usr/lib/Motif1.2 \
/usr/lib/X11 /usr/lib/X11R6 /usr/lib/X11R5 \
/usr/X11/lib /usr/X11R6/lib /usr/X11R5/lib \
/usr/dt/lib /usr/openwin/lib \
/usr/dt/*/lib /opt/*/lib /usr/lib/Motif* \
/usr/lesstif*/lib /usr/lib/Lesstif* \
"${prefix}"/*/lib /usr/*/lib /usr/local/*/lib \
"${prefix}"/lib/* /usr/lib/* /usr/local/lib/*; do
if test -d "$dir" && test "`ls $dir/libXm.* 2> /dev/null`" != ""; then
ac_cv_motif_libraries="$dir"
break
fi
done
])
#
LIBS="$ac_motif_save_LIBS"
INCLUDES="$ac_motif_save_INCLUDES"
CPPFLAGS="$ac_motif_save_CPPFLAGS"
LDFLAGS="$ac_motif_save_LDFLAGS"
])
#
motif_libraries="$ac_cv_motif_libraries"
fi
#
# Provide an easier way to link
#
if test "$motif_includes" = "none" -o "$motif_libraries" = "none"; then
with_motif="no"
else
with_motif="yes"
fi
AC_FIND_LIBXP
if test "$LT_HAVE_XP" = "yes"; then
XPLIB="-lXp -lXext"
else
XPLIB=""
fi
if test "$with_motif" != "no"; then
if test "$motif_libraries" = ""; then
link_motif="-lXm $XPLIB"
MOTIF_LIBS="-lXm $XPLIB"
else
link_motif="-L$motif_libraries -lXm $XPLIB"
MOTIF_LIBS="-L$motif_libraries -lXm $XPLIB"
fi
if test "$motif_includes" != ""; then
include_motif="-I$motif_includes"
MOTIF_CFLAGS="-I$motif_includes"
fi
AC_DEFINE(HAVE_MOTIF)
else
with_motif="no"
fi
#
AC_SUBST(link_motif)
AC_SUBST(include_motif)
AC_SUBST(MOTIF_CFLAGS)
AC_SUBST(MOTIF_LIBS)
#
#
#
motif_libraries_result="$motif_libraries"
motif_includes_result="$motif_includes"
test "$motif_libraries_result" = "" && motif_libraries_result="in default path"
test "$motif_includes_result" = "" && motif_includes_result="in default path"
test "$motif_libraries_result" = "none" && motif_libraries_result="(none)"
test "$motif_includes_result" = "none" && motif_includes_result="(none)"
AC_MSG_RESULT(
[libraries $motif_libraries_result, headers $motif_includes_result])
])dnl
dnl
dnl Check for libXp
dnl In fact this check ensures that
dnl - <X11/extensions/Print.h> and
dnl - both libXp libXext
dnl are in place
dnl Note that a simpler check only for the libraries would not
dnl be sufficient perhaps.
dnl If the test succeeds it defines Have_Libxp within our
dnl Makefiles. Perhaps one should immediately add those libs
dnl to link commands which include libXm version2.1?!
dnl
AC_DEFUN([AC_FIND_LIBXP],
[AC_REQUIRE([AC_PATH_X])
AC_CACHE_CHECK(whether libXp is available, lt_cv_libxp,
[lt_save_CFLAGS="$CFLAGS"
lt_save_CPPFLAGS="$CPPFLAGS"
lt_save_LIBS="$LIBS"
LIBS="$X_LIBS -lXp -lXext -lXt $X_PRE_LIBS -lX11 $X_EXTRA_LIBS $LIBS"
CFLAGS="$X_CFLAGS $CFLAGS"
CPPFLAGS="$X_CFLAGS $CPPFLAGS"
AC_TRY_LINK([
#include <X11/Intrinsic.h>
#include <X11/extensions/Print.h>
],[
int main() {
Display *display=NULL;
short major_version, minor_version;
Status rc;
rc=XpQueryVersion(display, &major_version, &minor_version);
exit(0);
}
],
lt_cv_libxp=yes,
lt_cv_libxp=no)
])
if test "$lt_cv_libxp" = "yes"; then
AC_DEFINE(HAVE_LIB_XP)
LT_HAVE_XP="yes"
else
LT_HAVE_XP="no"
fi
AM_CONDITIONAL(Have_Libxp, test "$lt_cv_libxp" = "yes")
AC_SUBST(LT_HAVE_XP)
CFLAGS="$lt_save_CFLAGS"
CPPFLAGS="$lt_save_CPPFLAGS"
LIBS="$lt_save_LIBS"
])
#################################################################
dnl
dnl
dnl AC_FIND_XBAE : find libXbae, and provide variables
dnl to easily use them in a Makefile.
dnl
dnl Adapted from a macro by Andreas Zeller.
dnl
dnl The variables provided are :
dnl link_xbae (e.g. -L/usr/lesstif/lib -lXm)
dnl include_xbae (e.g. -I/usr/lesstif/lib)
dnl xbae_libraries (e.g. /usr/lesstif/lib)
dnl xbae_includes (e.g. /usr/lesstif/include)
dnl
dnl The link_xbae and include_xbae variables should be fit to put on
dnl your application's link line in your Makefile.
dnl
AC_DEFUN([AC_FIND_XBAE],
[
AC_REQUIRE([AC_FIND_MOTIF])
xbae_includes=
xbae_libraries=
AC_ARG_WITH(xbae,
[ --without-xbae do not use Xbae widgets])
dnl Treat --without-xbae like
dnl --without-xbae-includes --without-xbae-libraries.
if test "$with_xbae" = "no"
then
xbae_includes=no
xbae_libraries=no
fi
AC_ARG_WITH(xbae-includes,
[ --with-xbae-includes=DIR Xbae include files are in DIR], xbae_includes="$withval")
AC_ARG_WITH(xbae-libraries,
[ --with-xbae-libraries=DIR Xbae libraries are in DIR], xbae_libraries="$withval")
if test "$xbae_includes" = "no" && test "$xbae_libraries" = "no"
then
with_xbae="no"
fi
AC_MSG_CHECKING([for Xbae])
if test "$with_xbae" != "no"
then
#
#
# Search the include files.
#
if test "$xbae_includes" = ""
then
AC_CACHE_VAL(ac_cv_xbae_includes,
[
ac_xbae_save_CFLAGS="$CFLAGS"
ac_xbae_save_CPPFLAGS="$CPPFLAGS"
#
CFLAGS="$MOTIF_CFLAGS $X_CFLAGS $CFLAGS"
CPPFLAGS="$MOTIF_CFLAGS $X_CFLAGS $CPPFLAGS"
#
AC_TRY_COMPILE([#include <Xbae/Matrix.h>],[int a;],
[
# Xbae/Matrix.h is in the standard search path.
ac_cv_xbae_includes=
],
[
# Xbae/Matrix.h is not in the standard search path.
# Locate it and put its directory in `xbae_includes'
#
# Other directories are just guesses.
for dir in "$x_includes" "${prefix}/include" /usr/include /usr/local/include \
/usr/include/Motif2.0 /usr/include/Motif1.2 /usr/include/Motif1.1 \
/usr/include/X11R6 /usr/include/X11R5 /usr/include/X11R4 \
/usr/dt/include /usr/openwin/include \
/usr/dt/*/include /opt/*/include /usr/include/Xbae* \
"${prefix}"/*/include /usr/*/include /usr/local/*/include \
"${prefix}"/include/* /usr/include/* /usr/local/include/* \
"${HOME}"/include
do
if test -f "$dir/Xbae/Matrix.h"
then
ac_cv_xbae_includes="$dir"
break
fi
done
])
#
CFLAGS="$ac_xbae_save_CFLAGS"
CPPFLAGS="$ac_xbae_save_CPPFLAGS"
])
xbae_includes="$ac_cv_xbae_includes"
fi
if test -z "$xbae_includes"
then
xbae_includes_result="default path"
XBAE_CFLAGS=""
else
if test "$xbae_includes" = "no"
then
xbae_includes_result="told not to use them"
XBAE_CFLAGS=""
else
xbae_includes_result="$xbae_includes"
XBAE_CFLAGS="-I$xbae_includes"
fi
fi
#
#
# Now for the libraries.
#
if test "$xbae_libraries" = ""
then
AC_CACHE_VAL(ac_cv_xbae_libraries,
[
ac_xbae_save_LIBS="$LIBS"
ac_xbae_save_CFLAGS="$CFLAGS"
ac_xbae_save_CPPFLAGS="$CPPFLAGS"
#
LIBS="-lXbae -lm $MOTIF_LIBS $X_LIBS $X_PRE_LIBS -lXt -lX11 $X_EXTRA_LIBS $LIBS"
CFLAGS="$XBAE_CFLAGS $MOTIF_CFLAGS $X_CFLAGS $CFLAGS"
CPPFLAGS="$XBAE_CFLAGS $MOTIF_CFLAGS $X_CFLAGS $CPPFLAGS"
#
AC_TRY_LINK([#include <Xbae/Matrix.h>],[Widget w; XbaeMatrixDeselectAll(w);],
[
# libXbae.a is in the standard search path.
ac_cv_xbae_libraries=
],
[
# libXbae.a is not in the standard search path.
# Locate it and put its directory in `xbae_libraries'
#
# Other directories are just guesses.
for dir in "$x_libraries" "${prefix}/lib" /usr/lib /usr/local/lib \
/usr/lib/Xbae \
/usr/lib/X11R6 /usr/lib/X11R5 /usr/lib/X11R4 /usr/lib/X11 \
/usr/dt/lib /usr/openwin/lib \
/usr/dt/*/lib /opt/*/lib /usr/lib/Xbae* \
/usr/lesstif*/lib /usr/lib/Lesstif* \
"${prefix}"/*/lib /usr/*/lib /usr/local/*/lib \
"${prefix}"/lib/* /usr/lib/* /usr/local/lib/* \
"${HOME}"/lib
do
for ext in "sl" "so" "a" "lib"; do
if test -d "$dir" && test -f "$dir/libXbae.$ext"; then
ac_cv_xbae_libraries="$dir"
break 2
fi
done
done
])
#
LIBS="$ac_xbae_save_LIBS"
CFLAGS="$ac_xbae_save_CFLAGS"
CPPFLAGS="$ac_xbae_save_CPPFLAGS"
])
#
xbae_libraries="$ac_cv_xbae_libraries"
fi
if test -z "$xbae_libraries"
then
xbae_libraries_result="default path"
XBAE_LIBS="-lXbae"
else
if test "$xbae_libraries" = "no"
then
xbae_libraries_result="told not to use it"
XBAE_LIBS=""
else
xbae_libraries_result="$xbae_libraries"
XBAE_LIBS="-L$xbae_libraries -lXbae"
fi
fi
#
# Make sure, whatever we found out, we can link.
#
ac_xbae_save_LIBS="$LIBS"
ac_xbae_save_CFLAGS="$CFLAGS"
ac_xbae_save_CPPFLAGS="$CPPFLAGS"
#
LIBS="$XBAE_LIBS -lm $MOTIF_LIBS $X_LIBS $X_PRE_LIBS -lXt -lX11 $X_EXTRA_LIBS $LIBS"
CFLAGS="$XBAE_CFLAGS $MOTIF_CFLAGS $X_CFLAGS $CFLAGS"
CPPFLAGS="$XBAE_CFLAGS $MOTIF_CFLAGS $X_CFLAGS $CPPFLAGS"
AC_TRY_LINK([#include <Xbae/Matrix.h>],[Widget w; XbaeMatrixDeselectAll(w);],
[
#
# link passed
#
AC_DEFINE(HAVE_XBAE)
],
[
#
# link failed
#
xbae_libraries_result="test link failed"
xbae_includes_result="test link failed"
with_xbae="no"
XBAE_CFLAGS=""
XBAE_LIBS=""
]) dnl AC_TRY_LINK
LIBS="$ac_xbae_save_LIBS"
CFLAGS="$ac_xbae_save_CFLAGS"
CPPFLAGS="$ac_xbae_save_CPPFLAGS"
else
xbae_libraries_result="told not to use it"
xbae_includes_result="told not to use them"
XBAE_CFLAGS=""
XBAE_LIBS=""
fi
AC_MSG_RESULT([libraries $xbae_libraries_result, headers $xbae_includes_result])
AC_SUBST(XBAE_CFLAGS)
AC_SUBST(XBAE_LIBS)
])dnl AC_DEFN
#################################################################
#
# Try to find the app-defaults directory.
#
AC_DEFUN([AC_PATH_X_APP_DEFAULTS_XMKMF],[
rm -fr conftestdir
if mkdir conftestdir; then
cd conftestdir 2>/dev/null
# Make sure to not put "make" in the Imakefile rules, since we grep it out.
cat > Imakefile <<'EOF'
acfindx:
@echo 'ac_x_app_defaults="${XAPPLOADDIR}"'
EOF
if (xmkmf) >/dev/null 2>&1 && test -f Makefile; then
# GNU make sometimes prints "make[1]: Entering...", which'd confuse us.
eval `${MAKE-make} acfindx 2>/dev/null | grep -v make`
fi
cd .. 2>/dev/null
rm -fr conftestdir
fi])
AC_DEFUN([AC_PATH_X_APP_DEFAULTS_DIRECT],[
# Look for the directory under a standard set of common directories.
# Check X11 before X11Rn because it's often a symlink to the current release.
# TJW - added /usr/share/X11/app-defaults for Xorg/FC5
# TJW - added /etc/X11/app-defaults for Ubuntu
for ac_dir in \
/usr/share/X11/app-defaults \
/etc/X11/app-defaults \
/usr/X11/lib/app-defaults \
/usr/X11R6/lib/app-defaults \
/usr/X11R6/lib/X11/app-defaults \
/usr/X11R5/lib/app-defaults \
/usr/X11R5/lib/X11/app-defaults \
/usr/X11R4/lib/app-defaults \
/usr/X11R4/lib/X11/app-defaults \
\
/usr/lib/X11/app-defaults \
/usr/lib/X11R6/app-defaults \
/usr/lib/X11R5/app-defaults \
/usr/lib/X11R4/app-defaults \
\
/usr/local/X11/lib/app-defaults \
/usr/local/X11R6/lib/app-defaults \
/usr/local/X11R5/lib/app-defaults \
/usr/local/X11R4/lib/app-defaults \
\
/usr/local/lib/X11/app-defaults \
/usr/local/lib/X11R6/app-defaults \
/usr/local/lib/X11R6/X11/app-defaults \
/usr/local/lib/X11R5/app-defaults \
/usr/local/lib/X11R5/X11/app-defaults \
/usr/local/lib/X11R4/app-defaults \
/usr/local/lib/X11R4/X11/app-defaults \
\
/usr/X386/lib/X11/app-defaults \
/usr/x386/lib/X11/app-defaults \
/usr/XFree86/lib/X11/app-defaults \
\
/usr/lib/X11/app-defaults \
/usr/local/lib/X11/app-defaults \
/usr/unsupported/lib/X11/app-defaults \
/usr/athena/lib/X11/app-defaults \
/usr/local/x11r5/lib/X11/app-defaults \
/usr/lpp/Xamples/lib/X11/app-defaults \
/lib/usr/lib/X11/app-defaults \
\
/usr/openwin/lib/app-defaults \
/usr/openwin/lib/X11/app-defaults \
/usr/openwin/share/lib/app-defaults \
/usr/openwin/share/lib/X11/app-defaults \
\
/X11R6/lib/app-defaults \
/X11R5/lib/app-defaults \
/X11R4/lib/app-defaults \
; \
do
if test -d "$ac_dir"; then
ac_x_app_defaults=$ac_dir
break
fi
done
])
AC_DEFUN([AC_PATH_X_APP_DEFAULTS],
[AC_REQUIRE_CPP()
AC_CACHE_CHECK([for X app-defaults directory], ac_cv_x_app_defaults,
[AC_PATH_X_APP_DEFAULTS_XMKMF
if test x"$ac_x_app_defaults" = x; then
AC_PATH_X_APP_DEFAULTS_DIRECT
fi
if test x"$ac_x_app_defaults" = x; then
ac_cv_x_app_defaults="/usr/lib/X11/app-defaults"
else
# Record where we found app-defaults for the cache.
ac_cv_x_app_defaults="$ac_x_app_defaults"
fi])
eval ac_x_app_defaults="$ac_cv_x_app_defaults"])
#################################################################
|