From 9bb854fddd5a96aa623b7169b07824780999ebc2 Mon Sep 17 00:00:00 2001 From: paulc Date: Tue, 15 Aug 2006 13:59:29 +0000 Subject: [PATCH] Included regexp library can be used for other non-Linux systems (*BSD). git-svn-id: http://voip.null.ro/svn/yate@996 acf43c95-373e-0410-b603-e72c3f656dc1 --- configure.in | 27 +++++++++++++++++++++++++++ contrib/regex/.cvsignore | 7 +++++++ {windows => contrib/regex}/regex.c | 0 {windows => contrib/regex}/regex.h | 0 engine/Makefile.in | 19 +++++++++++++++++-- windows/libregex.dsp | 4 ++-- 6 files changed, 53 insertions(+), 4 deletions(-) create mode 100644 contrib/regex/.cvsignore rename {windows => contrib/regex}/regex.c (100%) rename {windows => contrib/regex}/regex.h (100%) diff --git a/configure.in b/configure.in index b9e9d510..7a3fd748 100644 --- a/configure.in +++ b/configure.in @@ -16,6 +16,12 @@ AC_SUBST(PACKAGE_VERSION_BUILD) AC_SUBST(PACKAGE_VERSION_RELEASE) AC_SUBST(PACKAGE_RELEASE) +# We may need the host OS type but avoid the overhead of AC_CANONICAL_SYSTEM +AC_MSG_CHECKING([for local operating system type]) +uname_os=`uname -s` +test -x "$uname_os" && uname_os=Unknown +AC_MSG_RESULT([$uname_os]) + # Checks for programs. AC_PROG_CXX AC_PROG_CC @@ -187,6 +193,27 @@ AC_LANG_RESTORE AC_MSG_RESULT([$HAVE_RESOLV]) AC_SUBST(HAVE_RESOLV) +INTERNAL_REGEX=yes +AC_ARG_ENABLE(internalregex,AC_HELP_STRING([--enable-internalregex],[Use internal regexp library (default: not on Linux)]),want_internalregex=$enableval,want_internalregex=auto) +AC_MSG_CHECKING([whether to use the internal regexp library]) +case "x$want_internalregex" in + xno|xdisable|xnot) + INTERNAL_REGEX=no + ;; + xyes|xenable) + ;; + xauto) + if [[ "x$uname_os" = "xLinux" ]]; then + INTERNAL_REGEX=no + fi + ;; + *) + AC_ERROR([Invalid argument passed to --enable-internalregex]) + ;; +esac +AC_MSG_RESULT([$INTERNAL_REGEX]) +AC_SUBST(INTERNAL_REGEX) + HAVE_PRI=no HAVE_PRI_CB=no AC_ARG_WITH(libpri,AC_HELP_STRING([--with-libpri],[use ISDN PRI if available (default)]),[ac_cv_use_libpri=$withval],[ac_cv_use_libpri=yes]) diff --git a/contrib/regex/.cvsignore b/contrib/regex/.cvsignore new file mode 100644 index 00000000..cfebb73f --- /dev/null +++ b/contrib/regex/.cvsignore @@ -0,0 +1,7 @@ +Makefile +core* +*.o +*.a +*.orig +*~ +.*.swp diff --git a/windows/regex.c b/contrib/regex/regex.c similarity index 100% rename from windows/regex.c rename to contrib/regex/regex.c diff --git a/windows/regex.h b/contrib/regex/regex.h similarity index 100% rename from windows/regex.h rename to contrib/regex/regex.h diff --git a/engine/Makefile.in b/engine/Makefile.in index 6de27dc4..1f12ae57 100644 --- a/engine/Makefile.in +++ b/engine/Makefile.in @@ -4,13 +4,15 @@ # override DEBUG at compile time to enable full debug or remove it all DEBUG := +CC := @CC@ -Wall CXX := @CXX@ -Wall SED := sed DEFS := LIBAUX:= @DLOPEN_LIB@ LIBTHR:= -lpthread INCLUDES := -I.. -I@top_srcdir@ -CFLAGS := -O2 @MODULE_CPPFLAGS@ @INLINE_FLAGS@ +CFLAGS := -O2 @MODULE_CFLAGS@ @INLINE_FLAGS@ +CPPFLAGS := -O2 @MODULE_CPPFLAGS@ @INLINE_FLAGS@ LDFLAGS:= LDCONFIG:=true @@ -29,7 +31,8 @@ CLIOBJS := Client.o LIBOBJS := $(CLSOBJS) $(ENGOBJS) $(TELOBJS) $(CLIOBJS) CLEANS = $(LIBOBJS) core -COMPILE = $(CXX) $(DEFS) $(DEBUG) $(INCLUDES) $(CFLAGS) +CCOMPILE = $(CC) $(DEFS) $(DEBUG) $(INCLUDES) $(CFLAGS) +COMPILE = $(CXX) $(DEFS) $(DEBUG) $(INCLUDES) $(CPPFLAGS) LINK = $(CXX) $(LDFLAGS) SCTPOPTS:= @@ -39,6 +42,12 @@ endif ifneq (@HAVE_SCTP_NETINET@,no) SCTPOPTS := $(SCTPOPTS) -DHAVE_SCTP_NETINET endif +ifeq (@INTERNAL_REGEX@,yes) +REGEX_INC:= -I@top_srcdir@/contrib/regex +LIBOBJS := $(LIBOBJS) regex.o +else +REGEX_INC:= +endif prefix = @prefix@ exec_prefix = @exec_prefix@ @@ -87,6 +96,12 @@ Thread.o: @srcdir@/Thread.cpp $(MKDEPS) $(CINC) Client.o: @srcdir@/Client.cpp $(MKDEPS) $(CLINC) $(COMPILE) -c $< +String.o: @srcdir@/String.cpp $(MKDEPS) $(CINC) + $(COMPILE) $(REGEX_INC) -c $< + +regex.o: @top_srcdir@/contrib/regex/regex.c $(MKDEPS) + $(CCOMPILE) -DSTDC_HEADERS $(REGEX_INC) -c $< + %.o: @srcdir@/%.cpp $(MKDEPS) $(EINC) $(COMPILE) -c $< diff --git a/windows/libregex.dsp b/windows/libregex.dsp index 4de756ef..f65b35a8 100644 --- a/windows/libregex.dsp +++ b/windows/libregex.dsp @@ -87,7 +87,7 @@ LIB32=link.exe -lib # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Source File -SOURCE=.\regex.c +SOURCE=..\contrib\regex\regex.c # End Source File # End Group # Begin Group "Header Files" @@ -95,7 +95,7 @@ SOURCE=.\regex.c # PROP Default_Filter "h;hpp;hxx;hm;inl" # Begin Source File -SOURCE=.\regex.h +SOURCE=..\contrib\regex\regex.h # End Source File # End Group # End Target