printf: deal with some of the HAVE_FOO used in the printf code
authorTim-Philipp Müller <tim@centricular.net>
Wed, 10 Apr 2013 10:51:37 +0000 (11:51 +0100)
committerTim-Philipp Müller <tim.muller@collabora.co.uk>
Fri, 12 Apr 2013 22:05:59 +0000 (23:05 +0100)
Probably needs some more work for MSVC.

configure.ac
gst/printf/Makefile.am
gst/printf/gst-printf.h

index ca57a1f..8a6ad13 100644 (file)
@@ -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
index 5b9fbd4..1388be7 100644 (file)
@@ -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 =
index 8860003..1921550 100644 (file)
 #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
 #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__ */