Fixed configuration related code
[distributed.git] / configure.ac.in
blobb6d6b349ab52da06f7dbdb652738d2f7c80f1b6e
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
74 # Checks for preprocessor flags
75 TEMP_FLAGS=""
76 AX_CXXCPP_CHECK_FLAG([-Wall],  [],[],[ TEMP_FLAGS="$TEMP_FLAGS -Wall"  ])
77 AX_CXXCPP_CHECK_FLAG([-Werror],[],[],[ TEMP_FLAGS="$TEMP_FLAGS -Werror"])
78 AC_SUBST([EXTRA_CPPFLAGS],$TEMP_FLAGS)
80 # pkg-config setup
81 lua_available=0
83 PKG_PROG_PKG_CONFIG
84 AS_IF([test -n "$PKG_CONFIG"],[
85         # XXX FIXME: To be removed ASAP
86         AC_MSG_NOTICE([Performing pkg-config checks])
88         # Check for lua support
89         PKG_CHECK_MODULES([LUA],[lua],[ lua_available=1 ],[ lua_available=0 ])
90         AC_ARG_ENABLE(lua,[AS_HELP_STRING([--disable-lua],[disable lua support])],[
91                 AS_IF([test "$enable_lua" = "no"],[
92                             lua_available=0
93                 ])
94         ])
97 # XXX FIXME: To be removed ASAP
98 AC_MSG_NOTICE([lua_available = $lua_available])
100 # Finally output lua related state
101 AS_IF([ test "$lua_available" = "1" ],[
102         AC_DEFINE_UNQUOTED(HAVE_LUA,[1],[ Define to 1 if lua is available ])
104 AM_CONDITIONAL([ENABLE_LUA],[test "$lua_available" = "1"])
107 # Maintainer-side related program checks
109 AX_PATH_MISSING([WGET],     [wget])
110 AX_PATH_MISSING([PERL],     [perl])
111 AX_PATH_MISSING([ASCIIDOC], [asciidoc])
114 # User-side related program checks
118 # Headers and functions check
120 AC_CHECK_HEADERS([unistd.h getopt.h execinfo.h])
121 AC_CHECK_FUNCS([backtrace backtrace_symbols])
124 # Footer at last
126 AC_CONFIG_FILES([
127         Makefile
129         src/Makefile
131         docs/Makefile
132         docs/design/Makefile
134         tools/Makefile
135         tools/autotools/Makefile
136         tools/autotools/m4/Makefile
137         tools/maint/Makefile
139         tests/Makefile
142 AC_CONFIG_FILES([tools/maint/fetch],               [chmod +x tools/maint/fetch])
143 AC_CONFIG_FILES([tools/maint/gitlog-to-committers],[chmod +x tools/maint/gitlog-to-committers])
145 AS_IF([test "$lua_available" = "1" ],[lua_state="yes"],[lua_state="no"])
146 AC_OUTPUT
148 cat <<EOF
150    ${PACKAGE_NAME} configuration summary
152      Software version        : ${PACKAGE_VERSION}
154      Host                    : ${host_cpu} ($host)
155      Build                   : ${build_cpu} ($build)
156      Target                  : ${target_cpu} ($target)
158      C preprocessor          : ${CPP}
159      C preprocessor flags    : ${CPPFLAGS}
160      C compiler              : ${CC} (version ${CC_VERSION})
161      C compiler flags        : ${CFLAGS}
162      C++ preprocessor        : ${CXXCPP}
163      C++ preprocessor flags  : ${CPPFLAGS}
164      C++ compiler            : ${CXX} (version ${CXX_VERSION})
165      C++ compiler flags      : ${CXXFLAGS}
166      Assembler               : ${CCAS}
167      Archive handler         : ${RANLIB}
168      Linker flags            : ${LDFLAGS}
170      Lua support             : ${lua_state}
172    ${PACKAGE_NAME} ${PACKAGE_VERSION} configured.
174    Copyright (C) 2008 Francesco Salvestrini
175    All Rights Reserved.
177    The ${PACKAGE_NAME}; you can redistribute it and/or
178    modify it under the terms of the GNU General Public License as
179    published by the Free Software Foundation; either version 2 of
180    the License, or (at your option) any later version.
182    The ${PACKAGE_NAME} is distributed in the hope that it will be useful,
183    but WITHOUT ANY WARRANTY; without even the implied warranty of
184    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
185    GNU General Public License for more details.