diff options
author | rubidium <rubidium@openttd.org> | 2011-12-05 20:11:42 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2011-12-05 20:11:42 +0000 |
commit | d60ec559836e9a42ca58ff4176587f92f5262139 (patch) | |
tree | 1dbe90ed99de16775067b78382e8cbf4ee10654b /config.lib | |
parent | ce21a91db7eadc51a34dad69d9e8f16dd6b60de4 (diff) | |
download | openttd-d60ec559836e9a42ca58ff4176587f92f5262139.tar.xz |
(svn r23438) -Fix [FS#4867]: perform checks for nforenum/grfcodec in configure, including a version check so a proper error can be given when a too old grfcodec or nforenum is used
Diffstat (limited to 'config.lib')
-rw-r--r-- | config.lib | 113 |
1 files changed, 113 insertions, 0 deletions
diff --git a/config.lib b/config.lib index 5507b9c73..8f1868226 100644 --- a/config.lib +++ b/config.lib @@ -90,6 +90,8 @@ set_default() { with_threads="1" with_distcc="1" with_ccache="1" + with_nforenum="1" + with_grfcodec="1" save_params_array=" build @@ -162,6 +164,8 @@ set_default() { with_threads with_distcc with_ccache + with_grfcodec + with_nforenum CC CXX CFLAGS CXXFLAGS LDFLAGS" } @@ -417,6 +421,14 @@ detect_params() { --with-ccache) with_ccache="2";; --with-ccache=*) with_ccache="$optarg";; + --without-nforenum) with_nforenum="0";; + --with-nforenum) with_nforenum="2";; + --with-nforenum=*) with_nforenum="$optarg";; + + --without-grfcodec) with_grfcodec="0";; + --with-grfcodec) with_grfcodec="2";; + --with-grfcodec=*) with_grfcodec="$optarg";; + --without-osx-sysroot) with_osx_sysroot="0";; --with-osx-sysroot) with_osx_sysroot="2";; --with-osx-sysroot=*) with_osx_sysroot="$optarg";; @@ -926,6 +938,21 @@ check_params() { log 1 "checking ccache... $ccache" fi + detect_grfcodec + detect_nforenum + + if [ -z "$grfcodec" ] && [ -n "$nforenum" ]; then + log 1 "checking nforenum/grfcodec... nforenum needs grfcodec enabled, disabling nforenum" + nforenum="" + return 0 + fi + + if [ -z "$nforenum" ] && [ -n "$grfcodec" ]; then + log 1 "checking nforenum/grfcodec... grfcodec needs nforenum enabled, disabling grfcodec" + grfcodec="" + return 0 + fi + if [ "$os" = "DOS" ]; then with_threads="0" fi @@ -3042,6 +3069,90 @@ detect_sort() { fi } +detect_grfcodec() { + # 0 means no, 1 is auto-detect, 2 is force + if [ "$with_grfcodec" = "0" ]; then + log 1 "checking grfcodec... disabled" + + grfcodec="" + return 0 + fi + + if [ "$with_grfcodec" = "1" ] || [ "$with_grfcodec" = "" ] || [ "$with_grfcodec" = "2" ]; then + grfcodec="grfcodec" + else + grfcodec="$with_grfcodec" + fi + + version=`$grfcodec -v | $awk '{print $3}' | sed 's/[rM]//g;s/-/0/' 2>/dev/null` + ret=$? + log 2 "executing grfcodec -v" + log 2 " returned $version" + log 2 " exit code $ret" + + if [ -z "$version" ] || [ "$ret" != "0" ] || [ "$version" -lt "846" ]; then + if [ -n "$version" ] && [ "$version" -lt "846" ]; then + log 1 "checking grfcodec... needs at least version 5.1.3 (r846), disabled" + else + log 1 "checking grfcodec... not found" + fi + + # It was forced, so it should be found. + if [ "$with_grfcodec" != "1" ]; then + log 1 "configure: error: grfcodec couldn't be found" + log 1 "configure: error: you supplied '$with_grfcodec', but it seems invalid" + exit 1 + fi + + grfcodec="" + return 0 + fi + + log 1 "checking grfcodec... found" +} + +detect_nforenum() { + # 0 means no, 1 is auto-detect, 2 is force + if [ "$with_nforenum" = "0" ]; then + log 1 "checking nforenum... disabled" + + nforenum="" + return 0 + fi + + if [ "$with_nforenum" = "1" ] || [ "$with_nforenum" = "" ] || [ "$with_nforenum" = "2" ]; then + nforenum="nforenum" + else + nforenum="$with_nforenum" + fi + + version=`$nforenum -v | $awk '{print $3}' | sed 's/[rM]//g;s/-/0/' 2>/dev/null` + ret=$? + log 2 "executing nforenum -v" + log 2 " returned $version" + log 2 " exit code $ret" + + if [ -z "$version" ] || [ "$ret" != "0" ] || [ "$version" -lt "846" ]; then + if [ -n "$version" ] && [ "$version" -lt "846" ]; then + log 1 "checking nforenum... needs at least version 5.1.3 (r846), disabled" + else + log 1 "checking nforenum... not found" + fi + + # It was forced, so it should be found. + if [ "$with_nforenum" != "1" ]; then + log 1 "configure: error: nforenum couldn't be found" + log 1 "configure: error: you supplied '$with_nforenum', but it seems invalid" + exit 1 + fi + + nforenum="" + return 0 + fi + + log 1 "checking nforenum... found" +} + detect_cputype() { if [ -n "$cpu_type" ] && [ "$cpu_type" != "DETECT" ]; then log 1 "forcing cpu-type... $cpu_type bits" @@ -3139,6 +3250,8 @@ make_sed() { s@!!REVISION!!@$revision@g; s@!!AWK!!@$awk@g; s@!!DISTCC!!@$distcc@g; + s@!!NFORENUM!!@$nforenum@g; + s@!!GRFCODEC!!@$grfcodec@g; " if [ "$icon_theme_dir" != "" ]; then |