| 1 |
#!/bin/sh |
| 2 |
# |
| 3 |
# configure -- custom configure script for the ScummVM tools. |
| 4 |
# |
| 5 |
# ScummVM Tools is the legal property of its developers, whose names |
| 6 |
# are too numerous to list here. Please refer to the COPYRIGHT |
| 7 |
# file distributed with this source distribution. |
| 8 |
# |
| 9 |
# This program is free software: you can redistribute it and/or modify |
| 10 |
# it under the terms of the GNU General Public License as published by |
| 11 |
# the Free Software Foundation, either version 3 of the License, or |
| 12 |
# (at your option) any later version. |
| 13 |
# |
| 14 |
# This program is distributed in the hope that it will be useful, |
| 15 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 |
# GNU General Public License for more details. |
| 18 |
# |
| 19 |
# You should have received a copy of the GNU General Public License |
| 20 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 21 |
|
| 22 |
|
| 23 |
# Save the current environment variables for next runs |
| 24 |
SAVED_CONFIGFLAGS=$@ |
| 25 |
SAVED_LDFLAGS=$LDFLAGS |
| 26 |
SAVED_PKG_CONFIG_LIBDIR=${PKG_CONFIG_LIBDIR:-unset} |
| 27 |
SAVED_CXX=$CXX |
| 28 |
SAVED_CXXFLAGS=$CXXFLAGS |
| 29 |
SAVED_CPPFLAGS=$CPPFLAGS |
| 30 |
SAVED_ASFLAGS=$ASFLAGS |
| 31 |
SAVED_WINDRESFLAGS=$WINDRESFLAGS |
| 32 |
|
| 33 |
# Use environment vars if set |
| 34 |
CXXFLAGS="$CXXFLAGS $CPPFLAGS" |
| 35 |
|
| 36 |
# Backslashes into forward slashes: |
| 37 |
# The following OS/2 specific code is performed to deal with handling of backslashes by ksh. |
| 38 |
# Borrowed from the Sane configure script |
| 39 |
|
| 40 |
if test "$ac_emxsupport" != "no" -a "$ac_emxsupport" != "NO"; then |
| 41 |
ac_save_IFS="$IFS" |
| 42 |
IFS="\\" |
| 43 |
ac_TEMP_PATH= |
| 44 |
for ac_dir in $PATH; do |
| 45 |
IFS=$ac_save_IFS |
| 46 |
if test -z "$ac_TEMP_PATH"; then |
| 47 |
ac_TEMP_PATH="$ac_dir" |
| 48 |
else |
| 49 |
ac_TEMP_PATH="$ac_TEMP_PATH/$ac_dir" |
| 50 |
fi |
| 51 |
done |
| 52 |
PATH="$ac_TEMP_PATH" |
| 53 |
export PATH |
| 54 |
unset ac_TEMP_PATH |
| 55 |
fi |
| 56 |
|
| 57 |
set_var() { |
| 58 |
eval ${1}='${2}' |
| 59 |
} |
| 60 |
|
| 61 |
get_var() { |
| 62 |
eval echo \$${1} |
| 63 |
} |
| 64 |
|
| 65 |
_srcdir=`dirname $0` |
| 66 |
|
| 67 |
# |
| 68 |
# Default settings |
| 69 |
# |
| 70 |
# Default lib behavior yes/no/auto |
| 71 |
_vorbis=auto |
| 72 |
_tremor=auto |
| 73 |
_flac=auto |
| 74 |
_mad=auto |
| 75 |
_zlib=auto |
| 76 |
_png=auto |
| 77 |
_freetype2=auto |
| 78 |
_wxwidgets=auto |
| 79 |
_iconv=auto |
| 80 |
_boost=auto |
| 81 |
_endian=unknown |
| 82 |
_need_memalign=no |
| 83 |
# Default option behavior yes/no |
| 84 |
_debug_build=auto |
| 85 |
_release_build=auto |
| 86 |
_verbose_build=no |
| 87 |
_enable_prof=no |
| 88 |
_use_cxx11=yes |
| 89 |
# Default commands |
| 90 |
_ranlib=ranlib |
| 91 |
_strip=strip |
| 92 |
_ar="ar cru" |
| 93 |
_as="as" |
| 94 |
_windres=windres |
| 95 |
_pkgconfig=pkg-config |
| 96 |
_wxconfig=wx-config |
| 97 |
_wxpath="$PATH" |
| 98 |
_prefix=/usr/local |
| 99 |
_wxincludes="" |
| 100 |
_wxlibs="" |
| 101 |
_wxstaticlibs="" |
| 102 |
_freetypeconfig=freetype-config |
| 103 |
_freetype_found="false" |
| 104 |
_freetypepath="$PATH" |
| 105 |
_staticlibpath="" |
| 106 |
_xcodetoolspath="" |
| 107 |
_amigaospath="install" |
| 108 |
_morphospath="PROGDIR:" |
| 109 |
# For cross compiling |
| 110 |
_host="" |
| 111 |
_host_cpu="" |
| 112 |
_host_vendor="" |
| 113 |
_host_os="" |
| 114 |
_host_alias="" |
| 115 |
|
| 116 |
# Use temp files in the build directory |
| 117 |
TMPO=./scummvm-tools-conf |
| 118 |
TMPC=${TMPO}.cpp |
| 119 |
TMPLOG=config.log |
| 120 |
|
| 121 |
cc_check_no_clean() { |
| 122 |
echo >> "$TMPLOG" |
| 123 |
cat "$TMPC" >> "$TMPLOG" |
| 124 |
echo >> "$TMPLOG" |
| 125 |
echo "$CXX $LDFLAGS $CXXFLAGS $TMPC -o $TMPO$HOSTEXEEXT $@" >> "$TMPLOG" |
| 126 |
rm -f "$TMPO$HOSTEXEEXT" |
| 127 |
( $CXX $LDFLAGS $CXXFLAGS "$TMPC" -o "$TMPO$HOSTEXEEXT" "$@" ) >> "$TMPLOG" 2>&1 |
| 128 |
TMPR="$?" |
| 129 |
echo "return code: $TMPR" >> "$TMPLOG" |
| 130 |
echo >> "$TMPLOG" |
| 131 |
return "$TMPR" |
| 132 |
} |
| 133 |
|
| 134 |
cc_check_clean() { |
| 135 |
rm -rf $TMPC $TMPO $TMPO.o $TMPO.dSYM $TMPO$HOSTEXEEXT "$@" |
| 136 |
} |
| 137 |
|
| 138 |
cc_check() { |
| 139 |
cc_check_no_clean "$@" |
| 140 |
TMPR="$?" |
| 141 |
cc_check_clean |
| 142 |
return "$TMPR" |
| 143 |
} |
| 144 |
|
| 145 |
cc_check_define() { |
| 146 |
cat > $TMPC << EOF |
| 147 |
int main(void) { |
| 148 |
#ifndef $1 |
| 149 |
syntax error |
| 150 |
#endif |
| 151 |
return 0; |
| 152 |
} |
| 153 |
EOF |
| 154 |
cc_check -c |
| 155 |
return $? |
| 156 |
} |
| 157 |
|
| 158 |
gcc_get_define() { |
| 159 |
echo "" | $CXX -dM -E - | fgrep "$1" | head -n1 | cut -d ' ' -f 3- |
| 160 |
} |
| 161 |
|
| 162 |
# |
| 163 |
# Function to provide echo -n for bourne shells that don't have it |
| 164 |
# |
| 165 |
echo_n() { |
| 166 |
printf "$@" |
| 167 |
} |
| 168 |
|
| 169 |
echocheck() { |
| 170 |
echo_n "Checking for $@... " |
| 171 |
} |
| 172 |
|
| 173 |
# Add a line of data to config.mk. |
| 174 |
add_line_to_config_mk() { |
| 175 |
_config_mk_data="$_config_mk_data"' |
| 176 |
'"$1" |
| 177 |
} |
| 178 |
|
| 179 |
# Add a line of data to config.h. |
| 180 |
add_line_to_config_h() { |
| 181 |
_config_h_data="$_config_h_data"' |
| 182 |
'"$1" |
| 183 |
} |
| 184 |
|
| 185 |
# Conditionally add a line of data to config.h. Takes two parameters: |
| 186 |
# The first one can be set to 'no' to "comment out" the line, i.e. |
| 187 |
# make it ineffective, use 'yes' otherwise. |
| 188 |
# The second param is the line to insert. |
| 189 |
add_to_config_h_if_yes() { |
| 190 |
if test "$1" = yes ; then |
| 191 |
add_line_to_config_h "$2" |
| 192 |
else |
| 193 |
add_line_to_config_h "/* $2 */" |
| 194 |
fi |
| 195 |
} |
| 196 |
|
| 197 |
# Conditionally add a line of data to config.mk. Takes two parameters: |
| 198 |
# The first one can be set to 'no' to "comment out" the line, i.e. |
| 199 |
# make it ineffective, use 'yes' otherwise. |
| 200 |
# The second param is the line to insert. |
| 201 |
add_to_config_mk_if_yes() { |
| 202 |
if test "$1" = yes ; then |
| 203 |
add_line_to_config_mk "$2" |
| 204 |
else |
| 205 |
add_line_to_config_mk "# $2" |
| 206 |
fi |
| 207 |
} |
| 208 |
|
| 209 |
# Conditionally add a '#define' line to config.h. Takes two parameters: |
| 210 |
# The first one can be set to 'yes' or 'no'. If 'yes' is used, then |
| 211 |
# the line "#define $2" is added to config.h, otherwise "#undef $2". |
| 212 |
define_in_config_h_if_yes() { |
| 213 |
if test "$1" = yes ; then |
| 214 |
add_line_to_config_h "#define $2" |
| 215 |
else |
| 216 |
add_line_to_config_h "#undef $2" |
| 217 |
fi |
| 218 |
} |
| 219 |
|
| 220 |
# Conditionally add definitions to config.h and config.mk. Takes two parameters: |
| 221 |
# The first one can be set to 'yes' or 'no'. If 'yes' is used, then |
| 222 |
# the line "#define $2" is added to config.h and "$2 = 1" to config.mk. |
| 223 |
# Otherwise "#undef $2" is added to config.h and "# $2 = 1" to config.mk |
| 224 |
define_in_config_if_yes() { |
| 225 |
if test "$1" = yes ; then |
| 226 |
add_line_to_config_h "#define $2" |
| 227 |
add_line_to_config_mk "$2 = 1" |
| 228 |
else |
| 229 |
add_line_to_config_h "#undef $2" |
| 230 |
add_line_to_config_mk "# $2 = 1" |
| 231 |
fi |
| 232 |
} |
| 233 |
|
| 234 |
# |
| 235 |
# Determine wx-config |
| 236 |
# |
| 237 |
# TODO: small bit of code to test wxWidgets usability |
| 238 |
find_wxconfig() { |
| 239 |
echo_n "Looking for wx-config... " |
| 240 |
wxconfigs="$_wxconfig:wxgtk2-2.8-config" |
| 241 |
_wxconfig= |
| 242 |
|
| 243 |
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="$SEPARATOR" |
| 244 |
for path_dir in $_wxpath; do |
| 245 |
#reset separator to parse wxconfigs |
| 246 |
IFS=":" |
| 247 |
for wxconfig in $wxconfigs; do |
| 248 |
if test -f "$path_dir/$wxconfig" ; then |
| 249 |
_wxconfig="$path_dir/$wxconfig" |
| 250 |
echo $_wxconfig |
| 251 |
# Save the prefix |
| 252 |
_wxpath=$path_dir |
| 253 |
if test `basename $path_dir` = bin ; then |
| 254 |
_wxpath=`dirname $path_dir` |
| 255 |
fi |
| 256 |
# break at first wx-config found in path |
| 257 |
break 2 |
| 258 |
fi |
| 259 |
done |
| 260 |
done |
| 261 |
|
| 262 |
IFS="$ac_save_ifs" |
| 263 |
|
| 264 |
if test -z "$_wxconfig"; then |
| 265 |
echo "none found!" |
| 266 |
fi |
| 267 |
} |
| 268 |
|
| 269 |
# |
| 270 |
# Determine freetype-config |
| 271 |
# |
| 272 |
find_freetypeconfig() { |
| 273 |
echo_n "Looking for freetype-config... " |
| 274 |
freetypeconfigs="$_freetypeconfig" |
| 275 |
_freetypeconfig= |
| 276 |
|
| 277 |
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="$SEPARATOR" |
| 278 |
for path_dir in $_freetypepath; do |
| 279 |
#reset separator to parse freetypeconfigs |
| 280 |
IFS=":" |
| 281 |
for freetypeconfig in $freetypeconfigs; do |
| 282 |
if test -f "$path_dir/$freetypeconfig" ; then |
| 283 |
_freetypeconfig="$path_dir/$freetypeconfig" |
| 284 |
echo $_freetypeconfig |
| 285 |
# Save the prefix |
| 286 |
_freetypepath=$path_dir |
| 287 |
if test `basename $path_dir` = bin ; then |
| 288 |
_freetypepath=`dirname $path_dir` |
| 289 |
fi |
| 290 |
# break at first freetype-config found in path |
| 291 |
break 2 |
| 292 |
fi |
| 293 |
done |
| 294 |
done |
| 295 |
|
| 296 |
IFS="$ac_save_ifs" |
| 297 |
|
| 298 |
if test -z "$_freetypeconfig"; then |
| 299 |
echo "none found!" |
| 300 |
fi |
| 301 |
} |
| 302 |
|
| 303 |
# |
| 304 |
# Determine extension used for executables |
| 305 |
# |
| 306 |
get_system_exe_extension() { |
| 307 |
case $1 in |
| 308 |
riscos) |
| 309 |
_exeext=",e1f" |
| 310 |
;; |
| 311 |
dreamcast | ds | gamecube | n64 | ps2 | psp | wii) |
| 312 |
_exeext=".elf" |
| 313 |
;; |
| 314 |
gph-linux) |
| 315 |
_exeext=".gph" |
| 316 |
;; |
| 317 |
mingw* | *os2-emx | wince) |
| 318 |
_exeext=".exe" |
| 319 |
;; |
| 320 |
*) |
| 321 |
_exeext="" |
| 322 |
;; |
| 323 |
esac |
| 324 |
} |
| 325 |
|
| 326 |
# |
| 327 |
# Generic options functions |
| 328 |
# |
| 329 |
|
| 330 |
# Show the configure help line for an option |
| 331 |
option_help() { |
| 332 |
tmpopt=`echo $1 | sed 's/_/-/g'` |
| 333 |
option=`echo "--${tmpopt} " | sed "s/\(.\{23\}\).*/\1/"` |
| 334 |
echo " ${option} ${2}" |
| 335 |
} |
| 336 |
|
| 337 |
# Show an error about an unknown option |
| 338 |
option_error() { |
| 339 |
echo "error: unrecognized option: $ac_option |
| 340 |
Try \`$0 --help' for more information." >&2 |
| 341 |
exit 1 |
| 342 |
} |
| 343 |
|
| 344 |
|
| 345 |
# |
| 346 |
# Greet user |
| 347 |
# |
| 348 |
echo "Running ScummVM Tools configure..." |
| 349 |
echo "Configure run on" `date` > $TMPLOG |
| 350 |
|
| 351 |
# |
| 352 |
# Check any parameters we received |
| 353 |
# |
| 354 |
|
| 355 |
for parm in "$@" ; do |
| 356 |
if test "$parm" = "--help" || test "$parm" = "-help" || test "$parm" = "-h" ; then |
| 357 |
cat << EOF |
| 358 |
|
| 359 |
Usage: $0 [OPTIONS]... |
| 360 |
|
| 361 |
Configuration: |
| 362 |
-h, --help display this help and exit |
| 363 |
|
| 364 |
Installation directories: |
| 365 |
--prefix=DIR use this prefix for installing the ScummVM Tools [/usr/local] |
| 366 |
--bindir=DIR directory to install the tool binaries in [PREFIX/bin] |
| 367 |
--datadir=DIR directory to install the GUI tool media files in [PREFIX/share] |
| 368 |
--mandir=DIR directory to install the manpage in [PREFIX/share/man] |
| 369 |
--libdir=DIR directory to install the plugins in [PREFIX/lib] |
| 370 |
|
| 371 |
Special configuration feature: |
| 372 |
--host=HOST cross-compile to target HOST (arm-linux, ...) |
| 373 |
|
| 374 |
Optional Features: |
| 375 |
--disable-c++11 disable building as C++11 when the compiler allows that |
| 376 |
--disable-debug disable building with debugging symbols |
| 377 |
--enable-Werror treat warnings as errors |
| 378 |
--enable-profiling enable profiling |
| 379 |
--enable-verbose-build enable regular echoing of commands during build |
| 380 |
process |
| 381 |
|
| 382 |
Optional Libraries: |
| 383 |
--with-ogg-prefix=DIR Prefix where libogg is installed (optional) |
| 384 |
--with-vorbis-prefix=DIR Prefix where libvorbis is installed (optional) |
| 385 |
--disable-vorbis disable Ogg Vorbis support [autodetect] |
| 386 |
|
| 387 |
--with-tremor-prefix=DIR Prefix where tremor is installed (optional) |
| 388 |
--disable-tremor disable tremor support [autodetect] |
| 389 |
|
| 390 |
--with-mad-prefix=DIR Prefix where libmad is installed (optional) |
| 391 |
--disable-mad disable libmad (MP3) support [autodetect] |
| 392 |
|
| 393 |
--with-flac-prefix=DIR Prefix where libFLAC is installed (optional) |
| 394 |
--disable-flac disable FLAC support [autodetect] |
| 395 |
|
| 396 |
--with-zlib-prefix=DIR Prefix where zlib is installed (optional) |
| 397 |
--disable-zlib disable zlib (compression) support [autodetect] |
| 398 |
|
| 399 |
--with-png-prefix=DIR Prefix where libpng is installed (optional) |
| 400 |
--disable-png disable libpng (compression) support [autodetect] |
| 401 |
|
| 402 |
--with-freetype2-prefix=DIR prefix where the freetype-config script is |
| 403 |
installed (optional) |
| 404 |
--disable-freetype2 disable freetype2 TTF library usage [autodetect] |
| 405 |
|
| 406 |
--with-wx-prefix=DIR Prefix where wxwidgets is installed (optional) |
| 407 |
--disable-wxwidgets disable wxwidgets (GUI) support [autodetect] |
| 408 |
|
| 409 |
--disable-iconv disable iconv (Japanese font) support [autodetect] |
| 410 |
|
| 411 |
--with-boost-prefix=DIR Prefix where Boost is installed (optional) |
| 412 |
--disable-boost disable Boost support [autodetect] |
| 413 |
|
| 414 |
Some influential environment variables: |
| 415 |
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a |
| 416 |
nonstandard directory <lib dir> |
| 417 |
CXX C++ compiler command |
| 418 |
CXXFLAGS C++ compiler flags |
| 419 |
CONFIGURE_NO_HOST Ignore the cross-compile target set by the --host= option |
| 420 |
CPPFLAGS C++ preprocessor flags, e.g. -I<include dir> if you have |
| 421 |
headers in a nonstandard directory <include dir> |
| 422 |
PKG_CONFIG_LIBDIR list of directories where pkg-config ‘.pc’ files are |
| 423 |
looked up |
| 424 |
|
| 425 |
EOF |
| 426 |
exit 0 |
| 427 |
fi |
| 428 |
done # for parm in ... |
| 429 |
|
| 430 |
for ac_option in $@; do |
| 431 |
case "$ac_option" in |
| 432 |
# Silently ignore options valid for Autotools configure. |
| 433 |
--build=*) ;; |
| 434 |
--exec-prefix=*) ;; |
| 435 |
--program-prefix=*) ;; |
| 436 |
--sbindir=*) ;; |
| 437 |
--sysconfdir=*) ;; |
| 438 |
--includedir=*) ;; |
| 439 |
--libexecdir=*) ;; |
| 440 |
--localstatedir=*) ;; |
| 441 |
--sharedstatedir=*) ;; |
| 442 |
--infodir=*) ;; |
| 443 |
--disable-dependency-tracking) ;; |
| 444 |
--enable-dependency-tracking) ;; |
| 445 |
# End of ignored options. |
| 446 |
--enable-vorbis) _vorbis=yes ;; |
| 447 |
--disable-vorbis) _vorbis=no ;; |
| 448 |
--enable-tremor) _tremor=yes ;; |
| 449 |
--disable-tremor) _tremor=no ;; |
| 450 |
--enable-flac) _flac=yes ;; |
| 451 |
--disable-flac) _flac=no ;; |
| 452 |
--enable-mad) _mad=yes ;; |
| 453 |
--disable-mad) _mad=no ;; |
| 454 |
--enable-zlib) _zlib=yes ;; |
| 455 |
--disable-zlib) _zlib=no ;; |
| 456 |
--enable-png) _png=yes ;; |
| 457 |
--disable-png) _png=no ;; |
| 458 |
--enable-freetype2) _freetype2=yes ;; |
| 459 |
--disable-freetype2) _freetype2=no ;; |
| 460 |
--enable-wxwidgets) _wxwidgets=yes ;; |
| 461 |
--disable-wxwidgets) _wxwidgets=no ;; |
| 462 |
--enable-iconv) _iconv=yes ;; |
| 463 |
--disable-iconv) _iconv=no ;; |
| 464 |
--enable-boost) _boost=yes ;; |
| 465 |
--disable-boost) _boost=no ;; |
| 466 |
--enable-verbose-build) _verbose_build=yes ;; |
| 467 |
--with-ogg-prefix=*) |
| 468 |
arg=`echo $ac_option | cut -d '=' -f 2` |
| 469 |
OGG_CFLAGS="-I$arg/include" |
| 470 |
OGG_LIBS="-L$arg/lib" |
| 471 |
;; |
| 472 |
--with-vorbis-prefix=*) |
| 473 |
arg=`echo $ac_option | cut -d '=' -f 2` |
| 474 |
VORBIS_CFLAGS="-I$arg/include" |
| 475 |
VORBIS_LIBS="-L$arg/lib" |
| 476 |
;; |
| 477 |
--with-tremor-prefix=*) |
| 478 |
arg=`echo $ac_option | cut -d '=' -f 2` |
| 479 |
TREMOR_CFLAGS="-I$arg/include" |
| 480 |
TREMOR_LIBS="-L$arg/lib" |
| 481 |
;; |
| 482 |
--with-flac-prefix=*) |
| 483 |
arg=`echo $ac_option | cut -d '=' -f 2` |
| 484 |
FLAC_CFLAGS="-I$arg/include" |
| 485 |
FLAC_LIBS="-L$arg/lib" |
| 486 |
;; |
| 487 |
--with-mad-prefix=*) |
| 488 |
arg=`echo $ac_option | cut -d '=' -f 2` |
| 489 |
MAD_CFLAGS="-I$arg/include" |
| 490 |
MAD_LIBS="-L$arg/lib" |
| 491 |
;; |
| 492 |
--with-zlib-prefix=*) |
| 493 |
arg=`echo $ac_option | cut -d '=' -f 2` |
| 494 |
ZLIB_CFLAGS="-I$arg/include" |
| 495 |
ZLIB_LIBS="-L$arg/lib" |
| 496 |
;; |
| 497 |
--with-png-prefix=*) |
| 498 |
arg=`echo $ac_option | cut -d '=' -f 2` |
| 499 |
PNG_CFLAGS="-I$arg/include" |
| 500 |
PNG_LIBS="-L$arg/lib" |
| 501 |
;; |
| 502 |
--with-freetype2-prefix=*) |
| 503 |
arg=`echo $ac_option | cut -d '=' -f 2` |
| 504 |
_freetypepath="$arg:$arg/bin" |
| 505 |
;; |
| 506 |
--with-wx-prefix=*) |
| 507 |
arg=`echo $ac_option | cut -d '=' -f 2` |
| 508 |
_wxpath="$arg:$arg/bin" |
| 509 |
;; |
| 510 |
--with-boost-prefix=*) |
| 511 |
arg=`echo $ac_option | cut -d '=' -f 2` |
| 512 |
BOOST_CFLAGS="-I$arg/include" |
| 513 |
BOOST_LIBS="-L$arg/lib" |
| 514 |
;; |
| 515 |
--with-staticlib-prefix=*) |
| 516 |
_staticlibpath=`echo $ac_option | cut -d '=' -f 2` |
| 517 |
;; |
| 518 |
--with-xcodetools-path=*) |
| 519 |
_xcodetoolspath=`echo $ac_option | cut -d '=' -f 2` |
| 520 |
;; |
| 521 |
--enable-debug) |
| 522 |
_debug_build=yes |
| 523 |
;; |
| 524 |
--disable-debug) |
| 525 |
_debug_build=no |
| 526 |
;; |
| 527 |
--enable-c++11) |
| 528 |
_use_cxx11=yes |
| 529 |
;; |
| 530 |
--disable-c++11) |
| 531 |
_use_cxx11=no |
| 532 |
;; |
| 533 |
--enable-Werror) |
| 534 |
CXXFLAGS="$CXXFLAGS -Werror" |
| 535 |
;; |
| 536 |
--enable-release) |
| 537 |
_release_build=yes |
| 538 |
;; |
| 539 |
--disable-release) |
| 540 |
_release_build=no |
| 541 |
;; |
| 542 |
--enable-profiling) |
| 543 |
_enable_prof=yes |
| 544 |
;; |
| 545 |
--host=*) |
| 546 |
if test -z "$CONFIGURE_NO_HOST"; then |
| 547 |
_host=`echo $ac_option | cut -d '=' -f 2` |
| 548 |
else |
| 549 |
echo "Ignoring --host option!" >&2 |
| 550 |
fi |
| 551 |
;; |
| 552 |
--prefix=*) |
| 553 |
_prefix=`echo $ac_option | cut -d '=' -f 2` |
| 554 |
;; |
| 555 |
--bindir=*) |
| 556 |
_bindir=`echo $ac_option | cut -d '=' -f 2` |
| 557 |
;; |
| 558 |
--datadir=*) |
| 559 |
_datadir=`echo $ac_option | cut -d '=' -f 2` |
| 560 |
;; |
| 561 |
--mandir=*) |
| 562 |
_mandir=`echo $ac_option | cut -d '=' -f 2` |
| 563 |
;; |
| 564 |
--libdir=*) |
| 565 |
_libdir=`echo $ac_option | cut -d '=' -f 2` |
| 566 |
;; |
| 567 |
*) |
| 568 |
option_error |
| 569 |
;; |
| 570 |
esac; |
| 571 |
done; |
| 572 |
|
| 573 |
guessed_host=`$_srcdir/config.guess` |
| 574 |
get_system_exe_extension $guessed_host |
| 575 |
NATIVEEXEEXT=$_exeext |
| 576 |
|
| 577 |
case $_host in |
| 578 |
android | android-v7a) |
| 579 |
_host_os=android |
| 580 |
_host_cpu=arm |
| 581 |
_host_alias=arm-linux-androideabi |
| 582 |
;; |
| 583 |
bada) |
| 584 |
_host_os=bada |
| 585 |
if test "$_debug_build" = yes; then |
| 586 |
_host_cpu=i686 |
| 587 |
_host_alias=i686-mingw32 |
| 588 |
else |
| 589 |
_host_cpu=arm |
| 590 |
_host_alias=arm-samsung-nucleuseabi |
| 591 |
fi |
| 592 |
;; |
| 593 |
caanoo) |
| 594 |
_host_os=gph-linux |
| 595 |
_host_cpu=arm |
| 596 |
_host_alias=arm-none-linux-gnueabi |
| 597 |
;; |
| 598 |
dingux) |
| 599 |
_host_os=linux |
| 600 |
_host_cpu=mipsel |
| 601 |
_host_alias=mipsel-linux |
| 602 |
;; |
| 603 |
dreamcast) |
| 604 |
_host_os=dreamcast |
| 605 |
_host_cpu=sh |
| 606 |
_host_alias=sh-elf |
| 607 |
CXXFLAGS="$CXXFLAGS -ml -m4-single-only" |
| 608 |
LDFLAGS="$LDFLAGS -ml -m4-single-only" |
| 609 |
;; |
| 610 |
ds) |
| 611 |
_host_os=ds |
| 612 |
_host_cpu=arm |
| 613 |
_host_alias=arm-eabi |
| 614 |
;; |
| 615 |
gamecube) |
| 616 |
_host_os=gamecube |
| 617 |
_host_cpu=ppc |
| 618 |
_host_alias=powerpc-gekko |
| 619 |
;; |
| 620 |
gp2x) |
| 621 |
_host_os=gph-linux |
| 622 |
_host_cpu=arm |
| 623 |
_host_alias=arm-open2x-linux |
| 624 |
;; |
| 625 |
gp2xwiz) |
| 626 |
_host_os=gph-linux |
| 627 |
_host_cpu=arm |
| 628 |
_host_alias=arm-open2x-linux |
| 629 |
;; |
| 630 |
i586-mingw32msvc) |
| 631 |
_host_os=mingw32msvc |
| 632 |
_host_cpu=i586 |
| 633 |
;; |
| 634 |
iphone) |
| 635 |
_host_os=iphone |
| 636 |
_host_cpu=arm |
| 637 |
_host_alias=arm-apple-darwin9 |
| 638 |
;; |
| 639 |
linupy) |
| 640 |
_host_os=linux |
| 641 |
_host_cpu=arm |
| 642 |
;; |
| 643 |
maemo) |
| 644 |
_host_os=maemo |
| 645 |
_host_cpu=arm |
| 646 |
_host_alias=arm-linux |
| 647 |
|
| 648 |
# The prefix is always the same on Maemo so we hardcode the default |
| 649 |
# here. It is still possible to define a custom prefix which is |
| 650 |
# needed when packaging the app with a user-specific app ID. |
| 651 |
test "x$prefix" = xNONE && prefix=/opt/scummvm |
| 652 |
# Maemo apps are installed into app-specific directories. The |
| 653 |
# default directory structure of ScummVM makes no sense here so we |
| 654 |
# hardcode Maemo specific directories here. |
| 655 |
datarootdir='${prefix}/share' |
| 656 |
datadir=/opt/scummvm/share |
| 657 |
docdir='${datarootdir}/doc/scummvm' |
| 658 |
;; |
| 659 |
motoezx) |
| 660 |
_host_os=linux |
| 661 |
_host_cpu=arm |
| 662 |
_host_alias=arm-linux-gnu |
| 663 |
;; |
| 664 |
motomagx) |
| 665 |
_host_os=linux |
| 666 |
_host_cpu=arm |
| 667 |
_host_alias=arm-linux-gnueabi |
| 668 |
;; |
| 669 |
n64) |
| 670 |
_host_os=n64 |
| 671 |
_host_cpu=mips |
| 672 |
_host_alias=mips64 |
| 673 |
;; |
| 674 |
neuros) |
| 675 |
_host_os=linux |
| 676 |
_host_cpu=arm |
| 677 |
;; |
| 678 |
openpandora) |
| 679 |
_host_os=linux |
| 680 |
_host_cpu=arm |
| 681 |
_host_alias=arm-angstrom-linux-gnueabi |
| 682 |
;; |
| 683 |
ppc-amigaos) |
| 684 |
_host_os=amigaos |
| 685 |
_host_cpu=ppc |
| 686 |
;; |
| 687 |
ppc-morphos) |
| 688 |
_host_os=morphos |
| 689 |
_host_cpu=ppc |
| 690 |
;; |
| 691 |
ps2) |
| 692 |
_host_os=ps2 |
| 693 |
_host_cpu=mips64r5900el |
| 694 |
_host_alias=ee |
| 695 |
;; |
| 696 |
ps3) |
| 697 |
_host_os=ps3 |
| 698 |
_host_cpu=ppc |
| 699 |
_host_alias=powerpc64-ps3-elf |
| 700 |
|
| 701 |
# The prefix is always the same on PS3 so we hardcode the default |
| 702 |
# here. It is still possible to define a custom prefix which is |
| 703 |
# needed when packaging the app with a user-specific app ID. |
| 704 |
test "x$prefix" = xNONE && prefix=/dev_hdd0/game/SCUM12000/USRDIR |
| 705 |
# PS3 apps are installed into app-specific directories. The |
| 706 |
# default directory structure of ScummVM makes no sense here so we |
| 707 |
# hardcode PS3 specific directories here. |
| 708 |
datarootdir='${prefix}/data' |
| 709 |
datadir='${datarootdir}' |
| 710 |
docdir='${prefix}/doc' |
| 711 |
;; |
| 712 |
psp) |
| 713 |
_host_os=psp |
| 714 |
_host_cpu=mipsallegrexel |
| 715 |
_host_alias=psp |
| 716 |
;; |
| 717 |
raspberrypi) |
| 718 |
_host_os=linux |
| 719 |
_host_cpu=arm |
| 720 |
# This tuple is the one used by the official Rpi toolchain. |
| 721 |
# It may change in the future. |
| 722 |
_host_alias=arm-linux-gnueabihf |
| 723 |
;; |
| 724 |
samsungtv) |
| 725 |
_host_os=linux |
| 726 |
_host_cpu=arm |
| 727 |
_host_alias=arm-linux-gnueabi |
| 728 |
;; |
| 729 |
webos) |
| 730 |
_host_os=webos |
| 731 |
_host_cpu=arm |
| 732 |
_host_alias=arm-none-linux-gnueabi |
| 733 |
# The prefix is always the same on WebOS so we hardcode the default |
| 734 |
# here. It is still possible to define a custom prefix which is |
| 735 |
# needed when packaging the app with a user-specific app ID. |
| 736 |
test "x$prefix" = xNONE && prefix=/media/cryptofs/apps/usr/palm/applications/org.scummvm.scummvm |
| 737 |
# WebOS apps are installed into app-specific directories. The |
| 738 |
# default directory structure of ScummVM makes no sense here so we |
| 739 |
# hardcode WebOS specific directories here. |
| 740 |
datarootdir='${prefix}/data' |
| 741 |
datadir='${datarootdir}' |
| 742 |
docdir='${prefix}/doc' |
| 743 |
;; |
| 744 |
wii) |
| 745 |
_host_os=wii |
| 746 |
_host_cpu=ppc |
| 747 |
_host_alias=powerpc-gekko |
| 748 |
;; |
| 749 |
wince) |
| 750 |
_host_os=wince |
| 751 |
_host_cpu=arm |
| 752 |
_host_alias=arm-mingw32ce |
| 753 |
;; |
| 754 |
*) |
| 755 |
if test -n "$_host"; then |
| 756 |
guessed_host=`$_srcdir/config.sub $_host` |
| 757 |
fi |
| 758 |
_host_cpu=`echo $guessed_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` |
| 759 |
_host_vendor=`echo $guessed_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` |
| 760 |
_host_os=`echo $guessed_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` |
| 761 |
;; |
| 762 |
esac |
| 763 |
|
| 764 |
if test -z "$_host_alias"; then |
| 765 |
_host_alias="$_host_cpu-$_host_os" |
| 766 |
else |
| 767 |
# if _host_alias was set, default to the standard GNU tools |
| 768 |
_ranlib=$_host_alias-ranlib |
| 769 |
_strip=$_host_alias-strip |
| 770 |
_ar="$_host_alias-ar cru" |
| 771 |
_as="$_host_alias-as" |
| 772 |
_windres=$_host_alias-windres |
| 773 |
fi |
| 774 |
|
| 775 |
# |
| 776 |
# Determine extra build flags for debug and/or release builds |
| 777 |
# |
| 778 |
|
| 779 |
if test "$_debug_build" != no; then |
| 780 |
# debug mode not explicitly disabled -> compile with -g |
| 781 |
CXXFLAGS="$CXXFLAGS -g" |
| 782 |
fi |
| 783 |
|
| 784 |
if test "$_release_build" = yes; then |
| 785 |
# Release mode enabled: enable optimizations. This also |
| 786 |
# makes it possible to use -Wuninitialized, so let's do that. |
| 787 |
CXXFLAGS="$CXXFLAGS -O2" |
| 788 |
CXXFLAGS="$CXXFLAGS -Wuninitialized" |
| 789 |
fi |
| 790 |
|
| 791 |
|
| 792 |
# |
| 793 |
# Determine extension used for executables |
| 794 |
# |
| 795 |
get_system_exe_extension $_host_os |
| 796 |
HOSTEXEEXT=$_exeext |
| 797 |
|
| 798 |
# |
| 799 |
# Determine separator used for $PATH |
| 800 |
# |
| 801 |
case $_host_os in |
| 802 |
os2-emx*) |
| 803 |
SEPARATOR=";" |
| 804 |
;; |
| 805 |
*) |
| 806 |
SEPARATOR=":" |
| 807 |
;; |
| 808 |
esac |
| 809 |
|
| 810 |
# |
| 811 |
# Determine the C++ compiler |
| 812 |
# |
| 813 |
echo_n "Looking for C++ compiler... " |
| 814 |
|
| 815 |
# Check whether the given command is a working C++ compiler |
| 816 |
test_compiler() { |
| 817 |
cat > tmp_cxx_compiler.cpp << EOF |
| 818 |
class Foo { int a; }; |
| 819 |
int main(int argc, char **argv) { |
| 820 |
Foo *a = new Foo(); delete a; return 0; |
| 821 |
} |
| 822 |
EOF |
| 823 |
|
| 824 |
echo "testing compiler: $1" >> "$TMPLOG" |
| 825 |
|
| 826 |
if test -n "$_host"; then |
| 827 |
# In cross-compiling mode, we cannot run the result |
| 828 |
eval "$1 $CXXFLAGS $LDFLAGS -o $TMPO.o -c tmp_cxx_compiler.cpp" 2> /dev/null && cc_check_clean tmp_cxx_compiler.cpp |
| 829 |
else |
| 830 |
eval "$1 $CXXFLAGS $LDFLAGS -o $TMPO$HOSTEXEEXT tmp_cxx_compiler.cpp" 2> /dev/null && eval "$TMPO$HOSTEXEEXT 2> /dev/null" && cc_check_clean tmp_cxx_compiler.cpp |
| 831 |
fi |
| 832 |
} |
| 833 |
|
| 834 |
# Prepare a list of candidates for the C++ compiler |
| 835 |
if test -n "$CXX" && test_compiler "$CXX"; then |
| 836 |
# Use the compiler specified in CXX |
| 837 |
echo $CXX |
| 838 |
else |
| 839 |
if test -n "$_host"; then |
| 840 |
compilers="$_host_alias-g++ $_host_alias-c++ $_host-g++ $_host-c++" |
| 841 |
else |
| 842 |
compilers="g++ c++ CC" |
| 843 |
fi |
| 844 |
|
| 845 |
# Iterate over all candidates, pick the first working one |
| 846 |
CXX= |
| 847 |
for compiler in $compilers; do |
| 848 |
if test_compiler $compiler; then |
| 849 |
echo "success testing compiler: $compiler" >> "$TMPLOG" |
| 850 |
CXX=$compiler |
| 851 |
echo $CXX |
| 852 |
break |
| 853 |
else |
| 854 |
echo "failure testing compiler: $compiler" >> "$TMPLOG" |
| 855 |
fi |
| 856 |
done |
| 857 |
fi |
| 858 |
|
| 859 |
if test -z "$CXX"; then |
| 860 |
echo "none found!" |
| 861 |
exit 1 |
| 862 |
fi |
| 863 |
|
| 864 |
# By default, use the C++ compiler as linker |
| 865 |
LD=$CXX |
| 866 |
|
| 867 |
# |
| 868 |
# Determine the compiler version |
| 869 |
# |
| 870 |
echocheck "compiler version" |
| 871 |
|
| 872 |
have_gcc=no |
| 873 |
cc_check_define __GNUC__ && have_gcc=yes |
| 874 |
|
| 875 |
if test "$have_gcc" = yes; then |
| 876 |
add_line_to_config_mk 'HAVE_GCC = 1' |
| 877 |
_cxx_major=`gcc_get_define __GNUC__` |
| 878 |
_cxx_minor=`gcc_get_define __GNUC_MINOR__` |
| 879 |
cxx_version="`( $CXX -dumpversion ) 2>&1`" |
| 880 |
|
| 881 |
if test -n "`gcc_get_define __clang__`"; then |
| 882 |
add_line_to_config_mk 'HAVE_CLANG = 1' |
| 883 |
fi |
| 884 |
|
| 885 |
if test "$_cxx_major" -eq 2 && test "$_cxx_minor" -ge 95 || \ |
| 886 |
test "$_cxx_major" -gt 2 ; then |
| 887 |
cxx_version="$cxx_version, ok" |
| 888 |
cxx_verc_fail=no |
| 889 |
else |
| 890 |
cxx_version="$cxx_version, bad" |
| 891 |
cxx_verc_fail=yes |
| 892 |
fi |
| 893 |
else |
| 894 |
# TODO: Big scary warning about unsupported compilers |
| 895 |
cxx_version=`( $CXX -version ) 2>&1` |
| 896 |
if test "$?" -eq 0; then |
| 897 |
cxx_version="`echo "${cxx_version}" | sed -ne 's/^.*[^0-9]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*$/\1/gp'`" |
| 898 |
if test -z "${cxx_version}"; then |
| 899 |
cxx_version="not found" |
| 900 |
cxx_verc_fail=yes |
| 901 |
fi |
| 902 |
else |
| 903 |
cxx_version="not found" |
| 904 |
cxx_verc_fail=yes |
| 905 |
fi |
| 906 |
|
| 907 |
case $_host_os in |
| 908 |
irix*) |
| 909 |
case $cxx_version in |
| 910 |
7.4.4*) |
| 911 |
# We just assume this is SGI MIPSpro |
| 912 |
_cxx_major=7 |
| 913 |
_cxx_minor=4 |
| 914 |
cxx_verc_fail=no |
| 915 |
add_line_to_config_mk 'CXX_UPDATE_DEP_FLAG = -MDupdate "$(*D)/$(DEPDIR)/$(*F).d"' |
| 916 |
add_line_to_config_mk '-include Makedepend' |
| 917 |
;; |
| 918 |
*) |
| 919 |
cxx_version="$cxx_version, bad" |
| 920 |
cxx_verc_fail=yes |
| 921 |
;; |
| 922 |
esac |
| 923 |
;; |
| 924 |
solaris*) |
| 925 |
cxx_version=`( $CXX -V ) 2>&1` |
| 926 |
cxx_version="`echo "${cxx_version}" | sed 's/.*\([0-9][0-9]*\.[0-9][0-9]*\).*/\1/'`" |
| 927 |
|
| 928 |
case $cxx_version in |
| 929 |
5.1[0-2]) |
| 930 |
cxx_verc_fail=no |
| 931 |
;; |
| 932 |
*) |
| 933 |
cxx_version="$cxx_version, bad" |
| 934 |
cxx_verc_fail=yes |
| 935 |
;; |
| 936 |
esac |
| 937 |
;; |
| 938 |
*) |
| 939 |
cxx_version="$cxx_version, bad" |
| 940 |
cxx_verc_fail=yes |
| 941 |
;; |
| 942 |
esac |
| 943 |
fi |
| 944 |
|
| 945 |
echo "$cxx_version" |
| 946 |
|
| 947 |
if test "$cxx_verc_fail" = yes ; then |
| 948 |
echo |
| 949 |
echo "The version of your compiler is not supported at this time" |
| 950 |
echo "Please ensure you are using GCC >= 2.95" |
| 951 |
exit 1 |
| 952 |
else |
| 953 |
echo found non-gcc compiler version ${cxx_version} |
| 954 |
fi |
| 955 |
|
| 956 |
# |
| 957 |
# Check whether the compiler supports C++11 |
| 958 |
# |
| 959 |
have_cxx11=no |
| 960 |
cat > $TMPC << EOF |
| 961 |
int main(int argc, char *argv[]) { if (argv == nullptr) return -1; else return 0; } |
| 962 |
EOF |
| 963 |
cc_check -std=c++11 && have_cxx11=yes |
| 964 |
if test "$_use_cxx11" = "yes" ; then |
| 965 |
_use_cxx11=$have_cxx11 |
| 966 |
fi |
| 967 |
|
| 968 |
# |
| 969 |
# Setup compiler specific CXXFLAGS now that we know the compiler version. |
| 970 |
# Foremost, this means enabling various warnings. |
| 971 |
# In addition, we set CXX_UPDATE_DEP_FLAG for GCC >= 3.0 and for ICC. |
| 972 |
# |
| 973 |
if test "$have_gcc" = yes ; then |
| 974 |
if test "$_cxx_major" -ge "3" ; then |
| 975 |
# Try to use ANSI mode when C++11 is disabled. |
| 976 |
if test "$_use_cxx11" = "no" ; then |
| 977 |
case $_host_os in |
| 978 |
# newlib-based system include files suppress non-C89 function |
| 979 |
# declarations under __STRICT_ANSI__ |
| 980 |
amigaos* | android | dreamcast | ds | gamecube | mingw* | morphos* |n64 | psp | ps2 | wii | wince ) |
| 981 |
;; |
| 982 |
*) |
| 983 |
CXXFLAGS="$CXXFLAGS -ansi" |
| 984 |
;; |
| 985 |
esac |
| 986 |
fi |
| 987 |
CXXFLAGS="$CXXFLAGS -W -Wno-unused-parameter" |
| 988 |
add_line_to_config_mk 'HAVE_GCC3 = 1' |
| 989 |
add_line_to_config_mk 'CXX_UPDATE_DEP_FLAG = -MMD -MF "$(*D)/$(DEPDIR)/$(*F).d" -MQ "$@" -MP' |
| 990 |
fi |
| 991 |
|
| 992 |
if test "$_cxx_major" -eq 4 && test "$_cxx_minor" -ge 3 || \ |
| 993 |
test "$_cxx_major" -gt 4 ; then |
| 994 |
CXXFLAGS="$CXXFLAGS -Wno-empty-body" |
| 995 |
else |
| 996 |
CXXFLAGS="$CXXFLAGS -Wconversion" |
| 997 |
fi |
| 998 |
fi |
| 999 |
|
| 1000 |
echo_n "Building as C++11... " |
| 1001 |
if test "$_use_cxx11" = "yes" ; then |
| 1002 |
case $_host_os in |
| 1003 |
# newlib-based system include files suppress non-C89 function |
| 1004 |
# declarations under __STRICT_ANSI__ |
| 1005 |
amigaos* | android | dreamcast | ds | gamecube | mingw* | morphos* | n64 | psp | ps2 | wii | wince ) |
| 1006 |
_use_cxx11=no |
| 1007 |
;; |
| 1008 |
*) |
| 1009 |
CXXFLAGS="$CXXFLAGS -std=c++11" |
| 1010 |
;; |
| 1011 |
esac |
| 1012 |
fi |
| 1013 |
echo $_use_cxx11 |
| 1014 |
|
| 1015 |
|
| 1016 |
# By default, we add -pedantic to the CXXFLAGS to catch some potentially |
| 1017 |
# non-portable constructs, like use of GNU extensions. |
| 1018 |
# However, some platforms use GNU extensions in system header files, so |
| 1019 |
# for these we must not use -pedantic. |
| 1020 |
case $_host_os in |
| 1021 |
android | gamecube | psp | wii) |
| 1022 |
;; |
| 1023 |
*) |
| 1024 |
# ICC does not support pedantic, while GCC and clang do. |
| 1025 |
if test "$have_icc" = no ; then |
| 1026 |
CXXFLAGS="$CXXFLAGS -pedantic" |
| 1027 |
fi |
| 1028 |
;; |
| 1029 |
esac |
| 1030 |
|
| 1031 |
# Check if std::nullptr_t is available |
| 1032 |
echo_n "Checking if C++11 std::nullptr_t is available..." |
| 1033 |
cat > $TMPC << EOF |
| 1034 |
#include <cstddef> |
| 1035 |
int main(int argc, char *argv[]) { |
| 1036 |
std::nullptr_t i = nullptr; |
| 1037 |
return 0; |
| 1038 |
} |
| 1039 |
EOF |
| 1040 |
cc_check |
| 1041 |
if test "$TMPR" -eq 0; then |
| 1042 |
echo yes |
| 1043 |
else |
| 1044 |
echo no |
| 1045 |
define_in_config_if_yes yes 'NO_CXX11_NULLPTR_T' |
| 1046 |
fi |
| 1047 |
|
| 1048 |
if test -n "$STRINGS"; then |
| 1049 |
_strings=$STRINGS |
| 1050 |
else |
| 1051 |
echo_n "Checking for $_host_alias-strings... " >> "$TMPLOG" |
| 1052 |
if `which $_host_alias-strings >/dev/null 2>&1`; then |
| 1053 |
_strings=$_host_alias-strings |
| 1054 |
echo yes >> "$TMPLOG" |
| 1055 |
else |
| 1056 |
_strings=strings |
| 1057 |
echo no >> "$TMPLOG" |
| 1058 |
fi |
| 1059 |
fi |
| 1060 |
|
| 1061 |
# |
| 1062 |
# Check for endianness |
| 1063 |
# |
| 1064 |
echo_n "Checking endianness... " |
| 1065 |
cat > tmp_endianness_check.cpp << EOF |
| 1066 |
unsigned short ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; |
| 1067 |
unsigned short ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; |
| 1068 |
void _ascii() { char* s = (char*) ascii_mm; s = (char*) ascii_ii; } |
| 1069 |
unsigned short ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; |
| 1070 |
unsigned short ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; |
| 1071 |
void _ebcdic() { char* s = (char*) ebcdic_mm; s = (char*) ebcdic_ii; } |
| 1072 |
int main() { _ascii (); _ebcdic (); return 0; } |
| 1073 |
EOF |
| 1074 |
$CXX $CXXFLAGS -c -o $TMPO.o tmp_endianness_check.cpp |
| 1075 |
if $_strings $TMPO.o | grep BIGenDianSyS >/dev/null; then |
| 1076 |
_endian=big |
| 1077 |
elif $_strings $TMPO.o | grep LiTTleEnDian >/dev/null; then |
| 1078 |
_endian=little |
| 1079 |
fi |
| 1080 |
echo $_endian; |
| 1081 |
cc_check_clean tmp_endianness_check.cpp |
| 1082 |
|
| 1083 |
case $_endian in |
| 1084 |
big) |
| 1085 |
add_line_to_config_h '#undef SCUMM_LITTLE_ENDIAN' |
| 1086 |
add_line_to_config_h '#define SCUMM_BIG_ENDIAN' |
| 1087 |
;; |
| 1088 |
little) |
| 1089 |
add_line_to_config_h '#define SCUMM_LITTLE_ENDIAN' |
| 1090 |
add_line_to_config_h '#undef SCUMM_BIG_ENDIAN' |
| 1091 |
;; |
| 1092 |
*) |
| 1093 |
exit 1 |
| 1094 |
;; |
| 1095 |
esac |
| 1096 |
|
| 1097 |
# |
| 1098 |
# Determine a data type with the given length |
| 1099 |
# |
| 1100 |
find_type_with_size() { |
| 1101 |
for datatype in int short char long "long long" unknown; do |
| 1102 |
cat > tmp_find_type_with_size.cpp << EOF |
| 1103 |
typedef $datatype ac__type_sizeof_; |
| 1104 |
int main() { |
| 1105 |
static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) == $1)]; |
| 1106 |
test_array [0] = 0; |
| 1107 |
return 0; |
| 1108 |
} |
| 1109 |
EOF |
| 1110 |
if $CXX $CXXFLAGS -c -o $TMPO.o tmp_find_type_with_size.cpp 2>/dev/null ; then |
| 1111 |
break |
| 1112 |
else |
| 1113 |
if test "$datatype" = "unknown"; then |
| 1114 |
echo "couldn't find data type with $1 bytes" |
| 1115 |
exit 1 |
| 1116 |
fi |
| 1117 |
continue |
| 1118 |
fi |
| 1119 |
done |
| 1120 |
cc_check_clean tmp_find_type_with_size.cpp |
| 1121 |
echo "$datatype" |
| 1122 |
} |
| 1123 |
|
| 1124 |
# |
| 1125 |
# Determine data type sizes |
| 1126 |
# |
| 1127 |
echo_n "Type with 1 byte... " |
| 1128 |
type_1_byte=`find_type_with_size 1` |
| 1129 |
TMPR="$?" |
| 1130 |
echo "$type_1_byte" |
| 1131 |
test $TMPR -eq 0 || exit 1 # check exit code of subshell |
| 1132 |
|
| 1133 |
echo_n "Type with 2 bytes... " |
| 1134 |
type_2_byte=`find_type_with_size 2` |
| 1135 |
TMPR="$?" |
| 1136 |
echo "$type_2_byte" |
| 1137 |
test $TMPR -eq 0 || exit 1 # check exit code of subshell |
| 1138 |
|
| 1139 |
echo_n "Type with 4 bytes... " |
| 1140 |
type_4_byte=`find_type_with_size 4` |
| 1141 |
TMPR="$?" |
| 1142 |
echo "$type_4_byte" |
| 1143 |
test $TMPR -eq 0 || exit 1 # check exit code of subshell |
| 1144 |
|
| 1145 |
echo_n "Type with 8 bytes... " |
| 1146 |
type_8_byte=`find_type_with_size 8` |
| 1147 |
TMPR="$?" |
| 1148 |
echo "$type_8_byte" |
| 1149 |
test $TMPR -eq 0 || exit 1 # check exit code of subshell |
| 1150 |
|
| 1151 |
# |
| 1152 |
# Check whether memory alignment is required |
| 1153 |
# |
| 1154 |
# For some CPU types, unaligned memory access is either not supported at |
| 1155 |
# all (and so leads to a crash), requires a super-slow emulation via an |
| 1156 |
# exception handler, or just results in incorrect results. |
| 1157 |
# On the other hand, accessing data in a manner that works regardless of |
| 1158 |
# alignment can be a lot slower than regular access, so we don't want |
| 1159 |
# to use it if we don't have to. |
| 1160 |
# |
| 1161 |
# So we do the following: For CPU families where we know whether unaligned |
| 1162 |
# access is safe & fast, we enable / disable unaligned access accordingly. |
| 1163 |
# Otherwise, we just disable memory alignment. |
| 1164 |
# |
| 1165 |
# NOTE: In the past, for non-cross compiled builds, we would also run some code |
| 1166 |
# which would try to test whether unaligned access worked or not. But this test |
| 1167 |
# could not reliably determine whether unaligned access really worked in all |
| 1168 |
# situations (and across different implementations of the target CPU arch), nor |
| 1169 |
# whether it was fast (as opposed to slowly emulated by fault handlers). Hence, |
| 1170 |
# we do not use this approach anymore. |
| 1171 |
# |
| 1172 |
# NOTE: The only kinds of unaligned access we allow are for 2 byte and 4 |
| 1173 |
# byte loads / stores. No promises are made for bigger sizes, such as 8 |
| 1174 |
# or 16 byte loads, for which architectures may behave differently than |
| 1175 |
# for the smaller sizes. |
| 1176 |
echo_n "Alignment required... " |
| 1177 |
case $_host_cpu in |
| 1178 |
i[3-6]86 | x86_64 | ppc*) |
| 1179 |
# Unaligned access should work |
| 1180 |
_need_memalign=no |
| 1181 |
;; |
| 1182 |
alpha* | arm* | bfin* | hp* | mips* | sh* | sparc* | ia64 | nv1*) |
| 1183 |
# Unaligned access is not supported or extremely slow. |
| 1184 |
_need_memalign=yes |
| 1185 |
;; |
| 1186 |
*) |
| 1187 |
# Status of unaligned access is unknown, so assume the worst. |
| 1188 |
_need_memalign=yes |
| 1189 |
;; |
| 1190 |
esac |
| 1191 |
echo "$_need_memalign" |
| 1192 |
|
| 1193 |
define_in_config_h_if_yes $_need_memalign 'SCUMM_NEED_ALIGNMENT' |
| 1194 |
|
| 1195 |
# |
| 1196 |
# Determine build settings |
| 1197 |
# |
| 1198 |
echo_n "Checking hosttype... " |
| 1199 |
echo $_host_os |
| 1200 |
case $_host_os in |
| 1201 |
amigaos*) |
| 1202 |
add_line_to_config_mk 'AMIGAOS = 1' |
| 1203 |
# Use 'long' for ScummVM's 4 byte typedef, because AmigaOS |
| 1204 |
# already typedefs (u)int32 as (unsigned) long and suppress |
| 1205 |
# those noisy format warnings caused by the 'long' 4 byte |
| 1206 |
type_4_byte='long' |
| 1207 |
CXXFLAGS="$CXXFLAGS -Wno-format" |
| 1208 |
# Dependencies might also be compiled with stack protection |
| 1209 |
LDFLAGS="$LDFLAGS -L/sdk/local/newlib/lib -fstack-protector" |
| 1210 |
;; |
| 1211 |
beos*) |
| 1212 |
DEFINES="$DEFINES -DSYSTEM_NOT_SUPPORTING_D_TYPE" |
| 1213 |
# Needs -lbind -lsocket for the timidity MIDI driver |
| 1214 |
LDFLAGS="-L/boot/home/config/lib" |
| 1215 |
CFLAGS="-I/boot/home/config/include" |
| 1216 |
CXXFLAGS="$CXXFLAGS -fhuge-objects" |
| 1217 |
LIBS="$LIBS -lbind -lsocket" |
| 1218 |
_seq_midi=no |
| 1219 |
;; |
| 1220 |
cygwin*) |
| 1221 |
echo ERROR: Cygwin building is not supported by ScummVM anymore. Consider using MinGW. |
| 1222 |
exit 1 |
| 1223 |
;; |
| 1224 |
darwin*) |
| 1225 |
DEFINES="$DEFINES -DMACOSX" |
| 1226 |
LIBS="$LIBS -framework AudioUnit -framework AudioToolbox -framework Carbon -framework CoreMIDI" |
| 1227 |
add_line_to_config_mk 'MACOSX = 1' |
| 1228 |
|
| 1229 |
# Now we may have MacPorts or Fink installed |
| 1230 |
# Which put libraries and headers in non-standard places |
| 1231 |
# Checking them here |
| 1232 |
|
| 1233 |
# MacPorts |
| 1234 |
# There is no way to get the prefix, so implementing a hack here |
| 1235 |
macport_version=`port version 2>/dev/null` |
| 1236 |
if test "$?" -eq 0; then |
| 1237 |
macport_version="`echo "${macport_version}" | sed -ne 's/Version: \([0-9]\.[0-9]\.[0-9]\)/\1/gp'`" |
| 1238 |
echo_n "You seem to be running MacPorts version ${macport_version}..." |
| 1239 |
|
| 1240 |
macport_prefix=`which port` |
| 1241 |
# strip off /bin/port from /opt/local/bin/port |
| 1242 |
macport_prefix=`dirname ${macport_prefix}` |
| 1243 |
macport_prefix=`dirname ${macport_prefix}` |
| 1244 |
|
| 1245 |
echo "adding ${macport_prefix} to paths" |
| 1246 |
|
| 1247 |
LDFLAGS="-L${macport_prefix}/lib $LDFLAGS" |
| 1248 |
CXXFLAGS="-I${macport_prefix}/include $CXXFLAGS" |
| 1249 |
|
| 1250 |
if test -z "$_staticlibpath"; then |
| 1251 |
_staticlibpath=${macport_prefix} |
| 1252 |
echo "Set staticlib-prefix to ${_staticlibpath}" |
| 1253 |
fi |
| 1254 |
fi |
| 1255 |
|
| 1256 |
# Fink |
| 1257 |
# There is no way to get the prefix, so implementing a hack here |
| 1258 |
fink_version=`fink -V 2>/dev/null` |
| 1259 |
if test "$?" -eq 0; then |
| 1260 |
fink_version="`echo "${fink_version}" | sed -ne 's/Package manager version: \([0-9.]*\)/\1/gp'`" |
| 1261 |
echo_n "You seem to be running Fink version ${fink_version}..." |
| 1262 |
|
| 1263 |
fink_prefix=`which fink` |
| 1264 |
# strip off /bin/fink from /sw/bin/port |
| 1265 |
fink_prefix=`dirname ${fink_prefix}` |
| 1266 |
fink_prefix=`dirname ${fink_prefix}` |
| 1267 |
|
| 1268 |
echo "adding ${fink_prefix} to paths" |
| 1269 |
|
| 1270 |
LDFLAGS="-L${fink_prefix}/lib $LDFLAGS" |
| 1271 |
CXXFLAGS="-I${fink_prefix}/include $CXXFLAGS" |
| 1272 |
|
| 1273 |
if test -z "$_staticlibpath"; then |
| 1274 |
_staticlibpath=${fink_prefix} |
| 1275 |
echo "Set staticlib-prefix to ${_staticlibpath}" |
| 1276 |
fi |
| 1277 |
fi |
| 1278 |
|
| 1279 |
# Homebrew |
| 1280 |
brew_version=`brew -v 2>/dev/null` |
| 1281 |
if test "$?" -eq 0; then |
| 1282 |
brew_version="`echo "${brew_version}" | sed -ne 's/Homebrew \([0-9.]*\)/\1/gp'`" |
| 1283 |
echo_n "You seem to be running Homebrew version ${brew_version}..." |
| 1284 |
|
| 1285 |
brew_prefix=`brew --prefix` |
| 1286 |
|
| 1287 |
echo "adding ${brew_prefix} to paths" |
| 1288 |
|
| 1289 |
LDFLAGS="-L${brew_prefix}/lib $LDFLAGS" |
| 1290 |
CXXFLAGS="-I${brew_prefix}/include $CXXFLAGS" |
| 1291 |
|
| 1292 |
if test -z "$_staticlibpath"; then |
| 1293 |
_staticlibpath=${brew_prefix} |
| 1294 |
echo "Set staticlib-prefix to ${_staticlibpath}" |
| 1295 |
fi |
| 1296 |
fi |
| 1297 |
|
| 1298 |
# If _staticlibpath is not set yet try first /sw (fink) then /usr/local |
| 1299 |
# (the macports case is handled above). |
| 1300 |
if test -z "$_staticlibpath"; then |
| 1301 |
if test -d "/sw"; then |
| 1302 |
_staticlibpath=/sw |
| 1303 |
echo "Set staticlib-prefix to ${_staticlibpath}" |
| 1304 |
elif test -d "/usr/local"; then |
| 1305 |
_staticlibpath=/usr/local |
| 1306 |
echo "Set staticlib-prefix to ${_staticlibpath}" |
| 1307 |
else |
| 1308 |
echo "Could not determine prefix for static libraries" |
| 1309 |
fi |
| 1310 |
fi |
| 1311 |
|
| 1312 |
# If _xcodetoolspath is not set yet use xcode-select to get the path |
| 1313 |
if test -z "$_xcodetoolspath"; then |
| 1314 |
_xcodetoolspath=`xcode-select -print-path`/Tools |
| 1315 |
if test -d "$_xcodetoolspath"; then |
| 1316 |
echo "Set xcodetools-path to ${_xcodetoolspath}" |
| 1317 |
else |
| 1318 |
_xcodetoolspath= |
| 1319 |
echo "Could not determine path for Xcode Tools" |
| 1320 |
fi |
| 1321 |
fi |
| 1322 |
;; |
| 1323 |
freebsd*) |
| 1324 |
LDFLAGS="$LDFLAGS -L/usr/local/lib" |
| 1325 |
CXXFLAGS="$CXXFLAGS -I/usr/local/include" |
| 1326 |
;; |
| 1327 |
haiku*) |
| 1328 |
DEFINES="$DEFINES -DSYSTEM_NOT_SUPPORTING_D_TYPE" |
| 1329 |
# Needs -lnetwork for the timidity MIDI driver |
| 1330 |
LIBS="$LIBS -lnetwork" |
| 1331 |
_seq_midi=no |
| 1332 |
;; |
| 1333 |
irix*) |
| 1334 |
DEFINES="$DEFINES -DIRIX" |
| 1335 |
DEFINES="$DEFINES -DSYSTEM_NOT_SUPPORTING_D_TYPE" |
| 1336 |
LIBS="$LIBS -lmd -lfastm -lm" |
| 1337 |
_ranlib=: |
| 1338 |
;; |
| 1339 |
linux* | uclinux*) |
| 1340 |
# When not cross-compiling, enable large file support, but don't |
| 1341 |
# care if getconf doesn't exist or doesn't recognize LFS_CFLAGS. |
| 1342 |
if test -z "$_host"; then |
| 1343 |
CXXFLAGS="$CXXFLAGS $(getconf LFS_CFLAGS 2>/dev/null)" |
| 1344 |
fi |
| 1345 |
;; |
| 1346 |
mingw*) |
| 1347 |
DEFINES="$DEFINES -DWIN32" |
| 1348 |
# append_var DEFINES "-D__USE_MINGW_ANSI_STDIO=0" # Modern MinGW does not need it |
| 1349 |
LDFLAGS="$LDFLAGS -static-libgcc -static-libstdc++" |
| 1350 |
LIBS="$LIBS -lmingw32 -lwinmm" |
| 1351 |
OBJS="$OBJS scummvmtoolswinres.o" |
| 1352 |
add_line_to_config_mk 'WIN32 = 1' |
| 1353 |
;; |
| 1354 |
mint*) |
| 1355 |
DEFINES="$DEFINES -DSYSTEM_NOT_SUPPORTING_D_TYPE" |
| 1356 |
;; |
| 1357 |
morphos*) |
| 1358 |
LDFLAGS="$LDFLAGS -L/usr/local/lib -noixemul" |
| 1359 |
CXXFLAGS="$CXXFLAGS -D__MORPHOS_SHAREDLIBS" |
| 1360 |
# We have to use 'long' for our 4 byte typedef because MorphOS already typedefs (u)int32 |
| 1361 |
# as (unsigned) long, and consequently we'd get a compiler error otherwise. |
| 1362 |
type_4_byte='long' |
| 1363 |
add_line_to_config_mk 'MORPHOS = 1' |
| 1364 |
;; |
| 1365 |
riscos) |
| 1366 |
DEFINES="$DEFINES -DRISCOS" |
| 1367 |
add_line_to_config_mk 'RISCOS = 1' |
| 1368 |
LDFLAGS="$LDFLAGS -L$GCCSDK_INSTALL_ENV/lib" |
| 1369 |
CXXFLAGS="$CXXFLAGS -I$GCCSDK_INSTALL_ENV/include" |
| 1370 |
_pkgconfig=$GCCSDK_INSTALL_ENV/ro-pkg-config |
| 1371 |
_wxconfig=$GCCSDK_INSTALL_ENV/bin/wx-config |
| 1372 |
_freetypepath=$GCCSDK_INSTALL_ENV/bin |
| 1373 |
LDFLAGS="$LDFLAGS -static" |
| 1374 |
;; |
| 1375 |
solaris*) |
| 1376 |
DEFINES="$DEFINES -DSOLARIS" |
| 1377 |
DEFINES="$DEFINES -DSYSTEM_NOT_SUPPORTING_D_TYPE" |
| 1378 |
# Needs -lbind -lsocket for the timidity MIDI driver |
| 1379 |
LIBS="$LIBS -lnsl -lsocket" |
| 1380 |
;; |
| 1381 |
esac |
| 1382 |
|
| 1383 |
if test -n "$_host"; then |
| 1384 |
# Cross-compiling mode - add your target here if needed |
| 1385 |
echo "Cross-compiling to $_host" |
| 1386 |
case "$_host" in |
| 1387 |
arm-linux|arm*-linux-gnueabi|arm-*-linux) |
| 1388 |
;; |
| 1389 |
arm-*riscos) |
| 1390 |
# toolchain binaries prefixed by host |
| 1391 |
_ranlib=$_host-ranlib |
| 1392 |
_strip=$_host-strip |
| 1393 |
_ar="$_host-ar cru" |
| 1394 |
_as="$_host-as" |
| 1395 |
;; |
| 1396 |
*darwin*) |
| 1397 |
_ranlib=$_host-ranlib |
| 1398 |
_strip=$_host-strip |
| 1399 |
;; |
| 1400 |
linupy) |
| 1401 |
DEFINES="$DEFINES -DLINUPY" |
| 1402 |
;; |
| 1403 |
m68k-atari-mint) |
| 1404 |
DEFINES="$DEFINES -DSYSTEM_NOT_SUPPORTING_D_TYPE" |
| 1405 |
_ranlib=m68k-atari-mint-ranlib |
| 1406 |
_ar="m68k-atari-mint-ar cru" |
| 1407 |
;; |
| 1408 |
*mingw32*) |
| 1409 |
_windres=$_host-windres |
| 1410 |
_ar="$_host-ar cru" |
| 1411 |
_ranlib=$_host-ranlib |
| 1412 |
;; |
| 1413 |
mips-sgi*) |
| 1414 |
LDFLAGS="$LDFLAGS -static-libgcc" |
| 1415 |
LIBS="$LIBS -laudio" |
| 1416 |
;; |
| 1417 |
ppc-amigaos|ppc-morphos) |
| 1418 |
# Only static builds link successfully on buildbot |
| 1419 |
LDFLAGS=`echo $LDFLAGS | sed 's/-use-dynld//'` |
| 1420 |
LDFLAGS="$LDFLAGS -static" |
| 1421 |
|
| 1422 |
# toolchain binaries prefixed by host |
| 1423 |
_ranlib=$_host-ranlib |
| 1424 |
_strip=$_host-strip |
| 1425 |
_ar="$_host-ar cru" |
| 1426 |
_as="$_host-as" |
| 1427 |
_windres=$_host-windres |
| 1428 |
;; |
| 1429 |
raspberrypi) |
| 1430 |
# This is needed because the official cross compiler doesn't have multiarch enabled |
| 1431 |
# but Raspbian does. |
| 1432 |
# Be careful as it's the linker (LDFLAGS) which must know about sysroot. |
| 1433 |
# These are needed to build against Raspbian's libSDL. |
| 1434 |
LDFLAGS="$LDFLAGS --sysroot=$RPI_ROOT" |
| 1435 |
LDFLAGS="$LDFLAGS -B$RPI_ROOT/usr/lib/arm-linux-gnueabihf" |
| 1436 |
LDFLAGS="$LDFLAGS -Xlinker --rpath-link=$RPI_ROOT/usr/lib/arm-linux-gnueabihf/pulseaudio" |
| 1437 |
LDFLAGS="$LDFLAGS -Xlinker --rpath-link=$RPI_ROOT/usr/lib/arm-linux-gnueabihf" |
| 1438 |
LDFLAGS="$LDFLAGS -Xlinker --rpath-link=$RPI_ROOT/lib/arm-linux-gnueabihf" |
| 1439 |
LDFLAGS="$LDFLAGS -Xlinker --rpath-link=$RPI_ROOT/opt/vc/lib" |
| 1440 |
LDFLAGS="$LDFLAGS -L$RPI_ROOT/opt/vc/lib" |
| 1441 |
CXXFLAGS="$CXXFLAGS -isystem $RPI_ROOT/usr/include/arm-linux-gnueabihf" |
| 1442 |
CXXFLAGS="$CXXFLAGS -I$RPI_ROOT/usr/include" |
| 1443 |
# This is so optional OpenGL ES includes are found. |
| 1444 |
CXXFLAGS="$CXXFLAGS -I$RPI_ROOT/opt/vc/include" |
| 1445 |
;; |
| 1446 |
*) |
| 1447 |
echo "WARNING: Unknown target, continuing with auto-detected values" |
| 1448 |
;; |
| 1449 |
esac |
| 1450 |
fi |
| 1451 |
|
| 1452 |
# |
| 1453 |
# Determine whether host is POSIX compliant, or at least POSIX |
| 1454 |
# compatible enough to support our POSIX code (including dlsym(), |
| 1455 |
# mkdir() and some other APIs). |
| 1456 |
# |
| 1457 |
# TODO: Instead of basing this on the host name, we should really base |
| 1458 |
# this on the presence of features (such as the dlsym and mkdir APIs). |
| 1459 |
# |
| 1460 |
echo_n "Checking if host is POSIX compliant... " |
| 1461 |
case $_host_os in |
| 1462 |
amigaos* | cygwin* | dreamcast | ds | gamecube | mingw* | morphos* | n64 | ps2 | psp | wii | wince) |
| 1463 |
_posix=no |
| 1464 |
;; |
| •1465 |
android | beos* | bsd* | darwin* | freebsd* | gnu* | gph-linux | haiku* | hpux* | iphone | irix* | kfreebsd* | linux* | mint* | netbsd* | openbsd* | riscos | solaris* | sunos* | uclinux* | webos) |
| 1466 |
_posix=yes |
| 1467 |
;; |
| 1468 |
os2-emx*) |
| 1469 |
_posix=yes # FIXME: Really??? |
| 1470 |
;; |
| 1471 |
*) |
| 1472 |
# given this is a shell script, we might assume some type of posix. |
| 1473 |
# However, the host system might be a totally different one, so |
| 1474 |
# we can assume nothing about it. |
| 1475 |
# Indeed, as mentioned further above, we really should test for the |
| 1476 |
# presences of relevant APIs on the host anyway... |
| 1477 |
_posix=no |
| 1478 |
;; |
| 1479 |
esac |
| 1480 |
echo $_posix |
| 1481 |
|
| 1482 |
if test "$_posix" = yes ; then |
| 1483 |
DEFINES="$DEFINES -DPOSIX" |
| 1484 |
add_line_to_config_mk 'POSIX = 1' |
| 1485 |
fi |
| 1486 |
|
| 1487 |
# |
| 1488 |
# Check whether to enable a verbose build |
| 1489 |
# |
| 1490 |
echo_n "Checking whether to have a verbose build... " |
| 1491 |
echo "$_verbose_build" |
| 1492 |
add_to_config_mk_if_yes "$_verbose_build" 'VERBOSE_BUILD = 1' |
| 1493 |
|
| 1494 |
# |
| 1495 |
# Check for math lib |
| 1496 |
# |
| 1497 |
cat > $TMPC << EOF |
| 1498 |
int main(void) { return 0; } |
| 1499 |
EOF |
| 1500 |
cc_check -lm && LDFLAGS="$LDFLAGS -lm" |
| 1501 |
|
| 1502 |
# |
| 1503 |
# Check for pkg-config |
| 1504 |
# |
| 1505 |
echocheck "pkg-config" |
| 1506 |
_pkg_config=no |
| 1507 |
command -v $_pkgconfig >/dev/null 2>&1 && _pkg_config=yes |
| 1508 |
echo "$_pkg_config" |
| 1509 |
|
| 1510 |
if test "$_pkg_config" = yes && test -n "$_host" && test -z "$PKG_CONFIG_LIBDIR"; then |
| 1511 |
echo "WARNING: When cross-compiling PKG_CONFIG_LIBDIR must be set to the location of the .pc files for the target" |
| 1512 |
fi |
| 1513 |
|
| 1514 |
# |
| 1515 |
# Check for Ogg Vorbis |
| 1516 |
# |
| 1517 |
echocheck "Ogg Vorbis" |
| 1518 |
if test "$_vorbis" = auto ; then |
| 1519 |
_vorbis=no |
| 1520 |
cat > $TMPC << EOF |
| 1521 |
#include <vorbis/codec.h> |
| 1522 |
int main(void) { vorbis_packet_blocksize(0,0); return 0; } |
| 1523 |
EOF |
| 1524 |
cc_check $OGG_CFLAGS $OGG_LIBS $VORBIS_CFLAGS $VORBIS_LIBS \ |
| 1525 |
-lvorbisfile -lvorbis -logg && _vorbis=yes |
| 1526 |
fi |
| 1527 |
if test "$_vorbis" = yes ; then |
| 1528 |
LIBS="$LIBS $OGG_LIBS $VORBIS_LIBS -lvorbisfile -lvorbis -lvorbisenc -logg" |
| 1529 |
INCLUDES="$INCLUDES $OGG_CFLAGS $VORBIS_CFLAGS" |
| 1530 |
fi |
| 1531 |
define_in_config_if_yes "$_vorbis" 'USE_VORBIS' |
| 1532 |
echo "$_vorbis" |
| 1533 |
|
| 1534 |
# |
| 1535 |
# Check for Tremor |
| 1536 |
# |
| 1537 |
echocheck "Tremor" |
| 1538 |
if test "$_tremor" = auto ; then |
| 1539 |
_tremor=no |
| 1540 |
cat > $TMPC << EOF |
| 1541 |
#include <tremor/ivorbiscodec.h> |
| 1542 |
int main(void) { vorbis_info_init(0); return 0; } |
| 1543 |
EOF |
| 1544 |
cc_check $TREMOR_CFLAGS $TREMOR_LIBS -lvorbisidec && \ |
| 1545 |
_tremor=yes |
| 1546 |
fi |
| 1547 |
if test "$_tremor" = yes && test "$_vorbis" = no; then |
| 1548 |
add_line_to_config_h '#define USE_TREMOR' |
| 1549 |
add_line_to_config_h '#define USE_VORBIS' |
| 1550 |
LIBS="$LIBS $TREMOR_LIBS -lvorbisenc" |
| 1551 |
INCLUDES="$INCLUDES $TREMOR_CFLAGS" |
| 1552 |
else |
| 1553 |
if test "$_vorbis" = yes; then |
| 1554 |
_tremor="no (Ogg Vorbis/Tremor support is mutually exclusive)" |
| 1555 |
fi |
| 1556 |
add_line_to_config_h '#undef USE_TREMOR' |
| 1557 |
fi |
| 1558 |
add_to_config_mk_if_yes "$_tremor" 'USE_TREMOR = 1' |
| 1559 |
echo "$_tremor" |
| 1560 |
|
| 1561 |
# |
| 1562 |
# Check for FLAC |
| 1563 |
# |
| 1564 |
echocheck "FLAC >= 1.1.3" |
| 1565 |
if test "$_flac" = auto ; then |
| 1566 |
_flac=no |
| 1567 |
cat > $TMPC << EOF |
| 1568 |
#include <FLAC/format.h> |
| 1569 |
#include <FLAC/stream_encoder.h> |
| 1570 |
FLAC__StreamEncoderInitStatus x; |
| 1571 |
int main(void) { return FLAC__STREAM_SYNC_LEN >> 30; /* guaranteed to be 0 */ } |
| 1572 |
EOF |
| 1573 |
if test "$_vorbis" = yes ; then |
| 1574 |
cc_check $FLAC_CFLAGS $FLAC_LIBS $OGG_CFLAGS $OGG_LIBS \ |
| 1575 |
-lFLAC -logg && _flac=yes |
| 1576 |
else |
| 1577 |
cc_check $FLAC_CFLAGS $FLAC_LIBS \ |
| 1578 |
-lFLAC && _flac=yes |
| 1579 |
fi |
| 1580 |
fi |
| 1581 |
if test "$_flac" = yes ; then |
| 1582 |
if test "$_vorbis" = yes ; then |
| 1583 |
LIBS="$LIBS $FLAC_LIBS $OGG_LIBS -lFLAC -logg" |
| 1584 |
else |
| 1585 |
LIBS="$LIBS $FLAC_LIBS -lFLAC" |
| 1586 |
fi |
| 1587 |
INCLUDES="$INCLUDES $FLAC_CFLAGS" |
| 1588 |
fi |
| 1589 |
define_in_config_if_yes "$_flac" 'USE_FLAC' |
| 1590 |
echo "$_flac" |
| 1591 |
|
| 1592 |
# |
| 1593 |
# Check for MAD (MP3 library) |
| 1594 |
# |
| 1595 |
echocheck "MAD" |
| 1596 |
if test "$_mad" = auto ; then |
| 1597 |
_mad=no |
| 1598 |
cat > $TMPC << EOF |
| 1599 |
#include <mad.h> |
| 1600 |
int main(void) { return 0; } |
| 1601 |
EOF |
| 1602 |
cc_check $MAD_CFLAGS $MAD_LIBS -lmad && _mad=yes |
| 1603 |
fi |
| 1604 |
if test "$_mad" = yes ; then |
| 1605 |
LIBS="$LIBS $MAD_LIBS -lmad" |
| 1606 |
INCLUDES="$INCLUDES $MAD_CFLAGS" |
| 1607 |
fi |
| 1608 |
define_in_config_if_yes "$_mad" 'USE_MAD' |
| 1609 |
echo "$_mad" |
| 1610 |
|
| 1611 |
# |
| 1612 |
# Check for PNG |
| 1613 |
# |
| 1614 |
echocheck "PNG >= 1.2.8" |
| 1615 |
if test "$_pkg_config" = "yes" && $_pkgconfig --exists libpng; then |
| 1616 |
PNG_LIBS="$PNG_LIBS `$_pkgconfig --libs libpng`" |
| 1617 |
PNG_CFLAGS="$PNG_CFLAGS `$_pkgconfig --cflags libpng`" |
| 1618 |
else |
| 1619 |
PNG_LIBS="$PNG_LIBS -lpng -lz" |
| 1620 |
fi |
| 1621 |
if test "$_png" = auto ; then |
| 1622 |
_png=no |
| 1623 |
cat > $TMPC << EOF |
| 1624 |
#include <png.h> |
| 1625 |
int main(void) { |
| 1626 |
#if PNG_LIBPNG_VER >= 10208 |
| 1627 |
#else |
| 1628 |
syntax error |
| 1629 |
#endif |
| 1630 |
return 0; |
| 1631 |
} |
| 1632 |
EOF |
| 1633 |
cc_check $PNG_CFLAGS $PNG_LIBS && _png=yes |
| 1634 |
fi |
| 1635 |
if test "$_png" = yes ; then |
| 1636 |
LIBS="$LIBS $PNG_LIBS" |
| 1637 |
INCLUDES="$INCLUDES $PNG_CFLAGS" |
| 1638 |
fi |
| 1639 |
define_in_config_if_yes "$_png" 'USE_PNG' |
| 1640 |
echo "$_png" |
| 1641 |
|
| 1642 |
# |
| 1643 |
# Check for ZLib |
| 1644 |
# |
| 1645 |
echocheck "zlib" |
| 1646 |
if test "$_zlib" = auto ; then |
| 1647 |
_zlib=no |
| 1648 |
cat > $TMPC << EOF |
| 1649 |
#include <string.h> |
| 1650 |
#include <zlib.h> |
| 1651 |
int main(void) { return strcmp(ZLIB_VERSION, zlibVersion()); } |
| 1652 |
EOF |
| 1653 |
cc_check $ZLIB_CFLAGS $ZLIB_LIBS -lz && _zlib=yes |
| 1654 |
fi |
| 1655 |
if test "$_zlib" = yes ; then |
| 1656 |
LIBS="$LIBS $ZLIB_LIBS -lz" |
| 1657 |
INCLUDES="$INCLUDES $ZLIB_CFLAGS" |
| 1658 |
fi |
| 1659 |
define_in_config_if_yes "$_zlib" 'USE_ZLIB' |
| 1660 |
echo "$_zlib" |
| 1661 |
|
| 1662 |
# |
| 1663 |
# Check for FreeType2 to be present |
| 1664 |
# |
| 1665 |
find_freetype() { |
| 1666 |
# Wrapper function which tries to find freetype |
| 1667 |
# either by calling freetype-config or by using |
| 1668 |
# pkg-config. |
| 1669 |
# As of freetype-2.9.1 the freetype-config file |
| 1670 |
# no longer gets installed by default. |
| 1671 |
if test "$_pkg_config" = "yes" && $_pkgconfig --exists freetype2; then |
| 1672 |
FREETYPE2_LIBS=`$_pkgconfig --libs freetype2` |
| 1673 |
FREETYPE2_CFLAGS=`$_pkgconfig --cflags freetype2` |
| 1674 |
FREETYPE2_STATIC_LIBS=`$_pkgconfig --static --libs freetype2` |
| 1675 |
_freetype_found="true" |
| 1676 |
else |
| 1677 |
# Look for the freetype-config script |
| 1678 |
find_freetypeconfig |
| 1679 |
if test -n "$_freetypeconfig"; then |
| 1680 |
# Since 2.3.12, freetype-config prepends $SYSROOT to everything. |
| 1681 |
# This means we can't pass it a --prefix that includes $SYSROOT. |
| 1682 |
freetypeprefix="$_freetypepath" |
| 1683 |
if test -n "$SYSROOT" -a "$SYSROOT" != "/"; then |
| 1684 |
teststring=VeryImplausibleSysrootX1Y2Z3 |
| 1685 |
if ( env SYSROOT=/$teststring "$_freetypeconfig" --cflags | grep $teststring 2> /dev/null > /dev/null ); then |
| 1686 |
echo "Adapting FreeType prefix to SYSROOT" >> "$TMPLOG" |
| 1687 |
freetypeprefix="${freetypeprefix##$SYSROOT}" |
| 1688 |
fi |
| 1689 |
fi |
| 1690 |
FREETYPE2_LIBS=`$_freetypeconfig --prefix="$freetypeprefix" --libs` |
| 1691 |
FREETYPE2_CFLAGS=`$_freetypeconfig --prefix="$freetypeprefix" --cflags` |
| 1692 |
FREETYPE2_STATIC_LIBS=`$_freetypeconfig --prefix="$freetypeprefix" --static --libs 2>/dev/null` |
| 1693 |
_freetype_found="true" |
| 1694 |
fi |
| 1695 |
fi |
| 1696 |
} |
| 1697 |
|
| 1698 |
if test "$_freetype2" != "no"; then |
| 1699 |
find_freetype |
| 1700 |
if test $_freetype_found != true; then |
| 1701 |
_freetype2=no |
| 1702 |
else |
| 1703 |
if test "$_freetype2" = "auto"; then |
| 1704 |
_freetype2=no |
| 1705 |
|
| 1706 |
cat > $TMPC << EOF |
| 1707 |
#include <ft2build.h> |
| 1708 |
#include FT_FREETYPE_H |
| 1709 |
|
| 1710 |
int main(int argc, char *argv[]) { |
| 1711 |
FT_Library library; |
| 1712 |
FT_Error error = FT_Init_FreeType(&library); |
| 1713 |
FT_Done_FreeType(library); |
| 1714 |
} |
| 1715 |
EOF |
| 1716 |
|
| 1717 |
cc_check_no_clean $FREETYPE2_CFLAGS $FREETYPE2_LIBS && _freetype2=yes |
| 1718 |
# Modern freetype-config scripts accept --static to get all |
| 1719 |
# required flags for static linking. We abuse this to detect |
| 1720 |
# FreeType2 builds which are static themselves. |
| 1721 |
if test "$_freetype2" != "yes"; then |
| 1722 |
FREETYPE2_LIBS="$FREETYPE2_STATIC_LIBS" |
| 1723 |
cc_check_no_clean $FREETYPE2_CFLAGS $FREETYPE2_LIBS && _freetype2=yes |
| 1724 |
fi |
| 1725 |
cc_check_clean |
| 1726 |
fi |
| 1727 |
|
| 1728 |
if test "$_freetype2" = "yes"; then |
| 1729 |
LIBS="$LIBS $FREETYPE2_LIBS" |
| 1730 |
CXXFLAGS="$CXXFLAGS $FREETYPE2_CFLAGS" |
| 1731 |
fi |
| 1732 |
fi |
| 1733 |
|
| 1734 |
fi |
| 1735 |
|
| 1736 |
echocheck "FreeType2" |
| 1737 |
echo "$_freetype2" |
| 1738 |
|
| 1739 |
define_in_config_if_yes "$_freetype2" "USE_FREETYPE2" |
| 1740 |
|
| 1741 |
# |
| 1742 |
# Check for Boost |
| 1743 |
# |
| 1744 |
echocheck "Boost => 1.32.0" |
| 1745 |
if test "$_boost" = auto ; then |
| 1746 |
_boost=no |
| 1747 |
cat > $TMPC << EOF |
| 1748 |
#include <iostream> |
| 1749 |
#include <boost/version.hpp> |
| 1750 |
int main(void) { if (BOOST_VERSION < 103200) return 1; return 0; } |
| 1751 |
EOF |
| 1752 |
cc_check $BOOST_CFLAGS $BOOST_LIBS && _boost=yes |
| 1753 |
fi |
| 1754 |
echo "$_boost" |
| 1755 |
|
| 1756 |
if test "$_boost" = yes ; then |
| 1757 |
_boost=no |
| 1758 |
echo_n "Checking whether Boost.ProgramOptions has been compiled... " |
| 1759 |
cat > $TMPC << EOF |
| 1760 |
#include <boost/program_options.hpp> |
| 1761 |
int main(void) { boost::program_options::options_description generic("Generic options"); return 0; } |
| 1762 |
EOF |
| 1763 |
cc_check $BOOST_CFLAGS $BOOST_LIBS -lboost_program_options && _boost=yes |
| 1764 |
add_to_config_mk_if_yes "$_boost" 'BOOST_SUFFIX = ' |
| 1765 |
|
| 1766 |
# If not working without suffix, try -mt suffix |
| 1767 |
if test "$_boost" = no ; then |
| 1768 |
cc_check $BOOST_CFLAGS $BOOST_LIBS -lboost_program_options-mt && _boost=yes |
| 1769 |
add_to_config_mk_if_yes "$_boost" 'BOOST_SUFFIX = -mt' |
| 1770 |
fi |
| 1771 |
add_to_config_mk_if_yes "$_boost" 'USE_BOOST = 1' |
| 1772 |
echo "$_boost" |
| 1773 |
fi |
| 1774 |
|
| 1775 |
# |
| 1776 |
# Check for iconv |
| 1777 |
# |
| 1778 |
echo_n "Checking whether iconv.h is present... " |
| 1779 |
if test "$_iconv" = auto ; then |
| 1780 |
_iconv=no |
| 1781 |
cat > $TMPC << EOF |
| 1782 |
#include <iconv.h> |
| 1783 |
int main(int, char **) { |
| 1784 |
return 0; |
| 1785 |
} |
| 1786 |
EOF |
| 1787 |
cc_check && _iconv=yes |
| 1788 |
fi |
| 1789 |
|
| 1790 |
create_iconv_test() { |
| 1791 |
cat > $TMPC << EOF |
| 1792 |
#include <iconv.h> |
| 1793 |
int main(int, char **) { |
| 1794 |
iconv_t iconv = iconv_open("UTF-32", "SJIS"); |
| 1795 |
iconv_close(iconv); |
| 1796 |
return 0; |
| 1797 |
} |
| 1798 |
EOF |
| 1799 |
} |
| 1800 |
echo "$_iconv" |
| 1801 |
|
| 1802 |
if test "$_iconv" = yes ; then |
| 1803 |
echo_n "Checking whether iconv needs linking against libiconv... " |
| 1804 |
|
| 1805 |
needs_iconvlib='auto' |
| 1806 |
create_iconv_test |
| 1807 |
cc_check -liconv && needs_iconvlib='yes' |
| 1808 |
# We do check linking without -liconv here too, just in case |
| 1809 |
# it would fail otherwise too |
| 1810 |
create_iconv_test |
| 1811 |
cc_check && needs_iconvlib='no' |
| 1812 |
|
| 1813 |
if test "$needs_iconvlib" = auto ; then |
| 1814 |
_iconv=no |
| 1815 |
echo "does not link at all" |
| 1816 |
else |
| 1817 |
if test "$needs_iconvlib" = yes ; then |
| 1818 |
_iconvlibs='-liconv' |
| 1819 |
else |
| 1820 |
_iconvlibs='' |
| 1821 |
fi |
| 1822 |
echo "$needs_iconvlib" |
| 1823 |
|
| 1824 |
echo_n "Checking signature of iconv... " |
| 1825 |
uses_const=no |
| 1826 |
|
| 1827 |
cat > $TMPC << EOF |
| 1828 |
#include <iconv.h> |
| 1829 |
int main(int argc, char **argv) { |
| 1830 |
iconv_t iconvP; |
| 1831 |
const char **inbuf = 0; |
| 1832 |
iconv(iconvP, inbuf, 0, 0, 0); |
| 1833 |
return 0; |
| 1834 |
} |
| 1835 |
EOF |
| 1836 |
cc_check $_iconvlibs && uses_const=yes |
| 1837 |
|
| 1838 |
if test "$uses_const" = yes ; then |
| 1839 |
echo "iconv_t, const char **, size_t *, char **, size_t *" |
| 1840 |
_iconvcflags='-DICONV_USES_CONST' |
| 1841 |
else |
| 1842 |
echo "iconv_t, char **, size_t *, char **, size_t *" |
| 1843 |
_iconvcflags='-UICONV_USES_CONST' |
| 1844 |
fi |
| 1845 |
fi |
| 1846 |
fi |
| 1847 |
|
| 1848 |
echocheck "iconv" |
| 1849 |
define_in_config_if_yes "$_iconv" 'USE_ICONV' |
| 1850 |
echo "$_iconv" |
| 1851 |
|
| 1852 |
# |
| 1853 |
# Check for wxWidgets |
| 1854 |
# |
| 1855 |
if test "$_wxwidgets" = auto ; then |
| 1856 |
_wxwidgets=no |
| 1857 |
find_wxconfig |
| 1858 |
if test -n "$_wxconfig"; then |
| 1859 |
_wxwidgets=yes |
| 1860 |
fi |
| 1861 |
fi |
| 1862 |
|
| 1863 |
if test "$_wxwidgets" = yes ; then |
| 1864 |
_wxincludes="`$_wxconfig --prefix="$_wxpath" --cflags`" |
| 1865 |
_wxlibs="`$_wxconfig --prefix="$_wxpath" --libs`" |
| 1866 |
_wxstaticlibs="`$_wxconfig --prefix="$_wxpath" --static --libs 2> /dev/null`" |
| 1867 |
_wxstaticlibs=`echo $_wxstaticlibs | sed 's|-lpng||' | sed 's|-lz||'` |
| 1868 |
# _wxstaticlibs may contain non-static libraries that we also have in _wxstaticlibs. |
| 1869 |
# remove those to avoid dependency on non-static libraries |
| 1870 |
|
| 1871 |
if test "$have_gcc" = yes ; then |
| 1872 |
if test "$_cxx_major" -ge "8" ; then |
| 1873 |
# These warnings appear a lot in wx headers |
| 1874 |
_wxincludes="$_wxincludes -Wno-deprecated-copy -Wno-cast-function-type -Wno-cast-qual" |
| 1875 |
fi |
| 1876 |
fi |
| 1877 |
# Use the compiler specified by wx-config when not cross-compiling. This is needed on some systems to get a working executable. |
| 1878 |
if test -z "$_host"; then |
| 1879 |
CXX="`$_wxconfig --cxx`" |
| 1880 |
LD=$CXX |
| 1881 |
fi |
| 1882 |
|
| 1883 |
echo_n "Checking for wxwidgets gui dev component... " |
| 1884 |
has_wx_gui_dev=no |
| 1885 |
|
| 1886 |
cat > $TMPC << EOF |
| 1887 |
#include <wx/wx.h> |
| 1888 |
|
| 1889 |
class Foo : public wxFrame { |
| 1890 |
public: |
| 1891 |
Foo(const wxString& title) : wxFrame(NULL, wxID_ANY, title) {} |
| 1892 |
}; |
| 1893 |
|
| 1894 |
class FooApp : public wxApp { |
| 1895 |
public: |
| 1896 |
virtual bool OnInit(); |
| 1897 |
}; |
| 1898 |
|
| 1899 |
IMPLEMENT_APP(FooApp) |
| 1900 |
|
| 1901 |
bool FooApp::OnInit() { |
| 1902 |
Foo *foo = new Foo(wxT("Foo")); |
| 1903 |
foo->Show(true); |
| 1904 |
return true; |
| 1905 |
} |
| 1906 |
EOF |
| 1907 |
cc_check $_wxincludes $_wxlibs && has_wx_gui_dev=yes |
| 1908 |
|
| 1909 |
if test "$has_wx_gui_dev" = no ; then |
| 1910 |
_wxincludes="" |
| 1911 |
_wxlibs="" |
| 1912 |
_wxstaticlibs="" |
| 1913 |
_wxwidgets=no |
| 1914 |
echo "not found" |
| 1915 |
else |
| 1916 |
echo "found" |
| 1917 |
fi |
| 1918 |
|
| 1919 |
fi |
| 1920 |
add_to_config_mk_if_yes "$_wxwidgets" 'USE_WXWIDGETS = 1' |
| 1921 |
|
| 1922 |
|
| 1923 |
# |
| 1924 |
# Figure out installation directories |
| 1925 |
# |
| 1926 |
test -z "$_bindir" && _bindir="$_prefix/bin" |
| 1927 |
test -z "$_datadir" && _datadir="$_prefix/share" |
| 1928 |
test -z "$_mandir" && _mandir="$_prefix/share/man" |
| 1929 |
test -z "$_libdir" && _libdir="$_prefix/lib" |
| 1930 |
|
| 1931 |
# |
| 1932 |
# Set variables for profiling. |
| 1933 |
# We need to do it here to prevent mess-ups with the tests e.g. on the PSP |
| 1934 |
# |
| 1935 |
if test "$_enable_prof" = yes ; then |
| 1936 |
CXXFLAGS="$CXXFLAGS -pg" |
| 1937 |
LDFLAGS="$LDFLAGS -pg" |
| 1938 |
fi |
| 1939 |
|
| 1940 |
_def_media_path='#define APP_MEDIA_PATH "'$_datadir'"' |
| 1941 |
|
| 1942 |
echo |
| 1943 |
echo "Creating config.h" |
| 1944 |
cat > config.h << EOF |
| 1945 |
/* This file is automatically generated by configure */ |
| 1946 |
/* DO NOT EDIT MANUALLY */ |
| 1947 |
|
| 1948 |
#ifndef CONFIG_H |
| 1949 |
#define CONFIG_H |
| 1950 |
|
| 1951 |
$_config_h_data |
| 1952 |
|
| 1953 |
/* paths */ |
| 1954 |
$_def_media_path |
| 1955 |
|
| 1956 |
/* Data types */ |
| 1957 |
typedef unsigned $type_1_byte byte; |
| 1958 |
typedef unsigned int uint; |
| 1959 |
typedef unsigned $type_1_byte uint8; |
| 1960 |
typedef unsigned $type_2_byte uint16; |
| 1961 |
typedef unsigned $type_4_byte uint32; |
| 1962 |
typedef unsigned $type_8_byte uint64; |
| 1963 |
typedef signed $type_1_byte int8; |
| 1964 |
typedef signed $type_2_byte int16; |
| 1965 |
typedef signed $type_4_byte int32; |
| 1966 |
typedef signed $type_8_byte int64; |
| 1967 |
|
| 1968 |
#if defined(__APPLE__) && !defined(__ppc__) |
| 1969 |
#ifndef _UINT64 |
| 1970 |
#define _UINT64 |
| 1971 |
#endif |
| 1972 |
#endif |
| 1973 |
|
| 1974 |
#endif /* CONFIG_H */ |
| 1975 |
EOF |
| 1976 |
|
| 1977 |
echo "Creating config.mk" |
| 1978 |
cat > config.mk << EOF |
| 1979 |
# -------- Generated by configure ----------- |
| 1980 |
|
| 1981 |
CXX := $CXX |
| 1982 |
CXXFLAGS := $CXXFLAGS |
| 1983 |
LD := $LD |
| 1984 |
LIBS += $LIBS |
| 1985 |
RANLIB := $_ranlib |
| 1986 |
STRIP := $_strip |
| 1987 |
AR := $_ar |
| 1988 |
AS := $_as |
| 1989 |
ASFLAGS := $ASFLAGS |
| 1990 |
WINDRES := $_windres |
| 1991 |
WINDRESFLAGS := $WINDRESFLAGS |
| 1992 |
WIN32PATH=$_win32path |
| 1993 |
AMIGAOSPATH=$_amigaospath |
| 1994 |
MORPHOSPATH=$_morphospath |
| 1995 |
STATICLIBPATH=$_staticlibpath |
| 1996 |
XCODETOOLSPATH=$_xcodetoolspath |
| 1997 |
|
| 1998 |
EXEEXT := $HOSTEXEEXT |
| 1999 |
|
| 2000 |
PREFIX := $_prefix |
| 2001 |
BINDIR := $_bindir |
| 2002 |
DATADIR := $_datadir |
| 2003 |
MANDIR := $_mandir |
| 2004 |
LIBDIR := $_libdir |
| 2005 |
|
| 2006 |
$_config_mk_data |
| 2007 |
|
| 2008 |
INCLUDES += $INCLUDES |
| 2009 |
OBJS += $OBJS |
| 2010 |
DEFINES += $DEFINES |
| 2011 |
LDFLAGS += $LDFLAGS |
| 2012 |
|
| 2013 |
WXINCLUDES := $_wxincludes |
| 2014 |
WXLIBS := $_wxlibs |
| 2015 |
WXSTATICLIBS := $_wxstaticlibs |
| 2016 |
|
| 2017 |
FREETYPE2_CFLAGS := $FREETYPE2_CFLAGS |
| 2018 |
FREETYPE2_LIBS := $FREETYPE2_LIBS |
| 2019 |
|
| 2020 |
ICONVLIBS := $_iconvlibs |
| 2021 |
ICONVCFLAGS := $_iconvcflags |
| 2022 |
|
| 2023 |
SAVED_CONFIGFLAGS := $SAVED_CONFIGFLAGS |
| 2024 |
SAVED_LDFLAGS := $SAVED_LDFLAGS |
| 2025 |
SAVED_PKG_CONFIG_LIBDIR := $SAVED_PKG_CONFIG_LIBDIR |
| 2026 |
SAVED_CXX := $SAVED_CXX |
| 2027 |
SAVED_CXXFLAGS := $SAVED_CXXFLAGS |
| 2028 |
SAVED_CPPFLAGS := $SAVED_CPPFLAGS |
| 2029 |
SAVED_ASFLAGS := $SAVED_ASFLAGS |
| 2030 |
SAVED_WINDRESFLAGS := $SAVED_WINDRESFLAGS |
| 2031 |
EOF |
| 2032 |
|
| 2033 |
# |
| 2034 |
# Create a custom Makefile when building outside the source tree |
| 2035 |
# TODO: Add a better check than just looking for 'Makefile' |
| 2036 |
# |
| 2037 |
if test ! -f Makefile.common ; then |
| 2038 |
echo "Creating Makefile" |
| 2039 |
|
| 2040 |
cat > Makefile << EOF |
| 2041 |
# -------- Generated by configure ----------- |
| 2042 |
srcdir = $_srcdir |
| 2043 |
vpath %.h \$(srcdir) |
| 2044 |
vpath %.cpp \$(srcdir) |
| 2045 |
vpath %.c \$(srcdir) |
| 2046 |
vpath %.m \$(srcdir) |
| 2047 |
vpath %.mm \$(srcdir) |
| 2048 |
vpath %.asm \$(srcdir) |
| 2049 |
vpath %.s \$(srcdir) |
| 2050 |
vpath %.S \$(srcdir) |
| 2051 |
include \$(srcdir)/Makefile |
| 2052 |
EOF |
| 2053 |
|
| 2054 |
fi |