locale.c won't build if uselocale found but strtod_l isn't
Posted: 2014-10-09T18:19:19-07:00
When updating to a new build of Solaris 12 where uselocale() and newlocale() had been introduced, we hit a build failure:
It seems that AcquireCLocale is inside an #if defined(MAGICKCORE_HAVE_STRTOD_L) block but not all calls to it are. As we don't have strtod_l() we hit this. I was able to patch magick/locale.c as follows; the result builds on both the old build [that has neither uselocale() nor newlocale()] and the new build [that has both]. Note that this patch is against 6.8.3 but applies cleanly (modulo 98 lines of offset) against 6.8.9-8. Note also that a corresponding pair of lines may need to be tweaked for those who have vsnprintf_l().
Code: Select all
CCLD magick/libMagickCore-6.Q16.la
Undefined first referenced
symbol in file
AcquireCLocale magick/.libs/magick_libMagickCore_6_Q16_la-locale.o
ld: fatal: symbol referencing errors
Code: Select all
--- ImageMagick-6.8.3/magick/locale.c.orig 2012-12-07 05:14:16.000000000 -0800
+++ ImageMagick-6.8.3/magick/locale.c 2014-10-09 13:32:28.333380432 -0700
@@ -256,7 +256,7 @@
#endif
}
#else
-#if defined(MAGICKCORE_HAVE_USELOCALE)
+#if defined(MAGICKCORE_HAVE_USELOCALE) && defined(MAGICKCORE_HAVE_STRTOD_L)
{
locale_t
locale,
@@ -347,7 +347,7 @@
#endif
}
#elif defined(MAGICKCORE_HAVE_VSNPRINTF)
-#if defined(MAGICKCORE_HAVE_USELOCALE)
+#if defined(MAGICKCORE_HAVE_USELOCALE) && defined(MAGICKCORE_HAVE_STRTOD_L)
{
locale_t
locale,