1 dnl Initialize autoconf and automake
6 AM_CONFIG_HEADER(config.h)
8 AM_INIT_AUTOMAKE($PACKAGE,"$VERSION")
10 dnl Determine default prefix
11 if test "x$prefix" = "xNONE"; then
14 if test "x$exec_prefix" = "xNONE"; then
18 dnl Check for various flavors of UNIX(r)
23 dnl Locate required external software
30 dnl Check for system header files
32 AC_CHECK_HEADERS(string.h unistd.h dirent.h stdlib.h sys/time.h time.h sys/wait.h)
34 AC_CHECK_HEADERS(sstream, ,
35 [ AC_CHECK_HEADERS(strstream,,
36 [AC_MSG_ERROR([Your libstdc++ doesn't have the sstream, fstream or strstream classes])]
41 AC_CHECK_HEADERS(cassert cctype cerrno cmath cstdarg cstdio cstdlib cstring ctime)
45 dnl Check for X headers and libraries
46 AC_PATH_X([X11], [X11/Xlib.h], [XOpenDisplay(NULL)])
49 test x$no_x = "xyes" && AC_MSG_ERROR([Idesk requires the X Window System libraries and headers.])
51 test x$x_includes = "x" && x_includes="/usr/include"
52 test x$x_libraries = "x" && x_libraries="/usr/lib"
54 CFLAGS="$CFLAGS $X_CFLAGS"
55 CXXFLAGS="$CXXFLAGS $X_CFLAGS"
57 LDFLAGS="$LDFLAGS $LIBS $X_PRE_LIBS"
59 dnl Check for required functions in -lX11
60 AC_CHECK_LIB(X11, XOpenDisplay, LIBS="$LIBS -lX11",[
61 echo "ERROR: You need libX11 to build Idesk. Verify that you have libX11.a or";
62 echo " libX11.so installed and that it is located in the X libraries";
63 AC_MSG_ERROR([Fatal: libX11 not found.])])
65 LIBS="$LIBS $X_EXTRA_LIBS"
67 dnl Check for XShape extension support and proper library files.
69 AC_MSG_CHECKING([whether to build support for the XShape extension])
71 shape, [ --enable-shape enable support of the XShape extension [default=yes]])
74 if test x$enableval = "xyes"; then
76 AC_CHECK_LIB(Xext, XShapeCombineShape,
77 AC_MSG_CHECKING([for X11/extensions/shape.h])
80 #include <X11/Xutil.h>
81 #include <X11/extensions/shape.h>
82 , long foo = ShapeSet,
84 SHAPE="-DSHAPE"; Xext_lib="-lXext",
92 CXXFLAGS="$CXXFLAGS $SHAPE"
93 LIBS="$LIBS $Xext_lib"
97 AC_PATH_GENERIC(imlib2, , [
99 AC_SUBST(IMLIB_CXXFLAGS) ],
100 AC_MSG_ERROR(Cannot find imlib2: Is imlib2-config in the path?
101 You need Imlib2 to build Idesk. Verify that you have Imlib2-dev))
103 dnl the above doesn't work for some reason :/
104 IMLIB_LIBS=`imlib2-config --libs`
105 IMLIB_CFLAGS=`imlib2-config --cflags`
107 AC_SUBST(IMLIB_CXXFLAGS)
109 CXXFLAGS="$CXXFLAGS $IMLIB_CXXFLAGS"
110 LIBS="$LIBS $IMLIB_LIBS"
113 dnl Check for libsn Startup Notificacion options
115 AC_MSG_CHECKING([whether to include Startup Notification ])
117 libsn, [ --enable-libsn include code for LIBSN [default=no]])
119 if test -n "$enable_libsn"; then
120 PKG_CHECK_MODULES(LIBSN, libstartup-notification-1.0 >= 0.5)
122 STARTUP="-DHAVE_STARTUP_NOTIFICATION -DSN_API_NOT_YET_FROZEN=1",
127 AM_CONDITIONAL(HAVE_STARTUP_NOTIFICATION, test x$LIBSN = xtrue)
129 AC_SUBST(LIBSN_CFLAGS)
131 CXXFLAGS="$CXXFLAGS $LIBSN_CFLAGS $STARTUP"
132 LIBS="$LIBS $LIBSN_LIBS"
135 AC_MSG_CHECKING([whether to have Xft support])
141 if test "x$XFT" = "xtrue" ; then
143 #include <X11/Xft/Xft.h>
144 ], [ XftFontClose(0, 0); return 1; ],
147 AC_DEFINE(USE_XFT, 1, "antialias support")
148 AC_MSG_CHECKING([Xft UTF-8 support])
150 #include <X11/Xft/Xft.h>
151 ], [ XftDrawStringUtf8(0, 0, 0, 0, 0, 0, 0); return 0; ],
152 AC_DEFINE(HAVE_XFT_UTF8_STRING, 1, "Xft UTF8 support")
157 [ AC_MSG_RESULT([Could not link with Xft. Install Xft if you want support for it.])
162 AM_CONDITIONAL(XFT, test x$XFT = xtrue)
164 dnl Determine the return type of signal handlers
167 dnl Determine if maintainer portions of the Makefiles should be included.
168 dnl AM_MAINTAINER_MODE
171 DEFAULT_PREFIX="$prefix"
172 AC_SUBST(DEFAULT_PREFIX)
176 AC_MSG_RESULT([ $PACKAGE version $VERSION configured successfully.])
178 AC_MSG_RESULT([Using '$prefix' for installation.])
179 AC_MSG_RESULT([Using '$CXX' for C++ compiler.])
180 AC_MSG_RESULT([Building with '$CXXFLAGS' for C++ compiler flags.])
181 AC_MSG_RESULT([Building with '$LIBS' for linker flags.])