Blame common/m4/gst-args.m4

Packit 971217
dnl configure-time options shared among gstreamer modules
Packit 971217
Packit 971217
dnl AG_GST_ARG_DEBUG
Packit 971217
dnl AG_GST_ARG_PROFILING
Packit 971217
dnl AG_GST_ARG_VALGRIND
Packit 971217
dnl AG_GST_ARG_GCOV
Packit 971217
Packit 971217
dnl AG_GST_ARG_EXAMPLES
Packit 971217
Packit 971217
dnl AG_GST_ARG_WITH_PKG_CONFIG_PATH
Packit 971217
dnl AG_GST_ARG_WITH_PACKAGE_NAME
Packit 971217
dnl AG_GST_ARG_WITH_PACKAGE_ORIGIN
Packit 971217
Packit 971217
dnl AG_GST_ARG_WITH_PLUGINS
Packit 971217
dnl AG_GST_CHECK_PLUGIN
Packit 971217
dnl AG_GST_DISABLE_PLUGIN
Packit 971217
Packit 971217
dnl AG_GST_ARG_ENABLE_EXTERNAL
Packit 971217
dnl AG_GST_ARG_ENABLE_EXPERIMENTAL
Packit 971217
dnl AG_GST_ARG_ENABLE_BROKEN
Packit 971217
Packit 971217
dnl AG_GST_ARG_DISABLE_FATAL_WARNINGS
Packit 971217
AC_DEFUN([AG_GST_ARG_DEBUG],
Packit 971217
[
Packit 971217
  dnl debugging stuff
Packit 971217
  AC_ARG_ENABLE(debug,
Packit 971217
    AC_HELP_STRING([--disable-debug],[disable addition of -g debugging info]),
Packit 971217
    [
Packit 971217
      case "${enableval}" in
Packit 971217
        yes) USE_DEBUG=yes ;;
Packit 971217
        no)  USE_DEBUG=no ;;
Packit 971217
        *)   AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
Packit 971217
      esac
Packit 971217
    ],
Packit 971217
    [USE_DEBUG=yes]) dnl Default value
Packit 971217
])
Packit 971217
Packit 971217
AC_DEFUN([AG_GST_ARG_PROFILING],
Packit 971217
[
Packit 971217
  AC_ARG_ENABLE(profiling,
Packit 971217
    AC_HELP_STRING([--enable-profiling],
Packit 971217
      [adds -pg to compiler commandline, for profiling]),
Packit 971217
    [
Packit 971217
      case "${enableval}" in
Packit 971217
        yes) USE_PROFILING=yes ;;
Packit 971217
        no)  USE_PROFILING=no ;;
Packit 971217
        *)   AC_MSG_ERROR(bad value ${enableval} for --enable-profiling) ;;
Packit 971217
      esac
Packit 971217
    ],
Packit 971217
    [USE_PROFILING=no]) dnl Default value
Packit 971217
])
Packit 971217
Packit 971217
AC_DEFUN([AG_GST_ARG_VALGRIND],
Packit 971217
[
Packit 971217
  dnl valgrind inclusion
Packit 971217
  AC_ARG_ENABLE(valgrind,
Packit 971217
    AC_HELP_STRING([--disable-valgrind],[disable run-time valgrind detection]),
Packit 971217
    [
Packit 971217
      case "${enableval}" in
Packit 971217
        yes) USE_VALGRIND="$USE_DEBUG" ;;
Packit 971217
        no)  USE_VALGRIND=no ;;
Packit 971217
        *)   AC_MSG_ERROR(bad value ${enableval} for --enable-valgrind) ;;
Packit 971217
      esac
Packit 971217
    ],
Packit 971217
    [USE_VALGRIND="$USE_DEBUG"]) dnl Default value
Packit 971217
  VALGRIND_REQ="3.0"
Packit 971217
  if test "x$USE_VALGRIND" = xyes; then
Packit 971217
    PKG_CHECK_MODULES(VALGRIND, valgrind >= $VALGRIND_REQ,
Packit 971217
      USE_VALGRIND="yes",
Packit 971217
      USE_VALGRIND="no")
