DPDK patches and discussions
 help / color / mirror / Atom feed
From: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
To: dev@dpdk.org
Cc: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>,
	Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>,
	Omar Cardona <ocardona@microsoft.com>,
	Pallavi Kadam <pallavi.kadam@intel.com>,
	Ranjit Menon <ranjit.menon@intel.com>
Subject: [dpdk-dev] [PATCH v4 3/7] eal/windows: support builing with MinGW-w64
Date: Thu, 27 Feb 2020 07:25:33 +0300	[thread overview]
Message-ID: <20200227042537.187459-4-dmitry.kozliuk@gmail.com> (raw)
In-Reply-To: <20200227042537.187459-1-dmitry.kozliuk@gmail.com>

Disable bundled getopt implementation and GNU extensions shim when
building in GNU environment.

Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
---
 lib/librte_eal/meson.build                  | 3 +++
 lib/librte_eal/windows/eal/eal.c            | 6 ++++--
 lib/librte_eal/windows/eal/include/getopt.h | 4 ++++
 lib/librte_eal/windows/eal/include/rte_os.h | 2 ++
 4 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/lib/librte_eal/meson.build b/lib/librte_eal/meson.build
index 4be5118ce..1730d603f 100644
--- a/lib/librte_eal/meson.build
+++ b/lib/librte_eal/meson.build
@@ -20,6 +20,9 @@ endif
 if cc.has_function('getentropy', prefix : '#include <unistd.h>')
 	cflags += '-DRTE_LIBEAL_USE_GETENTROPY'
 endif
+if cc.has_header('getopt.h')
+	cflags += ['-DHAVE_GETOPT_H', '-DHAVE_GETOPT', '-DHAVE_GETOPT_LONG']
+endif
 sources = common_sources + env_sources
 objs = common_objs + env_objs
 headers = common_headers + env_headers
diff --git a/lib/librte_eal/windows/eal/eal.c b/lib/librte_eal/windows/eal/eal.c
index 34852d42c..e4b50df3b 100644
--- a/lib/librte_eal/windows/eal/eal.c
+++ b/lib/librte_eal/windows/eal/eal.c
@@ -2,9 +2,11 @@
  * Copyright(c) 2019 Intel Corporation
  */
 
-#include <sys/stat.h>
-#include <io.h>
 #include <fcntl.h>
+#include <io.h>
+#include <share.h>
+#include <sys/stat.h>
+
 #include <rte_debug.h>
 #include <rte_eal.h>
 #include <eal_memcfg.h>
diff --git a/lib/librte_eal/windows/eal/include/getopt.h b/lib/librte_eal/windows/eal/include/getopt.h
index 2eebe54e3..6f57af454 100644
--- a/lib/librte_eal/windows/eal/include/getopt.h
+++ b/lib/librte_eal/windows/eal/include/getopt.h
@@ -26,7 +26,11 @@
 #ifndef NEED_USUAL_GETOPT
 
 /* Use system getopt */
+#ifdef RTE_TOOLCHAIN_GCC
+#include_next <getopt.h>
+#else
 #include <getopt.h>
+#endif
 
 #else /* NEED_USUAL_GETOPT */
 
diff --git a/lib/librte_eal/windows/eal/include/rte_os.h b/lib/librte_eal/windows/eal/include/rte_os.h
index 95a19b2d3..e1e0378e6 100644
--- a/lib/librte_eal/windows/eal/include/rte_os.h
+++ b/lib/librte_eal/windows/eal/include/rte_os.h
@@ -57,6 +57,7 @@ int eal_thread_create(pthread_t *thread);
  */
 void eal_create_cpu_map(void);
 
+#ifndef RTE_TOOLCHAIN_GCC
 static inline int
 asprintf(char **buffer, const char *format, ...)
 {
@@ -83,6 +84,7 @@ asprintf(char **buffer, const char *format, ...)
 	}
 	return ret;
 }
