From f89fa2d9b2c3e90a361a38656cb45e20cf7cf097 Mon Sep 17 00:00:00 2001 From: notaz Date: Fri, 3 Aug 2012 01:38:51 +0300 Subject: [PATCH] configure: fix some ordering issues --- Makefile | 2 +- configure | 49 +++++++++++++++++++++++++++++-------------------- 2 files changed, 30 insertions(+), 21 deletions(-) diff --git a/Makefile b/Makefile index 61bec8b2..c10f7393 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ # default stuff goes here, so that config can override TARGET = pcsx CFLAGS += -Wall -ggdb -Ifrontend -ffast-math -LDLIBS += -lpthread -lm +LDLIBS += -lpthread ifndef DEBUG CFLAGS += -O2 -DNDEBUG endif diff --git a/configure b/configure index f5e3b6fc..0618ac21 100755 --- a/configure +++ b/configure @@ -47,6 +47,7 @@ have_armv7="" have_arm_neon="" have_tslib="" enable_dynarec="yes" +need_sdl="no" # these are for known platforms optimize_cortexa8="no" optimize_arm926ej="no" @@ -56,7 +57,7 @@ CC="${CC-${CROSS_COMPILE}gcc}" CXX="${CXX-${CROSS_COMPILE}g++}" AS="${AS-${CROSS_COMPILE}as}" AR="${AS-${CROSS_COMPILE}ar}" -MAIN_LDLIBS="$LDLIBS -ldl -lpng -lz" +MAIN_LDLIBS="$LDLIBS -ldl -lm" config_mak="config.mak" fail() @@ -247,10 +248,7 @@ fi case "$platform" in generic) - generic_cflags=`sdl-config --cflags` - generic_ldlibs=`sdl-config --libs` - CFLAGS="$CFLAGS $generic_cflags" - MAIN_LDLIBS="$MAIN_LDLIBS $generic_ldlibs" + need_sdl="yes" ;; maemo) maemo_cflags=`pkg-config --cflags hildon-1` @@ -320,27 +318,38 @@ EOF compile_binary "$@" } -check_zlib || fail "please install libz-dev" -check_bzlib || fail "please install libbz2-dev" -check_libpng || fail "please install libpng-dev" +MAIN_LDLIBS="$MAIN_LDLIBS -lz" +check_zlib || fail "please install zlib/libz-dev" + +check_bzlib || fail "please install bz2lib/libbz2-dev" + +MAIN_LDLIBS="-lpng $MAIN_LDLIBS" +check_libpng || fail "please install libpng/libpng-dev" # find what audio support we can compile if [ "x$sound_drivers" = "x" ]; then if check_oss; then sound_drivers="$sound_drivers oss"; fi - if check_alsa -lasound; then sound_drivers="$sound_drivers alsa"; fi - if check_sdl; then sound_drivers="$sound_drivers sdl"; fi + if check_alsa -lasound; then + sound_drivers="$sound_drivers alsa" + MAIN_LDLIBS="-lasound $MAIN_LDLIBS" + fi + if [ "$need_sdl" == "yes" ] || check_sdl `sdl-config --cflags -libs`; then + sound_drivers="$sound_drivers sdl" + need_sdl="yes" + fi +else + if echo $sound_drivers | grep -q "\"; then + check_oss || fail "oss support is missing" + fi + if echo $sound_drivers | grep -q "\"; then + MAIN_LDLIBS="-lasound $MAIN_LDLIBS" + check_alsa || fail "please install libasound2-dev" + fi fi -if echo $sound_drivers | grep -q "\"; then - check_oss || fail "oss support missing" -fi -if echo $sound_drivers | grep -q "\"; then - MAIN_LDLIBS="$MAIN_LDLIBS -lasound" - check_alsa || fail "please install libasound2-dev" -fi -if echo $sound_drivers | grep -q "\"; then - echo $MAIN_LDLIBS | grep -qi SDL || CFLAGS="$CFLAGS `sdl-config --cflags`" - echo $MAIN_LDLIBS | grep -qi SDL || MAIN_LDLIBS="$MAIN_LDLIBS `sdl-config --libs`" +if [ "$need_sdl" == "yes" ]; then + CFLAGS="$CFLAGS `sdl-config --cflags`" + MAIN_LDLIBS="`sdl-config --libs` $MAIN_LDLIBS" check_sdl || fail "please install libsdl1.2-dev" fi -- 2.39.5