diff options
101 files changed, 1034 insertions, 4925 deletions
@@ -86,3 +86,14 @@ doc/ledger.1.html doc/ledger.html doc/ledger3.html src/TAGS +CMakeCache.txt +CPackConfig.cmake +CPackSourceConfig.cmake +CMakeFiles/ +_CPack_Packages/ +cmake_install.cmake +install_manifest.txt +system.hh +system.hh.[gp]ch* +Ledger*.dmg +Ledger*.sh diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..002f5b85 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,260 @@ +cmake_minimum_required(VERSION 2.8.8) + +project(Ledger) + +set(Ledger_VERSION_MAJOR 3) +set(Ledger_VERSION_MINOR 0) +set(Ledger_VERSION_PATCH 0) +set(Ledger_VERSION_DATE 20120518) + +enable_testing() + +######################################################################## + +option(USE_PYTHON "Build support for the Python scripting bridge" OFF) +option(USE_DOXYGEN "Build reference documentation using Doxygen" OFF) + +option(NO_ASSERTS "Build without any internal consistency checks" OFF) +option(BUILD_DEBUG "Build support for runtime debugging" ON) + +option(BUILD_LIBRARY "Build and install Ledger as a library" ON) +option(BUILD_DOCS "Build and install documentation" OFF) +option(BUILD_EMACSLISP "Build and install ledger-mode for Emacs" OFF) + +if(BUILD_DEBUG) + set(CMAKE_BUILD_TYPE Debug) + set(DEBUG_MODE 1) +elseif(NO_ASSERTS) + set(CMAKE_BUILD_TYPE Release) + set(NDEBUG 1) +else() + set(CMAKE_BUILD_TYPE Release) +endif() + +######################################################################## + +find_package(PythonInterp) # Used for running tests + +if(USE_PYTHON) + find_package(PythonLibs) + if(PYTHONLIBS_FOUND) + set(BOOST_PYTHON python) + set(HAVE_BOOST_PYTHON 1) + include_directories(SYSTEM ${PYTHON_INCLUDE_DIRS}) + else() + set(HAVE_BOOST_PYTHON 0) + message("Could not find a Python library to use with Boost.Python") + endif() +endif() + +set(Boost_USE_MULTITHREADED OFF) + +find_package(Boost 1.47.0 + REQUIRED date_time filesystem system iostreams regex + unit_test_framework test_exec_monitor + OPTIONAL_COMPONENTS ${BOOST_PYTHON}) + +include_directories(SYSTEM ${Boost_INCLUDE_DIRS}) + +find_package(Gettext) # Used for running tests + +if(GETTEXT_FOUND) + set(HAVE_GETTEXT 1) +else() + set(HAVE_GETTEXT 0) +endif() + +######################################################################## + +include(CheckIncludeFiles) + +check_include_files(langinfo.h HAVE_LANGINFO_H) + +include(CheckLibraryExists) + +check_library_exists(edit readline "" HAVE_EDIT) + +include(CheckFunctionExists) + +check_function_exists(access HAVE_ACCESS) +check_function_exists(realpath HAVE_REALPATH) +check_function_exists(getpwuid HAVE_GETPWUID) +check_function_exists(getpwnam HAVE_GETPWNAM) +check_function_exists(isatty HAVE_ISATTY) + +include(CheckCSourceCompiles) + +check_c_source_compiles(" +#include <sys/types.h> +#include <sys/wait.h> +#include <unistd.h> +#include <stdlib.h> +#include <string.h> +#include <stdio.h> + +int main() { + int status, pfd[2]; + status = pipe(pfd); + status = fork(); + if (status < 0) { + ; + } else if (status == 0) { + char *arg0 = NULL; + + status = dup2(pfd[0], STDIN_FILENO); + + close(pfd[1]); + close(pfd[0]); + + execlp(\"\", arg0, (char *)0); + perror(\"execl\"); + exit(1); + } else { + close(pfd[0]); + } + return 0; +}" UNIX_PIPES_COMPILES) + +if(UNIX_PIPES_COMPILES) + set(HAVE_UNIX_PIPES 1) +else() + set(HAVE_UNIX_PIPES 0) +endif() + +include(CheckCXXSourceRuns) +include(CMakePushCheckState) + +cmake_push_check_state() + +set(CMAKE_REQUIRED_INCLUDES ${CMAKE_INCLUDE_PATH} ${Boost_INCLUDE_DIRS}) +set(CMAKE_REQUIRED_LIBRARIES ${Boost_LIBRARIES} icuuc) + +check_cxx_source_runs(" +#include <boost/regex/icu.hpp> + +using namespace boost; + +int main() { + std::string text = \"Активы\"; + u32regex r = make_u32regex(\"активы\", regex::perl | regex::icase); + return u32regex_search(text, r) ? 0 : 1; +}" BOOST_REGEX_UNICODE_RUNS) + +if(BOOST_REGEX_UNICODE_RUNS) + set(HAVE_BOOST_REGEX_UNICODE 1) +else() + set(HAVE_BOOST_REGEX_UNICODE 0) +endif() + +cmake_pop_check_state() + +cmake_push_check_state() + +set(CMAKE_REQUIRED_FLAGS -std=c++11) +set(CMAKE_REQUIRED_INCLUDES ${CMAKE_INCLUDE_PATH}) + +check_cxx_source_runs(" +#include <regex> +#include <vector> +#include <iostream> + +int main() { + std::vector<int> x {0, 1, 2, 3, 4}; + for (auto i : x) + std::cout << i << std::endl; + + std::regex r(\"foo\"); + std::cout << std::regex_match(\"foobar\", r) << std::endl; + return 0; +}" CXX11_RUNS) + +cmake_pop_check_state() + +if(CXX11_RUNS) + set(HAVE_CXX11 1) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") +else() + set(HAVE_CXX11 0) +endif() + +######################################################################## + +include_directories(${CMAKE_INCLUDE_PATH}) + +find_path(GMP_PATH gmp.h) +find_library(GMP_LIB gmp) +include_directories(SYSTEM "${GMP_PATH}") + +find_path(MPFR_PATH mpfr.h) +find_library(MPFR_LIB mpfr) +include_directories(SYSTEM "${MPFR_PATH}") + +find_path(EDIT_PATH histedit.h) +find_library(EDIT_LIB edit) +include_directories(SYSTEM "${EDIT_PATH}") + +find_path(INTL_PATH libintl.h) +find_library(INTL_LIB intl) +include_directories(SYSTEM "${INTL_PATH}") + +######################################################################## + +macro(add_ledger_library_dependencies _target) + if(BUILD_LIBRARY) + target_link_libraries(${_target} libledger) + endif() + target_link_libraries(${_target} ${MPFR_LIB}) + target_link_libraries(${_target} ${GMP_LIB}) + if(HAVE_EDIT) + target_link_libraries(${_target} ${EDIT_LIB}) + endif() + if(HAVE_GETTEXT) + target_link_libraries(${_target} ${INTL_LIB}) + endif() + if(HAVE_BOOST_PYTHON) + target_link_libraries(${_target} ${Boost_LIBRARIES} ${PYTHON_LIBRARIES}) + else() + target_link_libraries(${_target} ${Boost_LIBRARIES}) + endif() + if(HAVE_BOOST_REGEX_UNICODE) + target_link_libraries(${_target} icuuc) + endif() +endmacro(add_ledger_library_dependencies _target) + +######################################################################## + +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}) + +# add the binary tree to the search path for include files so that we will +# find TutorialConfig.h +include_directories("${PROJECT_SOURCE_DIR}/lib") +include_directories("${PROJECT_SOURCE_DIR}/lib/utfcpp/source") +include_directories("${PROJECT_BINARY_DIR}") + +configure_file( + ${PROJECT_SOURCE_DIR}/src/system.hh.in + ${PROJECT_BINARY_DIR}/system.hh) + +add_subdirectory(src) +if(BUILD_DOCS) + add_subdirectory(doc) +endif() +if(BUILD_EMACSLISP) + add_subdirectory(lisp) +endif() +add_subdirectory(test) + +######################################################################## + +# build a CPack driven installer package +include (InstallRequiredSystemLibraries) + +set (CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/doc/LICENSE.rtf") +set (CPACK_PACKAGE_VERSION_MAJOR "${Ledger_VERSION_MAJOR}") +set (CPACK_PACKAGE_VERSION_MINOR "${Ledger_VERSION_MINOR}") +set (CPACK_PACKAGE_VERSION_PATCH "${Ledger_VERSION_PATCH}") + +include (CPack) + +### CMakeLists.txt ends here @@ -39,176 +39,7 @@ LEVELS = {'DEBUG': logging.DEBUG, search_prefixes = [ '/usr/local', '/opt/local', '/sw', '/usr' ] class BoostInfo(object): - log = None - suffix = "" - file_suffix = ".so" - home_path = "/usr" - include_path = "include" - library_path = "lib" - configured = False - no_includes = False - - def __init__(self, log): - self.log = log - - def configure(self, suffix = None, file_suffix = None, home_path = None, - include_path = None, library_path = None): - self.log.debug('Configuring Boost details') - if suffix: - self.log.debug('Setting Boost suffix to => ' + suffix) - self.suffix = suffix - if file_suffix: - self.log.debug('Setting Boost file suffix to => ' + file_suffix) - self.file_suffix = file_suffix - if home_path: - self.log.debug('Setting Boost home to => ' + home_path) - self.home_path = home_path - if include_path: - self.log.debug('Setting Boost include directory to => ' + include_path) - self.include_path = include_path - if library_path: - self.log.debug('Setting Boost lib directory to => ' + library_path) - self.library_path = library_path - - path = library_path or self.library_path - if not isabs(path): - path = join(home_path or self.home_path, path) - if not exists(path) or not isdir(path) or \ - not self.check_for_boost_regex_lib(path, suffix or self.suffix, - file_suffix or self.file_suffix): - return False - - path = include_path or self.include_path - if not isabs(path): - path = join(home_path or self.home_path, path) - if not exists(path) or not isdir(path) or \ - not self.check_for_boost_regex_hpp(path): - return False - - self.configured = True - - return True # The object was configured - - def option_boost_suffix(self, option=None, opt_str=None, value=None, parser=None): - self.log.debug('Saw option --boost or --boost-suffix') - self.suffix = value - - def option_boost_file_suffix(self, option=None, opt_str=None, value=None, parser=None): - self.log.debug('Saw option --boost-file-suffix') - self.file_suffix = value - - def option_boost_home(self, option=None, opt_str=None, value=None, parser=None): - self.log.debug('Saw option --boost-home') - self.home_path = value - - def option_boost_include(self, option=None, opt_str=None, value=None, parser=None): - self.log.debug('Saw option --boost-include') - self.include_path = value - - def option_boost_lib(self, option=None, opt_str=None, value=None, parser=None): - self.log.debug('Saw option --boost-lib') - self.library_path = value - - def inform_boost_details(self): - self.log.info('Boost was found here:') - self.log.info('Boost home path => ' + self.home_path) - self.log.info('Boost include path => ' + self.include_directory()) - self.log.info('Boost library path => ' + self.library_directory()) - self.log.info('Boost suffix => ' + self.suffix) - self.log.info('Boost file suffix => ' + self.file_suffix) - - def find_boost_in_directory(self, path): - if exists(path) and isdir(path): - for entry in reversed(sorted(os.listdir(path))): - if re.search('boost_regex', entry): - self.log.info('Found a Boost library: ' + join(path, entry)) - - match = re.match('libboost_regex([^.]*)(\.(a|so|dylib))', entry) - if match: - suffix = match.group(1) - file_suffix = match.group(2) - self.log.info('Found a Boost suffix => ' + suffix) - self.log.info('Found a Boost file suffix => ' + file_suffix) - return [suffix, file_suffix] - else: - self.log.debug('The directory "%s" is not valid, skipping' % path) - return None - - def locate_boost(self): - lib64_dirs = map(lambda x: join(x, 'lib64'), search_prefixes) - lib_dirs = map(lambda x: join(x, 'lib'), search_prefixes) - result = None - for path in lib64_dirs + lib_dirs: - self.log.info('Looking for Boost in %s...' % path) - result = self.find_boost_in_directory(path) - if result is not None: - self.suffix, self.file_suffix = result - self.library_path = path - self.home_path = dirname(path) - self.configured = True - self.inform_boost_details() - break - if result is None: - self.log.error("Boost not found, try --boost-home (and --boost-suffix, --boost-file-suffix)") - sys.exit(1) - - def check_for_boost_regex_lib(self, path, suffix, file_suffix): - regex_lib = join(path, 'libboost_regex' + suffix) - return exists(regex_lib + file_suffix) - - def check_for_boost_regex_hpp(self, path): - regex_hpp = join(path, 'boost/regex.hpp') - return exists(regex_hpp) - - def get_suffix(self): - if not self.configured: - self.locate_boost() - return self.suffix - - def get_file_suffix(self): - if not self.configured: - self.locate_boost() - return self.file_suffix - - def include_directory(self): - if not self.configured: - self.locate_boost() - - if isabs(self.include_path): - path = self.include_path - else: - path = join(self.home_path, self.include_path) - - if not exists(path) or not isdir(path): - self.log.error("Boost include directory '%s' not found, use --boost-include" % path) - sys.exit(1) - - if not self.check_for_boost_regex_hpp(path): - self.log.error("Could not find Boost header 'boost/regex.hpp' in '%s'; use --boost-* flags" % path) - sys.exit(1) - - return path - - def library_directory(self): - if not self.configured: - self.locate_boost() - - if isabs(self.library_path): - path = self.library_path - else: - path = join(self.home_path, self.library_path) - - if not exists(path) or not isdir(path): - self.log.error("Boost library directory '%s' not found, use --boost-include" % path) - sys.exit(1) - - if not self.check_for_boost_regex_lib(path, self.suffix, self.file_suffix): - self.log.error("Could not find Boost library 'boost_regex' in '%s'; use --boost-* flags" % path) - sys.exit(1) - - return path - - def dependencies(self, system): + def dependencies(system): if system == 'darwin': return [ 'boost-jam', 'boost', '+python27+universal' ] @@ -224,7 +55,7 @@ class BoostInfo(object): 'libboost-iostreams-dev', 'libboost-python-dev' ] - elif system == 'ubuntu-karmic': + elif system == 'ubuntu-karmic' or system == 'ubuntu-hardy': return [ 'bjam', 'libboost-dev', 'libboost-regex-dev', 'libboost-date-time-dev', @@ -232,14 +63,6 @@ class BoostInfo(object): 'libboost-iostreams-dev', 'libboost-python-dev' ] - elif system == 'ubuntu-hardy': - return [ 'bjam', 'libboost-dev', - 'libboost-python-dev', - 'libboost-regex-dev', - 'libboost-date-time-dev', - 'libboost-filesystem-dev', - 'libboost-iostreams-dev' ] - elif system == 'ubuntu-oneiric': return [ 'libboost-dev', 'libboost-python-dev', @@ -254,8 +77,6 @@ class CommandLineApp(object): force_exit = True # If true, always ends run() with sys.exit() log_handler = None - darwin_gcc = False - boost_version = "1_49_0" boost_major = "1_49" options = { @@ -390,37 +211,22 @@ class PrepareBuild(CommandLineApp): def initialize(self): self.log.debug('Initializing all state variables') - self.should_clean = False - self.configured = False - self.current_ver = None - #self.current_flavor = 'default' - self.current_flavor = 'debug' - self.prefix_dir = None - self.products_dir = None - self.build_dir = self.source_dir - self.make_command = None - self.configure_args = ['--with-included-gettext'] - self.boost_info = BoostInfo(self.log) - self.sys_include_dirs = [] - self.sys_library_dirs = [] - - self.CPPFLAGS = [] - self.CFLAGS = [] - self.CXXFLAGS = [] - self.LDFLAGS = [] + self.should_clean = False + self.configured = False + self.current_ver = None + #self.current_flavor = 'default' + self.current_flavor = 'debug' + self.prefix_dir = None + self.products_dir = None + self.build_dir = self.source_dir + self.configure_args = [] + self.CXXFLAGS = [] + self.LDFLAGS = [] self.envvars = { - 'PYTHON': '/usr/bin/python', - 'PYTHON_HOME': '/usr', - 'PYTHON_VERSION': '2.7', - 'LEDGER_PRODUCTS': None, - 'CC': 'gcc', - 'CPPFLAGS': '', - 'CFLAGS': '', - 'CXX': 'g++', - 'CXXFLAGS': '', - 'LD': 'g++', - 'LDFLAGS': '' + 'CXX': 'g++', + 'CXXFLAGS': '', + 'LDFLAGS': '', } for varname in self.envvars.keys(): @@ -442,130 +248,55 @@ class PrepareBuild(CommandLineApp): CommandLineApp.__init__(self) self.log.setLevel(logging.INFO) - self.force = False - self.no_pch = False self.source_dir = os.getcwd() self.initialize() op = self.option_parser - # These options call into self.boost_info - op.add_option('', '--boost', metavar='BOOST_SUFFIX', - action="callback", type="string", - callback=self.boost_info.option_boost_suffix, - help='Set Boost library suffix (ex: "--boost=-mt")') + op.add_option('', '--help', action="callback", + callback=self.option_help, + help='Show this help text') + op.add_option('-j', '--jobs', metavar='N', + type='int', action='store', dest='jobs', + default=1, help='Allow N make jobs at once') + + op.add_option('', '--boost', metavar='BOOST_ROOT', + action="store", dest="boost_root", + help='Set Boost library root (ex: "--boost=/usr/local")') op.add_option('', '--boost-suffix', metavar='BOOST_SUFFIX', - action="callback", type="string", - callback=self.boost_info.option_boost_suffix, + action="store", dest="boost_suffix", help='Set Boost library suffix (ex: "--boost-suffix=-mt")') - op.add_option('', '--boost-file-suffix', metavar='BOOST_FILE_SUFFIX', - action="callback", type="string", - callback=self.boost_info.option_boost_file_suffix, - help='Set Boost library file suffix (ex: "--boost-file-suffix=.so")') - op.add_option('', '--boost-home', metavar='BOOST_HOME', - action="callback", type="string", - callback=self.boost_info.option_boost_home, - help='Set Boost home directory (ex: "--boost-home=DIR")') op.add_option('', '--boost-include', metavar='BOOST_INCLUDE', - action="callback", type="string", - callback=self.boost_info.option_boost_include, + action="store", dest="boost_include", help='Set Boost include path (ex: "--boost-include=DIR")') - op.add_option('', '--boost-lib', metavar='BOOST_LIB', - action="callback", type="string", - callback=self.boost_info.option_boost_lib, - help='Set Boost library path (ex: "--boost-lib=DIR")') - op.add_option('-j', '--jobs', metavar='N', - type='int', action='store', dest='jobs', - default=1, help='Allow N make jobs at once') - op.add_option('', '--force', action="callback", - callback=self.option_force, - help="Perform every action, without checking") - op.add_option('', '--clang', action='store_true', - dest='use_clang', default=False, + op.add_option('', '--compiler', metavar='COMPILER', + action="store", dest="compiler", help='Use the Clang C++ compiler') - op.add_option('', '--help', action="callback", - callback=self.option_help, - help='Show this help text') - op.add_option('', '--local', action="callback", - callback=self.option_local, - help='Build directly within the source tree (default)') - op.add_option('', '--make', metavar='FILE', action="callback", - callback=self.option_make, type="string", - help='Use custom make command') - op.add_option('', '--no-pch', action="callback", - callback=self.option_no_pch, - help='Do not use pre-compiled headers') - op.add_option('', '--no-patch', action='store_true', dest='no_patch', - default=False, - help='Do not patch the Makefile for prettier output') + op.add_option('', '--no-git', action='store_true', dest='no_git', default=False, help='Do not call out to Git; useful for offline builds') + op.add_option('', '--doxygen', action='store_true', + dest='enable_doxygen', default=False, + help='Enable use of Doxygen to build ref manual ("make docs")') op.add_option('', '--python', action='store_true', dest='python', default=False, help='Enable Python support (if disabled in acprep)') op.add_option('', '--no-python', action='store_true', dest='no_python', default=False, help='Do not enable Python support by default') - op.add_option('', '--cache', action='store_true', - dest='enable_cache', default=False, - help='Enable use of Boost.Serialization (--cache)') - op.add_option('', '--doxygen', action='store_true', - dest='enable_doxygen', default=False, - help='Enable use of Doxygen to build ref manual ("make docs")') - op.add_option('', '--enable-cache', action='store_true', - dest='enable_cache', default=False, - help='Enable use of Boost.Serialization (--cache)') - op.add_option('', '--enable-doxygen', action='store_true', - dest='enable_doxygen', default=False, - help='Enable use of Doxygen to build ref manual ("make docs")') - op.add_option('', '--universal', action='store_true', - dest='universal', default=False, - help='Attempt to build universal binaries') - op.add_option('', '--gcc45', action='store_true', - dest='gcc45', default=False, - help='Require the use of gcc 4.5') - op.add_option('', '--gcc46', action='store_true', - dest='gcc46', default=False, - help='Require the use of gcc 4.6') - op.add_option('', '--gcc47', action='store_true', - dest='gcc47', default=False, - help='Require the use of gcc 4.7') - op.add_option('', '--gcc48', action='store_true', - dest='gcc48', default=False, - help='Require the use of gcc 4.8') - op.add_option('', '--cpp11', action='store_true', - dest='use_cpp11', default=False, - help='Use C++11 extensions (requires Clang or gcc 4.6/7/8)') - op.add_option('', '--plain', action='store_true', - dest='use_plain', default=False, - help="Don't customize for my private environment") - op.add_option('', '--output', metavar='DIR', action="callback", - callback=self.option_output, - help='Build in the specified directory') - op.add_option('', '--pch', action="callback", - callback=self.option_pch, - help='Enable use of pre-compiled headers') - op.add_option('', '--pic', action="callback", - callback=self.option_pic, - help='Compile with explicit PIC support') - op.add_option('', '--prefix', metavar='DIR', action="callback", - callback=self.option_prefix, type="string", - help='Use custom installation prefix') - op.add_option('', '--products', metavar='DIR', action="callback", - callback=self.option_products, + op.add_option('', '--prefix', metavar='DIR', action="store", + dest="prefix_dir", help='Use custom installation prefix') + op.add_option('', '--products', metavar='DIR', action="store", + dest="option_products", help='Collect all build products in this directory') - op.add_option('', '--trees', action="callback", - callback=self.option_trees, - help='Use separate build trees for each flavor') - op.add_option('', '--release', action="callback", - callback=self.option_release, - help='Setup for doing a faster, once-only build') - op.add_option('', '--warn', action="callback", - callback=self.option_warn, - help='Enable full warning flags') + op.add_option('', '--output', metavar='DIR', action="store", + dest="build_dir", help='Build in the specified directory') + op.add_option('', '--local', action="callback", + callback=self.option_local, + help='Build directly within the source tree (default)') def main(self, *args): if args and args[0] in ['default', 'debug', 'opt', 'gcov', 'gprof']: @@ -640,10 +371,7 @@ class PrepareBuild(CommandLineApp): return None def default_products_directory(self): - if self.envvars['LEDGER_PRODUCTS']: - return self.envvars['LEDGER_PRODUCTS'] - else: - return join(os.environ['HOME'], "Products") + return join(os.environ['HOME'], "Products") def products_directory(self): if not self.products_dir: @@ -678,30 +406,28 @@ class PrepareBuild(CommandLineApp): def current_version(self): if not self.current_ver: - version_m4 = open('version.m4', 'r') + major, minor, patch, date = None, None, None, None + + version_m4 = open('CMakeLists.txt', 'r') for line in version_m4.readlines(): - match = re.match('m4_define\(\[VERSION_NUMBER\], \[([0-9.]+[-abgrc0-9]*)\]\)', - line) - assert(match) - self.current_ver = match.group(1) + match = re.match('^set\(Ledger_VERSION_MAJOR ([0-9]+)\)', line) + if match: + major = match.group(1) + match = re.match('^set\(Ledger_VERSION_MINOR ([0-9]+)\)', line) + if match: + minor = match.group(1) + match = re.match('^set\(Ledger_VERSION_PATCH ([0-9]+)\)', line) + if match: + patch = match.group(1) + match = re.match('^set\(Ledger_VERSION_DATE ([0-9]+)\)', line) + if match: + date = match.group(1) + break + self.current_ver = "%s.%s.%s%s" % (major, minor, patch, + "-%s" % date if date else "") version_m4.close() return self.current_ver - def need_to_prepare_autotools(self): - if self.force: - return 'because it was forced' - elif self.isnewer('acprep', 'configure'): - self.should_clean = True - return 'because acprep is newer than configure' - elif self.isnewer('acprep', 'Makefile.in'): - self.should_clean = True - return 'because acprep is newer than Makefile.in' - elif self.isnewer('configure.ac', 'configure'): - return 'because configure.ac is newer than configure' - elif self.isnewer('Makefile.am', 'Makefile.in'): - return 'because Makefile.am is newer than Makefile.in' - return False - def phase_products(self, *args): self.log.info('Executing phase: products') print self.products_directory() @@ -714,27 +440,20 @@ class PrepareBuild(CommandLineApp): self.log.info("Current version => " + self.current_version()) self.log.info("Current flavor => " + self.current_flavor) self.log.info("Source directory => " + self.source_dir) - self.log.info("Need to run autogen.sh => " + - str(self.need_to_prepare_autotools())) if self.prefix_directory(): self.log.info("Installation prefix => " + self.prefix_directory()) self.log.info("Products directory => " + self.products_directory()) self.log.info("Build directory => " + self.build_directory()) - self.log.info("Need to run configure => " + - str(self.need_to_run_configure())) - self.log.info("Use pre-compiled headers => " + - str('--enable-pch' in conf_args)) - self.log.debug('Configure environment =>') + self.log.debug('CMake environment =>') keys = environ.keys() keys.sort() for key in keys: - if key in ['PATH', 'CC', 'LD', 'CXX'] or \ - key.endswith('FLAGS'): + if key in ['PATH', 'CXX'] or key.endswith('FLAGS'): self.log.debug(' %s=%s' % (key, environ[key])) - self.log.debug('Configure arguments =>') + self.log.debug('CMake arguments =>') for arg in conf_args + list(args): self.log.debug(' %s' % arg) @@ -744,67 +463,6 @@ class PrepareBuild(CommandLineApp): self.execute('sloccount', 'src', 'python', 'lisp', 'test') ######################################################################### - # Configure source tree using autogen # - ######################################################################### - - def phase_gettext(self, *args): - self.log.info('Executing phase: gettext') - - # configure the template files - assert exists('po') and isdir('po') - if not exists(join('po', 'Makevars')): - assert exists(join('po', 'Makevars.template')) - self.log.info('Moving po/Makevars.template -> po/Makevars') - os.rename(join('po', 'Makevars.template'), - join('po', 'Makevars')) - - POTFILES_in = open('po/POTFILES.in', 'w') - for filename in (f for f in os.listdir(join(self.source_dir, 'src')) - if re.search('\.(cc|h)', f)): - POTFILES_in.write(join('src', filename)) - POTFILES_in.write('\n') - POTFILES_in.close() - - def copytimes(self, src, dest): - os.utime(dest, (os.stat(src)[ST_ATIME], os.stat(src)[ST_MTIME])) - - def phase_autogen(self, *args): - self.log.info('Executing phase: autogen') - - if not exists('autogen.sh') or \ - self.isnewer('tools/autogen.sh', 'autogen.sh'): - shutil.copyfile('tools/autogen.sh', 'autogen.sh') - self.copytimes('tools/autogen.sh', 'autogen.sh') - - self.execute('sh', 'tools/autogen.sh') - - def phase_aclocal(self, *args): - self.log.info('Executing phase: aclocal') - self.execute('aclocal', '-I', 'm4') - - def phase_autoconf(self, *args): - self.log.info('Executing phase: autoconf') - - if not exists('configure.ac') or \ - self.isnewer('tools/configure.ac', 'configure.ac'): - shutil.copyfile('tools/configure.ac', 'configure.ac') - self.copytimes('tools/configure.ac', 'configure.ac') - - if not exists('Makefile.am') or \ - self.isnewer('tools/Makefile.am', 'Makefile.am'): - shutil.copyfile('tools/Makefile.am', 'Makefile.am') - self.copytimes('tools/Makefile.am', 'Makefile.am') - - reason = self.need_to_prepare_autotools() - if reason: - self.log.info('autogen.sh must be run ' + reason) - self.phase_autogen() - self.phase_gettext() - self.phase_aclocal() - else: - self.log.debug('autogen.sh does not need to be run') - - ######################################################################### # Update local files with the latest information # ######################################################################### @@ -846,7 +504,7 @@ class PrepareBuild(CommandLineApp): 'libedit' ,'+universal', 'texlive-xetex', 'doxygen', 'graphviz', 'texinfo', 'lcov', 'sloccount' - ] + self.boost_info.dependencies('darwin') + ] + BoostInfo.dependencies('darwin') self.log.info('Executing: ' + string.join(packages, ' ')) self.execute(*packages) elif exists('/sw/bin/fink'): @@ -883,7 +541,7 @@ class PrepareBuild(CommandLineApp): 'texinfo', 'lcov', 'sloccount' - ] + self.boost_info.dependencies('ubuntu-karmic') + ] + BoostInfo.dependencies('ubuntu-karmic') elif re.search('hardy', info): self.log.info('Looks like you are using APT on Ubuntu Hardy') packages = [ @@ -973,137 +631,39 @@ class PrepareBuild(CommandLineApp): # Determine the system's basic configuration # ######################################################################### - def setup_system_directories(self): - if not self.boost_info.no_includes: - boost_include = self.boost_info.include_directory() - boost_library = self.boost_info.library_directory() - else: - boost_include = None - boost_library = None - - if re.match('/(usr|opt)/local', self.boost_info.home_path): - self.log.debug("Setting Python home to /opt/local based on Boost's location") - self.envvars['PYTHON_HOME'] = '/opt/local' - - # Each of these becomes '-isystem <name>' - for path in ['/usr/local/include', - boost_include, - '%s/include/python%s' % - (self.envvars['PYTHON_HOME'], - self.envvars['PYTHON_VERSION'].strip()), - '/opt/local/include', - '/sw/include']: - if path and exists(path) and isdir(path) and \ - path != '/usr/include': - self.log.info('Noticing include directory => ' + path) - self.sys_include_dirs.append(path) - - includes = string.split(self.get_stdout('python-config', - '--includes'), '-I') - for include in includes: - include = include.strip() - if include and include not in self.sys_include_dirs: - self.sys_include_dirs.append(include) - - # Each of these becomes '-L<name>' - for path in ['/usr/local/lib', - '%s/lib' % self.envvars['PYTHON_HOME'], - '%s/lib/python%s/config' - % (self.envvars['PYTHON_HOME'], - self.envvars['PYTHON_VERSION'].strip()), - '/opt/local/lib', - boost_library, - '/sw/lib']: - if path and exists(path) and isdir(path) and \ - path not in self.sys_library_dirs: - self.log.info('Noticing library directory => ' + path) - self.sys_library_dirs.append(path) - def setup_for_johnw(self): - self.envvars['PYTHON'] = '/opt/local/bin/python' - self.envvars['PYTHON_HOME'] = '/opt/local' - - self.boost_info.configured = True # cxx does all this work for me - self.boost_info.no_includes = True - - if self.options.use_cpp11: - self.CXXFLAGS.append('-std=c++11') - self.envvars['CXX'] = '/Users/johnw/bin/cxx' - self.envvars['LD'] = '/Users/johnw/bin/cxx' - - #if not self.options.use_clang: - # self.CXXFLAGS.append('--gcc47') - - if self.current_flavor == 'debug': - self.configure_args.append('--disable-shared') - elif self.current_flavor == 'gcov': - self.configure_args.append('--disable-shared') - else: - self.CXXFLAGS.append('-march=nocona') - self.CXXFLAGS.append('-msse3') - - self.CXXFLAGS.append('-DDOCUMENT_MODEL=1') + self.envvars['CXX'] = '/usr/local/stow/clang-3.1/bin/clang++' + + self.CXXFLAGS.append('-Qunused-arguments') + self.CXXFLAGS.append('-nostdlibinc') + self.CXXFLAGS.append('-isystem') + self.CXXFLAGS.append('/usr/local/include/c++/v1') + self.CXXFLAGS.append('-isystem') + self.CXXFLAGS.append('/usr/include') + self.CXXFLAGS.append('-stdlib=libc++') + self.CXXFLAGS.append('-Wl,/usr/local/lib/libc++.dylib') + self.CXXFLAGS.append('-Wno-disabled-macro-expansion') + + self.configure_args.append('-DCMAKE_INCLUDE_PATH:STRING=/usr/local/include;/opt/local/include') + self.configure_args.append('-DCMAKE_LIBRARY_PATH:STRING=/usr/local/lib;/opt/local/lib') + self.configure_args.append('-DBOOST_ROOT=/usr/local') + self.configure_args.append('-DBOOST_INCLUDEDIR=/usr/local/include/boost-1_49') + self.configure_args.append('-DBoost_COMPILER=-clang-darwin') + self.configure_args.append(self.source_dir) def setup_for_system(self): system = self.get_stdout('uname', '-s') - self.log.info('System type is => ' + system) - # These options are global defaults at the moment - #self.option_warn() - if not self.no_pch: - self.option_pch() - - if system == 'Linux': - arch = self.get_stdout('uname', '-m') - if arch == 'x86_64': - if '--disable-shared' in self.configure_args: - self.configure_args.remove('--disable-shared') - self.configure_args.append('--disable-static') - self.CXXFLAGS.append('-pthread') - - elif system == 'Solaris': - self.CXXFLAGS.append('-pthread') - - elif system == 'Darwin': - if self.options.use_clang: - self.envvars['CC'] = 'clang' - self.envvars['CXX'] = 'clang++' - self.envvars['LD'] = 'llvm-ld' - else: - # g++ 4.0.1 cannot use PCH headers on OS X 10.5 - self.option_no_pch() - if self.options.enable_doxygen: - self.configure_args.append('--enable-doxygen') - if self.options.enable_cache: - self.configure_args.append('--enable-cache') + self.configure_args.append('-DUSE_DOXYGEN=1') if self.options.python: - self.configure_args.append('--enable-python') + self.configure_args.append('-DUSE_PYTHON=1') if self.options.no_python: - self.configure_args.remove('--enable-python') + self.configure_args.remove('-DUSE_PYTHON=1') - if not self.options.use_plain and \ - exists('/Users/johnw/Projects/ledger/plan/TODO'): + if exists('/Users/johnw/Projects/ledger/plan/TODO'): self.setup_for_johnw() - self.setup_system_directories() - - if '--enable-pch' not in self.configure_args and \ - (exists('/opt/local/bin/ccache') or \ - exists('/usr/local/bin/ccache')): - self.envvars['CC'] = 'ccache ' + self.envvars['CC'] - self.envvars['CXX'] = 'ccache ' + self.envvars['CXX'] - self.envvars['LD'] = 'ccache ' + self.envvars['LD'] - - def setup_flags(self): - for path in self.sys_include_dirs: - self.CPPFLAGS.append('-isystem') - self.CPPFLAGS.append(path) - - self.CXXFLAGS.append('-pipe') - - for path in self.sys_library_dirs: - self.LDFLAGS.append('-L' + path) def setup_flavor(self): self.setup_for_system() @@ -1116,15 +676,13 @@ class PrepareBuild(CommandLineApp): self.log.info('Setting up build flavor => ' + self.current_flavor) PrepareBuild.__dict__['setup_flavor_' + self.current_flavor](self) - self.setup_flags() - def escape_string(self, data): return re.sub('(["\\\\])', '\\\\\\1', data) def finalize_config(self): self.setup_flavor() - for var in ('CPPFLAGS', 'CFLAGS', 'CXXFLAGS', 'LDFLAGS'): + for var in ('CXXFLAGS', 'LDFLAGS'): value = self.__dict__[var] if value: first = not self.envvars[var] @@ -1147,112 +705,10 @@ class PrepareBuild(CommandLineApp): # Options that can modify any build flavor # ######################################################################### - def option_pch(self, option=None, opt_str=None, value=None, parser=None): - self.log.debug('Saw option --pch') - - self.configure_args.append('--enable-pch') - - self.LDFLAGS.append('-fpch-deps') - if not self.options.use_clang: - self.CXXFLAGS.append('-Wconversion') - else: - self.CXXFLAGS.append('-Weverything') - self.CXXFLAGS.append('-Wno-padded') - self.CXXFLAGS.append('-Wno-weak-vtables') - self.CXXFLAGS.append('-Wno-exit-time-destructors') - self.CXXFLAGS.append('-Wno-global-constructors') - self.CXXFLAGS.append('-Wno-switch-enum') - self.CXXFLAGS.append('-Wno-missing-prototypes') - self.CXXFLAGS.append('-Wno-missing-noreturn') - self.CXXFLAGS.append('-Wno-disabled-macro-expansion') - self.CXXFLAGS.append('-Wno-unused-parameter') - self.CXXFLAGS.append('-Wno-c++98-compat') - self.CXXFLAGS.append('-fno-limit-debug-info') - #self.CXXFLAGS.append('-Wold-style-cast') - - system = self.get_stdout('uname', '-s') - - def option_no_pch(self, option=None, opt_str=None, value=None, parser=None): - self.log.debug('Saw option --no-pch') - - self.no_pch = True - - if '--enable-pch' in self.configure_args: - self.configure_args.remove('--enable-pch') - - if '-Wconversion' in self.configure_args: - self.CXXFLAGS.remove('-Wconversion') - #if '-Wold-style-cast' in self.configure_args: - # self.CXXFLAGS.remove('-Wold-style-cast') - - system = self.get_stdout('uname', '-s') - - if system == "Darwin": - self.envvars['CC'] = 'gcc' - self.envvars['CXX'] = 'g++' - self.envvars['LD'] = 'g++' - - def option_force(self, option=None, opt_str=None, value=None, parser=None): - self.log.debug('Saw option --force') - self.force = True - - def option_warn(self, option=None, opt_str=None, value=None, parser=None): - self.log.debug('Saw option --warn') - self.CXXFLAGS.append('-ansi') - self.CXXFLAGS.append('-pedantic') - self.CXXFLAGS.append('-pedantic-errors') - self.CXXFLAGS.append('-Wall') - self.CXXFLAGS.append('-Winvalid-pch') - self.CXXFLAGS.append('-Wextra') - self.CXXFLAGS.append('-Wcast-align') - self.CXXFLAGS.append('-Wcast-qual') - self.CXXFLAGS.append('-Wfloat-equal') - self.CXXFLAGS.append('-Wmissing-field-initializers') - self.CXXFLAGS.append('-Wno-endif-labels') - self.CXXFLAGS.append('-Woverloaded-virtual') - self.CXXFLAGS.append('-Wsign-compare') - self.CXXFLAGS.append('-Wsign-promo') - #self.CXXFLAGS.append('-Wstrict-null-sentinel') - self.CXXFLAGS.append('-Wwrite-strings') - self.CXXFLAGS.append('-Wno-old-style-cast') - self.CXXFLAGS.append('-Wno-deprecated') - self.CXXFLAGS.append('-Wno-strict-aliasing') - self.CXXFLAGS.append('-Werror') - - def option_pic(self, option=None, opt_str=None, value=None, parser=None): - self.log.debug('Saw option --pic') - self.CXXFLAGS.append('-fPIC') - - def option_make(self, option=None, opt_str=None, value=None, parser=None): - self.log.debug('Saw option --make') - self.make_command = value - - def option_output(self, option=None, opt_str=None, value=None, parser=None): - self.log.debug('Saw option --output') - self.build_dir = value - - def option_prefix(self, option=None, opt_str=None, value=None, parser=None): - self.log.debug('Saw option --prefix') - self.prefix_dir = value - - def option_products(self, option=None, opt_str=None, value=None, parser=None): - self.log.debug('Saw option --products') - self.products_dir = value - def option_local(self, option=None, opt_str=None, value=None, parser=None): self.log.debug('Saw option --local') self.build_dir = self.source_dir - def option_trees(self, option=None, opt_str=None, value=None, parser=None): - self.log.debug('Saw option --trees') - self.build_dir = None - - def option_release(self, option=None, opt_str=None, value=None, parser=None): - self.log.debug('Saw option --release') - if '--disable-shared' in self.configure_args: - self.configure_args.remove('--disable-shared') - self.configure_args.append('--disable-dependency-tracking') - def option_help(self, option=None, opt_str=None, value=None, parser=None): self.phase_help() @@ -1261,75 +717,31 @@ class PrepareBuild(CommandLineApp): ######################################################################### def setup_flavor_default(self): - if self.darwin_gcc: - self.option_no_pch() + pass def setup_flavor_debug(self): - self.configure_args.append('--enable-debug') - - if self.options.gcc45 or self.options.gcc46 or \ - self.options.gcc47 or self.options.gcc48: - self.CXXFLAGS.append('-g2') - self.CXXFLAGS.append('-ggdb') - self.LDFLAGS.append('-g2') - self.LDFLAGS.append('-ggdb') - else: - self.CXXFLAGS.append('-g') - self.LDFLAGS.append('-g') + self.configure_args.append('-DBUILD_DEBUG=1') def setup_flavor_opt(self): - self.CPPFLAGS.append('-DNDEBUG=1') - for i in ['-O3']: - self.CXXFLAGS.append(i) - self.CFLAGS.append(i) - self.LDFLAGS.append(i) - #if self.options.gcc45: - # for i in ['-flto']: - # self.CXXFLAGS.append(i) - # self.CFLAGS.append(i) - # self.LDFLAGS.append(i) - #if self.options.gcc46: - # for i in ['-flto']: - # self.CXXFLAGS.append(i) - # self.CFLAGS.append(i) - # self.LDFLAGS.append(i) - #if self.options.gcc47: - # for i in ['-flto']: - # self.CXXFLAGS.append(i) - # self.CFLAGS.append(i) - # self.LDFLAGS.append(i) - if self.darwin_gcc: - self.option_no_pch() - if '--disable-shared' in self.configure_args: - self.configure_args.remove('--disable-shared') - self.configure_args.append('--disable-dependency-tracking') - if self.options.universal: - for i in ['-fast']: - self.CXXFLAGS.append(i) - self.CFLAGS.append(i) - self.LDFLAGS.append(i) - for i in ['-arch', 'i386', '-arch', 'x86_64']: - self.CXXFLAGS.append(i) - self.CFLAGS.append(i) - self.LDFLAGS.append(i) + self.configure_args.append('-DNO_ASSERTS=1') def setup_flavor_gcov(self): - # NDEBUG is set so that branch coverage ignores the never-taken else - # branch inside assert statements. - self.CPPFLAGS.append('-DNDEBUG=1') - self.CXXFLAGS.append('-g') + # NO_ASSERTS is set so that branch coverage ignores the never-taken + # else branch inside assert statements. + self.configure_args.append('-DBUILD_DEBUG=1') + self.configure_args.append('-DNO_ASSERTS=1') + self.CXXFLAGS.append('-fprofile-arcs') self.CXXFLAGS.append('-ftest-coverage') - self.LDFLAGS.append('-g') def setup_flavor_gprof(self): - self.CXXFLAGS.append('-g') + self.configure_args.append('-DBUILD_DEBUG=1') + self.CXXFLAGS.append('-pg') - self.LDFLAGS.append('-g') self.LDFLAGS.append('-pg') ######################################################################### - # Configure build tree using autoconf # + # Configure build tree using CMake # ######################################################################### def configure_environment(self): @@ -1340,42 +752,25 @@ class PrepareBuild(CommandLineApp): if value: environ[key] = value - environ['PATH'] = ('%s/bin:%s' % - (environ['PYTHON_HOME'], environ['PATH'])) - if self.build_directory() == self.source_dir: - conf_args = ['sh', 'configure'] + conf_args = ['cmake'] else: - conf_args = ['sh', join(self.source_dir, 'configure'), - '--srcdir', self.source_dir] + conf_args = ['cmake', self.source_dir] - for var in ('CC', 'CPPFLAGS', 'CFLAGS', 'CXX', 'CXXFLAGS', - 'LD', 'LDFLAGS'): + for var in ('CXX', 'CXXFLAGS', 'LDFLAGS'): if self.envvars.has_key(var) and self.envvars[var] and \ (var.endswith('FLAGS') or exists(self.envvars[var])): conf_args.append('%s=%s' % (var, self.envvars[var])) - if self.boost_info.get_suffix(): - conf_args.append('--with-boost-suffix=%s' % - self.boost_info.get_suffix()) + if self.options.boost_suffix: + conf_args.append('-DBoost_COMPILER=%s' % + self.options.boost_suffix) if self.prefix_directory(): - conf_args.append('--prefix=%s' % self.prefix_directory()) + conf_args.append('-DCMAKE_PREFIX_PATH=%s' % self.prefix_directory()) return (environ, conf_args + self.configure_args) - def need_to_run_configure(self): - Makefile = join(self.build_directory(), 'Makefile') - if self.force: - return 'because it was forced' - elif not exists(Makefile): - return 'because Makefile does not exist' - elif self.isnewer(join(self.source_dir, 'configure'), Makefile): - return 'because configure is newer than Makefile' - elif self.isnewer(join(self.source_dir, 'Makefile.in'), Makefile): - return 'because Makefile.in is newer than Makefile' - return False - def phase_configure(self, *args): self.log.info('Executing phase: configure') @@ -1389,9 +784,8 @@ class PrepareBuild(CommandLineApp): try: os.chdir(build_dir) - reason = self.need_to_run_configure() - if reason: - self.log.info('./configure must be run ' + reason) + need_to_config = not isfile('Makefile') + if need_to_config: self.log.debug('Source => ' + self.source_dir) self.log.debug('Build => ' + build_dir) self.log.debug('configure env => ' + str(environ)) @@ -1405,11 +799,6 @@ class PrepareBuild(CommandLineApp): elif retcode != 0: self.log.error("Execution failed: " + string.join(conf_args, ' ')) sys.exit(1) - - # Wipe the pre-compiled header, if there is one - pch = join(self.build_directory(), 'system.hh.gch') - if exists(pch): - os.remove(pch) else: self.log.debug('configure does not need to be run') @@ -1419,7 +808,6 @@ class PrepareBuild(CommandLineApp): def phase_config(self, *args): self.log.info('Executing phase: config') self.phase_submodule() - self.phase_autoconf() self.phase_configure(*args) if self.should_clean: self.phase_clean() @@ -1442,9 +830,7 @@ class PrepareBuild(CommandLineApp): if self.options.jobs > 1 and self.current_flavor != 'gcov': make_args.append('-j%d' % self.options.jobs) - make_args.append('JOBS=%d' % self.options.jobs) - - make_args.append('FLAVOR=%s' % self.current_flavor) + make_args.append('ARGS=-j%d' % self.options.jobs) self.log.debug('Configure arguments => ' + str(config_args)) self.log.debug('Makefile arguments => ' + str(make_args)) @@ -1457,15 +843,18 @@ class PrepareBuild(CommandLineApp): self.log.debug('Changing directory to ' + build_dir) os.chdir(build_dir) - self.execute(*([self.make_command or 'make'] + - make_args)) + self.execute(*(['make'] + make_args)) finally: os.chdir(self.source_dir) + def phase_check(self, *args): + self.log.info('Executing phase: update') + self.phase_make(*(['check'] + list(args))) + def phase_update(self, *args): self.log.info('Executing phase: update') self.phase_pull() - self.phase_make(*args) + self.phase_check(*args) ######################################################################### # Build directory cleaning phases # @@ -1475,83 +864,12 @@ class PrepareBuild(CommandLineApp): self.log.info('Executing phase: clean') self.phase_make('clean') - def phase_distclean(self, *args): - self.log.info('Executing phase: distclean') - self.phase_make('distclean') - def phase_gitclean(self, *args): self.log.info('Executing phase: gitclean') if self.git_working_tree(): self.execute('git', 'clean', '-dfx') ######################################################################### - # Packaging phases # - ######################################################################### - - def translate_file(self, path, dest): - dest_file = join(dest, basename(path)) - - self.log.debug("Translating file %s -> %s" % (path, dest_file)) - - if not exists(dest_file): - shutil.copyfile(path, dest_file) - os.chmod(dest_file, 0755) - - for line in self.get_stdout('otool', '-L', dest_file).split('\n'): - match = re.search('/opt/local/lib/(.+?)\.dylib', line) - if not match: - continue - - lib = match.group(0) - base = basename(lib) - - if lib != path: - self.translate_file(lib, dest) - - self.execute('install_name_tool', '-change', lib, - '@loader_path/' + base, dest_file) - - def phase_bindmg(self, *args): - self.log.info('Executing phase: bindmg') - - self.phase_make() - - binary = join(self.build_directory(), 'ledger') - if not exists(binary): - self.log.error('Failed to build Ledger: ' + binary) - sys.exit(1) - - cwd = os.getcwd() - tempdir = tempfile.mkdtemp() - try: - name = 'ledger-%s' % self.current_version() - dest = join(tempdir, name) - - os.makedirs(dest) - self.translate_file(binary, dest) - - self.execute('hdiutil', 'create', '-srcfolder', dest, - '-ov', join(cwd, name + '.dmg')) - finally: - os.chdir(cwd) - shutil.rmtree(tempdir) - - def phase_upload(self, *args): - self.log.info('Executing phase: upload') - - self.phase_bindmg() - - dmg = 'ledger-%s.dmg' % self.current_version() - self.execute('zip', '%s.zip' % dmg, dmg) - dmg = '%s.zip' % dmg - - self.execute('ssh', 'jw', 'rm', '-f', '/srv/ftp/pub/ledger/ledger-*.dmg.zip') - self.execute('scp', dmg, 'jw:/srv/ftp/pub/ledger') - self.execute('ssh', 'jw', - '(cd /srv/ftp/pub/ledger; ln -sf %s ledger-current.dmg.zip)' % - basename(dmg)) - - ######################################################################### # Other build phases # ######################################################################### @@ -1559,7 +877,6 @@ class PrepareBuild(CommandLineApp): self.initialize() # reset everything self.build_dir = None # use the build/ tree self.current_flavor = flavor - self.option_release() self.prefix_dir = None if reset and exists(self.build_directory()) and \ @@ -1572,31 +889,6 @@ class PrepareBuild(CommandLineApp): self.execute('chmod', '-R', 'u+w', self.build_directory()) self.execute('rm', '-fr', self.build_directory()) - def phase_distcheck(self, *args): - self.log.info('Executing phase: distcheck') - - self.configure_flavor('default', False) - - environ, conf_args = self.configure_environment() - - configure_args = [] - - skip_next = False - for arg in conf_args[2:]: # skip "sh configure" - if arg == '--srcdir': - skip_next = True - elif skip_next: - skip_next = False - else: - configure_args.append('"' + self.escape_string(arg) + '"') - - make_args = ['DISTCHECK_CONFIGURE_FLAGS=%s' % - string.join(configure_args, ' '), 'distcheck'] - - self.log.debug('make_args for distcheck => ' + str(make_args)) - - self.phase_make(*make_args) - def phase_rsync(self, *args): self.log.info('Executing phase: rsync') @@ -1604,13 +896,8 @@ class PrepareBuild(CommandLineApp): if self.options.python: proof_dir += "-python" - - if self.options.gcc47: - proof_dir += "-gcc47" - elif self.options.gcc48: - proof_dir += "-gcc48" - elif self.options.use_clang: - proof_dir += "-clang" + if self.options.compiler: + proof_dir += "-" + basename(self.options.compiler) source_copy_dir = join(self.ensure(self.products_directory()), proof_dir) @@ -1648,9 +935,6 @@ class PrepareBuild(CommandLineApp): self.phase_make('fullcheck') self.phase_make('docs') - self.log.info('=== Building final distcheck ===') - self.phase_distcheck() - def phase_makeall(self, reset=False, *args): self.log.info('Executing phase: makeall') @@ -1697,8 +981,6 @@ Next is the optional build PHASE, with 'config' being the default: clean Runs 'make clean' in the build directory config Configure the environment for building dependencies Automatically install all necessary build dependencies - distcheck Properly does 'make distcheck', carrying all flags - distclean Runs 'make distclean' in the build directory gitclean Runs 'git clean -dfx', which *really* cleans things help Displays this help text info Show information about the build environment @@ -1710,14 +992,10 @@ Next is the optional build PHASE, with 'config' being the default: There are many other build phases, though most are not of interest to the typical user: - aclocal Runs aclocal -I m4 - autoconf Prepare the autoconf subsystem - autogen Runs autogen.sh - configure Runs just ./configure + configure Runs just cmake do_all Runs makeall followed by proof gettext Initialize gettext support makeall Build every flavor there is - patch Patches the automake Makefile to be less verbose products Report the products directory path rsync Rsync a copy of the source tree into Products sloc Report total Source Lines Of Code diff --git a/dist/Portfile b/dist/Portfile deleted file mode 100644 index 3388c936..00000000 --- a/dist/Portfile +++ /dev/null @@ -1,88 +0,0 @@ -# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4 -# $Id$ - -PortSystem 1.0 - -name ledger-devel -version 3.0.0-20100615 -homepage http://www.newartisans.com/software/ledger.html -categories finance - -description A command-line, double-entry accounting tool. -long_description Ledger is a powerful, double-entry accounting system that \ - is accessed from the UNIX command-line. - -maintainers newartisans.com:johnw - -platforms darwin - -use_bzip2 yes -master_sites http://ftp.newartisans.com/pub/ledger/ -distname ledger-${version} -checksums md5 980e819c4cb68b8777849a44316e0edc \ - sha1 ff1b281ce6ddfeb5814ce59bd4d69b97ddb21f7e \ - rmd160 a40e64bf21c9c132619b0921dee0e12299e3938a - -depends_build port:automake \ - port:autoconf \ - port:libtool - -depends_lib port:gettext \ - port:gmp \ - port:mpfr \ - port:boost \ - port:libedit - -configure.args --with-extra-includes=${prefix}/include \ - --with-extra-libs=${prefix}/lib - -build.args DYLD_LIBRARY_PATH=${worksrcpath}/ledger/.libs - -destroot.args DESTDIR=${destroot}${prefix} \ - DYLD_LIBRARY_PATH=${worksrcpath}/ledger/.libs \ - docprefix=${destroot}/share/doc - -variant debug description {Enable debug mode} { - configure.args-append --enable-debug=yes -} - -variant icu description {Enable full Unicode support} { - if {[variant_isset python25]} { - depends_lib-delete port:boost+python25 - depends_lib-append port:boost+icu+python25 - } elsif {[variant_isset python26]} { - depends_lib-delete port:boost+python26 - depends_lib-append port:boost+icu+python26 - } else { - depends_lib-delete port:boost - depends_lib-append port:boost+icu - } -} - -variant python25 description {build python 2.5 support} conflicts python26 { - set pyversion 2.5 - if {[variant_isset icu]} { - depends_lib-delete port:boost+icu - depends_lib-append port:boost+icu+python25 - } else { - depends_lib-delete port:boost - depends_lib-append port:boost+python25 - } - depends_lib-append port:python25 -} - -variant python26 description {build python 2.6 support} conflicts python25 { - set pyversion 2.6 - if {[variant_isset icu]} { - depends_lib-delete port:boost+icu - depends_lib-append port:boost+icu+python26 - } else { - depends_lib-delete port:boost - depends_lib-append port:boost+python26 - } - depends_lib-append port:python26 -} - -livecheck.check regex -livecheck.url [lindex ${master_sites} 0] -livecheck.regex ${name}-(\[0-9.-\]+)\\.tar diff --git a/dist/pkg/ledger.pmdoc/01libgmp-contents.xml b/dist/pkg/ledger.pmdoc/01libgmp-contents.xml deleted file mode 100644 index 0a430288..00000000 --- a/dist/pkg/ledger.pmdoc/01libgmp-contents.xml +++ /dev/null @@ -1 +0,0 @@ -<pkg-contents spec="1.12"><f n="libgmp.3.4.2.dylib" o="root" g="admin" p="33261" pt="/opt/local/lib/libgmp.3.4.2.dylib" m="false" t="file"/></pkg-contents>
\ No newline at end of file diff --git a/dist/pkg/ledger.pmdoc/01libgmp.xml b/dist/pkg/ledger.pmdoc/01libgmp.xml deleted file mode 100644 index 23719cb0..00000000 --- a/dist/pkg/ledger.pmdoc/01libgmp.xml +++ /dev/null @@ -1 +0,0 @@ -<pkgref spec="1.12" uuid="20CB3809-D9CA-4DC8-9D1C-7AF1A63BB48A"><config><identifier>com.newartisans.ledger261.libgmp342.pkg</identifier><version>1</version><description/><post-install type="none"/><requireAuthorization/><installFrom>/opt/local/lib/libgmp.3.4.2.dylib</installFrom><flags><followSymbolicLinks/></flags><packageStore type="internal"/><mod>parent</mod><mod>installTo.path</mod><mod>installTo</mod></config><contents><file-list>01libgmp-contents.xml</file-list><filter>/CVS$</filter><filter>/\.svn$</filter><filter>/\.cvsignore$</filter><filter>/\.cvspass$</filter><filter>/\.DS_Store$</filter></contents></pkgref>
\ No newline at end of file diff --git a/dist/pkg/ledger.pmdoc/02libintl-contents.xml b/dist/pkg/ledger.pmdoc/02libintl-contents.xml deleted file mode 100644 index c48f3143..00000000 --- a/dist/pkg/ledger.pmdoc/02libintl-contents.xml +++ /dev/null @@ -1 +0,0 @@ -<pkg-contents spec="1.12"><f n="libintl.8.0.2.dylib" o="root" g="admin" p="33188" pt="/opt/local/lib/libintl.8.0.2.dylib" m="false" t="file"/></pkg-contents>
\ No newline at end of file diff --git a/dist/pkg/ledger.pmdoc/02libintl.xml b/dist/pkg/ledger.pmdoc/02libintl.xml deleted file mode 100644 index 07805206..00000000 --- a/dist/pkg/ledger.pmdoc/02libintl.xml +++ /dev/null @@ -1 +0,0 @@ -<pkgref spec="1.12" uuid="45E37CF4-128B-4810-9BC8-BDE24D0C2D31"><config><identifier>com.newartisans.ledger261.libintl802.pkg</identifier><version>1</version><description/><post-install type="none"/><requireAuthorization/><installFrom>/opt/local/lib/libintl.8.0.2.dylib</installFrom><flags><followSymbolicLinks/></flags><packageStore type="internal"/><mod>parent</mod><mod>installTo.path</mod><mod>installTo</mod></config><contents><file-list>02libintl-contents.xml</file-list><filter>/CVS$</filter><filter>/\.svn$</filter><filter>/\.cvsignore$</filter><filter>/\.cvspass$</filter><filter>/\.DS_Store$</filter></contents></pkgref>
\ No newline at end of file diff --git a/dist/pkg/ledger.pmdoc/03libosp-contents.xml b/dist/pkg/ledger.pmdoc/03libosp-contents.xml deleted file mode 100644 index f620ae64..00000000 --- a/dist/pkg/ledger.pmdoc/03libosp-contents.xml +++ /dev/null @@ -1 +0,0 @@ -<pkg-contents spec="1.12"><f n="libosp.5.0.0.dylib" o="root" g="admin" p="33261" pt="/opt/local/lib/libosp.5.0.0.dylib" m="false" t="file"/></pkg-contents>
\ No newline at end of file diff --git a/dist/pkg/ledger.pmdoc/03libosp.xml b/dist/pkg/ledger.pmdoc/03libosp.xml deleted file mode 100644 index 0c355399..00000000 --- a/dist/pkg/ledger.pmdoc/03libosp.xml +++ /dev/null @@ -1 +0,0 @@ -<pkgref spec="1.12" uuid="68EFD971-45E8-41F0-A238-48A0D7DB919A"><config><identifier>com.newartisans.ledger261.libosp500.pkg</identifier><version>1</version><description/><post-install type="none"/><requireAuthorization/><installFrom>/opt/local/lib/libosp.5.0.0.dylib</installFrom><flags><followSymbolicLinks/></flags><packageStore type="internal"/><mod>parent</mod><mod>installTo.path</mod><mod>installTo</mod></config><contents><file-list>03libosp-contents.xml</file-list><filter>/CVS$</filter><filter>/\.svn$</filter><filter>/\.cvsignore$</filter><filter>/\.cvspass$</filter><filter>/\.DS_Store$</filter></contents></pkgref>
\ No newline at end of file diff --git a/dist/pkg/ledger.pmdoc/04libofx-contents.xml b/dist/pkg/ledger.pmdoc/04libofx-contents.xml deleted file mode 100644 index 9fd6b67f..00000000 --- a/dist/pkg/ledger.pmdoc/04libofx-contents.xml +++ /dev/null @@ -1 +0,0 @@ -<pkg-contents spec="1.12"><f n="libofx.3.0.1.dylib" o="root" g="admin" p="33261" pt="/opt/local/lib/libofx.3.0.1.dylib" m="false" t="file"/></pkg-contents>
\ No newline at end of file diff --git a/dist/pkg/ledger.pmdoc/04libofx.xml b/dist/pkg/ledger.pmdoc/04libofx.xml deleted file mode 100644 index 44ac60c7..00000000 --- a/dist/pkg/ledger.pmdoc/04libofx.xml +++ /dev/null @@ -1 +0,0 @@ -<pkgref spec="1.12" uuid="25459941-C854-492F-BBCB-AB386E085408"><config><identifier>com.newartisans.ledger261.libofx301.pkg</identifier><version>1</version><description/><post-install type="none"/><requireAuthorization/><installFrom>/opt/local/lib/libofx.3.0.1.dylib</installFrom><flags><followSymbolicLinks/></flags><packageStore type="internal"/><mod>parent</mod><mod>installTo.path</mod><mod>installTo</mod></config><contents><file-list>04libofx-contents.xml</file-list><filter>/CVS$</filter><filter>/\.svn$</filter><filter>/\.cvsignore$</filter><filter>/\.cvspass$</filter><filter>/\.DS_Store$</filter></contents></pkgref>
\ No newline at end of file diff --git a/dist/pkg/ledger.pmdoc/05libpcre-contents.xml b/dist/pkg/ledger.pmdoc/05libpcre-contents.xml deleted file mode 100644 index 244c7d22..00000000 --- a/dist/pkg/ledger.pmdoc/05libpcre-contents.xml +++ /dev/null @@ -1 +0,0 @@ -<pkg-contents spec="1.12"><f n="libpcre.0.0.1.dylib" o="root" g="admin" p="33261" pt="/opt/local/lib/libpcre.0.0.1.dylib" m="false" t="file"/></pkg-contents>
\ No newline at end of file diff --git a/dist/pkg/ledger.pmdoc/05libpcre.xml b/dist/pkg/ledger.pmdoc/05libpcre.xml deleted file mode 100644 index 28d7188b..00000000 --- a/dist/pkg/ledger.pmdoc/05libpcre.xml +++ /dev/null @@ -1 +0,0 @@ -<pkgref spec="1.12" uuid="C507CC8C-58DE-41FF-ACAF-393176088653"><config><identifier>com.newartisans.ledger261.libpcre001.pkg</identifier><version>1</version><description/><post-install type="none"/><requireAuthorization/><installFrom>/opt/local/lib/libpcre.0.0.1.dylib</installFrom><flags><followSymbolicLinks/></flags><packageStore type="internal"/><mod>parent</mod><mod>installTo.path</mod><mod>installTo</mod></config><contents><file-list>05libpcre-contents.xml</file-list><filter>/CVS$</filter><filter>/\.svn$</filter><filter>/\.cvsignore$</filter><filter>/\.cvspass$</filter><filter>/\.DS_Store$</filter></contents></pkgref>
\ No newline at end of file diff --git a/dist/pkg/ledger.pmdoc/06ledger-contents.xml b/dist/pkg/ledger.pmdoc/06ledger-contents.xml deleted file mode 100644 index 277b9294..00000000 --- a/dist/pkg/ledger.pmdoc/06ledger-contents.xml +++ /dev/null @@ -1 +0,0 @@ -<pkg-contents spec="1.12"><f n="ledger.pdf" o="johnw" g="501" p="33188" pt="/Users/johnw/Products/2.6.1/ledger.pdf" m="false" t="file"/></pkg-contents>
\ No newline at end of file diff --git a/dist/pkg/ledger.pmdoc/06ledger.xml b/dist/pkg/ledger.pmdoc/06ledger.xml deleted file mode 100644 index d90d9a33..00000000 --- a/dist/pkg/ledger.pmdoc/06ledger.xml +++ /dev/null @@ -1 +0,0 @@ -<pkgref spec="1.12" uuid="332F048F-7778-42FF-AABB-A519AC0CCEC5"><config><identifier>com.newartisans.ledger261.ledger.pkg</identifier><version>1</version><description/><post-install type="none"/><requireAuthorization/><installFrom>/Users/johnw/Products/2.6.1/ledger.pdf</installFrom><flags><followSymbolicLinks/></flags><packageStore type="internal"/><mod>parent</mod></config><contents><file-list>06ledger-contents.xml</file-list><filter>/CVS$</filter><filter>/\.svn$</filter><filter>/\.cvsignore$</filter><filter>/\.cvspass$</filter><filter>/\.DS_Store$</filter></contents></pkgref>
\ No newline at end of file diff --git a/dist/pkg/ledger.pmdoc/07ledger-contents.xml b/dist/pkg/ledger.pmdoc/07ledger-contents.xml deleted file mode 100644 index 8314ef4d..00000000 --- a/dist/pkg/ledger.pmdoc/07ledger-contents.xml +++ /dev/null @@ -1 +0,0 @@ -<pkg-contents spec="1.12"><f n="ledger.info" o="johnw" g="501" p="33188" pt="/Users/johnw/Projects/branches/2.6.1/ledger.info" m="false" t="file"/></pkg-contents>
\ No newline at end of file diff --git a/dist/pkg/ledger.pmdoc/07ledger.xml b/dist/pkg/ledger.pmdoc/07ledger.xml deleted file mode 100644 index 582ed128..00000000 --- a/dist/pkg/ledger.pmdoc/07ledger.xml +++ /dev/null @@ -1 +0,0 @@ -<pkgref spec="1.12" uuid="AF6A8ADD-2251-4548-B762-B0FFC7D664DE"><config><identifier>com.newartisans.ledger261.ledger-1.pkg</identifier><version>1</version><description/><post-install type="none"/><requireAuthorization/><installFrom>/Users/johnw/Projects/branches/2.6.1/ledger.info</installFrom><flags><followSymbolicLinks/></flags><packageStore type="internal"/><mod>parent</mod><mod>scripts.postinstall.path</mod><mod>installTo.path</mod><mod>installTo</mod></config><contents><file-list>07ledger-contents.xml</file-list><filter>/CVS$</filter><filter>/\.svn$</filter><filter>/\.cvsignore$</filter><filter>/\.cvspass$</filter><filter>/\.DS_Store$</filter></contents></pkgref>
\ No newline at end of file diff --git a/dist/pkg/ledger.pmdoc/08ledger-contents.xml b/dist/pkg/ledger.pmdoc/08ledger-contents.xml deleted file mode 100644 index 6adf8d2c..00000000 --- a/dist/pkg/ledger.pmdoc/08ledger-contents.xml +++ /dev/null @@ -1 +0,0 @@ -<pkg-contents spec="1.12"><f n="ledger.el" o="johnw" g="501" p="33188" pt="/Users/johnw/Projects/branches/2.6.1/ledger.el" m="false" t="file"/></pkg-contents>
\ No newline at end of file diff --git a/dist/pkg/ledger.pmdoc/08ledger.xml b/dist/pkg/ledger.pmdoc/08ledger.xml deleted file mode 100644 index 28489728..00000000 --- a/dist/pkg/ledger.pmdoc/08ledger.xml +++ /dev/null @@ -1 +0,0 @@ -<pkgref spec="1.12" uuid="3E76E43D-8A47-4CE2-B9C9-7F8BD8040222"><config><identifier>com.newartisans.ledger261.ledger-2.pkg</identifier><version>1</version><description/><post-install type="none"/><requireAuthorization/><installFrom>/Users/johnw/Projects/branches/2.6.1/ledger.el</installFrom><flags><followSymbolicLinks/></flags><packageStore type="internal"/><mod>parent</mod><mod>installTo.path</mod><mod>installTo</mod></config><contents><file-list>08ledger-contents.xml</file-list><filter>/CVS$</filter><filter>/\.svn$</filter><filter>/\.cvsignore$</filter><filter>/\.cvspass$</filter><filter>/\.DS_Store$</filter></contents></pkgref>
\ No newline at end of file diff --git a/dist/pkg/ledger.pmdoc/index.xml b/dist/pkg/ledger.pmdoc/index.xml deleted file mode 100644 index 0c8c8963..00000000 --- a/dist/pkg/ledger.pmdoc/index.xml +++ /dev/null @@ -1 +0,0 @@ -<pkmkdoc spec="1.12"><properties><title>Ledger 2.6.1</title><build>/Users/johnw/Projects/ledger/Ledger 2.6.1.pkg</build><organization>com.newartisans</organization><userSees ui="easy"/><min-target os="3"/><domain system="true"/></properties><distribution><versions min-spec="1.000000"/><scripts></scripts></distribution><description>Ledger is a command-line, double-entry accounting system.</description><contents><choice title="libgmp" id="gmp" description="The GNP multi-precision math library. " starts_selected="true" starts_enabled="true" starts_hidden="false"><customLoc mod="true">/usr/lib</customLoc><pkgref id="com.newartisans.ledger261.libgmp342.pkg"/></choice><choice title="libintl.8.0.2" id="choice9" starts_selected="true" starts_enabled="true" starts_hidden="false"><pkgref id="com.newartisans.ledger261.libintl802.pkg"/></choice><choice title="libosp.5.0.0" id="choice10" starts_selected="true" starts_enabled="true" starts_hidden="false"><pkgref id="com.newartisans.ledger261.libosp500.pkg"/></choice><choice title="libofx.3.0.1" id="choice11" starts_selected="true" starts_enabled="true" starts_hidden="false"><pkgref id="com.newartisans.ledger261.libofx301.pkg"/></choice><choice title="libpcre.0.0.1" id="choice12" starts_selected="true" starts_enabled="true" starts_hidden="false"><pkgref id="com.newartisans.ledger261.libpcre001.pkg"/></choice><choice title="ledger" id="choice13" starts_selected="true" starts_enabled="true" starts_hidden="false"><pkgref id="com.newartisans.ledger261.ledger.pkg"/><pkgref id="com.newartisans.ledger261.ledger-1.pkg"/></choice><choice title="ledger" id="choice14" starts_selected="true" starts_enabled="true" starts_hidden="false"><pkgref id="com.newartisans.ledger261.ledger-2.pkg"/></choice></contents><resources bg-scale="none" bg-align="topleft"><locale lang="en"><resource relative="true" mod="true" type="license">LICENSE</resource><resource relative="true" mod="true" type="readme">README</resource></locale></resources><requirements><requirement id="sosv" operator="ge" value="'10.5.0'"/></requirements><flags/><item type="file">01libgmp.xml</item><item type="file">02libintl.xml</item><item type="file">03libosp.xml</item><item type="file">04libofx.xml</item><item type="file">05libpcre.xml</item><item type="file">06ledger.xml</item><item type="file">07ledger.xml</item><item type="file">08ledger.xml</item><mod>properties.customizeOption</mod><mod>properties.userDomain</mod><mod>properties.title</mod><mod>description</mod><mod>properties.anywhereDomain</mod><mod>properties.systemDomain</mod></pkmkdoc>
\ No newline at end of file diff --git a/dist/pkg/post-install.sh b/dist/pkg/post-install.sh deleted file mode 100755 index 158ca7c2..00000000 --- a/dist/pkg/post-install.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -ln -sf /usr/lib/libexpat.1.5.2.dylib /usr/lib/libexpat.1.dylib -ln -sf /usr/lib/libexpat.1.5.2.dylib /usr/lib/libexpat.dylib - -ln -sf /usr/lib/libgmp.3.4.2.dylib /usr/lib/libgmp.3.dylib -ln -sf /usr/lib/libgmp.3.4.2.dylib /usr/lib/libgmp.dylib - diff --git a/dist/win/installer/Calculator.png b/dist/win/installer/Calculator.png Binary files differdeleted file mode 100644 index cf9c87c7..00000000 --- a/dist/win/installer/Calculator.png +++ /dev/null diff --git a/dist/win/installer/Calculator_16x16.ico b/dist/win/installer/Calculator_16x16.ico Binary files differdeleted file mode 100644 index 59a6ba8a..00000000 --- a/dist/win/installer/Calculator_16x16.ico +++ /dev/null diff --git a/dist/win/installer/build.bat b/dist/win/installer/build.bat deleted file mode 100644 index 1f3b69ff..00000000 --- a/dist/win/installer/build.bat +++ /dev/null @@ -1,28 +0,0 @@ -@echo off - -rem Call the script that will read and parse version.m4, and store the version -rem number in the ledger_version_nr environment variable. -call ..\vc9\extract_version_numbers.bat -del config.h -rem Ledgers uses x.y.z-date format, but MSI needs x.y.z.b numbering. Can be -rem solved with simple string replace. -set ledger_version_nr=%ledger_version_nr:-=.% - -rmdir /S /Q content -mkdir content -rem Now, gather all the files we need in a directory -copy ..\vc9\Release\ledger.exe content -copy ..\..\..\doc\ledger.pdf content -copy ..\..\..\doc\LICENSE.rtf content -copy Calculator_16x16.ico content -copy ledger.wxs content - -cd content -rem Finally, call the WiX compiler & linker -"%WIX%\bin\candle.exe" ledger.wxs -"%WIX%\bin\light.exe" -ext WixUIExtension ledger.wixobj - -rem Hopefully everything went well, copy the result back -copy ledger.msi ..\ledger-%ledger_version_nr%.msi - -cd .. diff --git a/dist/win/installer/ledger.wxs b/dist/win/installer/ledger.wxs deleted file mode 100644 index 711c9477..00000000 --- a/dist/win/installer/ledger.wxs +++ /dev/null @@ -1,63 +0,0 @@ -<?xml version='1.0' encoding='windows-1252'?> -<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'> - <Product Name='Ledger' Id='7976E26F-7353-4838-A524-2465619E8AE0' UpgradeCode='F9E282EC-EC89-482c-9214-8F03661414A2' - Language='1033' Codepage='1252' Version='$(env.ledger_version_nr)' Manufacturer='John Wiegley'> - <Package Id='*' Keywords='Installer' Description="Ledger $(env.ledger_version_nr) Installer" - Comments='Double-entry accounting system with a command-line reporting interface.' Manufacturer='John Wiegley' - InstallerVersion='100' Languages='1033' Compressed='yes' SummaryCodepage='1252' /> - - <Media Id='1' Cabinet='ledger.cab' EmbedCab='yes' DiskPrompt='CD-ROM #1' /> - <Property Id='DiskPrompt' Value="Ledger $(env.ledger_version_nr) Installation [1]" /> - <Directory Id='TARGETDIR' Name='SourceDir'> - <Directory Id='ProgramFilesFolder' Name='PFiles'> - <Directory Id='INSTALLDIR' Name='Ledger 3'> - <Component Id='MainExecutable' Guid='53D87CDD-FD2F-414f-BB84-807F5E31BC4B'> - <File Id='LedgerEXE' Name='ledger.exe' DiskId='1' Source='ledger.exe' KeyPath='yes'> - <!--Shortcut Id="startmenuFoobar10" Directory="ProgramMenuDir" Name="Foobar 1.0" - WorkingDirectory='INSTALLDIR' Icon="Foobar10.exe" IconIndex="0" Advertise="yes" /--> - <!--Shortcut Id="desktopFoobar10" Directory="DesktopFolder" Name="Foobar 1.0" - WorkingDirectory='INSTALLDIR' Icon="Foobar10.exe" IconIndex="0" Advertise="yes" /--> - </File> - </Component> - <!--Component Id='HelperLibrary' Guid='YOURGUID-6BE3-460D-A14F-75658D16550B'> - <File Id='HelperDLL' Name='Helper.dll' DiskId='1' Source='Helper.dll' KeyPath='yes' /> - </Component--> - <Component Id='Manual' Guid='86878FFD-860A-44d1-9FEB-B1CB2B551E38'> - <File Id='Manual' Name='ledger.pdf' DiskId='1' Source='ledger.pdf' KeyPath='yes'> - <Shortcut Id='startmenuManual' Directory='ProgramMenuDir' Name='Ledger manual' Advertise='yes' /> - </File> - </Component> - </Directory> - </Directory> - - <Directory Id="ProgramMenuFolder" Name="Programs"> - <Directory Id="ProgramMenuDir" Name="Ledger 3"> - <Component Id="ProgramMenuDir" Guid="E9BBD4AA-A0CB-41db-9870-795728956198"> - <RemoveFolder Id='ProgramMenuDir' On='uninstall' /> - <RegistryValue Root='HKCU' Key='Software\Ledger' Type='string' Value='' KeyPath='yes' /> - </Component> - </Directory> - </Directory> - </Directory> - <Feature Id='Complete' Level='1' Title='Ledger $(env.ledger_version_nr)' Description='The complete package.' Display='expand' ConfigurableDirectory='INSTALLDIR'> - <ComponentRef Id='MainExecutable' /> - <ComponentRef Id='Manual' /> - <ComponentRef Id='ProgramMenuDir' /> - </Feature> - <!-- http://techupcoming.com/userinterfaceiconscom-download-high-quality-icons-for-free/ --> - <Icon Id="Ledger.exe" SourceFile="Calculator_16x16.ico" /> - <Property Id="ARPPRODUCTICON" Value="Ledger.exe" /> - <Property Id="ALLUSERS" Value="1"/> - - <UIRef Id='WixUI_Minimal' /> - <UIRef Id='WixUI_ErrorProgressText' /> - - <WixVariable Id="WixUILicenseRtf" Value="LICENSE.rtf" /> - <!--WixVariable Id="WixUIBannerBmp" Value="path\banner.bmp" /> - <WixVariable Id="WixUIDialogBmp" Value="path\dialog.bmp" /> - <WixVariable Id="WixUIExclamationIco" Value="path\exclamation.ico" /> - <WixVariable Id="WixUIInfoIco" Value="path\information.ico" /> - <WixVariable Id="WixUINewIco" Value="path\new.ico" /> - <WixVariable Id="WixUIUpIco" Value="path\up.ico" /--> - </Product> -</Wix> diff --git a/dist/win/vc9/extract_version_numbers.bat b/dist/win/vc9/extract_version_numbers.bat deleted file mode 100644 index 71a339cd..00000000 --- a/dist/win/vc9/extract_version_numbers.bat +++ /dev/null @@ -1,7 +0,0 @@ -set target_file=config.h -set /p version_file_contents=<..\..\..\version.m4 -set ledger_version_nr=%version_file_contents:m4_define([VERSION_NUMBER], [=% -set ledger_version_nr=%ledger_version_nr:])=% -echo #pragma once> %target_file% -echo #define PACKAGE_VERSION "%ledger_version_nr%">> %target_file% -echo #define VERSION "%ledger_version_nr%">> %target_file% diff --git a/dist/win/vc9/ledger.sln b/dist/win/vc9/ledger.sln deleted file mode 100644 index a713475c..00000000 --- a/dist/win/vc9/ledger.sln +++ /dev/null @@ -1,93 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ledger", "ledger.vcproj", "{33A6F094-A973-4FB6-9DED-F4F0568359E1}" - ProjectSection(ProjectDependencies) = postProject - {4AF4FD03-C169-456A-966A-081DE6BB71C7} = {4AF4FD03-C169-456A-966A-081DE6BB71C7} - {96DA1C71-3895-49FA-A4F1-2775C650AF3D} = {96DA1C71-3895-49FA-A4F1-2775C650AF3D} - EndProjectSection -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{36984A95-E409-4254-9018-F65C78A32000}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gen-bases", "..\..\..\lib\win\mpir\build.vc9\gen-bases\gen-bases.vcproj", "{2297FA81-6D9D-4DC3-BA42-04E93F397047}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gen-fac_ui", "..\..\..\lib\win\mpir\build.vc9\gen-fac_ui\gen-fac_ui.vcproj", "{001E0D42-4AF4-44B8-A8B2-3CD46D537DBE}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gen-fib", "..\..\..\lib\win\mpir\build.vc9\gen-fib\gen-fib.vcproj", "{D3C6D6B7-CD38-4D49-9BA7-1FBB35F77223}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gen-mpir", "..\..\..\lib\win\mpir\build.vc9\gen-mpir\gen-mpir.vcproj", "{EAFA3E0D-5B34-43A3-A08A-B5E3839BF66A}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lib_mpfr", "..\..\..\lib\win\mpfr\build.vc9\lib_mpfr\lib_mpfr.vcproj", "{96DA1C71-3895-49FA-A4F1-2775C650AF3D}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lib_mpir_cxx", "..\..\..\lib\win\mpir\build.vc9\lib_mpir_cxx\lib_mpir_cxx.vcproj", "{C82A62DB-DDB4-4072-832F-6DD841C6D80E}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lib_mpir_gc", "..\..\..\lib\win\mpir\build.vc9\lib_mpir_gc\lib_mpir_gc.vcproj", "{4AF4FD03-C169-456A-966A-081DE6BB71C7}" - ProjectSection(ProjectDependencies) = postProject - {EAFA3E0D-5B34-43A3-A08A-B5E3839BF66A} = {EAFA3E0D-5B34-43A3-A08A-B5E3839BF66A} - {001E0D42-4AF4-44B8-A8B2-3CD46D537DBE} = {001E0D42-4AF4-44B8-A8B2-3CD46D537DBE} - {2297FA81-6D9D-4DC3-BA42-04E93F397047} = {2297FA81-6D9D-4DC3-BA42-04E93F397047} - {D3C6D6B7-CD38-4D49-9BA7-1FBB35F77223} = {D3C6D6B7-CD38-4D49-9BA7-1FBB35F77223} - {C82A62DB-DDB4-4072-832F-6DD841C6D80E} = {C82A62DB-DDB4-4072-832F-6DD841C6D80E} - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {33A6F094-A973-4FB6-9DED-F4F0568359E1}.Debug|Win32.ActiveCfg = Debug|Win32 - {33A6F094-A973-4FB6-9DED-F4F0568359E1}.Debug|Win32.Build.0 = Debug|Win32 - {33A6F094-A973-4FB6-9DED-F4F0568359E1}.Debug|x64.ActiveCfg = Debug|Win32 - {33A6F094-A973-4FB6-9DED-F4F0568359E1}.Release|Win32.ActiveCfg = Release|Win32 - {33A6F094-A973-4FB6-9DED-F4F0568359E1}.Release|Win32.Build.0 = Release|Win32 - {33A6F094-A973-4FB6-9DED-F4F0568359E1}.Release|x64.ActiveCfg = Release|Win32 - {2297FA81-6D9D-4DC3-BA42-04E93F397047}.Debug|Win32.ActiveCfg = Debug|Win32 - {2297FA81-6D9D-4DC3-BA42-04E93F397047}.Debug|Win32.Build.0 = Debug|Win32 - {2297FA81-6D9D-4DC3-BA42-04E93F397047}.Debug|x64.ActiveCfg = Debug|Win32 - {2297FA81-6D9D-4DC3-BA42-04E93F397047}.Release|Win32.ActiveCfg = Release|Win32 - {2297FA81-6D9D-4DC3-BA42-04E93F397047}.Release|Win32.Build.0 = Release|Win32 - {2297FA81-6D9D-4DC3-BA42-04E93F397047}.Release|x64.ActiveCfg = Release|Win32 - {001E0D42-4AF4-44B8-A8B2-3CD46D537DBE}.Debug|Win32.ActiveCfg = Debug|Win32 - {001E0D42-4AF4-44B8-A8B2-3CD46D537DBE}.Debug|Win32.Build.0 = Debug|Win32 - {001E0D42-4AF4-44B8-A8B2-3CD46D537DBE}.Debug|x64.ActiveCfg = Debug|Win32 - {001E0D42-4AF4-44B8-A8B2-3CD46D537DBE}.Release|Win32.ActiveCfg = Release|Win32 - {001E0D42-4AF4-44B8-A8B2-3CD46D537DBE}.Release|Win32.Build.0 = Release|Win32 - {001E0D42-4AF4-44B8-A8B2-3CD46D537DBE}.Release|x64.ActiveCfg = Release|Win32 - {D3C6D6B7-CD38-4D49-9BA7-1FBB35F77223}.Debug|Win32.ActiveCfg = Debug|Win32 - {D3C6D6B7-CD38-4D49-9BA7-1FBB35F77223}.Debug|Win32.Build.0 = Debug|Win32 - {D3C6D6B7-CD38-4D49-9BA7-1FBB35F77223}.Debug|x64.ActiveCfg = Debug|Win32 - {D3C6D6B7-CD38-4D49-9BA7-1FBB35F77223}.Release|Win32.ActiveCfg = Release|Win32 - {D3C6D6B7-CD38-4D49-9BA7-1FBB35F77223}.Release|Win32.Build.0 = Release|Win32 - {D3C6D6B7-CD38-4D49-9BA7-1FBB35F77223}.Release|x64.ActiveCfg = Release|Win32 - {EAFA3E0D-5B34-43A3-A08A-B5E3839BF66A}.Debug|Win32.ActiveCfg = Debug|Win32 - {EAFA3E0D-5B34-43A3-A08A-B5E3839BF66A}.Debug|Win32.Build.0 = Debug|Win32 - {EAFA3E0D-5B34-43A3-A08A-B5E3839BF66A}.Debug|x64.ActiveCfg = Debug|Win32 - {EAFA3E0D-5B34-43A3-A08A-B5E3839BF66A}.Release|Win32.ActiveCfg = Release|Win32 - {EAFA3E0D-5B34-43A3-A08A-B5E3839BF66A}.Release|Win32.Build.0 = Release|Win32 - {EAFA3E0D-5B34-43A3-A08A-B5E3839BF66A}.Release|x64.ActiveCfg = Release|Win32 - {96DA1C71-3895-49FA-A4F1-2775C650AF3D}.Debug|Win32.ActiveCfg = Debug|Win32 - {96DA1C71-3895-49FA-A4F1-2775C650AF3D}.Debug|Win32.Build.0 = Debug|Win32 - {96DA1C71-3895-49FA-A4F1-2775C650AF3D}.Debug|x64.ActiveCfg = Debug|Win32 - {96DA1C71-3895-49FA-A4F1-2775C650AF3D}.Release|Win32.ActiveCfg = Release|Win32 - {96DA1C71-3895-49FA-A4F1-2775C650AF3D}.Release|Win32.Build.0 = Release|Win32 - {96DA1C71-3895-49FA-A4F1-2775C650AF3D}.Release|x64.ActiveCfg = Release|Win32 - {C82A62DB-DDB4-4072-832F-6DD841C6D80E}.Debug|Win32.ActiveCfg = Debug|Win32 - {C82A62DB-DDB4-4072-832F-6DD841C6D80E}.Debug|Win32.Build.0 = Debug|Win32 - {C82A62DB-DDB4-4072-832F-6DD841C6D80E}.Debug|x64.ActiveCfg = Debug|Win32 - {C82A62DB-DDB4-4072-832F-6DD841C6D80E}.Release|Win32.ActiveCfg = Release|Win32 - {C82A62DB-DDB4-4072-832F-6DD841C6D80E}.Release|Win32.Build.0 = Release|Win32 - {C82A62DB-DDB4-4072-832F-6DD841C6D80E}.Release|x64.ActiveCfg = Release|Win32 - {4AF4FD03-C169-456A-966A-081DE6BB71C7}.Debug|Win32.ActiveCfg = Debug|Win32 - {4AF4FD03-C169-456A-966A-081DE6BB71C7}.Debug|Win32.Build.0 = Debug|Win32 - {4AF4FD03-C169-456A-966A-081DE6BB71C7}.Debug|x64.ActiveCfg = Debug|Win32 - {4AF4FD03-C169-456A-966A-081DE6BB71C7}.Release|Win32.ActiveCfg = Release|Win32 - {4AF4FD03-C169-456A-966A-081DE6BB71C7}.Release|Win32.Build.0 = Release|Win32 - {4AF4FD03-C169-456A-966A-081DE6BB71C7}.Release|x64.ActiveCfg = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/dist/win/vc9/ledger.vcproj b/dist/win/vc9/ledger.vcproj deleted file mode 100755 index 628150a6..00000000 --- a/dist/win/vc9/ledger.vcproj +++ /dev/null @@ -1,619 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="9.00" - Name="ledger" - ProjectGUID="{33A6F094-A973-4FB6-9DED-F4F0568359E1}" - RootNamespace="ledger" - Keyword="Win32Proj" - TargetFrameworkVersion="196613" - > - <Platforms> - <Platform - Name="Win32" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - OutputDirectory="$(SolutionDir)$(ConfigurationName)" - IntermediateDirectory="$(ConfigurationName)" - ConfigurationType="1" - CharacterSet="2" - > - <Tool - Name="VCPreBuildEventTool" - CommandLine="$(ProjectDir)extract_version_numbers.bat
copy "$(ProjectDir)..\..\..\src\system.hh.in" "$(ProjectDir)system.hh"
" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - AdditionalIncludeDirectories=""$(ProjectDir)";"$(ProjectDir)\..\..\..\lib\utfcpp\source";"$(ProjectDir)\..\..\..\lib";"$(ProjectDir)\..\..\..\lib\win\mpir";"$(ProjectDir)\..\..\..\lib\win\mpfr"" - PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;USE_BOOST_FACETS" - MinimalRebuild="true" - BasicRuntimeChecks="3" - RuntimeLibrary="1" - UsePrecompiledHeader="0" - WarningLevel="3" - DebugInformationFormat="4" - DisableSpecificWarnings="4800" - ShowIncludes="false" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - LinkIncremental="2" - GenerateDebugInformation="true" - SubSystem="1" - TargetMachine="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - OutputDirectory="$(SolutionDir)$(ConfigurationName)" - IntermediateDirectory="$(ConfigurationName)" - ConfigurationType="1" - CharacterSet="1" - WholeProgramOptimization="1" - > - <Tool - Name="VCPreBuildEventTool" - CommandLine="$(ProjectDir)extract_version_numbers.bat
copy "$(ProjectDir)..\..\..\src\system.hh.in" "$(ProjectDir)system.hh"
" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="2" - EnableIntrinsicFunctions="true" - AdditionalIncludeDirectories=""$(ProjectDir)";"$(ProjectDir)\..\..\..\lib\utfcpp";"$(ProjectDir)\..\..\..\lib";"$(ProjectDir)\..\..\..\lib\win\mpir";"$(ProjectDir)\..\..\..\lib\win\mpfr"" - PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;USE_BOOST_FACETS" - RuntimeLibrary="1" - EnableFunctionLevelLinking="true" - UsePrecompiledHeader="0" - WarningLevel="3" - DebugInformationFormat="3" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - LinkIncremental="1" - GenerateDebugInformation="false" - SubSystem="1" - OptimizeReferences="2" - EnableCOMDATFolding="2" - TargetMachine="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="Source Files" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" - > - <File - RelativePath="..\..\..\src\account.cc" - > - </File> - <File - RelativePath="..\..\..\src\accum.cc" - > - </File> - <File - RelativePath="..\..\..\src\amount.cc" - > - </File> - <File - RelativePath="..\..\..\src\annotate.cc" - > - </File> - <File - RelativePath="..\..\..\src\archive.cc" - > - </File> - <File - RelativePath="..\..\..\src\balance.cc" - > - </File> - <File - RelativePath="..\..\..\src\chain.cc" - > - </File> - <File - RelativePath="..\..\..\src\commodity.cc" - > - </File> - <File - RelativePath="..\..\..\src\compare.cc" - > - </File> - <File - RelativePath="..\..\..\src\convert.cc" - > - </File> - <File - RelativePath="..\..\..\src\csv.cc" - > - </File> - <File - RelativePath="..\..\..\src\draft.cc" - > - </File> - <File - RelativePath="..\..\..\src\emacs.cc" - > - </File> - <File - RelativePath="..\..\..\src\error.cc" - > - </File> - <File - RelativePath="..\..\..\src\expr.cc" - > - </File> - <File - RelativePath="..\..\..\src\filters.cc" - > - </File> - <File - RelativePath="..\..\..\src\format.cc" - > - </File> - <File - RelativePath="..\..\..\src\generate.cc" - > - </File> - <File - RelativePath="..\..\..\src\global.cc" - > - </File> - <File - RelativePath="..\..\..\src\item.cc" - > - </File> - <File - RelativePath="..\..\..\src\iterators.cc" - > - </File> - <File - RelativePath="..\..\..\src\journal.cc" - > - </File> - <File - RelativePath="..\..\..\src\lookup.cc" - > - </File> - <File - RelativePath="..\..\..\src\main.cc" - > - </File> - <File - RelativePath="..\..\..\src\mask.cc" - > - </File> - <File - RelativePath="..\..\..\src\op.cc" - > - </File> - <File - RelativePath="..\..\..\src\option.cc" - > - </File> - <File - RelativePath="..\..\..\src\output.cc" - > - </File> - <File - RelativePath="..\..\..\src\parser.cc" - > - </File> - <File - RelativePath="..\..\..\src\pool.cc" - > - </File> - <File - RelativePath="..\..\..\src\post.cc" - > - </File> - <File - RelativePath="..\..\..\src\precmd.cc" - > - </File> - <File - RelativePath="..\..\..\src\predicate.cc" - > - </File> - <File - RelativePath="..\..\..\src\print.cc" - > - </File> - <File - RelativePath="..\..\..\src\query.cc" - > - </File> - <File - RelativePath="..\..\..\src\quotes.cc" - > - </File> - <File - RelativePath="..\..\..\src\report.cc" - > - </File> - <File - RelativePath="..\..\..\src\scope.cc" - > - </File> - <File - RelativePath="..\..\..\src\session.cc" - > - </File> - <File - RelativePath="..\..\..\lib\sha1.cpp" - > - </File> - <File - RelativePath="..\..\..\src\stats.cc" - > - </File> - <File - RelativePath="..\..\..\src\stream.cc" - > - </File> - <File - RelativePath="..\..\..\src\temps.cc" - > - </File> - <File - RelativePath="..\..\..\src\textual.cc" - > - </File> - <File - RelativePath="..\..\..\src\timelog.cc" - > - </File> - <File - RelativePath="..\..\..\src\times.cc" - > - </File> - <File - RelativePath="..\..\..\src\token.cc" - > - </File> - <File - RelativePath="..\..\..\src\utils.cc" - > - </File> - <File - RelativePath="..\..\..\src\value.cc" - > - </File> - <File - RelativePath="..\..\..\src\xact.cc" - > - </File> - <File - RelativePath="..\..\..\src\xml.cc" - > - </File> - </Filter> - <Filter - Name="Header Files" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - <File - RelativePath="..\..\..\src\account.h" - > - </File> - <File - RelativePath="..\..\..\src\accum.h" - > - </File> - <File - RelativePath="..\..\..\src\amount.h" - > - </File> - <File - RelativePath="..\..\..\src\annotate.h" - > - </File> - <File - RelativePath="..\..\..\src\archive.h" - > - </File> - <File - RelativePath="..\..\..\src\balance.h" - > - </File> - <File - RelativePath="..\..\..\src\chain.h" - > - </File> - <File - RelativePath="..\..\..\src\commodity.h" - > - </File> - <File - RelativePath="..\..\..\src\compare.h" - > - </File> - <File - RelativePath="..\..\..\src\convert.h" - > - </File> - <File - RelativePath="..\..\..\src\csv.h" - > - </File> - <File - RelativePath="..\..\..\src\draft.h" - > - </File> - <File - RelativePath="..\..\..\src\emacs.h" - > - </File> - <File - RelativePath="..\..\..\src\error.h" - > - </File> - <File - RelativePath="..\..\..\src\expr.h" - > - </File> - <File - RelativePath="..\..\..\src\exprbase.h" - > - </File> - <File - RelativePath="..\..\..\src\filters.h" - > - </File> - <File - RelativePath="..\..\..\src\flags.h" - > - </File> - <File - RelativePath="..\..\..\src\format.h" - > - </File> - <File - RelativePath="..\..\..\src\generate.h" - > - </File> - <File - RelativePath="..\..\..\src\global.h" - > - </File> - <File - RelativePath="..\..\..\src\item.h" - > - </File> - <File - RelativePath="..\..\..\src\iterators.h" - > - </File> - <File - RelativePath="..\..\..\src\journal.h" - > - </File> - <File - RelativePath="..\..\..\src\lookup.h" - > - </File> - <File - RelativePath="..\..\..\src\mask.h" - > - </File> - <File - RelativePath="..\..\..\src\op.h" - > - </File> - <File - RelativePath="..\..\..\src\option.h" - > - </File> - <File - RelativePath="..\..\..\src\output.h" - > - </File> - <File - RelativePath="..\..\..\src\parser.h" - > - </File> - <File - RelativePath="..\..\..\src\pool.h" - > - </File> - <File - RelativePath="..\..\..\src\post.h" - > - </File> - <File - RelativePath="..\..\..\src\precmd.h" - > - </File> - <File - RelativePath="..\..\..\src\predicate.h" - > - </File> - <File - RelativePath="..\..\..\src\print.h" - > - </File> - <File - RelativePath="..\..\..\src\pstream.h" - > - </File> - <File - RelativePath="..\..\..\src\pyfstream.h" - > - </File> - <File - RelativePath="..\..\..\src\pyinterp.h" - > - </File> - <File - RelativePath="..\..\..\src\pyutils.h" - > - </File> - <File - RelativePath="..\..\..\src\query.h" - > - </File> - <File - RelativePath="..\..\..\src\quotes.h" - > - </File> - <File - RelativePath="..\..\..\src\report.h" - > - </File> - <File - RelativePath="..\..\..\src\scope.h" - > - </File> - <File - RelativePath="..\..\..\src\session.h" - > - </File> - <File - RelativePath="..\..\..\src\stats.h" - > - </File> - <File - RelativePath="..\..\..\src\stream.h" - > - </File> - <File - RelativePath="..\..\..\src\temps.h" - > - </File> - <File - RelativePath="..\..\..\src\timelog.h" - > - </File> - <File - RelativePath="..\..\..\src\times.h" - > - </File> - <File - RelativePath="..\..\..\src\token.h" - > - </File> - <File - RelativePath="..\..\..\src\unistring.h" - > - </File> - <File - RelativePath="..\..\..\src\utils.h" - > - </File> - <File - RelativePath="..\..\..\src\value.h" - > - </File> - <File - RelativePath="..\..\..\src\xact.h" - > - </File> - <File - RelativePath="..\..\..\src\xml.h" - > - </File> - </Filter> - <Filter - Name="Resource Files" - Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" - UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" - > - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> diff --git a/dist/win/vc9/windows_build_instructions.txt b/dist/win/vc9/windows_build_instructions.txt deleted file mode 100644 index 48561d21..00000000 --- a/dist/win/vc9/windows_build_instructions.txt +++ /dev/null @@ -1,50 +0,0 @@ - - How to build ledger with Visual Studio 2008 - -Let me start by saying that this is probably not suitable for someone with -little C++ and/or Visual Studio experience. This document does assume some -basic knowledger about configuring VS, building C++ projects in general etc. - -1. To start, get git from http://code.google.com/p/msysgit/ and install - it. Checkout ledger from the git repository using the instructions on - http://github.com/jwiegley/ledger. - -2. Next, Download the libraries you need: - - - mpir: http://www.mpir.org/ - (mpir is a source-level alternative for GMP, which supports Windows) - - mpfr: http://www.mpfr.org/ - - boost: http://www.boost.org/ - - Extract mpir & mpfr to lib/win/mpfr & lib/win/mpir. - -3. Download the mpfr Visual Studio project files from - - http://gladman.plushost.co.uk/oldsite/computing/gmp4win.php - -4. If you didn't download the binary distribution of boost, build it yourself. - These libraries are linked statically so you need to the static versions. - - Use the following command to build boost (bjam is a separate tool to be - downloaded from the boost website): - - bjam toolset=msvc-9.0 --build-type=complete - define=_BIND_TO_CURRENT_MFC_VERSION=1 - define=_BIND_TO_CURRENT_CRT_VERSION=1 - stage - -5. Add the boost directory to your VS include directories, and the stage/lib - directory to the library directories. - -6. Checkout utfcpp by updating Ledger's Git submodules: - - git submodule update --init - -7. Finally, open the ledger.sln solution and hit build. - - -If you also want to build the installer, you will first need to somehow -generate the documentation pdf in the doc/ directory. You can either do this -using a TeX distribution for Windows, or copy it from a Linux machine. Next -run the build.bat command in the dist/win/installer directory. The resulting -installer package will be copied to this directory, too. diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/doc/CMakeLists.txt diff --git a/lib/gettext.h b/lib/gettext.h deleted file mode 100644 index 209921e6..00000000 --- a/lib/gettext.h +++ /dev/null @@ -1,271 +0,0 @@ -/* Convenience header for conditional use of GNU <libintl.h>. - Copyright (C) 1995-1998, 2000-2002, 2004-2006 Free Software Foundation, Inc. - - This program 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 2, or (at your option) - any later version. - - This program 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 - Library General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. */ - -#ifndef _LIBGETTEXT_H -#define _LIBGETTEXT_H 1 - -/* NLS can be disabled through the configure --disable-nls option. */ -#if ENABLE_NLS - -/* Get declarations of GNU message catalog functions. */ -# include <libintl.h> - -/* You can set the DEFAULT_TEXT_DOMAIN macro to specify the domain used by - the gettext() and ngettext() macros. This is an alternative to calling - textdomain(), and is useful for libraries. */ -# ifdef DEFAULT_TEXT_DOMAIN -# undef gettext -# define gettext(Msgid) \ - dgettext (DEFAULT_TEXT_DOMAIN, Msgid) -# undef ngettext -# define ngettext(Msgid1, Msgid2, N) \ - dngettext (DEFAULT_TEXT_DOMAIN, Msgid1, Msgid2, N) -# endif - -#else - -/* Solaris /usr/include/locale.h includes /usr/include/libintl.h, which - chokes if dcgettext is defined as a macro. So include it now, to make - later inclusions of <locale.h> a NOP. We don't include <libintl.h> - as well because people using "gettext.h" will not include <libintl.h>, - and also including <libintl.h> would fail on SunOS 4, whereas <locale.h> - is OK. */ -#if defined(__sun) -# include <locale.h> -#endif - -/* Many header files from the libstdc++ coming with g++ 3.3 or newer include - <libintl.h>, which chokes if dcgettext is defined as a macro. So include - it now, to make later inclusions of <libintl.h> a NOP. */ -#if defined(__cplusplus) && defined(__GNUG__) && (__GNUC__ >= 3) -# include <cstdlib> -# if (__GLIBC__ >= 2) || _GLIBCXX_HAVE_LIBINTL_H -# include <libintl.h> -# endif -#endif - -/* Disabled NLS. - The casts to 'const char *' serve the purpose of producing warnings - for invalid uses of the value returned from these functions. - On pre-ANSI systems without 'const', the config.h file is supposed to - contain "#define const". */ -# define gettext(Msgid) ((const char *) (Msgid)) -# define dgettext(Domainname, Msgid) ((void) (Domainname), gettext (Msgid)) -# define dcgettext(Domainname, Msgid, Category) \ - ((void) (Category), dgettext (Domainname, Msgid)) -# define ngettext(Msgid1, Msgid2, N) \ - ((N) == 1 \ - ? ((void) (Msgid2), (const char *) (Msgid1)) \ - : ((void) (Msgid1), (const char *) (Msgid2))) -# define dngettext(Domainname, Msgid1, Msgid2, N) \ - ((void) (Domainname), ngettext (Msgid1, Msgid2, N)) -# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \ - ((void) (Category), dngettext(Domainname, Msgid1, Msgid2, N)) -# define textdomain(Domainname) ((const char *) (Domainname)) -# define bindtextdomain(Domainname, Dirname) \ - ((void) (Domainname), (const char *) (Dirname)) -# define bind_textdomain_codeset(Domainname, Codeset) \ - ((void) (Domainname), (const char *) (Codeset)) - -#endif - -/* A pseudo function call that serves as a marker for the automated - extraction of messages, but does not call gettext(). The run-time - translation is done at a different place in the code. - The argument, String, should be a literal string. Concatenated strings - and other string expressions won't work. - The macro's expansion is not parenthesized, so that it is suitable as - initializer for static 'char[]' or 'const char[]' variables. */ -#define gettext_noop(String) String - -/* The separator between msgctxt and msgid in a .mo file. */ -#define GETTEXT_CONTEXT_GLUE "\004" - -/* Pseudo function calls, taking a MSGCTXT and a MSGID instead of just a - MSGID. MSGCTXT and MSGID must be string literals. MSGCTXT should be - short and rarely need to change. - The letter 'p' stands for 'particular' or 'special'. */ -#ifdef DEFAULT_TEXT_DOMAIN -# define pgettext(Msgctxt, Msgid) \ - pgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES) -#else -# define pgettext(Msgctxt, Msgid) \ - pgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES) -#endif -#define dpgettext(Domainname, Msgctxt, Msgid) \ - pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES) -#define dcpgettext(Domainname, Msgctxt, Msgid, Category) \ - pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, Category) -#ifdef DEFAULT_TEXT_DOMAIN -# define npgettext(Msgctxt, Msgid, MsgidPlural, N) \ - npgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES) -#else -# define npgettext(Msgctxt, Msgid, MsgidPlural, N) \ - npgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES) -#endif -#define dnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N) \ - npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES) -#define dcnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N, Category) \ - npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, Category) - -#ifdef __GNUC__ -__inline -#else -#ifdef __cplusplus -inline -#endif -#endif -static const char * -pgettext_aux (const char *domain, - const char *msg_ctxt_id, const char *msgid, - int category) -{ - const char *translation = dcgettext (domain, msg_ctxt_id, category); - if (translation == msg_ctxt_id) - return msgid; - else - return translation; -} - -#ifdef __GNUC__ -__inline -#else -#ifdef __cplusplus -inline -#endif -#endif -static const char * -npgettext_aux (const char *domain, - const char *msg_ctxt_id, const char *msgid, - const char *msgid_plural, unsigned long int n, - int category) -{ - const char *translation = - dcngettext (domain, msg_ctxt_id, msgid_plural, n, category); - if (translation == msg_ctxt_id || translation == msgid_plural) - return (n == 1 ? msgid : msgid_plural); - else - return translation; -} - -/* The same thing extended for non-constant arguments. Here MSGCTXT and MSGID - can be arbitrary expressions. But for string literals these macros are - less efficient than those above. */ - -#include <string.h> - -#define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS \ - (((__GNUC__ >= 3 || __GNUG__ >= 2) && !__STRICT_ANSI__) \ - /* || __STDC_VERSION__ >= 199901L */ ) - -#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS -#include <stdlib.h> -#endif - -#define pgettext_expr(Msgctxt, Msgid) \ - dcpgettext_expr (NULL, Msgctxt, Msgid, LC_MESSAGES) -#define dpgettext_expr(Domainname, Msgctxt, Msgid) \ - dcpgettext_expr (Domainname, Msgctxt, Msgid, LC_MESSAGES) - -#ifdef __GNUC__ -__inline -#else -#ifdef __cplusplus -inline -#endif -#endif -static const char * -dcpgettext_expr (const char *domain, - const char *msgctxt, const char *msgid, - int category) -{ - size_t msgctxt_len = strlen (msgctxt) + 1; - size_t msgid_len = strlen (msgid) + 1; - const char *translation; -#if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS - char msg_ctxt_id[msgctxt_len + msgid_len]; -#else - char buf[1024]; - char *msg_ctxt_id = - (msgctxt_len + msgid_len <= sizeof (buf) - ? buf - : (char *) malloc (msgctxt_len + msgid_len)); - if (msg_ctxt_id != NULL) -#endif - { - memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1); - msg_ctxt_id[msgctxt_len - 1] = '\004'; - memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len); - translation = dcgettext (domain, msg_ctxt_id, category); -#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS - if (msg_ctxt_id != buf) - free (msg_ctxt_id); -#endif - if (translation != msg_ctxt_id) - return translation; - } - return msgid; -} - -#define npgettext_expr(Msgctxt, Msgid, MsgidPlural, N) \ - dcnpgettext_expr (NULL, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES) -#define dnpgettext_expr(Domainname, Msgctxt, Msgid, MsgidPlural, N) \ - dcnpgettext_expr (Domainname, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES) - -#ifdef __GNUC__ -__inline -#else -#ifdef __cplusplus -inline -#endif -#endif -static const char * -dcnpgettext_expr (const char *domain, - const char *msgctxt, const char *msgid, - const char *msgid_plural, unsigned long int n, - int category) -{ - size_t msgctxt_len = strlen (msgctxt) + 1; - size_t msgid_len = strlen (msgid) + 1; - const char *translation; -#if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS - char msg_ctxt_id[msgctxt_len + msgid_len]; -#else - char buf[1024]; - char *msg_ctxt_id = - (msgctxt_len + msgid_len <= sizeof (buf) - ? buf - : (char *) malloc (msgctxt_len + msgid_len)); - if (msg_ctxt_id != NULL) -#endif - { - memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1); - msg_ctxt_id[msgctxt_len - 1] = '\004'; - memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len); - translation = dcngettext (domain, msg_ctxt_id, msgid_plural, n, category); -#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS - if (msg_ctxt_id != buf) - free (msg_ctxt_id); -#endif - if (!(translation == msg_ctxt_id || translation == msgid_plural)) - return translation; - } - return (n == 1 ? msgid : msgid_plural); -} - -#endif /* _LIBGETTEXT_H */ diff --git a/lisp/CMakeLists.txt b/lisp/CMakeLists.txt new file mode 100644 index 00000000..949171b3 --- /dev/null +++ b/lisp/CMakeLists.txt @@ -0,0 +1,50 @@ +set(EMACS_LISP_SOURCES + ldg-complete.el + ldg-exec.el + ldg-mode.el + ldg-new.el + ldg-post.el + ldg-reconcile.el + ldg-regex.el + ldg-register.el + ldg-report.el + ldg-state.el + ldg-test.el + ldg-texi.el + ldg-xact.el + ledger.el + timeclock.el) + +# find emacs and complain if not found +find_program(EMACS_EXECUTABLE emacs) + +macro(add_emacs_lisp_target el) + configure_file(${el} ${CMAKE_CURRENT_BINARY_DIR}/${el}) + + # add rule (i.e. command) how to generate the byte-compiled file + add_custom_command( + OUTPUT ${el}c + COMMAND ${EMACS_EXECUTABLE} + -L ${CMAKE_CURRENT_BINARY_DIR} + -l ${CMAKE_CURRENT_BINARY_DIR}/ldg-regex.el + -batch -f batch-byte-compile + ${CMAKE_CURRENT_BINARY_DIR}/${el} + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${el} + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMENT "Creating byte-compiled Emacs lisp ${CMAKE_CURRENT_BINARY_DIR}/${el}c") +endmacro(add_emacs_lisp_target el) + +if(EMACS_EXECUTABLE) + foreach(el ${EMACS_LISP_SOURCES}) + add_emacs_lisp_target(${el}) + list(APPEND EMACS_LISP_BINARIES ${CMAKE_CURRENT_BINARY_DIR}/${el}c) + endforeach() + + add_custom_target(emacs_lisp_byte_compile ALL DEPENDS ${EMACS_LISP_BINARIES}) + + # install the byte-compiled emacs-lisp sources + install(FILES ${EMACS_LISP_SOURCES} ${EMACS_LISP_BINARIES} + DESTINATION share/emacs/site-lisp) +endif() + +### CMakeLists.txt ends here diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 00000000..6f44e1be --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,261 @@ +set(LEDGER_SOURCES + stats.cc + generate.cc + csv.cc + convert.cc + draft.cc + emacs.cc + org.cc + ptree.cc + print.cc + output.cc + precmd.cc + chain.cc + filters.cc + report.cc + views.cc + select.cc + session.cc + option.cc + lookup.cc + compare.cc + iterators.cc + timelog.cc + textual.cc + temps.cc + journal.cc + archive.cc + account.cc + xact.cc + post.cc + item.cc + format.cc + query.cc + scope.cc + expr.cc + op.cc + parser.cc + token.cc + value.cc + balance.cc + quotes.cc + history.cc + pool.cc + annotate.cc + commodity.cc + amount.cc + stream.cc + mask.cc + times.cc + error.cc + utils.cc) + +if(HAVE_BOOST_PYTHON) + list(APPEND LEDGER_SOURCES + py_account.cc + py_amount.cc + py_balance.cc + py_commodity.cc + py_expr.cc + py_format.cc + py_item.cc + py_journal.cc + py_post.cc + py_session.cc + py_times.cc + py_utils.cc + py_value.cc + py_xact.cc + pyinterp.cc + pyledger.cc) +endif() + +set(LEDGER_INCLUDES + account.h + amount.h + annotate.h + archive.h + balance.h + chain.h + commodity.h + compare.h + context.h + convert.h + csv.h + draft.h + emacs.h + error.h + expr.h + exprbase.h + filters.h + flags.h + format.h + generate.h + global.h + history.h + item.h + iterators.h + journal.h + lookup.h + mask.h + op.h + option.h + org.h + output.h + parser.h + pool.h + post.h + precmd.h + predicate.h + print.h + pstream.h + ptree.h + pyfstream.h + pyinterp.h + pyutils.h + query.h + quotes.h + report.h + scope.h + select.h + session.h + stats.h + stream.h + temps.h + timelog.h + times.h + token.h + unistring.h + utils.h + value.h + views.h + xact.h + ${PROJECT_BINARY_DIR}/system.hh) + +if(CMAKE_BUILD_TYPE STREQUAL "Debug") + if(CMAKE_CXX_COMPILER MATCHES "clang") + set(CMAKE_INCLUDE_SYSTEM_FLAG_CXX "-isystem ") + add_definitions( + -Weverything + -Wno-padded + -Wno-weak-vtables + -Wno-exit-time-destructors + -Wno-global-constructors + -Wno-switch-enum + -Wno-missing-prototypes + -Wno-missing-noreturn + -Wno-unused-parameter + -Wno-c++98-compat + -fno-limit-debug-info) + + macro(ADD_PCH_RULE _header_filename _src_list _other_srcs) + set(_pch_filename "${_header_filename}.pch") + + set_source_files_properties( + ${${_src_list}} PROPERTIES COMPILE_FLAGS "-include ${_header_filename}") + if(_other_srcs) + set_source_files_properties( + ${_other_srcs} PROPERTIES COMPILE_FLAGS "-include ${_header_filename}") + endif() + list(APPEND ${_src_list} ${_pch_filename}) + + set(_args ${CMAKE_CXX_FLAGS}) + list(APPEND _args ${CMAKE_CXX_FLAGS_DEBUG}) + list(APPEND _args "-x c++-header " ${_inc}) + list(APPEND _args -c ${_header_filename} -o ${_pch_filename}) + + get_directory_property(DIRINC INCLUDE_DIRECTORIES) + foreach(_inc ${DIRINC}) + list(APPEND _args "-isystem " ${_inc}) + endforeach(_inc ${DIRINC}) + + separate_arguments(_args) + + add_custom_command(OUTPUT ${_pch_filename} + COMMAND rm -f ${_pch_filename} + COMMAND ${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1} ${_args} + DEPENDS ${_header_filename}) + endmacro(ADD_PCH_RULE _header_filename _src_list _other_srcs) + + elseif(CMAKE_CXX_COMPILER MATCHES "g\\+\\+") + set(GXX_WARNING_FLAGS + -ansi + -pedantic + -Wall + -Winvalid-pch + -Wextra + -Wcast-align + -Wcast-qual + -Wfloat-equal + -Wmissing-field-initializers + -Wno-endif-labels + -Wno-overloaded-virtual + -Wsign-compare + -Wsign-promo + -Wwrite-strings + -Wno-unused-parameter + -Wno-old-style-cast + -Wno-deprecated + -Wno-strict-aliasing) + + add_definitions(${GXX_WARNING_FLAGS}) + + macro(ADD_PCH_RULE _header_filename _src_list _other_srcs) + set(_gch_filename "${_header_filename}.gch") + + set_source_files_properties( + ${${_src_list}} PROPERTIES COMPILE_FLAGS "-Winvalid-pch") + if(_other_srcs) + set_source_files_properties( + ${_other_srcs} PROPERTIES COMPILE_FLAGS "-Winvalid-pch") + endif() + list(APPEND ${_src_list} ${_gch_filename}) + + set(_args ${CMAKE_CXX_FLAGS}) + list(APPEND _args ${CMAKE_CXX_FLAGS_DEBUG}) + list(APPEND _args ${GXX_WARNING_FLAGS}) + list(APPEND _args "-x c++-header " ${_inc}) + list(APPEND _args -c ${_header_filename} -o ${_gch_filename}) + + get_directory_property(DIRINC INCLUDE_DIRECTORIES) + foreach(_inc ${DIRINC}) + list(APPEND _args "-isystem " ${_inc}) + endforeach(_inc ${DIRINC}) + + separate_arguments(_args) + + add_custom_command(OUTPUT ${_gch_filename} + COMMAND rm -f ${_gch_filename} + COMMAND ${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1} ${_args} + DEPENDS ${_header_filename}) + endmacro(ADD_PCH_RULE _header_filename _src_list _other_srcs) + + else() + macro(ADD_PCH_RULE _header_filename _src_list _other_srcs) + endmacro(ADD_PCH_RULE _header_filename _src_list _other_srcs) + endif() +else() + macro(ADD_PCH_RULE _header_filename _src_list _other_srcs) + endmacro(ADD_PCH_RULE _header_filename _src_list _other_srcs) +endif() + +add_pch_rule(${PROJECT_BINARY_DIR}/system.hh LEDGER_SOURCES main.cc global.cc) + +if(BUILD_LIBRARY) + add_library(libledger ${LEDGER_SOURCES} ${PROJECT_SOURCE_DIR}/lib/sha1.cpp) + set_target_properties(libledger PROPERTIES OUTPUT_NAME ledger) + + add_executable(ledger main.cc global.cc) + + install(TARGETS libledger DESTINATION lib) + install(FILES ${LEDGER_INCLUDES} DESTINATION include/ledger) +else() + add_executable(ledger + ${LEDGER_SOURCES} ${PROJECT_SOURCE_DIR}/lib/sha1.cpp main.cc global.cc) +endif() + +add_ledger_library_dependencies(ledger) + +install(TARGETS ledger DESTINATION bin) + +### CMakeLists.txt ends here diff --git a/src/account.cc b/src/account.cc index 11b918fa..72709f95 100644 --- a/src/account.cc +++ b/src/account.cc @@ -89,11 +89,11 @@ account_t * account_t::find_account(const string& acct_name, if (has_flags(ACCOUNT_GENERATED)) account->add_flags(ACCOUNT_GENERATED); -#if defined(DEBUG_ON) +#if DEBUG_ON std::pair<accounts_map::iterator, bool> result = #endif accounts.insert(accounts_map::value_type(first, account)); -#if defined(DEBUG_ON) +#if DEBUG_ON assert(result.second); #endif } else { diff --git a/src/account.h b/src/account.h index 1716102f..a2fcb8de 100644 --- a/src/account.h +++ b/src/account.h @@ -70,7 +70,7 @@ public: optional<expr_t> value_expr; mutable string _fullname; -#ifdef DOCUMENT_MODEL +#if DOCUMENT_MODEL mutable void * data; #endif @@ -80,7 +80,7 @@ public: : supports_flags<>(), scope_t(), parent(_parent), name(_name), note(_note), depth(static_cast<unsigned short>(parent ? parent->depth + 1 : 0)) -#ifdef DOCUMENT_MODEL +#if DOCUMENT_MODEL , data(NULL) #endif { @@ -93,7 +93,7 @@ public: note(other.note), depth(other.depth), accounts(other.accounts) -#ifdef DOCUMENT_MODEL +#if DOCUMENT_MODEL , data(NULL) #endif { @@ -282,7 +282,7 @@ public: bool children_with_xdata() const; std::size_t children_with_flags(xdata_t::flags_t flags) const; -#if defined(HAVE_BOOST_SERIALIZATION) +#if HAVE_BOOST_SERIALIZATION private: /** Serialization. */ diff --git a/src/amount.cc b/src/amount.cc index 645b244b..9491efcd 100644 --- a/src/amount.cc +++ b/src/amount.cc @@ -93,7 +93,7 @@ struct amount_t::bigint_t : public supports_flags<> return true; } -#if defined(HAVE_BOOST_SERIALIZATION) +#if HAVE_BOOST_SERIALIZATION private: friend class boost::serialization::access; @@ -120,7 +120,7 @@ namespace { { char * buf = NULL; try { -#if defined(DEBUG_ON) +#if DEBUG_ON IF_DEBUG("amount.convert") { char * tbuf = mpq_get_str(NULL, 10, quant); DEBUG("amount.convert", "Rational to convert = " << tbuf); @@ -247,7 +247,7 @@ void amount_t::initialize() // in terms of seconds, but reported as minutes or hours. if (commodity_t * commodity = commodity_pool_t::current_pool->create("s")) commodity->add_flags(COMMODITY_BUILTIN | COMMODITY_NOMARKET); -#if !defined(NO_ASSERTS) +#if !NO_ASSERTS else assert(false); #endif @@ -255,7 +255,7 @@ void amount_t::initialize() // Add a "percentile" commodity if (commodity_t * commodity = commodity_pool_t::current_pool->create("%")) commodity->add_flags(COMMODITY_BUILTIN | COMMODITY_NOMARKET); -#if !defined(NO_ASSERTS) +#if !NO_ASSERTS else assert(false); #endif @@ -730,7 +730,7 @@ amount_t::value(const datetime_t& moment, const commodity_t * in_terms_of) const { if (quantity) { -#if defined(DEBUG_ON) +#if DEBUG_ON DEBUG("commodity.price.find", "amount_t::value of " << commodity().symbol()); if (! moment.is_not_a_date_time()) @@ -1294,7 +1294,7 @@ void put_amount(property_tree::ptree& pt, const amount_t& amt, st.put("quantity", amt.quantity_string()); } -#if defined(HAVE_BOOST_SERIALIZATION) +#if HAVE_BOOST_SERIALIZATION template<class Archive> void amount_t::serialize(Archive& ar, const unsigned int /* version */) @@ -1308,7 +1308,7 @@ void amount_t::serialize(Archive& ar, const unsigned int /* version */) } // namespace ledger -#if defined(HAVE_BOOST_SERIALIZATION) +#if HAVE_BOOST_SERIALIZATION namespace boost { namespace serialization { diff --git a/src/amount.h b/src/amount.h index 5863381b..49027bb7 100644 --- a/src/amount.h +++ b/src/amount.h @@ -727,7 +727,7 @@ public: bool valid() const; -#if defined(HAVE_BOOST_SERIALIZATION) +#if HAVE_BOOST_SERIALIZATION private: /** Serialization. */ diff --git a/src/annotate.cc b/src/annotate.cc index b2df0d34..b7b6b5cb 100644 --- a/src/annotate.cc +++ b/src/annotate.cc @@ -186,7 +186,7 @@ void annotation_t::parse(std::istream& in) } } while (true); -#if defined(DEBUG_ON) +#if DEBUG_ON if (SHOW_DEBUG("amounts.commodities") && *this) { DEBUG("amounts.commodities", "Parsed commodity annotations: " << std::endl << *this); @@ -300,7 +300,7 @@ annotated_commodity_t::find_price(const commodity_t * commodity, } } -#if defined(DEBUG_ON) +#if DEBUG_ON if (target) DEBUG("commodity.price.find", "target commodity: " << target->symbol()); #endif diff --git a/src/annotate.h b/src/annotate.h index 1e62e2fa..27deaad3 100644 --- a/src/annotate.h +++ b/src/annotate.h @@ -108,7 +108,7 @@ struct annotation_t : public supports_flags<>, return true; } -#if defined(HAVE_BOOST_SERIALIZATION) +#if HAVE_BOOST_SERIALIZATION private: /** Serialization. */ @@ -163,7 +163,7 @@ struct keep_details_t } bool keep_any(const commodity_t& comm) const; -#if defined(HAVE_BOOST_SERIALIZATION) +#if HAVE_BOOST_SERIALIZATION private: /** Serialization. */ @@ -251,7 +251,7 @@ public: virtual void write_annotations(std::ostream& out, bool no_computed_annotations = false) const; -#if defined(HAVE_BOOST_SERIALIZATION) +#if HAVE_BOOST_SERIALIZATION private: explicit annotated_commodity_t() : ptr(NULL) { TRACE_CTOR(annotated_commodity_t, ""); diff --git a/src/archive.cc b/src/archive.cc index 72ec0419..caeaf965 100644 --- a/src/archive.cc +++ b/src/archive.cc @@ -31,7 +31,7 @@ #include <system.hh> -#if defined(HAVE_BOOST_SERIALIZATION) +#if HAVE_BOOST_SERIALIZATION #include "archive.h" #include "amount.h" @@ -116,7 +116,7 @@ bool archive_t::read_header() "Version number: " << std::hex << ARCHIVE_VERSION << std::dec); DEBUG("archive.journal", "Number of sources: " << sources.size()); -#if defined(DEBUG_ON) +#if DEBUG_ON foreach (const journal_t::fileinfo_t& i, sources) DEBUG("archive.journal", "Loaded source: " << *i.filename); #endif @@ -250,7 +250,7 @@ void archive_t::save(journal_t& journal) write_header_bits(stream); sources = journal.sources; -#if defined(DEBUG_ON) +#if DEBUG_ON foreach (const journal_t::fileinfo_t& i, sources) DEBUG("archive.journal", "Saving source: " << *i.filename); #endif diff --git a/src/archive.h b/src/archive.h index 4ce5e0e7..ee4e9ccb 100644 --- a/src/archive.h +++ b/src/archive.h @@ -74,7 +74,7 @@ public: void save(journal_t& journal); bool load(journal_t& journal); -#if defined(HAVE_BOOST_SERIALIZATION) +#if HAVE_BOOST_SERIALIZATION private: /** Serialization. */ diff --git a/src/balance.h b/src/balance.h index 9a07084d..230a4e2c 100644 --- a/src/balance.h +++ b/src/balance.h @@ -573,7 +573,7 @@ public: return true; } -#if defined(HAVE_BOOST_SERIALIZATION) +#if HAVE_BOOST_SERIALIZATION private: /** Serialization. */ diff --git a/src/commodity.cc b/src/commodity.cc index 54459155..05d465ca 100644 --- a/src/commodity.cc +++ b/src/commodity.cc @@ -91,7 +91,7 @@ optional<price_point_t> commodity_t::find_price_from_expr(expr_t& expr, const commodity_t * commodity, const datetime_t& moment) const { -#if defined(DEBUG_ON) +#if DEBUG_ON if (SHOW_DEBUG("commodity.price.find")) { ledger::_log_buffer << "valuation expr: "; expr.dump(ledger::_log_buffer); diff --git a/src/commodity.h b/src/commodity.h index 82be0ee8..ab496850 100644 --- a/src/commodity.h +++ b/src/commodity.h @@ -69,7 +69,7 @@ struct price_point_t return when == other.when && price == other.price; } -#if defined(HAVE_BOOST_SERIALIZATION) +#if HAVE_BOOST_SERIALIZATION private: /** Serialization. */ @@ -138,7 +138,7 @@ protected: TRACE_DTOR(commodity_t::base_t); } -#if defined(HAVE_BOOST_SERIALIZATION) +#if HAVE_BOOST_SERIALIZATION private: base_t() { TRACE_CTOR(base_t, ""); @@ -314,7 +314,7 @@ public: bool operator()(const amount_t * left, const amount_t * right) const; }; -#if defined(HAVE_BOOST_SERIALIZATION) +#if HAVE_BOOST_SERIALIZATION private: supports_flags<uint_least16_t> temp_flags; diff --git a/src/draft.cc b/src/draft.cc index c5f37f42..a6f60520 100644 --- a/src/draft.cc +++ b/src/draft.cc @@ -276,7 +276,7 @@ xact_t * draft_t::insert(journal_t& journal) //added->code = matching->code; //added->note = matching->note; -#if defined(DEBUG_ON) +#if DEBUG_ON DEBUG("draft.xact", "Setting payee from match: " << added->payee); //if (added->code) // DEBUG("draft.xact", "Setting code from match: " << *added->code); @@ -381,14 +381,14 @@ xact_t * draft_t::insert(journal_t& journal) account_t * acct = NULL; if (! acct) { acct = journal.find_account_re(post.account_mask->str()); -#if defined(DEBUG_ON) +#if DEBUG_ON if (acct) DEBUG("draft.xact", "Found account as a regular expression"); #endif } if (! acct) { acct = journal.find_account(post.account_mask->str()); -#if defined(DEBUG_ON) +#if DEBUG_ON if (acct) DEBUG("draft.xact", "Found (or created) account by name"); #endif @@ -107,7 +107,7 @@ public: virtual void print(std::ostream& out) const; virtual void dump(std::ostream& out) const; -#if defined(HAVE_BOOST_SERIALIZATION) +#if HAVE_BOOST_SERIALIZATION private: /** Serialization. */ diff --git a/src/exprbase.h b/src/exprbase.h index bea25320..4edf2a7a 100644 --- a/src/exprbase.h +++ b/src/exprbase.h @@ -156,22 +156,22 @@ public: result_type calc(scope_t& scope) { if (! compiled) { -#if defined(DEBUG_ON) +#if DEBUG_ON if (SHOW_DEBUG("expr.compile")) { DEBUG("expr.compile", "Before compilation:"); dump(*_log_stream); } -#endif // defined(DEBUG_ON) +#endif // DEBUG_ON DEBUG("expr.compile", "Compiling: " << str); compile(scope); -#if defined(DEBUG_ON) +#if DEBUG_ON if (SHOW_DEBUG("expr.compile")) { DEBUG("expr.compile", "After compilation:"); dump(*_log_stream); } -#endif // defined(DEBUG_ON) +#endif // DEBUG_ON } DEBUG("expr.calc", "Calculating: " << str); @@ -232,7 +232,7 @@ public: return calc(); } -#if defined(HAVE_BOOST_SERIALIZATION) +#if HAVE_BOOST_SERIALIZATION private: /** Serialization. */ diff --git a/src/filters.cc b/src/filters.cc index 9589958c..7f426bf3 100644 --- a/src/filters.cc +++ b/src/filters.cc @@ -909,14 +909,14 @@ void subtotal_posts::operator()(post_t& post) values_map::iterator i = values.find(acct->fullname()); if (i == values.end()) { -#if defined(DEBUG_ON) +#if DEBUG_ON std::pair<values_map::iterator, bool> result = #endif values.insert(values_pair (acct->fullname(), acct_value_t(acct, amount, post.has_flags(POST_VIRTUAL), post.has_flags(POST_MUST_BALANCE)))); -#if defined(DEBUG_ON) +#if DEBUG_ON assert(result.second); #endif } else { @@ -994,7 +994,7 @@ void interval_posts::flush() DEBUG("filters.interval", "Considering post " << post->date() << " = " << post->amount); -#if defined(DEBUG_ON) +#if DEBUG_ON DEBUG("filters.interval", "interval is:"); debug_interval(interval); #endif @@ -1269,7 +1269,7 @@ void budget_posts::report_budget_items(const date_t& date) begin = pair.first.start; } -#if defined(DEBUG_ON) +#if DEBUG_ON DEBUG("budget.generate", "begin = " << *begin); DEBUG("budget.generate", "date = " << date); if (pair.first.finish) @@ -1409,7 +1409,7 @@ void forecast_posts::flush() least = i; } -#if !defined(NO_ASSERTS) +#if !NO_ASSERTS if ((*least).first.finish) assert(*(*least).first.start < *(*least).first.finish); #endif diff --git a/src/filters.h b/src/filters.h index 1dad8852..b765f630 100644 --- a/src/filters.h +++ b/src/filters.h @@ -742,7 +742,7 @@ public: void report_subtotal(const date_interval_t& ival); -#if defined(DEBUG_ON) +#if DEBUG_ON void debug_interval(const date_interval_t& ival) { if (ival.start) DEBUG("filters.interval", "start = " << *ival.start); diff --git a/src/flags.h b/src/flags.h index e2046c08..77a2c4dd 100644 --- a/src/flags.h +++ b/src/flags.h @@ -91,7 +91,7 @@ public: _flags = static_cast<T>(static_cast<U>(_flags) & static_cast<U>(~arg)); } -#if defined(HAVE_BOOST_SERIALIZATION) +#if HAVE_BOOST_SERIALIZATION private: friend class boost::serialization::access; @@ -194,7 +194,7 @@ public: _flags.drop_flags(arg); } -#if defined(HAVE_BOOST_SERIALIZATION) +#if HAVE_BOOST_SERIALIZATION private: friend class boost::serialization::access; diff --git a/src/format.cc b/src/format.cc index 18c7696d..d29c87b3 100644 --- a/src/format.cc +++ b/src/format.cc @@ -221,7 +221,7 @@ format_t::element_t * format_t::parse_elements(const string& fmt, static_cast<int>(current->max_width) : -1); else if (keyword == "left") expr << (current->has_flags(ELEMENT_ALIGN_LEFT) ? "false" : "true"); -#if defined(DEBUG_ON) +#if DEBUG_ON else assert("Unrecognized format substitution keyword" == NULL); #endif @@ -538,7 +538,7 @@ string format_t::truncate(const unistring& ustr, // distributed, with the latter parts being longer than the // former, but with none shorter than account_abbrev_length. std::list<std::size_t> lens; -#if defined(DEBUG_ON) +#if DEBUG_ON int index = 0; #endif for (std::list<string>::iterator i = parts.begin(); @@ -595,7 +595,7 @@ string format_t::truncate(const unistring& ustr, std::size_t overflow_at_start = overflow; DEBUG("format.abbrev", "Overflow starting at " << overflow << " chars"); -#if defined(DEBUG_ON) +#if DEBUG_ON index = 0; #endif std::size_t counter = lens.size(); diff --git a/src/global.cc b/src/global.cc index 285fdea3..a718d6cb 100644 --- a/src/global.cc +++ b/src/global.cc @@ -32,7 +32,7 @@ #include <system.hh> #include "global.h" -#if defined(HAVE_BOOST_PYTHON) +#if HAVE_BOOST_PYTHON #include "pyinterp.h" #else #include "session.h" @@ -49,7 +49,7 @@ global_scope_t::global_scope_t(char ** envp) { epoch = CURRENT_TIME(); -#if defined(HAVE_BOOST_PYTHON) +#if HAVE_BOOST_PYTHON if (! python_session.get()) { python_session.reset(new ledger::python_interpreter_t); session_ptr = python_session; @@ -101,7 +101,7 @@ global_scope_t::~global_scope_t() // Otherwise, let it all leak because we're about to exit anyway. IF_VERIFY() set_session_context(NULL); -#if defined(HAVE_BOOST_PYTHON) +#if HAVE_BOOST_PYTHON python_session.reset(); #endif } @@ -399,13 +399,13 @@ global_scope_t::read_command_arguments(scope_t& scope, strings_list args) void global_scope_t::normalize_session_options() { -#if defined(LOGGING_ON) +#if LOGGING_ON INFO("Initialization file is " << HANDLER(init_file_).str()); INFO("Price database is " << session().HANDLER(price_db_).str()); foreach (const path& pathname, session().HANDLER(file_).data_files) INFO("Journal file is " << pathname.string()); -#endif // defined(LOGGING_ON) +#endif // LOGGING_ON } expr_t::func_t global_scope_t::look_for_precommand(scope_t& scope, @@ -455,7 +455,7 @@ void handle_debug_options(int argc, char * argv[]) args_only = true; } else if (std::strcmp(argv[i], "--verify-memory") == 0) { -#if defined(VERIFY_ON) +#if VERIFY_ON verify_enabled = true; _log_level = LOG_DEBUG; @@ -463,25 +463,25 @@ void handle_debug_options(int argc, char * argv[]) #endif } else if (std::strcmp(argv[i], "--verify") == 0) { -#if defined(VERIFY_ON) +#if VERIFY_ON verify_enabled = true; #endif } else if (std::strcmp(argv[i], "--verbose") == 0 || std::strcmp(argv[i], "-v") == 0) { -#if defined(LOGGING_ON) +#if LOGGING_ON _log_level = LOG_INFO; #endif } else if (i + 1 < argc && std::strcmp(argv[i], "--debug") == 0) { -#if defined(DEBUG_ON) +#if DEBUG_ON _log_level = LOG_DEBUG; _log_category = argv[i + 1]; i++; #endif } else if (i + 1 < argc && std::strcmp(argv[i], "--trace") == 0) { -#if defined(TRACING_ON) +#if TRACING_ON _log_level = LOG_TRACE; try { _trace_level = boost::lexical_cast<uint8_t>(argv[i + 1]); diff --git a/src/global.h b/src/global.h index 5786bb89..f797ba01 100644 --- a/src/global.h +++ b/src/global.h @@ -118,7 +118,11 @@ public: void show_version_info(std::ostream& out) { out << - "Ledger " << ledger::version << _(", the command-line accounting tool"); + "Ledger " << Ledger_VERSION_MAJOR << '.' << Ledger_VERSION_MINOR << '.' + << Ledger_VERSION_PATCH; + if (Ledger_VERSION_DATE != 0) + out << '-' << Ledger_VERSION_DATE; + out << _(", the command-line accounting tool"); out << _("\n\nCopyright (c) 2003-2012, John Wiegley. All rights reserved.\n\n\ This program is made available under the terms of the BSD Public License.\n\ diff --git a/src/history.cc b/src/history.cc index d94ec647..556abd26 100644 --- a/src/history.cc +++ b/src/history.cc @@ -67,7 +67,7 @@ public: template <typename Edge> bool operator()(const Edge& e) const { -#if defined(DEBUG_ON) +#if DEBUG_ON DEBUG("history.find", " reftime = " << reftime); if (! oldest.is_not_a_date_time()) { DEBUG("history.find", " oldest = " << oldest); @@ -239,7 +239,7 @@ commodity_history_t::find_price(const commodity_t& source, FNameMap namemap(get(vertex_name, fg)); DEBUG("history.find", "sv commodity = " << get(namemap, sv)->symbol()); -#if defined(DEBUG_ON) +#if DEBUG_ON if (source.has_flags(COMMODITY_PRIMARY)) DEBUG("history.find", "sv commodity is primary"); #endif diff --git a/src/item.cc b/src/item.cc index 5dc62096..0630043b 100644 --- a/src/item.cc +++ b/src/item.cc @@ -45,7 +45,7 @@ bool item_t::has_tag(const string& tag, bool) const return false; } string_map::const_iterator i = metadata->find(tag); -#if defined(DEBUG_ON) +#if DEBUG_ON if (SHOW_DEBUG("item.meta")) { if (i == metadata->end()) DEBUG("item.meta", "Item does not have this tag"); @@ -79,7 +79,7 @@ struct position_t return *this; } -#if defined(HAVE_BOOST_SERIALIZATION) +#if HAVE_BOOST_SERIALIZATION private: /** Serialization. */ @@ -223,7 +223,7 @@ public: bool valid() const; -#if defined(HAVE_BOOST_SERIALIZATION) +#if HAVE_BOOST_SERIALIZATION private: /** Serialization. */ diff --git a/src/iterators.cc b/src/iterators.cc index 7cc1291a..0a053031 100644 --- a/src/iterators.cc +++ b/src/iterators.cc @@ -203,7 +203,7 @@ void sorted_accounts_iterator::push_back(account_t& account) accounts_list.back().end(), compare_items<account_t>(sort_cmp)); -#if defined(DEBUG_ON) +#if DEBUG_ON if (SHOW_DEBUG("accounts.sorted")) { foreach (account_t * acct, accounts_list.back()) DEBUG("accounts.sorted", @@ -236,7 +236,7 @@ void sorted_accounts_iterator::sort_accounts(account_t& account, std::stable_sort(deque.begin(), deque.end(), compare_items<account_t>(sort_cmp)); -#if defined(DEBUG_ON) +#if DEBUG_ON if (SHOW_DEBUG("accounts.sorted")) { foreach (account_t * acct, deque) DEBUG("accounts.sorted", "Account: " << acct->fullname()); diff --git a/src/journal.h b/src/journal.h index 1f9cf3af..5e0fa0e3 100644 --- a/src/journal.h +++ b/src/journal.h @@ -99,7 +99,7 @@ public: TRACE_DTOR(journal_t::fileinfo_t); } -#if defined(HAVE_BOOST_SERIALIZATION) +#if HAVE_BOOST_SERIALIZATION private: /** Serialization. */ @@ -208,7 +208,7 @@ public: private: std::size_t read_textual(parse_context_stack_t& context); -#if defined(HAVE_BOOST_SERIALIZATION) +#if HAVE_BOOST_SERIALIZATION private: /** Serialization. */ diff --git a/src/lookup.cc b/src/lookup.cc index 6f0c33ea..9edc3bbc 100644 --- a/src/lookup.cc +++ b/src/lookup.cc @@ -67,7 +67,7 @@ lookup_probable_account(const string& ident, { scorecard_t scores; -#if !defined(HAVE_BOOST_REGEX_UNICODE) +#if !HAVE_BOOST_REGEX_UNICODE string lident = ident; to_lower(lident); unistring lowered_ident(lident); @@ -78,7 +78,7 @@ lookup_probable_account(const string& ident, DEBUG("lookup.account", "Looking up identifier '" << lowered_ident.extract() << "'"); -#if defined(DEBUG_ON) +#if DEBUG_ON if (ref_account != NULL) DEBUG("lookup.account", " with reference account: " << ref_account->fullname()); @@ -100,7 +100,7 @@ lookup_probable_account(const string& ident, break; } -#if !defined(HAVE_BOOST_REGEX_UNICODE) +#if !HAVE_BOOST_REGEX_UNICODE string payee = xact->payee; to_lower(payee); unistring value_key(payee); @@ -187,7 +187,7 @@ lookup_probable_account(const string& ident, addend++; #if 0 -#if !defined(HAVE_BOOST_REGEX_UNICODE) +#if !HAVE_BOOST_REGEX_UNICODE if (pos == 0 || (pos > 0 && !std::isalnum(value_key[pos - 1]))) addend++; #else @@ -268,7 +268,7 @@ lookup_probable_account(const string& ident, } if (account_usage.size() > 0) { -#if defined(DEBUG_ON) +#if DEBUG_ON if (SHOW_DEBUG("lookup.account")) { foreach (const account_use_pair& value, account_usage) { DEBUG("lookup.account", diff --git a/src/main.cc b/src/main.cc index b309255b..99f7451e 100644 --- a/src/main.cc +++ b/src/main.cc @@ -37,7 +37,7 @@ using namespace ledger; -#ifdef HAVE_BOOST_PYTHON +#if HAVE_BOOST_PYTHON namespace ledger { extern char * argv0; } @@ -47,7 +47,7 @@ int main(int argc, char * argv[], char * envp[]) { int status = 1; -#ifdef HAVE_BOOST_PYTHON +#if HAVE_BOOST_PYTHON argv0 = argv[0]; #endif @@ -60,7 +60,7 @@ int main(int argc, char * argv[], char * envp[]) // --trace LEVEL ; turns on trace logging // --memory ; turns on memory usage tracing handle_debug_options(argc, argv); -#if defined(VERIFY_ON) +#if VERIFY_ON IF_VERIFY() initialize_memory_tracing(); #endif @@ -77,7 +77,7 @@ int main(int argc, char * argv[], char * envp[]) std::signal(SIGPIPE, sigpipe_handler); #endif -#if defined(HAVE_GETTEXT) +#if HAVE_GETTEXT ::textdomain("ledger"); #endif @@ -127,7 +127,7 @@ int main(int argc, char * argv[], char * envp[]) bool exit_loop = false; -#ifdef HAVE_LIBEDIT +#ifdef HAVE_EDIT rl_readline_name = const_cast<char *>("Ledger"); #if 0 @@ -152,7 +152,7 @@ int main(int argc, char * argv[], char * envp[]) add_history(expansion); } -#else // HAVE_LIBEDIT +#else // HAVE_EDIT while (! std::cin.eof()) { std::cout << global_scope->prompt_string(); @@ -161,7 +161,7 @@ int main(int argc, char * argv[], char * envp[]) char * p = skip_ws(line); -#endif // HAVE_LIBEDIT +#endif // HAVE_EDIT check_for_signal(); @@ -172,7 +172,7 @@ int main(int argc, char * argv[], char * envp[]) global_scope->execute_command_wrapper(split_arguments(p), true); } -#ifdef HAVE_LIBEDIT +#if HAVE_EDIT if (expansion) std::free(expansion); std::free(p); @@ -202,12 +202,12 @@ int main(int argc, char * argv[], char * envp[]) // up everything by closing the session and deleting the session object, and // then shutting down the memory tracing subsystem. Otherwise, let it all // leak because we're about to exit anyway. -#if defined(VERIFY_ON) +#if VERIFY_ON IF_VERIFY() { checked_delete(global_scope); INFO("Ledger ended (Boost/libstdc++ may still hold memory)"); -#if defined(VERIFY_ON) +#if VERIFY_ON shutdown_memory_tracing(); #endif } else diff --git a/src/mask.cc b/src/mask.cc index afb68ca0..18d482ed 100644 --- a/src/mask.cc +++ b/src/mask.cc @@ -43,7 +43,7 @@ mask_t::mask_t(const string& pat) : expr() mask_t& mask_t::operator=(const string& pat) { -#if defined(HAVE_BOOST_REGEX_UNICODE) +#if HAVE_BOOST_REGEX_UNICODE expr = boost::make_u32regex(pat.c_str(), boost::regex::perl | boost::regex::icase); #else expr.assign(pat.c_str(), boost::regex::perl | boost::regex::icase); @@ -45,7 +45,7 @@ #define _MASK_H #include "utils.h" -#if defined(HAVE_BOOST_REGEX_UNICODE) +#if HAVE_BOOST_REGEX_UNICODE #include "unistring.h" #endif @@ -54,7 +54,7 @@ namespace ledger { class mask_t { public: -#if defined(HAVE_BOOST_REGEX_UNICODE) +#if HAVE_BOOST_REGEX_UNICODE boost::u32regex expr; #else boost::regex expr; @@ -83,7 +83,7 @@ public: } bool match(const string& text) const { -#if defined(HAVE_BOOST_REGEX_UNICODE) +#if HAVE_BOOST_REGEX_UNICODE DEBUG("mask.match", "Matching: \"" << text << "\" =~ /" << str() << "/ = " << (boost::u32regex_search(text, expr) ? "true" : "false")); @@ -102,7 +102,7 @@ public: string str() const { if (! empty()) { -#if defined(HAVE_BOOST_REGEX_UNICODE) +#if HAVE_BOOST_REGEX_UNICODE assert(sizeof(boost::uint32_t) == sizeof(UChar32)); unistring ustr; std::basic_string<UChar32> expr_str = expr.str(); @@ -125,7 +125,7 @@ public: return true; } -#if defined(HAVE_BOOST_SERIALIZATION) +#if HAVE_BOOST_SERIALIZATION private: /** Serialization. */ @@ -93,7 +93,7 @@ expr_t::ptr_op_t expr_t::op_t::compile(scope_t& scope, const int depth, unique_ptr<scope_t> bound_scope; expr_t::ptr_op_t result; -#if defined(DEBUG_ON) +#if DEBUG_ON if (SHOW_DEBUG("expr.compile")) { for (int i = 0; i < depth; i++) ledger::_log_buffer << '.'; @@ -114,12 +114,12 @@ expr_t::ptr_op_t expr_t::op_t::compile(scope_t& scope, const int depth, // Identifier references are first looked up at the point of // definition, and then at the point of every use if they could // not be found there. -#if defined(DEBUG_ON) +#if DEBUG_ON if (SHOW_DEBUG("expr.compile")) { DEBUG("expr.compile", "Found definition:"); def->dump(*_log_stream, 0); } -#endif // defined(DEBUG_ON) +#endif // DEBUG_ON result = copy(def); } else if (left()) { @@ -219,7 +219,7 @@ expr_t::ptr_op_t expr_t::op_t::compile(scope_t& scope, const int depth, } } -#if defined(DEBUG_ON) +#if DEBUG_ON if (SHOW_DEBUG("expr.compile")) { for (int i = 0; i < depth; i++) ledger::_log_buffer << '.'; @@ -253,7 +253,7 @@ value_t expr_t::op_t::calc(scope_t& scope, ptr_op_t * locus, const int depth) value_t result; -#if defined(DEBUG_ON) +#if DEBUG_ON if (SHOW_DEBUG("expr.calc")) { for (int i = 0; i < depth; i++) ledger::_log_buffer << '.'; @@ -415,7 +415,7 @@ value_t expr_t::op_t::calc(scope_t& scope, ptr_op_t * locus, const int depth) throw_(calc_error, _f("Unexpected expr node '%1%'") % op_context(this)); } -#if defined(DEBUG_ON) +#if DEBUG_ON if (SHOW_DEBUG("expr.calc")) { for (int i = 0; i < depth; i++) ledger::_log_buffer << '.'; @@ -315,7 +315,7 @@ private: value_t calc_cons(scope_t& scope, ptr_op_t * locus, const int depth); value_t calc_seq(scope_t& scope, ptr_op_t * locus, const int depth); -#if defined(HAVE_BOOST_SERIALIZATION) +#if HAVE_BOOST_SERIALIZATION private: /** Serialization. */ diff --git a/src/option.h b/src/option.h index 80be69c4..642142aa 100644 --- a/src/option.h +++ b/src/option.h @@ -95,7 +95,7 @@ public: if (wants_arg) { out << " = "; out.width(42); - out << value; + out << std::left << value; } else { out.width(45); out << ' '; diff --git a/src/output.cc b/src/output.cc index 742000bd..f433f8d1 100644 --- a/src/output.cc +++ b/src/output.cc @@ -208,7 +208,7 @@ format_accounts::mark_accounts(account_t& account, const bool flat) to_display += i.second; } -#if defined(DEBUG_ON) +#if DEBUG_ON DEBUG("account.display", "Considering account: " << account.fullname()); if (account.has_xflags(ACCOUNT_EXT_VISITED)) DEBUG("account.display", " it was visited itself"); diff --git a/src/parser.h b/src/parser.h index db16a919..9e6a59f4 100644 --- a/src/parser.h +++ b/src/parser.h @@ -65,7 +65,7 @@ class expr_t::parser_t : public noncopyable return lookahead; } -#if !defined(NO_ASSERTS) +#if !NO_ASSERTS void push_token(const token_t& tok) const { assert(&tok == &lookahead); use_lookahead = true; @@ -74,7 +74,7 @@ class expr_t::parser_t : public noncopyable void push_token(const token_t&) const { use_lookahead = true; } -#endif // !defined(NO_ASSERTS) +#endif // !NO_ASSERTS void push_token() const { use_lookahead = true; } diff --git a/src/pool.cc b/src/pool.cc index 61b5bef2..9f1aea9f 100644 --- a/src/pool.cc +++ b/src/pool.cc @@ -69,11 +69,11 @@ commodity_t * commodity_pool_t::create(const string& symbol) DEBUG("pool.commodities", "Creating commodity '" << symbol << "'"); -#if defined(DEBUG_ON) +#if DEBUG_ON std::pair<commodities_map::iterator, bool> result = #endif commodities.insert(commodities_map::value_type(symbol, commodity)); -#if defined(DEBUG_ON) +#if DEBUG_ON assert(result.second); #endif @@ -206,13 +206,13 @@ commodity_pool_t::create(commodity_t& comm, << "symbol " << commodity->base_symbol() << std::endl << details); -#if defined(DEBUG_ON) +#if DEBUG_ON std::pair<annotated_commodities_map::iterator, bool> result = #endif annotated_commodities.insert(annotated_commodities_map::value_type (annotated_commodities_map::key_type (comm.base_symbol(), details), commodity)); -#if defined(DEBUG_ON) +#if DEBUG_ON assert(result.second); #endif @@ -243,7 +243,7 @@ commodity_pool_t::exchange(const amount_t& amount, { DEBUG("commodity.prices.add", "exchange: " << amount << " for " << cost); DEBUG("commodity.prices.add", "exchange: is-per-unit = " << is_per_unit); -#if defined(DEBUG_ON) +#if DEBUG_ON if (moment) DEBUG("commodity.prices.add", "exchange: moment = " << *moment); if (tag) @@ -132,7 +132,7 @@ public: const bool add_prices = true, const optional<datetime_t>& moment = none); -#if defined(HAVE_BOOST_SERIALIZATION) +#if HAVE_BOOST_SERIALIZATION private: /** Serialization. */ @@ -250,7 +250,7 @@ public: } }; -#if defined(HAVE_BOOST_SERIALIZATION) +#if HAVE_BOOST_SERIALIZATION private: /** Serialization. */ diff --git a/src/predicate.h b/src/predicate.h index 7d58dc2f..c670d6a4 100644 --- a/src/predicate.h +++ b/src/predicate.h @@ -91,7 +91,7 @@ public: true); } -#if defined(HAVE_BOOST_SERIALIZATION) +#if HAVE_BOOST_SERIALIZATION private: /** Serialization. */ diff --git a/src/ptree.cc b/src/ptree.cc index db523e99..6fb840e0 100644 --- a/src/ptree.cc +++ b/src/ptree.cc @@ -54,7 +54,10 @@ void format_ptree::flush() property_tree::ptree pt; - pt.put("ledger.<xmlattr>.version", VERSION); + pt.put("ledger.<xmlattr>.version", + lexical_cast<string>((Ledger_VERSION_MAJOR << 16) | + (Ledger_VERSION_MINOR << 8) | + Ledger_VERSION_PATCH)); property_tree::ptree& ct(pt.put("ledger.commodities", "")); foreach (const commodities_pair& pair, commodities) @@ -67,11 +70,11 @@ void format_ptree::flush() foreach (const xact_t * xact, transactions) { put_xact(tt, *xact); - property_tree::ptree& post_t(tt.put("postings", "")); + property_tree::ptree& post_tree(tt.put("postings", "")); foreach (const post_t * post, xact->posts) if (post->has_xdata() && post->xdata().has_flags(POST_EXT_VISITED)) - put_post(post_t, *post); + put_post(post_tree, *post); } switch (format) { diff --git a/src/pyinterp.cc b/src/pyinterp.cc index 3c864910..135a088b 100644 --- a/src/pyinterp.cc +++ b/src/pyinterp.cc @@ -166,7 +166,7 @@ void python_interpreter_t::hack_system_paths() python::list paths(sys_dict["path"]); -#if defined(DEBUG_ON) +#if DEBUG_ON bool path_initialized = false; #endif int n = python::extract<int>(paths.attr("__len__")()); @@ -189,13 +189,13 @@ void python_interpreter_t::hack_system_paths() throw_(std::runtime_error, _("Python failed to initialize (couldn't find ledger)")); } -#if defined(DEBUG_ON) +#if DEBUG_ON path_initialized = true; #endif break; } } -#if defined(DEBUG_ON) +#if DEBUG_ON if (! path_initialized) DEBUG("python.init", "Ledger failed to find 'ledger/__init__.py' on the PYTHONPATH"); diff --git a/src/pyinterp.h b/src/pyinterp.h index 556b1563..56f808c8 100644 --- a/src/pyinterp.h +++ b/src/pyinterp.h @@ -34,7 +34,7 @@ #include "session.h" -#if defined(HAVE_BOOST_PYTHON) +#if HAVE_BOOST_PYTHON namespace ledger { diff --git a/src/pyutils.h b/src/pyutils.h index 2c7dfaeb..a34eee00 100644 --- a/src/pyutils.h +++ b/src/pyutils.h @@ -180,7 +180,7 @@ namespace boost { namespace python { BOOST_PYTHON_RETURN_TO_PYTHON_BY_VALUE(T,expr, pytype) \ BOOST_PYTHON_ARG_TO_PYTHON_BY_VALUE(T,expr) -#if !defined(HAVE_CPP11) && (defined(VERIFY_ON) || defined(HAVE_BOOST_PYTHON)) +#if !HAVE_CXX11 && (VERIFY_ON || HAVE_BOOST_PYTHON) BOOST_PYTHON_TO_PYTHON_BY_VALUE(ledger::string, ::PyUnicode_FromEncodedObject(::PyString_FromString(x.c_str()), "UTF-8", NULL), &PyUnicode_Type) #endif diff --git a/src/quotes.cc b/src/quotes.cc index c33e0826..e92af236 100644 --- a/src/quotes.cc +++ b/src/quotes.cc @@ -43,7 +43,7 @@ commodity_quote_from_script(commodity_t& commodity, const commodity_t * exchange_commodity) { DEBUG("commodity.download", "downloading quote for symbol " << commodity.symbol()); -#if defined(DEBUG_ON) +#if DEBUG_ON if (exchange_commodity) DEBUG("commodity.download", " in terms of commodity " << exchange_commodity->symbol()); diff --git a/src/report.cc b/src/report.cc index d6e6f150..662386a4 100644 --- a/src/report.cc +++ b/src/report.cc @@ -57,7 +57,7 @@ void report_t::normalize_options(const string& verb) // Patch up some of the reporting options based on what kind of // command it was. -#ifdef HAVE_ISATTY +#if HAVE_ISATTY if (! HANDLED(force_color)) { if (! HANDLED(no_color) && isatty(STDOUT_FILENO)) HANDLER(color).on("?normalize"); @@ -480,7 +480,7 @@ void report_t::commodities_report(post_handler_ptr handler) pass_down_posts<posts_commodities_iterator>(handler, *walker); } catch (...) { -#if defined(VERIFY_ON) +#if VERIFY_ON IF_VERIFY() { // If --verify was used, clean up the posts_commodities_iterator. // Otherwise, just leak like a sieve. diff --git a/src/report.h b/src/report.h index 085cfa48..0f4fc103 100644 --- a/src/report.h +++ b/src/report.h @@ -659,7 +659,7 @@ public: OPTION(report_t, equity); OPTION(report_t, exact); - OPTION_(report_t, exchange_, DO_() { // -X + OPTION_(report_t, exchange_, DO_(str) { // -X // Using -X implies -V. The main difference is that now // HANDLER(exchange_) contains the name of a commodity, which // is accessed via the "exchange" value expression function. @@ -784,7 +784,7 @@ public: OPTION(report_t, output_); // -o -#ifdef HAVE_ISATTY +#if HAVE_ISATTY OPTION__ (report_t, pager_, CTOR(report_t, pager_) { diff --git a/src/scope.h b/src/scope.h index c43d73d6..4190f5bb 100644 --- a/src/scope.h +++ b/src/scope.h @@ -84,7 +84,7 @@ struct symbol_t return kind == sym.kind || name == sym.name; } -#if defined(HAVE_BOOST_SERIALIZATION) +#if HAVE_BOOST_SERIALIZATION private: /** Serialization. */ @@ -128,7 +128,7 @@ public: return false; } -#if defined(HAVE_BOOST_SERIALIZATION) +#if HAVE_BOOST_SERIALIZATION private: /** Serialization. */ @@ -185,7 +185,7 @@ public: return NULL; } -#if defined(HAVE_BOOST_SERIALIZATION) +#if HAVE_BOOST_SERIALIZATION private: /** Serialization. */ @@ -234,7 +234,7 @@ public: return child_scope_t::lookup(kind, name); } -#if defined(HAVE_BOOST_SERIALIZATION) +#if HAVE_BOOST_SERIALIZATION private: /** Serialization. */ @@ -311,7 +311,7 @@ public: virtual string description() { if (parent) return parent->description(); -#if !defined(NO_ASSERTS) +#if !NO_ASSERTS else assert(false); #endif @@ -324,7 +324,7 @@ public: virtual expr_t::ptr_op_t lookup(const symbol_t::kind_t kind, const string& name); -#if defined(HAVE_BOOST_SERIALIZATION) +#if HAVE_BOOST_SERIALIZATION private: /** Serialization. */ @@ -366,7 +366,7 @@ public: return required; } -#if defined(HAVE_BOOST_SERIALIZATION) +#if HAVE_BOOST_SERIALIZATION protected: explicit context_scope_t() { TRACE_CTOR(context_scope_t, ""); @@ -481,7 +481,7 @@ public: return args.size() == 0; } -#if defined(HAVE_BOOST_SERIALIZATION) +#if HAVE_BOOST_SERIALIZATION protected: explicit call_scope_t() : depth(0) { TRACE_CTOR(call_scope_t, ""); diff --git a/src/select.cc b/src/select.cc index 20a78701..afcfb351 100644 --- a/src/select.cc +++ b/src/select.cc @@ -178,12 +178,8 @@ value_t select_command(call_scope_t& args) lexical_cast<std::size_t>(report.HANDLER(meta_width_).str()) : 10); - bool saw_date = false; bool saw_payee = false; bool saw_account = false; - bool saw_amount = false; - bool saw_total = false; - bool saw_meta = false; std::size_t cols_needed = 0; foreach (const value_t& column, columns.to_sequence()) { @@ -191,7 +187,6 @@ value_t select_command(call_scope_t& args) if (get_principal_identifiers(as_expr(column), ident)) { if (ident == "date" || ident == "aux_date") { cols_needed += date_width + 1; - saw_date = true; } else if (ident == "payee") { cols_needed += payee_width + 1; @@ -203,15 +198,12 @@ value_t select_command(call_scope_t& args) } else if (ident == "amount") { cols_needed += amount_width + 1; - saw_amount = true; } else if (ident == "total") { cols_needed += total_width + 1; - saw_total = true; } else { cols_needed += meta_width + 1; - saw_meta = true; } } } diff --git a/src/session.cc b/src/session.cc index 9a77d341..b6153203 100644 --- a/src/session.cc +++ b/src/session.cc @@ -117,7 +117,7 @@ std::size_t session_t::read_data(const string& master_account) else if (HANDLED(value_expr_)) journal->value_expr = HANDLER(value_expr_).str(); -#if defined(HAVE_BOOST_SERIALIZATION) +#if HAVE_BOOST_SERIALIZATION optional<archive_t> cache; if (HANDLED(cache_) && master_account.empty()) cache = archive_t(HANDLED(cache_).str()); @@ -179,7 +179,7 @@ std::size_t session_t::read_data(const string& master_account) << "] == journal->xacts.size() [" << journal->xacts.size() << "]"); assert(xact_count == journal->xacts.size()); -#if defined(HAVE_BOOST_SERIALIZATION) +#if HAVE_BOOST_SERIALIZATION if (cache && cache->should_save(*journal.get())) cache->save(*journal.get()); } @@ -201,14 +201,14 @@ journal_t * session_t::read_journal_files() if (HANDLED(master_account_)) master_account = HANDLER(master_account_).str(); -#if defined(DEBUG_ON) +#if DEBUG_ON std::size_t count = #endif read_data(master_account); INFO_FINISH(journal); -#if defined(DEBUG_ON) +#if DEBUG_ON INFO("Found " << count << " transactions"); #endif diff --git a/src/system.hh.in b/src/system.hh.in index fd019ba7..e81dfc00 100644 --- a/src/system.hh.in +++ b/src/system.hh.in @@ -41,7 +41,48 @@ * None of these header files (with the exception of acconf.h, when * configure is re-run) are expected to change. */ -#include "config.h" + +#ifndef _SYSTEM_HH +#define _SYSTEM_HH + +//#warning("Loading system.hh. This should occur only once!") + +/*------------------------------------------------------------------------*/ +/* Application configuration */ +/*------------------------------------------------------------------------*/ + +#define Ledger_VERSION_MAJOR @Ledger_VERSION_MAJOR@ +#define Ledger_VERSION_MINOR @Ledger_VERSION_MINOR@ +#define Ledger_VERSION_PATCH @Ledger_VERSION_PATCH@ +#define Ledger_VERSION_DATE @Ledger_VERSION_DATE@ + +#define HAVE_CXX11 @HAVE_CXX11@ + +#define HAVE_LANGINFO_H @HAVE_LANGINFO_H@ +#define HAVE_EDIT @HAVE_EDIT@ +#define HAVE_GETTEXT @HAVE_GETTEXT@ + +#define HAVE_ACCESS @HAVE_ACCESS@ +#define HAVE_REALPATH @HAVE_REALPATH@ +#define HAVE_GETPWUID @HAVE_GETPWUID@ +#define HAVE_GETPWNAM @HAVE_GETPWNAM@ +#define HAVE_ISATTY @HAVE_ISATTY@ + +#define HAVE_UNIX_PIPES @HAVE_UNIX_PIPES@ + +#define HAVE_BOOST_PYTHON @HAVE_BOOST_PYTHON@ +#define HAVE_BOOST_REGEX_UNICODE @HAVE_BOOST_REGEX_UNICODE@ +#define HAVE_BOOST_SERIALIZATION 0 + +#define DEBUG_MODE @DEBUG_MODE@ +#define NDEBUG @NDEBUG@ + +#define DOCUMENT_MODEL 0 +#define REDUCE_TO_INTEGER 0 + +/*------------------------------------------------------------------------*/ +/* System includes */ +/*------------------------------------------------------------------------*/ #if defined(__GNUG__) && __GNUG__ < 3 #define _XOPEN_SOURCE @@ -109,11 +150,11 @@ typedef std::ostream::pos_type ostream_pos_type; #else #include <unistd.h> #endif -#if defined(HAVE_GETPWUID) || defined(HAVE_GETPWNAM) +#if HAVE_GETPWUID || HAVE_GETPWNAM #include <pwd.h> #endif -#if defined(HAVE_UNIX_PIPES) +#if HAVE_UNIX_PIPES #include <sys/types.h> #include <sys/wait.h> #endif @@ -123,7 +164,7 @@ typedef std::ostream::pos_type ostream_pos_type; #include "sha1.h" #include "utf8.h" -#if defined(HAVE_LIBEDIT) +#if HAVE_EDIT #include <editline/readline.h> #endif @@ -147,7 +188,6 @@ typedef std::ostream::pos_type ostream_pos_type; #include <boost/foreach.hpp> #endif -#include <boost/format.hpp> #include <boost/function.hpp> #include <boost/graph/adjacency_list.hpp> @@ -155,6 +195,7 @@ typedef std::ostream::pos_type ostream_pos_type; #include <boost/graph/dijkstra_shortest_paths.hpp> #include <boost/graph/graphviz.hpp> +#include <boost/format.hpp> #include <boost/intrusive_ptr.hpp> #include <boost/iostreams/stream.hpp> @@ -179,7 +220,7 @@ typedef std::ostream::pos_type ostream_pos_type; #include <boost/random/uniform_real.hpp> #include <boost/random/variate_generator.hpp> -#if defined(HAVE_BOOST_REGEX_UNICODE) +#if HAVE_BOOST_REGEX_UNICODE #include <boost/regex/icu.hpp> #else #include <boost/regex.hpp> @@ -193,8 +234,8 @@ typedef std::ostream::pos_type ostream_pos_type; #include <boost/variant.hpp> #include <boost/version.hpp> -#if defined(HAVE_GETTEXT) -#include "gettext.h" +#if HAVE_GETTEXT +#include <libintl.h> #define _(str) gettext(str) #define _f(str) boost::format(gettext(str)) #else @@ -202,7 +243,7 @@ typedef std::ostream::pos_type ostream_pos_type; #define _f(str) boost::format(str) #endif -#if defined(HAVE_BOOST_SERIALIZATION) +#if HAVE_BOOST_SERIALIZATION #include <boost/archive/binary_iarchive.hpp> #include <boost/archive/binary_oarchive.hpp> @@ -282,7 +323,7 @@ void serialize(Archive& ar, istream_pos_type& pos, const unsigned int) #endif // HAVE_BOOST_SERIALIZATION -#if defined(HAVE_BOOST_PYTHON) +#if HAVE_BOOST_PYTHON #include <boost/python.hpp> @@ -296,3 +337,5 @@ void serialize(Archive& ar, istream_pos_type& pos, const unsigned int) #include <boost/iterator/indirect_iterator.hpp> #endif // HAVE_BOOST_PYTHON + +#endif // _SYSTEM_HH diff --git a/src/textual.cc b/src/textual.cc index 1665d4dd..a5ae2f68 100644 --- a/src/textual.cc +++ b/src/textual.cc @@ -40,7 +40,7 @@ #include "query.h" #include "pstream.h" #include "pool.h" -#if defined(HAVE_BOOST_PYTHON) +#if HAVE_BOOST_PYTHON #include "pyinterp.h" #endif @@ -126,7 +126,7 @@ namespace { return (in.good() && ! in.eof() && (in.peek() == ' ' || in.peek() == '\t')); } -#if defined(HAVE_BOOST_PYTHON) +#if HAVE_BOOST_PYTHON bool peek_blank_line() { return (in.good() && ! in.eof() && (in.peek() == '\n' || in.peek() == '\r')); @@ -221,15 +221,6 @@ namespace { DEBUG("textual.parse", "Parsed an amount expression"); -#if defined(DEBUG_ENABLED) - DEBUG_IF("textual.parse") { - if (_debug_stream) { - ledger::dump_value_expr(*_debug_stream, expr); - *_debug_stream << std::endl; - } - } -#endif - if (expr) { if (amount_expr) *amount_expr = expr; @@ -835,7 +826,7 @@ void instance_t::apply_account_directive(char * line) { if (account_t * acct = top_account()->find_account(line)) apply_stack.push_front(application_t("account", acct)); -#if !defined(NO_ASSERTS) +#if !NO_ASSERTS else assert("Failed to create account" == NULL); #endif @@ -1168,7 +1159,7 @@ void instance_t::comment_directive(char * line) } } -#if defined(HAVE_BOOST_PYTHON) +#if HAVE_BOOST_PYTHON void instance_t::import_directive(char * line) { diff --git a/src/times.cc b/src/times.cc index 6bf2af82..167aac73 100644 --- a/src/times.cc +++ b/src/times.cc @@ -122,7 +122,7 @@ namespace { datetime_t when; input_stream >> when; -#if defined(DEBUG_ON) +#if DEBUG_ON if (when.is_not_a_date_time()) DEBUG("times.parse", "Failed to parse date/time '" << str << "' using pattern '" << fmt_str << "'"); @@ -157,7 +157,7 @@ namespace { date_t when; input_stream >> when; -#if defined(DEBUG_ON) +#if DEBUG_ON if (when.is_not_a_date()) DEBUG("times.parse", "Failed to parse date '" << str << "' using pattern '" << fmt_str << "'"); @@ -346,7 +346,7 @@ date_t date_specifier_t::begin() const month_type the_month = month ? *month : date_t::month_type(1); day_type the_day = day ? *day : date_t::day_type(1); -#if !defined(NO_ASSERTS) +#if !NO_ASSERTS if (day) assert(! wday); else if (wday) @@ -1259,7 +1259,7 @@ date_t date_duration_t::find_nearest(const date_t& date, skip_quantum_t skip) void date_interval_t::stabilize(const optional<date_t>& date) { -#if defined(DEBUG_ON) +#if DEBUG_ON if (date) DEBUG("times.interval", "stabilize: with date = " << *date); #endif @@ -1280,7 +1280,7 @@ void date_interval_t::stabilize(const optional<date_t>& date) optional<date_t> initial_start = start ? start : begin(); optional<date_t> initial_finish = finish ? finish : end(); -#if defined(DEBUG_ON) +#if DEBUG_ON if (initial_start) DEBUG("times.interval", "stabilize: initial_start = " << *initial_start); @@ -1333,7 +1333,7 @@ void date_interval_t::stabilize(const optional<date_t>& date) DEBUG("times.interval", "stabilize: finish reset to initial finish"); } -#if defined(DEBUG_ON) +#if DEBUG_ON if (start) DEBUG("times.interval", "stabilize: final start = " << *start); if (finish) @@ -1403,7 +1403,7 @@ bool date_interval_t::find_period(const date_t& date, DEBUG("times.interval", "date = " << date); DEBUG("times.interval", "scan = " << scan); DEBUG("times.interval", "end_of_scan = " << end_of_scan); -#if defined(DEBUG_ON) +#if DEBUG_ON if (finish) DEBUG("times.interval", "finish = " << *finish); else diff --git a/src/times.h b/src/times.h index d6ab542d..9a0f21ff 100644 --- a/src/times.h +++ b/src/times.h @@ -162,7 +162,7 @@ struct date_traits_t has_day == traits.has_day); } -#if defined(HAVE_BOOST_SERIALIZATION) +#if HAVE_BOOST_SERIALIZATION private: /** Serialization. */ @@ -256,7 +256,7 @@ struct date_duration_t static date_t find_nearest(const date_t& date, skip_quantum_t skip); -#if defined(HAVE_BOOST_SERIALIZATION) +#if HAVE_BOOST_SERIALIZATION private: /** Serialization. */ @@ -352,7 +352,7 @@ public: return out.str(); } -#if defined(HAVE_BOOST_SERIALIZATION) +#if HAVE_BOOST_SERIALIZATION private: /** Serialization. */ @@ -429,7 +429,7 @@ public: return out.str(); } -#if defined(HAVE_BOOST_SERIALIZATION) +#if HAVE_BOOST_SERIALIZATION private: /** Serialization. */ @@ -499,7 +499,7 @@ public: return out.str(); } -#if defined(HAVE_BOOST_SERIALIZATION) +#if HAVE_BOOST_SERIALIZATION private: /** Serialization. */ @@ -599,7 +599,7 @@ public: void dump(std::ostream& out); -#if defined(HAVE_BOOST_SERIALIZATION) +#if HAVE_BOOST_SERIALIZATION private: /** Serialization. */ diff --git a/src/utils.cc b/src/utils.cc index d8cba61e..d32eef5a 100644 --- a/src/utils.cc +++ b/src/utils.cc @@ -38,7 +38,7 @@ * Assertions */ -#if defined(ASSERTS_ON) +#if ASSERTS_ON namespace ledger { @@ -64,7 +64,7 @@ void debug_assert(const string& reason, * Verification (basically, very slow asserts) */ -#if defined(VERIFY_ON) +#if VERIFY_ON namespace ledger { @@ -489,7 +489,7 @@ void report_memory(std::ostream& out, bool report_all) namespace ledger { -#if !defined(HAVE_CPP11) && (defined(VERIFY_ON) || defined(HAVE_BOOST_PYTHON)) +#if !HAVE_CXX11 && (VERIFY_ON || HAVE_BOOST_PYTHON) string::string() : std::string() { TRACE_CTOR(string, ""); @@ -527,7 +527,7 @@ string::~string() throw() { TRACE_DTOR(string); } -#endif // !defined(HAVE_CPP11) && (defined(VERIFY_ON) || defined(HAVE_BOOST_PYTHON)) +#endif // !HAVE_CXX11 && (VERIFY_ON || HAVE_BOOST_PYTHON) string empty_string(""); @@ -589,7 +589,7 @@ strings_list split_arguments(const char * line) * Logging */ -#if defined(LOGGING_ON) +#if LOGGING_ON namespace ledger { @@ -597,7 +597,7 @@ log_level_t _log_level = LOG_WARN; std::ostream * _log_stream = &std::cerr; std::ostringstream _log_buffer; -#if defined(TRACING_ON) +#if TRACING_ON uint8_t _trace_level; #endif @@ -610,7 +610,7 @@ void logger_func(log_level_t level) logger_has_run = true; logger_start = TRUE_CURRENT_TIME(); -#if defined(VERIFY_ON) +#if VERIFY_ON IF_VERIFY() *_log_stream << " TIME OBJSZ MEMSZ" << std::endl; #endif @@ -620,7 +620,7 @@ void logger_func(log_level_t level) << (TRUE_CURRENT_TIME() - logger_start).total_milliseconds() << "ms"; -#if defined(VERIFY_ON) +#if VERIFY_ON IF_VERIFY() { *_log_stream << std::right << std::setw(6) << std::setprecision(3); stream_memory_size(*_log_stream, current_objects_size()); @@ -656,12 +656,12 @@ void logger_func(log_level_t level) } // namespace ledger -#if defined(DEBUG_ON) +#if DEBUG_ON namespace ledger { optional<std::string> _log_category; -#if defined(HAVE_BOOST_REGEX_UNICODE) +#if HAVE_BOOST_REGEX_UNICODE optional<boost::u32regex> _log_category_re; #else optional<boost::regex> _log_category_re; @@ -686,7 +686,7 @@ struct __maybe_enable_debugging { * Timers (allows log xacts to specify cumulative time spent) */ -#if defined(LOGGING_ON) && defined(TIMERS_ON) +#if LOGGING_ON && defined(TIMERS_ON) namespace ledger { @@ -710,7 +710,7 @@ static timer_map timers; void start_timer(const char * name, log_level_t lvl) { -#if defined(VERIFY_ON) +#if VERIFY_ON bool tracing_active = memory_tracing_active; memory_tracing_active = false; #endif @@ -726,14 +726,14 @@ void start_timer(const char * name, log_level_t lvl) _log_buffer.clear(); _log_buffer.str(""); -#if defined(VERIFY_ON) +#if VERIFY_ON memory_tracing_active = tracing_active; #endif } void stop_timer(const char * name) { -#if defined(VERIFY_ON) +#if VERIFY_ON bool tracing_active = memory_tracing_active; memory_tracing_active = false; #endif @@ -744,21 +744,21 @@ void stop_timer(const char * name) (*i).second.spent += TRUE_CURRENT_TIME() - (*i).second.begin; (*i).second.active = false; -#if defined(VERIFY_ON) +#if VERIFY_ON memory_tracing_active = tracing_active; #endif } void finish_timer(const char * name) { -#if defined(VERIFY_ON) +#if VERIFY_ON bool tracing_active = memory_tracing_active; memory_tracing_active = false; #endif timer_map::iterator i = timers.find(name); if (i == timers.end()) { -#if defined(VERIFY_ON) +#if VERIFY_ON memory_tracing_active = tracing_active; #endif return; @@ -787,7 +787,7 @@ void finish_timer(const char * name) timers.erase(i); -#if defined(VERIFY_ON) +#if VERIFY_ON memory_tracing_active = tracing_active; #endif } @@ -820,8 +820,6 @@ void sigpipe_handler(int) namespace ledger { -const string version = PACKAGE_VERSION; - path expand_path(const path& pathname) { if (pathname.empty()) @@ -833,7 +831,7 @@ path expand_path(const path& pathname) if (path_string.length() == 1 || pos == 1) { pfx = std::getenv("HOME"); -#ifdef HAVE_GETPWUID +#if HAVE_GETPWUID if (! pfx) { // Punt. We're trying to expand ~/, but HOME isn't set struct passwd * pw = getpwuid(getuid()); @@ -842,7 +840,7 @@ path expand_path(const path& pathname) } #endif } -#ifdef HAVE_GETPWNAM +#if HAVE_GETPWNAM else { string user(path_string, 1, pos == string::npos ? string::npos : pos - 1); diff --git a/src/utils.h b/src/utils.h index 7f5242d9..cbcfb131 100644 --- a/src/utils.h +++ b/src/utils.h @@ -51,15 +51,23 @@ #define TIMERS_ON 1 -#if defined(DEBUG_MODE) +#if DEBUG_MODE +#define NO_ASSERTS 0 #define VERIFY_ON 1 #define TRACING_ON 1 #define DEBUG_ON 1 -#elif defined(NDEBUG) +#elif NDEBUG #define NO_ASSERTS 1 //#define NO_LOGGING 1 +#define VERIFY_ON 0 +#define TRACING_ON 0 +#define DEBUG_ON 0 #else +#define NO_ASSERTS 0 #define TRACING_ON 1 // use --trace X to enable +#define VERIFY_ON 0 +#define TRACING_ON 0 +#define DEBUG_ON 0 #endif /*@}*/ @@ -72,7 +80,7 @@ namespace ledger { using namespace boost; -#if !defined(HAVE_CPP11) && (defined(VERIFY_ON) || defined(HAVE_BOOST_PYTHON)) +#if !HAVE_CXX11 && (VERIFY_ON || HAVE_BOOST_PYTHON) class string; #else typedef std::string string; @@ -93,11 +101,11 @@ namespace ledger { } #if BOOST_FILESYSTEM_VERSION == 3 -#if !defined(HAVE_CPP11) && (defined(VERIFY_ON) || defined(HAVE_BOOST_PYTHON)) +#if !HAVE_CXX11 && (VERIFY_ON || HAVE_BOOST_PYTHON) namespace boost { namespace filesystem3 { namespace path_traits { template<> struct is_pathable<ledger::string> { static const bool value = true; }; }}} -#endif // defined(VERIFY_ON) || defined(HAVE_BOOST_PYTHON) +#endif // VERIFY_ON || HAVE_BOOST_PYTHON #endif // BOOST_FILESYSTEM_VERSION == 3 /*@}*/ @@ -111,10 +119,10 @@ template<> struct is_pathable<ledger::string> { static const bool value = true; #undef assert #endif -#if ! defined(NO_ASSERTS) +#if ! NO_ASSERTS #define ASSERTS_ON 1 #endif -#if defined(ASSERTS_ON) +#if ASSERTS_ON namespace ledger { void debug_assert(const string& reason, const string& func, @@ -138,7 +146,7 @@ namespace ledger { */ /*@{*/ -#if defined(VERIFY_ON) +#if VERIFY_ON namespace ledger { @@ -193,7 +201,7 @@ void report_memory(std::ostream& out, bool report_all = false); namespace ledger { -#if !defined(HAVE_CPP11) && (defined(VERIFY_ON) || defined(HAVE_BOOST_PYTHON)) +#if !HAVE_CXX11 && (VERIFY_ON || HAVE_BOOST_PYTHON) class string : public std::string { @@ -215,7 +223,7 @@ public: string(const char * str, size_type x, size_type y); ~string() throw(); -#if defined(HAVE_BOOST_SERIALIZATION) +#if HAVE_BOOST_SERIALIZATION private: /** Serialization. */ @@ -272,7 +280,7 @@ inline bool operator!=(const char* __lhs, const string& __rhs) inline bool operator!=(const string& __lhs, const char* __rhs) { return __lhs.compare(__rhs) != 0; } -#endif // !defined(HAVE_CPP11) && (defined(VERIFY_ON) || defined(HAVE_BOOST_PYTHON)) +#endif // !HAVE_CXX11 && (VERIFY_ON || HAVE_BOOST_PYTHON) extern string empty_string; @@ -312,7 +320,7 @@ inline string operator+(const char * left, const string& right) { #if ! defined(NO_LOGGING) #define LOGGING_ON 1 #endif -#if defined(LOGGING_ON) +#if LOGGING_ON namespace ledger { @@ -340,7 +348,7 @@ void logger_func(log_level_t level); #define LOGGER(cat) \ static const char * const _this_category = cat -#if defined(TRACING_ON) +#if TRACING_ON extern uint8_t _trace_level; @@ -358,10 +366,10 @@ extern uint8_t _trace_level; #endif // TRACING_ON -#if defined(DEBUG_ON) +#if DEBUG_ON extern optional<std::string> _log_category; -#if defined(HAVE_BOOST_REGEX_UNICODE) +#if HAVE_BOOST_REGEX_UNICODE extern optional<boost::u32regex> _log_category_re; #else extern optional<boost::regex> _log_category_re; @@ -371,7 +379,7 @@ inline bool category_matches(const char * cat) { if (_log_category) { if (! _log_category_re) { _log_category_re = -#if defined(HAVE_BOOST_REGEX_UNICODE) +#if HAVE_BOOST_REGEX_UNICODE boost::make_u32regex(_log_category->c_str(), boost::regex::perl | boost::regex::icase); #else @@ -379,7 +387,7 @@ inline bool category_matches(const char * cat) { boost::regex::perl | boost::regex::icase); #endif } -#if defined(HAVE_BOOST_REGEX_UNICODE) +#if HAVE_BOOST_REGEX_UNICODE return boost::u32regex_search(cat, *_log_category_re); #else return boost::regex_search(cat, *_log_category_re); @@ -467,7 +475,7 @@ inline bool category_matches(const char * cat) { */ /*@{*/ -#if defined(LOGGING_ON) && defined(TIMERS_ON) +#if LOGGING_ON && TIMERS_ON namespace ledger { @@ -475,7 +483,7 @@ void start_timer(const char * name, log_level_t lvl); void stop_timer(const char * name); void finish_timer(const char * name); -#if defined(TRACING_ON) +#if TRACING_ON #define TRACE_START(name, lvl, msg) \ (SHOW_TRACE(lvl) ? \ ((ledger::_log_buffer << msg), \ @@ -490,7 +498,7 @@ void finish_timer(const char * name); #define TRACE_FINISH(name, lvl) #endif -#if defined(DEBUG_ON) +#if DEBUG_ON #define DEBUG_START(name, cat, msg) \ (SHOW_DEBUG(cat) ? \ ((ledger::_log_buffer << msg), \ @@ -575,11 +583,10 @@ inline void check_for_signal() { */ /*@{*/ -#if defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__ -#define foreach(x, y) for (x : y) -#define unique_ptr std::unique_ptr -#else #define foreach BOOST_FOREACH +#if HAVE_CXX11 +using std::unique_ptr; +#else #define unique_ptr std::auto_ptr #endif @@ -592,7 +599,7 @@ inline T& downcast(U& object) { path resolve_path(const path& pathname); -#ifdef HAVE_REALPATH +#if HAVE_REALPATH extern "C" char * realpath(const char *, char resolved_path[]); #endif diff --git a/src/value.cc b/src/value.cc index 832460ce..1921d5a3 100644 --- a/src/value.cc +++ b/src/value.cc @@ -256,7 +256,7 @@ value_t::sequence_t value_t::to_sequence() const void value_t::in_place_simplify() { -#if defined(DEBUG_ON) +#if DEBUG_ON LOGGER("value.simplify"); #endif @@ -273,7 +273,7 @@ void value_t::in_place_simplify() DEBUG_("as an amount it looks like: " << *this); } -#ifdef REDUCE_TO_INTEGER // this is off by default +#if REDUCE_TO_INTEGER // this is off by default if (is_amount() && ! as_amount().has_commodity() && as_amount().fits_in_long()) { DEBUG_("Reducing amount to integer"); diff --git a/src/value.h b/src/value.h index 74c015ec..ee3d414d 100644 --- a/src/value.h +++ b/src/value.h @@ -228,7 +228,7 @@ public: type = VOID; } -#if defined(HAVE_BOOST_SERIALIZATION) +#if HAVE_BOOST_SERIALIZATION private: /** Serialization. */ @@ -952,7 +952,7 @@ public: */ bool valid() const; -#if defined(HAVE_BOOST_SERIALIZATION) +#if HAVE_BOOST_SERIALIZATION private: /** Serialization. */ diff --git a/src/views.cc b/src/views.cc index bbd58ce2..76d06370 100644 --- a/src/views.cc +++ b/src/views.cc @@ -29,7 +29,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifdef DOCUMENT_MODEL +#if DOCUMENT_MODEL #include <system.hh> diff --git a/src/views.h b/src/views.h index 22bc1dd5..7f769250 100644 --- a/src/views.h +++ b/src/views.h @@ -44,7 +44,7 @@ #include "utils.h" -#ifdef DOCUMENT_MODEL +#if DOCUMENT_MODEL #include "scope.h" #include "item.h" diff --git a/src/xact.cc b/src/xact.cc index 0e7e7e00..b5cb2a38 100644 --- a/src/xact.cc +++ b/src/xact.cc @@ -65,7 +65,7 @@ xact_base_t::~xact_base_t() void xact_base_t::add_post(post_t * post) { -#if !defined(NO_ASSERTS) +#if !NO_ASSERTS // You can add temporary postings to transactions, but not real postings to // temporary transactions. if (! post->has_flags(ITEM_TEMP)) @@ -197,7 +197,7 @@ bool xact_base_t::finalize() } VERIFY(balance.valid()); -#if defined(DEBUG_ON) +#if DEBUG_ON DEBUG("xact.finalize", "initial balance = " << balance); DEBUG("xact.finalize", "balance is " << balance.label()); if (balance.is_balance()) @@ -488,7 +488,7 @@ bool xact_base_t::verify() xact_t::xact_t(const xact_t& e) : xact_base_t(e), code(e.code), payee(e.payee) -#ifdef DOCUMENT_MODEL +#if DOCUMENT_MODEL , data(NULL) #endif { @@ -739,7 +739,7 @@ void auto_xact_t::extend_xact(xact_base_t& xact, parse_context_t& context) else amt = post_amount; -#if defined(DEBUG_ON) +#if DEBUG_ON IF_DEBUG("xact.extend") { DEBUG("xact.extend", "Initial post on line " << initial_post->pos->beg_line << ": " @@ -760,7 +760,7 @@ void auto_xact_t::extend_xact(xact_base_t& xact, parse_context_t& context) if (amt.keep_precision()) DEBUG("xact.extend", " amt precision is kept"); } -#endif // defined(DEBUG_ON) +#endif // DEBUG_ON account_t * account = post->account; string fullname = account->fullname(); @@ -88,7 +88,7 @@ public: return true; } -#if defined(HAVE_BOOST_SERIALIZATION) +#if HAVE_BOOST_SERIALIZATION private: /** Serialization. */ @@ -109,12 +109,12 @@ public: optional<string> code; string payee; -#ifdef DOCUMENT_MODEL +#if DOCUMENT_MODEL mutable void * data; #endif xact_t() -#ifdef DOCUMENT_MODEL +#if DOCUMENT_MODEL : data(NULL) #endif { @@ -143,7 +143,7 @@ public: virtual bool valid() const; -#if defined(HAVE_BOOST_SERIALIZATION) +#if HAVE_BOOST_SERIALIZATION private: /** Serialization. */ @@ -177,7 +177,7 @@ public: : tag_data(_tag_data), overwrite_existing(_overwrite_existing), apply_to_post(NULL) {} -#if defined(HAVE_BOOST_SERIALIZATION) +#if HAVE_BOOST_SERIALIZATION private: /** Serialization. */ deferred_tag_data_t() : apply_to_post(NULL) {} @@ -237,7 +237,7 @@ private: virtual void extend_xact(xact_base_t& xact, parse_context_t& context); -#if defined(HAVE_BOOST_SERIALIZATION) +#if HAVE_BOOST_SERIALIZATION private: /** Serialization. */ @@ -285,7 +285,7 @@ class period_xact_t : public xact_base_t } } -#if defined(HAVE_BOOST_SERIALIZATION) +#if HAVE_BOOST_SERIALIZATION private: /** Serialization. */ diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 00000000..92c2a763 --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,16 @@ +include(ProcessorCount) +ProcessorCount(PROCESSORS) + +if(NOT PROCESSORS EQUAL 0) + set(CTEST_BUILD_FLAGS -j${PROCESSORS}) + set(ctest_test_args ${ctest_test_args} PARALLEL_LEVEL ${PROCESSORS}) +endif() + +get_target_property(LEDGER_LOCATION ledger LOCATION) + +add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND}) + +add_subdirectory(unit) +add_subdirectory(regress) + +### CMakeLists.txt ends here diff --git a/test/regress/CMakeLists.txt b/test/regress/CMakeLists.txt new file mode 100644 index 00000000..4b6232dd --- /dev/null +++ b/test/regress/CMakeLists.txt @@ -0,0 +1,19 @@ +if(HAVE_BOOST_PYTHON) + set(TEST_PYTHON_FLAGS "--python") +endif() + +if(PYTHONINTERP_FOUND) + file(GLOB REGRESSION_TESTS *.test) + foreach(TestFile ${REGRESSION_TESTS}) + get_filename_component(TestFile_Name ${TestFile} NAME_WE) + string(FIND ${TestFile_Name} "_py" TestFile_IsPythonTest) + if((NOT TestFile_IsPythonTest) OR HAVE_BOOST_PYTHON) + add_test(RegressionTest_${TestFile_Name} + ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/test/RegressTests.py + ${LEDGER_LOCATION} ${PROJECT_SOURCE_DIR} + ${TestFile} ${TEST_PYTHON_FLAGS}) + set_target_properties(check + PROPERTIES DEPENDS RegressionTest_${TestFile_Name}) + endif() + endforeach() +endif() diff --git a/test/unit/CMakeLists.txt b/test/unit/CMakeLists.txt new file mode 100644 index 00000000..5ecd5a87 --- /dev/null +++ b/test/unit/CMakeLists.txt @@ -0,0 +1,17 @@ +macro(add_ledger_test _name) + add_ledger_library_dependencies(${_name}) + add_test(Ledger${_name} ${PROJECT_BINARY_DIR}/${_name}) +endmacro(add_ledger_test _name) + +include_directories(${PROJECT_SOURCE_DIR}/src) + +if(BUILD_LIBRARY) + add_executable(UtilTests t_times.cc) + add_ledger_test(UtilTests) + + add_executable(MathTests t_amount.cc t_commodity.cc t_balance.cc t_expr.cc) + add_ledger_test(MathTests) + + set_target_properties(check PROPERTIES DEPENDS LedgerUtilTests) + set_target_properties(check PROPERTIES DEPENDS LedgerMathTests) +endif() diff --git a/tools/Makefile.am b/tools/Makefile.am deleted file mode 100644 index 49f31f6c..00000000 --- a/tools/Makefile.am +++ /dev/null @@ -1,530 +0,0 @@ -LIBVERSION = $(shell echo $(PACKAGE_VERSION) | sed 's/[-abgrc].*//') -ACLOCAL_AMFLAGS = -I m4 -dist_man_MANS = doc/ledger.1 -SUBDIRS = po intl -EXTRA_DIST = autogen.sh config.rpath contrib src/system.hh.in -DISTCLEANFILES = .timestamp - -lib_LTLIBRARIES = \ - libledger_report.la \ - libledger_data.la \ - libledger_math.la \ - libledger_util.la - -lib_cppflags = -I$(srcdir)/src -I$(srcdir)/lib \ - -I$(srcdir)/lib/utfcpp/source - -libledger_util_la_SOURCES = \ - src/stream.cc \ - src/mask.cc \ - src/times.cc \ - src/error.cc \ - src/utils.cc \ - lib/sha1.cpp - -libledger_util_la_CPPFLAGS = $(lib_cppflags) -libledger_util_la_LDFLAGS = -release $(LIBVERSION) - -libledger_math_la_SOURCES = \ - src/format.cc \ - src/query.cc \ - src/scope.cc \ - src/expr.cc \ - src/op.cc \ - src/parser.cc \ - src/token.cc \ - src/value.cc \ - src/balance.cc \ - src/quotes.cc \ - src/history.cc \ - src/pool.cc \ - src/annotate.cc \ - src/commodity.cc \ - src/amount.cc - -libledger_math_la_CPPFLAGS = $(lib_cppflags) -libledger_math_la_LDFLAGS = -release $(LIBVERSION) - -libledger_data_la_SOURCES = \ - src/option.cc \ - src/lookup.cc \ - src/compare.cc \ - src/iterators.cc \ - src/timelog.cc \ - src/textual.cc \ - src/temps.cc \ - src/journal.cc \ - src/archive.cc \ - src/account.cc \ - src/xact.cc \ - src/post.cc \ - src/item.cc - -libledger_data_la_CPPFLAGS = $(lib_cppflags) -libledger_data_la_LDFLAGS = -release $(LIBVERSION) - -libledger_report_la_SOURCES = \ - src/stats.cc \ - src/generate.cc \ - src/csv.cc \ - src/convert.cc \ - src/draft.cc \ - src/emacs.cc \ - src/org.cc \ - src/ptree.cc \ - src/print.cc \ - src/output.cc \ - src/precmd.cc \ - src/chain.cc \ - src/filters.cc \ - src/report.cc \ - src/views.cc \ - src/select.cc \ - src/session.cc - -libledger_report_la_CPPFLAGS = $(lib_cppflags) -libledger_report_la_LDFLAGS = -release $(LIBVERSION) - -pkginclude_HEADERS = \ - src/utils.h \ - src/flags.h \ - src/error.h \ - src/times.h \ - src/mask.h \ - src/stream.h \ - src/pstream.h \ - src/unistring.h \ - \ - src/amount.h \ - src/commodity.h \ - src/annotate.h \ - src/history.h \ - src/pool.h \ - src/quotes.h \ - src/balance.h \ - \ - src/value.h \ - src/token.h \ - src/parser.h \ - src/op.h \ - src/exprbase.h \ - src/expr.h \ - src/scope.h \ - src/predicate.h \ - src/query.h \ - src/format.h \ - src/option.h \ - \ - src/item.h \ - src/post.h \ - src/xact.h \ - src/account.h \ - src/journal.h \ - src/context.h \ - src/temps.h \ - src/archive.h \ - src/timelog.h \ - src/iterators.h \ - src/compare.h \ - src/lookup.h \ - \ - src/session.h \ - src/select.h \ - src/views.h \ - src/report.h \ - src/filters.h \ - src/chain.h \ - src/precmd.h \ - src/csv.h \ - src/convert.h \ - src/draft.h \ - src/generate.h \ - src/stats.h \ - src/print.h \ - src/output.h \ - src/ptree.h \ - src/emacs.h \ - src/org.h \ - \ - src/global.h \ - \ - src/pyinterp.h \ - \ - lib/sha1.h \ - lib/gettext.h \ - \ - lib/utfcpp/source/utf8.h \ - lib/utfcpp/source/utf8/checked.h \ - lib/utfcpp/source/utf8/core.h \ - lib/utfcpp/source/utf8/unchecked.h - -nodist_libledger_util_la_SOURCES = system.hh - -BUILT_SOURCES = system.hh -CLEANFILES = system.hh - -system.hh: src/system.hh.in - cp -p $< $@ - -if USE_PCH -nodist_libledger_util_la_SOURCES += system.hh.gch - -BUILT_SOURCES += system.hh.gch -CLEANFILES += system.hh.gch - -system.hh.gch: system.hh - -rm -f $@ - $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(lib_cppflags) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) \ - -o $@ $< -endif - -###################################################################### - -bin_PROGRAMS = ledger - -ledger_CPPFLAGS = $(lib_cppflags) -if HAVE_BOOST_PYTHON -ledger_CPPFLAGS += -I$(srcdir)/python -endif -ledger_SOURCES = src/main.cc src/global.cc -ledger_LDADD = $(LIBOBJS) $(lib_LTLIBRARIES) $(INTLLIBS) -ledger_LDFLAGS = -static - -info_TEXINFOS = doc/ledger.texi - -dist_lisp_LISP = lisp/ledger.el lisp/timeclock.el -ELCFILES = -DISTCLEANFILES += ledger.elc timeclock.elc - -all_sources = $(libledger_util_la_SOURCES) \ - $(libledger_math_la_SOURCES) \ - $(libledger_data_la_SOURCES) \ - $(libledger_report_la_SOURCES) \ - $(libledger_python_la_SOURCES) \ - src/pyledger.cc - -all_files = $(all_sources) $(pkginclude_HEADERS) - -###################################################################### - -if HAVE_BOOST_PYTHON - -lib_LTLIBRARIES += libledger_python.la - -libledger_python_la_SOURCES = \ - src/pyutils.h \ - src/pyfstream.h \ - src/py_account.cc \ - src/py_amount.cc \ - src/py_balance.cc \ - src/py_commodity.cc \ - src/py_expr.cc \ - src/py_format.cc \ - src/py_item.cc \ - src/py_session.cc \ - src/py_journal.cc \ - src/py_post.cc \ - src/py_times.cc \ - src/py_utils.cc \ - src/py_value.cc \ - src/py_xact.cc \ - src/pyinterp.cc - -libledger_python_la_CPPFLAGS = $(lib_cppflags) -I$(srcdir)/python - -pyexec_LTLIBRARIES = ledger.la - -ledger_la_CPPFLAGS = $(libledger_python_la_CPPFLAGS) -ledger_la_SOURCES = src/pyledger.cc -ledger_la_DEPENDENCIES = $(lib_LTLIBRARIES) -ledger_la_LDFLAGS = -avoid-version -module -ledger_la_LIBADD = $(LIBOBJS) $(lib_LTLIBRARIES) - -pkgpython_PYTHON = python/__init__.py python/server.py - -endif - -###################################################################### - -TESTS = RegressTests BaselineTests ManualTests ConfirmTests \ - GenerateTests - -if HAVE_BOOST_TEST -TESTS += \ - UtilTests \ - MathTests -# DataTests \ -# ReportTests -endif - -if DEBUG -TESTS += CheckTests -endif - -if HAVE_BOOST_PYTHON -TESTS += PyUnitTests -endif - -check_PROGRAMS = $(TESTS) - -TESTLIBS = -lboost_unit_test_framework$(BOOST_SUFFIX) \ - -lboost_test_exec_monitor$(BOOST_SUFFIX) - -UtilTests_SOURCES = \ - test/unit/t_times.cc - -UtilTests_CPPFLAGS = -I$(srcdir)/test $(lib_cppflags) -UtilTests_LDADD = libledger_util.la $(TESTLIBS) - -MathTests_SOURCES = \ - test/unit/t_expr.cc \ - test/unit/t_commodity.cc \ - test/unit/t_amount.cc \ - test/unit/t_balance.cc - -MathTests_CPPFLAGS = -I$(srcdir)/test $(lib_cppflags) -MathTests_LDADD = libledger_math.la $(UtilTests_LDADD) - -DataTests_SOURCES = - -DataTests_CPPFLAGS = -I$(srcdir)/test $(lib_cppflags) -DataTests_LDADD = libledger_data.la $(MathTests_LDADD) - -ReportTests_SOURCES = - -ReportTests_CPPFLAGS = -I$(srcdir)/test $(lib_cppflags) -ReportTests_LDADD = libledger_report.la $(DataTests_LDADD) - -all_tests_sources = \ - $(UtilTests_SOURCES) \ - $(MathTests_SOURCES) \ - $(DataTests_SOURCES) \ - $(ReportTests_SOURCES) - -PyUnitTests_SOURCES = test/PyUnitTests.py - -all_py_tests_sources = \ - $(patsubst test/unit/%.cc,$(top_builddir)/test/python/%.py, \ - $(filter test/unit/t_%.cc,$(all_tests_sources))) - -test/python/%.py: test/unit/%.cc test/convert.py - $(PYTHON) $(srcdir)/test/convert.py $< $@ - -test/python/ConvertedTests.py: $(all_py_tests_sources) - @echo "from unittest import TextTestRunner, TestSuite" > $@ - @for file in $$(ls $(srcdir)/test/unit/*.cc); do \ - base=$$(basename $$file); \ - base=$$(echo $$base | sed 's/\.cc//'); \ - echo "import $$base" >> $@; \ - done - @echo "suites = [" >> $@ - @for file in $$(ls $(srcdir)/test/unit/*.cc); do \ - base=$$(basename $$file); \ - base=$$(echo $$base | sed 's/\.cc//'); \ - echo " $$base.suite()," >> $@; \ - done - @echo "]" >> $@ - @echo "TextTestRunner().run(TestSuite(suites))" >> $@ - -ledger_python = $(top_builddir)/ledger$(EXEEXT) python - -ESC_python=`echo "$(ledger_python)" | sed 's/\//\\\\\//g'` -ESC_srcdir=`echo "$(srcdir)" | sed 's/\//\\\\\//g'` -ESC_builddir=`echo "$(top_builddir)" | sed 's/\//\\\\\//g'` -ESC_distdir=`echo "$(distdir)" | sed 's/\//\\\\\//g'` - -# jww (2007-05-10): This rule will not be triggered on systems that -# define an EXEEXT. -PyUnitTests: test/PyUnitTests.py test/python/ConvertedTests.py - @cat $(srcdir)/test/PyUnitTests.py \ - | sed "s/%python%/$(ESC_python)/" \ - | sed "s/%srcdir%/$(ESC_srcdir)/g" \ - | sed "s/%builddir%/$(ESC_builddir)/g" > $@ - chmod 755 $@ - -RegressTests_SOURCES = test/RegressTests.py - -EXTRA_DIST += test/regress test/convert.py test/LedgerHarness.py - -if HAVE_BOOST_PYTHON -TEST_PYTHON_FLAGS = --python -EXTRA_DIST += test/python -else -TEST_PYTHON_FLAGS = -endif - -RegressTests: $(srcdir)/test/RegressTests.py - echo "$(PYTHON) $(srcdir)/test/RegressTests.py -j$(JOBS) $(top_builddir)/ledger$(EXEEXT) $(srcdir) $(srcdir)/test/regress $(TEST_PYTHON_FLAGS) \"\$$@\"" > $@ - chmod 755 $@ - -BaselineTests_SOURCES = test/RegressTests.py - -EXTRA_DIST += test/baseline - -BaselineTests: $(srcdir)/test/RegressTests.py - echo "$(PYTHON) $(srcdir)/test/RegressTests.py -j$(JOBS) $(top_builddir)/ledger$(EXEEXT) $(srcdir) $(srcdir)/test/baseline $(TEST_PYTHON_FLAGS) \"\$$@\"" > $@ - chmod 755 $@ - -ManualTests_SOURCES = test/RegressTests.py - -EXTRA_DIST += test/manual - -ManualTests: $(srcdir)/test/RegressTests.py - echo "$(PYTHON) $(srcdir)/test/RegressTests.py -j$(JOBS) $(top_builddir)/ledger$(EXEEXT) $(srcdir) $(srcdir)/test/manual $(TEST_PYTHON_FLAGS) \"\$$@\"" > $@ - chmod 755 $@ - -ConfirmTests_SOURCES = test/ConfirmTests.py - -EXTRA_DIST += test/input - -test/input/mondo.dat: test/input/standard.dat - @for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ; do \ - for j in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ; do \ - cat $< >> $@; \ - done; \ - done - -ConfirmTests: $(srcdir)/test/ConfirmTests.py - echo "$(PYTHON) $(srcdir)/test/ConfirmTests.py $(top_builddir)/ledger$(EXEEXT) $(srcdir) $(srcdir)/test/input $(TEST_PYTHON_FLAGS) \"\$$@\"" > $@ - chmod 755 $@ - -GenerateTests_SOURCES = test/GenerateTests.py - -GenerateTests: $(srcdir)/test/GenerateTests.py - echo "$(PYTHON) $(srcdir)/test/GenerateTests.py -j$(JOBS) $(top_builddir)/ledger$(EXEEXT) $(srcdir) 1 ${1:-20} \"\$$@\"" > $@ - chmod 755 $@ - -CheckTests_SOURCES = test/CheckTests.py - -CheckTests: - echo "$(PYTHON) $(srcdir)/test/CheckTests.py $(top_builddir)/ledger$(EXEEXT) $(srcdir) \"\$$@\"" > $@ - chmod 755 $@ - -FULLCHECK=$(srcdir)/test/fullcheck.sh - -if HAVE_BOOST_TEST -unittests: check - @sh $(FULLCHECK) $(top_builddir)/UtilTests$(EXEEXT) --verify \ - 2>&1 | grep -v '^GuardMalloc:' - @sh $(FULLCHECK) $(top_builddir)/MathTests$(EXEEXT) --verify \ - 2>&1 | grep -v '^GuardMalloc:' -# @sh $(FULLCHECK) $(top_builddir)/DataTests$(EXEEXT) --verify \ -# 2>&1 | grep -v '^GuardMalloc:' -# @sh $(FULLCHECK) $(top_builddir)/ReportTests$(EXEEXT) --verify \ -# 2>&1 | grep -v '^GuardMalloc:' -else -unittests: check - @test 1 -eq 1 -endif - -fullcheck: unittests - @$(top_builddir)/RegressTests --verify - @$(top_builddir)/BaselineTests --verify - @$(top_builddir)/ManualTests --verify - @$(top_builddir)/ConfirmTests --verify - @$(top_builddir)/GenerateTests 20 --verify -# @$(top_builddir)/RegressTests --gmalloc -# @$(top_builddir)/BaselineTests --gmalloc -# @$(top_builddir)/ManualTests --gmalloc -# @$(top_builddir)/ConfirmTests --gmalloc - @$(top_builddir)/GenerateTests 10000 -# @$(top_builddir)/GenerateTests --gmalloc - -###################################################################### - -EXTRA_DIST += doc/README doc/NEWS doc/ledger.pdf -EXTRA_DIST += doc/LICENSE doc/LICENSE-sha1 doc/LICENSE-utfcpp -if USE_DOXYGEN -EXTRA_DIST += doc/Doxyfile doc/refman.pdf -endif - -DISTCLEANFILES += doc/ledger.info doc/ledger.pdf -if USE_DOXYGEN -DISTCLEANFILES += Doxyfile.gen doc/Doxyfile.bak doc/refman.pdf -endif - -if USE_DOXYGEN -dist-hook-doxygen: - find $(distdir)/doc -name .dirstamp -delete - rm -fr $(distdir)/doc/latex \ - $(distdir)/doc/Doxyfile.bak \ - $(distdir)/doc/Doxyfile.gen - cp -pR doc/html $(distdir)/doc -else -dist-hook-doxygen: - @test 1 -eq 1 -endif - -dist-hook: dist-hook-doxygen - find $(distdir) -name .DS_Store -delete - find $(distdir) -name .localized -delete - rm -f $(distdir)/README.textile - cp -p $(srcdir)/doc/README $(distdir)/README - -if USE_DOXYGEN -distclean-local-doxygen: - rm -fr doc/html doc/latex - rm -f doc/refman.pdf -else -distclean-local-doxygen: - @test 1 -eq 1 -endif - -distclean-local: distclean-local-doxygen - rm -fr test/python - -if USE_DOXYGEN -ESC_top_builddir=`cd $(top_builddir); pwd | sed 's/\//\\\\\//g'` - -Doxyfile.gen: doc/Doxyfile - cat $< | sed "s/%srcdir%/$(ESC_srcdir)/g" \ - | sed "s/%builddir%/$(ESC_top_builddir)/g" > $@ - -doc/html/index.html: Doxyfile.gen $(all_files) - BUILD_DIR=`cd $(top_builddir); pwd`; \ - (cd $(srcdir); doxygen $$BUILD_DIR/Doxyfile.gen) - -# The intention with the following rules is that all of the Doxygen -# documentation (both HTML and PDF) is built locally before distcheck is -# run, since it's quite possible that the user will not have a complete -# TeX + Doxygen + dot environment on their own system. - -doc/refman.pdf: doc/html/index.html - (cd doc/latex && make) - cp doc/latex/refman.pdf $@ - -docs: pdf doc/refman.pdf -else -docs: pdf -endif - -libs: - @echo Building dependency libs and installing in /usr/local/stow ... - git submodule update --init - (cd lib; make) - -report: all - lcov -d $(shell pwd) --zerocounters - if [ -d doc/report ]; then rm -fr doc/report; fi - -mkdir doc/report - lcov -c -i -d $(shell pwd) -o doc/report/ledger_base.info - make check - lcov -c -d $(shell pwd) --checksum -o doc/report/ledger_test.info - lcov -a doc/report/ledger_base.info \ - -a doc/report/ledger_test.info -o doc/report/ledger_total.info - lcov --extract doc/report/ledger_total.info '*/src/*' \ - -o doc/report/ledger_cov.info - genhtml -o doc/report doc/report/ledger_cov.info - @echo Coverage reported generated\; now open doc/report/index.html - -LEDGER_BINARY = $(top_builddir)/ledger$(EXEEXT) -SPEEDTEST_DAT = $(srcdir)/test/input/speed-test.dat -SPEEDTEST_ARGS = -v --decimal-comma -o /dev/null reg 2eb75f84 1eede0cb - -speedtest: - @$(LEDGER_BINARY) -f $(SPEEDTEST_DAT) $(SPEEDTEST_ARGS) - @$(LEDGER_BINARY) -f $(SPEEDTEST_DAT) $(SPEEDTEST_ARGS) -V - @$(LEDGER_BINARY) -f $(SPEEDTEST_DAT) $(SPEEDTEST_ARGS) -X € - -# Makefile.am ends here diff --git a/tools/autogen.sh b/tools/autogen.sh deleted file mode 100755 index a8b63eff..00000000 --- a/tools/autogen.sh +++ /dev/null @@ -1,1491 +0,0 @@ -#!/bin/sh -# a u t o g e n . s h -# -# Copyright (c) 2005-2007 United States Government as represented by -# the U.S. Army Research Laboratory. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following -# disclaimer in the documentation and/or other materials provided -# with the distribution. -# -# 3. The name of the author may not be used to endorse or promote -# products derived from this software without specific prior written -# permission. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS -# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY -# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE -# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -### -# -# Script for automatically preparing the sources for compilation by -# performing the myrid of necessary steps. The script attempts to -# detect proper version support, and outputs warnings about particular -# systems that have autotool peculiarities. -# -# Basically, if everything is set up and installed correctly, the -# script will validate that minimum versions of the GNU Build System -# tools are installed, account for several common configuration -# issues, and then simply run autoreconf for you. -# -# If autoreconf fails, which can happen for many valid configurations, -# this script proceeds to run manual preparation steps effectively -# providing a POSIX shell script (mostly complete) reimplementation of -# autoreconf. -# -# The AUTORECONF, AUTOCONF, AUTOMAKE, LIBTOOLIZE, ACLOCAL, AUTOHEADER -# environment variables and corresponding _OPTIONS variables (e.g. -# AUTORECONF_OPTIONS) may be used to override the default automatic -# detection behaviors. Similarly the _VERSION variables will override -# the minimum required version numbers. -# -# Examples: -# -# To obtain help on usage: -# ./autogen.sh --help -# -# To obtain verbose output: -# ./autogen.sh --verbose -# -# To skip autoreconf and prepare manually: -# AUTORECONF=false ./autogen.sh -# -# To verbosely try running with an older (unsupported) autoconf: -# AUTOCONF_VERSION=2.50 ./autogen.sh --verbose -# -# Author: Christopher Sean Morrison <morrison@brlcad.org> -# -###################################################################### - -# set to minimum acceptible version of autoconf -if [ "x$AUTOCONF_VERSION" = "x" ] ; then - AUTOCONF_VERSION=2.52 -fi -# set to minimum acceptible version of automake -if [ "x$AUTOMAKE_VERSION" = "x" ] ; then - AUTOMAKE_VERSION=1.6.0 -fi -# set to minimum acceptible version of libtool -if [ "x$LIBTOOL_VERSION" = "x" ] ; then - LIBTOOL_VERSION=1.4.2 -fi - - -################## -# ident function # -################## -ident ( ) { - # extract copyright from header - __copyright="`grep Copyright $AUTOGEN_SH | head -${HEAD_N}1 | awk '{print $4}'`" - if [ "x$__copyright" = "x" ] ; then - __copyright="`date +%Y`" - fi - - # extract version from CVS Id string - __id="$Id: autogen.sh,v 14.97 2007/06/18 22:25:02 brlcad Exp $" - __version="`echo $__id | sed 's/.*\([0-9][0-9][0-9][0-9]\)[-\/]\([0-9][0-9]\)[-\/]\([0-9][0-9]\).*/\1\2\3/'`" - if [ "x$__version" = "x" ] ; then - __version="" - fi - - echo "autogen.sh build preparation script by Christopher Sean Morrison" - echo "revised 3-clause BSD-style license, copyright (c) $__copyright" - echo "script version $__version, ISO/IEC 9945 POSIX shell script" -} - - -################## -# USAGE FUNCTION # -################## -usage ( ) { - echo "Usage: $AUTOGEN_SH [-h|--help] [-v|--verbose] [-q|--quiet] [--version]" - echo " --help Help on $NAME_OF_AUTOGEN usage" - echo " --verbose Verbose progress output" - echo " --quiet Quiet suppressed progress output" - echo " --version Only perform GNU Build System version checks" - echo - echo "Description: This script will validate that minimum versions of the" - echo "GNU Build System tools are installed and then run autoreconf for you." - echo "Should autoreconf fail, manual preparation steps will be run" - echo "potentially accounting for several common preparation issues. The" - - echo "AUTORECONF, AUTOCONF, AUTOMAKE, LIBTOOLIZE, ACLOCAL, AUTOHEADER," - echo "PROJECT, & CONFIGURE environment variables and corresponding _OPTIONS" - echo "variables (e.g. AUTORECONF_OPTIONS) may be used to override the" - echo "default automatic detection behavior." - echo - - ident - - return 0 -} - - -########################## -# VERSION_ERROR FUNCTION # -########################## -version_error ( ) { - if [ "x$1" = "x" ] ; then - echo "INTERNAL ERROR: version_error was not provided a version" - exit 1 - fi - if [ "x$2" = "x" ] ; then - echo "INTERNAL ERROR: version_error was not provided an application name" - exit 1 - fi - $ECHO - $ECHO "ERROR: To prepare the ${PROJECT} build system from scratch," - $ECHO " at least version $1 of $2 must be installed." - $ECHO - $ECHO "$NAME_OF_AUTOGEN does not need to be run on the same machine that will" - $ECHO "run configure or make. Either the GNU Autotools will need to be installed" - $ECHO "or upgraded on this system, or $NAME_OF_AUTOGEN must be run on the source" - $ECHO "code on another system and then transferred to here. -- Cheers!" - $ECHO -} - -########################## -# VERSION_CHECK FUNCTION # -########################## -version_check ( ) { - if [ "x$1" = "x" ] ; then - echo "INTERNAL ERROR: version_check was not provided a minimum version" - exit 1 - fi - _min="$1" - if [ "x$2" = "x" ] ; then - echo "INTERNAL ERROR: version check was not provided a comparison version" - exit 1 - fi - _cur="$2" - - # needed to handle versions like 1.10 and 1.4-p6 - _min="`echo ${_min}. | sed 's/[^0-9]/./g' | sed 's/\.\././g'`" - _cur="`echo ${_cur}. | sed 's/[^0-9]/./g' | sed 's/\.\././g'`" - - _min_major="`echo $_min | cut -d. -f1`" - _min_minor="`echo $_min | cut -d. -f2`" - _min_patch="`echo $_min | cut -d. -f3`" - - _cur_major="`echo $_cur | cut -d. -f1`" - _cur_minor="`echo $_cur | cut -d. -f2`" - _cur_patch="`echo $_cur | cut -d. -f3`" - - if [ "x$_min_major" = "x" ] ; then - _min_major=0 - fi - if [ "x$_min_minor" = "x" ] ; then - _min_minor=0 - fi - if [ "x$_min_patch" = "x" ] ; then - _min_patch=0 - fi - if [ "x$_cur_minor" = "x" ] ; then - _cur_major=0 - fi - if [ "x$_cur_minor" = "x" ] ; then - _cur_minor=0 - fi - if [ "x$_cur_patch" = "x" ] ; then - _cur_patch=0 - fi - - $VERBOSE_ECHO "Checking if ${_cur_major}.${_cur_minor}.${_cur_patch} is greater than ${_min_major}.${_min_minor}.${_min_patch}" - - if [ $_min_major -lt $_cur_major ] ; then - return 0 - elif [ $_min_major -eq $_cur_major ] ; then - if [ $_min_minor -lt $_cur_minor ] ; then - return 0 - elif [ $_min_minor -eq $_cur_minor ] ; then - if [ $_min_patch -lt $_cur_patch ] ; then - return 0 - elif [ $_min_patch -eq $_cur_patch ] ; then - return 0 - fi - fi - fi - return 1 -} - - -###################################### -# LOCATE_CONFIGURE_TEMPLATE FUNCTION # -###################################### -locate_configure_template ( ) { - _pwd="`pwd`" - if test -f "./configure.ac" ; then - echo "./configure.ac" - elif test -f "./configure.in" ; then - echo "./configure.in" - elif test -f "$_pwd/configure.ac" ; then - echo "$_pwd/configure.ac" - elif test -f "$_pwd/configure.in" ; then - echo "$_pwd/configure.in" - elif test -f "$PATH_TO_AUTOGEN/configure.ac" ; then - echo "$PATH_TO_AUTOGEN/configure.ac" - elif test -f "$PATH_TO_AUTOGEN/configure.in" ; then - echo "$PATH_TO_AUTOGEN/configure.in" - fi -} - - -################## -# argument check # -################## -ARGS="$*" -PATH_TO_AUTOGEN="`dirname $0`" -NAME_OF_AUTOGEN="`basename $0`" -AUTOGEN_SH="$PATH_TO_AUTOGEN/$NAME_OF_AUTOGEN" - -LIBTOOL_M4="${PATH_TO_AUTOGEN}/misc/libtool.m4" - -if [ "x$HELP" = "x" ] ; then - HELP=no -fi -if [ "x$QUIET" = "x" ] ; then - QUIET=no -fi -if [ "x$VERBOSE" = "x" ] ; then - VERBOSE=no -fi -if [ "x$VERSION_ONLY" = "x" ] ; then - VERSION_ONLY=no -fi -if [ "x$AUTORECONF_OPTIONS" = "x" ] ; then - AUTORECONF_OPTIONS="-i -f" -fi -if [ "x$AUTOCONF_OPTIONS" = "x" ] ; then - AUTOCONF_OPTIONS="-f" -fi -if [ "x$AUTOMAKE_OPTIONS" = "x" ] ; then - AUTOMAKE_OPTIONS="-a -c -f" -fi -ALT_AUTOMAKE_OPTIONS="-a -c" -if [ "x$LIBTOOLIZE_OPTIONS" = "x" ] ; then - LIBTOOLIZE_OPTIONS="--automake -c -f" -fi -ALT_LIBTOOLIZE_OPTIONS="--automake --copy --force" -if [ "x$ACLOCAL_OPTIONS" = "x" ] ; then - ACLOCAL_OPTIONS="" -fi -if [ "x$AUTOHEADER_OPTIONS" = "x" ] ; then - AUTOHEADER_OPTIONS="" -fi -for arg in $ARGS ; do - case "x$arg" in - x--help) HELP=yes ;; - x-[hH]) HELP=yes ;; - x--quiet) QUIET=yes ;; - x-[qQ]) QUIET=yes ;; - x--verbose) VERBOSE=yes ;; - x-[vV]) VERBOSE=yes ;; - x--version) VERSION_ONLY=yes ;; - *) - echo "Unknown option: $arg" - echo - usage - exit 1 - ;; - esac -done - - -##################### -# environment check # -##################### - -# sanity check before recursions potentially begin -if [ ! -f "$AUTOGEN_SH" ] ; then - echo "INTERNAL ERROR: $AUTOGEN_SH does not exist" - if [ ! "x$0" = "x$AUTOGEN_SH" ] ; then - echo "INTERNAL ERROR: dirname/basename inconsistency: $0 != $AUTOGEN_SH" - fi - exit 1 -fi - -# force locale setting to C so things like date output as expected -LC_ALL=C - -# commands that this script expects -for __cmd in echo head tail pwd ; do - echo "test" | $__cmd > /dev/null 2>&1 - if [ $? != 0 ] ; then - echo "INTERNAL ERROR: '${__cmd}' command is required" - exit 2 - fi -done -echo "test" | grep "test" > /dev/null 2>&1 -if test ! x$? = x0 ; then - echo "INTERNAL ERROR: grep command is required" - exit 1 -fi -echo "test" | sed "s/test/test/" > /dev/null 2>&1 -if test ! x$? = x0 ; then - echo "INTERNAL ERROR: sed command is required" - exit 1 -fi - - -# determine the behavior of echo -case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in - *c*,-n*) ECHO_N= ECHO_C=' -' ECHO_T=' ' ;; - *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; - *) ECHO_N= ECHO_C='\c' ECHO_T= ;; -esac - -# determine the behavior of head -case "x`echo 'head' | head -n 1 2>&1`" in - *xhead*) HEAD_N="n " ;; - *) HEAD_N="" ;; -esac - -# determine the behavior of tail -case "x`echo 'tail' | tail -n 1 2>&1`" in - *xtail*) TAIL_N="n " ;; - *) TAIL_N="" ;; -esac - -VERBOSE_ECHO=: -ECHO=: -if [ "x$QUIET" = "xyes" ] ; then - if [ "x$VERBOSE" = "xyes" ] ; then - echo "Verbose output quelled by quiet option. Further output disabled." - fi -else - ECHO=echo - if [ "x$VERBOSE" = "xyes" ] ; then - echo "Verbose output enabled" - VERBOSE_ECHO=echo - fi -fi - - -# allow a recursive run to disable further recursions -if [ "x$RUN_RECURSIVE" = "x" ] ; then - RUN_RECURSIVE=yes -fi - - -################################################ -# check for help arg and bypass version checks # -################################################ -if [ "x`echo $ARGS | sed 's/.*[hH][eE][lL][pP].*/help/'`" = "xhelp" ] ; then - HELP=yes -fi -if [ "x$HELP" = "xyes" ] ; then - usage - $ECHO "---" - $ECHO "Help was requested. No preparation or configuration will be performed." - exit 0 -fi - - -####################### -# set up signal traps # -####################### -untrap_abnormal ( ) { - for sig in 1 2 13 15; do - trap - $sig - done -} - -# do this cleanup whenever we exit. -trap ' - # start from the root - if test -d "$START_PATH" ; then - cd "$START_PATH" - fi - - # restore/delete backup files - if test "x$PFC_INIT" = "x1" ; then - recursive_restore - fi -' 0 - -# trap SIGHUP (1), SIGINT (2), SIGPIPE (13), SIGTERM (15) -for sig in 1 2 13 15; do - trap ' - $ECHO "" - $ECHO "Aborting $NAME_OF_AUTOGEN: caught signal '$sig'" - - # start from the root - if test -d "$START_PATH" ; then - cd "$START_PATH" - fi - - # clean up on abnormal exit - $VERBOSE_ECHO "rm -rf autom4te.cache" - rm -rf autom4te.cache - - if test -f "acinclude.m4.$$.backup" ; then - $VERBOSE_ECHO "cat acinclude.m4.$$.backup > acinclude.m4" - chmod u+w acinclude.m4 - cat acinclude.m4.$$.backup > acinclude.m4 - - $VERBOSE_ECHO "rm -f acinclude.m4.$$.backup" - rm -f acinclude.m4.$$.backup - fi - - { (exit 1); exit 1; } -' $sig -done - - -############################# -# look for a configure file # -############################# -if [ "x$CONFIGURE" = "x" ] ; then - CONFIGURE="`locate_configure_template`" - if [ ! "x$CONFIGURE" = "x" ] ; then - $VERBOSE_ECHO "Found a configure template: $CONFIGURE" - fi -else - $ECHO "Using CONFIGURE environment variable override: $CONFIGURE" -fi -if [ "x$CONFIGURE" = "x" ] ; then - if [ "x$VERSION_ONLY" = "xyes" ] ; then - CONFIGURE=/dev/null - else - $ECHO - $ECHO "A configure.ac or configure.in file could not be located implying" - $ECHO "that the GNU Build System is at least not used in this directory. In" - $ECHO "any case, there is nothing to do here without one of those files." - $ECHO - $ECHO "ERROR: No configure.in or configure.ac file found in `pwd`" - exit 1 - fi -fi - -#################### -# get project name # -#################### -if [ "x$PROJECT" = "x" ] ; then - PROJECT="`grep AC_INIT $CONFIGURE | grep -v '.*#.*AC_INIT' | tail -${TAIL_N}1 | sed 's/^[ ]*AC_INIT(\([^,)]*\).*/\1/' | sed 's/.*\[\(.*\)\].*/\1/'`" - if [ "x$PROJECT" = "xAC_INIT" ] ; then - # projects might be using the older/deprecated arg-less AC_INIT .. look for AM_INIT_AUTOMAKE instead - PROJECT="`grep AM_INIT_AUTOMAKE $CONFIGURE | grep -v '.*#.*AM_INIT_AUTOMAKE' | tail -${TAIL_N}1 | sed 's/^[ ]*AM_INIT_AUTOMAKE(\([^,)]*\).*/\1/' | sed 's/.*\[\(.*\)\].*/\1/'`" - fi - if [ "x$PROJECT" = "xAM_INIT_AUTOMAKE" ] ; then - PROJECT="project" - fi - if [ "x$PROJECT" = "x" ] ; then - PROJECT="project" - fi -else - $ECHO "Using PROJECT environment variable override: $PROJECT" -fi -$ECHO "Preparing the $PROJECT build system...please wait" -$ECHO - - -######################## -# check for autoreconf # -######################## -HAVE_AUTORECONF=no -if [ "x$AUTORECONF" = "x" ] ; then - for AUTORECONF in autoreconf ; do - $VERBOSE_ECHO "Checking autoreconf version: $AUTORECONF --version" - $AUTORECONF --version > /dev/null 2>&1 - if [ $? = 0 ] ; then - HAVE_AUTORECONF=yes - break - fi - done -else - HAVE_AUTORECONF=yes - $ECHO "Using AUTORECONF environment variable override: $AUTORECONF" -fi - - -########################## -# autoconf version check # -########################## -_acfound=no -if [ "x$AUTOCONF" = "x" ] ; then - for AUTOCONF in autoconf ; do - $VERBOSE_ECHO "Checking autoconf version: $AUTOCONF --version" - $AUTOCONF --version > /dev/null 2>&1 - if [ $? = 0 ] ; then - _acfound=yes - break - fi - done -else - _acfound=yes - $ECHO "Using AUTOCONF environment variable override: $AUTOCONF" -fi - -_report_error=no -if [ ! "x$_acfound" = "xyes" ] ; then - $ECHO "ERROR: Unable to locate GNU Autoconf." - _report_error=yes -else - _version="`$AUTOCONF --version | head -${HEAD_N}1 | sed 's/[^0-9]*\([0-9\.][0-9\.]*\)/\1/'`" - if [ "x$_version" = "x" ] ; then - _version="0.0.0" - fi - $ECHO "Found GNU Autoconf version $_version" - version_check "$AUTOCONF_VERSION" "$_version" - if [ $? -ne 0 ] ; then - _report_error=yes - fi -fi -if [ "x$_report_error" = "xyes" ] ; then - version_error "$AUTOCONF_VERSION" "GNU Autoconf" - exit 1 -fi - - -########################## -# automake version check # -########################## -_amfound=no -if [ "x$AUTOMAKE" = "x" ] ; then - for AUTOMAKE in automake ; do - $VERBOSE_ECHO "Checking automake version: $AUTOMAKE --version" - $AUTOMAKE --version > /dev/null 2>&1 - if [ $? = 0 ] ; then - _amfound=yes - break - fi - done -else - _amfound=yes - $ECHO "Using AUTOMAKE environment variable override: $AUTOMAKE" -fi - - -_report_error=no -if [ ! "x$_amfound" = "xyes" ] ; then - $ECHO - $ECHO "ERROR: Unable to locate GNU Automake." - _report_error=yes -else - _version="`$AUTOMAKE --version | head -${HEAD_N}1 | sed 's/[^0-9]*\([0-9\.][0-9\.]*\)/\1/'`" - if [ "x$_version" = "x" ] ; then - _version="0.0.0" - fi - $ECHO "Found GNU Automake version $_version" - version_check "$AUTOMAKE_VERSION" "$_version" - if [ $? -ne 0 ] ; then - _report_error=yes - fi -fi -if [ "x$_report_error" = "xyes" ] ; then - version_error "$AUTOMAKE_VERSION" "GNU Automake" - exit 1 -fi - - -######################## -# check for libtoolize # -######################## -HAVE_LIBTOOLIZE=yes -HAVE_ALT_LIBTOOLIZE=no -_ltfound=no -if [ "x$LIBTOOLIZE" = "x" ] ; then - LIBTOOLIZE=libtoolize - $VERBOSE_ECHO "Checking libtoolize version: $LIBTOOLIZE --version" - $LIBTOOLIZE --version > /dev/null 2>&1 - if [ ! $? = 0 ] ; then - HAVE_LIBTOOLIZE=no - $ECHO - if [ "x$HAVE_AUTORECONF" = "xno" ] ; then - $ECHO "Warning: libtoolize does not appear to be available." - else - $ECHO "Warning: libtoolize does not appear to be available. This means that" - $ECHO "the automatic build preparation via autoreconf will probably not work." - $ECHO "Preparing the build by running each step individually, however, should" - $ECHO "work and will be done automatically for you if autoreconf fails." - fi - - # look for some alternates - for tool in glibtoolize libtoolize15 libtoolize14 libtoolize13 ; do - $VERBOSE_ECHO "Checking libtoolize alternate: $tool --version" - _glibtoolize="`$tool --version > /dev/null 2>&1`" - if [ $? = 0 ] ; then - $VERBOSE_ECHO "Found $tool --version" - _glti="`which $tool`" - if [ "x$_glti" = "x" ] ; then - $VERBOSE_ECHO "Cannot find $tool with which" - continue; - fi - if test ! -f "$_glti" ; then - $VERBOSE_ECHO "Cannot use $tool, $_glti is not a file" - continue; - fi - _gltidir="`dirname $_glti`" - if [ "x$_gltidir" = "x" ] ; then - $VERBOSE_ECHO "Cannot find $tool path with dirname of $_glti" - continue; - fi - if test ! -d "$_gltidir" ; then - $VERBOSE_ECHO "Cannot use $tool, $_gltidir is not a directory" - continue; - fi - HAVE_ALT_LIBTOOLIZE=yes - LIBTOOLIZE="$tool" - $ECHO - $ECHO "Fortunately, $tool was found which means that your system may simply" - $ECHO "have a non-standard or incomplete GNU Autotools install. If you have" - $ECHO "sufficient system access, it may be possible to quell this warning by" - $ECHO "running:" - $ECHO - sudo -V > /dev/null 2>&1 - if [ $? = 0 ] ; then - $ECHO " sudo ln -s $_glti $_gltidir/libtoolize" - $ECHO - else - $ECHO " ln -s $_glti $_gltidir/libtoolize" - $ECHO - $ECHO "Run that as root or with proper permissions to the $_gltidir directory" - $ECHO - fi - _ltfound=yes - break - fi - done - else - _ltfound=yes - fi -else - _ltfound=yes - $ECHO "Using LIBTOOLIZE environment variable override: $LIBTOOLIZE" -fi - - -############################ -# libtoolize version check # -############################ -_report_error=no -if [ ! "x$_ltfound" = "xyes" ] ; then - $ECHO - $ECHO "ERROR: Unable to locate GNU Libtool." - _report_error=yes -else - _version="`$LIBTOOLIZE --version | head -${HEAD_N}1 | sed 's/[^0-9]*\([0-9\.][0-9\.]*\)/\1/'`" - if [ "x$_version" = "x" ] ; then - _version="0.0.0" - fi - $ECHO "Found GNU Libtool version $_version" - version_check "$LIBTOOL_VERSION" "$_version" - if [ $? -ne 0 ] ; then - _report_error=yes - fi -fi -if [ "x$_report_error" = "xyes" ] ; then - version_error "$LIBTOOL_VERSION" "GNU Libtool" - exit 1 -fi - - -##################### -# check for aclocal # -##################### -if [ "x$ACLOCAL" = "x" ] ; then - for ACLOCAL in aclocal ; do - $VERBOSE_ECHO "Checking aclocal version: $ACLOCAL --version" - $ACLOCAL --version > /dev/null 2>&1 - if [ $? = 0 ] ; then - break - fi - done -else - $ECHO "Using ACLOCAL environment variable override: $ACLOCAL" -fi - - -######################## -# check for autoheader # -######################## -if [ "x$AUTOHEADER" = "x" ] ; then - for AUTOHEADER in autoheader ; do - $VERBOSE_ECHO "Checking autoheader version: $AUTOHEADER --version" - $AUTOHEADER --version > /dev/null 2>&1 - if [ $? = 0 ] ; then - break - fi - done -else - $ECHO "Using AUTOHEADER environment variable override: $AUTOHEADER" -fi - - -######################### -# check if version only # -######################### -$VERBOSE_ECHO "Checking whether to only output version information" -if [ "x$VERSION_ONLY" = "xyes" ] ; then - $ECHO - ident - $ECHO "---" - $ECHO "Version requested. No preparation or configuration will be performed." - exit 0 -fi - - -################################# -# PROTECT_FROM_CLOBBER FUNCTION # -################################# -protect_from_clobber ( ) { - PFC_INIT=1 - - # protect COPYING & INSTALL from overwrite by automake. the - # automake force option will (inappropriately) ignore the existing - # contents of a COPYING and/or INSTALL files (depending on the - # version) instead of just forcing *missing* files like it does - # for AUTHORS, NEWS, and README. this is broken but extremely - # prevalent behavior, so we protect against it by keeping a backup - # of the file that can later be restored. - - if test -f COPYING ; then - if test -f COPYING.$$.protect_from_automake.backup ; then - $VERBOSE_ECHO "Already backed up COPYING in `pwd`" - else - $VERBOSE_ECHO "Backing up COPYING in `pwd`" - $VERBOSE_ECHO "cp -p COPYING COPYING.$$.protect_from_automake.backup" - cp -p COPYING COPYING.$$.protect_from_automake.backup - fi - fi - if test -f INSTALL ; then - if test -f INSTALL.$$.protect_from_automake.backup ; then - $VERBOSE_ECHO "Already backed up INSTALL in `pwd`" - else - $VERBOSE_ECHO "Backing up INSTALL in `pwd`" - $VERBOSE_ECHO "cp -p INSTALL INSTALL.$$.protect_from_automake.backup" - cp -p INSTALL INSTALL.$$.protect_from_automake.backup - fi - fi -} - - -############################## -# RECURSIVE_PROTECT FUNCTION # -############################## -recursive_protect ( ) { - - # for projects using recursive configure, run the build - # preparation steps for the subdirectories. this function assumes - # START_PATH was set to pwd before recursion begins so that - # relative paths work. - - # git 'r done, protect COPYING and INSTALL from being clobbered - protect_from_clobber - - if test -d autom4te.cache ; then - $VERBOSE_ECHO "Found an autom4te.cache directory, deleting it" - $VERBOSE_ECHO "rm -rf autom4te.cache" - rm -rf autom4te.cache - fi - - # find configure template - _configure="`locate_configure_template`" - if [ "x$_configure" = "x" ] ; then - return - fi - # $VERBOSE_ECHO "Looking for configure template found `pwd`/$_configure" - - # look for subdirs - # $VERBOSE_ECHO "Looking for subdirs in `pwd`" - _det_config_subdirs="`grep AC_CONFIG_SUBDIRS $_configure | grep -v '.*#.*AC_CONFIG_SUBDIRS' | sed 's/^[ ]*AC_CONFIG_SUBDIRS(\(.*\)).*/\1/' | sed 's/.*\[\(.*\)\].*/\1/'`" - CHECK_DIRS="" - for dir in $_det_config_subdirs ; do - if test -d "`pwd`/$dir" ; then - CHECK_DIRS="$CHECK_DIRS \"`pwd`/$dir\"" - fi - done - - # process subdirs - if [ ! "x$CHECK_DIRS" = "x" ] ; then - $VERBOSE_ECHO "Recursively scanning the following directories:" - $VERBOSE_ECHO " $CHECK_DIRS" - for dir in $CHECK_DIRS ; do - $VERBOSE_ECHO "Protecting files from automake in $dir" - cd "$START_PATH" - eval "cd $dir" - - # recursively git 'r done - recursive_protect - done - fi -} # end of recursive_protect - - -############################# -# RESTORE_CLOBBERED FUNCION # -############################# -restore_clobbered ( ) { - - # The automake (and autoreconf by extension) -f/--force-missing - # option may overwrite COPYING and INSTALL even if they do exist. - # Here we restore the files if necessary. - - spacer=no - - # COPYING - if test -f COPYING.$$.protect_from_automake.backup ; then - if test -f COPYING ; then - # compare entire content, restore if needed - if test "x`cat COPYING`" != "x`cat COPYING.$$.protect_from_automake.backup`" ; then - if test "x$spacer" = "xno" ; then - $VERBOSE_ECHO - spacer=yes - fi - # restore the backup - $VERBOSE_ECHO "Restoring COPYING from backup (automake -f likely clobbered it)" - $VERBOSE_ECHO "rm -f COPYING" - rm -f COPYING - $VERBOSE_ECHO "mv COPYING.$$.protect_from_automake.backup COPYING" - mv COPYING.$$.protect_from_automake.backup COPYING - fi # check contents - elif test -f COPYING.$$.protect_from_automake.backup ; then - $VERBOSE_ECHO "mv COPYING.$$.protect_from_automake.backup COPYING" - mv COPYING.$$.protect_from_automake.backup COPYING - fi # -f COPYING - - # just in case - $VERBOSE_ECHO "rm -f COPYING.$$.protect_from_automake.backup" - rm -f COPYING.$$.protect_from_automake.backup - fi # -f COPYING.$$.protect_from_automake.backup - - # INSTALL - if test -f INSTALL.$$.protect_from_automake.backup ; then - if test -f INSTALL ; then - # compare entire content, restore if needed - if test "x`cat INSTALL`" != "x`cat INSTALL.$$.protect_from_automake.backup`" ; then - if test "x$spacer" = "xno" ; then - $VERBOSE_ECHO - spacer=yes - fi - # restore the backup - $VERBOSE_ECHO "Restoring INSTALL from backup (automake -f likely clobbered it)" - $VERBOSE_ECHO "rm -f INSTALL" - rm -f INSTALL - $VERBOSE_ECHO "mv INSTALL.$$.protect_from_automake.backup INSTALL" - mv INSTALL.$$.protect_from_automake.backup INSTALL - fi # check contents - elif test -f INSTALL.$$.protect_from_automake.backup ; then - $VERBOSE_ECHO "mv INSTALL.$$.protect_from_automake.backup INSTALL" - mv INSTALL.$$.protect_from_automake.backup INSTALL - fi # -f INSTALL - - # just in case - $VERBOSE_ECHO "rm -f INSTALL.$$.protect_from_automake.backup" - rm -f INSTALL.$$.protect_from_automake.backup - fi # -f INSTALL.$$.protect_from_automake.backup - - CONFIGURE="`locate_configure_template`" - if [ "x$CONFIGURE" = "x" ] ; then - return - fi - - _aux_dir="`grep AC_CONFIG_AUX_DIR $CONFIGURE | grep -v '.*#.*AC_CONFIG_AUX_DIR' | tail -${TAIL_N}1 | sed 's/^[ ]*AC_CONFIG_AUX_DIR(\(.*\)).*/\1/' | sed 's/.*\[\(.*\)\].*/\1/'`" - if test ! -d "$_aux_dir" ; then - _aux_dir=. - fi - - for file in config.guess config.sub ltmain.sh ; do - if test -f "${_aux_dir}/${file}" ; then - $VERBOSE_ECHO "rm -f \"${_aux_dir}/${file}.backup\"" - rm -f "${_aux_dir}/${file}.backup" - fi - done -} # end of restore_clobbered - - -############################## -# RECURSIVE_RESTORE FUNCTION # -############################## -recursive_restore ( ) { - - # restore COPYING and INSTALL from backup if they were clobbered - # for each directory recursively. - - # git 'r undone - restore_clobbered - - # find configure template - _configure="`locate_configure_template`" - if [ "x$_configure" = "x" ] ; then - return - fi - - # look for subdirs - _det_config_subdirs="`grep AC_CONFIG_SUBDIRS $_configure | grep -v '.*#.*AC_CONFIG_SUBDIRS' | sed 's/^[ ]*AC_CONFIG_SUBDIRS(\(.*\)).*/\1/' | sed 's/.*\[\(.*\)\].*/\1/'`" - CHECK_DIRS="" - for dir in $_det_config_subdirs ; do - if test -d "`pwd`/$dir" ; then - CHECK_DIRS="$CHECK_DIRS \"`pwd`/$dir\"" - fi - done - - # process subdirs - if [ ! "x$CHECK_DIRS" = "x" ] ; then - $VERBOSE_ECHO "Recursively scanning the following directories:" - $VERBOSE_ECHO " $CHECK_DIRS" - for dir in $CHECK_DIRS ; do - $VERBOSE_ECHO "Checking files for automake damage in $dir" - cd "$START_PATH" - eval "cd $dir" - - # recursively git 'r undone - recursive_restore - done - fi -} # end of recursive_restore - - -####################### -# INITIALIZE FUNCTION # -####################### -initialize ( ) { - - # this routine performs a variety of directory-specific - # initializations. some are sanity checks, some are preventive, - # and some are necessary setup detection. - # - # this function sets: - # CONFIGURE - # SEARCH_DIRS - # CONFIG_SUBDIRS - - ################################## - # check for a configure template # - ################################## - CONFIGURE="`locate_configure_template`" - if [ "x$CONFIGURE" = "x" ] ; then - $ECHO - $ECHO "A configure.ac or configure.in file could not be located implying" - $ECHO "that the GNU Build System is at least not used in this directory. In" - $ECHO "any case, there is nothing to do here without one of those files." - $ECHO - $ECHO "ERROR: No configure.in or configure.ac file found in `pwd`" - exit 1 - fi - - ##################### - # detect an aux dir # - ##################### - _aux_dir="`grep AC_CONFIG_AUX_DIR $CONFIGURE | grep -v '.*#.*AC_CONFIG_AUX_DIR' | tail -${TAIL_N}1 | sed 's/^[ ]*AC_CONFIG_AUX_DIR(\(.*\)).*/\1/' | sed 's/.*\[\(.*\)\].*/\1/'`" - if test ! -d "$_aux_dir" ; then - _aux_dir=. - else - $VERBOSE_ECHO "Detected auxillary directory: $_aux_dir" - fi - - ################################ - # detect a recursive configure # - ################################ - CONFIG_SUBDIRS="" - _det_config_subdirs="`grep AC_CONFIG_SUBDIRS $CONFIGURE | grep -v '.*#.*AC_CONFIG_SUBDIRS' | sed 's/^[ ]*AC_CONFIG_SUBDIRS(\(.*\)).*/\1/' | sed 's/.*\[\(.*\)\].*/\1/'`" - for dir in $_det_config_subdirs ; do - if test -d "`pwd`/$dir" ; then - $VERBOSE_ECHO "Detected recursive configure directory: `pwd`/$dir" - CONFIG_SUBDIRS="$CONFIG_SUBDIRS `pwd`/$dir" - fi - done - - ########################################## - # make sure certain required files exist # - ########################################## - #for file in AUTHORS COPYING ChangeLog INSTALL NEWS README ; do - # if test ! -f $file ; then - # $VERBOSE_ECHO "Touching ${file} since it does not exist" - # touch $file - # fi - #done - - ################################################## - # make sure certain generated files do not exist # - ################################################## - for file in config.guess config.sub ltmain.sh ; do - if test -f "${_aux_dir}/${file}" ; then - $VERBOSE_ECHO "mv -f \"${_aux_dir}/${file}\" \"${_aux_dir}/${file}.backup\"" - mv -f "${_aux_dir}/${file}" "${_aux_dir}/${file}.backup" - fi - done - - ############################ - # search alternate m4 dirs # - ############################ - SEARCH_DIRS="" - for dir in m4 ; do - if [ -d $dir ] ; then - $VERBOSE_ECHO "Found extra aclocal search directory: $dir" - SEARCH_DIRS="$SEARCH_DIRS -I $dir" - fi - done - - ###################################### - # remove any previous build products # - ###################################### - if test -d autom4te.cache ; then - $VERBOSE_ECHO "Found an autom4te.cache directory, deleting it" - $VERBOSE_ECHO "rm -rf autom4te.cache" - rm -rf autom4te.cache - fi -# tcl/tk (and probably others) have a customized aclocal.m4, so can't delete it -# if test -f aclocal.m4 ; then -# $VERBOSE_ECHO "Found an aclocal.m4 file, deleting it" -# $VERBOSE_ECHO "rm -f aclocal.m4" -# rm -f aclocal.m4 -# fi - -} # end of initialize() - - -############## -# initialize # -############## - -# stash path -START_PATH="`pwd`" - -# Before running autoreconf or manual steps, some prep detection work -# is necessary or useful. Only needs to occur once per directory, but -# does need to traverse the entire subconfigure hierarchy to protect -# files from being clobbered even by autoreconf. -recursive_protect - -# start from where we started -cd "$START_PATH" - -# get ready to process -initialize - - -############################################ -# prepare build via autoreconf or manually # -############################################ -reconfigure_manually=no -if [ "x$HAVE_AUTORECONF" = "xyes" ] ; then - $ECHO - $ECHO $ECHO_N "Automatically preparing build ... $ECHO_C" - - $VERBOSE_ECHO "$AUTORECONF $SEARCH_DIRS $AUTORECONF_OPTIONS" - autoreconf_output="`$AUTORECONF $SEARCH_DIRS $AUTORECONF_OPTIONS 2>&1`" - ret=$? - $VERBOSE_ECHO "$autoreconf_output" - - if [ ! $ret = 0 ] ; then - if [ "x$HAVE_ALT_LIBTOOLIZE" = "xyes" ] ; then - if [ ! "x`echo \"$autoreconf_output\" | grep libtoolize | grep \"No such file or directory\"`" = "x" ] ; then - $ECHO - $ECHO "Warning: autoreconf failed but due to what is usually a common libtool" - $ECHO "misconfiguration issue. This problem is encountered on systems that" - $ECHO "have installed libtoolize under a different name without providing a" - $ECHO "symbolic link or without setting the LIBTOOLIZE environment variable." - $ECHO - $ECHO "Restarting the preparation steps with LIBTOOLIZE set to $LIBTOOLIZE" - - export LIBTOOLIZE - RUN_RECURSIVE=no - export RUN_RECURSIVE - untrap_abnormal - - $VERBOSE_ECHO sh $AUTOGEN_SH "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9" - sh "$AUTOGEN_SH" "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9" - exit $? - fi - fi - - $ECHO "Warning: $AUTORECONF failed" - - if test -f ltmain.sh ; then - $ECHO "libtoolize being run by autoreconf is not creating ltmain.sh in the auxillary directory like it should" - fi - - $ECHO "Attempting to run the preparation steps individually" - reconfigure_manually=yes - fi -else - reconfigure_manually=yes -fi - - -############################ -# LIBTOOL_FAILURE FUNCTION # -############################ -libtool_failure ( ) { - - # libtool is rather error-prone in comparison to the other - # autotools and this routine attempts to compensate for some - # common failures. the output after a libtoolize failure is - # parsed for an error related to AC_PROG_LIBTOOL and if found, we - # attempt to inject a project-provided libtool.m4 file. - - _autoconf_output="$1" - - if [ "x$RUN_RECURSIVE" = "xno" ] ; then - # we already tried the libtool.m4, don't try again - return 1 - fi - - if test -f "$LIBTOOL_M4" ; then - found_libtool="`$ECHO $_autoconf_output | grep AC_PROG_LIBTOOL`" - if test ! "x$found_libtool" = "x" ; then - if test -f acinclude.m4 ; then - rm -f acinclude.m4.$$.backup - $VERBOSE_ECHO "cat acinclude.m4 > acinclude.m4.$$.backup" - cat acinclude.m4 > acinclude.m4.$$.backup - fi - $VERBOSE_ECHO "cat \"$LIBTOOL_M4\" >> acinclude.m4" - chmod u+w acinclude.m4 - cat "$LIBTOOL_M4" >> acinclude.m4 - - # don't keep doing this - RUN_RECURSIVE=no - export RUN_RECURSIVE - untrap_abnormal - - $ECHO - $ECHO "Restarting the preparation steps with libtool macros in acinclude.m4" - $VERBOSE_ECHO sh $AUTOGEN_SH "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9" - sh "$AUTOGEN_SH" "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9" - exit $? - fi - fi -} - - -########################### -# MANUAL_AUTOGEN FUNCTION # -########################### -manual_autogen ( ) { - - ################################################## - # Manual preparation steps taken are as follows: # - # aclocal [-I m4] # - # libtoolize --automake -c -f # - # aclocal [-I m4] # - # autoconf -f # - # autoheader # - # automake -a -c -f # - ################################################## - - ########### - # aclocal # - ########### - $VERBOSE_ECHO "$ACLOCAL $SEARCH_DIRS $ACLOCAL_OPTIONS" - aclocal_output="`$ACLOCAL $SEARCH_DIRS $ACLOCAL_OPTIONS 2>&1`" - ret=$? - $VERBOSE_ECHO "$aclocal_output" - if [ ! $ret = 0 ] ; then $ECHO "ERROR: $ACLOCAL failed" && exit 2 ; fi - - ############## - # libtoolize # - ############## - need_libtoolize=no - for feature in AC_PROG_LIBTOOL LT_INIT ; do - $VERBOSE_ECHO "Searching for $feature in $CONFIGURE" - found="`grep \"^$feature.*\" $CONFIGURE`" - if [ ! "x$found" = "x" ] ; then - need_libtoolize=yes - break - fi - done - if [ "x$need_libtoolize" = "xyes" ] ; then - if [ "x$HAVE_LIBTOOLIZE" = "xyes" ] ; then - $VERBOSE_ECHO "$LIBTOOLIZE $LIBTOOLIZE_OPTIONS" - libtoolize_output="`$LIBTOOLIZE $LIBTOOLIZE_OPTIONS 2>&1`" - ret=$? - $VERBOSE_ECHO "$libtoolize_output" - - if [ ! $ret = 0 ] ; then $ECHO "ERROR: $LIBTOOLIZE failed" && exit 2 ; fi - else - if [ "x$HAVE_ALT_LIBTOOLIZE" = "xyes" ] ; then - $VERBOSE_ECHO "$LIBTOOLIZE $ALT_LIBTOOLIZE_OPTIONS" - libtoolize_output="`$LIBTOOLIZE $ALT_LIBTOOLIZE_OPTIONS 2>&1`" - ret=$? - $VERBOSE_ECHO "$libtoolize_output" - - if [ ! $ret = 0 ] ; then $ECHO "ERROR: $LIBTOOLIZE failed" && exit 2 ; fi - fi - fi - - ########### - # aclocal # - ########### - # re-run again as instructed by libtoolize - $VERBOSE_ECHO "$ACLOCAL $SEARCH_DIRS $ACLOCAL_OPTIONS" - aclocal_output="`$ACLOCAL $SEARCH_DIRS $ACLOCAL_OPTIONS 2>&1`" - ret=$? - $VERBOSE_ECHO "$aclocal_output" - - # libtoolize might put ltmain.sh in the wrong place - if test -f ltmain.sh ; then - if test ! -f "${_aux_dir}/ltmain.sh" ; then - $ECHO - $ECHO "Warning: $LIBTOOLIZE is creating ltmain.sh in the wrong directory" - $ECHO - $ECHO "Fortunately, the problem can be worked around by simply copying the" - $ECHO "file to the appropriate location (${_aux_dir}/). This has been done for you." - $ECHO - $VERBOSE_ECHO "cp -p ltmain.sh \"${_aux_dir}/ltmain.sh\"" - cp -p ltmain.sh "${_aux_dir}/ltmain.sh" - $ECHO $ECHO_N "Continuing build preparation ... $ECHO_C" - fi - fi # ltmain.sh - fi # need_libtoolize - - ############ - # autoconf # - ############ - $VERBOSE_ECHO - $VERBOSE_ECHO "$AUTOCONF $AUTOCONF_OPTIONS" - autoconf_output="`$AUTOCONF $AUTOCONF_OPTIONS 2>&1`" - ret=$? - $VERBOSE_ECHO "$autoconf_output" - - if [ ! $ret = 0 ] ; then - # retry without the -f and check for usage of macros that are too new - ac2_59_macros="AC_C_RESTRICT AC_INCLUDES_DEFAULT AC_LANG_ASSERT AC_LANG_WERROR AS_SET_CATFILE" - ac2_55_macros="AC_COMPILER_IFELSE AC_FUNC_MBRTOWC AC_HEADER_STDBOOL AC_LANG_CONFTEST AC_LANG_SOURCE AC_LANG_PROGRAM AC_LANG_CALL AC_LANG_FUNC_TRY_LINK AC_MSG_FAILURE AC_PREPROC_IFELSE" - ac2_54_macros="AC_C_BACKSLASH_A AC_CONFIG_LIBOBJ_DIR AC_GNU_SOURCE AC_PROG_EGREP AC_PROG_FGREP AC_REPLACE_FNMATCH AC_FUNC_FNMATCH_GNU AC_FUNC_REALLOC AC_TYPE_MBSTATE_T" - - macros_to_search="" - ac_major="`echo ${AUTOCONF_VERSION}. | cut -d. -f1 | sed 's/[^0-9]//g'`" - ac_minor="`echo ${AUTOCONF_VERSION}. | cut -d. -f2 | sed 's/[^0-9]//g'`" - - if [ $ac_major -lt 2 ] ; then - macros_to_search="$ac2_59_macros $ac2_55_macros $ac2_54_macros" - else - if [ $ac_minor -lt 54 ] ; then - macros_to_search="$ac2_59_macros $ac2_55_macros $ac2_54_macros" - elif [ $ac_minor -lt 55 ] ; then - macros_to_search="$ac2_59_macros $ac2_55_macros" - elif [ $ac_minor -lt 59 ] ; then - macros_to_search="$ac2_59_macros" - fi - fi - - configure_ac_macros=__none__ - for feature in $macros_to_search ; do - $VERBOSE_ECHO "Searching for $feature in $CONFIGURE" - found="`grep \"^$feature.*\" $CONFIGURE`" - if [ ! "x$found" = "x" ] ; then - if [ "x$configure_ac_macros" = "x__none__" ] ; then - configure_ac_macros="$feature" - else - configure_ac_macros="$feature $configure_ac_macros" - fi - fi - done - if [ ! "x$configure_ac_macros" = "x__none__" ] ; then - $ECHO - $ECHO "Warning: Unsupported macros were found in $CONFIGURE" - $ECHO - $ECHO "The `echo $CONFIGURE | basename` file was scanned in order to determine if any" - $ECHO "unsupported macros are used that exceed the minimum version" - $ECHO "settings specified within this file. As such, the following macros" - $ECHO "should be removed from configure.ac or the version numbers in this" - $ECHO "file should be increased:" - $ECHO - $ECHO "$configure_ac_macros" - $ECHO - $ECHO $ECHO_N "Ignorantly continuing build preparation ... $ECHO_C" - fi - - ################### - # autoconf, retry # - ################### - $VERBOSE_ECHO - $VERBOSE_ECHO "$AUTOCONF" - autoconf_output="`$AUTOCONF 2>&1`" - ret=$? - $VERBOSE_ECHO "$autoconf_output" - - if [ ! $ret = 0 ] ; then - # test if libtool is busted - libtool_failure "$autoconf_output" - - # let the user know what went wrong - cat <<EOF -$autoconf_output -EOF - $ECHO "ERROR: $AUTOCONF failed" - exit 2 - else - # autoconf sans -f and possibly sans unsupported options succeed so warn verbosely - $ECHO - $ECHO "Warning: autoconf seems to have succeeded by removing the following options:" - $ECHO " AUTOCONF_OPTIONS=\"$AUTOCONF_OPTIONS\"" - $ECHO - $ECHO "Removing those options should not be necessary and indicate some other" - $ECHO "problem with the build system. The build preparation is highly suspect" - $ECHO "and may result in configuration or compilation errors. Consider" - if [ "x$VERBOSE_ECHO" = "x:" ] ; then - $ECHO "rerunning the build preparation with verbose output enabled." - $ECHO " $AUTOGEN_SH --verbose" - else - $ECHO "reviewing the minimum GNU Autotools version settings contained in" - $ECHO "this script along with the macros being used in your `echo $CONFIGURE | basename` file." - fi - $ECHO - $ECHO $ECHO_N "Continuing build preparation ... $ECHO_C" - fi # autoconf ret = 0 - fi # autoconf ret = 0 - - ############## - # autoheader # - ############## - need_autoheader=no - for feature in AM_CONFIG_HEADER AC_CONFIG_HEADER ; do - $VERBOSE_ECHO "Searching for $feature in $CONFIGURE" - found="`grep \"^$feature.*\" $CONFIGURE`" - if [ ! "x$found" = "x" ] ; then - need_autoheader=yes - break - fi - done - if [ "x$need_autoheader" = "xyes" ] ; then - $VERBOSE_ECHO "$AUTOHEADER $AUTOHEADER_OPTIONS" - autoheader_output="`$AUTOHEADER $AUTOHEADER_OPTIONS 2>&1`" - ret=$? - $VERBOSE_ECHO "$autoheader_output" - if [ ! $ret = 0 ] ; then $ECHO "ERROR: $AUTOHEADER failed" && exit 2 ; fi - fi # need_autoheader - - ############ - # automake # - ############ - need_automake=no - for feature in AM_INIT_AUTOMAKE ; do - $VERBOSE_ECHO "Searching for $feature in $CONFIGURE" - found="`grep \"^$feature.*\" $CONFIGURE`" - if [ ! "x$found" = "x" ] ; then - need_automake=yes - break - fi - done - - if [ "x$need_automake" = "xyes" ] ; then - $VERBOSE_ECHO "$AUTOMAKE $AUTOMAKE_OPTIONS" - automake_output="`$AUTOMAKE $AUTOMAKE_OPTIONS 2>&1`" - ret=$? - $VERBOSE_ECHO "$automake_output" - - if [ ! $ret = 0 ] ; then - - ################### - # automake, retry # - ################### - $VERBOSE_ECHO - $VERBOSE_ECHO "$AUTOMAKE $ALT_AUTOMAKE_OPTIONS" - # retry without the -f - automake_output="`$AUTOMAKE $ALT_AUTOMAKE_OPTIONS 2>&1`" - ret=$? - $VERBOSE_ECHO "$automake_output" - - if [ ! $ret = 0 ] ; then - # test if libtool is busted - libtool_failure "$automake_output" - - # let the user know what went wrong - cat <<EOF -$automake_output -EOF - $ECHO "ERROR: $AUTOMAKE failed" - exit 2 - fi # automake retry - fi # automake ret = 0 - fi # need_automake -} # end of manual_autogen - - -##################################### -# RECURSIVE_MANUAL_AUTOGEN FUNCTION # -##################################### -recursive_manual_autogen ( ) { - - # run the build preparation steps manually for this directory - manual_autogen - - # for projects using recursive configure, run the build - # preparation steps for the subdirectories. - if [ ! "x$CONFIG_SUBDIRS" = "x" ] ; then - $VERBOSE_ECHO "Recursively configuring the following directories:" - $VERBOSE_ECHO " $CONFIG_SUBDIRS" - for dir in $CONFIG_SUBDIRS ; do - $VERBOSE_ECHO "Processing recursive configure in $dir" - cd "$START_PATH" - cd "$dir" - - # new directory, prepare - initialize - - # run manual steps for the subdir and any others below - recursive_manual_autogen - done - fi -} - - -################################ -# run manual preparation steps # -################################ -if [ "x$reconfigure_manually" = "xyes" ] ; then - $ECHO - $ECHO $ECHO_N "Preparing build ... $ECHO_C" - - recursive_manual_autogen -fi - - -######################### -# restore and summarize # -######################### -cd "$START_PATH" - -# restore COPYING and INSTALL from backup if necessary -recursive_restore - -# make sure we end up with a configure script -config_ac="`locate_configure_template`" -config="`echo $config_ac | sed 's/\.ac$//' | sed 's/\.in$//'`" -if [ "x$config" = "x" ] ; then - $VERBOSE_ECHO "Could not locate the configure template (from `pwd`)" -fi - -# summarize -$ECHO "done" -$ECHO -if test "x$config" = "x" -o ! -f "$config" ; then - $ECHO "WARNING: The $PROJECT build system should now be prepared but there" - $ECHO "does not seem to be a resulting configure file. This is unexpected" - $ECHO "and likely the result of an error. You should run $NAME_OF_AUTOGEN" - $ECHO "with the --verbose option to get more details on a potential" - $ECHO "misconfiguration." -else - $ECHO "The $PROJECT build system is now prepared. To build here, run:" - $ECHO " $config" - $ECHO " make" -fi - - -# Local Variables: -# mode: sh -# tab-width: 8 -# sh-basic-offset: 4 -# sh-indentation: 4 -# indent-tabs-mode: t -# End: -# ex: shiftwidth=4 tabstop=8 diff --git a/tools/configure.ac b/tools/configure.ac deleted file mode 100644 index 418ffd7d..00000000 --- a/tools/configure.ac +++ /dev/null @@ -1,575 +0,0 @@ -# -*- Autoconf -*- -# Process this file with autoconf to produce a configure script. - -AC_PREREQ(2.61) - -m4_include([version.m4]) - -AC_INIT([ledger],[VERSION_NUMBER],[johnw@newartisans.com]) - -AC_CONFIG_AUX_DIR([.]) -AM_INIT_AUTOMAKE([dist-bzip2 foreign]) -AC_CONFIG_MACRO_DIR([m4]) - -AC_CONFIG_SRCDIR([src/main.cc]) -AC_CONFIG_HEADER([config.h]) - -# Use AM_SILENT_RULES if present -m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) - -# Checks for programs. -AC_USE_SYSTEM_EXTENSIONS -AC_PROG_CXX -AC_PROG_MAKE_SET -AC_PROG_LIBTOOL -AM_GNU_GETTEXT -AM_GNU_GETTEXT_VERSION([0.17]) - -# Checks for emacs lisp path -AM_PATH_LISPDIR - -# Check for options -AC_ARG_ENABLE(debug, - [ --enable-debug Turn on debugging], - [case "${enableval}" in - yes) debug=true ;; - no) debug=false ;; - *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;; - esac],[debug=false]) - -if [ test x$debug = xtrue ]; then - AC_DEFINE([DEBUG_MODE], [1], [Whether debugging is enabled]) -fi -AM_CONDITIONAL(DEBUG, test x$debug = xtrue) - -AC_ARG_ENABLE(pch, - [ --enable-pch Use GCC 4.x pre-compiled headers], - [case "${enableval}" in - yes) pch=true ;; - no) pch=false ;; - *) AC_MSG_ERROR(bad value ${enableval} for --enable-pch) ;; - esac],[pch=false]) - -if [ test x$pch = xtrue ]; then - AC_DEFINE([USE_PCH], [1], [Whether pre-compiled headers are being used]) -fi -AM_CONDITIONAL(USE_PCH, test x$pch = xtrue) - -AC_ARG_ENABLE(doxygen, - [ --enable-doxygen Turns on generation of code documentation], - [case "${enableval}" in - yes) doxygen=true ;; - no) doxygen=false ;; - *) AC_MSG_ERROR(bad value ${enableval} for --enable-doxygen) ;; - esac],[doxygen=false]) - -AM_CONDITIONAL(USE_DOXYGEN, test x$doxygen = xtrue) - -AC_ARG_ENABLE(cache, - [ --enable-cache Enable use of the --cache option], - [case "${enableval}" in - yes) cache=true ;; - no) cache=false ;; - *) AC_MSG_ERROR(bad value ${enableval} for --enable-cache) ;; - esac],[cache=false]) - -AM_CONDITIONAL(USE_CACHE_OPTION, test x$cache = xtrue) - -AC_ARG_ENABLE(python, - [ --enable-python Turn on Python support (experimental)], - [case "${enableval}" in - yes) python=true ;; - no) python=false ;; - *) AC_MSG_ERROR(bad value ${enableval} for --enable-python) ;; - esac],[python=false]) - -AC_ARG_WITH(boost-suffix, - [ --with-boost-suffix=X Append X to the Boost library names], - [BOOST_SUFFIX="${withval}"], - [BOOST_SUFFIX=""]) - -AC_SUBST([BOOST_SUFFIX], $BOOST_SUFFIX) - -# check if UNIX pipes are available -AC_CACHE_CHECK( - [if pipes can be used], - [pipes_avail_cv_], - [AC_LANG_PUSH(C++) - AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [[#include <sys/types.h> - #include <sys/wait.h> - #include <unistd.h> - #include <stdlib.h> - #include <string.h> - #include <stdio.h>]], - [[int status, pfd[2]; - status = pipe(pfd); - status = fork(); - if (status < 0) { - ; - } else if (status == 0) { - char *arg0 = NULL; - - status = dup2(pfd[0], STDIN_FILENO); - - close(pfd[1]); - close(pfd[0]); - - execlp("", arg0, (char *)0); - perror("execl"); - exit(1); - } else { - close(pfd[0]); - }]])], - [pipes_avail_cv_=true], - [pipes_avail_cv_=false]) - AC_LANG_POP]) - -if [test x$pipes_avail_cv_ = xtrue ]; then - AC_DEFINE([HAVE_UNIX_PIPES], [1], [Whether UNIX pipes are available]) -fi - -# check for gmp -AC_CACHE_CHECK( - [if GMP is available], - [libgmp_avail_cv_], - [libgmp_save_libs=$LIBS - LIBS="-lgmp $LIBS" - AC_LANG_PUSH(C++) - AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <gmp.h>]], [[mpz_t bar; - mpz_init(bar); - mpz_clear(bar);]])],[libgmp_avail_cv_=true],[libgmp_avail_cv_=false]) - AC_LANG_POP - LIBS=$libgmp_save_libs]) - -if [test x$libgmp_avail_cv_ = xtrue ]; then - LIBS="-lgmp $LIBS" -else - AC_MSG_FAILURE("Could not find gmp library (set CPPFLAGS and LDFLAGS?)") -fi - -# check for mpfr -AC_CACHE_CHECK( - [if MPFR is available], - [libmpfr_avail_cv_], - [libmpfr_save_libs=$LIBS - LIBS="-lmpfr $LIBS" - AC_LANG_PUSH(C++) - AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <mpfr.h>]], [[mpfr_t bar; - mpfr_init(bar); - char * buf = NULL; - mpfr_asprintf(&buf, "%Rf", bar); - mpfr_clear(bar);]])],[libmpfr_avail_cv_=true],[libmpfr_avail_cv_=false]) - AC_LANG_POP - LIBS=$libmpfr_save_libs]) - -if [test x$libmpfr_avail_cv_ = xtrue ]; then - LIBS="-lmpfr $LIBS" -else - AC_MSG_FAILURE("Could not find mpfr library 2.4.0 or higher (set CPPFLAGS and LDFLAGS?)") -fi - -# check for edit -AC_CACHE_CHECK( - [if libedit is available], - [libedit_avail_cv_], - [libedit_save_libs=$LIBS - LIBS="-ledit $LIBS" - AC_LANG_PUSH(C++) - AC_LINK_IFELSE([AC_LANG_PROGRAM( - [[#include <stdlib.h> - #include <stdio.h> - #include <editline/readline.h>]], - [[rl_readline_name = const_cast<char *>("foo"); - char * line = readline(const_cast<char *>("foo: ")); - free(line);]])],[libedit_avail_cv_=true],[libedit_avail_cv_=false]) - AC_LANG_POP - LIBS=$libedit_save_libs]) - -if [test x$libedit_avail_cv_ = xtrue ]; then - LIBS="-ledit $LIBS" - AC_DEFINE([HAVE_LIBEDIT], [1], [If the libedit library is available]) -fi - -# check for boost_regex -AC_CACHE_CHECK( - [if boost_regex is available], - [boost_regex_avail_cv_], - [boost_regex_save_libs=$LIBS - LIBS="-lboost_regex$BOOST_SUFFIX $LIBS" - AC_LANG_PUSH(C++) - AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [[#include <boost/regex.hpp>]], - [[boost::regex foo_regexp("Hello, world!");]])], - [boost_regex_avail_cv_=true], - [boost_regex_avail_cv_=false]) - AC_LANG_POP - LIBS=$boost_regex_save_libs]) - -if [test x$boost_regex_avail_cv_ = xtrue ]; then - LIBS="-lboost_regex$BOOST_SUFFIX $LIBS" -else - AC_MSG_FAILURE("Could not find boost_regex library (set CPPFLAGS and LDFLAGS?)") -fi - -AC_CACHE_CHECK( - [if boost_regex w/ICU is available], - [boost_regex_icu_avail_cv_], - [boost_regex_icu_save_libs=$LIBS - LIBS="-licuuc $LIBS" - AC_LANG_PUSH(C++) - AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [[#include <boost/regex/icu.hpp> - using namespace boost;]], - [[std::string text = "Активы"; - u32regex r = make_u32regex("активы", regex::perl | regex::icase); - return u32regex_search(text, r) ? 0 : 1;]])], - [boost_regex_icu_avail_cv_=true], - [boost_regex_icu_avail_cv_=false]) - AC_LANG_POP - LIBS=$boost_regex_icu_save_libs]) - -if [test x$boost_regex_icu_avail_cv_ = xtrue ]; then - AC_DEFINE([HAVE_BOOST_REGEX_UNICODE], [1], [If the boost_regex library w/ICU is available]) - LIBS="-licuuc $LIBS" -fi - -# check for boost_date_time -AC_CACHE_CHECK( - [if boost_date_time is available], - [boost_date_time_cpplib_avail_cv_], - [boost_date_time_save_libs=$LIBS - LIBS="-lboost_date_time$BOOST_SUFFIX $LIBS" - AC_LANG_PUSH(C++) - AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [[#include <boost/date_time/posix_time/posix_time.hpp> - #include <boost/date_time/gregorian/gregorian.hpp> - #include <boost/date_time/local_time_adjustor.hpp> - #include <boost/date_time/time_duration.hpp> - - using namespace boost::posix_time; - using namespace boost::date_time; - - #include <ctime> - - inline ptime time_to_system_local(const ptime& when) { - struct std::tm tm_gmt = to_tm(when); - return from_time_t(mktime(&tm_gmt)); - }]], - [[ptime t10 = ptime(boost::gregorian::from_string("2007-01-15"), - ptime::time_duration_type()); - - ptime t12 = time_to_system_local(t10); - - return t10 != t12;]])], - [boost_date_time_cpplib_avail_cv_=true], - [boost_date_time_cpplib_avail_cv_=false]) - AC_LANG_POP - LIBS=$boost_date_time_save_libs]) - -if [test x$boost_date_time_cpplib_avail_cv_ = xtrue ]; then - LIBS="-lboost_date_time$BOOST_SUFFIX $LIBS" -else - AC_MSG_FAILURE("Could not find boost_date_time library (set CPPFLAGS and LDFLAGS?)") -fi - -# check for boost_filesystem -AC_CACHE_CHECK( - [if boost_filesystem is available], - [boost_filesystem_cpplib_avail_cv_], - [boost_filesystem_save_libs=$LIBS - LIBS="-lboost_filesystem$BOOST_SUFFIX -lboost_system$BOOST_SUFFIX $LIBS" - AC_LANG_PUSH(C++) - AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [[#include <boost/filesystem/path.hpp>]], - [[boost::filesystem::path this_path("Hello");]])], - [boost_filesystem_cpplib_avail_cv_=true], - [boost_filesystem_cpplib_avail_cv_=false]) - AC_LANG_POP - LIBS=$boost_filesystem_save_libs]) - -if [test x$boost_filesystem_cpplib_avail_cv_ = xtrue ]; then - LIBS="-lboost_filesystem$BOOST_SUFFIX -lboost_system$BOOST_SUFFIX $LIBS" -else - AC_MSG_FAILURE("Could not find boost_filesystem library (set CPPFLAGS and LDFLAGS?)") -fi - -# check for boost_iostreams -AC_CACHE_CHECK( - [if boost_iostreams is available], - [boost_iostreams_cpplib_avail_cv_], - [boost_iostreams_save_libs=$LIBS - LIBS="-lboost_iostreams$BOOST_SUFFIX -lboost_system$BOOST_SUFFIX $LIBS" - AC_LANG_PUSH(C++) - AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [[#define BOOST_IOSTREAMS_USE_DEPRECATED 1 - #include <boost/iostreams/device/file_descriptor.hpp> - #include <boost/iostreams/stream.hpp> - #include <boost/version.hpp>]], - [[namespace io = boost::iostreams; - typedef io::stream<io::file_descriptor_sink> ofdstream; -#if BOOST_VERSION >= 104400 - ofdstream outstream(1, io::never_close_handle); -#else // BOOST_VERSION >= 104400 - ofdstream outstream(1); -#endif // BOOST_VERSION >= 104400 - ]])], - [boost_iostreams_cpplib_avail_cv_=true], - [boost_iostreams_cpplib_avail_cv_=false]) - AC_LANG_POP - LIBS=$boost_iostreams_save_libs]) - -if [test x$boost_iostreams_cpplib_avail_cv_ = xtrue ]; then - LIBS="-lboost_iostreams$BOOST_SUFFIX -lboost_system$BOOST_SUFFIX $LIBS" -else - AC_MSG_FAILURE("Could not find boost_iostreams library (set CPPFLAGS and LDFLAGS?)") -fi - -# check for boost_serialization -AC_CACHE_CHECK( - [if boost_serialization is available], - [boost_serialization_cpplib_avail_cv_], - [boost_serialization_save_libs=$LIBS - LIBS="-lboost_serialization$BOOST_SUFFIX -lboost_system$BOOST_SUFFIX $LIBS" - AC_LANG_PUSH(C++) - AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [[#include <boost/archive/binary_oarchive.hpp> - #include <iostream> - struct foo { - int a; - template<class Archive> - void serialize(Archive & ar, const unsigned int) { - ar & a; - } - };]], - [[boost::archive::binary_oarchive oa(std::cout); - foo x; - oa << x;]])], - [boost_serialization_cpplib_avail_cv_=true], - [boost_serialization_cpplib_avail_cv_=false]) - AC_LANG_POP - LIBS=$boost_serialization_save_libs]) - -if [test x$boost_serialization_cpplib_avail_cv_ = xtrue -a x$cache = xtrue]; then - AC_DEFINE([HAVE_BOOST_SERIALIZATION], [1], [Whether Boost.Serialization is available]) - LIBS="-lboost_serialization$BOOST_SUFFIX $LIBS" -fi -AM_CONDITIONAL(HAVE_BOOST_SERIALIZATION, test x$boost_serialization_cpplib_avail_cv_ = xtrue -a x$cache = xtrue) - -# check for expat or xmlparse -AC_ARG_ENABLE(xml, - [ --enable-xml Turn on support for XML parsing], - [case "${enableval}" in - yes) xml=true ;; - no) xml=false ;; - *) AC_MSG_ERROR(bad value ${enableval} for --enable-xml) ;; - esac],[xml=true]) -AM_CONDITIONAL(USE_XML, test x$xml = xtrue) - -if [test x$xml = xtrue ]; then - AC_CACHE_CHECK( - [if libexpat is available], - [libexpat_avail_cv_], - [libexpat_save_libs=$LIBS - LIBS="-lexpat $LIBS" - AC_LANG_PUSH(C++) - AC_TRY_LINK( - [#include <stdio.h> - extern "C" { - #include <expat.h> // expat XML parser - }], - [XML_Parser parser = XML_ParserCreate(NULL); - return parser != NULL;], - [libexpat_avail_cv_=true], - [libexpat_avail_cv_=false]) - AC_LANG_POP - LIBS=$libexpat_save_libs]) - - if [test x$libexpat_avail_cv_ = xtrue ]; then - AM_CONDITIONAL(HAVE_EXPAT, true) - LIBS="-lexpat $LIBS" - else - AM_CONDITIONAL(HAVE_EXPAT, false) - fi -else - AM_CONDITIONAL(HAVE_EXPAT, false) -fi - -if [test x$xml = xtrue ]; then - if [test x$libexpat_avail_cv_ = xfalse ]; then - AC_CACHE_CHECK( - [if libxmlparse is available], - [libxmlparse_avail_cv_], - [libxmlparse_save_libs=$LIBS - LIBS="-lxmlparse -lxmltok $LIBS" - AC_LANG_PUSH(C++) - AC_TRY_LINK( - [#include <stdio.h> - extern "C" { - #include <xmlparse.h> // expat XML parser - }], - [XML_Parser parser = XML_ParserCreate(NULL); - return parser != NULL;], - [libxmlparse_avail_cv_=true], - [libxmlparse_avail_cv_=false]) - AC_LANG_POP - LIBS=$libxmlparse_save_libs]) - - if [test x$libxmlparse_avail_cv_ = xtrue ]; then - AM_CONDITIONAL(HAVE_XMLPARSE, true) - LIBS="-lxmlparse -lxmltok $LIBS" - else - AM_CONDITIONAL(HAVE_XMLPARSE, false) - fi - else - AM_CONDITIONAL(HAVE_XMLPARSE, false) - fi -else - AM_CONDITIONAL(HAVE_XMLPARSE, false) -fi - -# check for libofx -AC_ARG_ENABLE(ofx, - [ --enable-ofx Turn on support for OFX/OCF parsing], - [case "${enableval}" in - yes) ofx=true ;; - no) ofx=false ;; - *) AC_MSG_ERROR(bad value ${enableval} for --enable-ofx) ;; - esac],[ofx=true]) -AM_CONDITIONAL(USE_OFX, test x$ofx = xtrue) - -if [test x$ofx = xtrue ]; then - AC_CACHE_CHECK( - [if libofx is available], - [libofx_avail_cv_], - [libofx_save_libs=$LIBS - LIBS="-lofx $LIBS" - AC_LANG_PUSH(C++) - AC_TRY_LINK( - [#include <libofx.h>], - [ LibofxContextPtr libofx_context = libofx_get_new_context();], - [libofx_avail_cv_=true], - [libofx_avail_cv_=false]) - AC_LANG_POP - LIBS=$libofx_save_libs]) - - if [test x$libofx_avail_cv_ = xtrue ]; then - AM_CONDITIONAL(HAVE_LIBOFX, true) - LIBS="-lofx $LIBS" - else - AM_CONDITIONAL(HAVE_LIBOFX, false) - fi -else - AM_CONDITIONAL(HAVE_LIBOFX, false) -fi - -# check for Python -if [ test x$python = xtrue ]; then - AM_PATH_PYTHON(2.4,, :) - if [test "$PYTHON" != :]; then - AM_CONDITIONAL(HAVE_PYTHON, true) - AC_CACHE_CHECK( - [if boost_python is available], - [boost_python_cpplib_avail_cv_], - [boost_python_save_libs=$LIBS - LIBS="-lboost_python$BOOST_SUFFIX -lpython$PYTHON_VERSION $LIBS" - AC_LANG_PUSH(C++) - AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [[#include <boost/python.hpp> - using namespace boost::python; - class foo {}; - BOOST_PYTHON_MODULE(samp) { - class_< foo > ("foo") ; - }]], - [[return 0]])], - [boost_python_cpplib_avail_cv_=true], - [boost_python_cpplib_avail_cv_=false]) - AC_LANG_POP - LIBS=$boost_python_save_libs]) - - if [ test x$boost_python_cpplib_avail_cv_ = xtrue ]; then - AC_DEFINE([HAVE_BOOST_PYTHON], [1], [Whether Boost.Python is available]) - LIBS="-lboost_python$BOOST_SUFFIX -lpython$PYTHON_VERSION $LIBS" - fi - else - AM_CONDITIONAL(HAVE_PYTHON, false) - fi - AM_CONDITIONAL(HAVE_BOOST_PYTHON, test x$boost_python_cpplib_avail_cv_ = xtrue) -else - AM_CONDITIONAL(HAVE_PYTHON, false) - AM_CONDITIONAL(HAVE_BOOST_PYTHON, false) -fi - -# check for Boost.Test -AC_CACHE_CHECK( - [if boost_test is available], - [boost_test_avail_cv_], - [boost_test_save_libs=$LIBS - LIBS="-lboost_unit_test_framework$BOOST_SUFFIX -lboost_test_exec_monitor$BOOST_SUFFIX $LIBS" - AC_LANG_PUSH(C++) - AC_LINK_IFELSE( - [AC_LANG_SOURCE( - [[#define BOOST_TEST_MODULE sample - #include <boost/test/unit_test.hpp> - BOOST_AUTO_TEST_CASE(test_test) {}]])], - [boost_test_avail_cv_=true], - [boost_test_avail_cv_=false]) - AC_LANG_POP - LIBS=$boost_test_save_libs]) - -AM_CONDITIONAL(HAVE_BOOST_TEST, test x$boost_test_avail_cv_ = xtrue) - -# check for C++11 and libc++ -#AC_CACHE_CHECK( -# [if C++11 and libc++ are available], -# [cpp11_avail_cv_], -# [cpp11_save_cxxflags=$CXXFLAGS -# cpp11_save_ldflags=$LDFLAGS -# CXXFLAGS="-std=c++11 -stdlib=libc++ $CXXFLAGS" -# LDFLAGS="-stdlib=libc++ $LDFLAGS" -# AC_LANG_PUSH(C++) -# AC_LINK_IFELSE( -# [AC_LANG_PROGRAM( -# [[#include <boost/regex.hpp> -# #include <iostream>]], -# [[boost::regex foo_regexp("Hello, world!"); -# for (auto i : "Hello, world") -# std::cout << i << std::endl;]])], -# [cpp11_avail_cv_=true], -# [cpp11_avail_cv_=false]) -# AC_LANG_POP -# CXXFLAGS="$cpp11_save_cxxflags" -# LDFLAGS="$cpp11_save_ldflags"]) -# -#if [test x$cpp11_avail_cv_ = xtrue]; then -# AC_DEFINE([HAVE_CPP11], [1], [Whether C++11 and libc++ are available]) -# CXXFLAGS="-std=c++11 -stdlib=libc++ $CXXFLAGS" -# LDFLAGS="-stdlib=libc++ $LDFLAGS" -#fi - -# Checks for header files. -AC_HEADER_STDC -AC_HEADER_STAT -AC_CHECK_HEADERS([langinfo.h]) - -# Checks for typedefs, structures, and compiler characteristics. -AC_TYPE_SIZE_T -AC_STRUCT_TM - -# Checks for library functions. -#AC_FUNC_MKTIME -#AC_FUNC_STAT -#AC_FUNC_STRFTIME -AC_CHECK_FUNCS([access realpath getpwuid getpwnam isatty]) - -# Pepare the Makefiles -AC_CONFIG_FILES([Makefile po/Makefile.in intl/Makefile]) -AC_OUTPUT diff --git a/version.m4 b/version.m4 deleted file mode 100644 index b6e3b58f..00000000 --- a/version.m4 +++ /dev/null @@ -1 +0,0 @@ -m4_define([VERSION_NUMBER], [3.0.0-20120510]) |