AC_INIT([Conky],[1.4.3],[brenden1@users.sourceforge.net]) AM_INIT_AUTOMAKE(conky, 1.4.3) AM_CONFIG_HEADER(src/config.h) dnl dnl C Compiler dnl dnl prevent libtool setting LTCFLAGS to default of -g -O2 when CFLAGS unset. dnl libtool must be deleted with make distclean to see this fix. if test x"$CFLAGS" = x""; then AC_SUBST(CFLAGS, [ ]) fi AC_PROG_CC AC_PROG_LIBTOOL PKG_PROG_PKG_CONFIG([0.17.2]) AC_CONFIG_FILES( Makefile doc/Makefile src/Makefile src/build.h ) uname=`uname` case $uname in Linux*) WANT_SYSINFO=yes ;; FreeBSD*) WANT_KVM=yes WANT_DEVSTAT=yes ;; # NetBSD*) # WANT_KVM=yes # WANT_OSSLIB=yes # ;; # OpenBSD*) # WANT_KVM=yes # WANT_OSSLIB=yes # ;; # Solaris doesn't work at all right now # SunOS*) # WANT_KSTAT=yes # ;; *) echo "Your operating system $uname isn't supported" echo "Feel free to help. :P" exit 1 ;; esac AM_CONDITIONAL(BUILD_LINUX, test x$uname = xLinux) #AM_CONDITIONAL(BUILD_SOLARIS, test x$uname = xSunOS) AM_CONDITIONAL(BUILD_FREEBSD, test x$uname = xFreeBSD) #AM_CONDITIONAL(BUILD_NETBSD, test x$uname = xNetBSD) # AM_CONDITIONAL(BUILD_OPENBSD, test x$uname = xOpenBSD) BUILD_DATE=$(LANG=en_US LC_ALL=en_US LOCALE=en_US date) BUILD_ARCH="$(uname -sr) ($(uname -m))" AC_SUBST(BUILD_DATE) AC_SUBST(BUILD_ARCH) dnl dnl XFT option dnl want_xft=yes AC_ARG_ENABLE(xft, [ --enable-xft enable if you want to use Xft [[default=yes]]], [want_xft="$enableval"]) dnl dnl OWN_WINDOW option dnl dah=yes AC_ARG_ENABLE(own_window, [ --enable-own-window enable if you want support for creating own window [[default=yes]]], [dah="$enableval"]) if test $dah != "no"; then AC_DEFINE(OWN_WINDOW, 1, [Define if you want support for window creating]) fi dnl dnl PROC_UPTIME option dnl dah=yes AC_ARG_ENABLE(proc_uptime, [ --enable-proc-uptime enable using /proc/uptime for uptime [[default=yes]]], [dah="$enableval"]) if test $dah = "yes"; then AC_DEFINE(PROC_UPTIME, 1, [Define if you want to use /proc/uptime for uptime]) fi dnl dnl XMMS (Version 1) dnl want_xmms=auto AC_ARG_ENABLE(xmms, [ --enable-xmms enable xmms (ver. 1) media player support [[default=auto]]], [want_xmms="$enableval"]) case x$want_xmms in xauto) want_xmms=yes ## its ok to favor the glib 2.0 headers over 1.2 for our purposes ## PKG_CHECK_MODULES([XMMS], [glib-2.0], [], [PKG_CHECK_MODULES([XMMS], [glib-1.2], [], [want_xmms=no])]) if test x$want_xmms = xyes; then AC_CHECK_HEADERS([dlfcn.h], [], [want_xmms=no]) if test x$want_xmms = xyes; then AC_CHECK_LIB(dl, dlopen, [LIBS="$LIBS -ldl"], [AC_CHECK_FUNCS(dlopen,[], [want_xmms=no])]) if test x$want_xmms = xyes; then CFLAGS="$CFLAGS $XMMS_CFLAGS" ### if we link to glib 1.2, that means 2.0 wasn't found ### ### if we link to glib 2.0, that's ok, we will load libglib-1.2.so.0 dynamically ### LIBS="$LIBS $XMMS_LIBS" AC_DEFINE(XMMS, 1, [Define for XMMS Ver. 1 support]) fi fi fi ;; xyes) ## its ok to favor the glib 2.0 headers over 1.2 for our purposes ## PKG_CHECK_MODULES([XMMS], [glib-2.0], [], [PKG_CHECK_MODULES([XMMS], [glib-1.2])]) CFLAGS="$CFLAGS $XMMS_CFLAGS" ### if we link to glib 1.2, that means 2.0 wasn't found ### ### if we link to glib 2.0, that's ok, we will load libglib-1.2.so.0 dynamically ### LIBS="$LIBS $XMMS_LIBS" AC_CHECK_HEADERS([dlfcn.h], [], [AC_MSG_ERROR(["dlfcn.h not found: dynamic library loading not supported"])]) AC_CHECK_LIB(dl, dlopen, [LIBS="$LIBS -ldl"], [AC_CHECK_FUNCS(dlopen,[], [AC_MSG_ERROR([dlopen() not available])])]) AC_DEFINE(XMMS, 1, [Define for XMMS Ver. 1 support]) ;; xno) ;; *) echo "Error: invalid xmms parameter specified: $want_xmms" exit -1 ;; esac AM_CONDITIONAL(BUILD_XMMS, test x$want_xmms = xyes) dnl dnl BMP (through 0.9.7.1) dnl want_bmp=auto AC_ARG_ENABLE(bmp, [ --enable-bmp enable beep media media player support [[default=auto]]], [want_bmp="$enableval"]) case x$want_bmp in xauto) want_bmp=yes PKG_CHECK_MODULES([BMP], [glib-2.0], [], [want_bmp=no]) if test x$want_bmp = xyes; then AC_CHECK_HEADERS([dlfcn.h], [], [want_bmp=no]) if test x$want_bmp = xyes; then AC_CHECK_LIB(dl, dlopen, [LIBS="$LIBS -ldl"], [AC_CHECK_FUNCS(dlopen,[], [want_bmp=no])]) if test x$want_bmp = xyes; then CFLAGS="$CFLAGS $BMP_CFLAGS" LIBS="$LIBS $BMP_LIBS" AC_DEFINE(BMP, 1, [Define for Beep Media Player support]) fi fi fi ;; xyes) PKG_CHECK_MODULES([BMP], [glib-2.0 >= 2.0]) CFLAGS="$CFLAGS $BMP_CFLAGS" LIBS="$LIBS $BMP_LIBS" AC_CHECK_HEADERS([dlfcn.h], [], [AC_MSG_ERROR(["dlfcn.h not found: dynamic library loading not supported"])]) AC_CHECK_LIB(dl, dlopen, [LIBS="$LIBS -ldl"], [AC_CHECK_FUNCS(dlopen,[], [AC_MSG_ERROR([dlopen() not available])])]) AC_DEFINE(BMP, 1, [Define for Beep Media Player support]) ;; xno) ;; *) echo "Error: invalid bmp parameter specified: $want_bmp" exit -1 ;; esac AM_CONDITIONAL(BUILD_BMP, test x$want_bmp = xyes) dnl dnl Audacious Media Player dnl want_audacious=auto AC_ARG_ENABLE(audacious, [ --enable-audacious enable audacious player support [[default=auto]]], [want_audacious="$enableval"]) case x$want_audacious in xauto) want_audacious=yes PKG_CHECK_MODULES([AUDACIOUS], [glib-2.0], [], [want_audacious=no]) if test x$want_audacious = xyes; then AC_CHECK_HEADERS([dlfcn.h], [], [want_audacious=no]) if test x$want_audacious = xyes; then AC_CHECK_LIB(dl, dlopen, [LIBS="$LIBS -ldl"], [AC_CHECK_FUNCS(dlopen,[], [want_audacious=no])]) if test x$want_audacious = xyes; then CFLAGS="$CFLAGS $AUDACIOUS_CFLAGS" LIBS="$LIBS $AUDACIOUS_LIBS" AC_DEFINE(AUDACIOUS, 1, [Define for Audacious support]) fi fi fi ;; xyes) PKG_CHECK_MODULES([AUDACIOUS], [glib-2.0]) CFLAGS="$CFLAGS $AUDACIOUS_CFLAGS" LIBS="$LIBS $AUDACIOUS_LIBS" AC_CHECK_HEADERS([dlfcn.h], [], [AC_MSG_ERROR(["dlfcn.h not found: dynamic library loading not supported"])]) AC_CHECK_LIB(dl, dlopen, [LIBS="$LIBS -ldl"], [AC_CHECK_FUNCS(dlopen,[], [AC_MSG_ERROR([dlopen() not available])])]) AC_DEFINE(AUDACIOUS, 1, [Define for Audacious support]) ;; xno) ;; *) echo "Error: invalid audacious parameter specified: $want_audacious" exit -1 ;; esac AM_CONDITIONAL(BUILD_AUDACIOUS, test x$want_audacious = xyes) dnl dnl InfoPipe (Version 1.3) dnl want_infopipe=yes AC_ARG_ENABLE(infopipe, [ --enable-infopipe enable xmms/bmp infopipe support [[default=yes]]], [want_infopipe="$enableval"]) case x$want_infopipe in xyes) AC_DEFINE(INFOPIPE, 1, [Define for InfoPipe support]) ;; xno) ;; *) echo "Error: invalid infopipe parameter specified: $want_infopipe" exit -1 ;; esac AM_CONDITIONAL(BUILD_INFOPIPE, test x$want_infopipe = xyes) dnl dnl BMPx dnl want_bmpx=no AC_ARG_ENABLE(bmpx, [ --enable-bmpx enable if you want BMPx support [[default=no]]], [want_bmpx="$enableval"]) AM_CONDITIONAL(BUILD_BMPX, test x$want_bmpx = xyes) if test x$want_bmpx = xyes; then PKG_CHECK_MODULES([BMPX], [bmp-2.0 >= 0.14.0]) CFLAGS="$CFLAGS $BMPX_CFLAGS" LIBS="$LIBS $BMPX_LIBS" AC_DEFINE(BMPX, 1, [Define if you want BMPx support]) fi dnl dnl Seti@Home dnl want_seti=yes AC_ARG_ENABLE(seti, [ --enable-seti enable if you want SETI at Home stats [[default=yes]]], [want_seti="$enableval"]) AM_CONDITIONAL(BUILD_SETI, test x$want_seti = xyes) if test x$want_seti = xyes; then AC_DEFINE(SETI, 1, [Define if you want SETI at Home stats]) fi dnl dnl Hddtemp dnl want_hddtemp=yes AC_ARG_ENABLE(hddtemp, [ --enable-hddtemp enable if you want hddtemp support [[default=yes]]], [want_hddtemp="$enableval"]) AM_CONDITIONAL(BUILD_HDDTEMP, test x$want_hddtemp = xyes) if test x$want_hddtemp = xyes; then AC_DEFINE(HDDTEMP, 1, [Define if you want hddtemp support]) fi dnl dnl MPD dnl want_mpd=yes AC_ARG_ENABLE(mpd, [ --enable-mpd enable if you want MPD support [[default=yes]]], [want_mpd="$enableval"]) AM_CONDITIONAL(BUILD_MPD, test x$want_mpd = xyes) if test x$want_mpd = xyes; then AC_DEFINE(MPD, 1, [Define if you want MPD support]) fi dnl dnl XMMS2 dnl want_xmms2=no AC_ARG_ENABLE(xmms2, [ --enable-xmms2 enable if you want XMMS2 support [[default=no]]], [want_xmms2="$enableval"]) AM_CONDITIONAL(BUILD_XMMS2, test x$want_xmms2 = xyes) if test x$want_xmms2 = xyes; then CFLAGS="$CFLAGS `pkg-config --cflags xmms2-client`" LIBS="$LIBS `pkg-config --libs xmms2-client`" AC_DEFINE(XMMS2, 1, [Define if you want XMMS2 support]) fi dnl dnl IMLIB2 dnl want_imlib2=no AC_ARG_ENABLE(imlib2, [ --enable-imlib2 enable if you want Imlib2 support [[default=no]]], [want_imlib2="$enableval"]) AM_CONDITIONAL(BUILD_IMLIB2, test x$want_imlib2 = xyes) if test x$want_imlib2 = xyes; then PKG_CHECK_MODULES([Imlib2], [imlib2]) CFLAGS="$CFLAGS $Imlib2_CFLAGS" LIBS="$LIBS $Imlib2_LIBS" AC_DEFINE(IMLIB2, 1, [Define if you want Imlib2 support]) fi dnl dnl PORT_MONITORS dnl want_portmon=yes AC_ARG_ENABLE(portmon, [ --enable-portmon enable if you want tcp (ip4) port monitoring [[default=yes]]], [want_portmon="$enableval"]) AM_CONDITIONAL(BUILD_PORT_MONITORS, test x$want_portmon = xyes) if test x$want_portmon = xyes; then AC_CHECK_HEADERS([netdb.h netinet/in.h netinet/tcp.h sys/socket.h arpa/inet.h], [], [PORT_MONITORS_MISSING=yes]) if test "x$PORT_MONITORS_MISSING" = xyes; then AC_MSG_ERROR([missing a needed network header for port monitoring]) fi AC_DEFINE(TCP_PORT_MONITOR, 1, [Define if you want tcp port monitoring support]) fi dnl dnl Cairo dnl dnl dnl MLDonkey dnl want_mldonkey=no AC_ARG_ENABLE(mldonkey, [ --enable-mldonkey enable if you want MLDonkey support [[default=no]]], [want_mldonkey="$enableval"]) AM_CONDITIONAL(BUILD_MLDONKEY, test x$want_mldonkey = xyes) if test x$want_mldonkey = xyes; then AC_DEFINE(MLDONKEY, 1, [Define if you want MLDonkey support]) fi dnl dnl ICONV dnl AM_ICONV if test "$am_cv_func_iconv" != yes; then AC_MSG_WARN([Could not find libiconv]) else LIBS="$LIBS $LIBICONV" fi dnl dnl debug dnl want_debug=no AC_ARG_ENABLE(debug, [ --enable-debug compile with debug symbols [[default=no]]], [want_debug="$enableval"]) if test "x$want_debug" = "xyes" -a $ac_cv_c_compiler_gnu != no; then CFLAGS="$CFLAGS -g3" fi dnl dnl X dnl dah=yes AC_ARG_ENABLE(double_buffer, [ --enable-double-buffer enable if you want to support flicker-free operation [[default=yes]]], [dah="$enableval"]) want_xdamage=yes AC_ARG_ENABLE(xdamage, [ --enable-xdamage enable if you want Xdamage support [[default=yes]]], [want_xdamage="$enableval"]) want_x11=yes AC_ARG_ENABLE(x11, [ --enable-x11 enable if you want X11 support [[default=yes]]], [want_x11="$enableval"]) if test "x$want_x11" = "xyes"; then AC_PATH_X AC_PATH_XTRA CFLAGS="$CFLAGS $X_CFLAGS" LIBS="$LIBS $X_LIBS $X11_LIBS" LDFLAGS="$LDFLAGS $LIBS $X_PRE_LIBS" if test "x$X_DISPLAY_MISSING" = xyes; then 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]) fi AC_DEFINE(X11, 1, [Define if you want to use X11]) AC_DEFINE(HAVE_X11, 1, [Define if you have X11]) AM_CONDITIONAL(BUILD_X11, true) if test "x$dah" != xno; then AC_DEFINE(DOUBLE_BUFFER, 1, [Define if you want support for the DBE extension]) AC_CHECK_LIB(Xext, XdbeQueryExtension, [AC_DEFINE([HAVE_XDBE], 1, [Xdbe]) LIBS="$LIBS -lXext"], [AC_MSG_ERROR([something went wrong when checking for Xdbe (double buffer extension)])]) fi if test "x$want_xdamage" = "xyes"; then AC_DEFINE(XDAMAGE, 1, [Define if you want support for the Xdamage extension]) AC_CHECK_LIB(Xdamage, XDamageQueryExtension, [AC_DEFINE([HAVE_XDAMAGE], 1, [Xdamage]) LIBS="$LIBS -lXdamage"], [AC_MSG_ERROR([something went wrong when checking for Xdamage])]) fi else AM_CONDITIONAL(BUILD_X11, false) fi dnl dnl Xft dnl if test x$want_xft && test x$want_x11; then PKG_CHECK_MODULES(XFT, [xft], [ AC_DEFINE(XFT, 1, [Define if you are using Xft]) CFLAGS="$CFLAGS $XFT_CFLAGS" AC_SUBST(XFT_LIBS) ], [want_xft=no]) fi dnl dnl KVM dnl if test x$WANT_KVM = xyes; then AC_CHECK_LIB(kvm, kvm_open, LIBS="$LIBS -lkvm", AC_MSG_ERROR([Could not find kvm_open in -lkvm.]) ) fi dnl dnl devstat dnl if test x$WANT_DEVSTAT = xyes; then AC_CHECK_LIB(devstat, devstat_getversion, LIBS="$LIBS -ldevstat", AC_MSG_ERROR([Cound not find devstat_getversion in -ldevstat.]) ) fi dnl dnl OSSLIB for NetBSD/OpenBSD dnl if test x$WANT_OSSLIB = xyes; then AC_CHECK_LIB(ossaudio, _oss_ioctl, LIBS="$LIBS -lossaudio", AC_MSG_ERROR([Could not find oss_ioctl in -lossaudio.]) ) fi dnl dnl Some random headers dnl AC_CHECK_HEADERS([signal.h unistd.h sys/utsname.h sys/stat.h linux/soundcard.h dirent.h mcheck.h]) AC_CHECK_HEADERS([sys/statfs.h sys/param.h]) AC_CHECK_HEADERS([sys/mount.h], [], [], [#ifdef HAVE_SYS_PARAM_H #include #endif ]) dnl dnl Check doc stuff dnl AC_CHECK_PROGS(db2x_xsltproc_cmd, db2x_xsltproc) AC_CHECK_PROGS(db2x_manxml_cmd, db2x_manxml) AC_CHECK_PROGS(xsltproc_cmd, xsltproc) if test x$db2x_xsltproc_cmd = "x" -o x$xsltproc_cmd = "x"; then AM_CONDITIONAL(HAVE_DOCSTUFF, false) else AM_CONDITIONAL(HAVE_DOCSTUFF, true) fi dnl dnl Check sysinfo() dnl if test x$WANT_SYSINFO = xyes; then dah=no AC_MSG_CHECKING(for sysinfo) AC_TRY_COMPILE( [#include #include ], [struct sysinfo s; sysinfo(&s); (void) s.uptime; ], [AC_MSG_RESULT(yes); dah=yes], [AC_MSG_RESULT(not usable); dah=no]) if test x$dah = xyes; then AC_DEFINE(HAVE_SYSINFO, 1, [Define if you have sysinfo (Linux)]) fi fi dnl dnl kstat in Solaris dnl if test x$WANT_KSTAT = xyes; then dah=no AC_CHECK_LIB([kstat], [kstat_open], [dah=yes], []) if test x$dah = xyes; then AC_DEFINE(HAVE_KSTAT, 1, [Define if you have kstat (Solaris)]) LDFLAGS="$LDFLAGS -lkstat" fi fi AC_DEFUN([AM_LANGINFO_CODESET], [ AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset, [AC_TRY_LINK([#include ], [char* cs = nl_langinfo(CODESET);], am_cv_langinfo_codeset=yes, am_cv_langinfo_codeset=no) ]) if test $am_cv_langinfo_codeset = yes; then AC_DEFINE(HAVE_LANGINFO_CODESET, 1, [Define if you have and nl_langinfo(CODESET).]) fi ]) dnl dnl Check getloadavg dnl AC_MSG_CHECKING(for getloadavg) AC_TRY_COMPILE( [#include ], [double v[3]; getloadavg(v, 3);], [AC_MSG_RESULT(yes) AC_DEFINE(HAVE_GETLOADAVG, 1, [Define if you have getloadavg])], [AC_MSG_RESULT(no)]) dnl dnl Check popen dnl AC_CHECK_FUNCS(popen) dnl dnl Da. dnl CFLAGS="$CFLAGS -Wall -W" AC_SUBST(CFLAGS) AC_SUBST(X11_LIBS) AC_OUTPUT dnl dnl Print summary dnl cat << EOF $PACKAGE $VERSION configured successfully: Installing into: $prefix C compiler flags: $CFLAGS Linker flags: $LDFLAGS Libraries: $LIBS * x11: x11 support: $want_x11 xft support: $want_xft xdamage extension: $want_xdamage * music detection: xmms: $want_xmms bmp: $want_bmp audacious: $want_audacious infopipe: $want_infopipe bmpx: $want_bmpx xmms2: $want_xmms2 mpd: $want_mpd * general: portmon: $want_portmon mldonkey: $want_mldonkey hddtemp: $want_hddtemp EOF