autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Warn on naked cross-tool names, add macros to detect target tools


From: Ralf Corsepius
Subject: Re: Warn on naked cross-tool names, add macros to detect target tools
Date: Tue, 16 Mar 2004 13:25:07 +0100

On Tue, 2004-03-16 at 12:23, Bonzini wrote:
> For target tools, it makes no sense to me to have naked names, so I am
> already looking for prefixed names only.  Ok to apply?
IMO, no, because AFAIS you seem to be mixing up target and host.

In autoconf host != build denotes cross compilation, IMO cross tools
should be picked up if build != host.


> 
> 2004-03-16  Paolo Bonzini  <address@hidden>
> 
>       * lib/autoconf/programs.m4 (AC_PATH_TOOL, AC_CHECK_TOOL,
>       AC_CHECK_TOOLS): Warn if a cross-tool is found without
>       a prefix.
>       (AC_PATH_TARGET_TOOL, AC_CHECK_TARGET_TOOL,
>       AC_CHECK_TARGET_TOOLS): New macros.
>       * doc/autoconf.texi (Generic Programs): Document
>       (AC_PATH_TARGET_TOOL, AC_CHECK_TARGET_TOOL,
>       AC_CHECK_TARGET_TOOLS, and warn for future changes
>       in the behavior of AC_PATH_TOOL, AC_CHECK_TOOL and
>       AC_CHECK_TOOLS.
>       * tests/mktests.sh: Do not generate tests for the
>       new macros.
> 
> Index: autoconf.texi
> ===================================================================
> RCS file: /cvsroot/autoconf/autoconf/doc/autoconf.texi,v
> retrieving revision 1.803
> diff -u -r1.803 autoconf.texi
> --- autoconf.texi     15 Mar 2004 22:00:06 -0000      1.803
> +++ autoconf.texi     16 Mar 2004 10:07:26 -0000
> @@ -3438,6 +3438,26 @@
>  is not changed.  Calls @code{AC_SUBST} for @var{variable}.
>  @end defmac
>  
> address@hidden AC_CHECK_TARGET_TOOL (@var{variable}, @var{prog-to-check-for}, 
> @ovar{value-if-not-found}, @ovar{path})
> address@hidden
> +Like @code{AC_CHECK_PROG}, but first looks for @var{prog-to-check-for}
> +with a prefix of the target type as determined by
> address@hidden, followed by a dash (@pxref{Canonicalizing}).
> +For example, if the user runs @samp{configure --target=i386-gnu}, then
> +this call:
> address@hidden
> +AC_CHECK_TARGET_TOOL(RANLIB, ranlib, :)
> address@hidden example
> address@hidden
> +sets @code{RANLIB} to @file{i386-gnu-ranlib} if that program exists in
> address@hidden, or otherwise to @samp{ranlib} if that program exists in
> address@hidden, or to @samp{:} if neither program exists.
> +This macro is rarely needed, because the host and the target are usually
> +the same (the notable difference being compilers, assemblers and linkers).
> +When building a cross-compiler this macro will @emph{not}
> +accept program names that are not prefixed with the host type.
> address@hidden defmac
> +
>  @defmac AC_CHECK_TOOL (@var{variable}, @var{prog-to-check-for}, 
> @ovar{value-if-not-found}, @ovar{path})
>  @acindex{CHECK_TOOL}
>  Like @code{AC_CHECK_PROG}, but first looks for @var{prog-to-check-for}
> @@ -3452,6 +3472,23 @@
>  sets @code{RANLIB} to @file{i386-gnu-ranlib} if that program exists in
>  @code{PATH}, or otherwise to @samp{ranlib} if that program exists in
>  @code{PATH}, or to @samp{:} if neither program exists.
> +
> +In the future, when cross-compiling this macro will @emph{not}
> +accept program names that are not prefixed with the host type.
> address@hidden defmac
> +
> address@hidden AC_CHECK_TARGET_TOOLS (@var{variable}, 
> @var{progs-to-check-for}, @ovar{value-if-not-found}, @ovar{path})
> address@hidden
> +Like @code{AC_CHECK_TARGET_TOOL}, each of the tools in the list
> address@hidden are checked with a prefix of the target type as
> +determined by @code{AC_CANONICAL_TARGET}, followed by a dash
> +(@pxref{Canonicalizing}).  If none of the tools can be found with a
> +prefix, and if the build and target types are equal, then the first one
> +without a prefix is used.  If a tool is found, set @var{variable} to
> +the name of that program.  If none of the tools in the list are found,
> +set @var{variable} to @var{value-if-not-found}; if @var{value-if-not-found}
> +is not specified, the value of @var{variable} is not changed.  Calls
> address@hidden for @var{variable}.
>  @end defmac
>  
>  @defmac AC_CHECK_TOOLS (@var{variable}, @var{progs-to-check-for}, 
> @ovar{value-if-not-found}, @ovar{path})
> @@ -3465,6 +3502,9 @@
>  the list are found, set @var{variable} to @var{value-if-not-found}; if
>  @var{value-if-not-found} is not specified, the value of @var{variable}
>  is not changed.  Calls @code{AC_SUBST} for @var{variable}.
> +
> +In the future, when cross-compiling this macro will @emph{not}
> +accept program names that are not prefixed with the host type.
>  @end defmac
>  
>  @defmac AC_PATH_PROG (@var{variable}, @var{prog-to-check-for}, 
> @ovar{value-if-not-found}, @ovar{path})
> @@ -3480,10 +3520,19 @@
>  found.
>  @end defmac
>  
> address@hidden AC_PATH_TARGET_TOOL (@var{variable}, @var{prog-to-check-for}, 
> @ovar{value-if-not-found}, @ovar{path})
> address@hidden
> +Like @code{AC_CHECK_TARGET_TOOL}, but set @var{variable} to the entire
> +path of the program if it is found.
> address@hidden defmac
> +
>  @defmac AC_PATH_TOOL (@var{variable}, @var{prog-to-check-for}, 
> @ovar{value-if-not-found}, @ovar{path})
>  @acindex{PATH_TOOL}
>  Like @code{AC_CHECK_TOOL}, but set @var{variable} to the entire
>  path of the program if it is found.
> +
> +In the future, when cross-compiling this macro will @emph{not}
> +accept program names that are not prefixed with the host type.
>  @end defmac
>  
> 
> Index: programs.m4
> ===================================================================
> RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/programs.m4,v
> retrieving revision 1.21
> diff -u -F^AC_DEFUN -r1.21 programs.m4
> --- programs.m4       30 Jan 2004 14:21:36 -0000      1.21
> +++ programs.m4       16 Mar 2004 10:15:19 -0000
> @@ -197,8 +197,17 @@ AC_DEFUN([AC_PATH_TOOL],
>  fi
>  if test -z "$ac_cv_path_$1"; then
>    ac_pt_$1=$$1
> -  AC_PATH_PROG([ac_pt_$1], [$2], [$3], [$4])
> -  $1=$ac_pt_$1
> +  AC_PATH_PROG([ac_pt_$1], [$2], [], [$4])
> +  if test "x$ac_pt_$1" = x; then
> +    $1="$3"
> +  else
> +    if test "$build" != "$host"; then
> +      AC_MSG_WARN([In the future, Autoconf will not detect cross-tools
> +whose name does not start with the host triplet.  If you think this
> +configuration is useful to you, please write to address@hidden)
> +    fi
> +    $1=$ac_pt_$1
> +  fi
>  else
>    $1="$ac_cv_path_$1"
>  fi
> @@ -214,8 +223,17 @@ AC_DEFUN([AC_CHECK_TOOL],
>  fi
>  if test -z "$ac_cv_prog_$1"; then
>    ac_ct_$1=$$1
> -  AC_CHECK_PROG([ac_ct_$1], [$2], [$2], [$3], [$4])
> -  $1=$ac_ct_$1
> +  AC_CHECK_PROG([ac_ct_$1], [$2], [$2], [], [$4])
> +  if test "x$ac_ct_$1" = x; then
> +    $1="$3"
> +  else
> +    if test "$build" != "$host"; then
> +      AC_MSG_WARN([In the future, Autoconf will not detect cross-tools
> +whose name does not start with the host triplet.  If you think this
> +configuration is useful to you, please write to address@hidden)
> +    fi
> +    $1=$ac_ct_$1
> +  fi
>  else
>    $1="$ac_cv_prog_$1"
>  fi
> @@ -240,10 +258,86 @@ AC_DEFUN([AC_CHECK_TOOLS],
>  fi
>  if test -z "$$1"; then
>    ac_ct_$1=$$1
> -  AC_CHECK_PROGS([ac_ct_$1], [$2], [$3], [$4])
> -  $1=$ac_ct_$1
> +  AC_CHECK_PROGS([ac_ct_$1], [$2], [], [$4])
> +  if test "x$ac_ct_$1" = x; then
> +    $1="$3"
> +  else
> +    if test "$build" != "$host"; then
> +      AC_MSG_WARN([In the future, Autoconf will not detect cross-tools
> +whose name does not start with the host triplet.  If you think this
> +configuration is useful to you, please write to address@hidden)
> +    fi
> +    $1=$ac_ct_$1
> +  fi
>  fi
>  ])# AC_CHECK_TOOLS
> +
> +
> +# AC_PATH_TARGET_TOOL(VARIABLE, PROG-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND], 
> [PATH])
> +# -----------------------------------------------------------------------
> +# (Use different variables $1 and ac_pt_$1 so that cache vars don't 
> conflict.)
> +AC_DEFUN([AC_PATH_TARGET_TOOL],
> +[AC_BEFORE([$0], [AC_CANONICAL_TARGET])dnl
> +AC_PATH_PROG([$1], [$target_alias-$2], , [$4])
> +if test -z "$ac_cv_path_$1"; then
> +  if test "$build" = "$target"; then
> +    ac_pt_$1=$$1
> +    AC_PATH_PROG([ac_pt_$1], [$2], [$3], [$4])
> +    $1=$ac_pt_$1
> +  else
> +    $1="$3"
> +  fi
> +else
> +  $1="$ac_cv_path_$1"
> +fi
> +])# AC_PATH_TARGET_TOOL
> +
> +
> +# AC_CHECK_TARGET_TOOL(VARIABLE, PROG-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND], 
> [PATH])
> +# ------------------------------------------------------------------------
> +# (Use different variables $1 and ac_ct_$1 so that cache vars don't 
> conflict.)
> +AC_DEFUN([AC_CHECK_TARGET_TOOL],
> +[AC_BEFORE([$0], [AC_CANONICAL_TARGET])dnl
> +AC_CHECK_PROG([$1], [$target_alias-$2], [$target_alias-$2], , [$4])
> +if test -z "$ac_cv_prog_$1"; then
> +  if test "$build" = "$target"; then
> +    ac_ct_$1=$$1
> +    AC_CHECK_PROG([ac_ct_$1], [$2], [$2], [$3], [$4])
> +    $1=ac_ct_$1
> +  else
> +    $1="$3"
> +  fi
> +else
> +  $1="$ac_cv_prog_$1"
> +fi
> +])# AC_CHECK_TARGET_TOOL
> +
> +
> +# AC_CHECK_TARGET_TOOLS(VARIABLE, PROGS-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND],
> +#                    [PATH])
> +# ------------------------------------------------------------------
> +# Check for each tool in PROGS-TO-CHECK-FOR with the cross prefix. If
> +# none can be found with a cross prefix, then use the first one that
> +# was found without the cross prefix.
> +AC_DEFUN([AC_CHECK_TARGET_TOOLS],
> +[AC_BEFORE([$0], [AC_CANONICAL_TARGET])dnl
> +for ac_prog in $2
> +do
> +  AC_CHECK_PROG([$1],
> +             [$target_alias-$ac_prog], [$target_alias-$ac_prog],,
> +             [$4])
> +  test -n "$$1" && break
> +done
> +if test -z "$$1"; then
> +  if test "$build" = "$target"; then
> +    ac_ct_$1=$$1
> +    AC_CHECK_PROGS([ac_ct_$1], [$2], [$3], [$4])
> +    $1=$ac_ct_$1
> +  else
> +    $1="$3"
> +  fi
> +fi
> +])# AC_CHECK_TARGET_TOOLS
>  
> 
> 
> Index: mktests.sh
> ===================================================================
> RCS file: /cvsroot/autoconf/autoconf/tests/mktests.sh,v
> retrieving revision 1.39
> diff -u -r1.39 mktests.sh
> --- mktests.sh        15 Mar 2004 22:00:06 -0000      1.39
> +++ mktests.sh        16 Mar 2004 11:08:31 -0000
> @@ -131,7 +131,7 @@
>  #
>  ac_exclude_list='^AC_ARG_VAR$
>  ^AC_CANONICALIZE|AC_PREFIX_PROGRAM|AC_PREREQ$
> -^AC_CHECK_(ALIGNOF|DECL|FILE|FUNC|HEADER|LIB|MEMBER|PROG|SIZEOF|TOOL|TYPE)S?$
> +^AC_CHECK_(ALIGNOF|DECL|FILE|FUNC|HEADER|LIB|MEMBER|PROG|SIZEOF|.*TOOL|TYPE)S?$
>  ^AC_CONFIG
>  ^AC_(F77|FC)_FUNC$
>  ^AC_FC_(FUNC|FREEFORM|SRCEXT)$






reply via email to

[Prev in Thread] Current Thread [Next in Thread]