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"
local -r platform=$(detect_platform_type)
case "$platform" in
- *-*-darwin)
+ *-*-darwin*)
ioreg -r -c IOCPU | fgrep -c \"IOCPUNumber\"
;;
*-*-netbsd*)
# 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([
#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;
+ }
}
-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