File diff r14207:f0d2dcb62e53 → r14208:c4ac4f772e63
config.lib
Show inline comments
 
@@ -64,12 +64,13 @@ set_default() {
 
	with_application_bundle="1"
 
	with_menu_entry="1"
 
	with_allegro="1"
 
	with_sdl="1"
 
	with_cocoa="1"
 
	with_zlib="1"
 
	with_lzo2="1"
 
	with_png="1"
 
	enable_builtin_depend="1"
 
	with_makedepend="0"
 
	with_direct_music="1"
 
	with_sort="1"
 
	with_iconv="1"
 
@@ -133,12 +134,13 @@ set_default() {
 
		with_osx_sysroot
 
		with_application_bundle
 
		with_allegro
 
		with_sdl
 
		with_cocoa
 
		with_zlib
 
		with_lzo2
 
		with_png
 
		enable_builtin_depend
 
		with_makedepend
 
		with_direct_music
 
		with_sort
 
		with_iconv
 
@@ -316,12 +318,19 @@ detect_params() {
 
			--with-cocoa=*)               with_cocoa="$optarg";;
 

	
 
			--with-zlib)                  with_zlib="2";;
 
			--without-zlib)               with_zlib="0";;
 
			--with-zlib=*)                with_zlib="$optarg";;
 

	
 
			--with-lzo2)                  with_lzo2="2";;
 
			--without-lzo2)               with_lzo2="0";;
 
			--with-lzo2=*)                with_lzo2="$optarg";;
 
			--with-liblzo2)               with_lzo2="2";;
 
			--without-liblzo2)            with_lzo2="0";;
 
			--with-liblzo2=*)             with_lzo2="$optarg";;
 

	
 
			--with-png)                   with_png="2";;
 
			--without-png)                with_png="0";;
 
			--with-png=*)                 with_png="$optarg";;
 
			--with-libpng)                with_png="2";;
 
			--without-libpng)             with_png="0";;
 
			--with-libpng=*)              with_png="$optarg";;
 
