After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 140468 - building libxslt 1.1.6 on Solaris
building libxslt 1.1.6 on Solaris
Status: VERIFIED FIXED
Product: libxslt
Classification: Platform
Component: general
unspecified
Other Solaris
: Normal normal
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
: 138095 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2004-04-19 06:32 UTC by Dimitri Papadopoulos
Modified: 2009-08-15 18:40 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Dimitri Papadopoulos 2004-04-19 06:32:57 UTC
Just a short note to report that libxslt 1.1.6 builds without problem on Solaris
using the Sun ONE Studio 7 compiler, with just one warning:

 cc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I../libxslt -I../libexslt -I..
-I../libxslt -I../libexslt -I/usr/local/libxml2/include/libxml2 -O -O -c date.c
 -KPIC -DPIC -o .libs/date.o
"date.c", line 748: warning: implicit function declaration: localtime_r

This bug was already present in libxslt 1.1.5:
	http://bugzilla.gnome.org/show_bug.cgi?id=138095

I had written the warning could be caused by a missing <time.h> in date.c, but
it's a bit more complicated than that. File date.c does include <time.h>:
	#ifdef HAVE_TIME_H
	#include <time.h>
	#endif
after including "config.h":
	#if defined(WIN32) && [...]
	[...]
	#else
	#include "config.h"
	#endif
which does define HAVE_TIME_H:
	/* Define to 1 if you have the <time.h> header file. */
	#define HAVE_TIME_H 1

The problem is that unlike GNU systems, Unix systems don't always "export" newer
APIs by default, for compatibility reasons. On Solaris /usr/include/time.h looks
like:
	#if	defined(__EXTENSIONS__) || defined(_REENTRANT) || \
		    (_POSIX_C_SOURCE - 0 >= 199506L)
	extern struct tm *gmtime_r(const time_t *, struct tm *);
	extern struct tm *localtime_r(const time_t *, struct tm *);
	#endif	/* defined(__EXTENSIONS__) || defined(_REENTRANT) .. */

As far as I can tell, the idea here is that you don't need localtime_r if you
don't write threaded programs that are supposed to define _REENTRANT or
_POSIX_C_SOURCE. Of course that's stupid since libraries should use localtime_r
even when they're not threaded themselves, because they may be later used in a
threaded program.

Anyway, I see no solution apart from defining __EXTENSIONS__ which is fairly
standard on Solaris if you want to use the latest APIs without caring about
compatibility. I'm not sure whether __EXTENSIONS__ should be defined in config.h
or Makefile. Both should work, it's a question of taste and consistency.
Comment 1 John Fleck 2004-04-19 14:25:41 UTC
*** Bug 138095 has been marked as a duplicate of this bug. ***
Comment 2 Daniel Veillard 2004-05-16 22:10:05 UTC
Okay, I see. To limit the amount of potential troubles related to the define
I assume the following is a safe bet:

--- date.c      26 Feb 2004 17:04:11 -0000      1.24
+++ date.c      16 May 2004 21:50:28 -0000
@@ -49,6 +49,13 @@
 #include <math.h>
 #endif
  
+/* needed to get localtime_r on Solaris */
+#ifdef sun
+#ifndef __EXTENSION__
+#define __EXTENSION__
+#endif
+#endif
+
 #ifdef HAVE_TIME_H
 #include <time.h>
 #endif

  I have commited this, I hope this will close this bug for good :-)

   thanks a lot for the explanations,

Daniel
Comment 3 Daniel Veillard 2004-07-06 09:19:46 UTC
This should be closed in libxslt-1.1.8,
                                                                                
  thanks,
                                                                                
Daniel