You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by jp...@apache.org on 2013/04/25 05:44:25 UTC

git commit: TS-1717: static library build fails with duplicate symbols

Updated Branches:
  refs/heads/master 2915206c7 -> 1b92b8b3c


TS-1717: static library build fails with duplicate symbols

Fix the static build as much as possible. Add common plugin build
variables so we don't repeat automake fragments everywhere.


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/1b92b8b3
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/1b92b8b3
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/1b92b8b3

Branch: refs/heads/master
Commit: 1b92b8b3cbd8519e2305827755e9dbc267732e77
Parents: 2915206
Author: James Peach <jp...@apache.org>
Authored: Wed Mar 20 16:42:15 2013 -0700
Committer: James Peach <jp...@apache.org>
Committed: Wed Apr 24 20:43:53 2013 -0700

----------------------------------------------------------------------
 CHANGES                                            |    2 +
 build/plugins.mk                                   |   37 ++++++++
 example/Makefile.am                                |   10 +--
 example/cache-scan/cache-scan.cc                   |    1 -
 lib/records/P_RecCore.h                            |    2 +
 lib/records/RecCore.cc                             |    2 +-
 lib/records/RecUtils.cc                            |    3 -
 lib/ts/ink_defs.h                                  |    2 +-
 mgmt/Main.cc                                       |   65 ++++++---------
 mgmt/Main.h                                        |    5 -
 mgmt/utils/MgmtUtils.cc                            |    3 +
 plugins/conf_remap/Makefile.am                     |    6 +-
 plugins/experimental/authproxy/Makefile.am         |    8 +--
 plugins/experimental/cacheurl/Makefile.am          |    7 +-
 plugins/experimental/channel_stats/Makefile.am     |    6 +-
 .../experimental/channel_stats/channel_stats.cc    |    1 -
 plugins/experimental/custom_redirect/Makefile.am   |    6 +-
 plugins/experimental/esi/Makefile.am               |   25 +++---
 plugins/experimental/esi/esi.cc                    |    1 +
 plugins/experimental/gzip/Makefile.am              |    6 +-
 plugins/experimental/header_rewrite/Makefile.am    |   24 ++++--
 plugins/experimental/lua/Makefile.am               |   13 +--
 plugins/experimental/metalink/Makefile.am          |    7 +-
 plugins/experimental/rfc5861/Makefile.am           |    6 +-
 plugins/experimental/spdy/Makefile.am              |   12 +--
 plugins/experimental/tcp_info/Makefile.am          |    7 +-
 plugins/header_filter/Makefile.am                  |    6 +-
 plugins/regex_remap/Makefile.am                    |    6 +-
 plugins/stats_over_http/Makefile.am                |    6 +-
 proxy/Main.cc                                      |    4 -
 proxy/logcat.cc                                    |    8 +-
 proxy/logging/LogStandalone.cc                     |    8 +-
 tools/jtest/jtest.cc                               |    5 +-
 33 files changed, 145 insertions(+), 165 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1b92b8b3/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 9720edb..b2c319b 100644
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,8 @@
   Changes with Apache Traffic Server 3.3.3
 
 
+  *) [TS-1717] Fix the static build as much as possible.
+
   *) [TS-1851] Turn HostDBInfo back into a POD type.
 
   *) [TS-1850] Improve SSL certificate error reporting.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1b92b8b3/build/plugins.mk
----------------------------------------------------------------------
diff --git a/build/plugins.mk b/build/plugins.mk
new file mode 100644
index 0000000..c284405
--- /dev/null
+++ b/build/plugins.mk
@@ -0,0 +1,37 @@
+#  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
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+# plugins.mk: Common automake build variables for Traffic Server plugins.
+
+TS_PLUGIN_LDFLAGS = \
+  -module \
+  -shared \
+  -avoid-version
+
+TS_PLUGIN_CPPFLAGS = \
+  -D__STDC_LIMIT_MACROS=1 \
+  -D__STDC_FORMAT_MACROS=1 \
+  -I$(top_builddir)/proxy/api \
+  -I$(top_srcdir)/proxy/api \
+  -I$(top_builddir)/lib/ts \
+  -I$(top_srcdir)/lib/ts
+
+# Provide a default AM_CPPFLAGS. Automake handles this correctly, but libtool
+# throws an error if we try to do the same with AM_LDFLAGS. Hence, we provide
+# TS_PLUGIN variables that can be used to construct the necessary automake
+# syntax.
+AM_CPPFLAGS = $(TS_PLUGIN_CPPFLAGS)
+pkglibdir = $(pkglibexecdir)

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1b92b8b3/example/Makefile.am
----------------------------------------------------------------------
diff --git a/example/Makefile.am b/example/Makefile.am
index b10e1d5..e0939e0 100644
--- a/example/Makefile.am
+++ b/example/Makefile.am
@@ -14,15 +14,9 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
 
-pkglibdir = ${pkglibexecdir}
+include $(top_srcdir)/build/plugins.mk
 
