All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>
To: Vaibhav Jain <vaibhav@linux.ibm.com>,
	nvdimm@lists.linux.dev, dan.j.williams@intel.com,
	vishal.l.verma@intel.com
Subject: Re: [PATCH] util/parse: Fix build error on ubuntu
Date: Tue, 15 Mar 2022 15:45:58 +0530	[thread overview]
Message-ID: <87v8wfcyht.fsf@linux.ibm.com> (raw)
In-Reply-To: <874k3zd27b.fsf@vajain21.in.ibm.com>

Vaibhav Jain <vaibhav@linux.ibm.com> writes:

> Second hunk of this diff seems to be a revert of [1]  which might
> break the ndctl build on Arch Linux.
>
> AFAIS for Centos/Fedora/RHEL etc the iniparser.h file is present in the
> default include path('/usr/include') as a softlink to
> '/usr/include/iniparser/iniparser.h' . Ubuntu/Debian seems to an
> exception where path '/usr/include/iniparser.h' is not present.
>
> I guess thats primarily due to no 'make install' target available in
> iniparser makefiles [1] that fixes a single include patch. This may have led
> to differences across distros where to place these header files.
>
> I would suggest changing to this in meson.build to atleast catch if the
> iniparser.h is not present at the expected path during meson setup:
>
>     iniparser = cc.find_library('iniparser', required : true, has_headers: 'iniparser.h')
>
> [1] addc5fd8511('Fix iniparser.h include')
> [2] https://github.com/ndevilla/iniparser/blob/master/Makefile


We can do this.

diff --git a/config.h.meson b/config.h.meson
index 2852f1e9cd8b..b070df96cf4a 100644
--- a/config.h.meson
+++ b/config.h.meson
@@ -82,6 +82,9 @@
 /* Define to 1 if you have the <unistd.h> header file. */
 #mesondefine HAVE_UNISTD_H
 
+/* Define to 1 if you have the <iniparser/iniparser.h> header file. */
+#mesondefine HAVE_INIPARSER_INCLUDE_H
+
 /* Define to 1 if using libuuid */
 #mesondefine HAVE_UUID
 
diff --git a/meson.build b/meson.build
index 42e11aa25cba..893f70c22270 100644
--- a/meson.build
+++ b/meson.build
@@ -176,6 +176,7 @@ check_headers = [
   ['HAVE_SYS_STAT_H', 'sys/stat.h'],
   ['HAVE_SYS_TYPES_H', 'sys/types.h'],
   ['HAVE_UNISTD_H', 'unistd.h'],
+  ['HAVE_INIPARSER_INCLUDE_H', 'iniparser/iniparser.h'],
 ]
 
 foreach h : check_headers
diff --git a/util/parse-configs.c b/util/parse-configs.c
index c834a07011e5..8bdc9d18cbf3 100644
--- a/util/parse-configs.c
+++ b/util/parse-configs.c
@@ -4,7 +4,11 @@
 #include <dirent.h>
 #include <errno.h>
 #include <fcntl.h>
+#ifdef HAVE_INIPARSER_INCLUDE_H
+#include <iniparser/iniparser.h>
+#else
 #include <iniparser.h>
+#endif
 #include <sys/stat.h>
 #include <util/parse-configs.h>
 #include <util/strbuf.h>

  reply	other threads:[~2022-03-15 10:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-15  6:04 [PATCH] util/parse: Fix build error on ubuntu Aneesh Kumar K.V
2022-03-15  8:55 ` Vaibhav Jain
2022-03-15 10:15   ` Aneesh Kumar K.V [this message]
2022-03-15 16:46     ` Vaibhav Jain
2022-03-15 17:03       ` Verma, Vishal L
2022-03-15 17:19       ` Dan Williams
2022-03-16  3:50       ` Aneesh Kumar K V
2022-03-16  5:33         ` Vaibhav Jain

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=87v8wfcyht.fsf@linux.ibm.com \
    --to=aneesh.kumar@linux.ibm.com \
    --cc=dan.j.williams@intel.com \
    --cc=nvdimm@lists.linux.dev \
    --cc=vaibhav@linux.ibm.com \
    --cc=vishal.l.verma@intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.