[evolution-data-server] Get the prototype for strptime() when it's available



commit 47cf221ae610bbf64bc1e328960e5812c20df41f
Author: Emilio Pozuelo Monfort <pochu27 gmail com>
Date:   Thu Dec 17 22:03:06 2009 +0100

    Get the prototype for strptime() when it's available
    
    Instead of only getting it on Linux. Also use nl_langinfo()
    when available, and not only on Linux.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=604858

 configure.ac                  |    2 +-
 libedataserver/e-time-utils.c |   13 ++++---------
 2 files changed, 5 insertions(+), 10 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index f6e449c..ae9f70a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -269,7 +269,7 @@ AC_FUNC_ALLOCA
 dnl ******************************
 dnl Checks for functions
 dnl ******************************
-AC_CHECK_FUNCS(fsync strptime strtok_r)
+AC_CHECK_FUNCS(fsync strptime strtok_r nl_langinfo)
 
 dnl ***********************************
 dnl Check for base dependencies early.
diff --git a/libedataserver/e-time-utils.c b/libedataserver/e-time-utils.c
index 73759c5..7fd2cc2 100644
--- a/libedataserver/e-time-utils.c
+++ b/libedataserver/e-time-utils.c
@@ -9,19 +9,14 @@
  */
 
 #include <config.h>
-
-#ifdef __linux__
-/* We need this to get a prototype for strptime. */
-#define _GNU_SOURCE
-#endif /* __linux__ */
+#define _XOPEN_SOURCE
 
 #include <time.h>
 #include <sys/time.h>
 
-#ifdef __linux__
+#ifdef HAVE_NL_LANGINFO
 #include <langinfo.h>
-#undef _GNU_SOURCE
-#endif /* __linux__ */
+#endif /* HAVE_NL_LANGINFO */
 
 #include <string.h>
 #include <ctype.h>
@@ -2028,7 +2023,7 @@ e_time_get_d_fmt_with_4digit_year (void)
 {
 	gchar *p;
 	gchar *res = NULL;
-#if defined(__linux__)
+#if defined(HAVE_NL_LANGINFO)
 	res = g_strdup (nl_langinfo (D_FMT) );
 #elif defined(G_OS_WIN32)
   #define GET_LOCALE_INFO(str, len) GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_SLONGDATE, str, len)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]