configure.in
changeset 1521 9b9212e4810c
parent 1520 5d264facfd03
child 1532 30f189cdd82b
     1.1 --- a/configure.in	Mon Mar 13 18:01:34 2006 +0000
     1.2 +++ b/configure.in	Tue Mar 14 02:46:26 2006 +0000
     1.3 @@ -57,20 +57,23 @@
     1.4  case "$target" in
     1.5      *-*-cygwin*)
     1.6          # We build SDL on cygwin without the UNIX emulation layer
     1.7 -        CFLAGS="$CFLAGS -I/usr/include/mingw -mno-cygwin"
     1.8 -        BUILD_CFLAGS="$CFLAGS \$(INCLUDE)"
     1.9 -        BUILD_LDFLAGS="$LDFLAGS -mno-cygwin"
    1.10 -        SDL_CFLAGS="-I/usr/include/mingw -mno-cygwin"
    1.11 -        SDL_LIBS="-lSDL -mno-cygwin"
    1.12 +        BASE_CFLAGS="-I/usr/include/mingw -mno-cygwin"
    1.13 +        BASE_LDFLAGS="-mno-cygwin"
    1.14          ;;
    1.15      *)
    1.16 -        CFLAGS="$CFLAGS -D_GNU_SOURCE=1"
    1.17 -        BUILD_CFLAGS="$CFLAGS \$(INCLUDE)"
    1.18 -        BUILD_LDFLAGS="$LDFLAGS"
    1.19 -        SDL_CFLAGS=""
    1.20 -        SDL_LIBS="-lSDL"
    1.21 +        BASE_CFLAGS="-D_GNU_SOURCE=1"
    1.22 +        BASE_LDFLAGS=""
    1.23          ;;
    1.24  esac
    1.25 +BUILD_CFLAGS="$CFLAGS"
    1.26 +EXTRA_CFLAGS="$INCLUDE $BASE_CFLAGS"
    1.27 +BUILD_LDFLAGS="$LDFLAGS"
    1.28 +EXTRA_LDFLAGS="$BASE_LDFLAGS"
    1.29 +SDL_CFLAGS="$BASE_CFLAGS"
    1.30 +SDL_LIBS="-lSDL $BASE_LDFLAGS"
    1.31 +CPPFLAGS="$CPPFLAGS $EXTRA_CFLAGS"
    1.32 +CFLAGS="$CFLAGS $EXTRA_CFLAGS"
    1.33 +LDFLAGS="$LDFLAGS $EXTRA_LDFLAGS"
    1.34  
    1.35  dnl Check for tools
    1.36  AC_LIBTOOL_WIN32_DLL
    1.37 @@ -118,7 +121,7 @@
    1.38      fi
    1.39      AC_CHECK_FUNCS(malloc calloc realloc free getenv putenv unsetenv qsort abs bcopy memset memcpy memmove strlen strlcpy strlcat strdup _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp sscanf snprintf vsnprintf iconv sigaction setjmp nanosleep)
    1.40  
    1.41 -    AC_CHECK_LIB(m, pow, [BUILD_LDFLAGS="$BUILD_LDFLAGS -lm"])
    1.42 +    AC_CHECK_LIB(m, pow, [EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm"])
    1.43  fi
    1.44  
    1.45  if test x$have_inttypes != xyes; then
    1.46 @@ -284,7 +287,7 @@
    1.47              # OpenBSD needs linking with ossaudio emulation library
    1.48              case "$target" in
    1.49                  *-*-openbsd*|*-*-netbsd*)
    1.50 -                    BUILD_LDFLAGS="$BUILD_LDFLAGS -lossaudio";;
    1.51 +                    EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lossaudio";;
    1.52              esac
    1.53          fi
    1.54      fi
    1.55 @@ -321,7 +324,7 @@
    1.56  
    1.57              AC_DEFINE(SDL_AUDIO_DRIVER_ALSA)
    1.58              SOURCES="$SOURCES $srcdir/src/audio/alsa/*.c"
    1.59 -            BUILD_CFLAGS="$BUILD_CFLAGS $ALSA_CFLAGS"
    1.60 +            EXTRA_CFLAGS="$EXTRA_CFLAGS $ALSA_CFLAGS"
    1.61              if test x$have_loadso != xyes && \
    1.62                 test x$enable_alsa_shared = xyes; then
    1.63                  AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ALSA loading])
    1.64 @@ -330,7 +333,7 @@
    1.65                 test x$enable_alsa_shared = xyes && test x$alsa_lib != x; then
    1.66                  AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ALSA_DYNAMIC, "$alsa_lib")
    1.67              else
    1.68 -                BUILD_LDFLAGS="$BUILD_LDFLAGS $ALSA_LIBS"
    1.69 +                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ALSA_LIBS"
    1.70              fi
    1.71              have_audio=yes
    1.72          fi
    1.73 @@ -355,7 +358,7 @@
    1.74          if test x$have_dmedia = xyes; then
    1.75              AC_DEFINE(SDL_AUDIO_DRIVER_DMEDIA)
    1.76              SOURCES="$SOURCES $srcdir/src/audio/dmedia/*.c"
    1.77 -            BUILD_LDFLAGS="$BUILD_LDFLAGS -laudio"
    1.78 +            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -laudio"
    1.79              have_audio=yes
    1.80          fi
    1.81      fi
    1.82 @@ -392,8 +395,8 @@
    1.83          if test x$have_mme = xyes; then
    1.84              AC_DEFINE(SDL_AUDIO_DRIVER_MMEAUDIO)
    1.85              SOURCES="$SOURCES $srcdir/src/audio/mme/*.c"
    1.86 -            BUILD_CFLAGS="$BUILD_CFLAGS $MME_CFLAGS"
    1.87 -            BUILD_LDFLAGS="$BUILD_LDFLAGS $MME_LIBS"
    1.88 +            EXTRA_CFLAGS="$EXTRA_CFLAGS $MME_CFLAGS"
    1.89 +            EXTRA_LDFLAGS="$EXTRA_LDFLAGS $MME_LIBS"
    1.90              have_audio=yes
    1.91          fi
    1.92      fi
    1.93 @@ -417,7 +420,7 @@
    1.94  
    1.95              AC_DEFINE(SDL_AUDIO_DRIVER_ESD)
    1.96              SOURCES="$SOURCES $srcdir/src/audio/esd/*.c"
    1.97 -            BUILD_CFLAGS="$BUILD_CFLAGS $ESD_CFLAGS"
    1.98 +            EXTRA_CFLAGS="$EXTRA_CFLAGS $ESD_CFLAGS"
    1.99              if test x$have_loadso != xyes && \
   1.100                 test x$enable_esd_shared = xyes; then
   1.101                  AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ESD loading])
   1.102 @@ -426,7 +429,7 @@
   1.103                 test x$enable_esd_shared = xyes && test x$esd_lib != x; then
   1.104                  AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ESD_DYNAMIC, "$esd_lib")
   1.105              else
   1.106 -                BUILD_LDFLAGS="$BUILD_LDFLAGS $ESD_LIBS"
   1.107 +                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ESD_LIBS"
   1.108              fi
   1.109              have_audio=yes
   1.110          fi
   1.111 @@ -469,7 +472,7 @@
   1.112  
   1.113                  AC_DEFINE(SDL_AUDIO_DRIVER_ARTS)
   1.114                  SOURCES="$SOURCES $srcdir/src/audio/arts/*.c"
   1.115 -                BUILD_CFLAGS="$BUILD_CFLAGS $ARTS_CFLAGS"
   1.116 +                EXTRA_CFLAGS="$EXTRA_CFLAGS $ARTS_CFLAGS"
   1.117                  if test x$have_loadso != xyes && \
   1.118                     test x$enable_arts_shared = xyes; then
   1.119                      AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ARTS loading])
   1.120 @@ -478,7 +481,7 @@
   1.121                     test x$enable_arts_shared = xyes && test x$arts_lib != x; then
   1.122                      AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ARTS_DYNAMIC, "$arts_lib")
   1.123                  else
   1.124 -                    BUILD_LDFLAGS="$BUILD_LDFLAGS $ARTS_LIBS"
   1.125 +                    EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ARTS_LIBS"
   1.126                  fi
   1.127                  have_audio=yes
   1.128              fi
   1.129 @@ -511,8 +514,8 @@
   1.130          if test x$have_nas = xyes; then
   1.131              AC_DEFINE(SDL_AUDIO_DRIVER_NAS)
   1.132              SOURCES="$SOURCES $srcdir/src/audio/nas/*.c"
   1.133 -            BUILD_CFLAGS="$BUILD_CFLAGS $NAS_CFLAGS"
   1.134 -            BUILD_LDFLAGS="$BUILD_LDFLAGS $NAS_LIBS"
   1.135 +            EXTRA_CFLAGS="$EXTRA_CFLAGS $NAS_CFLAGS"
   1.136 +            EXTRA_LDFLAGS="$EXTRA_LDFLAGS $NAS_LIBS"
   1.137              have_audio=yes
   1.138          fi
   1.139      fi
   1.140 @@ -588,9 +591,9 @@
   1.141              case "$target" in
   1.142                  # this line is needed for QNX, because it's not defined the __ELF__
   1.143                  *-*-qnx*)
   1.144 -                     BUILD_CFLAGS="$BUILD_CFLAGS -D__ELF__";;
   1.145 +                     EXTRA_CFLAGS="$EXTRA_CFLAGS -D__ELF__";;
   1.146                  *-*-solaris*)
   1.147 -                     BUILD_CFLAGS="$BUILD_CFLAGS -D__ELF__";;
   1.148 +                     EXTRA_CFLAGS="$EXTRA_CFLAGS -D__ELF__";;
   1.149              esac
   1.150          fi
   1.151      fi
   1.152 @@ -669,7 +672,7 @@
   1.153              if test x$have_altivec_h_hdr = xyes; then
   1.154                AC_DEFINE(HAVE_ALTIVEC_H)
   1.155              fi
   1.156 -            BUILD_CFLAGS="$BUILD_CFLAGS $altivec_CFLAGS"
   1.157 +            EXTRA_CFLAGS="$EXTRA_CFLAGS $altivec_CFLAGS"
   1.158          fi
   1.159      fi
   1.160  }
   1.161 @@ -682,7 +685,7 @@
   1.162          , enable_ipod=yes)
   1.163  
   1.164      if test x$enable_ipod = xyes; then
   1.165 -        BUILD_CFLAGS="$BUILD_CFLAGS -DIPOD"
   1.166 +        EXTRA_CFLAGS="$EXTRA_CFLAGS -DIPOD"
   1.167          AC_DEFINE(SDL_VIDEO_DRIVER_IPOD)
   1.168          SOURCES="$SOURCES $srcdir/src/video/ipod/*.c"
   1.169      fi
   1.170 @@ -700,26 +703,26 @@
   1.171              AC_HELP_STRING([--enable-nanox-debug], [print debug messages [default=no]]),
   1.172              , enable_nanox_debug=no)
   1.173          if test x$enable_nanox_debug = xyes; then
   1.174 -            BUILD_CFLAGS="$BUILD_CFLAGS -DENABLE_NANOX_DEBUG"
   1.175 +            EXTRA_CFLAGS="$EXTRA_CFLAGS -DENABLE_NANOX_DEBUG"
   1.176          fi
   1.177  
   1.178          AC_ARG_ENABLE(nanox-share-memory,  
   1.179              AC_HELP_STRING([--enable-nanox-share-memory], [use share memory [default=no]]),
   1.180              , enable_nanox_share_memory=no)
   1.181          if test x$enable_nanox_share_memory = xyes; then
   1.182 -            BUILD_CFLAGS="$BUILD_CFLAGS -DNANOX_SHARE_MEMORY"
   1.183 +            EXTRA_CFLAGS="$EXTRA_CFLAGS -DNANOX_SHARE_MEMORY"
   1.184          fi
   1.185  
   1.186          AC_ARG_ENABLE(nanox_direct_fb, 
   1.187              AC_HELP_STRING([--enable-nanox-direct-fb], [use direct framebuffer access [default=no]]),
   1.188              , enable_nanox_direct_fb=no)
   1.189          if test x$enable_nanox_direct_fb = xyes; then
   1.190 -            BUILD_CFLAGS="$BUILD_CFLAGS -DENABLE_NANOX_DIRECT_FB"
   1.191 +            EXTRA_CFLAGS="$EXTRA_CFLAGS -DENABLE_NANOX_DIRECT_FB"
   1.192          fi
   1.193  
   1.194          AC_DEFINE(SDL_VIDEO_DRIVER_NANOX)
   1.195          SOURCES="$SOURCES $srcdir/src/video/nanox/*.c"
   1.196 -        BUILD_LDFLAGS="$BUILD_LDFLAGS -lnano-X"
   1.197 +        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lnano-X"
   1.198          have_video=yes
   1.199      fi
   1.200  }
   1.201 @@ -767,7 +770,7 @@
   1.202  
   1.203              AC_DEFINE(SDL_VIDEO_DRIVER_X11)
   1.204              SOURCES="$SOURCES $srcdir/src/video/x11/*.c"
   1.205 -            BUILD_CFLAGS="$BUILD_CFLAGS $X_CFLAGS"
   1.206 +            EXTRA_CFLAGS="$EXTRA_CFLAGS $X_CFLAGS"
   1.207              if test x$have_loadso != xyes && \
   1.208                 test x$enable_x11_shared = xyes; then
   1.209                  AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic X11 loading])
   1.210 @@ -779,7 +782,7 @@
   1.211                  AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC, "$x11_lib")
   1.212                  AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT, "$x11ext_lib")
   1.213              else
   1.214 -                BUILD_LDFLAGS="$BUILD_LDFLAGS $X_LIBS -lX11 -lXext"
   1.215 +                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $X_LIBS -lX11 -lXext"
   1.216              fi
   1.217              have_video=yes
   1.218  
   1.219 @@ -857,7 +860,7 @@
   1.220          if test x$video_photon = xyes; then
   1.221              AC_DEFINE(SDL_VIDEO_DRIVER_PHOTON)
   1.222              SOURCES="$SOURCES $srcdir/src/video/photon/*.c"
   1.223 -            BUILD_LDFLAGS="$BUILD_LDFLAGS -lph"
   1.224 +            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lph"
   1.225              have_video=yes
   1.226  
   1.227              CheckOpenGLQNX
   1.228 @@ -986,8 +989,8 @@
   1.229          if test x$video_directfb = xyes; then
   1.230              AC_DEFINE(SDL_VIDEO_DRIVER_DIRECTFB)
   1.231              SOURCES="$SOURCES $srcdir/src/video/directfb/*.c"
   1.232 -            BUILD_CFLAGS="$BUILD_CFLAGS $DIRECTFB_CFLAGS"
   1.233 -            BUILD_LDFLAGS="$BUILD_LDFLAGS $DIRECTFB_LIBS"
   1.234 +            EXTRA_CFLAGS="$EXTRA_CFLAGS $DIRECTFB_CFLAGS"
   1.235 +            EXTRA_LDFLAGS="$EXTRA_LDFLAGS $DIRECTFB_LIBS"
   1.236              have_video=yes
   1.237          fi
   1.238      fi
   1.239 @@ -1038,7 +1041,7 @@
   1.240          if test x$video_ggi = xyes; then
   1.241              AC_DEFINE(SDL_VIDEO_DRIVER_GGI)
   1.242              SOURCES="$SOURCES $srcdir/src/video/ggi/*.c"
   1.243 -            BUILD_LDFLAGS="$BUILD_LDFLAGS -lggi -lgii -lgg"
   1.244 +            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lggi -lgii -lgg"
   1.245              have_video=yes
   1.246          fi
   1.247      fi
   1.248 @@ -1068,7 +1071,7 @@
   1.249          if test x$video_svga = xyes; then
   1.250              AC_DEFINE(SDL_VIDEO_DRIVER_SVGALIB)
   1.251              SOURCES="$SOURCES $srcdir/src/video/svga/*.c"
   1.252 -            BUILD_LDFLAGS="$BUILD_LDFLAGS -lvga"
   1.253 +            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lvga"
   1.254              have_video=yes
   1.255          fi
   1.256      fi
   1.257 @@ -1098,7 +1101,7 @@
   1.258          if test x$video_vgl = xyes; then
   1.259              AC_DEFINE(SDL_VIDEO_DRIVER_VGL)
   1.260              SOURCES="$SOURCES $srcdir/src/video/vgl/*.c"
   1.261 -            BUILD_LDFLAGS="$BUILD_LDFLAGS -lvgl"
   1.262 +            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lvgl"
   1.263              have_video=yes
   1.264          fi
   1.265      fi
   1.266 @@ -1149,7 +1152,7 @@
   1.267          if test x$video_aalib = xyes; then
   1.268              AC_DEFINE(SDL_VIDEO_DRIVER_AALIB)
   1.269              SOURCES="$SOURCES $srcdir/src/video/aalib/*.c"
   1.270 -            BUILD_LDFLAGS="$BUILD_LDFLAGS -laa"
   1.271 +            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -laa"
   1.272              have_video=yes
   1.273          fi
   1.274      fi
   1.275 @@ -1180,7 +1183,7 @@
   1.276              AC_DEFINE(SDL_VIDEO_DRIVER_QTOPIA)
   1.277              SOURCES="$SOURCES $srcdir/src/video/qtopia/*.cc"
   1.278              SDLMAIN_SOURCES="$srcdir/src/main/qtopia/*.cc"
   1.279 -            BUILD_CFLAGS="$BUILD_CFLAGS $QTOPIA_FLAGS"
   1.280 +            EXTRA_CFLAGS="$EXTRA_CFLAGS $QTOPIA_FLAGS"
   1.281              SDL_CFLAGS="$SDL_CFLAGS -DQWS -Dmain=SDL_main"
   1.282              SDL_LIBS="-lSDLmain $SDL_LIBS -L${QPEDIR}/lib -L${QTDIR}/lib/ -lqpe -lqte"
   1.283              have_video=yes
   1.284 @@ -1250,7 +1253,7 @@
   1.285              video_gem=yes
   1.286              AC_DEFINE(SDL_VIDEO_DRIVER_GEM)
   1.287              SOURCES="$SOURCES $srcdir/src/video/gem/*.c"
   1.288 -            BUILD_LDFLAGS="$BUILD_LDFLAGS -lgem"
   1.289 +            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lgem"
   1.290              have_video=yes
   1.291          fi
   1.292      fi
   1.293 @@ -1310,7 +1313,7 @@
   1.294          AC_MSG_RESULT($video_opengl)
   1.295          if test x$video_opengl = xyes; then
   1.296              AC_DEFINE(SDL_VIDEO_OPENGL)
   1.297 -            BUILD_LDFLAGS="$BUILD_LDFLAGS -lGL"
   1.298 +            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGL"
   1.299          fi
   1.300      fi
   1.301  }
   1.302 @@ -1329,7 +1332,7 @@
   1.303  {
   1.304      if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
   1.305          AC_DEFINE(SDL_VIDEO_OPENGL)
   1.306 -        BUILD_LDFLAGS="$BUILD_LDFLAGS -lGL"
   1.307 +        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGL"
   1.308      fi
   1.309  }
   1.310  
   1.311 @@ -1340,9 +1343,9 @@
   1.312          AC_DEFINE(SDL_VIDEO_OPENGL)
   1.313          case "$target" in
   1.314              *-*-darwin*)
   1.315 -                BUILD_LDFLAGS="$BUILD_LDFLAGS -framework OpenGL"
   1.316 +                EXTRA_LDFLAGS="$EXTRA_LDFLAGS -framework OpenGL"
   1.317                  # The following is probably not available in Darwin:
   1.318 -                BUILD_LDFLAGS="$BUILD_LDFLAGS -framework AGL"
   1.319 +                EXTRA_LDFLAGS="$EXTRA_LDFLAGS -framework AGL"
   1.320          esac
   1.321      fi
   1.322  }
   1.323 @@ -1368,8 +1371,8 @@
   1.324          fi
   1.325          AC_DEFINE(SDL_VIDEO_OPENGL)
   1.326          AC_DEFINE(SDL_VIDEO_OPENGL_OSMESA)
   1.327 -        BUILD_CFLAGS="$BUILD_CFLAGS $OSMESA_CFLAGS"
   1.328 -        BUILD_LDFLAGS="$BUILD_LDFLAGS $OSMESA_LIBS"
   1.329 +        EXTRA_CFLAGS="$EXTRA_CFLAGS $OSMESA_CFLAGS"
   1.330 +        EXTRA_LDFLAGS="$EXTRA_LDFLAGS $OSMESA_LIBS"
   1.331  
   1.332          AC_ARG_ENABLE(osmesa-shared,
   1.333  AC_HELP_STRING([--enable-osmesa-shared], [dynamically load OSMesa OpenGL support [default=yes]]),
   1.334 @@ -1427,7 +1430,7 @@
   1.335          AC_MSG_RESULT($enable_input_tslib)
   1.336          if test x$enable_input_tslib = xyes; then
   1.337              AC_DEFINE(SDL_INPUT_TSLIB)
   1.338 -            BUILD_LDFLAGS="$BUILD_LDFLAGS -lts"
   1.339 +            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lts"
   1.340          fi
   1.341      fi
   1.342  }
   1.343 @@ -1556,8 +1559,8 @@
   1.344          # Do futher testing if we have pthread support...
   1.345          if test x$use_pthreads = xyes; then
   1.346              AC_DEFINE(SDL_THREAD_PTHREAD)
   1.347 -            BUILD_CFLAGS="$BUILD_CFLAGS $pthread_cflags"
   1.348 -            BUILD_LDFLAGS="$BUILD_LDFLAGS $pthread_lib"
   1.349 +            EXTRA_CFLAGS="$EXTRA_CFLAGS $pthread_cflags"
   1.350 +            EXTRA_LDFLAGS="$EXTRA_LDFLAGS $pthread_lib"
   1.351              SDL_CFLAGS="$SDL_CFLAGS $pthread_cflags"
   1.352              SDL_LIBS="$SDL_LIBS $pthread_lib"
   1.353  
   1.354 @@ -1659,7 +1662,7 @@
   1.355  AC_HELP_STRING([--enable-stdio-redirect], [Redirect STDIO to files on Win32 [default=yes]]),
   1.356                    , enable_stdio_redirect=yes)
   1.357      if test x$enable_stdio_redirect != xyes; then
   1.358 -        BUILD_CFLAGS="$BUILD_CFLAGS -DNO_STDIO_REDIRECT"
   1.359 +        EXTRA_CFLAGS="$EXTRA_CFLAGS -DNO_STDIO_REDIRECT"
   1.360      fi
   1.361  
   1.362      if test x$enable_video = xyes; then
   1.363 @@ -1710,9 +1713,9 @@
   1.364          AC_MSG_RESULT($have_dlopen)
   1.365  
   1.366          if test x$have_dlopen = xyes; then
   1.367 -            AC_CHECK_LIB(c, dlopen, BUILD_LDFLAGS="$BUILD_LDFLAGS",
   1.368 -               AC_CHECK_LIB(dl, dlopen, BUILD_LDFLAGS="$BUILD_LDFLAGS -ldl",
   1.369 -                  AC_CHECK_LIB(ltdl, dlopen, BUILD_LDFLAGS="$BUILD_LDFLAGS -lltdl")))
   1.370 +            AC_CHECK_LIB(c, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS",
   1.371 +               AC_CHECK_LIB(dl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldl",
   1.372 +                  AC_CHECK_LIB(ltdl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lltdl")))
   1.373              AC_CHECK_LIB(dl, dlvsym, have_dlvsym=yes)
   1.374              if test x$have_dlvsym = xyes; then
   1.375                  AC_DEFINE(HAVE_DLVSYM)
   1.376 @@ -1736,7 +1739,7 @@
   1.377          if test x$have_ldg_hdr = xyes -a x$have_ldg_lib = xyes; then
   1.378              AC_DEFINE(SDL_LOADSO_LDG)
   1.379              SOURCES="$SOURCES $srcdir/src/loadso/mint/*.c"
   1.380 -            BUILD_LDFLAGS="$BUILD_LDFLAGS -lldg -lgem"
   1.381 +            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lldg -lgem"
   1.382              have_loadso=yes
   1.383          fi
   1.384      fi
   1.385 @@ -1839,8 +1842,8 @@
   1.386  
   1.387              AC_DEFINE(SDL_JOYSTICK_USBHID)
   1.388              SOURCES="$SOURCES $srcdir/src/joystick/bsd/*.c"
   1.389 -            BUILD_CFLAGS="$BUILD_CFLAGS $USB_CFLAGS"
   1.390 -            BUILD_LDFLAGS="$BUILD_LDFLAGS $USB_LIBS"
   1.391 +            EXTRA_CFLAGS="$EXTRA_CFLAGS $USB_CFLAGS"
   1.392 +            EXTRA_LDFLAGS="$EXTRA_LDFLAGS $USB_LIBS"
   1.393              have_joystick=yes
   1.394          fi
   1.395          CFLAGS="$save_CFLAGS"
   1.396 @@ -1857,7 +1860,7 @@
   1.397          AC_CHECK_LIB(rt, clock_gettime, have_clock_gettime=yes)
   1.398          if test x$have_clock_gettime = xyes; then
   1.399              AC_DEFINE(HAVE_CLOCK_GETTIME)
   1.400 -            BUILD_LDFLAGS="$BUILD_LDFLAGS -lrt"
   1.401 +            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lrt"
   1.402          fi
   1.403      fi
   1.404  }
   1.405 @@ -1867,7 +1870,7 @@
   1.406  {
   1.407      AC_CHECK_HEADER(linux/version.h, have_linux_version_h=yes)
   1.408      if test x$have_linux_version_h = xyes; then
   1.409 -        BUILD_CFLAGS="$BUILD_CFLAGS -DHAVE_LINUX_VERSION_H"
   1.410 +        EXTRA_CFLAGS="$EXTRA_CFLAGS -DHAVE_LINUX_VERSION_H"
   1.411      fi
   1.412  }
   1.413  
   1.414 @@ -2037,7 +2040,7 @@
   1.415          if test x$enable_audio = xyes; then
   1.416              AC_DEFINE(SDL_AUDIO_DRIVER_QNXNTO)
   1.417              SOURCES="$SOURCES $srcdir/src/audio/nto/*.c"
   1.418 -            BUILD_LDFLAGS="$BUILD_LDFLAGS -lasound"
   1.419 +            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lasound"
   1.420              have_audio=yes
   1.421          fi
   1.422          # Set up files for the cdrom library
   1.423 @@ -2114,9 +2117,9 @@
   1.424              have_loadso=yes
   1.425          fi
   1.426          # Set up the system libraries we need
   1.427 -        BUILD_LDFLAGS="$BUILD_LDFLAGS -luser32 -lgdi32 -lwinmm"
   1.428 +        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -luser32 -lgdi32 -lwinmm"
   1.429          if test x$have_directx = xyes; then
   1.430 -            BUILD_LDFLAGS="$BUILD_LDFLAGS -ldxguid"
   1.431 +            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldxguid"
   1.432          fi
   1.433          # The Win32 platform requires special setup
   1.434          SDLMAIN_SOURCES="$srcdir/src/main/win32/*.c"
   1.435 @@ -2171,7 +2174,7 @@
   1.436          fi
   1.437          # The BeOS platform requires special setup.
   1.438          SOURCES="$srcdir/src/main/beos/*.cc $SOURCES"
   1.439 -        BUILD_LDFLAGS="$BUILD_LDFLAGS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding"
   1.440 +        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding"
   1.441          ;;
   1.442      *-*-darwin* )
   1.443          # This could be either full "Mac OS X", or plain "Darwin" which is
   1.444 @@ -2190,7 +2193,7 @@
   1.445          CheckAltivec
   1.446  
   1.447          # Need this or things might misbuild on a G3.
   1.448 -        BUILD_CFLAGS="$BUILD_CFLAGS -force_cpusubtype_ALL"
   1.449 +        EXTRA_CFLAGS="$EXTRA_CFLAGS -force_cpusubtype_ALL"
   1.450  
   1.451          # Set up files for the audio library
   1.452          if test x$enable_audio = xyes; then
   1.453 @@ -2204,7 +2207,7 @@
   1.454          if test x$enable_joystick = xyes; then
   1.455              AC_DEFINE(SDL_JOYSTICK_IOKIT)
   1.456              SOURCES="$SOURCES $srcdir/src/joystick/darwin/*.c"
   1.457 -            BUILD_LDFLAGS="$BUILD_LDFLAGS -framework IOKit"
   1.458 +            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -framework IOKit"
   1.459              have_joystick=yes
   1.460          fi
   1.461          # Set up files for the cdrom library
   1.462 @@ -2227,19 +2230,19 @@
   1.463          fi
   1.464          # The MacOS X platform requires special setup.
   1.465          SDLMAIN_SOURCES="$srcdir/src/main/macosx/*.m"
   1.466 -        BUILD_CFLAGS="$BUILD_CFLAGS -fpascal-strings"
   1.467 +        EXTRA_CFLAGS="$EXTRA_CFLAGS -fpascal-strings"
   1.468          SDL_LIBS="-lSDLmain $SDL_LIBS"
   1.469          if test x$enable_video_cocoa = xyes; then
   1.470 -            BUILD_LDFLAGS="$BUILD_LDFLAGS -framework Cocoa"
   1.471 +            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -framework Cocoa"
   1.472          fi
   1.473          if test x$enable_video_carbon = xyes -o x$enable_video_cocoa = xyes; then
   1.474              # The Cocoa backend still needs Carbon, and the YUV code QuickTime
   1.475 -            BUILD_LDFLAGS="$BUILD_LDFLAGS -framework QuickTime -framework ApplicationServices"
   1.476 -            BUILD_LDFLAGS="$BUILD_LDFLAGS -framework Carbon"
   1.477 +            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -framework QuickTime -framework ApplicationServices"
   1.478 +            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -framework Carbon"
   1.479          fi
   1.480          # If either the audio or CD driver is used, add the AudioUnit framework
   1.481          if test x$enable_audio = xyes -o x$enable_cdrom = xyes; then
   1.482 -            BUILD_LDFLAGS="$BUILD_LDFLAGS -framework AudioToolbox -framework AudioUnit"
   1.483 +            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -framework AudioToolbox -framework AudioUnit"
   1.484          fi
   1.485          ;;
   1.486      *-*-mint*)
   1.487 @@ -2310,7 +2313,7 @@
   1.488              have_timers=yes
   1.489          fi
   1.490          # The RISC OS platform requires special setup.
   1.491 -        BUILD_LDFLAGS="$BUILD_LDFLAGS -ljpeg -ltiff -lpng -lz"
   1.492 +        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ljpeg -ltiff -lpng -lz"
   1.493          ;;
   1.494      *)
   1.495          AC_MSG_ERROR([
   1.496 @@ -2450,7 +2453,9 @@
   1.497  AC_SUBST(SDLMAIN_SOURCES)
   1.498  AC_SUBST(SDLMAIN_OBJECTS)
   1.499  AC_SUBST(BUILD_CFLAGS)
   1.500 +AC_SUBST(EXTRA_CFLAGS)
   1.501  AC_SUBST(BUILD_LDFLAGS)
   1.502 +AC_SUBST(EXTRA_LDFLAGS)
   1.503  
   1.504  AC_OUTPUT([
   1.505      Makefile sdl-config SDL.spec SDL.qpg