1 # configure.ac -- Process this file with autoconf to produce configure.
3 dnl Initialization stuff.
4 AC_INIT(wmnotify, 1.0.0)
5 AC_CONFIG_AUX_DIR(config)
6 AC_CONFIG_SRCDIR(src/wmnotify.c)
7 AM_CONFIG_HEADER(config.h:config-h.in)
8 dnl Checking if the NEWS file has been updated to reflect the current version.
9 AM_INIT_AUTOMAKE(check-news)
10 AM_SILENT_RULES([yes])
12 dnl Testing the C compiler.
16 dnl Checking for header files.
19 AC_CHECK_HEADERS(stdlib.h unistd.h errno.h assert.h)
20 AC_CHECK_HEADERS(string.h strings.h)
22 dnl Checking for typedefs, structures, and compiler characteristics.
27 dnl Basic CFLAGS values
28 CFLAGS="${CFLAGS} -Wall"
30 dnl Checking for POSIX threads library.
31 ACX_PTHREAD([CFLAGS="$CFLAGS $PTHREAD_CFLAGS" LDFLAGS="$PTHREAD_LIBS $LDFLAGS" CC="$PTHREAD_CC"],
32 [AC_MSG_ERROR([POSIX thread support required])])
34 dnl Trying to locate the X window system's includes and libraries, and sets the
35 dnl variables x_includes and x_libraries to their locations. Also adds the
36 dnl required include flags to X_CFLAGS and required linking flags to X_LIBS.
38 CFLAGS="${CFLAGS} ${X_CFLAGS}"
39 LIBS="${LIBS} ${X_PRE_LIBS} ${X_LIBS} ${X_EXTRA_LIBS}"
41 dnl Checking for X11 library.
42 AC_CHECK_LIB(X11, XOpenDisplay, LIBS="${LIBS} -lX11",
43 echo "Can't find X11 library" ; exit 1, "${X_LIBS}")
45 dnl Checking for Xpm library and headers.
46 AC_CHECK_HEADERS(X11/xpm.h, ,echo "Can't find header file for library Xpm" ; exit 1)
47 AC_CHECK_LIB(Xpm, XpmCreatePixmapFromXpmImage, LIBS="${LIBS} -lXpm",
48 echo "Can't find Xpm library" ; exit 1, "${X_LIBS}")
50 dnl Checking for Xext library and headers.
51 AC_CHECK_HEADERS(X11/extensions/shape.h, ,
52 echo "Can't find header file for library Xext" ; exit 1)
53 AC_CHECK_LIB(Xext, XShapeCombineMask, LIBS="${LIBS} -lXext",
54 echo "Can't find Xext library" ; exit 1, "${X_LIBS}")
56 dnl Checks for libsndfile
57 AC_ARG_ENABLE(libsndfile,
58 [ --enable-libsndfile Enable libsndfile support for audible notification (default=yes)],
59 [ac_cv_enable_libsndfile=$enableval], [ac_cv_enable_libsndfile=yes])
60 AC_MSG_CHECKING([whether to use libsndfile])
61 if test x$ac_cv_enable_libsndfile = xyes; then
63 PKG_CHECK_MODULES([SNDFILE], sndfile >= 1.0.2, :, ac_cv_enable_libsndfile=no)
64 if test x$ac_cv_enable_libsndfile = xyes; then
65 AC_DEFINE([HAVE_SNDFILE],1,[Set to 1 to enable libsndfile support.])
71 dnl Checks for OpenSSL
73 [ --enable-ssl Enable SSL support using OpenSSL (default=yes)],
74 [ac_cv_enable_ssl=$enableval], [ac_cv_enable_ssl=yes])
75 AC_MSG_CHECKING([whether to use OpenSSL])
76 if test x$ac_cv_enable_ssl = xyes; then
78 PKG_CHECK_MODULES([OPENSSL], openssl >= 0.9.6, :, ac_cv_enable_ssl=no)
79 if test x$ac_cv_enable_ssl = xyes; then
80 AC_DEFINE([HAVE_SSL],1,[Set to 1 to enable OpenSSL support.])
86 CFLAGS="${CFLAGS} ${SNDFILE_CFLAGS} ${OPENSSL_CFLAGS}"
87 LIBS="${SNDFILE_LIBS} ${OPENSSL_LIBS} ${LIBS}"
93 dnl Creating output file(s)
94 AC_OUTPUT(Makefile src/Makefile doc/Makefile)
96 dnl Output the configuration summary
98 echo "Configuration summary:"
100 echo " Install path: ${prefix}"
101 echo " Compiler: ${CC}"
102 echo " Compiler flags: ${CFLAGS}"
103 echo " Linker flags: ${LIBS}"
104 echo " OpenSSL support: $ac_cv_enable_ssl"
105 echo " libsndfile support: $ac_cv_enable_libsndfile"
106 if test "x${ac_cv_enable_libsndfile}" = xno; then
108 echo " WARNING: Althought the 'libsndfile' library is not mandatory, without it"
109 echo " you won't have audible notifications."
113 echo "Configure finished. Type 'make' to build."