diff --git a/m4/ac_config_libconfig_in.m4 b/m4/ac_config_libconfig_in.m4 index eaca39e3..aacfd0a0 100644 --- a/m4/ac_config_libconfig_in.m4 +++ b/m4/ac_config_libconfig_in.m4 @@ -98,11 +98,11 @@ for option in $options extra; do exec-prefix | eprefix) echo ' o="$o $exec_prefix"' >>$LIBCONFIG_FILE ;; template-version) echo ' o="$o $template_version"' >>$LIBCONFIG_FILE ;; cflags) - echo ' i=`eval echo "$includedir"`' >>$LIBCONFIG_FILE ; - echo ' i=`eval echo "$i"`' >>$LIBCONFIG_FILE ; - echo ' if test "_$i" != "_/usr/include" ; then' >>$LIBCONFIG_FILE ; - echo ' o="$o -I$includedir"' >>$LIBCONFIG_FILE ; - echo ' fi' >>$LIBCONFIG_FILE ; +# echo ' i=`eval echo "$includedir"`' >>$LIBCONFIG_FILE ; +# echo ' i=`eval echo "$i"`' >>$LIBCONFIG_FILE ; +# echo ' if test "_$i" != "_/usr/include" ; then' >>$LIBCONFIG_FILE ; +# echo ' o="$o -I$includedir"' >>$LIBCONFIG_FILE ; +# echo ' fi' >>$LIBCONFIG_FILE ; echo ' o="$o $cflags"' >>$LIBCONFIG_FILE ;; libs) echo ' o="$o -L$libdir $libs"' >>$LIBCONFIG_FILE ;; help) echo ' h="1"' >>$LIBCONFIG_FILE ;; diff --git a/m4/ogg.m4 b/m4/ogg.m4 index 9755d051..957ec5cc 100644 --- a/m4/ogg.m4 +++ b/m4/ogg.m4 @@ -23,7 +23,7 @@ if test "x$ogg_prefix" = "x"; then fi fi -XIPH_GCC_INCLUDE_WARNING([$ogg_prefix/include],, +XIPH_GCC_WARNING([-I$ogg_prefix/include],, [OGG_CFLAGS="-I$ogg_prefix/include" OGG_LDFLAGS="-L$ogg_prefix/lib" ]) diff --git a/m4/vorbis.m4 b/m4/vorbis.m4 index 787d962c..d6efd3d2 100644 --- a/m4/vorbis.m4 +++ b/m4/vorbis.m4 @@ -32,7 +32,7 @@ fi VORBIS_CFLAGS="$OGG_CFLAGS" VORBIS_LDFLAGS="$OGG_LDFLAGS" if test "x$vorbis_prefix" != "x$ogg_prefix"; then - XIPH_GCC_INCLUDE_WARNING("$vorbis_prefix/include",, + XIPH_GCC_WARNING(-I"$vorbis_prefix/include",, [VORBIS_CFLAGS="$VORBIS_CFLAGS -I$vorbis_prefix/include" VORBIS_LDFLAGS="-L$vorbis_prefix/lib $VORBIS_LDFLAGS" ]) diff --git a/m4/xiph_compiler.m4 b/m4/xiph_compiler.m4 index 8b50153c..8b69fda6 100644 --- a/m4/xiph_compiler.m4 +++ b/m4/xiph_compiler.m4 @@ -1,46 +1,5 @@ dnl xiph_compiler.m4 -dnl $Id: xiph_compiler.m4,v 1.3 2003/06/24 05:04:54 brendan Exp $ - -dnl XIPH_CLEAN_CCFLAGS -dnl Brendan Cully 20030612 -dnl -# XIPH_CLEAN_CCFLAGS(flag-list, dest-shell-var-name) -# Filters out duplicate compiler flags -# Operates right-to-left on -l flags, left-to-right on everything else -# eg XIPH_CLEAN_CCFLAGS([-L/opt/lib -lfoo -lm -L/opt/lib -lbar -lm], [MY_LDFLAGS]) -# => MY_LDFLAGS="-L/opt/lib -lfoo -lbar -lm" -# the cat< /dev/null - then - xcc_REV_FLAGS="$flag $xcc_REV_FLAGS" - fi - esac -done - -for flag in $xcc_REV_FLAGS -do - if { cat < /dev/null - then - $2="$flag $$2" - fi -done -])dnl XIPH_CLEAN_CCFLAGS +dnl $Id: xiph_compiler.m4,v 1.4 2003/06/26 16:03:37 brendan Exp $ dnl XIPH_FUNC_VA_COPY dnl Karl Heyes @@ -79,29 +38,89 @@ AC_TRY_COMPILE([int func(void) __attribute__((unused));], ]) ])dnl XIPH_C_ATTRIBUTE -dnl XIPH_GCC_INCLUDE_WARNING +dnl XIPH_GCC_WARNING dnl Karl Heyes dnl -# XIPH_GCC_INCLUDE_WARNING(include-dir, action-if-warning, action-if-not) -# Tests whether GCC emits a warning if explicitly asked to put include-dir -# in its include path, because GCC is already including that path by default -AC_DEFUN([XIPH_GCC_INCLUDE_WARNING], +# XIPH_GCC_WARNING(flag, action-if-warning, action-if-not) +# Tests whether GCC emits a warning if explicitly asked to use flag. +# Useful for eg system default include paths +AC_DEFUN([XIPH_GCC_WARNING], [AC_REQUIRE([AC_PROG_CC]) -xgiw_warning=no +xt_warning=no if test x"$GCC" = "xyes" then save_cflags="$CFLAGS" - CFLAGS="-Werror -I$1" - AC_TRY_COMPILE(,,,xgiw_warning=yes) + CFLAGS="-Werror $1" + AC_TRY_COMPILE(,,,xt_warning=yes) CFLAGS="$save_cflags" fi -if test "$xgiw_warning" = "yes" +if test "$xt_warning" = "yes" then ifelse([$2],,:,[$2]) else ifelse([$3],,:,[$3]) fi -])dnl XIPH_GCC_INCLUDE_WARNING +])dnl XIPH_GCC_WARNING + +dnl XIPH_CLEAN_CCFLAGS +dnl Brendan Cully 20030612 +dnl +# XIPH_CLEAN_CCFLAGS(flag-list, dest-shell-var-name) +# Filters out duplicate compiler flags, and -I flags if XIPH_GCC_WARNING +# complains about them +# Operates right-to-left on -l flags, left-to-right on everything else +# eg XIPH_CLEAN_CCFLAGS([-L/opt/lib -lfoo -lm -L/opt/lib -lbar -lm], [MY_LDFLAGS]) +# => MY_LDFLAGS="-L/opt/lib -lfoo -lbar -lm" +# the cat< /dev/null + then + xt_FLAGS="$flag $xt_FLAGS" + fi + ;; + esac +done + +$2='' +for flag in $xt_FLAGS +do + if { cat < /dev/null + then + $2="$flag $$2" + fi +done + +# Prune -I flags if $CC warns about them +xt_FLAGS='' +for flag in $$2 +do + case "$flag" in + -I*) + XIPH_GCC_WARNING([$flag], [], [xt_FLAGS="$xt_FLAGS $flag"]) + ;; + *) + xt_FLAGS="$xt_FLAGS $flag" + ;; + esac +done +$2="$xt_FLAGS" +])dnl XIPH_CLEAN_CCFLAGS dnl XIPH_VAR_APPEND dnl Karl Heyes @@ -132,8 +151,8 @@ dnl AC_DEFUN([XIPH_VAR_PREPEND], [dnl AC_REQUIRE([AC_PROG_FGREP]) -xvp_compare="$1" -filtered="" +xt_compare="$1" +xt_filtered="" for arg in $2 do if { cat < /dev/null then - compare="$arg $compare" - filtered="$filtered $arg" + xt_compare="$arg $xt_compare" + xt_filtered="$xt_filtered $arg" fi done -$1="$filtered $$1" +$1="$xt_filtered $$1" ])dnl XIPH_VAR_PREPEND