aboutsummaryrefslogtreecommitdiff
path: root/fontconfig/configure.in
diff options
context:
space:
mode:
Diffstat (limited to 'fontconfig/configure.in')
-rw-r--r--fontconfig/configure.in139
1 files changed, 111 insertions, 28 deletions
diff --git a/fontconfig/configure.in b/fontconfig/configure.in
index ea44c1422..1af236719 100644
--- a/fontconfig/configure.in
+++ b/fontconfig/configure.in
@@ -123,7 +123,7 @@ dnl ==========================================================================
# Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_STDC
-AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h])
+AC_CHECK_HEADERS([fcntl.h regex.h stdlib.h string.h unistd.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
@@ -133,38 +133,86 @@ AC_TYPE_PID_T
# Checks for library functions.
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])
+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])
#
-# Checks for iconv
+# regex
#
-AC_MSG_CHECKING([for a usable iconv])
-ICONV_LIBS=""
-AC_TRY_LINK([#include <iconv.h>],
- [iconv_open ("from", "to");],
- [use_iconv=1],
- [use_iconv=0])
-if test x$use_iconv = x1; then
- AC_MSG_RESULT([libc])
-else
- # try using libiconv
- fontconfig_save_libs="$LIBS"
- LIBS="$LIBS -liconv"
+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.])
- AC_TRY_LINK([#include <iconv.h>],
- [iconv_open ("from", "to");],
- [use_iconv=1],
- [use_iconv=0])
-
- if test x$use_iconv = x1; then
- ICONV_LIBS="-liconv"
- AC_MSG_RESULT([libiconv])
+#
+# Checks for iconv
+#
+AC_ARG_WITH(libiconv,
+ [AC_HELP_STRING([--with-libiconv=DIR],
+ [Use libiconv in DIR])],
+ [libiconv_prefix=$withval],
+ [libiconv_prefix=auto])
+AC_ARG_WITH(libiconv-includes,
+ [AC_HELP_STRING([--with-libiconv-includes=DIR],
+ [Use libiconv includes in DIR])],
+ [libiconv_includes=$withval],
+ [libiconv_includes=auto])
+AC_ARG_WITH(libiconv-lib,
+ [AC_HELP_STRING([--with-libiconv-lib=DIR],
+ [Use libiconv library in DIR])],
+ [libiconv_lib=$withval],
+ [libiconv_lib=auto])
+
+# if none of libiconv,libiconv-includes,libiconv-libs are specified
+if test "$libiconv_prefix" != "auto" -o "$libiconv_includes" != "auto" -o "$libiconv_lib" != "auto"; then
+ if test "$libiconv_includes" != "auto" -a -r ${libiconv_includes}/iconv.h; then
+ libiconv_cflags="-I${libiconv_includes}"
+ elif test "$libiconv_prefix" != "auto" -a -r ${libiconv_prefix}/include/iconv.h; then
+ libiconv_cflags="-I${libiconv_prefix}/include"
+ else
+ libiconv_cflags=""
+ fi
+ if test "$libiconv_lib" != "auto"; then
+ libiconv_lib="-L${libiconv_lib} -liconv"
+ elif test "$libiconv_prefix" != "auto"; then
+ libiconv_lib="-L${libiconv_prefix}/lib -liconv"
+ elif test "x$libiconv_cflags" != "x"; then
+ libiconv_lib="-liconv"
else
- AC_MSG_RESULT([no])
+ libiconv_lib=""
fi
+fi
+
+use_iconv=0
+AC_MSG_CHECKING([for a usable iconv])
+if test "x$libiconv_cflags" != "x" -o "x$libiconv_lib" != "x"; then
+ iconvsaved_CFLAGS="$CFLAGS"
+ iconvsaved_LIBS="$LIBS"
+ CFLAGS="$CFLAGS $libiconv_cflags"
+ LIBS="$LIBS $libiconv_lib"
- LIBS="$fontconfig_save_libs"
+ AC_TRY_LINK([#include <iconv.h>],
+ [iconv_open ("from", "to");],
+ [iconv_type="libiconv"
+ use_iconv=1],
+ [use_iconv=0])
+
+ CFLAGS="$iconvsaved_CFLAGS"
+ LIBS="$iconvsaved_LIBS"
+ ICONV_CFLAGS="$libiconv_cflags"
+ ICONV_LIBS="$libiconv_lib"
+fi
+if test "x$use_iconv" = "x0"; then
+ AC_TRY_LINK([#include <iconv.h>],
+ [iconv_open ("from", "to");],
+ [iconv_type="libc"
+ use_iconv=1],
+ [iconv_type="not found"
+ use_iconv=0])
fi
+
+AC_MSG_RESULT([$iconv_type])
+AC_SUBST(ICONV_CFLAGS)
AC_SUBST(ICONV_LIBS)
AC_DEFINE_UNQUOTED(USE_ICONV,$use_iconv,[Use iconv.])
@@ -194,10 +242,45 @@ LIBS="$fontconfig_save_libs"
#
# Check expat configuration
#
+AC_ARG_WITH(expat,
+ [AC_HELP_STRING([--with-expat=DIR],
+ [Use Expat in DIR])],
+ [expat_prefix=$withval],
+ [expat_prefix=auto])
+AC_ARG_WITH(expat-includes,
+ [AC_HELP_STRING([--with-expat-includes=DIR],
+ [Use Expat includes in DIR])],
+ [expat_includes=$withval],
+ [expat_includes=auto])
+AC_ARG_WITH(expat-lib,
+ [AC_HELP_STRING([--with-expat-lib=DIR])],
+ [expat_lib=$withval],
+ [expat_lib=auto])
+
if test "$enable_libxml2" != "yes"; then
- # specify EXPAT_CFLAGS and/or EXPAT_LIBS if you like the old behavior
- # with --with-expat-includes and --with-expat-lib.
- PKG_CHECK_MODULES(EXPAT, expat)
+ use_pkgconfig_for_expat=yes
+ if test "$expat_prefix" = "auto" -a "$expat_includes" = "auto" -a "$expat_lib" = "auto"; then
+ PKG_CHECK_MODULES(EXPAT, expat,,use_pkgconfig_for_expat=no)
+ else
+ use_pkgconfig_for_expat=no
+ fi
+ if test "x$use_pkgconfig_for_expat" = "xno"; then
+ if test "$expat_includes" != "auto" -a -r ${expat_includes}/expat.h; then
+ EXPAT_CFLAGS="-I${expat_includes}"
+ elif test "$expat_prefix" != "auto" -a -r ${expat_prefix}/include/expat.h; then
+ EXPAT_CFLAGS="-I${expat_prefix}/include"
+ else
+ EXPAT_CFLAGS=""
+ fi
+ if test "$expat_lib" != "auto"; then
+ EXPAT_LIBS="-L${expat_lib} -lexpat"
+ elif test "$expat_prefix" != "auto"; then
+ EXPAT_LIBS="-L${expat_prefix}/lib -lexpat"
+ else
+ EXPAT_LIBS="-lexpat"
+ fi
+ fi
+
expatsaved_CPPFLAGS="$CPPFLAGS"
expatsaved_LIBS="$LIBS"
CPPFLAGS="$CPPFLAGS $EXPAT_CFLAGS"