Use pkgconfig to check builddeps

This commit is contained in:
Akira TAGOH 2012-04-02 15:38:27 +09:00
parent 87d7b82a98
commit bb02899d9f
1 changed files with 30 additions and 132 deletions

View File

@ -63,6 +63,7 @@ AC_PROG_LN_S
AC_LIBTOOL_WIN32_DLL AC_LIBTOOL_WIN32_DLL
AM_PROG_LIBTOOL AM_PROG_LIBTOOL
AC_PROG_MAKE_SET AC_PROG_MAKE_SET
PKG_PROG_PKG_CONFIG
AC_MSG_CHECKING([for RM macro]) AC_MSG_CHECKING([for RM macro])
_predefined_rm=`make -p -f /dev/null 2>/dev/null|grep '^RM ='|sed -e 's/^RM = //'` _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 # Checks for FreeType
# #
PKG_CHECK_MODULES(FREETYPE, freetype2)
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`"
AC_SUBST(FREETYPE_LIBS) AC_SUBST(FREETYPE_LIBS)
AC_SUBST(FREETYPE_CFLAGS) AC_SUBST(FREETYPE_CFLAGS)
@ -210,134 +194,48 @@ LIBS="$fontconfig_save_libs"
# #
# Check expat configuration # 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 if test "$enable_libxml2" != "yes"; then
case "$expat" in # specify EXPAT_CFLAGS and/or EXPAT_LIBS if you like the old behavior
no) # with --with-expat-includes and --with-expat-lib.
;; PKG_CHECK_MODULES(EXPAT, expat)
*) expatsaved_CPPFLAGS="$CPPFLAGS"
case "$expat_includes" in expatsaved_LIBS="$LIBS"
yes) CPPFLAGS="$CPPFLAGS $EXPAT_CFLAGS"
case "$expat" in LIBS="$LIBS $EXPAT_LIBS"
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
expatsaved_CPPFLAGS="$CPPFLAGS" AC_CHECK_HEADER(expat.h)
CPPFLAGS="$CPPFLAGS $EXPAT_CFLAGS" if test "$ac_cv_header_expat_h" = "no"; then
expatsaved_LIBS="$LIBS" AC_CHECK_HEADER(xmlparse.h)
LIBS="$LIBS $EXPAT_LIBS" if test "$ac_cv_header_xmlparse_h" = "yes"; then
HAVE_XMLPARSE_H=1
AC_CHECK_HEADER(expat.h) AC_SUBST(HAVE_XMLPARSE_H)
case "$ac_cv_header_expat_h" in AC_DEFINE_UNQUOTED(HAVE_XMLPARSE_H,$HAVE_XMLPARSE_H,
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,
[Use xmlparse.h instead of expat.h]) [Use xmlparse.h instead of expat.h])
have_expat_header=yes else
;; AC_MSG_ERROR([
esac *** expat is required. or try to use --enable-libxml2])
;; fi
yes) fi
have_expat_header=yes AC_CHECK_FUNCS(XML_SetDoctypeDeclHandler)
;; if test "$ac_cv_func_XML_SetDoctypeDeclHandler" = "no"; then
esac AC_MSG_ERROR([
case "$have_expat_header" in *** expat is required. or try to use --enable-libxml2])
no) fi
expat=no CPPFLAGS="$expatsaved_CPPFLAGS"
;; LIBS="$expatsaved_LIBS"
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
AC_SUBST(EXPAT_CFLAGS) AC_SUBST(EXPAT_CFLAGS)
AC_SUBST(EXPAT_LIBS) 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 fi
# #
# Check libxml2 configuration # Check libxml2 configuration
# #
AC_ARG_ENABLE(libxml2, AC_ARG_ENABLE(libxml2,
[AC_HELP_STRING([--enable-libxml2], [AC_HELP_STRING([--enable-libxml2],
[Use libxml2 instead of Expat])]) [Use libxml2 instead of Expat])])
PKG_PROG_PKG_CONFIG if test "$enable_libxml2" = "yes"; then
if test "$enable_libxml2" = "yes" -o "$expat" = "no"; then
PKG_CHECK_MODULES([LIBXML2], [libxml-2.0 >= 2.6]) PKG_CHECK_MODULES([LIBXML2], [libxml-2.0 >= 2.6])
AC_DEFINE_UNQUOTED(ENABLE_LIBXML2,1,[Use libxml2 instead of Expat]) AC_DEFINE_UNQUOTED(ENABLE_LIBXML2,1,[Use libxml2 instead of Expat])