option(OVERRIDE_GET_RANDOM_SEED "Override json_c_get_random_seed() with custom code." OFF)
option(DISABLE_EXTRA_LIBS "Avoid linking against extra libraries, such as libbsd." OFF)
option(DISABLE_JSON_POINTER "Disable JSON pointer (RFC6901) support." OFF)
+option(NEWLOCALE_NEEDS_FREELOCALE "Work around newlocale bugs in old FreeBSD by calling freelocale" OFF)
if (UNIX OR MINGW OR CYGWIN)
/* Define to 1 if you have the `uselocale' function. */
#cmakedefine HAVE_USELOCALE
+/* Define to 1 if newlocale() needs freelocale() called on it's `base` argument */
+#cmakedefine NEWLOCALE_NEEDS_FREELOCALE
+
/* Define to 1 if you have the `vasprintf' function. */
#cmakedefine HAVE_VASPRINTF
freelocale(duploc);
return NULL;
}
+#ifdef NEWLOCALE_NEEDS_FREELOCALE
+ // Older versions of FreeBSD (<12.4) don't free the locale
+ // passed to newlocale(), so do it here
+ freelocale(duploc);
+#endif
uselocale(newloc);
}
#elif defined(HAVE_SETLOCALE)