config.lib
changeset 10385 4f9838649c7f
parent 10379 dd9d0aade65e
child 10393 4441e16edb52
equal deleted inserted replaced
10384:6b408b83ac34 10385:4f9838649c7f
   444 	if [ "$endian" = "PREPROCESSOR" ] && [ "$os" != "OSX" ]; then
   444 	if [ "$endian" = "PREPROCESSOR" ] && [ "$os" != "OSX" ]; then
   445 		echo "configure: error: invalid option --endian=$endian"
   445 		echo "configure: error: invalid option --endian=$endian"
   446 		echo " PREPROCESSOR is only available for OSX"
   446 		echo " PREPROCESSOR is only available for OSX"
   447 		exit 1
   447 		exit 1
   448 	fi
   448 	fi
   449 	# OS only allows DETECT, UNIX, OSX, FREEBSD, OPENBSD, MORPHOS, BEOS, SUNOS, CYGWIN, MINGW, OS2, WINCE, and PSP
   449 	# OS only allows DETECT, UNIX, OSX, FREEBSD, OPENBSD, MORPHOS, BEOS, SUNOS, CYGWIN, MINGW, OS2, DOS, WINCE, and PSP
   450 	if [ -z "`echo $os | egrep '^(DETECT|UNIX|OSX|FREEBSD|OPENBSD|NETBSD|HPUX|MORPHOS|BEOS|SUNOS|CYGWIN|MINGW|OS2|WINCE|PSP)$'`" ]; then
   450 	if [ -z "`echo $os | egrep '^(DETECT|UNIX|OSX|FREEBSD|OPENBSD|NETBSD|HPUX|MORPHOS|BEOS|SUNOS|CYGWIN|MINGW|OS2|DOS|WINCE|PSP)$'`" ]; then
   451 		echo "configure: error: invalid option --os=$os"
   451 		echo "configure: error: invalid option --os=$os"
   452 		echo " Available options are: --os=[DETECT|UNIX|OSX|FREEBSD|OPENBSD|NETBSD|HPUX|MORPHOS|BEOS|SUNOS|CYGWIN|MINGW|OS2|WINCE|PSP]"
   452 		echo " Available options are: --os=[DETECT|UNIX|OSX|FREEBSD|OPENBSD|NETBSD|HPUX|MORPHOS|BEOS|SUNOS|CYGWIN|MINGW|OS2|DOS|WINCE|PSP]"
   453 		exit 1
   453 		exit 1
   454 	fi
   454 	fi
   455 	# cpu_type can be either 32 or 64
   455 	# cpu_type can be either 32 or 64
   456 	if [ -z "`echo $cpu_type | egrep '^(32|64|DETECT)$'`" ]; then
   456 	if [ -z "`echo $cpu_type | egrep '^(32|64|DETECT)$'`" ]; then
   457 		echo "configure: error: invalid option --cpu-type=$cpu_type"
   457 		echo "configure: error: invalid option --cpu-type=$cpu_type"
   509 	check_lipo
   509 	check_lipo
   510 	check_makedepend
   510 	check_makedepend
   511 	detect_cputype
   511 	detect_cputype
   512 
   512 
   513 	if [ "$enable_static" = "1" ]; then
   513 	if [ "$enable_static" = "1" ]; then
   514 		if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "MORPHOS" ]; then
   514 		if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "MORPHOS" ] || [ "$os" = "DOS" ]; then
   515 			enable_static="2"
   515 			enable_static="2"
   516 		else
   516 		else
   517 			enable_static="0"
   517 			enable_static="0"
   518 		fi
   518 		fi
   519 	fi
   519 	fi
   520 
   520 
   521 	if [ "$enable_static" != "0" ]; then
   521 	if [ "$enable_static" != "0" ]; then
   522 		log 1 "checking static... yes"
   522 		log 1 "checking static... yes"
   523 
   523 
   524 		if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ] && [ "$os" != "OSX" ] && [ "$os" != "MORPHOS" ]; then
   524 		if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ] && [ "$os" != "OSX" ] && [ "$os" != "MORPHOS" ] && [ "$os" != "DOS" ]; then
   525 			log 1 "WARNING: static is only known to work on Windows, MacOSX and MorphOS"
   525 			log 1 "WARNING: static is only known to work on Windows, DOS, MacOSX and MorphOS"
   526 			log 1 "WARNING: use static at your own risk on this platform"
   526 			log 1 "WARNING: use static at your own risk on this platform"
   527 
   527 
   528 			sleep 5
   528 			sleep 5
   529 		fi
   529 		fi
   530 	else
   530 	else
   531 		log 1 "checking static... no"
   531 		log 1 "checking static... no"
   532 	fi
   532 	fi
   533 
   533 
   534 	if [ "$enable_unicode" = "1" ]; then
   534 	if [ "$enable_unicode" = "1" ]; then
   535 		if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ]; then
   535 		if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "DOS" ]; then
   536 			enable_unicode="2"
   536 			enable_unicode="2"
   537 		else
   537 		else
   538 			enable_unicode="0"
   538 			enable_unicode="0"
   539 		fi
   539 		fi
   540 	fi
   540 	fi
   593 		else
   593 		else
   594 			log 1 "checking dedicated... not selected"
   594 			log 1 "checking dedicated... not selected"
   595 		fi
   595 		fi
   596 	fi
   596 	fi
   597 
   597 
   598 	if [ "$enable_network" != "0" ]; then
   598 	if [ "$enable_network" = "1" ] && [ "$os" = "DOS" ]; then
       
   599 		log 1 "checking network... DOS, skipping"
       
   600 		enable_network=0
       
   601 	elif [ "$enable_network" != "0" ]; then
   599 		log 1 "checking network... found"
   602 		log 1 "checking network... found"
   600 	else
   603 	else
   601 		log 1 "checking network... disabled"
   604 		log 1 "checking network... disabled"
   602 	fi
   605 	fi
   603 
   606 
   745 		fi
   748 		fi
   746 
   749 
   747 		log 1 "checking ccache... $ccache"
   750 		log 1 "checking ccache... $ccache"
   748 	fi
   751 	fi
   749 
   752 
       
   753 	if [ "$os" = "DOS" ]; then
       
   754 		with_threads="0"
       
   755 	fi
       
   756 
   750 	if [ "$os" != "OSX" ] && [ "$with_osx_sysroot" != "0" ]; then
   757 	if [ "$os" != "OSX" ] && [ "$with_osx_sysroot" != "0" ]; then
   751 		if [ "$with_osx_sysroot" = "1" ]; then
   758 		if [ "$with_osx_sysroot" = "1" ]; then
   752 			with_osx_sysroot="0"
   759 			with_osx_sysroot="0"
   753 
   760 
   754 			log 1 "checking OSX sysroot... not OSX, skipping"
   761 			log 1 "checking OSX sysroot... not OSX, skipping"
   895 	else
   902 	else
   896 		icon_theme_dir="`echo $icon_theme_dir | sed 's~\([^\]\)\\\\ ~\1\\\\\\\\ ~g;s~\([^\]\) ~\1\\\\\\\\ ~g'`"
   903 		icon_theme_dir="`echo $icon_theme_dir | sed 's~\([^\]\)\\\\ ~\1\\\\\\\\ ~g;s~\([^\]\) ~\1\\\\\\\\ ~g'`"
   897 	fi
   904 	fi
   898 
   905 
   899 	if [ "$personal_dir" = "1" ]; then
   906 	if [ "$personal_dir" = "1" ]; then
   900 		if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "WINCE" ]; then
   907 		if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "WINCE" ] || [ "$os" = "DOS" ]; then
   901 			personal_dir="OpenTTD"
   908 			personal_dir="OpenTTD"
   902 		elif [ "$os" = "OSX" ]; then
   909 		elif [ "$os" = "OSX" ]; then
   903 			personal_dir="Documents/OpenTTD"
   910 			personal_dir="Documents/OpenTTD"
   904 		else
   911 		else
   905 			personal_dir=".openttd"
   912 			personal_dir=".openttd"
  1118 		if [ $cc_version -ge 42 ]; then
  1125 		if [ $cc_version -ge 42 ]; then
  1119 			CFLAGS="$CFLAGS -fno-strict-overflow"
  1126 			CFLAGS="$CFLAGS -fno-strict-overflow"
  1120 		fi
  1127 		fi
  1121 	fi
  1128 	fi
  1122 
  1129 
  1123 	if [ "$os" != "CYGWIN" ] && [ "$os" != "FREEBSD" ] && [ "$os" != "OPENBSD" ] && [ "$os" != "MINGW" ] && [ "$os" != "MORPHOS" ] && [ "$os" != "OSX" ] && [ "$os" != "WINCE" ] && [ "$os" != "PSP" ] && [ "$os" != "OS2" ]; then
  1130 	if [ "$os" != "CYGWIN" ] && [ "$os" != "FREEBSD" ] && [ "$os" != "OPENBSD" ] && [ "$os" != "MINGW" ] && [ "$os" != "MORPHOS" ] && [ "$os" != "OSX" ] && [ "$os" != "DOS" ] && [ "$os" != "WINCE" ] && [ "$os" != "PSP" ] && [ "$os" != "OS2" ]; then
  1124 		LIBS="$LIBS -lpthread"
  1131 		LIBS="$LIBS -lpthread"
  1125 	fi
  1132 	fi
  1126 
  1133 
  1127 	if [ "$os" != "CYGWIN" ] && [ "$os" != "MINGW" ] && [ "$os" != "WINCE" ]; then
  1134 	if [ "$os" != "CYGWIN" ] && [ "$os" != "MINGW" ] && [ "$os" != "DOS" ] && [ "$os" != "WINCE" ]; then
  1128 		LIBS="$LIBS -lc"
  1135 		LIBS="$LIBS -lc"
  1129 	fi
  1136 	fi
  1130 	if [ "$os" = "WINCE" ]; then
  1137 	if [ "$os" = "WINCE" ]; then
  1131 		LIBS="$LIBS -lcoredll -lcorelibc -laygshell -lws2 -e WinMainCRTStartup"
  1138 		LIBS="$LIBS -lcoredll -lcorelibc -laygshell -lws2 -e WinMainCRTStartup"
  1132 	fi
  1139 	fi
  1706 	log 1 "checking awk... $awk"
  1713 	log 1 "checking awk... $awk"
  1707 }
  1714 }
  1708 
  1715 
  1709 detect_os() {
  1716 detect_os() {
  1710 	if [ "$os" = "DETECT" ]; then
  1717 	if [ "$os" = "DETECT" ]; then
  1711 		# Detect UNIX, OSX, FREEBSD, OPENBSD, NETBSD, HPUX, MORPHOS, BEOS, SUNOS, CYGWIN, MINGW, OS2, WINCE, and PSP
  1718 		# Detect UNIX, OSX, FREEBSD, OPENBSD, NETBSD, HPUX, MORPHOS, BEOS, SUNOS, CYGWIN, MINGW, OS2, DOS, WINCE, and PSP
  1712 
  1719 
  1713 		# Try first via dumpmachine, then via uname
  1720 		# Try first via dumpmachine, then via uname
  1714 		os=`echo "$host" | tr '[A-Z]' '[a-z]' | $awk '
  1721 		os=`echo "$host" | tr '[A-Z]' '[a-z]' | $awk '
  1715 					/linux/        { print "UNIX";    exit}
  1722 					/linux/        { print "UNIX";    exit}
  1716 					/darwin/       { print "OSX";     exit}
  1723 					/darwin/       { print "OSX";     exit}
  1723 					/sunos/        { print "SUNOS";   exit}
  1730 					/sunos/        { print "SUNOS";   exit}
  1724 					/solaris/      { print "SUNOS";   exit}
  1731 					/solaris/      { print "SUNOS";   exit}
  1725 					/cygwin/       { print "CYGWIN";  exit}
  1732 					/cygwin/       { print "CYGWIN";  exit}
  1726 					/mingw/        { print "MINGW";   exit}
  1733 					/mingw/        { print "MINGW";   exit}
  1727 					/os2/          { print "OS2";     exit}
  1734 					/os2/          { print "OS2";     exit}
       
  1735 					/dos/          { print "DOS";     exit}
  1728 					/wince/        { print "WINCE";   exit}
  1736 					/wince/        { print "WINCE";   exit}
  1729 					/psp/          { print "PSP";     exit}
  1737 					/psp/          { print "PSP";     exit}
  1730 		'`
  1738 		'`
  1731 
  1739 
  1732 		if [ -z "$os" ]; then
  1740 		if [ -z "$os" ]; then
  1747 		fi
  1755 		fi
  1748 
  1756 
  1749 		if [ -z "$os" ]; then
  1757 		if [ -z "$os" ]; then
  1750 			log 1 "detecting OS... none detected"
  1758 			log 1 "detecting OS... none detected"
  1751 			log 1 "I couldn't detect your OS. Please use --os=OS to force one"
  1759 			log 1 "I couldn't detect your OS. Please use --os=OS to force one"
  1752 			log 1 "Allowed values are: UNIX, OSX, FREEBSD, OPENBSD, NETBSD, MORPHOS, HPUX, BEOS, SUNOS, CYGWIN, MINGW, OS2, WINCE, and PSP"
  1760 			log 1 "Allowed values are: UNIX, OSX, FREEBSD, OPENBSD, NETBSD, MORPHOS, HPUX, BEOS, SUNOS, CYGWIN, MINGW, OS2, DOS, WINCE, and PSP"
  1753 			exit 1
  1761 			exit 1
  1754 		fi
  1762 		fi
  1755 
  1763 
  1756 		log 1 "detecting OS... $os"
  1764 		log 1 "detecting OS... $os"
  1757 	else
  1765 	else
  1787 		return 0
  1795 		return 0
  1788 	fi
  1796 	fi
  1789 
  1797 
  1790 	# By default on OSX we don't use SDL. The rest is auto-detect
  1798 	# By default on OSX we don't use SDL. The rest is auto-detect
  1791 	if [ "$with_allegro" = "1" ] && [ "$os" = "OSX" ] && [ "$with_cocoa" != "0" ]; then
  1799 	if [ "$with_allegro" = "1" ] && [ "$os" = "OSX" ] && [ "$with_cocoa" != "0" ]; then
  1792 		log 1 "checking SDL... OSX, skipping"
  1800 		log 1 "checking Allegro... OSX, skipping"
  1793 
  1801 
  1794 		allegro_config=""
  1802 		allegro_config=""
  1795 		return 0
  1803 		return 0
  1796 	fi
  1804 	fi
  1797 
  1805 
  2018 			log 1 "configure: error: $2 couldn't be found"
  2026 			log 1 "configure: error: $2 couldn't be found"
  2019 			log 1 "configure: error: you supplied '$1', but it seems invalid"
  2027 			log 1 "configure: error: you supplied '$1', but it seems invalid"
  2020 
  2028 
  2021 			exit 1
  2029 			exit 1
  2022 		fi
  2030 		fi
       
  2031 
       
  2032 		eval "with_$2=0"
  2023 
  2033 
  2024 		return 0
  2034 		return 0
  2025 	fi
  2035 	fi
  2026 
  2036 
  2027 	eval "res=\$$2"
  2037 	eval "res=\$$2"
  2719 	echo "  --awk=AWK                      the awk to use in configure [awk]"
  2729 	echo "  --awk=AWK                      the awk to use in configure [awk]"
  2720 	echo "  --lipo=LIPO                    the lipo to use (OSX ONLY) [HOST-lipo]"
  2730 	echo "  --lipo=LIPO                    the lipo to use (OSX ONLY) [HOST-lipo]"
  2721 	echo "  --os=OS                        the OS we are compiling for [DETECT]"
  2731 	echo "  --os=OS                        the OS we are compiling for [DETECT]"
  2722 	echo "                                 DETECT/UNIX/OSX/FREEBSD/OPENBSD/NETBSD/"
  2732 	echo "                                 DETECT/UNIX/OSX/FREEBSD/OPENBSD/NETBSD/"
  2723 	echo "                                 MORPHOS/HPUX/BEOS/SUNOS/CYGWIN/MINGW/OS2/"
  2733 	echo "                                 MORPHOS/HPUX/BEOS/SUNOS/CYGWIN/MINGW/OS2/"
  2724 	echo "                                 WINCE/PSP"
  2734 	echo "                                 DOS/WINCE/PSP"
  2725 	echo "  --endian=ENDIAN                set the endian of the HOST (AUTO/LE/BE)"
  2735 	echo "  --endian=ENDIAN                set the endian of the HOST (AUTO/LE/BE)"
  2726 	echo "  --revision=rXXXX               overwrite the revision detection."
  2736 	echo "  --revision=rXXXX               overwrite the revision detection."
  2727 	echo "                                 Use with care!"
  2737 	echo "                                 Use with care!"
  2728 	echo ""
  2738 	echo ""
  2729 	echo "Paths:"
  2739 	echo "Paths:"