acx.m4 revision 1.1.1.4
1# Autoconf M4 include file defining utility macros for complex Canadian 2# cross builds. 3 4dnl #### 5dnl # _GCC_TOPLEV_NONCANONICAL_BUILD 6dnl # $build_alias or canonical $build if blank. 7dnl # Used when we would use $build_alias, but empty is not OK. 8AC_DEFUN([_GCC_TOPLEV_NONCANONICAL_BUILD], 9[AC_REQUIRE([AC_CANONICAL_BUILD]) []dnl 10case ${build_alias} in 11 "") build_noncanonical=${build} ;; 12 *) build_noncanonical=${build_alias} ;; 13esac 14]) []dnl # _GCC_TOPLEV_NONCANONICAL_BUILD 15 16dnl #### 17dnl # _GCC_TOPLEV_NONCANONICAL_HOST 18dnl # $host_alias, or $build_noncanonical if blank. 19dnl # Used when we would use $host_alias, but empty is not OK. 20AC_DEFUN([_GCC_TOPLEV_NONCANONICAL_HOST], 21[AC_REQUIRE([_GCC_TOPLEV_NONCANONICAL_BUILD]) []dnl 22case ${host_alias} in 23 "") host_noncanonical=${build_noncanonical} ;; 24 *) host_noncanonical=${host_alias} ;; 25esac 26]) []dnl # _GCC_TOPLEV_NONCANONICAL_HOST 27 28dnl #### 29dnl # _GCC_TOPLEV_NONCANONICAL_TARGET 30dnl # $target_alias or $host_noncanonical if blank. 31dnl # Used when we would use $target_alias, but empty is not OK. 32AC_DEFUN([_GCC_TOPLEV_NONCANONICAL_TARGET], 33[AC_REQUIRE([_GCC_TOPLEV_NONCANONICAL_HOST]) []dnl 34case ${target_alias} in 35 "") target_noncanonical=${host_noncanonical} ;; 36 *) target_noncanonical=${target_alias} ;; 37esac 38]) []dnl # _GCC_TOPLEV_NONCANONICAL_TARGET 39 40dnl #### 41dnl # ACX_NONCANONICAL_BUILD 42dnl # Like underscored version, but AC_SUBST's. 43AC_DEFUN([ACX_NONCANONICAL_BUILD], 44[AC_REQUIRE([_GCC_TOPLEV_NONCANONICAL_BUILD]) []dnl 45AC_SUBST(build_noncanonical) 46]) []dnl # ACX_NONCANONICAL_BUILD 47 48dnl #### 49dnl # ACX_NONCANONICAL_HOST 50dnl # Like underscored version, but AC_SUBST's. 51AC_DEFUN([ACX_NONCANONICAL_HOST], 52[AC_REQUIRE([_GCC_TOPLEV_NONCANONICAL_HOST]) []dnl 53AC_SUBST(host_noncanonical) 54]) []dnl # ACX_NONCANONICAL_HOST 55 56dnl #### 57dnl # ACX_NONCANONICAL_TARGET 58dnl # Like underscored version, but AC_SUBST's. 59AC_DEFUN([ACX_NONCANONICAL_TARGET], 60[AC_REQUIRE([_GCC_TOPLEV_NONCANONICAL_TARGET]) []dnl 61AC_SUBST(target_noncanonical) 62]) []dnl # ACX_NONCANONICAL_TARGET 63 64dnl #### 65dnl # GCC_TOPLEV_SUBDIRS 66dnl # GCC & friends build 'build', 'host', and 'target' tools. These must 67dnl # be separated into three well-known subdirectories of the build directory: 68dnl # build_subdir, host_subdir, and target_subdir. The values are determined 69dnl # here so that they can (theoretically) be changed in the future. They 70dnl # were previously reproduced across many different files. 71dnl # 72dnl # This logic really amounts to very little with autoconf 2.13; it will 73dnl # amount to a lot more with autoconf 2.5x. 74AC_DEFUN([GCC_TOPLEV_SUBDIRS], 75[AC_REQUIRE([_GCC_TOPLEV_NONCANONICAL_TARGET]) []dnl 76AC_REQUIRE([_GCC_TOPLEV_NONCANONICAL_BUILD]) []dnl 77 78# post-stage1 host modules use a different CC_FOR_BUILD so, in order to 79# have matching libraries, they should use host libraries: Makefile.tpl 80# arranges to pass --with-build-libsubdir=$(HOST_SUBDIR). 81# However, they still use the build modules, because the corresponding 82# host modules (e.g. bison) are only built for the host when bootstrap 83# finishes. So: 84# - build_subdir is where we find build modules, and never changes. 85# - build_libsubdir is where we find build libraries, and can be overridden. 86 87# Prefix 'build-' so this never conflicts with target_subdir. 88build_subdir="build-${build_noncanonical}" 89AC_ARG_WITH(build-libsubdir, 90[ --with-build-libsubdir=[DIR] Directory where to find libraries for build system], 91build_libsubdir="$withval", 92build_libsubdir="$build_subdir") 93# --srcdir=. covers the toplevel, while "test -d" covers the subdirectories 94if ( test $srcdir = . && test -d gcc ) \ 95 || test -d $srcdir/../host-${host_noncanonical}; then 96 host_subdir="host-${host_noncanonical}" 97else 98 host_subdir=. 99fi 100# No prefix. 101target_subdir=${target_noncanonical} 102AC_SUBST([build_libsubdir]) []dnl 103AC_SUBST([build_subdir]) []dnl 104AC_SUBST([host_subdir]) []dnl 105AC_SUBST([target_subdir]) []dnl 106]) []dnl # GCC_TOPLEV_SUBDIRS 107 108 109#### 110# _NCN_TOOL_PREFIXES: Some stuff that oughtta be done in AC_CANONICAL_SYSTEM 111# or AC_INIT. 112# These demand that AC_CANONICAL_SYSTEM be called beforehand. 113AC_DEFUN([_NCN_TOOL_PREFIXES], 114[ncn_tool_prefix= 115test -n "$host_alias" && ncn_tool_prefix=$host_alias- 116ncn_target_tool_prefix= 117test -n "$target_alias" && ncn_target_tool_prefix=$target_alias- 118]) []dnl # _NCN_TOOL_PREFIXES 119 120#### 121# NCN_STRICT_CHECK_TOOLS(variable, progs-to-check-for,[value-if-not-found],[path]) 122# Like plain AC_CHECK_TOOLS, but require prefix if build!=host. 123 124AC_DEFUN([NCN_STRICT_CHECK_TOOLS], 125[AC_REQUIRE([_NCN_TOOL_PREFIXES]) []dnl 126AC_ARG_VAR([$1], [$1 for the host]) 127 128if test -n "[$]$1"; then 129 ac_cv_prog_$1=[$]$1 130elif test -n "$ac_cv_prog_$1"; then 131 $1=$ac_cv_prog_$1 132fi 133 134if test -n "$ac_cv_prog_$1"; then 135 for ncn_progname in $2; do 136 AC_CHECK_PROG([$1], [${ncn_progname}], [${ncn_progname}], , [$4]) 137 done 138fi 139 140for ncn_progname in $2; do 141 if test -n "$ncn_tool_prefix"; then 142 AC_CHECK_PROG([$1], [${ncn_tool_prefix}${ncn_progname}], 143 [${ncn_tool_prefix}${ncn_progname}], , [$4]) 144 fi 145 if test -z "$ac_cv_prog_$1" && test $build = $host ; then 146 AC_CHECK_PROG([$1], [${ncn_progname}], [${ncn_progname}], , [$4]) 147 fi 148 test -n "$ac_cv_prog_$1" && break 149done 150 151if test -z "$ac_cv_prog_$1" ; then 152 ifelse([$3],[], [set dummy $2 153 if test $build = $host ; then 154 $1="[$]2" 155 else 156 $1="${ncn_tool_prefix}[$]2" 157 fi], [$1="$3"]) 158fi 159]) []dnl # NCN_STRICT_CHECK_TOOLS 160 161#### 162# NCN_STRICT_CHECK_TARGET_TOOLS(variable, progs-to-check-for,[value-if-not-found],[path]) 163# Like CVS Autoconf AC_CHECK_TARGET_TOOLS, but require prefix if build!=target. 164 165AC_DEFUN([NCN_STRICT_CHECK_TARGET_TOOLS], 166[AC_REQUIRE([_NCN_TOOL_PREFIXES]) []dnl 167AC_ARG_VAR([$1], patsubst([$1], [_FOR_TARGET$], [])[ for the target]) 168 169if test -n "[$]$1"; then 170 ac_cv_prog_$1=[$]$1 171elif test -n "$ac_cv_prog_$1"; then 172 $1=$ac_cv_prog_$1 173fi 174 175if test -n "$ac_cv_prog_$1"; then 176 for ncn_progname in $2; do 177 AC_CHECK_PROG([$1], [${ncn_progname}], [${ncn_progname}], , [$4]) 178 done 179fi 180 181if test -z "$ac_cv_prog_$1" && test -n "$with_build_time_tools"; then 182 for ncn_progname in $2; do 183 AC_MSG_CHECKING([for ${ncn_progname} in $with_build_time_tools]) 184 if test -x $with_build_time_tools/${ncn_progname}; then 185 ac_cv_prog_$1=$with_build_time_tools/${ncn_progname} 186 AC_MSG_RESULT(yes) 187 break 188 else 189 AC_MSG_RESULT(no) 190 fi 191 done 192fi 193 194if test -z "$ac_cv_prog_$1"; then 195 for ncn_progname in $2; do 196 if test -n "$ncn_target_tool_prefix"; then 197 AC_CHECK_PROG([$1], [${ncn_target_tool_prefix}${ncn_progname}], 198 [${ncn_target_tool_prefix}${ncn_progname}], , [$4]) 199 fi 200 if test -z "$ac_cv_prog_$1" && test $build = $target ; then 201 AC_CHECK_PROG([$1], [${ncn_progname}], [${ncn_progname}], , [$4]) 202 fi 203 test -n "$ac_cv_prog_$1" && break 204 done 205fi 206 207if test -z "$ac_cv_prog_$1" ; then 208 ifelse([$3],[], [set dummy $2 209 if test $build = $target ; then 210 $1="[$]2" 211 else 212 $1="${ncn_target_tool_prefix}[$]2" 213 fi], [$1="$3"]) 214else 215 $1="$ac_cv_prog_$1" 216fi 217]) []dnl # NCN_STRICT_CHECK_TARGET_TOOLS 218 219 220# Backported from Autoconf 2.5x; can go away when and if 221# we switch. Put the OS path separator in $PATH_SEPARATOR. 222AC_DEFUN([ACX_PATH_SEP], [ 223# The user is always right. 224if test "${PATH_SEPARATOR+set}" != set; then 225 echo "#! /bin/sh" >conf$$.sh 226 echo "exit 0" >>conf$$.sh 227 chmod +x conf$$.sh 228 if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then 229 PATH_SEPARATOR=';' 230 else 231 PATH_SEPARATOR=: 232 fi 233 rm -f conf$$.sh 234fi 235]) 236 237 238dnl #### 239dnl # GCC_BASE_VER 240dnl # Determine GCC version number to use in compiler directories. 241 242AC_DEFUN([GCC_BASE_VER], 243[ 244 get_gcc_base_ver="cat" 245 AC_ARG_WITH(gcc-major-version-only, 246 [AS_HELP_STRING([--with-gcc-major-version-only], [use only GCC major number in filesystem paths])], 247 [if test x$with_gcc_major_version_only = xyes ; then 248 changequote(,)dnl 249 get_gcc_base_ver="sed -e 's/^\([0-9]*\).*/\1/'" 250 changequote([,])dnl 251 fi 252 ]) 253 AC_SUBST(get_gcc_base_ver) 254]) 255 256 257AC_DEFUN([ACX_TOOL_DIRS], [ 258AC_REQUIRE([ACX_PATH_SEP]) 259AC_REQUIRE([GCC_BASE_VER]) 260if test "x$exec_prefix" = xNONE; then 261 if test "x$prefix" = xNONE; then 262 gcc_cv_tool_prefix=$ac_default_prefix 263 else 264 gcc_cv_tool_prefix=$prefix 265 fi 266else 267 gcc_cv_tool_prefix=$exec_prefix 268fi 269 270# If there is no compiler in the tree, use the PATH only. In any 271# case, if there is no compiler in the tree nobody should use 272# AS_FOR_TARGET and LD_FOR_TARGET. 273if test x$host = x$build && test -f $srcdir/gcc/BASE-VER; then 274 if test x$with_gcc_major_version_only = xyes ; then 275 changequote(,)dnl 276 gcc_version=`sed -e 's/^\([0-9]*\).*$/\1/' $srcdir/gcc/BASE-VER` 277 changequote([,])dnl 278 else 279 gcc_version=`cat $srcdir/gcc/BASE-VER` 280 fi 281 gcc_cv_tool_dirs="$gcc_cv_tool_prefix/libexec/gcc/$target_noncanonical/$gcc_version$PATH_SEPARATOR" 282 gcc_cv_tool_dirs="$gcc_cv_tool_dirs$gcc_cv_tool_prefix/libexec/gcc/$target_noncanonical$PATH_SEPARATOR" 283 gcc_cv_tool_dirs="$gcc_cv_tool_dirs/usr/lib/gcc/$target_noncanonical/$gcc_version$PATH_SEPARATOR" 284 gcc_cv_tool_dirs="$gcc_cv_tool_dirs/usr/lib/gcc/$target_noncanonical$PATH_SEPARATOR" 285 gcc_cv_tool_dirs="$gcc_cv_tool_dirs$gcc_cv_tool_prefix/$target_noncanonical/bin/$target_noncanonical/$gcc_version$PATH_SEPARATOR" 286 gcc_cv_tool_dirs="$gcc_cv_tool_dirs$gcc_cv_tool_prefix/$target_noncanonical/bin$PATH_SEPARATOR" 287else 288 gcc_cv_tool_dirs= 289fi 290 291if test x$build = x$target && test -n "$md_exec_prefix"; then 292 gcc_cv_tool_dirs="$gcc_cv_tool_dirs$md_exec_prefix$PATH_SEPARATOR" 293fi 294 295]) []dnl # ACX_TOOL_DIRS 296 297# ACX_HAVE_GCC_FOR_TARGET 298# Check if the variable GCC_FOR_TARGET really points to a GCC binary. 299AC_DEFUN([ACX_HAVE_GCC_FOR_TARGET], [ 300cat > conftest.c << \EOF 301#ifdef __GNUC__ 302 gcc_yay; 303#endif 304EOF 305if ($GCC_FOR_TARGET -E conftest.c | grep gcc_yay) > /dev/null 2>&1; then 306 have_gcc_for_target=yes 307else 308 GCC_FOR_TARGET=${ncn_target_tool_prefix}gcc 309 have_gcc_for_target=no 310fi 311rm conftest.c 312]) 313 314# ACX_CHECK_INSTALLED_TARGET_TOOL(VAR, PROG) 315# Searching for installed target binutils. We need to take extra care, 316# else we may find the wrong assembler, linker, etc., and lose. 317# 318# First try --with-build-time-tools, if specified. 319# 320# For build != host, we ask the installed GCC for the name of the tool it 321# uses, and accept it if it is an absolute path. This is because the 322# only good choice for a compiler is the same GCC version that is being 323# installed (or we couldn't make target libraries), and we assume that 324# on the host system we'll have not only the same GCC version, but also 325# the same binutils version. 326# 327# For build == host, search the same directories that the installed 328# compiler will search. We used to do this for the assembler, linker, 329# and nm only; for simplicity of configuration, however, we extend this 330# criterion to tools (such as ar and ranlib) that are never invoked by 331# the compiler, to avoid mismatches. 332# 333# Also note we have to check MD_EXEC_PREFIX before checking the user's path 334# if build == target. This makes the most sense only when bootstrapping, 335# but we also do so when build != host. In this case, we hope that the 336# build and host systems will have similar contents of MD_EXEC_PREFIX. 337# 338# If we do not find a suitable binary, then try the user's path. 339 340AC_DEFUN([ACX_CHECK_INSTALLED_TARGET_TOOL], [ 341AC_REQUIRE([ACX_TOOL_DIRS]) 342AC_REQUIRE([ACX_HAVE_GCC_FOR_TARGET]) 343if test -z "$ac_cv_path_$1" ; then 344 if test -n "$with_build_time_tools"; then 345 AC_MSG_CHECKING([for $2 in $with_build_time_tools]) 346 if test -x $with_build_time_tools/$2; then 347 $1=`cd $with_build_time_tools && pwd`/$2 348 ac_cv_path_$1=[$]$1 349 AC_MSG_RESULT([$ac_cv_path_$1]) 350 else 351 AC_MSG_RESULT(no) 352 fi 353 elif test $build != $host && test $have_gcc_for_target = yes; then 354 $1=`$GCC_FOR_TARGET --print-prog-name=$2` 355 test [$]$1 = $2 && $1= 356 test -n "[$]$1" && ac_cv_path_$1=[$]$1 357 fi 358fi 359if test -z "$ac_cv_path_$1" && test -n "$gcc_cv_tool_dirs"; then 360 AC_PATH_PROG([$1], [$2], [], [$gcc_cv_tool_dirs]) 361fi 362if test -z "$ac_cv_path_$1" ; then 363 NCN_STRICT_CHECK_TARGET_TOOLS([$1], [$2]) 364else 365 $1=$ac_cv_path_$1 366fi 367]) []dnl # ACX_CHECK_INSTALLED_TARGET_TOOL 368 369### 370# AC_PROG_CPP_WERROR 371# Used for autoconf 2.5x to force AC_PREPROC_IFELSE to reject code which 372# triggers warnings from the preprocessor. Will be in autoconf 2.58. 373# For now, using this also overrides header checks to use only the 374# preprocessor (matches 2.13 behavior; matching 2.58's behavior is a 375# bit harder from here). 376# Eventually autoconf will default to checking headers with the compiler 377# instead, and we'll have to do this differently. 378 379AC_DEFUN([AC_PROG_CPP_WERROR], 380[AC_REQUIRE([AC_PROG_CPP])dnl 381m4_define([AC_CHECK_HEADER],m4_defn([_AC_CHECK_HEADER_OLD])) 382ac_c_preproc_warn_flag=yes])# AC_PROG_CPP_WERROR 383 384# Test for GNAT. 385# We require the gnatbind & gnatmake programs, as well as a compiler driver 386# that understands Ada. We use the user's CC setting, already found, and 387# possibly add $1 to the command-line parameters. 388# 389# Sets the shell variable have_gnat to yes or no as appropriate, and 390# substitutes GNATBIND and GNATMAKE. 391AC_DEFUN([ACX_PROG_GNAT], 392[AC_REQUIRE([AC_CHECK_TOOL_PREFIX]) 393AC_REQUIRE([AC_PROG_CC]) 394AC_CHECK_TOOL(GNATBIND, gnatbind, no) 395AC_CHECK_TOOL(GNATMAKE, gnatmake, no) 396AC_CACHE_CHECK([whether compiler driver understands Ada], 397 acx_cv_cc_gcc_supports_ada, 398[cat >conftest.adb <<EOF 399procedure conftest is begin null; end conftest; 400EOF 401acx_cv_cc_gcc_supports_ada=no 402# There is a bug in old released versions of GCC which causes the 403# driver to exit successfully when the appropriate language module 404# has not been installed. This is fixed in 2.95.4, 3.0.2, and 3.1. 405# Therefore we must check for the error message as well as an 406# unsuccessful exit. 407# Other compilers, like HP Tru64 UNIX cc, exit successfully when 408# given a .adb file, but produce no object file. So we must check 409# if an object file was really produced to guard against this. 410errors=`(${CC} $1[]m4_ifval([$1], [ ])-c conftest.adb) 2>&1 || echo failure` 411if test x"$errors" = x && test -f conftest.$ac_objext; then 412 acx_cv_cc_gcc_supports_ada=yes 413fi 414rm -f conftest.*]) 415 416if test "x$GNATBIND" != xno && test "x$GNATMAKE" != xno && test x$acx_cv_cc_gcc_supports_ada != xno; then 417 have_gnat=yes 418else 419 have_gnat=no 420fi 421]) 422 423# Test for D. 424AC_DEFUN([ACX_PROG_GDC], 425[AC_REQUIRE([AC_CHECK_TOOL_PREFIX]) 426AC_REQUIRE([AC_PROG_CC]) 427AC_CHECK_TOOL(GDC, gdc, no) 428AC_CACHE_CHECK([whether the D compiler works], 429 acx_cv_d_compiler_works, 430[cat >conftest.d <<EOF 431module conftest; int main() { return 0; } 432EOF 433acx_cv_d_compiler_works=no 434if test "x$GDC" != xno; then 435 errors=`(${GDC} $1[]m4_ifval([$1], [ ])-c conftest.d) 2>&1 || echo failure` 436 if test x"$errors" = x && test -f conftest.$ac_objext; then 437 acx_cv_d_compiler_works=yes 438 fi 439 rm -f conftest.* 440fi]) 441if test "x$GDC" != xno && test x$acx_cv_d_compiler_works != xno; then 442 have_gdc=yes 443else 444 have_gdc=no 445fi 446]) 447 448dnl 'make compare' can be significantly faster, if cmp itself can 449dnl skip bytes instead of using tail. The test being performed is 450dnl "if cmp --ignore-initial=2 t1 t2 && ! cmp --ignore-initial=1 t1 t2" 451dnl but we need to sink errors and handle broken shells. We also test 452dnl for the parameter format "cmp file1 file2 skip1 skip2" which is 453dnl accepted by cmp on some systems. 454AC_DEFUN([ACX_PROG_CMP_IGNORE_INITIAL], 455[AC_CACHE_CHECK([how to compare bootstrapped objects], gcc_cv_prog_cmp_skip, 456[ echo abfoo >t1 457 echo cdfoo >t2 458 gcc_cv_prog_cmp_skip='tail -c +17 $$f1 > tmp-foo1; tail -c +17 $$f2 > tmp-foo2; cmp tmp-foo1 tmp-foo2' 459 if cmp t1 t2 2 2 > /dev/null 2>&1; then 460 if cmp t1 t2 1 1 > /dev/null 2>&1; then 461 : 462 else 463 gcc_cv_prog_cmp_skip='cmp $$f1 $$f2 16 16' 464 fi 465 fi 466 if cmp --ignore-initial=2 t1 t2 > /dev/null 2>&1; then 467 if cmp --ignore-initial=1 t1 t2 > /dev/null 2>&1; then 468 : 469 else 470 gcc_cv_prog_cmp_skip='cmp --ignore-initial=16 $$f1 $$f2' 471 fi 472 fi 473 rm t1 t2 474]) 475do_compare="$gcc_cv_prog_cmp_skip" 476AC_SUBST(do_compare) 477]) 478 479dnl See whether we can include both string.h and strings.h. 480AC_DEFUN([ACX_HEADER_STRING], 481[AC_CACHE_CHECK([whether string.h and strings.h may both be included], 482 gcc_cv_header_string, 483[AC_TRY_COMPILE([#include <string.h> 484#include <strings.h>], , gcc_cv_header_string=yes, gcc_cv_header_string=no)]) 485if test $gcc_cv_header_string = yes; then 486 AC_DEFINE(STRING_WITH_STRINGS, 1, [Define if you can safely include both <string.h> and <strings.h>.]) 487fi 488]) 489 490dnl See if stdbool.h properly defines bool and true/false. 491dnl Check whether _Bool is built-in. 492AC_DEFUN([ACX_HEADER_STDBOOL], 493[AC_CACHE_CHECK([for working stdbool.h], 494 ac_cv_header_stdbool_h, 495[AC_TRY_COMPILE([#include <stdbool.h>], 496[bool foo = false;], 497ac_cv_header_stdbool_h=yes, ac_cv_header_stdbool_h=no)]) 498if test $ac_cv_header_stdbool_h = yes; then 499 AC_DEFINE(HAVE_STDBOOL_H, 1, 500 [Define if you have a working <stdbool.h> header file.]) 501fi 502AC_CACHE_CHECK(for built-in _Bool, gcc_cv_c__bool, 503[AC_TRY_COMPILE(, 504[_Bool foo;], 505gcc_cv_c__bool=yes, gcc_cv_c__bool=no) 506]) 507if test $gcc_cv_c__bool = yes; then 508 AC_DEFINE(HAVE__BOOL, 1, [Define if the \`_Bool' type is built-in.]) 509fi 510]) 511 512dnl See if hard links work and if not, try to substitute $1 or simple copy. 513AC_DEFUN([ACX_PROG_LN], 514[AC_MSG_CHECKING(whether ln works) 515AC_CACHE_VAL(acx_cv_prog_LN, 516[rm -f conftestdata_t 517echo >conftestdata_f 518if ln conftestdata_f conftestdata_t 2>/dev/null 519then 520 acx_cv_prog_LN=ln 521else 522 acx_cv_prog_LN=no 523fi 524rm -f conftestdata_f conftestdata_t 525])dnl 526if test $acx_cv_prog_LN = no; then 527 LN="ifelse([$1],,cp,[$1])" 528 AC_MSG_RESULT([no, using $LN]) 529else 530 LN="$acx_cv_prog_LN" 531 AC_MSG_RESULT(yes) 532fi 533AC_SUBST(LN)dnl 534]) 535 536dnl GCC_TARGET_TOOL(PROGRAM, TARGET-VAR, HOST-VAR, IN-TREE-TOOL, LANGUAGE) 537AC_DEFUN([GCC_TARGET_TOOL], 538[AC_MSG_CHECKING(where to find the target $1) 539if test "x${build}" != "x${host}" ; then 540 if expr "x[$]$2" : "x/" > /dev/null; then 541 # We already found the complete path 542 ac_dir=`dirname [$]$2` 543 AC_MSG_RESULT(pre-installed in $ac_dir) 544 else 545 # Canadian cross, just use what we found 546 AC_MSG_RESULT(pre-installed) 547 fi 548else 549 ifelse([$4],,, 550 [ok=yes 551 case " ${configdirs} " in 552 *" patsubst([$4], [/.*], []) "*) ;; 553 *) ok=no ;; 554 esac 555 ifelse([$5],,, 556 [case ,${enable_languages}, in 557 *,$5,*) ;; 558 *) ok=no ;; 559 esac]) 560 if test $ok = yes; then 561 # An in-tree tool is available and we can use it 562 $2='$$r/$(HOST_SUBDIR)/$4' 563 AC_MSG_RESULT(just compiled) 564 el])if expr "x[$]$2" : "x/" > /dev/null; then 565 # We already found the complete path 566 ac_dir=`dirname [$]$2` 567 AC_MSG_RESULT(pre-installed in $ac_dir) 568 elif test "x$target" = "x$host"; then 569 # We can use an host tool 570 $2='$($3)' 571 AC_MSG_RESULT(host tool) 572 else 573 # We need a cross tool 574 AC_MSG_RESULT(pre-installed) 575 fi 576fi 577AC_SUBST($2)]) 578 579 580dnl Locate a program and check that its version is acceptable. 581dnl ACX_PROG_CHECK_VER(var, name, version-switch, 582dnl version-extract-regexp, version-glob) 583AC_DEFUN([ACX_CHECK_PROG_VER],[ 584 AC_CHECK_PROG([$1], [$2], [$2]) 585 if test -n "[$]$1"; then 586 # Found it, now check the version. 587 AC_CACHE_CHECK([for modern $2], 588 [gcc_cv_prog_$2_modern], 589 [ac_prog_version=`eval [$]$1 $3 2>&1 | 590 sed -n 's/^.*patsubst([[$4]],/,\/).*$/\1/p'` 591 592 [case $ac_prog_version in 593 '') gcc_cv_prog_$2_modern=no;; 594 $5) gcc_cv_prog_$2_modern=yes;; 595 *) gcc_cv_prog_$2_modern=no;; 596 esac] 597 ]) 598 else 599 gcc_cv_prog_$2_modern=no 600 fi 601 if test $gcc_cv_prog_$2_modern = no; then 602 $1="${CONFIG_SHELL-/bin/sh} $ac_aux_dir/missing $2" 603 fi 604]) 605 606dnl Support the --with-pkgversion configure option. 607dnl ACX_PKGVERSION(default-pkgversion) 608AC_DEFUN([ACX_PKGVERSION],[ 609 AC_ARG_WITH(pkgversion, 610 AS_HELP_STRING([--with-pkgversion=PKG], 611 [Use PKG in the version string in place of "$1"]), 612 [case "$withval" in 613 yes) AC_MSG_ERROR([package version not specified]) ;; 614 no) PKGVERSION= ;; 615 *) PKGVERSION="($withval) " ;; 616 esac], 617 PKGVERSION="($1) " 618 ) 619 AC_SUBST(PKGVERSION) 620]) 621 622dnl Support the --with-bugurl configure option. 623dnl ACX_BUGURL(default-bugurl) 624AC_DEFUN([ACX_BUGURL],[ 625 AC_ARG_WITH(bugurl, 626 AS_HELP_STRING([--with-bugurl=URL], 627 [Direct users to URL to report a bug]), 628 [case "$withval" in 629 yes) AC_MSG_ERROR([bug URL not specified]) ;; 630 no) BUGURL= 631 ;; 632 *) BUGURL="$withval" 633 ;; 634 esac], 635 BUGURL="$1" 636 ) 637 case ${BUGURL} in 638 "") 639 REPORT_BUGS_TO= 640 REPORT_BUGS_TEXI= 641 ;; 642 *) 643 REPORT_BUGS_TO="<$BUGURL>" 644 REPORT_BUGS_TEXI=@uref{`echo "$BUGURL" | sed 's/@/@@/g'`} 645 ;; 646 esac; 647 AC_SUBST(REPORT_BUGS_TO) 648 AC_SUBST(REPORT_BUGS_TEXI) 649]) 650 651dnl #### 652dnl # ACX_CHECK_CYGWIN_CAT_WORKS 653dnl # On Cygwin hosts, check that the cat command ignores 654dnl # carriage returns as otherwise builds will not work. 655dnl # See binutils PR 4334 for more details. 656AC_DEFUN([ACX_CHECK_CYGWIN_CAT_WORKS],[ 657AC_MSG_CHECKING([to see if cat works as expected]) 658echo a >cygwin-cat-check 659if test `cat cygwin-cat-check` = a ; then 660 rm cygwin-cat-check 661 AC_MSG_RESULT(yes) 662else 663 rm cygwin-cat-check 664 AC_MSG_RESULT(no) 665 AC_MSG_ERROR([The cat command does not ignore carriage return characters. 666 Please either mount the build directory in binary mode or run the following 667 commands before running any configure script: 668set -o igncr 669export SHELLOPTS 670 ]) 671fi 672]) 673