Skip to content

Commit

Permalink
Merged --with-re2 configure changes from rel21
Browse files Browse the repository at this point in the history
  • Loading branch information
deogar committed Nov 12, 2013
1 parent a6c33be commit 2f0a6d6
Show file tree
Hide file tree
Showing 4 changed files with 123 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ LIBSTEMMER_DIRS =
endif

if USE_RE2
LIBRE2_DIRS = libre2
LIBRE2_DIRS = $(LIBRE2_PATH)
else
LIBRE2_DIRS =
endif
Expand Down
95 changes: 95 additions & 0 deletions acinclude.m4
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,101 @@ fi
])

dnl ---------------------------------------------------------------------------
dnl Macro: AC_CHECK_RE2
dnl Check user-specified path in --with-re2=*, then check ./libre2 path.
dnl Finally check for installed libraries and headers if present.
dnl Also libraries and headers paths can be given using --with-re2-libs and
dnl --with-re2-includes
dnl ---------------------------------------------------------------------------

AC_DEFUN([AC_CHECK_RE2],[
# Includes and libraries
LIBRE2_CFLAGS=
LIBRE2_LIBS=
# First check if include path was explicitly given.
# If so, it has the maximum priority over any other possibilities
if test [ -n "$ac_cv_use_re2" -a x$ac_cv_use_re2 != xyes]; then
re2include=$ac_cv_use_re2
if test [ -f $re2include/re2/re2.h ]; then
LIBRE2_CFLAGS="-I$re2include"
LIBRE2_LIBS="$re2include/obj/libre2.a"
# Use re2 Makefile if present
if test [ -f $re2include/Makefile ]; then
LIBRE2_PATH="$re2include"
fi
fi
else
# Check if there any sources in ./libre2 path
if test -d ./libre2 && test -f ./libre2/re2/re2.h; then
ac_cv_use_re2=yes
LIBRE2_LIBS="\$(top_srcdir)/libre2/obj/libre2.a"
LIBRE2_CFLAGS="-I\$(top_srcdir)/libre2"
LIBRE2_PATH="libre2"
else
# Possible include paths
re2includedirs="/usr/include /usr/include/re2"
# Possible libraries paths
re2libdirs="/usr/lib/x86_64-linux-gnu /usr/lib64 /usr/local/lib64 /usr/lib/i386-linux-gnu /usr/lib /usr/local/lib"
# Trying to find installed header files
for re2includedir in $re2includedirs
do
if test [ -f $re2includedir/re2/re2.h ]; then
LIBRE2_CFLAGS="-I$re2includedir"
break
fi
done
# Trying to find installed libraries
for re2libdir in $re2libdirs
do
if test [ -f $re2libdir/libre2.a ]; then
LIBRE2_LIBS="$re2libdir/libre2.a"
break 2
fi
done
fi
fi
# Apply explicit include path overrides
if test x$ac_cv_re2_includes != xno; then
if test [ -f $ac_cv_re2_includes/re2/re2.h ]; then
LIBRE2_CFLAGS="-I$ac_cv_re2_includes"
else
AC_MSG_ERROR([missing re2 headers])
fi
fi
# Apply explicit lib path overrides
if test x$ac_cv_re2_libs != xno; then
if test [ -f "$ac_cv_re2_libs" ]; then
LIBRE2_LIBS="$ac_cv_re2_libs"
else
AC_MSG_ERROR([missing re2 library libre2.a])
fi
fi
# Now we either have re2, or not
if test [ -z "$LIBRE2_LIBS" ]; then
AC_MSG_ERROR([missing re2 sources])
fi
])

dnl ---------------------------------------------------------------------------
dnl Macro: SPHINX_CONFIGURE_PART
dnl
Expand Down
33 changes: 26 additions & 7 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -413,13 +413,29 @@ AC_ARG_WITH([re2],
)

AC_MSG_CHECKING([whether to compile with re2 library support])

AC_ARG_WITH([re2-includes],
AC_HELP_STRING([--with-re2-includes], [path to re2 header files]),
[ac_cv_re2_includes=$withval], [ac_cv_re2_includes=no]
)

