Commit | Line | Data |
---|---|---|
4132e8ca | 1 | #!/bin/sh |
2 | # some elements originated from qemu configure | |
3 | set -e | |
4 | ||
5 | TMPC="/tmp/pcsx-conf-${RANDOM}-$$-${RANDOM}.c" | |
6 | TMPO="/tmp/pcsx-conf-${RANDOM}-$$-${RANDOM}.o" | |
07c13dfd | 7 | TMPB="/tmp/pcsx-conf-${RANDOM}-$$-${RANDOM}" |
8 | trap "rm -f $TMPC $TMPO $TMPB" EXIT INT QUIT TERM | |
4132e8ca | 9 | rm -f config.log |
10 | ||
11 | compile_object() | |
12 | { | |
07c13dfd | 13 | c="$CC $CFLAGS -c $TMPC -o $TMPO $@" |
14 | echo $c >> config.log | |
15 | $c >> config.log 2>&1 | |
16 | } | |
17 | ||
18 | compile_binary() | |
19 | { | |
20 | c="$CC $CFLAGS $TMPC -o $TMPB $LDFLAGS $MAIN_LDLIBS $@" | |
4132e8ca | 21 | echo $c >> config.log |
22 | $c >> config.log 2>&1 | |
23 | } | |
24 | ||
25 | check_define() | |
26 | { | |
fad9f755 | 27 | $CC -E -dD $CFLAGS include/arm_features.h | grep -v '#undef' | grep -q "$1" || return 1 |
cc376814 | 28 | return 0 |
29 | } | |
30 | ||
31 | check_define_val() | |
32 | { | |
fad9f755 | 33 | $CC -E -dD $CFLAGS include/arm_features.h | grep -v '#undef' | grep "$1" | awk '{print $3}' |
4132e8ca | 34 | return 0 |
35 | } | |
36 | ||
37 | # setting options to "yes" or "no" will make that choice default, | |
38 | # "" means "autodetect". | |
39 | ||
fad9f755 | 40 | platform_list="generic pandora maemo caanoo" |
4132e8ca | 41 | platform="generic" |
5ddc3a7a | 42 | builtin_gpu_list="neon peops unai" |
a4c71501 | 43 | dynarec_list="ari64 lightrec none" |
61bc6d40 | 44 | builtin_gpu="" |
fad9f755 | 45 | sound_driver_list="oss alsa pulseaudio sdl" |
07c13dfd | 46 | sound_drivers="" |
60ff60f5 | 47 | plugins="" |
4132e8ca | 48 | drc_cache_base="no" |
00a212aa | 49 | have_armv5="" |
4132e8ca | 50 | have_armv6="" |
51 | have_armv7="" | |
52 | have_arm_neon="" | |
57467c77 | 53 | have_arm_neon_asm="" |
49040d98 | 54 | have_neon_gpu="" |
4132e8ca | 55 | have_tslib="" |
f49a4c48 | 56 | have_evdev="" |
5b9aa749 | 57 | have_gles="" |
5514a050 | 58 | have_c64x_dsp="" |
f49a4c48 | 59 | have_fsections="yes" |
2e4073b2 | 60 | have_dynamic="yes" |
f49a4c48 | 61 | gnu_linker="yes" |
a4c71501 | 62 | dynarec="" |
fad9f755 | 63 | multithreading="yes" |
f89fa2d9 | 64 | need_sdl="no" |
955f9af0 | 65 | need_xlib="no" |
cc56203b | 66 | need_libpicofe="yes" |
67 | need_warm="no" | |
5b9aa749 | 68 | CFLAGS_GLES="" |
69 | LDLIBS_GLES="" | |
4132e8ca | 70 | # these are for known platforms |
71 | optimize_cortexa8="no" | |
72 | optimize_arm926ej="no" | |
73 | ||
74 | # hardcoded stuff | |
f49a4c48 | 75 | case "${OSTYPE}" in |
76 | *BSD*|*darwin*) | |
77 | CC="clang" | |
78 | CXX="clang++" | |
79 | if test -d /opt/local/include; then | |
80 | # MacPorts | |
81 | CFLAGS="$CFLAGS -I/opt/local/include" | |
82 | LDFLAGS="$LDFLAGS -L/opt/local/lib" | |
83 | fi | |
84 | if test -d /opt/local/include; then | |
85 | CFLAGS="$CFLAGS -I/usr/local/include" | |
86 | LDFLAGS="$LDFLAGS -L/usr/local/lib" | |
87 | fi | |
88 | MAKE=gmake | |
89 | gnu_linker="no" | |
90 | ;; | |
91 | *) | |
92 | CC="${CC-${CROSS_COMPILE}gcc}" | |
93 | CXX="${CXX-${CROSS_COMPILE}g++}" | |
94 | ;; | |
95 | esac | |
4132e8ca | 96 | AS="${AS-${CROSS_COMPILE}as}" |
97 | AR="${AS-${CROSS_COMPILE}ar}" | |
9aff1963 | 98 | MAIN_LDLIBS="$LDLIBS -ldl -lm -lpthread" |
4132e8ca | 99 | config_mak="config.mak" |
100 | ||
f49a4c48 | 101 | case "${OSTYPE}" in |
102 | *BSD*|*darwin*) | |
103 | SYSROOT="$sysroot" | |
104 | [ "x${SDL_CONFIG}" = "x" ] && SDL_CONFIG="${SYSROOT}/usr/local/bin/sdl-config" | |
105 | ;; | |
106 | *) | |
107 | SYSROOT="$(${CC} --print-sysroot 2> /dev/null || true)" | |
108 | [ "x${SDL_CONFIG}" = "x" ] && SDL_CONFIG="${SYSROOT}/usr/bin/sdl-config" | |
109 | ;; | |
110 | esac | |
3d037671 | 111 | |
07c13dfd | 112 | fail() |
113 | { | |
114 | echo "$@" | |
5d53bb85 | 115 | if test -n "$DUMP_CONFIG_LOG"; then cat config.log; fi |
07c13dfd | 116 | exit 1 |
117 | } | |
118 | ||
4132e8ca | 119 | # call during arg parsing, so that cmd line can override platform defaults |
120 | set_platform() | |
121 | { | |
122 | platform=$1 | |
123 | case "$platform" in | |
124 | generic) | |
125 | ;; | |
126 | pandora) | |
07c13dfd | 127 | sound_drivers="oss alsa" |
4132e8ca | 128 | drc_cache_base="yes" |
129 | optimize_cortexa8="yes" | |
130 | have_arm_neon="yes" | |
49040d98 | 131 | have_neon_gpu="yes" |
955f9af0 | 132 | need_xlib="yes" |
fad9f755 | 133 | multithreading="no" |
4132e8ca | 134 | ;; |
135 | maemo) | |
4132e8ca | 136 | drc_cache_base="yes" |
137 | optimize_cortexa8="yes" | |
138 | have_arm_neon="yes" | |
49040d98 | 139 | have_neon_gpu="yes" |
fad9f755 | 140 | multithreading="no" |
4132e8ca | 141 | ;; |
142 | caanoo) | |
07c13dfd | 143 | sound_drivers="oss" |
4132e8ca | 144 | drc_cache_base="yes" |
145 | optimize_arm926ej="yes" | |
cc56203b | 146 | need_warm="yes" |
fad9f755 | 147 | multithreading="no" |
38c2028e | 148 | ;; |
4132e8ca | 149 | *) |
07c13dfd | 150 | fail "unsupported platform: $platform" |
4132e8ca | 151 | ;; |
152 | esac | |
153 | } | |
154 | ||
155 | for opt do | |
156 | optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'` || true | |
157 | case "$opt" in | |
158 | --help|-h) show_help="yes" | |
159 | ;; | |
160 | --platform=*) set_platform "$optarg" | |
161 | ;; | |
61bc6d40 | 162 | --gpu=*) builtin_gpu="$optarg" |
163 | ;; | |
07c13dfd | 164 | --sound-drivers=*) sound_drivers="$optarg" |
4132e8ca | 165 | ;; |
166 | --enable-neon) have_arm_neon="yes" | |
167 | ;; | |
168 | --disable-neon) have_arm_neon="no" | |
169 | ;; | |
fad9f755 | 170 | --enable-threads) multithreading="yes" |
171 | ;; | |
172 | --disable-threads) multithreading="no" | |
173 | ;; | |
2e4073b2 A |
174 | --enable-dynamic) have_dynamic="yes" |
175 | ;; | |
176 | --disable-dynamic) have_dynamic="no" | |
177 | ;; | |
a4c71501 | 178 | --dynarec=*) dynarec="$optarg" |
179 | ;; | |
180 | --disable-dynarec) dynarec="no" | |
4132e8ca | 181 | ;; |
182 | *) echo "ERROR: unknown option $opt"; show_help="yes" | |
183 | ;; | |
184 | esac | |
185 | done | |
186 | ||
187 | if [ "$show_help" = "yes" ]; then | |
188 | echo "options:" | |
189 | echo " --help print this message" | |
190 | echo " --platform=NAME target platform [$platform]" | |
191 | echo " available: $platform_list" | |
61bc6d40 | 192 | echo " --gpu=NAME builtin gpu plugin [guessed]" |
193 | echo " available: $builtin_gpu_list" | |
07c13dfd | 194 | echo " --sound-drivers=LIST sound output drivers [guessed]" |
4132e8ca | 195 | echo " available: $sound_driver_list" |
196 | echo " --enable-neon" | |
197 | echo " --disable-neon enable/disable ARM NEON optimizations [guessed]" | |
fad9f755 | 198 | echo " --enable-threads" |
199 | echo " --disable-threads enable/disable multithreaded features [guessed]" | |
2e4073b2 A |
200 | echo " --enable-dynamic" |
201 | echo " --disable-dynamic enable/disable dynamic loading obj. eg.plugins [guessed]" | |
a4c71501 | 202 | echo " --dynarec=NAME select dynamic recompiler [guessed]" |
203 | echo " available: $dynarec_list" | |
4132e8ca | 204 | echo "influential environment variables:" |
ac6575cd | 205 | echo " CROSS_COMPILE CC CXX AS AR CFLAGS ASFLAGS LDFLAGS LDLIBS" |
4132e8ca | 206 | exit 1 |
207 | fi | |
208 | ||
07c13dfd | 209 | # validate selections |
61bc6d40 | 210 | if [ "x$builtin_gpu" != "x" ]; then |
07c13dfd | 211 | if ! echo $builtin_gpu_list | grep -q "\<$builtin_gpu\>"; then |
212 | fail "unsupported builtin gpu plugin: $builtin_gpu" | |
213 | fi | |
61bc6d40 | 214 | fi |
215 | ||
07c13dfd | 216 | if [ "x$sound_drivers" != "x" ]; then |
217 | for d in $sound_drivers; do | |
218 | if ! echo $sound_driver_list | grep -q "\<$d\>"; then | |
219 | fail "unsupported sound driver: $sound_driver" | |
220 | fi | |
221 | done | |
222 | fi | |
4132e8ca | 223 | |
cc56203b | 224 | if [ "$need_libpicofe" = "yes" ]; then |
225 | if ! test -f "frontend/libpicofe/README"; then | |
226 | fail "libpicofe is missing, please run 'git submodule init && git submodule update'" | |
227 | fi | |
228 | fi | |
229 | ||
230 | if [ "$need_warm" = "yes" ]; then | |
231 | if ! test -f "frontend/warm/README"; then | |
232 | fail "wARM is missing, please run 'git submodule init && git submodule update'" | |
233 | fi | |
234 | fi | |
235 | ||
00a212aa | 236 | # basic compiler test |
237 | cat > $TMPC <<EOF | |
238 | #include <zlib.h> | |
239 | int main(void) { return 0; } | |
240 | EOF | |
241 | if ! compile_binary; then | |
0dc1b4a9 | 242 | fail "compiler test failed, please check config.log" |
00a212aa | 243 | fi |
244 | ||
4132e8ca | 245 | if [ -z "$ARCH" ]; then |
0dc1b4a9 | 246 | ARCH=`$CC -dumpmachine | awk -F '-' '{print $1}'` |
4132e8ca | 247 | fi |
248 | ||
0dc1b4a9 | 249 | case "$ARCH" in |
f49a4c48 | 250 | aarch64|arm64) |
251 | have_arm_neon="yes" | |
49040d98 | 252 | have_neon_gpu="yes" |
f49a4c48 | 253 | have_arm_neon_asm="no" |
254 | if [ "x$dynarec" = "x" ]; then | |
255 | dynarec="ari64" | |
256 | fi | |
f49a4c48 | 257 | ;; |
0dc1b4a9 | 258 | arm*) |
259 | # ARM stuff | |
260 | ARCH="arm" | |
261 | ||
4132e8ca | 262 | if [ "$optimize_cortexa8" = "yes" ]; then |
4132e8ca | 263 | CFLAGS="$CFLAGS -mcpu=cortex-a8 -mtune=cortex-a8" |
264 | ASFLAGS="$ASFLAGS -mcpu=cortex-a8" | |
265 | fi | |
266 | if [ "$optimize_arm926ej" = "yes" ]; then | |
267 | CFLAGS="$CFLAGS -mcpu=arm926ej-s -mtune=arm926ej-s" | |
268 | ASFLAGS="$ASFLAGS -mcpu=arm926ej-s -mfloat-abi=softfp" | |
269 | fi | |
270 | ||
271 | if [ "x$have_arm_neon" = "x" ]; then | |
57467c77 | 272 | # detect NEON from user-supplied cflags to enable neon code |
4132e8ca | 273 | have_arm_neon=`check_define __ARM_NEON__ && echo yes` || true |
274 | fi | |
4132e8ca | 275 | if [ "x$have_armv7" = "x" ]; then |
00a212aa | 276 | if check_define HAVE_ARMV7; then |
4132e8ca | 277 | have_armv7="yes" |
00a212aa | 278 | have_armv6="yes" |
279 | have_armv5="yes" | |
4132e8ca | 280 | fi |
281 | fi | |
00a212aa | 282 | if [ "x$have_armv6" = "x" ]; then |
283 | if check_define HAVE_ARMV6; then | |
284 | have_armv6="yes" | |
285 | have_armv5="yes" | |
286 | fi | |
287 | fi | |
288 | if [ "x$have_armv5" = "x" ]; then | |
289 | have_armv5=`check_define HAVE_ARMV5 && echo yes` || true | |
290 | fi | |
4132e8ca | 291 | |
a4c71501 | 292 | if [ "x$dynarec" = "x" ]; then |
293 | dynarec="ari64" | |
294 | fi | |
295 | ||
4132e8ca | 296 | if [ "$have_arm_neon" = "yes" ]; then |
49040d98 | 297 | have_neon_gpu="yes" |
40cf6975 | 298 | fpu="neon" |
4132e8ca | 299 | elif [ "$have_armv6" = "yes" ]; then |
40cf6975 | 300 | fpu="vfp" |
4132e8ca | 301 | fi |
49040d98 | 302 | # automatically set mfpu and mfloat-abi if they are not set |
40cf6975 | 303 | if [ "x$fpu" != "x" ]; then |
304 | echo "$CFLAGS" | grep -q -- '-mfpu=' || CFLAGS="$CFLAGS -mfpu=$fpu" | |
305 | echo "$ASFLAGS" | grep -q -- '-mfpu=' || ASFLAGS="$ASFLAGS -mfpu=$fpu" | |
306 | floatabi_set_by_gcc=`$CC -v 2>&1 | grep -q -- --with-float= && echo yes` || true | |
307 | if [ "$floatabi_set_by_gcc" != "yes" ]; then | |
308 | echo "$CFLAGS" | grep -q -- '-mfloat-abi=' || CFLAGS="$CFLAGS -mfloat-abi=softfp" | |
309 | echo "$ASFLAGS" | grep -q -- '-mfloat-abi=' || ASFLAGS="$ASFLAGS -mfloat-abi=softfp" | |
310 | fi | |
4132e8ca | 311 | fi |
312 | ||
9f704290 | 313 | # must disable thumb as recompiler can't handle it |
96751f36 | 314 | if check_define __thumb__; then |
9f704290 | 315 | CFLAGS="$CFLAGS -marm" |
96751f36 | 316 | fi |
00a212aa | 317 | |
318 | # warn about common mistakes | |
319 | if [ "$have_armv5" != "yes" ]; then | |
320 | if ! echo "$CFLAGS" | grep -q -- '-mcpu=\|-march='; then | |
321 | echo "Warning: compiling for ARMv4, is that really what you want?" | |
322 | echo "You probably should specify -mcpu= or -march= like this:" | |
323 | echo " CFLAGS=-march=armv6 ./configure ..." | |
324 | fi | |
325 | fi | |
326 | if [ "$have_arm_neon" = "yes" -a "$have_armv7" != "yes" ]; then | |
327 | echo "Warning: compiling for NEON, but not ARMv7?" | |
328 | echo "You probably want to specify -mcpu= or -march= like this:" | |
329 | echo " CFLAGS=-march=armv7-a ./configure ..." | |
330 | fi | |
57467c77 | 331 | have_arm_neon_asm=$have_arm_neon |
0dc1b4a9 | 332 | ;; |
af486d6e | 333 | x86_64) |
a4c71501 | 334 | if [ "x$dynarec" = "x" ]; then |
335 | dynarec="lightrec" | |
336 | fi | |
49040d98 | 337 | have_neon_gpu="yes" |
af486d6e | 338 | ;; |
0dc1b4a9 | 339 | *) |
a4c71501 | 340 | if [ "x$dynarec" = "x" ]; then |
341 | dynarec="lightrec" | |
342 | fi | |
0dc1b4a9 | 343 | ;; |
344 | esac | |
4132e8ca | 345 | |
61bc6d40 | 346 | if [ "x$builtin_gpu" = "x" ]; then |
49040d98 | 347 | if [ "$have_neon_gpu" = "yes" ]; then |
348 | builtin_gpu="neon" | |
349 | elif [ "$ARCH" = "arm" -a "$have_armv7" != "yes" ]; then | |
350 | # pre-ARMv7 hardware is usually not fast enough for peops | |
351 | builtin_gpu="unai" | |
352 | else | |
353 | builtin_gpu="peops" | |
354 | fi | |
61bc6d40 | 355 | fi |
356 | ||
4132e8ca | 357 | # supposedly we can avoid -fPIC on armv5 for slightly better performace? |
358 | if [ "$ARCH" != "arm" -o "$have_armv6" = "yes" ]; then | |
359 | PLUGIN_CFLAGS="$PLUGIN_CFLAGS -fPIC" | |
a28b8a4b A |
360 | else |
361 | PLUGIN_CFLAGS="$PLUGIN_CFLAGS -fno-PIC" | |
4132e8ca | 362 | fi |
363 | ||
38c2028e | 364 | case "$platform" in |
365 | generic) | |
f89fa2d9 | 366 | need_sdl="yes" |
38c2028e | 367 | ;; |
368 | maemo) | |
7010034e | 369 | CFLAGS="$CFLAGS -DMAEMO -DMAEMO_CHANGES" |
38c2028e | 370 | ;; |
38c2028e | 371 | esac |
4132e8ca | 372 | |
07c13dfd | 373 | # header/library presence tests |
374 | check_zlib() | |
375 | { | |
376 | cat > $TMPC <<EOF | |
377 | #include <zlib.h> | |
791f6e3e | 378 | int main(void) { uncompress(0, 0, 0, 0); } |
07c13dfd | 379 | EOF |
380 | compile_binary | |
381 | } | |
382 | ||
07c13dfd | 383 | check_libpng() |
384 | { | |
385 | cat > $TMPC <<EOF | |
386 | #include <png.h> | |
387 | void main() { png_init_io(0, 0); } | |
388 | EOF | |
389 | compile_binary | |
390 | } | |
391 | ||
392 | check_oss() | |
393 | { | |
394 | cat > $TMPC <<EOF | |
395 | #include <sys/soundcard.h> | |
396 | #include <sys/ioctl.h> | |
397 | void main() { int a=0; ioctl(0, SNDCTL_DSP_SETFMT, &a); } | |
398 | EOF | |
399 | compile_binary | |
400 | } | |
401 | ||
402 | check_alsa() | |
403 | { | |
404 | cat > $TMPC <<EOF | |
405 | #include <alsa/asoundlib.h> | |
406 | void main() { snd_pcm_open(0, 0, 0, 0); } | |
407 | EOF | |
408 | compile_binary "$@" | |
409 | } | |
410 | ||
b68bf5c2 | 411 | check_pulseaudio() |
412 | { | |
413 | cat > $TMPC <<EOF | |
414 | #include <pulse/pulseaudio.h> | |
415 | void main() { pa_threaded_mainloop_new(); } | |
416 | EOF | |
417 | compile_binary "$@" | |
418 | } | |
419 | ||
07c13dfd | 420 | check_sdl() |
421 | { | |
422 | cat > $TMPC <<EOF | |
423 | #include <SDL.h> | |
f49a4c48 | 424 | int main(int argc, char *argv[]) { SDL_OpenAudio(0, 0); } |
07c13dfd | 425 | EOF |
426 | compile_binary "$@" | |
427 | } | |
428 | ||
955f9af0 | 429 | check_xlib_headers() |
430 | { | |
431 | cat > $TMPC <<EOF | |
432 | #include <X11/Xlib.h> | |
433 | void *f() { return XOpenDisplay(0); } | |
434 | EOF | |
435 | compile_object "$@" | |
436 | } | |
437 | ||
5514a050 | 438 | # see if we have c64_tools for TI C64x DSP |
439 | check_c64_tools() | |
440 | { | |
441 | cat > $TMPC <<EOF | |
442 | #include <inc_libc64_mini.h> | |
443 | int f() { return dsp_open(); } | |
444 | EOF | |
445 | compile_object "$@" | |
446 | } | |
447 | ||
f89fa2d9 | 448 | MAIN_LDLIBS="$MAIN_LDLIBS -lz" |
9f704290 | 449 | check_zlib || fail "please install zlib (libz-dev)" |
f89fa2d9 | 450 | |
f89fa2d9 | 451 | MAIN_LDLIBS="-lpng $MAIN_LDLIBS" |
9f704290 | 452 | check_libpng || fail "please install libpng (libpng-dev)" |
07c13dfd | 453 | |
454 | # find what audio support we can compile | |
455 | if [ "x$sound_drivers" = "x" ]; then | |
456 | if check_oss; then sound_drivers="$sound_drivers oss"; fi | |
f89fa2d9 | 457 | if check_alsa -lasound; then |
458 | sound_drivers="$sound_drivers alsa" | |
459 | MAIN_LDLIBS="-lasound $MAIN_LDLIBS" | |
460 | fi | |
b68bf5c2 | 461 | if check_pulseaudio -lpulse; then |
462 | sound_drivers="$sound_drivers pulseaudio" | |
463 | MAIN_LDLIBS="-lpulse $MAIN_LDLIBS" | |
464 | fi | |
3d037671 | 465 | if [ "$need_sdl" = "yes" ] || check_sdl `${SDL_CONFIG} --cflags --libs`; then |
f89fa2d9 | 466 | sound_drivers="$sound_drivers sdl" |
467 | need_sdl="yes" | |
468 | fi | |
469 | else | |
470 | if echo $sound_drivers | grep -q "\<oss\>"; then | |
471 | check_oss || fail "oss support is missing" | |
472 | fi | |
473 | if echo $sound_drivers | grep -q "\<alsa\>"; then | |
474 | MAIN_LDLIBS="-lasound $MAIN_LDLIBS" | |
475 | check_alsa || fail "please install libasound2-dev" | |
476 | fi | |
b68bf5c2 | 477 | if echo $sound_drivers | grep -q "\<pulseaudio\>"; then |
478 | MAIN_LDLIBS="-lpulse $MAIN_LDLIBS" | |
479 | check_pulseaudio || fail "pulseaudio support is missing" | |
480 | fi | |
07c13dfd | 481 | fi |
482 | ||
9f704290 | 483 | if [ "$need_sdl" = "yes" ]; then |
3d037671 | 484 | which ${SDL_CONFIG} > /dev/null || \ |
9f704290 | 485 | fail "sdl-config is missing; please install libsdl (libsdl1.2-dev)" |
3d037671 PC |
486 | CFLAGS="$CFLAGS `${SDL_CONFIG} --cflags`" |
487 | MAIN_LDLIBS="`${SDL_CONFIG} --libs` $MAIN_LDLIBS" | |
9f704290 | 488 | check_sdl || fail "please install libsdl (libsdl1.2-dev)" |
07c13dfd | 489 | fi |
490 | ||
4132e8ca | 491 | # check for tslib (only headers needed) |
492 | if [ "x$have_tslib" = "x" ]; then | |
493 | cat > $TMPC <<EOF | |
494 | #include <tslib.h> | |
495 | void test(struct ts_sample sample) {} | |
496 | EOF | |
497 | if compile_object; then | |
498 | have_tslib="yes" | |
499 | else | |
500 | have_tslib="no" | |
501 | fi | |
502 | fi | |
503 | ||
f49a4c48 | 504 | # evdev |
505 | if [ "x$have_evdev" = "x" ]; then | |
506 | cat > $TMPC <<EOF | |
507 | #include <linux/input.h> | |
508 | EOF | |
509 | have_evdev="no" | |
510 | if compile_object; then | |
511 | have_evdev="yes" | |
512 | else | |
513 | cat > $TMPC <<EOF | |
514 | #include <dev/evdev/input.h> | |
515 | EOF | |
516 | if compile_object; then | |
517 | have_evdev="yes" | |
518 | fi | |
519 | fi | |
520 | fi | |
521 | ||
dd4d5a35 | 522 | # check for GLES headers |
523 | cat > $TMPC <<EOF | |
524 | #include <GLES/gl.h> | |
dd4d5a35 | 525 | #include <EGL/egl.h> |
5b9aa749 | 526 | int main(void) { |
527 | return (int)eglGetDisplay( (EGLNativeDisplayType)0 ); | |
dd4d5a35 | 528 | } |
529 | EOF | |
ef701b2e | 530 | if compile_binary $CFLAGS_GLES -lEGL -lGLES_CM $LDLIBS_GLES; then |
5b9aa749 | 531 | have_gles="yes" |
532 | LDLIBS_GLES="-lEGL -lGLES_CM $LDLIBS_GLES" | |
533 | elif compile_binary $CFLAGS_GLES -lEGL -lGLESv1_CM $LDLIBS_GLES; then | |
534 | have_gles="yes" | |
535 | LDLIBS_GLES="-lEGL -lGLESv1_CM $LDLIBS_GLES" | |
86e02a02 | 536 | elif compile_object $CFLAGS_GLES; then |
537 | have_gles="yes" | |
dd4d5a35 | 538 | fi |
539 | ||
5514a050 | 540 | if check_c64_tools; then |
541 | have_c64x_dsp="yes" | |
542 | fi | |
543 | ||
60ff60f5 | 544 | # declare available dynamic plugins |
2e4073b2 A |
545 | if [ "$have_dynamic" = "yes" ]; then |
546 | plugins="plugins/spunull/spunull.so" | |
60ff60f5 | 547 | |
2e4073b2 A |
548 | if [ "$builtin_gpu" != "peops" ]; then |
549 | plugins="$plugins plugins/dfxvideo/gpu_peops.so" | |
550 | fi | |
551 | if [ "$builtin_gpu" != "unai" ]; then | |
552 | plugins="$plugins plugins/gpu_unai/gpu_unai.so" | |
553 | fi | |
86e02a02 | 554 | if [ "$have_gles" = "yes" -a "x$LDLIBS_GLES" != "x" ]; then |
2e4073b2 A |
555 | plugins="$plugins plugins/gpu-gles/gpu_gles.so" |
556 | fi | |
557 | if [ "$have_neon_gpu" = "yes" -a "$builtin_gpu" != "neon" ]; then | |
558 | plugins="$plugins plugins/gpu_neon/gpu_neon.so" | |
559 | fi | |
560 | else | |
561 | have_dynamic="no" | |
562 | CFLAGS="$CFLAGS -DNO_DYLIB" | |
61bc6d40 | 563 | fi |
564 | ||
955f9af0 | 565 | # check for xlib (only headers needed) |
566 | if [ "x$need_xlib" = "xyes" ]; then | |
567 | check_xlib_headers || fail "please install libx11-dev" | |
568 | fi | |
569 | ||
cc376814 | 570 | sizeof_long=`check_define_val __SIZEOF_LONG__` |
571 | if [ "x$sizeof_long" = "x4" ]; then | |
572 | CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64" | |
573 | fi | |
574 | ||
9f704290 | 575 | cat > $TMPC <<EOF |
576 | void test(void *f, void *d) { fread(d, 1, 1, f); } | |
577 | EOF | |
578 | if compile_object -Wno-unused-result; then | |
579 | CFLAGS="$CFLAGS -Wno-unused-result" | |
580 | fi | |
581 | ||
dd4d5a35 | 582 | # short plugin list for display |
583 | for p in $plugins; do | |
584 | p1=`basename $p` | |
585 | plugins_short="$p1 $plugins_short" | |
586 | done | |
587 | ||
4132e8ca | 588 | # set things that failed to autodetect to "no" |
589 | test "x$have_armv6" != "x" || have_armv6="no" | |
590 | test "x$have_armv7" != "x" || have_armv7="no" | |
591 | test "x$have_arm_neon" != "x" || have_arm_neon="no" | |
57467c77 | 592 | test "x$have_arm_neon_asm" != "x" || have_arm_neon_asm="no" |
00a212aa | 593 | test "x$have_gles" != "x" || have_gles="no" |
5514a050 | 594 | test "x$have_c64x_dsp" != "x" || have_c64x_dsp="no" |
4132e8ca | 595 | |
596 | echo "architecture $ARCH" | |
597 | echo "platform $platform" | |
61bc6d40 | 598 | echo "built-in GPU $builtin_gpu" |
07c13dfd | 599 | echo "sound drivers $sound_drivers" |
dd4d5a35 | 600 | echo "plugins $plugins_short" |
4132e8ca | 601 | echo "C compiler $CC" |
602 | echo "C compiler flags $CFLAGS" | |
07c13dfd | 603 | echo "libraries $MAIN_LDLIBS" |
22fa3f2b | 604 | echo "linker flags $LDFLAGS$MAIN_LDFLAGS" |
a4c71501 | 605 | echo "dynarec $dynarec" |
57467c77 | 606 | if [ "$ARCH" = "arm" -o "$ARCH" = "aarch64" ]; then |
607 | echo "enable ARM NEON $have_arm_neon" | |
608 | fi | |
5514a050 | 609 | if [ "$ARCH" = "arm" ]; then |
610 | echo "ARMv7 optimizations $have_armv7" | |
5514a050 | 611 | echo "TI C64x DSP support $have_c64x_dsp" |
612 | fi | |
28bfade9 A |
613 | if [ "$have_dynamic" = "yes" ]; then |
614 | echo "tslib support $have_tslib" | |
615 | else | |
616 | echo "tslib does NOT support staticly linked build" | |
617 | fi | |
2c616080 | 618 | if [ "$platform" = "generic" ]; then |
619 | echo "OpenGL ES output $have_gles" | |
620 | fi | |
fad9f755 | 621 | echo "multithreading $multithreading" |
4132e8ca | 622 | |
623 | echo "# Automatically generated by configure" > $config_mak | |
624 | printf "# Configured with:" >> $config_mak | |
625 | printf " '%s'" "$0" "$@" >> $config_mak | |
626 | echo >> $config_mak | |
627 | ||
628 | echo "CC = $CC" >> $config_mak | |
ac6575cd | 629 | echo "CXX = $CXX" >> $config_mak |
4132e8ca | 630 | echo "AS = $AS" >> $config_mak |
631 | echo "CFLAGS += $CFLAGS" >> $config_mak | |
632 | echo "ASFLAGS += $ASFLAGS" >> $config_mak | |
633 | echo "LDFLAGS += $LDFLAGS" >> $config_mak | |
22fa3f2b | 634 | echo "MAIN_LDFLAGS += $MAIN_LDFLAGS" >> $config_mak |
07c13dfd | 635 | echo "MAIN_LDLIBS += $MAIN_LDLIBS" >> $config_mak |
4132e8ca | 636 | echo "PLUGIN_CFLAGS += $PLUGIN_CFLAGS" >> $config_mak |
637 | echo >> $config_mak | |
638 | ||
639 | echo "ARCH = $ARCH" >> $config_mak | |
640 | echo "PLATFORM = $platform" >> $config_mak | |
61bc6d40 | 641 | echo "BUILTIN_GPU = $builtin_gpu" >> $config_mak |
07c13dfd | 642 | echo "SOUND_DRIVERS = $sound_drivers" >> $config_mak |
ddd99692 | 643 | echo "PLUGINS = $plugins" >> $config_mak |
5368e5b9 A |
644 | if [ "$have_neon_gpu" = "yes" ]; then |
645 | echo "HAVE_NEON_GPU = 1" >> $config_mak | |
646 | fi | |
4132e8ca | 647 | if [ "$have_arm_neon" = "yes" ]; then |
648 | echo "HAVE_NEON = 1" >> $config_mak | |
649 | fi | |
57467c77 | 650 | if [ "$have_arm_neon_asm" = "yes" ]; then |
651 | echo "HAVE_NEON_ASM = 1" >> $config_mak | |
652 | fi | |
28bfade9 | 653 | if [ "$have_tslib" = "yes" -a "$have_dynamic" = "yes" ]; then |
4132e8ca | 654 | echo "HAVE_TSLIB = 1" >> $config_mak |
655 | fi | |
f49a4c48 | 656 | if [ "$have_evdev" = "yes" ]; then |
657 | echo "HAVE_EVDEV = 1" >> $config_mak | |
658 | fi | |
5b9aa749 | 659 | if [ "$have_gles" = "yes" ]; then |
660 | echo "HAVE_GLES = 1" >> $config_mak | |
661 | echo "CFLAGS_GLES = $CFLAGS_GLES" >> $config_mak | |
662 | echo "LDLIBS_GLES = $LDLIBS_GLES" >> $config_mak | |
663 | fi | |
f49a4c48 | 664 | if [ "$have_fsections" = "no" ]; then |
665 | echo "NO_FSECTIONS = 1" >> $config_mak | |
666 | fi | |
667 | if [ "$gnu_linker" = "yes" ]; then | |
668 | echo "GNU_LINKER = 1" >> $config_mak | |
669 | fi | |
a4c71501 | 670 | echo "DYNAREC = $dynarec" >> $config_mak |
4132e8ca | 671 | if [ "$drc_cache_base" = "yes" ]; then |
2a014d73 | 672 | echo "BASE_ADDR_DYNAMIC = 1" >> $config_mak |
4132e8ca | 673 | fi |
5514a050 | 674 | if [ "$have_c64x_dsp" = "yes" ]; then |
675 | echo "HAVE_C64_TOOLS = 1" >> $config_mak | |
676 | fi | |
fad9f755 | 677 | if [ "$multithreading" = "yes" ]; then |
678 | echo "USE_ASYNC_CDROM = 1" >> $config_mak | |
679 | echo "NDRC_THREAD = 1" >> $config_mak | |
680 | fi | |
4132e8ca | 681 | |
2e6189bc | 682 | # use pandora's skin (for now) |
683 | test -e skin || ln -s frontend/pandora/skin skin | |
684 | ||
4132e8ca | 685 | # vim:shiftwidth=2:expandtab |