Check for XOpenDisplay in -lX11.
[monky] / configure.ac
index 6416012..41ff062 100644 (file)
@@ -1,11 +1,17 @@
-AC_INIT([Conky],[1.4.2],[brenden1@users.sourceforge.net])
+AC_INIT([Conky],[1.4.3],[brenden1@users.sourceforge.net])
 
-AM_INIT_AUTOMAKE(conky, 1.4.2)
+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])
@@ -15,6 +21,7 @@ AC_CONFIG_FILES(
        Makefile
        doc/Makefile
        src/Makefile
+       src/build.h
        )
 
 uname=`uname`
@@ -50,11 +57,16 @@ case $uname in
 esac
 
 AM_CONDITIONAL(BUILD_LINUX, test x$uname = xLinux)
-AM_CONDITIONAL(BUILD_SOLARIS, test x$uname = xSunOS)
+#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_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
@@ -399,15 +411,27 @@ 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
+want_double_buffer=yes
 AC_ARG_ENABLE(double_buffer,
 [  --enable-double-buffer  enable if you want to support flicker-free operation [[default=yes]]],
-  [dah="$enableval"])
+  [want_double_buffer="$enableval"])
 
 want_xdamage=yes
 AC_ARG_ENABLE(xdamage,
@@ -426,13 +450,21 @@ if test "x$want_x11" = "xyes"; then
        CFLAGS="$CFLAGS $X_CFLAGS"
        LIBS="$LIBS $X_LIBS $X11_LIBS"
        LDFLAGS="$LDFLAGS $LIBS $X_PRE_LIBS"
-       if test "x$X_DISPLAY_MISSING" = xyes; then
+       
+       if test "x$no_x" = 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_CHECK_LIB(
+               [X11], [XOpenDisplay],[], 
+               AC_MSG_ERROR([Could not find XOpenDisplay in -lX11.])
+       )
+
        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
+       
+       if test "x$want_double_buffer" != 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)])])
@@ -453,22 +485,13 @@ dnl Xft
 dnl
 
 if test x$want_xft && test x$want_x11; then
-  AC_PATH_PROG(XFTCONFIG, xft-config)
-  if test x$XFTCONFIG != x; then
-    dnl TODO: needs more checks
-  
-dnl This won't work for some reason
-dnl  AC_CHECK_HEADERS([X11/Xft/Xft.h], [], [XFT_MISSING=yes])
-    if test "x$XFT_MISSING" = xyes; then
-      AC_MSG_ERROR([something went wrong when checking for Xft, you're probably missing headers or it's not installed])
-  fi
-
-    AC_DEFINE(XFT, 1, [Define if you are using Xft])
-    CFLAGS="$CFLAGS `$XFTCONFIG --cflags`"
-    XFT_LIBS=`$XFTCONFIG --libs`
-  else
-    want_xft=no
-  fi
+  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
@@ -603,7 +626,6 @@ CFLAGS="$CFLAGS -Wall -W"
 
 AC_SUBST(CFLAGS)
 AC_SUBST(X11_LIBS)
-AC_SUBST(XFT_LIBS)
 
 AC_OUTPUT
 
@@ -613,7 +635,12 @@ 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