[libgweather] Consolidate feature checks and system macros



commit 1c9a26ce4d58efeda86a73829cb8d74fe71e89d5
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Mon Apr 13 23:34:32 2015 -0700

    Consolidate feature checks and system macros
    
    We know hard require POSIX 2008 with XSI extensions (aka SUSv3, or
    XOPEN 700 in glibc), as well as C99 for the compiler.
    If the BSDs provide this, good, otherwise tell them they are 7
    years late.

 configure.ac                   |   31 -------------------------------
 libgweather/Makefile.am        |    3 ++-
 libgweather/gweather-weather.c |   17 -----------------
 libgweather/weather-metar.c    |    6 +-----
 libgweather/weather-owm.c      |    1 -
 libgweather/weather-yahoo.c    |    1 -
 libgweather/weather-yrno.c     |    1 -
 7 files changed, 3 insertions(+), 57 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 204b219..ef2551b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -86,37 +86,6 @@ AC_CHECK_FUNCS(regexec,,[AC_CHECK_LIB(regex,regexec,
                [AC_MSG_ERROR([No regex library found])])])
 AC_SUBST(REGEX_LIBS)
 
-
-dnl ***************************************************************************
-dnl *** Check for presence of tm.tm_gmtoff on the system                    ***
-dnl ***************************************************************************
-AC_CHECK_MEMBER([struct tm.tm_gmtoff],[struct_tm_tm_gmtoff=true],[struct_tm_tm_gmtoff=false],[#include 
<time.h>])
-case $struct_tm_tm_gmtoff in
-        true)
-                AC_DEFINE_UNQUOTED(HAVE_TM_TM_GMOFF, 1, Have the tm.tm_gmtoff member.)
-                ;;
-        *)
-                AC_CHECK_DECL(timezone,AC_DEFINE(HAVE_TIMEZONE,1,Have timezone),,
-[
-#include <time.h>
-])
-                ;;
-esac
-
-dnl ***************************************************************************
-dnl *** _NL_MEASUREMENT_MEASUREMENT is an enum and not a define             ***
-dnl ***************************************************************************
-AC_MSG_CHECKING([for _NL_MEASUREMENT_MEASUREMENT])
-AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <langinfo.h>]], [[
-char c;
-c = *((unsigned char *)  nl_langinfo(_NL_MEASUREMENT_MEASUREMENT));
-]])],[gtk_ok=yes],[gtk_ok=no])
-AC_MSG_RESULT($gtk_ok)
-if test "$gtk_ok" = "yes"; then
-  AC_DEFINE([HAVE__NL_MEASUREMENT_MEASUREMENT], [1],
-            [Define if _NL_MEASUREMENT_MEASUREMENT is available])
-fi
-
 dnl ***************************************************************************
 dnl *** Find tzdata                                                         ***
 dnl ***************************************************************************
diff --git a/libgweather/Makefile.am b/libgweather/Makefile.am
index 89ffb2b..694edf2 100644
--- a/libgweather/Makefile.am
+++ b/libgweather/Makefile.am
@@ -5,12 +5,13 @@ noinst_LTLIBRARIES = libgweather-internal-3.la
 noinst_PROGRAMS = test_metar test_locations test_sun_moon
 
 AM_CPPFLAGS =                  \
+       -D_XOPEN_SOURCE=700     \
        -DGWEATHER_COMPILATION  \
        $(DEPS_CFLAGS)          \
        -I$(top_srcdir)         \
        -I$(srcdir)
 
-AM_CFLAGS = $(WARN_CFLAGS)
+AM_CFLAGS = -std=c99 $(WARN_CFLAGS)
 
 gweather_new_headers = \
        gweather.h \
diff --git a/libgweather/gweather-weather.c b/libgweather/gweather-weather.c
index 3fa6453..60c5499 100644
--- a/libgweather/gweather-weather.c
+++ b/libgweather/gweather-weather.c
@@ -736,15 +736,6 @@ gweather_info_get_conditions (GWeatherInfo *info)
 static gboolean
 is_locale_metric (void)
 {
-    /* Translate to the default units to use for presenting
-     * lengths to the user. Translate to default:inch if you
-     * want inches, otherwise translate to default:mm.
-     * Do *not* translate it to "predefinito:mm", if it
-     * it isn't default:mm or default:inch it will not work
-     */
-    gchar *e = _("default:mm");
-
-#ifdef HAVE__NL_MEASUREMENT_MEASUREMENT
     const char *fmt;
     fmt = nl_langinfo (_NL_MEASUREMENT_MEASUREMENT);
 
@@ -752,14 +743,6 @@ is_locale_metric (void)
        return FALSE;
     else
        return TRUE;
-#endif
-
-    if (strcmp (e, "default:inch")==0)
-        return FALSE;
-    else if (strcmp (e, "default:mm"))
-        g_warning ("Whoever translated default:mm did so wrongly.\n");
-
-    return TRUE;
 }
 
 static GWeatherTemperatureUnit
diff --git a/libgweather/weather-metar.c b/libgweather/weather-metar.c
index b8ac2b1..48559be 100644
--- a/libgweather/weather-metar.c
+++ b/libgweather/weather-metar.c
@@ -62,12 +62,8 @@ make_time (gint utcDate, gint utcHour, gint utcMin)
     tm.tm_min  = utcMin;
     tm.tm_sec  = 0;
 
-    /* mktime() assumes value is local, not UTC.  Use tm_gmtoff to compensate */
-#ifdef HAVE_TM_TM_GMOFF
-    return tm.tm_gmtoff + mktime (&tm);
-#elif defined HAVE_TIMEZONE
+    /* mktime() assumes value is local, not UTC.  Use timezone to compensate */
     return timezone + mktime (&tm);
-#endif
 }
 
 static void
diff --git a/libgweather/weather-owm.c b/libgweather/weather-owm.c
index 4ad94e9..6628653 100644
--- a/libgweather/weather-owm.c
+++ b/libgweather/weather-owm.c
@@ -20,7 +20,6 @@
 #include <config.h>
 #endif
 
-#define _GNU_SOURCE /* for strptime */
 #include <stdio.h>
 #include <stdlib.h>
 #include <assert.h>
diff --git a/libgweather/weather-yahoo.c b/libgweather/weather-yahoo.c
index 77c0b2b..67c305b 100644
--- a/libgweather/weather-yahoo.c
+++ b/libgweather/weather-yahoo.c
@@ -22,7 +22,6 @@
 #include <config.h>
 #endif
 
-#define _GNU_SOURCE /* for strptime */
 #include <time.h>
 #include <stdlib.h>
 #include <string.h>
diff --git a/libgweather/weather-yrno.c b/libgweather/weather-yrno.c
index 2e62926..da6a943 100644
--- a/libgweather/weather-yrno.c
+++ b/libgweather/weather-yrno.c
@@ -22,7 +22,6 @@
 #include <config.h>
 #endif
 
-#define _GNU_SOURCE /* for strptime */
 #include <time.h>
 #include <stdlib.h>
 #include <string.h>


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