1
0
mirror of https://gitlab.xiph.org/xiph/icecast-server.git synced 2024-12-04 14:46:30 -05:00

Prune shout_prefix from *-config include flags if it would generate a warning.

Make all xiph_compiler macros comply with our coding guidelines
XIPH_GCC_INCLUDE_WARNING renamed XIPH_GCC_WARNING

svn path=/trunk/m4/; revision=5013
This commit is contained in:
brendan 2003-06-26 16:03:37 +00:00
parent 4b92ae2baa
commit 52dbe24523
4 changed files with 83 additions and 64 deletions

View File

@ -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 ;;

View File

@ -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"
])

View File

@ -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"
])

View File

@ -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 <brendan@xiph.org> 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<<EOF construct makes sure echo doesn't pick, say, -n
AC_DEFUN([XIPH_CLEAN_CCFLAGS],
[AC_REQUIRE([AC_PROG_FGREP])
xcc_REV_FLAGS=''
for flag in $1
do
case "$flag" in
-l*)
xcc_REV_FLAGS="$flag $xcc_REV_FLAGS"
;;
*)
if { cat <<EOF
$xcc_REV_FLAGS x
EOF
} | $FGREP -v -e " $flag " > /dev/null
then
xcc_REV_FLAGS="$flag $xcc_REV_FLAGS"
fi
esac
done
for flag in $xcc_REV_FLAGS
do
if { cat <<EOF
$$2 x
EOF
} | $FGREP -v -e " $flag " > /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 <brendan@xiph.org> 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<<EOF construct makes sure echo doesn't pick, say, -n
AC_DEFUN([XIPH_CLEAN_CCFLAGS],
[AC_REQUIRE([AC_PROG_FGREP])
xt_FLAGS=''
for flag in $1
do
case "$flag" in
-l*)
xt_FLAGS="$flag $xt_FLAGS"
;;
*)
if { cat <<EOF
$xt_FLAGS x
EOF
} | $FGREP -v -e " $flag " > /dev/null
then
xt_FLAGS="$flag $xt_FLAGS"
fi
;;
esac
done
$2=''
for flag in $xt_FLAGS
do
if { cat <<EOF
$$2 x
EOF
} | $FGREP -v -e " $flag " > /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 <<EOF
@ -141,9 +160,9 @@ do
EOF
} | $FGREP -v -e " $arg " > /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