Fix SDL detection.

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@1671 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
meep-eep
2005-04-23 23:23:16 +00:00
parent a9080b7a49
commit cad8f6f54d
17 changed files with 104 additions and 47 deletions
+6 -4
View File
@@ -122,7 +122,8 @@ Information about programs used should be supplied in the following form:
done configuring.
- PROG_${PROGRAM}_DETECT (optional)
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, 1 if it is not present, or 2 to fallback to the default
detection. If no detect function was set, or it returned 2, 'type' is
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
@@ -156,9 +157,10 @@ Information about libraries used should be supplied in the following form:
is used.
- PROG_${LIB}_DETECT (optional)
A command to be executed which should return 0 if the library is present
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
LIB_${LIB}_CFLAGS and LIB_${LIB}_LDFLAGS.
on the system, 1 if it is not present, or 2 to fallback to the default
detection. If no detect function was set, or it returned 2,
an attempt is made to compile and link an empty C program with
the flags as in LIB_${LIB}_CFLAGS and LIB_${LIB}_LDFLAGS.
This command may include a shell command that modifies any of the
variables PROG_${LIB}_CFLAGS, PROG_${LIB}_LDFLAGS, or
PROG_${LIB}_VERSION.
+48 -16
View File
@@ -194,17 +194,30 @@ have_program() {
$TEMP_DETECT
# NB. TEMP_DETECT should make sure PROG_${PROG}_VERSION and
# PROG_${PROG}_FILE are set.
if [ $? -ne 0 ]; then
eval "PROG_${PROG}_PRESENT"=1
build_message "$TEMP_NAME not found."
return 1
fi
case $? in
0) # Program found
eval "PROG_${PROG}_PRESENT"=0
;;
1) # Lib not found
eval "PROG_${PROG}_PRESENT"=1
;;
2) # Use default detection
;;
esac
fi
TEMP_FILE=`evalVar PROG_${PROG}_FILE`
type "${TEMP_FILE%% *}" > /dev/null 2>&1
if [ $? -ne 0 ]; then
eval TEMP_PRESENT="\$PROG_${PROG}_PRESENT"
if [ -z "$TEMP_PRESENT" ]; then
TEMP_FILE=`evalVar PROG_${PROG}_FILE`
type "${TEMP_FILE%% *}" > /dev/null 2>&1
if [ $? -eq 0 ]; then
# Program found
eval "PROG_${PROG}_PRESENT"=0
fi
fi
eval TEMP_PRESENT="\$PROG_${PROG}_PRESENT"
if [ -z "$TEMP_PRESENT" ]; then
eval "PROG_${PROG}_PRESENT"=1
build_message "$TEMP_NAME not found."
return 1
@@ -262,14 +275,27 @@ have_library() {
TEMP_DETECT=`evalVar LIB_${LIB}_DETECT`
if [ -n "$TEMP_DETECT" ]; then
$TEMP_DETECT
TEMP_DEPEND_PROG=`evalVar LIB_${LIB}_DEPEND_DETECT_PROG`
TEMP_DEPEND_LIB=`evalVar LIB_${LIB}_DEPEND_DETECT_LIB`
detect_dependencies_program "$TEMP_DEPEND_PROG"
detect_dependencies_library "$TEMP_DEPEND_LIB"
$TEMP_DETECT
# NB. TEMP_DETECT should make sure PROG_$LIB_VERSION is set.
# return value of $TEMP_DETECT is used below.
else
case $? in
0) # Lib found
eval "LIB_${LIB}_PRESENT"=0
;;
1) # Lib not found
eval "LIB_${LIB}_PRESENT"=1
;;
2) # Use default detection
;;
esac
fi
eval TEMP_PRESENT="\$LIB_${LIB}_PRESENT"
if [ -z "$TEMP_PRESENT" ]; then
TEMP_CFLAGS=`evalVar LIB_${LIB}_CFLAGS`
TEMP_LDFLAGS=`evalVar LIB_${LIB}_LDFLAGS`
@@ -280,9 +306,14 @@ int main(int argc, char *argv[]) {
return 0;
}
EOF
fi # TEMP_DETECT not defined
if [ $? -eq 0 ]; then
# Build successful
eval "LIB_${LIB}_PRESENT"=0
fi
fi
if [ $? -ne 0 ]; then
eval TEMP_PRESENT="\$LIB_${LIB}_PRESENT"
if [ -z "$TEMP_PRESENT" ]; then
eval "LIB_${LIB}_PRESENT"=1
build_message "$TEMP_NAME not found."
return 1
@@ -548,7 +579,7 @@ try_pkgconfig_prog() {
eval PROG_${PROG}_VERSION=\$TEMP_VERSION
return 0
else
return 1
return 2
fi
}
@@ -582,9 +613,10 @@ try_pkgconfig_lib() {
eval LIB_${LIB}_VERSION=\$TEMP_VERSION
eval LIB_${LIB}_CFLAGS=\$TEMP_CFLAGS
eval LIB_${LIB}_LDFLAGS=\$TEMP_LDFLAGS
return 0
return 2 # Force testing using the new CFLAGS and LDFLAGS
#return 0
else
return 1
return 2
fi
}
+7 -3
View File
@@ -132,7 +132,7 @@ case "$OSNAME" in
LIB_SDL_VERSION='$(sdl11-config --version)'
;;
Darwin)
LIB_SDL_CFLAGS='-I/System/Library/Frameworks/SDL.framework/Headers -I/Library/Frameworks/SDL.framework/Headers -I$HOME/Library/Frameworks/SDL.framework/Headers'
LIB_SDL_CFLAGS=''
LIB_SDL_LDFLAGS='-framework SDL -framework Cocoa -lobjc'
LIB_SDL_VERSION=$(echo \
"SDL_MAJOR_VERSION.SDL_MINOR_VERSION.SDL_PATCHLEVEL" | \
@@ -158,7 +158,7 @@ LIB_SDL_mixer_VERSION=""
LIB_SDL_image_NAME="SDL_image"
case "$OSNAME" in
Darwin)
LIB_SDL_image_CFLAGS='-I/System/Library/Frameworks/SDL_image.framework/Headers -I/Library/Frameworks/SDL_image.framework/Headers -I$HOME/Library/Frameworks/SDL_image.framework/Headers'
LIB_SDL_image_CFLAGS=''
LIB_SDL_image_LDFLAGS="-framework SDL_image"
;;
*)
@@ -176,9 +176,13 @@ case "$OSNAME" in
FreeBSD|OpenBSD)
LIB_openal_LDFLAGS="-L/usr/local/lib -pthread -lopenal"
;;
MINGW32*)
MINGW32*)
LIB_openal_LDFLAGS="-lopenal32"
;;
Darwin)
LIB_openal_CFLAGS=''
LIB_openal_LDFLAGS="-framework OpenAL"
;;
*)
LIB_openal_LDFLAGS="-lopenal"
;;