From 6c08bf462b56df52a2bc2a732d0d56aeebf1b12c Mon Sep 17 00:00:00 2001 From: meep-eep Date: Tue, 25 Oct 2005 15:38:28 +0000 Subject: [PATCH] Better system build flags handling. git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@1923 8092fc87-c524-0410-9efc-e669fe64eaf9 --- sc2/build/unix/config_functions | 8 ++++++-- sc2/build/unix/config_proginfo_build | 12 ++++++++++++ sc2/build/unix/config_proginfo_host | 22 ++++++++++++++++++++++ 3 files changed, 40 insertions(+), 2 deletions(-) diff --git a/sc2/build/unix/config_functions b/sc2/build/unix/config_functions index 79850e1e9..2213ebe9b 100644 --- a/sc2/build/unix/config_functions +++ b/sc2/build/unix/config_functions @@ -67,12 +67,14 @@ EOF # Returns: 0 - if compile successful # something else - if compile failed try_compile_c() { + local SYSTEM_FLAGS if [ -z "$COMPILE" ]; then echo "Fatal: Program \$COMPILE is not defined!" >&2 exit 1 fi + SYSTEM_FLAGS="$SYSTEM_BUILD_CFLAGS $SYSTEM_BUILD_LDFLAGS $SYSTEM_HOST_CFLAGS $SYSTEM_HOST_LDFLAGS" cat > "$TEMPFILE.c" - echo_and_perform $COMPILE $1 $2 "$TEMPFILE.c" \ + echo_and_perform $COMPILE $SYSTEM_FLAGS $1 $2 "$TEMPFILE.c" \ -o "$TEMPFILE.out" >> "$BUILDLOG" 2>&1 RESULT=$? if [ $RESULT -ne 0 ]; then @@ -92,12 +94,14 @@ try_compile_c() { # Returns: -1 - if compile failed # otherwise - exit status of the program try_compile_and_run_c() { + local SYSTEM_FLAGS if [ -z "$COMPILE" ]; then echo "Fatal: Program \$COMPILE is not defined!" >&2 exit 1 fi + SYSTEM_FLAGS="$SYSTEM_BUILD_CFLAGS $SYSTEM_BUILD_LDFLAGS $SYSTEM_HOST_CFLAGS $SYSTEM_HOST_LDFLAGS" cat > "$TEMPFILE.c" - echo_and_perform $COMPILE $1 $2 "$TEMPFILE.c" \ + echo_and_perform $COMPILE $SYSTEM_FLAGS $1 $2 "$TEMPFILE.c" \ -o "$TEMPFILE.out" >> "$BUILDLOG" 2>&1 if [ $? -ne 0 ]; then return -1 diff --git a/sc2/build/unix/config_proginfo_build b/sc2/build/unix/config_proginfo_build index a17bd85b4..d36b3f889 100644 --- a/sc2/build/unix/config_proginfo_build +++ b/sc2/build/unix/config_proginfo_build @@ -18,6 +18,18 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +############################################################################## +# System specific build flags # +############################################################################## + + +# CFLAGS +SYSTEM_BUILD_CFLAGS="" + +# LDFLAGS +SYSTEM_BUILD_LDFLAGS="" + + ############################################################################## # Describe the programs (possibly) used: # ############################################################################## diff --git a/sc2/build/unix/config_proginfo_host b/sc2/build/unix/config_proginfo_host index a15ddfad6..240a34515 100644 --- a/sc2/build/unix/config_proginfo_host +++ b/sc2/build/unix/config_proginfo_host @@ -18,6 +18,28 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +############################################################################## +# System specific build flags # +############################################################################## + + +# CFLAGS +case "$HOST_SYSTEM" in + CYGWIN*) + # HACK: sdl-config on Cygwin supplies -mno-cygwin which means that + # dependencies detected without that flag may not be available at + # the actual build. + SYSTEM_HOST_CFLAGS="-mno-cygwin" + ;; + *) + SYSTEM_HOST_CFLAGS="" + ;; +esac + +# LDFLAGS +SYSTEM_HOST_LDFLAGS="" + + ############################################################################## # Describe the programs (possibly) used: # ##############################################################################