config.lib
branchcpp_gui
changeset 6254 abc6ad7c035c
parent 6232 09125a3ceba4
child 6268 4b5241e5dd10
equal deleted inserted replaced
6253:23983700e3d7 6254:abc6ad7c035c
    50 	with_direct_music="1"
    50 	with_direct_music="1"
    51 	with_sort="1"
    51 	with_sort="1"
    52 	with_iconv="1"
    52 	with_iconv="1"
    53 	with_midi=""
    53 	with_midi=""
    54 	with_midi_arg=""
    54 	with_midi_arg=""
       
    55 	with_libtimidity="1"
    55 	with_freetype="1"
    56 	with_freetype="1"
    56 	with_fontconfig="1"
    57 	with_fontconfig="1"
    57 	with_psp_config="1"
    58 	with_psp_config="1"
    58 
    59 
    59 	save_params_array="build host cc_build cc_host cxx_build cxx_host windres strip 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 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_freetype with_fontconfig with_psp_config CC CXX CFLAGS LDFLAGS"
    60 	save_params_array="build host cc_build cc_host cxx_build cxx_host windres strip 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 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"
    60 }
    61 }
    61 
    62 
    62 detect_params() {
    63 detect_params() {
    63 	# Walk over all params from the user and override any default settings if
    64 	# Walk over all params from the user and override any default settings if
    64 	#  needed. This also handles any invalid option.
    65 	#  needed. This also handles any invalid option.
   182 			--with-png=*)                 with_png="$optarg";;
   183 			--with-png=*)                 with_png="$optarg";;
   183 			--with-libpng)                with_png="2";;
   184 			--with-libpng)                with_png="2";;
   184 			--without-libpng)             with_png="0";;
   185 			--without-libpng)             with_png="0";;
   185 			--with-libpng=*)              with_png="$optarg";;
   186 			--with-libpng=*)              with_png="$optarg";;
   186 
   187 
       
   188 			--with-libtimidity)           with_libtimidity="2";;
       
   189 			--without-libtimidity)        with_libtimidity="0";;
       
   190 			--with-libtimidity=*)         with_libtimidity="$optarg";;
       
   191 
   187 			--with-freetype)              with_freetype="2";;
   192 			--with-freetype)              with_freetype="2";;
   188 			--without-freetype)           with_freetype="0";;
   193 			--without-freetype)           with_freetype="0";;
   189 			--with-freetype=*)            with_freetype="$optarg";;
   194 			--with-freetype=*)            with_freetype="$optarg";;
   190 			--with-libfreetype)           with_freetype="2";;
   195 			--with-libfreetype)           with_freetype="2";;
   191 			--without-libfreetype)        with_freetype="0";;
   196 			--without-libfreetype)        with_freetype="0";;
   419 	detect_png
   424 	detect_png
   420 	detect_freetype
   425 	detect_freetype
   421 	detect_fontconfig
   426 	detect_fontconfig
   422 	detect_iconv
   427 	detect_iconv
   423 	detect_pspconfig
   428 	detect_pspconfig
       
   429 	detect_libtimidity
   424 
   430 
   425 	if [ "$with_direct_music" = "1" ] || [ "$with_direct_music" = "2" ]; then
   431 	if [ "$with_direct_music" = "1" ] || [ "$with_direct_music" = "2" ]; then
   426 		if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ]; then
   432 		if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ]; then
   427 			if [ "$with_direct_music" = "2" ]; then
   433 			if [ "$with_direct_music" = "2" ]; then
   428 				log 1 "configure: error: direct-music is only supported on Win32 targets"
   434 				log 1 "configure: error: direct-music is only supported on Win32 targets"
   772 		fi
   778 		fi
   773 	fi
   779 	fi
   774 
   780 
   775 	if [ "$with_direct_music" != "0" ]; then
   781 	if [ "$with_direct_music" != "0" ]; then
   776 		CFLAGS="$CFLAGS -DWIN32_ENABLE_DIRECTMUSIC_SUPPORT"
   782 		CFLAGS="$CFLAGS -DWIN32_ENABLE_DIRECTMUSIC_SUPPORT"
       
   783 	fi
       
   784 
       
   785 	if [ -n "$libtimidity" ]; then
       
   786 		if [ "$enable_static" != "0" ]; then
       
   787 			LIBS="$LIBS $libtimidity"
       
   788 		else
       
   789 			LIBS="$LIBS -ltimidity"
       
   790 		fi
       
   791 		CFLAGS="$CFLAGS -DLIBTIMIDITY"
   777 	fi
   792 	fi
   778 
   793 
   779 	if [ "$with_iconv" != "0" ]; then
   794 	if [ "$with_iconv" != "0" ]; then
   780 		CFLAGS="$CFLAGS -DWITH_ICONV"
   795 		CFLAGS="$CFLAGS -DWITH_ICONV"
   781 		LIBS="$LIBS -liconv"
   796 		LIBS="$LIBS -liconv"
  1271 	fi
  1286 	fi
  1272 
  1287 
  1273 	log 1 "checking COCOA... found"
  1288 	log 1 "checking COCOA... found"
  1274 }
  1289 }
  1275 
  1290 
  1276 detect_zlib() {
  1291 detect_library() {
       
  1292 	# $1 - config-param ($with_zlib value)
       
  1293 	# $2 - library name ('zlib', sets $zlib)
       
  1294 	# $3 - static library name (libz.a)
       
  1295 	# $4 - header name (zlib.h)
       
  1296 
  1277 	# 0 means no, 1 is auto-detect, 2 is force
  1297 	# 0 means no, 1 is auto-detect, 2 is force
  1278 	if [ "$with_zlib" = "0" ]; then
  1298 	if [ "$1" = "0" ]; then
  1279 		log 1 "checking zlib... disabled"
  1299 		log 1 "checking $2... disabled"
  1280 
  1300 
  1281 		zlib=""
  1301 		eval "$2=\"\""
  1282 		return 0
  1302 		return 0
  1283 	fi
  1303 	fi
  1284 
  1304 
  1285 	log 2 "detecting zlib"
  1305 	log 2 "detecting $2"
  1286 
  1306 
  1287 	if [ "$with_zlib" = "1" ] || [ "$with_zlib" = "" ] || [ "$with_zlib" = "2" ]; then
  1307 	if [ "$1" = "1" ] || [ "$1" = "" ] || [ "$1" = "2" ]; then
  1288 		zlib=`ls -1 /usr/include/*.h 2>/dev/null | grep "\/zlib.h$"`
  1308 		eval "$2=`ls -1 /usr/include/*.h 2>/dev/null | grep \"\/$4\$\"`"
  1289 		if [ -z "$zlib" ]; then
  1309 		eval "res=\$$2"
  1290 			log 2 "  trying /usr/include/zlib.h... no"
  1310 		if [ -z "$res" ]; then
  1291 			zlib=`ls -1 /usr/local/include/*.h 2>/dev/null | grep "\/zlib.h$"`
  1311 			log 2 "  trying /usr/include/$4... no"
  1292 		fi
  1312 			eval "$2=`ls -1 /usr/local/include/*.h 2>/dev/null | grep \"\/$4\$\"`"
  1293 		if [ -z "$zlib" ]; then
  1313 		fi
  1294 			log 2 "  trying /usr/local/include/zlib.h... no"
  1314 		eval "res=\$$2"
  1295 		fi
  1315 		if [ -z "$res" ]; then
  1296 
  1316 			log 2 "  trying /usr/local/include/$4... no"
  1297 		if [ -n "$zlib" ] && [ "$enable_static" != "0" ] && [ "$os" != "OSX" ]; then
  1317 		fi
  1298 			log 2 "  trying $zlib... found"
  1318 
       
  1319 		eval "res=\$$2"
       
  1320 		if [ -n "$res" ] && [ "$enable_static" != "0" ] && [ "$os" != "OSX" ]; then
       
  1321 			eval "res=\$$2"
       
  1322 			log 2 "  trying $res... found"
  1299 			# Now find the static lib, if needed
  1323 			# Now find the static lib, if needed
  1300 			zlib=`ls /lib/*.a 2>/dev/null | grep "\/libz.a$"`
  1324 			eval "$2=`ls /lib/*.a 2>/dev/null | grep \"\/$3\$\"`"
  1301 			if [ -z "$zlib" ]; then
  1325 			eval "res=\$$2"
  1302 				log 2 "  trying /lib/libz.a... no"
  1326 			if [ -z "$res" ]; then
  1303 				zlib=`ls /usr/lib/*.a 2>/dev/null | grep "\/libz.a$"`
  1327 				log 2 "  trying /lib/$3... no"
       
  1328 				eval "$2=`ls /usr/lib/*.a 2>/dev/null | grep \"\/$3\$\"`"
  1304 			fi
  1329 			fi
  1305 			if [ -z "$zlib" ]; then
  1330 			eval "res=\$$2"
  1306 				log 2 "  trying /usr/lib/libz.a... no"
  1331 			if [ -z "$res" ]; then
  1307 				zlib=`ls /usr/local/lib/*.a 2>/dev/null | grep "\/libz.a$"`
  1332 				log 2 "  trying /usr/lib/$3... no"
       
  1333 				eval "$2=`ls /usr/local/lib/*.a 2>/dev/null | grep \"\/$3\$\"`"
  1308 			fi
  1334 			fi
  1309 			if [ -z "$zlib" ]; then
  1335 			eval "res=\$$2"
  1310 				log 2 "  trying /usr/local/lib/libz.a... no"
  1336 			if [ -z "$res" ]; then
  1311 				log 1 "configure: error: zlib couldn't be found"
  1337 				log 2 "  trying /usr/local/lib/$3... no"
  1312 				log 1 "configure: error: you requested a static link, but I can't find zlib.a"
  1338 				log 1 "configure: error: $2 couldn't be found"
       
  1339 				log 1 "configure: error: you requested a static link, but I can't find $3"
  1313 
  1340 
  1314 				exit 1
  1341 				exit 1
  1315 			fi
  1342 			fi
  1316 		fi
  1343 		fi
  1317 	else
  1344 	else
  1318 		# Make sure it exists
  1345 		# Make sure it exists
  1319 		if [ -f "$with_zlib" ]; then
  1346 		if [ -f "$1" ]; then
  1320 			zlib=`ls $with_zlib 2>/dev/null`
  1347 			eval "$2=`ls $1 2>/dev/null`"
  1321 		else
  1348 		else
  1322 			zlib=`ls $with_zlib/libz.a 2>/dev/null`
  1349 			eval "$2=`ls $1/$3 2>/dev/null`"
  1323 		fi
  1350 		fi
  1324 	fi
  1351 	fi
  1325 
  1352 
  1326 	if [ -z "$zlib" ]; then
  1353 	eval "res=\$$2"
  1327 		log 1 "checking zlib... not found"
  1354 	if [ -z "$res" ]; then
  1328 		if [ "$with_zlib" = "2" ]; then
  1355 		log 1 "checking $2... not found"
  1329 			log 1 "configure: error: zlib couldn't be found"
  1356 		if [ "$1" = "2" ]; then
  1330 
  1357 			log 1 "configure: error: $2 couldn't be found"
  1331 			exit 1
  1358 
  1332 		elif [ "$with_zlib" != "1" ]; then
  1359 			exit 1
  1333 			log 1 "configure: error: zlib couldn't be found"
  1360 		elif [ "$1" != "1" ]; then
  1334 			log 1 "configure: error: you supplied '$with_zlib', but it seems invalid"
  1361 			log 1 "configure: error: $2 couldn't be found"
       
  1362 			log 1 "configure: error: you supplied '$1', but it seems invalid"
  1335 
  1363 
  1336 			exit 1
  1364 			exit 1
  1337 		fi
  1365 		fi
  1338 
  1366 
  1339 		return 0
  1367 		return 0
  1340 	fi
  1368 	fi
  1341 
  1369 
  1342 	log 2 "  trying $zlib... found"
  1370 	eval "res=\$$2"
  1343 
  1371 	log 2 "  trying $res... found"
  1344 	log 1 "checking zlib... found"
  1372 
       
  1373 	log 1 "checking $2... found"
       
  1374 }
       
  1375 
       
  1376 detect_zlib() {
       
  1377 	detect_library "$with_zlib" "zlib" "libz.a" "zlib.h"
       
  1378 }
       
  1379 
       
  1380 detect_libtimidity() {
       
  1381 	detect_library "$with_libtimidity" "libtimidity" "libtimidity.a" "timidity.h"
  1345 }
  1382 }
  1346 
  1383 
  1347 detect_png() {
  1384 detect_png() {
  1348 	# 0 means no, 1 is auto-detect, 2 is force
  1385 	# 0 means no, 1 is auto-detect, 2 is force
  1349 	if [ "$with_png" = "0" ]; then
  1386 	if [ "$with_png" = "0" ]; then