2006-03-14 19:12:39 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# This 'configure' script is a very easy wrapper around 'make updateconf'
|
|
|
|
# It allows cross-compilers to do their job much more easy.
|
|
|
|
|
|
|
|
function showhelp() {
|
|
|
|
echo "Configure for OpenTTD"
|
|
|
|
echo ""
|
|
|
|
echo "Usage:"
|
|
|
|
echo " $0 --your_options"
|
|
|
|
echo ""
|
|
|
|
echo "Params:"
|
2006-03-14 19:21:49 +00:00
|
|
|
echo " --debug Create debug-release [no]"
|
|
|
|
echo " --profile Create profile-release [no]"
|
2006-03-23 13:24:09 +00:00
|
|
|
echo " --dedicated Make a dedicated build [no]"
|
2006-03-14 19:21:49 +00:00
|
|
|
echo " --revision Set the revision of the compilation [detected]"
|
2006-03-14 19:12:39 +00:00
|
|
|
echo " --target-cc Sets the target-compiler [\$CC]"
|
|
|
|
echo " --target-cxx Sets the C++ target-compiler []"
|
|
|
|
echo " --host-cc Sets the host-compiler [\$CC]"
|
|
|
|
echo " --os Sets the OS. Listens to: [detected]"
|
|
|
|
echo " UNIX, OSX, FREEBSD, MORPHOS"
|
|
|
|
echo " BEOS, SUNOS, CYGWIN, MINGW"
|
|
|
|
echo " --windres Sets the windres (Windows) [windres]"
|
|
|
|
echo " --force-le Force LE platform [no]"
|
|
|
|
echo " --force-be Force BE platform [no]"
|
|
|
|
echo ""
|
|
|
|
echo "Params that can be used with --with or --without"
|
|
|
|
echo " (e.g.: --without-static disables static (default))"
|
|
|
|
echo " static Do you want a static build? [no]"
|
|
|
|
echo " directmusic Do you want direct-music? [no]"
|
|
|
|
echo " zlib Do you want zlib-support? [yes]"
|
|
|
|
echo " sdl Do you want SDL-support? [yes]"
|
|
|
|
echo " png Do you want PNG-support? [yes]"
|
2006-03-31 21:22:41 +00:00
|
|
|
echo " iconv Do you want iconv-support? [no]"
|
2006-03-14 19:12:39 +00:00
|
|
|
echo " cocoa Do you want cocoa-support? (MacOSX) [no]"
|
|
|
|
echo ""
|
|
|
|
echo "Params used to configure external libs:"
|
|
|
|
echo " --static-zlib-path Set the path to your static zlib []"
|
|
|
|
echo " --sdl-config Where is your sdl-config [sdl-config]"
|
|
|
|
echo " --libpng-config Where is your libpng-config [libpng-config]"
|
2006-03-31 21:22:41 +00:00
|
|
|
echo " --with-iconv Set the path to your iconv headers []"
|
2006-03-14 19:12:39 +00:00
|
|
|
echo " "
|
|
|
|
}
|
|
|
|
|
|
|
|
function handle() {
|
2006-03-23 15:34:47 +00:00
|
|
|
PARAM="$PARAM \"$1=`awk 'BEGIN { FS="="; $0="'"$2"'"; print $2;}'`\""
|
2006-03-14 19:12:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# The things you can use inside this case:
|
|
|
|
# handle NAME VALUE - Sets the value to give the 'make upgradeconf'
|
|
|
|
# Value is in form: tag=REAL_VALUE
|
|
|
|
# ITEM="NAME" - Will set the value as above, only with the next param
|
|
|
|
# SITEM="NAME" - Will set the var $NAME to the next param
|
2006-03-15 21:55:59 +00:00
|
|
|
for n in "$@"
|
2006-03-14 19:12:39 +00:00
|
|
|
do
|
|
|
|
case "$n" in
|
|
|
|
--help | -h)
|
|
|
|
showhelp
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
|
2006-03-14 19:21:49 +00:00
|
|
|
--debug)
|
2006-03-14 21:35:15 +00:00
|
|
|
DEBUG_SET=1
|
|
|
|
ITEM="DEBUG"
|
|
|
|
;;
|
|
|
|
--debug=*)
|
2006-03-23 15:34:47 +00:00
|
|
|
handle "DEBUG" "$n"
|
2006-03-14 19:21:49 +00:00
|
|
|
;;
|
|
|
|
--profile)
|
|
|
|
PARAM="$PARAM PROFILE=1"
|
|
|
|
;;
|
2006-03-23 13:24:09 +00:00
|
|
|
--dedicated)
|
|
|
|
PARAM="$PARAM DEDICATED=1"
|
|
|
|
;;
|
2006-03-14 19:21:49 +00:00
|
|
|
--revision=*)
|
2006-03-23 15:34:47 +00:00
|
|
|
RELEASE=`awk 'BEGIN { FS="="; $0="'"$n"'"; print $2;}'`
|
2006-03-14 19:21:49 +00:00
|
|
|
;;
|
|
|
|
--revision)
|
|
|
|
SITEM="RELEASE"
|
|
|
|
;;
|
2006-03-14 19:12:39 +00:00
|
|
|
--target-cc=*)
|
2006-03-23 15:34:47 +00:00
|
|
|
handle "CC_TARGET" "$n"
|
2006-03-14 19:12:39 +00:00
|
|
|
;;
|
|
|
|
--target-cc)
|
2006-03-23 15:34:47 +00:00
|
|
|
ITEM="CC_TARGET"
|
2006-03-14 19:12:39 +00:00
|
|
|
;;
|
|
|
|
--target-cxx=*)
|
2006-03-23 15:34:47 +00:00
|
|
|
TARGET_CXX=`awk 'BEGIN { FS="="; $0="'"$n"'"; print $2;}'`
|
2006-03-14 19:12:39 +00:00
|
|
|
;;
|
|
|
|
--target-cxx)
|
|
|
|
SITEM="TARGET_CXX"
|
|
|
|
;;
|
|
|
|
--host-cc=*)
|
2006-03-23 15:34:47 +00:00
|
|
|
handle CC_HOST "$n"
|
2006-03-14 19:12:39 +00:00
|
|
|
;;
|
|
|
|
--host-cc)
|
|
|
|
ITEM="CC_HOST"
|
|
|
|
;;
|
2006-03-23 16:03:11 +00:00
|
|
|
--host-cflags=*)
|
|
|
|
handle CFLAGS_HOST "$n"
|
|
|
|
;;
|
|
|
|
--host-cflags)
|
|
|
|
ITEM="CFLAGS_HOST"
|
|
|
|
;;
|
2006-03-14 19:12:39 +00:00
|
|
|
--os=*)
|
2006-03-23 15:34:47 +00:00
|
|
|
TARGET_OS=`awk 'BEGIN { FS="="; $0="'"$n"'"; print $2;}'`
|
2006-03-14 19:12:39 +00:00
|
|
|
;;
|
|
|
|
--os)
|
2006-03-14 20:56:07 +00:00
|
|
|
SITEM="TARGET_OS"
|
2006-03-14 19:12:39 +00:00
|
|
|
;;
|
|
|
|
--windres=*)
|
2006-03-23 15:34:47 +00:00
|
|
|
handle WINDRES "$n"
|
2006-03-14 19:12:39 +00:00
|
|
|
;;
|
|
|
|
--windres)
|
|
|
|
ITEM="WINDRES"
|
|
|
|
;;
|
|
|
|
--force-le)
|
|
|
|
PARAM="$PARAM ENDIAN_FORCE=LE"
|
|
|
|
;;
|
|
|
|
--force-be)
|
|
|
|
PARAM="$PARAM ENDIAN_FORCE=BE"
|
|
|
|
;;
|
|
|
|
|
|
|
|
--with-static)
|
|
|
|
PARAM="$PARAM STATIC=1"
|
|
|
|
;;
|
|
|
|
--without-static)
|
|
|
|
PARAM="$PARAM STATIC="
|
|
|
|
;;
|
|
|
|
--with-directmusic)
|
|
|
|
PARAM="$PARAM WITH_DIRECTMUSIC=1"
|
|
|
|
;;
|
|
|
|
--without-directmusic)
|
|
|
|
PARAM="$PARAM WITH_DIRECTMUSIC="
|
|
|
|
;;
|
|
|
|
--with-zlib)
|
|
|
|
PARAM="$PARAM WITH_ZLIB=1"
|
|
|
|
;;
|
|
|
|
--without-zlib)
|
|
|
|
PARAM="$PARAM WITH_ZLIB="
|
|
|
|
;;
|
|
|
|
--with-sdl)
|
|
|
|
PARAM="$PARAM WITH_SDL=1"
|
|
|
|
;;
|
|
|
|
--without-sdl)
|
|
|
|
PARAM="$PARAM WITH_SDL="
|
|
|
|
;;
|
|
|
|
--with-png)
|
|
|
|
PARAM="$PARAM WITH_PNG=1"
|
|
|
|
;;
|
|
|
|
--without-png)
|
|
|
|
PARAM="$PARAM WITH_PNG="
|
|
|
|
;;
|
2006-03-31 21:22:41 +00:00
|
|
|
--with-iconv)
|
|
|
|
PARAM="$PARAM WITH_ICONV=1"
|
|
|
|
;;
|
|
|
|
--with-iconv=*)
|
|
|
|
PARAM="$PARAM WITH_ICONV=1"
|
|
|
|
handle WITH_ICONV_PATH "$n"
|
|
|
|
;;
|
|
|
|
--without-iconv)
|
|
|
|
PARAM="$PARAM WITH_ICONV="
|
|
|
|
;;
|
2006-03-14 19:12:39 +00:00
|
|
|
--with-cocoa)
|
|
|
|
PARAM="$PARAM WITH_COCOA=1"
|
|
|
|
;;
|
|
|
|
--without-cocoa)
|
|
|
|
PARAM="$PARAM WITH_COCOA="
|
|
|
|
;;
|
|
|
|
--static-zlib-path=*)
|
2006-03-23 15:34:47 +00:00
|
|
|
handle STATIC_ZLIB_PATH "$n"
|
2006-03-14 19:12:39 +00:00
|
|
|
;;
|
|
|
|
--static-zlib-path)
|
|
|
|
ITEM="STATIC_ZLIB_PATH"
|
|
|
|
;;
|
|
|
|
--sdl-config=*)
|
2006-03-31 21:06:55 +00:00
|
|
|
handle SDL_CONFIG "$n"
|
2006-03-14 19:12:39 +00:00
|
|
|
;;
|
|
|
|
--sdl-config)
|
2006-03-31 21:06:55 +00:00
|
|
|
ITEM="SDL_CONFIG"
|
2006-03-14 19:12:39 +00:00
|
|
|
;;
|
|
|
|
--libpng-config=*)
|
2006-03-31 21:06:55 +00:00
|
|
|
handle LIBPNG_CONFIG "$n"
|
2006-03-14 19:12:39 +00:00
|
|
|
;;
|
|
|
|
--lib-png-config)
|
2006-03-31 21:06:55 +00:00
|
|
|
ITEM="LIBPNG_CONFIG"
|
2006-03-14 19:12:39 +00:00
|
|
|
;;
|
|
|
|
|
|
|
|
--*=*)
|
|
|
|
echo -n "Unknown switch "
|
2006-03-23 15:34:47 +00:00
|
|
|
echo `awk 'BEGIN { FS="="; $0="'"$n"'"; print $1;}'`
|
2006-03-14 19:12:39 +00:00
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
-*)
|
|
|
|
echo "Unknown switch $n"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
|
|
|
|
*)
|
|
|
|
if ! test -z "$ITEM"
|
|
|
|
then
|
2006-03-23 15:34:47 +00:00
|
|
|
PARAM="$PARAM $ITEM=\"$n\""
|
2006-03-14 19:12:39 +00:00
|
|
|
ITEM="";
|
|
|
|
elif ! test -z "$SITEM"
|
|
|
|
then
|
2006-03-23 15:34:47 +00:00
|
|
|
export $SITEM="$n"
|
2006-03-14 19:12:39 +00:00
|
|
|
SITEM=""
|
|
|
|
else
|
|
|
|
echo "Unknown switch $n"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2006-03-14 20:56:07 +00:00
|
|
|
if ! test -z "$TARGET_OS"
|
2006-03-14 19:12:39 +00:00
|
|
|
then
|
2006-03-14 20:56:07 +00:00
|
|
|
TARGET_OS=`echo $TARGET_OS | tr '[:lower:]' '[:upper:]'`
|
|
|
|
case "$TARGET_OS" in
|
2006-03-14 19:12:39 +00:00
|
|
|
WIN32)
|
|
|
|
PARAM="$PARAM WIN32=1"
|
|
|
|
;;
|
|
|
|
UNIX)
|
|
|
|
PARAM="$PARAM UNIX=1"
|
|
|
|
;;
|
|
|
|
OSX)
|
|
|
|
PARAM="$PARAM OSX=1 UNIX=1"
|
|
|
|
;;
|
|
|
|
FREEBSD)
|
|
|
|
PARAM="$PARAM FREEBSD=1"
|
|
|
|
;;
|
|
|
|
MORPHOS)
|
|
|
|
PARAM="$PARAM MORPHOS=1 UNIX=1"
|
|
|
|
;;
|
|
|
|
BEOS)
|
|
|
|
PARAM="$PARAM BEOS=1 UNIX=1"
|
|
|
|
;;
|
|
|
|
SUNOS)
|
|
|
|
PARAM="$PARAM SUNOS=1 UNIX=1"
|
|
|
|
;;
|
|
|
|
CYGWIN)
|
|
|
|
PARAM="$PARAM CYGWIN=1 WIN32=1"
|
|
|
|
;;
|
|
|
|
MINGW)
|
|
|
|
PARAM="$PARAM MINGW=1 WIN32=1"
|
|
|
|
;;
|
|
|
|
*)
|
2006-03-14 20:59:03 +00:00
|
|
|
echo "Unknown OS: $TARGET_OS"
|
2006-03-14 19:12:39 +00:00
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
PARAM="$PARAM BYPASS_OS_DETECT=1"
|
|
|
|
fi
|
|
|
|
|
2006-03-14 21:35:15 +00:00
|
|
|
if ! test -z "$DEBUG_SET"
|
|
|
|
then
|
|
|
|
if test -z "`echo $PARAM | grep "DEBUG="`"
|
|
|
|
then
|
|
|
|
# Someone did --debug, without assigning a value, assume 1
|
|
|
|
PARAM="$PARAM DEBUG=1"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# First remove the Makefile.config, else you can have double entries
|
2006-06-10 20:11:02 +00:00
|
|
|
rm -f Makefile.config
|
2006-03-14 21:35:15 +00:00
|
|
|
|
2006-03-23 15:34:47 +00:00
|
|
|
echo "make upgradeconf $PARAM" > Makefile.run
|
|
|
|
. Makefile.run
|
|
|
|
rm -f Makefile.run
|
2006-03-14 19:12:39 +00:00
|
|
|
|
|
|
|
# Makefile.config currently doesn't support custom CXX, so, we add the line
|
|
|
|
# ourself!
|
|
|
|
|
2006-03-14 19:15:46 +00:00
|
|
|
if ! test -z "$TARGET_CXX"
|
|
|
|
then
|
|
|
|
echo "CXX=$TARGET_CXX" >> Makefile.config
|
|
|
|
fi
|
2006-03-14 19:12:39 +00:00
|
|
|
|
2006-03-14 19:21:49 +00:00
|
|
|
# Same for RELEASE (read: REVISION)
|
|
|
|
|
|
|
|
if ! test -z "$RELEASE"
|
|
|
|
then
|
|
|
|
echo "RELEASE=$RELEASE" >> Makefile.config
|
|
|
|
fi
|
|
|
|
|