From 6ed41889941c892ac33cc94489a121689d1f4c17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C6=B0=C6=A1ng=20Ch=C6=B0=C6=A1ng=20D=C6=B0=C6=A1ng?= Date: Tue, 20 May 2025 20:00:20 +0700 Subject: [PATCH] Fix error when ccompile by mingw32 and remove the $ from example shell script (#448) * Fix build error with mingw32 * Remove $ from shell example --------- Co-authored-by: hacrot3000 --- README.md | 19 +++++++++++++------ configure.ac | 2 +- include/mdbtools.h.in | 7 +++++++ 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 0df1e56..eb54bc5 100644 --- a/README.md +++ b/README.md @@ -116,19 +116,26 @@ If you have cloned the Git repository, you will first need to generate the `configure` file (skip this step if you have downloaded a formal release): ```bash -$ autoreconf -i -f +autoreconf -i -f ``` Then: ```bash -$ ./configure +./configure ``` +OR with mingw32 (--disable-shared --enable-static are optional as you knew): + +```bash +./configure --host=x86_64-w64-mingw32 --disable-shared --enable-static +``` + + OR for a complete install (requires bison, flex, and unixODBC): ```bash -$ ./configure --with-unixodbc=/usr/local +./configure --with-unixodbc=/usr/local ``` By default, MDB Tools is linked against the copy of @@ -155,7 +162,7 @@ with a Unicode-capable driver at /usr/local/lib/odbc/libmdbodbcW.so. The command `configure --help` will give you the list of mdbtools specific options. ```bash -$ make +make ``` Once MDB Tools has been compiled, libmdb.[so|a] will be in the src/libmdb @@ -164,14 +171,14 @@ directory and the utility programs will be in the src/util directory. You can then install (to /usr/local by default) by running the following as root: ```bash -$ make install +make install ``` Some systems will also need the ld cache to be updated after installation; You can do that running: ```bash -$ ldconfig +ldconfig ``` ## Hacking diff --git a/configure.ac b/configure.ac index e23a2ed..cdfcfee 100644 --- a/configure.ac +++ b/configure.ac @@ -86,7 +86,7 @@ AC_SUBST(LFLAGS) CFLAGS="$CFLAGS -Wall" LOCALE_T=locale_t AS_CASE([$host], - [*mingw*], [LDFLAGS="$LDFLAGS -no-undefined" CFLAGS="$CFLAGS -D_spawnv=spawnv"], []) + [*mingw*], [LDFLAGS="$LDFLAGS -no-undefined" CFLAGS="$CFLAGS -D_spawnv=_spawnv"], []) AC_SUBST(LOCALE_T) dnl See if iconv is present and wanted diff --git a/include/mdbtools.h.in b/include/mdbtools.h.in index a543897..6de3f52 100644 --- a/include/mdbtools.h.in +++ b/include/mdbtools.h.in @@ -68,6 +68,13 @@ // M$VC see http://stackoverflow.com/questions/1113409/attribute-constructor-equivalent-in-vc #define MDB_DEPRECATED(type, funcname) type __attribute__((deprecated)) funcname +#ifdef __MINGW32__ + #include + #ifndef locale_t + typedef _locale_t locale_t; + #endif +#endif + typedef @LOCALE_T@ mdb_locale_t; enum {