-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
321 lines (277 loc) · 9.74 KB
/
configure.ac
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
311
312
313
314
315
# Process this file with autoconf to produce a configure script.
AC_INIT([gngeo],[0.9.3-cjp])
AC_CONFIG_SRCDIR([src/emu.c])
AC_CANONICAL_TARGET
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(silent-rules)
AM_SILENT_RULES
# it's not optimal, but at least, it work
if test -z "$CC_FOR_BUILD"; then
CC_FOR_BUILD=gcc
fi
AC_SUBST(CC_FOR_BUILD)
# Checks for programs.
AC_PROG_CC
AC_PROG_RANLIB
AM_PROG_AS
AC_DEFUN([GN_ARG_ENABLE],[
AC_ARG_ENABLE($1,[ $2],
[case "${enableval}" in
yes) enable_$1=true ;;
no) enable_$1=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-$1]) ;;
esac];$3,
[enable_$1=false];$4)
]
)
GN_ARG_ENABLE(gp2x, [--enable-gp2x Enable GP2X build])
GN_ARG_ENABLE(wiz, [--enable-wiz Enable WIZ build])
GN_ARG_ENABLE(wii, [--enable-wii Enable WII build])
GN_ARG_ENABLE(pandora, [--enable-pandora Enable PANDORA build])
GN_ARG_ENABLE(win32, [--enable-win32 Enable WIN32 build])
GN_ARG_ENABLE(dingux, [--enable-dingux Enable DINGUX build])
GN_ARG_ENABLE(embedded,[--enable-embedded Enable Embedded directory structure])
AC_SUBST(ROMPATH)
AC_ARG_WITH(rompath,[ --with-rompath=[path] Specify path to directory containing roms files], [ROMPATH="$withval"], [])
AC_SUBST(BIOSPATH)
AC_ARG_WITH(biospath,[ --with-biospath=[path] Specify path to directory containing bios files], [BIOSPATH="$withval"], [])
# Check for SDL
SDL_VERSION=1.2.0
AM_PATH_SDL($SDL_VERSION,,AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!]))
CFLAGS="$CFLAGS $SDL_CFLAGS"
LIBS="$LIBS $SDL_LIBS"
# Setup platform specific optimisation/source/cflags/libs/etc.
if test "x$enable_gp2x" = xtrue ; then
AC_DEFINE([GP2X],[1],[Define if you build for gp2x])
AC_DEFINE([ENABLE_940T],[1],[Define to process audio on the 940t])
CFLAGS="$CFLAGS -mtune=arm920t"
LIBS="$LIBS -lpthread -static";
enable_embedded=true
#PDEP_SOURCE=$PDEP_SOURCE 'gp2x.$(OBJEXT)'
fi
if test "x$enable_wiz" = xtrue ; then
AC_DEFINE([WIZ],[1],[Define if you build for wiz])
enable_embedded=true
# CFLAGS="$CFLAGS -mtune=arm920t"
# LIBS="$LIBS -lpthread -static";
fi
if test "x$enable_dingux" = xtrue ; then
AC_DEFINE([DINGUX],[1],[Define if you build for dingux])
enable_embedded=true
CFLAGS="$CFLAGS -mips32 -mtune=r4600 -mno-mips16 -msoft-float -fexpensive-optimizations -fomit-frame-pointer -frename-registers"
# LIBS="$LIBS -lpthread -static";
fi
if test "x$enable_pandora" = xtrue ; then
AC_DEFINE([PANDORA],[1],[Define if you build for pandora])
enable_embedded=true
# CFLAGS="$CFLAGS -mtune=arm920t"
# LIBS="$LIBS -lpthread -static";
fi
if test "x$enable_wii" = xtrue ; then
AC_DEFINE([WII],[1],[Define if you build for wii])
enable_embedded=true
CFLAGS="$CFLAGS -DGEKKO -mrvl -mcpu=750 -meabi -mhard-float -MMD -MP"
LIBS="$LIBS -lSDL -lfat -lwiiuse -lbte -logc -lm -lwiikeyboard";
fi
if test "x$enable_win32" = xtrue ; then
enable_embedded=true
AC_DEFINE([WIN32],[1],[Define if you build for win32])
NASMENV="--prefix_"
fi
if test "x$enable_embedded" = xtrue ; then
AC_DEFINE([EMBEDDED_FS],[1],[Define for embedded directory structure])
fi
# CFLAGS="$CFLAGS -DDATA_DIRECTORY=\"${pkgdatadir}\""
# Checks for libraries.
#AC_SUBST(LIBOBJS)
AC_CHECK_LIB([m], [acos])
AC_CHECK_LIB([z], [inflate])
AC_CHECK_FUNCS(getopt_long , , [ AC_LIBOBJ(getopt) AC_LIBOBJ(getopt1) ])
AC_CHECK_FUNCS(scandir)
AC_CHECK_FUNCS(basename)
AC_CHECK_FUNCS(mmap)
#have_nasm=false
use_starscream=false
use_raze=false
use_generator68k=false
use_cyclone=false
use_mamez80=false
#choice_68k=ko
#choice_z80=ko
# TODO: check mmx support
AC_ARG_ENABLE(i386asm, [ --disable-i386asm disable the use of i386 optimisation],
[case "${enableval}" in
yes) enablei386asm=true ;;
no) enablei386asm=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --disable-i386asm]) ;;
esac],
[enablei386asm=true])
AC_ARG_WITH(m68kcore,[ --with-m68kcore=[68kcore] Specify which 68k core to use (cyclone|starscream|gen68k)],
m68kcore="$withval", m68kcore="default")
AC_ARG_WITH(z80core, [ --with-z80core=[z80core] Specify which z80 core to use (drz80|raze|mamez80)],
z80core="$withval", z80core="default")
#echo $m68kcore
#echo $z80core
case $target_cpu in
i?86)
if test "$enablei386asm" = true ; then
AC_CHECK_PROG(have_nasm, nasm, true,false)
CFLAGS="$CFLAGS -m32 -DI386_ASM"
# PDEP_SOURCE=$PDEP_SOURCE 'gp2x.$(OBJEXT)'
else
have_nasm=false
fi
;;
esac
#setup default 68k core
if test $m68kcore = default ; then
case $target_cpu in
i?86)
if test x$have_name=xtrue ; then
m68kcore=starscream
else
m68kcore=gen68k
fi
;;
arm) m68kcore=cyclone
;;
*) m68kcore=gen68k
;;
esac
fi
#setup default z80 core
if test $z80core = default ; then
case $target_cpu in
i?86)
if test x$have_name=xtrue ; then
z80core=raze
else
z80core=mamez80
fi
;;
arm) z80core=drz80
;;
*) z80core=mamez80
;;
esac
fi
case "${m68kcore}" in
cyclone) use_cyclone=true
AC_DEFINE([USE_CYCLONE],[1],[Define to enable cyclone])
;;
starscream) use_starscream=true
AC_DEFINE([USE_STARSCREAM],[1],[Define to enable starscream])
;;
gen68k) use_generator68k=true
AC_DEFINE([USE_GENERATOR68K],[1],[Define to enable generator68k])
;;
*) AC_MSG_ERROR([The specified m68k core is invalid]) ;;
esac
case "${z80core}" in
drz80) use_drz80=true
AC_DEFINE([USE_DRZ80],[1],[Define to enable drz80])
;;
raze) use_raze=true
AC_DEFINE([USE_RAZE],[1],[Define to enable raze])
;;
mamez80) use_mamez80=true
AC_DEFINE([USE_MAMEZ80],[1],[Define to enable mamez80])
;;
*) AC_MSG_ERROR([The specified z80 core is invalid]) ;;
esac
AC_ARG_ENABLE(opengl, [ --disable-opengl disable opengl blitter],
[case "${enableval}" in
yes) enable_opengl=true ;;
no) enable_opengl=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --disable-opengl]) ;;
esac],
[enable_opengl=true])
if test "$enable_opengl" = true ; then
AC_CHECK_HEADERS(GL/gl.h)
AC_DEFINE([USE_GL2],[1],[Define to use alternative opengl blitter])
fi
AM_CONDITIONAL(HAVE_NASM,[test x$have_nasm = xtrue])
AM_CONDITIONAL(USE_STARSCREAM,[test x$use_starscream = xtrue])
AM_CONDITIONAL(USE_RAZE,[test x$use_raze = xtrue])
AM_CONDITIONAL(USE_GENERATOR68K,[test x$use_generator68k = xtrue])
AM_CONDITIONAL(USE_CYCLONE,[test x$use_cyclone = xtrue])
AM_CONDITIONAL(USE_MAMEZ80,[test x$use_mamez80 = xtrue])
AM_CONDITIONAL(USE_DRZ80,[test x$use_drz80 = xtrue])
AM_CONDITIONAL(USE_GUI,[test x$enable_gui = xtrue])
AM_CONDITIONAL(USE_GP2X,[test x$enable_gp2x = xtrue])
AM_CONDITIONAL(USE_WIZ,[test x$enable_wiz = xtrue])
# Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_CHECK_HEADERS([errno.h limits.h malloc.h stddef.h stdlib.h string.h sys/time.h unistd.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_HEADER_TIME
AC_STRUCT_TM
AC_C_BIGENDIAN
# Checks for library functions.
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([atexit floor gettimeofday memset mkdir pow strchr strstr strtoul])
# Check for processor.
case $target_cpu in
i?86) AC_MSG_RESULT(Turning on x86 processor optimisations)
AC_DEFINE(PROCESSOR_INTEL, 1, [Define if you have an x86 processor])
ALIGNLONGS=0
proc_i386=true
CFLAGS="$CFLAGS -O3 -fstrength-reduce -frerun-loop-opt -Wall -Wno-unused -funroll-loops \
-ffast-math -falign-functions=2 -falign-jumps=2 -fexpensive-optimizations \
-falign-loops=2 -fschedule-insns2 -malign-double -fomit-frame-pointer -g \
-fno-strict-aliasing -pipe -mtune=$target_cpu -DCPU=$target_cpu"
;;
x86_64)
AC_MSG_RESULT(Turning on x86_64 processor optimisations)
AC_DEFINE(PROCESSOR_ADM64, 1, [Define if you have an x86_64 processor])
ALIGNLONGS=0
proc_x64=true
CFLAGS="$CFLAGS -O3 -fstrength-reduce -frerun-loop-opt -Wall -Wno-unused -funroll-loops \
-ffast-math -fexpensive-optimizations \
-malign-double -fomit-frame-pointer -g \
-fno-strict-aliasing -pipe -DCPU=$target_cpu"
;;
sparc*) AC_MSG_RESULT(Turning on sparc processor optimisations)
AC_DEFINE(PROCESSOR_SPARC, 1, [Define if you have a sparc processor])
ALIGNLONGS=1
proc_sparc=true
if test $target_cpu = sparc64 && test $CC_MAJOR -ge 3 ; then
CFLAGS="$CFLAGS -mcpu=v9"
fi
CFLAGS="$CFLAGS -O3 -Wall -Wno-unused -funroll-loops \
-ffast-math -fomit-frame-pointer -g"
;;
arm) AC_MSG_RESULT(Turning on arm processor optimisations)
AC_DEFINE(PROCESSOR_ARM, 1, [Define if you have an ARM processor])
ALIGNLONGS=1
proc_arm=true
CFLAGS="$CFLAGS -O3 -Wall -ftracer -fstrength-reduce -Wno-unused -funroll-loops \
-fomit-frame-pointer -fstrict-aliasing -ffast-math \
"
;;
*) AC_MSG_RESULT(Processor type unknown - Use generic optimisations)
ALIGNLONGS=1
optimum=no
CFLAGS="$CFLAGS -O3 -Wall -Wno-unused -funroll-loops \
-ffast-math -g"
;;
esac
AM_CONDITIONAL(PROCESSOR_ARM,[test x$proc_arm = xtrue])
AC_DEFINE(ALIGNLONGS, ALIGNLONGS,
[Undefine if your processor can read unaligned 32-bit values])
AC_CONFIG_FILES([Makefile
gngeo.dat/Makefile
src/Makefile
src/raze/Makefile
src/star/Makefile
src/mamez80/Makefile
src/generator68k/Makefile
src/cyclone/Makefile
src/drz80/Makefile
src/effect/Makefile
src/blitter/Makefile
src/ym2610/Makefile])
AC_OUTPUT