[rrd-developers] r2017 breaks build on !linux

Tobias Oetiker tobi at oetiker.ch
Sat Feb 13 12:29:35 CET 2010


Hi Kevin,

Thursday kevin brintnall wrote:

> On Thu, Feb 11, 2010 at 06:42:50PM +0100, Tobias Oetiker wrote:
> > Hi Kevin,
> >
> > Today kevin brintnall wrote:
> >
> > > Tobi,
> > >
> > > r2107 uses _NL_TIME_FIRST_WEEKDAY to determine the first weekday.
> > >
> > > As far as I can tell, this macro exists only on Linux systems.  FreeBSD
> > > and Solaris have no such macro.
> > >
> > > #ifdef(HAVE_NL_LANGINFO) is insufficient, since both of those systems do
> > > have a <langinfo.h>.
> >
> > ok i'll make the configure test more robust.
> >
> > do you know how to determine this info on freebsd/solaris ?
>
> There doesn't appear to be a way at the moment.

in that case, I guess this shold help:

Index: src/rrd_graph.c
===================================================================
--- src/rrd_graph.c     (revision 2018)
+++ src/rrd_graph.c     (working copy)
@@ -1359,11 +1359,10 @@
     return 0;
 }

-
 static int find_first_weekday(void){
     static int first_weekday = -1;
     if (first_weekday == -1){
-#if defined(HAVE_NL_LANGINFO)
+#ifdef HAVE__NL_TIME_WEEK_1STDAY
         /* according to http://sourceware.org/ml/libc-locales/2009-q1/msg00011.html */
         long week_1stday_l = (long) nl_langinfo (_NL_TIME_WEEK_1STDAY);
         if (week_1stday_l == 19971130) first_weekday = 0; /* Sun */
Index: configure.ac
===================================================================
--- configure.ac        (revision 2017)
+++ configure.ac        (working copy)
@@ -345,6 +345,12 @@

 CHECK_FOR_WORKING_MS_ASYNC

+dnl do we have nl_langinfo(_NL_TIME_WEEK_1STDAY)
+AC_CHECK_FUNCS(_NL_TIME_WEEK_1STDAY, ,
+  [AC_MSG_CHECKING([for nl_langinfo(_NL_TIME_WEEK_1STDAY) with langinfo.h])
+    AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <langinfo.h>]], [[nl_langinfo(_NL_TIME_WEEK_1STDAY)]])],[AC_MSG_RESULT(yes)
+      AC_DEFINE(HAVE__NL_TIME_WEEK_1STDAY)],[AC_MSG_RESULT(no)])])
+
 dnl Do we need getopt_long

 dnl even when including our own getopt implementation

cheers
tobi


-- 
Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten, Switzerland
http://it.oetiker.ch tobi at oetiker.ch ++41 62 775 9902 / sb: -9900



More information about the rrd-developers mailing list