adding more m4
authorThomas Vander Stichele <thomas@apestaart.org>
Sat, 9 Feb 2002 21:15:35 +0000 (21:15 +0000)
committerThomas Vander Stichele <thomas@apestaart.org>
Sat, 9 Feb 2002 21:15:35 +0000 (21:15 +0000)
Original commit message from CVS:
adding more m4

m4/gst-arch.m4 [new file with mode: 0644]
m4/gst-doc.m4 [new file with mode: 0644]
m4/gst-feature.m4 [new file with mode: 0644]

diff --git a/m4/gst-arch.m4 b/m4/gst-arch.m4
new file mode 100644 (file)
index 0000000..7e07049
--- /dev/null
@@ -0,0 +1,65 @@
+AC_DEFUN(GST_ARCH, [
+dnl Set up conditionals for (target) architecture:
+dnl ==============================================
+
+dnl Determine CPU
+case "x${target_cpu}" in
+  xi?86 | k?) HAVE_CPU_I386=yes
+              AC_DEFINE(HAVE_CPU_I386, 1, [Define if the target CPU is an 
+x86])
+              dnl FIXME could use some better detection
+              dnl       (ie CPUID)
+              case "x${target_cpu}" in
+                xi386 | xi486) ;;
+                *)             AC_DEFINE(HAVE_RDTSC) ;;
+              esac ;;
+  xpowerpc)   HAVE_CPU_PPC=yes
+              AC_DEFINE(HAVE_CPU_PPC, 1, [Define if the target CPU is a 
+PPC]) ;;
+  xalpha)     HAVE_CPU_ALPHA=yes
+              AC_DEFINE(HAVE_CPU_ALPHA, 1, [Define if the target CPU is an 
+Alpha]) ;;
+  xarm*)      HAVE_CPU_ARM=yes
+              AC_DEFINE(HAVE_CPU_ARM, 1, [Define if the target CPU is an 
+ARM]) ;;
+  xsparc*)    HAVE_CPU_SPARC=yes
+              AC_DEFINE(HAVE_CPU_SPARC, 1, [Define if the target CPU is a 
+PPC]) ;;
+  xmips*)     HAVE_CPU_MIPS=yes
+              AC_DEFINE(HAVE_CPU_MIPS, 1, [Define if the target CPU is a 
+MIPS]) ;;
+  xhppa*)     HAVE_CPU_HPPA=yes
+              AC_DEFINE(HAVE_CPU_HPPA, 1, [Define if the target CPU is a 
+HPPA]) ;;
+esac
+
+dnl Determine endianness
+AC_C_BIGENDIAN
+
+dnl Check for MMX-capable compiler
+AC_MSG_CHECKING(for MMX-capable compiler)
+AC_TRY_RUN([
+#include "include/mmx.h"
+
+main()
+{ movq_r2r(mm0, mm1); return 0; }
+],
+[
+HAVE_LIBMMX="yes"
+AC_MSG_RESULT(yes)
+],
+HAVE_LIBMMX="no"
+AC_MSG_RESULT(no)
+,
+HAVE_LIBMMX="no"
+AC_MSG_RESULT(no)
+)
+
+AM_CONDITIONAL(HAVE_CPU_I386,       test "x$HAVE_CPU_I386" = "xyes")
+AM_CONDITIONAL(HAVE_CPU_PPC,        test "x$HAVE_CPU_PPC" = "xyes")
+AM_CONDITIONAL(HAVE_CPU_ALPHA,      test "x$HAVE_CPU_ALPHA" = "xyes")
+AM_CONDITIONAL(HAVE_CPU_ARM,        test "x$HAVE_CPU_ARM" = "xyes")
+AM_CONDITIONAL(HAVE_CPU_SPARC,      test "x$HAVE_CPU_SPARC" = "xyes")
+AM_CONDITIONAL(HAVE_LIBMMX,         test "x$USE_LIBMMX" = "xyes")
+
+])
diff --git a/m4/gst-doc.m4 b/m4/gst-doc.m4
new file mode 100644 (file)
index 0000000..1d7fff5
--- /dev/null
@@ -0,0 +1,90 @@
+AC_DEFUN(GST_DOC, [
+AC_ARG_WITH(html-dir, AC_HELP_STRING([--with-html-dir=PATH], [path to installed docs]))
+
+if test "x$with_html_dir" = "x" ; then
+  HTML_DIR='${datadir}/gst/html'
+else
+  HTML_DIR=$with_html_dir
+fi
+
+AC_SUBST(HTML_DIR)
+
+dnl check for gtk-doc
+AC_CHECK_PROG(HAVE_GTK_DOC, gtkdoc-scangobj, true, false)
+gtk_doc_min_version=0.6
+if $HAVE_GTK_DOC ; then
+    gtk_doc_version=`gtkdoc-mkdb --version`
+    AC_MSG_CHECKING([gtk-doc version ($gtk_doc_version) >= 
+$gtk_doc_min_version])
+    if perl <<EOF ; then
+      exit (("$gtk_doc_version" =~ /^[[0-9]]+\.[[0-9]]+$/) &&
+            ("$gtk_doc_version" >= "$gtk_doc_min_version") ? 0 : 1);
+EOF
+      AC_MSG_RESULT(yes)
+   else
+      AC_MSG_RESULT(no)
+      HAVE_GTK_DOC=false
+   fi
+fi
+# don't you love undocumented command line options?
+GTK_DOC_SCANOBJ="gtkdoc-scangobj --nogtkinit"
+AC_SUBST(HAVE_GTK_DOC)
+AC_SUBST(GTK_DOC_SCANOBJ)
+
+dnl check for docbook tools
+AC_CHECK_PROG(HAVE_XSLTPROC, xsltproc, true, false)
+AC_CHECK_PROG(HAVE_PDFTOPS, pdftops, true, false)
+dnl this does not yet work properly, at least on debian -- wingo
+HAVE_PDFXMLTEX=false
+
+dnl check for image conversion tool
+AC_CHECK_PROG(HAVE_FIG2DEV, fig2dev, true, false)
+
+dnl The following is a hack: if fig2dev doesn't display an error message
+dnl for the desired type, we assume it supports it.
+HAVE_FIG2DEV_PNG=false
+if test "x$HAVE_FIG2DEV" = "xtrue" ; then
+  fig2dev_quiet=`fig2dev -L png </dev/null 2>&1 >/dev/null`
+  if test "x$fig2dev_quiet" = "x" ; then
+    HAVE_FIG2DEV_PNG=true
+  fi
+fi
+HAVE_FIG2DEV_PDF=false
+if test "x$HAVE_FIG2DEV" = "xtrue" ; then
+  fig2dev_quiet=`fig2dev -L pdf </dev/null 2>&1 >/dev/null`
+  if test "x$fig2dev_quiet" = "x" ; then
+    HAVE_FIG2DEV_PDF=true
+  fi
+fi
+
+AC_ARG_ENABLE(docs-build,
+AC_HELP_STRING([--enable-docs-build][enable building of documentation]),
+[case "${enableval}" in
+  yes) if $HAVE_GTK_DOC; then BUILD_DOCS=yes; else AC_MSG_ERROR([you don't have gtk-doc, so don't use --docs-build]); fi; ;;
+  no)  BUILD_DOCS=no ;;
+  *) AC_MSG_ERROR(bad value ${enableval} for --enable-docs-build) ;;
+esac],
+[BUILD_DOCS=no]) dnl Default value
+
+dnl AC_ARG_ENABLE(plugin-docs,
+dnl [  --enable-plugin-docs         enable the building of plugin documentation
+dnl                                (this is currently broken, so off by default)],
+dnl [case "${enableval}" in
+dnl   yes) BUILD_PLUGIN_DOCS=yes ;;
+dnl   no)  BUILD_PLUGIN_DOCS=no ;;
+dnl   *) AC_MSG_ERROR(bad value ${enableval} for --enable-plugin-docs) ;;
+dnl esac], 
+dnl [BUILD_PLUGIN_DOCS=no]) dnl Default value
+BUILD_PLUGIN_DOCS=no
+
+AM_CONDITIONAL(HAVE_GTK_DOC,        $HAVE_GTK_DOC)
+AM_CONDITIONAL(BUILD_DOCS,          test "x$BUILD_DOCS" = "xyes")
+AM_CONDITIONAL(BUILD_PLUGIN_DOCS,   test "x$BUILD_PLUGIN_DOCS" = "xyes")
+AM_CONDITIONAL(HAVE_PDFXMLTEX,      $HAVE_PDFXMLTEX)
+AM_CONDITIONAL(HAVE_PDFTOPS,        $HAVE_PDFTOPS)
+AM_CONDITIONAL(HAVE_XSLTPROC,       $HAVE_XSLTPROC)
+AM_CONDITIONAL(HAVE_FIG2DEV_PNG,    $HAVE_FIG2DEV_PNG)
+AM_CONDITIONAL(HAVE_FIG2DEV_PDF,    $HAVE_FIG2DEV_PDF)
+
+])
+
diff --git a/m4/gst-feature.m4 b/m4/gst-feature.m4
new file mode 100644 (file)
index 0000000..a0dc39c
--- /dev/null
@@ -0,0 +1,182 @@
+dnl Perform a check for a feature for GStreamer
+dnl Richard Boulton <richard-alsa@tartarus.org>
+dnl Thomas Vander Stichele <thomas@apestaart.org> added useful stuff
+dnl Last modification: 25/06/2001
+dnl GST_CHECK_FEATURE(FEATURE-NAME, FEATURE-DESCRIPTION,
+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
+dnl test to check if the feature is available.
+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 Thomas changed this, so that when USE_<FEATURE-NAME> was already set
+dnl to no, then it stays that way.
+dnl
+dnl The macro will call AM_CONDITIONAL(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
+dnl                     the command line argument.
+dnl DEPENDENT-PLUGINS   lists any plugins which depend on this feature.
+dnl TEST-FOR-FEATURE    is a test which sets HAVE_<FEATURE-NAME> to "yes"
+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
+dnl
+dnl thomas :
+dnl we also added a history.  
+dnl GST_PLUGINS_YES will contain all plugins to be built
+dnl                 that were checked through GST_CHECK_FEATURE
+dnl GST_PLUGINS_NO will contain those that won't be built
+
+AC_DEFUN(GST_CHECK_FEATURE,
+[dnl
+builtin(define, [gst_endisable], ifelse($5, [disabled], [enable], [disable]))dnl
+dnl if it is set to NO, then don't even consider it for building
+NOUSE=
+if test "x$USE_[$1]" = "xno"; then
+  NOUSE="yes"
+fi
+AC_ARG_ENABLE(translit([$1], A-Z, a-z),
+  [  ]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;;
+      *) AC_MSG_ERROR(bad value ${enableval} for --enable-translit([$1], A-Z, a-z)) ;;
+    esac],
+  [ USE_$1=]ifelse($5, [disabled], [no], [yes]))           dnl DEFAULT
+
+dnl *** set it back to no if it was preset to no
+if test "x$NOUSE" = "xyes"; then
+  USE_[$1]="no"
+  AC_MSG_WARN(*** $3 pre-configured not to be built)
+fi
+NOUSE=
+
+dnl *** If it's enabled
+
+if test x$USE_[$1] = xyes; then
+  gst_check_save_LIBS=$LIBS
+  gst_check_save_LDFLAGS=$LDFLAGS
+  gst_check_save_CFLAGS=$CFLAGS
+  gst_check_save_CPPFLAGS=$CPPFLAGS
+  gst_check_save_CXXFLAGS=$CXXFLAGS
+  HAVE_[$1]=no
+  $4
+  LIBS=$gst_check_save_LIBS
+  LDFLAGS=$gst_check_save_LDFLAGS
+  CFLAGS=$gst_check_save_CFLAGS
+  CPPFLAGS=$gst_check_save_CPPFLAGS
+  CXXFLAGS=$gst_check_save_CXXFLAGS
+
+  dnl If it isn't found, unset USE_[$1]
+  if test x$HAVE_[$1] = xno; then
+    USE_[$1]=no
+  fi
+fi
+dnl *** Warn if it's disabled or not found
+if test x$USE_[$1] = xyes; then
+  ifelse([$6], , :, [$6])
+  GST_PLUGINS_YES="$GST_PLUGINS_YES \n\t[$3]"
+else
+  ifelse([$3], , :, [AC_MSG_NOTICE(
+These plugins will not be built: [$3]
+)])
+  GST_PLUGINS_NO="$GST_PLUGINS_NO \n\t[$3]"
+  ifelse([$7], , :, [$7])
+fi
+dnl *** Define the conditional as appropriate
+AM_CONDITIONAL(USE_[$1], test x$USE_[$1] = xyes)
+])
+
+dnl Use a -config program which accepts --cflags and --libs parameters
+dnl to set *_CFLAGS and *_LIBS and check existence of a feature.
+dnl Richard Boulton <richard-alsa@tartarus.org>
+dnl Last modification: 26/06/2001
+dnl GST_CHECK_CONFIGPROG(FEATURE-NAME, CONFIG-PROG-FILENAME, MODULES)
+dnl
+dnl This check was written for GStreamer: it should be renamed and checked
+dnl for portability if you decide to use it elsewhere.
+dnl
+AC_DEFUN(GST_CHECK_CONFIGPROG,
+[
+  AC_PATH_PROG([$1]_CONFIG, [$2], no)
+  if test x$[$1]_CONFIG = xno; then
+    [$1]_LIBS=
+    [$1]_CFLAGS=
+    HAVE_[$1]=no
+  else
+    [$1]_LIBS=`[$2] --libs [$3]`
+    [$1]_CFLAGS=`[$2] --cflags [$3]`
+    HAVE_[$1]=yes
+  fi
+  AC_SUBST([$1]_LIBS)
+  AC_SUBST([$1]_CFLAGS)
+])
+
+dnl Use AC_CHECK_LIB and AC_CHECK_HEADER to do both tests at once
+dnl sets HAVE_module if we have it
+dnl Richard Boulton <richard-alsa@tartarus.org>
+dnl Last modification: 26/06/2001
+dnl GST_CHECK_LIBHEADER(FEATURE-NAME, LIB NAME, LIB FUNCTION, EXTRA LD FLAGS, 
+dnl                     HEADER NAME, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
+dnl
+dnl This check was written for GStreamer: it should be renamed and checked
+dnl for portability if you decide to use it elsewhere.
+dnl
+AC_DEFUN(GST_CHECK_LIBHEADER,
+[
+  AC_CHECK_LIB([$2], [$3], HAVE_[$1]=yes, HAVE_[$1]=no,[$4])
+  if test "x$HAVE_[$1]" = "xyes"; then
+    AC_CHECK_HEADER([$5], :, HAVE_[$1]=no)
+    if test "x$HAVE_[$1]" = "xyes"; then
+      dnl execute what needs to be
+      ifelse([$6], , :, [$6])
+    else
+      ifelse([$7], , :, [$7])
+    fi
+  else
+    AC_MSG_WARN([$1] not found)
+  fi
+  AC_SUBST(HAVE_[$1])
+]
+)
+
+dnl
+dnl Add a subsystem --disable flag and all the necessary symbols and substitions
+dnl
+dnl GST_SUBSYSTEM_DISABLE(SYSNAME, [subsystem name])
+dnl
+AC_DEFUN(GST_SUBSYSTEM_DISABLE,
+[AC_ARG_ENABLE(translit([$1], A-Z, a-z), 
+[  ]builtin(format, --disable-%-17s  disable %s, translit([$1], A-Z, a-z), $2),
+[ case "${enableval}" in
+    yes) GST_DISABLE_[$1]=no ;;
+    no) GST_DISABLE_[$1]=yes ;;
+    *) AC_MSG_ERROR(bad value ${enableval} for --enable-translit([$1], A-Z, a-z)) ;;
+  esac],
+[GST_DISABLE_[$1]=no]) dnl Default value
+if test x$GST_DISABLE_[$1] = xyes; then
+  AC_DEFINE(GST_DISABLE_[$1], 1, [Disable $2])
+  GST_DISABLE_[$1]_DEFINE=-DGST_DISABLE_[$1]
+fi
+AM_CONDITIONAL(GST_DISABLE_[$1], test x$GST_DISABLE_[$1] = xyes)
+AC_SUBST(GST_DISABLE_[$1]_DEFINE)
+GST_SUBSYSTEM_DISABLE_DEFINES="$GST_SUBSYTEM_DISABLE_DEFINES $GST_DISABLE_[$1]_DEFINE"
+])