From 36a412f6e4693a2505ba1a3a861bd1598e33878b Mon Sep 17 00:00:00 2001 From: Andrew Udvare Date: Wed, 28 Jan 2015 16:11:26 -0800 Subject: [PATCH] Add --with-system-pcre; allow building against system PCRE library --- configure.ac | 15 +++++++++++++++ src/Makefile.am | 12 ++++++++---- src/RageUtil.cpp | 4 ++++ 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index e875775951..9cb0d610a2 100644 --- a/configure.ac +++ b/configure.ac @@ -388,6 +388,21 @@ AC_SUBST(RESFLAGS) dnl Add these after all tests are done as they don't exist just yet. LIBS="$LIBS $FFMPEG_LIBS" +# Selection between bundled pcre and system pcre +AC_ARG_WITH(system-pcre, AS_HELP_STRING([--with-system-pcre],[Disable building of bundled libpcre]), with_system_pcre=$withval, with_system_pcre=no) +AM_CONDITIONAL(USE_SYSTEM_PCRE, test "$with_system_pcre" == "yes") + +if test "$with_system_pcre" == "yes"; then + have_libpcre=yes + AC_CHECK_HEADER(pcre.h, , have_libpcre=no) + if test "$have_libpcre" = "no"; then + AC_MSG_ERROR([If you want to use system libpcre, please make sure that it is installed. Otherwise please configure with --without-system-pcre.]) + else + AC_DEFINE([USE_SYSTEM_PCRE], 1, [Build with system libpcre]) + LIBS="$LIBS -lpcre" + fi +fi + AC_CONFIG_FILES(Makefile) AC_CONFIG_FILES(bundle/Makefile) AC_CONFIG_FILES(src/Makefile) diff --git a/src/Makefile.am b/src/Makefile.am index bda964f867..3031b65d04 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -486,8 +486,13 @@ ScoreDisplayNormal.cpp ScoreDisplayNormal.h ScoreDisplayOni.cpp ScoreDisplayOni. ScoreDisplayPercentage.cpp ScoreDisplayPercentage.h ScoreDisplayRave.cpp ScoreDisplayRave.h \ SongPosition.cpp SongPosition.h -PCRE = ../extern/pcre/get.c ../extern/pcre/internal.h ../extern/pcre/maketables.c ../extern/pcre/pcre.c ../extern/pcre/pcre.h ../extern/pcre/study.c +Rage = +all_test_SOURCES = +if !USE_SYSTEM_PCRE +Rage += ../extern/pcre/get.c ../extern/pcre/internal.h ../extern/pcre/maketables.c ../extern/pcre/pcre.c ../extern/pcre/pcre.h ../extern/pcre/study.c +all_test_SOURCES += ../extern/pcre/get.c ../extern/pcre/internal.h ../extern/pcre/maketables.c ../extern/pcre/pcre.c ../extern/pcre/pcre.h ../extern/pcre/study.c EXTRA_DIST += ../extern/pcre/chartables.c +endif Lua = ../extern/lua-5.1/src/lapi.c ../extern/lua-5.1/src/lauxlib.c ../extern/lua-5.1/src/lbaselib.c ../extern/lua-5.1/src/lcode.c ../extern/lua-5.1/src/ldblib.c \ ../extern/lua-5.1/src/ldebug.c ../extern/lua-5.1/src/ldo.c ../extern/lua-5.1/src/ldump.c ../extern/lua-5.1/src/lfunc.c ../extern/lua-5.1/src/lgc.c ../extern/lua-5.1/src/linit.c \ @@ -523,7 +528,7 @@ RageFileDriverReadAhead.cpp RageFileDriverReadAhead.h \ RageFileDriverSlice.cpp RageFileDriverSlice.h \ RageFileDriverTimeout.cpp RageFileDriverTimeout.h -Rage = $(PCRE) $(Lua) $(jsoncpp) $(RageFile) $(RageSoundFileReaders) \ +Rage += $(Lua) $(jsoncpp) $(RageFile) $(RageSoundFileReaders) \ CubicSpline.cpp CubicSpline.h \ RageBitmapTexture.cpp RageBitmapTexture.h \ RageDisplay.cpp RageDisplay.h \ @@ -769,9 +774,8 @@ if HAVE_GTK GtkModule_so_SOURCES = arch/LoadingWindow/LoadingWindow_GtkModule.cpp endif -all_test_SOURCES = \ +all_test_SOURCES += \ $(ArchUtils) \ - $(PCRE) \ $(RageFile) \ $(Lua) \ $(ArchHooks) \ diff --git a/src/RageUtil.cpp b/src/RageUtil.cpp index c2d033f87e..b61b3f12b3 100644 --- a/src/RageUtil.cpp +++ b/src/RageUtil.cpp @@ -1342,7 +1342,11 @@ bool GetFileContents( const RString &sFile, vector &asOut ) return true; } +#ifndef USE_SYSTEM_PCRE #include "../extern/pcre/pcre.h" +#else +#include +#endif void Regex::Compile() { const char *error;