1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310
|
dnl DGen/SDL v1.22
dnl At long last, the configure script!
AC_INIT(decode.c)
dnl We'll need machine type later
AC_CANONICAL_SYSTEM
machtype=$target_cpu
AM_INIT_AUTOMAKE(dgen-sdl, 1.23)
dnl Before we check for cc and c++, check for the --with-extra-opt switch, so
dnl we can add the optimizations.
AC_ARG_WITH(extra-opt,
[ --with-extra-opt Add extra optimizations (egcs/GCC >= 2.95 only)],
ADD_OPT=$withval,
ADD_OPT=no)
if test x$ADD_OPT \!= xno; then
case $machtype in
i?86)
CFLAGS="$CFLAGS -O3 -mpentium -march=pentium -fstrength-reduce -fomit-frame-pointer -frerun-cse-after-loop -funroll-loops -ffast-math -malign-functions=5 -malign-jumps=5 -malign-loops=5 -malign-double -fno-exceptions -fno-rtti"
CXXFLAGS="$CXXFLAGS -O3 -mpentium -march=pentium -fstrength-reduce -fomit-frame-pointer -frerun-cse-after-loop -funroll-loops -ffast-math -malign-functions=5 -malign-jumps=5 -malign-loops=5 -malign-double -fno-exceptions -fno-rtti"
;;
*)
CFLAGS="$CFLAGS -O3 -ffast-math -fomit-frame-pointer -fno-exceptions -fno-rtti -funroll-loops -frerun-cse-after-loop"
CXXFLAGS="$CXXFLAGS -O3 -ffast-math -fomit-frame-pointer -fno-exceptions -fno-rtti -funroll-loops -frerun-cse-after-loop"
;;
esac
fi
dnl Check for standard programs
AC_PROG_AWK
AC_PROG_CC
AC_PROG_CPP
AC_PROG_CXX
AC_PROG_CXXCPP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_RANLIB
dnl Set the value of make, if make doesn't already
AC_PROG_MAKE_SET
dnl We're using C
AC_LANG_C
dnl Check endianness
AC_C_BIGENDIAN
dnl Check for SDL libs
AM_PATH_SDL(1.0.0, true, AC_MSG_ERROR([*** SDL version >= 1.0.0 not found.]))
CFLAGS="$CFLAGS $SDL_CFLAGS"
CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
INTERFACE=sdl
dnl Add SDL cflags to CPPFLAGS, just to check for SDL_joystick header
OLD_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$CPPFLAGS $SDL_CFLAGS"
EXTRAOBJS=
dnl Check for SDL joystick
JOYSTICK_SUPPORT=no
AC_CHECK_HEADER(SDL_joystick.h, JOYSTICK_SUPPORT=SDL,
dnl Check for Linux joystick as a backup
AC_CHECK_HEADER(linux/joystick.h, JOYSTICK_SUPPORT=LINUX))
dnl Check for X (so we can find the OpenGL headers)
AC_PATH_XTRA
CFLAGS="$CFLAGS $X_CFLAGS"
CXXFLAGS="$CXXFLAGS $X_CFLAGS"
LIBS="$LIBS $X_LIBS"
dnl Check for OpenGL support in SDL
AC_ARG_WITH(opengl,
[ --without-opengl Don't use SDL OpenGL support],
OPENGL_SUPPORT=$withval, OPENGL_SUPPORT=yes)
if test x$OPENGL_SUPPORT \!= xno; then
AC_MSG_CHECKING([for OpenGL support in SDL])
AC_TRY_COMPILE([#include <SDL.h>], [int foo() { int x = SDL_OPENGL; }],
OPENGL_SUPPORT=yes, OPENGL_SUPPORT=no)
AC_MSG_RESULT($OPENGL_SUPPORT)
# Check for the GL libs
if test x$OPENGL_SUPPORT \!= xno; then
oldCPPFLAGS=$CPPFLAGS
oldLIBS=$LIBS
CPPFLAGS="$CPPFLAGS $X_CFLAGS"
LIBS="$LIBS $SDL_LIBS"
AC_CHECK_LIB(GL, glBegin,
AC_CHECK_HEADER(GL/gl.h, , OPENGL_SUPPORT=no),
OPENGL_SUPPORT=no
)
LIBS=$oldLIBS
CPPFLAGS=$oldCPPFLAGS
fi
fi
if test x$OPENGL_SUPPORT \!= xno; then
AC_DEFINE(SDL_OPENGL_SUPPORT)
SDL_LIBS="$SDL_LIBS -lGL"
fi
CPPFLAGS=$OLD_CPPFLAGS
if test x$JOYSTICK_SUPPORT \!= xno; then
AC_DEFINE(JOYSTICK_SUPPORT)
AC_DEFINE_UNQUOTED(${JOYSTICK_SUPPORT}_JOYSTICK_SUPPORT)
EXTRAOBJS="$EXTRAOBJS md-phil.o"
fi
oldLIBS=$LIBS
LIBS="$LIBS $SDL_LIBS"
dnl Check for the SDL_WM_ToggleFullScreen function
AC_CHECK_FUNCS(SDL_WM_ToggleFullScreen)
LIBS=$oldLIBS
dnl Check for an Intel chip
AC_MSG_CHECKING([for x86 processor])
case $machtype in
i?86|BePC)
AC_MSG_RESULT([yes])
dnl Check if the user explicitly asked to not use nasm
AC_ARG_WITH(nasm,
[ --without-nasm Don't use NASM for assembler routines],
USENASM=$withval,
USENASM=yes)
if test x$USENASM \!= xno; then
dnl Check for NASM
AC_CHECK_PROG(NASM, nasm, nasm, [not found])
if test x$NASM \!= "xnot found"; then
dnl Find NASM object format
AC_MSG_CHECKING([for NASM object format])
cat >___DgSdFmTTeSt.asm <<EOF
bits 32
section .text
global main
global _main
global main_
main:
_main:
main_:
ret
EOF
test -z $NASM_FMT &&
for FMT in elf aout aoutb coff; do
$NASM -f $FMT ___DgSdFmTTeSt.asm
if $CC -o ___DgSdFmTTeSt ___DgSdFmTTeSt.o >&5
then
NASM_FMT=$FMT
break
fi
done
rm ___DgSdFmTTeSt*
if test \! -z "$NASM_FMT"; then
AC_MSG_RESULT([$NASM_FMT])
ASM=true
dnl ELF doesn't use underscores, aout&coff do
if test x$NASM_FMT = xelf; then
changequote(<<,>>)
CHOP_="sed -e '/^_/s/^_//' -e '/_/s/\([][,.+ *:-]\)_/\1/g'"
changequote([,])
else
CHOP_=cat
fi
AM_CONDITIONAL(NO_USCORE,
test x$NASM_FMT = xelf)
dnl Check for MMX
AC_ARG_WITH(mmx,
[ --without-mmx Don't use MMX routines, even if supported],
USEMMX=$withval,
USEMMX=yes)
AC_MSG_CHECKING([for MMX])
cat >___DgSdMmXTeSt.asm <<EOF
bits 32
section .text
global main
global _main
global main_
main:
_main:
main_:
emms
xor eax, eax ; Return value of 0
ret
EOF
$NASM -f $NASM_FMT ___DgSdMmXTeSt.asm
$CC -o ___DgSdMmXTeSt ___DgSdMmXTeSt.o >&5
./___DgSdMmXTeSt
MMXE=$?
rm ___DgSdMmXTeSt*
if test x$USEMMX \!= xno -a x$MMXE = x0; then
MMX=true
AC_MSG_RESULT([yes])
else
MMX=false
AC_MSG_RESULT([no])
fi
else
AC_MSG_RESULT([not found])
ASM=false
MMX=false
fi
else
ASM=false
MMX=false
fi
else
ASM=false
MMX=false
fi
if test x$ASM = xfalse; then
AC_MSG_ERROR([
*** NASM is necessary on x86 platforms for assembler optimizations.
*** A package most likely came with your Unix distribution, but if one didn't,
*** it can be found at http://www.web-sites.co.uk/nasm/ (or at
*** http://www.bebits.com/ for BeOS)
])
fi
;;
*)
AC_MSG_RESULT([no])
ASM=false
MMX=false
;;
esac
dnl We are free to use assembler! :)
if $ASM; then
EXTRAOBJS="$EXTRAOBJS asm_tiles.o ctv.o"
AC_DEFINE(ASM_TILES)
AC_DEFINE(ASM_CTV)
if $MMX; then
EXTRAOBJS="$EXTRAOBJS mmx_memcpy.o"
AC_DEFINE(MMX)
AC_DEFINE(memcpy, mmx_memcpy)
else
EXTRAOBJS="$EXTRAOBJS asm_memcpy.o"
AC_DEFINE(memcpy, asm_memcpy)
fi
if test -f mz80/makez80.c; then
CPUDIRS=mz80
MZ80="mz80/mz80.o"
fi
fi
dnl Use ZZ80 if MZ80 isn't here
AC_MSG_CHECKING([whether MZ80 is available])
if test -z "$MZ80"; then
AC_MSG_RESULT([no])
EXTRAOBJS="$EXTRAOBJS zz80.o"
else
AC_MSG_RESULT([yes])
fi
dnl Figure out what emus we're using (StarScream, Musashi, or both)
AC_ARG_WITH(star,
[ --without-star Don't use StarScream assembler CPU core if available],
USESTAR=$withval, USESTAR=yes)
AC_ARG_WITH(musa,
[ --without-musa Don't use Musashi C CPU core],
USEMUSA=$withval, USEMUSA=yes)
AC_MSG_CHECKING([whether StarScream is available])
if test x$ASM = xfalse -o \! -f star/star.c -o x$USESTAR = xno; then
AC_MSG_RESULT([no])
dnl We have to use musa
if test x$USEMUSA = xno; then
AC_MSG_ERROR([*** You have disabled both CPU cores. You need at least one.])
fi
CPUDIRS="$CPUDIRS musa"
MUSA="-Lmusa -lmusa68"
AC_DEFINE(COMPILE_WITH_MUSA)
else
AC_MSG_RESULT([yes])
if test x$USEMUSA \!= xno; then
CPUDIRS="$CPUDIRS musa"
MUSA="-Lmusa -lmusa68"
AC_DEFINE(COMPILE_WITH_MUSA)
fi
CPUDIRS="$CPUDIRS star"
STAR="star/starcpu.o"
AC_DEFINE(COMPILE_WITH_STAR)
fi
dnl Output variables
AC_SUBST(INTERFACE)
AC_SUBST(NASM)
AC_SUBST(NASM_FMT)
AC_SUBST(CHOP_)
AC_SUBST(CPUDIRS)
AC_SUBST(MUSA)
AC_SUBST(STAR)
AC_SUBST(MZ80)
AC_SUBST(EXTRAOBJS)
dnl Done!
AC_OUTPUT([
Makefile
star/Makefile
musa/Makefile
mz80/Makefile
sdl/Makefile
])
|