[opus] Patch for Opusfile build system

Simon Jackson si at sonocent.com
Wed May 27 09:29:10 PDT 2015


Hi,

I’d like to submit a patch to add an option to configure to stop the examples being built. They were causing me some issues when building static libraries for multiple architectures which were merged into a fat binary and I thought that rather than hack Makefile.am to stop them being built, I would add the option correctly and submit a patch. 

I hope it’s acceptable,
Simon



From 8e31cf19fef7a7db519d48f029557cd49971ef9f Mon Sep 17 00:00:00 2001
From: Simon Jackson <si at sonocent.com>
Date: Wed, 27 May 2015 16:19:02 +0100
Subject: [PATCH] Added configure option to stop examples being built,
 --disable-examples.

- Added new configure option --disable-examples which can be used to
  stop the example programs being built. This can be useful in some
  situations, such as when cross compiling static libraries.

- Examples are still built by default, --disable-examples must be passed
  explicitly to stop them being built.
---
 Makefile.am  | 2 ++
 configure.ac | 6 ++++++
 2 files changed, 8 insertions(+)

diff --git a/Makefile.am b/Makefile.am
index 59633c3..184268e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -21,7 +21,9 @@ libopusurl_la_LIBADD = libopusfile.la $(URL_DEPS_LIBS)
 libopusurl_la_LDFLAGS = -no-undefined \
  -version-info @OP_LT_CURRENT@:@OP_LT_REVISION@:@OP_LT_AGE@
 
+if OP_ENABLE_EXAMPLES
 noinst_PROGRAMS = examples/opusfile_example examples/seeking_example
+endif
 
 examples_opusfile_example_SOURCES = examples/opusfile_example.c
 examples_seeking_example_SOURCES = examples/seeking_example.c
diff --git a/configure.ac b/configure.ac
index d68666c..83de37d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -124,6 +124,11 @@ AS_IF([test "$enable_fixed_point" = "yes"],
   ]
 )
 
+AC_ARG_ENABLE([examples],
+  AS_HELP_STRING([--disable-examples], [Disable building of examples]),,
+  enable_examples=yes)
+AM_CONDITIONAL([OP_ENABLE_EXAMPLES], [test "$enable_examples" = "yes"])
+
 AS_CASE(["$ac_cv_search_lrintf"],
   ["no"],[],
   ["none required"],[],
@@ -172,6 +177,7 @@ AC_MSG_NOTICE([
 
     Hidden visibility ............ ${cc_cv_flag_visibility}
 
+    Building Examples ............ ${enable_examples}
     API documentation ............ ${enable_doc}
 ------------------------------------------------------------------------
 ])
-- 
2.4.1


More information about the opus mailing list