Packit 971217
  fi
Packit 971217
  if test "x$USE_VALGRIND" = xyes; then
Packit 971217
    AC_DEFINE(HAVE_VALGRIND, 1, [Define if valgrind should be used])
Packit 971217
    AC_MSG_NOTICE(Using extra code paths for valgrind)
Packit 971217
  fi
Packit 971217
])
Packit 971217
Packit 971217
AC_DEFUN([AG_GST_ARG_GCOV],
Packit 971217
[
Packit 971217
  AC_ARG_ENABLE(gcov,
Packit 971217
    AC_HELP_STRING([--enable-gcov],
Packit 971217
      [compile with coverage profiling instrumentation (gcc only)]),
Packit 971217
    enable_gcov=$enableval,
Packit 971217
    enable_gcov=no)
Packit 971217
  if test x$enable_gcov = xyes ; then
Packit 971217
    if test "x$GCC" != "xyes"
Packit 971217
    then
Packit 971217
      AC_MSG_ERROR([gcov only works if gcc is used])
Packit 971217
    fi
Packit 971217
Packit 971217
    AS_COMPILER_FLAG(["-fprofile-arcs"],
Packit 971217
      [GCOV_CFLAGS="$GCOV_CFLAGS -fprofile-arcs"],
Packit 971217
      true)
Packit 971217
    AS_COMPILER_FLAG(["-ftest-coverage"],
Packit 971217
      [GCOV_CFLAGS="$GCOV_CFLAGS -ftest-coverage"],
Packit 971217
      true)
Packit 971217
    dnl remove any -O flags - FIXME: is this needed ?
Packit 971217
    GCOV_CFLAGS=`echo "$GCOV_CFLAGS" | sed -e 's/-O[[0-9]]*//g'`
Packit 971217
    dnl libtool 1.5.22 and lower strip -fprofile-arcs from the flags
Packit 971217
    dnl passed to the linker, which is a bug; -fprofile-arcs implicitly
Packit 971217
    dnl links in -lgcov, so we do it explicitly here for the same effect
Packit 971217
    GCOV_LIBS=-lgcov
Packit 971217
    AC_SUBST(GCOV_CFLAGS)
Packit 971217
    AC_SUBST(GCOV_LIBS)
Packit 971217
    GCOV=`echo $CC | sed s/gcc/gcov/g`
Packit 971217
    AC_SUBST(GCOV)
Packit 971217
Packit 971217
    GST_GCOV_ENABLED=yes
Packit 971217
    AC_DEFINE_UNQUOTED(GST_GCOV_ENABLED, 1,
Packit 971217
      [Defined if gcov is enabled to force a rebuild due to config.h changing])
Packit 971217
    dnl if gcov is used, we do not want default -O2 CFLAGS
Packit 971217
    if test "x$GST_GCOV_ENABLED" = "xyes"
Packit 971217
    then
Packit 971217
      CFLAGS="$CFLAGS -O0"
Packit 971217
      AC_SUBST(CFLAGS)
Packit 971217
      CXXFLAGS="$CXXFLAGS -O0"
Packit 971217
      AC_SUBST(CXXFLAGS)
Packit 971217
      FFLAGS="$FFLAGS -O0"
Packit 971217
      AC_SUBST(FFLAGS)
Packit 971217
      CCASFLAGS="$CCASFLAGS -O0"
Packit 971217
      AC_SUBST(CCASFLAGS)
Packit 971217
      AC_MSG_NOTICE([gcov enabled, setting CFLAGS and friends to $CFLAGS])
Packit 971217
    fi
Packit 971217
  fi
Packit 971217
  AM_CONDITIONAL(GST_GCOV_ENABLED, test x$enable_gcov = xyes)
Packit 971217
])
Packit 971217
Packit 971217
AC_DEFUN([AG_GST_ARG_EXAMPLES],
Packit 971217
[
Packit 971217
  AC_ARG_ENABLE(examples,
Packit 971217
    AC_HELP_STRING([--disable-examples], [disable building examples]),
Packit 971217
      [
Packit 971217
        case "${enableval}" in
Packit 971217
          yes) BUILD_EXAMPLES=yes ;;
Packit 971217
          no)  BUILD_EXAMPLES=no ;;
Packit 971217
          *)   AC_MSG_ERROR(bad value ${enableval} for --disable-examples) ;;
Packit 971217
        esac
Packit 971217
      ],