-AM_CPPFLAGS = \
-    -I$(top_srcdir)/proxy/api \
-    -I$(top_builddir)/proxy/api \
-    -I$(top_srcdir)/lib/ts \
-    -I$(top_builddir)/lib/ts
-    
-AM_LDFLAGS = -module -avoid-version -shared
+AM_LDFLAGS = $(TS_PLUGIN_LDFLAGS)
 
 noinst_LTLIBRARIES = \
 	add-header.la \

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1b92b8b3/example/cache-scan/cache-scan.cc
----------------------------------------------------------------------
diff --git a/example/cache-scan/cache-scan.cc b/example/cache-scan/cache-scan.cc
index b45dac5..efde358 100644
--- a/example/cache-scan/cache-scan.cc
+++ b/example/cache-scan/cache-scan.cc
@@ -32,7 +32,6 @@
 
 #include "ts/ts.h"
 #include "ts/experimental.h"
-
 #include "ink_defs.h"
 
 static TSCont global_contp;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1b92b8b3/lib/records/P_RecCore.h
----------------------------------------------------------------------
diff --git a/lib/records/P_RecCore.h b/lib/records/P_RecCore.h
index fda9b13..6d3633d 100644
--- a/lib/records/P_RecCore.h
+++ b/lib/records/P_RecCore.h
@@ -43,6 +43,8 @@ extern int g_num_update[];
 extern RecModeT g_mode_type;
 extern RecTree *g_records_tree;
 
+extern Diags *g_diags;
+
 // records.config items
 extern const char *g_rec_config_fpath;
 extern LLQ *g_rec_config_contents_llq;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1b92b8b3/lib/records/RecCore.cc
----------------------------------------------------------------------
diff --git a/lib/records/RecCore.cc b/lib/records/RecCore.cc
index ce9818e..5a09e0a 100644
--- a/lib/records/RecCore.cc
+++ b/lib/records/RecCore.cc
@@ -179,7 +179,7 @@ RecCoreInit(RecModeT mode_type, Diags *_diags)
   }
 
   // set our diags
-  ink_atomic_swap(&g_diags, _diags);
+  RecSetDiags(_diags);
 
   g_records_tree = new RecTree(NULL);
   g_num_records = 0;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1b92b8b3/lib/records/RecUtils.cc
----------------------------------------------------------------------
diff --git a/lib/records/RecUtils.cc b/lib/records/RecUtils.cc
index 84e036a..fb5c81a 100644
--- a/lib/records/RecUtils.cc
+++ b/lib/records/RecUtils.cc
@@ -26,9 +26,6 @@
 #include "P_RecCore.h"
 #include "P_RecTree.h"
 
-// diags defined in RecCore.cc
-extern Diags *g_diags;
-
 //-------------------------------------------------------------------------
 // RecAlloc
 //-------------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1b92b8b3/lib/ts/ink_defs.h
----------------------------------------------------------------------
diff --git a/lib/ts/ink_defs.h b/lib/ts/ink_defs.h
index 8d00f07..4f5439b 100644
--- a/lib/ts/ink_defs.h
+++ b/lib/ts/ink_defs.h
@@ -29,7 +29,7 @@
 #include <stddef.h>
 
 #ifdef HAVE_STDINT_H
-#define __STDC_LIMIT_MACROS
+#define __STDC_LIMIT_MACROS 1
 # include <stdint.h>
 #else
 // TODO: Add "standard" int types?

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1b92b8b3/mgmt/Main.cc
----------------------------------------------------------------------
diff --git a/mgmt/Main.cc b/mgmt/Main.cc
index 895ea06..2a0d3d1 100644
--- a/mgmt/Main.cc
+++ b/mgmt/Main.cc
@@ -71,16 +71,15 @@ FileManager *configFiles;
 StatProcessor *statProcessor;   // Statistics Processors
 AppVersionInfo appVersionInfo;  // Build info for this application
 
-inkcoreapi Diags *diags;
-inkcoreapi DiagsConfig *diagsConfig;
-char debug_tags[1024] = "";
-char action_tags[1024] = "";
 int diags_init = 0;
-bool proxy_on = true;
-bool forceProcessRecordsSnap = false;
 
-bool schema_on = false;
-char *schema_path = NULL;
+static inkcoreapi DiagsConfig *diagsConfig;
+static char debug_tags[1024] = "";
+static char action_tags[1024] = "";
+static bool proxy_on = true;
+
+static bool schema_on = false;
+static char *schema_path = NULL;
 
 // TODO: Check if really need those
 char system_root_dir[PATH_NAME_MAX + 1];
@@ -91,27 +90,25 @@ char system_log_dir[PATH_NAME_MAX + 1];
 char mgmt_path[PATH_NAME_MAX + 1];
 
 // By default, set the current directory as base
-const char *ts_base_dir = ".";
-const char *recs_conf = "records.config";
+static const char *recs_conf = "records.config";
 
-int fds_limit;
+static int fds_limit;
 
-typedef void (*PFV) (int);
 // TODO: Use positive instead negative selection
 //       Thsis should just be #if defined(solaris)
 #if !defined(linux) && !defined(freebsd) && !defined(darwin)
-void SignalHandler(int sig, siginfo_t * t, void *f);
+static void SignalHandler(int sig, siginfo_t * t, void *f);
 void SignalAlrmHandler(int sig, siginfo_t * t, void *f);
 #else