+#endif /* RTE_TOOLCHAIN_GCC */
 
 /* cpu_set macros implementation */
 #define RTE_CPU_AND(dst, src1, src2) CPU_AND(dst, src1, src2)
-- 
2.25.1


  parent reply	other threads:[~2020-02-27  4:26 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-18  0:02 [dpdk-dev] [PATCH v3 0/7] MinGW-w64 support Dmitry Kozlyuk
2020-02-18  0:02 ` [dpdk-dev] [PATCH v3 1/7] eal: introduce portable format attribute Dmitry Kozlyuk
2020-02-18  0:02 ` [dpdk-dev] [PATCH v3 2/7] eal/windows: use lowercase filenames for system headers Dmitry Kozlyuk
2020-02-18  0:02 ` [dpdk-dev] [PATCH v3 3/7] eal/windows: support builing with MinGW-w64 Dmitry Kozlyuk
2020-02-18  0:02 ` [dpdk-dev] [PATCH v3 4/7] build: MinGW-w64 support for Meson Dmitry Kozlyuk
2020-02-18 14:26   ` Thomas Monjalon
2020-02-18 14:54     ` Bruce Richardson
2020-02-18  0:02 ` [dpdk-dev] [PATCH v3 5/7] build: add cross-file for MinGW-w64 Dmitry Kozlyuk
2020-02-18  0:02 ` [dpdk-dev] [PATCH v3 6/7] doc: guide for Windows build using MinGW-w64 Dmitry Kozlyuk
2020-02-18 21:27   ` William Tu
2020-02-18  0:02 ` [dpdk-dev] [PATCH v3 7/7] build: fix linker warnings with Clang on Windows Dmitry Kozlyuk
2020-02-18 21:16 ` [dpdk-dev] [PATCH v3 0/7] MinGW-w64 support William Tu
2020-02-27  4:25 ` [dpdk-dev] [PATCH v4 " Dmitry Kozlyuk
2020-02-27  4:25   ` [dpdk-dev] [PATCH v4 1/7] eal: introduce portable format attribute Dmitry Kozlyuk
2020-03-12 22:33     ` Thomas Monjalon
2020-03-13 23:38       ` Dmitry Kozlyuk
2020-03-15  8:36         ` Thomas Monjalon
2020-03-16 10:54           ` Bruce Richardson
2020-03-16 11:02             ` Bruce Richardson
2020-03-16 11:14               ` Thomas Monjalon
2020-03-16 11:18                 ` Bruce Richardson
2020-03-16 11:35                 ` Bruce Richardson
2020-03-16 14:27         ` Thomas Monjalon
2020-02-27  4:25   ` [dpdk-dev] [PATCH v4 2/7] eal/windows: use lowercase filenames for system headers Dmitry Kozlyuk
2020-02-27  4:25   ` Dmitry Kozlyuk [this message]
2020-02-27  4:25   ` [dpdk-dev] [PATCH v4 4/7] build: MinGW-w64 support for Meson Dmitry Kozlyuk
2020-02-27  4:25   ` [dpdk-dev] [PATCH v4 5/7] build: add cross-file for MinGW-w64 Dmitry Kozlyuk
2020-02-27  4:25   ` [dpdk-dev] [PATCH v4 6/7] doc: guide for Windows build using MinGW-w64 Dmitry Kozlyuk
2020-02-27  4:25   ` [dpdk-dev] [PATCH v4 7/7] build: fix linker warnings with Clang on Windows Dmitry Kozlyuk
2020-03-11 17:22   ` [dpdk-dev] [PATCH v4 0/7] MinGW-w64 support William Tu
2020-03-18  0:24     ` Thomas Monjalon
2020-03-11 22:36   ` Kadam, Pallavi

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=20200227042537.187459-4-dmitry.kozliuk@gmail.com \
    --to=dmitry.kozliuk@gmail.com \
    --cc=dev@dpdk.org \
    --cc=harini.ramakrishnan@microsoft.com \
    --cc=ocardona@microsoft.com \
    --cc=pallavi.kadam@intel.com \
    --cc=ranjit.menon@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).