@@ -741,12 +750,28 @@ check_params() {
 
			log 1 "configure: error: no zlib detected"
 
			log 1 " If you want to compile without zlib use --without-zlib as parameter"
 
			exit
 
		fi
 
	fi
 

	
 
	pre_detect_with_lzo2=$with_lzo2
 
	detect_lzo2
 

	
 
	if [ "$with_lzo2" = "0" ] || [ -z "$lzo2" ]; then
 
		log 1 "WARNING: liblzo2 was not detected or disabled"
 
		log 1 "WARNING: OpenTTD doesn't require liblzo2, but it does mean that"
 
		log 1 "WARNING: loading old savegames/scenarios will be disabled."
 
		if [ "$pre_detect_with_lzo2" = "0" ]; then
 
			log 1 "WARNING: We strongly suggest you to install liblzo2."
 
		else
 
			log 1 "configure: error: no liblzo2 detected"
 
			log 1 " If you want to compile without liblzo2 use --without-liblzo2 as parameter"
 
			exit
 
		fi
 
	fi
 

	
 
	detect_png
 
	detect_freetype
 
	detect_fontconfig
 
	detect_icu
 
	detect_pspconfig
 
	detect_libtimidity
 
@@ -1387,12 +1412,21 @@ make_cflags_and_ldflags() {
 
		else
 
			LIBS="$LIBS -lz"
 
		fi
 
		CFLAGS="$CFLAGS -DWITH_ZLIB"
 
	fi
 

	
 
	if [ "$with_lzo2" != "0" ]; then
 
		if [ "$enable_static" != "0" ] && [ "$os" != "OSX" ]; then
 
			LIBS="$LIBS $lzo2"
 
		else
 
			LIBS="$LIBS -llzo2"
 
		fi
 
		CFLAGS="$CFLAGS -DWITH_LZO"
 
	fi
 

	
 
	# 64bit machines need -D_SQ64
 
	if [ "$cpu_type" = "64" ] && [ "$enable_universal" = "0" ]; then
 
		CFLAGS="$CFLAGS -D_SQ64"
 
	fi
 
	CFLAGS="$CFLAGS -I$SCRIPT_SRC_DIR"
 

	
 
@@ -2233,37 +2267,38 @@ EOF
 
}
 

	
 
detect_library() {
 
	# $1 - config-param ($with_zlib value)
 
	# $2 - library name ('zlib', sets $zlib)
 
	# $3 - static library name (libz.a)
 
	# $4 - header name (zlib.h)
 
	# $5 - force static (if non-empty)
 

	
 
	if [ -n "$5" ]; then force_static="1"; fi
 
	# $4 - header directory ()
 
	# $5 - header name (zlib.h)
 
	# $6 - force static (if non-empty)
 

	
 
	if [ -n "$6" ]; then force_static="1"; fi
 

	
 
	# 0 means no, 1 is auto-detect, 2 is force
 
	if [ "$1" = "0" ]; then
 
		log 1 "checking $2... disabled"
 

	
 
		eval "$2=\"\""
 
		return 0
 
	fi
 

	
 
	log 2 "detecting $2"
 

	
 
	if [ "$1" = "1" ] || [ "$1" = "" ] || [ "$1" = "2" ]; then
 
		eval "$2=`ls -1 /usr/include/*.h 2>/dev/null | egrep \"\/$4\$\"`"
 
		eval "$2=`ls -1 /usr/include/$4*.h 2>/dev/null | egrep \"\/$5\$\"`"
 
		eval "res=\$$2"
 
		if [ -z "$res" ]; then
 
			log 2 "  trying /usr/include/$4... no"
 
			eval "$2=`ls -1 /usr/local/include/*.h 2>/dev/null | egrep \"\/$4\$\"`"
 
			log 2 "  trying /usr/include/$4$5... no"
 
			eval "$2=`ls -1 /usr/local/include/$4*.h 2>/dev/null | egrep \"\/$5\$\"`"
 
		fi
 
		eval "res=\$$2"
 
		if [ -z "$res" ]; then
 
			log 2 "  trying /usr/local/include/$4... no"
 
			log 2 "  trying /usr/local/include/$4$5... no"
 
		fi
 

	
 
		eval "res=\$$2"
 
		if [ -n "$res" ] && ( [ -n "$force_static" ] || ( [ "$enable_static" != "0" ] && [ "$os" != "OSX" ] ) ); then
 
			eval "res=\$$2"
 
			log 2 "  trying $res... found"
 
@@ -2320,17 +2355,21 @@ detect_library() {
 
	log 2 "  trying $res... found"
 

	
 
	log 1 "checking $2... found"
 
}
 

	
 
detect_zlib() {
 
	detect_library "$with_zlib" "zlib" "libz.a" "zlib.h"
 
	detect_library "$with_zlib" "zlib" "libz.a" "" "zlib.h"
 
}
 

	
 
detect_lzo2() {
 
	detect_library "$with_lzo2" "lzo2" "liblzo2.a" "lzo/" "lzo1x.h"
 
}
 

	
 
detect_libtimidity() {
 
	detect_library "$with_libtimidity" "libtimidity" "libtimidity.a" "timidity.h"
 
	detect_library "$with_libtimidity" "libtimidity" "" "libtimidity.a" "timidity.h"
 
}
 

	
 
detect_png() {
 
	# 0 means no, 1 is auto-detect, 2 is force
 
	if [ "$with_png" = "0" ]; then
 
		log 1 "checking libpng... disabled"
 
@@ -3110,12 +3149,13 @@ showhelp() {
 
	echo "                                 midi-player"
 
	echo "  --with-allegrol[=allegro-config]"
 
	echo "                                 enables Allegro video driver support"
 
	echo "  --with-cocoa                   enables COCOA video driver (OSX ONLY)"
 
	echo "  --with-sdl[=sdl-config]        enables SDL video driver support"
 
	echo "  --with-zlib[=zlib.a]           enables zlib support"
 
	echo "  --with-liblzo2[=liblzo2.a]     enables liblzo2 support"
 
	echo "  --with-png[=libpng-config]     enables libpng support"
 
	echo "  --with-freetype[=freetype-config]"
 
	echo "                                 enables libfreetype support"
 
	echo "  --with-fontconfig[=pkg-config fontconfig]"
 
	echo "                                 enables fontconfig support"
 
	echo "  --with-icu[=icu-config]        enables icu (used for right-to-left support)"