From: des Date: Tue, 24 Apr 2007 09:39:12 +0000 (+0000) Subject: Correctly detect the presence and location of all external library we use X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=399d657c5962d10935470a9183179a77741aae20;p=varnish Correctly detect the presence and location of all external library we use (except for the C math library, which the C standard guarantees is always available as -lm) and more importantly, use them only where needed. This should fix the compilation issues on SuSE. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@1364 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/bin/varnishd/Makefile.am b/varnish-cache/bin/varnishd/Makefile.am index e11bbdc4..729e4fe7 100644 --- a/varnish-cache/bin/varnishd/Makefile.am +++ b/varnish-cache/bin/varnishd/Makefile.am @@ -61,4 +61,5 @@ varnishd_LDFLAGS = -export-dynamic varnishd_LDADD = \ $(top_builddir)/lib/libcompat/libcompat.a \ $(top_builddir)/lib/libvarnish/libvarnish.la \ - $(top_builddir)/lib/libvcl/libvcl.la + $(top_builddir)/lib/libvcl/libvcl.la \ + ${DL_LIBS} ${RT_LIBS} ${PTHREAD_LIBS} diff --git a/varnish-cache/bin/varnishhist/Makefile.am b/varnish-cache/bin/varnishhist/Makefile.am index 152ccb62..e0756d8e 100644 --- a/varnish-cache/bin/varnishhist/Makefile.am +++ b/varnish-cache/bin/varnishhist/Makefile.am @@ -14,4 +14,5 @@ varnishhist_LDADD = \ $(top_builddir)/lib/libcompat/libcompat.a \ $(top_builddir)/lib/libvarnish/libvarnish.la \ $(top_builddir)/lib/libvarnishapi/libvarnishapi.la \ - -lm -lcurses + -lm \ + ${CURSES_LIBS} diff --git a/varnish-cache/bin/varnishstat/Makefile.am b/varnish-cache/bin/varnishstat/Makefile.am index 6b4a6eba..a1832315 100644 --- a/varnish-cache/bin/varnishstat/Makefile.am +++ b/varnish-cache/bin/varnishstat/Makefile.am @@ -14,4 +14,4 @@ varnishstat_LDADD = \ $(top_builddir)/lib/libcompat/libcompat.a \ $(top_builddir)/lib/libvarnish/libvarnish.la \ $(top_builddir)/lib/libvarnishapi/libvarnishapi.la \ - -lcurses + ${CURSES_LIBS} ${RT_LIBS} diff --git a/varnish-cache/bin/varnishtop/Makefile.am b/varnish-cache/bin/varnishtop/Makefile.am index 377486d4..d9de7adb 100644 --- a/varnish-cache/bin/varnishtop/Makefile.am +++ b/varnish-cache/bin/varnishtop/Makefile.am @@ -14,4 +14,4 @@ varnishtop_LDADD = \ $(top_builddir)/lib/libcompat/libcompat.a \ $(top_builddir)/lib/libvarnish/libvarnish.la \ $(top_builddir)/lib/libvarnishapi/libvarnishapi.la \ - -lcurses + ${CURSES_LIBS} diff --git a/varnish-cache/configure.ac b/varnish-cache/configure.ac index 83f3926a..e051c2f5 100644 --- a/varnish-cache/configure.ac +++ b/varnish-cache/configure.ac @@ -35,10 +35,33 @@ AC_PROG_LIBTOOL AC_PROG_MAKE_SET # Checks for libraries. +save_LIBS="${LIBS}" +LIBS="" AC_CHECK_LIB(rt, clock_gettime) +RT_LIBS="${LIBS}" +LIBS="${save_LIBS}" +AC_SUBST(RT_LIBS) + +save_LIBS="${LIBS}" +LIBS="" AC_CHECK_LIB(dl, dlopen) -#AC_SEARCH_LIBS(initscr, [curses ncurses]) +DL_LIBS="${LIBS}" +LIBS="${save_LIBS}" +AC_SUBST(DL_LIBS) + +save_LIBS="${LIBS}" +LIBS="" +AC_SEARCH_LIBS(initscr, [curses ncurses]) +CURSES_LIBS="${LIBS}" +LIBS="${save_LIBS}" +AC_SUBST(CURSES_LIBS) + +save_LIBS="${LIBS}" +LIBS="" AC_SEARCH_LIBS(pthread_create, [thr pthread c_r]) +PTHREAD_LIBS="${LIBS}" +LIBS="${save_LIBS}" +AC_SUBST(PTHREAD_LIBS) # Checks for header files. AC_HEADER_STDC @@ -79,7 +102,11 @@ AC_CHECK_FUNCS([srandomdev]) AC_CHECK_FUNCS([strlcat strlcpy]) AC_CHECK_FUNCS([strndup]) AC_CHECK_FUNCS([vis strvis strvisx]) + +save_LIBS="${LIBS}" +LIBS="${LIBS} ${RT_LIBS}" AC_CHECK_FUNCS([clock_gettime]) +LIBS="${save_LIBS}" # Check which mechanism to use for the acceptor AC_CHECK_FUNCS([kqueue])