From fa53aaa72fcea8995e0f0c506b0f0c1f6d33e47f Mon Sep 17 00:00:00 2001 From: Richard Boulton Date: Thu, 28 Jun 2001 15:39:48 +0000 Subject: [PATCH] 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. --- acinclude.m4 | 26 ++++++++++++++++----- configure.base | 61 +++++++++++++++----------------------------------- 2 files changed, 39 insertions(+), 48 deletions(-) diff --git a/acinclude.m4 b/acinclude.m4 index 731b60b2ce..34ca272948 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -297,7 +297,8 @@ dnl Perform a check for a feature for GStreamer dnl Richard Boulton 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 @@ -305,6 +306,14 @@ dnl test to check if the feature is available. dnl dnl The test should define HAVE_ to "yes" or "no" depending dnl on whether the feature is available. +dnl +dnl The macro will set USE_< to "yes" or "no" depending on +dnl whether the feature is to be used. +dnl +dnl The macro will call AM_CONDTIONAL(USE_<, ...) 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. @@ -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) diff --git a/configure.base b/configure.base index ce38f74904..e1dd242f50 100644 --- a/configure.base +++ b/configure.base @@ -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) + 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 - CORE_LIBS="$GLIB2_LIBS" - 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_DEFINE(USE_GLIB2) + GST_DEFINE_CFLAGS="$GST_DEFINE_CFLAGS -DUSE_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") 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