summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.net>2013-04-10 11:51:37 +0100
committerTim-Philipp Müller <tim.muller@collabora.co.uk>2013-04-12 23:05:59 +0100
commit5299a0cd65e3233dd61a5c8862519be4961f1b27 (patch)
tree443fe2cc58ccf8218576dc42be8044b7a3fda973
parent3c1d9c6d41e4f209af5be1baa933234d6ef51560 (diff)
printf: deal with some of the HAVE_FOO used in the printf code
Probably needs some more work for MSVC.
-rw-r--r--configure.ac21
-rw-r--r--gst/printf/Makefile.am12
-rw-r--r--gst/printf/gst-printf.h19
3 files changed, 52 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index ca57a1fea..8a6ad13d3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -529,6 +529,27 @@ AC_CHECK_LIB(dl, dladdr,
LIBS="$LIBS -ldl")
CFLAGS="$save_cflags"
+dnl Check printf stuff
+if test "x${GST_DISABLE_GST_DEBUG}" != "xyes"; then
+ AC_TYPE_LONG_LONG_INT
+ AC_TYPE_UNSIGNED_LONG_LONG_INT
+
+ if test x$ac_cv_type_long_long_int$ac_cv_type_unsigned_long_long_int = xyesyes; then
+ AC_DEFINE([HAVE_LONG_LONG], [1], [Define to 1 if the system has the type long long])
+ fi
+
+ dnl /usr/share/aclocal/inttypes_h.m4 - ships with gettext apparently
+ gl_AC_HEADER_INTTYPES_H
+
+ dnl /usr/share/aclocal/stdint_h.m4 - ships with gettext apparently
+ gl_AC_HEADER_STDINT_H
+
+ AC_CHECK_TYPES(ptrdiff_t)
+
+ AC_TYPE_INTMAX_T
+ AC_TYPE_SIZE_T
+fi
+
dnl *** checks for dependency libraries ***
dnl GLib
diff --git a/gst/printf/Makefile.am b/gst/printf/Makefile.am
index 5b9fbd4d8..1388be770 100644
--- a/gst/printf/Makefile.am
+++ b/gst/printf/Makefile.am
@@ -1,5 +1,17 @@
AM_CPPFLAGS = $(GLIB_CFLAGS) -DSTATIC=G_GNUC_INTERNAL $(WARNING_CFLAGS) $(PRINTF_CFLAGS)
+# don't have a need for that and it's not portable so just ignore for now
+AM_CPPFLAGS += -UHAVE_LONG_DOUBLE
+
+# just use internal emulation for printing long longs for now
+AM_CPPFLAGS += -UHAVE_LONG_LONG_FORMAT
+
+# don't need any of this widechar stuff, so just disable it for now
+AM_CPPFLAGS += -UHAVE_WCHAR_T -UHAVE_WCSLEN -UHAVE_WINT_T
+
+# in case anyone wants to add anything else or undo some of the undefs
+AM_CPPFLAGS += $(PRINTF_EXTRA_CFLAGS)
+
noinst_LTLIBRARIES = libgstprintf.la
libgstprintf_la_CFLAGS =
diff --git a/gst/printf/gst-printf.h b/gst/printf/gst-printf.h
index 8860003fd..192155072 100644
--- a/gst/printf/gst-printf.h
+++ b/gst/printf/gst-printf.h
@@ -36,6 +36,11 @@
#define realloc g_realloc
#define free g_free
+/* If GLib is using the system printf, we can assume C99 behaviour */
+#ifdef GLIB_USING_SYSTEM_PRINTF
+#define HAVE_C99_SNPRINTF
+#endif
+
/* Ensure only C99 snprintf gets used */
#undef HAVE_SNPRINTF
#ifdef HAVE_C99_SNPRINTF
@@ -44,5 +49,19 @@
#undef HAVE_SNPRINTF
#endif
+/* based on glib's config.h.win32.in */
+#ifdef G_OS_WIN32
+
+/* define to support printing 64-bit integers with format I64 */
+#define HAVE_INT64_AND_I64 1
+
+/* FIXME: do we need to do anything else here? or should we just typedef/define
+ * intmax_t etc. to __int64? */
+#if defined (_MSC_VER) && _MSC_VER >= 1600
+#undef HAVE_INTMAX_T
+#define HAVE_INTMAX_T 1
+#endif
+
+#endif /* G_OS_WIN32 */
#endif /* __G_GNULIB_H__ */