From c370f56bf3553c1ff37564d7b2c6c5848deb3651 Mon Sep 17 00:00:00 2001 From: terkhen Date: Sun, 14 Nov 2010 20:47:45 +0000 Subject: [PATCH] (svn r21194) -Add: Configure option for compiling OpenTTD as a console application under MinGW. --- config.lib | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/config.lib b/config.lib index 29bf9c925c..7afb7d9ecb 100644 --- a/config.lib +++ b/config.lib @@ -55,6 +55,7 @@ set_default() { enable_static="1" enable_translator="0" enable_unicode="1" + enable_console="1"; enable_assert="1" enable_strip="0" enable_universal="1" @@ -128,6 +129,7 @@ set_default() { enable_static enable_translator enable_unicode + enable_console enable_assert enable_strip enable_universal @@ -305,6 +307,9 @@ detect_params() { --disable-unicode) enable_unicode="0";; --enable-unicode) enable_unicode="2";; --enable-unicode=*) enable_unicode="$optarg";; + --disable-console) enable_console="0";; + --enable-console) enable_console="2";; + --enable-console=*) enable_console="$optarg";; --disable-cocoa-quartz) enable_cocoa_quartz="0";; --enable-cocoa-quartz) enable_cocoa_quartz="2";; @@ -718,6 +723,20 @@ check_params() { fi fi + if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ]; then + log 1 "checking console application... not Windows, skipping" + elif [ "$enable_console" = "1" ] && [ "$enable_dedicated" != "0" ]; then + log 1 "checking console application... dedicated server, enabled" + enable_console="2" + elif [ "$enable_console" = "1" ]; then + log 1 "checking console application... disabled (only used when forced)" + enable_console="0" + elif [ "$enable_console" = "0" ]; then + log 1 "checking console application... disabled" + else + log 1 "checking console application... enabled" + fi + if [ "$enable_network" = "1" ] && [ "$os" = "DOS" ]; then log 1 "checking network... DOS, skipping" enable_network=0 @@ -1334,7 +1353,13 @@ make_cflags_and_ldflags() { fi if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ]; then flags="$flags -mno-cygwin" - LDFLAGS="$LDFLAGS -mno-cygwin -Wl,--subsystem,windows" + + if [ "$enable_console" != "0" ]; then + LDFLAGS="$LDFLAGS -mno-cygwin -Wl,--subsystem,console" + else + LDFLAGS="$LDFLAGS -mno-cygwin -Wl,--subsystem,windows" + fi + LIBS="$LIBS -lws2_32 -lwinmm -lgdi32 -ldxguid -lole32" if [ $cc_version -ge 44 ]; then @@ -3298,6 +3323,9 @@ showhelp() { echo " --disable-cocoa-quickdraw disable the quickdraw window mode driver for Cocoa (OSX ONLY)" echo " --disable-unicode disable unicode support to build win9x" echo " version (Win32 ONLY)" + echo " --enable-console compile as a console application instead of as a GUI application." + echo " If this setting is active, debug output will appear in the same" + echo " console instead of opening a new window. (Win32 ONLY)" echo " --disable-network disable network support" echo " --disable-assert disable asserts (continue on errors)" echo " --enable-strip enable any possible stripping"