-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.in
204 lines (137 loc) · 4.44 KB
/
configure.in
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
AC_INIT(cpu.c)
CFLAGS="$CFLAGS"
AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
test "$cross_compiling" = "yes" || AC_C_BIGENDIAN
test "$ac_cv_c_bigendian" = "no" && ENDIAN="-DIS_LITTLE_ENDIAN"
AC_CHECK_FUNCS(usleep, ,[
AC_CHECK_FUNCS(select, ,[
AC_MSG_ERROR(your system must support either usleep or select)
])])
LIBS="$LIBS -L/usr/local/lib -L/usr/X11R6/lib"
AC_ARG_WITH(fb, [ --with-fb build framebuffer device interface], [], [with_fb=yes])
AC_ARG_WITH(svgalib, [ --with-svgalib build Linux svgalib interface], [], [with_svgalib=yes])
AC_ARG_WITH(sdl, [ --with-sdl build SDL interface], [], [with_sdl=yes])
SOUND=""
JOY=""
case `uname -s` in
Linux)
SYS_DEFS=-DIS_LINUX
AC_CHECK_HEADERS(sys/soundcard.h, [SOUND=sys/oss/oss.o])
AC_CHECK_HEADERS(linux/joystick.h, [JOY=sys/linux/joy.o])
test "$with_fb" = "no" || AC_CHECK_HEADERS(linux/fb.h, [with_fb=linux])
;;
FreeBSD)
SYS_DEFS=-DIS_FBSD
AC_CHECK_HEADERS(machine/soundcard.h, [SOUND=sys/oss/oss.o])
;;
OpenBSD)
SYS_DEFS=-DIS_OBSD
AC_CHECK_HEADERS(soundcard.h, [SOUND=sys/oss/oss.o])
;;
esac
test "$SOUND" || SOUND=sys/dummy/nosound.o
test "$JOY" || JOY=sys/dummy/nojoy.o
case "$with_fb" in
linux) FB_OBJS="sys/linux/fbdev.o sys/linux/kb.o sys/pc/keymap.o" ;;
*) FB_OBJS="" ; with_fb=no ;;
esac
if test "$with_svgalib" != "no" ; then
AC_CHECK_LIB(vga, vga_init, [
AC_CHECK_HEADERS(vga.h vgakeyboard.h, ,[
AC_MSG_WARN(svgalib found but headers are missing!!)
with_svgalib=no
])], [with_svgalib=no])
fi
if test "$with_sdl" != "no" ; then
AC_CHECK_PROG(SDL_CONFIG, sdl-config, yes)
if test "$SDL_CONFIG" ; then
SDL_LIBS="`sdl-config --libs`"
SDL_CFLAGS="`sdl-config --cflags`"
old_incs="$INCS"
INCS="$INCS $SDL_CFLAGS"
AC_CHECK_LIB(SDL, SDL_Init, [
AC_CHECK_HEADERS(SDL/SDL.h, ,[
AC_MSG_WARN(SDL found but headers are missing!!)
with_sdl=no
])], [with_sdl=no], $SDL_LIBS)
INCS="$old_incs"
else
with_sdl=no
fi
fi
AC_PATH_X
if test "$no_x" != "yes" ; then
with_x=yes
AC_CHECK_LIB(Xext, XShmCreateImage)
AC_CHECK_HEADERS(sys/ipc.h sys/shm.h X11/extensions/XShm.h)
test "$x_includes" && XINCS="-I$x_includes"
test "$x_libraries" && XLIBS="-L$x_libraries"
else
with_x=no
fi
test "$with_x" = "no" || TARGETS="$TARGETS xgnuboy"
test "$with_fb" = "no" || TARGETS="$TARGETS fbgnuboy"
test "$with_svgalib" = "no" || TARGETS="$TARGETS sgnuboy"
test "$with_sdl" = "no" || TARGETS="$TARGETS sdlgnuboy"
AC_ARG_ENABLE(debug, [ --enable-debug include debugging symbols], [])
AC_ARG_ENABLE(profile, [ --enable-profile enable performance profiling], [])
AC_ARG_ENABLE(optimize, [ --enable-optimize=LEVEL select optimization level (full,low,none)], [], [enable_optimize=yes])
AC_ARG_ENABLE(asm, [ --enable-asm use hand-optimized asm cores], [], [enable_asm=yes])
if test "$enable_debug" = yes ; then
AC_MSG_RESULT(including debugging symbols)
CFLAGS="$CFLAGS -g"
fi
if test "$enable_profile" = yes ; then
AC_MSG_RESULT(enabling performance profiling)
CFLAGS="$CFLAGS -pg"
fi
case "$enable_optimize" in
yes|full)
AC_MSG_RESULT(producing heavily optimized code)
case `uname -m` in i?86)
test -f /proc/cpuinfo && case `grep "model name" /proc/cpuinfo` in
*AMD-K6*) case `$CC --version` in 2.9*) CFLAGS="$CFLAGS -march=k6" ;; esac ;;
*Pentium*Pro*|*Pentium\ I*|*Klamath*) case `$CC --version` in 2.9*) CFLAGS="$CFLAGS -march=i686" ;; esac ;;
*Pentium*|*586*) case `$CC --version` in 2.9*) CFLAGS="$CFLAGS -march=i586" ;; esac ;;
*486*) CFLAGS="$CFLAGS -m486" ;;
esac
CFLAGS="$CFLAGS -O3 -DALLOW_UNALIGNED_IO \
-fstrength-reduce -fthread-jumps \
-fcse-follow-jumps -fcse-skip-blocks -frerun-cse-after-loop \
-fschedule-insns -fschedule-insns2 -fexpensive-optimizations \
-fforce-mem -fforce-addr" ;;
*) CFLAGS="$CFLAGS -O3" ;;
esac
if test "$enable_debug" != yes -a "$enable_profile" != yes ; then
CFLAGS="$CFLAGS -fomit-frame-pointer"
LDFLAGS="$LDFLAGS -s"
fi ;;
low)
AC_MSG_RESULT(using minimal optimizations)
CFLAGS="$CFLAGS -O2" ;;
esac
if test "$enable_asm" = yes ; then
case `uname -m` in
i?86)
AC_MSG_RESULT(using optimized i386 cores)
ASM="-DUSE_ASM -I./asm/i386" ; ASM_OBJS="asm/i386/cpu.o asm/i386/lcd.o asm/i386/refresh.s" ;;
*)
AC_MSG_RESULT(no optimized asm core available for `uname -m`) ;;
esac
fi
AC_SUBST(SYS_DEFS)
AC_SUBST(ENDIAN)
AC_SUBST(SOUND)
AC_SUBST(JOY)
AC_SUBST(ASM)
AC_SUBST(ASM_OBJS)
AC_SUBST(FB_OBJS)
AC_SUBST(SDL_CFLAGS)
AC_SUBST(SDL_LIBS)
AC_SUBST(TARGETS)
AC_SUBST(XINCS)
AC_SUBST(XLIBS)
AC_CONFIG_HEADER(sys/nix/config.h)
AC_OUTPUT(Makefile)