pax_global_header00006660000000000000000000000064124563260020014512gustar00rootroot0000000000000052 comment=6d1e3025b7bd8e4856b3fc89420d58bedf64f2be ckon-0.7.1/000077500000000000000000000000001245632600200124515ustar00rootroot00000000000000ckon-0.7.1/.gitignore000066400000000000000000000002261245632600200144410ustar00rootroot00000000000000# Compiled Object files *.slo *.lo *.o # Compiled Dynamic libraries *.so *.dylib # Compiled Static libraries *.lai *.la *.a docs/_build pepper_out ckon-0.7.1/LICENSE000066400000000000000000000020401245632600200134520ustar00rootroot00000000000000Copyright (c) 2013 Patrick Huck Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ckon-0.7.1/Makefile.am000066400000000000000000000014471245632600200145130ustar00rootroot00000000000000AUTOMAKE_OPTIONS = foreign subdir-objects -Wall ACLOCAL_AMFLAGS = ${ACLOCAL_FLAGS} -I m4 AM_CPPFLAGS = $(BOOST_CPPFLAGS) AM_CPPFLAGS += $(CURL_CFLAGS) bin_PROGRAMS = ckon ckon_LDADD = $(BOOST_LDFLAGS) -lstdc++ ckon_LDADD += $(BOOST_SYSTEM_LIB) ckon_LDADD += $(BOOST_FILESYSTEM_LIB) ckon_LDADD += $(BOOST_REGEX_LIB) ckon_LDADD += $(BOOST_PROGRAM_OPTIONS_LIB) ckon_LDADD += $(CURL_LIBS) ckon_SOURCES = ckon_SOURCES += ./src/aux/myregex.cc ckon_SOURCES += ./src/aux/myregex.h ckon_SOURCES += ./src/aux/utils.cc ckon_SOURCES += ./src/aux/utils.h ckon_SOURCES += ./src/ckon.cc ckon_SOURCES += ./src/clean/clean.cc ckon_SOURCES += ./src/clean/clean.h ckon_SOURCES += ./src/cmdline/cmdline.cc ckon_SOURCES += ./src/cmdline/cmdline.h ckon_SOURCES += ./src/helpers/helpers.cc ckon_SOURCES += ./src/helpers/helpers.h ckon-0.7.1/README.md000066400000000000000000000023151245632600200137310ustar00rootroot00000000000000Please find the docs at https://ckon.readthedocs.org ---------------------------------------------------- [![DOI](https://zenodo.org/badge/4568/tschaume/ckon.png)](http://dx.doi.org/10.5281/zenodo.12533) *ckon* is a C++ program/tool which automatically takes care of compilation, dictionary generation and linking of programs and libraries developed for data analyses within the [CERN ROOT analysis framework](http://root.cern.ch). This includes parsing include headers to figure out which libraries the main programs need to be linked to. It uses [automake/autoconf](http://www.gnu.org/software/autoconf/) to be platform independent and GNU install compliant. In addition, [m4 macros](http://www.gnu.org/software/autoconf-archive/The-Macros.html#The-Macros) are automatically downloaded and the according compiler flags included based on a list of [boost](http://www.boost.org/) libraries provided in the config file. For the purpose of YAML database usage, a m4 macro can be downloaded during setup to link against the [yaml-cpp](https://code.google.com/p/yaml-cpp/) library. *ckon* is published under MIT License (http://opensource.org/licenses/MIT). Patrick Huck (@tschaume) *invaluable contributions*: Hiroshi Masui ckon-0.7.1/autogen.sh000077500000000000000000000033501245632600200144530ustar00rootroot00000000000000#!/bin/bash VERSION=0.7 MIN_BOOST_VERSION=1.50 MIN_CURL_VERSION=7.15.5 [ -e configure.ac ] && rm -v configure.ac echo 'AC_INIT([ckon], ['$VERSION'])' >> configure.ac echo 'AC_CONFIG_MACRO_DIR([m4])' >> configure.ac echo 'm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])' >> configure.ac echo 'AC_CONFIG_AUX_DIR(config)' >> configure.ac echo 'm4_ifdef([AM_PROG_AR], [AM_PROG_AR])' >> configure.ac echo 'AM_INIT_AUTOMAKE([-Wall no-define])' >> configure.ac echo 'AC_PROG_CXX' >> configure.ac echo 'AX_BOOST_BASE(['$MIN_BOOST_VERSION'])' >> configure.ac echo 'AX_BOOST_SYSTEM' >> configure.ac echo 'AX_BOOST_FILESYSTEM' >> configure.ac echo 'AX_BOOST_REGEX' >> configure.ac echo 'AX_BOOST_PROGRAM_OPTIONS' >> configure.ac echo -n "AX_LIB_CURL([$MIN_CURL_VERSION],," >> configure.ac echo "AC_MSG_ERROR([You need libcurl >= $MIN_CURL_VERSION]))" >> configure.ac echo 'AC_CONFIG_FILES([Makefile])' >> configure.ac echo 'AC_OUTPUT' >> configure.ac [ -e Makefile.am ] && rm -v Makefile.am echo 'AUTOMAKE_OPTIONS = foreign subdir-objects -Wall' >> Makefile.am echo 'ACLOCAL_AMFLAGS = ${ACLOCAL_FLAGS} -I m4' >> Makefile.am echo 'AM_CPPFLAGS = $(BOOST_CPPFLAGS)' >> Makefile.am echo 'AM_CPPFLAGS += $(CURL_CFLAGS)' >> Makefile.am echo 'bin_PROGRAMS = ckon' >> Makefile.am echo 'ckon_LDADD = $(BOOST_LDFLAGS) -lstdc++' >> Makefile.am echo 'ckon_LDADD += $(BOOST_SYSTEM_LIB)' >> Makefile.am echo 'ckon_LDADD += $(BOOST_FILESYSTEM_LIB)' >> Makefile.am echo 'ckon_LDADD += $(BOOST_REGEX_LIB)' >> Makefile.am echo 'ckon_LDADD += $(BOOST_PROGRAM_OPTIONS_LIB)' >> Makefile.am echo 'ckon_LDADD += $(CURL_LIBS)' >> Makefile.am echo 'ckon_SOURCES =' >> Makefile.am for file in `find . -type f -name "*.h" -o -name "*.cc"`; do echo "ckon_SOURCES += $file" >> Makefile.am done ckon-0.7.1/cleanup.sh000077500000000000000000000005141245632600200144370ustar00rootroot00000000000000#!/bin/bash #set -v # files [ -e Makefile.in ] && rm -v Makefile.in [ -e configure ] && rm -v configure [ -e aclocal.m4 ] && rm -v aclocal.m4 # dirs [ -d build ] && rm -rvf build [ -d autom4te.cache ] && rm -rvf autom4te.cache [ -d config ] && rm -rvf config [ -d bin ] && rm -rvf bin find . -type f -name ".deps" -exec rm -v {} \; ckon-0.7.1/configure.ac000066400000000000000000000006401245632600200147370ustar00rootroot00000000000000AC_INIT([ckon], [0.7]) AC_CONFIG_MACRO_DIR([m4]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) AC_CONFIG_AUX_DIR(config) m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) AM_INIT_AUTOMAKE([-Wall no-define]) AC_PROG_CXX AX_BOOST_BASE([1.50]) AX_BOOST_SYSTEM AX_BOOST_FILESYSTEM AX_BOOST_REGEX AX_BOOST_PROGRAM_OPTIONS AX_LIB_CURL([7.15.5],,AC_MSG_ERROR([You need libcurl >= 7.15.5])) AC_CONFIG_FILES([Makefile]) AC_OUTPUT ckon-0.7.1/docs/000077500000000000000000000000001245632600200134015ustar00rootroot00000000000000ckon-0.7.1/docs/Makefile000066400000000000000000000126701245632600200150470ustar00rootroot00000000000000# Makefile for Sphinx documentation # # You can set these variables from the command line. SPHINXOPTS = SPHINXBUILD = sphinx-build-2.7 PAPER = BUILDDIR = _build # Internal variables. PAPEROPT_a4 = -D latex_paper_size=a4 PAPEROPT_letter = -D latex_paper_size=letter ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . # the i18n builder cannot share the environment and doctrees with the others I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext help: @echo "Please use \`make ' where is one of" @echo " html to make standalone HTML files" @echo " dirhtml to make HTML files named index.html in directories" @echo " singlehtml to make a single large HTML file" @echo " pickle to make pickle files" @echo " json to make JSON files" @echo " htmlhelp to make HTML files and a HTML help project" @echo " qthelp to make HTML files and a qthelp project" @echo " devhelp to make HTML files and a Devhelp project" @echo " epub to make an epub" @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" @echo " latexpdf to make LaTeX files and run them through pdflatex" @echo " text to make text files" @echo " man to make manual pages" @echo " texinfo to make Texinfo files" @echo " info to make Texinfo files and run them through makeinfo" @echo " gettext to make PO message catalogs" @echo " changes to make an overview of all changed/added/deprecated items" @echo " linkcheck to check all external links for integrity" @echo " doctest to run all doctests embedded in the documentation (if enabled)" clean: -rm -rf $(BUILDDIR)/* html: $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." dirhtml: $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." singlehtml: $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml @echo @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." pickle: $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle @echo @echo "Build finished; now you can process the pickle files." json: $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json @echo @echo "Build finished; now you can process the JSON files." htmlhelp: $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp @echo @echo "Build finished; now you can run HTML Help Workshop with the" \ ".hhp project file in $(BUILDDIR)/htmlhelp." qthelp: $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp @echo @echo "Build finished; now you can run "qcollectiongenerator" with the" \ ".qhcp project file in $(BUILDDIR)/qthelp, like this:" @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/ckon.qhcp" @echo "To view the help file:" @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/ckon.qhc" devhelp: $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp @echo @echo "Build finished." @echo "To view the help file:" @echo "# mkdir -p $$HOME/.local/share/devhelp/ckon" @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/ckon" @echo "# devhelp" epub: $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub @echo @echo "Build finished. The epub file is in $(BUILDDIR)/epub." latex: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." @echo "Run \`make' in that directory to run these through (pdf)latex" \ "(use \`make latexpdf' here to do that automatically)." latexpdf: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo "Running LaTeX files through pdflatex..." $(MAKE) -C $(BUILDDIR)/latex all-pdf @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." text: $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text @echo @echo "Build finished. The text files are in $(BUILDDIR)/text." man: $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man @echo @echo "Build finished. The manual pages are in $(BUILDDIR)/man." texinfo: $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo @echo @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." @echo "Run \`make' in that directory to run these through makeinfo" \ "(use \`make info' here to do that automatically)." info: $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo @echo "Running Texinfo files through makeinfo..." make -C $(BUILDDIR)/texinfo info @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." gettext: $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale @echo @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." changes: $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes @echo @echo "The overview file is in $(BUILDDIR)/changes." linkcheck: $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck @echo @echo "Link check complete; look for any errors in the above output " \ "or in $(BUILDDIR)/linkcheck/output.txt." doctest: $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest @echo "Testing of doctests in the sources finished, look at the " \ "results in $(BUILDDIR)/doctest/output.txt." ckon-0.7.1/docs/conf.py000066400000000000000000000170661245632600200147120ustar00rootroot00000000000000# -*- coding: utf-8 -*- # # ckon documentation build configuration file, created by # sphinx-quickstart on Thu Jul 4 14:26:45 2013. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. import sys, os # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. #sys.path.insert(0, os.path.abspath('.')) # -- General configuration ----------------------------------------------------- # If your documentation needs a minimal Sphinx version, state it here. #needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = ['sphinx.ext.todo', 'sphinx.ext.coverage'] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] # The suffix of source filenames. source_suffix = '.rst' # The encoding of source files. #source_encoding = 'utf-8-sig' # The master toctree document. master_doc = 'index' # General information about the project. project = u'ckon' copyright = u'2013, Patrick Huck' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. version = '0.3' # The full version, including alpha/beta/rc tags. release = '0.3' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. #language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: #today = '' # Else, today_fmt is used as the format for a strftime call. #today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = ['_build'] # The reST default role (used for this markup: `text`) to use for all documents. #default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. #add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). #add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. #show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' # A list of ignored prefixes for module index sorting. #modindex_common_prefix = [] # -- Options for HTML output --------------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # html_theme = 'default' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. #html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. #html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". #html_title = None # A shorter title for the navigation bar. Default is the same as html_title. #html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. #html_logo = None # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. #html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ['_static'] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. #html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. #html_use_smartypants = True # Custom sidebar templates, maps document names to template names. #html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. #html_additional_pages = {} # If false, no module index is generated. #html_domain_indices = True # If false, no index is generated. #html_use_index = True # If true, the index is split into individual pages for each letter. #html_split_index = False # If true, links to the reST sources are added to the pages. #html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. #html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. #html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. #html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). #html_file_suffix = None # Output file base name for HTML help builder. htmlhelp_basename = 'ckondoc' # -- Options for LaTeX output -------------------------------------------------- latex_elements = { # The paper size ('letterpaper' or 'a4paper'). #'papersize': 'letterpaper', # The font size ('10pt', '11pt' or '12pt'). #'pointsize': '10pt', # Additional stuff for the LaTeX preamble. #'preamble': '', } # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ ('index', 'ckon.tex', u'ckon Documentation', u'Patrick Huck', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of # the title page. #latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. #latex_use_parts = False # If true, show page references after internal links. #latex_show_pagerefs = False # If true, show URL addresses after external links. #latex_show_urls = False # Documents to append as an appendix to all manuals. #latex_appendices = [] # If false, no module index is generated. #latex_domain_indices = True # -- Options for manual page output -------------------------------------------- # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ ('index', 'ckon', u'ckon Documentation', [u'Patrick Huck'], 1) ] # If true, show URL addresses after external links. #man_show_urls = False # -- Options for Texinfo output ------------------------------------------------ # Grouping the document tree into Texinfo files. List of tuples # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ ('index', 'ckon', u'ckon Documentation', u'Patrick Huck', 'ckon', 'One line description of project.', 'Miscellaneous'), ] # Documents to append as an appendix to all manuals. #texinfo_appendices = [] # If false, no module index is generated. #texinfo_domain_indices = True # How to display URL addresses: 'footnote', 'no', or 'inline'. #texinfo_show_urls = 'footnote' ckon-0.7.1/docs/index.rst000066400000000000000000000161271245632600200152510ustar00rootroot00000000000000.. ckon documentation master file, created by sphinx-quickstart on Thu Jul 4 14:26:45 2013. You can adapt this file completely to your liking, but it should at least contain the root `toctree` directive. ckon documentation ================== .. toctree:: :maxdepth: 2 Introduction ------------ *ckon* is a C++ program/tool which automatically takes care of compilation, dictionary generation and linking of programs and libraries developed for data analyses within the `CERN ROOT`_ analysis framework. This includes parsing include headers to figure out which libraries the main programs need to be linked to. It uses `automake/autoconf`_ to be platform independent and GNU install compliant. In addition, `m4 macros`_ are automatically downloaded and the according compiler flags included based on a list of `boost`_ libraries provided in the config file. For the purpose of YAML database usage, a m4 macro can be downloaded during setup to link against the `yaml-cpp`_ library. .. _CERN ROOT: http://root.cern.ch .. _automake/autoconf: http://www.gnu.org/software/autoconf/ .. _m4 macros: http://www.gnu.org/software/autoconf-archive/The-Macros.html#The-Macros .. _boost: http://www.boost.org/ .. _yaml-cpp: https://code.google.com/p/yaml-cpp/ Authors and Contributors | Patrick Huck (@tschaume) | *invaluable contributions*: Hiroshi Masui | Reference `Talk`_ (LBNL, 2011/11/14) License & Project Homepage | *ckon* is published under `MIT License`_. | Find the project page at http://tschaume.github.com/ckon Software Requirements * m4/1.4.6 * autoconf/2.68 * automake/1.11.4 * libtool/2.4 * boost/1.50 * libcurl/7.27.0 .. _Talk: https://speakerdeck.com/tschaume/organize-root-analyses-with-autoconf .. _MIT License: http://opensource.org/licenses/MIT Installation ------------ * clone *ckon* via ``git clone git@github.com:tschaume/ckon.git`` * install via ``cd ckon; ./installCkon `` * replace ```` with an install path in your $PATH * see ``./installCkon -h`` for help * see ``./configure --help`` for configure options in case something goes wrong Usage ----- Generic Options ^^^^^^^^^^^^^^^ Shown below are the generic command line options which can be given to *ckon*.:: Generic Options: -h [ --help ] show this help -v [ --verbose ] verbose output -j arg call make w/ -j <#cores> --ckon_cmd arg setup | clean | install The long option ``--ckon_cmd`` is implemented as optional positional option to run the setup, clean all compilation products (i.e. ``make clean``) and globally install libraries and programs (i.e. ``make install``): * ``ckon setup``: run the setup * ``ckon``: compile * ``ckon clean``: make clean * ``ckon install``: make install * ``ckon dry``: only generates Makefiles, no compilation Setup ^^^^^ ``ckon setup`` generates the files *configure.ac* and *.autom4te.cfg* (both autoconf specific, no need for modifications) as well as *ckon.cfg*. Modify the latter to resemble your directory structure and linker options. Simply remove the lines/options you don't need, thus using the default options. Configuration ^^^^^^^^^^^^^ The following options can be set on the command line or preferably in *ckon.cfg*. Optionally, a file named ``ckonignore`` with a list of strings to be ignored during the build process, can be created in the working directory. Wildcards are not supported (yet). Instead each path currently processed by *ckon* will be checked against the strings/lines in ``ckonignore``. If one of the strings in ``ckonignore`` is contained in the path, the path is ignored/skipped.:: Configuration: -s [ --suffix ] arg add suffix + in LinkDef.h (bool) -y [ --yaml ] arg use yaml --ckon.src_dir arg source dir --ckon.exclSuffix arg no + suffix --ckon.NoRootCint arg no dictionary --ckon.prog_subdir arg progs subdir --ckon.build_dir arg build dir --ckon.install_dir arg install dir --ckon.cppflags arg add CPPFLAGS --ckon.boost arg boost libraries In addition, unregistered options of the form ldadd.prog_name are allowed to use for adding LDFLAGS to the linker of specific programs. The given string/value is added verbatim in LDADD. Unregistered options are only allowed in ckon.cfg The unregistered option group ``ldadd`` is allowed. For instance, link the programs *genCharmContrib* and *dedxCut* versus `Pythia6`_ and `RooFit`_, respectively, by adding the following to *ckon.cfg*.:: [ldadd] genCharmContrib=-lPhysics -lEG -lEGPythia6 # link pythia dedxCut=-lRooFit -lRooFitCore -lMinuit # link roofit .. _Pythia6: http://home.thep.lu.se/~torbjorn/Pythia.html .. _RooFit: http://root.cern.ch/drupal/content/roofit ``ckon.boost`` is set during ``ckon setup`` to use and link against specific boost libraries. Try not to run rootcint (``ckon.NoRootCint``) on the library if compilation fails. .. NOTE:: ckon version 0.4 now allows for the automatic download of a ``yaml.m4`` macro during ``ckon setup`` to link against the `yaml-cpp`_ library. Please submit an `issue`_ if the macro doesn't find the library after you installed it. This added functionality shouldn't break anything if you choose not to use YAML during ``ckon setup``. .. _yaml-cpp: https://code.google.com/p/yaml-cpp/ .. _issue: https://github.com/tschaume/ckon/issues .. WARNING:: For the recursive header scan to work, make sure that all include directives for C++ and ROOT headers are enclosed in ``<...>``! Only your local/private headers should be enclosed in ``"..."``. Otherwise *ckon* will fail reporting a ``basic_string::_S_create`` error. Typical Directory Structure ^^^^^^^^^^^^^^^^^^^^^^^^^^^ Put header and source files for each library into a separate folder in ``ckon.src_dir``. Running *ckon* should automagically take the right action for the current status of your build directory (no need to run ``ckon clean`` before re-compilation). Makefiles and LinkDef’s are generated automatically based on the contents and timestamps in the ``ckon.src_dir`` directory. A typical directory structure could look as follows - using the current defaults for illustration purposes.:: StRoot/ ElectronPid/ BetaPanels.cxx BetaPanels.h PureSampleAnalysis.cxx PureSampleAnalysis.h SigmaElFitsMaker.cxx SigmaElFitsMaker.h SigmaElFitsPlotter.cxx SigmaElFitsPlotter.h SigmaElFitsUtils.cxx SigmaElFitsUtils.h programs/ README beta3sig.cc dedxCut.cc nsigparamsGP.cc pureSamp.cc StBadRdosDb/ StBadRdosDb.cxx StBadRdosDb.h database/ dbfiles genAll.sh genBadRdosDb.pl macros/ testStBadRdosDb.C YamlCfgReader/ YamlCfgReader.cxx YamlCfgReader.h config.yml ... Index and Search ---------------- * :ref:`genindex` * :ref:`modindex` * :ref:`search` ckon-0.7.1/installCkon000077500000000000000000000016461245632600200146670ustar00rootroot00000000000000#!/bin/bash if [ $# -ge 0 ]; then if [ $# -ge 3 ]; then echo "too many arguments." echo "usage: $0 prefix [nCpu]" exit fi prefix=$PWD [ $# -ge 1 ] && prefix=$1 nCpu=1 [ $# -eq 2 ] && nCpu=$2 echo "using prefix $prefix and $nCpu CPU(s)" ./autogen.sh autoreconf -v --force --install -Wall mkdir -v build cd build # BOOST_ROOT set by `module load boost/1.54.0` in ~/.login works on PDSF boostopts='--with-boost' [ ! -z $BOOST_ROOT ] && boostopts=$boostopts"=$BOOST_ROOT" boostopts=$boostopts' --with-boost-filesystem --with-boost-system' boostopts=$boostopts' --with-boost-regex --with-boost-program-options' ../configure --prefix=$prefix $boostopts make -j $nCpu CXXFLAGS="-Wall -Werror" make install echo "===> ckon build done." else echo "usage: $0 [prefix [nCpu]]" echo 'prefix = install dir [default=$PWD]' echo "nCpu = #cpu's for parallel build (-j) [default=1]" fi ckon-0.7.1/m4/000077500000000000000000000000001245632600200127715ustar00rootroot00000000000000ckon-0.7.1/m4/ax_boost_base.m4000066400000000000000000000245761245632600200160610ustar00rootroot00000000000000# =========================================================================== # http://www.gnu.org/software/autoconf-archive/ax_boost_base.html # =========================================================================== # # SYNOPSIS # # AX_BOOST_BASE([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) # # DESCRIPTION # # Test for the Boost C++ libraries of a particular version (or newer) # # If no path to the installed boost library is given the macro searchs # under /usr, /usr/local, /opt and /opt/local and evaluates the # $BOOST_ROOT environment variable. Further documentation is available at # . # # This macro calls: # # AC_SUBST(BOOST_CPPFLAGS) / AC_SUBST(BOOST_LDFLAGS) # # And sets: # # HAVE_BOOST # # LICENSE # # Copyright (c) 2008 Thomas Porschberg # Copyright (c) 2009 Peter Adolphs # # Copying and distribution of this file, with or without modification, are # permitted in any medium without royalty provided the copyright notice # and this notice are preserved. This file is offered as-is, without any # warranty. #serial 22 AC_DEFUN([AX_BOOST_BASE], [ AC_ARG_WITH([boost], [AS_HELP_STRING([--with-boost@<:@=ARG@:>@], [use Boost library from a standard location (ARG=yes), from the specified location (ARG=), or disable it (ARG=no) @<:@ARG=yes@:>@ ])], [ if test "$withval" = "no"; then want_boost="no" elif test "$withval" = "yes"; then want_boost="yes" ac_boost_path="" else want_boost="yes" ac_boost_path="$withval" fi ], [want_boost="yes"]) AC_ARG_WITH([boost-libdir], AS_HELP_STRING([--with-boost-libdir=LIB_DIR], [Force given directory for boost libraries. Note that this will override library path detection, so use this parameter only if default library detection fails and you know exactly where your boost libraries are located.]), [ if test -d "$withval" then ac_boost_lib_path="$withval" else AC_MSG_ERROR(--with-boost-libdir expected directory name) fi ], [ac_boost_lib_path=""] ) if test "x$want_boost" = "xyes"; then boost_lib_version_req=ifelse([$1], ,1.20.0,$1) boost_lib_version_req_shorten=`expr $boost_lib_version_req : '\([[0-9]]*\.[[0-9]]*\)'` boost_lib_version_req_major=`expr $boost_lib_version_req : '\([[0-9]]*\)'` boost_lib_version_req_minor=`expr $boost_lib_version_req : '[[0-9]]*\.\([[0-9]]*\)'` boost_lib_version_req_sub_minor=`expr $boost_lib_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'` if test "x$boost_lib_version_req_sub_minor" = "x" ; then boost_lib_version_req_sub_minor="0" fi WANT_BOOST_VERSION=`expr $boost_lib_version_req_major \* 100000 \+ $boost_lib_version_req_minor \* 100 \+ $boost_lib_version_req_sub_minor` AC_MSG_CHECKING(for boostlib >= $boost_lib_version_req) succeeded=no dnl On 64-bit systems check for system libraries in both lib64 and lib. dnl The former is specified by FHS, but e.g. Debian does not adhere to dnl this (as it rises problems for generic multi-arch support). dnl The last entry in the list is chosen by default when no libraries dnl are found, e.g. when only header-only libraries are installed! libsubdirs="lib" ax_arch=`uname -m` case $ax_arch in x86_64|ppc64|s390x|sparc64|aarch64) libsubdirs="lib64 lib lib64" ;; esac dnl allow for real multi-arch paths e.g. /usr/lib/x86_64-linux-gnu. Give dnl them priority over the other paths since, if libs are found there, they dnl are almost assuredly the ones desired. AC_REQUIRE([AC_CANONICAL_HOST]) libsubdirs="lib/${host_cpu}-${host_os} $libsubdirs" dnl first we check the system location for boost libraries dnl this location ist chosen if boost libraries are installed with the --layout=system option dnl or if you install boost with RPM if test "$ac_boost_path" != ""; then BOOST_CPPFLAGS="-I$ac_boost_path/include" for ac_boost_path_tmp in $libsubdirs; do if test -d "$ac_boost_path"/"$ac_boost_path_tmp" ; then BOOST_LDFLAGS="-L$ac_boost_path/$ac_boost_path_tmp" break fi done elif test "$cross_compiling" != yes; then for ac_boost_path_tmp in /usr /usr/local /opt /opt/local ; do if test -d "$ac_boost_path_tmp/include/boost" && test -r "$ac_boost_path_tmp/include/boost"; then for libsubdir in $libsubdirs ; do if ls "$ac_boost_path_tmp/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi done BOOST_LDFLAGS="-L$ac_boost_path_tmp/$libsubdir" BOOST_CPPFLAGS="-I$ac_boost_path_tmp/include" break; fi done fi dnl overwrite ld flags if we have required special directory with dnl --with-boost-libdir parameter if test "$ac_boost_lib_path" != ""; then BOOST_LDFLAGS="-L$ac_boost_lib_path" fi CPPFLAGS_SAVED="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" export CPPFLAGS LDFLAGS_SAVED="$LDFLAGS" LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" export LDFLAGS AC_REQUIRE([AC_PROG_CXX]) AC_LANG_PUSH(C++) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ @%:@include ]], [[ #if BOOST_VERSION >= $WANT_BOOST_VERSION // Everything is okay #else # error Boost version is too old #endif ]])],[ AC_MSG_RESULT(yes) succeeded=yes found_system=yes ],[ ]) AC_LANG_POP([C++]) dnl if we found no boost with system layout we search for boost libraries dnl built and installed without the --layout=system option or for a staged(not installed) version if test "x$succeeded" != "xyes"; then _version=0 if test "$ac_boost_path" != ""; then if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do _version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'` V_CHECK=`expr $_version_tmp \> $_version` if test "$V_CHECK" = "1" ; then _version=$_version_tmp fi VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'` BOOST_CPPFLAGS="-I$ac_boost_path/include/boost-$VERSION_UNDERSCORE" done fi else if test "$cross_compiling" != yes; then for ac_boost_path in /usr /usr/local /opt /opt/local ; do if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do _version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'` V_CHECK=`expr $_version_tmp \> $_version` if test "$V_CHECK" = "1" ; then _version=$_version_tmp best_path=$ac_boost_path fi done fi done VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'` BOOST_CPPFLAGS="-I$best_path/include/boost-$VERSION_UNDERSCORE" if test "$ac_boost_lib_path" = ""; then for libsubdir in $libsubdirs ; do if ls "$best_path/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi done BOOST_LDFLAGS="-L$best_path/$libsubdir" fi fi if test "x$BOOST_ROOT" != "x"; then for libsubdir in $libsubdirs ; do if ls "$BOOST_ROOT/stage/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi done if test -d "$BOOST_ROOT" && test -r "$BOOST_ROOT" && test -d "$BOOST_ROOT/stage/$libsubdir" && test -r "$BOOST_ROOT/stage/$libsubdir"; then version_dir=`expr //$BOOST_ROOT : '.*/\(.*\)'` stage_version=`echo $version_dir | sed 's/boost_//' | sed 's/_/./g'` stage_version_shorten=`expr $stage_version : '\([[0-9]]*\.[[0-9]]*\)'` V_CHECK=`expr $stage_version_shorten \>\= $_version` if test "$V_CHECK" = "1" -a "$ac_boost_lib_path" = "" ; then AC_MSG_NOTICE(We will use a staged boost library from $BOOST_ROOT) BOOST_CPPFLAGS="-I$BOOST_ROOT" BOOST_LDFLAGS="-L$BOOST_ROOT/stage/$libsubdir" fi fi fi fi CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" export CPPFLAGS LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" export LDFLAGS AC_LANG_PUSH(C++) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ @%:@include ]], [[ #if BOOST_VERSION >= $WANT_BOOST_VERSION // Everything is okay #else # error Boost version is too old #endif ]])],[ AC_MSG_RESULT(yes) succeeded=yes found_system=yes ],[ ]) AC_LANG_POP([C++]) fi if test "$succeeded" != "yes" ; then if test "$_version" = "0" ; then AC_MSG_NOTICE([[We could not detect the boost libraries (version $boost_lib_version_req_shorten or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option. If you are sure you have boost installed, then check your version number looking in . See http://randspringer.de/boost for more documentation.]]) else AC_MSG_NOTICE([Your boost libraries seems to old (version $_version).]) fi # execute ACTION-IF-NOT-FOUND (if present): ifelse([$3], , :, [$3]) else AC_SUBST(BOOST_CPPFLAGS) AC_SUBST(BOOST_LDFLAGS) AC_DEFINE(HAVE_BOOST,,[define if the Boost library is available]) # execute ACTION-IF-FOUND (if present): ifelse([$2], , :, [$2]) fi CPPFLAGS="$CPPFLAGS_SAVED" LDFLAGS="$LDFLAGS_SAVED" fi ]) ckon-0.7.1/m4/ax_boost_filesystem.m4000066400000000000000000000104371245632600200173220ustar00rootroot00000000000000# =========================================================================== # http://www.gnu.org/software/autoconf-archive/ax_boost_filesystem.html # =========================================================================== # # SYNOPSIS # # AX_BOOST_FILESYSTEM # # DESCRIPTION # # Test for Filesystem library from the Boost C++ libraries. The macro # requires a preceding call to AX_BOOST_BASE. Further documentation is # available at . # # This macro calls: # # AC_SUBST(BOOST_FILESYSTEM_LIB) # # And sets: # # HAVE_BOOST_FILESYSTEM # # LICENSE # # Copyright (c) 2009 Thomas Porschberg # Copyright (c) 2009 Michael Tindal # Copyright (c) 2009 Roman Rybalko # # Copying and distribution of this file, with or without modification, are # permitted in any medium without royalty provided the copyright notice # and this notice are preserved. This file is offered as-is, without any # warranty. #serial 26 AC_DEFUN([AX_BOOST_FILESYSTEM], [ AC_ARG_WITH([boost-filesystem], AS_HELP_STRING([--with-boost-filesystem@<:@=special-lib@:>@], [use the Filesystem library from boost - it is possible to specify a certain library for the linker e.g. --with-boost-filesystem=boost_filesystem-gcc-mt ]), [ if test "$withval" = "no"; then want_boost="no" elif test "$withval" = "yes"; then want_boost="yes" ax_boost_user_filesystem_lib="" else want_boost="yes" ax_boost_user_filesystem_lib="$withval" fi ], [want_boost="yes"] ) if test "x$want_boost" = "xyes"; then AC_REQUIRE([AC_PROG_CC]) CPPFLAGS_SAVED="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" export CPPFLAGS LDFLAGS_SAVED="$LDFLAGS" LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" export LDFLAGS LIBS_SAVED=$LIBS LIBS="$LIBS $BOOST_SYSTEM_LIB" export LIBS AC_CACHE_CHECK(whether the Boost::Filesystem library is available, ax_cv_boost_filesystem, [AC_LANG_PUSH([C++]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include ]], [[using namespace boost::filesystem; path my_path( "foo/bar/data.txt" ); return 0;]])], ax_cv_boost_filesystem=yes, ax_cv_boost_filesystem=no) AC_LANG_POP([C++]) ]) if test "x$ax_cv_boost_filesystem" = "xyes"; then AC_DEFINE(HAVE_BOOST_FILESYSTEM,,[define if the Boost::Filesystem library is available]) BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'` if test "x$ax_boost_user_filesystem_lib" = "x"; then for libextension in `ls -r $BOOSTLIBDIR/libboost_filesystem* 2>/dev/null | sed 's,.*/lib,,' | sed 's,\..*,,'` ; do ax_lib=${libextension} AC_CHECK_LIB($ax_lib, exit, [BOOST_FILESYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_FILESYSTEM_LIB) link_filesystem="yes"; break], [link_filesystem="no"]) done if test "x$link_filesystem" != "xyes"; then for libextension in `ls -r $BOOSTLIBDIR/boost_filesystem* 2>/dev/null | sed 's,.*/,,' | sed -e 's,\..*,,'` ; do ax_lib=${libextension} AC_CHECK_LIB($ax_lib, exit, [BOOST_FILESYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_FILESYSTEM_LIB) link_filesystem="yes"; break], [link_filesystem="no"]) done fi else for ax_lib in $ax_boost_user_filesystem_lib boost_filesystem-$ax_boost_user_filesystem_lib; do AC_CHECK_LIB($ax_lib, exit, [BOOST_FILESYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_FILESYSTEM_LIB) link_filesystem="yes"; break], [link_filesystem="no"]) done fi if test "x$ax_lib" = "x"; then AC_MSG_ERROR(Could not find a version of the library!) fi if test "x$link_filesystem" != "xyes"; then AC_MSG_ERROR(Could not link against $ax_lib !) fi fi CPPFLAGS="$CPPFLAGS_SAVED" LDFLAGS="$LDFLAGS_SAVED" LIBS="$LIBS_SAVED" fi ]) ckon-0.7.1/m4/ax_boost_program_options.m4000066400000000000000000000115251245632600200203570ustar00rootroot00000000000000# ============================================================================ # http://www.gnu.org/software/autoconf-archive/ax_boost_program_options.html # ============================================================================ # # SYNOPSIS # # AX_BOOST_PROGRAM_OPTIONS # # DESCRIPTION # # Test for program options library from the Boost C++ libraries. The macro # requires a preceding call to AX_BOOST_BASE. Further documentation is # available at . # # This macro calls: # # AC_SUBST(BOOST_PROGRAM_OPTIONS_LIB) # # And sets: # # HAVE_BOOST_PROGRAM_OPTIONS # # LICENSE # # Copyright (c) 2009 Thomas Porschberg # # Copying and distribution of this file, with or without modification, are # permitted in any medium without royalty provided the copyright notice # and this notice are preserved. This file is offered as-is, without any # warranty. #serial 22 AC_DEFUN([AX_BOOST_PROGRAM_OPTIONS], [ AC_ARG_WITH([boost-program-options], AS_HELP_STRING([--with-boost-program-options@<:@=special-lib@:>@], [use the program options library from boost - it is possible to specify a certain library for the linker e.g. --with-boost-program-options=boost_program_options-gcc-mt-1_33_1 ]), [ if test "$withval" = "no"; then want_boost="no" elif test "$withval" = "yes"; then want_boost="yes" ax_boost_user_program_options_lib="" else want_boost="yes" ax_boost_user_program_options_lib="$withval" fi ], [want_boost="yes"] ) if test "x$want_boost" = "xyes"; then AC_REQUIRE([AC_PROG_CC]) export want_boost CPPFLAGS_SAVED="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" export CPPFLAGS LDFLAGS_SAVED="$LDFLAGS" LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" export LDFLAGS AC_CACHE_CHECK([whether the Boost::Program_Options library is available], ax_cv_boost_program_options, [AC_LANG_PUSH(C++) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include ]], [[boost::program_options::options_description generic("Generic options"); return 0;]])], ax_cv_boost_program_options=yes, ax_cv_boost_program_options=no) AC_LANG_POP([C++]) ]) if test "$ax_cv_boost_program_options" = yes; then AC_DEFINE(HAVE_BOOST_PROGRAM_OPTIONS,,[define if the Boost::PROGRAM_OPTIONS library is available]) BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'` if test "x$ax_boost_user_program_options_lib" = "x"; then for libextension in `ls $BOOSTLIBDIR/libboost_program_options*.so* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_program_options.*\)\.so.*$;\1;'` `ls $BOOSTLIBDIR/libboost_program_options*.dylib* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_program_options.*\)\.dylib.*$;\1;'` `ls $BOOSTLIBDIR/libboost_program_options*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_program_options.*\)\.a.*$;\1;'` ; do ax_lib=${libextension} AC_CHECK_LIB($ax_lib, exit, [BOOST_PROGRAM_OPTIONS_LIB="-l$ax_lib"; AC_SUBST(BOOST_PROGRAM_OPTIONS_LIB) link_program_options="yes"; break], [link_program_options="no"]) done if test "x$link_program_options" != "xyes"; then for libextension in `ls $BOOSTLIBDIR/boost_program_options*.dll* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_program_options.*\)\.dll.*$;\1;'` `ls $BOOSTLIBDIR/boost_program_options*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_program_options.*\)\.a.*$;\1;'` ; do ax_lib=${libextension} AC_CHECK_LIB($ax_lib, exit, [BOOST_PROGRAM_OPTIONS_LIB="-l$ax_lib"; AC_SUBST(BOOST_PROGRAM_OPTIONS_LIB) link_program_options="yes"; break], [link_program_options="no"]) done fi else for ax_lib in $ax_boost_user_program_options_lib boost_program_options-$ax_boost_user_program_options_lib; do AC_CHECK_LIB($ax_lib, main, [BOOST_PROGRAM_OPTIONS_LIB="-l$ax_lib"; AC_SUBST(BOOST_PROGRAM_OPTIONS_LIB) link_program_options="yes"; break], [link_program_options="no"]) done fi if test "x$ax_lib" = "x"; then AC_MSG_ERROR(Could not find a version of the library!) fi if test "x$link_program_options" != "xyes"; then AC_MSG_ERROR([Could not link against [$ax_lib] !]) fi fi CPPFLAGS="$CPPFLAGS_SAVED" LDFLAGS="$LDFLAGS_SAVED" fi ]) ckon-0.7.1/m4/ax_boost_regex.m4000066400000000000000000000101641245632600200162450ustar00rootroot00000000000000# =========================================================================== # http://www.gnu.org/software/autoconf-archive/ax_boost_regex.html # =========================================================================== # # SYNOPSIS # # AX_BOOST_REGEX # # DESCRIPTION # # Test for Regex library from the Boost C++ libraries. The macro requires # a preceding call to AX_BOOST_BASE. Further documentation is available at # . # # This macro calls: # # AC_SUBST(BOOST_REGEX_LIB) # # And sets: # # HAVE_BOOST_REGEX # # LICENSE # # Copyright (c) 2008 Thomas Porschberg # Copyright (c) 2008 Michael Tindal # # Copying and distribution of this file, with or without modification, are # permitted in any medium without royalty provided the copyright notice # and this notice are preserved. This file is offered as-is, without any # warranty. #serial 22 AC_DEFUN([AX_BOOST_REGEX], [ AC_ARG_WITH([boost-regex], AS_HELP_STRING([--with-boost-regex@<:@=special-lib@:>@], [use the Regex library from boost - it is possible to specify a certain library for the linker e.g. --with-boost-regex=boost_regex-gcc-mt-d-1_33_1 ]), [ if test "$withval" = "no"; then want_boost="no" elif test "$withval" = "yes"; then want_boost="yes" ax_boost_user_regex_lib="" else want_boost="yes" ax_boost_user_regex_lib="$withval" fi ], [want_boost="yes"] ) if test "x$want_boost" = "xyes"; then AC_REQUIRE([AC_PROG_CC]) CPPFLAGS_SAVED="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" export CPPFLAGS LDFLAGS_SAVED="$LDFLAGS" LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" export LDFLAGS AC_CACHE_CHECK(whether the Boost::Regex library is available, ax_cv_boost_regex, [AC_LANG_PUSH([C++]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include ]], [[boost::regex r(); return 0;]])], ax_cv_boost_regex=yes, ax_cv_boost_regex=no) AC_LANG_POP([C++]) ]) if test "x$ax_cv_boost_regex" = "xyes"; then AC_DEFINE(HAVE_BOOST_REGEX,,[define if the Boost::Regex library is available]) BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'` if test "x$ax_boost_user_regex_lib" = "x"; then for libextension in `ls $BOOSTLIBDIR/libboost_regex*.so* $BOOSTLIBDIR/libboost_regex*.dylib* $BOOSTLIBDIR/libboost_regex*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_regex.*\)\.so.*$;\1;' -e 's;^lib\(boost_regex.*\)\.dylib.*;\1;' -e 's;^lib\(boost_regex.*\)\.a.*$;\1;'` ; do ax_lib=${libextension} AC_CHECK_LIB($ax_lib, exit, [BOOST_REGEX_LIB="-l$ax_lib"; AC_SUBST(BOOST_REGEX_LIB) link_regex="yes"; break], [link_regex="no"]) done if test "x$link_regex" != "xyes"; then for libextension in `ls $BOOSTLIBDIR/boost_regex*.dll* $BOOSTLIBDIR/boost_regex*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_regex.*\)\.dll.*$;\1;' -e 's;^\(boost_regex.*\)\.a.*$;\1;'` ; do ax_lib=${libextension} AC_CHECK_LIB($ax_lib, exit, [BOOST_REGEX_LIB="-l$ax_lib"; AC_SUBST(BOOST_REGEX_LIB) link_regex="yes"; break], [link_regex="no"]) done fi else for ax_lib in $ax_boost_user_regex_lib boost_regex-$ax_boost_user_regex_lib; do AC_CHECK_LIB($ax_lib, main, [BOOST_REGEX_LIB="-l$ax_lib"; AC_SUBST(BOOST_REGEX_LIB) link_regex="yes"; break], [link_regex="no"]) done fi if test "x$ax_lib" = "x"; then AC_MSG_ERROR(Could not find a version of the Boost::Regex library!) fi if test "x$link_regex" != "xyes"; then AC_MSG_ERROR(Could not link against $ax_lib !) fi fi CPPFLAGS="$CPPFLAGS_SAVED" LDFLAGS="$LDFLAGS_SAVED" fi ]) ckon-0.7.1/m4/ax_boost_system.m4000066400000000000000000000101341245632600200164540ustar00rootroot00000000000000# =========================================================================== # http://www.gnu.org/software/autoconf-archive/ax_boost_system.html # =========================================================================== # # SYNOPSIS # # AX_BOOST_SYSTEM # # DESCRIPTION # # Test for System library from the Boost C++ libraries. The macro requires # a preceding call to AX_BOOST_BASE. Further documentation is available at # . # # This macro calls: # # AC_SUBST(BOOST_SYSTEM_LIB) # # And sets: # # HAVE_BOOST_SYSTEM # # LICENSE # # Copyright (c) 2008 Thomas Porschberg # Copyright (c) 2008 Michael Tindal # Copyright (c) 2008 Daniel Casimiro # # Copying and distribution of this file, with or without modification, are # permitted in any medium without royalty provided the copyright notice # and this notice are preserved. This file is offered as-is, without any # warranty. #serial 17 AC_DEFUN([AX_BOOST_SYSTEM], [ AC_ARG_WITH([boost-system], AS_HELP_STRING([--with-boost-system@<:@=special-lib@:>@], [use the System library from boost - it is possible to specify a certain library for the linker e.g. --with-boost-system=boost_system-gcc-mt ]), [ if test "$withval" = "no"; then want_boost="no" elif test "$withval" = "yes"; then want_boost="yes" ax_boost_user_system_lib="" else want_boost="yes" ax_boost_user_system_lib="$withval" fi ], [want_boost="yes"] ) if test "x$want_boost" = "xyes"; then AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_CANONICAL_BUILD]) CPPFLAGS_SAVED="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" export CPPFLAGS LDFLAGS_SAVED="$LDFLAGS" LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" export LDFLAGS AC_CACHE_CHECK(whether the Boost::System library is available, ax_cv_boost_system, [AC_LANG_PUSH([C++]) CXXFLAGS_SAVE=$CXXFLAGS AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include ]], [[boost::system::system_category]])], ax_cv_boost_system=yes, ax_cv_boost_system=no) CXXFLAGS=$CXXFLAGS_SAVE AC_LANG_POP([C++]) ]) if test "x$ax_cv_boost_system" = "xyes"; then AC_SUBST(BOOST_CPPFLAGS) AC_DEFINE(HAVE_BOOST_SYSTEM,,[define if the Boost::System library is available]) BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'` LDFLAGS_SAVE=$LDFLAGS if test "x$ax_boost_user_system_lib" = "x"; then for libextension in `ls -r $BOOSTLIBDIR/libboost_system* 2>/dev/null | sed 's,.*/lib,,' | sed 's,\..*,,'` ; do ax_lib=${libextension} AC_CHECK_LIB($ax_lib, exit, [BOOST_SYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_SYSTEM_LIB) link_system="yes"; break], [link_system="no"]) done if test "x$link_system" != "xyes"; then for libextension in `ls -r $BOOSTLIBDIR/boost_system* 2>/dev/null | sed 's,.*/,,' | sed -e 's,\..*,,'` ; do ax_lib=${libextension} AC_CHECK_LIB($ax_lib, exit, [BOOST_SYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_SYSTEM_LIB) link_system="yes"; break], [link_system="no"]) done fi else for ax_lib in $ax_boost_user_system_lib boost_system-$ax_boost_user_system_lib; do AC_CHECK_LIB($ax_lib, exit, [BOOST_SYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_SYSTEM_LIB) link_system="yes"; break], [link_system="no"]) done fi if test "x$ax_lib" = "x"; then AC_MSG_ERROR(Could not find a version of the library!) fi if test "x$link_system" = "xno"; then AC_MSG_ERROR(Could not link against $ax_lib !) fi fi CPPFLAGS="$CPPFLAGS_SAVED" LDFLAGS="$LDFLAGS_SAVED" fi ]) ckon-0.7.1/m4/ax_compare_version.m4000066400000000000000000000146521245632600200171260ustar00rootroot00000000000000# =========================================================================== # http://www.gnu.org/software/autoconf-archive/ax_compare_version.html # =========================================================================== # # SYNOPSIS # # AX_COMPARE_VERSION(VERSION_A, OP, VERSION_B, [ACTION-IF-TRUE], [ACTION-IF-FALSE]) # # DESCRIPTION # # This macro compares two version strings. Due to the various number of # minor-version numbers that can exist, and the fact that string # comparisons are not compatible with numeric comparisons, this is not # necessarily trivial to do in a autoconf script. This macro makes doing # these comparisons easy. # # The six basic comparisons are available, as well as checking equality # limited to a certain number of minor-version levels. # # The operator OP determines what type of comparison to do, and can be one # of: # # eq - equal (test A == B) # ne - not equal (test A != B) # le - less than or equal (test A <= B) # ge - greater than or equal (test A >= B) # lt - less than (test A < B) # gt - greater than (test A > B) # # Additionally, the eq and ne operator can have a number after it to limit # the test to that number of minor versions. # # eq0 - equal up to the length of the shorter version # ne0 - not equal up to the length of the shorter version # eqN - equal up to N sub-version levels # neN - not equal up to N sub-version levels # # When the condition is true, shell commands ACTION-IF-TRUE are run, # otherwise shell commands ACTION-IF-FALSE are run. The environment # variable 'ax_compare_version' is always set to either 'true' or 'false' # as well. # # Examples: # # AX_COMPARE_VERSION([3.15.7],[lt],[3.15.8]) # AX_COMPARE_VERSION([3.15],[lt],[3.15.8]) # # would both be true. # # AX_COMPARE_VERSION([3.15.7],[eq],[3.15.8]) # AX_COMPARE_VERSION([3.15],[gt],[3.15.8]) # # would both be false. # # AX_COMPARE_VERSION([3.15.7],[eq2],[3.15.8]) # # would be true because it is only comparing two minor versions. # # AX_COMPARE_VERSION([3.15.7],[eq0],[3.15]) # # would be true because it is only comparing the lesser number of minor # versions of the two values. # # Note: The characters that separate the version numbers do not matter. An # empty string is the same as version 0. OP is evaluated by autoconf, not # configure, so must be a string, not a variable. # # The author would like to acknowledge Guido Draheim whose advice about # the m4_case and m4_ifvaln functions make this macro only include the # portions necessary to perform the specific comparison specified by the # OP argument in the final configure script. # # LICENSE # # Copyright (c) 2008 Tim Toolan # # Copying and distribution of this file, with or without modification, are # permitted in any medium without royalty provided the copyright notice # and this notice are preserved. This file is offered as-is, without any # warranty. #serial 11 dnl ######################################################################### AC_DEFUN([AX_COMPARE_VERSION], [ AC_REQUIRE([AC_PROG_AWK]) # Used to indicate true or false condition ax_compare_version=false # Convert the two version strings to be compared into a format that # allows a simple string comparison. The end result is that a version # string of the form 1.12.5-r617 will be converted to the form # 0001001200050617. In other words, each number is zero padded to four # digits, and non digits are removed. AS_VAR_PUSHDEF([A],[ax_compare_version_A]) A=`echo "$1" | sed -e 's/\([[0-9]]*\)/Z\1Z/g' \ -e 's/Z\([[0-9]]\)Z/Z0\1Z/g' \ -e 's/Z\([[0-9]][[0-9]]\)Z/Z0\1Z/g' \ -e 's/Z\([[0-9]][[0-9]][[0-9]]\)Z/Z0\1Z/g' \ -e 's/[[^0-9]]//g'` AS_VAR_PUSHDEF([B],[ax_compare_version_B]) B=`echo "$3" | sed -e 's/\([[0-9]]*\)/Z\1Z/g' \ -e 's/Z\([[0-9]]\)Z/Z0\1Z/g' \ -e 's/Z\([[0-9]][[0-9]]\)Z/Z0\1Z/g' \ -e 's/Z\([[0-9]][[0-9]][[0-9]]\)Z/Z0\1Z/g' \ -e 's/[[^0-9]]//g'` dnl # In the case of le, ge, lt, and gt, the strings are sorted as necessary dnl # then the first line is used to determine if the condition is true. dnl # The sed right after the echo is to remove any indented white space. m4_case(m4_tolower($2), [lt],[ ax_compare_version=`echo "x$A x$B" | sed 's/^ *//' | sort -r | sed "s/x${A}/false/;s/x${B}/true/;1q"` ], [gt],[ ax_compare_version=`echo "x$A x$B" | sed 's/^ *//' | sort | sed "s/x${A}/false/;s/x${B}/true/;1q"` ], [le],[ ax_compare_version=`echo "x$A x$B" | sed 's/^ *//' | sort | sed "s/x${A}/true/;s/x${B}/false/;1q"` ], [ge],[ ax_compare_version=`echo "x$A x$B" | sed 's/^ *//' | sort -r | sed "s/x${A}/true/;s/x${B}/false/;1q"` ],[ dnl Split the operator from the subversion count if present. m4_bmatch(m4_substr($2,2), [0],[ # A count of zero means use the length of the shorter version. # Determine the number of characters in A and B. ax_compare_version_len_A=`echo "$A" | $AWK '{print(length)}'` ax_compare_version_len_B=`echo "$B" | $AWK '{print(length)}'` # Set A to no more than B's length and B to no more than A's length. A=`echo "$A" | sed "s/\(.\{$ax_compare_version_len_B\}\).*/\1/"` B=`echo "$B" | sed "s/\(.\{$ax_compare_version_len_A\}\).*/\1/"` ], [[0-9]+],[ # A count greater than zero means use only that many subversions A=`echo "$A" | sed "s/\(\([[0-9]]\{4\}\)\{m4_substr($2,2)\}\).*/\1/"` B=`echo "$B" | sed "s/\(\([[0-9]]\{4\}\)\{m4_substr($2,2)\}\).*/\1/"` ], [.+],[ AC_WARNING( [illegal OP numeric parameter: $2]) ],[]) # Pad zeros at end of numbers to make same length. ax_compare_version_tmp_A="$A`echo $B | sed 's/./0/g'`" B="$B`echo $A | sed 's/./0/g'`" A="$ax_compare_version_tmp_A" # Check for equality or inequality as necessary. m4_case(m4_tolower(m4_substr($2,0,2)), [eq],[ test "x$A" = "x$B" && ax_compare_version=true ], [ne],[ test "x$A" != "x$B" && ax_compare_version=true ],[ AC_WARNING([illegal OP parameter: $2]) ]) ]) AS_VAR_POPDEF([A])dnl AS_VAR_POPDEF([B])dnl dnl # Execute ACTION-IF-TRUE / ACTION-IF-FALSE. if test "$ax_compare_version" = "true" ; then m4_ifvaln([$4],[$4],[:])dnl m4_ifvaln([$5],[else $5])dnl fi ]) dnl AX_COMPARE_VERSION ckon-0.7.1/m4/ax_lib_curl.m4000066400000000000000000000022301245632600200155130ustar00rootroot00000000000000# =========================================================================== # http://www.gnu.org/software/autoconf-archive/ax_lib_curl.html # =========================================================================== # # SYNOPSIS # # AX_LIB_CURL([VERSION],[ACTION-IF-SUCCESS],[ACTION-IF-FAILURE]) # # DESCRIPTION # # Checks for minimum curl library version VERSION. If successfull executes # ACTION-IF-SUCCESS otherwise ACTION-IF-FAILURE. # # Defines CURL_LIBS and CURL_CFLAGS. # # A simple example: # # AX_LIB_CURL([7.19.4],,[ # AC_MSG_ERROR([Your system lacks of libcurl >= 7.19.4]) # ]) # # This macro is a rearranged version of AC_LIB_CURL from Akos Maroy. # # LICENSE # # Copyright (c) 2009 Francesco Salvestrini # # Copying and distribution of this file, with or without modification, are # permitted in any medium without royalty provided the copyright notice # and this notice are preserved. This file is offered as-is, without any # warranty. #serial 7 AU_ALIAS([AC_CHECK_CURL], [AX_LIB_CURL]) AC_DEFUN([AX_LIB_CURL], [ AX_PATH_GENERIC([curl],[$1],'s/^libcurl\ \+//',[$2],[$3]) ]) ckon-0.7.1/m4/ax_path_generic.m4000066400000000000000000000126251245632600200163610ustar00rootroot00000000000000# =========================================================================== # http://www.gnu.org/software/autoconf-archive/ax_path_generic.html # =========================================================================== # # SYNOPSIS # # AX_PATH_GENERIC(LIBRARY,[MINIMUM-VERSION,[SED-EXPR-EXTRACTOR]],[ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND],[CONFIG-SCRIPTS],[CFLAGS-ARG],[LIBS-ARG]) # # DESCRIPTION # # Runs the LIBRARY-config script and defines LIBRARY_CFLAGS and # LIBRARY_LIBS unless the user had predefined them in the environment. # # The script must support `--cflags' and `--libs' args. If MINIMUM-VERSION # is specified, the script must also support the `--version' arg. If the # `--with-library-[exec-]prefix' arguments to ./configure are given, it # must also support `--prefix' and `--exec-prefix'. Prefereable use # CONFIG-SCRIPTS as config script, CFLAGS-ARG instead of `--cflags` and # LIBS-ARG instead of `--libs`, if given. # # The SED-EXPR-EXTRACTOR parameter representes the expression used in sed # to extract the version number. Use it if your 'foo-config --version' # dumps something like 'Foo library v1.0.0 (alfa)' instead of '1.0.0'. # # The macro respects LIBRARY_CONFIG, LIBRARY_CFLAGS and LIBRARY_LIBS # variables. If the first one is defined, it specifies the name of the # config script to use. If the latter two are defined, the script is not # ran at all and their values are used instead (if only one of them is # defined, the empty value of the remaining one is still used). # # Example: # # AX_PATH_GENERIC(Foo, 1.0.0) # # would run `foo-config --version' and check that it is at least 1.0.0, if # successful the following variables would be defined and substituted: # # FOO_CFLAGS to `foo-config --cflags` # FOO_LIBS to `foo-config --libs` # # Example: # # AX_PATH_GENERIC([Bar],,,[ # AC_MSG_ERROR([Cannot find Bar library]) # ]) # # would check for bar-config program, defining and substituting the # following variables: # # BAR_CFLAGS to `bar-config --cflags` # BAR_LIBS to `bar-config --libs` # # Example: # # ./configure BAZ_LIBS=/usr/lib/libbaz.a # # would link with a static version of baz library even if `baz-config # --libs` returns just "-lbaz" that would normally result in using the # shared library. # # This macro is a rearranged version of AC_PATH_GENERIC from Angus Lees. # # LICENSE # # Copyright (c) 2009 Francesco Salvestrini # # Copying and distribution of this file, with or without modification, are # permitted in any medium without royalty provided the copyright notice # and this notice are preserved. This file is offered as-is, without any # warranty. #serial 11 AU_ALIAS([AC_PATH_GENERIC], [AX_PATH_GENERIC]) AC_DEFUN([AX_PATH_GENERIC],[ AC_REQUIRE([AC_PROG_SED]) dnl we're going to need uppercase and lowercase versions of the dnl string `LIBRARY' pushdef([UP], translit([$1], [a-z], [A-Z]))dnl pushdef([DOWN], translit([$1], [A-Z], [a-z]))dnl AC_ARG_WITH(DOWN-prefix,[AS_HELP_STRING([--with-]DOWN[-prefix=PREFIX], [Prefix where $1 is installed (optional)])], DOWN[]_config_prefix="$withval", DOWN[]_config_prefix="") AC_ARG_WITH(DOWN-exec-prefix,[AS_HELP_STRING([--with-]DOWN[-exec-prefix=EPREFIX], [Exec prefix where $1 is installed (optional)])], DOWN[]_config_exec_prefix="$withval", DOWN[]_config_exec_prefix="") AC_ARG_VAR(UP[]_CONFIG, [config script used for $1]) AC_ARG_VAR(UP[]_CFLAGS, [CFLAGS used for $1]) AC_ARG_VAR(UP[]_LIBS, [LIBS used for $1]) AS_IF([test x$UP[]_CFLAGS != x -o x$UP[]_LIBS != x],[ dnl Don't run config script at all, use user-provided values instead. AC_SUBST(UP[]_CFLAGS) AC_SUBST(UP[]_LIBS) : $4 ],[ AS_IF([test x$DOWN[]_config_exec_prefix != x],[ DOWN[]_config_args="$DOWN[]_config_args --exec-prefix=$DOWN[]_config_exec_prefix" AS_IF([test x${UP[]_CONFIG+set} != xset],[ UP[]_CONFIG=$DOWN[]_config_exec_prefix/bin/DOWN-config ]) ]) AS_IF([test x$DOWN[]_config_prefix != x],[ DOWN[]_config_args="$DOWN[]_config_args --prefix=$DOWN[]_config_prefix" AS_IF([test x${UP[]_CONFIG+set} != xset],[ UP[]_CONFIG=$DOWN[]_config_prefix/bin/DOWN-config ]) ]) AC_PATH_PROGS(UP[]_CONFIG,[$6 DOWN-config],[no]) AS_IF([test "$UP[]_CONFIG" == "no"],[ : $5 ],[ dnl Get the CFLAGS from LIBRARY-config script AS_IF([test x"$7" == x],[ UP[]_CFLAGS="`$UP[]_CONFIG $DOWN[]_config_args --cflags`" ],[ UP[]_CFLAGS="`$UP[]_CONFIG $DOWN[]_config_args $7`" ]) dnl Get the LIBS from LIBRARY-config script AS_IF([test x"$8" == x],[ UP[]_LIBS="`$UP[]_CONFIG $DOWN[]_config_args --libs`" ],[ UP[]_LIBS="`$UP[]_CONFIG $DOWN[]_config_args $8`" ]) AS_IF([test x"$2" != x],[ dnl Check for provided library version AS_IF([test x"$3" != x],[ dnl Use provided sed expression DOWN[]_version="`$UP[]_CONFIG $DOWN[]_config_args --version | $SED -e $3`" ],[ DOWN[]_version="`$UP[]_CONFIG $DOWN[]_config_args --version | $SED -e 's/^\ *\(.*\)\ *$/\1/'`" ]) AC_MSG_CHECKING([for $1 ($DOWN[]_version) >= $2]) AX_COMPARE_VERSION($DOWN[]_version,[ge],[$2],[ AC_MSG_RESULT([yes]) AC_SUBST(UP[]_CFLAGS) AC_SUBST(UP[]_LIBS) : $4 ],[ AC_MSG_RESULT([no]) : $5 ]) ],[ AC_SUBST(UP[]_CFLAGS) AC_SUBST(UP[]_LIBS) : $4 ]) ]) ]) popdef([UP]) popdef([DOWN]) ]) ckon-0.7.1/m4/yaml.m4000066400000000000000000000004531245632600200141770ustar00rootroot00000000000000dnl YAML_REQUIRE() dnl Check for LibYAML dnl If found, YAML_CPPFLAGS and YAML_LDFLAGS will be set. AC_DEFUN([YAML_REQUIRE], [ YAML_CPPFLAGS= dnl YAML_CPPFLAGS="-I/usr/local/include/yaml-cpp" YAML_LDFLAGS="-lyaml-cpp" AC_SUBST([YAML_CPPFLAGS]) AC_SUBST([YAML_LDFLAGS]) ]) ckon-0.7.1/src/000077500000000000000000000000001245632600200132405ustar00rootroot00000000000000ckon-0.7.1/src/aux/000077500000000000000000000000001245632600200140355ustar00rootroot00000000000000ckon-0.7.1/src/aux/myregex.cc000066400000000000000000000057611245632600200160350ustar00rootroot00000000000000// Copyright (c) 2013 Patrick Huck #include "src/aux/myregex.h" // possibly leading whitespace: const char* r1a = "^[[:space:]]*"; // possible template declaration: const char* r1b = "(template[[:space:]]*<[^;:{]+>[[:space:]]*)?"; // class or namespace: const char* r1c = "(REPLACE_W_OBJECT)[[:space:]]*"; // leading declspec macros etc: const char* r1d = "(\\<\\w+\\>([[:blank:]]*\\([^)]*\\))?[[:space:]]*)*"; // template specialisation parameters const char* r1e = "(\\<\\w*\\>)[[:space:]]*(<[^;:{]+>)?[[:space:]]*"; // terminate in { or : const char* r1f = "(\\{|:[^;\\{()]*\\{)"; const char* r2 = "^#include[[:space:]]*\"(.*?)\"[[:space:]]*$"; void myregex::IndexObjects(map_type& m, const string& file, const char* obj) { string::const_iterator start, end; start = file.begin(); end = file.end(); boost::match_results what; boost::match_flag_type flags = boost::match_default; char r1[300]; snprintf(r1, sizeof(r1), "%s%s%s%s%s%s", r1a, r1b, r1c, r1d, r1e, r1f); string restr = (obj) ? r1 : r2; if ( obj ) boost::replace_all(restr, "REPLACE_W_OBJECT", obj); boost::regex expression(restr.c_str()); while (boost::regex_search(start, end, what, expression, flags)) { if ( obj ) { // what[0] contains the whole string // what[5] contains the class name. // what[6] contains the template specialisation if any. // add class name and position to map: m[ string(what[5].first, what[5].second) + string(what[6].first, what[6].second) ] = what[5].first - file.begin(); } else { m[string(what[1].first, what[1].second)] = what[1].first - file.begin(); } // update search position: start = what[0].second; // update flags: flags |= boost::match_prev_avail; flags |= boost::match_not_bob; } } void myregex::load_file(string& s, std::istream& is) { s.erase(); if ( is.bad() ) return; s.reserve(static_cast(is.rdbuf()->in_avail())); char c; while ( is.get(c) ) { if ( s.capacity() == s.size() ) s.reserve(s.capacity() * 3); s.append(1, c); } } map_type myregex::getIndexMap(const fs::path& p, const char* obj) { string text; fs::ifstream in(p); load_file(text, in); in.close(); map_type m; IndexObjects(m, text, obj); return m; } void myregex::parseIncs(const fs::path& p, string& cls, const fs::path& csd) { // find includes map_type mi = getIndexMap(p); // default searches for includes // compare to subdir, fill core_lib_string for ( map_type::iterator i = mi.begin(); i != mi.end(); ++i ) { fs::path fndIncl((*i).first); if ( fndIncl.string().find(csd.string()) != string::npos ) { // check fndIncl for further includes recursively parseIncs(fndIncl, cls, csd); } else if ( fndIncl.parent_path().empty() ) { fs::path fndSameDirIncl(csd); fndSameDirIncl /= fndIncl; parseIncs(fndSameDirIncl, cls, csd); } else if ( cls.find(getLibString(fndIncl)) == string::npos ) { cls += getLibString(fndIncl); } } } ckon-0.7.1/src/aux/myregex.h000066400000000000000000000023001245632600200156610ustar00rootroot00000000000000// Copyright (c) 2013 Patrick Huck #ifndef SRC_AUX_MYREGEX_H_ #define SRC_AUX_MYREGEX_H_ // extended version of // http://www.boost.org/doc/libs/1_31_0/libs/ // regex/example/snippets/regex_search_example.cpp // purpose: // takes the contents of a file in the form of a string // and searches for all the C++ class definitions, storing // their locations in a map of strings/int's #include #include #include #include #include #include #include using std::string; namespace fs = boost::filesystem; typedef std::map< string, string::difference_type, std::less > map_type; class myregex { private: static void IndexObjects(map_type&, const string&, const char* obj = NULL); static void load_file(string&, std::istream&); static string getLibString(const fs::path& p) { return " lib/lib" + p.stem().string() + ".la"; } public: myregex() {} virtual ~myregex() {} static map_type getIndexMap(const fs::path&, const char* obj = NULL); static void parseIncs(const fs::path&, string&, const fs::path&); }; #endif // SRC_AUX_MYREGEX_H_ ckon-0.7.1/src/aux/utils.cc000066400000000000000000000033721245632600200155110ustar00rootroot00000000000000// Copyright (c) 2013 Patrick Huck #include "src/aux/utils.h" #include #include #include #include "src/cmdline/cmdline.h" utils::utils() {} double utils::compareTimeStamps(const fs::path& f2, const fs::path& f1) { time_t t1 = fs::last_write_time(f1); time_t t2 = fs::last_write_time(f2); return difftime(t2, t1); // t2 - t1 in seconds } bool utils::checkTimeStamp(const fs::path& file, const std::vector& filelist) { BOOST_FOREACH(fs::path p, filelist) { if ( compareTimeStamps(p, file) > 0 ) return false; } return true; } char utils::askYesOrNo(const std::string& question) { char type; do { std::cout << question << "? [y/n] "; std::cin >> type; std::cin.ignore(); } while (!std::cin.fail() && type != 'y' && type != 'n'); return type; } bool utils::isEmptyDir(const fs::path& sd) { for ( fs::directory_iterator dir_end, dir(sd); dir != dir_end; ++dir ) { if ( (*dir).path().extension().compare(".h") == 0 ) { return false; } } return true; } string utils::writeLinkDefHd() { string out = "#ifdef __CINT__\n"; out += "#pragma link off all globals;\n"; out += "#pragma link off all classes;\n"; out += "#pragma link off all functions;\n"; out += "#pragma link C++ nestedclasses;\n"; return out + "#pragma link C++ nestedtypedefs;\n"; } std::vector utils::split(const std::string& vi) { std::string v(vi); boost::erase_all(v, "\""); std::vector vo; boost::split(vo, v, boost::is_any_of(" ")); return vo; } std::string utils::getM4Url(const std::string& s) { std::string u("http://git.savannah.gnu.org/gitweb/"); u += "?p=autoconf-archive.git;a=blob_plain;f=m4/ax_boost_"; return u + s + ".m4"; } ckon-0.7.1/src/aux/utils.h000066400000000000000000000012771245632600200153550ustar00rootroot00000000000000// Copyright (c) 2013 Patrick Huck #ifndef SRC_AUX_UTILS_H_ #define SRC_AUX_UTILS_H_ #include #include #include namespace fs = boost::filesystem; class cmdline; class utils { public: utils(); virtual ~utils(void) {} static double compareTimeStamps(const fs::path&, const fs::path&); static bool checkTimeStamp(const fs::path&, const std::vector&); static char askYesOrNo(const std::string&); static bool isEmptyDir(const fs::path&); static std::string writeLinkDefHd(); static std::vector split(const std::string&); static std::string getM4Url(const std::string&); }; #endif // SRC_AUX_UTILS_H_ ckon-0.7.1/src/ckon.cc000066400000000000000000000135261245632600200145100ustar00rootroot00000000000000// Copyright (c) 2013 Patrick Huck #define BOOST_FILESYSTEM_NO_DEPRECATED #include #include #include #include #include #include #include #include #include "src/aux/utils.h" #include "src/cmdline/cmdline.h" #include "src/helpers/helpers.h" using std::vector; using std::string; using std::cout; using std::endl; namespace fs = boost::filesystem; int main(int argc, char *argv[]) { try { // init & parse options & arguments, fill container cmdline* clopts = new cmdline(); if ( !clopts->parse(argc, argv) ) return 0; // check whether 'ckon_config_file' and 'configure.ac' exist // if not user needs to run `ckon setup` first if ( clopts->noSetup() ) { cout << "please run `ckon setup` first and check "; cout << clopts->ckon_config_file << endl; return 0; } // init helpers w/ command line options helpers* hlp = new helpers(clopts); // get list of sub-directories in ckon_src_dir/ for which // to generate Makefile_insert and LinkDef.h vector subdirs; // absolute paths to subdirs hlp->push_subdirs(&subdirs); // if Makefile.am doesn't exist, generate Makefile.am bool redoMakefileAm = !fs::exists("Makefile.am"); fs::ofstream top_out; if ( redoMakefileAm ) { // create & init Makefile.am top_out.open("Makefile.am"); top_out << hlp->writeMakefileAmHd(); } // loop all subdirs BOOST_FOREACH(fs::path sd, subdirs) { if ( clopts->bVerbose ) cout << sd << endl; // set subdir for helpers, set libname // increase subdir counter, set oprnd hlp->init_subdir(sd); // get list of all header, source and prog files in current subdir vector headers, sources, progs; hlp->push_src(&headers, &sources, &progs); // check time stamp for linkdef file fs::path linkdef(sd); linkdef /= "LinkDef.h"; bool redoLinkDef = ( !fs::exists(linkdef) || !utils::checkTimeStamp(linkdef, headers) || !utils::checkTimeStamp(linkdef, sources) || !utils::checkTimeStamp(linkdef, progs)); // write LinkDef.h for current subdir if ( redoLinkDef ) { // get lists of all classes & namespaces for current subdir vector classes, namespaces; hlp->push_obj("class", &classes); hlp->push_obj("namespace", &namespaces); // write linkdef fs::ofstream out; out.open(linkdef); out << utils::writeLinkDefHd(); string prgma = "#pragma link C++ "; BOOST_FOREACH(string ns, namespaces) { out << prgma << "namespace " << ns << ";" << endl; } BOOST_FOREACH(string cl, classes) { out << prgma << "class " << cl << hlp->getSuffix(cl) << ";" << endl; } out << "#endif" << endl; out.close(); } // check time stamp for makefile_insert fs::path makefile(sd); makefile /= "Makefile_insert"; bool redoMakefile = ( !fs::exists(makefile) || !utils::checkTimeStamp(makefile, headers) || !utils::checkTimeStamp(makefile, sources) || !utils::checkTimeStamp(makefile, progs)); // write include statement into Makefile.am if ( redoMakefileAm ) { top_out << "include " << makefile.string() << endl; } // write Makefile_insert for current subdir if ( redoMakefile ) { // write makefile fs::ofstream out; out.open(makefile); out << hlp->writePkgDefs(linkdef, headers); out << hlp->writeLibDefs(sources); if ( hlp->genDict() ) { out << hlp->writeDict(linkdef, headers); } BOOST_FOREACH(fs::path p, progs) { hlp->genCoreLibStr(p); out << hlp->writeBinProg(p); } out.close(); } } // end of subdir loop cout << hlp->getNrSubdirs() << " sub-directories processed." << endl; if ( redoMakefileAm ) top_out.close(); // return if dry-run requested if ( clopts->bDry ) return 0; // run autoconf if configure script doesn't exist if ( !fs::exists("configure") ) system("autoreconf -v --force --install"); // if builddir doesn't exist, create it and run configure // else, just switch to builddir fs::path cwd(fs::current_path()); // pwd cwd /= clopts->ckon_build_dir; // append build dir if ( !fs::exists(cwd) ) { fs::create_directories(cwd); // mkdir fs::current_path(cwd); // chdir string export_build = "export top_builddir=" + cwd.string(); putenv(const_cast(export_build.c_str())); fs::path prefix(fs::absolute(clopts->ckon_install_dir)); string config_call = "../configure --prefix=" + prefix.string(); if ( !clopts->ckon_boost.empty() ) { config_call += " --with-boost"; if ( getenv("BOOST_ROOT") != NULL ) { config_call += "=$BOOST_ROOT"; } vector boost_libs = utils::split(clopts->ckon_boost); BOOST_FOREACH(string s, boost_libs) { boost::replace_all(s, "_", "-"); config_call += " --with-boost-" + s; } } cout << config_call << endl; system(config_call.c_str()); } // always call make when invoking ckon string make_call = "make "; if ( atoi((clopts->nCpu).c_str()) > 1 ) { make_call += "-j " + clopts->nCpu + " "; } if ( !(clopts->ckon_cppflags).empty() ) { make_call += "CXXFLAGS=" + clopts->ckon_cppflags + " "; } if ( clopts->bInstall ) make_call += "install"; fs::current_path(cwd); // chdir system(make_call.c_str()); cout << "==> build process finished." << endl; } catch(const std::exception& e) { std::cerr << "Unhandled Exception reached the top of main: " << e.what() << ", application will now exit" << endl; return 1; } return 0; } ckon-0.7.1/src/clean/000077500000000000000000000000001245632600200143225ustar00rootroot00000000000000ckon-0.7.1/src/clean/clean.cc000066400000000000000000000022641245632600200157170ustar00rootroot00000000000000// Copyright (c) 2013 Patrick Huck #include "src/clean/clean.h" #include clean::clean(const std::string& src_dir) { fs::recursive_directory_iterator dir_end; for (fs::recursive_directory_iterator d(src_dir); d != dir_end; ++d) { fs::path p((*d).path()); fs::path filename(p.filename()); if ( isFileNotToDelete(filename) ) { continue; } else { cont.push_back(p.c_str()); } } cont.push_back("build"); cont.push_back("autom4te.cache"); cont.push_back("config"); cont.push_back(".lib"); cont.push_back("aclocal.m4"); cont.push_back("configure"); cont.push_back("Makefile.in"); cont.push_back("Makefile.am"); cont.push_back(".autom4te.cfg"); } bool clean::isFileNotToDelete(const fs::path& filename) { if ( filename.compare("LinkDef.h") == 0 ) return false; if ( filename.compare("Makefile_insert") == 0 ) return false; return true; } int clean::purge() { int nfiles = 0; std::vector::iterator it; for ( it = cont.begin(); it != cont.end(); ++it ) { if ( !fs::exists((*it).c_str()) ) continue; std::cout << "remove " << (*it).c_str() << std::endl; nfiles += fs::remove_all((*it).c_str()); } return nfiles; } ckon-0.7.1/src/clean/clean.h000066400000000000000000000006501245632600200155560ustar00rootroot00000000000000// Copyright (c) 2013 Patrick Huck #ifndef SRC_CLEAN_CLEAN_H_ #define SRC_CLEAN_CLEAN_H_ #include #include #include namespace fs = boost::filesystem; class clean { private: std::vector cont; bool isFileNotToDelete(const fs::path&); public: explicit clean(const std::string&); virtual ~clean() {} int purge(); }; #endif // SRC_CLEAN_CLEAN_H_ ckon-0.7.1/src/cmdline/000077500000000000000000000000001245632600200146535ustar00rootroot00000000000000ckon-0.7.1/src/cmdline/cmdline.cc000066400000000000000000000227171245632600200166060ustar00rootroot00000000000000// Copyright (c) 2013 Patrick Huck #include "src/cmdline/cmdline.h" #include #include #include #include #include #include #include #include #include "src/clean/clean.h" #include "src/aux/utils.h" using std::cout; using std::endl; using std::ostream; using std::basic_string; namespace io = boost::iostreams; namespace fs = boost::filesystem; typedef io::tee_device Tee; typedef io::stream TeeStream; cmdline::cmdline() : ckon_cmd(""), bYaml(false), nCpu("1"), ckon_config_file("ckon.cfg"), ckon_src_dir("StRoot"), ckon_exclSuffix("Gnuplot Options"), ckon_NoRootCint("YamlCpp"), ckon_prog_subdir("programs"), ckon_build_dir("build"), ckon_install_dir("build"), ckon_cppflags("-Wall"), ckon_ignore_file("ckonignore"), ckon_boost("") { } void cmdline::purge() { clean clcont(ckon_src_dir); printf("%d files removed.\n", clcont.purge()); } size_t cmdline::writeM4File(void *ptr, size_t size, size_t nm, FILE *stream) { return fwrite(ptr, size, nm, stream); } bool cmdline::noSetup() { return !fs::exists(ckon_config_file) && !fs::exists("configure.ac"); } void cmdline::runSetup() { if ( fs::exists(ckon_config_file) || fs::exists("configure.ac") ) { cout << ckon_config_file << " or configure.ac already exist(s)!" << endl; if ( utils::askYesOrNo("remove and start over") == 'n' ) return; fs::remove(ckon_config_file); fs::remove("configure.ac"); fs::remove(".autom4te.cfg"); } if ( !fs::exists("m4") ) fs::create_directory("m4"); if ( utils::askYesOrNo("are you going to use boost") == 'y' ) { cout << "space-separate list of boost library names:" << endl; std::getline(std::cin, ckon_boost); // download boost m4 files if not exist (don't remove old ones) curl_global_init(CURL_GLOBAL_ALL); CURL* curl = curl_easy_init(); curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, &writeM4File); vector boost_libs = utils::split(ckon_boost); boost_libs.push_back("base"); BOOST_FOREACH(string s, boost_libs) { string m4url = utils::getM4Url(s); curl_easy_setopt(curl, CURLOPT_URL, m4url.c_str()); string fn = "m4/ax_boost_" + s + ".m4"; if ( fs::exists(fn) ) continue; FILE* file = fopen(fn.c_str(),"wb"); curl_easy_setopt(curl, CURLOPT_WRITEDATA, file); curl_easy_perform(curl); } curl_easy_cleanup(curl); curl_global_cleanup(); // FYI message cout << "re-run setup after adding boost libraries in ckon.cfg!" << endl; } if ( utils::askYesOrNo("are you going to use yaml") == 'y' ) { bYaml = true; string fn = "m4/yaml.m4"; if ( !fs::exists(fn) ) { CURL* curl = curl_easy_init(); curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, &writeM4File); if ( !fs::exists("m4") ) fs::create_directory("m4"); //string u = "http://libtmrm.googlecode.com/svn/trunk/m4/yaml.m4"; string u = "https://raw.github.com/tschaume/ckon/master/m4/yaml.m4"; curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, false); curl_easy_setopt(curl, CURLOPT_URL, u.c_str()); FILE* file = fopen(fn.c_str(),"wb"); curl_easy_setopt(curl, CURLOPT_WRITEDATA, file); curl_easy_perform(curl); curl_easy_cleanup(curl); } } writeCfgFile(); writeConfigureAc(); writeAutom4teCfg(); cout << endl << "setup done. check " << ckon_config_file << endl; } bool cmdline::parse(int argc, char *argv[]) { po::options_description generic("Generic Options"); generic.add_options() ("help,h", po::bool_switch(&bHelp), "show this help") ("version", po::bool_switch(&bVersion), "print version number") ("verbose,v", po::bool_switch(&bVerbose), "verbose output") (",j", po::value(&nCpu), "call make w/ -j <#cores>") ("ckon_cmd", po::value(&ckon_cmd), "setup | clean | install | dry"); po::options_description config("Configuration"); config.add_options() ("suffix,s", po::value(&bSuffix), "add suffix + in LinkDef.h (bool)") ("yaml,y", po::value(&bYaml), "use yaml") ("ckon.src_dir", po::value(&ckon_src_dir), "source dir") ("ckon.exclSuffix", po::value(&ckon_exclSuffix), "no + suffix") ("ckon.NoRootCint", po::value(&ckon_NoRootCint), "no dictionary") ("ckon.prog_subdir", po::value(&ckon_prog_subdir), "progs subdir") ("ckon.build_dir", po::value(&ckon_build_dir), "build dir") ("ckon.install_dir", po::value(&ckon_install_dir), "install dir") ("ckon.cppflags", po::value(&ckon_cppflags), "add CPPFLAGS") ("ckon.boost", po::value(&ckon_boost), "boost libraries"); po::options_description userOpts; userOpts.add(generic).add(config); po::positional_options_description posOpts; posOpts.add("ckon_cmd", 1); po::variables_map vm; try { // parse command line // don't allow unregistered on command line po::parsed_options cl_parsed = po::command_line_parser(argc, argv).options(userOpts) .positional(posOpts).run(); po::store(cl_parsed, vm); // parse config file if ( fs::exists(ckon_config_file) ) { // parse & allow unregistered po::parsed_options file_parsed = po::parse_config_file(ckon_config_file.c_str(), config, true); po::store(file_parsed, vm); // collect & parse unrecognized options BOOST_FOREACH(po::basic_option opt, file_parsed.options) { if ( opt.unregistered ) { vector v; boost::split(v, opt.string_key, boost::is_any_of(".")); BOOST_FOREACH(basic_string c, opt.value) ldadd[v.back()] += c; } } } // parse ckonignore file if ( fs::exists(ckon_ignore_file) ) { fs::ifstream ifs(ckon_ignore_file.c_str()); string line; while ( std::getline(ifs, line) ) ckon_vign.push_back(line); } po::notify(vm); // throws on error if ( bHelp ) { // --help option cout << "ckon -- automatic build tool for ROOT" << endl; cout << userOpts << endl; cout << "\nIn addition, unregistered options of the form"; cout << "\nldadd.prog_name are allowed to use for adding"; cout << "\nLDFLAGS to the linker of specific programs. The"; cout << "\ngiven string/value is added verbatim in LDADD."; cout << "\nUnregistered options are only allowed in ckon.cfg\n"; return false; } if ( bVersion ) { // --version option cout << PACKAGE_VERSION << endl; return false; } bSetup = !ckon_cmd.compare("setup"); bClean = !ckon_cmd.compare("clean"); bInstall = !ckon_cmd.compare("install"); bDry = !ckon_cmd.compare("dry"); if ( bSetup ) { cout << "run setup" << endl; runSetup(); return false; } if ( bClean ) { purge(); return false; } if ( !bInstall && !bDry && !ckon_cmd.empty() ) { cout << "unknown ckon command: " << ckon_cmd << endl; return false; } return true; } catch(const po::error& e) { std::cerr << "ERROR: " << e.what() << endl << endl << generic << endl; return false; } } void cmdline::writeCfgFile() { fs::ofstream cfgfile(ckon_config_file); Tee tee(cout, cfgfile); TeeStream both(tee); both << "suffix=" << bSuffix << endl; both << "yaml=" << bYaml << endl; both << "[ckon]" << endl; both << "src_dir=" << ckon_src_dir << endl; both << "prog_subdir=" << ckon_prog_subdir << endl; both << "build_dir=" << ckon_build_dir << endl; both << "install_dir=" << ckon_install_dir << endl; both << "exclSuffix=\"" << ckon_exclSuffix << "\"" << endl; both << "NoRootCint=" << ckon_NoRootCint << endl; both << "cppflags=\"" << ckon_cppflags << "\"" << endl; both << "boost=\"" << ckon_boost << "\"" << endl; both.close(); } void cmdline::writeConfigureAc() { string cfg_ac_str = "AC_INIT([ana], [0.0])\n"; cfg_ac_str += "m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])\n"; cfg_ac_str += "AC_CONFIG_AUX_DIR(config)\n"; cfg_ac_str += "m4_pattern_allow([AM_PROG_AR])\n"; cfg_ac_str += "m4_ifdef([AM_PROG_AR], [AM_PROG_AR])\n"; cfg_ac_str += "AM_INIT_AUTOMAKE([-Wall no-define])\n"; cfg_ac_str += "AC_PROG_CXX\n"; if ( !ckon_boost.empty() ) { cfg_ac_str += "AX_BOOST_BASE([1.50])\n"; vector boost_libs = utils::split(ckon_boost); BOOST_FOREACH(string s, boost_libs) { boost::to_upper(s); cfg_ac_str += "AX_BOOST_" + s + "\n"; } } if ( bYaml ) cfg_ac_str += "YAML_REQUIRE\n"; cfg_ac_str += "AM_PROG_LIBTOOL\n"; cfg_ac_str += "ROOTLIBS=`$(which root-config) --libs`\n"; cfg_ac_str += "ROOTINCLUDES=`$(which root-config) --incdir`\n"; cfg_ac_str += "ROOTLIBDIR=`$(which root-config) --libdir`\n"; cfg_ac_str += "ROOTGLIBS=`$(which root-config) --glibs`\n"; cfg_ac_str += "AC_SUBST(ROOTLIBS)\n"; cfg_ac_str += "AC_SUBST(ROOTINCLUDES)\n"; cfg_ac_str += "AC_SUBST(ROOTGLIBS)\n"; cfg_ac_str += "AC_SUBST(ROOTLIBDIR)\n"; cfg_ac_str += "AC_CONFIG_FILES([Makefile])\n"; cfg_ac_str += "AC_OUTPUT\n"; fs::ofstream cfg_ac; cfg_ac.open("configure.ac"); cfg_ac << cfg_ac_str; cfg_ac.close(); } void cmdline::writeAutom4teCfg() { string atmte_str = "begin-language: \"Autoconf-without-aclocal-m4\"\n"; atmte_str += "args: --no-cache\n"; atmte_str += "end-language: \"Autoconf-without-aclocal-m4\"\n"; fs::ofstream atmte; atmte.open(".autom4te.cfg"); atmte << atmte_str; atmte.close(); } ckon-0.7.1/src/cmdline/cmdline.h000066400000000000000000000022251245632600200164400ustar00rootroot00000000000000// Copyright (c) 2013 Patrick Huck #ifndef SRC_CMDLINE_CMDLINE_H_ #define SRC_CMDLINE_CMDLINE_H_ #include #include #include #include using std::string; using std::vector; using std::map; namespace po = boost::program_options; class cmdline { private: string ckon_cmd; void purge(); void runSetup(); void writeCfgFile(); void writeConfigureAc(); void writeAutom4teCfg(); static size_t writeM4File(void *, size_t, size_t, FILE*); public: cmdline(); virtual ~cmdline() {} bool bHelp; bool bVersion; bool bVerbose; bool bInstall; bool bSetup; bool bClean; bool bDry; bool bSuffix; bool bYaml; string nCpu; string ckon_config_file; string ckon_src_dir; string ckon_exclSuffix; string ckon_NoRootCint; string ckon_prog_subdir; string ckon_build_dir; string ckon_install_dir; string ckon_cppflags; string ckon_ignore_file; string ckon_boost; map ldadd; vector ckon_vign; bool parse(int argc, char *argv[]); bool noSetup(); }; #endif // SRC_CMDLINE_CMDLINE_H_ ckon-0.7.1/src/helpers/000077500000000000000000000000001245632600200147025ustar00rootroot00000000000000ckon-0.7.1/src/helpers/helpers.cc000066400000000000000000000137771245632600200166720ustar00rootroot00000000000000// Copyright (c) 2013 Patrick Huck #include "src/helpers/helpers.h" #include #include #include #include #include #include "src/cmdline/cmdline.h" #include "src/aux/myregex.h" #include "src/aux/utils.h" helpers::helpers(const cmdline* cl) : mCl(cl), sd_cnt(0) { } void helpers::push_subdirs(vpath* subdirs) { fs::recursive_directory_iterator d_end; for (fs::recursive_directory_iterator d(mCl->ckon_src_dir); d != d_end; ++d) { fs::path p((*d).path()); if ( !fs::is_directory(p) ) continue; if ( check_ignore(p) ) continue; // skip ignored dir's if ( utils::isEmptyDir(p) ) continue; // skip dir w/ no header files subdirs->push_back(p); } } bool helpers::check_ignore(const fs::path& p) { BOOST_FOREACH(string i, mCl->ckon_vign) { if ( p.string().find(i) != string::npos ) { if ( mCl->bVerbose ) { std::cout << "found ignore string " << i; std::cout << " in " << p.string() << std::endl; } return true; } } return false; } void helpers::push_src(vpath* headers, vpath* sources, vpath* progs) { fs::recursive_directory_iterator dir_end; for (fs::recursive_directory_iterator d(sd); d != dir_end; ++d) { fs::path p((*d).path()); if ( fs::is_directory(p) ) { if ( p.filename().compare(mCl->ckon_prog_subdir) == 0 ) { d.no_push(); fs::directory_iterator pd_end; for (fs::directory_iterator pd(p); pd != pd_end; ++pd) { if ( (*pd).path().extension().compare(".cc") == 0 ) { progs->push_back(*pd); } } } if ( p.filename().compare(".git") == 0 ) d.no_push(); if ( check_ignore(p) ) d.no_push(); } if ( p.filename().compare("LinkDef.h") == 0 ) continue; if ( check_ignore(p) ) continue; if ( p.extension().compare(".h") == 0 ) headers->push_back(p); if ( p.extension().compare(".cxx") == 0 ) sources->push_back(p); } } void helpers::push_obj(const char* obj, vector* objv) { for ( fs::directory_iterator dir_end, dir(sd); dir != dir_end; ++dir ) { if ( fs::is_directory(*dir) ) continue; fs::path p((*dir).path()); if ( p.filename().compare("LinkDef.h") == 0 ) continue; if ( check_ignore(p) ) continue; if ( p.extension().compare(".h") == 0 ) { if ( mCl->bVerbose ) std::cout << "Processing file " << p << std::endl; map_type m = myregex::getIndexMap(p, obj); for ( map_type::iterator it = m.begin(); it != m.end(); ++it ) { if ( mCl->bVerbose ) { std::cout << " " << obj << " \"" << (*it).first; std::cout << "\" found at: " << (*it).second << std::endl; } if ( find(objv->begin(), objv->end(), (*it).first) == objv->end() ) objv->push_back((*it).first); } } } } string helpers::writePkgDefs(const fs::path& linkdef, const vpath& files) { string out = "pkglib_LTLIBRARIES" + oprnd + "lib/lib" + libname + ".la\n"; out += "noinst_HEADERS" + oprnd + linkdef.string() + '\n'; string mkstr = "pkginclude_HEADERS"; return out + printFilesMk(mkstr, files, oprnd); } string helpers::writeLibDefs(const vpath& files) { string mkstr = "lib_lib" + libname + "_la_SOURCES"; return printFilesMk(mkstr, files, " = "); } string helpers::printFilesMk(const string& mkstr, vpath fs, const string& op) { string out = mkstr + op + fs.front().string() + '\n'; boost::sub_range< vpath > frange(fs.begin()+1, fs.end()); BOOST_FOREACH(fs::path p, frange) { out += mkstr + " += " + p.string() + '\n'; } return out; } string helpers::writeDict(const fs::path& linkdef, const vpath& headers) { fs::path dict(sd); dict /= libname; dict += "_Dict.C"; string out = "nodist_lib_lib" + libname + "_la_SOURCES = "; out += dict.string() + '\n'; out += "lib_lib" + libname + "_la_LIBADD = @ROOTLIBS@\n"; out += dict.string() + ": "; BOOST_FOREACH(fs::path p, headers) { out += p.string() + " "; } out += linkdef.string() + '\n'; out += "\t rootcint -f $@ -c $(DEFAULT_INCLUDES) $(AM_CPPFLAGS) $^\n"; return out + '\n'; } void helpers::genCoreLibStr(const fs::path& p) { // generate string of all libraries to be linked for bin__LDADD myregex::parseIncs(p, core_lib_string, sd); if ( mCl->bVerbose ) { std::cout << "core_lib_string: " << core_lib_string << std::endl; } } string helpers::writeBinProg(const fs::path& p) { string prog_name = p.stem().string(); string out = "bin_PROGRAMS += bin/" + prog_name + '\n'; out += "bin_" + prog_name + "_SOURCES = " + p.string() + '\n'; out += "bin_" + prog_name + "_LDADD = lib/lib" + libname + ".la\n"; if ( !core_lib_string.empty() ) out += "bin_" + prog_name + "_LDADD +=" + core_lib_string + '\n'; out += "bin_" + prog_name; out += "_LDADD += -L@ROOTLIBDIR@ @ROOTGLIBS@ @ROOTLIBS@ @LIBS@\n"; out += "bin_" + prog_name + "_LDADD += -ldl -lSpectrum\n"; if ( mCl->ldadd.find(prog_name) != mCl->ldadd.end() ) out += "bin_" + prog_name + "_LDADD += " + mCl->ldadd.at(prog_name) + "\n"; out += "bin_" + prog_name + "_LDFLAGS = -R $(ROOTLIBDIR) -L$(ROOTLIBDIR)\n"; if ( !(mCl->ckon_boost).empty() ) { out += "bin_" + prog_name + "_LDFLAGS += $(BOOST_LDFLAGS)\n"; vector boost_libs = utils::split(mCl->ckon_boost); BOOST_FOREACH(string s, boost_libs) { boost::to_upper(s); out += "bin_" + prog_name + "_LDFLAGS += $(BOOST_" + s + "_LIB)\n"; } } if ( mCl->bYaml ) { out += "bin_" + prog_name + "_LDFLAGS += $(YAML_LDFLAGS)\n"; } out += "bin_" + prog_name + " = @ROOTCFLAGS@\n"; return out; } string helpers::writeMakefileAmHd() { string out = "AUTOMAKE_OPTIONS = foreign subdir-objects -Wall -Werror\n"; out += "ACLOCAL_AMFLAGS = ${ACLOCAL_FLAGS} -I m4\n"; out += "ROOTINCLUDE = @ROOTINCLUDES@\n"; out += "AM_CPPFLAGS = -I. -I$(srcdir) -I$(pkgincludedir) "; if ( !(mCl->ckon_boost).empty() ) out += "$(BOOST_CPPFLAGS) "; if ( mCl->bYaml ) out += "$(YAML_CPPFLAGS) "; out += "-I$(ROOTINCLUDE)\n"; return out + "bin_PROGRAMS = \n"; } ckon-0.7.1/src/helpers/helpers.h000066400000000000000000000031421245632600200165150ustar00rootroot00000000000000// Copyright (c) 2013 Patrick Huck #ifndef SRC_HELPERS_HELPERS_H_ #define SRC_HELPERS_HELPERS_H_ #include #include #include #include "src/cmdline/cmdline.h" using std::string; using std::vector; namespace fs = boost::filesystem; typedef vector vpath; class helpers { private: const cmdline* mCl; fs::path sd; string oprnd; string libname; int sd_cnt; string core_lib_string; string printFilesMk(const string&, vpath, const string&); bool hasSuffix(const string& cl) { return ( mCl->bSuffix && mCl->ckon_exclSuffix.find(cl) == string::npos ); } bool check_ignore(const fs::path&); public: explicit helpers(const cmdline* cl); virtual ~helpers() {} void init_subdir(const fs::path& s) { // called for each subdir sd = s; libname = s.filename().string(); oprnd = (sd_cnt > 0) ? " += " : " = "; sd_cnt++; } bool genDict() { string fn = sd.filename().string(); return ( mCl->ckon_NoRootCint.find(fn) == string::npos ); } string getSuffix(const string& cl) { return ( hasSuffix(cl) ) ? "+" : ""; } void push_subdirs(vpath*); void push_src(vpath*, vpath*, vpath*); void push_obj(const char*, vector*); void genCoreLibStr(const fs::path& p); string writePkgDefs(const fs::path&, const vpath&); string writeLibDefs(const vpath&); string writeDict(const fs::path&, const vpath&); string writeBinProg(const fs::path&); string writeMakefileAmHd(); int getNrSubdirs() { return sd_cnt; } }; #endif // SRC_HELPERS_HELPERS_H_ ckon-0.7.1/test/000077500000000000000000000000001245632600200134305ustar00rootroot00000000000000ckon-0.7.1/test/ckon.cfg000066400000000000000000000003271245632600200150450ustar00rootroot00000000000000suffix=0 yaml=1 [ckon] src_dir=StRoot prog_subdir=programs build_dir=build install_dir=build exclSuffix="" NoRootCint="BesCocktail" cppflags="-Wall" boost="system filesystem program_options" [ldadd] cbes=-lMathMore ckon-0.7.1/test/ckonignore000066400000000000000000000000071245632600200155060ustar00rootroot00000000000000macros ckon-0.7.1/test/clone_testdir.sh000077500000000000000000000002321245632600200166220ustar00rootroot00000000000000#!/bin/bash srcdir="StRoot" [ -e $srcdir ] && rm -rfv $srcdir mkdir -p $srcdir git clone https://github.com/tschaume/BesCocktail.git $srcdir/BesCocktail