[xml] XML autoconf magic

Date view Thread view Subject view Author view

From: David Helder (dhelder@umich.edu)
Date: Wed Mar 22 2000 - 14:39:01 EST


FYI, this is what I'm using. Maybe someone else will find it useful.

David

# Need libxml
AC_PATH_PROG(XML_CONFIG, xml-config, no)
AC_MSG_CHECKING(for libxml)
if test "$XML_CONFIG" = "no" ; then
  AC_MSG_RESULT(no)
  echo "*** Could not find libxml. Check out the libxml homepage at "
  echo "*** http://rufus.w3.org/veillard/XML/xml.html or just get "
  echo "*** the appropriate package for your system. If you have Debian,
"
  echo "*** get libxml-dev"
  AC_MSG_ERROR([libxml needed])
else
  AC_MSG_RESULT(yes)

  # Check for proper version
  AC_MSG_CHECKING(for version 1.8.2 (or better) of libxml)

  # Check if old or new style xml-config
  libxml_version=`$XML_CONFIG --version`
  libxml_version=`echo $libxml_version | sed 's/ //'`
  if test `expr $libxml_version : libxml` != 0; then

    xml_config_major_version=`$XML_CONFIG --version | \
      sed 's/libxml \([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
    xml_config_minor_version=`$XML_CONFIG --version | \
      sed 's/libxml \([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
    xml_config_micro_version=`$XML_CONFIG --version | \
      sed 's/libxml \([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`

  else

    xml_config_major_version=`$XML_CONFIG --version | \
      sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
    xml_config_minor_version=`$XML_CONFIG --version | \
      sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
    xml_config_micro_version=`$XML_CONFIG --version | \
      sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`

  fi

  # Check if version is good
  if test \( $xml_config_major_version -ne 1 \) -o \
          \( $xml_config_minor_version -ne 8 \) -o \
          \( $xml_config_micro_version -lt 2 \) ; then

     AC_MSG_RESULT(no)
     echo "*** You need libxml 1.8.2 or greater. Check out the libxml "
     echo "*** homepage at http://rufus.w3.org/veillard/XML/xml.html or
just get "
     echo "*** the appropriate package for your system. If you have
Debian, "
     echo "*** get the latest libxml-dev"
     AC_MSG_ERROR([libxml 1.8.2 or greater needed])

  else
     AC_MSG_RESULT(yes)
  fi

  XML_LIBS=`$XML_CONFIG --libs`
  XML_CFLAGS=`$XML_CONFIG --cflags`
  LIBS="$LIBS $XML_LIBS"
  CFLAGS="$CFLAGS $XML_CFLAGS"
fi

-- 
      __          _    __ 
  ___/ /__ __  __(_)__/ /  David Helder - University of Michigan
 / _  / _ `/ |/ / / _  /   dhelder@umich.edu
 |_,_/|_,_/|___/_/|_,_/    http://www.eecs.umich.edu/~dhelder

---- Message from the list xml@xmlsoft.org Archived at : http://xmlsoft.org/messages/ to unsubscribe: echo "unsubscribe xml" | mail majordomo@xmlsoft.org


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Wed Aug 02 2000 - 12:30:08 EDT