diff --git a/configure.in b/configure.in
index 9bbae797..effd1f4d 100644
--- a/configure.in
+++ b/configure.in
@@ -230,6 +230,16 @@ if test "x$enable_xmms_plugin" != xfalse ; then
fi
AM_CONDITIONAL(FLaC__HAS_XMMS, test -n "$XMMS_INPUT_PLUGIN_DIR")
+dnl build FLAC++ or not
+AC_ARG_ENABLE([cpplibs],
+AC_HELP_STRING([--disable-cpplibs], [Do not build libFLAC++]),
+[case "${enableval}" in
+ yes) disable_cpplibs=false ;;
+ no) disable_cpplibs=true ;;
+ *) AC_MSG_ERROR(bad value ${enableval} for --enable-cpplibs) ;;
+esac], [disable_cpplibs=false])
+AM_CONDITIONAL(FLaC__WITH_CPPLIBS, [test "x$disable_cpplibs" != xtrue])
+
dnl check for ogg library
AC_ARG_ENABLE([ogg],
AC_HELP_STRING([--disable-ogg], [Disable ogg support (default: test for libogg)]),
diff --git a/doc/html/changelog.html b/doc/html/changelog.html
index a2a57b6e..e3030965 100644
--- a/doc/html/changelog.html
+++ b/doc/html/changelog.html
@@ -101,6 +101,7 @@
build system:
+ - New configure option --disable-cpplibs to prevent building libFLAC++ (SF #1723295).
- Fixed bug compiling flac without Ogg support (SF #1760786).
- Fixed bug where sometimes an existing installation of flac could interfere with the build process (SF #1763690).
- Some MinGW fixes (SF #1684879).
diff --git a/include/Makefile.am b/include/Makefile.am
index bc60d786..b45dc840 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -15,4 +15,8 @@
# restrictive of those mentioned above. See the file COPYING.Xiph in this
# distribution.
-SUBDIRS = FLAC FLAC++ share test_libs_common
+if FLaC__WITH_CPPLIBS
+CPPLIBS_DIRS = FLAC++
+endif
+
+SUBDIRS = FLAC $(CPPLIBS_DIRS) share test_libs_common
diff --git a/src/Makefile.am b/src/Makefile.am
index 298eb17e..131383e6 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -19,9 +19,12 @@ if FLaC__HAS_XMMS
XMMS_DIRS = plugin_common plugin_xmms
endif
+if FLaC__WITH_CPPLIBS
+CPPLIBS_DIRS = libFLAC++ test_libFLAC++
+endif
+
SUBDIRS = \
libFLAC \
- libFLAC++ \
share \
flac \
metaflac \
@@ -31,9 +34,9 @@ SUBDIRS = \
test_grabbag \
test_libs_common \
test_libFLAC \
- test_libFLAC++ \
test_seeking \
- test_streams
+ test_streams \
+ $(CPPLIBS_DIRS)
EXTRA_DIST = \
Makefile.lite
diff --git a/test/Makefile.am b/test/Makefile.am
index 263450ca..13dc9cb4 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -15,13 +15,17 @@
# restrictive of those mentioned above. See the file COPYING.Xiph in this
# distribution.
+if FLaC__WITH_CPPLIBS
+CPPLIBS_TESTS = test_libFLAC++.sh
+endif
+
TESTS_ENVIRONMENT = FLAC__TEST_LEVEL=@FLAC__TEST_LEVEL@ FLAC__TEST_WITH_VALRGIND=@FLAC__TEST_WITH_VALGRIND@
SUBDIRS = cuesheets flac-to-flac-metadata-test-files metaflac-test-files pictures
TESTS = \
./test_libFLAC.sh \
- ./test_libFLAC++.sh \
+ $(CPPLIBS_TESTS) \
./test_grabbag.sh \
./test_flac.sh \
./test_metaflac.sh \
@@ -35,7 +39,7 @@ EXTRA_DIST = \
metaflac.flac.ok \
picture.ok \
test_libFLAC.sh \
- test_libFLAC++.sh \
+ $(CPPLIBS_TESTS) \
test_flac.sh \
test_metaflac.sh \
test_grabbag.sh \