-void SignalHandler(int sig);
-void SignalAlrmHandler(int sig);
+static void SignalHandler(int sig);
+static void SignalAlrmHandler(int sig);
 #endif
 
-volatile int sigHupNotifier = 0;
-volatile int sigUsr2Notifier = 0;
-void SigChldHandler(int sig);
+static volatile int sigHupNotifier = 0;
+static volatile int sigUsr2Notifier = 0;
+static void SigChldHandler(int sig);
 
-void
+static void
 check_lockfile()
 {
   char lockfile[PATH_NAME_MAX];
@@ -175,7 +172,7 @@ check_lockfile()
 }
 
 
-void
+static void
 initSignalHandlers()
 {
   struct sigaction sigHandler, sigChldHandler, sigAlrmHandler;
@@ -324,7 +321,7 @@ init_dirs(bool use_librecords = true)
 
 }
 
-void
+static void
 chdir_root()
 {
 
@@ -367,7 +364,7 @@ set_process_limits(int fds_throttle)
 }
 
 #if TS_HAS_WCCP
-void
+static void
 Errata_Logger(ts::Errata const& err) {
   size_t n;
   static size_t const SIZE = 4096;
@@ -385,7 +382,7 @@ Errata_Logger(ts::Errata const& err) {
   }
 }
 
-void
+static void
 Init_Errata_Logging() {
   ts::Errata::registerSink(&Errata_Logger);
 }
@@ -845,10 +842,10 @@ main(int argc, char **argv)
 
 
 #if !defined(linux) && !defined(freebsd) && !defined(darwin)
-void
+static void
 SignalAlrmHandler(int sig, siginfo_t * t, void *c)
 #else
