summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6e03727)
raw | patch | inline | side by side (parent: 6e03727)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Mon, 3 May 2004 14:05:48 +0000 (14:05 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Mon, 3 May 2004 14:05:48 +0000 (14:05 +0000) |
* Add configure options
--disable-rrdcgi disable building of rrdcgi
--disable-pthread disable multithread support
-- Stanislav Sinyagin <ssinyagin@yahoo.com>
git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk@244 a5681a0c-68f1-0310-ab6d-d61299d08faa
--disable-rrdcgi disable building of rrdcgi
--disable-pthread disable multithread support
-- Stanislav Sinyagin <ssinyagin@yahoo.com>
git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk@244 a5681a0c-68f1-0310-ab6d-d61299d08faa
program/Makefile.am | patch | blob | history | |
program/configure.ac | patch | blob | history | |
program/src/Makefile.am | patch | blob | history |
diff --git a/program/Makefile.am b/program/Makefile.am
index 8951c777cc19eb7e34d0b903312f76d3528ee059..334f941b4ca0c98642eb757f952e775c385d4d7d 100644 (file)
--- a/program/Makefile.am
+++ b/program/Makefile.am
# where we keep local rules for automake
ACLOCAL_M4= $(top_srcdir)/aclocal.m4
-AUTOHEADER = @AUTOHEADER@ --localdir=$(top_srcdir)/config
-AUTOCONF = @AUTOCONF@ --localdir=$(top_srcdir)/config
+#AUTOHEADER = @AUTOHEADER@ --localdir=$(top_srcdir)/config
+#AUTOCONF = @AUTOCONF@ --localdir=$(top_srcdir)/config
to-docs: to-versync
(cd doc && $(MAKE) clean && $(MAKE) && $(MAKE) pdf)
diff --git a/program/configure.ac b/program/configure.ac
index c9dd1704c945d1777033147dc4f2a5ecced79194..1ce43a2995feb2f1a1d779c5d8834ad3465a3898 100644 (file)
--- a/program/configure.ac
+++ b/program/configure.ac
dnl tell automake the this script is for rrdtool
AC_INIT([rrdtool],[1.1.0])
-AM_INIT_AUTOMAKE
AC_CANONICAL_TARGET
+AM_INIT_AUTOMAKE
AM_CONFIG_HEADER(config.h)
# AC_CONFIG_AUX_DIR(config)
]
)
-EX_CHECK_ALL(cgi, cgiInit, cgi.h, cgilib, 0.5, http://www.infodrom.org/projects/cgilib)
-EX_CHECK_ALL(art_lgpl_2, art_vpath_add_point, libart_lgpl/libart.h, libart_lgpl, 2.3.16, ftp://ftp.gnome.org/pub/GNOME/sources/libart_lgpl/2.3/)
-EX_CHECK_ALL(z, zlibVersion, zlib.h, zlib, 1.2.1, http://www.gzip.org/zlib/)
-EX_CHECK_ALL(png, png_access_version_number, png.h, libpng, 1.2.5, http://prdownloads.sourceforge.net/libpng/)
-EX_CHECK_ALL(freetype, FT_Init_FreeType, ft2build.h, freetype, 2.1.5, http://prdownloads.sourceforge.net/freetype/)
-
dnl How the vertical axis label is printed
AC_ARG_VAR(RRDGRAPH_YLEGEND_ANGLE,
[Vertical label angle: 90.0 (default) or 270.0])
[Vertical label angle: 90.0 (default) or 270.0])
+AC_ARG_ENABLE(rrdcgi,[ --disable-rrdcgi disable building of rrdcgi],
+[],[enable_rrdcgi=yes])
+AM_CONDITIONAL(BUILD_RRDCGI,[test $enable_rrdcgi != no])
+
+if test $enable_rrdcgi != no; then
+EX_CHECK_ALL(cgi, cgiInit, cgi.h, cgilib, 0.5, http://www.infodrom.org/projects/cgilib)
+fi
+EX_CHECK_ALL(art_lgpl_2, art_vpath_add_point, libart_lgpl/libart.h, libart_lgpl, 2.3.16, ftp://ftp.gnome.org/pub/GNOME/sources/libart_lgpl/2.3/)
+EX_CHECK_ALL(z, zlibVersion, zlib.h, zlib, 1.2.1, http://www.gzip.org/zlib/)
+EX_CHECK_ALL(png, png_access_version_number, png.h, libpng, 1.2.5, http://prdownloads.sourceforge.net/libpng/)
+EX_CHECK_ALL(freetype, FT_Init_FreeType, ft2build.h, freetype, 2.1.5, http://prdownloads.sourceforge.net/freetype/)
+
+dnl Check for pthreads (pieces of code from Bert Driehuis)
+
+AC_SUBST(MULTITHREAD_CFLAGS)
+AC_SUBST(MULTITHREAD_LDFLAGS)
+
+AC_DEFUN(AC_CHECK_PTHREAD, [
+ AC_MSG_CHECKING([pthreads: trying no flags])
+ AC_CACHE_VAL(ac_cv_flag_pthread,[
+ AC_TRY_LINK([
+ #include <pthread.h>
+ ],
+ [pthread_exit(0);],
+ eval "ac_cv_flag_pthread=no",
+ [
+ AC_MSG_RESULT([didn't work])
+ AC_MSG_CHECKING([pthreads: trying to add -pthread])
+ ac_save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -pthread"
+ AC_TRY_LINK([
+ #include <pthread.h>
+ ],
+ [pthread_exit(0);],
+ eval "ac_cv_flag_pthread=yes",
+ AC_MSG_ERROR([Can't figure out pthreads])
+ )
+ CFLAGS="$ac_save_CFLAGS"
+ ])
+ ])
+
+ if test "$ac_cv_flag_pthread" = "no"; then
+ AC_MSG_RESULT([good, -pthread flag not necessary])
+ else
+ AC_MSG_RESULT([adding -pthread flag])
+ MULTITHREAD_CFLAGS="-pthread"
+ fi
+
+ AC_MSG_CHECKING([for libpthread])
+ AC_CACHE_VAL(ac_cv_lib_pthread,[
+ ac_save_LIBS="$LIBS"
+ LIBS="-lpthread"
+ AC_TRY_LINK([
+ #include <pthread.h>
+ ],
+ [pthread_exit(0);],
+ eval "ac_cv_lib_pthread=-lphtread",
+ eval "ac_cv_lib_pthread=no"
+ )
+ LIBS="$ac_save_LIBS"
+ ])
+ if test "$ac_cv_lib_pthread" = "no"; then
+ AC_MSG_RESULT([no -lpthread necessary])
+ else
+ AC_MSG_RESULT([adding -lpthread to LIBS])
+ MULTITHREAD_LDFLAGS="-lpthread"
+ fi
+])
+
+AC_ARG_ENABLE(pthread,[ --disable-pthread disable multithread support],
+[],[enable_pthread=yes])
+
+if test $enable_pthread != no; then
+ AC_CHECK_PTHREAD
+fi
+
+AM_CONDITIONAL(BUILD_MULTITHREAD,[test $enable_pthread != no])
+
dnl Check for Perl.
AC_PATH_PROG(PERL, perl, no)
if test "x$PERL" = "xno"; then
index cb4fca2545c1f9703692c1ac8e2c1effdac7a80e..eb027a3797dbe95627ab37747ba05979e817ce16 100644 (file)
--- a/program/src/Makefile.am
+++ b/program/src/Makefile.am
rrd_nan_inf.h fnv.h rrd_graph.h rrd_afm.h rrd_afm_data.h \
rrd_is_thread_safe.h
-lib_LTLIBRARIES = librrd.la librrd_th.la
+lib_LTLIBRARIES = librrd.la
+if BUILD_MULTITHREAD
+lib_LTLIBRARIES += librrd_th.la
+endif
+
#noinst_LTLIBRARIES = librrd_private.la
librrd_la_SOURCES = $(RRD_C_FILES) rrd_not_thread_safe.c
librrd_la_LDFLAGS = -version-info 1:2:0
librrd_th_la_SOURCES = $(RRD_C_FILES) rrd_thread_safe.c
-librrd_th_la_LIBADD = -lpthread
-librrd_th_la_LDFLAGS = -version-info 1:2:0
+librrd_th_la_CFLAGS = $(MULTITHREAD_CFLAGS)
+librrd_th_la_LDFLAGS = $(MULTITHREAD_LDFLAGS) -version-info 1:2:0
include_HEADERS = rrd.h
#librrd_private_la_LIBADD = $(RRD_LIBS)
#librrd_private_la_LDFLAGS = -static
-bin_PROGRAMS = rrdcgi rrdtool rrdupdate
+bin_PROGRAMS = rrdtool rrdupdate
+if BUILD_RRDCGI
+bin_PROGRAMS += rrdcgi
+endif
rrdcgi_SOURCES = rrd_cgi.c
rrdcgi_LDADD = librrd.la