From bb02899d9ff9813738809fb5349a9f3ae2dba76f Mon Sep 17 00:00:00 2001 From: Akira TAGOH Date: Mon, 2 Apr 2012 15:38:27 +0900 Subject: [PATCH] Use pkgconfig to check builddeps --- configure.in | 162 ++++++++++----------------------------------------- 1 file changed, 30 insertions(+), 132 deletions(-) diff --git a/configure.in b/configure.in index 55b0d85..7637c02 100644 --- a/configure.in +++ b/configure.in @@ -63,6 +63,7 @@ AC_PROG_LN_S AC_LIBTOOL_WIN32_DLL AM_PROG_LIBTOOL AC_PROG_MAKE_SET +PKG_PROG_PKG_CONFIG AC_MSG_CHECKING([for RM macro]) _predefined_rm=`make -p -f /dev/null 2>/dev/null|grep '^RM ='|sed -e 's/^RM = //'` @@ -170,24 +171,7 @@ AC_DEFINE_UNQUOTED(USE_ICONV,$use_iconv,[Use iconv.]) # # Checks for FreeType # - -AC_ARG_WITH(freetype-config, - [AC_HELP_STRING([--with-freetype-config=PROG], - [Use FreeType configuration program PROG])], - freetype_config=$withval, - freetype_config=yes) - -if test "$freetype_config" = "yes"; then - AC_PATH_PROG(ft_config,freetype-config,no) - if test "$ft_config" = "no"; then - AC_MSG_ERROR([You must have freetype installed; see http://www.freetype.org/]) - fi -else - ft_config="$freetype_config" -fi - -FREETYPE_CFLAGS="`$ft_config --cflags`" -FREETYPE_LIBS="`$ft_config --libs`" +PKG_CHECK_MODULES(FREETYPE, freetype2) AC_SUBST(FREETYPE_LIBS) AC_SUBST(FREETYPE_CFLAGS) @@ -210,134 +194,48 @@ LIBS="$fontconfig_save_libs" # # Check expat configuration # - -AC_ARG_WITH(expat, - [AC_HELP_STRING([--with-expat=DIR], - [Use Expat in DIR])], - expat=$withval, expat=yes) -AC_ARG_WITH(expat-includes, - [AC_HELP_STRING([--with-expat-includes=DIR], - [Use Expat includes in DIR])], - expat_includes=$withval, expat_includes=yes) -AC_ARG_WITH(expat-lib, - [AC_HELP_STRING([--with-expat-lib=DIR], - [Use Expat library in DIR])], - expat_lib=$withval, expat_lib=yes) - if test "$enable_libxml2" != "yes"; then - case "$expat" in - no) - ;; - *) - case "$expat_includes" in - yes) - case "$expat" in - yes) - ;; - *) - EXPAT_CFLAGS="-I$expat/include" - ;; - esac - ;; - no) - EXPAT_CFLAGS="" - ;; - *) - EXPAT_CFLAGS="-I$expat_includes" - ;; - esac - case "$expat_lib" in - yes) - case "$expat" in - yes) - EXPAT_LIBS="-lexpat" - ;; - *) - EXPAT_LIBS="-L$expat/lib -lexpat" - ;; - esac - ;; - no) - ;; - *) - EXPAT_LIBS="-L$expat_lib -lexpat" - ;; - esac + # 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) + expatsaved_CPPFLAGS="$CPPFLAGS" + expatsaved_LIBS="$LIBS" + CPPFLAGS="$CPPFLAGS $EXPAT_CFLAGS" + LIBS="$LIBS $EXPAT_LIBS" - expatsaved_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $EXPAT_CFLAGS" - expatsaved_LIBS="$LIBS" - LIBS="$LIBS $EXPAT_LIBS" - - AC_CHECK_HEADER(expat.h) - case "$ac_cv_header_expat_h" in - no) - AC_CHECK_HEADER(xmlparse.h) - case "$ac_cv_header_xmlparse_h" in - no) - have_expat_header=no; - ;; - yes) - HAVE_XMLPARSE_H=1 - AC_SUBST(HAVE_XMLPARSE_H) - AC_DEFINE_UNQUOTED(HAVE_XMLPARSE_H,$HAVE_XMLPARSE_H, + AC_CHECK_HEADER(expat.h) + if test "$ac_cv_header_expat_h" = "no"; then + AC_CHECK_HEADER(xmlparse.h) + if test "$ac_cv_header_xmlparse_h" = "yes"; then + HAVE_XMLPARSE_H=1 + AC_SUBST(HAVE_XMLPARSE_H) + AC_DEFINE_UNQUOTED(HAVE_XMLPARSE_H,$HAVE_XMLPARSE_H, [Use xmlparse.h instead of expat.h]) - have_expat_header=yes - ;; - esac - ;; - yes) - have_expat_header=yes - ;; - esac - case "$have_expat_header" in - no) - expat=no - ;; - yes) - AC_CHECK_FUNCS(XML_SetDoctypeDeclHandler) - case "$ac_cv_func_XML_SetDoctypeDeclHandler" in - yes) - HAVE_EXPAT=1 - AC_SUBST(HAVE_EXPAT) - AC_DEFINE_UNQUOTED(HAVE_EXPAT,$HAVE_EXPAT, - [Found a useable expat library]) - ;; - *) - expat=no - ;; - esac - ;; - esac - CPPFLAGS="$expatsaved_CPPFLAGS" - LIBS="$expatsaved_LIBS" - ;; - esac - + else + AC_MSG_ERROR([ +*** expat is required. or try to use --enable-libxml2]) + fi + fi + AC_CHECK_FUNCS(XML_SetDoctypeDeclHandler) + if test "$ac_cv_func_XML_SetDoctypeDeclHandler" = "no"; then + AC_MSG_ERROR([ +*** expat is required. or try to use --enable-libxml2]) + fi + CPPFLAGS="$expatsaved_CPPFLAGS" + LIBS="$expatsaved_LIBS" + AC_SUBST(EXPAT_CFLAGS) AC_SUBST(EXPAT_LIBS) - - case "$expat" in - no) - EXPAT_CFLAGS="" - EXPAT_LIBS="" - - AC_MSG_WARN([Cannot find usable expat library. Trying to use libxml2 as fallback.]) - ;; - esac fi # # Check libxml2 configuration # - AC_ARG_ENABLE(libxml2, [AC_HELP_STRING([--enable-libxml2], [Use libxml2 instead of Expat])]) -PKG_PROG_PKG_CONFIG - -if test "$enable_libxml2" = "yes" -o "$expat" = "no"; then +if test "$enable_libxml2" = "yes"; then PKG_CHECK_MODULES([LIBXML2], [libxml-2.0 >= 2.6]) AC_DEFINE_UNQUOTED(ENABLE_LIBXML2,1,[Use libxml2 instead of Expat])