11 test "$cross_compiling" = "yes" || AC_C_BIGENDIAN
12 test "$ac_cv_c_bigendian" = "no" && ENDIAN="-DIS_LITTLE_ENDIAN"
16 AC_CHECK_FUNCS(usleep, ,[
17 AC_CHECK_FUNCS(select, ,[
18 AC_MSG_ERROR(your system must support either usleep or select)
24 LIBS="$LIBS -L/usr/local/lib -L/usr/X11R6/lib"
30 AC_ARG_WITH(fb, [ --with-fb build framebuffer device interface], [], [with_fb=yes])
31 AC_ARG_WITH(svgalib, [ --with-svgalib build Linux svgalib interface], [], [with_svgalib=yes])
32 AC_ARG_WITH(sdl, [ --with-sdl build SDL interface], [], [with_sdl=yes])
44 AC_CHECK_HEADERS(sys/soundcard.h, [SOUND=sys/oss/oss.o])
45 AC_CHECK_HEADERS(linux/joystick.h, [JOY=sys/linux/joy.o])
46 test "$with_fb" = "no" || AC_CHECK_HEADERS(linux/fb.h, [with_fb=linux])
50 AC_CHECK_HEADERS(machine/soundcard.h, [SOUND=sys/oss/oss.o])
54 AC_CHECK_HEADERS(soundcard.h, [SOUND=sys/oss/oss.o])
58 test "$SOUND" || SOUND=sys/dummy/nosound.o
59 test "$JOY" || JOY=sys/dummy/nojoy.o
67 linux) FB_OBJS="sys/linux/fbdev.o sys/linux/kb.o sys/pc/keymap.o" ;;
68 *) FB_OBJS="" ; with_fb=no ;;
71 if test "$with_svgalib" != "no" ; then
72 AC_CHECK_LIB(vga, vga_init, [
73 AC_CHECK_HEADERS(vga.h vgakeyboard.h, ,[
74 AC_MSG_WARN(svgalib found but headers are missing!!)
76 ])], [with_svgalib=no])
79 if test "$with_sdl" != "no" ; then
80 AC_CHECK_PROG(SDL_CONFIG, sdl-config, yes)
81 if test "$SDL_CONFIG" ; then
82 SDL_LIBS="`sdl-config --libs`"
83 SDL_CFLAGS="`sdl-config --cflags`"
85 INCS="$INCS $SDL_CFLAGS"
86 AC_CHECK_LIB(SDL, SDL_Init, [
87 AC_CHECK_HEADERS(SDL/SDL.h, ,[
88 AC_MSG_WARN(SDL found but headers are missing!!)
90 ])], [with_sdl=no], $SDL_LIBS)
99 if test "$no_x" != "yes" ; then
101 AC_CHECK_LIB(Xext, XShmCreateImage)
102 AC_CHECK_HEADERS(sys/ipc.h sys/shm.h X11/extensions/XShm.h)
103 test "$x_includes" && XINCS="-I$x_includes"
104 test "$x_libraries" && XLIBS="-L$x_libraries"
111 test "$with_x" = "no" || TARGETS="$TARGETS xgnuboy"
112 test "$with_fb" = "no" || TARGETS="$TARGETS fbgnuboy"
113 test "$with_svgalib" = "no" || TARGETS="$TARGETS sgnuboy"
114 test "$with_sdl" = "no" || TARGETS="$TARGETS sdlgnuboy"
125 AC_ARG_ENABLE(warnings, [ --enable-warnings enable selected compiler warnings], [], [enable_warnings=yes])
126 AC_ARG_ENABLE(debug, [ --enable-debug include debugging symbols], [])
127 AC_ARG_ENABLE(profile, [ --enable-profile enable performance profiling], [])
128 AC_ARG_ENABLE(arch, [ --enable-arch compile for specific host cpu architecture], [], [enable_arch=yes])
129 AC_ARG_ENABLE(optimize, [ --enable-optimize=LEVEL select optimization level (full,low,none)], [], [enable_optimize=yes])
130 AC_ARG_ENABLE(asm, [ --enable-asm use hand-optimized asm cores], [], [enable_asm=yes])
133 if test "$enable_warnings" = yes ; then
135 AC_MSG_RESULT(enabling selected compiler warnings)
136 CFLAGS="$CFLAGS -ansi -pedantic -Wall" ;;
138 AC_MSG_RESULT(disabling warnings for non-gcc compiler) ;;
142 if test "$enable_debug" = yes ; then
143 AC_MSG_RESULT(including debugging symbols)
147 if test "$enable_profile" = yes ; then
148 AC_MSG_RESULT(enabling performance profiling)
152 if test "$enable_arch" = yes ; then
153 if test `uname -s` = Linux -a -f /proc/cpuinfo ; then
154 case `grep "model name" /proc/cpuinfo` in
155 *AMD-K6*) enable_arch=k6 ;;
156 *Pentium*Pro*|*Pentium\ I*|*Klamath*) enable_arch=i686 ;;
157 *Pentium*|*586*) enable_arch=i586 ;;
158 *486*) enable_arch=i486 ;;
159 *386*) enable_arch=i386 ;;
165 #i686) enable_arch=i686 ;;
166 #i586) enable_arch=i586 ;;
167 #i486) enable_arch=i486 ;;
168 #i386) enable_arch=i386 ;;
169 #*) enable_arch=no ;;
175 case `$CC --version` in
179 case "$enable_arch" in
180 k6|i686|i586|i486|i386) CFLAGS="$CFLAGS -march=$enable_arch" ;;
182 *) AC_MSG_WARN(unknown architecture $enable_arch) ;;
187 case "$enable_arch" in
188 k6|i686|i586) AC_MSG_WARN(your compiler is too old to support $enable_arch optimizations) ;;
189 i486) CFLAGS="$CFLAGS -m486" ;;
190 i386) CFLAGS="$CFLAGS -m386" ;;
192 *) AC_MSG_WARN(unknown architecture $enable_arch) ;;
198 case "$enable_optimize" in
200 AC_MSG_RESULT(producing heavily optimized code)
205 i?86) CFLAGS="$CFLAGS -DALLOW_UNALIGNED_IO" ;;
208 #case `$CC --version` in
210 CFLAGS="$CFLAGS -fstrength-reduce -fthread-jumps \
211 -fcse-follow-jumps -fcse-skip-blocks -frerun-cse-after-loop \
212 -fexpensive-optimizations -fforce-addr"
215 #AC_MSG_WARN(your compiler is too old for fancy optimizations)
219 if test "$enable_debug" != yes -a "$enable_profile" != yes ; then
220 CFLAGS="$CFLAGS -fomit-frame-pointer"
221 LDFLAGS="$LDFLAGS -s"
226 AC_MSG_RESULT(using minimal optimizations)
227 CFLAGS="$CFLAGS -O3" ;;
231 if test "$enable_asm" = yes ; then
234 AC_MSG_RESULT(using optimized i386 cores)
235 ASM="-DUSE_ASM -I./asm/i386" ; ASM_OBJS="asm/i386/cpu.o asm/i386/lcd.o asm/i386/refresh.s" ;;
237 AC_MSG_RESULT(no optimized asm core available for `uname -m`) ;;
255 AC_CONFIG_HEADER(sys/nix/config.h)