Packit 971217
      [BUILD_EXAMPLES=yes]) dnl Default value
Packit 971217
  AM_CONDITIONAL(BUILD_EXAMPLES,      test "x$BUILD_EXAMPLES" = "xyes")
Packit 971217
])
Packit 971217
Packit 971217
AC_DEFUN([AG_GST_ARG_WITH_PKG_CONFIG_PATH],
Packit 971217
[
Packit 971217
  dnl possibly modify pkg-config path
Packit 971217
  AC_ARG_WITH(pkg-config-path,
Packit 971217
     AC_HELP_STRING([--with-pkg-config-path],
Packit 971217
                    [colon-separated list of pkg-config(1) dirs]),
Packit 971217
     [
Packit 971217
       export PKG_CONFIG_PATH=${withval}
Packit 971217
       AC_MSG_NOTICE(Set PKG_CONFIG_PATH to $PKG_CONFIG_PATH)
Packit 971217
     ])
Packit 971217
])
Packit 971217
Packit 971217
Packit 971217
dnl This macro requires that GST_GIT or GST_CVS is set to yes or no (release)
Packit 971217
AC_DEFUN([AG_GST_ARG_WITH_PACKAGE_NAME],
Packit 971217
[
Packit 971217
  dnl package name in plugins
Packit 971217
  AC_ARG_WITH(package-name,
Packit 971217
    AC_HELP_STRING([--with-package-name],
Packit 971217
      [specify package name to use in plugins]),
Packit 971217
    [
Packit 971217
      case "${withval}" in
Packit 971217
        yes) AC_MSG_ERROR(bad value ${withval} for --with-package-name) ;;
Packit 971217
        no)  AC_MSG_ERROR(bad value ${withval} for --with-package-name) ;;
Packit 971217
        *)   GST_PACKAGE_NAME="${withval}" ;;
Packit 971217
      esac
Packit 971217
    ],
Packit 971217
    [
Packit 971217
      P=$1
Packit 971217
      if test "x$P" = "x"
Packit 971217
      then
Packit 971217
        P=$PACKAGE_NAME
Packit 971217
      fi
Packit 971217
Packit 971217
      if test "x$PACKAGE_VERSION_NANO" = "x0"
Packit 971217
      then
Packit 971217
        GST_PACKAGE_NAME="$P source release"
Packit 971217
      else
Packit 971217
        if test "x$PACKAGE_VERSION_NANO" = "x1"
Packit 971217
        then
Packit 971217
          GST_PACKAGE_NAME="$P git"
Packit 971217
        else
Packit 971217
          GST_PACKAGE_NAME="$P prerelease"
Packit 971217
        fi
Packit 971217
      fi
Packit 971217
    ]
Packit 971217
  )
Packit 971217
  AC_MSG_NOTICE(Using $GST_PACKAGE_NAME as package name)
Packit 971217
  AC_DEFINE_UNQUOTED(GST_PACKAGE_NAME, "$GST_PACKAGE_NAME",
Packit 971217
      [package name in plugins])
Packit 971217
  AC_SUBST(GST_PACKAGE_NAME)
Packit 971217
])
Packit 971217
Packit 971217
AC_DEFUN([AG_GST_ARG_WITH_PACKAGE_ORIGIN],
Packit 971217
[
Packit 971217
  dnl package origin URL
Packit 971217
  AC_ARG_WITH(package-origin,
Packit 971217
    AC_HELP_STRING([--with-package-origin],
Packit 971217
      [specify package origin URL to use in plugins]),
Packit 971217
    [
Packit 971217
      case "${withval}" in
Packit 971217
        yes) AC_MSG_ERROR(bad value ${withval} for --with-package-origin) ;;
Packit 971217
        no)  AC_MSG_ERROR(bad value ${withval} for --with-package-origin) ;;
Packit 971217
        *)   GST_PACKAGE_ORIGIN="${withval}" ;;
Packit 971217
      esac
Packit 971217
    ],