-void
+static void
 SignalAlrmHandler(int sig)
 #endif
 {
@@ -878,10 +875,10 @@ SignalAlrmHandler(int sig)
 
 
 #if !defined(linux) && !defined(freebsd) && !defined(darwin)
-void
+static void
 SignalHandler(int sig, siginfo_t * t, void *c)
 #else
-void
+static void
 SignalHandler(int sig)
 #endif
 {
@@ -962,24 +959,12 @@ SignalHandler(int sig)
 //    waitpid() blocks until all child are transformed into
 //    zombies which is bad for us
 //
-void
+static void
 SigChldHandler(int sig)
 {
   NOWARN_UNUSED(sig);
 }
 
-// void SigHupHandler(int sig,...)
-//
-//  Records that a sigHup was sent so that we can reread our
-//    config files on the next run through the main loop
-void
-SigHupHandler(int sig, ...)
-{
-  ink_assert(sig == SIGHUP);
-  Debug("lm", "[SigHupHandler] hup caught\n");
-  sigHupNotifier = 1;
-}                               /* End SigHupHandler */
-
 void
 printUsage()
 {

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1b92b8b3/mgmt/Main.h
----------------------------------------------------------------------
diff --git a/mgmt/Main.h b/mgmt/Main.h
index 19434fb..f4b393e 100644
--- a/mgmt/Main.h
+++ b/mgmt/Main.h
@@ -46,11 +46,6 @@ extern AppVersionInfo appVersionInfo;
 
 // Global strings
 extern char mgmt_path[];
-extern const char *recs_conf;
-//extern char *lm_conf;
-
-// Root of Traffic Server
-extern const char *ts_base_dir;
 
 // Global variable to replace ifdef MGMT_LAUNCH_PROXY so that
 // we can turn on/off proxy launch at runtime to facilitate

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1b92b8b3/mgmt/utils/MgmtUtils.cc
----------------------------------------------------------------------
diff --git a/mgmt/utils/MgmtUtils.cc b/mgmt/utils/MgmtUtils.cc
index 2011540..05cd022 100644
--- a/mgmt/utils/MgmtUtils.cc
+++ b/mgmt/utils/MgmtUtils.cc
@@ -33,7 +33,10 @@
 #include "../../proxy/Main.h"
 #endif
 
+#if defined(LOCAL_MANAGER) || defined(PROCESS_MANAGER)
+// diags_init defined in mgmt/Main.cc.
 extern int diags_init;
+#endif
 
 static int use_syslog = 0;
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1b92b8b3/plugins/conf_remap/Makefile.am
----------------------------------------------------------------------
diff --git a/plugins/conf_remap/Makefile.am b/plugins/conf_remap/Makefile.am
index 9042800..48843d3 100644
--- a/plugins/conf_remap/Makefile.am
+++ b/plugins/conf_remap/Makefile.am
@@ -14,10 +14,8 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
 
-AM_CPPFLAGS = -I$(top_builddir)/proxy/api -I$(top_srcdir)/proxy/api \
-    -I$(top_builddir)/lib/ts -I$(top_srcdir)/lib/ts
+include $(top_srcdir)/build/plugins.mk
 
-pkglibdir = ${pkglibexecdir}
 pkglib_LTLIBRARIES = conf_remap.la
 conf_remap_la_SOURCES = conf_remap.cc
-conf_remap_la_LDFLAGS = -module -avoid-version -shared
+conf_remap_la_LDFLAGS = $(TS_PLUGIN_LDFLAGS)

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1b92b8b3/plugins/experimental/authproxy/Makefile.am
----------------------------------------------------------------------
diff --git a/plugins/experimental/authproxy/Makefile.am b/plugins/experimental/authproxy/Makefile.am
index 81604ee..844511a 100644
--- a/plugins/experimental/authproxy/Makefile.am
+++ b/plugins/experimental/authproxy/Makefile.am
@@ -14,13 +14,9 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
 
-pkglibdir = ${pkglibexecdir}
-
-AM_CPPFLAGS = \
-  -I$(top_builddir)/proxy/api \
-  -I$(top_srcdir)/proxy/api
+include $(top_srcdir)/build/plugins.mk
 
 pkglib_LTLIBRARIES = authproxy.la
 authproxy_la_SOURCES = authproxy.cc utils.cc utils.h
-authproxy_la_LDFLAGS = -module -avoid-version -shared
+authproxy_la_LDFLAGS = $(TS_PLUGIN_LDFLAGS)
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1b92b8b3/plugins/experimental/cacheurl/Makefile.am
----------------------------------------------------------------------
diff --git a/plugins/experimental/cacheurl/Makefile.am b/plugins/experimental/cacheurl/Makefile.am
index cca749f..bd1e5a3 100644
--- a/plugins/experimental/cacheurl/Makefile.am
+++ b/plugins/experimental/cacheurl/Makefile.am
@@ -14,11 +14,8 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
 
-AM_CPPFLAGS = -I$(top_builddir)/proxy/api -I$(top_srcdir)/proxy/api \
-     -I$(top_builddir)/lib/ts -I$(top_srcdir)/lib/ts
-
-pkglibdir = ${pkglibexecdir}
+include $(top_srcdir)/build/plugins.mk
 
 pkglib_LTLIBRARIES = cacheurl.la
 cacheurl_la_SOURCES = cacheurl.c
-cacheurl_la_LDFLAGS = -avoid-version -module -shared
+cacheurl_la_LDFLAGS = $(TS_PLUGIN_LDFLAGS)

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1b92b8b3/plugins/experimental/channel_stats/Makefile.am
----------------------------------------------------------------------
diff --git a/plugins/experimental/channel_stats/Makefile.am b/plugins/experimental/channel_stats/Makefile.am
index 6438ce0..032a8b2 100644
--- a/plugins/experimental/channel_stats/Makefile.am
+++ b/plugins/experimental/channel_stats/Makefile.am
@@ -14,10 +14,8 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
 
-AM_CPPFLAGS = -I$(top_builddir)/proxy/api -I$(top_srcdir)/proxy/api \
-     -I$(top_builddir)/lib/ts -I$(top_srcdir)/lib/ts
+include $(top_srcdir)/build/plugins.mk
 
-pkglibdir = ${pkglibexecdir}
 pkglib_LTLIBRARIES = channel_stats.la
 channel_stats_la_SOURCES = channel_stats.cc
-channel_stats_la_LDFLAGS = -module -avoid-version -shared
+channel_stats_la_LDFLAGS = $(TS_PLUGIN_LDFLAGS)

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1b92b8b3/plugins/experimental/channel_stats/channel_stats.cc
----------------------------------------------------------------------
diff --git a/plugins/experimental/channel_stats/channel_stats.cc b/plugins/experimental/channel_stats/channel_stats.cc
index 09d7152..d6b7724 100644
--- a/plugins/experimental/channel_stats/channel_stats.cc
+++ b/plugins/experimental/channel_stats/channel_stats.cc
@@ -16,7 +16,6 @@
   limitations under the License.
 */
 
-
 #include "ink_platform.h"
 #include "ink_defs.h"
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1b92b8b3/plugins/experimental/custom_redirect/Makefile.am
----------------------------------------------------------------------
diff --git a/plugins/experimental/custom_redirect/Makefile.am b/plugins/experimental/custom_redirect/Makefile.am
index 1b03088..302244f 100644
--- a/plugins/experimental/custom_redirect/Makefile.am
+++ b/plugins/experimental/custom_redirect/Makefile.am
@@ -14,11 +14,9 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
 
-AM_CPPFLAGS = -I$(top_builddir)/proxy/api -I$(top_srcdir)/proxy/api \
-              -I$(top_srcdir)/lib/ts -I$(top_builddir)/lib/ts
+include $(top_srcdir)/build/plugins.mk
 
-pkglibdir = ${pkglibexecdir}
 pkglib_LTLIBRARIES = custom_redirect.la
 custom_redirect_la_SOURCES = custom_redirect.cc
-custom_redirect_la_LDFLAGS = -module -avoid-version -shared
+custom_redirect_la_LDFLAGS = $(TS_PLUGIN_LDFLAGS)
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1b92b8b3/plugins/experimental/esi/Makefile.am
----------------------------------------------------------------------
diff --git a/plugins/experimental/esi/Makefile.am b/plugins/experimental/esi/Makefile.am
index b103dd0..9c796ed 100644
--- a/plugins/experimental/esi/Makefile.am
+++ b/plugins/experimental/esi/Makefile.am
@@ -14,17 +14,14 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
 
-pkglibdir = ${pkglibexecdir}
+include $(top_srcdir)/build/plugins.mk
 
-
-AM_CXXFLAGS = \
+AM_CPPFLAGS += \
   -I$(srcdir)/lib \
   -I$(srcdir)/fetcher \
-  -I$(srcdir)/test \
-  -I$(top_builddir)/proxy/api \
-  -I$(top_srcdir)/proxy/api \
-  -I$(top_builddir)/lib/ts \
-  -I$(top_srcdir)/lib/ts \
+  -I$(srcdir)/test
+
+AM_CXXFLAGS = \
   -Wno-deprecated
 
 pkglib_LTLIBRARIES = esi.la combo_handler.la
@@ -68,21 +65,21 @@ combo_handler_la_SOURCES = \
 	fetcher/HttpDataFetcherImpl.cc
 
 esi_la_LIBADD = libesi.la
-esi_la_LDFLAGS = -module -avoid-version -shared
+esi_la_LDFLAGS = $(TS_PLUGIN_LDFLAGS)
 
 combo_handler_la_LIBADD = libesi.la
 combo_handler_la_LDFLAGS = -module -avoid-version -shared
 
 docnode_test_SOURCES = test/docnode_test.cc test/print_funcs.cc
-docnode_test_LDADD = libesi.la  @LIBDL@ -lz -lpthread
+docnode_test_LDADD = libesi.la  @LIBDL@ -lz @LIBTHREAD@
 parser_test_SOURCES = test/parser_test.cc test/print_funcs.cc
-parser_test_LDADD = libesi.la  @LIBDL@ -lz -lpthread
+parser_test_LDADD = libesi.la  @LIBDL@ -lz @LIBTHREAD@
 processor_test_SOURCES = test/processor_test.cc test/HandlerMap.cc test/StubIncludeHandler.cc test/print_funcs.cc
-processor_test_LDADD = libtest.la  @LIBDL@ -lz -lpthread
+processor_test_LDADD = libtest.la  @LIBDL@ -lz @LIBTHREAD@
 utils_test_SOURCES = test/utils_test.cc test/print_funcs.cc
-utils_test_LDADD = libesi.la  @LIBDL@ -lz -lpthread
+utils_test_LDADD = libesi.la  @LIBDL@ -lz @LIBTHREAD@
 vars_test_SOURCES = test/vars_test.cc test/print_funcs.cc
-vars_test_LDADD = libesi.la @LIBDL@ -lz -lpthread
+vars_test_LDADD = libesi.la @LIBDL@ -lz @LIBTHREAD@
 
 TESTS = $(check_PROGRAMS)
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1b92b8b3/plugins/experimental/esi/esi.cc
----------------------------------------------------------------------
diff --git a/plugins/experimental/esi/esi.cc b/plugins/experimental/esi/esi.cc
index ec13b5e..994f5f0 100644
--- a/plugins/experimental/esi/esi.cc
+++ b/plugins/experimental/esi/esi.cc
@@ -20,6 +20,7 @@
   See the License for the specific language governing permissions and
   limitations under the License.
  */
+
 #include "ink_defs.h"   
 
 #include <stdio.h>

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1b92b8b3/plugins/experimental/gzip/Makefile.am
----------------------------------------------------------------------
diff --git a/plugins/experimental/gzip/Makefile.am b/plugins/experimental/gzip/Makefile.am
index f3fec21..3c7861b 100644
--- a/plugins/experimental/gzip/Makefile.am
+++ b/plugins/experimental/gzip/Makefile.am
@@ -14,10 +14,8 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
 
-AM_CPPFLAGS = -I$(top_builddir)/proxy/api -I$(top_srcdir)/proxy/api \
-    -I$(top_builddir)/lib/ts -I$(top_srcdir)/lib/ts
-pkglibdir = ${pkglibexecdir}
+include $(top_srcdir)/build/plugins.mk
 
 pkglib_LTLIBRARIES = gzip.la
 gzip_la_SOURCES = gzip.cc configuration.cc misc.cc
-gzip_la_LDFLAGS = -avoid-version -module -shared
+gzip_la_LDFLAGS = $(TS_PLUGIN_LDFLAGS)

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1b92b8b3/plugins/experimental/header_rewrite/Makefile.am
----------------------------------------------------------------------
diff --git a/plugins/experimental/header_rewrite/Makefile.am b/plugins/experimental/header_rewrite/Makefile.am
index 80d77f0..bef7840 100644
--- a/plugins/experimental/header_rewrite/Makefile.am
+++ b/plugins/experimental/header_rewrite/Makefile.am
@@ -14,18 +14,26 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
 
-pkglibdir = ${pkglibexecdir}
+include $(top_srcdir)/build/plugins.mk
 
 if BUILD_HAVE_BOOST
 
-AM_CPPFLAGS = $(BOOST_CPPFLAGS) \
-	      -I$(top_builddir)/proxy/api -I$(top_srcdir)/proxy/api \
-              -I$(top_srcdir)/lib/ts -I$(top_builddir)/lib/ts
-
-AM_LDFLAGS = $(BOOST_LDFLAGS)
+AM_CPPFLAGS += $(BOOST_CPPFLAGS)
 
 pkglib_LTLIBRARIES = header_rewrite.la
-header_rewrite_la_SOURCES = condition.cc conditions.cc factory.cc header_rewrite.cc matcher.cc operator.cc operators.cc parser.cc regex_helper.cc resources.cc ruleset.cc statement.cc
-header_rewrite_la_LDFLAGS = -module -avoid-version -shared
+header_rewrite_la_SOURCES = \
+  condition.cc \
+  conditions.cc \
+  factory.cc \
+  header_rewrite.cc \
+  matcher.cc \
+  operator.cc \
+  operators.cc \
+  parser.cc \
+  regex_helper.cc \
+  resources.cc \
+  ruleset.cc \
+  statement.cc
+header_rewrite_la_LDFLAGS = $(BOOST_LDFLAGS) $(TS_PLUGIN_LDFLAGS)
 
 endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1b92b8b3/plugins/experimental/lua/Makefile.am
----------------------------------------------------------------------
diff --git a/plugins/experimental/lua/Makefile.am b/plugins/experimental/lua/Makefile.am
index 736e176..0a41390 100644
--- a/plugins/experimental/lua/Makefile.am
+++ b/plugins/experimental/lua/Makefile.am
@@ -14,7 +14,7 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
 
-pkglibdir = ${pkglibexecdir}
+include $(top_srcdir)/build/plugins.mk
 
 if BUILD_LUA_SUPPORT
 
@@ -23,16 +23,13 @@ if BUILD_LUA_SUPPORT
 # (/opt/local/include) headers, then we need to make sure that we don't end up
 # building with the Lua headers but linking LuaJIT.
 lua_la_CPPFLAGS = \
-  ${LUA_CFLAGS} \
-  -I$(top_builddir)/proxy/api \
-  -I$(top_srcdir)/proxy/api \
-  -I$(top_builddir)/lib/ts \
-  -I$(top_srcdir)/lib/ts
+  $(LUA_CFLAGS) \
+  $(AM_CPPFLAGS)
 
 pkglib_LTLIBRARIES = lua.la
 
-lua_la_LIBADD = ${LUA_LIBS}
+lua_la_LIBADD = $(LUA_LIBS)
 lua_la_SOURCES = remap.cc plugin.cc lapi.cc lutil.cc lconfig.cc hook.cc state.cc
-lua_la_LDFLAGS = -module -avoid-version -shared
+lua_la_LDFLAGS = $(TS_PLUGIN_LDFLAGS)
 
 endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1b92b8b3/plugins/experimental/metalink/Makefile.am
----------------------------------------------------------------------
diff --git a/plugins/experimental/metalink/Makefile.am b/plugins/experimental/metalink/Makefile.am
index 707c25a..490c980 100644
--- a/plugins/experimental/metalink/Makefile.am
+++ b/plugins/experimental/metalink/Makefile.am
@@ -14,11 +14,8 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
 
-AM_CPPFLAGS = -I$(top_builddir)/proxy/api -I$(top_srcdir)/proxy/api \
-    -I$(top_builddir)/lib/ts -I$(top_srcdir)/lib/ts
-
-pkglibdir = ${pkglibexecdir}
+include $(top_srcdir)/build/plugins.mk
 
 pkglib_LTLIBRARIES = metalink.la
 metalink_la_SOURCES = metalink.cc
-metalink_la_LDFLAGS = -avoid-version -module -shared
+metalink_la_LDFLAGS = $(TS_PLUGIN_LDFLAGS)

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1b92b8b3/plugins/experimental/rfc5861/Makefile.am
----------------------------------------------------------------------
diff --git a/plugins/experimental/rfc5861/Makefile.am b/plugins/experimental/rfc5861/Makefile.am
index ad7ab17..d878858 100644
--- a/plugins/experimental/rfc5861/Makefile.am
+++ b/plugins/experimental/rfc5861/Makefile.am
@@ -14,10 +14,8 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
 
-AM_CPPFLAGS = -I$(top_builddir)/proxy/api -I$(top_srcdir)/proxy/api \
-    -I$(top_builddir)/lib/ts -I$(top_srcdir)/lib/ts
+include $(top_srcdir)/build/plugins.mk
 
-pkglibdir = ${pkglibexecdir}
 pkglib_LTLIBRARIES = rfc5861.la
 rfc5861_la_SOURCES = rfc5861.c
-rfc5861_la_LDFLAGS = -module -avoid-version -shared
+rfc5861_la_LDFLAGS = $(TS_PLUGIN_LDFLAGS)

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1b92b8b3/plugins/experimental/spdy/Makefile.am
----------------------------------------------------------------------
diff --git a/plugins/experimental/spdy/Makefile.am b/plugins/experimental/spdy/Makefile.am
index 8fc28f5..298d9f4 100644
--- a/plugins/experimental/spdy/Makefile.am
+++ b/plugins/experimental/spdy/Makefile.am
@@ -14,7 +14,7 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
 
-pkglibdir = ${pkglibexecdir}
+include $(top_srcdir)/build/plugins.mk
 
 if BUILD_HAVE_CXX_11
 
@@ -22,12 +22,8 @@ pkglib_LTLIBRARIES = spdy.la
 lib_LTLIBRARIES = libspdy.la
 check_PROGRAMS = zstream_test
 
-AM_CPPFLAGS = \
-  -I$(srcdir)/lib \
-  -I$(top_builddir)/lib/ts \
-  -I$(top_srcdir)/lib/ts \
-  -I$(top_builddir)/proxy/api \
-  -I$(top_srcdir)/proxy/api
+AM_CPPFLAGS += \
+  -I$(srcdir)/lib
 
 if BUILD_HAVE_LIBCXX
 AM_CXXFLAGS = -stdlib=libc++
@@ -47,7 +43,7 @@ libspdy_la_SOURCES = \
   lib/spdy/zstream.cc
 
 spdy_la_LIBADD = libspdy.la
-spdy_la_LDFLAGS = -module -avoid-version -shared
+spdy_la_LDFLAGS = $(TS_PLUGIN_LDFLAGS)
 
 zstream_test_SOURCES = tests/zstream_test.cc tests/stubs.cc
 zstream_test_LDADD = libspdy.la -lz

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1b92b8b3/plugins/experimental/tcp_info/Makefile.am
----------------------------------------------------------------------
diff --git a/plugins/experimental/tcp_info/Makefile.am b/plugins/experimental/tcp_info/Makefile.am
index d200ad2..7e6e5f1 100644
--- a/plugins/experimental/tcp_info/Makefile.am
+++ b/plugins/experimental/tcp_info/Makefile.am
@@ -14,16 +14,13 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
 
-pkglibdir = ${pkglibexecdir}
-
-AM_CPPFLAGS = -I$(top_builddir)/proxy/api -I$(top_srcdir)/proxy/api \
-              -I$(top_srcdir)/lib/ts -I$(top_builddir)/lib/ts
+include $(top_srcdir)/build/plugins.mk
 
 if BUILD_TCPINFO_PLUGIN
 
 pkglib_LTLIBRARIES = tcp_info.la
 tcp_info_la_SOURCES = tcp_info.cc
-tcp_info_la_LDFLAGS = -module -avoid-version -shared
+tcp_info_la_LDFLAGS = $(TS_PLUGIN_LDFLAGS)
 
 endif
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1b92b8b3/plugins/header_filter/Makefile.am
----------------------------------------------------------------------
diff --git a/plugins/header_filter/Makefile.am b/plugins/header_filter/Makefile.am
index b86777a..fc752bd 100644
--- a/plugins/header_filter/Makefile.am
+++ b/plugins/header_filter/Makefile.am
@@ -14,10 +14,8 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
 
-AM_CPPFLAGS = -I$(top_builddir)/proxy/api -I$(top_srcdir)/proxy/api \
-              -I$(top_srcdir)/lib/ts -I$(top_builddir)/lib/ts
+include $(top_srcdir)/build/plugins.mk
 
-pkglibdir = ${pkglibexecdir}
 pkglib_LTLIBRARIES = header_filter.la
 header_filter_la_SOURCES = header_filter.cc rules.cc
-header_filter_la_LDFLAGS = -module -avoid-version -shared
+header_filter_la_LDFLAGS = $(TS_PLUGIN_LDFLAGS)

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1b92b8b3/plugins/regex_remap/Makefile.am
----------------------------------------------------------------------
diff --git a/plugins/regex_remap/Makefile.am b/plugins/regex_remap/Makefile.am
index 08acecf..5a696cb 100644
--- a/plugins/regex_remap/Makefile.am
+++ b/plugins/regex_remap/Makefile.am
@@ -14,10 +14,8 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
 
-AM_CPPFLAGS = -I$(top_builddir)/proxy/api -I$(top_srcdir)/proxy/api \
-              -I$(top_srcdir)/lib/ts -I$(top_builddir)/lib/ts
+include $(top_srcdir)/build/plugins.mk
 
-pkglibdir = ${pkglibexecdir}
 pkglib_LTLIBRARIES = regex_remap.la
 regex_remap_la_SOURCES = regex_remap.cc
-regex_remap_la_LDFLAGS = -module -avoid-version -shared
+regex_remap_la_LDFLAGS = $(TS_PLUGIN_LDFLAGS)

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1b92b8b3/plugins/stats_over_http/Makefile.am
----------------------------------------------------------------------
diff --git a/plugins/stats_over_http/Makefile.am b/plugins/stats_over_http/Makefile.am
index f624567..a9c04d7 100644
--- a/plugins/stats_over_http/Makefile.am
+++ b/plugins/stats_over_http/Makefile.am
@@ -14,10 +14,8 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
 
-AM_CPPFLAGS = -I$(top_builddir)/proxy/api -I$(top_srcdir)/proxy/api \
-    -I$(top_builddir)/lib/ts -I$(top_srcdir)/lib/ts
+include $(top_srcdir)/build/plugins.mk
 
-pkglibdir = ${pkglibexecdir}
 pkglib_LTLIBRARIES = stats_over_http.la
 stats_over_http_la_SOURCES = stats_over_http.c
-stats_over_http_la_LDFLAGS = -module -avoid-version -shared
+stats_over_http_la_LDFLAGS = $(TS_PLUGIN_LDFLAGS)

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1b92b8b3/proxy/Main.cc
----------------------------------------------------------------------
diff --git a/proxy/Main.cc b/proxy/Main.cc
index 8f64bb5..9d04841 100644
--- a/proxy/Main.cc
+++ b/proxy/Main.cc
@@ -157,10 +157,8 @@ static char error_tags[1024] = "";
 static char action_tags[1024] = "";
 static int show_statistics = 0;
 static int history_info_enabled = 1;
-//inkcoreapi Diags *diags = NULL;
 static inkcoreapi DiagsConfig *diagsConfig = NULL;
 HttpBodyFactory *body_factory = NULL;
-static int diags_init = 0;             // used by process manager
 
 static char vingid_flag[255] = "";
 
@@ -1371,7 +1369,6 @@ main(int argc, char **argv)
   // re-start it again, TS will crash.
   diagsConfig = NEW(new DiagsConfig(error_tags, action_tags, false));
   diags = diagsConfig->diags;
-  diags_init = 1;
   diags->prefix_str = "Server ";
   if (is_debug_tag_set("diags"))
     diags->dump();
@@ -1433,7 +1430,6 @@ main(int argc, char **argv)
   diagsConfig = NEW(new DiagsConfig(error_tags, action_tags, true));
   diags = diagsConfig->diags;
   RecSetDiags(diags);
-  diags_init = 1;
   diags->prefix_str = "Server ";
   if (is_debug_tag_set("diags"))
     diags->dump();

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1b92b8b3/proxy/logcat.cc
----------------------------------------------------------------------
diff --git a/proxy/logcat.cc b/proxy/logcat.cc
index 71a02c1..eab1a8d 100644
--- a/proxy/logcat.cc
+++ b/proxy/logcat.cc
@@ -60,7 +60,7 @@ static char output_file[1024];
 extern int CacheClusteringEnabled;
 int auto_clear_cache_flag = 0;
 
-ArgumentDescription argument_descriptions[] = {
+static const ArgumentDescription argument_descriptions[] = {
 
   {"output_file", 'o', "Specify output file", "S1023", &output_file, NULL, NULL},
   {"auto_filenames", 'a', "Automatically generate output names",
@@ -77,7 +77,7 @@ ArgumentDescription argument_descriptions[] = {
   {"elf2", '2', "Convert to Extended2 Logging Format", "T", &elf2_flag, NULL,
    NULL}
 };
-int n_argument_descriptions = SIZE(argument_descriptions);
+static const int n_argument_descriptions = SIZE(argument_descriptions);
 
 static const char *USAGE_LINE = "Usage: " PROGRAM_NAME " [-o output-file | -a] [-CEhS"
 #ifdef DEBUG
@@ -87,7 +87,7 @@ static const char *USAGE_LINE = "Usage: " PROGRAM_NAME " [-o output-file | -a] [
 
 
 
-int
+static int
 process_file(int in_fd, int out_fd)
 {
   char buffer[MAX_LOGBUFFER_SIZE];
@@ -185,7 +185,7 @@ process_file(int in_fd, int out_fd)
   }
 }
 
-int
+static int
 open_output_file(char *output_file)
 {
   int file_desc = 0;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1b92b8b3/proxy/logging/LogStandalone.cc
----------------------------------------------------------------------
diff --git a/proxy/logging/LogStandalone.cc b/proxy/logging/LogStandalone.cc
index ba0f6d2..7bcffea 100644
--- a/proxy/logging/LogStandalone.cc
+++ b/proxy/logging/LogStandalone.cc
@@ -42,9 +42,7 @@
 // Needs LibRecordsConfigInit()
 #include "RecordsConfig.h"
 
-#define LOG_ReadConfigString REC_ReadConfigString
-
-#define HttpBodyFactory		int
+class HttpBodyFactory;
 
 // globals the rest of the system depends on
 extern int fds_limit;
@@ -69,7 +67,7 @@ char action_tags[1024] = "";
 char command_string[512] = "";
 
 
-Diags *diags = NULL;
+//Diags *diags = NULL;
 DiagsConfig *diagsConfig = NULL;
 HttpBodyFactory *body_factory = NULL;
 AppVersionInfo appVersionInfo;
@@ -130,7 +128,7 @@ initialize_process_manager()
 
   pmgmt->reconfigure();
 
-  LOG_ReadConfigString(system_config_directory, "proxy.config.config_dir", PATH_NAME_MAX);
+  REC_ReadConfigString(system_config_directory, "proxy.config.config_dir", PATH_NAME_MAX);
 
   //
   // Define version info records

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1b92b8b3/tools/jtest/jtest.cc
----------------------------------------------------------------------
diff --git a/tools/jtest/jtest.cc b/tools/jtest/jtest.cc
index 19042fc..621ee48 100644
--- a/tools/jtest/jtest.cc
+++ b/tools/jtest/jtest.cc
@@ -45,7 +45,10 @@
 #include <limits.h>
 #include <sys/mman.h>
 
-#define __STDC_FORMAT_MACROS
+#ifndef __STDC_FORMAT_MACROS
+#define __STDC_FORMAT_MACROS 1
+#endif
+
 #include <inttypes.h>
 
 #include <time.h>