1# Configure paths for SDL 2# Sam Lantinga 9/21/99 3# stolen from Manish Singh 4# stolen back from Frank Belew 5# stolen from Manish Singh 6# Shamelessly stolen from Owen Taylor 7 8dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) 9dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS 10dnl 11AC_DEFUN(AM_PATH_SDL, 12[dnl 13dnl Get the cflags and libraries from the sdl-config script 14dnl 15AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)], 16 sdl_prefix="$withval", sdl_prefix="") 17AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)], 18 sdl_exec_prefix="$withval", sdl_exec_prefix="") 19AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run a test SDL program], 20 , enable_sdltest=yes) 21 22 if test x$sdl_exec_prefix != x ; then 23 sdl_args="$sdl_args --exec-prefix=$sdl_exec_prefix" 24 if test x${SDL_CONFIG+set} != xset ; then 25 SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config 26 fi 27 fi 28 if test x$sdl_prefix != x ; then 29 sdl_args="$sdl_args --prefix=$sdl_prefix" 30 if test x${SDL_CONFIG+set} != xset ; then 31 SDL_CONFIG=$sdl_prefix/bin/sdl-config 32 fi 33 fi 34 35 AC_PATH_PROG(SDL_CONFIG, sdl-config, no) 36 min_sdl_version=ifelse([$1], ,0.11.0,$1) 37 AC_MSG_CHECKING(for SDL - version >= $min_sdl_version) 38 no_sdl="" 39 if test "$SDL_CONFIG" = "no" ; then 40 no_sdl=yes 41 else 42 SDL_CFLAGS=`$SDL_CONFIG $sdlconf_args --cflags` 43 SDL_LIBS=`$SDL_CONFIG $sdlconf_args --libs` 44 45 sdl_major_version=`$SDL_CONFIG $sdl_args --version | \ 46 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` 47 sdl_minor_version=`$SDL_CONFIG $sdl_args --version | \ 48 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` 49 sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \ 50 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` 51 if test "x$enable_sdltest" = "xyes" ; then 52 ac_save_CFLAGS="$CFLAGS" 53 ac_save_LIBS="$LIBS" 54 CFLAGS="$CFLAGS $SDL_CFLAGS" 55 LIBS="$LIBS $SDL_LIBS" 56dnl 57dnl Now check if the installed SDL is sufficiently new. (Also sanity 58dnl checks the results of sdl-config to some extent 59dnl 60 rm -f conf.sdltest 61 AC_TRY_RUN([ 62#include <stdio.h> 63#include <stdlib.h> 64#include <string.h> 65#include <SDL/SDL.h> 66 67char* 68my_strdup (char *str) 69{ 70 char *new_str; 71 72 if (str) 73 { 74 new_str = malloc ((strlen (str) + 1) * sizeof(char)); 75 strcpy (new_str, str); 76 } 77 else 78 new_str = NULL; 79 80 return new_str; 81} 82 83int main () 84{ 85 int major, minor, micro; 86 char *tmp_version; 87 88 system ("touch conf.sdltest"); 89 90 /* HP/UX 9 (%@#!) writes to sscanf strings */ 91 tmp_version = my_strdup("$min_sdl_version"); 92 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { 93 printf("%s, bad version string\n", "$min_sdl_version"); 94 exit(1); 95 } 96 97 if (($sdl_major_version > major) || 98 (($sdl_major_version == major) && ($sdl_minor_version > minor)) || 99 (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro))) 100 { 101 return 0; 102 } 103 else 104 { 105 printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version); 106 printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro); 107 printf("*** best to upgrade to the required version.\n"); 108 printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n"); 109 printf("*** to point to the correct copy of sdl-config, and remove the file\n"); 110 printf("*** config.cache before re-running configure\n"); 111 return 1; 112 } 113} 114 115],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) 116 CFLAGS="$ac_save_CFLAGS" 117 LIBS="$ac_save_LIBS" 118 fi 119 fi 120 if test "x$no_sdl" = x ; then 121 AC_MSG_RESULT(yes) 122 ifelse([$2], , :, [$2]) 123 else 124 AC_MSG_RESULT(no) 125 if test "$SDL_CONFIG" = "no" ; then 126 echo "*** The sdl-config script installed by SDL could not be found" 127 echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in" 128 echo "*** your path, or set the SDL_CONFIG environment variable to the" 129 echo "*** full path to sdl-config." 130 else 131 if test -f conf.sdltest ; then 132 : 133 else 134 echo "*** Could not run SDL test program, checking why..." 135 CFLAGS="$CFLAGS $SDL_CFLAGS" 136 LIBS="$LIBS $SDL_LIBS" 137 AC_TRY_LINK([ 138#include <stdio.h> 139#include <SDL/SDL.h> 140], [ return 0; ], 141 [ echo "*** The test program compiled, but did not run. This usually means" 142 echo "*** that the run-time linker is not finding SDL or finding the wrong" 143 echo "*** version of SDL. If it is not finding SDL, you'll need to set your" 144 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" 145 echo "*** to the installed location Also, make sure you have run ldconfig if that" 146 echo "*** is required on your system" 147 echo "***" 148 echo "*** If you have an old version installed, it is best to remove it, although" 149 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], 150 [ echo "*** The test program failed to compile or link. See the file config.log for the" 151 echo "*** exact error that occured. This usually means SDL was incorrectly installed" 152 echo "*** or that you have moved SDL since it was installed. In the latter case, you" 153 echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ]) 154 CFLAGS="$ac_save_CFLAGS" 155 LIBS="$ac_save_LIBS" 156 fi 157 fi 158 SDL_CFLAGS="" 159 SDL_LIBS="" 160 ifelse([$3], , :, [$3]) 161 fi 162 AC_SUBST(SDL_CFLAGS) 163 AC_SUBST(SDL_LIBS) 164 rm -f conf.sdltest 165]) 166## libtool.m4 - Configure libtool for the target system. -*-Shell-script-*- 167## Copyright (C) 1996-1999 Free Software Foundation, Inc. 168## Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 169## 170## This program is free software; you can redistribute it and/or modify 171## it under the terms of the GNU General Public License as published by 172## the Free Software Foundation; either version 2 of the License, or 173## (at your option) any later version. 174## 175## This program is distributed in the hope that it will be useful, but 176## WITHOUT ANY WARRANTY; without even the implied warranty of 177## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 178## General Public License for more details. 179## 180## You should have received a copy of the GNU General Public License 181## along with this program; if not, write to the Free Software 182## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 183## 184## As a special exception to the GNU General Public License, if you 185## distribute this file as part of a program that contains a 186## configuration script generated by Autoconf, you may include it under 187## the same distribution terms that you use for the rest of that program. 188 189# serial 41 AC_PROG_LIBTOOL 190AC_DEFUN(AC_PROG_LIBTOOL, 191[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl 192 193# Save cache, so that ltconfig can load it 194AC_CACHE_SAVE 195 196# Actually configure libtool. ac_aux_dir is where install-sh is found. 197CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \ 198LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ 199LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \ 200DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \ 201${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \ 202$libtool_flags --no-verify --build="$build" $ac_aux_dir/ltmain.sh $host \ 203|| AC_MSG_ERROR([libtool configure failed]) 204 205# Reload cache, that may have been modified by ltconfig 206AC_CACHE_LOAD 207 208# This can be used to rebuild libtool when needed 209LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh" 210 211# Always use our own libtool. 212LIBTOOL='$(SHELL) $(top_builddir)/libtool' 213AC_SUBST(LIBTOOL)dnl 214 215# Redirect the config.log output again, so that the ltconfig log is not 216# clobbered by the next message. 217exec 5>>./config.log 218]) 219 220AC_DEFUN(AC_LIBTOOL_SETUP, 221[AC_PREREQ(2.13)dnl 222AC_REQUIRE([AC_ENABLE_SHARED])dnl 223AC_REQUIRE([AC_ENABLE_STATIC])dnl 224AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl 225AC_REQUIRE([AC_CANONICAL_HOST])dnl 226AC_REQUIRE([AC_CANONICAL_BUILD])dnl 227AC_REQUIRE([AC_PROG_CC])dnl 228AC_REQUIRE([AC_PROG_LD])dnl 229AC_REQUIRE([AC_PROG_NM])dnl 230AC_REQUIRE([AC_PROG_LN_S])dnl 231dnl 232 233AC_CHECK_TOOL(RANLIB, ranlib, :) 234 235# Check for any special flags to pass to ltconfig. 236libtool_flags="--cache-file=$cache_file" 237test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared" 238test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static" 239test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install" 240test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc" 241test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld" 242ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN], 243[libtool_flags="$libtool_flags --enable-dlopen"]) 244ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], 245[libtool_flags="$libtool_flags --enable-win32-dll"]) 246AC_ARG_ENABLE(libtool-lock, 247 [ --disable-libtool-lock avoid locking (might break parallel builds)]) 248test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock" 249test x"$silent" = xyes && libtool_flags="$libtool_flags --silent" 250 251AC_ARG_WITH(pic, 252 [ --with-pic try to use only PIC/non-PIC objects [default=use both]], 253 pic_mode="$withval", pic_mode=default) 254test x"$pic_mode" = xyes && libtool_flags="$libtool_flags --prefer-pic" 255test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic" 256 257# Some flags need to be propagated to the compiler or linker for good 258# libtool support. 259case "$host" in 260*-*-irix6*) 261 # Find out which ABI we are using. 262 echo '[#]line __oline__ "configure"' > conftest.$ac_ext 263 if AC_TRY_EVAL(ac_compile); then 264 case "`/usr/bin/file conftest.o`" in 265 *32-bit*) 266 LD="${LD-ld} -32" 267 ;; 268 *N32*) 269 LD="${LD-ld} -n32" 270 ;; 271 *64-bit*) 272 LD="${LD-ld} -64" 273 ;; 274 esac 275 fi 276 rm -rf conftest* 277 ;; 278 279*-*-sco3.2v5*) 280 # On SCO OpenServer 5, we need -belf to get full-featured binaries. 281 SAVE_CFLAGS="$CFLAGS" 282 CFLAGS="$CFLAGS -belf" 283 AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, 284 [AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])]) 285 if test x"$lt_cv_cc_needs_belf" != x"yes"; then 286 # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf 287 CFLAGS="$SAVE_CFLAGS" 288 fi 289 ;; 290 291ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], 292[*-*-cygwin* | *-*-mingw*) 293 AC_CHECK_TOOL(DLLTOOL, dlltool, false) 294 AC_CHECK_TOOL(AS, as, false) 295 AC_CHECK_TOOL(OBJDUMP, objdump, false) 296 297 # recent cygwin and mingw systems supply a stub DllMain which the user 298 # can override, but on older systems we have to supply one 299 AC_CACHE_CHECK([if libtool should supply DllMain function], lt_cv_need_dllmain, 300 [AC_TRY_LINK([DllMain (0, 0, 0);], 301 [extern int __attribute__((__stdcall__)) DllMain(void*, int, void*);], 302 [lt_cv_need_dllmain=yes],[lt_cv_need_dllmain=no])]) 303 304 case $host in 305 *-*-cygwin*) 306 # cygwin systems need to pass --dll to the linker, and not link 307 # crt.o which will require a WinMain@16 definition. 308 lt_cv_cc_dll_switch="-Wl,--dll -nostartfiles" ;; 309 *-*-mingw*) 310 # old mingw systems require "-dll" to link a DLL, while more recent ones 311 # require "-mdll" 312 SAVE_CFLAGS="$CFLAGS" 313 CFLAGS="$CFLAGS -mdll" 314 AC_CACHE_CHECK([how to link DLLs], lt_cv_cc_dll_switch, 315 [AC_TRY_LINK([], [], [lt_cv_cc_dll_switch=-mdll],[lt_cv_cc_dll_switch=-dll])]) 316 CFLAGS="$SAVE_CFLAGS" ;; 317 esac 318 ;; 319 ]) 320esac 321]) 322 323# AC_LIBTOOL_DLOPEN - enable checks for dlopen support 324AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])]) 325 326# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's 327AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])]) 328 329# AC_ENABLE_SHARED - implement the --enable-shared flag 330# Usage: AC_ENABLE_SHARED[(DEFAULT)] 331# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to 332# `yes'. 333AC_DEFUN(AC_ENABLE_SHARED, [dnl 334define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl 335AC_ARG_ENABLE(shared, 336changequote(<<, >>)dnl 337<< --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT], 338changequote([, ])dnl 339[p=${PACKAGE-default} 340case "$enableval" in 341yes) enable_shared=yes ;; 342no) enable_shared=no ;; 343*) 344 enable_shared=no 345 # Look at the argument we got. We use all the common list separators. 346 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," 347 for pkg in $enableval; do 348 if test "X$pkg" = "X$p"; then 349 enable_shared=yes 350 fi 351 done 352 IFS="$ac_save_ifs" 353 ;; 354esac], 355enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl 356]) 357 358# AC_DISABLE_SHARED - set the default shared flag to --disable-shared 359AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl 360AC_ENABLE_SHARED(no)]) 361 362# AC_ENABLE_STATIC - implement the --enable-static flag 363# Usage: AC_ENABLE_STATIC[(DEFAULT)] 364# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to 365# `yes'. 366AC_DEFUN(AC_ENABLE_STATIC, [dnl 367define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl 368AC_ARG_ENABLE(static, 369changequote(<<, >>)dnl 370<< --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT], 371changequote([, ])dnl 372[p=${PACKAGE-default} 373case "$enableval" in 374yes) enable_static=yes ;; 375no) enable_static=no ;; 376*) 377 enable_static=no 378 # Look at the argument we got. We use all the common list separators. 379 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," 380 for pkg in $enableval; do 381 if test "X$pkg" = "X$p"; then 382 enable_static=yes 383 fi 384 done 385 IFS="$ac_save_ifs" 386 ;; 387esac], 388enable_static=AC_ENABLE_STATIC_DEFAULT)dnl 389]) 390 391# AC_DISABLE_STATIC - set the default static flag to --disable-static 392AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl 393AC_ENABLE_STATIC(no)]) 394 395 396# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag 397# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)] 398# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to 399# `yes'. 400AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl 401define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl 402AC_ARG_ENABLE(fast-install, 403changequote(<<, >>)dnl 404<< --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT], 405changequote([, ])dnl 406[p=${PACKAGE-default} 407case "$enableval" in 408yes) enable_fast_install=yes ;; 409no) enable_fast_install=no ;; 410*) 411 enable_fast_install=no 412 # Look at the argument we got. We use all the common list separators. 413 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," 414 for pkg in $enableval; do 415 if test "X$pkg" = "X$p"; then 416 enable_fast_install=yes 417 fi 418 done 419 IFS="$ac_save_ifs" 420 ;; 421esac], 422enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl 423]) 424 425# AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install 426AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl 427AC_ENABLE_FAST_INSTALL(no)]) 428 429# AC_PROG_LD - find the path to the GNU or non-GNU linker 430AC_DEFUN(AC_PROG_LD, 431[AC_ARG_WITH(gnu-ld, 432[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], 433test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) 434AC_REQUIRE([AC_PROG_CC])dnl 435AC_REQUIRE([AC_CANONICAL_HOST])dnl 436AC_REQUIRE([AC_CANONICAL_BUILD])dnl 437ac_prog=ld 438if test "$ac_cv_prog_gcc" = yes; then 439 # Check if gcc -print-prog-name=ld gives a path. 440 AC_MSG_CHECKING([for ld used by GCC]) 441 case $host in 442 *-*-mingw*) 443 # gcc leaves a trailing carriage return which upsets mingw 444 ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; 445 *) 446 ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; 447 esac 448 case "$ac_prog" in 449 # Accept absolute paths. 450changequote(,)dnl 451 [\\/]* | [A-Za-z]:[\\/]*) 452 re_direlt='/[^/][^/]*/\.\./' 453changequote([,])dnl 454 # Canonicalize the path of ld 455 ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` 456 while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do 457 ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` 458 done 459 test -z "$LD" && LD="$ac_prog" 460 ;; 461 "") 462 # If it fails, then pretend we aren't using GCC. 463 ac_prog=ld 464 ;; 465 *) 466 # If it is relative, then search for the first ld in PATH. 467 with_gnu_ld=unknown 468 ;; 469 esac 470elif test "$with_gnu_ld" = yes; then 471 AC_MSG_CHECKING([for GNU ld]) 472else 473 AC_MSG_CHECKING([for non-GNU ld]) 474fi 475AC_CACHE_VAL(ac_cv_path_LD, 476[if test -z "$LD"; then 477 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" 478 for ac_dir in $PATH; do 479 test -z "$ac_dir" && ac_dir=. 480 if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then 481 ac_cv_path_LD="$ac_dir/$ac_prog" 482 # Check to see if the program is GNU ld. I'd rather use --version, 483 # but apparently some GNU ld's only accept -v. 484 # Break only if it was the GNU/non-GNU ld that we prefer. 485 if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then 486 test "$with_gnu_ld" != no && break 487 else 488 test "$with_gnu_ld" != yes && break 489 fi 490 fi 491 done 492 IFS="$ac_save_ifs" 493else 494 ac_cv_path_LD="$LD" # Let the user override the test with a path. 495fi]) 496LD="$ac_cv_path_LD" 497if test -n "$LD"; then 498 AC_MSG_RESULT($LD) 499else 500 AC_MSG_RESULT(no) 501fi 502test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) 503AC_SUBST(LD) 504AC_PROG_LD_GNU 505]) 506 507AC_DEFUN(AC_PROG_LD_GNU, 508[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld, 509[# I'd rather use --version here, but apparently some GNU ld's only accept -v. 510if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then 511 ac_cv_prog_gnu_ld=yes 512else 513 ac_cv_prog_gnu_ld=no 514fi]) 515]) 516 517# AC_PROG_NM - find the path to a BSD-compatible name lister 518AC_DEFUN(AC_PROG_NM, 519[AC_MSG_CHECKING([for BSD-compatible nm]) 520AC_CACHE_VAL(ac_cv_path_NM, 521[if test -n "$NM"; then 522 # Let the user override the test. 523 ac_cv_path_NM="$NM" 524else 525 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" 526 for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do 527 test -z "$ac_dir" && ac_dir=. 528 if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then 529 # Check to see if the nm accepts a BSD-compat flag. 530 # Adding the `sed 1q' prevents false positives on HP-UX, which says: 531 # nm: unknown option "B" ignored 532 if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then 533 ac_cv_path_NM="$ac_dir/nm -B" 534 break 535 elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then 536 ac_cv_path_NM="$ac_dir/nm -p" 537 break 538 else 539 ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but 540 continue # so that we can try to find one that supports BSD flags 541 fi 542 fi 543 done 544 IFS="$ac_save_ifs" 545 test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm 546fi]) 547NM="$ac_cv_path_NM" 548AC_MSG_RESULT([$NM]) 549AC_SUBST(NM) 550]) 551 552# AC_CHECK_LIBM - check for math library 553AC_DEFUN(AC_CHECK_LIBM, 554[AC_REQUIRE([AC_CANONICAL_HOST])dnl 555LIBM= 556case "$host" in 557*-*-beos* | *-*-cygwin*) 558 # These system don't have libm 559 ;; 560*-ncr-sysv4.3*) 561 AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") 562 AC_CHECK_LIB(m, main, LIBM="$LIBM -lm") 563 ;; 564*) 565 AC_CHECK_LIB(m, main, LIBM="-lm") 566 ;; 567esac 568]) 569 570# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for 571# the libltdl convenience library, adds --enable-ltdl-convenience to 572# the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor 573# is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed 574# to be `${top_builddir}/libltdl'. Make sure you start DIR with 575# '${top_builddir}/' (note the single quotes!) if your package is not 576# flat, and, if you're not using automake, define top_builddir as 577# appropriate in the Makefiles. 578AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl 579 case "$enable_ltdl_convenience" in 580 no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; 581 "") enable_ltdl_convenience=yes 582 ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; 583 esac 584 LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdlc.la 585 INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl']) 586]) 587 588# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for 589# the libltdl installable library, and adds --enable-ltdl-install to 590# the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor 591# is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed 592# to be `${top_builddir}/libltdl'. Make sure you start DIR with 593# '${top_builddir}/' (note the single quotes!) if your package is not 594# flat, and, if you're not using automake, define top_builddir as 595# appropriate in the Makefiles. 596# In the future, this macro may have to be called after AC_PROG_LIBTOOL. 597AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl 598 AC_CHECK_LIB(ltdl, main, 599 [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], 600 [if test x"$enable_ltdl_install" = xno; then 601 AC_MSG_WARN([libltdl not installed, but installation disabled]) 602 else 603 enable_ltdl_install=yes 604 fi 605 ]) 606 if test x"$enable_ltdl_install" = x"yes"; then 607 ac_configure_args="$ac_configure_args --enable-ltdl-install" 608 LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdl.la 609 INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl']) 610 else 611 ac_configure_args="$ac_configure_args --enable-ltdl-install=no" 612 LIBLTDL="-lltdl" 613 INCLTDL= 614 fi 615]) 616 617dnl old names 618AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl 619AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl 620AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl 621AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl 622AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl 623AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl 624AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl 625 626dnl This is just to silence aclocal about the macro not being used 627ifelse([AC_DISABLE_FAST_INSTALL])dnl 628 629 630dnl Thanks to Ingo Ruhnke <grumbel@gmx.de> 631AC_DEFUN(MY_EXPAND_DIR, [ 632 $1=$2 633 $1=`( 634 test "x$prefix" = xNONE && prefix=${ac_default_prefix} 635 test "x$exec_prefix" = xNONE && exec_prefix=${prefix} 636 eval echo \""[$]$1"\" 637 )` 638 ]) 639