Packit 971217
    [GST_PACKAGE_ORIGIN="[Unknown package origin]"] dnl Default value
Packit 971217
  )
Packit 971217
  AC_MSG_NOTICE(Using $GST_PACKAGE_ORIGIN as package origin)
Packit 971217
  AC_DEFINE_UNQUOTED(GST_PACKAGE_ORIGIN, "$GST_PACKAGE_ORIGIN",
Packit 971217
      [package origin])
Packit 971217
  AC_SUBST(GST_PACKAGE_ORIGIN)
Packit 971217
])
Packit 971217
Packit 971217
dnl sets WITH_PLUGINS to the list of plug-ins given as an argument
Packit 971217
dnl also clears GST_PLUGINS_ALL and GST_PLUGINS_SELECTED
Packit 971217
AC_DEFUN([AG_GST_ARG_WITH_PLUGINS],
Packit 971217
[
Packit 971217
  AC_ARG_WITH(plugins,
Packit 971217
    AC_HELP_STRING([--with-plugins],
Packit 971217
      [comma-separated list of dependencyless plug-ins to compile]),
Packit 971217
    [WITH_PLUGINS=$withval],
Packit 971217
    [WITH_PLUGINS=])
Packit 971217
Packit 971217
  GST_PLUGINS_ALL=""
Packit 971217
  GST_PLUGINS_SELECTED=""
Packit 971217
  GST_PLUGINS_NONPORTED=""
Packit 971217
Packit 971217
  AC_SUBST(GST_PLUGINS_ALL)
Packit 971217
  AC_SUBST(GST_PLUGINS_SELECTED)
Packit 971217
  AC_SUBST(GST_PLUGINS_NONPORTED)
Packit 971217
])
Packit 971217
Packit 971217
dnl AG_GST_CHECK_PLUGIN(PLUGIN-NAME)
Packit 971217
dnl
Packit 971217
dnl This macro adds the plug-in <PLUGIN-NAME> to GST_PLUGINS_ALL. Then it
Packit 971217
dnl checks if WITH_PLUGINS is empty or the plugin is present in WITH_PLUGINS,
Packit 971217
dnl and if so adds it to GST_PLUGINS_SELECTED. Then it checks if the plugin
Packit 971217
dnl is present in WITHOUT_PLUGINS (ie. was disabled specifically) and if so
Packit 971217
dnl removes it from GST_PLUGINS_SELECTED.
Packit 971217
dnl
Packit 971217
dnl The macro will call AM_CONDITIONAL(USE_PLUGIN_<PLUGIN-NAME>, ...) to allow
Packit 971217
dnl control of what is built in Makefile.ams.
Packit 971217
AC_DEFUN([AG_GST_CHECK_PLUGIN],
Packit 971217
[
Packit 971217
  GST_PLUGINS_ALL="$GST_PLUGINS_ALL [$1]"
Packit 971217
Packit 971217
  define([pname_def],translit([$1], -a-z, _a-z))
Packit 971217
Packit 971217
  AC_ARG_ENABLE([$1],
Packit 971217
    AC_HELP_STRING([--disable-[$1]], [disable dependency-less $1 plugin]),
Packit 971217
    [
Packit 971217
      case "${enableval}" in
Packit 971217
        yes) [gst_use_]pname_def=yes ;;
Packit 971217
        no) [gst_use_]pname_def=no ;;
Packit 971217
        *) AC_MSG_ERROR([bad value ${enableval} for --enable-$1]) ;;
Packit 971217
       esac
Packit 971217
    ],
Packit 971217
    [[gst_use_]pname_def=yes]) dnl Default value
Packit 971217
Packit 971217
  if test x$[gst_use_]pname_def = xno; then
Packit 971217
    AC_MSG_NOTICE(disabling dependency-less plugin $1)
