## Process this file with autoconf to produce a configure script. ## ## $Id: configure.ac 729 2008-12-14 16:59:35Z peter $ ## ## If you grabbed the source from subversion you should, at top-level, ## execute: ## ./bootstrap ## To push subsequent changes of this file into the build scripts you ## must issue: ## autoreconf # Copyright (C) 2005 Jari Häkkinen, Peter Johansson # Copyright (C) 2006 Jari Häkkinen # Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson # # This file is part of svndigest, http://dev.thep.lu.se/svndigest # # svndigest is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # svndigest is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with svndigest. If not, see . AC_PREREQ(2.60) m4_include([build_support/version.m4]) AC_INIT([svndigest],[SVNDIGEST_VERSION],[jari@thep.lu.se]) AC_CONFIG_SRCDIR([lib/File.h]) AC_CONFIG_AUX_DIR([autotools]) dnl arg below should be the same as in Makefile.am AC_CONFIG_MACRO_DIR([build_support]) AC_PREFIX_DEFAULT([/usr/local]) test $prefix = NONE && prefix=/usr/local AC_SUBST([SVNDIGEST_MAJOR_VERSION], [MAJOR_VERSION]) AC_SUBST([SVNDIGEST_MINOR_VERSION], [MINOR_VERSION]) AC_SUBST([SVNDIGEST_PATCH_VERSION], [PATCH_VERSION]) AC_DEFINE([DEV_BUILD],[SVNDIGEST_DEV_BUILD], [true if dev build (version ends with pre)]) AC_DEFINE([SVNDIGEST_MAJOR_VERSION], [MAJOR_VERSION], [Define to the svndigest major version]) AC_DEFINE([SVNDIGEST_MINOR_VERSION], [MINOR_VERSION], [Define to the svndigest minor version]) AC_DEFINE([SVNDIGEST_PATCH_VERSION], [PATCH_VERSION], [Define to the svndigest patch version]) AC_CONFIG_HEADER([config.h]) AM_INIT_AUTOMAKE([1.10 std-options check-news]) # Set default programming language AC_LANG(C++) # Let user overide default CXXFLAGS if test "${CXXFLAGS+set}" != set; then CXXFLAGS="" # Setting CXXFLAGS here to prevent expansion in AC_PROG_CXX fi # Checks for programs. AC_PROG_CXXCPP AC_PROG_CXX AC_PROG_INSTALL AC_PROG_RANLIB AC_PROG_SED AM_MISSING_PROG([HELP2MAN], [help2man]) AC_CHECK_PROG([GNUPLOT],[gnuplot],[ok]) # Save FLAGS SAVE_CPPFLAGS="$CPPFLAGS" SAVE_CXXFLAGS="$CXXFLAGS" SAVE_LDFLAGS="$LDFLAGS" SAVE_LIBS="$LIBS" # -Wno-long-long is needed to suppress compiler diagnostics regarding # using extension beyond the C++ standard (usage of non C++ standard # 'long long' types). SD_CXXFLAGS="$SD_CXXFLAGS-Wall -pedantic -Wno-long-long" AC_TYPE_LONG_LONG_INT() AC_ARG_ENABLE(debug, [AS_HELP_STRING([--enable-debug],[turn on debug options and code])], [SD_CXXFLAGS="$SD_CXXFLAGS -g -O"], [SD_CPPFLAGS="-DNDEBUG" SD_CXXFLAGS="$SD_CXXFLAGS -O3"]) # Apache Portable Runtime (APR) API checks # The next three lines are not needed as long as APR_FIND_APR is used. # AC_ARG_WITH(apr, # [ --with-apr=DIR prefix for installed APR or path to APR build # tree [[PREFIX]]]) # Include APR_FIND_APR macro distributed within the APR project. If # the usage of the APR macro is to be omitted then the construct for # setting the CXXFLAGS (header file location) and LDFLAGS (linking # informaion) for APR must be changed. The latter can be achieved with # AC_SEARCH_LIBS([apr_allocator_create],[apr-0],,apr_found="no") but # apr-0 must be prior knowledge. APR_FIND_APR(,,1,[1 0]) if test "$apr_found" = "yes" ; then SD_LIBS="`$apr_config --libs` $SD_LIBS" SD_LDFLAGS="`$apr_config --link-ld` $SD_LDFLAGS" SD_CPPFLAGS="`$apr_config --includes --cppflags` $SD_CPPFLAGS" fi # Subversion API checks svn_found="yes" AC_ARG_WITH(svn, [AS_HELP_STRING([--with-svn=DIR],[prefix for svn developer files [[PREFIX]]])], [ SD_LDFLAGS="-L$withval/lib $SD_LDFLAGS" SD_CPPFLAGS="-I$withval/include $SD_CPPFLAGS"]) # Use SD_*FLAGS in tests CPPFLAGS="$SD_CPPFLAGS $CPPFLAGS" CXXFLAGS="$SD_CXXFLAGS $CXXFLAGS" LDFLAGS="$SD_LDFLAGS $LDFLAGS" LIBS="$SD_LIBS $LIBS" AC_CHECK_HEADER([apr_allocator.h],,apr_found="no") AC_CHECK_HEADER([subversion-1/svn_types.h],,svn_found="no") AC_SEARCH_LIBS([svn_cmdline_setup_auth_baton],[svn_subr-1], [SD_LIBS="-lsvn_subr-1 $SD_LIBS"],svn_found="no") AC_SEARCH_LIBS([svn_ra_initialize],[svn_ra-1], [SD_LIBS="-lsvn_ra-1 $SD_LIBS"],svn_found="no") AC_SEARCH_LIBS([svn_wc_adm_open3],[svn_wc-1], [SD_LIBS="-lsvn_wc-1 $SD_LIBS"],svn_found="no") AC_SEARCH_LIBS([svn_diff_file_options_create],[svn_diff-1], [SD_LIBS="-lsvn_diff-1 $SD_LIBS"],svn_found="no") AC_SEARCH_LIBS([svn_client_log3],[svn_client-1], [SD_LIBS="-lsvn_client-1 $SD_LIBS"],svn_found="no") # Export flags AC_SUBST([SVNDIGEST_CPPFLAGS], $SD_CPPFLAGS) AC_SUBST([SVNDIGEST_CXXFLAGS], $SD_CXXFLAGS) AC_SUBST([SVNDIGEST_LDFLAGS], $SD_LDFLAGS) AC_SUBST([SVNDIGEST_LIBS], $SD_LIBS) # Reset FLAGS CPPFLAGS="$SAVE_CPPFLAGS" CXXFLAGS="$SAVE_CXXFLAGS" LDFLAGS="$SAVE_LDFLAGS" LIBS="$SAVE_LIBS" # check if svnversion is installed AC_PATH_PROG([SVNVERSION], [svnversion], [no]) # checking if we build in a subversion WC AC_MSG_CHECKING([if we build from subversion wc]) wc_found="no"; if (test "$SVNVERSION" != "no" && test `$SVNVERSION -n $srcdir` != "exported"); then wc_found="yes"; fi AC_MSG_RESULT([$wc_found]) AC_CHECK_FILE("$srcdir/lib/subversion_info.cc",info_found="yes",info_found="no") # devel version should have svn WC and SVNVERSION installed AM_CONDITIONAL(HAVE_SVN_WC, test "$wc_found" = "yes" ) AC_CONFIG_FILES([Makefile bin/Makefile lib/Makefile man/Makefile test/environment.h test/Makefile]) # Print failure status information about selected items, and exit if # fatal errors were encountered. No output will be created if # configure is halted prematurely. # used to trigger exit before creation of output all_reqs_ok="true" if (test "$wc_found" != "yes") ; then if (test "$info_found" = "no") ; then AC_MSG_WARN([Cannot find sources (lib/subversion_info.cc).]) if (test "$svnversion" = "no") ; then AC_MSG_WARN([If you grabbed the source from the subversion repository, the file will be generated automatically. However, svnversion cannot be found and therefore the file cannot be generated. Please install svnversion and make sure it is in your search path.]) else AC_MSG_WARN([If you grabbed the source from the subversion repository, the file will be generated automatically. However, the output from svnversion was incorrect. Either your installation of svnversion is is not healthy or there is something wrong with the repository.]) fi all_reqs_ok="false" fi else dnl test repo is not distributed AC_CONFIG_FILES([test/test_repo.sh], [chmod +x test/test_repo.sh]) AC_CONFIG_FILES([test/check_repo_status.sh], [chmod +x test/check_repo_status.sh]) fi # Non-existing APR is fatal -- sub-sequent compilation will fail. if (test "$apr_found" = "no") ; then AC_MSG_WARN([APR not found. The Apache Portable Runtime (APR) library cannot be found. Please make sure APR is installed and supply the appropriate --with-apr option to 'configure'.]) all_reqs_ok="false" fi # Non-existing subversion API is fatal -- sub-sequent compilation will fail. if (test "$svn_found" = "no") ; then svn_msg="Subversion API not found. Subversion API libraries cannot be found. Make sure the APIs are installed and supply the appropriate --with-svn option to 'configure'." if (test "$apr_found" = "no") ; then svn_msg="$svn_msg Note, APR was not found. Failure to locate APR affects the search of the subversion API. Please fix the APR problem before trying to resolve the subversion related issues." fi AC_MSG_WARN([$svn_msg]) all_reqs_ok="false" fi if test $ac_cv_type_long_long_int != yes ; then AC_MSG_WARN([Compiler $CXX does not support `long long'. svndigest must be compiled with a compiler that supports `long long'.]) all_reqs_ok="false" fi if (test "$all_reqs_ok" = "false") ; then AC_MSG_ERROR([Some pre-requisites were not fulfilled, aborting configure. Please consult the 'README' file for more information about what is needed to compile svndigest and refer to above warning messages. Needed files were NOT created.]) fi # Create output. AC_OUTPUT # Some more messages. AC_MSG_NOTICE([]) AC_MSG_NOTICE([ Ready to compile the executables of svndigest $VERSION]) AC_MSG_NOTICE([ The following flags and libs will be used:]) AC_MSG_NOTICE([ +++++++++++++++++++++++++++++++++++++++++++++++]) AC_MSG_NOTICE([ Compiler: $CXX]) AC_MSG_NOTICE([ Preprocessor flags: $SD_CPPFLAGS $CPPFLAGS]) AC_MSG_NOTICE([ C++ flags: $SD_CXXFLAGS $CXXFLAGS]) AC_MSG_NOTICE([ Linker flags: $SD_LDFLAGS $LDFLAGS]) AC_MSG_NOTICE([ LIBS: $SD_LIBS $LIBS]) AC_MSG_NOTICE([ +++++++++++++++++++++++++++++++++++++++++++++++]) AC_MSG_NOTICE([]) # Failure to locate gnuplot is not considered fatal if (test "$GNUPLOT" != "ok") ; then AC_MSG_WARN([Gnuplot was not found. svndigest will compile without gnuplot but will throw an exception at run-time. Please install gnuplot (available for a wide range of operating systems at http://www.gnuplot.info).]) AC_MSG_NOTICE([]) fi AC_MSG_NOTICE([Now type 'make ; make check'.])