mirror of
https://github.com/crosstool-ng/crosstool-ng.git
synced 2024-12-18 20:37:56 +00:00
Add checking for *sum and unzip
Also improve logging (add an ability to log commands/files/environment variables to config.log) Signed-off-by: Alexey Neyman <stilor@att.net>
This commit is contained in:
parent
0f34b0ebf0
commit
74979fb19b
@ -45,5 +45,17 @@ config CONFIGURE_has_svn
|
||||
config CONFIGURE_has_git
|
||||
@KCONFIG_git@
|
||||
|
||||
config CONFIGURE_has_md5sum
|
||||
@KCONFIG_md5sum@
|
||||
|
||||
config CONFIGURE_has_sha1sum
|
||||
@KCONFIG_sha1sum@
|
||||
|
||||
config CONFIGURE_has_sha256sum
|
||||
@KCONFIG_sha256sum@
|
||||
|
||||
config CONFIGURE_has_sha512sum
|
||||
@KCONFIG_sha512sum@
|
||||
|
||||
config CONFIGURE_has_install_with_strip_program
|
||||
@KCONFIG_install_with_strip_program@
|
||||
|
@ -135,6 +135,7 @@ endif # USE_MIRROR
|
||||
config VERIFY_DOWNLOAD_DIGEST
|
||||
bool "Verify download digests (checksums)"
|
||||
default y
|
||||
depends on CONFIGURE_has_sha512sum || CONFIGURE_has_sha256sum || CONFIGURE_has_sha1sum || CONFIGURE_has_md5sum
|
||||
|
||||
if VERIFY_DOWNLOAD_DIGEST
|
||||
|
||||
@ -143,14 +144,18 @@ choice
|
||||
|
||||
config VERIFY_DOWNLOAD_DIGEST_SHA512
|
||||
bool "SHA-512"
|
||||
depends on CONFIGURE_has_sha512sum
|
||||
|
||||
config VERIFY_DOWNLOAD_DIGEST_SHA256
|
||||
depends on CONFIGURE_has_sha256sum
|
||||
bool "SHA-256"
|
||||
|
||||
config VERIFY_DOWNLOAD_DIGEST_SHA1
|
||||
depends on CONFIGURE_has_sha1sum
|
||||
bool "SHA-1"
|
||||
|
||||
config VERIFY_DOWNLOAD_DIGEST_MD5
|
||||
depends on CONFIGURE_has_md5sum
|
||||
bool "MD5"
|
||||
|
||||
endchoice
|
||||
|
34
configure.ac
34
configure.ac
@ -21,6 +21,9 @@ AC_CONFIG_MACRO_DIR([m4])
|
||||
# - Request new tar format (old, tar-v7, breaks on long paths we have)
|
||||
AM_INIT_AUTOMAKE([-Wall -Werror foreign no-dist-gzip dist-xz dist-bzip2 subdir-objects tar-pax])
|
||||
|
||||
# To avoid stubbing autotools with missing script
|
||||
AM_MAINTAINER_MODE([enable])
|
||||
|
||||
# Safety check per autoconf best practices
|
||||
AC_CONFIG_SRCDIR([ct-ng.in])
|
||||
|
||||
@ -80,7 +83,7 @@ CTNG_PROG_VERSION_REQ_STRICT([SED],
|
||||
[GNU sed >= 4.0],
|
||||
[sed],
|
||||
[gsed sed],
|
||||
['GNU sed[^0-9]* [4-9]\.'])
|
||||
[GNU sed[^0-9]* [4-9]\.])
|
||||
AC_ARG_VAR([SED], [Specify the full path to GNU sed])
|
||||
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
@ -122,6 +125,7 @@ CTNG_CHECK_PROGS_REQ([tar], [tar])
|
||||
CTNG_CHECK_PROGS_REQ([gzip], [gzip])
|
||||
CTNG_CHECK_PROGS_REQ([bzip2], [bzip2])
|
||||
CTNG_CHECK_PROGS_REQ([xz], [xz])
|
||||
CTNG_CHECK_PROGS_REQ([unzip], [unzip])
|
||||
CTNG_CHECK_PROGS_REQ([help2man], [help2man])
|
||||
|
||||
# Not a fatal failure even if we have neither - the tarballs may
|
||||
@ -145,14 +149,14 @@ CTNG_PROG_VERSION_REQ_STRICT([BASH_SHELL],
|
||||
[GNU bash >= 3.1],
|
||||
[bash],
|
||||
[bash],
|
||||
['^GNU bash, version (3\.[1-9]|4)'])
|
||||
[^GNU bash, version (3\.[1-9]|4)])
|
||||
|
||||
# We need a awk that *is* GNU awk
|
||||
CTNG_PROG_VERSION_REQ_STRICT([AWK],
|
||||
[GNU awk],
|
||||
[awk],
|
||||
[gawk awk],
|
||||
['^GNU Awk '])
|
||||
[^GNU Awk ])
|
||||
|
||||
# FIXME This checks for tools at the time configure runs. If a tool is later updated
|
||||
# to satisfy our version requirement, we still won't be able to see that. Or worse,
|
||||
@ -165,7 +169,7 @@ CTNG_PROG_VERSION_REQ_ANY([MAKE],
|
||||
[GNU make >= 3.81],
|
||||
[make],
|
||||
[gmake make],
|
||||
['^GNU Make (3\.8[1-9]|3\.9[0-9]|[4-9]\.)'],
|
||||
[^GNU Make (3\.8[1-9]|3\.9[0-9]|[4-9]\.)],
|
||||
[make_3_81_or_newer])
|
||||
|
||||
# Check other companion tools that we may or may not build.
|
||||
@ -173,42 +177,42 @@ CTNG_PROG_VERSION_REQ_STRICT([LIBTOOL],
|
||||
[GNU libtool >= 2.4],
|
||||
[libtool],
|
||||
[glibtool libtool],
|
||||
['\(GNU libtool\) ([3-9]\.|2.[4-9]|2.[1-3][0-9])'],
|
||||
[\(GNU libtool\) ([3-9]\.|2.[4-9]|2.[1-3][0-9])],
|
||||
[libtool_2_4_or_newer])
|
||||
|
||||
CTNG_PROG_VERSION([LIBTOOLIZE],
|
||||
[GNU libtoolize >= 2.4],
|
||||
[libtoolize],
|
||||
[glibtoolize libtoolize],
|
||||
['\(GNU libtool\) ([3-9]\.|2.[4-9]|2.[1-3][0-9])'],
|
||||
[\(GNU libtool\) ([3-9]\.|2.[4-9]|2.[1-3][0-9])],
|
||||
[libtoolize_2_4_or_newer])
|
||||
|
||||
CTNG_PROG_VERSION([AUTOCONF],
|
||||
[GNU autoconf >= 2.65],
|
||||
[autoconf],
|
||||
[autoconf],
|
||||
['\(GNU Autoconf\) ([3-9]\.|2\.[7-9][0-9]|2\.6[5-9])'],
|
||||
[\(GNU Autoconf\) ([3-9]\.|2\.[7-9][0-9]|2\.6[5-9])],
|
||||
[autoconf_2_65_or_newer])
|
||||
|
||||
CTNG_PROG_VERSION([AUTORECONF],
|
||||
[GNU autoreconf >= 2.63],
|
||||
[autoreconf],
|
||||
[autoreconf],
|
||||
['\(GNU Autoconf\) ([3-9]\.|2\.[7-9][0-9]|2\.6[5-9])'],
|
||||
[\(GNU Autoconf\) ([3-9]\.|2\.[7-9][0-9]|2\.6[5-9])],
|
||||
[autoreconf_2_65_or_newer])
|
||||
|
||||
CTNG_PROG_VERSION([AUTOMAKE],
|
||||
[GNU automake >= 1.15],
|
||||
[automake],
|
||||
[automake],
|
||||
['\(GNU automake\) ([2-9]\.|1\.[2-9][0-9]|1\.1[5-9])'],
|
||||
[\(GNU automake\) ([2-9]\.|1\.[2-9][0-9]|1\.1[5-9])],
|
||||
[automake_1_15_or_newer])
|
||||
|
||||
CTNG_PROG_VERSION([M4],
|
||||
[GNU m4 >= 1.4.12],
|
||||
[m4],
|
||||
[gm4 m4],
|
||||
['\(GNU M4\) ([2-9]\.|1\.[5-9]|1\.[1-4][0-9]|1\.4\.[2-9][0-9]|1\.4\.1[2-9])'],
|
||||
[\(GNU M4\) ([2-9]\.|1\.[5-9]|1\.[1-4][0-9]|1\.4\.[2-9][0-9]|1\.4\.1[2-9])],
|
||||
[gnu_m4_1_4_12_or_newer])
|
||||
|
||||
AC_SUBST([kconfig_options])
|
||||
@ -222,6 +226,16 @@ CTNG_SET_KCONFIG_OPTION([svn])
|
||||
AC_CHECK_PROGS([git], [git])
|
||||
CTNG_SET_KCONFIG_OPTION([git])
|
||||
|
||||
# Check which tools we have for verifying the digest
|
||||
AC_PATH_PROGS([md5sum], [gmd5sum md5sum])
|
||||
AC_PATH_PROGS([sha1sum], [gsha1sum sha1sum])
|
||||
AC_PATH_PROGS([sha256sum], [gsha256sum sha256sum])
|
||||
AC_PATH_PROGS([sha512sum], [gsha512sum sha512sum])
|
||||
CTNG_SET_KCONFIG_OPTION([md5sum])
|
||||
CTNG_SET_KCONFIG_OPTION([sha1sum])
|
||||
CTNG_SET_KCONFIG_OPTION([sha256sum])
|
||||
CTNG_SET_KCONFIG_OPTION([sha512sum])
|
||||
|
||||
# FIXME why checking if not using the result? We don't provide replacemant malloc/alloca/...
|
||||
AC_C_INLINE
|
||||
AC_HEADER_STDC
|
||||
|
29
m4/ctng_log.m4
Normal file
29
m4/ctng_log.m4
Normal file
@ -0,0 +1,29 @@
|
||||
# CTNG_MSG_LOG(MSG)
|
||||
# Log the MSG message to config.log
|
||||
AC_DEFUN([CTNG_MSG_LOG],
|
||||
[AS_ECHO(["$as_me:${as_lineno-$LINENO}: AS_ESCAPE([$1])"]) >&AS_MESSAGE_LOG_FD])
|
||||
|
||||
# CTNG_MSG_LOG_CMD(CMD, [DESC])
|
||||
# Log the output of a command CMD to config.log, prepending the
|
||||
# description DESC.
|
||||
AC_DEFUN([CTNG_MSG_LOG_CMD],
|
||||
[AS_IF([test -n "AS_ESCAPE([$2])"],
|
||||
[AS_ECHO(["$as_me:${as_lineno-$LINENO}: AS_ESCAPE([$2]):"]) >&AS_MESSAGE_LOG_FD],
|
||||
[AS_ECHO(["$as_me:${as_lineno-$LINENO}: output from command '$1':"]) >&AS_MESSAGE_LOG_FD])
|
||||
$1 | sed 's/^/| /' >&AS_MESSAGE_LOG_FD])
|
||||
|
||||
# CTNG_MSG_LOG_ENVVAR(VAR, [DESC])
|
||||
# Log the contents of an environment variable VAR to config.log, prepending the
|
||||
# description DESC.
|
||||
AC_DEFUN([CTNG_MSG_LOG_ENVVAR],
|
||||
[AS_IF([test -n "AS_ESCAPE([$2])"],
|
||||
[CTNG_MSG_LOG_CMD([AS_ECHO(["$$1"])], [$2])],
|
||||
[CTNG_MSG_LOG_CMD([AS_ECHO(["$$1"])], [variable $1 is set to])])])
|
||||
|
||||
# CTNG_MSG_LOG_FILE(FILE, [DESC])
|
||||
# Log the contents of a file FILE to config.log, prepending the
|
||||
# description DESC.
|
||||
AC_DEFUN([CTNG_MSG_LOG_FILE],
|
||||
[AS_IF([test -n "AS_ESCAPE([$2])"],
|
||||
[CTNG_MSG_LOG_CMD([cat $1], [$2])],
|
||||
[CTNG_MSG_LOG_CMD([cat $1], [contents of $1])])])
|
@ -1,5 +1,15 @@
|
||||
# Several convenience wrappers for checking the programs
|
||||
|
||||
# Convert a pre-set tool variable to absolute path if it is not already.
|
||||
AC_DEFUN([CTNG_PATH_ABSNAME],
|
||||
[CTNG_MSG_LOG_ENVVAR([$1], [must determine absolute path for '$$1'])
|
||||
AS_CASE([$$1],
|
||||
[/*],,
|
||||
[*\ *],,
|
||||
[?*],[AC_MSG_CHECKING([for absolute path to $$1])
|
||||
$1=$(which $$1)
|
||||
AC_MSG_RESULT([$$1])])])
|
||||
|
||||
# Check for required tool
|
||||
AC_DEFUN([CTNG_CHECK_TOOL_REQ],
|
||||
[AC_CHECK_TOOLS([$1], [$2])
|
||||
@ -12,12 +22,7 @@ AC_DEFUN([CTNG_CHECK_TOOL_REQ],
|
||||
AC_DEFUN([CTNG_PATH_TOOL_REQ],
|
||||
[AC_ARG_VAR([$1], [Specify the full path to GNU $3])
|
||||
CTNG_CHECK_TOOL_REQ([$1], [$2])
|
||||
AS_CASE(
|
||||
[$$1],
|
||||
[/*],,
|
||||
[?*],[AC_MSG_CHECKING([for absolute path to $$1])
|
||||
$1=$(which $$1)
|
||||
AC_MSG_RESULT([$$1])])])
|
||||
CTNG_PATH_ABSNAME([$1])])
|
||||
|
||||
# Check for required program
|
||||
AC_DEFUN([CTNG_CHECK_PROGS_REQ],
|
||||
|
@ -7,9 +7,13 @@ AC_DEFUN([CTNG_PROG_STAT_FORMAT],
|
||||
[ctng_cv_stat_flavor],
|
||||
[touch conftest
|
||||
chmod 642 conftest
|
||||
attr_bsd=$(stat -f '%Lp' conftest 2>/dev/null)
|
||||
attr_gnu=$(stat -c '%a' conftest 2>/dev/null)
|
||||
rm -f conftest
|
||||
attr_bsd=$(stat -f '%Lp' conftest 2>conftest.stderr.bsd)
|
||||
CTNG_MSG_LOG_ENVVAR([attr_bsd], [stat -f output])
|
||||
CTNG_MSG_LOG_FILE([conftest.stderr.bsd])
|
||||
attr_gnu=$(stat -c '%a' conftest 2>conftest.stderr.gnu)
|
||||
CTNG_MSG_LOG_ENVVAR([attr_gnu], [stat -c output])
|
||||
CTNG_MSG_LOG_FILE([conftest.stderr.gnu])
|
||||
rm -f conftest conftest.stderr.*
|
||||
AS_IF([test "$attr_bsd" = "642"],
|
||||
[ctng_cv_stat_flavor=BSD],
|
||||
[test "$attr_gnu" = "642"],
|
||||
|
@ -11,14 +11,27 @@ AC_DEFUN([CTNG_PROG_VERSION],
|
||||
CTNG_WITH_DEPRECATED([$3], [$1])
|
||||
AC_ARG_VAR([$1], [Specify the full path to $2])
|
||||
ctng_version_$1_ok=false
|
||||
AC_CACHE_CHECK([for $3], [ac_cv_path_$1],
|
||||
[AC_PATH_PROGS_FEATURE_CHECK([$1], [$4],
|
||||
[[ver=$($ac_path_$1 --version 2>/dev/null| $EGREP $5)
|
||||
test -z "$ac_cv_path_$1" && ac_cv_path_$1=$ac_path_$1
|
||||
test -n "$ver" && ac_cv_path_$1="$ac_path_$1" ac_path_$1_found=: ctng_version_$1_ok=:]])])
|
||||
# If a variable is already set, check if it an absolute path and convert if not.
|
||||
# Autoconf's AC_PATH_PROGS* macros just blindly trust $1 to be correct - but
|
||||
# AWK is set to just the command name by AC_INIT.
|
||||
AS_IF([test -n "$$1"],
|
||||
[[ver=$($ac_cv_path_$1 --version 2>/dev/null| $EGREP $5)
|
||||
test -n "$ver" && ctng_version_$1_ok=:]])
|
||||
[ac_cv_path_$1="$$1"
|
||||
CTNG_PATH_ABSNAME([ac_cv_path_$1])
|
||||
CTNG_MSG_LOG_ENVVAR([ac_cv_path_$1])
|
||||
ver=$($ac_cv_path_$1 --version 2>/dev/null)
|
||||
CTNG_MSG_LOG([looking for '[$5]' regexp in])
|
||||
CTNG_MSG_LOG_ENVVAR([ver], [version info for $ac_cv_path_$1])
|
||||
ver=$(AS_ECHO(["$ver"]) | $EGREP '[$5]')
|
||||
test -n "$ver" && ctng_version_$1_ok=:],
|
||||
[AC_CACHE_CHECK([for $3], [ac_cv_path_$1],
|
||||
[AC_PATH_PROGS_FEATURE_CHECK([$1], [$4],
|
||||
[CTNG_MSG_LOG_ENVVAR([ac_path_$1], [checking $1 at])
|
||||
ver=$($ac_path_$1 --version 2>/dev/null)
|
||||
CTNG_MSG_LOG([looking for '[$5]' regexp in])
|
||||
CTNG_MSG_LOG_ENVVAR([ver], [version info])
|
||||
ver=$(AS_ECHO(["$ver"]) | $EGREP '[$5]')
|
||||
test -z "$ac_cv_path_$1" && ac_cv_path_$1=$ac_path_$1
|
||||
test -n "$ver" && ac_cv_path_$1="$ac_path_$1" ac_path_$1_found=: ctng_version_$1_ok=:])])])
|
||||
AC_MSG_CHECKING([for $2])
|
||||
AS_IF([$ctng_version_$1_ok],
|
||||
[AC_MSG_RESULT([yes])],
|
||||
|
@ -10,3 +10,7 @@ export objcopy="@OBJCOPY@"
|
||||
export objdump="@OBJDUMP@"
|
||||
export readelf="@READELF@"
|
||||
export patch="@PATCH@"
|
||||
export md5sum="@md5sum@"
|
||||
export sha1sum="@sha1sum@"
|
||||
export sha256sum="@sha256sum@"
|
||||
export sha512sum="@sha512sum@"
|
||||
|
@ -115,11 +115,13 @@ cat "${paths_sh_location}" |while read trash line; do
|
||||
tool="${line%%=*}"
|
||||
# Suppress extra quoting
|
||||
eval path=${line#*=}
|
||||
if [ -r "${CT_LIB_DIR}/scripts/override/$tool" ]; then
|
||||
tmpl="${CT_LIB_DIR}/scripts/override/$tool"
|
||||
else
|
||||
tmpl="${CT_LIB_DIR}/scripts/override/__default"
|
||||
if [ ! -r "${CT_LIB_DIR}/scripts/override/$tool" ]; then
|
||||
if [ -n "${path}" ]; then
|
||||
CT_DoExecLog ALL ln -s "${path}" "${CT_TOOLS_OVERRIDE_DIR}/bin/${tool}"
|
||||
fi
|
||||
continue
|
||||
fi
|
||||
tmpl="${CT_LIB_DIR}/scripts/override/$tool"
|
||||
CT_DoLog DEBUG "Creating script-override for '${tool}' -> '${path}' using '${tmpl}' template"
|
||||
CT_DoExecLog ALL cp "${tmpl}" "${CT_TOOLS_OVERRIDE_DIR}/bin/${tool}"
|
||||
CT_DoExecLog ALL ${sed} -i -r \
|
||||
|
@ -1,3 +0,0 @@
|
||||
#!@CONFIG_SHELL@
|
||||
|
||||
exec @TOOL_PATH@ "$@"
|
Loading…
Reference in New Issue
Block a user