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 Richard Boulton <richard-alsa@tartarus.org>
dnl Last modification: 25/06/2001 dnl Last modification: 25/06/2001
dnl GST_CHECK_FEATURE(FEATURE-NAME, FEATURE-DESCRIPTION, 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
dnl This macro adds a command line argument to enable the user to enable 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 dnl or disable a feature, and if the feature is enabled, performs a supplied
@ -305,6 +306,14 @@ dnl test to check if the feature is available.
dnl dnl
dnl The test should define HAVE_<FEATURE-NAME> to "yes" or "no" depending dnl The test should define HAVE_<FEATURE-NAME> to "yes" or "no" depending
dnl on whether the feature is available. 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
dnl FEATURE-NAME is the name of the feature, and should be in dnl FEATURE-NAME is the name of the feature, and should be in
dnl purely upper case characters. dnl purely upper case characters.
@ -316,12 +325,16 @@ dnl or "no" depending on whether the feature is
dnl available. dnl available.
dnl DISABLE-BY-DEFAULT if "disabled", the feature is disabled by default, dnl DISABLE-BY-DEFAULT if "disabled", the feature is disabled by default,
dnl if any other value, the feature is enabled 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 dnl
AC_DEFUN(GST_CHECK_FEATURE, AC_DEFUN(GST_CHECK_FEATURE,
[dnl [dnl
builtin(define, [gst_endisable], ifelse($5, [disabled], [enable], [disable]))dnl builtin(define, [gst_endisable], ifelse($5, [disabled], [enable], [disable]))dnl
AC_ARG_ENABLE(translit([$1], A-Z, a-z), 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 [ case "${enableval}" in
yes) USE_[$1]=yes ;; yes) USE_[$1]=yes ;;
no) USE_[$1]=no ;; no) USE_[$1]=no ;;
@ -350,10 +363,13 @@ if test x$USE_[$1] = xyes; then
fi fi
fi fi
dnl *** Warn if it's disabled or not found dnl *** Warn if it's disabled or not found
if test x$USE_[$1] = xno; then if test x$USE_[$1] = xyes; then
AC_MSG_WARN( ifelse([$6], , :, [$6])
else
ifelse([$3], , :, [AC_MSG_WARN(
***** NOTE: These plugins won't be built: [$3] ***** NOTE: These plugins won't be built: [$3]
) )])
ifelse([$7], , :, [$7])
fi fi
dnl *** Define the conditional as appropriate dnl *** Define the conditional as appropriate
AM_CONDITIONAL(USE_[$1], test x$USE_[$1] = xyes) 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 Check for essential libraries first:
dnl ==================================== dnl ====================================
dnl Check for glib2
AC_ARG_ENABLE(glib2, GST_CHECK_FEATURE(GLIB2, [use of glib-2.0 and GObject], , [
[ --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)
PKG_CHECK_MODULES(GLIB2, glib-2.0 gobject-2.0 gthread-2.0 gmodule-2.0, PKG_CHECK_MODULES(GLIB2, glib-2.0 gobject-2.0 gthread-2.0 gmodule-2.0,
HAVE_GLIB2=yes,HAVE_GLIB2=yes) 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"
if test x$HAVE_GLIB2 = xyes; then AC_DEFINE(USE_GLIB2)
CORE_LIBS="$GLIB2_LIBS" GST_DEFINE_CFLAGS="$GST_DEFINE_CFLAGS -DUSE_GLIB2"
CORE_CFLAGS="$GLIB2_CFLAGS" ])
AC_SUBST(GLIB2_LIBS)
AC_SUBST(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) 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") AM_CONDITIONAL(USE_GTK2, test "x$USE_GTK2" = "xyes")
AC_SUBST(USE_GTK2) AC_SUBST(USE_GTK2)
AM_CONDITIONAL(USE_GNOME2, test "x$USE_GNOME2" = "xyes") AM_CONDITIONAL(USE_GNOME2, test "x$USE_GNOME2" = "xyes")
AC_SUBST(USE_GNOME2) AC_SUBST(USE_GNOME2)
if test x$HAVE_OBJECT_MODEL = xno; then if test x$USE_GLIB2 = xno; then
dnl Check for glib dnl Check for glib and gtk
AM_PATH_GLIB(1.2.0,, AM_PATH_GLIB(1.2.0,,
AC_MSG_ERROR(Cannot find glib: Is glib-config in path?), AC_MSG_ERROR(Cannot find glib: Is glib-config in path?),
glib gmodule gthread) 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,, AM_PATH_GTK(1.2.0,,
AC_MSG_ERROR(Cannot find gtk: Is gtk-config in path?)) 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 fi