From patchwork Tue Aug 16 00:50:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Amiantov X-Patchwork-Id: 9282451 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7E6CD600CB for ; Tue, 16 Aug 2016 00:58:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7124328ED3 for ; Tue, 16 Aug 2016 00:58:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6631B28EDC; Tue, 16 Aug 2016 00:58:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DB18828EDA for ; Tue, 16 Aug 2016 00:58:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752258AbcHPA6Q (ORCPT ); Mon, 15 Aug 2016 20:58:16 -0400 Received: from fmap.me ([91.92.66.84]:33940 "EHLO smtp.fmap.me" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752365AbcHPA6O (ORCPT ); Mon, 15 Aug 2016 20:58:14 -0400 From: Nikolay Amiantov DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=fmap.me; s=mail; t=1471308642; bh=vr0gOp/S2CxWrGsjbcU4BSMlggt1rFTxS1ZF8Mlauno=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=O7CTwM4n5cFTSfonli/ifHMmhCq5dOLFfaprEDyfHV3GmcuN9uaArwm5ksJ6R+NMc ZMrw+TLU5zJtMMBz77/l8i1o/SeUG1xo1wPy4yPxc/N66LC/6re7rL2hzmgvc5Kjg+ SKXbE7aEuf7ydF7lUarb7wxhsrbhk2N29JNi+W8s= To: linux-modules@vger.kernel.org Cc: Shea Levy , Nikolay Amiantov Subject: [PATCH 4/4] libkmod: add --with-modulesdirs configure option Date: Tue, 16 Aug 2016 03:50:32 +0300 Message-Id: <20160816005032.28881-5-ab@fmap.me> In-Reply-To: <20160816005032.28881-1-ab@fmap.me> References: <20160816005032.28881-1-ab@fmap.me> Sender: owner-linux-modules@vger.kernel.org Precedence: bulk List-ID: X-Virus-Scanned: ClamAV using ClamSMTP Let the user override default /lib/modules path. One can also define several directories to be looked in order by specifying them separated with a colon, like this: ./configure --with-modulesdirs=/lib/modules:/usr/local/lib/modules --- Makefile.am | 1 + configure.ac | 6 ++++++ libkmod/libkmod.c | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index d4eeb7e..5c9f603 100644 --- a/Makefile.am +++ b/Makefile.am @@ -19,6 +19,7 @@ AM_CPPFLAGS = \ -include $(top_builddir)/config.h \ -I$(top_srcdir) \ -DSYSCONFDIR=\""$(sysconfdir)"\" \ + -DMODULESDIRS=\""$(shell echo $(modulesdirs) | $(SED) 's|:|\\",\\"|g')"\" \ ${zlib_CFLAGS} AM_CFLAGS = $(OUR_CFLAGS) diff --git a/configure.ac b/configure.ac index 23510c8..66490cf 100644 --- a/configure.ac +++ b/configure.ac @@ -202,6 +202,12 @@ GTK_DOC_CHECK([1.14],[--flavour no-tmpl-flat]) ], [ AM_CONDITIONAL([ENABLE_GTK_DOC], false)]) +AC_ARG_WITH([modulesdirs], + AS_HELP_STRING([--with-modulesdirs=DIRS], [Kernel modules directories, separated by :]), + [], + [with_modulesdirs=/lib/modules]) +AC_SUBST([modulesdirs], [$with_modulesdirs]) + ##################################################################### # Default CFLAGS and LDFLAGS diff --git a/libkmod/libkmod.c b/libkmod/libkmod.c index be9358d..291c08d 100644 --- a/libkmod/libkmod.c +++ b/libkmod/libkmod.c @@ -207,7 +207,7 @@ static int log_priority(const char *priority) } static const char *dirname_default_prefixes[] = { - "/lib/modules", + MODULESDIRS, NULL };