diff --git a/common.mak b/common.mak index 629e7829ea..eeeb6f54f8 100644 --- a/common.mak +++ b/common.mak @@ -18,16 +18,17 @@ endif ALLFFLIBS = avcodec avdevice avfilter avformat avutil postproc swscale -CFLAGS := -DHAVE_AV_CONFIG_H -I$(BUILD_ROOT_REL) -I$(SRC_PATH) $(OPTFLAGS) +CPPFLAGS += -DHAVE_AV_CONFIG_H -I$(BUILD_ROOT_REL) -I$(SRC_PATH) +CFLAGS := $(OPTFLAGS) %.o: %.c - $(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $< + $(CC) $(CPPFLAGS) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $< %.o: %.S - $(AS) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $< + $(AS) $(CPPFLAGS) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $< %.ho: %.h - $(CC) $(CFLAGS) $(LIBOBJFLAGS) -Wno-unused -c -o $@ -x c $< + $(CC) $(CPPFLAGS) $(CFLAGS) $(LIBOBJFLAGS) -Wno-unused -c -o $@ -x c $< %.d: %.c $(DEPEND_CMD) > $@ diff --git a/configure b/configure index 0ef9f73a69..3be7aa0f5e 100755 --- a/configure +++ b/configure @@ -511,6 +511,10 @@ append(){ eval "$var=\"\$$var $*\"" } +add_cppflags(){ + append CPPFLAGS "$@" +} + add_cflags(){ append CFLAGS "$@" } @@ -532,21 +536,21 @@ check_cc(){ log check_cc "$@" cat > $TMPC log_file $TMPC - check_cmd $cc $CFLAGS "$@" -c -o $TMPO $TMPC + check_cmd $cc $CPPFLAGS $CFLAGS "$@" -c -o $TMPO $TMPC } check_cpp(){ log check_cpp "$@" cat > $TMPC log_file $TMPC - check_cmd $cc $CFLAGS "$@" -E -o $TMPO $TMPC + check_cmd $cc $CPPFLAGS "$@" -E -o $TMPO $TMPC } check_as(){ log check_as "$@" cat > $TMPC log_file $TMPC - check_cmd $as $CFLAGS "$@" -c -o $TMPO $TMPC + check_cmd $as $CPPFLAGS $CFLAGS "$@" -c -o $TMPO $TMPC } check_asm(){ @@ -578,6 +582,13 @@ check_ld(){ check_cmd $cc $LDFLAGS $flags -o $TMPE $TMPO $extralibs $libs } +check_cppflags(){ + log check_cppflags "$@" + check_cc "$@" <&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,"' + DEPEND_CMD='$(CC) $(CPPFLAGS) -M $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o,"' debuglevel=3 add_ldflags -Wl,-z,now # calls to libots crash without this elif $cc --vsn 2>/dev/null | grep -q RVCT; then @@ -1499,10 +1510,10 @@ if test "$?" != 0; then fi check_cflags -std=c99 -check_cc -D_FILE_OFFSET_BITS=64 < EOF -check_cc -D_LARGEFILE_SOURCE < EOF @@ -1593,7 +1604,8 @@ case $target_os in beos|haiku|zeta) prefix_default="$HOME/config" # helps building libavcodec - add_cflags -DPIC -fomit-frame-pointer + add_cppflags -DPIC + add_cflags -fomit-frame-pointer # 3 gcc releases known for BeOS, each with ugly bugs gcc_version="$($cc -v 2>&1 | grep version | cut -d ' ' -f3-)" case "$gcc_version" in @@ -1620,7 +1632,7 @@ case $target_os in FFSERVERLDFLAGS="" SHFLAGS='-shared -Wl,-h,$$(@F)' network_extralibs="-lsocket -lnsl" - add_cflags -D__EXTENSIONS__ + add_cppflags -D__EXTENSIONS__ ;; netbsd) oss_indev_extralibs="-lossaudio" @@ -2472,6 +2484,7 @@ enabled stripping && echo "STRIP=$strip" >> config.mak || echo "STRIP=echo ignoring strip" >> config.mak +echo "CPPFLAGS?=$CPPFLAGS" >> config.mak echo "OPTFLAGS=$CFLAGS" >> config.mak echo "LDFLAGS=$LDFLAGS" >> config.mak echo "FFSERVERLDFLAGS=$FFSERVERLDFLAGS" >> config.mak