summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Ringwald <mringwal@inf.ethz.ch>2008-07-09 16:19:01 +0200
committerMatthias Ringwald <mringwal@inf.ethz.ch>2008-07-09 16:19:01 +0200
commit42f53bf3d5d3ec823e4db53fde5f0efd1bbc3451 (patch)
tree5f6d96548bf42a3d1818309146dc359bf3f23ace
parentdb77cc621ac71f2a18aba0c2072c3d379e871e85 (diff)
downloadxine-lib-42f53bf3d5d3ec823e4db53fde5f0efd1bbc3451.tar.gz
xine-lib-42f53bf3d5d3ec823e4db53fde5f0efd1bbc3451.tar.bz2
Fix MIN, MAX macro replacement (mingw32 fix)
xine was already checking for MIN/MAX macros but the replacement does not work (at least not on mingw32). This change defines HAVE_[MIN|MAX]_MACRO and if missing, providedes them in lib/os_internal.h
-rw-r--r--configure.ac8
-rw-r--r--lib/os_internal.h7
2 files changed, 11 insertions, 4 deletions
diff --git a/configure.ac b/configure.ac
index 7c7030009..b3a9d7079 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2159,10 +2159,10 @@ AC_CHECK_FUNC(opendir,
AC_MSG_ERROR([dirent is needed (opendir, readdir, ...)])
fi])
-XINE_CHECK_MINMAX([], [
- AC_DEFINE([MIN(x, y)], [(x > y) ? y : x], [Get the minimum value between two])
- AC_DEFINE([MAX(x, y)], [(x > y) ? x : y], [Get the maximum value between two])
- ])
+XINE_CHECK_MINMAX([
+ AC_DEFINE(HAVE_MAX_MACRO, 1, [Define to 1 if you have 'MAX' macro in sys/param.h])
+ AC_DEFINE(HAVE_MIN_MACRO, 1, [Define to 1 if you have 'MIN' macro in sys/param.h])
+ ],[])
dnl ---------------------------------------------
dnl cflags and debug cflags
diff --git a/lib/os_internal.h b/lib/os_internal.h
index 968b8f02f..fe406a747 100644
--- a/lib/os_internal.h
+++ b/lib/os_internal.h
@@ -36,6 +36,13 @@
# define XINE_DIRECTORY_SEPARATOR_CHAR '/'
#endif
+/* replacement of min/max macros */
+#ifndef HAVE_MAX_MACRO
+#define MAX(a,b) (((a)>(b))?(a):(b))
+#endif
+#ifndef HAVE_MIN_MACRO
+#define MIN(a,b) (((a)<(b))?(a):(b))
+#endif
/* replacement of strndup */
#ifndef HAVE_STRNDUP