Some detection improvements to the build system.
Also checks added form iswgraph(), wchar_t, and int_t. git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@1566 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -39,6 +39,12 @@ uqm_requirements()
|
|||||||
define_have_symbol setenv
|
define_have_symbol setenv
|
||||||
define_have_symbol strupr
|
define_have_symbol strupr
|
||||||
define_have_symbol stricmp
|
define_have_symbol stricmp
|
||||||
|
|
||||||
|
# Add defines for HAVE_ISWGRAPH, HAVE_WCHAR_T, and HAVE_WINT_T
|
||||||
|
define_have_symbol iswgraph
|
||||||
|
define_have_type wchar_t
|
||||||
|
define_have_type wint_t
|
||||||
|
|
||||||
|
|
||||||
# Check for getopt.h
|
# Check for getopt.h
|
||||||
define_have_header getopt.h
|
define_have_header getopt.h
|
||||||
|
|||||||
@@ -292,25 +292,50 @@ use_library() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Description: check if a symbol is defined
|
||||||
|
# Arguments: $1 - the name of the symbol
|
||||||
|
# $2 - the C code that does the actual checking
|
||||||
|
have_symbol_generic() {
|
||||||
|
local CODE DETECT EXTRA
|
||||||
|
|
||||||
|
eval eval DETECT="\\\"\$SYMBOL_${1}_DETECT\\\""
|
||||||
|
if [ -n "$DETECT" ]; then
|
||||||
|
$DETECT
|
||||||
|
return $?
|
||||||
|
fi
|
||||||
|
|
||||||
|
eval eval EXTRA="\\\"\$SYMBOL_${1}_EXTRA\\\""
|
||||||
|
eval eval CODE="\\\"\$SYMBOL_${1}_CODE\\\""
|
||||||
|
if [ -z "$CODE" ]; then
|
||||||
|
CODE=$2
|
||||||
|
fi
|
||||||
|
|
||||||
|
try_compile_c "$TEMP_CFLAGS" "$TEMP_LDFLAGS" << EOF > /dev/null 2>&1
|
||||||
|
$EXTRA
|
||||||
|
$CODE
|
||||||
|
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
|
local SYMBOL CODE
|
||||||
SYMBOL="$1"
|
SYMBOL="$1"
|
||||||
|
|
||||||
# TODO: I'll want the include handling to be done differently
|
CODE=`cat << EOF
|
||||||
# eventually.
|
|
||||||
try_compile_c "$TEMP_CFLAGS" "$TEMP_LDFLAGS" << EOF > /dev/null 2>&1
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
int main() {
|
int main(void) {
|
||||||
(void) $SYMBOL;
|
(void) $SYMBOL;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
`
|
||||||
|
|
||||||
|
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."
|
||||||
return 1
|
return 1
|
||||||
@@ -319,6 +344,35 @@ EOF
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Description: check if a type is present.
|
||||||
|
# Arguments: $1 - the name of the symbol
|
||||||
|
have_type() {
|
||||||
|
local TYPE
|
||||||
|
TYPE="$1"
|
||||||
|
|
||||||
|
CODE=`cat << EOF
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <string.h>
|
||||||
|
int main(void) {
|
||||||
|
$TYPE var;
|
||||||
|
(void) var;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
`
|
||||||
|
|
||||||
|
have_symbol_generic "$TYPE" "$CODE"
|
||||||
|
if [ $? -gt 0 ]; then
|
||||||
|
build_message "Type '$TYPE' not found."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
build_message "Type '$TYPE' found."
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
# Description: check if a symbol is defined.
|
# Description: check if a symbol is defined.
|
||||||
# set HAVE_<NAME> accordingly, where <NAME> is the capitalized
|
# set HAVE_<NAME> accordingly, where <NAME> is the capitalized
|
||||||
# name of the symbol.
|
# name of the symbol.
|
||||||
@@ -336,6 +390,23 @@ EOF
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Description: check if a type is present.
|
||||||
|
# set HAVE_<NAME> accordingly, where <NAME> is the capitalized
|
||||||
|
# name of the symbol.
|
||||||
|
# Arguments: $1 - the name of the symbol
|
||||||
|
define_have_type() {
|
||||||
|
local NAME VALUE
|
||||||
|
NAME=`$TR "[:lower:]" "[:upper:]" << EOF
|
||||||
|
$1
|
||||||
|
EOF
|
||||||
|
`
|
||||||
|
if have_type "$1"; then
|
||||||
|
add_symbol "HAVE_$NAME" "#define HAVE_$NAME"
|
||||||
|
else
|
||||||
|
add_symbol "HAVE_$NAME" "#undef HAVE_$NAME"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Description: check if a header is available.
|
# Description: check if a header is available.
|
||||||
# Arguments: $1 - the name of the header file
|
# Arguments: $1 - the name of the header file
|
||||||
have_header() {
|
have_header() {
|
||||||
|
|||||||
@@ -249,3 +249,17 @@ LIB_zlib_DETECT="try_pkgconfig_lib zlib zlib"
|
|||||||
LIB_zlib_DEPEND_DETECT_BIN="pkgconfig"
|
LIB_zlib_DEPEND_DETECT_BIN="pkgconfig"
|
||||||
|
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
# Describe the symbols (possibly) used: #
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
SYMBOL_wchar_t_EXTRA="#include <stddef.h>
|
||||||
|
"
|
||||||
|
|
||||||
|
SYMBOL_wint_t_EXTRA="#include <wchar.h>
|
||||||
|
"
|
||||||
|
|
||||||
|
SYMBOL_iswgraph_EXTRA="#include <wctype.h>
|
||||||
|
"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
- Specify files to be removed on clean.
|
- Specify files to be removed on clean.
|
||||||
- static compilation
|
- static compilation
|
||||||
- generating tags files
|
- generating tags files
|
||||||
|
- grep is used for the gcc 3.4 compilation patch. It's slower now,
|
||||||
|
and presence for "grep" isn't even checked.
|
||||||
|
|
||||||
|
|
||||||
some docs
|
some docs
|
||||||
|
|||||||
@@ -38,6 +38,15 @@
|
|||||||
/* Defined if your system has getopt.h */
|
/* Defined if your system has getopt.h */
|
||||||
@HAVE_GETOPT_H@
|
@HAVE_GETOPT_H@
|
||||||
|
|
||||||
|
/* Defined if your system has iswgraph of its own*/
|
||||||
|
@HAVE_ISWGRAPH@
|
||||||
|
|
||||||
|
/* Defined if your system has wchar_t of its own */
|
||||||
|
@HAVE_WCHAR_T@
|
||||||
|
|
||||||
|
/* Defined if your system has wint_t of its own */
|
||||||
|
@HAVE_WINT_T@
|
||||||
|
|
||||||
#endif /* _CONFIG_UNIX_H */
|
#endif /* _CONFIG_UNIX_H */
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -39,5 +39,14 @@
|
|||||||
/* Defined if your system has getopt.h */
|
/* Defined if your system has getopt.h */
|
||||||
#undef HAVE_GETOPT_H
|
#undef HAVE_GETOPT_H
|
||||||
|
|
||||||
|
/* Defined if your system has iswgraph of its own*/
|
||||||
|
#define HAVE_ISWGRAPH
|
||||||
|
|
||||||
|
/* Defined if your system has wchar_t of its own */
|
||||||
|
#define HAVE_WCHAR_T
|
||||||
|
|
||||||
|
/* Defined if your system has wint_t of its own */
|
||||||
|
#define HAVE_WINT_T
|
||||||
|
|
||||||
#endif /* _CONFIG_H */
|
#endif /* _CONFIG_H */
|
||||||
|
|
||||||
|
|||||||
@@ -116,6 +116,25 @@ typedef unsigned short mode_t;
|
|||||||
int setenv (const char *name, const char *value, int overwrite);
|
int setenv (const char *name, const char *value, int overwrite);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef HAVE_WCHAR_T
|
||||||
|
typedef unsigned short wchar_t
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef HAVE_WINT_T
|
||||||
|
typedef unsigned int wint_t
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_ISWGRAPH
|
||||||
|
# include <wctype.h>
|
||||||
|
#else
|
||||||
|
# include <ctype.h>
|
||||||
|
static inline int
|
||||||
|
iswgraph(wint_t wc)
|
||||||
|
{
|
||||||
|
return wc > 0x7f || isgraph((int) wc);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* _PORT_H */
|
#endif /* _PORT_H */
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user