From: oetiker Date: Mon, 5 Jul 2010 13:19:18 +0000 (+0000) Subject: * make rrd_getopt compile on solaris X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=290e895f6016a6adddc67b669e77eccc23cc3e57;p=rrdtool-all.git * make rrd_getopt compile on solaris * unify isinf isnan definitions for compilation and configuration * replace round by rint if round is not available git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.4@2103 a5681a0c-68f1-0310-ab6d-d61299d08faa --- diff --git a/program/CHANGES b/program/CHANGES index 424acb18..5bd98dc8 100644 --- a/program/CHANGES +++ b/program/CHANGES @@ -3,7 +3,7 @@ RRDtool 1.4.4 - 2010-07-05 Bugfixes: * compile: multiple fixes isnan and isinf defines to make rrdtool compile - on solaris ... -- Tobi + with gcc on solaris (with --disable-nls) -- Tobi * rrd_client: fix potential segfaults -- Florian Forster * rrd_client: resolve synmlinks properly -- Kevin Brintnall * compile: fix libtool and libtoolize names for OSX compiles -- Antoine Musso diff --git a/program/configure.ac b/program/configure.ac index 29be00ca..9c5fa8a5 100644 --- a/program/configure.ac +++ b/program/configure.ac @@ -161,7 +161,7 @@ AC_SUBST(WERROR) dnl which flags does the compiler support? if test "x$GCC" = "xyes"; then - for flag in -fno-strict-aliasing -Wall -std=c99 -pedantic -Wundef -Wshadow -Wpointer-arith -Wcast-align -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Winline -Wold-style-definition -W; do + for flag in -fno-strict-aliasing -Wall -std=gnu99 -pedantic -Wundef -Wshadow -Wpointer-arith -Wcast-align -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Winline -Wold-style-definition -W; do oCFLAGS="$CFLAGS" CFLAGS="$CFLAGS $flag" cachename=rd_cv_gcc_flag_`echo $flag|sed 's/[[^A-Za-z]]/_/g'` @@ -209,7 +209,7 @@ AC_C_BIGENDIAN dnl for each function found we get a definition in config.h dnl of the form HAVE_FUNCTION -AC_CHECK_FUNCS(nl_langinfo tzset fsync mbstowcs opendir readdir chdir chroot getuid strerror snprintf vsnprintf vasprintf fpclass class fp_class isnan memmove strchr mktime getrusage gettimeofday) +AC_CHECK_FUNCS(nl_langinfo tzset round rint fsync mbstowcs opendir readdir chdir chroot getuid strerror snprintf vsnprintf vasprintf fpclass class fp_class isnan memmove strchr mktime getrusage gettimeofday) AC_FUNC_STRERROR_R diff --git a/program/doc/rrdbuild.pod b/program/doc/rrdbuild.pod index dbcd5d31..4159d5ab 100644 --- a/program/doc/rrdbuild.pod +++ b/program/doc/rrdbuild.pod @@ -92,10 +92,11 @@ Make sure the RRDtool build system finds your new compiler export PATH=/opt/SunStudioExpress/bin -Since there does not seem to be a viable msgfmt tool on OpenSolaris (short -of installing it yourself). You have to call configure with the +=head2 Solaris 8/9 - --disable-libintl +Getting NLS to work on old solaris is an open issue ... use + + --disable-nls option. diff --git a/program/m4/acinclude.m4 b/program/m4/acinclude.m4 index ee2fc1b9..4ada9197 100644 --- a/program/m4/acinclude.m4 +++ b/program/m4/acinclude.m4 @@ -339,61 +339,7 @@ AC_DEFUN([AC_IEEE], [ AC_MSG_CHECKING([if IEEE math works $1]) AC_CACHE_VAL([rd_cv_ieee_$2], [AC_RUN_IFELSE([AC_LANG_SOURCE([[$3 - -#if HAVE_MATH_H -# include -#endif - -#if HAVE_FLOAT_H -# include -#endif - -#if HAVE_IEEEFP_H -# include -#endif - -#if HAVE_FP_CLASS_H -# include -#endif - -/* Solaris */ -#if (! defined(HAVE_ISINF) && defined(HAVE_FPCLASS)) -# define HAVE_ISINF 1 -# define isinf(a) (fpclass(a) == FP_NINF || fpclass(a) == FP_PINF) -#endif - -/* solaris 10 it defines isnan such that only forte can compile it ... bad bad */ -#if (defined(HAVE_ISNAN) && defined(isnan) && defined(HAVE_FPCLASS) && defined(FP_SNAN) && defined(FP_QNAN)) -# undef isnan -# define isnan(a) (fpclass(a) == FP_SNAN || fpclass(a) == FP_QNAN) -#endif - -/* Digital UNIX */ -#if (! defined(HAVE_ISINF) && defined(HAVE_FP_CLASS) && defined(HAVE_FP_CLASS_H) && defined(FP_NEG_INF) && defined( FP_POS_INF) ) -# define HAVE_ISINF 1 -# define isinf(a) (fp_class(a) == FP_NEG_INF || fp_class(a) == FP_POS_INF) -#endif - -/* AIX */ -#if (! defined(HAVE_ISINF) && defined(HAVE_CLASS)) -# define HAVE_ISINF 1 -# define isinf(a) (class(a) == FP_MINUS_INF || class(a) == FP_PLUS_INF) -#endif - -#if (! defined(HAVE_ISINF) && defined(HAVE_FPCLASSIFY) && defined(FP_PLUS_INF) && defined(FP_MINUS_INF)) -# define HAVE_ISINF 1 -# define isinf(a) (fpclassify(a) == FP_MINUS_INF || fpclassify(a) == FP_PLUS_INF) -#endif - -#if (! defined(HAVE_ISINF) && defined(HAVE_FPCLASSIFY) && defined(FP_INFINITE)) -# define HAVE_ISINF 1 -# define isinf(a) (fpclassify(a) == FP_INFINITE) -#endif - -#if HAVE_MATH_H -#include -#endif - +#include "src/rrd_config_bottom.h" #include int main(void){ double rrdnan,rrdinf,rrdc,rrdzero; diff --git a/program/src/rrd_config_bottom.h b/program/src/rrd_config_bottom.h index ae072be1..c48a06f1 100644 --- a/program/src/rrd_config_bottom.h +++ b/program/src/rrd_config_bottom.h @@ -178,6 +178,11 @@ char *strchr (), *strrchr (); # define isinf(a) (fpclass(a) == FP_NINF || fpclass(a) == FP_PINF) #endif +/* solaris 8/9 has rint but not round */ +#if (! defined(HAVE_ROUND) && defined(HAVE_RINT)) +# define round rint +#endif + /* solaris 10 it defines isnan such that only forte can compile it ... bad bad */ #if (defined(HAVE_ISNAN) && defined(isnan) && defined(HAVE_FPCLASS)) # undef isnan diff --git a/program/src/rrd_getopt.c b/program/src/rrd_getopt.c index a74ff88d..0556c86a 100644 --- a/program/src/rrd_getopt.c +++ b/program/src/rrd_getopt.c @@ -360,7 +360,7 @@ static const char *_getopt_initialize( const char *); #endif static const char* _getopt_initialize(int argc, - char** argv, + char* const* argv, const char* optstring) { /* Start processing options with ARGV-element 1 (since ARGV-element 0 @@ -465,7 +465,7 @@ static const char* _getopt_initialize(int argc, long-named options. */ int _getopt_internal(int argc, - char** argv, + char* const* argv, const char *optstring, const struct option *longopts, int* longind, @@ -869,15 +869,6 @@ int _getopt_internal(int argc, } } -int getopt( - int argc, - char** argv, - const char* optstring) -{ - return _getopt_internal(argc, argv, optstring, - (const struct option *) 0, (int *) 0, 0); -} - #endif /* Not ELIDE_CODE. */ #ifdef TEST diff --git a/program/src/rrd_getopt1.c b/program/src/rrd_getopt1.c index 1ace77e2..32e54915 100644 --- a/program/src/rrd_getopt1.c +++ b/program/src/rrd_getopt1.c @@ -66,7 +66,7 @@ #endif int getopt_long(int argc, - char** argv, + char* const* argv, const char* options, const struct option* long_options, int* opt_index) @@ -80,7 +80,7 @@ int getopt_long(int argc, instead. */ int getopt_long_only(int argc, - char** argv, + char* const* argv, const char* options, const struct option* long_options, int* opt_index)