The unix build script should now be able to detect SDL on Darwin (bug #358)

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@1387 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
meep-eep
2004-06-16 23:22:19 +00:00
parent 8aa026c23b
commit a8ef5a61c8
4 changed files with 58 additions and 12 deletions
+1
View File
@@ -1,4 +1,5 @@
Changes towards version 0.4: Changes towards version 0.4:
- The unix build script is now able to detect SDL on Darwin (bug #358) - SvdB
- Resource units given more obviously when ordering a probe to - Resource units given more obviously when ordering a probe to
self-destruct (bug #586), from Nic. self-destruct (bug #586), from Nic.
- Shipyard "Combat Energy" changed to reflect the recharge rate (bug #522). - Shipyard "Combat Energy" changed to reflect the recharge rate (bug #522).
+7 -1
View File
@@ -124,6 +124,9 @@ Information about programs used should be supplied in the following form:
A command to be executed which should return 0 if the program is present A command to be executed which should return 0 if the program is present
on the system, or 1 otherwise. If not supplied, 'type' is on the system, or 1 otherwise. If not supplied, 'type' is
used to check for the program in the path. used to check for the program in the path.
This command may include a shell command that modifies any of the
variables PROG_${PROGRAM}_FILE, PROG_${PROGRAM}_ACTION, or
PROG_${PROGRAM}_VERSION.
- PROG_${PROGRAM}_VERSION (optional) - PROG_${PROGRAM}_VERSION (optional)
A string that evaluates to the version of the executable that is A string that evaluates to the version of the executable that is
present, if it is present. present, if it is present.
@@ -150,10 +153,13 @@ Information about libraries used should be supplied in the following form:
on the system, or 1 otherwise. If not supplied, an attempt is on the system, or 1 otherwise. If not supplied, an attempt is
made to compile and link an empty C program with the flags as in made to compile and link an empty C program with the flags as in
LIB_${LIB}_CFLAGS and LIB_${LIB}_LDFLAGS. LIB_${LIB}_CFLAGS and LIB_${LIB}_LDFLAGS.
This command may include a shell command that modifies any of the
variables PROG_${LIB}_FILE, PROG_${LIB}_ACTION, or
PROG_${LIB}_VERSION.
- LIB_${LIB}_VERSION (optional) - LIB_${LIB}_VERSION (optional)
A string that evaluates to the version of the library that is A string that evaluates to the version of the library that is
present, if it is present. present, if it is present.
- LIB_${PROGRAM}_PRESENT (set by the configuration program) - LIB_${LIB}_PRESENT (set by the configuration program)
0 if the library has been verified to be present 0 if the library has been verified to be present
1 if the library has been verified to be not present 1 if the library has been verified to be not present
<empty> if the library hasn't been verified to be present <empty> if the library hasn't been verified to be present
+30 -9
View File
@@ -107,14 +107,27 @@ lexlt() {
# Description: check if a program is present in the path # Description: check if a program is present in the path
# Arguments: # Arguments:
have_program() { have_program() {
local TEMP_NAME TEMP_FILE TEMP_VERSION local PROG TEMP_NAME TEMP_FILE TEMP_VERSION TEMP_DETECT
eval eval TEMP_NAME="\\\"\$PROG_${1}_NAME\\\"" PROG="$1"
eval eval TEMP_NAME="\\\"\$PROG_${PROG}_NAME\\\""
if [ -z "$TEMP_NAME" ]; then if [ -z "$TEMP_NAME" ]; then
echo "Fatal: Program '$1' is not defined!" >&2 echo "Fatal: Program '$PROG' is not defined!" >&2
exit 1 exit 1
fi fi
eval eval TEMP_FILE="\\\"\$PROG_${1}_FILE\\\""
eval eval TEMP_DETECT="\\\"\$PROG_${PROG}_DETECT\\\""
if [ -n "$TEMP_DETECT" ]; then
$TEMP_DETECT
# NB. TEMP_DETECT should make sure PROG_${PROG}_VERSION and
# PROG_${PROG}_FILE are set.
if [ $? -ne 0 ]; then
build_message "$TEMP_NAME not found."
return 1
fi
fi
eval eval TEMP_FILE="\\\"\$PROG_${PROG}_FILE\\\""
type "$TEMP_FILE" 2>&1 > /dev/null type "$TEMP_FILE" 2>&1 > /dev/null
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
@@ -124,7 +137,7 @@ have_program() {
if [ $# -gt 1 ]; then if [ $# -gt 1 ]; then
# Minimum version supplied # Minimum version supplied
eval eval TEMP_VERSION="\\\"\$PROG_${1}_VERSION\\\"" eval eval TEMP_VERSION="\\\"\$PROG_${PROG}_VERSION\\\""
if [ -z "$TEMP_VERSION" ]; then if [ -z "$TEMP_VERSION" ]; then
echo "Fatal: Could not determine version of $TEMP_NAME" >&2 echo "Fatal: Could not determine version of $TEMP_NAME" >&2
exit 1 exit 1
@@ -152,7 +165,7 @@ but version $2 is required!"
# 1 - if the library is not found # 1 - if the library is not found
have_library() { have_library() {
local LIB TEMP_NAME TEMP_PRESENT TEMP_LDFLAGS TEMP_CFLAGS \ local LIB TEMP_NAME TEMP_PRESENT TEMP_LDFLAGS TEMP_CFLAGS \
TEMP_VERSION TEMP_VERSION TEMP_DETECT
LIB="$1" LIB="$1"
eval eval TEMP_NAME="\\\"\$LIB_${1}_NAME\\\"" eval eval TEMP_NAME="\\\"\$LIB_${1}_NAME\\\""
@@ -166,16 +179,24 @@ have_library() {
return "$TEMP_PRESENT" return "$TEMP_PRESENT"
fi fi
eval eval TEMP_LDFLAGS="\\\"\$LIB_${LIB}_LDFLAGS\\\"" eval eval TEMP_DETECT="\\\"\$LIB_${LIB}_DETECT\\\""
eval eval TEMP_CFLAGS="\\\"\$LIB_${LIB}_CFLAGS\\\"" if [ -n "$TEMP_DETECT" ]; then
$TEMP_DETECT
# NB. TEMP_DETECT should make sure PROG_$LIB_VERSION is set.
# return value of $TEMP_DETECT is used below.
else
eval eval TEMP_LDFLAGS="\\\"\$LIB_${LIB}_LDFLAGS\\\""
eval eval TEMP_CFLAGS="\\\"\$LIB_${LIB}_CFLAGS\\\""
try_compile_c "$TEMP_CFLAGS" "$TEMP_LDFLAGS" << EOF try_compile_c "$TEMP_CFLAGS" "$TEMP_LDFLAGS" << EOF
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
(void) argc; /* Get rid of unused variable warning */ (void) argc; /* Get rid of unused variable warning */
(void) argv; /* Get rid of unused variable warning */ (void) argv; /* Get rid of unused variable warning */
return 0; return 0;
} }
EOF EOF
fi # TEMP_DETECT not defined
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
eval "LIB_${LIB}_PRESENT"=1 eval "LIB_${LIB}_PRESENT"=1
build_message "$TEMP_NAME not found." build_message "$TEMP_NAME not found."
+18
View File
@@ -76,6 +76,24 @@ case "$OSNAME" in
FreeBSD) LIB_SDL_VERSION='$(sdl11-config --version)' ;; FreeBSD) LIB_SDL_VERSION='$(sdl11-config --version)' ;;
*) LIB_SDL_VERSION='$(sdl-config --version)' ;; *) LIB_SDL_VERSION='$(sdl-config --version)' ;;
esac esac
case "$OSNAME" in
Darwin)
LIB_SDL_DETECT="Darwin_SDL_detect"
Darwin_SDL_detect() {
eval TEMP_LDFLAGS="\"$LIB_SDL_LDFLAGS\""
eval TEMP_CFLAGS="\"$LIB_SDL_CFLAGS\""
try_compile_c "$TEMP_CFLAGS" "$TEMP_LDFLAGS" << EOF
#include "SDL.h"
int main(int argc, char *argv[]) {
(void) argc; /* Get rid of unused variable warning */
(void) argv; /* Get rid of unused variable warning */
return 0;
}
EOF
return $?
}
;;
esac
LIB_SDL_mixer_NAME="SDL_mixer" LIB_SDL_mixer_NAME="SDL_mixer"
LIB_SDL_mixer_CFLAGS="$LIB_SDL_CFLAGS" LIB_SDL_mixer_CFLAGS="$LIB_SDL_CFLAGS"