]> gitweb @ CieloNegro.org - build-hc-pkg.git/commitdiff
Use autotools' idea of the canonical name of platform as-is.
authorPHO <pho@cielonegro.org>
Thu, 23 Feb 2012 13:07:57 +0000 (22:07 +0900)
committerPHO <pho@cielonegro.org>
Thu, 23 Feb 2012 13:07:57 +0000 (22:07 +0900)
build-hc-pkg
canon-name/configure.ac
canon-name/src/canon-name.c
mk/canon-name.mk

index 27bf1fdd72d420a763af6375c0704badc56c53b0..14ef15e5ade04e1f67f5fea489476bcd65e9722d 100755 (executable)
@@ -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*)
index e8f41fe766e05096a47fd19c3f3a598a694ce1ee..f89b2fabdf6dea0adddcc67a4725fd91c059f089 100644 (file)
@@ -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([
index 447083f35edcdabe31c22f231d65e9056835a77f..b74f50bd2e14835a27e1bb2f7e21883e35008764 100644 (file)
@@ -1,8 +1,15 @@
 #include "config.h"
 #include <stdio.h>
-#include <string.h>
 
 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;
+    }
 }
index 266d5dff382d7814e0591a468310e91d0b6894e2..effc06b9f316d80d0efb235cbd7f35a2154a7d25 100644 (file)
@@ -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