diff options
-rwxr-xr-x | configure.py | 80 | ||||
-rw-r--r-- | doc/log.txt | 3 | ||||
-rw-r--r-- | src/build-data/buildh.in | 2 | ||||
-rw-r--r-- | src/build-data/cc/bcc.txt | 1 | ||||
-rw-r--r-- | src/build-data/cc/clang.txt | 5 | ||||
-rw-r--r-- | src/build-data/cc/ekopath.txt | 5 | ||||
-rw-r--r-- | src/build-data/cc/gcc.txt | 5 | ||||
-rw-r--r-- | src/build-data/cc/msvc.txt | 4 | ||||
-rw-r--r-- | src/build-data/os/solaris.txt | 3 |
9 files changed, 77 insertions, 31 deletions
diff --git a/configure.py b/configure.py index 019b68b54..2a8280061 100755 --- a/configure.py +++ b/configure.py @@ -241,6 +241,12 @@ def process_command_line(args): build_group.add_option('--without-sphinx', action='store_false', dest='with_sphinx', help=optparse.SUPPRESS_HELP) + build_group.add_option('--with-visibility', action='store_true', + default=None, help=optparse.SUPPRESS_HELP) + + build_group.add_option('--without-visibility', action='store_false', + dest='with_visibility', help=optparse.SUPPRESS_HELP) + build_group.add_option('--with-doxygen', action='store_true', default=False, help='Use Doxygen to generate HTML API docs') @@ -703,7 +709,8 @@ class CompilerInfo(object): 'lang_flags': '', 'warning_flags': '', 'maintainer_warning_flags': '', - 'dll_import_flags': '', + 'visibility_build_flags': '', + 'visibility_attribute': '', 'ar_command': None, 'makefile_style': '', 'has_tr1': False, @@ -731,6 +738,23 @@ class CompilerInfo(object): del self.mach_opt """ + Return the shared library build flags, if any + """ + def gen_shared_flags(self, options): + def flag_builder(): + if options.build_shared_lib: + yield self.shared_flags + if options.with_visibility: + yield self.visibility_build_flags + + return ' '.join(list(flag_builder())) + + def gen_visibility_attribute(self, options): + if options.build_shared_lib and options.with_visibility: + return self.visibility_attribute + return '' + + """ Return the machine specific ABI flags """ def mach_abi_link_flags(self, osname, arch, submodel, debug_p): @@ -972,11 +996,6 @@ def create_template_vars(build_config, options, modules, cc, arch, osinfo): return os.path.join(options.with_build_dir, path) return path - def only_if_shared(option): - if options.build_shared_lib: - return option - return '' - def warning_flags(normal_flags, maintainer_flags, maintainer_mode): @@ -1033,8 +1052,8 @@ def create_template_vars(build_config, options, modules, cc, arch, osinfo): cc.maintainer_warning_flags, options.maintainer_mode), - 'shared_flags': only_if_shared(cc.shared_flags), - 'dll_import_flags': only_if_shared(cc.dll_import_flags), + 'shared_flags': cc.gen_shared_flags(options), + 'visibility_attribute': cc.gen_visibility_attribute(options), 'so_link': cc.so_link_command_for(osinfo.basename), @@ -1637,37 +1656,58 @@ def main(argv = None): logging.info('Target is %s-%s-%s-%s' % ( options.compiler, options.os, options.arch, options.cpu)) + cc = ccinfo[options.compiler] + # Kind of a hack... options.extra_flags = '' if options.compiler == 'gcc': + def get_gcc_version(gcc_bin): + try: + gcc_version = ''.join(subprocess.Popen( + gcc_bin.split(' ') + ['-dumpversion'], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE).communicate()).strip() + logging.info('Detected gcc version %s' % (gcc_version)) + return gcc_version + except OSError: + logging.warning('Could not execute %s for version check' % (gcc_bin)) + return None + def is_64bit_arch(arch): if arch.endswith('64') or arch in ['alpha', 's390x']: return True return False - if not is_64bit_arch(options.arch) and not options.dumb_gcc: - try: - matching_version = '(4\.[01234]\.)|(3\.[34]\.)|(2\.95\.[0-4])' + gcc_version = get_gcc_version(options.compiler_binary or cc.binary_name) - gcc_version = ''.join(subprocess.Popen( - ['g++', '-dumpversion'], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE).communicate()).strip() + if gcc_version: - logging.info('Detected GCC version %s' % (gcc_version)) + if not is_64bit_arch(options.arch) and not options.dumb_gcc: + matching_version = '(4\.[01234]\.)|(3\.[34]\.)|(2\.95\.[0-4])' if re.search(matching_version, gcc_version): options.dumb_gcc = True - except OSError: - logging.warning('Could not execute GCC for version check') + + versions_without_tr1 = '(4\.0\.)|(3\.[0-4]\.)|(2\.95\.[0-4])' + + if options.with_tr1 == None and \ + re.search(versions_without_tr1, gcc_version): + logging.info('Disabling TR1 support for this gcc, too old') + options.with_tr1 = 'none' + + versions_without_visibility = '(3\.[0-4]\.)|(2\.95\.[0-4])' + if options.with_visibility == None and \ + re.search(versions_without_visibility, gcc_version): + logging.info('Disabling DSO visibility support for this gcc, too old') + options.with_visibility = False if options.dumb_gcc is True: logging.info('Setting -fpermissive to work around gcc bug') options.extra_flags = ' -fpermissive' if options.with_tr1 == None: - if ccinfo[options.compiler].has_tr1: + if cc.has_tr1: logging.info('Assuming %s has TR1 (use --with-tr1=none to disable)' % ( options.compiler)) options.with_tr1 = 'system' @@ -1705,7 +1745,7 @@ def main(argv = None): template_vars = create_template_vars(build_config, options, modules_to_use, - ccinfo[options.compiler], + cc, archinfo[options.arch], osinfo[options.os]) diff --git a/doc/log.txt b/doc/log.txt index 92b6505f3..be51cca6b 100644 --- a/doc/log.txt +++ b/doc/log.txt @@ -16,6 +16,9 @@ Version 1.10.0, Not Yet Released * Fix a bug under Visual C++ 2010 which would cause ``hex_encode`` to crash if given a zero-sized input to encode. +* TR1 support is not longer automatically assumed under older versions + of GCC + Series 1.9 ---------------------------------------- diff --git a/src/build-data/buildh.in b/src/build-data/buildh.in index 8e0de0183..733646524 100644 --- a/src/build-data/buildh.in +++ b/src/build-data/buildh.in @@ -20,7 +20,7 @@ #define BOTAN_DISTRIBUTION_INFO "%{distribution_info}" #ifndef BOTAN_DLL - #define BOTAN_DLL %{dll_import_flags} + #define BOTAN_DLL %{visibility_attribute} #endif /* Chunk sizes */ diff --git a/src/build-data/cc/bcc.txt b/src/build-data/cc/bcc.txt index 93306dde1..f2ea46ef2 100644 --- a/src/build-data/cc/bcc.txt +++ b/src/build-data/cc/bcc.txt @@ -15,7 +15,6 @@ lang_flags "" warning_flags "" shared_flags "" -dll_import_flags "" ar_command lib diff --git a/src/build-data/cc/clang.txt b/src/build-data/cc/clang.txt index 5f522cdb6..f4db26ee8 100644 --- a/src/build-data/cc/clang.txt +++ b/src/build-data/cc/clang.txt @@ -17,11 +17,12 @@ makefile_style unix lib_opt_flags "-O2" check_opt_flags "-O2" -shared_flags "-fPIC -fvisibility=hidden" +shared_flags "-fPIC" debug_flags -g no_debug_flags "-finline-functions" -dll_import_flags '__attribute__((visibility("default")))' +visibility_build_flags "-fvisibility=hidden" +visibility_attribute '__attribute__((visibility("default")))' <so_link_flags> # The default works for GNU ld and several other Unix linkers diff --git a/src/build-data/cc/ekopath.txt b/src/build-data/cc/ekopath.txt index 101f6babb..c6e8b6550 100644 --- a/src/build-data/cc/ekopath.txt +++ b/src/build-data/cc/ekopath.txt @@ -28,10 +28,9 @@ default -> "$(CXX) -shared -fPIC -Wl,-soname,$(SONAME)" athlon -> "-mcpu=athlon" pentium4 -> "-mcpu=pentium4" -opteron -> "-mcpu=opteron" -em64t -> "-mcpu=em64t" +k8 -> "-mcpu=opteron" core2 -> "-mcpu=core" -x86 -> "-mcpu=anyx86" +x86_32 -> "-mcpu=anyx86" x86_64 -> "-mcpu=athlon64" </mach_opt> diff --git a/src/build-data/cc/gcc.txt b/src/build-data/cc/gcc.txt index f82b9d36f..f75239666 100644 --- a/src/build-data/cc/gcc.txt +++ b/src/build-data/cc/gcc.txt @@ -17,11 +17,12 @@ maintainer_warning_flags "-Werror -Wall -Wextra -Wstrict-aliasing -Wstrict-overf lib_opt_flags "-O3" check_opt_flags "-O2" -shared_flags "-fPIC -fvisibility=hidden" +shared_flags "-fPIC" debug_flags -g no_debug_flags "-finline-functions" -dll_import_flags '__attribute__((visibility("default")))' +visibility_build_flags "-fvisibility=hidden" +visibility_attribute '__attribute__((visibility("default")))' makefile_style unix diff --git a/src/build-data/cc/msvc.txt b/src/build-data/cc/msvc.txt index a854a576d..034ea7444 100644 --- a/src/build-data/cc/msvc.txt +++ b/src/build-data/cc/msvc.txt @@ -14,8 +14,8 @@ check_opt_flags "/O2 /D_CONSOLE" lang_flags "/EHs /GR" warning_flags "/W3 /wd4275 /wd4267" -shared_flags "/DBOTAN_DLL=__declspec(dllexport)" -dll_import_flags "__declspec(dllimport)" +visibility_build_flags "/DBOTAN_DLL=__declspec(dllexport)" +visibility_attribute "__declspec(dllimport)" ar_command lib diff --git a/src/build-data/os/solaris.txt b/src/build-data/os/solaris.txt index 47e7bccbc..571c594d1 100644 --- a/src/build-data/os/solaris.txt +++ b/src/build-data/os/solaris.txt @@ -1,5 +1,8 @@ os_type unix +install_cmd_data 'cp' +install_cmd_exec 'cp' + <target_features> posix_mlock gettimeofday |