Packit 971217
    WITHOUT_PLUGINS="$WITHOUT_PLUGINS [$1]"
Packit 971217
  fi
Packit 971217
  undefine([pname_def])
Packit 971217
Packit 971217
  dnl First check inclusion
Packit 971217
  if [[ -z "$WITH_PLUGINS" ]] || echo " [$WITH_PLUGINS] " | tr , ' ' | grep -i " [$1] " > /dev/null; then
Packit 971217
    GST_PLUGINS_SELECTED="$GST_PLUGINS_SELECTED [$1]"
Packit 971217
  fi
Packit 971217
  dnl Then check exclusion
Packit 971217
  if echo " [$WITHOUT_PLUGINS] " | tr , ' ' | grep -i " [$1] " > /dev/null; then
Packit 971217
    GST_PLUGINS_SELECTED=`echo " $GST_PLUGINS_SELECTED " | $SED -e 's/ [$1] / /'`
Packit 971217
  fi
Packit 971217
  dnl Finally check if the plugin is ported or not
Packit 971217
  if echo " [$GST_PLUGINS_NONPORTED] " | tr , ' ' | grep -i " [$1] " > /dev/null; then
Packit 971217
    GST_PLUGINS_SELECTED=`echo " $GST_PLUGINS_SELECTED " | $SED -e 's/ [$1] / /'`
Packit 971217
  fi
Packit 971217
  AM_CONDITIONAL([USE_PLUGIN_]translit([$1], a-z, A-Z), echo " $GST_PLUGINS_SELECTED " | grep -i " [$1] " > /dev/null)
