From: PHO Date: Thu, 23 Feb 2012 13:07:57 +0000 (+0900) Subject: Use autotools' idea of the canonical name of platform as-is. X-Git-Url: https://git.cielonegro.org/gitweb.cgi?a=commitdiff_plain;h=9ce7d7cfab6f5795e9f90a1b07bbba8f8d6c0a5d;p=build-hc-pkg.git Use autotools' idea of the canonical name of platform as-is. --- diff --git a/build-hc-pkg b/build-hc-pkg index 27bf1fd..14ef15e 100755 --- a/build-hc-pkg +++ b/build-hc-pkg @@ -4,8 +4,8 @@ set -e function detect_platform_type () { local -r canon_name="canon-name/src/canon-name" - if [[ ! -x "$canon_name" ]]; then - gmake -f mk/canon-name.mk + if ! gmake --question --file="mk/canon-name.mk" >/dev/null 2>&1; then + gmake --file="mk/canon-name.mk" >&2 fi "$canon_name" @@ -15,7 +15,7 @@ function detect_number_of_cpus () { local -r platform=$(detect_platform_type) case "$platform" in - *-*-darwin) + *-*-darwin*) ioreg -r -c IOCPU | fgrep -c \"IOCPUNumber\" ;; *-*-netbsd*) diff --git a/canon-name/configure.ac b/canon-name/configure.ac index e8f41fe..f89b2fa 100644 --- a/canon-name/configure.ac +++ b/canon-name/configure.ac @@ -21,13 +21,10 @@ AC_PROG_CC # Checks for libraries. # Checks for header files. -AC_CHECK_HEADERS([string.h]) # Checks for typedefs, structures, and compiler characteristics. -AC_TYPE_SIZE_T # Checks for library functions. -AC_CHECK_FUNCS([strcspn]) # Done. AC_CONFIG_FILES([ diff --git a/canon-name/src/canon-name.c b/canon-name/src/canon-name.c index 447083f..b74f50b 100644 --- a/canon-name/src/canon-name.c +++ b/canon-name/src/canon-name.c @@ -1,8 +1,15 @@ #include "config.h" #include -#include int main(int argc, char* argv[]) { - size_t n_non_digits = strcspn(HOST_OS, "0123456789"); - printf("%s-%s-%.*s\n", HOST_CPU, HOST_VENDOR, n_non_digits, HOST_OS); + int ret; + + ret = printf("%s-%s-%s\n", HOST_CPU, HOST_VENDOR, HOST_OS); + if (ret < 0) { + perror(NULL); + return 1; + } + else { + return 0; + } } diff --git a/mk/canon-name.mk b/mk/canon-name.mk index 266d5df..effc06b 100644 --- a/mk/canon-name.mk +++ b/mk/canon-name.mk @@ -1,6 +1,4 @@ -all: canon-name/src/canon-name - -canon-name/src/canon-name: canon-name/Makefile +all: canon-name/Makefile $(MAKE) -C canon-name canon-name/Makefile: canon-name/configure