[svn r616] added m4 macros trunk
authorrenatofilho
Tue May 01 16:36:58 2007 +0100 (2007-05-01)
branchtrunk
changeset 6103cdc32e43041
parent 609 4aac30345986
child 611 aa1f309ec686
[svn r616] added m4 macros
gst-gmyth/m4/as-compiler-flag.m4
gst-gmyth/m4/as-version.m4
gst-gmyth/m4/gst-feature.m4
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gst-gmyth/m4/as-compiler-flag.m4	Tue May 01 16:36:58 2007 +0100
     1.3 @@ -0,0 +1,32 @@
     1.4 +dnl as-compiler-flag.m4 0.1.0
     1.5 +
     1.6 +dnl autostars m4 macro for detection of compiler flags
     1.7 +
     1.8 +dnl David Schleef <ds@schleef.org>
     1.9 +
    1.10 +dnl $Id: as-compiler-flag.m4,v 1.1 2005/06/18 18:02:46 burgerman Exp $
    1.11 +
    1.12 +dnl AS_COMPILER_FLAG(CFLAGS, ACTION-IF-ACCEPTED, [ACTION-IF-NOT-ACCEPTED])
    1.13 +dnl Tries to compile with the given CFLAGS.
    1.14 +dnl Runs ACTION-IF-ACCEPTED if the compiler can compile with the flags,
    1.15 +dnl and ACTION-IF-NOT-ACCEPTED otherwise.
    1.16 +
    1.17 +AC_DEFUN([AS_COMPILER_FLAG],
    1.18 +[
    1.19 +  AC_MSG_CHECKING([to see if compiler understands $1])
    1.20 +
    1.21 +  save_CFLAGS="$CFLAGS"
    1.22 +  CFLAGS="$CFLAGS $1"
    1.23 +
    1.24 +  AC_TRY_COMPILE([ ], [], [flag_ok=yes], [flag_ok=no])
    1.25 +  CFLAGS="$save_CFLAGS"
    1.26 +
    1.27 +  if test "X$flag_ok" = Xyes ; then
    1.28 +    $2
    1.29 +    true
    1.30 +  else
    1.31 +    $3
    1.32 +    true
    1.33 +  fi
    1.34 +  AC_MSG_RESULT([$flag_ok])
    1.35 +])
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/gst-gmyth/m4/as-version.m4	Tue May 01 16:36:58 2007 +0100
     2.3 @@ -0,0 +1,67 @@
     2.4 +dnl as-version.m4 0.1.0
     2.5 +
     2.6 +dnl autostars m4 macro for versioning
     2.7 +
     2.8 +dnl Thomas Vander Stichele <thomas at apestaart dot org>
     2.9 +
    2.10 +dnl $Id: as-version.m4,v 1.1 2005/06/18 18:02:46 burgerman Exp $
    2.11 +
    2.12 +dnl AS_VERSION(PACKAGE, PREFIX, MAJOR, MINOR, MICRO, NANO,
    2.13 +dnl            ACTION-IF-NO-NANO, [ACTION-IF-NANO])
    2.14 +
    2.15 +dnl example
    2.16 +dnl AS_VERSION(gstreamer, GST_VERSION, 0, 3, 2,)
    2.17 +dnl for a 0.3.2 release version
    2.18 +
    2.19 +dnl this macro
    2.20 +dnl - defines [$PREFIX]_MAJOR, MINOR and MICRO
    2.21 +dnl - if NANO is empty, then we're in release mode, else in cvs/dev mode
    2.22 +dnl - defines [$PREFIX], VERSION, and [$PREFIX]_RELEASE
    2.23 +dnl - executes the relevant action
    2.24 +dnl - AC_SUBST's PACKAGE, VERSION, [$PREFIX] and [$PREFIX]_RELEASE
    2.25 +dnl   as well as the little ones
    2.26 +dnl - doesn't call AM_INIT_AUTOMAKE anymore because it prevents
    2.27 +dnl   maintainer mode from running ok
    2.28 +dnl
    2.29 +dnl don't forget to put #undef [$2] and [$2]_RELEASE in acconfig.h
    2.30 +dnl if you use acconfig.h
    2.31 +
    2.32 +AC_DEFUN([AS_VERSION],
    2.33 +[
    2.34 +  PACKAGE=[$1]
    2.35 +  [$2]_MAJOR=[$3]
    2.36 +  [$2]_MINOR=[$4]
    2.37 +  [$2]_MICRO=[$5]
    2.38 +  NANO=[$6]
    2.39 +  [$2]_NANO=$NANO
    2.40 +  if test "x$NANO" = "x" || test "x$NANO" = "x0";
    2.41 +  then
    2.42 +      AC_MSG_NOTICE(configuring [$1] for release)
    2.43 +      VERSION=[$3].[$4].[$5]
    2.44 +      [$2]_RELEASE=1
    2.45 +      dnl execute action
    2.46 +      ifelse([$7], , :, [$7])
    2.47 +  else
    2.48 +      AC_MSG_NOTICE(configuring [$1] for development with nano $NANO)
    2.49 +      VERSION=[$3].[$4].[$5].$NANO
    2.50 +      [$2]_RELEASE=0.`date +%Y%m%d.%H%M%S`
    2.51 +      dnl execute action
    2.52 +      ifelse([$8], , :, [$8])
    2.53 +  fi
    2.54 +
    2.55 +  [$2]=$VERSION
    2.56 +  AC_DEFINE_UNQUOTED([$2], "$[$2]", [Define the version])
    2.57 +  AC_SUBST([$2])
    2.58 +  AC_DEFINE_UNQUOTED([$2]_RELEASE, "$[$2]_RELEASE", [Define the release version])
    2.59 +  AC_SUBST([$2]_RELEASE)
    2.60 +
    2.61 +  AC_SUBST([$2]_MAJOR)
    2.62 +  AC_SUBST([$2]_MINOR)
    2.63 +  AC_SUBST([$2]_MICRO)
    2.64 +  AC_SUBST([$2]_NANO)
    2.65 +  AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Define the package name])
    2.66 +  AC_SUBST(PACKAGE)
    2.67 +  AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Define the version])
    2.68 +  AC_SUBST(VERSION)
    2.69 +])
    2.70 +
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/gst-gmyth/m4/gst-feature.m4	Tue May 01 16:36:58 2007 +0100
     3.3 @@ -0,0 +1,211 @@
     3.4 +dnl Perform a check for a feature for GStreamer
     3.5 +dnl Richard Boulton <richard-alsa@tartarus.org>
     3.6 +dnl Thomas Vander Stichele <thomas@apestaart.org> added useful stuff
     3.7 +dnl Last modification: 25/06/2001
     3.8 +dnl GST_CHECK_FEATURE(FEATURE-NAME, FEATURE-DESCRIPTION,
     3.9 +dnl                   DEPENDENT-PLUGINS, TEST-FOR-FEATURE,
    3.10 +dnl                   DISABLE-BY-DEFAULT, ACTION-IF-USE, ACTION-IF-NOTUSE)
    3.11 +dnl
    3.12 +dnl This macro adds a command line argument to enable the user to enable
    3.13 +dnl or disable a feature, and if the feature is enabled, performs a supplied
    3.14 +dnl test to check if the feature is available.
    3.15 +dnl
    3.16 +dnl The test should define HAVE_<FEATURE-NAME> to "yes" or "no" depending
    3.17 +dnl on whether the feature is available.
    3.18 +dnl
    3.19 +dnl The macro will set USE_<FEATURE-NAME> to "yes" or "no" depending on
    3.20 +dnl whether the feature is to be used.
    3.21 +dnl Thomas changed this, so that when USE_<FEATURE-NAME> was already set
    3.22 +dnl to no, then it stays that way.
    3.23 +dnl
    3.24 +dnl The macro will call AM_CONDITIONAL(USE_<<FEATURE-NAME>, ...) to allow
    3.25 +dnl the feature to control what is built in Makefile.ams.  If you want
    3.26 +dnl additional actions resulting from the test, you can add them with the
    3.27 +dnl ACTION-IF-USE and ACTION-IF-NOTUSE parameters.
    3.28 +dnl 
    3.29 +dnl FEATURE-NAME        is the name of the feature, and should be in
    3.30 +dnl                     purely upper case characters.
    3.31 +dnl FEATURE-DESCRIPTION is used to describe the feature in help text for
    3.32 +dnl                     the command line argument.
    3.33 +dnl DEPENDENT-PLUGINS   lists any plugins which depend on this feature.
    3.34 +dnl TEST-FOR-FEATURE    is a test which sets HAVE_<FEATURE-NAME> to "yes"
    3.35 +dnl                     or "no" depending on whether the feature is
    3.36 +dnl                     available.
    3.37 +dnl DISABLE-BY-DEFAULT  if "disabled", the feature is disabled by default,
    3.38 +dnl                     if any other value, the feature is enabled by default.
    3.39 +dnl ACTION-IF-USE       any extra actions to perform if the feature is to be
    3.40 +dnl                     used.
    3.41 +dnl ACTION-IF-NOTUSE    any extra actions to perform if the feature is not to
    3.42 +dnl                     be used.
    3.43 +dnl
    3.44 +dnl
    3.45 +dnl thomas :
    3.46 +dnl we also added a history.  
    3.47 +dnl GST_PLUGINS_YES will contain all plugins to be built
    3.48 +dnl                 that were checked through GST_CHECK_FEATURE
    3.49 +dnl GST_PLUGINS_NO will contain those that won't be built
    3.50 +
    3.51 +AC_DEFUN([GST_CHECK_FEATURE],
    3.52 +AC_MSG_NOTICE(***)
    3.53 +AC_MSG_NOTICE(*** checking plugin: [$3] ***)
    3.54 +AC_MSG_NOTICE(***)
    3.55 +[dnl
    3.56 +builtin(define, [gst_endisable], ifelse($5, [disabled], [enable], [disable]))dnl
    3.57 +dnl if it is set to NO, then don't even consider it for building
    3.58 +NOUSE=
    3.59 +if test "x$USE_[$1]" = "xno"; then
    3.60 +  NOUSE="yes"
    3.61 +fi
    3.62 +AC_ARG_ENABLE(translit([$1], A-Z, a-z),
    3.63 +  [  ]builtin(format, --%-26s gst_endisable %s, gst_endisable-translit([$1], A-Z, a-z), [$2]ifelse([$3],,,: [$3])),
    3.64 +  [ case "${enableval}" in
    3.65 +      yes) USE_[$1]=yes;;
    3.66 +      no) USE_[$1]=no;;
    3.67 +      *) AC_MSG_ERROR(bad value ${enableval} for --enable-translit([$1], A-Z, a-z)) ;;
    3.68 +    esac],
    3.69 +  [ USE_$1=]ifelse($5, [disabled], [no], [yes]))           dnl DEFAULT
    3.70 +
    3.71 +dnl *** set it back to no if it was preset to no
    3.72 +if test "x$NOUSE" = "xyes"; then
    3.73 +  USE_[$1]="no"
    3.74 +  AC_MSG_WARN(*** $3 pre-configured not to be built)
    3.75 +fi
    3.76 +NOUSE=
    3.77 +
    3.78 +dnl *** If it's enabled
    3.79 +
    3.80 +if test x$USE_[$1] = xyes; then
    3.81 +  dnl save compile variables before the test
    3.82 +
    3.83 +  gst_check_save_LIBS=$LIBS
    3.84 +  gst_check_save_LDFLAGS=$LDFLAGS
    3.85 +  gst_check_save_CFLAGS=$CFLAGS
    3.86 +  gst_check_save_CPPFLAGS=$CPPFLAGS
    3.87 +  gst_check_save_CXXFLAGS=$CXXFLAGS
    3.88 +
    3.89 +  HAVE_[$1]=no
    3.90 +  dnl TEST_FOR_FEATURE
    3.91 +  $4
    3.92 +
    3.93 +  LIBS=$gst_check_save_LIBS
    3.94 +  LDFLAGS=$gst_check_save_LDFLAGS
    3.95 +  CFLAGS=$gst_check_save_CFLAGS
    3.96 +  CPPFLAGS=$gst_check_save_CPPFLAGS
    3.97 +  CXXFLAGS=$gst_check_save_CXXFLAGS
    3.98 +
    3.99 +  dnl If it isn't found, unset USE_[$1]
   3.100 +  if test x$HAVE_[$1] = xno; then
   3.101 +    USE_[$1]=no
   3.102 +  fi
   3.103 +fi
   3.104 +dnl *** Warn if it's disabled or not found
   3.105 +if test x$USE_[$1] = xyes; then
   3.106 +  ifelse([$6], , :, [$6])
   3.107 +  if test "x$3" != "x"; then
   3.108 +    GST_PLUGINS_YES="\t[$3]\n$GST_PLUGINS_YES"
   3.109 +  fi
   3.110 +  AC_DEFINE(HAVE_[$1], , [support for features: $3])
   3.111 +else
   3.112 +  ifelse([$3], , :, [AC_MSG_NOTICE(*** These plugins will not be built: [$3])])
   3.113 +  if test "x$3" != "x"; then
   3.114 +    GST_PLUGINS_NO="\t[$3]\n$GST_PLUGINS_NO"
   3.115 +  fi
   3.116 +  ifelse([$7], , :, [$7])
   3.117 +fi
   3.118 +dnl *** Define the conditional as appropriate
   3.119 +AM_CONDITIONAL(USE_[$1], test x$USE_[$1] = xyes)
   3.120 +])
   3.121 +
   3.122 +dnl Use a -config program which accepts --cflags and --libs parameters
   3.123 +dnl to set *_CFLAGS and *_LIBS and check existence of a feature.
   3.124 +dnl Richard Boulton <richard-alsa@tartarus.org>
   3.125 +dnl Last modification: 26/06/2001
   3.126 +dnl GST_CHECK_CONFIGPROG(FEATURE-NAME, CONFIG-PROG-FILENAME, MODULES)
   3.127 +dnl
   3.128 +dnl This check was written for GStreamer: it should be renamed and checked
   3.129 +dnl for portability if you decide to use it elsewhere.
   3.130 +dnl
   3.131 +AC_DEFUN([GST_CHECK_CONFIGPROG],
   3.132 +[
   3.133 +  AC_PATH_PROG([$1]_CONFIG, [$2], no)
   3.134 +  if test x$[$1]_CONFIG = xno; then
   3.135 +    [$1]_LIBS=
   3.136 +    [$1]_CFLAGS=
   3.137 +    HAVE_[$1]=no
   3.138 +  else
   3.139 +    if [$2] --plugin-libs [$3] &> /dev/null; then
   3.140 +      [$1]_LIBS=`[$2] --plugin-libs [$3]`
   3.141 +    else
   3.142 +      [$1]_LIBS=`[$2] --libs [$3]`
   3.143 +    fi
   3.144 +    [$1]_CFLAGS=`[$2] --cflags [$3]`
   3.145 +    HAVE_[$1]=yes
   3.146 +  fi
   3.147 +  AC_SUBST([$1]_LIBS)
   3.148 +  AC_SUBST([$1]_CFLAGS)
   3.149 +])
   3.150 +
   3.151 +dnl Use AC_CHECK_LIB and AC_CHECK_HEADER to do both tests at once
   3.152 +dnl sets HAVE_module if we have it
   3.153 +dnl Richard Boulton <richard-alsa@tartarus.org>
   3.154 +dnl Last modification: 26/06/2001
   3.155 +dnl GST_CHECK_LIBHEADER(FEATURE-NAME, LIB NAME, LIB FUNCTION, EXTRA LD FLAGS, 
   3.156 +dnl                     HEADER NAME, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
   3.157 +dnl
   3.158 +dnl This check was written for GStreamer: it should be renamed and checked
   3.159 +dnl for portability if you decide to use it elsewhere.
   3.160 +dnl
   3.161 +AC_DEFUN([GST_CHECK_LIBHEADER],
   3.162 +[
   3.163 +  AC_CHECK_LIB([$2], [$3], HAVE_[$1]=yes, HAVE_[$1]=no,[$4])
   3.164 +  if test "x$HAVE_[$1]" = "xyes"; then
   3.165 +    AC_CHECK_HEADER([$5], :, HAVE_[$1]=no)
   3.166 +    if test "x$HAVE_[$1]" = "xyes"; then
   3.167 +      dnl execute what needs to be
   3.168 +      ifelse([$6], , :, [$6])
   3.169 +    else
   3.170 +      ifelse([$7], , :, [$7])
   3.171 +    fi
   3.172 +  else
   3.173 +    ifelse([$7], , :, [$7])
   3.174 +  fi
   3.175 +  AC_SUBST(HAVE_[$1])
   3.176 +]
   3.177 +)
   3.178 +
   3.179 +dnl 2004-02-14 Thomas - changed to get set properly and use proper output
   3.180 +dnl 2003-06-27 Benjamin Otte - changed to make this work with gstconfig.h
   3.181 +dnl
   3.182 +dnl Add a subsystem --disable flag and all the necessary symbols and substitions
   3.183 +dnl
   3.184 +dnl GST_CHECK_SUBSYSTEM_DISABLE(SYSNAME, [subsystem name])
   3.185 +dnl
   3.186 +AC_DEFUN([GST_CHECK_SUBSYSTEM_DISABLE],
   3.187 +[
   3.188 +  dnl this define will replace each literal subsys_def occurrence with
   3.189 +  dnl the lowercase hyphen-separated subsystem
   3.190 +  dnl e.g. if $1 is GST_DEBUG then subsys_def will be a macro with gst-debug
   3.191 +  define([subsys_def],translit([$1], _A-Z, -a-z))
   3.192 +
   3.193 +  AC_ARG_ENABLE(subsys_def, 
   3.194 +    AC_HELP_STRING(--disable-subsys_def, [disable $2]),
   3.195 +    [
   3.196 +      case "${enableval}" in
   3.197 +        yes) GST_DISABLE_[$1]=no ;;
   3.198 +        no) GST_DISABLE_[$1]=yes ;;
   3.199 +        *) AC_MSG_ERROR([bad value ${enableval} for --enable-subsys_def]) ;;
   3.200 +       esac
   3.201 +    ],
   3.202 +    [GST_DISABLE_[$1]=no]) dnl Default value
   3.203 +
   3.204 +  if test x$GST_DISABLE_[$1] = xyes; then
   3.205 +    AC_MSG_NOTICE([disabled subsystem [$2]])
   3.206 +    GST_DISABLE_[$1]_DEFINE="#define GST_DISABLE_$1 1" 
   3.207 +  else
   3.208 +    GST_DISABLE_[$1]_DEFINE="/* #undef GST_DISABLE_$1 */"
   3.209 +  fi
   3.210 +  AC_SUBST(GST_DISABLE_[$1]_DEFINE)
   3.211 +  undefine([subsys_def])
   3.212 +])
   3.213 +
   3.214 +