--- a/config.lib Wed Jun 13 11:45:14 2007 +0000
+++ b/config.lib Wed Jun 13 12:05:56 2007 +0000
@@ -5,6 +5,8 @@
}
set_default() {
+ released_version=""
+
ignore_extra_parameters="0"
# We set all kinds of defaults for params. Later on the user can override
# most of them; but if they don't, this default is used.
@@ -42,6 +44,7 @@
enable_universal="1"
enable_osx_g5="0"
enable_unicode="1"
+ with_distcc="1"
with_osx_sysroot="1"
with_application_bundle="1"
with_sdl="1"
@@ -59,7 +62,7 @@
with_fontconfig="1"
with_psp_config="1"
- save_params_array="build host cc_build cc_host cxx_build cxx_host windres strip awk lipo os revision endian config_log prefix_dir binary_dir data_dir icon_dir personal_dir install_dir custom_lang_dir second_data_dir enable_install enable_debug enable_profiling enable_dedicated enable_network enable_static enable_translator enable_assert enable_strip with_osx_sysroot enable_universal enable_osx_g5 enable_unicode with_application_bundle with_sdl with_cocoa with_zlib with_png with_makedepend with_direct_music with_sort with_iconv with_midi with_midi_arg with_libtimidity with_freetype with_fontconfig with_psp_config CC CXX CFLAGS LDFLAGS"
+ save_params_array="build host cc_build cc_host cxx_build cxx_host windres strip awk lipo os revision endian config_log prefix_dir binary_dir data_dir icon_dir personal_dir install_dir custom_lang_dir second_data_dir enable_install enable_debug enable_profiling enable_dedicated enable_network enable_static enable_translator enable_assert enable_strip with_distcc with_osx_sysroot enable_universal enable_osx_g5 enable_unicode with_application_bundle with_sdl with_cocoa with_zlib with_png with_makedepend with_direct_music with_sort with_iconv with_midi with_midi_arg with_libtimidity with_freetype with_fontconfig with_psp_config CC CXX CFLAGS LDFLAGS"
}
detect_params() {
@@ -233,6 +236,10 @@
--with-midi=*) with_midi="$optarg";;
--with-midi-arg=*) with_midi_arg="$optarg";;
+ --without-distcc) with_distcc="0";;
+ --with-distcc) with_distcc="2";;
+ --with-distcc=*) with_distcc="$optarg";;
+
--without-osx-sysroot) with_osx_sysroot="0";;
--with-osx-sysroot) with_osx_sysroot="2";;
--with-osx-sysroot=*) with_osx_sysroot="$optarg";;
@@ -303,10 +310,10 @@
echo " Available options are: --endian=[AUTO|LE|BE]"
exit 1
fi
- # OS only allows DETECT, UNIX, OSX, FREEBSD, MORPHOS, BEOS, SUNOS, CYGWIN, MINGW, OS2, WINCE, and PSP
- if [ -z "`echo $os | egrep '^(DETECT|UNIX|OSX|FREEBSD|MORPHOS|BEOS|SUNOS|CYGWIN|MINGW|OS2|WINCE|PSP)$'`" ]; then
+ # OS only allows DETECT, UNIX, OSX, FREEBSD, OPENBSD, MORPHOS, BEOS, SUNOS, CYGWIN, MINGW, OS2, WINCE, and PSP
+ if [ -z "`echo $os | egrep '^(DETECT|UNIX|OSX|FREEBSD|OPENBSD|MORPHOS|BEOS|SUNOS|CYGWIN|MINGW|OS2|WINCE|PSP)$'`" ]; then
echo "configure: error: invalid option --os=$os"
- echo " Available options are: --os=[DETECT|UNIX|OSX|FREEBSD|MORPHOS|BEOS|SUNOS|CYGWIN|MINGW|OS2|WINCE|PSP]"
+ echo " Available options are: --os=[DETECT|UNIX|OSX|FREEBSD|OPENBSD|MORPHOS|BEOS|SUNOS|CYGWIN|MINGW|OS2|WINCE|PSP]"
exit 1
fi
# enable_debug should be between 0 and 4
@@ -510,6 +517,35 @@
log 1 "checking stripping... skipped"
fi
+ if [ "$with_distcc" = "0" ]; then
+ log 1 "checking distcc... no"
+ elif [ "$with_distcc" = "1" ]; then
+ with_distcc="0"
+
+ log 1 "checking distcc... no (only used when forced)"
+ elif [ "$with_distcc" = "2" ]; then
+ distcc="distcc"
+ else
+ distcc="$with_distcc"
+ fi
+ if [ "$with_distcc" != "0" ]; then
+ res="`$distcc --version 2>/dev/null | head -n 1 | cut -b 0-6`"
+ if [ "$res" != "distcc" ]; then
+ distcc=""
+ log 1 "checking distcc... no"
+ if [ "$with_distcc" = "2" ]; then
+ log 1 "configure: error: no distcc detected, but was forced to be used"
+ exit 1
+ fi
+ if [ "$with_distcc" != "1" ]; then
+ log 1 "configure: error: '$with_distcc' doesn't seem a distcc to me"
+ exit 1
+ fi
+ fi
+
+ log 1 "checking distcc... $distcc"
+ fi
+
if [ "$os" != "OSX" ] && [ "$with_osx_sysroot" != "0" ]; then
if [ "$with_osx_sysroot" = "1" ]; then
with_osx_sysroot="0"
@@ -609,6 +645,47 @@
exit 1
fi
fi
+
+ if [ -n "$released_version" ]; then
+ log 1 "checking revision... release ($released_version)"
+ if [ -n "$revision" ] && [ "$revision" != "$released_version" ]; then
+ log 1 "WARNING: overriding of the revision is NOT possible for releases"
+ log 1 "WARNING: the given revision is IGNORED"
+
+ sleep 5
+ fi
+ revision=$released_version
+ else
+ if [ -n "$revision" ]; then
+ log 1 "checking revision... $revision"
+ log 1 "WARNING: we do not advise you to use this setting"
+ log 1 "WARNING: in most cases it is not safe for network use"
+ log 1 "WARNING: USE WITH CAUTION!"
+
+ sleep 5
+ elif [ -f "$ROOT_DIR/version" ]; then
+ revision="`cat $ROOT_DIR/version`"
+
+ log 1 "checking revision... $revision"
+ elif [ -d "$ROOT_DIR/.svn" ] && [ -n "`svn help`" ]; then
+ revision=""
+ log 1 "checking revision... svn detection"
+ elif [ -d "$ROOT_DIR/.git" ] && [ -n "`git help`" ]; then
+ revision=""
+ log 1 "checking revision... git detection"
+ else
+ revision=""
+ log 1 "checking revision... no detection"
+ log 1 "WARNING: there is no means to determine the version."
+ log 1 "WARNING: please use a subversion or git checkout of OpenTTD."
+ log 1 "WARNING: this version will be allowed by all game servers,"
+ log 1 "WARNING: but you will be kicked from all incompatible"
+ log 1 "WARNING: servers as you will desync."
+ log 1 "WARNING: USE WITH CAUTION!"
+
+ sleep 5
+ fi
+ fi
}
make_cflags_and_ldflags() {
@@ -709,7 +786,7 @@
fi
fi
- if [ "$os" != "CYGWIN" ] && [ "$os" != "FREEBSD" ] && [ "$os" != "MINGW" ] && [ "$os" != "MORPHOS" ] && [ "$os" != "OSX" ] && [ "$os" != "WINCE" ] && [ "$os" != "PSP" ]; then
+ if [ "$os" != "CYGWIN" ] && [ "$os" != "FREEBSD" ] && [ "$os" != "OPENBSD" ] && [ "$os" != "MINGW" ] && [ "$os" != "MORPHOS" ] && [ "$os" != "OSX" ] && [ "$os" != "WINCE" ] && [ "$os" != "PSP" ]; then
LIBS="$LIBS -lpthread"
LIBS="$LIBS -lrt"
fi
@@ -733,6 +810,10 @@
CFLAGS="$CFLAGS -Wno-strict-prototypes"
fi
+ if [ "$os" = "OPENBSD" ]; then
+ LIBS="$LIBS -pthread"
+ fi
+
if [ "$os" = "OSX" ]; then
LDFLAGS="$LDFLAGS -framework Cocoa"
if [ "$enable_dedicated" = "0" ]; then
@@ -745,7 +826,7 @@
fi
# Most targets act like UNIX, just with some additions
- if [ "$os" = "BEOS" ] || [ "$os" = "OSX" ] || [ "$os" = "MORPHOS" ] || [ "$os" = "FREEBSD" ] || [ "$os" = "SUNOS" ] || [ "$os" = "OS2" ]; then
+ if [ "$os" = "BEOS" ] || [ "$os" = "OSX" ] || [ "$os" = "MORPHOS" ] || [ "$os" = "FREEBSD" ] || [ "$os" = "OPENBSD" ] || [ "$os" = "SUNOS" ] || [ "$os" = "OS2" ]; then
CFLAGS="$CFLAGS -DUNIX"
fi
# And others like Windows
@@ -927,23 +1008,6 @@
fi
fi
- if [ -n "$revision" ]; then
- log 1 "checking revision... $revision"
- log 1 "WARNING: we do not advise you to use this setting"
- log 1 "WARNING: in most cases it is not safe for network use"
- log 1 "WARNING: USE WITH CAUTION!"
-
- sleep 5
- elif [ -f "$ROOT_DIR/version" ]; then
- revision="`cat $ROOT_DIR/version`"
-
- log 1 "checking revision... $revision"
- else
- revision=""
-
- log 1 "checking revision... svn detection"
- fi
-
log 1 "using CFLAGS... $CFLAGS $CC_CFLAGS"
log 1 "using LDFLAGS... $LIBS $LDFLAGS"
@@ -958,6 +1022,14 @@
else
makedepend=""
fi
+
+ if [ "$with_distcc" != "0" ]; then
+ cc_host="$distcc $cc_host"
+ cxx_host="$distcc $cxx_host"
+ log 1 ""
+ log 1 " NOTICE: remind yourself to use 'make -jN' to make use of distcc"
+ log 1 ""
+ fi
}
check_compiler() {
@@ -1239,13 +1311,14 @@
detect_os() {
if [ "$os" = "DETECT" ]; then
- # Detect UNIX, OSX, FREEBSD, MORPHOS, BEOS, SUNOS, CYGWIN, MINGW, OS2, WINCE, and PSP
+ # Detect UNIX, OSX, FREEBSD, OPENBSD, MORPHOS, BEOS, SUNOS, CYGWIN, MINGW, OS2, WINCE, and PSP
# Try first via dumpmachine, then via uname
os=`echo "$host" | tr '[A-Z]' '[a-z]' | $awk '
/linux/ { print "UNIX"; exit}
/darwin/ { print "OSX"; exit}
/freebsd/ { print "FREEBSD"; exit}
+ /openbsd/ { print "OPENBSD"; exit}
/morphos/ { print "MORPHOS"; exit}
/beos/ { print "BEOS"; exit}
/sunos/ { print "SUNOS"; exit}
@@ -1262,6 +1335,7 @@
/linux/ { print "UNIX"; exit}
/darwin/ { print "OSX"; exit}
/freebsd/ { print "FREEBSD"; exit}
+ /openbsd/ { print "OPENBSD"; exit}
/morphos/ { print "MORPHOS"; exit}
/beos/ { print "BEOS"; exit}
/sunos/ { print "SUNOS"; exit}
@@ -1273,8 +1347,8 @@
if [ -z "$os" ]; then
log 1 "detecting OS... none detected"
- log 1 "I couldn't detect your OS. Please use --with-os=OS to force one"
- log 1 "Allowed values are: UNIX, OSX, FREEBSD, MORPHOS, BEOS, SUNOS, CYGWIN, MINGW, OS2, WINCE, and PSP"
+ log 1 "I couldn't detect your OS. Please use --os=OS to force one"
+ log 1 "Allowed values are: UNIX, OSX, FREEBSD, OPENBSD, MORPHOS, BEOS, SUNOS, CYGWIN, MINGW, OS2, WINCE, and PSP"
exit 1
fi
@@ -1862,6 +1936,7 @@
s#!!AWK!!#$awk#g;
s#!!GCC295!!#$gcc295#g;
s#!!ENABLE_INSTALL!!#$enable_install#g;
+ s#!!DISTCC!!#$distcc#g;
"
}
@@ -1960,8 +2035,8 @@
echo " --awk=AWK the awk to use in configure [awk]"
echo " --lipo=LIPO the lipo to use (OSX ONLY) [HOST-lipo]"
echo " --os=OS the OS we are compiling for [DETECT]"
- echo " DETECT/UNIX/OSX/FREEBSD/MORPHOS/BEOS/"
- echo " SUNOS/CYGWIN/MINGW/OS2/WINCE/PSP"
+ echo " DETECT/UNIX/OSX/FREEBSD/OPENBSD/MORPHOS/"
+ echo " BEOS/SUNOS/CYGWIN/MINGW/OS2/WINCE/PSP"
echo " --endian=ENDIAN set the endian of the HOST (AUTO/LE/BE)"
echo " --revision=rXXXX overwrite the revision detection."
echo " Use with care!"