| 1 |
dnl |
| 2 |
dnl "$Id: configure.in 427 2011-01-03 02:03:29Z mike $" |
| 3 |
dnl |
| 4 |
dnl Configuration script for Mini-XML, a small XML-like file parsing library. |
| 5 |
dnl |
| 6 |
dnl Copyright 2003-2011 by Michael R Sweet. |
| 7 |
dnl |
| 8 |
dnl These coded instructions, statements, and computer programs are the |
| 9 |
dnl property of Michael R Sweet and are protected by Federal copyright |
| 10 |
dnl law. Distribution and use rights are outlined in the file "COPYING" |
| 11 |
dnl which should have been included with this file. If this file is |
| 12 |
dnl missing or damaged, see the license at: |
| 13 |
dnl |
| 14 |
dnl http://www.minixml.org/ |
| 15 |
dnl |
| 16 |
|
| 17 |
dnl Specify a source file from the distribution... |
| 18 |
AC_INIT(mxml.h) |
| 19 |
|
| 20 |
dnl Set the name of the config header file... |
| 21 |
AC_CONFIG_HEADER(config.h) |
| 22 |
|
| 23 |
dnl Version number... |
| 24 |
VERSION=2.7 |
| 25 |
AC_SUBST(VERSION) |
| 26 |
AC_DEFINE_UNQUOTED(MXML_VERSION, "Mini-XML v$VERSION") |
| 27 |
|
| 28 |
dnl Clear default debugging options and set normal optimization by |
| 29 |
dnl default unless the user asks for debugging specifically. |
| 30 |
CFLAGS="${CFLAGS:=}" |
| 31 |
CXXFLAGS="${CXXFLAGS:=}" |
| 32 |
LDFLAGS="${LDFLAGS:=}" |
| 33 |
AC_SUBST(LDFLAGS) |
| 34 |
OPTIM="" |
| 35 |
AC_SUBST(OPTIM) |
| 36 |
|
| 37 |
AC_ARG_WITH(ansi, [ --with-ansi set full ANSI C mode, default=no], |
| 38 |
use_ansi="$withval", |
| 39 |
use_ansi="no") |
| 40 |
|
| 41 |
AC_ARG_WITH(archflags, [ --with-archflags set additional architecture flags, default=none], |
| 42 |
ARCHFLAGS="$withval", |
| 43 |
ARCHFLAGS="") |
| 44 |
AC_SUBST(ARCHFLAGS) |
| 45 |
|
| 46 |
AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging, default=no], |
| 47 |
if eval "test x$enable_debug = xyes"; then |
| 48 |
OPTIM="-g" |
| 49 |
fi) |
| 50 |
|
| 51 |
AC_ARG_WITH(docdir, [ --with-docdir set directory for documentation, default=${prefix}/share/doc/mxml], |
| 52 |
docdir="$withval", |
| 53 |
docdir="NONE") |
| 54 |
|
| 55 |
AC_SUBST(docdir) |
| 56 |
|
| 57 |
AC_ARG_WITH(vsnprintf, [ --with-vsnprintf use vsnprintf emulation functions, default=auto], |
| 58 |
use_vsnprintf="$withval", |
| 59 |
use_vsnprintf="no") |
| 60 |
|
| 61 |
dnl Get the operating system and version number... |
| 62 |
uname=`uname` |
| 63 |
uversion=`uname -r | sed -e '1,$s/[[^0-9]]//g'` |
| 64 |
if test x$uname = xIRIX64; then |
| 65 |
uname="IRIX" |
| 66 |
fi |
| 67 |
|
| 68 |
dnl Checks for programs... |
| 69 |
AC_PROG_CC |
| 70 |
AC_PROG_CXX |
| 71 |
AC_PROG_INSTALL |
| 72 |
if test "$INSTALL" = "$ac_install_sh"; then |
| 73 |
# Use full path to install-sh script... |
| 74 |
INSTALL="`pwd`/install-sh -c" |
| 75 |
fi |
| 76 |
AC_PROG_RANLIB |
| 77 |
AC_PATH_PROG(AR,ar) |
| 78 |
AC_PATH_PROG(CP,cp) |
| 79 |
AC_PATH_PROG(LN,ln) |
| 80 |
AC_PATH_PROG(MKDIR,mkdir) |
| 81 |
AC_PATH_PROG(RM,rm) |
| 82 |
|
| 83 |
dnl Flags for "ar" command... |
| 84 |
case "$uname" in |
| 85 |
Darwin* | *BSD*) |
| 86 |
ARFLAGS="-rcv" |
| 87 |
;; |
| 88 |
*) |
| 89 |
ARFLAGS="crvs" |
| 90 |
;; |
| 91 |
esac |
| 92 |
|
| 93 |
AC_SUBST(ARFLAGS) |
| 94 |
|
| 95 |
dnl Inline functions... |
| 96 |
AC_C_INLINE |
| 97 |
|
| 98 |
dnl Checks for string functions. |
| 99 |
if test "x$use_ansi" != xyes; then |
| 100 |
AC_CHECK_FUNCS(strdup) |
| 101 |
fi |
| 102 |
|
| 103 |
if test "x$use_vsnprintf" != xyes; then |
| 104 |
AC_CHECK_FUNCS(snprintf vsnprintf) |
| 105 |
fi |
| 106 |
|
| 107 |
dnl Check for "long long" support... |
| 108 |
AC_CACHE_CHECK(for long long int, ac_cv_c_long_long, |
| 109 |
[if test "$GCC" = yes; then |
| 110 |
ac_cv_c_long_long=yes |
| 111 |
else |
| 112 |
AC_TRY_COMPILE(,[long long int i;], |
| 113 |
ac_cv_c_long_long=yes, |
| 114 |
ac_cv_c_long_long=no) |
| 115 |
fi]) |
| 116 |
|
| 117 |
if test $ac_cv_c_long_long = yes; then |
| 118 |
AC_DEFINE(HAVE_LONG_LONG) |
| 119 |
fi |
| 120 |
|
| 121 |
dnl Threading support |
| 122 |
AC_ARG_ENABLE(threads, [ --enable-threads enable multi-threading support]) |
| 123 |
|
| 124 |
have_pthread=no |
| 125 |
PTHREAD_FLAGS="" |
| 126 |
PTHREAD_LIBS="" |
| 127 |
|
| 128 |
if test "x$enable_threads" != xno; then |
| 129 |
AC_CHECK_HEADER(pthread.h, AC_DEFINE(HAVE_PTHREAD_H)) |
| 130 |
|
| 131 |
if test x$ac_cv_header_pthread_h = xyes; then |
| 132 |
dnl Check various threading options for the platforms we support |
| 133 |
for flag in -lpthreads -lpthread -pthread; do |
| 134 |
AC_MSG_CHECKING([for pthread_create using $flag]) |
| 135 |
SAVELIBS="$LIBS" |
| 136 |
LIBS="$flag $LIBS" |
| 137 |
AC_TRY_LINK([#include <pthread.h>], |
| 138 |
[pthread_create(0, 0, 0, 0);], |
| 139 |
have_pthread=yes) |
| 140 |
AC_MSG_RESULT([$have_pthread]) |
| 141 |
LIBS="$SAVELIBS" |
| 142 |
|
| 143 |
if test $have_pthread = yes; then |
| 144 |
PTHREAD_FLAGS="-D_THREAD_SAFE -D_REENTRANT" |
| 145 |
PTHREAD_LIBS="$flag" |
| 146 |
|
| 147 |
# Solaris requires -D_POSIX_PTHREAD_SEMANTICS to |
| 148 |
# be POSIX-compliant... :( |
| 149 |
if test $uname = SunOS; then |
| 150 |
PTHREAD_FLAGS="$PTHREAD_FLAGS -D_POSIX_PTHREAD_SEMANTICS" |
| 151 |
fi |
| 152 |
break |
| 153 |
fi |
| 154 |
done |
| 155 |
fi |
| 156 |
fi |
| 157 |
|
| 158 |
AC_SUBST(PTHREAD_FLAGS) |
| 159 |
AC_SUBST(PTHREAD_LIBS) |
| 160 |
|
| 161 |
dnl Shared library support... |
| 162 |
DSO="${DSO:=:}" |
| 163 |
DSOFLAGS="${DSOFLAGS:=}" |
| 164 |
|
| 165 |
AC_ARG_ENABLE(shared, [ --enable-shared turn on shared libraries, default=no]) |
| 166 |
|
| 167 |
if test x$enable_shared != xno; then |
| 168 |
AC_MSG_CHECKING(for shared library support) |
| 169 |
PICFLAG=1 |
| 170 |
|
| 171 |
case "$uname" in |
| 172 |
SunOS* | UNIX_S*) |
| 173 |
AC_MSG_RESULT(yes) |
| 174 |
LIBMXML="libmxml.so.1.5" |
| 175 |
DSO="\$(CC)" |
| 176 |
DSOFLAGS="$DSOFLAGS -Wl,-h,libmxml.so.1 -G -R\$(libdir) \$(OPTIM)" |
| 177 |
LDFLAGS="$LDFLAGS -R\$(libdir)" |
| 178 |
;; |
| 179 |
|
| 180 |
HP-UX*) |
| 181 |
AC_MSG_RESULT(yes) |
| 182 |
LIBMXML="libmxml.sl.1" |
| 183 |
DSO="ld" |
| 184 |
DSOFLAGS="$DSOFLAGS -b -z +h libmxml.sl.1 +s +b \$(libdir)" |
| 185 |
LDFLAGS="$LDFLAGS -Wl,+s,+b,\$(libdir)" |
| 186 |
;; |
| 187 |
|
| 188 |
IRIX) |
| 189 |
AC_MSG_RESULT(yes) |
| 190 |
LIBMXML="libmxml.so.1.5" |
| 191 |
DSO="\$(CC)" |
| 192 |
DSOFLAGS="$DSOFLAGS -Wl,-rpath,\$(libdir),-set_version,sgi1.0,-soname,libmxml.so.1 -shared \$(OPTIM)" |
| 193 |
;; |
| 194 |
|
| 195 |
OSF1* | Linux | GNU) |
| 196 |
AC_MSG_RESULT(yes) |
| 197 |
LIBMXML="libmxml.so.1.5" |
| 198 |
DSO="\$(CC)" |
| 199 |
DSOFLAGS="$DSOFLAGS -Wl,-soname,libmxml.so.1,-rpath,\$(libdir) -shared \$(OPTIM)" |
| 200 |
LDFLAGS="$LDFLAGS -Wl,-rpath,\$(libdir)" |
| 201 |
;; |
| 202 |
|
| 203 |
*BSD*) |
| 204 |
AC_MSG_RESULT(yes) |
| 205 |
LIBMXML="libmxml.so.1.5" |
| 206 |
DSO="\$(CC)" |
| 207 |
DSOFLAGS="$DSOFLAGS -Wl,-soname,libmxml.so.1,-R\$(libdir) -shared \$(OPTIM)" |
| 208 |
LDFLAGS="$LDFLAGS -Wl,-R\$(libdir)" |
| 209 |
;; |
| 210 |
|
| 211 |
Darwin*) |
| 212 |
AC_MSG_RESULT(yes) |
| 213 |
LIBMXML="libmxml.1.dylib" |
| 214 |
DSO="\$(CC)" |
| 215 |
DSOFLAGS="$DSOFLAGS \$(RC_CFLAGS) -dynamiclib -lc" |
| 216 |
;; |
| 217 |
|
| 218 |
*) |
| 219 |
AC_MSG_RESULT(no) |
| 220 |
AC_MSG_WARN(shared libraries not supported on this platform.) |
| 221 |
PICFLAG=0 |
| 222 |
LIBMXML="libmxml.a" |
| 223 |
;; |
| 224 |
esac |
| 225 |
else |
| 226 |
PICFLAG=0 |
| 227 |
LIBMXML="libmxml.a" |
| 228 |
fi |
| 229 |
|
| 230 |
AC_SUBST(DSO) |
| 231 |
AC_SUBST(DSOFLAGS) |
| 232 |
AC_SUBST(LIBMXML) |
| 233 |
AC_SUBST(PICFLAG) |
| 234 |
|
| 235 |
dnl Add -Wall for GCC... |
| 236 |
if test -n "$GCC"; then |
| 237 |
CFLAGS="-Wall $CFLAGS" |
| 238 |
|
| 239 |
if test "x$OPTIM" = x; then |
| 240 |
OPTIM="-Os -g" |
| 241 |
fi |
| 242 |
|
| 243 |
if test "x$use_ansi" = xyes; then |
| 244 |
CFLAGS="-ansi -pedantic $CFLAGS" |
| 245 |
fi |
| 246 |
|
| 247 |
if test $PICFLAG = 1 -a $uname != AIX; then |
| 248 |
OPTIM="-fPIC $OPTIM" |
| 249 |
fi |
| 250 |
else |
| 251 |
case $uname in |
| 252 |
HP-UX*) |
| 253 |
CFLAGS="-Ae $CFLAGS" |
| 254 |
|
| 255 |
if test "x$OPTIM" = x; then |
| 256 |
OPTIM="-O" |
| 257 |
fi |
| 258 |
|
| 259 |
OPTIM="+DAportable $OPTIM" |
| 260 |
|
| 261 |
if test $PICFLAG = 1; then |
| 262 |
OPTIM="+z $OPTIM" |
| 263 |
fi |
| 264 |
;; |
| 265 |
|
| 266 |
UNIX_SVR* | SunOS*) |
| 267 |
if test "x$OPTIM" = x; then |
| 268 |
OPTIM="-O" |
| 269 |
fi |
| 270 |
|
| 271 |
if test $PICFLAG = 1; then |
| 272 |
OPTIM="-KPIC $OPTIM" |
| 273 |
fi |
| 274 |
;; |
| 275 |
|
| 276 |
*) |
| 277 |
if test "x$OPTIM" = x; then |
| 278 |
OPTIM="-O" |
| 279 |
fi |
| 280 |
;; |
| 281 |
esac |
| 282 |
fi |
| 283 |
|
| 284 |
dnl Fix "prefix" variable if it hasn't been specified... |
| 285 |
if test "$prefix" = "NONE"; then |
| 286 |
prefix="/usr/local" |
| 287 |
fi |
| 288 |
|
| 289 |
dnl Fix "exec_prefix" variable if it hasn't been specified... |
| 290 |
if test "$exec_prefix" = "NONE"; then |
| 291 |
exec_prefix="$prefix" |
| 292 |
fi |
| 293 |
|
| 294 |
dnl Fix "docdir" variable if it hasn't been specified... |
| 295 |
if test "$docdir" = "NONE"; then |
| 296 |
docdir="$datadir/doc/mxml" |
| 297 |
fi |
| 298 |
|
| 299 |
dnl Fix "mandir" variable if it hasn't been specified... |
| 300 |
if test "$mandir" = "\${prefix}/man" -a "$prefix" = "/usr"; then |
| 301 |
case "$uname" in |
| 302 |
*BSD* | Darwin* | Linux*) |
| 303 |
# BSD, Darwin (MacOS X), and Linux |
| 304 |
mandir="/usr/share/man" |
| 305 |
;; |
| 306 |
IRIX*) |
| 307 |
# SGI IRIX |
| 308 |
mandir="/usr/share/catman/u_man" |
| 309 |
;; |
| 310 |
*) |
| 311 |
# All others |
| 312 |
mandir="/usr/man" |
| 313 |
;; |
| 314 |
esac |
| 315 |
fi |
| 316 |
|
| 317 |
dnl pkg-config stuff... |
| 318 |
if test "$includedir" != /usr/include; then |
| 319 |
PC_CFLAGS="-I$includedir" |
| 320 |
else |
| 321 |
PC_CFLAGS="" |
| 322 |
fi |
| 323 |
|
| 324 |
if test "$libdir" != /usr/lib; then |
| 325 |
PC_LIBS="-L$libdir -lmxml" |
| 326 |
else |
| 327 |
PC_LIBS="-lmxml" |
| 328 |
fi |
| 329 |
|
| 330 |
AC_SUBST(PC_CFLAGS) |
| 331 |
AC_SUBST(PC_LIBS) |
| 332 |
|
| 333 |
dnl Output the makefile, etc... |
| 334 |
AC_OUTPUT(Makefile mxml.list mxml.pc) |
| 335 |
|
| 336 |
dnl |
| 337 |
dnl End of "$Id: configure.in 427 2011-01-03 02:03:29Z mike $". |
| 338 |
dnl |