Add ACTION-IF-USE and ACTION-IF-NOTUSE parameters to GST_CHECK_FEATURE.

Original commit message from CVS:
Add ACTION-IF-USE and ACTION-IF-NOTUSE parameters to GST_CHECK_FEATURE.
Convert glib2 check to use GST_CHECK_FEATURE.
This commit is contained in:
Richard Boulton 2001-06-28 15:39:48 +00:00
parent 4dce71b5a7
commit fa53aaa72f
2 changed files with 39 additions and 48 deletions

View file

@ -297,7 +297,8 @@ dnl Perform a check for a feature for GStreamer
dnl Richard Boulton <richard-alsa@tartarus.org>
dnl Last modification: 25/06/2001
dnl GST_CHECK_FEATURE(FEATURE-NAME, FEATURE-DESCRIPTION,
dnl DEPENDENT-PLUGINS, TEST-FOR-FEATURE)
dnl DEPENDENT-PLUGINS, TEST-FOR-FEATURE,
dnl DISABLE-BY-DEFAULT, ACTION-IF-USE, ACTION-IF-NOTUSE)
dnl
dnl This macro adds a command line argument to enable the user to enable
dnl or disable a feature, and if the feature is enabled, performs a supplied
@ -306,6 +307,14 @@ dnl
dnl The test should define HAVE_<FEATURE-NAME> to "yes" or "no" depending
dnl on whether the feature is available.
dnl
dnl The macro will set USE_<<FEATURE-NAME> to "yes" or "no" depending on
dnl whether the feature is to be used.
dnl
dnl The macro will call AM_CONDTIONAL(USE_<<FEATURE-NAME>, ...) to allow
dnl the feature to control what is built in Makefile.ams. If you want
dnl additional actions resulting from the test, you can add them with the
dnl ACTION-IF-USE and ACTION-IF-NOTUSE parameters.
dnl
dnl FEATURE-NAME is the name of the feature, and should be in
dnl purely upper case characters.
dnl FEATURE-DESCRIPTION is used to describe the feature in help text for
@ -316,12 +325,16 @@ dnl or "no" depending on whether the feature is
dnl available.
dnl DISABLE-BY-DEFAULT if "disabled", the feature is disabled by default,
dnl if any other value, the feature is enabled by default.
dnl ACTION-IF-USE any extra actions to perform if the feature is to be
dnl used.
dnl ACTION-IF-NOTUSE any extra actions to perform if the feature is not to
dnl be used.
dnl
AC_DEFUN(GST_CHECK_FEATURE,
[dnl
builtin(define, [gst_endisable], ifelse($5, [disabled], [enable], [disable]))dnl
AC_ARG_ENABLE(translit([$1], A-Z, a-z),
[ ]builtin(format, --%-26s gst_endisable %s: %s, gst_endisable-translit([$1], A-Z, a-z), [$2], [$3]),
[ ]builtin(format, --%-26s gst_endisable %s, gst_endisable-translit([$1], A-Z, a-z), [$2]ifelse([$3],,,: [$3])),
[ case "${enableval}" in
yes) USE_[$1]=yes ;;
no) USE_[$1]=no ;;
@ -350,10 +363,13 @@ if test x$USE_[$1] = xyes; then
fi
fi
dnl *** Warn if it's disabled or not found
if test x$USE_[$1] = xno; then
AC_MSG_WARN(
if test x$USE_[$1] = xyes; then
ifelse([$6], , :, [$6])
else
ifelse([$3], , :, [AC_MSG_WARN(
***** NOTE: These plugins won't be built: [$3]
)
)])
ifelse([$7], , :, [$7])
fi
dnl *** Define the conditional as appropriate
AM_CONDITIONAL(USE_[$1], test x$USE_[$1] = xyes)

View file

@ -168,63 +168,38 @@ AC_MSG_RESULT(no)
dnl Check for essential libraries first:
dnl ====================================
AC_ARG_ENABLE(glib2,
[ --enable-glib2 enable the use of glib-2.0 and GObject if available],
[ case "${enableval}" in
yes) USE_GLIB2=yes ;;
no) USE_GLIB2=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-glib2) ;;
esac],
[:])
HAVE_OBJECT_MODEL=no
if test x$USE_GLIB2 = xyes; then
AC_MSG_CHECKING(glib-2.0)
dnl Check for glib2
GST_CHECK_FEATURE(GLIB2, [use of glib-2.0 and GObject], , [
PKG_CHECK_MODULES(GLIB2, glib-2.0 gobject-2.0 gthread-2.0 gmodule-2.0,
HAVE_GLIB2=yes,HAVE_GLIB2=yes)
if test x$HAVE_GLIB2 = xyes; then
CORE_LIBS="$GLIB2_LIBS"
CORE_CFLAGS="$GLIB2_CFLAGS"
HAVE_GLIB2=yes,HAVE_GLIB2=no)
AC_SUBST(GLIB2_LIBS)
AC_SUBST(GLIB2_CFLAGS)
], disabled, [
CORE_LIBS="$CORE_LIBS $GLIB2_LIBS"
CORE_CFLAGS="$CORE_CFLAGS $GLIB2_CFLAGS"
AC_DEFINE(USE_GLIB2)
GST_DEFINE_CFLAGS="$GST_DEFINE_CFLAGS -DUSE_GLIB2"
HAVE_OBJECT_MODEL=yes
else
USE_GLIB2=no
HAVE_OBJECT_MODEL=no
fi
fi
AM_CONDITIONAL(USE_GLIB2, test "x$USE_GLIB2" = "xyes")
])
AC_SUBST(USE_GLIB2)
dnl FIXME: check for gtk2 and gnome2 - these conditionals are currently
dnl always false.
AM_CONDITIONAL(USE_GTK2, test "x$USE_GTK2" = "xyes")
AC_SUBST(USE_GTK2)
AM_CONDITIONAL(USE_GNOME2, test "x$USE_GNOME2" = "xyes")
AC_SUBST(USE_GNOME2)
if test x$HAVE_OBJECT_MODEL = xno; then
dnl Check for glib
if test x$USE_GLIB2 = xno; then
dnl Check for glib and gtk
AM_PATH_GLIB(1.2.0,,
AC_MSG_ERROR(Cannot find glib: Is glib-config in path?),
glib gmodule gthread)
dnl Put the glib flags into $LIBS and $CFLAGS since we always use them
CORE_LIBS="$GLIB_LIBS"
CORE_CFLAGS="$GLIB_CFLAGS"
dnl Check for gtk
AM_PATH_GTK(1.2.0,,
AC_MSG_ERROR(Cannot find gtk: Is gtk-config in path?))
dnl Put the gtk flags into $LIBS and $CFLAGS since we always use them
CORE_LIBS="$CORE_LIBS $GTK_LIBS"
CORE_CFLAGS="$CORE_CFLAGS $GTK_CFLAGS"
HAVE_OBJECT_MODEL=yes
CORE_LIBS="$CORE_LIBS $GLIB_LIBS $GTK_LIBS"
CORE_CFLAGS="$CORE_CFLAGS $GLIB_CFLAGS $GTK_CFLAGS"
fi