changeset 1550:31c2b8e4885e

Fixed bug #166 From the autoconf obsolete macros documentation: Macro: AC_CANONICAL_SYSTEM Determine the system type and set output variables to the names of the canonical system types. See section Getting the Canonical System Type, for details about the variables this macro sets. The user is encouraged to use either AC_CANONICAL_BUILD, or AC_CANONICAL_HOST, or AC_CANONICAL_TARGET, depending on the needs. Using AC_CANONICAL_TARGET is enough to run the two other macros. From the documentation for the canonical environments: case $target in i386-*-mach* | i386-*-gnu*) obj_format=aout emulation=mach bfd_gas=yes ;; i960-*-bout) obj_format=bout ;; esac Note that the above example uses $target because it's taken from a tool which can be built on some architecture ($build), run on another ($host), but yet handle data for a third architecture ($target). Such tools are usually part of a compiler suite, they generate code for a specific $target. However $target should be meaningless for most packages. If you want to base a decision on the system where your program will be run, make sure you use the $host variable.
author Sam Lantinga <slouken@libsdl.org>
date Sun, 19 Mar 2006 05:27:22 +0000
parents 066236f0cbf0
children 02e19471a694
files configure.in sdl.m4 test/acinclude.m4 test/configure.in
diffstat 4 files changed, 19 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/configure.in	Sat Mar 18 22:42:09 2006 +0000
+++ b/configure.in	Sun Mar 19 05:27:22 2006 +0000
@@ -39,9 +39,9 @@
 AC_SUBST(LT_REVISION)
 AC_SUBST(LT_AGE)
 
-dnl Detect the canonical host and target build environment
+dnl Detect the canonical build and host environments
 AC_CONFIG_AUX_DIRS($srcdir/build-scripts)
-AC_CANONICAL_SYSTEM
+AC_CANONICAL_HOST
 AC_C_BIGENDIAN
 if test x$ac_cv_c_bigendian = xyes; then
     AC_DEFINE(SDL_BYTEORDER, 4321)
@@ -54,7 +54,7 @@
 if test x$srcdir != x.; then
     INCLUDE="-Iinclude $INCLUDE"
 fi
-case "$target" in
+case "$host" in
     *-*-cygwin*)
         # We build SDL on cygwin without the UNIX emulation layer
         BASE_CFLAGS="-I/usr/include/mingw -mno-cygwin"
@@ -285,7 +285,7 @@
             have_audio=yes
 
             # OpenBSD needs linking with ossaudio emulation library
-            case "$target" in
+            case "$host" in
                 *-*-openbsd*|*-*-netbsd*)
                     EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lossaudio";;
             esac
@@ -569,7 +569,7 @@
 CheckNASM()
 {
     dnl Make sure we are running on an x86 platform
-    case $target in
+    case $host in
         i?86*)
             ;;
         *)
@@ -600,7 +600,7 @@
             AC_SUBST(NASM)
             AC_SUBST(NASMFLAGS)
 
-            case "$target" in
+            case "$host" in
                 # this line is needed for QNX, because it's not defined the __ELF__
                 *-*-qnx*)
                      EXTRA_CFLAGS="$EXTRA_CFLAGS -D__ELF__";;
@@ -753,7 +753,7 @@
 AC_HELP_STRING([--enable-x11-shared], [dynamically load X11 support [default=yes]]),
                           , enable_x11_shared=yes)
 
-            case "$target" in
+            case "$host" in
                 *-*-darwin*)
                     x11_lib='/usr/X11R6/lib/libX11.6.dylib'
                     x11ext_lib='/usr/X11R6/lib/libXext.6.dylib'
@@ -1353,7 +1353,7 @@
 {
     if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
         AC_DEFINE(SDL_VIDEO_OPENGL)
-        case "$target" in
+        case "$host" in
             *-*-darwin*)
                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -framework OpenGL"
                 # The following is probably not available in Darwin:
@@ -1485,7 +1485,7 @@
     AC_ARG_ENABLE(pthread-sem,
 AC_HELP_STRING([--enable-pthread-sem], [use pthread semaphores [default=yes]]),
                   , enable_pthread_sem=yes)
-    case "$target" in
+    case "$host" in
         *-*-linux*)
             pthread_cflags="-D_REENTRANT"
             pthread_lib="-lpthread"
