aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlloyd <[email protected]>2011-04-19 13:19:33 +0000
committerlloyd <[email protected]>2011-04-19 13:19:33 +0000
commit73d4e7850e38228d25589dc154039dd4fced59a9 (patch)
tree507d9d18334f7bd6493534766d8aeedb4de0c99a
parent2a20f8ccd0b0646ba407220877f2c03f43f2e7be (diff)
Fix the --without-sphinx and --without-doxygen flags.
If neither --with-sphinx nor --without-sphinx were used, then test for sphinx-build in the path and turn it on if we find it. Document the --distribution-info option.
-rwxr-xr-xconfigure.py51
-rw-r--r--doc/building.txt15
2 files changed, 45 insertions, 21 deletions
diff --git a/configure.py b/configure.py
index 18d019de2..073df9d6b 100755
--- a/configure.py
+++ b/configure.py
@@ -228,17 +228,17 @@ def process_command_line(args):
help='set distribution specific versioning',
default='unspecified')
- build_group.add_option('--with-sphinx', default=False, action='store_true',
+ build_group.add_option('--with-sphinx', default=None, action='store_true',
help='Use Sphinx to generate HTML manual')
build_group.add_option('--without-sphinx', action='store_false',
- help=SUPPRESS_HELP)
+ dest='with_sphinx', help=SUPPRESS_HELP)
build_group.add_option('--with-doxygen', default=False, action='store_true',
help='Use Doxygen to generate HTML API docs')
build_group.add_option('--without-doxygen', action='store_false',
- help=SUPPRESS_HELP)
+ dest='with_doxygen', help=SUPPRESS_HELP)
build_group.add_option('--dumb-gcc', dest='dumb_gcc',
action='store_true', default=False,
@@ -1507,24 +1507,27 @@ def generate_amalgamation(build_config):
botan_all_cpp.write(line)
"""
-Finding a program by name
-code from http://stackoverflow.com/questions/377017/#377028
+Test for the existence of a program
"""
-def which(program):
- def have_exe(fpath):
- return os.path.exists(fpath) and os.access(fpath, os.X_OK)
-
- fpath, fname = os.path.split(program)
- if fpath:
- if have_exe(program):
- return program
- else:
- for path in os.environ['PATH'].split(os.pathsep):
- exe_file = os.path.join(path, program)
- if have_exe(exe_file):
- return exe_file
+def have_program(program):
+
+ def exe_test(path, program):
+ exe_file = os.path.join(path, program)
+
+ if os.path.exists(exe_file) and os.access(exe_file, os.X_OK):
+ logging.debug('Found program %s in %s' % (program, path))
+ return True
+ else:
+ return False
+
+ exe_suffixes = ['', '.exe']
- return None
+ for path in os.environ['PATH'].split(os.pathsep):
+ for suffix in exe_suffixes:
+ if exe_test(path, program + suffix):
+ return True
+
+ return False
"""
Main driver
@@ -1574,9 +1577,9 @@ def main(argv = None):
if options.compiler is None:
if options.os == 'windows':
- if which('cl.exe') is not None:
+ if have_program('cl'):
options.compiler = 'msvc'
- elif which('g++.exe') is not None:
+ elif have_program('g++'):
options.compiler = 'gcc'
else:
options.compiler = 'msvc'
@@ -1613,6 +1616,12 @@ def main(argv = None):
logging.info('Canonicalizized --cpu=%s to %s/%s' % (
cpu_from_user, options.arch, options.cpu))
+ if options.with_sphinx is None:
+ if have_program('sphinx-build'):
+ logging.info('Found sphinx-build, will enable; ' +
+ 'use --without-sphinx to disable')
+ options.with_sphinx = True
+
logging.info('Target is %s-%s-%s-%s' % (
options.compiler, options.os, options.arch, options.cpu))
diff --git a/doc/building.txt b/doc/building.txt
index b31d2e316..fba56196d 100644
--- a/doc/building.txt
+++ b/doc/building.txt
@@ -249,6 +249,21 @@ script; this will convert the script to the Python 3.x dialect::
$ python ./configure.py
[...]
+Setting Distribution Info
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+The build allows you to set some information about what distribution
+this build of the library comes from. It is particularly relevant to
+people packaging the library for wider distribution, to signify what
+distribution this build is from. Applications can test this value by
+checking the string value of the macro ``BOTAN_DISTRIBUTION_INFO``. It
+can be set using the ``--distribution-info`` flag to ``configure.py``,
+and otherwise defaults to "unspecified". For instance, a `Gentoo
+<http://www.gentoo.org>`_ ebuild might set it with
+``--distribution-info="Gentoo ${PVR}"`` where ``${PVR}`` is an ebuild
+variable automatically set to a combination of the library and ebuild
+versions.
+
Local Configuration Settings
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^