1 | ## Process this file with autoconf to produce a configure script. |
---|
2 | ## |
---|
3 | ## $Id: configure.ac 892 2009-11-26 05:56:47Z 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, 2009 Jari Häkkinen, Peter Johansson |
---|
15 | # |
---|
16 | # This file is part of svndigest, http://dev.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 3 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 svndigest. If not, see <http://www.gnu.org/licenses/>. |
---|
30 | |
---|
31 | AC_PREREQ(2.61) |
---|
32 | |
---|
33 | m4_include([m4/version.m4]) |
---|
34 | AC_INIT([svndigest],[SVNDIGEST_VERSION],[jari@thep.lu.se],, |
---|
35 | [http://dev.thep.lu.se/svndigest]) |
---|
36 | AC_CONFIG_SRCDIR([lib/File.h]) |
---|
37 | AC_CONFIG_AUX_DIR([autotools]) |
---|
38 | dnl arg below should be the same as in Makefile.am |
---|
39 | AC_CONFIG_MACRO_DIR([m4]) |
---|
40 | AC_PREFIX_DEFAULT([/usr/local]) |
---|
41 | |
---|
42 | dnl FIXME remove when we assume autoconf 2.64 |
---|
43 | m4_ifndef([AC_PACKAGE_URL], |
---|
44 | [AC_DEFINE([PACKAGE_URL], ["http://dev.thep.lu.se/svndigest"], |
---|
45 | [Define to home page for this package])]) |
---|
46 | |
---|
47 | AC_SUBST([SVNDIGEST_MAJOR_VERSION], [MAJOR_VERSION]) |
---|
48 | AC_SUBST([SVNDIGEST_MINOR_VERSION], [MINOR_VERSION]) |
---|
49 | AC_SUBST([SVNDIGEST_PATCH_VERSION], [PATCH_VERSION]) |
---|
50 | |
---|
51 | AC_DEFINE([DEV_BUILD],[SVNDIGEST_DEV_BUILD], |
---|
52 | [true if dev build (version ends with pre)]) |
---|
53 | AC_DEFINE([SVNDIGEST_MAJOR_VERSION], [MAJOR_VERSION], |
---|
54 | [Define to the svndigest major version]) |
---|
55 | AC_DEFINE([SVNDIGEST_MINOR_VERSION], [MINOR_VERSION], |
---|
56 | [Define to the svndigest minor version]) |
---|
57 | AC_DEFINE([SVNDIGEST_PATCH_VERSION], [PATCH_VERSION], |
---|
58 | [Define to the svndigest patch version]) |
---|
59 | |
---|
60 | AC_CONFIG_HEADER([config.h]) |
---|
61 | AM_INIT_AUTOMAKE([1.10 std-options]) |
---|
62 | |
---|
63 | # Set default programming language |
---|
64 | AC_LANG([C++]) |
---|
65 | |
---|
66 | # propagate selected configure variables to DISTCHECK_CONFIGURE_FLAGS |
---|
67 | for var in CPPFLAGS CXX CXXFLAGS CXXCPP LDFLAGS LIBS; do |
---|
68 | eval isset=\${$var+set} |
---|
69 | if test "$isset" = 'set' ; then |
---|
70 | eval val=$`echo $var` |
---|
71 | DISTCHECK_CONFIGURE_FLAGS="${DISTCHECK_CONFIGURE_FLAGS}'${var}=${val}' " |
---|
72 | fi |
---|
73 | done |
---|
74 | AC_SUBST(DISTCHECK_CONFIGURE_FLAGS) |
---|
75 | |
---|
76 | # Let user overide default CXXFLAGS |
---|
77 | if test "${CXXFLAGS+set}" != set; then |
---|
78 | CXXFLAGS="" # Setting CXXFLAGS here to prevent expansion in AC_PROG_CXX |
---|
79 | fi |
---|
80 | |
---|
81 | # Checks for programs. |
---|
82 | AC_PROG_CXXCPP |
---|
83 | AC_PROG_CXX |
---|
84 | AC_PROG_INSTALL |
---|
85 | AC_PROG_RANLIB |
---|
86 | AC_PROG_SED |
---|
87 | AC_PATH_PROG([HELP2MAN], [help2man], [no]) |
---|
88 | AM_CONDITIONAL([HAVE_HELP2MAN], [test x$HELP2MAN != xno]) |
---|
89 | # look for pkg-config |
---|
90 | PKG_PROG_PKG_CONFIG([0.23]) |
---|
91 | |
---|
92 | # Save FLAGS |
---|
93 | APR_SAVE_THE_ENVIRONMENT(CPPFLAGS) |
---|
94 | APR_SAVE_THE_ENVIRONMENT(CXXFLAGS) |
---|
95 | |
---|
96 | # -Wno-long-long is needed to suppress compiler diagnostics regarding |
---|
97 | # using extension beyond the C++ standard (usage of non C++ standard |
---|
98 | # 'long long' types). |
---|
99 | YAT_CXX_ADD_FLAG([CXXFLAGS],[-pedantic -Wno-long-long]) |
---|
100 | AC_TYPE_LONG_LONG_INT |
---|
101 | AS_IF([test x$ac_cv_type_long_long_int = xno], |
---|
102 | [AC_MSG_ERROR([compiler does not support long long int])] |
---|
103 | ) |
---|
104 | |
---|
105 | AC_ARG_ENABLE([debug], |
---|
106 | [AS_HELP_STRING([--enable-debug],[turn on debug options and code])]) |
---|
107 | |
---|
108 | AS_IF([test x$enable_debug = xyes], |
---|
109 | [YAT_CXX_ADD_FLAG([CXXFLAGS],[-g -O])], |
---|
110 | [YAT_CPP_ADD_FLAG([CPPFLAGS],[-DNDEBUG]) |
---|
111 | YAT_CXX_ADD_FLAG([CXXFLAGS],[-O3])]) |
---|
112 | |
---|
113 | # Apache Portable Runtime (APR) API checks |
---|
114 | APR_FIND_APR(,,[1],[1 0]) |
---|
115 | AS_IF([test "${with_apr+set}" = set], |
---|
116 | [DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS --with-apr=$with_apr"] |
---|
117 | ) |
---|
118 | if test "$apr_found" = "yes" ; then |
---|
119 | APR_LIBS="`$apr_config --libs`" |
---|
120 | apr_link_ld="`$apr_config --link-ld`" |
---|
121 | for i in $apr_link_ld; do |
---|
122 | AS_IF([test ${i:0:2} = "-l"],[APR_LIBS="$i $APR_LIBS"], |
---|
123 | [YAT_LD_ADD_FLAG([APR_LDFLAGS], [$i])]) |
---|
124 | done |
---|
125 | YAT_CPP_ADD_FLAG([APR_CPPFLAGS],[`$apr_config --includes --cppflags`]) |
---|
126 | save_CPPFLAGS=$CPPFLAGS |
---|
127 | CPPFLAGS="$APR_CPPFLAGS $CPPFLAGS" |
---|
128 | AC_CHECK_HEADER([apr_allocator.h],,[apr_found="no"]) |
---|
129 | CPPFLAGS=$save_CPPFLAGS |
---|
130 | fi |
---|
131 | AC_SUBST([APR_CPPFLAGS]) |
---|
132 | AC_SUBST([APR_LDFLAGS]) |
---|
133 | AC_SUBST([APR_LIBS]) |
---|
134 | |
---|
135 | # Subversion API checks |
---|
136 | svn_found="yes" |
---|
137 | AC_ARG_WITH([svn], |
---|
138 | [AS_HELP_STRING([--with-svn=DIR],[prefix for svn developer files [[PREFIX]]])], |
---|
139 | [ DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS --with-svn=$withval" |
---|
140 | YAT_LD_ADD_FLAG([SVN_LDFLAGS], [-L$withval/lib]) |
---|
141 | YAT_CPP_ADD_FLAG([SVN_CPPFLAGS], [-I$withval/include]) |
---|
142 | ]) |
---|
143 | # svn needs needs apr headers |
---|
144 | save_CPPFLAGS=$CPPFLAGS |
---|
145 | CPPFLAGS="$APR_CPPFLAGS $SVN_CPPFLAGS $CPPFLAGS" |
---|
146 | AC_CHECK_HEADER([subversion-1/svn_types.h],,[svn_found="no"]) |
---|
147 | CPPFLAGS=$save_CPPFLAGS |
---|
148 | |
---|
149 | save_LDFLAGS=$LDFLAGS |
---|
150 | save_LIBS=$LIBS |
---|
151 | tmp_LIBS="$APR_LIBS $save_LIBS" |
---|
152 | LIBS="" |
---|
153 | LDFLAGS="$SVN_LDFLAGS $APR_LDFLAGS" |
---|
154 | AC_SEARCH_LIBS([svn_cmdline_setup_auth_baton],[svn_subr-1], |
---|
155 | [], [svn_found="no"], [$tmp_LIBS]) |
---|
156 | AC_SEARCH_LIBS([svn_ra_initialize],[svn_ra-1], [], [svn_found="no"],[$tmp_LIBS]) |
---|
157 | AC_SEARCH_LIBS([svn_wc_adm_open3],[svn_wc-1], [], [svn_found="no"], [$tmp_LIBS]) |
---|
158 | AC_SEARCH_LIBS([svn_diff_file_options_create],[svn_diff-1],[], |
---|
159 | [svn_found="no"], [$tmp_LIBS]) |
---|
160 | AC_SEARCH_LIBS([svn_client_log3],[svn_client-1],,[svn_found="no"], [$tmp_LIBS]) |
---|
161 | SVN_LIBS=$LIBS |
---|
162 | LIBS=$save_LIBS |
---|
163 | LDFLAGS=$save_LDFLAGS |
---|
164 | AC_SUBST([SVN_CPPFLAGS]) |
---|
165 | AC_SUBST([SVN_LDFLAGS]) |
---|
166 | AC_SUBST([SVN_LIBS]) |
---|
167 | |
---|
168 | |
---|
169 | # check if svnversion is installed |
---|
170 | AC_PATH_PROG([SVNVERSION], [svnversion], [no]) |
---|
171 | |
---|
172 | # PLplot API checks |
---|
173 | plplot_found="yes" |
---|
174 | plplot_version=5.9 |
---|
175 | save_PKG_CONFIG_PATH=$PKG_CONFIG_PATH |
---|
176 | AC_ARG_WITH([plplot], |
---|
177 | [AS_HELP_STRING([--with-plplot=DIR],[prefix for plplot developer files])], |
---|
178 | [DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS --with-plplot=$withval" |
---|
179 | PKG_CONFIG_PATH=${withval}/lib/pkgconfig${PATH_SEPARATOR}${PKG_CONFIG_PATH} |
---|
180 | export PKG_CONFIG_PATH |
---|
181 | ]) |
---|
182 | |
---|
183 | # copy flags if pkg-config finds plplot |
---|
184 | PKG_CHECK_EXISTS([plplotd-c++], [ |
---|
185 | YAT_CPP_ADD_FLAG([PLPLOT_CPPFLAGS], [`$PKG_CONFIG plplotd-c++ --cflags`]) |
---|
186 | YAT_LD_ADD_FLAG([PLPLOT_LDFLAGS], [`$PKG_CONFIG plplotd-c++ --libs-only-L`]) |
---|
187 | PLPLOT_LIBS="`$PKG_CONFIG plplotd-c++ --libs-only-l --libs-only-other`" |
---|
188 | ],[ |
---|
189 | plplot_found=no-pkg-config |
---|
190 | ]) |
---|
191 | |
---|
192 | AS_IF([test "x$plplot_found" = "xyes"], [ |
---|
193 | save_CPPFLAGS=$CPPFLAGS |
---|
194 | CPPFLAGS="$PLPLOT_CPPFLAGS $CPPFLAGS" |
---|
195 | AC_CHECK_HEADER([plplot/plstream.h], [], [plplot_found="noheader"]) |
---|
196 | CPPFLAGS=$save_CPPFLAGS |
---|
197 | ]) |
---|
198 | |
---|
199 | AS_IF([test "x$plplot_found" = "xyes"], [ |
---|
200 | AS_IF([$PKG_CONFIG --atleast-version=$plplot_version plplotd-c++], [],[ |
---|
201 | plplot_found="nolib" |
---|
202 | ]) |
---|
203 | ]) |
---|
204 | # restore variable |
---|
205 | export PKG_CONFIG_PATH=$save_PKG_CONFIG_PATH |
---|
206 | AC_SUBST(PLPLOT_CPPFLAGS) |
---|
207 | AC_SUBST(PLPLOT_LDFLAGS) |
---|
208 | AC_SUBST(PLPLOT_LIBS) |
---|
209 | |
---|
210 | # checking if we build in a subversion WC |
---|
211 | AS_IF([test -d $srcdir/.svn], [wc_found="yes"], [wc_found="no"]) |
---|
212 | AM_CONDITIONAL([HAVE_SVN_WC], [test "$wc_found" = "yes"]) |
---|
213 | AC_SUBST([wc_found]) |
---|
214 | |
---|
215 | # Reset FLAGS |
---|
216 | APR_RESTORE_THE_ENVIRONMENT([CPPFLAGS], [DEFAULT_]) |
---|
217 | APR_RESTORE_THE_ENVIRONMENT([CXXFLAGS], [DEFAULT_]) |
---|
218 | |
---|
219 | # checking if we have test repo |
---|
220 | test_repo_filename=$srcdir/test/repo; |
---|
221 | AS_IF([test -r $test_repo_filename], |
---|
222 | [AC_DEFINE([HAVE_TEST_REPO],[1],[define if test repo is available]) |
---|
223 | test_repo_found="yes"], |
---|
224 | [test_repo_found="no"]) |
---|
225 | AC_SUBST([test_repo_found]) |
---|
226 | AS_IF([test "x$test_repo_found" = xyes], |
---|
227 | [abs_test_repo=`cd $test_repo_filename && pwd`; |
---|
228 | AC_SUBST(abs_test_repo)] |
---|
229 | ) |
---|
230 | AC_CONFIG_FILES([test/test_repo.sh], [chmod +x test/test_repo.sh]) |
---|
231 | AC_CONFIG_FILES([test/svn_update.sh], [chmod +x test/svn_update.sh]) |
---|
232 | AC_CONFIG_FILES([test/check_repo_status.sh], |
---|
233 | [chmod +x test/check_repo_status.sh]) |
---|
234 | |
---|
235 | dnl maintainer make rukes from yat project |
---|
236 | YAT_SVN_RELEASE |
---|
237 | |
---|
238 | AC_CONFIG_FILES([Makefile |
---|
239 | bin/Makefile |
---|
240 | lib/Makefile |
---|
241 | lib/yat/Makefile |
---|
242 | man/Makefile |
---|
243 | test/environment.h |
---|
244 | test/Makefile]) |
---|
245 | |
---|
246 | AC_CONFIG_HEADER([lib/yat/config_public.h]) |
---|
247 | |
---|
248 | # Print failure status information about selected items, and exit if |
---|
249 | # fatal errors were encountered. No output will be created if |
---|
250 | # configure is halted prematurely. |
---|
251 | |
---|
252 | # used to trigger exit before creation of output |
---|
253 | all_reqs_ok="true" |
---|
254 | |
---|
255 | if (test "$wc_found" = "yes"); then |
---|
256 | if test x$HELP2MAN = xno; then |
---|
257 | AC_MSG_WARN(m4_text_wrap(m4_normalize([ |
---|
258 | `help2man' is missing on your system. You will not be |
---|
259 | able to create the man page. A sound man page should be |
---|
260 | included in a distribution, and since you will not able |
---|
261 | to create a complete distribution `make dist' will fail. |
---|
262 | ]),[ ], |
---|
263 | [ ], 79)) |
---|
264 | fi |
---|
265 | # svnversion is required when building from svn wc |
---|
266 | if (test "$svnversion" = "no"); then |
---|
267 | all_reqs_ok="false"; |
---|
268 | AC_MSG_WARN([dnl |
---|
269 | Cannot find svnversion, which is required when building from a |
---|
270 | subversion working copy. Please install svnversion and make sure it is |
---|
271 | in your search path.]); |
---|
272 | fi |
---|
273 | if (test "$test_repo_found" = "no"); then |
---|
274 | all_reqs_ok="false"; |
---|
275 | AC_MSG_WARN([dnl |
---|
276 | Cannot find test repository (test_repo_filename), which should be |
---|
277 | available when building from a subversion working copy. Try svn |
---|
278 | update in top directory.]); |
---|
279 | fi |
---|
280 | fi |
---|
281 | |
---|
282 | # Non-existing APR is fatal -- sub-sequent compilation will fail. |
---|
283 | if (test "$apr_found" = "no") ; then |
---|
284 | AC_MSG_WARN([APR not found. The Apache Portable Runtime |
---|
285 | (APR) library cannot be found. Please make sure APR is installed |
---|
286 | and supply the appropriate --with-apr option to 'configure'.]) |
---|
287 | all_reqs_ok="false" |
---|
288 | fi |
---|
289 | |
---|
290 | # Non-existing subversion API is fatal -- sub-sequent compilation will fail. |
---|
291 | if (test "$svn_found" = "no") ; then |
---|
292 | svn_msg="Subversion API not found. Subversion API libraries cannot |
---|
293 | be found. Make sure the APIs are installed and supply the |
---|
294 | appropriate --with-svn option to 'configure'." |
---|
295 | if (test "$apr_found" = "no") ; then |
---|
296 | svn_msg="$svn_msg |
---|
297 | Note, APR was not found. Failure to locate APR affects the search |
---|
298 | of the subversion API. Please fix the APR problem before trying |
---|
299 | to resolve the subversion related issues." |
---|
300 | fi |
---|
301 | AC_MSG_WARN([$svn_msg]) |
---|
302 | all_reqs_ok="false" |
---|
303 | fi |
---|
304 | |
---|
305 | # Non-existing PLplot API is fatal -- sub-sequent compilation will fail. |
---|
306 | if (test "$plplot_found" = "noheader") ; then |
---|
307 | AC_MSG_WARN([PLplot developer files cannot be found. Make sure PLplot |
---|
308 | is installed.]) |
---|
309 | all_reqs_ok="false" |
---|
310 | elif (test "$plplot_found" = "nolib") ; then |
---|
311 | AC_MSG_WARN([PLplot developer files found but not required API version. |
---|
312 | Version at least $plplot_version is required. Please upgrade PLplot.]) |
---|
313 | all_reqs_ok="false" |
---|
314 | elif (test "$plplot_found" = "no-pkg-config") ; then |
---|
315 | AC_MSG_WARN([cannot find pkg-config]) |
---|
316 | all_reqs_ok="false" |
---|
317 | fi |
---|
318 | |
---|
319 | if test $ac_cv_type_long_long_int != yes ; then |
---|
320 | AC_MSG_WARN([Compiler $CXX does not support `long long'. |
---|
321 | svndigest must be compiled with a compiler that supports `long long'.]) |
---|
322 | all_reqs_ok="false" |
---|
323 | fi |
---|
324 | |
---|
325 | if (test "$all_reqs_ok" = "false") ; then |
---|
326 | AC_MSG_ERROR([Some pre-requisites were not fulfilled, aborting |
---|
327 | configure. Please consult the 'README' file for more information |
---|
328 | about what is needed to compile svndigest and refer to above |
---|
329 | warning messages. Needed files were NOT created.]) |
---|
330 | fi |
---|
331 | |
---|
332 | # Create output. |
---|
333 | AC_OUTPUT |
---|
334 | |
---|
335 | # Some more messages. |
---|
336 | AC_MSG_NOTICE([ |
---|
337 | Ready to compile the executables of svndigest $VERSION |
---|
338 | The following flags and libs will be used: |
---|
339 | +++++++++++++++++++++++++++++++++++++++++++++++ |
---|
340 | Compiler: $CXX |
---|
341 | Preprocessor flags: $SD_CPPFLAGS $CPPFLAGS |
---|
342 | CPPFLAGS: $CPPFLAGS |
---|
343 | DEFAULT_CPPFLAGS: $DEFAULT_CPPFLAGS |
---|
344 | APR_CPPFLAGS: $APR_CPPFLAGS |
---|
345 | SVN_CPPFLAGS: $SVN_CPPFLAGS |
---|
346 | PLPLOT_CPPFLAGS: $PLPLOT_CPPFLAGS |
---|
347 | C++ flags: |
---|
348 | CXXFLAGS: $CXXFLAGS |
---|
349 | DEFAULT_CXXFLAGS: $DEFAULT_CXXFLAGS |
---|
350 | Linker flags: |
---|
351 | LDFLAGS: $LDFLAGS |
---|
352 | APR_LDFLAGS: $APR_LDFLAGS |
---|
353 | SVN_LDFLAGS: $SVN_LDFLAGS |
---|
354 | PLPLOT_LDFLAGS: $PLPLOT_LDFLAGS |
---|
355 | Libraries: |
---|
356 | LIBS $LIBS |
---|
357 | APR_LIBS $APR_LIBS |
---|
358 | SVN_LIBS $SVN_LIBS |
---|
359 | PLPLOT_LIBS $PLPLOT_LIBS |
---|
360 | +++++++++++++++++++++++++++++++++++++++++++++++]dnl |
---|
361 | ) |
---|
362 | |
---|
363 | AC_MSG_NOTICE([Now type 'make all check'.]) |
---|