configure option for mathfunctions
authorNikolas Garofil <ngarofil@users.sourceforge.net>
Tue, 1 Jul 2008 11:13:40 +0000 (11:13 +0000)
committerNikolas Garofil <ngarofil@users.sourceforge.net>
Tue, 1 Jul 2008 11:13:40 +0000 (11:13 +0000)
git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@1204 7f574dfc-610e-0410-a909-a81674777703

configure.ac.in
src/conky.c

index 3454c3a..f173300 100644 (file)
@@ -184,6 +184,20 @@ if test x$want_hddtemp = xyes; then
 fi
 
 dnl
+dnl Math
+dnl
+
+AC_ARG_ENABLE([math],
+              AC_HELP_STRING([--disable-math], [disable if you do not want math support @<:@default=yes@:>@]),
+              [want_math="$enableval"], [want_math=yes])
+
+AM_CONDITIONAL(BUILD_MATH, test x$want_math = xyes)
+if test x$want_math = xyes; then
+  LIBS="$LIBS -lm"
+  AC_DEFINE(MATH, 1, [Define if you want math support])
+fi
+
+dnl
 dnl MPD
 dnl
 
@@ -662,6 +676,7 @@ $PACKAGE $VERSION configured successfully:
   XMMS2:            $want_xmms2
 
  * General:
+  math:             $want_math
   hddtemp:          $want_hddtemp
   portmon:          $want_portmon
   RSS:              $want_rss
index eef5f0c..21fe277 100644 (file)
@@ -108,6 +108,9 @@ static void print_version(void)
                   "  * xmms2\n"
 #endif /* XMMS2 */
                   "\n General features:\n"
+#ifdef MATH
+                  "  * math\n"
+#endif /* Math */
 #ifdef HDDTEMP
                   "  * hddtemp\n"
 #endif /* HDDTEMP */
@@ -715,7 +718,9 @@ void graph_append(struct special_t *graph, double f, char showaslog)
        int i;
 
        if (showaslog) {
+#ifdef MATH
                f = log10(f + 1);
+#endif
        }
        
        if (!graph->scaled && f > graph->graph_scale) {
@@ -797,7 +802,9 @@ static void new_graph(char *buf, int w, int h, unsigned int first_colour,
                s->graph_width = s->width - 2;  // subtract 2 for rectangle around
        } */
        if (showaslog) {
+#ifdef MATH
                s->graph_scale = log10(s->graph_scale + 1);
+#endif
        }
        if (append) {
                graph_append(s, i, showaslog);
@@ -7072,6 +7079,7 @@ static void draw_line(char *s)
                                                cur_x = tmp_x;
                                                cur_y = tmp_y;
                                        }
+#ifdef MATH
                                        if (show_graph_scale && (specials[special_index].show_scale == 1)) {
                                                int tmp_x = cur_x;
                                                int tmp_y = cur_y;
@@ -7086,6 +7094,7 @@ static void draw_line(char *s)
                                                cur_x = tmp_x;
                                                cur_y = tmp_y;
                                        }
+#endif
                                        set_foreground_color(last_colour);
                                        break;
                                }