Added support to the unix build system for explicitely specifying the name of
the define to set to show when a symbol is found. Also a fix for when 'strcasecmp' is #define'd by the system. git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2881 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
+4
-1
@@ -1,4 +1,7 @@
|
|||||||
Changes towards version 0.7:
|
Changes towards version 0.7:
|
||||||
|
- Added support to the unix build system for explicitely specifying the name
|
||||||
|
of the define to set to show when a symbol is found.
|
||||||
|
Also a fix for when 'strcasecmp' is #define'd by the system. - SvdB
|
||||||
- Rewrote mapres.c to use uio's hashtables instead of its own
|
- Rewrote mapres.c to use uio's hashtables instead of its own
|
||||||
association lists - Michael
|
association lists - Michael
|
||||||
- Added a Remix option to the setup menu - Michael
|
- Added a Remix option to the setup menu - Michael
|
||||||
@@ -46,7 +49,7 @@ Changes towards version 0.7:
|
|||||||
- Fixed some Melnorme history info timestamps - Alex
|
- Fixed some Melnorme history info timestamps - Alex
|
||||||
- Fixed Ur-Quan story timestamps, from Vlad-Ceru Opran
|
- Fixed Ur-Quan story timestamps, from Vlad-Ceru Opran
|
||||||
- Removed the 256-frame limit on .ani files - Michael
|
- Removed the 256-frame limit on .ani files - Michael
|
||||||
- Renamed PlaySpeeh/StopSpeech to work around name collisions
|
- Renamed PlaySpeech/StopSpeech to work around name collisions
|
||||||
on OSX - Alex
|
on OSX - Alex
|
||||||
- Ending the battle with a simultaneous death no longer triggers an
|
- Ending the battle with a simultaneous death no longer triggers an
|
||||||
assertion - SvdB
|
assertion - SvdB
|
||||||
|
|||||||
@@ -32,12 +32,19 @@ uqm_requirements()
|
|||||||
|
|
||||||
|
|
||||||
# Add defines for HAVE_READDIR_R, HAVE_SETENV, HAVE_STRUPR,
|
# Add defines for HAVE_READDIR_R, HAVE_SETENV, HAVE_STRUPR,
|
||||||
# and HAVE_STRICMP
|
# HAVE_STRCASECMP, and HAVE_STRICMP
|
||||||
define_have_symbol readdir_r
|
define_have_symbol readdir_r
|
||||||
define_have_symbol setenv
|
define_have_symbol setenv
|
||||||
define_have_symbol strupr
|
define_have_symbol strupr
|
||||||
|
define_have_symbol strcasecmp
|
||||||
define_have_symbol stricmp
|
define_have_symbol stricmp
|
||||||
|
|
||||||
|
# Require either strcasecmp or stricmp.
|
||||||
|
if not have_symbol strcasecmp && not have_symbol stricmp; then
|
||||||
|
echo "Fatal: Your system defines neither strcasecmp() nor stricmp()."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# Add defines for HAVE_ISWGRAPH, HAVE_WCHAR_T, and HAVE_WINT_T
|
# Add defines for HAVE_ISWGRAPH, HAVE_WCHAR_T, and HAVE_WINT_T
|
||||||
define_have_symbol iswgraph
|
define_have_symbol iswgraph
|
||||||
define_have_type wchar_t
|
define_have_type wchar_t
|
||||||
@@ -191,13 +198,13 @@ uqm_prepare_config()
|
|||||||
OGGVORBIS=tremor
|
OGGVORBIS=tremor
|
||||||
use_library tremor
|
use_library tremor
|
||||||
}
|
}
|
||||||
CHOICE_ovcodec_DEFAULT=standard
|
|
||||||
CHOICE_ovcodec_OPTION_none_TITLE="No Ogg Vorbis support"
|
CHOICE_ovcodec_OPTION_none_TITLE="No Ogg Vorbis support"
|
||||||
CHOICE_ovcodec_OPTION_none_ACTION=ovcodec_none_action
|
CHOICE_ovcodec_OPTION_none_ACTION=ovcodec_none_action
|
||||||
ovcodec_none_action() {
|
ovcodec_none_action() {
|
||||||
CFLAGS="$CFLAGS -DOVCODEC_NONE"
|
CFLAGS="$CFLAGS -DOVCODEC_NONE"
|
||||||
OGGVORBIS=none
|
OGGVORBIS=none
|
||||||
}
|
}
|
||||||
|
CHOICE_ovcodec_DEFAULT=standard
|
||||||
|
|
||||||
CHOICE_mikmod_OPTIONS="internal external"
|
CHOICE_mikmod_OPTIONS="internal external"
|
||||||
CHOICE_mikmod_TITLE="Tracker music support"
|
CHOICE_mikmod_TITLE="Tracker music support"
|
||||||
|
|||||||
@@ -586,9 +586,14 @@ EOF
|
|||||||
# Description: check if a symbol is defined.
|
# Description: check if a symbol is defined.
|
||||||
# Arguments: $1 - the name of the symbol
|
# Arguments: $1 - the name of the symbol
|
||||||
have_symbol() {
|
have_symbol() {
|
||||||
local SYMBOL CODE
|
local SYMBOL TEMP_PRESENT CODE
|
||||||
SYMBOL="$1"
|
SYMBOL="$1"
|
||||||
|
|
||||||
|
TEMP_PRESENT=`getVar SYMBOL_${SYMBOL}_PRESENT`
|
||||||
|
if [ -n "$TEMP_PRESENT" ]; then
|
||||||
|
return "$TEMP_PRESENT"
|
||||||
|
fi
|
||||||
|
|
||||||
CODE=`cat << EOF
|
CODE=`cat << EOF
|
||||||
int main(void) {
|
int main(void) {
|
||||||
(void) $SYMBOL;
|
(void) $SYMBOL;
|
||||||
@@ -600,18 +605,25 @@ EOF
|
|||||||
have_symbol_generic "$SYMBOL" "$CODE"
|
have_symbol_generic "$SYMBOL" "$CODE"
|
||||||
if [ $? -gt 0 ]; then
|
if [ $? -gt 0 ]; then
|
||||||
build_message "Symbol '$SYMBOL' not found."
|
build_message "Symbol '$SYMBOL' not found."
|
||||||
|
eval "SYMBOL_${SYMBOL}_PRESENT"=1
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
build_message "Symbol '$SYMBOL' found."
|
build_message "Symbol '$SYMBOL' found."
|
||||||
|
eval "SYMBOL_${SYMBOL}_PRESENT"=0
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
# Description: check if a type is present.
|
# Description: check if a type is present.
|
||||||
# Arguments: $1 - the name of the symbol
|
# Arguments: $1 - the name of the symbol
|
||||||
have_type() {
|
have_type() {
|
||||||
local TYPE
|
local TYPE TEMP_PRESENT CODE
|
||||||
TYPE="$1"
|
TYPE="$1"
|
||||||
|
|
||||||
|
TEMP_PRESENT=`getVar TYPE_${TYPE}_PRESENT`
|
||||||
|
if [ -n "$TEMP_PRESENT" ]; then
|
||||||
|
return "$TEMP_PRESENT"
|
||||||
|
fi
|
||||||
|
|
||||||
CODE=`cat << EOF
|
CODE=`cat << EOF
|
||||||
int main(void) {
|
int main(void) {
|
||||||
$TYPE var;
|
$TYPE var;
|
||||||
@@ -619,14 +631,16 @@ int main(void) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
`
|
`
|
||||||
|
|
||||||
have_symbol_generic "$TYPE" "$CODE"
|
have_symbol_generic "$TYPE" "$CODE"
|
||||||
if [ $? -gt 0 ]; then
|
if [ $? -gt 0 ]; then
|
||||||
build_message "Type '$TYPE' not found."
|
build_message "Type '$TYPE' not found."
|
||||||
|
eval "TYPE_${TYPE}_PRESENT"=1
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
build_message "Type '$TYPE' found."
|
build_message "Type '$TYPE' found."
|
||||||
|
eval "TYPE_${TYPE}_PRESENT"=0
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -635,20 +649,26 @@ EOF
|
|||||||
# name of the symbol.
|
# name of the symbol.
|
||||||
# Arguments: $1 - the name of the symbol
|
# Arguments: $1 - the name of the symbol
|
||||||
define_have_symbol() {
|
define_have_symbol() {
|
||||||
local NAME VALUE
|
local NAME VALUE DEFNAME
|
||||||
|
|
||||||
|
DEFNAME=`getVar SYMBOL_${1}_DEFNAME`
|
||||||
|
if [ -z "$DEFNAME" ]; then
|
||||||
# Why not "tr [:lower:] [:upper:]"? Because the capital "i" is not
|
# Why not "tr [:lower:] [:upper:]"? Because the capital "i" is not
|
||||||
# "I" in Turkish... An alternative would be setting LC_CTYPE to POSIX.
|
# "I" in Turkish... An alternative would be setting LC_CTYPE to POSIX.
|
||||||
NAME=`$TR "abcdefghijklmnopqrstuvwxyz" "ABCDEFGHIJKLMNOPQRSTUVWXYZ" << EOF
|
NAME=`$TR "abcdefghijklmnopqrstuvwxyz" "ABCDEFGHIJKLMNOPQRSTUVWXYZ" \
|
||||||
|
<< EOF
|
||||||
$1
|
$1
|
||||||
EOF
|
EOF
|
||||||
`
|
`
|
||||||
|
DEFNAME="HAVE_$NAME"
|
||||||
|
fi
|
||||||
|
|
||||||
if have_symbol "$1"; then
|
if have_symbol "$1"; then
|
||||||
add_symbol "HAVE_$NAME" "#define HAVE_$NAME"
|
add_symbol "$DEFNAME" "#define $DEFNAME"
|
||||||
add_symbol "HAVE_${NAME}_FLAG" 1
|
add_symbol "${DEFNAME}_FLAG" 1
|
||||||
else
|
else
|
||||||
add_symbol "HAVE_$NAME" "#undef HAVE_$NAME"
|
add_symbol "$DEFNAME" "#undef $DEFNAME"
|
||||||
add_symbol "HAVE_${NAME}_FLAG" 0
|
add_symbol "${DEFNAME}_FLAG" 0
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -657,20 +677,26 @@ EOF
|
|||||||
# name of the symbol.
|
# name of the symbol.
|
||||||
# Arguments: $1 - the name of the symbol
|
# Arguments: $1 - the name of the symbol
|
||||||
define_have_type() {
|
define_have_type() {
|
||||||
local NAME VALUE
|
local NAME VALUE DEFNAME
|
||||||
|
|
||||||
|
DEFNAME=`getVar TYPE_${1}_DEFNAME`
|
||||||
|
if [ -z "$DEFNAME" ]; then
|
||||||
# Why not "tr [:lower:] [:upper:]"? Because the capital "i" is not
|
# Why not "tr [:lower:] [:upper:]"? Because the capital "i" is not
|
||||||
# "I" in Turkish... An alternative would be setting LC_CTYPE to POSIX.
|
# "I" in Turkish... An alternative would be setting LC_CTYPE to POSIX.
|
||||||
NAME=`$TR "abcdefghijklmnopqrstuvwxyz" "ABCDEFGHIJKLMNOPQRSTUVWXYZ" << EOF
|
NAME=`$TR "abcdefghijklmnopqrstuvwxyz" "ABCDEFGHIJKLMNOPQRSTUVWXYZ" \
|
||||||
|
<< EOF
|
||||||
$1
|
$1
|
||||||
EOF
|
EOF
|
||||||
`
|
`
|
||||||
|
DEFNAME="HAVE_$NAME"
|
||||||
|
fi
|
||||||
|
|
||||||
if have_type "$1"; then
|
if have_type "$1"; then
|
||||||
add_symbol "HAVE_$NAME" "#define HAVE_$NAME"
|
add_symbol "$DEFNAME" "#define $DEFNAME"
|
||||||
add_symbol "HAVE_${NAME}_FLAG" 1
|
add_symbol "${DEFNAME}_FLAG" 1
|
||||||
else
|
else
|
||||||
add_symbol "HAVE_$NAME" "#undef HAVE_$NAME"
|
add_symbol "$DEFNAME" "#undef $DEFNAME"
|
||||||
add_symbol "HAVE_${NAME}_FLAG" 0
|
add_symbol "${DEFNAME}_FLAG" 0
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -703,20 +729,26 @@ EOF
|
|||||||
# name of the header file. "sys/time.h" becomes "SYS_TIME_H".
|
# name of the header file. "sys/time.h" becomes "SYS_TIME_H".
|
||||||
# Arguments: $1 - the name of the header file
|
# Arguments: $1 - the name of the header file
|
||||||
define_have_header() {
|
define_have_header() {
|
||||||
local NAME VALUE
|
local NAME VALUE DEFNAME
|
||||||
|
|
||||||
|
DEFNAME=`getVar HEADER_${1%.h}_DEFNAME`
|
||||||
|
if [ -z "$DEFNAME" ]; then
|
||||||
# Why not "tr [:lower:] [:upper:]"? Because the capital "i" is not
|
# Why not "tr [:lower:] [:upper:]"? Because the capital "i" is not
|
||||||
# "I" in Turkish... An alternative would be setting LC_CTYPE to POSIX.
|
# "I" in Turkish... An alternative would be setting LC_CTYPE to POSIX.
|
||||||
NAME=`$TR "/.abcdefghijklmnopqrstuvwxyz" "__ABCDEFGHIJKLMNOPQRSTUVWXYZ" << EOF
|
NAME=`$TR "/.abcdefghijklmnopqrstuvwxyz" \
|
||||||
|
"__ABCDEFGHIJKLMNOPQRSTUVWXYZ" << EOF
|
||||||
$1
|
$1
|
||||||
EOF
|
EOF
|
||||||
`
|
`
|
||||||
|
DEFNAME="HAVE_$NAME"
|
||||||
|
fi
|
||||||
|
|
||||||
if have_header "$1"; then
|
if have_header "$1"; then
|
||||||
add_symbol "HAVE_$NAME" "#define HAVE_$NAME"
|
add_symbol "$DEFNAME" "#define $DEFNAME"
|
||||||
add_symbol "HAVE_${NAME}_FLAG" 1
|
add_symbol "${DEFNAME}_FLAG" 1
|
||||||
else
|
else
|
||||||
add_symbol "HAVE_$NAME" "#undef HAVE_$NAME"
|
add_symbol "$DEFNAME" "#undef $DEFNAME"
|
||||||
add_symbol "HAVE_${NAME}_FLAG" 0
|
add_symbol "${DEFNAME}_FLAG" 0
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -243,6 +243,10 @@ SYMBOL_readdir_r_EXTRA="#include <dirent.h>"
|
|||||||
|
|
||||||
SYMBOL_setenv_EXTRA="#include <stdlib.h>"
|
SYMBOL_setenv_EXTRA="#include <stdlib.h>"
|
||||||
|
|
||||||
|
SYMBOL_strcasecmp_EXTRA="#include <string.h>"
|
||||||
|
SYMBOL_strcasecmp_DEFNAME="HAVE_STRCASECMP_UQM"
|
||||||
|
# HAVE_STRCASECMP would conflict with SDL (SDL_config.h).
|
||||||
|
|
||||||
SYMBOL_stricmp_EXTRA="#include <string.h>"
|
SYMBOL_stricmp_EXTRA="#include <string.h>"
|
||||||
|
|
||||||
SYMBOL_strupr_EXTRA="#include <string.h>"
|
SYMBOL_strupr_EXTRA="#include <string.h>"
|
||||||
|
|||||||
@@ -37,6 +37,10 @@
|
|||||||
/* Defined if your system has strupr of its own */
|
/* Defined if your system has strupr of its own */
|
||||||
@HAVE_STRUPR@
|
@HAVE_STRUPR@
|
||||||
|
|
||||||
|
/* Defined if your system has strcasecmp of its own */
|
||||||
|
@HAVE_STRCASECMP_UQM@
|
||||||
|
// Not using "HAVE_STRCASECMP" as that conflicts with SDL.
|
||||||
|
|
||||||
/* Defined if your system has stricmp of its own */
|
/* Defined if your system has stricmp of its own */
|
||||||
@HAVE_STRICMP@
|
@HAVE_STRICMP@
|
||||||
|
|
||||||
|
|||||||
@@ -38,6 +38,10 @@
|
|||||||
/* Defined if your system has strupr of its own */
|
/* Defined if your system has strupr of its own */
|
||||||
@HAVE_STRUPR@
|
@HAVE_STRUPR@
|
||||||
|
|
||||||
|
/* Defined if your system has strcasecmp of its own */
|
||||||
|
@HAVE_STRCASECMP_UQM@
|
||||||
|
// Not using "HAVE_STRCASECMP" as that conflicts with SDL.
|
||||||
|
|
||||||
/* Defined if your system has stricmp of its own */
|
/* Defined if your system has stricmp of its own */
|
||||||
@HAVE_STRICMP@
|
@HAVE_STRICMP@
|
||||||
|
|
||||||
|
|||||||
@@ -38,6 +38,10 @@
|
|||||||
/* Defined if your system has strupr of its own */
|
/* Defined if your system has strupr of its own */
|
||||||
#define HAVE_STRUPR
|
#define HAVE_STRUPR
|
||||||
|
|
||||||
|
/* Defined if your system has strcasecmp of its own */
|
||||||
|
#undef HAVE_STRCASECMP_UQM
|
||||||
|
// Not using "HAVE_STRCASECMP" as that conflicts with SDL.
|
||||||
|
|
||||||
/* Defined if your system has stricmp of its own */
|
/* Defined if your system has stricmp of its own */
|
||||||
#define HAVE_STRICMP
|
#define HAVE_STRICMP
|
||||||
|
|
||||||
|
|||||||
+10
-2
@@ -45,12 +45,20 @@
|
|||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef HAVE_STRICMP
|
// Using "HAVE_STRCASECMP_UQM" instead of "HAVE_STRCASECMP" as the latter
|
||||||
|
// conflicts with SDL.
|
||||||
|
#if !defined(HAVE_STRICMP) && !defined(HAVE_STRCASECMP_UQM)
|
||||||
|
# error Neither stricmp() nor strcasecmp() is available.
|
||||||
|
#elif defined(HAVE_STRCASECMP_UQM)
|
||||||
# define stricmp strcasecmp
|
# define stricmp strcasecmp
|
||||||
#else
|
#elif defined(HAVE_STRICMP)
|
||||||
# define strcasecmp stricmp
|
# define strcasecmp stricmp
|
||||||
|
#else
|
||||||
|
// We should take care not to define anything if both strcasecmp() and
|
||||||
|
// stricmp() are defined, as one might exist as a macro to the other.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifndef HAVE_STRUPR
|
#ifndef HAVE_STRUPR
|
||||||
char *strupr (char *str);
|
char *strupr (char *str);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user