2003-06-03 19:46:29 +00:00
|
|
|
dnl
|
2005-01-29 07:19:38 +00:00
|
|
|
dnl "$Id$"
|
2003-06-03 19:46:29 +00:00
|
|
|
dnl
|
2004-05-02 16:04:40 +00:00
|
|
|
dnl Configuration script for Mini-XML, a small XML-like file parsing library.
|
2003-06-03 19:46:29 +00:00
|
|
|
dnl
|
2016-06-11 20:51:49 +00:00
|
|
|
dnl Copyright 2003-2016 by Michael R Sweet.
|
2003-06-03 19:46:29 +00:00
|
|
|
dnl
|
2010-09-19 05:26:46 +00:00
|
|
|
dnl These coded instructions, statements, and computer programs are the
|
|
|
|
dnl property of Michael R Sweet and are protected by Federal copyright
|
|
|
|
dnl law. Distribution and use rights are outlined in the file "COPYING"
|
|
|
|
dnl which should have been included with this file. If this file is
|
|
|
|
dnl missing or damaged, see the license at:
|
2003-06-03 19:46:29 +00:00
|
|
|
dnl
|
2014-01-05 03:12:18 +00:00
|
|
|
dnl http://www.msweet.org/projects.php/Mini-XML
|
2003-06-03 19:46:29 +00:00
|
|
|
dnl
|
|
|
|
|
2016-06-11 20:51:49 +00:00
|
|
|
dnl Package name and version...
|
|
|
|
AC_INIT([Mini-XML], [2.10], [http://www.msweet.org/bugs.php/Mini-XML], [mxml], [http://www.msweet.org/projects.php/Mini-XML])
|
2003-06-15 00:44:34 +00:00
|
|
|
|
2003-07-20 13:41:17 +00:00
|
|
|
dnl Set the name of the config header file...
|
|
|
|
AC_CONFIG_HEADER(config.h)
|
|
|
|
|
2004-05-02 22:02:36 +00:00
|
|
|
dnl Version number...
|
2016-06-11 20:51:49 +00:00
|
|
|
VERSION="AC_PACKAGE_VERSION"
|
2004-05-02 22:02:36 +00:00
|
|
|
AC_SUBST(VERSION)
|
|
|
|
AC_DEFINE_UNQUOTED(MXML_VERSION, "Mini-XML v$VERSION")
|
|
|
|
|
2003-06-15 00:44:34 +00:00
|
|
|
dnl Clear default debugging options and set normal optimization by
|
|
|
|
dnl default unless the user asks for debugging specifically.
|
|
|
|
CFLAGS="${CFLAGS:=}"
|
|
|
|
CXXFLAGS="${CXXFLAGS:=}"
|
|
|
|
LDFLAGS="${LDFLAGS:=}"
|
|
|
|
AC_SUBST(LDFLAGS)
|
2005-10-13 18:27:00 +00:00
|
|
|
OPTIM=""
|
2003-06-15 00:44:34 +00:00
|
|
|
AC_SUBST(OPTIM)
|
|
|
|
|
2003-07-27 23:11:40 +00:00
|
|
|
AC_ARG_WITH(ansi, [ --with-ansi set full ANSI C mode, default=no],
|
|
|
|
use_ansi="$withval",
|
|
|
|
use_ansi="no")
|
|
|
|
|
2007-07-20 23:52:25 +00:00
|
|
|
AC_ARG_WITH(archflags, [ --with-archflags set additional architecture flags, default=none],
|
|
|
|
ARCHFLAGS="$withval",
|
|
|
|
ARCHFLAGS="")
|
|
|
|
AC_SUBST(ARCHFLAGS)
|
|
|
|
|
2003-07-27 23:11:40 +00:00
|
|
|
AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging, default=no],
|
2003-06-15 00:44:34 +00:00
|
|
|
if eval "test x$enable_debug = xyes"; then
|
|
|
|
OPTIM="-g"
|
|
|
|
fi)
|
|
|
|
|
2003-07-27 23:11:40 +00:00
|
|
|
AC_ARG_WITH(docdir, [ --with-docdir set directory for documentation, default=${prefix}/share/doc/mxml],
|
2003-06-15 00:44:34 +00:00
|
|
|
docdir="$withval",
|
|
|
|
docdir="NONE")
|
|
|
|
|
|
|
|
AC_SUBST(docdir)
|
2003-06-03 19:46:29 +00:00
|
|
|
|
2003-09-28 12:44:39 +00:00
|
|
|
AC_ARG_WITH(vsnprintf, [ --with-vsnprintf use vsnprintf emulation functions, default=auto],
|
|
|
|
use_vsnprintf="$withval",
|
|
|
|
use_vsnprintf="no")
|
|
|
|
|
2003-07-20 13:41:17 +00:00
|
|
|
dnl Get the operating system and version number...
|
|
|
|
uname=`uname`
|
|
|
|
uversion=`uname -r | sed -e '1,$s/[[^0-9]]//g'`
|
|
|
|
if test x$uname = xIRIX64; then
|
|
|
|
uname="IRIX"
|
|
|
|
fi
|
|
|
|
|
2003-06-03 19:46:29 +00:00
|
|
|
dnl Checks for programs...
|
|
|
|
AC_PROG_CC
|
|
|
|
AC_PROG_CXX
|
2005-04-24 23:23:59 +00:00
|
|
|
AC_PROG_INSTALL
|
|
|
|
if test "$INSTALL" = "$ac_install_sh"; then
|
|
|
|
# Use full path to install-sh script...
|
|
|
|
INSTALL="`pwd`/install-sh -c"
|
|
|
|
fi
|
2003-06-03 19:46:29 +00:00
|
|
|
AC_PROG_RANLIB
|
2003-06-15 00:44:34 +00:00
|
|
|
AC_PATH_PROG(AR,ar)
|
|
|
|
AC_PATH_PROG(CP,cp)
|
2005-02-26 03:10:23 +00:00
|
|
|
AC_PATH_PROG(LN,ln)
|
2003-06-15 00:44:34 +00:00
|
|
|
AC_PATH_PROG(MKDIR,mkdir)
|
|
|
|
AC_PATH_PROG(RM,rm)
|
2003-06-03 19:46:29 +00:00
|
|
|
|
|
|
|
dnl Flags for "ar" command...
|
2003-07-20 13:41:17 +00:00
|
|
|
case "$uname" in
|
2003-06-03 19:46:29 +00:00
|
|
|
Darwin* | *BSD*)
|
|
|
|
ARFLAGS="-rcv"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
ARFLAGS="crvs"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
AC_SUBST(ARFLAGS)
|
|
|
|
|
2007-09-09 07:27:08 +00:00
|
|
|
dnl Inline functions...
|
|
|
|
AC_C_INLINE
|
|
|
|
|
2003-07-20 13:41:17 +00:00
|
|
|
dnl Checks for string functions.
|
2003-07-27 23:11:40 +00:00
|
|
|
if test "x$use_ansi" != xyes; then
|
|
|
|
AC_CHECK_FUNCS(strdup)
|
|
|
|
fi
|
2003-07-20 13:41:17 +00:00
|
|
|
|
2003-09-28 12:44:39 +00:00
|
|
|
if test "x$use_vsnprintf" != xyes; then
|
2007-04-18 13:14:10 +00:00
|
|
|
AC_CHECK_FUNCS(snprintf vsnprintf)
|
2003-09-28 12:44:39 +00:00
|
|
|
fi
|
|
|
|
|
2009-04-18 17:05:52 +00:00
|
|
|
dnl Check for "long long" support...
|
|
|
|
AC_CACHE_CHECK(for long long int, ac_cv_c_long_long,
|
|
|
|
[if test "$GCC" = yes; then
|
|
|
|
ac_cv_c_long_long=yes
|
|
|
|
else
|
|
|
|
AC_TRY_COMPILE(,[long long int i;],
|
|
|
|
ac_cv_c_long_long=yes,
|
|
|
|
ac_cv_c_long_long=no)
|
|
|
|
fi])
|
|
|
|
|
|
|
|
if test $ac_cv_c_long_long = yes; then
|
|
|
|
AC_DEFINE(HAVE_LONG_LONG)
|
|
|
|
fi
|
|
|
|
|
2007-09-22 21:00:56 +00:00
|
|
|
dnl Threading support
|
|
|
|
AC_ARG_ENABLE(threads, [ --enable-threads enable multi-threading support])
|
|
|
|
|
|
|
|
have_pthread=no
|
|
|
|
PTHREAD_FLAGS=""
|
|
|
|
PTHREAD_LIBS=""
|
|
|
|
|
|
|
|
if test "x$enable_threads" != xno; then
|
|
|
|
AC_CHECK_HEADER(pthread.h, AC_DEFINE(HAVE_PTHREAD_H))
|
|
|
|
|
|
|
|
if test x$ac_cv_header_pthread_h = xyes; then
|
|
|
|
dnl Check various threading options for the platforms we support
|
|
|
|
for flag in -lpthreads -lpthread -pthread; do
|
|
|
|
AC_MSG_CHECKING([for pthread_create using $flag])
|
|
|
|
SAVELIBS="$LIBS"
|
|
|
|
LIBS="$flag $LIBS"
|
|
|
|
AC_TRY_LINK([#include <pthread.h>],
|
|
|
|
[pthread_create(0, 0, 0, 0);],
|
|
|
|
have_pthread=yes)
|
|
|
|
AC_MSG_RESULT([$have_pthread])
|
|
|
|
LIBS="$SAVELIBS"
|
|
|
|
|
|
|
|
if test $have_pthread = yes; then
|
|
|
|
PTHREAD_FLAGS="-D_THREAD_SAFE -D_REENTRANT"
|
|
|
|
PTHREAD_LIBS="$flag"
|
|
|
|
|
|
|
|
# Solaris requires -D_POSIX_PTHREAD_SEMANTICS to
|
|
|
|
# be POSIX-compliant... :(
|
|
|
|
if test $uname = SunOS; then
|
|
|
|
PTHREAD_FLAGS="$PTHREAD_FLAGS -D_POSIX_PTHREAD_SEMANTICS"
|
|
|
|
fi
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
AC_SUBST(PTHREAD_FLAGS)
|
|
|
|
AC_SUBST(PTHREAD_LIBS)
|
|
|
|
|
2005-02-26 03:10:23 +00:00
|
|
|
dnl Shared library support...
|
|
|
|
DSO="${DSO:=:}"
|
|
|
|
DSOFLAGS="${DSOFLAGS:=}"
|
|
|
|
|
|
|
|
AC_ARG_ENABLE(shared, [ --enable-shared turn on shared libraries, default=no])
|
|
|
|
|
2010-09-19 05:26:46 +00:00
|
|
|
if test x$enable_shared != xno; then
|
2005-02-26 03:10:23 +00:00
|
|
|
AC_MSG_CHECKING(for shared library support)
|
|
|
|
PICFLAG=1
|
|
|
|
|
|
|
|
case "$uname" in
|
|
|
|
SunOS* | UNIX_S*)
|
|
|
|
AC_MSG_RESULT(yes)
|
2011-01-03 02:03:29 +00:00
|
|
|
LIBMXML="libmxml.so.1.5"
|
2005-02-26 03:10:23 +00:00
|
|
|
DSO="\$(CC)"
|
|
|
|
DSOFLAGS="$DSOFLAGS -Wl,-h,libmxml.so.1 -G -R\$(libdir) \$(OPTIM)"
|
|
|
|
LDFLAGS="$LDFLAGS -R\$(libdir)"
|
|
|
|
;;
|
|
|
|
|
|
|
|
HP-UX*)
|
|
|
|
AC_MSG_RESULT(yes)
|
2007-09-15 20:03:15 +00:00
|
|
|
LIBMXML="libmxml.sl.1"
|
2005-02-26 03:10:23 +00:00
|
|
|
DSO="ld"
|
|
|
|
DSOFLAGS="$DSOFLAGS -b -z +h libmxml.sl.1 +s +b \$(libdir)"
|
|
|
|
LDFLAGS="$LDFLAGS -Wl,+s,+b,\$(libdir)"
|
|
|
|
;;
|
|
|
|
|
|
|
|
IRIX)
|
|
|
|
AC_MSG_RESULT(yes)
|
2011-01-03 02:03:29 +00:00
|
|
|
LIBMXML="libmxml.so.1.5"
|
2005-02-26 03:10:23 +00:00
|
|
|
DSO="\$(CC)"
|
|
|
|
DSOFLAGS="$DSOFLAGS -Wl,-rpath,\$(libdir),-set_version,sgi1.0,-soname,libmxml.so.1 -shared \$(OPTIM)"
|
|
|
|
;;
|
|
|
|
|
|
|
|
OSF1* | Linux | GNU)
|
|
|
|
AC_MSG_RESULT(yes)
|
2011-01-03 02:03:29 +00:00
|
|
|
LIBMXML="libmxml.so.1.5"
|
2005-02-26 03:10:23 +00:00
|
|
|
DSO="\$(CC)"
|
|
|
|
DSOFLAGS="$DSOFLAGS -Wl,-soname,libmxml.so.1,-rpath,\$(libdir) -shared \$(OPTIM)"
|
|
|
|
LDFLAGS="$LDFLAGS -Wl,-rpath,\$(libdir)"
|
|
|
|
;;
|
|
|
|
|
|
|
|
*BSD*)
|
|
|
|
AC_MSG_RESULT(yes)
|
2011-01-03 02:03:29 +00:00
|
|
|
LIBMXML="libmxml.so.1.5"
|
2005-02-26 03:10:23 +00:00
|
|
|
DSO="\$(CC)"
|
|
|
|
DSOFLAGS="$DSOFLAGS -Wl,-soname,libmxml.so.1,-R\$(libdir) -shared \$(OPTIM)"
|
|
|
|
LDFLAGS="$LDFLAGS -Wl,-R\$(libdir)"
|
|
|
|
;;
|
|
|
|
|
|
|
|
Darwin*)
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
LIBMXML="libmxml.1.dylib"
|
|
|
|
DSO="\$(CC)"
|
|
|
|
DSOFLAGS="$DSOFLAGS \$(RC_CFLAGS) -dynamiclib -lc"
|
|
|
|
;;
|
|
|
|
|
|
|
|
*)
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
AC_MSG_WARN(shared libraries not supported on this platform.)
|
|
|
|
PICFLAG=0
|
|
|
|
LIBMXML="libmxml.a"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
else
|
|
|
|
PICFLAG=0
|
|
|
|
LIBMXML="libmxml.a"
|
|
|
|
fi
|
|
|
|
|
|
|
|
AC_SUBST(DSO)
|
|
|
|
AC_SUBST(DSOFLAGS)
|
|
|
|
AC_SUBST(LIBMXML)
|
|
|
|
AC_SUBST(PICFLAG)
|
|
|
|
|
2003-06-04 00:30:04 +00:00
|
|
|
dnl Add -Wall for GCC...
|
|
|
|
if test -n "$GCC"; then
|
|
|
|
CFLAGS="-Wall $CFLAGS"
|
2003-07-27 23:11:40 +00:00
|
|
|
|
2005-10-13 18:27:00 +00:00
|
|
|
if test "x$OPTIM" = x; then
|
|
|
|
OPTIM="-Os -g"
|
|
|
|
fi
|
|
|
|
|
2003-07-27 23:11:40 +00:00
|
|
|
if test "x$use_ansi" = xyes; then
|
|
|
|
CFLAGS="-ansi -pedantic $CFLAGS"
|
|
|
|
fi
|
2005-02-26 03:10:23 +00:00
|
|
|
|
|
|
|
if test $PICFLAG = 1 -a $uname != AIX; then
|
|
|
|
OPTIM="-fPIC $OPTIM"
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
case $uname in
|
|
|
|
HP-UX*)
|
|
|
|
CFLAGS="-Ae $CFLAGS"
|
2005-10-13 18:27:00 +00:00
|
|
|
|
|
|
|
if test "x$OPTIM" = x; then
|
2006-07-25 19:11:31 +00:00
|
|
|
OPTIM="-O"
|
2005-10-13 18:27:00 +00:00
|
|
|
fi
|
|
|
|
|
2005-02-26 03:10:23 +00:00
|
|
|
OPTIM="+DAportable $OPTIM"
|
|
|
|
|
|
|
|
if test $PICFLAG = 1; then
|
|
|
|
OPTIM="+z $OPTIM"
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
|
|
|
|
UNIX_SVR* | SunOS*)
|
2005-10-13 18:27:00 +00:00
|
|
|
if test "x$OPTIM" = x; then
|
2006-07-25 19:11:31 +00:00
|
|
|
OPTIM="-O"
|
2005-10-13 18:27:00 +00:00
|
|
|
fi
|
|
|
|
|
2005-02-26 03:10:23 +00:00
|
|
|
if test $PICFLAG = 1; then
|
|
|
|
OPTIM="-KPIC $OPTIM"
|
|
|
|
fi
|
|
|
|
;;
|
2005-10-13 18:27:00 +00:00
|
|
|
|
|
|
|
*)
|
|
|
|
if test "x$OPTIM" = x; then
|
2006-07-25 19:11:31 +00:00
|
|
|
OPTIM="-O"
|
2005-10-13 18:27:00 +00:00
|
|
|
fi
|
|
|
|
;;
|
2005-02-26 03:10:23 +00:00
|
|
|
esac
|
2003-06-04 00:30:04 +00:00
|
|
|
fi
|
|
|
|
|
2003-06-15 00:44:34 +00:00
|
|
|
dnl Fix "prefix" variable if it hasn't been specified...
|
|
|
|
if test "$prefix" = "NONE"; then
|
|
|
|
prefix="/usr/local"
|
|
|
|
fi
|
|
|
|
|
|
|
|
dnl Fix "exec_prefix" variable if it hasn't been specified...
|
|
|
|
if test "$exec_prefix" = "NONE"; then
|
|
|
|
exec_prefix="$prefix"
|
|
|
|
fi
|
|
|
|
|
|
|
|
dnl Fix "docdir" variable if it hasn't been specified...
|
|
|
|
if test "$docdir" = "NONE"; then
|
|
|
|
docdir="$datadir/doc/mxml"
|
|
|
|
fi
|
|
|
|
|
|
|
|
dnl Fix "mandir" variable if it hasn't been specified...
|
|
|
|
if test "$mandir" = "\${prefix}/man" -a "$prefix" = "/usr"; then
|
2003-07-20 13:41:17 +00:00
|
|
|
case "$uname" in
|
2003-06-15 00:44:34 +00:00
|
|
|
*BSD* | Darwin* | Linux*)
|
|
|
|
# BSD, Darwin (MacOS X), and Linux
|
|
|
|
mandir="/usr/share/man"
|
|
|
|
;;
|
|
|
|
IRIX*)
|
|
|
|
# SGI IRIX
|
|
|
|
mandir="/usr/share/catman/u_man"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
# All others
|
|
|
|
mandir="/usr/man"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
2004-05-02 22:02:36 +00:00
|
|
|
dnl pkg-config stuff...
|
|
|
|
if test "$includedir" != /usr/include; then
|
|
|
|
PC_CFLAGS="-I$includedir"
|
|
|
|
else
|
|
|
|
PC_CFLAGS=""
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test "$libdir" != /usr/lib; then
|
|
|
|
PC_LIBS="-L$libdir -lmxml"
|
|
|
|
else
|
|
|
|
PC_LIBS="-lmxml"
|
|
|
|
fi
|
|
|
|
|
|
|
|
AC_SUBST(PC_CFLAGS)
|
|
|
|
AC_SUBST(PC_LIBS)
|
|
|
|
|
2003-06-15 00:44:34 +00:00
|
|
|
dnl Output the makefile, etc...
|
2004-05-02 16:04:40 +00:00
|
|
|
AC_OUTPUT(Makefile mxml.list mxml.pc)
|
2003-06-03 19:46:29 +00:00
|
|
|
|
|
|
|
dnl
|
2005-01-29 07:19:38 +00:00
|
|
|
dnl End of "$Id$".
|
2003-06-03 19:46:29 +00:00
|
|
|
dnl
|