Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import regex from gnulib #3054

Merged
merged 9 commits into from
Jul 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,15 @@ Units/**/Makefile.in
Tmain/dist.m4
Units/dist.m4
VALGRIND.tmp.core.*
gnulib/inttypes.h
gnulib/langinfo.h
gnulib/libgnu.a
gnulib/limits.h
gnulib/locale.h
gnulib/malloc/dynarray-skeleton.gl.h
gnulib/malloc/dynarray.gl.h
gnulib/stdlib.h
gnulib/unistd.h
gnulib/wchar.h
gnulib/wctype.h
gnulib/sys/types.h
28 changes: 15 additions & 13 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
ACLOCAL_AMFLAGS = -I m4
#AM_CPPFLAGS = -I$(top_builddir)/gnulib -I$(top_srcdir)/gnulib
GNULIB_DIR = gnulib
GNULIB_CPPFLAGS = -I$(top_builddir)/$(GNULIB_DIR) -I$(top_srcdir)/$(GNULIB_DIR)
GNULIB_LIBS = $(GNULIB_DIR)/libgnu.a $(LIBPTHREAD)
$(GNULIB_DIR)/libgnu.a:
$(MAKE) -C $(GNULIB_DIR) libgnu.a
SUBDIRS = $(GNULIB_DIR)

masatake marked this conversation as resolved.
Show resolved Hide resolved
include $(top_srcdir)/source.mak

Expand All @@ -12,8 +20,6 @@ EXTRA_DIST = README.md autogen.sh \
makefiles/list-optlib2c-input.mak misc/optlib2c \
.ctags.d/exclusion.ctags .dir-locals.el .editorconfig .gdbinit .gitignore \
.indent.pro .uncrustify.cfg \
gnu_regex/README.txt gnu_regex/regcomp.c gnu_regex/regexec.c \
gnu_regex/regex_internal.c gnu_regex/regex_internal.h \
misc/ctags-optlib-mode.el \
misc/mk-interactive-request.sh misc/roundtrip misc/tinst \
$(PACKCC_FILES) \
Expand All @@ -30,7 +36,7 @@ EXTRA_DIST = README.md autogen.sh \
man/Makefile man/README man/tags.5.rst \
makefiles/list-txt2cstr-input.mak misc/txt2cstr \
$(PEG_INPUT) $(OPTLIB2C_INPUT) $(TXT2CSTR_INPUT) \
docs Tmain Units
docs Tmain Units m4/gnulib-cache.m4

CLEANFILES =
MOSTLYCLEANFILES =
Expand Down Expand Up @@ -66,24 +72,17 @@ bin_PROGRAMS+= readtags
readtags_CPPFLAGS = -I. -I$(srcdir) -I$(srcdir)/main -I$(srcdir)/libreadtags
readtags_CFLAGS = $(COVERAGE_CFLAGS) $(WARNING_CFLAGS)
dist_readtags_SOURCES = $(READTAGS_SRCS) $(READTAGS_HEADS)
readtags_CPPFLAGS += $(GNULIB_CPPFLAGS)
readtags_CPPFLAGS += -DREADTAGS_DSL -I$(srcdir)/dsl
readtags_LDADD = $(GNULIB_LIBS)
dist_readtags_SOURCES += $(READTAGS_DSL_SRCS) $(READTAGS_DSL_HEADS)
if !HAVE_REGCOMP
readtags_CPPFLAGS += $(REGCOMP_CPPFLAGS)
masatake marked this conversation as resolved.
Show resolved Hide resolved
dist_readtags_SOURCES += $(REGEX_SRCS) $(REGEX_HEADS)
endif
endif

if !HAVE_FNMATCH
LIB_SRCS += $(FNMATCH_SRCS)
LIB_HEADS += $(FNMATCH_HEADS)
endif

if !HAVE_REGCOMP
LIB_SRCS += $(REGEX_SRCS)
LIB_HEADS += $(REGEX_HEADS)
endif

if HAVE_LIBXML
PARSER_SRCS += $(XML_SRCS)
PARSER_HEADS += $(XML_HEADS)
Expand All @@ -109,7 +108,7 @@ if HAVE_STRNLEN
libctags_a_CPPFLAGS += -DUSE_SYSTEM_STRNLEN
endif
libctags_a_CPPFLAGS+= $(FNMATCH_CPPFLAGS)
libctags_a_CPPFLAGS+= $(REGCOMP_CPPFLAGS)
masatake marked this conversation as resolved.
Show resolved Hide resolved
libctags_a_CPPFLAGS+= $(GNULIB_CPPFLAGS)
libctags_a_CPPFLAGS+= -DHAVE_REPOINFO_H

