From 4ba7b6dd84bd401a4bf95013334e0b2cec47917d Mon Sep 17 00:00:00 2001 From: des Date: Tue, 25 Sep 2007 08:21:28 +0000 Subject: [PATCH] Portability: use -lsocket / -lns on systems that need it (read Solaris), use instead of our own if present. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2032 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishadm/Makefile.am | 3 ++- varnish-cache/bin/varnishd/Makefile.am | 2 +- varnish-cache/bin/varnishd/cache.h | 5 +++++ varnish-cache/bin/varnishd/heritage.h | 5 +++++ varnish-cache/bin/varnishd/mgt_event.h | 5 +++++ varnish-cache/bin/varnishd/mgt_vcc.c | 5 +++++ varnish-cache/bin/varnishd/stevedore.h | 4 ++++ varnish-cache/bin/varnishreplay/Makefile.am | 3 +-- varnish-cache/bin/varnishreplay/varnishreplay.c | 7 ++++++- varnish-cache/bin/varnishtop/varnishtop.c | 7 ++++++- varnish-cache/configure.ac | 9 +++++++++ varnish-cache/lib/libvarnish/Makefile.am | 2 +- varnish-cache/lib/libvcl/vcc_compile.c | 9 +++++++-- varnish-cache/lib/libvcl/vcc_compile.h | 5 +++++ varnish-cache/lib/libvcl/vcc_token.c | 7 ++++++- 15 files changed, 68 insertions(+), 10 deletions(-) diff --git a/varnish-cache/bin/varnishadm/Makefile.am b/varnish-cache/bin/varnishadm/Makefile.am index e2f37f2a..0efdd23c 100644 --- a/varnish-cache/bin/varnishadm/Makefile.am +++ b/varnish-cache/bin/varnishadm/Makefile.am @@ -13,4 +13,5 @@ varnishadm_CFLAGS = -include config.h varnishadm_LDADD = \ $(top_builddir)/lib/libvarnish/libvarnish.la \ - $(top_builddir)/lib/libvarnishcompat/libvarnishcompat.la + $(top_builddir)/lib/libvarnishcompat/libvarnishcompat.la \ + ${NET_LIBS} diff --git a/varnish-cache/bin/varnishd/Makefile.am b/varnish-cache/bin/varnishd/Makefile.am index 956a1ab2..a2b0b849 100644 --- a/varnish-cache/bin/varnishd/Makefile.am +++ b/varnish-cache/bin/varnishd/Makefile.am @@ -70,4 +70,4 @@ varnishd_LDADD = \ $(top_builddir)/lib/libvarnish/libvarnish.la \ $(top_builddir)/lib/libvarnishcompat/libvarnishcompat.la \ $(top_builddir)/lib/libvcl/libvcl.la \ - ${DL_LIBS} ${PTHREAD_LIBS} ${LIBM} + ${DL_LIBS} ${PTHREAD_LIBS} ${NET_LIBS} ${LIBM} diff --git a/varnish-cache/bin/varnishd/cache.h b/varnish-cache/bin/varnishd/cache.h index 3384710e..bec6b2dc 100644 --- a/varnish-cache/bin/varnishd/cache.h +++ b/varnish-cache/bin/varnishd/cache.h @@ -36,7 +36,12 @@ #include #include +#ifdef HAVE_SYS_QUEUE_H +#include +#else #include "queue.h" +#endif + #include "vsb.h" #include "libvarnish.h" diff --git a/varnish-cache/bin/varnishd/heritage.h b/varnish-cache/bin/varnishd/heritage.h index 27902b6b..6c783007 100644 --- a/varnish-cache/bin/varnishd/heritage.h +++ b/varnish-cache/bin/varnishd/heritage.h @@ -32,7 +32,12 @@ */ #include + +#ifdef HAVE_SYS_QUEUE_H +#include +#else #include "queue.h" +#endif struct listen_sock { TAILQ_ENTRY(listen_sock) list; diff --git a/varnish-cache/bin/varnishd/mgt_event.h b/varnish-cache/bin/varnishd/mgt_event.h index 68b547be..c224cdd9 100644 --- a/varnish-cache/bin/varnishd/mgt_event.h +++ b/varnish-cache/bin/varnishd/mgt_event.h @@ -30,7 +30,12 @@ */ #include + +#ifdef HAVE_SYS_QUEUE_H +#include +#else #include "queue.h" +#endif struct ev; struct evbase; diff --git a/varnish-cache/bin/varnishd/mgt_vcc.c b/varnish-cache/bin/varnishd/mgt_vcc.c index cc69b049..36a29ef0 100644 --- a/varnish-cache/bin/varnishd/mgt_vcc.c +++ b/varnish-cache/bin/varnishd/mgt_vcc.c @@ -44,7 +44,12 @@ #include "compat/asprintf.h" #endif #include "vsb.h" + +#ifdef HAVE_SYS_QUEUE_H +#include +#else #include "queue.h" +#endif #include "libvcl.h" #include "cli.h" diff --git a/varnish-cache/bin/varnishd/stevedore.h b/varnish-cache/bin/varnishd/stevedore.h index 1d1ba1b6..91d45ba4 100644 --- a/varnish-cache/bin/varnishd/stevedore.h +++ b/varnish-cache/bin/varnishd/stevedore.h @@ -29,7 +29,11 @@ * $Id$ */ +#ifdef HAVE_SYS_QUEUE_H +#include +#else #include "queue.h" +#endif struct stevedore; struct sess; diff --git a/varnish-cache/bin/varnishreplay/Makefile.am b/varnish-cache/bin/varnishreplay/Makefile.am index fb079fb9..bef4a6fb 100644 --- a/varnish-cache/bin/varnishreplay/Makefile.am +++ b/varnish-cache/bin/varnishreplay/Makefile.am @@ -15,5 +15,4 @@ varnishreplay_LDADD = \ $(top_builddir)/lib/libvarnish/libvarnish.la \ $(top_builddir)/lib/libvarnishcompat/libvarnishcompat.la \ $(top_builddir)/lib/libvarnishapi/libvarnishapi.la \ - ${PTHREAD_LIBS} - + ${PTHREAD_LIBS} ${NET_LIBS} diff --git a/varnish-cache/bin/varnishreplay/varnishreplay.c b/varnish-cache/bin/varnishreplay/varnishreplay.c index 1b86efe6..f34984dc 100644 --- a/varnish-cache/bin/varnishreplay/varnishreplay.c +++ b/varnish-cache/bin/varnishreplay/varnishreplay.c @@ -38,8 +38,13 @@ #include #include -#include "libvarnish.h" +#ifdef HAVE_SYS_QUEUE_H +#include +#else #include "queue.h" +#endif + +#include "libvarnish.h" #include "varnishapi.h" #include "vss.h" diff --git a/varnish-cache/bin/varnishtop/varnishtop.c b/varnish-cache/bin/varnishtop/varnishtop.c index a4d28af8..dca9ff67 100644 --- a/varnish-cache/bin/varnishtop/varnishtop.c +++ b/varnish-cache/bin/varnishtop/varnishtop.c @@ -43,11 +43,16 @@ #include #include +#ifdef HAVE_SYS_QUEUE_H +#include +#else +#include "queue.h" +#endif + #include "vsb.h" #include "libvarnish.h" #include "shmlog.h" -#include "queue.h" #include "varnishapi.h" struct top { diff --git a/varnish-cache/configure.ac b/varnish-cache/configure.ac index 9326c22e..4540e4e0 100644 --- a/varnish-cache/configure.ac +++ b/varnish-cache/configure.ac @@ -50,6 +50,14 @@ PTHREAD_LIBS="${LIBS}" LIBS="${save_LIBS}" AC_SUBST(PTHREAD_LIBS) +save_LIBS="${LIBS}" +LIBS="" +AC_CHECK_LIB(socket, socket) +AC_CHECK_LIB(getaddrinfo, ns) +NET_LIBS="${LIBS}" +LIBS="${save_LIBS}" +AC_SUBST(NET_LIBS) + AC_CHECK_LIBM AC_SUBST(LIBM) @@ -57,6 +65,7 @@ AC_SUBST(LIBM) AC_HEADER_STDC AC_HEADER_SYS_WAIT AC_HEADER_TIME +AC_CHECK_HEADERS([sys/queue.h]) AC_CHECK_HEADERS([sys/socket.h]) AC_CHECK_HEADERS([sys/mount.h]) AC_CHECK_HEADERS([sys/vfs.h]) diff --git a/varnish-cache/lib/libvarnish/Makefile.am b/varnish-cache/lib/libvarnish/Makefile.am index 278286ee..c377ae8d 100644 --- a/varnish-cache/lib/libvarnish/Makefile.am +++ b/varnish-cache/lib/libvarnish/Makefile.am @@ -20,4 +20,4 @@ libvarnish_la_SOURCES = \ libvarnish_la_CFLAGS = -include config.h -libvarnish_la_LIBADD = ${RT_LIBS} +libvarnish_la_LIBADD = ${RT_LIBS} ${NET_LIBS} diff --git a/varnish-cache/lib/libvcl/vcc_compile.c b/varnish-cache/lib/libvcl/vcc_compile.c index bf09a7f5..f3f83978 100644 --- a/varnish-cache/lib/libvcl/vcc_compile.c +++ b/varnish-cache/lib/libvcl/vcc_compile.c @@ -60,6 +60,8 @@ * and all the rest... */ +#include + #include #include #include @@ -69,10 +71,13 @@ #include #include -#include +#ifdef HAVE_SYS_QUEUE_H +#include +#else +#include "queue.h" +#endif #include "vsb.h" -#include "queue.h" #include "vcc_priv.h" #include "vcc_compile.h" diff --git a/varnish-cache/lib/libvcl/vcc_compile.h b/varnish-cache/lib/libvcl/vcc_compile.h index 4d8b8a4a..0ae1ec64 100644 --- a/varnish-cache/lib/libvcl/vcc_compile.h +++ b/varnish-cache/lib/libvcl/vcc_compile.h @@ -29,7 +29,12 @@ * $Id$ */ +#ifdef HAVE_SYS_QUEUE_H +#include +#else #include "queue.h" +#endif + #include "vcl_returns.h" #define INDENT 2 diff --git a/varnish-cache/lib/libvcl/vcc_token.c b/varnish-cache/lib/libvcl/vcc_token.c index 37e41ce8..d193be5c 100644 --- a/varnish-cache/lib/libvcl/vcc_token.c +++ b/varnish-cache/lib/libvcl/vcc_token.c @@ -34,8 +34,13 @@ #include #include -#include "vsb.h" +#ifdef HAVE_SYS_QUEUE_H +#include +#else #include "queue.h" +#endif + +#include "vsb.h" #include "libvarnish.h" #include "vcc_priv.h" -- 2.39.5