From: oetiker Date: Mon, 5 Jul 2010 13:19:18 +0000 (+0000) Subject: * make rrd_getopt compile on solaris X-Git-Url: https://git.octo.it/?p=rrdtool.git;a=commitdiff_plain;h=d372ef83ee1b95f5263f80258b1cb750249ea89f * 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/trunk/program@2103 a5681a0c-68f1-0310-ab6d-d61299d08faa --- diff --git a/configure.ac b/configure.ac index cfbeb1d..d0fec6a 100644 --- a/configure.ac +++ b/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'` diff --git a/doc/rrdbuild.pod b/doc/rrdbuild.pod index dbcd5d3..4159d5a 100644 --- a/doc/rrdbuild.pod +++ b/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/m4/acinclude.m4 b/m4/acinclude.m4 index ee2fc1b..4ada919 100644 --- a/m4/acinclude.m4 +++ b/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/src/rrd_config_bottom.h b/src/rrd_config_bottom.h index 90ecc8e..e7d0a38 100644 --- a/src/rrd_config_bottom.h +++ b/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/src/rrd_getopt.c b/src/rrd_getopt.c index a74ff88..0556c86 100644 --- a/src/rrd_getopt.c +++ b/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/src/rrd_getopt1.c b/src/rrd_getopt1.c index 1ace77e..32e5491 100644 --- a/src/rrd_getopt1.c +++ b/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)