libctags_a_CFLAGS =
Expand Down Expand Up @@ -178,6 +177,7 @@ dist_libctags_a_SOURCES = $(ALL_LIB_HEADS) $(ALL_LIB_SRCS)
ctags_CPPFLAGS = $(libctags_a_CPPFLAGS)
ctags_CFLAGS = $(libctags_a_CFLAGS)
ctags_LDADD = libctags.a
ctags_LDADD += $(GNULIB_LIBS)
ctags_LDADD += $(LIBXML_LIBS)
ctags_LDADD += $(JANSSON_LIBS)
ctags_LDADD += $(LIBYAML_LIBS)
Expand All @@ -200,6 +200,7 @@ endif
mini_geany_CPPFLAGS = $(libctags_a_CPPFLAGS)
mini_geany_CFLAGS = $(libctags_a_CFLAGS)
mini_geany_LDADD = libctags.a
mini_geany_LDADD += $(GNULIB_LIBS)
mini_geany_LDADD += $(LIBXML_LIBS)
mini_geany_LDADD += $(JANSSON_LIBS)
mini_geany_LDADD += $(LIBYAML_LIBS)
Expand All @@ -212,6 +213,7 @@ optscript_CPPFLAGS = $(libctags_a_CPPFLAGS)
optscript_CFLAGS = $(libctags_a_CFLAGS)
optscript_LDADD = libctags.a
# TODO: remove these dependencies from optscript command.
optscript_LDADD += $(GNULIB_LIBS)
optscript_LDADD += $(LIBXML_LIBS)
optscript_LDADD += $(JANSSON_LIBS)
optscript_LDADD += $(LIBYAML_LIBS)
Expand Down
57 changes: 13 additions & 44 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.59])
AC_PREREQ([2.64])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NOTE for myself: the version of autoconf shipped as part of RHEL6 is 2.63.
The time for thinking about preparing weekly tarball with generated configure comes.

AC_INIT([universal-ctags],[5.9.0])

if ! test -e "${srcdir}/config.h.in"; then
Expand Down Expand Up @@ -97,9 +97,6 @@ AH_TEMPLATE([ICONV_USE_LIB_PREFIX],
AH_TEMPLATE([TMPDIR],
[If you wish to change the directory in which temporary files are stored,
define this label to the directory desired.])
AH_TEMPLATE([CHECK_REGCOMP],
[Define this label if you wish to check the regcomp() function at run time
for correct behavior. This function is currently broken on Cygwin.])
AH_TEMPLATE([NON_CONST_PUTENV_PROTOTYPE],
[Define this is you have a prototype for putenv() in <stdlib.h>, but
doesn't declare its argument as "const char *".])
Expand Down Expand Up @@ -248,6 +245,10 @@ AM_CONDITIONAL(ENABLE_DEBUGGING, [test "x$enable_debugging" = "xyes"])

AC_PROG_CC
AC_PROG_CC_C99
# For gnulib.
# Typically, this is immediately after AC_PROG_CC, ...
gl_EARLY

AC_PROG_RANLIB
AC_C_BIGENDIAN

Expand Down Expand Up @@ -484,6 +485,8 @@ fi
case "$host" in
i?86-*-mingw* | x86_64-*-mingw*)
host_mingw=yes
# See https://github.com/universal-ctags/ctags/pull/3069
gl_cv_have_weak=no
AC_DEFINE(MSDOS_STYLE_PATH)
;;
esac
Expand Down Expand Up @@ -528,6 +531,11 @@ PRETTY_ARG_VAR([EXTRA_CFLAGS], [extra C compiler flags],
PRETTY_ARG_VAR([WARNING_CFLAGS], [C compiler warning flags],
[-Wall])

# For gnulib.
# Place it further down in the file, typically where you normally check for
# header files or functions.
gl_INIT

# Checks for library functions
# ----------------------------
AC_CHECK_FUNCS(fnmatch,[have_fnmatch=yes],[
Expand Down Expand Up @@ -585,45 +593,6 @@ if test "$have_setenv" != yes ; then
fi
fi

dnl
dnl
dnl Check regcomp
dnl
dnl If it is found but broken, abort with a message.
dnl If it is found but cannot be test brokenness, define CHECK_REGCOMP.
dnl If it is not found, use bundled implementation.
dnl
dnl If CHECK_REGCOMP is defined, ctags itself check the brokenness at runtime
dnl (cross-compiling is assumed here).
dnl
dnl
dnl The final result can be check with ./ctags --list-features.
dnl
dnl
AC_CHECK_FUNCS(regcomp,[
AC_MSG_CHECKING(if regcomp works)
AC_RUN_IFELSE([AC_LANG_SOURCE([
#include <sys/types.h>
#include <regex.h>
int main(void) {
regex_t patbuf;
return (regcomp (&patbuf, "/hello/", 0) != 0);
}
])],[regcomp_works=yes],[regcomp_works=no],[AC_DEFINE(CHECK_REGCOMP)])
AC_MSG_RESULT($regcomp_works)
if test no = "$regcomp_works"; then
AC_MSG_ERROR([regcomp() on this system is broken.])
fi
have_regcomp=yes
],[
dnl Using bundled regex implementation
AC_LIBOBJ([regex])
REGCOMP_CPPFLAGS="-I${srcdir}/gnu_regex -D__USE_GNU"
AC_DEFINE(HAVE_REGCOMP)
have_regcomp=no])
AC_SUBST([REGCOMP_CPPFLAGS])
AM_CONDITIONAL([HAVE_REGCOMP], [test "xyes" = "x$have_regcomp"])

have_scandir=no
AC_CHECK_FUNCS(scandir,have_scandir=yes)

Expand Down Expand Up @@ -820,7 +789,7 @@ fi

AC_CHECK_FUNCS(mblen)

AC_CONFIG_FILES([Makefile
AC_CONFIG_FILES([Makefile gnulib/Makefile
man/ctags.1.rst
man/ctags-client-tools.7.rst
man/ctags-incompatibilities.7.rst
Expand Down
5 changes: 0 additions & 5 deletions gnu_regex/README.txt

This file was deleted.

Loading