Bug 48573 - platform without regex do not have also REG_XXX defines

Fix a build issue on the platforms where regex isn't available
This commit is contained in:
Akira TAGOH 2012-04-12 11:01:12 +09:00
parent 9231d79ad1
commit ac6271dbac
2 changed files with 13 additions and 2 deletions

View File

@ -135,6 +135,15 @@ AC_FUNC_VPRINTF
AC_FUNC_MMAP
AC_CHECK_FUNCS([geteuid getuid link memmove memset mkstemp strchr strrchr strtol getopt getopt_long sysconf ftruncate chsize rand random lrand48 random_r rand_r regcomp regerror regexec regfree])
#
# regex
#
use_regex=0
if test "x$ac_cv_func_regcomp" = "xyes" -a "x$ac_cv_func_regerror" = "xyes" -a "x$ac_cv_func_regexec" = "xyes" -a "x$ac_cv_func_regfree"; then
use_regex=1
fi
AC_DEFINE_UNQUOTED(USE_REGEX,$use_regex,[Use regex.])
#
# Checks for iconv
#

View File

@ -272,11 +272,11 @@ FcStrCmp (const FcChar8 *s1, const FcChar8 *s2)
return (int) c1 - (int) c2;
}
#ifdef USE_REGEX
static FcBool
_FcStrRegexCmp (const FcChar8 *s, const FcChar8 *regex, int cflags, int eflags)
{
int ret = -1;
#if defined (HAVE_REGCOMP) && defined (HAVE_REGERROR) && defined (HAVE_REGEXEC) && defined (HAVE_REGFREE)
regex_t reg;
if ((ret = regcomp (&reg, (const char *)regex, cflags)) != 0)
@ -302,10 +302,12 @@ _FcStrRegexCmp (const FcChar8 *s, const FcChar8 *regex, int cflags, int eflags)
}
}
regfree (&reg);
#endif
return ret == 0 ? FcTrue : FcFalse;
}
#else
# define _FcStrRegexCmp(_s_, _regex_) (FcFalse)
#endif
FcBool
FcStrRegexCmp (const FcChar8 *s, const FcChar8 *regex)