Added tcp port monitor support
[monky] / configure.in
1 AC_INIT([Conky],[1.3.3],[brenden1@users.sourceforge.net])
2
3 AM_INIT_AUTOMAKE(conky, 1.3.3)
4 AM_CONFIG_HEADER(src/config.h)
5 AC_PROG_LIBTOOL
6
7
8 AC_CONFIG_FILES(
9         Makefile
10         doc/Makefile
11         src/Makefile
12         )
13
14 uname=`uname`
15
16 case $uname in
17   Linux*)
18     WANT_SYSINFO=yes
19     ;;
20   FreeBSD*)
21     WANT_KVM=yes
22     WANT_DEVSTAT=yes
23     ;;
24 #  NetBSD*)
25 #    WANT_KVM=yes
26 #    WANT_OSSLIB=yes
27 #    ;;
28
29 # Solaris doesn't work at all right now
30 #  SunOS*)
31 #    WANT_KSTAT=yes
32 #    ;;
33
34   *)
35     echo "Your operating system $uname isn't supported"
36     echo "Feel free to help. :P"
37     exit 1
38     ;;
39 esac
40
41 AM_CONDITIONAL(BUILD_LINUX, test x$uname = xLinux)
42 AM_CONDITIONAL(BUILD_SOLARIS, test x$uname = xSunOS)
43 AM_CONDITIONAL(BUILD_FREEBSD, test x$uname = xFreeBSD)
44 AM_CONDITIONAL(BUILD_NETBSD, test x$uname = xNetBSD)
45
46 dnl
47 dnl XFT option
48 dnl
49
50 want_xft=no
51 AC_ARG_ENABLE(xft,
52 [  --enable-xft            enable if you want to use Xft [default=no]],
53   [want_xft="$enableval"])
54
55 dnl
56 dnl OWN_WINDOW option
57 dnl
58
59 dah=yes
60 AC_ARG_ENABLE(own_window,
61 [  --enable-own-window     enable if you want support for creating own window [default=yes]],
62   [dah="$enableval"])
63
64 if test $dah != "no"; then
65   AC_DEFINE(OWN_WINDOW, 1, [Define if you want support for window creating])
66 fi
67
68 dnl
69 dnl PROC_UPTIME option
70 dnl
71
72 dah=no
73 AC_ARG_ENABLE(proc_uptime,
74 [  --enable-proc-uptime    enable using /proc/uptime for uptime [default=no]],
75   [dah="$enableval"])
76
77 if test $dah = "yes"; then
78   AC_DEFINE(PROC_UPTIME, 1, [Define if you want to use /proc/uptime for uptime])
79 fi
80
81 dnl
82 dnl Seti@Home
83 dnl
84
85 want_seti=no
86 AC_ARG_ENABLE(seti,
87 [  --enable-seti           enable if you want SETI at Home stats [default=no]],
88   [want_seti="$enableval"])
89
90 AM_CONDITIONAL(BUILD_SETI, test x$want_seti = xyes)
91 if test x$want_seti = xyes; then
92   AC_DEFINE(SETI, 1, [Define if you want SETI at Home stats])
93 fi
94
95 dnl
96 dnl MPD
97 dnl
98
99 want_mpd=no
100 AC_ARG_ENABLE(mpd,
101 [  --enable-mpd            enable if you want MPD support [default=no]],
102   [want_mpd="$enableval"])
103
104 AM_CONDITIONAL(BUILD_MPD, test x$want_mpd = xyes)
105 if test x$want_mpd = xyes; then
106   AC_DEFINE(MPD, 1, [Define if you want MPD support])
107 fi
108
109 dnl
110 dnl PORT_MONITORS
111 dnl
112
113 want_portmon=no
114 AC_ARG_ENABLE(portmon,
115 [  --enable-portmon        enable if you want tcp (ip4) port monitoring [[default=no]]],
116   [want_portmon="$enableval"])
117
118 AM_CONDITIONAL(BUILD_PORT_MONITORS, test x$want_portmon = xyes)
119 if test x$want_portmon = xyes; then
120   AC_CHECK_HEADERS([netdb.h netinet/in.h netinet/tcp.h sys/socket.h arpa/inet.h], [], [PORT_MONITORS_MISSING=yes])
121   if test "x$PORT_MONITORS_MISSING" = xyes; then
122          AC_MSG_ERROR([missing a needed network header for port monitoring])
123   fi
124   AC_DEFINE(TCP_PORT_MONITOR, 1, [Define if you want tcp port monitoring support])
125 fi
126
127 dnl
128 dnl Cairo
129 dnl
130
131 want_cairo=no
132 AC_ARG_ENABLE(cairo,
133 [  --enable-cairo          enable if you want Cairo support [default=no]],
134   [want_cairo="$enableval"])
135
136 AM_CONDITIONAL(BUILD_CAIRO, test x$want_cairo = xyes)
137
138
139 if test "$want_cairo" = "yes"; then
140   AC_CHECK_HEADERS([cairo.h cairo-xlib.h], [], [CAIRO_MISSING=yes])
141     if test "x$CAIRO_MISSING" = xyes; then
142       AC_MSG_ERROR([something went wrong when checking for cairo, you're probably missing headers or it's not installed])
143   fi
144   AC_PATH_PROG(CAIROCONFIG, pkg-config)
145   if test x$CAIROCONFIG != x; then
146     dnl TODO: needs more checks
147
148     AC_DEFINE(CAIRO, 1, [Define if you are using Cairo])
149     CFLAGS="$CFLAGS `$CAIROCONFIG --cflags cairo` `$CAIROCONFIG --libs cairo` "
150     CAIRO_LIBS="`$CAIROCONFIG --libs cairo` `$CAIROCONFIG --cflags cairo`"
151   else
152     want_cairo=no
153   fi
154 fi
155
156
157 dnl
158 dnl MLDonkey
159 dnl
160
161 want_mldonkey=no
162 AC_ARG_ENABLE(mldonkey,
163 [  --enable-mldonkey       enable if you want MLDonkey support [default=no]],
164   [want_mldonkey="$enableval"])
165
166 AM_CONDITIONAL(BUILD_MLDONKEY, test x$want_mldonkey = xyes)
167 if test x$want_mldonkey = xyes; then
168   AC_DEFINE(MLDONKEY, 1, [Define if you want MLDonkey support])
169 fi
170
171 dnl
172 dnl C Compiler
173 dnl
174
175 AC_PROG_CC
176
177 dnl
178 dnl X
179 dnl
180
181 dah=yes
182 AC_ARG_ENABLE(double_buffer,
183 [  --enable-double-buffer  enable if you want to support flicker-free operation [default=yes]],
184   [dah="$enableval"])
185
186 want_x11=yes
187 AC_ARG_ENABLE(x11,
188 [  --enable-x11            enable if you want X11 support [default=yes]],
189  [want_x11="$enableval"])
190
191
192 if test "x$want_x11" = "xyes"; then
193         AC_PATH_X
194         AC_PATH_XTRA
195         CFLAGS="$CFLAGS $X_CFLAGS"
196         LIBS="$LIBS $X_LIBS $X11_LIBS"
197         LDFLAGS="$LDFLAGS $LIBS $X_PRE_LIBS"
198         if test "x$X_DISPLAY_MISSING" = xyes; then
199                 AC_MSG_ERROR([something went wrong when checking for X11, you're probably missing headers or it's not installed, either re-run configure with --disable-x11, or fix this])
200         fi
201         AC_DEFINE(X11, 1, [Define if you want to use X11])
202         AC_DEFINE(HAVE_X11, 1, [Define if you have X11])
203         AM_CONDITIONAL(BUILD_X11, true)
204         if test $dah != "no"; then
205                 AC_DEFINE(DOUBLE_BUFFER, 1, [Define if you want support for the DBE extension])
206                 AC_CHECK_LIB(Xext, XdbeQueryExtension, [AC_DEFINE([HAVE_XDBE], 1, [Xdbe]) LIBS="$LIBS -lXext"],
207                      [AC_MSG_ERROR([something went wrong when checking for Xdbe (double buffer extension)])])
208         fi
209 else
210         AM_CONDITIONAL(BUILD_X11, false)
211 fi
212
213 dnl
214 dnl Xft
215 dnl
216
217 if test x$want_xft && test x$want_x11; then
218   AC_PATH_PROG(XFTCONFIG, xft-config)
219   if test x$XFTCONFIG != x; then
220     dnl TODO: needs more checks
221   
222 dnl This won't work for some reason
223 dnl  AC_CHECK_HEADERS([X11/Xft/Xft.h], [], [XFT_MISSING=yes])
224     if test "x$XFT_MISSING" = xyes; then
225       AC_MSG_ERROR([something went wrong when checking for Xft, you're probably missing headers or it's not installed])
226   fi
227
228     AC_DEFINE(XFT, 1, [Define if you are using Xft])
229     CFLAGS="$CFLAGS `$XFTCONFIG --cflags`"
230     XFT_LIBS=`$XFTCONFIG --libs`
231   else
232     want_xft=no
233   fi
234 fi
235
236 dnl
237 dnl KVM
238 dnl
239
240 if test x$WANT_KVM = xyes; then
241   AC_CHECK_LIB(kvm, kvm_open,
242         LIBS="$LIBS -lkvm",
243         AC_MSG_ERROR([Could not find kvm_open in -lkvm.])
244   )
245 fi
246
247 dnl
248 dnl devstat
249 dnl
250
251 if test x$WANT_DEVSTAT = xyes; then
252         AC_CHECK_LIB(devstat, devstat_getversion,
253                      LIBS="$LIBS -ldevstat",
254                      AC_MSG_ERROR([Cound not find devstat_getversion in -ldevstat.])
255         )
256 fi
257
258 dnl
259 dnl OSSLIB for NetBSD
260 dnl
261
262 if test x$WANT_OSSLIB = xyes; then
263     AC_CHECK_LIB(ossaudio, _oss_ioctl,
264         LIBS="$LIBS -lossaudio",
265         AC_MSG_ERROR([Could not find oss_ioctl in -lossaudio.])
266     )
267 fi
268
269 dnl
270 dnl Some random headers
271 dnl
272
273
274 AC_CHECK_HEADERS([signal.h unistd.h sys/utsname.h sys/stat.h linux/soundcard.h dirent.h mcheck.h])
275 AC_CHECK_HEADERS([sys/statfs.h sys/param.h])
276 AC_CHECK_HEADERS([sys/mount.h], [], [],
277                  [#ifdef HAVE_SYS_PARAM_H
278                   #include <sys/param.h>
279                   #endif
280 ])
281 dnl For cairo
282
283 dnl
284 dnl Check doc stuff
285 dnl
286
287 AC_CHECK_PROGS(db2x_xsltproc_cmd, db2x_xsltproc)
288 AC_CHECK_PROGS(db2x_manxml_cmd, db2x_manxml)
289 AC_CHECK_PROGS(xsltproc_cmd, xsltproc)
290 if test x$db2x_xsltproc_cmd = "x" -o x$xsltproc_cmd = "x"; then
291         AM_CONDITIONAL(HAVE_DOCSTUFF, false)
292 else
293         AM_CONDITIONAL(HAVE_DOCSTUFF, true)
294 fi
295
296 dnl
297 dnl Check sysinfo()
298 dnl
299
300 if test x$WANT_SYSINFO = xyes; then
301   dah=no
302   AC_MSG_CHECKING(for sysinfo)
303   AC_TRY_COMPILE(
304     [#include <sys/types.h>
305      #include <sys/sysinfo.h>],
306     [struct sysinfo s; sysinfo(&s); (void) s.uptime; ],
307     [AC_MSG_RESULT(yes); dah=yes],
308     [AC_MSG_RESULT(not usable); dah=no])
309
310   if test x$dah = xyes; then
311     AC_DEFINE(HAVE_SYSINFO, 1, [Define if you have sysinfo (Linux)])
312   fi
313 fi
314
315 dnl
316 dnl kstat in Solaris
317 dnl
318
319 if test x$WANT_KSTAT = xyes; then
320   dah=no
321   AC_CHECK_LIB([kstat], [kstat_open], [dah=yes], [])
322
323   if test x$dah = xyes; then
324     AC_DEFINE(HAVE_KSTAT, 1, [Define if you have kstat (Solaris)])
325     LDFLAGS="$LDFLAGS -lkstat"
326   fi
327 fi
328
329 AC_DEFUN([AM_LANGINFO_CODESET],
330 [
331   AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
332     [AC_TRY_LINK([#include <langinfo.h>],
333       [char* cs = nl_langinfo(CODESET);],
334       am_cv_langinfo_codeset=yes,
335       am_cv_langinfo_codeset=no)
336     ])
337   if test $am_cv_langinfo_codeset = yes; then
338     AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
339       [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
340   fi
341 ])
342
343 dnl
344 dnl Check getloadavg
345 dnl
346
347 AC_MSG_CHECKING(for getloadavg)
348 AC_TRY_COMPILE(
349   [#include <stdlib.h>],
350   [double v[3]; getloadavg(v, 3);],
351   [AC_MSG_RESULT(yes)
352    AC_DEFINE(HAVE_GETLOADAVG, 1, [Define if you have getloadavg])],
353   [AC_MSG_RESULT(no)])
354
355 dnl
356 dnl Check popen
357 dnl
358
359 AC_CHECK_FUNCS(popen)
360
361 dnl
362 dnl Da.
363 dnl
364
365 CFLAGS="$CFLAGS -Wall -W"
366
367 AC_SUBST(CFLAGS)
368 AC_SUBST(X11_LIBS)
369 AC_SUBST(XFT_LIBS)
370
371 AC_OUTPUT