echo " --source-path=PATH path to source code [$source_path]"
echo " --cross-prefix=PREFIX use PREFIX for compilation tools [$cross_prefix]"
echo " --enable-cross-compile assume a cross-compiler is used"
+ echo " --sysroot=PATH root of cross-build tree"
+ echo " --sysinclude=PATH location of cross-build system headers"
echo " --target-os=OS compiler targets OS [$target_os]"
echo " --target-exec=CMD command to run executables on target"
echo " --target-path=DIR path to view of build directory on target"
set_weak no $*
}
+enable_safe(){
+ enable $(echo "$*" | sed 's/[^A-Za-z0-9_ ]/_/g')
+}
+
+disable_safe(){
+ disable $(echo "$*" | sed 's/[^A-Za-z0-9_ ]/_/g')
+}
+
do_enable_deep(){
for var; do
enabled $var && continue
log check_header "$@"
header=$1
shift
- var=`echo $header | sed 's/[^A-Za-z0-9_]/_/g'`
- disable $var
- check_cpp "$@" <<EOF && enable $var
+ disable_safe $header
+ check_cpp "$@" <<EOF && enable_safe $header
#include <$header>
int x;
EOF
incs="$incs
#include <$hdr>"
done
- check_ld "$@" <<EOF && enable $func
+ check_ld "$@" <<EOF && enable $func && enable_safe $headers
$incs
int main(int argc, char **argv){
(void) $func;
logfile
nm
source_path
+ sysinclude
+ sysroot
target_exec
target_os
target_path
ranlib="${cross_prefix}${ranlib}"
strip="${cross_prefix}${strip}"
-set_default cc nm
+sysinclude_default="${sysroot}/usr/include"
+
+set_default cc nm sysinclude
enabled cross_compile || host_cc_default=$cc
set_default host_cc
fi
rm $TMPSH
+if $cc --version 2>/dev/null | grep -qi gcc; then
+ cc_type=gcc
+elif $cc --version 2>/dev/null | grep -q Intel; then
+ cc_type=icc
+elif $cc -v 2>&1 | grep -q xlc; then
+ cc_type=xlc
+elif $cc -V 2>/dev/null | grep -q Compaq; then
+ cc_type=ccc
+ DEPEND_CMD='$(CC) $(CFLAGS) -M $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o,"'
+ add_ldflags -Wl,-z,now # calls to libots crash without this
+fi
+
+test -n "$cc_type" && enable $cc_type || echolog "Unknown C compiler $cc"
+
+if test -n "$sysroot"; then
+ case "$cc_type" in
+ gcc)
+ add_cflags --sysroot="$sysroot"
+ add_ldflags --sysroot="$sysroot"
+ ;;
+ esac
+fi
+
# compiler sanity check
check_exec <<EOF
int main(void){ return 0; }
#Darwin CC versions
if test $target_os = darwin; then
- if $cc -v 2>&1 | grep -q xlc; then
+ if enabled xlc; then
add_cflags -qpdf2 -qlanglvl=extc99 -qmaxmem=-1 -qarch=auto -qtune=auto
else
add_cflags -pipe
add_cflags -mcpu=$cpu
;;
ev4|ev45|ev5|ev56|pca56|ev6|ev67)
- add_cflags -mcpu=$cpu
+ enabled ccc && add_cflags -arch $cpu || add_cflags -mcpu=$cpu
;;
*)
echo "WARNING: Unknown CPU \"$cpu\", ignored."
ldl=-ldl
fi
+# Solaris has nanosleep in -lrt, OpenSolaris no longer needs that
+check_func nanosleep || { check_func nanosleep -lrt && add_extralibs -lrt; }
+
check_func fork
check_func gethrtime
check_func getrusage
check_header sys/soundcard.h
check_header soundcard.h
-check_header alsa/asoundlib.h &&
check_lib2 alsa/asoundlib.h snd_pcm_htimestamp -lasound
# deal with the X11 frame grabber
check_cflags -Os # not all compilers support -Os
optimizations="small"
elif enabled optimizations; then
- if $cc -v 2>&1 | grep -q xlc; then
+ if enabled xlc; then
add_cflags -O5
add_ldflags -O5
+ elif enabled ccc; then
+ add_cflags -fast
else
add_cflags -O3
fi
check_cflags -fno-signed-zeros
# add some flags for Intel C Compiler
-if $cc --version 2> /dev/null | grep -q Intel; then
- # Just warnings, no remarks
- check_cflags -w1
- # -wd: Disable following warnings
- # 144, 167, 556: -Wno-pointer-sign
- # 10006: ignoring unknown option -fno-signed-zeros
- # 10156: ignoring option '-W'; no argument required
- check_cflags -wd144,167,556,10006,10156
- # 11030: Warning unknown option --as-needed
- # 10156: ignoring option '-export'; no argument required
- check_ldflags -wd10156,11030
- # Allow to compile with optimizations
- check_ldflags -march=$cpu
+if enabled icc; then
+ # Just warnings, no remarks
+ check_cflags -w1
+ # -wd: Disable following warnings
+ # 144, 167, 556: -Wno-pointer-sign
+ # 10006: ignoring unknown option -fno-signed-zeros
+ # 10156: ignoring option '-W'; no argument required
+ check_cflags -wd144,167,556,10006,10156
+ # 11030: Warning unknown option --as-needed
+ # 10156: ignoring option '-export'; no argument required
+ check_ldflags -wd10156,11030
+ # Allow to compile with optimizations
+ check_ldflags -march=$cpu
+elif enabled ccc; then
+ # disable some annoying warnings
+ add_cflags -msg_disable cvtu32to64
+ add_cflags -msg_disable embedcomment
+ add_cflags -msg_disable needconstext
+ add_cflags -msg_disable nomainieee
+ add_cflags -msg_disable ptrmismatch1
+ add_cflags -msg_disable unreachcode
fi
# PIC flags for shared library objects where they are needed