Navigation Menu

Skip to content

Commit

Permalink
Ray Kelm - Fri, 04 Aug 2000 20:58:00 -0400
Browse files Browse the repository at this point in the history
 * Added support for cross-compiling Windows DLL from Linux
  • Loading branch information
Sam Lantinga committed Aug 10, 2000
1 parent db1013f commit 6b21c21
Show file tree
Hide file tree
Showing 6 changed files with 1,504 additions and 2,332 deletions.
4 changes: 4 additions & 0 deletions CHANGES
@@ -1,4 +1,8 @@

1.0.7:
Ray Kelm - Fri, 04 Aug 2000 20:58:00 -0400
* Added support for cross-compiling Windows DLL from Linux

1.0.6:
Sam Lantinga - Sun Jul 2 14:16:44 PDT 2000
* Added support for the Ogg Vorbis music format: http://www.vorbis.org/
Expand Down
103 changes: 39 additions & 64 deletions acinclude.m4
Expand Up @@ -71,7 +71,7 @@ my_strdup (char *str)
if (str)
{
new_str = malloc ((strlen (str) + 1) * sizeof(char));
new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char));
strcpy (new_str, str);
}
else
Expand All @@ -80,12 +80,15 @@ my_strdup (char *str)
return new_str;
}
int main ()
int main (int argc, char *argv[])
{
int major, minor, micro;
char *tmp_version;
/* This hangs on some systems (?)
system ("touch conf.sdltest");
*/
{ FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); }
/* HP/UX 9 (%@#!) writes to sscanf strings */
tmp_version = my_strdup("$min_sdl_version");
Expand Down Expand Up @@ -164,7 +167,7 @@ int main ()
rm -f conf.sdltest
])
## libtool.m4 - Configure libtool for the target system. -*-Shell-script-*-
## Copyright (C) 1996-1999 Free Software Foundation, Inc.
## Copyright (C) 1996-1999, 2000 Free Software Foundation, Inc.
## Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
##
## This program is free software; you can redistribute it and/or modify
Expand All @@ -186,7 +189,7 @@ int main ()
## configuration script generated by Autoconf, you may include it under
## the same distribution terms that you use for the rest of that program.

# serial 41 AC_PROG_LIBTOOL
# serial 40 AC_PROG_LIBTOOL
AC_DEFUN(AC_PROG_LIBTOOL,
[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
Expand All @@ -199,7 +202,7 @@ LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
$libtool_flags --no-verify --build="$build" $ac_aux_dir/ltmain.sh $host \
$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \
|| AC_MSG_ERROR([libtool configure failed])
# Reload cache, that may have been modified by ltconfig
Expand All @@ -224,13 +227,17 @@ AC_REQUIRE([AC_ENABLE_STATIC])dnl
AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
AC_REQUIRE([AC_CANONICAL_HOST])dnl
AC_REQUIRE([AC_CANONICAL_BUILD])dnl
AC_REQUIRE([AC_PROG_RANLIB])dnl
AC_REQUIRE([AC_PROG_CC])dnl
AC_REQUIRE([AC_PROG_LD])dnl
AC_REQUIRE([AC_PROG_NM])dnl
AC_REQUIRE([AC_PROG_LN_S])dnl
dnl
AC_CHECK_TOOL(RANLIB, ranlib, :)
case "$target" in
NONE) lt_target="$host" ;;
*) lt_target="$target" ;;
esac
# Check for any special flags to pass to ltconfig.
libtool_flags="--cache-file=$cache_file"
Expand All @@ -248,15 +255,9 @@ AC_ARG_ENABLE(libtool-lock,
test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
AC_ARG_WITH(pic,
[ --with-pic try to use only PIC/non-PIC objects [default=use both]],
pic_mode="$withval", pic_mode=default)
test x"$pic_mode" = xyes && libtool_flags="$libtool_flags --prefer-pic"
test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic"
# Some flags need to be propagated to the compiler or linker for good
# libtool support.
case "$host" in
case "$lt_target" in
*-*-irix6*)
# Find out which ABI we are using.
echo '[#]line __oline__ "configure"' > conftest.$ac_ext
Expand Down Expand Up @@ -293,30 +294,8 @@ ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
AC_CHECK_TOOL(DLLTOOL, dlltool, false)
AC_CHECK_TOOL(AS, as, false)
AC_CHECK_TOOL(OBJDUMP, objdump, false)
# recent cygwin and mingw systems supply a stub DllMain which the user
# can override, but on older systems we have to supply one
AC_CACHE_CHECK([if libtool should supply DllMain function], lt_cv_need_dllmain,
[AC_TRY_LINK([DllMain (0, 0, 0);],
[extern int __attribute__((__stdcall__)) DllMain(void*, int, void*);],
[lt_cv_need_dllmain=yes],[lt_cv_need_dllmain=no])])
case $host in
*-*-cygwin*)
# cygwin systems need to pass --dll to the linker, and not link
# crt.o which will require a WinMain@16 definition.
lt_cv_cc_dll_switch="-Wl,--dll -nostartfiles" ;;
*-*-mingw*)
# old mingw systems require "-dll" to link a DLL, while more recent ones
# require "-mdll"
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -mdll"
AC_CACHE_CHECK([how to link DLLs], lt_cv_cc_dll_switch,
[AC_TRY_LINK([], [], [lt_cv_cc_dll_switch=-mdll],[lt_cv_cc_dll_switch=-dll])])
CFLAGS="$SAVE_CFLAGS" ;;
esac
;;
])
])
esac
])

