Commit 2b94fdd0 authored by Michael Sweet's avatar Michael Sweet

Add (limited) cross-compilation support (Issue #188)

parent 8f4d8706
......@@ -16,6 +16,7 @@ libmxml.so.1
libmxml.so.1.5
mxml.list
mxml.pc
mxml.xml
mxmldoc
mxmldoc-static
org.minixml.atom
......
# Changes in Mini-XML 2.11
- The configure script now properly supports cross-compilation (Issue #188)
# Changes in Mini-XML 2.10
......
This diff is collapsed.
This diff is collapsed.
......@@ -657,6 +657,14 @@ ARCHFLAGS
OPTIM
LDFLAGS
VERSION
host_os
host_vendor
host_cpu
host
build_os
build_vendor
build_cpu
build
target_alias
host_alias
build_alias
......@@ -1314,6 +1322,10 @@ Fine tuning of the installation directories:
_ACEOF
cat <<\_ACEOF
System types:
--build=BUILD configure for building on BUILD [guessed]
--host=HOST cross-compile to build programs to run on HOST [BUILD]
_ACEOF
fi
......@@ -2174,6 +2186,110 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
ac_aux_dir=
for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
if test -f "$ac_dir/install-sh"; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/install-sh -c"
break
elif test -f "$ac_dir/install.sh"; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/install.sh -c"
break
elif test -f "$ac_dir/shtool"; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/shtool install -c"
break
fi
done
if test -z "$ac_aux_dir"; then
as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5
fi
# These three variables are undocumented and unsupported,
# and are intended to be withdrawn in a future Autoconf release.
# They can cause serious problems if a builder's source tree is in a directory
# whose full name contains unusual characters.
ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var.
ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var.
ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
# Make sure we can run config.sub.
$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
$as_echo_n "checking build system type... " >&6; }
if ${ac_cv_build+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_build_alias=$build_alias
test "x$ac_build_alias" = x &&
ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
test "x$ac_build_alias" = x &&
as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5
ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
$as_echo "$ac_cv_build" >&6; }
case $ac_cv_build in
*-*-*) ;;
*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;;
esac
build=$ac_cv_build
ac_save_IFS=$IFS; IFS='-'
set x $ac_cv_build
shift
build_cpu=$1
build_vendor=$2
shift; shift
# Remember, the first character of IFS is used to create $*,
# except with old shells:
build_os=$*
IFS=$ac_save_IFS
case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
$as_echo_n "checking host system type... " >&6; }
if ${ac_cv_host+:} false; then :
$as_echo_n "(cached) " >&6
else
if test "x$host_alias" = x; then
ac_cv_host=$ac_cv_build
else
ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5
$as_echo "$ac_cv_host" >&6; }
case $ac_cv_host in
*-*-*) ;;
*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;;
esac
host=$ac_cv_host
ac_save_IFS=$IFS; IFS='-'
set x $ac_cv_host
shift
host_cpu=$1
host_vendor=$2
shift; shift
# Remember, the first character of IFS is used to create $*,
# except with old shells:
host_os=$*
IFS=$ac_save_IFS
case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
host_os_name=`echo $host_os | sed -e '1,$s/[0-9.]*$//g'`
host_os_version=`echo $host_os | sed -e '1,$s/^[^0-9.]*//g'`
ac_config_headers="$ac_config_headers config.h"
......@@ -2238,12 +2354,6 @@ else
fi
uname=`uname`
uversion=`uname -r | sed -e '1,$s/[^0-9]//g'`
if test x$uname = xIRIX64; then
uname="IRIX"
fi
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
......@@ -3290,35 +3400,6 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
ac_aux_dir=
for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
if test -f "$ac_dir/install-sh"; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/install-sh -c"
break
elif test -f "$ac_dir/install.sh"; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/install.sh -c"
break
elif test -f "$ac_dir/shtool"; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/shtool install -c"
break
fi
done
if test -z "$ac_aux_dir"; then
as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5
fi
# These three variables are undocumented and unsupported,
# and are intended to be withdrawn in a future Autoconf release.
# They can cause serious problems if a builder's source tree is in a directory
# whose full name contains unusual characters.
ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var.
ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var.
ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
# Find a good install program. We prefer a C program (faster),
# so one script is as good as another. But avoid the broken or
# incompatible versions:
......@@ -3709,8 +3790,8 @@ fi
case "$uname" in
Darwin* | *BSD*)
case "$host_os_name" in
darwin* | *bsd)
ARFLAGS="-rcv"
;;
*)
......@@ -4276,9 +4357,11 @@ $as_echo "$have_pthread" >&6; }
# Solaris requires -D_POSIX_PTHREAD_SEMANTICS to
# be POSIX-compliant... :(
if test $uname = SunOS; then
case "$host_os_name" in
sunos)
PTHREAD_FLAGS="$PTHREAD_FLAGS -D_POSIX_PTHREAD_SEMANTICS"
fi
;;
esac
break
fi
done
......@@ -4302,8 +4385,8 @@ if test x$enable_shared != xno; then
$as_echo_n "checking for shared library support... " >&6; }
PICFLAG=1
case "$uname" in
SunOS* | UNIX_S*)
case "$host_os_name" in
sunos | unix_s)
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
LIBMXML="libmxml.so.1.5"
......@@ -4312,7 +4395,7 @@ $as_echo "yes" >&6; }
LDFLAGS="$LDFLAGS -R\$(libdir)"
;;
HP-UX*)
hp-ux)
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
LIBMXML="libmxml.sl.1"
......@@ -4321,7 +4404,7 @@ $as_echo "yes" >&6; }
LDFLAGS="$LDFLAGS -Wl,+s,+b,\$(libdir)"
;;
IRIX)
irix)
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
LIBMXML="libmxml.so.1.5"
......@@ -4329,7 +4412,7 @@ $as_echo "yes" >&6; }
DSOFLAGS="$DSOFLAGS -Wl,-rpath,\$(libdir),-set_version,sgi1.0,-soname,libmxml.so.1 -shared \$(OPTIM)"
;;
OSF1* | Linux | GNU)
osf | linux | gnu)
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
LIBMXML="libmxml.so.1.5"
......@@ -4338,7 +4421,7 @@ $as_echo "yes" >&6; }
LDFLAGS="$LDFLAGS -Wl,-rpath,\$(libdir)"
;;
*BSD*)
*bsd)
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
LIBMXML="libmxml.so.1.5"
......@@ -4347,7 +4430,7 @@ $as_echo "yes" >&6; }
LDFLAGS="$LDFLAGS -Wl,-R\$(libdir)"
;;
Darwin*)
darwin)
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
LIBMXML="libmxml.1.dylib"
......@@ -4385,12 +4468,12 @@ if test -n "$GCC"; then
CFLAGS="-ansi -pedantic $CFLAGS"
fi
if test $PICFLAG = 1 -a $uname != AIX; then
if test $PICFLAG = 1 -a "$host_os_name" != aix; then
OPTIM="-fPIC $OPTIM"
fi
else
case $uname in
HP-UX*)
case "$host_os_name" in
hp-ux)
CFLAGS="-Ae $CFLAGS"
if test "x$OPTIM" = x; then
......@@ -4404,7 +4487,7 @@ else
fi
;;
UNIX_SVR* | SunOS*)
unix_svr | sunos)
if test "x$OPTIM" = x; then
OPTIM="-O"
fi
......@@ -4435,12 +4518,12 @@ if test "$docdir" = "NONE"; then
fi
if test "$mandir" = "\${prefix}/man" -a "$prefix" = "/usr"; then
case "$uname" in
*BSD* | Darwin* | Linux*)
# BSD, Darwin (MacOS X), and Linux
case "$host_os_name" in
*bsd | darwin | linux)
# *BSD, Darwin (macOS), and Linux
mandir="/usr/share/man"
;;
IRIX*)
irix)
# SGI IRIX
mandir="/usr/share/catman/u_man"
;;
......@@ -5749,4 +5832,3 @@ if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
fi
......@@ -15,6 +15,12 @@ dnl
dnl Package name and version...
AC_INIT([Mini-XML], [2.11], [https://github.com/michaelrsweet/mxml/issues], [mxml], [https://michaelrsweet.github.io/mxml])
dnl Get the compile host and split the host_os value
AC_CANONICAL_HOST
[host_os_name=`echo $host_os | sed -e '1,$s/[0-9.]*$//g'`]
[host_os_version=`echo $host_os | sed -e '1,$s/^[^0-9.]*//g'`]
dnl Set the name of the config header file...
AC_CONFIG_HEADER(config.h)
......@@ -56,13 +62,6 @@ AC_ARG_WITH(vsnprintf, [ --with-vsnprintf use vsnprintf emulation functi
use_vsnprintf="$withval",
use_vsnprintf="no")
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
dnl Checks for programs...
AC_PROG_CC
AC_PROG_CXX
......@@ -79,8 +78,8 @@ AC_PATH_PROG(MKDIR,mkdir)
AC_PATH_PROG(RM,rm)
dnl Flags for "ar" command...
case "$uname" in
Darwin* | *BSD*)
case "$host_os_name" in
darwin* | *bsd)
ARFLAGS="-rcv"
;;
*)
......@@ -144,9 +143,11 @@ if test "x$enable_threads" != xno; then
# Solaris requires -D_POSIX_PTHREAD_SEMANTICS to
# be POSIX-compliant... :(
if test $uname = SunOS; then
case "$host_os_name" in
sunos)
PTHREAD_FLAGS="$PTHREAD_FLAGS -D_POSIX_PTHREAD_SEMANTICS"
fi
;;
esac
break
fi
done
......@@ -166,8 +167,8 @@ if test x$enable_shared != xno; then
AC_MSG_CHECKING(for shared library support)
PICFLAG=1
case "$uname" in
SunOS* | UNIX_S*)
case "$host_os_name" in
sunos | unix_s)
AC_MSG_RESULT(yes)
LIBMXML="libmxml.so.1.5"
DSO="\$(CC)"
......@@ -175,7 +176,7 @@ if test x$enable_shared != xno; then
LDFLAGS="$LDFLAGS -R\$(libdir)"
;;
HP-UX*)
hp-ux)
AC_MSG_RESULT(yes)
LIBMXML="libmxml.sl.1"
DSO="ld"
......@@ -183,14 +184,14 @@ if test x$enable_shared != xno; then
LDFLAGS="$LDFLAGS -Wl,+s,+b,\$(libdir)"
;;
IRIX)
irix)
AC_MSG_RESULT(yes)
LIBMXML="libmxml.so.1.5"
DSO="\$(CC)"
DSOFLAGS="$DSOFLAGS -Wl,-rpath,\$(libdir),-set_version,sgi1.0,-soname,libmxml.so.1 -shared \$(OPTIM)"
;;
OSF1* | Linux | GNU)
osf | linux | gnu)
AC_MSG_RESULT(yes)
LIBMXML="libmxml.so.1.5"
DSO="\$(CC)"
......@@ -198,7 +199,7 @@ if test x$enable_shared != xno; then
LDFLAGS="$LDFLAGS -Wl,-rpath,\$(libdir)"
;;
*BSD*)
*bsd)
AC_MSG_RESULT(yes)
LIBMXML="libmxml.so.1.5"
DSO="\$(CC)"
......@@ -206,7 +207,7 @@ if test x$enable_shared != xno; then
LDFLAGS="$LDFLAGS -Wl,-R\$(libdir)"
;;
Darwin*)
darwin)
AC_MSG_RESULT(yes)
LIBMXML="libmxml.1.dylib"
DSO="\$(CC)"
......@@ -242,12 +243,12 @@ if test -n "$GCC"; then
CFLAGS="-ansi -pedantic $CFLAGS"
fi
if test $PICFLAG = 1 -a $uname != AIX; then
if test $PICFLAG = 1 -a "$host_os_name" != aix; then
OPTIM="-fPIC $OPTIM"
fi
else
case $uname in
HP-UX*)
case "$host_os_name" in
hp-ux)
CFLAGS="-Ae $CFLAGS"
if test "x$OPTIM" = x; then
......@@ -261,7 +262,7 @@ else
fi
;;
UNIX_SVR* | SunOS*)
unix_svr | sunos)
if test "x$OPTIM" = x; then
OPTIM="-O"
fi
......@@ -296,12 +297,12 @@ fi
dnl Fix "mandir" variable if it hasn't been specified...
if test "$mandir" = "\${prefix}/man" -a "$prefix" = "/usr"; then
case "$uname" in
*BSD* | Darwin* | Linux*)
# BSD, Darwin (MacOS X), and Linux
case "$host_os_name" in
*bsd | darwin | linux)
# *BSD, Darwin (macOS), and Linux
mandir="/usr/share/man"
;;
IRIX*)
irix)
# SGI IRIX
mandir="/usr/share/catman/u_man"
;;
......@@ -330,7 +331,3 @@ AC_SUBST(PC_LIBS)
dnl Output the makefile, etc...
AC_OUTPUT(Makefile mxml.list mxml.pc)
dnl
dnl End of "$Id$".
dnl
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment