aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Schink <swo-dev@marcschink.de>2016-03-10 10:23:38 +0100
committerMarc Schink <swo-dev@marcschink.de>2016-03-10 10:28:10 +0100
commit55c620e711d206e5c192d9973c3ec39fae7b5394 (patch)
treec977facce17e2af02f4864a51ed677a768558de4
parent49799b2fbed7180a034875b34195b38db3dc5065 (diff)
Use __USE_MINGW_ANSI_STDIO for MinGW build
This enables C99 compatible stdio functions on MinGW instead of using the incompatible functions provided by Microsoft.
-rw-r--r--configure.ac8
-rw-r--r--src/dwt.c4
-rw-r--r--src/main.c5
3 files changed, 16 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index d6d6f65..731a0d9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -24,6 +24,8 @@ AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_AUX_DIR([build-aux])
+AC_CANONICAL_HOST
+
AM_INIT_AUTOMAKE([foreign -Wall -Werror])
# Enable additional compiler warnings via -Wall and -Wextra.
@@ -51,6 +53,12 @@ PKG_CHECK_MODULES([libswo], [libswo >= 0.1.0],
# Checks for library functions.
+# Use C99 compatible stdio functions on MinGW instead of the incompatible
+# functions provided by Microsoft.
+AS_CASE([$host_os], [mingw*],
+ [AC_DEFINE([__USE_MINGW_ANSI_STDIO], [1],
+ [Define to 1 to use C99 compatible stdio functions on MinGW.])])
+
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([src/Makefile])
diff --git a/src/dwt.c b/src/dwt.c
index c0b3411..e24e255 100644
--- a/src/dwt.c
+++ b/src/dwt.c
@@ -17,6 +17,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <stdio.h>
#include <stdint.h>
#include <glib.h>
diff --git a/src/main.c b/src/main.c
index 1e387a7..9c890b2 100644
--- a/src/main.c
+++ b/src/main.c
@@ -17,13 +17,16 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <stdio.h>
#include <stdint.h>
#include <unistd.h>
#include <string.h>
#include <glib.h>
-#include "config.h"
#include "swodec.h"
#define BUFFER_SIZE 1024