2 # Process this file with autoconf to produce a configure script.
5 AC_INIT([Xestia Address Book], [0.05], [bugs@xestia.co.uk])
6 #AC_CONFIG_SRCDIR([version.h])
7 #AC_CONFIG_HEADERS([config.h])
9 AC_DEFINE([DEBUG], [1], [Enable debugging build so errors can be examined in detail.])
11 # Checks for programs.
16 # Check prefix directories.
18 if test "x$prefix" = "xNONE" ; then
22 if test "x$exec_prefix" = "xNONE" ; then
29 if test "x$bindir" = "xNONE" ; then
32 BINDIR=`eval echo $bindir`
35 if test "x$datarootdir" = "xNONE" ; then
38 DATAROOTDIR=`eval echo $datarootdir`
39 AC_SUBST([DATAROOTDIR])
41 # Checks for libraries.
47 # Check for C++11 support for the compiler.
49 CPPFLAGS="$CPPFLAGS -std=c++11"
50 CXXFLAGS="$CXXFLAGS -std=c++11"
52 # Checks for header files.
53 AC_CHECK_HEADERS([stdlib.h string.h iostream iomanip ios algorithm map vector utility])
55 AC_CHECK_HEADER([thread], [], [echo "The C++ compiler does not support C++11 extensions which is
56 needed for Xestia Address Book. Please install or use a
57 compiler that supports C++11 extensions."
63 AM_PATH_WXCONFIG($reqwx, wxWin=1)
64 if test "$wxWin" != 1; then
66 wxWidgets must be installed on your system.
68 Please check that wx-config is in path, the directory where wxWidgets libraries
69 are installed (returned by 'wx-config --libs' or 'wx-config --static --libs'
70 command) is in LD_LIBRARY_PATH or equivalent variable and wxWidgets version
75 CPPFLAGS="$CPPFLAGS $WX_CPPFLAGS"
76 CXXFLAGS="$CXXFLAGS $WX_CXXFLAGS_ONLY"
77 CFLAGS="$CFLAGS $WX_CFLAGS_ONLY"
82 PKG_CHECK_MODULES([SFML], [sfml-all >= 2.4.1])
84 AC_CHECK_LIB([sfml-audio], [main], [], [echo "The SFML libraries must be installed on your system.
85 Please check that this library is installed properly before
86 running configure again."
90 AC_CHECK_HEADER([SFML/Audio.hpp], [], [echo "The SFML library headers must be installed on your system.
91 Please check that the library headers are installed properly
92 before running configure again."
100 PKG_CHECK_MODULES([CURL], [libcurl >= 7.52.0])
102 AC_CHECK_LIB([curl], [main], [], [echo "The cURL library must be installed on your system.
103 Please check that this library is installed properly before
104 running configure again."
108 AC_CHECK_HEADER([curl/curl.h], [], [echo "The cURL library headers must be installed on your system.
109 Please check that the library headers are installed properly
110 before running configure again."
114 AC_CHECK_PROG([FOUND_CURLCONFIG], [curl-config], [yes], [no])
115 AM_CONDITIONAL([FOUND_CURLCONFIG_RES], [test x$FOUND_CURLCONFIG = xyes])
117 AM_COND_IF([FOUND_CURLCONFIG_RES], [], [echo "Cannot find the curl-config program on your system.
118 If it is installed on your system, adjust your PATH environment
119 variable before running configure again."
125 AC_CHECK_PROG([FOUND_FILE], [file], [yes], [no])
126 AM_CONDITIONAL([FOUND_FILE_RES], [test x$FOUND_FILE = xyes])
128 AM_COND_IF([FOUND_FILE_RES], [], [echo "Cannot find the file program on your system.
129 If it is installed on your system, adjust your PATH environment
130 variable before running configure again."
134 # uuidgen application
136 AC_CHECK_PROG([FOUND_UUIDGEN], [uuidgen], [yes], [no])
137 AM_CONDITIONAL([FOUND_UUIDGEN_RES], [test x$FOUND_UUIDGEN = xyes])
139 AM_COND_IF([FOUND_UUIDGEN_RES], [], [echo "Cannot find the uuidgen program on your system.
140 If it is installed on your system, adjust your PATH environment
141 variable before running configure again."
145 # Checks for typedefs, structures, and compiler characteristics.
149 # Check for Google Test and if it exists, enable the tests.
152 AC_CHECK_HEADERS([gtest/gtest.h], [gtestfound=yes], [gtestfound=no])
158 CPPFLAGS=`xml2-config --cflags`
160 AC_CHECK_PROG([FOUND_XML2CONFIG], [xml2-config], [yes], [no])
161 AM_CONDITIONAL([FOUND_XML2CONFIG_RES], [test x$FOUND_XML2CONFIG = xyes])
163 AM_COND_IF([FOUND_XML2CONFIG_RES], [], [echo "Cannot find the xml2-config program on your system.
164 If it is installed on your system, adjust your PATH environment
165 variable before running configure again."
169 AC_CHECK_LIB([xml2], [main], [], [echo "The libxml2 library must be installed on your system.
170 Please check that this library is installed properly before
171 running configure again."
175 AC_CHECK_HEADERS([libxml2/libxml/parser.h libxml2/libxml/tree.h], [], [echo "The libxml2 library headers must be installed on your system.
176 Please check that the library headers are installed properly
177 before running configure again."
183 # Setup the debug setting.
185 AC_ARG_ENABLE([debug],
186 [ --enable-debug Enable debugging features for the build.],
187 [case "${enableval}" in
190 *) AC_MSG_ERROR([invalid value ${enableval} given for --enable-debug]) ;;
193 # Checks for library functions.
195 AM_CONDITIONAL([DEBUG], [test x$debug = xtrue])
196 AM_COND_IF([DEBUG], [AC_SUBST([DBGOUT], ["-O0 -ggdb"])], [AC_SUBST([DBGOUT], ["-Os"])])
197 AM_COND_IF([DEBUG], [AC_SUBST([DBGSTATUS], ["DEBUG=true"])], [AC_SUBST([DBGSTATUS], ["DEBUG=false"])])
198 AM_COND_IF([DEBUG], [echo "Debugging mode has been enabled."])
200 AM_CONDITIONAL([GTEST_FOUND], [test x$gtestfound = xyes])
201 AM_COND_IF([GTEST_FOUND], [AC_SUBST([GTEST], [`cat tests/test.commands`])],
202 [AC_SUBST([GTEST], [" @echo \"Google Test was not found on the system. Unable to build tests.\""])])
203 AM_COND_IF([GTEST_FOUND], [echo "Google Test found on the system. Enabling Unit Tests."]);
205 AC_CONFIG_FILES([Makefile tests/Makefile])