From f50eeb8065447b00e281e81d322113046828e9d8 Mon Sep 17 00:00:00 2001 From: oetiker Date: Sat, 6 Sep 2008 10:43:07 +0000 Subject: [PATCH] only link build and use rrd_getopt if there is no getopt_long provided by by the os ... this should also fix problems for solaris 2.8 and other non getopt_long oses who were not taken care of anymore after the intriduction of librrd.sym git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk@1481 a5681a0c-68f1-0310-ab6d-d61299d08faa --- program/bindings/perl-piped/RRDp.pm | 1 + program/configure.ac | 32 ++++++++++++++++------- program/src/Makefile.am | 9 ++++--- program/src/{librrd.sym => librrd.sym.in} | 1 + program/src/rrd_tool.h | 6 ++++- 5 files changed, 35 insertions(+), 14 deletions(-) rename program/src/{librrd.sym => librrd.sym.in} (97%) diff --git a/program/bindings/perl-piped/RRDp.pm b/program/bindings/perl-piped/RRDp.pm index 0a28506c..9f577744 100644 --- a/program/bindings/perl-piped/RRDp.pm +++ b/program/bindings/perl-piped/RRDp.pm @@ -102,6 +102,7 @@ For more information on how to use RRDtool, check the manpages. Tobias Oetiker =cut + #' this is to make cperl.el happy use strict; diff --git a/program/configure.ac b/program/configure.ac index 90897420..7bd2913f 100644 --- a/program/configure.ac +++ b/program/configure.ac @@ -9,25 +9,25 @@ dnl tell automake the this script is for rrdtool dnl the official version number is dnl a.b.c -AC_INIT([rrdtool],[1.3.1]) +AC_INIT([rrdtool],[1.3.2]) dnl for testing a numberical version number comes handy dnl the released version are dnl a.bccc dnl the devel versions will be something like dnl a.b999yymmddhh -NUMVERS=1.3001 +NUMVERS=1.3002 AC_SUBST(NUMVERS) -dnl for the linker to understand which version the library is compatible with -dnl we must keep a separate library version cout of the format c:r:a if any -dnl if only implementation changed but all interfaces are kept, do r++ -dnl when only functionality was added do c++,r=0,a++ -dnl if any functionality was removed do c++,r=0,a=0. +dnl for the linker to understand which versions the library are compatible with +dnl each other we must keep a separate library version cout of the format c:r:a. +dnl - if only implementation changed but all interfaces are kept, do r++ +dnl - if only functionality was added do c++,r=0,a++ +dnl - if any functionality was removed do c++,r=0,a=0. dnl dnl see http://sourceware.org/autobook/autobook/autobook_91.html dnl -LIBVERS=4:0:0 +LIBVERS=4:1:0 AC_SUBST(LIBVERS) AC_CANONICAL_TARGET @@ -398,7 +398,6 @@ dnl Checks for libraries. AC_CHECK_FUNC(acos, , AC_CHECK_LIB(m, acos)) - dnl add pic flag in any case this makes sure all our code is relocatable eval `./libtool --config | grep pic_flag` CFLAGS="$CFLAGS $pic_flag" @@ -549,7 +548,7 @@ return 0; have_broken_isfinite=no],have_broken_isfinite=yes,[ case "${target}" in hppa*-*-hpux*) have_broken_isfinite=yes ;; - sparc-sun-solaris2.8) have_broken_isfinite=yes ;; + *-sun-solaris2.8) have_broken_isfinite=yes ;; *) have_broken_isfinite=no ;; esac]) ]) @@ -568,6 +567,17 @@ AC_FULL_IEEE CONFIGURE_PART(Resolve Portability Issues) +dnl Do we need getopt_long + +build_getopt=no +RRD_GETOPT_LONG="#" +AC_CHECK_FUNC(getopt_long,[],[ +RRD_GETOPT_LONG="getopt_long" +build_getopt=yes +]) +AC_SUBST(RRD_GETOPT_LONG) +AM_CONDITIONAL(BUILD_GETOPT,[test $build_getopt = yes]) + dnl what does realloc do if it gets called with a NULL pointer AC_CACHE_CHECK([if realloc can deal with NULL], rd_cv_null_realloc, @@ -917,6 +927,7 @@ AC_CONFIG_FILES([examples/Makefile]) AC_CONFIG_FILES([doc/Makefile]) AC_CONFIG_FILES([po/Makefile.in]) AC_CONFIG_FILES([src/Makefile]) +AC_CONFIG_FILES([src/librrd.sym]) AC_CONFIG_FILES([bindings/Makefile]) AC_CONFIG_FILES([bindings/tcl/Makefile]) AC_CONFIG_FILES([bindings/tcl/ifOctets.tcl]) @@ -944,6 +955,7 @@ echo "----------------------------------------------------------------" echo "Config is DONE!" echo echo " With MMAP IO: $enable_mmap" +echo " Build rrd_getopt: $build_getopt" echo " Static programs: $staticprogs" echo " Perl Modules: $COMP_PERL" echo " Perl Binary: $PERL" diff --git a/program/src/Makefile.am b/program/src/Makefile.am index c5676794..a88eef31 100644 --- a/program/src/Makefile.am +++ b/program/src/Makefile.am @@ -14,8 +14,6 @@ RRD_DEFAULT_FONT=@RRD_DEFAULT_FONT@ AM_CPPFLAGS = -DRRD_DEFAULT_FONT=\"$(RRD_DEFAULT_FONT)\" -DNUMVERS=@NUMVERS@ UPD_C_FILES = \ - rrd_getopt.c \ - rrd_getopt1.c \ rrd_parsetime.c \ rrd_hw.c \ rrd_hw_math.c \ @@ -56,6 +54,11 @@ noinst_HEADERS = \ fnv.h rrd_graph.h \ rrd_is_thread_safe.h +if BUILD_GETOPT +noinst_HEADERS += rrd_getopt.h +UPD_C_FILES += rrd_getopt.c rrd_getopt1.c +endif + noinst_LTLIBRARIES = librrdupd.la lib_LTLIBRARIES = librrd.la @@ -99,6 +102,6 @@ rrdtool_LDADD = librrd.la # strftime is here because we do not usually need it. unices have propper # iso date support -EXTRA_DIST= strftime.c strftime.h \ +EXTRA_DIST= strftime.c strftime.h rrd_getopt.c rrd_getopt1.c rrd_getopt.h \ win32comp.c rrd_thread_safe_nt.c get_ver.awk librrd.sym diff --git a/program/src/librrd.sym b/program/src/librrd.sym.in similarity index 97% rename from program/src/librrd.sym rename to program/src/librrd.sym.in index a1822c9d..a178f554 100644 --- a/program/src/librrd.sym +++ b/program/src/librrd.sym.in @@ -48,3 +48,4 @@ rrd_update_v rrd_version rrd_write rrd_xport +@RRD_GETOPT_LONG@ diff --git a/program/src/rrd_tool.h b/program/src/rrd_tool.h index 8f0e3c39..131dcbb9 100644 --- a/program/src/rrd_tool.h +++ b/program/src/rrd_tool.h @@ -50,8 +50,12 @@ extern "C" { #endif /* local include files -- need to be after the system ones */ +#ifdef HAVE_GETOPT_LONG +#define _GNU_SOURCE +#include +#else #include "rrd_getopt.h" -#include "rrd_format.h" +#endif #ifndef max #define max(a,b) ((a) > (b) ? (a) : (b)) -- 2.30.2