source: trunk/configure.ac @ 570

Last change on this file since 570 was 569, checked in by Peter Johansson, 13 years ago

NOTE: may cause file name clash. Adding file
subversion_info.h'. Previously make' generated this file, and thus
you may experience a file name clash. Please remove subversion_info.h
prior updating.

Moved implementation of subversion_info to source file in order to
avoid re-compilations not needed. Using script move-if-change to
create source file.

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