5 # if user sets custom CFLAGS, don't enforce our optimization flags
6 test -n "$CFLAGS" && enable_optimize=no
13 test "$cross_compiling" = "yes" || AC_C_BIGENDIAN
14 test "$ac_cv_c_bigendian" = "no" && ENDIAN="-DIS_LITTLE_ENDIAN"
18 AC_CHECK_FUNCS(usleep, ,[
19 AC_CHECK_FUNCS(select, ,[
20 AC_MSG_ERROR(your system must support either usleep or select)
26 test "$cross_compiling" = "yes" || LIBS="$LIBS -L/usr/X11R6/lib"
32 AC_ARG_WITH(fb, [ --with-fb build framebuffer device interface], [], [with_fb=yes])
33 AC_ARG_WITH(svgalib, [ --with-svgalib build Linux svgalib interface], [], [with_svgalib=yes])
34 AC_ARG_WITH(sdl, [ --with-sdl build SDL interface], [], [with_sdl=yes])
35 AC_ARG_WITH(sdl, [ --with-sdl2 build SDL2 interface], [], [with_sdl2=yes])
36 AC_ARG_WITH(sound, [ --with-sound=no,oss,sdl,ao select sound interface], [], [with_sound=yes])
44 if test "$with_sound" != "no" ; then
45 if test "$with_sound" = "yes" || test "$with_sound" = "ao" ; then
46 AC_CHECK_HEADERS(ao/ao.h, [SOUND=sys/ao/ao.o ; LIBS="$LIBS -Wl,--as-needed -lao -Wl,--no-as-needed"])
48 if test -z "$SOUND" && ( test "$with_sound" = "yes" || test "$with_sound" = "sdl" ) ; then
49 AC_CHECK_HEADERS(SDL/SDL.h, [SOUND=sys/sdl/sdl-audio.o ; LIBS="$LIBS -lSDL"])
51 if test -z "$SOUND" && ( test "$with_sound" = "yes" || test "$with_sound" = "oss" ) ; then
52 AC_CHECK_HEADERS(sys/soundcard.h, [SOUND=sys/oss/oss.o ; CPPFLAGS="$CPPFLAGS -DHAVE_SYS_SOUNDCARD_H"], [
53 AC_CHECK_HEADERS(machine/soundcard.h, [SOUND=sys/oss/oss.o ; CPPFLAGS="$CPPFLAGS -DHAVE_MACHINE_SOUNDCARD_H"], [
54 AC_CHECK_HEADERS(soundcard.h, [SOUND=sys/oss/oss.o ; CPPFLAGS="$CPPFLAGS -DHAVE_SOUNDCARD_H"], [
55 test "$with_sound" = "oss" && AC_MSG_WARN(oss selected but required headers not found)
62 AC_CHECK_HEADERS(linux/joystick.h, [JOY=sys/linux/joy.o])
63 test "$with_fb" = "no" || AC_CHECK_HEADERS(linux/fb.h, [with_fb=linux])
65 test "$SOUND" || SOUND=sys/dummy/nosound.o
66 test "$JOY" || JOY=sys/dummy/nojoy.o
74 linux) FB_OBJS="sys/linux/fbdev.o sys/linux/kb.o sys/pc/keymap.o" ;;
75 *) FB_OBJS="" ; with_fb=no ;;
78 if test "$with_svgalib" != "no" ; then
79 AC_CHECK_LIB(vga, vga_init, [
80 AC_CHECK_HEADERS(vga.h vgakeyboard.h, ,[
81 AC_MSG_WARN(svgalib found but headers are missing!!)
83 ])], [with_svgalib=no])
86 if test "$with_sdl2" != no ; then
88 AC_CHECK_LIB(SDL2, SDL_Init, [
89 AC_CHECK_HEADERS(SDL2/SDL.h, ,[
90 AC_MSG_WARN(SDL2 found but headers are missing!!)
92 ])], [with_sdl2=no], $SDL2_LIBS)
95 if test "$with_sdl" != "no" ; then
96 AC_CHECK_PROG(SDL_CONFIG, sdl-config, yes)
97 if test "$SDL_CONFIG" ; then
98 SDL_LIBS="`sdl-config --libs`"
99 SDL_CFLAGS="`sdl-config --cflags`"
101 INCS="$INCS $SDL_CFLAGS"
102 AC_CHECK_LIB(SDL, SDL_Init, [
103 AC_CHECK_HEADERS(SDL/SDL.h, ,[
104 AC_MSG_WARN(SDL found but headers are missing!!)
106 ])], [with_sdl=no], $SDL_LIBS)
115 AH_TEMPLATE(HAVE_LIBXEXT)
116 if test "$no_x" != "yes" ; then
118 AC_CHECK_LIB(Xext, XShmCreateImage, [AC_DEFINE(HAVE_LIBXEXT)])
119 AC_CHECK_HEADERS(sys/ipc.h sys/shm.h X11/Xlib.h X11/Xutil.h X11/keysym.h X11/extensions/XShm.h, [], [], [[
120 #include <X11/Xlib.h>
121 #include <X11/Xutil.h>
122 #include <X11/keysym.h>
124 #define _XOPEN_SOURCE
126 test "$x_includes" && XINCS="-I$x_includes"
127 test "$x_libraries" && XLIBS="-L$x_libraries"
134 test "$with_x" = "no" || TARGETS="$TARGETS xgnuboy"
135 test "$with_fb" = "no" || TARGETS="$TARGETS fbgnuboy"
136 test "$with_svgalib" = "no" || TARGETS="$TARGETS sgnuboy"
137 test "$with_sdl" = "no" || TARGETS="$TARGETS sdlgnuboy"
138 test "$with_sdl2" = "no" || TARGETS="$TARGETS sdl2gnuboy"
149 AC_ARG_ENABLE(warnings, [ --enable-warnings enable selected compiler warnings], [], [enable_warnings=yes])
150 AC_ARG_ENABLE(debug, [ --enable-debug include debugging symbols], [])
151 AC_ARG_ENABLE(profile, [ --enable-profile enable performance profiling], [])
152 AC_ARG_ENABLE(arch, [ --enable-arch compile for specific host cpu architecture], [], [enable_arch=no])
153 AC_ARG_ENABLE(optimize, [ --enable-optimize=LEVEL select optimization level (full,low,none)], [], [enable_optimize=yes])
154 AC_ARG_ENABLE(asm, [ --enable-asm use hand-optimized asm cores], [], [enable_asm=yes])
157 if test "$enable_warnings" = yes ; then
159 AC_MSG_RESULT(enabling selected compiler warnings)
160 CFLAGS="$CFLAGS -ansi -pedantic -Wall" ;;
162 AC_MSG_RESULT(disabling warnings for non-gcc compiler) ;;
166 if test "$enable_debug" = yes ; then
167 AC_MSG_RESULT(including debugging symbols)
171 if test "$enable_profile" = yes ; then
172 AC_MSG_RESULT(enabling performance profiling)
176 if test "$enable_arch" = yes ; then
177 CFLAGS="$CFLAGS -march=native"
180 case "$enable_optimize" in
182 AC_MSG_RESULT(producing heavily optimized code)
186 case `$CC -dumpmachine` in
187 x86_64*|i?86*) CFLAGS="$CFLAGS -DALLOW_UNALIGNED_IO" ;;
190 CFLAGS="$CFLAGS -fstrength-reduce -fthread-jumps \
191 -fcse-follow-jumps -fcse-skip-blocks -frerun-cse-after-loop \
192 -fexpensive-optimizations -fforce-addr"
194 if test "$enable_debug" != yes -a "$enable_profile" != yes ; then
195 CFLAGS="$CFLAGS -fomit-frame-pointer"
196 LDFLAGS="$LDFLAGS -s"
201 AC_MSG_RESULT(using minimal optimizations)
202 CFLAGS="$CFLAGS -O3" ;;
206 if test "$enable_asm" = yes ; then
207 case `$CC -dumpmachine` in
209 AC_MSG_RESULT(using optimized i386 cores)
210 ASM="-DUSE_ASM -I./asm/i386" ; ASM_OBJS="asm/i386/cpu.o asm/i386/lcd.o asm/i386/refresh.s" ;;
212 AC_MSG_RESULT(no optimized asm core available for `$CC -dumpmachine`) ;;
231 AC_CONFIG_HEADER(sys/nix/config.h)