mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: Juergen Beisert <jbe@pengutronix.de>
To: ptxdist@pengutronix.de
Subject: [ptxdist] [PATCH 01/14] Core CPU count detection: do not rely on a fixed path to the 'sysctl' tool
Date: Wed, 13 Jun 2012 17:23:30 +0200	[thread overview]
Message-ID: <1339601023-28824-2-git-send-email-jbe@pengutronix.de> (raw)
In-Reply-To: <1339601023-28824-1-git-send-email-jbe@pengutronix.de>

Using a fix path is a bad idea. Lets 'configure' search for the tool and use
it as is.

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
---
 Makefile.in  |    1 +
 bin/ptxdist  |    2 +-
 configure.ac |    3 +++
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/Makefile.in b/Makefile.in
index 8382402..f041814 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -59,6 +59,7 @@ environment:
 	@ln -sf @PYTHON@ "$(abs_srcdir)/bin/python"
 	@ln -sf @SED@ "$(abs_srcdir)/bin/sed"
 	@ln -sf @XARGS@ "$(abs_srcdir)/bin/xargs"
+	@ln -sf @SYSCTL@ "$(abs_srcdir)/bin/sysctl"
 	@echo " done"
 
 clean:
diff --git a/bin/ptxdist b/bin/ptxdist
index e10c03d..e96201e 100755
--- a/bin/ptxdist
+++ b/bin/ptxdist
@@ -2140,7 +2140,7 @@ setup_config() {
 			cpus=1
 		fi
 	# and this one is tested on Darwin and should work on BSDs
-	elif ! cpus="$(/usr/sbin/sysctl -n hw.ncpu)" 2> /dev/null; then
+	elif ! cpus="$(sysctl -n hw.ncpu)" 2> /dev/null; then
 		cpus=1
 	fi
 	local pmf_intern="-j$(( ${cpus} * 2 ))"
diff --git a/configure.ac b/configure.ac
index 44c2448..1723ef9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -182,6 +182,9 @@ case "$AWK_VERSION" in
 esac
 AC_MSG_RESULT([$AWK_VERSION])
 
+# fall back to 'false' for systems which do not provide a 'sysctl' tool
+AC_PATH_PROGS(SYSCTL, sysctl false,, $PATH)
+
 dnl Check for lex
 AC_PROG_LEX
 AC_PATH_PROGS(LEX, ${LEX},, $PATH)
-- 
1.7.10


-- 
ptxdist mailing list
ptxdist@pengutronix.de

  reply	other threads:[~2012-06-13 15:23 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-13 15:23 [ptxdist] Make PTXdist more OS independent Juergen Beisert
2012-06-13 15:23 ` Juergen Beisert [this message]
2012-06-13 15:23 ` [ptxdist] [PATCH 02/14] Sed: prefer the GNU sed tool to do the configure job Juergen Beisert
2012-06-13 15:23 ` [ptxdist] [PATCH 03/14] Don't check for 'find' twice Juergen Beisert
2012-06-13 15:23 ` [ptxdist] [PATCH 04/14] Fix: use the 'find' utility which was already detected as the correct one Juergen Beisert
2012-06-13 15:23 ` [ptxdist] [PATCH 05/14] Don't check for 'install' twice Juergen Beisert
2012-06-13 15:23 ` [ptxdist] [PATCH 06/14] Don't check for 'readlink' twice Juergen Beisert
2012-06-13 15:23 ` [ptxdist] [PATCH 07/14] 'sort' is from coreutils. So, handle it like all other coreutil tools Juergen Beisert
2012-06-13 15:23 ` [ptxdist] [PATCH 08/14] 'dirname' " Juergen Beisert
2012-06-13 15:23 ` [ptxdist] [PATCH 09/14] 'cat' " Juergen Beisert
2012-06-13 15:23 ` [ptxdist] [PATCH 10/14] 'xargs' is from findutils. So, handle it like all other findutils tools Juergen Beisert
2012-06-13 15:23 ` [ptxdist] [PATCH 11/14] Find: ensure the 'file' command is always found Juergen Beisert
2012-06-13 15:23 ` [ptxdist] [PATCH 12/14] 'tty' is from coreutils. So, handle it like all other coreutil tools Juergen Beisert
2012-06-13 15:23 ` [ptxdist] [PATCH 13/14] Bash: ensure the bash is always found Juergen Beisert
2012-06-13 15:23 ` [ptxdist] [PATCH 14/14] Make: ensure the GNU make " Juergen Beisert
2012-06-13 16:41 ` [ptxdist] Make PTXdist more OS independent Bernhard Walle
2012-06-13 17:22   ` Juergen Beisert
2012-06-13 17:26     ` Michael Olbrich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1339601023-28824-2-git-send-email-jbe@pengutronix.de \
    --to=jbe@pengutronix.de \
    --cc=ptxdist@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox