Home | History | Annotate | Download | only in wayland
      1 AC_PREREQ([2.64])
      2 
      3 m4_define([wayland_major_version],  [1])
      4 m4_define([wayland_minor_version], [12])
      5 m4_define([wayland_micro_version], [90])
      6 m4_define([wayland_version],
      7           [wayland_major_version.wayland_minor_version.wayland_micro_version])
      8 
      9 AC_INIT([wayland],
     10         [wayland_version],
     11         [https://bugs.freedesktop.org/enter_bug.cgi?product=Wayland&component=wayland&version=wayland_version],
     12         [wayland],
     13         [http://wayland.freedesktop.org/])
     14 
     15 AC_SUBST([WAYLAND_VERSION_MAJOR], [wayland_major_version])
     16 AC_SUBST([WAYLAND_VERSION_MINOR], [wayland_minor_version])
     17 AC_SUBST([WAYLAND_VERSION_MICRO], [wayland_micro_version])
     18 AC_SUBST([WAYLAND_VERSION], [wayland_version])
     19 
     20 AC_CONFIG_HEADERS([config.h])
     21 AC_CONFIG_MACRO_DIR([m4])
     22 
     23 AM_INIT_AUTOMAKE([1.11 foreign no-dist-gzip dist-xz subdir-objects])
     24 
     25 AM_SILENT_RULES([yes])
     26 
     27 # Check for programs
     28 AC_PROG_CC
     29 AC_PROG_CXX
     30 AC_PROG_GREP
     31 AM_PROG_AS
     32 
     33 # check if we have C++ compiler. This is hacky workaround,
     34 # for a reason why it is this way see
     35 # http://lists.gnu.org/archive/html/bug-autoconf/2010-05/msg00001.html
     36 have_cpp_compiler=yes
     37 
     38 if ! which "$CXX" &>/dev/null; then
     39 	have_cpp_compiler=no
     40 fi
     41 
     42 AM_CONDITIONAL(ENABLE_CPP_TEST, test "x$have_cpp_compiler" = "xyes")
     43 
     44 # Initialize libtool
     45 LT_PREREQ([2.2])
     46 LT_INIT
     47 
     48 PKG_PROG_PKG_CONFIG()
     49 
     50 AC_ARG_ENABLE([fatal-warnings],
     51 	      AC_HELP_STRING([--enable-fatal-warnings],
     52 			     [Build with -Werror]),
     53 	      [enable_fatal_warnings=$enableval],
     54 	      [enable_fatal_warnings=no])
     55 AS_IF([test x"$enable_fatal_warnings" != "xno"], [
     56       WERROR_CFLAGS="-Werror"
     57 ])
     58 
     59 if test "x$GCC" = "xyes"; then
     60 	GCC_CFLAGS="$WERROR_CFLAGS -Wall -Wextra -Wno-unused-parameter -g -Wstrict-prototypes -Wmissing-prototypes -fvisibility=hidden"
     61 fi
     62 AC_SUBST(GCC_CFLAGS)
     63 
     64 AC_CHECK_FUNCS([accept4 mkostemp posix_fallocate])
     65 
     66 AC_ARG_ENABLE([libraries],
     67 	      [AC_HELP_STRING([--disable-libraries],
     68 			      [Disable compilation of wayland libraries])],
     69 	      [],
     70 	      [enable_libraries=yes])
     71 
     72 AC_ARG_WITH([host-scanner],
     73               [AC_HELP_STRING([--with-host-scanner],
     74                               [Use installed wayland-scanner from host PATH during build])],
     75               [],
     76               [with_host_scanner=no])
     77 
     78 AC_ARG_ENABLE([documentation],
     79 	      [AC_HELP_STRING([--disable-documentation],
     80 		              [Disable building the documentation])],
     81 	      [],
     82 	      [enable_documentation=yes])
     83 
     84 AC_ARG_ENABLE([dtd-validation],
     85 	      [AC_HELP_STRING([--disable-dtd-validation],
     86 			      [Disable DTD validation of the protocol])],
     87 	      [],
     88 	      [enable_dtd_validation=yes])
     89 
     90 AM_CONDITIONAL(USE_HOST_SCANNER, test "x$with_host_scanner" = xyes)
     91 
     92 AM_CONDITIONAL(ENABLE_LIBRARIES, test "x$enable_libraries" = xyes)
     93 
     94 AC_ARG_WITH(icondir, [  --with-icondir=<dir>    Look for cursor icons here],
     95 		     [  ICONDIR=$withval],
     96 		     [  ICONDIR=${datadir}/icons])
     97 AC_SUBST([ICONDIR])
     98 
     99 if test "x$enable_libraries" = "xyes"; then
    100 	PKG_CHECK_MODULES(FFI, [libffi])
    101 	AC_CHECK_DECL(SFD_CLOEXEC,[],
    102 		      [AC_MSG_ERROR("SFD_CLOEXEC is needed to compile wayland libraries")],
    103 		      [[#include <sys/signalfd.h>]])
    104 	AC_CHECK_DECL(TFD_CLOEXEC,[],
    105 		      [AC_MSG_ERROR("TFD_CLOEXEC is needed to compile wayland libraries")],
    106 		      [[#include <sys/timerfd.h>]])
    107 	AC_CHECK_DECL(CLOCK_MONOTONIC,[],
    108 		      [AC_MSG_ERROR("CLOCK_MONOTONIC is needed to compile wayland libraries")],
    109 		      [[#include <time.h>]])
    110 	AC_CHECK_HEADERS([execinfo.h])
    111 fi
    112 
    113 PKG_CHECK_MODULES(EXPAT, [expat], [],
    114 	[AC_CHECK_HEADERS(expat.h, [],
    115 		[AC_MSG_ERROR([Can't find expat.h. Please install expat.])])
    116 	 SAVE_LIBS="$LIBS"
    117 	 AC_SEARCH_LIBS(XML_ParserCreate, expat, [],
    118 		[AC_MSG_ERROR([Can't find expat library. Please install expat.])])
    119 	 EXPAT_LIBS="$LIBS"
    120 	 LIBS="$SAVE_LIBS"
    121 	 AC_SUBST(EXPAT_LIBS)
    122 	])
    123 
    124 AM_CONDITIONAL([DTD_VALIDATION], [test "x$enable_dtd_validation" = "xyes"])
    125 if test "x$enable_dtd_validation" = "xyes"; then
    126 	PKG_CHECK_MODULES(LIBXML, [libxml-2.0])
    127 	AC_DEFINE(HAVE_LIBXML, 1, [libxml-2.0 is available])
    128 	AC_CONFIG_LINKS([src/wayland.dtd.embed:protocol/wayland.dtd])
    129 fi
    130 
    131 AC_PATH_PROG(XSLTPROC, xsltproc)
    132 AM_CONDITIONAL([HAVE_XSLTPROC], [test "x$XSLTPROC" != "x"])
    133 
    134 AC_MSG_CHECKING([for docbook manpages stylesheet])
    135 MANPAGES_STYLESHEET=http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl
    136 AC_PATH_PROGS_FEATURE_CHECK([XSLTPROC_TMP], [xsltproc],
    137 			    AS_IF([`"$ac_path_XSLTPROC_TMP" --nonet "$MANPAGES_STYLESHEET" > /dev/null 2>&1`],
    138 				  [HAVE_MANPAGES_STYLESHEET=yes]))
    139 if test "x$HAVE_MANPAGES_STYLESHEET" = "xyes"; then
    140 	AM_CONDITIONAL([HAVE_MANPAGES_STYLESHEET], true)
    141 	AC_SUBST(MANPAGES_STYLESHEET)
    142 	AC_MSG_RESULT([yes])
    143 else
    144 	AM_CONDITIONAL([HAVE_MANPAGES_STYLESHEET], false)
    145 	AC_MSG_RESULT([no])
    146 fi
    147 
    148 AM_CONDITIONAL(BUILD_DOCS, [test x$enable_documentation = xyes])
    149 if test "x$enable_documentation" = "xyes"; then
    150 	AC_PATH_PROG(DOXYGEN, doxygen)
    151 
    152 	if test "x$DOXYGEN" = "x"; then
    153 		AC_MSG_ERROR([Documentation build requested but doxygen not found. Install doxygen or disable the documentation using --disable-documentation])
    154 	fi
    155 
    156 	AC_MSG_CHECKING([for compatible doxygen version])
    157 	doxygen_version=`$DOXYGEN --version`
    158 	AS_VERSION_COMPARE([$doxygen_version], [1.6.0],
    159 	                   [AC_MSG_RESULT([no])
    160 	                    AC_MSG_ERROR([Doxygen $doxygen_version too old. Doxygen 1.6+ required for documentation build. Install required doxygen version or disable the documentation using --disable-documentation])],
    161 	                   [AC_MSG_RESULT([yes])],
    162 	                   [AC_MSG_RESULT([yes])])
    163 
    164 	AC_PATH_PROG(XMLTO, xmlto)
    165 
    166 	if test "x$XMLTO" = "x"; then
    167 		AC_MSG_ERROR([Documentation build requested but xmlto not found. Install xmlto or disable the documentation using --disable-documentation])
    168 	fi
    169 
    170 	AC_PATH_PROG(DOT, dot)
    171 	if test "x$DOT" = "x"; then
    172 		AC_MSG_ERROR([Documentation build requested but graphviz's dot not found. Install graphviz or disable the documentation using --disable-documentation])
    173 	fi
    174 	AC_MSG_CHECKING([for compatible dot version])
    175 	dot_version=`$DOT -V 2>&1|$GREP -o ['[0-9]*\.[0-9]*\.[0-9]*']`
    176 	AS_VERSION_COMPARE([$dot_version], [2.26.0],
    177 	                   [AC_MSG_RESULT([no])
    178 	                    AC_MSG_ERROR([Graphviz dot $dot_version too old. Graphviz 2.26+ required for documentation build. Install required graphviz version or disable the documentation using --disable-documentation])],
    179 	                   [AC_MSG_RESULT([yes])],
    180 	                   [AC_MSG_RESULT([yes])])
    181 
    182 	AC_CONFIG_FILES([
    183 	doc/doxygen/wayland.doxygen
    184 	])
    185 
    186 fi
    187 AM_CONDITIONAL([HAVE_XMLTO], [test "x$XMLTO" != "x"])
    188 
    189 AC_CONFIG_FILES([Makefile
    190 		 cursor/wayland-cursor.pc
    191 		 cursor/wayland-cursor-uninstalled.pc
    192 		 doc/Makefile
    193 		 doc/publican/Makefile
    194 		 doc/doxygen/Makefile
    195 		 doc/man/Makefile
    196 		 src/wayland-server-uninstalled.pc
    197 		 src/wayland-client-uninstalled.pc
    198 		 src/wayland-scanner-uninstalled.pc
    199 		 src/wayland-server.pc
    200 		 src/wayland-client.pc
    201 		 src/wayland-scanner.pc
    202 		 src/wayland-version.h])
    203 AC_OUTPUT
    204