Fixed bug #166
authorSam Lantinga <slouken@libsdl.org>
Sun, 19 Mar 2006 05:27:22 +0000
changeset 155031c2b8e4885e
parent 1549 066236f0cbf0
child 1551 02e19471a694
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.
configure.in
sdl.m4
test/acinclude.m4
test/configure.in
     1.1 --- a/configure.in	Sat Mar 18 22:42:09 2006 +0000
     1.2 +++ b/configure.in	Sun Mar 19 05:27:22 2006 +0000
     1.3 @@ -39,9 +39,9 @@
     1.4  AC_SUBST(LT_REVISION)
     1.5  AC_SUBST(LT_AGE)
     1.6  
     1.7 -dnl Detect the canonical host and target build environment
     1.8 +dnl Detect the canonical build and host environments
     1.9  AC_CONFIG_AUX_DIRS($srcdir/build-scripts)
    1.10 -AC_CANONICAL_SYSTEM
    1.11 +AC_CANONICAL_HOST
    1.12  AC_C_BIGENDIAN
    1.13  if test x$ac_cv_c_bigendian = xyes; then
    1.14      AC_DEFINE(SDL_BYTEORDER, 4321)
    1.15 @@ -54,7 +54,7 @@
    1.16  if test x$srcdir != x.; then
    1.17      INCLUDE="-Iinclude $INCLUDE"
    1.18  fi
    1.19 -case "$target" in
    1.20 +case "$host" in
    1.21      *-*-cygwin*)
    1.22          # We build SDL on cygwin without the UNIX emulation layer
    1.23          BASE_CFLAGS="-I/usr/include/mingw -mno-cygwin"
    1.24 @@ -285,7 +285,7 @@
    1.25              have_audio=yes
    1.26  
    1.27              # OpenBSD needs linking with ossaudio emulation library
    1.28 -            case "$target" in
    1.29 +            case "$host" in
    1.30                  *-*-openbsd*|*-*-netbsd*)
    1.31                      EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lossaudio";;
    1.32              esac
    1.33 @@ -569,7 +569,7 @@
    1.34  CheckNASM()
    1.35  {
    1.36      dnl Make sure we are running on an x86 platform
    1.37 -    case $target in
    1.38 +    case $host in
    1.39          i?86*)
    1.40              ;;
    1.41          *)
    1.42 @@ -600,7 +600,7 @@
    1.43              AC_SUBST(NASM)
    1.44              AC_SUBST(NASMFLAGS)
    1.45  
    1.46 -            case "$target" in
    1.47 +            case "$host" in
    1.48                  # this line is needed for QNX, because it's not defined the __ELF__
    1.49                  *-*-qnx*)
    1.50                       EXTRA_CFLAGS="$EXTRA_CFLAGS -D__ELF__";;
    1.51 @@ -753,7 +753,7 @@
    1.52  AC_HELP_STRING([--enable-x11-shared], [dynamically load X11 support [default=yes]]),
    1.53                            , enable_x11_shared=yes)
    1.54  
    1.55 -            case "$target" in
    1.56 +            case "$host" in
    1.57                  *-*-darwin*)
    1.58                      x11_lib='/usr/X11R6/lib/libX11.6.dylib'
    1.59                      x11ext_lib='/usr/X11R6/lib/libXext.6.dylib'
    1.60 @@ -1353,7 +1353,7 @@
    1.61  {
    1.62      if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
    1.63          AC_DEFINE(SDL_VIDEO_OPENGL)
    1.64 -        case "$target" in
    1.65 +        case "$host" in
    1.66              *-*-darwin*)
    1.67                  EXTRA_LDFLAGS="$EXTRA_LDFLAGS -framework OpenGL"
    1.68                  # The following is probably not available in Darwin:
    1.69 @@ -1485,7 +1485,7 @@
    1.70      AC_ARG_ENABLE(pthread-sem,
    1.71  AC_HELP_STRING([--enable-pthread-sem], [use pthread semaphores [default=yes]]),
    1.72                    , enable_pthread_sem=yes)
    1.73 -    case "$target" in
    1.74 +    case "$host" in
    1.75          *-*-linux*)
    1.76              pthread_cflags="-D_REENTRANT"
    1.77              pthread_lib="-lpthread"
    1.78 @@ -1894,8 +1894,8 @@
    1.79                    , enable_rpath=yes)
    1.80  }
    1.81  
    1.82 -dnl Set up the configuration based on the target platform!
    1.83 -case "$target" in
    1.84 +dnl Set up the configuration based on the host platform!
    1.85 +case "$host" in
    1.86      arm-*-elf*) # FIXME: Can we get more specific for iPodLinux?
    1.87          ARCH=linux
    1.88          CheckDummyVideo
    1.89 @@ -1908,7 +1908,7 @@
    1.90          fi
    1.91          ;;
    1.92      *-*-linux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-irix*|*-*-aix*|*-*-osf*)
    1.93 -        case "$target" in
    1.94 +        case "$host" in
    1.95              *-*-linux*)         ARCH=linux ;;
    1.96              *-*-kfreebsd*-gnu)  ARCH=kfreebsd-gnu ;;
    1.97              *-*-knetbsd*-gnu)   ARCH=knetbsd-gnu ;;
    1.98 @@ -2072,7 +2072,7 @@
    1.99          ;;
   1.100      *-*-cygwin* | *-*-mingw32*)
   1.101          ARCH=win32
   1.102 -        if test "$build" != "$target"; then # cross-compiling
   1.103 +        if test "$build" != "$host"; then # cross-compiling
   1.104              # Default cross-compile location
   1.105              ac_default_prefix=/usr/local/cross-tools/i386-mingw32msvc
   1.106          else
   1.107 @@ -2335,7 +2335,7 @@
   1.108          ;;
   1.109      *)
   1.110          AC_MSG_ERROR([
   1.111 -*** Unsupported target:  Please add to configure.in
   1.112 +*** Unsupported host:  Please add to configure.in
   1.113          ])
   1.114          ;;
   1.115  esac
     2.1 --- a/sdl.m4	Sat Mar 18 22:42:09 2006 +0000
     2.2 +++ b/sdl.m4	Sun Mar 19 05:27:22 2006 +0000
     2.3 @@ -32,7 +32,6 @@
     2.4       fi
     2.5    fi
     2.6  
     2.7 -  AC_REQUIRE([AC_CANONICAL_TARGET])
     2.8    PATH="$prefix/bin:$prefix/usr/bin:$PATH"
     2.9    AC_PATH_PROG(SDL_CONFIG, sdl-config, no, [$PATH])
    2.10    min_sdl_version=ifelse([$1], ,0.11.0,$1)
    2.11 @@ -121,6 +120,7 @@
    2.12  
    2.13  ],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
    2.14         CFLAGS="$ac_save_CFLAGS"
    2.15 +       CXXFLAGS="$ac_save_CXXFLAGS"
    2.16         LIBS="$ac_save_LIBS"
    2.17       fi
    2.18    fi
    2.19 @@ -170,7 +170,6 @@
    2.20         fi
    2.21       fi
    2.22       SDL_CFLAGS=""
    2.23 -     SDL_CXXFLAGS=""
    2.24       SDL_LIBS=""
    2.25       ifelse([$3], , :, [$3])
    2.26    fi
     3.1 --- a/test/acinclude.m4	Sat Mar 18 22:42:09 2006 +0000
     3.2 +++ b/test/acinclude.m4	Sun Mar 19 05:27:22 2006 +0000
     3.3 @@ -32,7 +32,6 @@
     3.4       fi
     3.5    fi
     3.6  
     3.7 -  AC_REQUIRE([AC_CANONICAL_TARGET])
     3.8    PATH="$prefix/bin:$prefix/usr/bin:$PATH"
     3.9    AC_PATH_PROG(SDL_CONFIG, sdl-config, no, [$PATH])
    3.10    min_sdl_version=ifelse([$1], ,0.11.0,$1)
    3.11 @@ -121,6 +120,7 @@
    3.12  
    3.13  ],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
    3.14         CFLAGS="$ac_save_CFLAGS"
    3.15 +       CXXFLAGS="$ac_save_CXXFLAGS"
    3.16         LIBS="$ac_save_LIBS"
    3.17       fi
    3.18    fi
    3.19 @@ -170,7 +170,6 @@
    3.20         fi
    3.21       fi
    3.22       SDL_CFLAGS=""
    3.23 -     SDL_CXXFLAGS=""
    3.24       SDL_LIBS=""
    3.25       ifelse([$3], , :, [$3])
    3.26    fi
     4.1 --- a/test/configure.in	Sat Mar 18 22:42:09 2006 +0000
     4.2 +++ b/test/configure.in	Sun Mar 19 05:27:22 2006 +0000
     4.3 @@ -1,9 +1,9 @@
     4.4  dnl Process this file with autoconf to produce a configure script.
     4.5  AC_INIT(README)
     4.6  
     4.7 -dnl Detect the canonical host and target build environment
     4.8 +dnl Detect the canonical build and host environments
     4.9  AC_CONFIG_AUX_DIRS($srcdir/../build-scripts)
    4.10 -AC_CANONICAL_SYSTEM
    4.11 +AC_CANONICAL_HOST
    4.12  
    4.13  dnl Check for tools
    4.14  
    4.15 @@ -14,7 +14,7 @@
    4.16  AC_C_CONST
    4.17  
    4.18  dnl Figure out which math library to use
    4.19 -case "$target" in
    4.20 +case "$host" in
    4.21      *-*-cygwin* | *-*-mingw32*)
    4.22          EXE=".exe"
    4.23          MATHLIB=""