Fixed compilation issues
[distributed.git] / configure.ac.in
blob49d701b767c604f2866c07cf08e12ec4c65514fe
1 # Process this file with autoconf to produce a configure script.
4 # configure.ac for distributed
6 # Copyright (C) 2008 Francesco Salvestrini
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License along
19 # with this program; if not, write to the Free Software Foundation, Inc.,
20 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 AC_INIT([Distributed],[@VERSION@],[salvestrini@gmail.com],[distributed])
25 # Check for a recent version of autoconf
26 AC_PREREQ([2.61])
28 # Place/find all autotools related files in the following directories
29 AC_CONFIG_AUX_DIR([tools/autotools])
30 AC_CONFIG_MACRO_DIR([tools/autotools/m4])
31 AC_CONFIG_SRCDIR([AUTHORS])
32 AC_CONFIG_HEADERS([src/autoconfig.h])
34 # Get the triplet
35 AC_CANONICAL_BUILD
36 AC_CANONICAL_HOST
37 AC_CANONICAL_TARGET
40 # For automake options (AM_INIT_AUTOMAKE options) see Makefile.am
41 # file, AUTOMAKE_OPTIONS variable
43 AM_INIT_AUTOMAKE([1.10 foreign -Wall])
46 # Build related programs
48 AC_PROG_INSTALL
49 AC_PROG_MAKE_SET
50 AC_PROG_LN_S
51 AC_PROG_GREP
52 AC_PROG_SED
53 AM_PROG_AS
54 AC_PROG_CPP
55 AC_PROG_CC
56 AS_IF([test "$CC" = "gcc"],[
57         AX_GCC_VERSION
58         CC_VERSION=$GCC_VERSION
59 ],[
60         CC_VERSION="unknown"
62 AC_PROG_CXX
63 AS_IF([test "$CXX" = "g++"],[
64         AX_GXX_VERSION
65         CXX_VERSION=$GXX_VERSION
66 ],[
67         CXX_VERSION="unknown"
69 AC_PROG_CC_C_O
70 AC_PROG_CXX_C_O
71 AC_PROG_CXXCPP
72 AC_PROG_RANLIB
75 # gnulib related
77 GNULIB_EARLY
78 GNULIB_INIT
80 # Checks for preprocessor flags
81 TEMP_FLAGS=""
82 AX_CXXCPP_CHECK_FLAG([-Wall],  [],[],[ TEMP_FLAGS="$TEMP_FLAGS -Wall"  ])
83 AX_CXXCPP_CHECK_FLAG([-Werror],[],[],[ TEMP_FLAGS="$TEMP_FLAGS -Werror"])
84 AC_SUBST([EXTRA_CPPFLAGS],$TEMP_FLAGS)
86 # pkg-config setup
87 lua_available=0
89 PKG_PROG_PKG_CONFIG
90 AS_IF([test -n "$PKG_CONFIG"],[
91         # XXX FIXME: To be removed ASAP
92         AC_MSG_NOTICE([Performing pkg-config checks])
94         # Check for lua support
95         PKG_CHECK_MODULES([LUA],[lua],[ lua_available=1 ],[ lua_available=0 ])
96         AC_ARG_ENABLE(lua,[AS_HELP_STRING([--disable-lua],[disable lua support])],[
97                 AS_IF([test "$enable_lua" = "no"],[
98                             lua_available=0
99                 ])
100         ])
103 # XXX FIXME: To be removed ASAP
104 AC_MSG_NOTICE([lua_available = $lua_available])
106 # Finally output lua related state
107 AS_IF([ test "$lua_available" = "1" ],[
108         AC_DEFINE_UNQUOTED(HAVE_LUA,[1],[ Define to 1 if lua is available ])
110 AM_CONDITIONAL([ENABLE_LUA],[test "$lua_available" = "1"])
113 # Maintainer-side related program checks
115 AX_PATH_MISSING([WGET],     [wget])
116 AX_PATH_MISSING([PERL],     [perl])
117 AX_PATH_MISSING([ASCIIDOC], [asciidoc])
118 AX_PATH_MISSING([DEVTODO],  [devtodo])
121 # User-side related program checks
125 # Headers and functions check
127 AC_CHECK_HEADERS([unistd.h getopt.h execinfo.h])
128 AC_CHECK_FUNCS([backtrace backtrace_symbols])
131 # Footer at last
133 AC_CONFIG_FILES([
134         Makefile
136         src/Makefile
137         src/gnulib/Makefile
139         docs/Makefile
140         docs/design/Makefile
142         tools/Makefile
143         tools/autotools/Makefile
144         tools/autotools/m4/Makefile
145         tools/maint/Makefile
147         tests/Makefile
150 AC_CONFIG_FILES([tools/maint/fetch],               [chmod +x tools/maint/fetch])
151 AC_CONFIG_FILES([tools/maint/gitlog-to-committers],[chmod +x tools/maint/gitlog-to-committers])
153 AS_IF([test "$lua_available" = "1" ],[lua_state="yes"],[lua_state="no"])
154 AC_OUTPUT
156 cat <<EOF
158    ${PACKAGE_NAME} configuration summary
160      Software version        : ${PACKAGE_VERSION}
162      Host                    : ${host_cpu} ($host)
163      Build                   : ${build_cpu} ($build)
164      Target                  : ${target_cpu} ($target)
166      C preprocessor          : ${CPP}
167      C preprocessor flags    : ${CPPFLAGS}
168      C compiler              : ${CC} (version ${CC_VERSION})
169      C compiler flags        : ${CFLAGS}
170      C++ preprocessor        : ${CXXCPP}
171      C++ preprocessor flags  : ${CPPFLAGS}
172      C++ compiler            : ${CXX} (version ${CXX_VERSION})
173      C++ compiler flags      : ${CXXFLAGS}
174      Assembler               : ${CCAS}
175      Archive handler         : ${RANLIB}
176      Linker flags            : ${LDFLAGS}
178      Lua support             : ${lua_state}
180    ${PACKAGE_NAME} ${PACKAGE_VERSION} configured.
182    Copyright (C) 2008 Francesco Salvestrini
183    All Rights Reserved.
185    The ${PACKAGE_NAME}; you can redistribute it and/or
186    modify it under the terms of the GNU General Public License as
187    published by the Free Software Foundation; either version 2 of
188    the License, or (at your option) any later version.
190    The ${PACKAGE_NAME} is distributed in the hope that it will be useful,
191    but WITHOUT ANY WARRANTY; without even the implied warranty of
192    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
193    GNU General Public License for more details.