This is an automated email from the ASF dual-hosted git repository.

maskit pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new b02e19be05 Make Cripts buildable with autotools (#10460)
b02e19be05 is described below

commit b02e19be059ad77cb0b9f39e32464c2228ba8220
Author: Masakazu Kitajo <[email protected]>
AuthorDate: Tue Sep 26 07:29:20 2023 +0900

    Make Cripts buildable with autotools (#10460)
---
 configure.ac                 | 19 +++++++++++
 m4/fmt.m4                    | 77 ++++++++++++++++++++++++++++++++++++++++++++
 m4/pcre2.m4                  | 77 ++++++++++++++++++++++++++++++++++++++++++++
 src/Makefile.am              |  4 +++
 src/{ => cripts}/Makefile.am | 48 +++++++++++++++------------
 5 files changed, 204 insertions(+), 21 deletions(-)

diff --git a/configure.ac b/configure.ac
index 140b1cf8d7..521b56e2c7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -400,6 +400,19 @@ AC_MSG_RESULT([$enable_wccp])
 TS_ARG_ENABLE_VAR([has],[wccp])
 AM_CONDITIONAL([BUILD_WCCP], [test 0 -ne $has_wccp])
 
+#
+# Cripts
+#
+AC_MSG_CHECKING([whether to enable Cripts support])
+AC_ARG_ENABLE([cripts],
+  [AS_HELP_STRING([--enable-cripts],[enable Cripts])],
+  [],
+  [enable_cripts=no]
+)
+AC_MSG_RESULT([$enable_cripts])
+TS_ARG_ENABLE_VAR([has],[cripts])
+AM_CONDITIONAL([BUILD_CRIPTS], [test 0 -ne $has_cripts])
+
 # Google profiler
 AC_MSG_CHECKING([whether to enable profiler])
 AC_ARG_WITH([profiler],
@@ -1440,9 +1453,14 @@ if test "x${enable_pcre}" != "xyes"; then
   AC_MSG_ERROR([Cannot find pcre library, configure --with-pcre=DIR])
 fi
 
+TS_CHECK_PCRE2
+
 # Check for optional brotli library
 TS_CHECK_BROTLI
 
+# Check for optional fmt library
+TS_CHECK_FMT
+
 # Check for optional luajit library
 TS_CHECK_LUAJIT
 
@@ -2371,6 +2389,7 @@ AC_CONFIG_FILES([
   lib/Makefile
   src/tscpp/api/Makefile
   src/wccp/Makefile
+  src/cripts/Makefile
   lib/fastlz/Makefile
   lib/swoc/Makefile
   lib/yamlcpp/Makefile
diff --git a/m4/fmt.m4 b/m4/fmt.m4
new file mode 100644
index 0000000000..dcd0a1a1cf
--- /dev/null
+++ b/m4/fmt.m4
@@ -0,0 +1,77 @@
+dnl -------------------------------------------------------- -*- autoconf -*-
+dnl Licensed to the Apache Software Foundation (ASF) under one or more
+dnl contributor license agreements.  See the NOTICE file distributed with
+dnl this work for additional information regarding copyright ownership.
+dnl The ASF licenses this file to You under the Apache License, Version 2.0
+dnl (the "License"); you may not use this file except in compliance with
+dnl the License.  You may obtain a copy of the License at
+dnl
+dnl     http://www.apache.org/licenses/LICENSE-2.0
+dnl
+dnl Unless required by applicable law or agreed to in writing, software
+dnl distributed under the License is distributed on an "AS IS" BASIS,
+dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+dnl See the License for the specific language governing permissions and
+dnl limitations under the License.
+
+dnl
+dnl fmt.m4: Trafficserver's fmt autoconf macros
+dnl
+
+dnl
+dnl TS_CHECK_FMT: look for fmt libraries and headers
+dnl
+AC_DEFUN([TS_CHECK_FMT], [
+has_fmt=0
+AC_ARG_WITH(fmt, [AS_HELP_STRING([--with-fmt=DIR],[use a specific fmt 
library])],
+[
+  if test "x$withval" != "xyes" && test "x$withval" != "x"; then
+    fmt_base_dir="$withval"
+    if test "$withval" != "no"; then
+      has_fmt=1
+      case "$withval" in
+      *":"*)
+        fmt_include="`echo $withval | sed -e 's/:.*$//'`"
+        fmt_ldflags="`echo $withval | sed -e 's/^.*://'`"
+        AC_MSG_CHECKING(checking for fmt includes in $fmt_include libs in 
$fmt_ldflags )
+        ;;
+      *)
+        fmt_include="$withval/include"
+        fmt_ldflags="$withval/lib"
+        AC_MSG_CHECKING(checking for fmt includes in $withval)
+        ;;
+      esac
+    fi
+  fi
+
+  if test -d $fmt_include && test -d $fmt_ldflags && test -f 
$fmt_include/fmt/core.h; then
+    AC_MSG_RESULT([ok])
+  else
+    AC_MSG_RESULT([not found])
+  fi
+
+if test "$has_fmt" != "0"; then
+  saved_ldflags=$LDFLAGS
+  saved_cppflags=$CPPFLAGS
+  fmt_have_headers=0
+  if test "$fmt_base_dir" != "/usr"; then
+    TS_ADDTO(CPPFLAGS, [-I${fmt_include}])
+    TS_ADDTO(LDFLAGS, [-L${fmt_ldflags}])
+    TS_ADDTO_RPATH(${fmt_ldflags})
+  fi
+
+  AC_SUBST([FMT_LIB], [-lfmt])
+  AC_SUBST([FMT_CFLAGS], [-I${fmt_include}])
+fi
+],
+[
+  PKG_CHECK_EXISTS([fmt],
+  [
+    PKG_CHECK_MODULES([LIBFMT], [fmt >= 0.8.0], [
+      AC_SUBST([FMT_LIB], [$LIBFMT_LIBS])
+      AC_SUBST([FMT_CFLAGS], [$LIBFMT_CFLAGS])
+    ], [])
+  ], [])
+])
+
+])
diff --git a/m4/pcre2.m4 b/m4/pcre2.m4
new file mode 100644
index 0000000000..47a9d5341f
--- /dev/null
+++ b/m4/pcre2.m4
@@ -0,0 +1,77 @@
+dnl -------------------------------------------------------- -*- autoconf -*-
+dnl Licensed to the Apache Software Foundation (ASF) under one or more
+dnl contributor license agreements.  See the NOTICE file distributed with
+dnl this work for additional information regarding copyright ownership.
+dnl The ASF licenses this file to You under the Apache License, Version 2.0
+dnl (the "License"); you may not use this file except in compliance with
+dnl the License.  You may obtain a copy of the License at
+dnl
+dnl     http://www.apache.org/licenses/LICENSE-2.0
+dnl
+dnl Unless required by applicable law or agreed to in writing, software
+dnl distributed under the License is distributed on an "AS IS" BASIS,
+dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+dnl See the License for the specific language governing permissions and
+dnl limitations under the License.
+
+dnl
+dnl pcre2.m4: Trafficserver's pcre2 autoconf macros
+dnl
+
+dnl
+dnl TS_CHECK_PCRE2: look for pcre2 libraries and headers
+dnl
+AC_DEFUN([TS_CHECK_PCRE2], [
+has_pcre2=0
+AC_ARG_WITH(pcre2, [AS_HELP_STRING([--with-pcre2=DIR],[use a specific pcre2 
library])],
+[
+  if test "x$withval" != "xyes" && test "x$withval" != "x"; then
+    pcre2_base_dir="$withval"
+    if test "$withval" != "no"; then
+      has_pcre2=1
+      case "$withval" in
+      *":"*)
+        pcre2_include="`echo $withval | sed -e 's/:.*$//'`"
+        pcre2_ldflags="`echo $withval | sed -e 's/^.*://'`"
+        AC_MSG_CHECKING(checking for pcre2 includes in $pcre2_include libs in 
$pcre2_ldflags )
+        ;;
+      *)
+        pcre2_include="$withval/include"
+        pcre2_ldflags="$withval/lib"
+        AC_MSG_CHECKING(checking for pcre2 includes in $withval)
+        ;;
+      esac
+    fi
+  fi
+
+  if test -d $pcre2_include && test -d $pcre2_ldflags && test -f 
$pcre2_include/pcre2.h; then
+    AC_MSG_RESULT([ok])
+  else
+    AC_MSG_RESULT([not found])
+  fi
+
+if test "$has_pcre2" != "0"; then
+  saved_ldflags=$LDFLAGS
+  saved_cppflags=$CPPFLAGS
+  pcre2_have_headers=0
+  if test "$pcre2_base_dir" != "/usr"; then
+    TS_ADDTO(CPPFLAGS, [-I${pcre2_include}])
+    TS_ADDTO(LDFLAGS, [-L${pcre2_ldflags}])
+    TS_ADDTO_RPATH(${pcre2_ldflags})
+  fi
+
+  AC_SUBST([PCRE2_LIB], [-lpcre2-8])
+  AC_SUBST([PCRE2_CFLAGS], [-I${pcre2_include}])
+fi
+],
+[
+  PKG_CHECK_EXISTS([libpcre2-8],
+  [
+    PKG_CHECK_MODULES([LIBPCRE2], [libpcre2-8 >= 10.0.0], [
+      AC_SUBST([PCRE2_LIB], [$LIBPCRE2_LIBS])
+      AC_SUBST([PCRE2_CFLAGS], [$LIBPCRE2_CFLAGS])
+    ], [])
+  ], [])
+])
+
+])
diff --git a/src/Makefile.am b/src/Makefile.am
index e6aaddec1d..060871b168 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -30,6 +30,10 @@ SUBDIRS += wccp
 include traffic_wccp/Makefile.inc
 endif
 
+if BUILD_CRIPTS
+SUBDIRS += cripts
+endif
+
 include traffic_cache_tool/Makefile.inc
 include traffic_via/Makefile.inc
 include traffic_top/Makefile.inc
diff --git a/src/Makefile.am b/src/cripts/Makefile.am
similarity index 61%
copy from src/Makefile.am
copy to src/cripts/Makefile.am
index e6aaddec1d..cf7e41d8e1 100644
--- a/src/Makefile.am
+++ b/src/cripts/Makefile.am
@@ -1,4 +1,6 @@
 #
+# Makefile.am for Cripts module.
+#
 #  Licensed to the Apache Software Foundation (ASF) under one
 #  or more contributor license agreements.  See the NOTICE file
 #  distributed with this work for additional information
@@ -17,28 +19,32 @@
 
 include $(top_srcdir)/mk/tidy.mk
 
-bin_PROGRAMS =
-check_PROGRAMS =
-TESTS =
-lib_LTLIBRARIES =
-noinst_PROGRAMS =
-
-SUBDIRS = tscpp/api api
+AM_CPPFLAGS += \
+       -I$(abs_top_srcdir)/iocore/eventsystem \
+       -I$(abs_top_srcdir)/iocore/utils \
+       -I$(abs_top_srcdir)/proxy \
+       -I$(abs_top_srcdir)/ \
+       @SWOC_INCLUDES@
 
-if BUILD_WCCP
-SUBDIRS += wccp
-include traffic_wccp/Makefile.inc
-endif
+noinst_LIBRARIES = libcripts.a
 
-include traffic_cache_tool/Makefile.inc
-include traffic_via/Makefile.inc
-include traffic_top/Makefile.inc
-include traffic_server/Makefile.inc
-include traffic_logstats/Makefile.inc
-include traffic_crashlog/Makefile.inc
-include traffic_layout/Makefile.inc
-include traffic_logcat/Makefile.inc
-include traffic_ctl/Makefile.inc
+libcripts_a_SOURCES = \
+       Configs.cc \
+       Connections.cc \
+       Crypto.cc \
+       Error.cc \
+       Files.cc \
+       Geo.cc \
+       Headers.cc \
+       Instance.cc \
+       Lulu.cc \
+       Matcher.cc \
+       Metrics.cc \
+       Plugins.cc \
+       UUID.cc \
+       Urls.cc \
+       Bundles/Common.cc \
+       Bundles/LogsMetrics.cc
 
-clang-tidy-local: $(DIST_SOURCES)
+clang-tidy-local: $(sort $(DIST_SOURCES))
        $(CXX_Clang_Tidy)

Reply via email to