[FFmpeg-devel] [RFC PATCH] When checking for compiler or linker flags, check if warnings are reported.

Måns Rullgård mans
Thu Oct 9 16:59:26 CEST 2008


Diego 'Flameeyes' Petten? wrote:
> Not all compilers and linkres fail with error when an option they
> don't support is used during compilation or linking. For instance, the
> Sun Studio and the Intel compiler suites, only issue warnings for
> those cases.
>
> Also, even GCC only issues warnings when a flag that cannot be used
> with a given language (like -fvisibility-inlines-hidden used with the
> C frontend).
>
> With this patch, the checks for both compiler and linker flags will
> ensure that no warning is issued that might show the compiler or
> linker doesn't support the flag being tested. This will avoid adding
> further warnings during build.
>
> Known possible issue: it expects the user to know its compiler and not
> forcing through --extra-cflags or --extra-ldflags options that are not
> supported, otherwise all the cflags/ldflags checks will fail. Doesn't
> look too bad.
> ---
>
>  configure |   26 ++++++++++++++++++++++----
>  1 files changed, 22 insertions(+), 4 deletions(-)
>
> diff --git a/configure b/configure
> index 0a31571..ee4ab1f 100755
> --- a/configure
> +++ b/configure
> @@ -223,7 +223,7 @@ Include the log file "$logfile" produced by configure as
> this will help
>  solving the problem.
>  EOF
>      fi
> -    rm -f $TMPC $TMPE $TMPH $TMPO $TMPS $TMPSH
> +    rm -f $TMPC $TMPE $TMPH $TMPO $TMPS $TMPSH $TMPLOG $TMPRES
>      exit 1
>  }
>
> @@ -420,7 +420,9 @@ add_extralibs(){
>
>  check_cmd(){
>      log "$@"
> -    "$@" >> $logfile 2>&1
> +    rm -f $TMPRES
> +    ( "$@" 2>&1 && touch $TMPRES; ) | tee $TMPLOG >> $logfile
> +    test -f $TMPRES
>  }
>
>  check_cc(){
> @@ -466,18 +468,32 @@ check_ld(){
>      check_cmd $cc $LDFLAGS $flags -o $TMPE $TMPO $extralibs $libs
>  }
>
> +check_flags_warning() {
> +    grep -qi "warning" $TMPLOG && return 1
> +    grep -qi "illegal option" $TMPLOG && return 1
> +    grep -qi "unknown option" $TMPLOG && return 1
> +    grep -qi "ignoring option" $TMPLOG && return 1
> +    grep -qi "unrecognized" $TMPLOG && return 1
> +
> +    return 0
> +}
> +
>  check_cflags(){
>      log check_cflags "$@"
> -    check_cc "$@" <<EOF && add_cflags "$@"
> +    check_cc "$@" <<EOF || return 1
>  int x;
>  EOF
> +
> +    check_flags_warning && add_cflags "$@"
>  }
>
>  check_ldflags(){
>      log check_ldflags "$@"
> -    check_ld "$@" <<EOF && add_ldflags "$@"
> +    check_ld "$@" <<EOF || return 1
>  int main(void){ return 0; }
>  EOF
> +
> +    check_flags_warning && add_ldflags "$@"
>  }
>
>  check_header(){
> @@ -1125,6 +1141,8 @@ TMPH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h"
>  TMPO="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o"
>  TMPS="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
>  TMPSH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.sh"
> +TMPLOG="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.log"
> +TMPRES="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.res"

I'll get to this eventually.  Until the, please stop sending it.

-- 
M?ns Rullg?rd
mans at mansr.com




More information about the ffmpeg-devel mailing list