@@ -1894,8 +1894,8 @@
                   , enable_rpath=yes)
 }
 
-dnl Set up the configuration based on the target platform!
-case "$target" in
+dnl Set up the configuration based on the host platform!
+case "$host" in
     arm-*-elf*) # FIXME: Can we get more specific for iPodLinux?
         ARCH=linux
         CheckDummyVideo
@@ -1908,7 +1908,7 @@
         fi
         ;;
     *-*-linux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-irix*|*-*-aix*|*-*-osf*)
-        case "$target" in
+        case "$host" in
             *-*-linux*)         ARCH=linux ;;
             *-*-kfreebsd*-gnu)  ARCH=kfreebsd-gnu ;;
             *-*-knetbsd*-gnu)   ARCH=knetbsd-gnu ;;
@@ -2072,7 +2072,7 @@
         ;;
     *-*-cygwin* | *-*-mingw32*)
         ARCH=win32
-        if test "$build" != "$target"; then # cross-compiling
+        if test "$build" != "$host"; then # cross-compiling
             # Default cross-compile location
             ac_default_prefix=/usr/local/cross-tools/i386-mingw32msvc
         else
@@ -2335,7 +2335,7 @@
         ;;
     *)
         AC_MSG_ERROR([
-*** Unsupported target:  Please add to configure.in
+*** Unsupported host:  Please add to configure.in
         ])
         ;;
 esac
--- a/sdl.m4	Sat Mar 18 22:42:09 2006 +0000
+++ b/sdl.m4	Sun Mar 19 05:27:22 2006 +0000
@@ -32,7 +32,6 @@
      fi
   fi
 
-  AC_REQUIRE([AC_CANONICAL_TARGET])
   PATH="$prefix/bin:$prefix/usr/bin:$PATH"
   AC_PATH_PROG(SDL_CONFIG, sdl-config, no, [$PATH])
   min_sdl_version=ifelse([$1], ,0.11.0,$1)
@@ -121,6 +120,7 @@
 
 ],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
        CFLAGS="$ac_save_CFLAGS"
+       CXXFLAGS="$ac_save_CXXFLAGS"
        LIBS="$ac_save_LIBS"
      fi
   fi
@@ -170,7 +170,6 @@
        fi
      fi
      SDL_CFLAGS=""
-     SDL_CXXFLAGS=""
      SDL_LIBS=""
      ifelse([$3], , :, [$3])
   fi
--- a/test/acinclude.m4	Sat Mar 18 22:42:09 2006 +0000
+++ b/test/acinclude.m4	Sun Mar 19 05:27:22 2006 +0000
@@ -32,7 +32,6 @@
      fi
   fi
 
-  AC_REQUIRE([AC_CANONICAL_TARGET])
   PATH="$prefix/bin:$prefix/usr/bin:$PATH"
   AC_PATH_PROG(SDL_CONFIG, sdl-config, no, [$PATH])
   min_sdl_version=ifelse([$1], ,0.11.0,$1)
@@ -121,6 +120,7 @@
 
 ],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
        CFLAGS="$ac_save_CFLAGS"
+       CXXFLAGS="$ac_save_CXXFLAGS"
        LIBS="$ac_save_LIBS"
      fi
   fi
@@ -170,7 +170,6 @@
        fi
      fi
      SDL_CFLAGS=""
-     SDL_CXXFLAGS=""
      SDL_LIBS=""
      ifelse([$3], , :, [$3])
   fi
--- a/test/configure.in	Sat Mar 18 22:42:09 2006 +0000
+++ b/test/configure.in	Sun Mar 19 05:27:22 2006 +0000
@@ -1,9 +1,9 @@
 dnl Process this file with autoconf to produce a configure script.
 AC_INIT(README)
 
-dnl Detect the canonical host and target build environment
+dnl Detect the canonical build and host environments
 AC_CONFIG_AUX_DIRS($srcdir/../build-scripts)
-AC_CANONICAL_SYSTEM
+AC_CANONICAL_HOST
 
 dnl Check for tools
 
@@ -14,7 +14,7 @@
 AC_C_CONST
 
 dnl Figure out which math library to use
-case "$target" in
+case "$host" in
     *-*-cygwin* | *-*-mingw32*)
         EXE=".exe"
         MATHLIB=""