Expand Down Expand Up @@ -438,13 +417,7 @@ ac_prog=ld
if test "$ac_cv_prog_gcc" = yes; then
# Check if gcc -print-prog-name=ld gives a path.
AC_MSG_CHECKING([for ld used by GCC])
case $host in
*-*-mingw*)
# gcc leaves a trailing carriage return which upsets mingw
ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
*)
ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
esac
ac_prog=`($CC -print-prog-name=ld) 2>&5`
case "$ac_prog" in
# Accept absolute paths.
changequote(,)dnl
Expand Down Expand Up @@ -500,7 +473,6 @@ else
AC_MSG_RESULT(no)
fi
test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
AC_SUBST(LD)
AC_PROG_LD_GNU
])

Expand Down Expand Up @@ -546,14 +518,13 @@ else
fi])
NM="$ac_cv_path_NM"
AC_MSG_RESULT([$NM])
AC_SUBST(NM)
])

# AC_CHECK_LIBM - check for math library
AC_DEFUN(AC_CHECK_LIBM,
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
LIBM=
case "$host" in
case "$lt_target" in
*-*-beos* | *-*-cygwin*)
# These system don't have libm
;;
Expand All @@ -568,31 +539,35 @@ esac
])

# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
# the libltdl convenience library, adds --enable-ltdl-convenience to
# the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor
# is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed
# to be `${top_builddir}/libltdl'. Make sure you start DIR with
# '${top_builddir}/' (note the single quotes!) if your package is not
# flat, and, if you're not using automake, define top_builddir as
# appropriate in the Makefiles.
# the libltdl convenience library and INCLTDL to the include flags for
# the libltdl header and adds --enable-ltdl-convenience to the
# configure arguments. Note that LIBLTDL and INCLTDL are not
# AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If DIR is not
# provided, it is assumed to be `libltdl'. LIBLTDL will be prefixed
# with '${top_builddir}/' and INCLTDL will be prefixed with
# '${top_srcdir}/' (note the single quotes!). If your package is not
# flat and you're not using automake, define top_builddir and
# top_srcdir appropriately in the Makefiles.
AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
case "$enable_ltdl_convenience" in
no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
"") enable_ltdl_convenience=yes
ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
esac
LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdlc.la
INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la
INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
])

# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
# the libltdl installable library, and adds --enable-ltdl-install to
# the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor
# is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed
# to be `${top_builddir}/libltdl'. Make sure you start DIR with
# '${top_builddir}/' (note the single quotes!) if your package is not
# flat, and, if you're not using automake, define top_builddir as
# appropriate in the Makefiles.
# the libltdl installable library and INCLTDL to the include flags for
# the libltdl header and adds --enable-ltdl-install to the configure
# arguments. Note that LIBLTDL and INCLTDL are not AC_SUBSTed, nor is
# AC_CONFIG_SUBDIRS called. If DIR is not provided and an installed
# libltdl is not found, it is assumed to be `libltdl'. LIBLTDL will
# be prefixed with '${top_builddir}/' and INCLTDL will be prefixed
# with '${top_srcdir}/' (note the single quotes!). If your package is
# not flat and you're not using automake, define top_builddir and
# top_srcdir appropriately in the Makefiles.
# In the future, this macro may have to be called after AC_PROG_LIBTOOL.
AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
AC_CHECK_LIB(ltdl, main,
Expand All @@ -605,8 +580,8 @@ AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
])
if test x"$enable_ltdl_install" = x"yes"; then
ac_configure_args="$ac_configure_args --enable-ltdl-install"
LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdl.la
INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la
INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
else
ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
LIBLTDL="-lltdl"
Expand Down
10 changes: 9 additions & 1 deletion configure.in
Expand Up @@ -39,6 +39,10 @@ AC_SUBST(LT_AGE)
dnl Setup for automake
AM_INIT_AUTOMAKE(SDL_mixer, $VERSION)

dnl Detect the canonical host and target build environment
AC_CANONICAL_HOST
AC_CANONICAL_TARGET

dnl Check for tools

AC_PROG_MAKE_SET
Expand All @@ -48,11 +52,15 @@ AM_PROG_LIBTOOL
AC_PROG_INSTALL

dnl The alpha architecture needs special flags for binary portability
AC_CANONICAL_TARGET
case "$target" in
alpha*-*-linux*)
CFLAGS="$CFLAGS -mcpu=ev4 -Wa,-mall"
;;
*-*-cygwin* | *-*-mingw32*)
if test "$build" != "$target"; then # cross-compiling
ac_default_prefix=/usr/local/cross-tools/i386-mingw32msvc
fi
;;
esac

dnl Check for SDL
Expand Down

0 comments on commit 6b21c21

Please sign in to comment.