source: trunk/configure.ac @ 540

Last change on this file since 540 was 540, checked in by Peter Johansson, 14 years ago

fixes automatic update of revision and copyright year in --version output. Options --version and --verbose can no be combined to get a slightly more detailed description.

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