Packit 971217
])
Packit 971217
Packit 971217
dnl AG_GST_DISABLE_PLUGIN(PLUGIN-NAME)
Packit 971217
dnl
Packit 971217
dnl This macro disables the plug-in <PLUGIN-NAME> by removing it from
Packit 971217
dnl GST_PLUGINS_SELECTED.
Packit 971217
AC_DEFUN([AG_GST_DISABLE_PLUGIN],
Packit 971217
[
Packit 971217
  GST_PLUGINS_SELECTED=`echo " $GST_PLUGINS_SELECTED " | $SED -e 's/ [$1] / /'`
Packit 971217
  AM_CONDITIONAL([USE_PLUGIN_]translit([$1], a-z, A-Z), false)
Packit 971217
])
Packit 971217
Packit 971217
AC_DEFUN([AG_GST_ARG_ENABLE_EXTERNAL],
Packit 971217
[
Packit 971217
  AG_GST_CHECK_FEATURE(EXTERNAL, [building of plug-ins with external deps],,
Packit 971217
    HAVE_EXTERNAL=yes, enabled,
Packit 971217
    [
Packit 971217
      AC_MSG_NOTICE(building external plug-ins)
Packit 971217
      BUILD_EXTERNAL="yes"
Packit 971217
    ],[
Packit 971217
      AC_MSG_WARN(all plug-ins with external dependencies will not be built)
Packit 971217
      BUILD_EXTERNAL="no"
Packit 971217
    ])
Packit 971217
  # make BUILD_EXTERNAL available to Makefile.am
Packit 971217
  AM_CONDITIONAL(BUILD_EXTERNAL, test "x$BUILD_EXTERNAL" = "xyes")
Packit 971217
])
Packit 971217
Packit 971217
dnl experimental plug-ins; stuff that hasn't had the dust settle yet
Packit 971217
dnl read 'builds, but might not work'
Packit 971217
AC_DEFUN([AG_GST_ARG_ENABLE_EXPERIMENTAL],
Packit 971217
[
Packit 971217
  AG_GST_CHECK_FEATURE(EXPERIMENTAL, [building of experimental plug-ins],,
Packit 971217
    HAVE_EXPERIMENTAL=yes, disabled,
Packit 971217
    [
Packit 971217
      AC_MSG_WARN(building experimental plug-ins)
Packit 971217
      BUILD_EXPERIMENTAL="yes"
Packit 971217
    ],[
Packit 971217
      AC_MSG_NOTICE(not building experimental plug-ins)
Packit 971217
      BUILD_EXPERIMENTAL="no"
Packit 971217
    ])
Packit 971217
  # make BUILD_EXPERIMENTAL available to Makefile.am
Packit 971217
  AM_CONDITIONAL(BUILD_EXPERIMENTAL, test "x$BUILD_EXPERIMENTAL" = "xyes")
Packit 971217
])
Packit 971217
Packit 971217
dnl broken plug-ins; stuff that doesn't seem to build at the moment
Packit 971217
AC_DEFUN([AG_GST_ARG_ENABLE_BROKEN],
Packit 971217
[
Packit 971217
  AG_GST_CHECK_FEATURE(BROKEN, [building of broken plug-ins],,
Packit 971217
    HAVE_BROKEN=yes, disabled,
Packit 971217
    [
Packit 971217
      AC_MSG_WARN([building broken plug-ins -- no bug reports on these, only patches ...])
Packit 971217
    ],[
Packit 971217
      AC_MSG_NOTICE([not building broken plug-ins])
Packit 971217
    ])
Packit 971217
])
Packit 971217
Packit 971217
dnl allow people (or build tools) to override default behaviour
Packit 971217
dnl for fatal compiler warnings
Packit 971217
dnl Enable fatal warnings by default only for development versions
Packit 971217
AC_DEFUN([AG_GST_ARG_DISABLE_FATAL_WARNINGS],
Packit 971217
[
Packit 971217
  AC_ARG_ENABLE(fatal-warnings,
Packit 971217
    AC_HELP_STRING([--disable-fatal-warnings],
Packit 971217
                   [Don't turn compiler warnings into fatal errors]),
Packit 971217
    [
Packit 971217
      case "${enableval}" in
Packit 971217
        yes) FATAL_WARNINGS=yes ;;
Packit 971217
        no)  FATAL_WARNINGS=no ;;
Packit 971217
        *)   AC_MSG_ERROR(bad value ${enableval} for --disable-fatal-warnings) ;;
Packit 971217
      esac
Packit 971217
    ],
Packit 971217
    [
Packit 971217
      if test "x`expr $PACKAGE_VERSION_MINOR % 2`" = "x1" -a "x`expr $PACKAGE_VERSION_MICRO '<' 90`" = "x1"; then
Packit 971217
        FATAL_WARNINGS=yes
Packit 971217
      else
Packit 971217
        FATAL_WARNINGS=no
Packit 971217
      fi
Packit 971217
    ])
Packit 971217
])
Packit 971217
Packit 971217
dnl Enable extra checks by default only for development versions
Packit 971217
AC_DEFUN([AG_GST_ARG_ENABLE_EXTRA_CHECKS],
Packit 971217
[
Packit 971217
  AC_ARG_ENABLE(extra-check,
Packit 971217
    AC_HELP_STRING([--enable-extra-checks],
Packit 971217
                   [Enable extra runtime checks]),
Packit 971217
    [
Packit 971217
      case "${enableval}" in
Packit 971217
        yes) EXTRA_CHECKS=yes ;;
Packit 971217
        no)  EXTRA_CHECKS=no ;;
Packit 971217
        *)   AC_MSG_ERROR(bad value ${enableval} for --enable-extra-checks) ;;
Packit 971217
      esac
Packit 971217
    ],
Packit 971217
    [
Packit 971217
      if test "x`expr $PACKAGE_VERSION_MINOR % 2`" = "x1" -a "x`expr $PACKAGE_VERSION_MICRO '<' 90`" = "x1"; then
Packit 971217
        EXTRA_CHECKS=yes
Packit 971217
      else
Packit 971217
        EXTRA_CHECKS=no
Packit 971217
      fi
Packit 971217
    ])
Packit 971217
Packit 971217
    if test "x$EXTRA_CHECKS" = "xyes"; then
Packit 971217
        AC_DEFINE(GST_ENABLE_EXTRA_CHECKS, 1, [Define if extra runtime checks should be enabled])
Packit 971217
    fi
Packit 971217
])