1 | ## Process this file with autoconf to produce a configure script. |
---|
2 | ## |
---|
3 | ## $Id: configure.ac 566 2008-03-07 19:27:00Z peter $ |
---|
4 | ## |
---|
5 | ## If you grabbed the source from subversion you should, at top-level, |
---|
6 | ## execute: |
---|
7 | ## ./bootstrap |
---|
8 | ## To push subsequent changes of this file into the build scripts you |
---|
9 | ## must issue: |
---|
10 | ## autoreconf |
---|
11 | |
---|
12 | # Copyright (C) 2005 Jari Häkkinen, Peter Johansson |
---|
13 | # Copyright (C) 2006 Jari Häkkinen |
---|
14 | # Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson |
---|
15 | # |
---|
16 | # This file is part of svndigest, http://trac.thep.lu.se/svndigest |
---|
17 | # |
---|
18 | # svndigest is free software; you can redistribute it and/or modify it |
---|
19 | # under the terms of the GNU General Public License as published by |
---|
20 | # the Free Software Foundation; either version 2 of the License, or |
---|
21 | # (at your option) any later version. |
---|
22 | # |
---|
23 | # svndigest is distributed in the hope that it will be useful, but |
---|
24 | # WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
25 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
26 | # General Public License for more details. |
---|
27 | # |
---|
28 | # You should have received a copy of the GNU General Public License |
---|
29 | # along with this program; if not, write to the Free Software |
---|
30 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
---|
31 | # 02111-1307, USA. |
---|
32 | |
---|
33 | AC_PREREQ(2.57) |
---|
34 | |
---|
35 | |
---|
36 | AC_INIT([svndigest],[pre0.7],[jari@thep.lu.se]) |
---|
37 | AC_CONFIG_SRCDIR([lib/File.h]) |
---|
38 | AC_CONFIG_AUX_DIR([autotools]) |
---|
39 | AC_PREFIX_DEFAULT([/usr/local]) |
---|
40 | test $prefix = NONE && prefix=/usr/local |
---|
41 | |
---|
42 | AM_CONFIG_HEADER([config.h]) |
---|
43 | AM_INIT_AUTOMAKE([std-options check-news]) |
---|
44 | |
---|
45 | sinclude(./build_support/svndigest.m4) |
---|
46 | SPLIT_VERSION([VERSION], [$VERSION]) |
---|
47 | |
---|
48 | # seems like these variables are not set with older autoconf(?) |
---|
49 | AC_SUBST([abs_srcdir], ["`cd $srcdir && pwd`"]) |
---|
50 | AC_SUBST([abs_builddir], ["`pwd`"]) |
---|
51 | |
---|
52 | # Set default programming language |
---|
53 | AC_LANG(C++) |
---|
54 | |
---|
55 | # Let user overide default CXXFLAGS |
---|
56 | if test "${CXXFLAGS+set}" != set; then |
---|
57 | CXXFLAGS="" # Setting CXXFLAGS here to prevent expansion in AC_PROG_CXX |
---|
58 | fi |
---|
59 | # Checks for programs. |
---|
60 | AC_PROG_CXXCPP |
---|
61 | AC_PROG_CXX |
---|
62 | AC_PROG_INSTALL |
---|
63 | AC_PROG_LIBTOOL |
---|
64 | AC_PROG_RANLIB |
---|
65 | AC_CHECK_PROG([GNUPLOT],[gnuplot],[ok]) |
---|
66 | |
---|
67 | # -Wno-long-long is needed to suppress compiler diagnostics regarding |
---|
68 | # using extension beyond the C++ standard (usage of non C++ standard |
---|
69 | # 'long long' types). |
---|
70 | CXXFLAGS="$CXXFLAGS -Wall -pedantic -Wno-long-long" |
---|
71 | sinclude(./build_support/ac_c_long_long.m4) |
---|
72 | AC_C_LONG_LONG() |
---|
73 | |
---|
74 | AC_ARG_ENABLE(debug, |
---|
75 | [AS_HELP_STRING([--enable-debug],[turn on debug options and code])], |
---|
76 | [CXXFLAGS="$CXXFLAGS -g -O"], |
---|
77 | [CPPFLAGS="$CPPFLAGS -DNDEBUG" CXXFLAGS="$CXXFLAGS -O3"]) |
---|
78 | |
---|
79 | # optionally prepare for building static libraries. |
---|
80 | AC_ARG_ENABLE(staticbin, |
---|
81 | [AS_HELP_STRING([--enable-staticbin], [create a static binary, |
---|
82 | at least as static as the available underlying libraries |
---|
83 | allows])]) |
---|
84 | if test "$enable_staticbin" = "yes"; then |
---|
85 | case $host in |
---|
86 | *-apple-darwin*) |
---|
87 | # At the time of creating this libsvn_subr uses |
---|
88 | # Keychain on Mac OSX. In consequence the below |
---|
89 | # frameworks are needed for succesful static builds. |
---|
90 | LIBS="$LIBS -framework Security" |
---|
91 | LIBS="$LIBS -framework CoreFoundation" |
---|
92 | LIBS="$LIBS -framework CoreServices" |
---|
93 | ;; |
---|
94 | esac |
---|
95 | STATICFLAG=-static |
---|
96 | AC_SUBST(STATICFLAG) |
---|
97 | fi |
---|
98 | |
---|
99 | # Apache Portable Runtime (APR) API checks |
---|
100 | # The next three lines are not needed as long as APR_FIND_APR is used. |
---|
101 | # AC_ARG_WITH(apr, |
---|
102 | # [ --with-apr=DIR prefix for installed APR or path to APR build |
---|
103 | # tree [[PREFIX]]]) |
---|
104 | # Include APR_FIND_APR macro distributed within the APR project. If |
---|
105 | # the usage of the APR macro is to be omitted then the construct for |
---|
106 | # setting the CXXFLAGS (header file location) and LDFLAGS (linking |
---|
107 | # informaion) for APR must be changed. The latter can be achieved with |
---|
108 | # AC_SEARCH_LIBS([apr_allocator_create],[apr-0],,apr_found="no") but |
---|
109 | # apr-0 must be prior knowledge. |
---|
110 | sinclude(./build_support/find_apr.m4) |
---|
111 | APR_FIND_APR(,,1) |
---|
112 | if test "$apr_found" = "yes" ; then |
---|
113 | LDFLAGS="`$apr_config --link-ld` $LDFLAGS" |
---|
114 | CPPFLAGS="`$apr_config --includes` $CPPFLAGS" |
---|
115 | AC_CHECK_HEADER([apr_allocator.h],,apr_found="no") |
---|
116 | fi |
---|
117 | |
---|
118 | # Subversion API checks |
---|
119 | svn_found="yes" |
---|
120 | AC_ARG_WITH(svn, |
---|
121 | [AS_HELP_STRING([--with-svn=DIR],[prefix for svn developer files [[PREFIX]]])], |
---|
122 | [ LDFLAGS="-L$withval/lib $LDFLAGS" CPPFLAGS="-I$withval/include $CPPFLAGS"]) |
---|
123 | AC_CHECK_HEADER([subversion-1/svn_types.h],,svn_found="no") |
---|
124 | # The library checks below may match shared libs even when |
---|
125 | # --enable-staticbin is given to configure. This should probably not |
---|
126 | # pose any problems since in a properly installed system the shared |
---|
127 | # and static libraries should be the same. |
---|
128 | AC_SEARCH_LIBS([svn_cmdline_setup_auth_baton],[svn_subr-1],,svn_found="no") |
---|
129 | AC_SEARCH_LIBS([svn_ra_initialize],[svn_ra-1],,svn_found="no") |
---|
130 | AC_SEARCH_LIBS([svn_wc_adm_open3],[svn_wc-1],,svn_found="no") |
---|
131 | AC_SEARCH_LIBS([svn_diff_file_options_create],[svn_diff-1],,svn_found="no") |
---|
132 | AC_SEARCH_LIBS([svn_client_log3],[svn_client-1],,svn_found="no") |
---|
133 | |
---|
134 | |
---|
135 | # check if svnversion is installed |
---|
136 | have_svnversion="yes" |
---|
137 | AC_PATH_PROG(SVNVERSION, svnversion, have_svnversion="no") |
---|
138 | |
---|
139 | wc_found="no"; |
---|
140 | if (test `$SVNVERSION -n '.'` != "exported"); then |
---|
141 | wc_found="yes"; |
---|
142 | fi |
---|
143 | AC_CHECK_FILE("lib/subversion_info.h", info_found="yes", info_found="no") |
---|
144 | |
---|
145 | # Checking that a release (non-dev) has no pre in VERSION |
---|
146 | # Failure should be captured by distcheck |
---|
147 | if (test "$wc_found" = "no" && test "$DEV_BUILD" = "yes") ; then |
---|
148 | AC_MSG_ERROR([Incorrect version number: $VERSION |
---|
149 | Version number of an official release should have format |
---|
150 | MAJOR.MINOR or MAJOR.MINOR.PATCH]) |
---|
151 | fi |
---|
152 | |
---|
153 | # devel version should have svn WC and SVNVERSION installed |
---|
154 | AM_CONDITIONAL(HAVE_SVN_WC, test "$wc_found" = "yes" ) |
---|
155 | |
---|
156 | |
---|
157 | AC_CONFIG_FILES([Makefile |
---|
158 | bin/Makefile |
---|
159 | lib/Makefile |
---|
160 | test/Makefile]) |
---|
161 | |
---|
162 | # Print failure status information about selected items, and exit if |
---|
163 | # fatal errors were encountered. No output will be created if |
---|
164 | # configure is halted prematurely. |
---|
165 | |
---|
166 | # used to trigger exit before creation of output |
---|
167 | all_reqs_ok="true" |
---|
168 | |
---|
169 | # |
---|
170 | if (test "$info_found" = "no" && test "$wc_found" = "no") ; then |
---|
171 | AC_MSG_WARN([Cannot find sources (lib/subverion_info.h).]) |
---|
172 | if (test "$svnversion" = "no") ; then |
---|
173 | AC_MSG_WARN([If you grabbed the source from the subversion repository, |
---|
174 | the file will be generated automatically. However, svnversion cannot |
---|
175 | be found and therefore the file cannot be generated. Please install |
---|
176 | svnversion and make sure it is in your search path.]) |
---|
177 | else |
---|
178 | AC_MSG_WARN([If you grabbed the source from the subversion repository, |
---|
179 | the file will be generated automatically. However, the output from |
---|
180 | svnversion was incorrect. Either your installation of svnversion is |
---|
181 | is not healthy or there is something wrong with the repository.]) |
---|
182 | fi |
---|
183 | all_reqs_ok="false" |
---|
184 | fi |
---|
185 | |
---|
186 | # Non-existing APR is fatal -- sub-sequent compilation will fail. |
---|
187 | if (test "$apr_found" = "no") ; then |
---|
188 | AC_MSG_WARN([APR not found. The Apache Portable Runtime |
---|
189 | (APR) library cannot be found. Please make sure APR is installed |
---|
190 | and supply the appropriate --with-apr option to 'configure'.]) |
---|
191 | all_reqs_ok="false" |
---|
192 | fi |
---|
193 | |
---|
194 | # Non-existing subversion API is fatal -- sub-sequent compilation will fail. |
---|
195 | if (test "$svn_found" = "no") ; then |
---|
196 | svn_msg="Subversion API not found. Subversion API libraries cannot |
---|
197 | be found. Make sure the APIs are installed and supply the |
---|
198 | appropriate --with-svn option to 'configure'." |
---|
199 | if (test "$apr_found" = "no") ; then |
---|
200 | svn_msg="$svn_msg |
---|
201 | Note, APR was not found. Failure to locate APR affects the search |
---|
202 | of the subversion API. Please fix the APR problem before trying |
---|
203 | to resolve the subversion related issues." |
---|
204 | fi |
---|
205 | AC_MSG_WARN([$svn_msg]) |
---|
206 | all_reqs_ok="false" |
---|
207 | fi |
---|
208 | |
---|
209 | if test $ac_cv_c_long_long = no; then |
---|
210 | AC_MSG_WARN([Compiler $CXX does not support `long long'. |
---|
211 | svndigest must be compiled with a compiler that supports `long long'.]) |
---|
212 | all_reqs_ok="false" |
---|
213 | fi |
---|
214 | |
---|
215 | if (test "$all_reqs_ok" = "false") ; then |
---|
216 | AC_MSG_ERROR([Some pre-requisites were not fulfilled, aborting |
---|
217 | configure. Please consult the 'INSTALL' file for more information |
---|
218 | about what is needed to compile svndigest and refer to above |
---|
219 | warning messages. Needed files were NOT created.]) |
---|
220 | fi |
---|
221 | |
---|
222 | # Create output. |
---|
223 | AC_OUTPUT |
---|
224 | |
---|
225 | # Some more messages. |
---|
226 | AC_MSG_NOTICE([]) |
---|
227 | AC_MSG_NOTICE([ Ready to compile the executables of svndigest $VERSION]) |
---|
228 | AC_MSG_NOTICE([ The following flags and libs will be used:]) |
---|
229 | AC_MSG_NOTICE([ +++++++++++++++++++++++++++++++++++++++++++++++]) |
---|
230 | AC_MSG_NOTICE([ Compiler: CXX=\"$CXX\"]) |
---|
231 | AC_MSG_NOTICE([ Preprocessor flags: CPPFLAGS=\"$CPPFLAGS\"]) |
---|
232 | AC_MSG_NOTICE([ C++ flags: CXXFLAGS=\"$CXXFLAGS\"]) |
---|
233 | AC_MSG_NOTICE([ Linker flags: LDFLAGS=\"$LDFLAGS\"]) |
---|
234 | AC_MSG_NOTICE([ LIBS: LIBS=\"$LIBS\"]) |
---|
235 | AC_MSG_NOTICE([ +++++++++++++++++++++++++++++++++++++++++++++++]) |
---|
236 | AC_MSG_NOTICE([]) |
---|
237 | |
---|
238 | # Failure to locate gnuplot is not considered fatal |
---|
239 | if (test "$GNUPLOT" != "ok") ; then |
---|
240 | AC_MSG_WARN([Gnuplot was not found. svndigest will compile |
---|
241 | without gnuplot but will throw an exception at run-time. Please |
---|
242 | install gnuplot (available for a wide range of operating systems |
---|
243 | at http://www.gnuplot.info).]) |
---|
244 | AC_MSG_NOTICE([]) |
---|
245 | fi |
---|
246 | |
---|
247 | if test "$enable_staticbin" = "yes"; then |
---|
248 | AC_MSG_NOTICE([A statically linked 'svndigest' binary will be created.]) |
---|
249 | else |
---|
250 | AC_MSG_NOTICE([A dynamically linked 'svndigest' binary will be created.]) |
---|
251 | fi |
---|
252 | AC_MSG_NOTICE([]) |
---|
253 | |
---|
254 | AC_MSG_NOTICE([Now type 'make ; make check'.]) |
---|
255 | |
---|