source: trunk/configure.ac @ 547

Last change on this file since 547 was 547, checked in by Peter Johansson, 16 years ago

removed configure option wctests - now detected automatically. Also parsing version number and setting variables MAJOR, MINOR, PATCH, and DEV_BUILD

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