sdl backend: default to fullscreen off
[rofl0r-gnuboy.git] / configure.in
blob6c214078fa381e73cb544da2e3a50d17adb2bf7d
2 AC_INIT(cpu.c)
4 CFLAGS="$CFLAGS"
6 AC_PROG_CC
7 AC_PROG_CPP
8 AC_PROG_INSTALL
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)
19 ])])
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])
38 SOUND=""
39 JOY=""
41 case `uname -s` in
42 Linux)
43 SYS_DEFS=-DIS_LINUX
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])
48 FreeBSD)
49 SYS_DEFS=-DIS_FBSD
50 AC_CHECK_HEADERS(machine/soundcard.h, [SOUND=sys/oss/oss.o])
52 OpenBSD)
53 SYS_DEFS=-DIS_OBSD
54 AC_CHECK_HEADERS(soundcard.h, [SOUND=sys/oss/oss.o])
56 esac
58 test "$SOUND" || SOUND=sys/dummy/nosound.o
59 test "$JOY" || JOY=sys/dummy/nojoy.o
66 case "$with_fb" in
67 linux) FB_OBJS="sys/linux/fbdev.o sys/linux/kb.o sys/pc/keymap.o" ;;
68 *) FB_OBJS="" ; with_fb=no ;;
69 esac
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!!)
75 with_svgalib=no
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`"
84 old_incs="$INCS"
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!!)
89 with_sdl=no
90 ])], [with_sdl=no], $SDL_LIBS)
91 INCS="$old_incs"
92 else
93 with_sdl=no
97 AC_PATH_X
99 if test "$no_x" != "yes" ; then
100 with_x=yes
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"
105 else
106 with_x=no
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
134 case "$CC" in *gcc*)
135 AC_MSG_RESULT(enabling selected compiler warnings)
136 CFLAGS="$CFLAGS -ansi -pedantic -Wall" ;;
138 AC_MSG_RESULT(disabling warnings for non-gcc compiler) ;;
139 esac
142 if test "$enable_debug" = yes ; then
143 AC_MSG_RESULT(including debugging symbols)
144 CFLAGS="$CFLAGS -g"
147 if test "$enable_profile" = yes ; then
148 AC_MSG_RESULT(enabling performance profiling)
149 CFLAGS="$CFLAGS -pg"
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 ;;
160 *) enable_arch=no ;;
161 esac
162 else
163 enable_arch=no
164 #case `uname -m` in
165 #i686) enable_arch=i686 ;;
166 #i586) enable_arch=i586 ;;
167 #i486) enable_arch=i486 ;;
168 #i386) enable_arch=i386 ;;
169 #*) enable_arch=no ;;
170 #esac
175 case `$CC --version` in
177 2.9*|3.*)
179 case "$enable_arch" in
180 k6|i686|i586|i486|i386) CFLAGS="$CFLAGS -march=$enable_arch" ;;
181 no) ;;
182 *) AC_MSG_WARN(unknown architecture $enable_arch) ;;
183 esac ;;
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" ;;
191 no) ;;
192 *) AC_MSG_WARN(unknown architecture $enable_arch) ;;
193 esac ;;
195 esac
198 case "$enable_optimize" in
199 yes|full)
200 AC_MSG_RESULT(producing heavily optimized code)
202 CFLAGS="$CFLAGS -O3"
204 case `uname -m` in
205 i?86) CFLAGS="$CFLAGS -DALLOW_UNALIGNED_IO" ;;
206 esac
208 #case `$CC --version` in
209 #2.9*|3.*)
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)
217 #esac
219 if test "$enable_debug" != yes -a "$enable_profile" != yes ; then
220 CFLAGS="$CFLAGS -fomit-frame-pointer"
221 LDFLAGS="$LDFLAGS -s"
222 fi ;;
224 low)
226 AC_MSG_RESULT(using minimal optimizations)
227 CFLAGS="$CFLAGS -O3" ;;
229 esac
231 if test "$enable_asm" = yes ; then
232 case `uname -m` in
233 i?86)
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`) ;;
238 esac
242 AC_SUBST(SYS_DEFS)
243 AC_SUBST(ENDIAN)
244 AC_SUBST(SOUND)
245 AC_SUBST(JOY)
246 AC_SUBST(ASM)
247 AC_SUBST(ASM_OBJS)
248 AC_SUBST(FB_OBJS)
249 AC_SUBST(SDL_CFLAGS)
250 AC_SUBST(SDL_LIBS)
251 AC_SUBST(TARGETS)
252 AC_SUBST(XINCS)
253 AC_SUBST(XLIBS)
255 AC_CONFIG_HEADER(sys/nix/config.h)
256 AC_OUTPUT(Makefile)