Skip to content

Commit

Permalink
Add GNU regex bundle from upstream ctags and use it if missing
Browse files Browse the repository at this point in the history
If we don't have `regcomp()` (e.g. on Windows), use the bundled GNU
regex from upstream ctags.
  • Loading branch information
b4n committed Nov 22, 2020
1 parent 3f0bb8e commit 33fc269
Show file tree
Hide file tree
Showing 9 changed files with 11,334 additions and 0 deletions.
8 changes: 8 additions & 0 deletions configure.ac
Expand Up @@ -44,6 +44,14 @@ AC_CHECK_HEADERS([fcntl.h glob.h stdlib.h sys/time.h errno.h limits.h])
# Checks for dependencies needed by ctags
AC_CHECK_HEADERS([fnmatch.h direct.h io.h sys/dir.h])
AC_DEFINE([HAVE_STDBOOL_H], [1], [whether or not to use <stdbool.h>.])
AC_CHECK_FUNC([regcomp],
[have_regcomp=yes],
[have_regcomp=no
dnl various stuff for ctags/gnu_regex/
AC_CHECK_HEADERS([langinfo.h locale.h libintl.h wctype.h wchar.h])
AC_CHECK_FUNCS([memcpy isblank wcrtomb mbrtowc wcscoll])
AC_FUNC_ALLOCA])
AM_CONDITIONAL([USE_BUNDLED_REGEX], [test "xno" = "x$have_regcomp"])

# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_OFF_T
Expand Down
22 changes: 22 additions & 0 deletions ctags/Makefile.am
Expand Up @@ -176,3 +176,25 @@ libctags_la_SOURCES = \
main/xtag.h \
main/xtag_p.h \
$(parsers)

# build bundled GNU regex if needed
if USE_BUNDLED_REGEX
noinst_LTLIBRARIES += libgnu_regex.la
libgnu_regex_la_SOURCES = \
gnu_regex/regex.c \
gnu_regex/regex.h
# regex.c includes other sources we have to distribute
EXTRA_libgnu_regex_la_SOURCES = \
gnu_regex/regcomp.c \
gnu_regex/regex.c \
gnu_regex/regex.h \
gnu_regex/regex_internal.c \
gnu_regex/regex_internal.h \
gnu_regex/regexec.c
libgnu_regex_la_CPPFLAGS = -D__USE_GNU
EXTRA_DIST = \
gnu_regex/README.txt

libctags_la_LIBADD = libgnu_regex.la
AM_CPPFLAGS += -I$(srcdir)/gnu_regex
endif
5 changes: 5 additions & 0 deletions ctags/gnu_regex/README.txt
@@ -0,0 +1,5 @@
These source files were taken from the GNU glibc-2.10.1 package.

ftp://ftp.gnu.org/gnu/glibc/glibc-2.10.1.tar.bz2

Minor changes were made to eliminate compiler errors and warnings.

0 comments on commit 33fc269

Please sign in to comment.