source: trunk/configure.ac @ 911

Last change on this file since 911 was 911, checked in by Peter Johansson, 12 years ago

refs #380. Changing permission mode to 'rw' for user to avoid problem. Hope this fixes the problem with 'cannot open svndigest-copy-cache.in'. You need to chmod or remove the file in question before bootstrapping.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 15.0 KB
RevLine 
[84]1## Process this file with autoconf to produce a configure script.
2##
3## $Id: configure.ac 911 2009-11-29 23:30:57Z peter $
4##
5## If you grabbed the source from subversion you should, at top-level,
6## execute:
7##          ./bootstrap
[480]8## To push subsequent changes of this file into the build scripts you
9## must issue:
10##          autoreconf
[84]11
[408]12# Copyright (C) 2005 Jari Häkkinen, Peter Johansson
13# Copyright (C) 2006 Jari Häkkinen
[847]14# Copyright (C) 2007, 2008, 2009 Jari Häkkinen, Peter Johansson
[2]15#
[687]16# This file is part of svndigest, http://dev.thep.lu.se/svndigest
[2]17#
[149]18# svndigest is free software; you can redistribute it and/or modify it
[84]19# under the terms of the GNU General Public License as published by
[693]20# the Free Software Foundation; either version 3 of the License, or
[84]21# (at your option) any later version.
[2]22#
[149]23# svndigest is distributed in the hope that it will be useful, but
[84]24# WITHOUT ANY WARRANTY; without even the implied warranty of
[149]25# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
[84]26# General Public License for more details.
[2]27#
[84]28# You should have received a copy of the GNU General Public License
[693]29# along with svndigest. If not, see <http://www.gnu.org/licenses/>.
[2]30
[907]31AC_PREREQ([2.63])
[547]32
[775]33m4_include([m4/version.m4])
[910]34AC_INIT([svndigest], m4_defn([SVNDIGEST_VERSION]),[jari@thep.lu.se],,
[819]35        [http://dev.thep.lu.se/svndigest])
[5]36AC_CONFIG_SRCDIR([lib/File.h])
[2]37AC_CONFIG_AUX_DIR([autotools])
[720]38dnl arg below should be the same as in Makefile.am
[775]39AC_CONFIG_MACRO_DIR([m4])
[2]40AC_PREFIX_DEFAULT([/usr/local])
41
[892]42dnl FIXME remove when we assume autoconf 2.64
43m4_ifndef([AC_PACKAGE_URL],
44          [AC_DEFINE([PACKAGE_URL], ["http://dev.thep.lu.se/svndigest"],
[907]45                     [Define to home page for this package])
46           AC_SUBST([PACKAGE_URL], ["http://dev.thep.lu.se/svndigest"])])
[892]47
[909]48# propagate RELEASE_YEAR from file .release_year
49RELEASE_YEAR=`cat $srcdir/.release_year`
50AC_SUBST([RELEASE_YEAR])
51AC_DEFINE_UNQUOTED([RELEASE_YEAR], ["$RELEASE_YEAR"],
52                   [Define year package was last modified])
53AC_SUBST([CONFIG_STATUS_DEPENDENCIES], ['$(top_srcdir)/.release_year'])
54
[585]55AC_SUBST([SVNDIGEST_MAJOR_VERSION], [MAJOR_VERSION])
56AC_SUBST([SVNDIGEST_MINOR_VERSION], [MINOR_VERSION])
57AC_SUBST([SVNDIGEST_PATCH_VERSION], [PATCH_VERSION])
58
59AC_DEFINE([DEV_BUILD],[SVNDIGEST_DEV_BUILD],
[723]60          [true if dev build (version ends with pre)])
[675]61AC_DEFINE([SVNDIGEST_MAJOR_VERSION], [MAJOR_VERSION],
[585]62                    [Define to the svndigest major version])
[675]63AC_DEFINE([SVNDIGEST_MINOR_VERSION], [MINOR_VERSION],
[585]64                    [Define to the svndigest minor version])
[675]65AC_DEFINE([SVNDIGEST_PATCH_VERSION], [PATCH_VERSION],
[585]66                    [Define to the svndigest patch version])
67
[568]68AC_CONFIG_HEADER([config.h])
[874]69AM_INIT_AUTOMAKE([1.10 std-options])
[2]70
[907]71dnl create bin/svndigest-copy-cache.in at autoconf time and let
72dnl config.status create bin/svndigest-copy-cache from
73dnl bin/svndigest-copy-cache.in
74m4_pushdef([FILE], [svndigest-copy-cache])
[911]75m4_pushdef([my_m4sh_options], [-m 0644])
[907]76dnl me cd down in bin to have same output as when created from Makefile
77m4_syscmd([cd bin && autom4te -l M4sh -o ]FILE[.in ]my_m4sh_options FILE[.as])
78AC_CONFIG_FILES([bin/]FILE[], [chmod +x bin/]FILE[ && chmod a-w bin/]FILE[])
79dnl export options so we can use the same in Makefile
80AC_SUBST([M4SH_OPTIONS], ['my_m4sh_options'])
81m4_popdef([my_m4sh_options])
82m4_popdef([FILE])
83AM_MISSING_PROG([AUTOM4TE], [autom4te])
84
[480]85# Set default programming language
[880]86AC_LANG([C++])
[480]87
[741]88# propagate selected configure variables to DISTCHECK_CONFIGURE_FLAGS
89for var in CPPFLAGS CXX CXXFLAGS CXXCPP LDFLAGS LIBS; do
90  eval isset=\${$var+set}
91  if test "$isset" = 'set' ; then
92    eval val=$`echo $var`
93    DISTCHECK_CONFIGURE_FLAGS="${DISTCHECK_CONFIGURE_FLAGS}'${var}=${val}' "
94  fi
95done
96AC_SUBST(DISTCHECK_CONFIGURE_FLAGS)
97
[564]98# Let user overide default CXXFLAGS
99if test "${CXXFLAGS+set}" != set; then
100  CXXFLAGS=""  # Setting CXXFLAGS here to prevent expansion in AC_PROG_CXX
101fi
[687]102
[2]103# Checks for programs.
[566]104AC_PROG_CXXCPP
[2]105AC_PROG_CXX
106AC_PROG_INSTALL
[668]107AC_PROG_RANLIB
[586]108AC_PROG_SED
[732]109AC_PATH_PROG([HELP2MAN], [help2man], [no])
[742]110AM_CONDITIONAL([HAVE_HELP2MAN], [test x$HELP2MAN != xno])
[880]111# look for pkg-config
112PKG_PROG_PKG_CONFIG([0.23])
[2]113
[640]114# Save FLAGS
[887]115APR_SAVE_THE_ENVIRONMENT(CPPFLAGS)
116APR_SAVE_THE_ENVIRONMENT(CXXFLAGS)
[640]117
[138]118# -Wno-long-long is needed to suppress compiler diagnostics regarding
119# using extension beyond the C++ standard (usage of non C++ standard
120# 'long long' types).
[887]121YAT_CXX_ADD_FLAG([CXXFLAGS],[-pedantic -Wno-long-long])
[769]122AC_TYPE_LONG_LONG_INT
[782]123AS_IF([test x$ac_cv_type_long_long_int = xno],
124      [AC_MSG_ERROR([compiler does not support long long int])]
125     )
[2]126
[782]127AC_ARG_ENABLE([debug],
[843]128  [AS_HELP_STRING([--enable-debug],[turn on debug options and code])])
129
130AS_IF([test x$enable_debug = xyes],
[887]131  [YAT_CXX_ADD_FLAG([CXXFLAGS],[-g -O])],
132  [YAT_CPP_ADD_FLAG([CPPFLAGS],[-DNDEBUG])
133   YAT_CXX_ADD_FLAG([CXXFLAGS],[-O3])])
[160]134
[164]135# Apache Portable Runtime (APR) API checks
[887]136APR_FIND_APR(,,[1],[1 0])
[773]137AS_IF([test "${with_apr+set}" = set],
138    [DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS --with-apr=$with_apr"]
139)
[164]140if test "$apr_found" = "yes" ; then
[887]141    APR_LIBS="`$apr_config --libs`"
142    apr_link_ld="`$apr_config --link-ld`"
[774]143    for i in $apr_link_ld; do
[887]144      AS_IF([test ${i:0:2} = "-l"],[APR_LIBS="$i $APR_LIBS"],
145            [YAT_LD_ADD_FLAG([APR_LDFLAGS], [$i])])
[774]146    done
[887]147    YAT_CPP_ADD_FLAG([APR_CPPFLAGS],[`$apr_config --includes --cppflags`])
148    save_CPPFLAGS=$CPPFLAGS
149    CPPFLAGS="$APR_CPPFLAGS $CPPFLAGS"
150    AC_CHECK_HEADER([apr_allocator.h],,[apr_found="no"])
151    CPPFLAGS=$save_CPPFLAGS
[164]152fi
[887]153AC_SUBST([APR_CPPFLAGS])
154AC_SUBST([APR_LDFLAGS])
155AC_SUBST([APR_LIBS])
[96]156
[164]157# Subversion API checks
158svn_found="yes"
[887]159AC_ARG_WITH([svn],
[172]160  [AS_HELP_STRING([--with-svn=DIR],[prefix for svn developer files [[PREFIX]]])],
[905]161  [ AS_CASE([$withval], [yes|no],
162            [AC_MSG_ERROR([--with-svn requires a directory to be provided])])
163    DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS --with-svn=$withval"
[887]164    YAT_LD_ADD_FLAG([SVN_LDFLAGS], [-L$withval/lib])
165    YAT_CPP_ADD_FLAG([SVN_CPPFLAGS], [-I$withval/include])
[774]166  ])
[887]167# svn needs needs apr headers
168save_CPPFLAGS=$CPPFLAGS
169CPPFLAGS="$APR_CPPFLAGS $SVN_CPPFLAGS $CPPFLAGS"
170AC_CHECK_HEADER([subversion-1/svn_types.h],,[svn_found="no"])
171CPPFLAGS=$save_CPPFLAGS
[640]172
[887]173save_LDFLAGS=$LDFLAGS
174save_LIBS=$LIBS
175tmp_LIBS="$APR_LIBS $save_LIBS"
176LIBS=""
177LDFLAGS="$SVN_LDFLAGS $APR_LDFLAGS"
[640]178AC_SEARCH_LIBS([svn_cmdline_setup_auth_baton],[svn_subr-1],
[887]179               [], [svn_found="no"], [$tmp_LIBS])
180AC_SEARCH_LIBS([svn_ra_initialize],[svn_ra-1], [], [svn_found="no"],[$tmp_LIBS])
181AC_SEARCH_LIBS([svn_wc_adm_open3],[svn_wc-1], [], [svn_found="no"], [$tmp_LIBS])
182AC_SEARCH_LIBS([svn_diff_file_options_create],[svn_diff-1],[],
183               [svn_found="no"], [$tmp_LIBS])
184AC_SEARCH_LIBS([svn_client_log3],[svn_client-1],,[svn_found="no"], [$tmp_LIBS])
185SVN_LIBS=$LIBS
186LIBS=$save_LIBS
187LDFLAGS=$save_LDFLAGS
188AC_SUBST([SVN_CPPFLAGS])
189AC_SUBST([SVN_LDFLAGS])
190AC_SUBST([SVN_LIBS])
[96]191
[540]192
193# check if svnversion is installed
[690]194AC_PATH_PROG([SVNVERSION], [svnversion], [no])
[540]195
[858]196# PLplot API checks
[901]197# plplot_found can get values: skip, noheader, old, or nolib if an
198# error is detected.
[858]199plplot_found="yes"
200plplot_version=5.9
[888]201save_PKG_CONFIG_PATH=$PKG_CONFIG_PATH
202AC_ARG_WITH([plplot],
203  [AS_HELP_STRING([--with-plplot=DIR],[prefix for plplot developer files])],
204  [DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS --with-plplot=$withval"
[901]205   AS_IF([test "x$withval" = "xno"], [ dnl
206     plplot_found=skip;
207   ], [ dnl
208     # help pkg-config find .pc file
209     PKG_CONFIG_PATH=${withval}/lib/pkgconfig${PATH_SEPARATOR}${PKG_CONFIG_PATH}
210     export PKG_CONFIG_PATH
211   ])
[888]212  ])
[858]213
[901]214use_plplot_pc="no"
215AS_IF([test "x$plplot_found" = "xyes" && test -n "$PKG_CONFIG"], [
216  AC_MSG_CHECKING([for plplotd-c++.pc])
217  AS_IF([$PKG_CONFIG --exists plplotd-c++], [
218    AC_MSG_RESULT([yes])
219    use_plplot_pc="yes"
220  ],[
221    AC_MSG_RESULT([no])
222    AC_MSG_WARN([cannot find plplotd-c++;
223      please use --with-plplot with appropriate argument to get more accurate
224      configuration.])
225  ])
[888]226])
[901]227
228AS_IF([test "x$plplot_found" = "xyes"], [
229  # copy flags if we have found pc file
230  AS_IF([test "$use_plplot_pc" = "yes"], [
231    YAT_CPP_ADD_FLAG([PLPLOT_CPPFLAGS], [`$PKG_CONFIG plplotd-c++ --cflags`])
232    YAT_LD_ADD_FLAG([PLPLOT_LDFLAGS], [`$PKG_CONFIG plplotd-c++ --libs-only-L`])
233    PLPLOT_LIBS="`$PKG_CONFIG plplotd-c++ --libs-only-l --libs-only-other`"
234  ],[
235    # otherwise guess
236    PLPLOT_LIBS="-lplplotcxxd -lplplotd";
237    AS_IF([test -n "$with_plplot" && test "x$with_plplot" != "xyes"], [
238      YAT_CPP_ADD_FLAG([PLPLOT_CPPFLAGS], [$with_plplot/include])
239      YAT_LD_ADD_FLAG([PLPLOT_LDFLAGS], [$with_plplot/libs])
240    ])
241  ])
242])
[888]243                 
244AS_IF([test "x$plplot_found" = "xyes"], [
245  save_CPPFLAGS=$CPPFLAGS
246  CPPFLAGS="$PLPLOT_CPPFLAGS $CPPFLAGS"
247  AC_CHECK_HEADER([plplot/plstream.h], [], [plplot_found="noheader"])
248  CPPFLAGS=$save_CPPFLAGS
249])
250
[901]251
252AS_IF([test "x$plplot_found" = "xyes" && test -n "$PKG_CONFIG"], [
253  AC_MSG_CHECKING([plplot version >= $plplot_version])
254  AS_IF([$PKG_CONFIG --atleast-version=$plplot_version plplotd-c++], [
255    AC_MSG_RESULT([yes])
256  ],[
257    AC_MSG_RESULT([`$PKG_CONFIG --modversion= plplotd-c++`])
258    plplot_found="old"
[888]259  ])
260])
[901]261
[904]262AS_IF([test "x$plplot_found" = "xyes"], [
[901]263  save_LDFLAGS=$LDFLAGS
264  LDFLAGS="$PLPLOT_LDFLAGS $LDFLAGS"
265  save_LIBS=$LIBS
266  LIBS="$PLPLOT_LIBS $LIBS"
267  AC_MSG_CHECKING([for library containing plstream])
268  AC_LINK_IFELSE([AC_LANG_PROGRAM([@%:@include <plplot/plstream.h>],
269                                  [plstream pls(1,1,"svg", "conftest.svg")])],
270                 [AC_MSG_RESULT([yes]);
271                  AC_DEFINE([HAVE_PLPLOT], [1],
272                            [Define to 1 if you have plplot])],
273                 [AC_MSG_RESULT([no])
274                  plplot_found=nolib;])
275])
[888]276# restore variable
[901]277LDFLAGS=$save_LDFLAGS
278LIBS=$save_LIBS
[888]279export PKG_CONFIG_PATH=$save_PKG_CONFIG_PATH
280AC_SUBST(PLPLOT_CPPFLAGS)
281AC_SUBST(PLPLOT_LDFLAGS)
282AC_SUBST(PLPLOT_LIBS)
283
[614]284# checking if we build in a subversion WC
[835]285AS_IF([test -d $srcdir/.svn], [wc_found="yes"], [wc_found="no"])
[730]286AM_CONDITIONAL([HAVE_SVN_WC], [test "$wc_found" = "yes"])
[738]287AC_SUBST([wc_found])
[730]288
289# checking if we have test repo
290test_repo_filename=$srcdir/test/repo;
[835]291AS_IF([test -r $test_repo_filename],
[744]292              [AC_DEFINE([HAVE_TEST_REPO],[1],[define if test repo is available])
293               test_repo_found="yes"],
[730]294              [test_repo_found="no"])
[748]295AC_SUBST([test_repo_found])
[772]296AS_IF([test "x$test_repo_found" = xyes],
297      [abs_test_repo=`cd $test_repo_filename && pwd`;
298       AC_SUBST(abs_test_repo)]
299     )
300AC_CONFIG_FILES([test/test_repo.sh], [chmod +x test/test_repo.sh])
301AC_CONFIG_FILES([test/svn_update.sh], [chmod +x test/svn_update.sh])
302AC_CONFIG_FILES([test/check_repo_status.sh],
303                [chmod +x test/check_repo_status.sh])   
[540]304
[880]305dnl maintainer make rukes from yat project
[874]306YAT_SVN_RELEASE
[561]307
[901]308# Restore FLAGS
309APR_RESTORE_THE_ENVIRONMENT([CPPFLAGS], [DEFAULT_])
310APR_RESTORE_THE_ENVIRONMENT([CXXFLAGS], [DEFAULT_])
311
[2]312AC_CONFIG_FILES([Makefile
[21]313                bin/Makefile
314                lib/Makefile
[795]315                lib/yat/Makefile
[724]316                man/Makefile
[597]317                test/environment.h
[569]318                test/Makefile])
[2]319
[795]320AC_CONFIG_HEADER([lib/yat/config_public.h])
321
[164]322# Print failure status information about selected items, and exit if
323# fatal errors were encountered. No output will be created if
324# configure is halted prematurely.
[156]325
[164]326# used to trigger exit before creation of output
327all_reqs_ok="true"
[160]328
[730]329if (test "$wc_found" = "yes"); then
[742]330   if test x$HELP2MAN = xno; then
[740]331     AC_MSG_WARN(m4_text_wrap(m4_normalize([
332       `help2man' is missing on your system.  You will not be
333       able to create the man page. A sound man page should be
334       included in a distribution, and since you will not able
335       to create a complete distribution `make dist' will fail.
336       ]),[                   ],
337          [                             ], 79))
338   fi
[730]339   # svnversion is required when building from svn wc
340   if (test "$svnversion" = "no"); then
341      all_reqs_ok="false";
342      AC_MSG_WARN([dnl
343Cannot find svnversion, which is required when building from a
344subversion working copy. Please install svnversion and make sure it is
345in your search path.]);
346   fi
347   if (test "$test_repo_found" = "no"); then
348      all_reqs_ok="false";
349      AC_MSG_WARN([dnl
350Cannot find test repository (test_repo_filename), which should be
351available when building from a subversion working copy. Try svn
352update in top directory.]);
353   fi
[672]354fi
[540]355
[164]356# Non-existing APR is fatal -- sub-sequent compilation will fail.
357if (test "$apr_found" = "no") ; then
[670]358  AC_MSG_WARN([APR not found. The Apache Portable Runtime
359  (APR) library cannot be found. Please make sure APR is installed
360  and supply the appropriate --with-apr option to 'configure'.])
361  all_reqs_ok="false"
[164]362fi
[160]363
[164]364# Non-existing subversion API is fatal -- sub-sequent compilation will fail.
365if (test "$svn_found" = "no") ; then
[670]366  svn_msg="Subversion API not found. Subversion API libraries cannot
367  be found. Make sure the APIs are installed and supply the
368  appropriate --with-svn option to 'configure'."
369  if (test "$apr_found" = "no") ; then
[383]370    svn_msg="$svn_msg
[557]371    Note, APR was not found. Failure to locate APR affects the search
372    of the subversion API. Please fix the APR problem before trying
373    to resolve the subversion related issues."
[670]374  fi
375  AC_MSG_WARN([$svn_msg])
376  all_reqs_ok="false"
[383]377fi
[162]378
[858]379# Non-existing PLplot API is fatal -- sub-sequent compilation will fail.
[901]380AS_CASE([$plplot],
381  [noheader],
382    [AC_MSG_WARN([
383    PLplot developer files cannot be found. Make sure PLplot is installed.])
384    all_reqs_ok="false"],
385  [old],
386    [AC_MSG_WARN([
387    PLplot developer files found but not required API version.
388    Version at least $plplot_version is required. Please upgrade PLplot.])
389    all_reqs_ok="false"],
390  [nolib],
391    [AC_MSG_WARN([
392    PLplot developer files found but linking against plplot library failed.])
393    all_reqs_ok="false"])
[858]394
[567]395if test $ac_cv_type_long_long_int != yes ; then
[670]396  AC_MSG_WARN([Compiler $CXX does not support `long long'.
397  svndigest must be compiled with a compiler that supports `long long'.])
398  all_reqs_ok="false"
[564]399fi
400
[164]401if (test "$all_reqs_ok" = "false") ; then
[670]402  AC_MSG_ERROR([Some pre-requisites were not fulfilled, aborting
403  configure. Please consult the 'README' file for more information
404  about what is needed to compile svndigest and refer to above
405  warning messages. Needed files were NOT created.])
[164]406fi
407
408# Create output.
409AC_OUTPUT
410
411# Some more messages.
[887]412AC_MSG_NOTICE([
413Ready to compile the executables of svndigest $VERSION
414The following flags and libs will be used:
415+++++++++++++++++++++++++++++++++++++++++++++++
416  Compiler:           $CXX
417  Preprocessor flags: $SD_CPPFLAGS $CPPFLAGS
418    CPPFLAGS:         $CPPFLAGS
419    DEFAULT_CPPFLAGS: $DEFAULT_CPPFLAGS
420    APR_CPPFLAGS:     $APR_CPPFLAGS
421    SVN_CPPFLAGS:     $SVN_CPPFLAGS
[888]422    PLPLOT_CPPFLAGS:  $PLPLOT_CPPFLAGS
[887]423  C++ flags:
424    CXXFLAGS:         $CXXFLAGS
425    DEFAULT_CXXFLAGS: $DEFAULT_CXXFLAGS
426  Linker flags:
427    LDFLAGS:          $LDFLAGS
428    APR_LDFLAGS:      $APR_LDFLAGS
429    SVN_LDFLAGS:      $SVN_LDFLAGS
430    PLPLOT_LDFLAGS:   $PLPLOT_LDFLAGS
431  Libraries:         
432    LIBS              $LIBS
433    APR_LIBS          $APR_LIBS
434    SVN_LIBS          $SVN_LIBS
[888]435    PLPLOT_LIBS       $PLPLOT_LIBS
[887]436+++++++++++++++++++++++++++++++++++++++++++++++]dnl
437)
[164]438
[880]439AC_MSG_NOTICE([Now type 'make all check'.])
Note: See TracBrowser for help on using the repository browser.