435 |
435 |
436 # Check if all params have valid values |
436 # Check if all params have valid values |
437 |
437 |
438 # Endian only allows AUTO, LE and, BE |
438 # Endian only allows AUTO, LE and, BE |
439 if [ -z "`echo $endian | egrep '^(AUTO|LE|BE|PREPROCESSOR)$'`" ]; then |
439 if [ -z "`echo $endian | egrep '^(AUTO|LE|BE|PREPROCESSOR)$'`" ]; then |
440 echo "configure: error: invalid option --endian=$endian" |
440 log 1 "configure: error: invalid option --endian=$endian" |
441 echo " Available options are: --endian=[AUTO|LE|BE]" |
441 log 1 " Available options are: --endian=[AUTO|LE|BE]" |
442 exit 1 |
442 exit 1 |
443 fi |
443 fi |
444 if [ "$endian" = "PREPROCESSOR" ] && [ "$os" != "OSX" ]; then |
444 if [ "$endian" = "PREPROCESSOR" ] && [ "$os" != "OSX" ]; then |
445 echo "configure: error: invalid option --endian=$endian" |
445 log 1 "configure: error: invalid option --endian=$endian" |
446 echo " PREPROCESSOR is only available for OSX" |
446 log 1 " 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, DOS, 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|DOS|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 log 1 "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|DOS|WINCE|PSP]" |
452 log 1 " 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 log 1 "configure: error: invalid option --cpu-type=$cpu_type" |
458 echo " Available options are: --cpu-type[=DETECT|32|64]" |
458 log 1 " Available options are: --cpu-type[=DETECT|32|64]" |
459 exit 1 |
459 exit 1 |
460 fi |
460 fi |
461 # enable_debug should be between 0 and 4 |
461 # enable_debug should be between 0 and 4 |
462 if [ -z "`echo $enable_debug | egrep '^[0123]$'`" ]; then |
462 if [ -z "`echo $enable_debug | egrep '^[0123]$'`" ]; then |
463 echo "configure: error: invalid option --enable-debug=$enable_debug" |
463 log 1 "configure: error: invalid option --enable-debug=$enable_debug" |
464 echo " Available options are: --enable-debug[=0123]" |
464 log 1 " Available options are: --enable-debug[=0123]" |
465 exit 1 |
465 exit 1 |
466 fi |
466 fi |
467 |
467 |
468 # enable_desync_debug should be between 0 and 3 |
468 # enable_desync_debug should be between 0 and 3 |
469 if [ -z "`echo $enable_desync_debug | egrep '^[012]$'`" ]; then |
469 if [ -z "`echo $enable_desync_debug | egrep '^[012]$'`" ]; then |
470 echo "configure: error: invalid option --enable-desync-debug=$enable_desync_debug" |
470 log 1 "configure: error: invalid option --enable-desync-debug=$enable_desync_debug" |
471 echo " Available options are: --enable-desync-debug[=012]" |
471 log 1 " Available options are: --enable-desync-debug[=012]" |
472 exit 1 |
472 exit 1 |
473 fi |
473 fi |
474 |
474 |
475 detect_awk |
475 detect_awk |
476 |
476 |
1557 } |
1557 } |
1558 |
1558 |
1559 check_strip() { |
1559 check_strip() { |
1560 if [ "$os" = "OS2" ]; then |
1560 if [ "$os" = "OS2" ]; then |
1561 # OS2 via gcc is a bit weird.. stripping HAS to be done via emxbind, which is via gcc directly |
1561 # OS2 via gcc is a bit weird.. stripping HAS to be done via emxbind, which is via gcc directly |
1562 echo "checking host strip... using gcc -s option" |
1562 log 1 "checking host strip... using gcc -s option" |
1563 elif [ "$os" = "OSX" ]; then |
1563 elif [ "$os" = "OSX" ]; then |
1564 # Most targets have -V in strip, to see if they exists... OSX doesn't.. so execute something |
1564 # Most targets have -V in strip, to see if they exists... OSX doesn't.. so execute something |
1565 echo "int main(int argc, char *argv[]) { }" > strip.test.c |
1565 echo "int main(int argc, char *argv[]) { }" > strip.test.c |
1566 $cc_host strip.test.c -o strip.test |
1566 $cc_host strip.test.c -o strip.test |
1567 check_compiler "host strip" "strip" "$host" "$strip" "$STRIP" "strip" "strip" "3" "strip.test" |
1567 check_compiler "host strip" "strip" "$host" "$strip" "$STRIP" "strip" "strip" "3" "strip.test" |
2616 MENU_REPLACE=" |
2616 MENU_REPLACE=" |
2617 s~!!TTD!!~$TTD~g; |
2617 s~!!TTD!!~$TTD~g; |
2618 s~!!MENU_GROUP!!~$menu_group~g; |
2618 s~!!MENU_GROUP!!~$menu_group~g; |
2619 s~!!MENU_NAME!!~$menu_name~g |
2619 s~!!MENU_NAME!!~$menu_name~g |
2620 " |
2620 " |
2621 echo "Generating menu item..." |
2621 log 1 "Generating menu item..." |
2622 mkdir -p media |
2622 mkdir -p media |
2623 < $ROOT_DIR/media/openttd.desktop.in sed "$MENU_REPLACE" > media/openttd.desktop |
2623 < $ROOT_DIR/media/openttd.desktop.in sed "$MENU_REPLACE" > media/openttd.desktop |
2624 } |
2624 } |
2625 |
2625 |
2626 generate_main() { |
2626 generate_main() { |
2627 STAGE="[MAIN]" |
2627 STAGE="[MAIN]" |
2628 |
2628 |
2629 make_sed |
2629 make_sed |
2630 |
2630 |
2631 # Create the main Makefile |
2631 # Create the main Makefile |
2632 echo "Generating Makefile..." |
2632 log 1 "Generating Makefile..." |
2633 echo "# Auto-generated file from 'Makefile.in' -- DO NOT EDIT" > Makefile |
2633 echo "# Auto-generated file from 'Makefile.in' -- DO NOT EDIT" > Makefile |
2634 < $ROOT_DIR/Makefile.in sed "$SRC_REPLACE" >> Makefile |
2634 < $ROOT_DIR/Makefile.in sed "$SRC_REPLACE" >> Makefile |
2635 cp $ROOT_DIR/Makefile.bundle.in Makefile.bundle |
2635 cp $ROOT_DIR/Makefile.bundle.in Makefile.bundle |
2636 echo "# Auto-generated file -- DO NOT EDIT" > Makefile.am |
2636 echo "# Auto-generated file -- DO NOT EDIT" > Makefile.am |
2637 echo >> Makefile.am |
2637 echo >> Makefile.am |
2654 make_sed |
2654 make_sed |
2655 |
2655 |
2656 # Create the language file |
2656 # Create the language file |
2657 mkdir -p $LANG_OBJS_DIR |
2657 mkdir -p $LANG_OBJS_DIR |
2658 |
2658 |
2659 echo "Generating lang/Makefile..." |
2659 log 1 "Generating lang/Makefile..." |
2660 echo "# Auto-generated file from 'Makefile.lang.in' -- DO NOT EDIT" > $LANG_OBJS_DIR/Makefile |
2660 echo "# Auto-generated file from 'Makefile.lang.in' -- DO NOT EDIT" > $LANG_OBJS_DIR/Makefile |
2661 < $ROOT_DIR/Makefile.lang.in sed "$SRC_REPLACE" >> $LANG_OBJS_DIR/Makefile |
2661 < $ROOT_DIR/Makefile.lang.in sed "$SRC_REPLACE" >> $LANG_OBJS_DIR/Makefile |
2662 echo "DIRS += $LANG_OBJS_DIR" >> Makefile.am |
2662 echo "DIRS += $LANG_OBJS_DIR" >> Makefile.am |
2663 echo "LANG_DIRS += $LANG_OBJS_DIR" >> Makefile.am |
2663 echo "LANG_DIRS += $LANG_OBJS_DIR" >> Makefile.am |
2664 } |
2664 } |
2669 make_sed |
2669 make_sed |
2670 |
2670 |
2671 # Create the source file |
2671 # Create the source file |
2672 mkdir -p $SRC_OBJS_DIR |
2672 mkdir -p $SRC_OBJS_DIR |
2673 |
2673 |
2674 echo "Generating $2/Makefile..." |
2674 log 1 "Generating $2/Makefile..." |
2675 echo "# Auto-generated file from 'Makefile.src.in' -- DO NOT EDIT" > $SRC_OBJS_DIR/Makefile |
2675 echo "# Auto-generated file from 'Makefile.src.in' -- DO NOT EDIT" > $SRC_OBJS_DIR/Makefile |
2676 < $ROOT_DIR/Makefile.src.in sed "$SRC_REPLACE" >> $SRC_OBJS_DIR/Makefile |
2676 < $ROOT_DIR/Makefile.src.in sed "$SRC_REPLACE" >> $SRC_OBJS_DIR/Makefile |
2677 echo "DIRS += $SRC_OBJS_DIR" >> Makefile.am |
2677 echo "DIRS += $SRC_OBJS_DIR" >> Makefile.am |
2678 echo "SRC_DIRS += $SRC_OBJS_DIR" >> Makefile.am |
2678 echo "SRC_DIRS += $SRC_OBJS_DIR" >> Makefile.am |
2679 } |
2679 } |