[MPlayer-dev-eng] [PATCH] OS/X localtime_r multiply defined

Steven M. Schultz sms at 2BSD.COM
Wed Apr 14 01:05:54 CEST 2004


Hi!

	After installing a copy of ffmpeg/libavformat into the MPlayer 
	source tree the symbol localtime_r() is multiply defined when
	building mencoder on OS/X:

ld: warning multiple definitions of symbol _locale_charset
/usr/lib/libiconv.dylib(localcharset.o) definition of _locale_charset
/usr/local/lib/libintl.dylib(localcharset.o) definition of _locale_charset
ld: multiple definitions of symbol _localtime_r
/usr/lib/libm.dylib(localtime.So) definition of _localtime_r
libavformat/libavformat.a(os_support.o) definition of _localtime_r in section (__TEXT,__text)
gmake: *** [mencoder] Error 1

	This is because HAVE_LOCALTIME_R is used by libavformat/os_support.c
	but MPlayer's ./configure does not define HAVE_LOCALTIME_R for systems
	which have it.  

	A patch against the current CVS version is attached which adds a test
	for localtime_r and defines HAVE_LOCALTIME_R in config.h as needed
	(the ffmpeg folks have graciously added a '#include "config.h"' to
	os_support.c).

	Cheers,
	Steven Schultz
-------------- next part --------------
--- configure.dist	Tue Apr 13 15:55:10 2004
+++ configure	Tue Apr 13 16:01:50 2004
@@ -2654,6 +2654,20 @@
 fi
 echores "$_fseeko"
 
+echocheck "localtime_r()"
+cat > $TMPC << EOF
+#include <time.h>
+int main( void ) { localtime_r(NULL, NULL); }
+EOF
+_localtime_r=no
+cc_check && _localtime_r=yes
+if test "$_localtime_r" = yes ; then
+ _def_localtime_r='#define HAVE_LOCALTIME_R 1'
+else
+ _def_localtime_r='#undef HAVE_LOCALTIME_R'
+fi
+echores "$_localtime_r"
+
 echocheck "vsscanf()"
 cat > $TMPC << EOF
 #include <stdarg.h>
@@ -6250,6 +6264,8 @@
 #include <sys/types.h>
 int fseeko(FILE *, off_t, int);
 #endif
+
+$_def_localtime_r
 
 /* Define this if your system has vsscanf */
 $_def_vsscanf


More information about the MPlayer-dev-eng mailing list