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