version 1.3, 2015/04/20 18:10:08
|
version 1.4, 2015/04/20 18:19:49
|
|
|
| |
##============================================================================== | ##============================================================================== |
## | ## |
|
## Extract the --target=TARGET option up front (leave other options in |
|
## localopts). |
|
## |
|
##============================================================================== |
|
|
|
localopts= |
|
|
|
for opt in $opts |
|
do |
|
arg=`expr "x$opt" : 'x[^=]*=\(.*\)'` |
|
case $opt in |
|
--target=*) |
|
target=$arg |
|
;; |
|
*) |
|
if [ -z "$localopts" ]; then |
|
localopts="$opt" |
|
else |
|
localopts="$localopts $opt" |
|
fi |
|
;; |
|
esac |
|
done |
|
|
|
opts=$localopts |
|
|
|
##============================================================================== |
|
## |
## Print the help message | ## Print the help message |
## | ## |
##============================================================================== | ##============================================================================== |
|
|
Print command name of C compiler. | Print command name of C compiler. |
cxx | cxx |
Print command name of C++ compiler. | Print command name of C++ compiler. |
cflags [--debug --pic --errwarn] |
ar |
|
Print command name of archive command. |
|
cflags [--debug --pic --errwarn --pal] |
Print C compiler flags. | Print C compiler flags. |
cxxflags [--debug --pic --errwarn] | cxxflags [--debug --pic --errwarn] |
Print C++ compiler flags. | Print C++ compiler flags. |
cshlibflags [--libpath=PATH] |
cshlibflags [--libpath=PATH --pal] |
Print compiler flags used to create a C shared library. | Print compiler flags used to create a C shared library. |
cxxshlibflags [--libpath=PATH] | cxxshlibflags [--libpath=PATH] |
Print compiler flags used to create a C++ shared library. | Print compiler flags used to create a C++ shared library. |
|
|
Print the shared library name of the given basename. | Print the shared library name of the given basename. |
shlibext | shlibext |
Print the shared library extension (e.g., 'so'). | Print the shared library extension (e.g., 'so'). |
|
openssllibdir |
|
Print the directory containing the OpenSSL library |
|
ldlibrarypath |
|
Print the name of the dynamic library path variable, usually LD_LIBRARY_PATH or SHLIB_PATH |
EOF | EOF |
exit 0 | exit 0 |
fi | fi |
|
|
## | ## |
##============================================================================== | ##============================================================================== |
| |
if [ -z "$CONFIG_TARGET" ]; then |
if [ -z "$target" ]; then |
| |
__m=`uname -m 2>/dev/null` || __m=unknown | __m=`uname -m 2>/dev/null` || __m=unknown |
__s=`uname -s 2>/dev/null` || __s=unknown | __s=`uname -s 2>/dev/null` || __s=unknown |
|
|
esac | esac |
platform=$os"_"$arch"_"$compiler | platform=$os"_"$arch"_"$compiler |
else | else |
platform=$CONFIG_TARGET |
platform=$target |
fi | fi |
| |
case "$platform" in | case "$platform" in |
|
|
;; | ;; |
MONTAVISTA_IX86_GNU) | MONTAVISTA_IX86_GNU) |
;; | ;; |
|
NETBSD_IX86_GNU) |
|
;; |
SUNOS_I86PC_SUNPRO|SUNOS_SPARC_SUNPRO) | SUNOS_I86PC_SUNPRO|SUNOS_SPARC_SUNPRO) |
;; | ;; |
AIX_PPC_IBM) | AIX_PPC_IBM) |
|
|
exit 1 | exit 1 |
fi | fi |
| |
|
case "$platform" in |
|
MONTAVISTA*) |
|
os=LINUX |
|
;; |
|
NETBSD*) |
|
os=BSD |
|
;; |
|
esac |
|
|
echo $os | echo $os |
exit | exit |
fi | fi |
|
|
MONTAVISTA*) | MONTAVISTA*) |
hostname | hostname |
;; | ;; |
|
NETBSD*) |
|
hostname |
|
;; |
DARWIN*) | DARWIN*) |
hostname | hostname |
;; | ;; |
|
|
exit 1 | exit 1 |
fi | fi |
| |
|
case "$platform" in |
|
MONTAVISTA*) |
|
arch=IX86 |
|
;; |
|
NETBSD*) |
|
arch=IX86 |
|
;; |
|
esac |
|
|
echo $arch | echo $arch |
exit | exit |
fi | fi |
|
|
exit 1 | exit 1 |
fi | fi |
| |
|
case "$platform" in |
|
MONTAVISTA*) |
|
compiler=GNU |
|
;; |
|
NETBSD*) |
|
compiler=GNU |
|
;; |
|
esac |
|
|
echo $compiler | echo $compiler |
exit | exit |
fi | fi |
|
|
MONTAVISTA_IX86_GNU) | MONTAVISTA_IX86_GNU) |
echo 586-gcc | echo 586-gcc |
;; | ;; |
|
NETBSD_IX86_GNU) |
|
echo netbsd-gcc |
|
;; |
SUNOS_I86PC_SUNPRO|SUNOS_SPARC_SUNPRO) | SUNOS_I86PC_SUNPRO|SUNOS_SPARC_SUNPRO) |
echo cc | echo cc |
;; | ;; |
|
|
MONTAVISTA_IX86_GNU) | MONTAVISTA_IX86_GNU) |
echo 586-g++ | echo 586-g++ |
;; | ;; |
|
NETBSD_IX86_GNU) |
|
echo netbsd-g++ |
|
;; |
SUNOS_I86PC_SUNPRO|SUNOS_SPARC_SUNPRO) | SUNOS_I86PC_SUNPRO|SUNOS_SPARC_SUNPRO) |
echo CC | echo CC |
;; | ;; |
|
|
| |
##============================================================================== | ##============================================================================== |
## | ## |
|
## ar command: |
|
## |
|
##============================================================================== |
|
|
|
if [ "$arg1" = "ar" ]; then |
|
|
|
if [ "$argc" != "1" -o "$opts" != "" ]; then |
|
echo "Usage: $0 $arg1" |
|
echo |
|
exit 1 |
|
fi |
|
|
|
case "$platform" in |
|
|
|
MONTAVISTA_IX86_GNU) |
|
echo 586-ar |
|
;; |
|
NETBSD_IX86_GNU) |
|
echo netbsd-ar |
|
;; |
|
*) |
|
echo ar |
|
;; |
|
esac |
|
|
|
exit |
|
fi |
|
|
|
##============================================================================== |
|
## |
## 'cflags' command: | ## 'cflags' command: |
## 'cxxflags' command: | ## 'cxxflags' command: |
## | ## |
|
|
--errwarn) | --errwarn) |
errwarn_opt=1 | errwarn_opt=1 |
;; | ;; |
|
--size) |
|
size_opt=1 |
|
;; |
|
--pal) |
|
pal_opt=1 |
|
;; |
*) | *) |
echo "$arg1: unknown option: $opt" | echo "$arg1: unknown option: $opt" |
exit 1 | exit 1 |
|
|
r="" | r="" |
| |
case "$platform" in | case "$platform" in |
LINUX_IX86_GNU|LINUX_X86_64_GNU|MONTAVISTA_IX86_GNU) |
LINUX_IX86_GNU|LINUX_X86_64_GNU|MONTAVISTA_IX86_GNU|NETBSD_IX86_GNU) |
test -n "$debug_opt" && r="$r -g" |
|
test -z "$debug_opt" && r="$r -g -O2" |
if test -n "$debug_opt"; then |
|
r="$r -g" |
|
else |
|
if test -n "$size_opt"; then |
|
r="$r -Os" |
|
else |
|
r="$r -g -O2" |
|
fi |
|
fi |
|
|
test -n "$pic_opt" && r="$r -fPIC" | test -n "$pic_opt" && r="$r -fPIC" |
test -n "$errwarn_opt" && r="$r -Werror" | test -n "$errwarn_opt" && r="$r -Werror" |
r="$r -Wall" | r="$r -Wall" |
r="$r -fvisibility=hidden" | r="$r -fvisibility=hidden" |
|
r="$r -fno-strict-aliasing" |
|
r="$r -D_GNU_SOURCE" |
|
r="$r -D_XOPEN_SOURCE=600" |
|
r="$r -D_BSD_SOURCE" |
|
|
#test -n "$cxx_opt" && r="$r -fno-exceptions" | #test -n "$cxx_opt" && r="$r -fno-exceptions" |
#test -n "$cxx_opt" && r="$r -fno-enforce-eh-specs" | #test -n "$cxx_opt" && r="$r -fno-enforce-eh-specs" |
#test -n "$cxx_opt" && r="$r -fno-rtti" | #test -n "$cxx_opt" && r="$r -fno-rtti" |
|
|
r="$r -xarch=generic" | r="$r -xarch=generic" |
| |
## hide all library symbols by default. | ## hide all library symbols by default. |
r="$r -xldscope=hidden" |
test -z "$pal_opt" && r="$r -xldscope=hidden" |
|
test -n "$pal_opt" && r="$r -xldscope=symbolic" |
| |
## display brief message tag for each warning message. | ## display brief message tag for each warning message. |
r="$r -errtags=yes" | r="$r -errtags=yes" |
|
|
## use standar pthread funciton declarations | ## use standar pthread funciton declarations |
r="$r -D_POSIX_PTHREAD_SEMANTICS" | r="$r -D_POSIX_PTHREAD_SEMANTICS" |
| |
|
r="$r -D_XOPEN_SOURCE=500" |
|
|
|
r="$r -D__EXTENSIONS__" |
|
|
## suppress all warning messages. | ## suppress all warning messages. |
#r="$r -erroff=%all" | #r="$r -erroff=%all" |
| |
|
|
r="$r -Dhpux" | r="$r -Dhpux" |
r="$r +W4232" | r="$r +W4232" |
r="$r +W4275" | r="$r +W4275" |
r="$r -D_XOPEN_SOURCE=600" |
r="$r -D_XOPEN_SOURCE=500" |
r="$r -D__STDC_EXT__" | r="$r -D__STDC_EXT__" |
;; | ;; |
HPUX_PARISC_HP) | HPUX_PARISC_HP) |
|
|
r="$r +Z" | r="$r +Z" |
r="$r +DAportable" | r="$r +DAportable" |
r="$r -mt" | r="$r -mt" |
|
r="$r -Dhpux" |
r="$r -D_PSTAT64" | r="$r -D_PSTAT64" |
r="$r +W749" | r="$r +W749" |
r="$r +W740" | r="$r +W740" |
r="$r -Wl,+s" | r="$r -Wl,+s" |
|
r="$r -D_INCLUDE__STDC_A1_SOURCE" |
r="$r -D__STDC_EXT__" | r="$r -D__STDC_EXT__" |
r="$r -D_XOPEN_SOURCE_EXTENDED" | r="$r -D_XOPEN_SOURCE_EXTENDED" |
;; | ;; |
|
|
--libpath=*) | --libpath=*) |
libpath_opt=$arg | libpath_opt=$arg |
;; | ;; |
|
--pal) |
|
palshlib_opt=1 |
|
;; |
*) | *) |
echo "$arg1: unknown option: $opt" | echo "$arg1: unknown option: $opt" |
exit 1 | exit 1 |
|
|
r="$r -shared" | r="$r -shared" |
test -n "$libpath_opt" && r="$r -Wl,-rpath=$libpath_opt" | test -n "$libpath_opt" && r="$r -Wl,-rpath=$libpath_opt" |
;; | ;; |
|
NETBSD_IX86_GNU) |
|
r="$r -shared" |
|
test -n "$libpath_opt" && r="$r -Wl,-rpath=$libpath_opt" |
|
;; |
SUNOS_I86PC_SUNPRO|SUNOS_SPARC_SUNPRO) | SUNOS_I86PC_SUNPRO|SUNOS_SPARC_SUNPRO) |
| |
## multi-threaded support. | ## multi-threaded support. |
|
|
r="$r -lrt" | r="$r -lrt" |
| |
## hide all library symbols by default. | ## hide all library symbols by default. |
r="$r -xldscope=hidden" |
test -z "$palshlib_opt" && r="$r -xldscope=hidden" |
|
test -n "$palshlib_opt" && r="$r -xldscope=symbolic" |
| |
## Add libpath_opt to the dynamic library path. | ## Add libpath_opt to the dynamic library path. |
test -n "$libpath_opt" && r="$r -R:$libpath_opt" | test -n "$libpath_opt" && r="$r -R:$libpath_opt" |
|
|
r="$r -D_XOPEN_SOURCE=600" | r="$r -D_XOPEN_SOURCE=600" |
r="$r -D__STDC_EXT__" | r="$r -D__STDC_EXT__" |
r="$r -lc" | r="$r -lc" |
|
r="$r -lrt" |
r="$r -b" | r="$r -b" |
|
r="$r -Wl,-Bsymbolic" |
test -n "$libpath_opt" && r="$r +b $libpath_opt" | test -n "$libpath_opt" && r="$r +b $libpath_opt" |
test -n "$cxx_opt" && r="$r -lunwind" | test -n "$cxx_opt" && r="$r -lunwind" |
test -n "$cxx_opt" && r="$r -lCsup" | test -n "$cxx_opt" && r="$r -lCsup" |
;; | ;; |
HPUX_PARISC_HP) | HPUX_PARISC_HP) |
r="$r -b" | r="$r -b" |
|
r="$r -lrt" |
r="$r -Wl,-Bsymbolic" | r="$r -Wl,-Bsymbolic" |
r="$r -Wl,+s" | r="$r -Wl,+s" |
;; | ;; |
|
|
MONTAVISTA_IX86_GNU) | MONTAVISTA_IX86_GNU) |
test -n "$libpath_opt" && r="$r -Wl,-rpath=$libpath_opt" | test -n "$libpath_opt" && r="$r -Wl,-rpath=$libpath_opt" |
;; | ;; |
|
NETBSD_IX86_GNU) |
|
test -n "$libpath_opt" && r="$r -Wl,-rpath=$libpath_opt" |
|
;; |
SUNOS_I86PC_SUNPRO|SUNOS_SPARC_SUNPRO) | SUNOS_I86PC_SUNPRO|SUNOS_SPARC_SUNPRO) |
| |
## multi-threaded support. | ## multi-threaded support. |
|
|
r="$r +W4275" | r="$r +W4275" |
r="$r -D_XOPEN_SOURCE=600" | r="$r -D_XOPEN_SOURCE=600" |
r="$r -D__STDC_EXT__" | r="$r -D__STDC_EXT__" |
|
r="$r -lrt" |
|
r="$r -Wl,-Bsymbolic" |
test -n "$libpath_opt" && r="$r +b $libpath_opt" | test -n "$libpath_opt" && r="$r +b $libpath_opt" |
;; | ;; |
HPUX_PARISC_HP) | HPUX_PARISC_HP) |
r="$r +Z" | r="$r +Z" |
r="$r +DAportable" | r="$r +DAportable" |
r="$r -mt" | r="$r -mt" |
|
r="$r -lrt" |
r="$r -D_PSTAT64" | r="$r -D_PSTAT64" |
;; | ;; |
DARWIN_IX86_GNU) | DARWIN_IX86_GNU) |
|
|
MONTAVISTA_IX86_GNU) | MONTAVISTA_IX86_GNU) |
r="586-gcc -M" | r="586-gcc -M" |
;; | ;; |
|
NETBSD_IX86_GNU) |
|
r="gcc -M" |
|
;; |
SUNOS_I86PC_SUNPRO|SUNOS_SPARC_SUNPRO) | SUNOS_I86PC_SUNPRO|SUNOS_SPARC_SUNPRO) |
r="CC -xM1" | r="CC -xM1" |
;; | ;; |
|
|
MONTAVISTA_IX86_GNU) | MONTAVISTA_IX86_GNU) |
r="-lpthread -ldl -lpam" | r="-lpthread -ldl -lpam" |
;; | ;; |
|
NETBSD_IX86_GNU) |
|
r="-lpthread -ldl -lpam" |
|
;; |
SUNOS_I86PC_SUNPRO|SUNOS_SPARC_SUNPRO) | SUNOS_I86PC_SUNPRO|SUNOS_SPARC_SUNPRO) |
r="-lpthread -lsocket -lnsl -ldl -lpam" | r="-lpthread -lsocket -lnsl -ldl -lpam" |
;; | ;; |
|
|
r="$r -Wl,-rpath=$path" | r="$r -Wl,-rpath=$path" |
done | done |
;; | ;; |
|
NETBSD_IX86_GNU) |
|
for path in $args |
|
do |
|
r="$r -Wl,-rpath=$path" |
|
done |
|
;; |
SUNOS_I86PC_SUNPRO|SUNOS_SPARC_SUNPRO) | SUNOS_I86PC_SUNPRO|SUNOS_SPARC_SUNPRO) |
for path in $args | for path in $args |
do | do |
|
|
;; | ;; |
MONTAVISTA_IX86_GNU) | MONTAVISTA_IX86_GNU) |
;; | ;; |
|
NETBSD_IX86_GNU) |
|
;; |
SUNOS_I86PC_SUNPRO|SUNOS_SPARC_SUNPRO) | SUNOS_I86PC_SUNPRO|SUNOS_SPARC_SUNPRO) |
;; | ;; |
AIX_PPC_IBM) | AIX_PPC_IBM) |
|
|
MONTAVISTA_IX86_GNU) | MONTAVISTA_IX86_GNU) |
echo "lib$arg2.so" | echo "lib$arg2.so" |
;; | ;; |
|
NETBSD_IX86_GNU) |
|
echo "lib$arg2.so" |
|
;; |
SUNOS_I86PC_SUNPRO|SUNOS_SPARC_SUNPRO) | SUNOS_I86PC_SUNPRO|SUNOS_SPARC_SUNPRO) |
echo "lib$arg2.so" | echo "lib$arg2.so" |
;; | ;; |
|
|
MONTAVISTA_IX86_GNU) | MONTAVISTA_IX86_GNU) |
echo "so" | echo "so" |
;; | ;; |
|
NETBSD_IX86_GNU) |
|
echo "so" |
|
;; |
SUNOS_I86PC_SUNPRO|SUNOS_SPARC_SUNPRO) | SUNOS_I86PC_SUNPRO|SUNOS_SPARC_SUNPRO) |
echo "so" | echo "so" |
;; | ;; |
|
|
libdir=/usr/lib | libdir=/usr/lib |
fi | fi |
;; | ;; |
MONTAVISTA_IX86_GNU) |
|
if [ -f "/usr/lib/libssl.so" ]; then |
|
libdir=/usr/lib |
|
fi |
|
;; |
|
SUNOS_I86PC_SUNPRO) | SUNOS_I86PC_SUNPRO) |
if [ -f "/usr/sfw/lib/libssl.so" ]; then | if [ -f "/usr/sfw/lib/libssl.so" ]; then |
libdir=/usr/sfw/lib | libdir=/usr/sfw/lib |
|
|
| |
##============================================================================== | ##============================================================================== |
## | ## |
|
## 'semnamelocalprefix' command (determine the prefix for a semaphore) |
|
## |
|
##============================================================================== |
|
|
|
if [ "$arg1" = "semnamelocalprefix" ]; then |
|
|
|
if [ "$argc" != "1" -o "$opts" != "" ]; then |
|
echo "Usage: $0 $arg1" |
|
echo |
|
exit 1 |
|
fi |
|
|
|
case "$platform" in |
|
HPUX_IA64_HP|HPUX_PARISC_HP) |
|
echo "/tmp/" |
|
;; |
|
*) |
|
echo "/" |
|
esac |
|
|
|
exit |
|
fi |
|
|
|
##============================================================================== |
|
## |
|
## 'shmnamelocalprefix' command (determine the prefix for a shmaphore) |
|
## |
|
##============================================================================== |
|
|
|
if [ "$arg1" = "shmnamelocalprefix" ]; then |
|
|
|
if [ "$argc" != "1" -o "$opts" != "" ]; then |
|
echo "Usage: $0 $arg1" |
|
echo |
|
exit 1 |
|
fi |
|
|
|
case "$platform" in |
|
HPUX_IA64_HP|HPUX_PARISC_HP) |
|
echo "/tmp/" |
|
;; |
|
*) |
|
echo "/" |
|
esac |
|
|
|
exit |
|
fi |
|
|
|
##============================================================================== |
|
## |
|
## 'semnameglobalprefix' command (determine the prefix for a semaphore) |
|
## |
|
##============================================================================== |
|
|
|
if [ "$arg1" = "semnameglobalprefix" ]; then |
|
|
|
if [ "$argc" != "1" -o "$opts" != "" ]; then |
|
echo "Usage: $0 $arg1" |
|
echo |
|
exit 1 |
|
fi |
|
|
|
case "$platform" in |
|
HPUX_IA64_HP|HPUX_PARISC_HP) |
|
echo "/tmp/" |
|
;; |
|
*) |
|
echo "/" |
|
esac |
|
|
|
exit |
|
fi |
|
|
|
##============================================================================== |
|
## |
|
## 'shmnameglobalprefix' command (determine the prefix for a shmaphore) |
|
## |
|
##============================================================================== |
|
|
|
if [ "$arg1" = "shmnameglobalprefix" ]; then |
|
|
|
if [ "$argc" != "1" -o "$opts" != "" ]; then |
|
echo "Usage: $0 $arg1" |
|
echo |
|
exit 1 |
|
fi |
|
|
|
case "$platform" in |
|
HPUX_IA64_HP|HPUX_PARISC_HP) |
|
echo "/tmp/" |
|
;; |
|
*) |
|
echo "/" |
|
esac |
|
|
|
exit |
|
fi |
|
|
|
##============================================================================== |
|
## |
|
## 'faultinjection' command |
|
## Whether fault injection is supported (1) or not (0) |
|
## |
|
##============================================================================== |
|
|
|
if [ "$arg1" = "faultinjection" ]; then |
|
|
|
if [ "$argc" != "1" -o "$opts" != "" ]; then |
|
echo "Usage: $0 $arg1" |
|
echo |
|
exit 1 |
|
fi |
|
|
|
case "$os" in |
|
LINUX) |
|
# supported! |
|
echo "1" |
|
;; |
|
*) |
|
# not-supported! |
|
echo "0" |
|
esac |
|
|
|
exit |
|
fi |
|
|
|
##============================================================================== |
|
## |
|
## 'vsnprintf' command |
|
## Whether vsnprintf return -1 on NULL buffer or not |
|
## |
|
##============================================================================== |
|
|
|
if [ "$arg1" = "vsnprintf" ]; then |
|
|
|
if [ "$argc" != "1" -o "$opts" != "" ]; then |
|
echo "Usage: $0 $arg1" |
|
echo |
|
exit 1 |
|
fi |
|
|
|
case "$platform" in |
|
HPUX_IA64_HP|HPUX_PARISC_HP|SUNOS_SPARC_SUNPRO) |
|
# vsnprintf returns -1 if buffer is NULL |
|
echo "1" |
|
;; |
|
*) |
|
# vsnprintf returns number of characters that would have been written |
|
# if buffer is big enough |
|
echo "0" |
|
esac |
|
|
|
exit |
|
fi |
|
|
|
##============================================================================== |
|
## |
## Unknown command: | ## Unknown command: |
## | ## |
##============================================================================== | ##============================================================================== |