From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from dude.hi.pengutronix.de ([2001:6f8:1178:2:21e:67ff:fe11:9c5c]) by metis.ext.pengutronix.de with esmtp (Exim 4.72) (envelope-from ) id 1SepQ9-0001Zu-8C for ptxdist@pengutronix.de; Wed, 13 Jun 2012 17:23:45 +0200 Received: from jbe by dude.hi.pengutronix.de with local (Exim 4.80) (envelope-from ) id 1SepQ9-00029b-6T for ptxdist@pengutronix.de; Wed, 13 Jun 2012 17:23:45 +0200 From: Juergen Beisert Date: Wed, 13 Jun 2012 17:23:30 +0200 Message-Id: <1339601023-28824-2-git-send-email-jbe@pengutronix.de> In-Reply-To: <1339601023-28824-1-git-send-email-jbe@pengutronix.de> References: <1339601023-28824-1-git-send-email-jbe@pengutronix.de> Subject: [ptxdist] [PATCH 01/14] Core CPU count detection: do not rely on a fixed path to the 'sysctl' tool Reply-To: ptxdist@pengutronix.de List-Id: PTXdist Development Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: ptxdist-bounces@pengutronix.de Errors-To: ptxdist-bounces@pengutronix.de To: ptxdist@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 --- 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