AC_ARG_WITH([re2-libs],
AC_HELP_STRING([--with-re2-libs], [path to re2 libraries]),
[ac_cv_re2_libs=$withval], [ac_cv_re2_libs=no]
)

# First check if user supplied --with-re2-libs and --with-re2-includes
if test x$ac_cv_re2_libs != xno && test x$ac_cv_re2_includes != xno; then
ac_cv_use_re2=yes
fi

if test x$ac_cv_use_re2 != xno; then
if test -d libre2 && test -f libre2/re2/re2.h; then
AC_MSG_RESULT([yes])
AC_DEFINE(USE_RE2, 1, [RE2 library support])
else
AC_MSG_ERROR([missing re2 sources from libre2])
fi
AC_CHECK_RE2
AC_MSG_RESULT([yes, $LIBRE2_CFLAGS])
AC_DEFINE(USE_RE2, 1, [RE2 library support])
AC_SUBST([LIBRE2_LIBS])
AC_SUBST([LIBRE2_CFLAGS])
AC_SUBST([LIBRE2_PATH])
else
AC_MSG_RESULT([no])
AC_DEFINE(USE_RE2, 0, [re2 library support])
Expand All @@ -428,6 +444,9 @@ AM_CONDITIONAL(USE_RE2, test x$ac_cv_use_re2 != xno)

dnl ---

# we can now set preprocessor flags for both C and C++ compilers
CPPFLAGS="$CPPFLAGS $MYSQL_CFLAGS $PGSQL_CFLAGS $LIBRE2_CFLAGS"

AC_ARG_WITH([rlp],
AC_HELP_STRING([--with-rlp], [compile with RLP library support (default is disabled)]),
[ac_cv_use_rlp=$withval], [ac_cv_use_rlp=no]
Expand Down Expand Up @@ -548,7 +567,7 @@ dnl ---
AC_MSG_CHECKING([whether to enable c++ memory routines override])
sph_enable_mem_override=yes
AC_ARG_ENABLE([mem-override],
[ --enable-mem-override enable to override std c++ mem routines in production build (default is yes). Disabling may help in some rare cases as statically linking with mysql on Mac OS X Lion.],
[ --enable-mem-override enable to override std c++ mem routines in production build (default is yes). Disabling may help in some rare cases as statically linking with mysql on Mac OS X Lion.],
[sph_enable_mem_override=$enableval])
if test x$sph_enable_mem_override = xyes; then
AC_MSG_RESULT([yes])
Expand Down
10 changes: 1 addition & 9 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,6 @@ BUILT_SOURCES = extract-version
extract-version:
/bin/sh svnxrev.sh ..

if USE_RE2
LIBRE2_LIBS = $(top_srcdir)/libre2/obj/libre2.a
LIBRE2_INC = -I$(top_srcdir)/libre2
else
LIBRE2_LIBS =
LIBRE2_INC =
endif

if USE_RLP
RLP_LIBS = -L$(top_srcdir)/rlp/lib/amd64-glibc25-gcc42 -lbtrlpc -lbtrlpcore -lbtutils
RLP_INC = -I$(top_srcdir)/rlp/rlp/include -I$(top_srcdir)/rlp/utilities/include -D_REENTRANT
Expand All @@ -38,6 +30,6 @@ RLP_LIBS =
RLP_INC =
endif

AM_CPPFLAGS = $(LIBRE2_INC) $(RLP_INC) -DSYSCONFDIR="\"$(sysconfdir)\"" -DDATADIR="\"$(localstatedir)/data\""
AM_CPPFLAGS = $(LIBRE2_CFLAGS) $(RLP_INC) -DSYSCONFDIR="\"$(sysconfdir)\"" -DDATADIR="\"$(localstatedir)/data\""
COMMON_LIBS = libsphinx.a $(LIBSTEMMER_LIBS) $(MYSQL_LIBS) $(PGSQL_LIBS) $(LIBRE2_LIBS) $(RLP_LIBS)
LDADD = $(COMMON_LIBS)

0 comments on commit 2f0a6d6

Please sign in to comment.