From owner-svn-soc-all@FreeBSD.ORG Tue May 17 17:12:32 2011 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 5DBEA106566B for ; Tue, 17 May 2011 17:12:31 +0000 (UTC) (envelope-from gk@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 17 May 2011 17:12:31 +0000 Date: Tue, 17 May 2011 17:12:31 +0000 From: gk@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20110517171231.5DBEA106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r222105 - soc2011/gk X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 May 2011 17:12:32 -0000 Author: gk Date: Tue May 17 17:12:31 2011 New Revision: 222105 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=222105 Log: Create directory soc2011/gk Added: soc2011/gk/ From owner-svn-soc-all@FreeBSD.ORG Tue May 17 17:13:43 2011 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 8D05D1065670 for ; Tue, 17 May 2011 17:13:42 +0000 (UTC) (envelope-from gk@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 17 May 2011 17:13:42 +0000 Date: Tue, 17 May 2011 17:13:42 +0000 From: gk@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20110517171342.8D05D1065670@hub.freebsd.org> Cc: Subject: socsvn commit: r222106 - soc2011/gk/ino64-head X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 May 2011 17:13:43 -0000 Author: gk Date: Tue May 17 17:13:42 2011 New Revision: 222106 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=222106 Log: Create ino64-head branch Added: soc2011/gk/ino64-head/ (props changed) - copied from r222105, mirror/FreeBSD/head/ From owner-svn-soc-all@FreeBSD.ORG Tue May 17 18:33:51 2011 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 884E41065674 for ; Tue, 17 May 2011 18:33:49 +0000 (UTC) (envelope-from gk@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 17 May 2011 18:33:49 +0000 Date: Tue, 17 May 2011 18:33:49 +0000 From: gk@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20110517183349.884E41065674@hub.freebsd.org> Cc: Subject: socsvn commit: r222108 - in soc2011/gk/ino64-head/tools/tools/shlib-compat: . test test/libtest1 test/libtest2 test/libtest3 X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 May 2011 18:33:51 -0000 Author: gk Date: Tue May 17 18:33:49 2011 New Revision: 222108 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=222108 Log: Import shlib-compat shlib-compat is ABI compatibility checker for shared libraries with symbol versioning. It uses dwarf debugging info to recreate function definitions including arguments and structural types. https://github.com/glk/shlib-compat 4faf1193be68479d99fa Added: soc2011/gk/ino64-head/tools/tools/shlib-compat/ soc2011/gk/ino64-head/tools/tools/shlib-compat/shlib-compat (contents, props changed) soc2011/gk/ino64-head/tools/tools/shlib-compat/test/ soc2011/gk/ino64-head/tools/tools/shlib-compat/test/Makefile (contents, props changed) soc2011/gk/ino64-head/tools/tools/shlib-compat/test/Makefile.inc (contents, props changed) soc2011/gk/ino64-head/tools/tools/shlib-compat/test/Versions.def soc2011/gk/ino64-head/tools/tools/shlib-compat/test/libtest1/ soc2011/gk/ino64-head/tools/tools/shlib-compat/test/libtest1/Makefile (contents, props changed) soc2011/gk/ino64-head/tools/tools/shlib-compat/test/libtest1/Symbol.map soc2011/gk/ino64-head/tools/tools/shlib-compat/test/libtest1/test.c (contents, props changed) soc2011/gk/ino64-head/tools/tools/shlib-compat/test/libtest2/ soc2011/gk/ino64-head/tools/tools/shlib-compat/test/libtest2/Makefile (contents, props changed) soc2011/gk/ino64-head/tools/tools/shlib-compat/test/libtest2/Symbol.map soc2011/gk/ino64-head/tools/tools/shlib-compat/test/libtest2/test.c (contents, props changed) soc2011/gk/ino64-head/tools/tools/shlib-compat/test/libtest3/ soc2011/gk/ino64-head/tools/tools/shlib-compat/test/libtest3/Makefile (contents, props changed) soc2011/gk/ino64-head/tools/tools/shlib-compat/test/libtest3/Symbol.map soc2011/gk/ino64-head/tools/tools/shlib-compat/test/libtest3/test.c (contents, props changed) soc2011/gk/ino64-head/tools/tools/shlib-compat/test/regress.1-1.out soc2011/gk/ino64-head/tools/tools/shlib-compat/test/regress.1-2.out soc2011/gk/ino64-head/tools/tools/shlib-compat/test/regress.1-3.out soc2011/gk/ino64-head/tools/tools/shlib-compat/test/regress.2-1.out soc2011/gk/ino64-head/tools/tools/shlib-compat/test/regress.2-2.out soc2011/gk/ino64-head/tools/tools/shlib-compat/test/regress.2-3.out soc2011/gk/ino64-head/tools/tools/shlib-compat/test/regress.3-1.out soc2011/gk/ino64-head/tools/tools/shlib-compat/test/regress.3-2.out soc2011/gk/ino64-head/tools/tools/shlib-compat/test/regress.3-3.out soc2011/gk/ino64-head/tools/tools/shlib-compat/test/regress.m4 soc2011/gk/ino64-head/tools/tools/shlib-compat/test/regress.sh (contents, props changed) soc2011/gk/ino64-head/tools/tools/shlib-compat/test/regress.t Added: soc2011/gk/ino64-head/tools/tools/shlib-compat/shlib-compat ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2011/gk/ino64-head/tools/tools/shlib-compat/shlib-compat Tue May 17 18:33:49 2011 (r222108) @@ -0,0 +1,811 @@ +#!/usr/bin/env python + +# Copyright (c) 2010 Gleb Kurtsou +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +import os +import sys +import re +import json +import optparse + +class Config(object): + version = '0.1' + # controlled by user + verbose = 0 + dump = False + version_filter = None + symbol_filter = None + # misc opts + objdump = 'objdump' + dwarfdump = 'dwarfdump' + # debug + cmpcache_enabled = True + dwarfcache_enabled = True + + @classmethod + def init(cls): + cls.version_filter = StrFilter() + cls.symbol_filter = StrFilter() + +# {{{ misc + +class StrFilter(object): + def __init__(self): + self.exclude = [] + self.include = [] + + def compile(self): + self.re_exclude = [ re.compile(x) for x in self.exclude ] + self.re_include = [ re.compile(x) for x in self.include ] + + def match(self, s): + if len(self.re_include): + matched = False + for r in self.re_include: + if r.match(s): + matched = True + break + if not matched: + return False + for r in self.re_exclude: + if r.match(s): + return False + return True + +class Cache(object): + + class CacheStats(object): + def __init__(self): + self.hit = 0 + self.miss = 0 + + def show(self, name): + total = self.hit + self.miss + if total == 0: + ratio = '(undef)' + else: + ratio = '%f' % (self.hit/float(total)) + return '%s cache stats: hit: %d; miss: %d; ratio: %s' % \ + (name, self.hit, self.miss, ratio) + + def __init__(self, enabled=True, stats=None): + self.enabled = enabled + self.items = {} + if stats == None: + self.stats = Cache.CacheStats() + else: + self.stats = stats + + def get(self, id): + if self.enabled and self.items.has_key(id): + self.stats.hit += 1 + return self.items[id] + else: + self.stats.miss += 1 + return None + + def put(self, id, obj): + if self.enabled: + if self.items.has_key(id) and obj is not self.items[id]: + #raise ValueError, "Item is already cached: %d (%s, %s)" % \ + # (id, self.items[id], obj) + print >> sys.stderr, "WARN: Item is already cached: %d (%s, %s)" % \ + (id, self.items[id], obj) + self.items[id] = obj + + def replace(self, id, obj): + if self.enabled: + assert self.items.has_key(id) + self.items[id] = obj + +class ListDiff(object): + def __init__(self, orig, new): + self.orig = set(orig) + self.new = set(new) + self.common = self.orig & self.new + self.added = self.new - self.common + self.removed = self.orig - self.common + +# }}} + +#{{{ symbols and version maps + +class Symbol(object): + def __init__(self, name, offset, version, lib): + self.name = name + self.offset = offset + self.version = version + self.lib = lib + self.definition = None + + @property + def name_ver(self): + return self.name + '@' + self.version + + def __repr__(self): + return "Symbol(%s, 0x%x, %s)" % (self.name, self.offset, self.version) + +class CommonSymbol(object): + def __init__(self, origsym, newsym): + if origsym.name != newsym.name or origsym.version != newsym.version: + raise RuntimeError, "Symbols have different names:", [origsym, newsym] + self.origsym = origsym + self.newsym = newsym + self.name = newsym.name + self.version = newsym.version + + def __repr__(self): + return "CommonSymbol(%s, %s)" % (self.name, self.version) + +class VersionMap(object): + def __init__(self, name): + self.name = name + self.symbols = {} + + def append(self, symbol): + if (self.symbols.has_key(symbol.name)): + raise ValueError, "Symbol is already defined %s@@%s" % (symbol.name, self.name) + self.symbols[symbol.name] = symbol + + def names(self): + return self.symbols.keys() + + def __repr__(self): + return repr(self.symbols.values()) + +# }}} + +# {{{ types and definitions + +class Def(object): + _is_alias = False + + def __init__(self, id, name, **kwargs): + self.id = id + self.name = name + self.attrs = kwargs + + def __getattr__(self, attr): + if not self.attrs.has_key(attr): + raise AttributeError + return self.attrs[attr] + + def _alias(self): + if self._is_alias: + return self.type._alias() + return self + + def __cmp__(self, other): + # TODO assert 'self' and 'other' belong to different libraries + #print 'cmp defs: %s, %s' % (self, other) + a = self._alias() + try: + b = other._alias() + except AttributeError: + return 1 + r = cmp(a.__class__, b.__class__) + if r == 0: + if a.id != 0 and b.id != 0: + ind = (long(a.id) << 32) + b.id + r = Dwarf.cmpcache.get(ind) + if r != None: + return r + else: + ind = 0 + r = cmp(a.attrs, b.attrs) + if ind != 0: + Dwarf.cmpcache.put(ind, r) + else: + raise RuntimeError, 'Comparing different classes: %s, %s' % \ + (a.__class__.__name__, b.__class__.__name__) + return r + + def __repr__(self): + p = [] + if hasattr(self, 'name'): + p.append("name=%s" % self.name) + for (k, v) in self.attrs.items(): + if isinstance(v, Def): + v = v.__class__.__name__ + '(...)' + p.append("%s=%s" % (k, v)) + return self.__class__.__name__ + '(' + ', '.join(p) + ')' + + @staticmethod + def serialize_any(obj): + if isinstance(obj, Def): + return obj.serialize() + elif type(obj) is list: + return [ Def.serialize_any(x) for x in obj ] + return obj + + def serialize(self): + d = { '.name': self.name, '.tag': self.__class__.__name__ } + for (k, v) in self.attrs.items(): + d[k] = Def.serialize_any(v) + return d + +class AnonymousDef(Def): + def __init__(self, id, **kwargs): + Def.__init__(self, id, None, **kwargs) + +class Void(AnonymousDef): + _instance = None + + def __new__(cls, *args, **kwargs): + if not cls._instance: + cls._instance = super(Void, cls).__new__( + cls, *args, **kwargs) + return cls._instance + + def __init__(self): + AnonymousDef.__init__(self, 0) + +class VarArgs(AnonymousDef): + pass + +class PointerDef(AnonymousDef): + pass + +class BaseTypeDef(Def): + pass + +class TypeAliasDef(Def): + _is_alias = True + +class EnumerationTypeDef(Def): + pass + +class ConstTypeDef(AnonymousDef): + _is_alias = True + +class VolatileTypeDef(AnonymousDef): + _is_alias = True + +class ArrayDef(AnonymousDef): + pass + +class ArraySubrangeDef(AnonymousDef): + pass + +class FunctionDef(Def): + pass + +class FunctionTypeDef(Def): + pass + +class ParameterDef(Def): + pass + +# TODO +class StructForwardDef(Def): + pass + +class IncompleteDef(Def): + def update(self, complete, cache=None): + self.complete = complete + complete.incomplete = self + if cache != None: + cached = cache.get(self.id) + if cached != None and isinstance(cached, IncompleteDef): + cache.replace(self.id, complete) + +class StructIncompleteDef(IncompleteDef): + pass + +class UnionIncompleteDef(IncompleteDef): + pass + +class StructDef(Def): + pass + +class UnionDef(Def): + pass + +class MemberDef(Def): + pass + +class Dwarf(object): + + cmpcache = Cache(enabled=Config.cmpcache_enabled) + + def __init__(self, dump): + self.dump = dump + + def _build_optarg_type(self, praw): + type = praw.optarg('type', Void()) + if type != Void(): + type = self.buildref(praw.unit, type) + return type + + def build_subprogram(self, raw): + params = [ self.build(x) for x in raw.nested ] + result = self._build_optarg_type(raw) + return FunctionDef(raw.id, raw.name, params=params, result=result) + + def build_subroutine_type(self, raw): + params = [ self.build(x) for x in raw.nested ] + result = self._build_optarg_type(raw) + return FunctionTypeDef(raw.id, raw.optname, params=params, result=result) + + def build_formal_parameter(self, raw): + type = self.buildref(raw.unit, raw.arg('type')) + return ParameterDef(raw.id, raw.optname, type=type) + + def build_pointer_type(self, raw): + type = self._build_optarg_type(raw) + return PointerDef(raw.id, type=type) + + def build_member(self, raw): + type = self.buildref(raw.unit, raw.arg('type')) + return MemberDef(raw.id, raw.name, type=type) + + def build_structure_type(self, raw): + incomplete = raw.unit.incomplete.get(raw.id) + if incomplete == None: + incomplete = StructIncompleteDef(raw.id, raw.optname) + raw.unit.incomplete.put(raw.id, incomplete) + else: + return incomplete + members = [ self.build(x) for x in raw.nested ] + byte_size = raw.optarg('byte_size', None) + if byte_size == None: + obj = StructForwardDef(raw.id, raw.name, members=members, \ + forcename=raw.name) + obj = StructDef(raw.id, raw.optname, members=members, \ + byte_size=byte_size) + incomplete.update(obj, cache=raw.unit.cache) + return obj + + def build_union_type(self, raw): + incomplete = raw.unit.incomplete.get(raw.id) + if incomplete == None: + incomplete = UnionIncompleteDef(raw.id, raw.optname) + raw.unit.incomplete.put(raw.id, incomplete) + else: + return incomplete + members = [ self.build(x) for x in raw.nested ] + byte_size = raw.optarg('byte_size', None) + obj = UnionDef(raw.id, raw.optname, members=members, \ + byte_size=byte_size) + obj.incomplete = incomplete + incomplete.complete = obj + return obj + + def build_typedef(self, raw): + type = self.buildref(raw.unit, raw.arg('type')) + return TypeAliasDef(raw.id, raw.name, type=type) + + def build_const_type(self, raw): + type = self._build_optarg_type(raw) + return ConstTypeDef(raw.id, type=type) + + def build_volatile_type(self, raw): + type = self.buildref(raw.unit, raw.arg('type')) + return VolatileTypeDef(raw.id, type=type) + + def build_enumeration_type(self, raw): + # TODO handle DW_TAG_enumerator ??? + return EnumerationTypeDef(raw.id, name=raw.optname, \ + byte_size=raw.arg('byte_size')) + + def build_base_type(self, raw): + return BaseTypeDef(raw.id, raw.optname, \ + byte_size=raw.arg('byte_size'), encoding=raw.arg('encoding')) + + def build_array_type(self, raw): + type = self.buildref(raw.unit, raw.arg('type')) + subranges = [ self.build(x) for x in raw.nested ] + return ArrayDef(raw.id, type=type, subranges=subranges) + + def build_subrange_type(self, raw): + type = self.buildref(raw.unit, raw.arg('type')) + return ArraySubrangeDef(raw.id, type=type, \ + upper_bound=raw.arg('upper_bound')) + + def build_unspecified_parameters(self, raw): + return VarArgs(raw.id) + + def _get_id(self, id): + try: + return int(id) + except ValueError: + if (id.startswith('<') and id.endswith('>')): + return int(id[1:-1]) + else: + raise ValueError, "Invalid dwarf id: %s" % id + + def build(self, raw): + obj = raw.unit.cache.get(raw.id) + if obj != None: + return obj + builder_name = raw.tag.replace('DW_TAG_', 'build_') + try: + builder = getattr(self, builder_name) + except AttributeError: + raise AttributeError, "Unknown dwarf tag: %s" % raw + obj = builder(raw) + raw.unit.cache.put(obj.id, obj) + return obj + + def buildref(self, unit, id): + id = self._get_id(id) + raw = unit.tags[id] + obj = self.build(raw) + return obj + +# }}} + +class Shlib(object): + def __init__(self, libfile): + self.libfile = libfile + self.versions = {} + + def parse_objdump(self): + objdump = ObjdumpParser(self.libfile) + objdump.run() + for p in objdump.dynamic_symbols: + vername = p['ver'] + if vername.startswith('(') and vername.endswith(')'): + vername = vername[1:-1] + if not Config.version_filter.match(vername): + continue + if not Config.symbol_filter.match(p['symbol']): + continue + sym = Symbol(p['symbol'], p['offset'], vername, self) + if not self.versions.has_key(vername): + self.versions[vername] = VersionMap(vername) + self.versions[vername].append(sym) + + def parse_dwarfdump(self): + dwarfdump = DwarfdumpParser(self.libfile) + dwarfdump.run() + dwarf = Dwarf(dwarfdump) + for ver in self.versions.values(): + for sym in ver.symbols.values(): + try: + raw = dwarfdump.offsetmap[sym.offset] + except: + print >> sys.stderr, "WARN: Symbol %s (%s) wan't found at offset 0x%x" % \ + (sym.name_ver, self.libfile, sym.offset) + continue + if Config.verbose > 1: + print "Parse symbol %s (%s)" % (sym.name_ver, self.libfile) + sym.definition = dwarf.build(raw) + + def parse(self): + self.parse_objdump() + self.parse_dwarfdump() + +# {{{ parsers + +class Parser(object): + def __init__(self, proc): + self.proc = proc + self.parser = self.parse_begin + + def run(self): + fd = os.popen(self.proc, 'r') + while True: + line = fd.readline() + if (not line): + break + line = line.strip() + if (line): + self.parser(line) + + def parse_begin(self, line): + print(line) + +class ObjdumpParser(Parser): + + re_header = re.compile('(?P\w*)\s*SYMBOL TABLE:') + + re_local_symbol = re.compile('(?P[0-9a-fA-F]+)\s+(?P\w+)\s+(?P\w+)\s+(?P
[^\s]+)\s+(?P[0-9a-fA-F]+)\s*(?P[^\s]*)') + re_lame_symbol = re.compile('(?P[0-9a-fA-F]+)\s+(?P\w+)\s+\*[A-Z]+\*') + + re_dynamic_symbol = re.compile('(?P[0-9a-fA-F]+)\s+(?P\w+)\s+(?P\w+)\s+(?P
[^\s]+)\s+(?P[0-9a-fA-F]+)\s*(?P[^\s]*)\s*(?P[^\s]*)') + + def __init__(self, libfile): + Parser.__init__(self, "%s -wT %s" % (Config.objdump, libfile)) + self.dynamic_symbols = [] + self.local_symbols = [] + + def parse_begin(self, line): + self.parse_header(line) + + def add_symbol(self, table, symbol): + offset = int(symbol['offset'], 16); + symbol['offset'] = offset + if (offset == 0): + return + table.append(symbol) + + def parse_header(self, line): + m = self.re_header.match(line) + if (m): + table = m.group('table') + if (table == "DYNAMIC"): + self.parser = self.parse_dynamic + elif table == '': + self.parser = self.parse_local + else: + raise ValueError, "Invalid symbol table: %s" % table + return True + return False + + def parse_local(self, line): + if (self.parse_header(line)): + return + if (self.re_lame_symbol.match(line)): + return + m = self.re_local_symbol.match(line) + if (not m): + raise ValueError, "Invalid symbol definition: %s" % line + p = m.groupdict() + if (p['symbol'] and p['symbol'].find('@') == -1): + self.add_symbol(self.local_symbols, p); + + def parse_dynamic(self, line): + if (self.parse_header(line)): + return + if (self.re_lame_symbol.match(line)): + return + m = self.re_dynamic_symbol.match(line) + if (not m): + raise ValueError, "Invalid symbol definition: %s" % line + p = m.groupdict() + if (p['symbol'] and p['ver']): + self.add_symbol(self.dynamic_symbols, p); + +class DwarfdumpParser(Parser): + + tagcache_stats = Cache.CacheStats() + + class Unit(object): + def __init__(self): + self.cache = Cache(enabled=Config.dwarfcache_enabled, \ + stats=DwarfdumpParser.tagcache_stats) + self.incomplete = Cache() + self.tags = {} + + class Tag(object): + def __init__(self, unit, data): + self.unit = unit + self.id = int(data['id']) + self.level = int(data['level']) + self.tag = data['tag'] + self.args = {} + self.nested = [] + + @property + def name(self): + return self.arg('name') + + @property + def optname(self): + return self.optarg('name', None) + + def arg(self, a): + name = 'DW_AT_' + a + try: + return self.args[name] + except KeyError: + raise KeyError, "Argument '%s' not found in %s: %s" % (name, self, self.args) + + def optarg(self, a, default): + try: + return self.arg(a) + except KeyError: + return default + + def __repr__(self): + return "Tag(%d, %d, %s)" % (self.level, self.id, self.tag) + + re_header = re.compile('<(?P\d+)><(?P\d+\+*\d*)><(?P\w+)>') + re_argname = re.compile('(?P\w+)<') + + skip_tags = set([ + 'DW_TAG_lexical_block', + 'DW_TAG_inlined_subroutine', + 'DW_TAG_label', + 'DW_TAG_variable', + ]) + + def __init__(self, libfile): + Parser.__init__(self, "%s -di %s" % (Config.dwarfdump, libfile)) + self.current_unit = None + self.offsetmap = {} + self.stack = [] + + def parse_begin(self, line): + if line == '.debug_info': + self.parser = self.parse_debuginfo + else: + raise ValueError, "Invalid dwarfdump header: %s" % line + + def parse_argvalue(self, args): + assert args.startswith('<') + i = 1 + cnt = 1 + while i < len(args) and args[i]: + if args[i] == '<': + cnt += 1 + elif args[i] == '>': + cnt -= 1 + if cnt == 0: + break + i = i + 1 + value = args[1:i] + args = args[i+1:] + return (args, value) + + def parse_arg(self, tag, args): + m = self.re_argname.match(args) + if not m: + raise ValueError, "Invalid dwarfdump: couldn't parse arguments: %s" % args + argname = m.group('arg') + args = args[len(argname):] + value = [] + while len(args) > 0 and args.startswith('<'): + (args, v) = self.parse_argvalue(args) + value.append(v) + args = args.lstrip() + if len(value) == 1: + value = value[0] + tag.args[argname] = value + return args + + def parse_debuginfo(self, line): + m = self.re_header.match(line) + if not m: + raise ValueError, "Invalid dwarfdump: %s" % line + if m.group('level') == '0': + self.current_unit = DwarfdumpParser.Unit() + return + tag = DwarfdumpParser.Tag(self.current_unit, m.groupdict()) + args = line[len(m.group(0)):].lstrip() + while args: + args = self.parse_arg(tag, args) + tag.unit.tags[tag.id] = tag + if tag.args.has_key('DW_AT_low_pc') and \ + tag.tag not in DwarfdumpParser.skip_tags: + offset = int(tag.args['DW_AT_low_pc'], 16) + if self.offsetmap.has_key(offset): + raise ValueError, "Dwarf dump parse error: " + \ + "symbol is aleady defined at offset 0x%x" % offset + self.offsetmap[offset] = tag + if len(self.stack) > 0: + prev = self.stack.pop() + while prev.level >= tag.level and len(self.stack) > 0: + prev = self.stack.pop() + if prev.level < tag.level: + assert prev.level == tag.level - 1 + # TODO check DW_AT_sibling ??? + if tag.tag not in DwarfdumpParser.skip_tags: + prev.nested.append(tag) + self.stack.append(prev) + self.stack.append(tag) + assert len(self.stack) == tag.level + +# }}} + +def list_str(l): + l = [ str(x) for x in l ] + l.sort() + return ', '.join(l) + +def names_ver_str(vername, names): + return list_str([ x + "@" + vername for x in names ]) + +def common_symbols(origlib, newlib): + result = [] + verdiff = ListDiff(origlib.versions.keys(), newlib.versions.keys()) + if Config.verbose > 0: + print 'Original versions: ', list_str(verdiff.orig) + print 'New versions: ', list_str(verdiff.new) + for vername in verdiff.added: + print 'Added version: ', vername + print ' Added symbols: ', \ + names_ver_str(vername, newlib.versions[vername].names()) + for vername in verdiff.removed: + print 'Removed version: ', vername + print ' Removed symbols: ', \ + names_ver_str(vername, origlib.versions[vername].names()) + for vername in verdiff.common: + origver = origlib.versions[vername] + newver = newlib.versions[vername] + namediff = ListDiff(origver.names(), newver.names()) + if namediff.added or namediff.removed: + print 'Added symbols: ', \ + names_ver_str(vername, namediff.added) + print 'Removed symbols: ', \ + names_ver_str(vername, namediff.removed) + commonver = VersionMap(vername) + result.append(commonver) + for n in namediff.common: + sym = CommonSymbol(origver.symbols[n], newver.symbols[n]) + commonver.append(sym) + return result + +def cmp_symbols(commonver): + for ver in commonver: + names = ver.names(); + names.sort() + for symname in names: + sym = ver.symbols[symname] + match = sym.origsym.definition == sym.newsym.definition + if Config.verbose or not match: + print '==== %s: definitions%s match' % \ + (sym.origsym.name_ver, "" if match else " don't") + if Config.dump and not match: + for xsym in [sym.origsym, sym.newsym]: + print '---- %s %s:' % \ + (xsym.name_ver, xsym.lib.libfile) + print json.dump(xsym.definition.serialize(), sys.stdout) + + +if __name__ == '__main__': + Config.init() + parser = optparse.OptionParser(usage="usage: %prog origlib newlib", \ + version="%prog " + Config.version) + parser.add_option('-v', '--verbose', action='count', \ + help="verbose mode, may be specified several times") + parser.add_option('--dump', action='store_true', \ + help="dump json representation if symbol definitions don't match") + parser.add_option('--exclude-ver', action='append', metavar="re") + parser.add_option('--include-ver', action='append', metavar="re") + parser.add_option('--exclude-sym', action='append', metavar="re") + parser.add_option('--include-sym', action='append', metavar="re") + (opts, args) = parser.parse_args() + + if len(args) != 2: + parser.print_help() + sys.exit(-1) + if opts.verbose: + Config.verbose = opts.verbose + if opts.dump: + Config.verbose = opts.dump + for (k, v) in ({ '_sym': Config.symbol_filter, \ + '_ver': Config.version_filter }).items(): + for a in [ 'exclude', 'include' ]: + opt = getattr(opts, a + k) + if opt: + getattr(v, a).extend(opt) + Config.version_filter.compile() + Config.symbol_filter.compile() + + (origfile, newfile) = (args[0], args[1]) + + origlib = Shlib(origfile) + origlib.parse() + newlib = Shlib(newfile) + newlib.parse() + + commonver = common_symbols(origlib, newlib) + cmp_symbols(commonver) + if Config.verbose > 2: + print Dwarf.cmpcache.stats.show('Cmp') + print DwarfdumpParser.tagcache_stats.show('Dwarf tag') + Added: soc2011/gk/ino64-head/tools/tools/shlib-compat/test/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2011/gk/ino64-head/tools/tools/shlib-compat/test/Makefile Tue May 17 18:33:49 2011 (r222108) @@ -0,0 +1,34 @@ +SUBDIR= libtest1 \ + libtest2 \ + libtest3 + +NUMTEST=3 + +.PHONY: test regress.sh gentests gendiffs cleandiffs + +test: all + sh regress.t + +prove: all + prove ${.CURDIR} + +regress.sh: + echo 'run() { ../shlib-compat -vv libtest$$1/libtest$$1.so.0 libtest$$2/libtest$$2.so.0; }' > ${.TARGET} + N=`expr ${NUMTEST} \* ${NUMTEST}`; echo "echo 1..$$N" >> ${.TARGET} + echo 'REGRESSION_START($$1)' >> ${.TARGET} + for a in `jot ${NUMTEST}`; do for b in `jot ${NUMTEST}`; do echo "REGRESSION_TEST(\`$$a-$$b', \`run $$a $$b')"; done; done >> ${.TARGET} + echo "REGRESSION_END()" >> ${.TARGET} + + +gentests: regress.sh + for a in `jot ${NUMTEST}`; do for b in `jot ${NUMTEST}`; do ../shlib-compat -vv libtest$$a/libtest$$a.so.0 libtest$$b/libtest$$b.so.0 > regress.$$a-$$b.out; done; done + +gendiffs: + for a in `jot ${NUMTEST}`; do for b in `jot ${NUMTEST}`; do (diff -ur libtest$$a libtest$$b > regress.$$a-$$b.diff || exit 0); done; done + +cleandiffs: + rm -f regress.*-*.diff + +clean: cleandiffs + +.include Added: soc2011/gk/ino64-head/tools/tools/shlib-compat/test/Makefile.inc ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2011/gk/ino64-head/tools/tools/shlib-compat/test/Makefile.inc Tue May 17 18:33:49 2011 (r222108) @@ -0,0 +1,11 @@ +SHLIB= test${TESTNUM} +SHLIB_MAJOR= 0 + +SRCS+= test.c + +WARNS?= 3 + +DEBUG_FLAGS?= -g + +VERSION_DEF= ${.CURDIR}/../Versions.def +SYMBOL_MAPS= ${.CURDIR}/Symbol.map Added: soc2011/gk/ino64-head/tools/tools/shlib-compat/test/Versions.def ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2011/gk/ino64-head/tools/tools/shlib-compat/test/Versions.def Tue May 17 18:33:49 2011 (r222108) @@ -0,0 +1,9 @@ +TEST_1.0 { +}; + +TEST_1.1 { +} TEST_1.0; + +TESTprivate_1.0 { +} TEST_1.1; + Added: soc2011/gk/ino64-head/tools/tools/shlib-compat/test/libtest1/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2011/gk/ino64-head/tools/tools/shlib-compat/test/libtest1/Makefile Tue May 17 18:33:49 2011 (r222108) @@ -0,0 +1,4 @@ +TESTNUM= 1 + +.include <../Makefile.inc> +.include Added: soc2011/gk/ino64-head/tools/tools/shlib-compat/test/libtest1/Symbol.map ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2011/gk/ino64-head/tools/tools/shlib-compat/test/libtest1/Symbol.map Tue May 17 18:33:49 2011 (r222108) @@ -0,0 +1,8 @@ +TEST_1.0 { + func1; + func2; + func3; + func4; + func5; + func6; +}; Added: soc2011/gk/ino64-head/tools/tools/shlib-compat/test/libtest1/test.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2011/gk/ino64-head/tools/tools/shlib-compat/test/libtest1/test.c Tue May 17 18:33:49 2011 (r222108) @@ -0,0 +1,62 @@ +#include +#include + +struct s1 { + int32_t f1_int; + char *f2_str; + short f3_short; + uint64_t f4_uint64; + intmax_t f5_intmax; + void* f6_ptr; +}; + +struct s2 { + char f1_buf[30]; + struct s1 *f2_s1; +}; + +struct s3 { + struct s1 f1_s1; + uint32_t f2_int32; +}; + +int func1(int a, int b); +int func2(int64_t a, uint64_t b); +void func3(struct s1 *s); +void func4(struct s1 s); +int func5(int a, void *b, struct s2 *s); +int func6(char a, struct s3 *s); + +int +func1(int a, int b) +{ + return (a - b); +} + +int +func2(int64_t a, uint64_t b) +{ + return (a - b); +} + +void +func3(struct s1 *s) +{ +} + +void +func4(struct s1 s) +{ +} + +int +func5(int a, void *b, struct s2 *s) +{ + return (0); +} + +int +func6(char a, struct s3 *s) +{ + return (0); +} Added: soc2011/gk/ino64-head/tools/tools/shlib-compat/test/libtest2/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2011/gk/ino64-head/tools/tools/shlib-compat/test/libtest2/Makefile Tue May 17 18:33:49 2011 (r222108) @@ -0,0 +1,4 @@ +TESTNUM= 2 + +.include <../Makefile.inc> +.include Added: soc2011/gk/ino64-head/tools/tools/shlib-compat/test/libtest2/Symbol.map ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2011/gk/ino64-head/tools/tools/shlib-compat/test/libtest2/Symbol.map Tue May 17 18:33:49 2011 (r222108) @@ -0,0 +1,11 @@ +TEST_1.0 { + func2; + func3; + func4; + func5; + func6; +}; + +TEST_1.1 { + func1; +}; Added: soc2011/gk/ino64-head/tools/tools/shlib-compat/test/libtest2/test.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2011/gk/ino64-head/tools/tools/shlib-compat/test/libtest2/test.c Tue May 17 18:33:49 2011 (r222108) @@ -0,0 +1,70 @@ +#include +#include + +struct s1 { + int32_t f1_int; + char *f2_str; + short f3_short; + uint64_t f4_uint64; + intmax_t f5_intmax; + void* f6_ptr; +}; + +struct s2 { + char f1_buf[30]; + struct s1 *f2_s1; +}; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-soc-all@FreeBSD.ORG Wed May 18 06:00:23 2011 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 5B7F7106566B for ; Wed, 18 May 2011 06:00:22 +0000 (UTC) (envelope-from kibab@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 18 May 2011 06:00:11 +0000 Date: Wed, 18 May 2011 06:00:11 +0000 From: kibab@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20110518060022.5B7F7106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r222126 - soc2011/kibab X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 May 2011 06:00:23 -0000 Author: kibab Date: Wed May 18 06:00:10 2011 New Revision: 222126 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=222126 Log: Test commit Added: soc2011/kibab/ soc2011/kibab/testfile Added: soc2011/kibab/testfile ============================================================================== From owner-svn-soc-all@FreeBSD.ORG Wed May 18 13:22:56 2011 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id B465A106566C for ; Wed, 18 May 2011 13:22:55 +0000 (UTC) (envelope-from rudot@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 18 May 2011 13:22:55 +0000 Date: Wed, 18 May 2011 13:22:55 +0000 From: rudot@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20110518132255.B465A106566C@hub.freebsd.org> Cc: Subject: socsvn commit: r222134 - soc2011/rudot X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 May 2011 13:22:56 -0000 Author: rudot Date: Wed May 18 13:22:55 2011 New Revision: 222134 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=222134 Log: New import Added: soc2011/rudot/ soc2011/rudot/test.c Added: soc2011/rudot/test.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2011/rudot/test.c Wed May 18 13:22:55 2011 (r222134) @@ -0,0 +1 @@ +// svn test From owner-svn-soc-all@FreeBSD.ORG Wed May 18 14:22:53 2011 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 3B4CC106564A for ; Wed, 18 May 2011 14:22:51 +0000 (UTC) (envelope-from zy@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 18 May 2011 14:22:51 +0000 Date: Wed, 18 May 2011 14:22:51 +0000 From: zy@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20110518142251.3B4CC106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r222135 - in soc2011/zy/nvi-iconv/head: contrib/nvi usr.bin/nvi usr.bin/vi X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 May 2011 14:22:53 -0000 Author: zy Date: Wed May 18 14:22:50 2011 New Revision: 222135 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=222135 Log: Forks nvi from vendor source. Added: soc2011/zy/nvi-iconv/head/usr.bin/nvi/ - copied from r222106, soc2011/zy/nvi-iconv/head/contrib/nvi/ Deleted: soc2011/zy/nvi-iconv/head/contrib/nvi/ Modified: soc2011/zy/nvi-iconv/head/usr.bin/vi/Makefile Modified: soc2011/zy/nvi-iconv/head/usr.bin/vi/Makefile ============================================================================== --- soc2011/zy/nvi-iconv/head/usr.bin/vi/Makefile Wed May 18 13:22:55 2011 (r222134) +++ soc2011/zy/nvi-iconv/head/usr.bin/vi/Makefile Wed May 18 14:22:50 2011 (r222135) @@ -2,7 +2,7 @@ # $FreeBSD$ # -SRCDIR= ${.CURDIR}/../../contrib/nvi +SRCDIR= ${.CURDIR}/../nvi CFLAGS+= -DGTAGS From owner-svn-soc-all@FreeBSD.ORG Wed May 18 18:26:55 2011 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id BDF44106564A for ; Wed, 18 May 2011 18:26:53 +0000 (UTC) (envelope-from zy@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 18 May 2011 18:26:53 +0000 Date: Wed, 18 May 2011 18:26:53 +0000 From: zy@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20110518182653.BDF44106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r222155 - in soc2011/zy/nvi-iconv/head/usr.bin: nvi/build vi X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 May 2011 18:26:55 -0000 Author: zy Date: Wed May 18 18:26:53 2011 New Revision: 222155 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=222155 Log: Switches to autoheader & autoconf 2.13; Checks for . Modified: soc2011/zy/nvi-iconv/head/usr.bin/nvi/build/acconfig.h soc2011/zy/nvi-iconv/head/usr.bin/nvi/build/config.h.in soc2011/zy/nvi-iconv/head/usr.bin/nvi/build/configure soc2011/zy/nvi-iconv/head/usr.bin/nvi/build/configure.in soc2011/zy/nvi-iconv/head/usr.bin/vi/config.h Modified: soc2011/zy/nvi-iconv/head/usr.bin/nvi/build/acconfig.h ============================================================================== --- soc2011/zy/nvi-iconv/head/usr.bin/nvi/build/acconfig.h Wed May 18 17:39:28 2011 (r222154) +++ soc2011/zy/nvi-iconv/head/usr.bin/nvi/build/acconfig.h Wed May 18 18:26:53 2011 (r222155) @@ -72,6 +72,9 @@ /* Define if you have */ #undef HAVE_SYS_SELECT_H +/* Define if you have */ +#undef HAVE_TERM_H + /* Define if you have the System V style pty calls. */ #undef HAVE_SYS5_PTY Modified: soc2011/zy/nvi-iconv/head/usr.bin/nvi/build/config.h.in ============================================================================== --- soc2011/zy/nvi-iconv/head/usr.bin/nvi/build/config.h.in Wed May 18 17:39:28 2011 (r222154) +++ soc2011/zy/nvi-iconv/head/usr.bin/nvi/build/config.h.in Wed May 18 18:26:53 2011 (r222155) @@ -103,6 +103,9 @@ /* Define if you have */ #undef HAVE_SYS_SELECT_H +/* Define if you have */ +#undef HAVE_TERM_H + /* Define if you have the System V style pty calls. */ #undef HAVE_SYS5_PTY @@ -172,8 +175,8 @@ /* Define if you have the unsetenv function. */ #undef HAVE_UNSETENV -/* Define if you have the valloc function. */ -#undef HAVE_VALLOC - /* Define if you have the vsnprintf function. */ #undef HAVE_VSNPRINTF + +/* Define if you have the header file. */ +#undef HAVE_UNISTD_H Modified: soc2011/zy/nvi-iconv/head/usr.bin/nvi/build/configure ============================================================================== --- soc2011/zy/nvi-iconv/head/usr.bin/nvi/build/configure Wed May 18 17:39:28 2011 (r222154) +++ soc2011/zy/nvi-iconv/head/usr.bin/nvi/build/configure Wed May 18 18:26:53 2011 (r222155) @@ -1,8 +1,8 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.7 -# Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc. +# Generated automatically using autoconf version 2.13 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. @@ -44,6 +44,7 @@ program_transform_name=s,x,x, silent= site= +sitefile= srcdir= target=NONE verbose= @@ -65,6 +66,9 @@ # Initialize some other variables. subdirs= MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 ac_prev= for ac_option @@ -155,6 +159,7 @@ --help print this message --no-create do not create output files --quiet, --silent do not print \`checking...' messages + --site-file=FILE use FILE as the site file --version print the version of autoconf that created configure Directory and file names: --prefix=PREFIX install architecture-independent files in PREFIX @@ -325,6 +330,11 @@ -site=* | --site=* | --sit=*) site="$ac_optarg" ;; + -site-file | --site-file | --site-fil | --site-fi | --site-f) + ac_prev=sitefile ;; + -site-file=* | --site-file=* | --site-fil=* | --site-fi=* | --site-f=*) + sitefile="$ac_optarg" ;; + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) @@ -346,7 +356,7 @@ verbose=yes ;; -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.7" + echo "configure generated by autoconf version 2.13" exit 0 ;; -with-* | --with-*) @@ -448,11 +458,14 @@ done # NLS nuisances. -# Only set LANG and LC_ALL to C if already set. -# These must not be set unconditionally because not all systems understand -# e.g. LANG=C (notably SCO). -if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -rf conftest* confdefs.h @@ -487,12 +500,16 @@ srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` # Prefer explicitly selected file to automatically selected ones. -if test -z "$CONFIG_SITE"; then - if test "x$prefix" != xNONE; then - CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" - else - CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" +if test -z "$sitefile"; then + if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi fi +else + CONFIG_SITE="$sitefile" fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then @@ -511,13 +528,13 @@ ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='echo $CPP $CPPFLAGS 1>&5; -$CPP $CPPFLAGS' -ac_compile='echo ${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5; -${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5 2>&5' -ac_link='echo ${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5; -${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5 2>&5' +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross +ac_exeext= +ac_objext=o if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then @@ -559,27 +576,30 @@ # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:585: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" for ac_dir in $PATH; do # Account for people who put trailing slashes in PATH elements. case "$ac_dir/" in /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. - for ac_prog in ginstall installbsd scoinst install; do + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do if test -f $ac_dir/$ac_prog; then if test $ac_prog = install && grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. - # OSF/1 installbsd also uses dspmsg, but is usable. : else ac_cv_path_install="$ac_dir/$ac_prog -c" @@ -590,7 +610,7 @@ ;; esac done - IFS="$ac_save_ifs" + IFS="$ac_save_IFS" fi if test "${ac_cv_path_install+set}" = set; then @@ -609,32 +629,35 @@ # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' + test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' # Make sure we can run config.sub. -if $ac_config_sub sun4 >/dev/null 2>&1; then : +if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } fi echo $ac_n "checking host system type""... $ac_c" 1>&6 +echo "configure:644: checking host system type" >&5 host_alias=$host case "$host_alias" in NONE) case $nonopt in NONE) - if host_alias=`$ac_config_guess`; then : + if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } fi ;; *) host_alias=$nonopt ;; esac ;; esac -host=`$ac_config_sub $host_alias` -host_cpu=`echo $host | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'` -host_vendor=`echo $host | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'` -host_os=`echo $host | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'` +host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` +host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$host" 1>&6 if test "$program_transform_name" = s,x,x,; then @@ -658,6 +681,7 @@ echo $ac_n "checking if --enable-debug option specified""... $ac_c" 1>&6 +echo "configure:685: checking if --enable-debug option specified" >&5 # Check whether --enable-debug or --disable-debug was given. if test "${enable_debug+set}" = set; then enableval="$enable_debug" @@ -693,14 +717,16 @@ lynxos*) # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:721: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_prog_CC="gcc" @@ -708,7 +734,6 @@ fi done IFS="$ac_save_ifs" - test -z "$ac_cv_prog_CC" && ac_cv_prog_CC="cc" fi fi CC="$ac_cv_prog_CC" @@ -718,8 +743,141 @@ echo "$ac_t""no" 1>&6 fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:751: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_prog_rejected=no + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# -gt 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + if test -z "$CC"; then + case "`uname -s`" in + *win32* | *WIN32*) + # Extract the first word of "cl", so it can be a program name with args. +set dummy cl; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:802: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="cl" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + ;; + esac + fi + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 +echo "configure:834: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +cat > conftest.$ac_ext << EOF + +#line 845 "configure" +#include "confdefs.h" + +main(){return(0);} +EOF +if { (eval echo configure:850: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + ac_cv_prog_cc_works=yes + # If we can't run a trivial program, we are probably using a cross compiler. + if (./conftest; exit) 2>/dev/null; then + ac_cv_prog_cc_cross=no + else + ac_cv_prog_cc_cross=yes + fi +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_prog_cc_works=no +fi +rm -fr conftest* +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 +if test $ac_cv_prog_cc_works = no; then + { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } +fi +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 +echo "configure:876: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 +cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +echo "configure:881: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -728,7 +886,7 @@ yes; #endif EOF -if ${CC-cc} -E conftest.c 2>&5 | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:890: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -736,36 +894,50 @@ fi echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + if test $ac_cv_prog_gcc = yes; then GCC=yes - if test "${CFLAGS+set}" != set; then - echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -if eval "test \"`echo '$''{'ac_cv_prog_gcc_g'+set}'`\" = set"; then +else + GCC= +fi + +ac_test_CFLAGS="${CFLAGS+set}" +ac_save_CFLAGS="$CFLAGS" +CFLAGS= +echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:909: checking whether ${CC-cc} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else echo 'void f(){}' > conftest.c if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then - ac_cv_prog_gcc_g=yes + ac_cv_prog_cc_g=yes else - ac_cv_prog_gcc_g=no + ac_cv_prog_cc_g=no fi rm -f conftest* fi -echo "$ac_t""$ac_cv_prog_gcc_g" 1>&6 - if test $ac_cv_prog_gcc_g = yes; then - CFLAGS="-g -O" - else - CFLAGS="-O" - fi +echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" fi else - GCC= - test "${CFLAGS+set}" = set || CFLAGS="-g" + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi fi echo $ac_n "checking for GNU C (gcc) version 2.x""... $ac_c" 1>&6 +echo "configure:941: checking for GNU C (gcc) version 2.x" >&5 ac_cv_gcc_vers=`${CC-cc} -v 2>&1 | \ grep "gcc version " | sed 's/.*version //'` ac_cv_gcc_major=`echo "$ac_cv_gcc_vers" | sed 's/\..*//'` @@ -826,82 +998,227 @@ LIBS="$ADDLIBS $LIBS" -# If we cannot run a trivial program, we must be cross compiling. -echo $ac_n "checking whether cross-compiling""... $ac_c" 1>&6 -if eval "test \"`echo '$''{'ac_cv_c_cross'+set}'`\" = set"; then +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1005: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - if test "$cross_compiling" = yes; then - ac_cv_c_cross=yes + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. else -cat > conftest.$ac_ext </dev/null; then - ac_cv_c_cross=no + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 else - ac_cv_c_cross=yes + echo "$ac_t""no" 1>&6 +fi + +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1035: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_prog_rejected=no + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# -gt 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi fi fi -rm -fr conftest* +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 fi -echo "$ac_t""$ac_cv_c_cross" 1>&6 -cross_compiling=$ac_cv_c_cross + if test -z "$CC"; then + case "`uname -s`" in + *win32* | *WIN32*) + # Extract the first word of "cl", so it can be a program name with args. +set dummy cl; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1086: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="cl" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + ;; + esac + fi + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi -echo $ac_n "checking whether the compiler ($CC $CFLAGS $LDFLAGS) actually works""... $ac_c" 1>&6 +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 +echo "configure:1118: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 - ac_ext=c +ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='echo $CPP $CPPFLAGS 1>&5; -$CPP $CPPFLAGS' -ac_compile='echo ${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5; -${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5 2>&5' -ac_link='echo ${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5; -${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5 2>&5' +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross - if test "$cross_compiling" = yes; then - cat > conftest.$ac_ext < conftest.$ac_ext << EOF -int main() { return 0; } -int t() { +#line 1129 "configure" +#include "confdefs.h" -; return 0; } +main(){return(0);} EOF -if eval $ac_link; then - rm -rf conftest* - am_cv_prog_cc_works=yes +if { (eval echo configure:1134: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + ac_cv_prog_cc_works=yes + # If we can't run a trivial program, we are probably using a cross compiler. + if (./conftest; exit) 2>/dev/null; then + ac_cv_prog_cc_cross=no + else + ac_cv_prog_cc_cross=yes + fi else - rm -rf conftest* - am_cv_prog_cc_works=no + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_prog_cc_works=no fi -rm -f conftest* +rm -fr conftest* +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 +if test $ac_cv_prog_cc_works = no; then + { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } +fi +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 +echo "configure:1160: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 +cross_compiling=$ac_cv_prog_cc_cross +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +echo "configure:1165: checking whether we are using GNU C" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 else -cat > conftest.$ac_ext < conftest.c </dev/null; then - am_cv_prog_cc_works=yes +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1174: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes else - am_cv_prog_cc_works=no + ac_cv_prog_gcc=no fi fi -rm -fr conftest* -case "$am_cv_prog_cc_works" in - *no) { echo "configure: error: Installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } ;; - *yes) ;; -esac -echo "$ac_t""yes" 1>&6 +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + GCC=yes +else + GCC= +fi + +ac_test_CFLAGS="${CFLAGS+set}" +ac_save_CFLAGS="$CFLAGS" +CFLAGS= +echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:1193: checking whether ${CC-cc} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_cc_g=yes +else + ac_cv_prog_cc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi PATH="$PATH:/usr/bin:/usr/sbin:/sbin:/etc:/usr/etc:/usr/lib:/usr/ucblib:" @@ -909,6 +1226,7 @@ # Extract the first word of "sh", so it can be a program name with args. set dummy sh; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1230: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_vi_cv_path_shell'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -916,9 +1234,13 @@ /*) ac_cv_path_vi_cv_path_shell="$vi_cv_path_shell" # Let the user override the test with a path. ;; + ?:/*) + ac_cv_path_vi_cv_path_shell="$vi_cv_path_shell" # Let the user override the test with a dos path. + ;; *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_path_vi_cv_path_shell="$ac_dir/$ac_word" @@ -945,6 +1267,7 @@ # Extract the first word of "sendmail", so it can be a program name with args. set dummy sendmail; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1271: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_vi_cv_path_sendmail'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -952,9 +1275,13 @@ /*) ac_cv_path_vi_cv_path_sendmail="$vi_cv_path_sendmail" # Let the user override the test with a path. ;; + ?:/*) + ac_cv_path_vi_cv_path_sendmail="$vi_cv_path_sendmail" # Let the user override the test with a dos path. + ;; *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_path_vi_cv_path_sendmail="$ac_dir/$ac_word" @@ -984,6 +1311,7 @@ # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1315: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_vi_cv_path_perl'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -991,9 +1319,13 @@ /*) ac_cv_path_vi_cv_path_perl="$vi_cv_path_perl" # Let the user override the test with a path. ;; + ?:/*) + ac_cv_path_vi_cv_path_perl="$vi_cv_path_perl" # Let the user override the test with a dos path. + ;; *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_path_vi_cv_path_perl="$ac_dir/$ac_word" @@ -1018,6 +1350,7 @@ echo $ac_n "checking for preserve directory""... $ac_c" 1>&6 +echo "configure:1354: checking for preserve directory" >&5 if eval "test \"`echo '$''{'vi_cv_path_preserve'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1049,6 +1382,7 @@ # Extract the first word of "chmod", so it can be a program name with args. set dummy chmod; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1386: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_vi_cv_path_chmod'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1056,9 +1390,13 @@ /*) ac_cv_path_vi_cv_path_chmod="$vi_cv_path_chmod" # Let the user override the test with a path. ;; + ?:/*) + ac_cv_path_vi_cv_path_chmod="$vi_cv_path_chmod" # Let the user override the test with a dos path. + ;; *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_path_vi_cv_path_chmod="$ac_dir/$ac_word" @@ -1080,6 +1418,7 @@ # Extract the first word of "cp", so it can be a program name with args. set dummy cp; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1422: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_vi_cv_path_cp'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1087,9 +1426,13 @@ /*) ac_cv_path_vi_cv_path_cp="$vi_cv_path_cp" # Let the user override the test with a path. ;; + ?:/*) + ac_cv_path_vi_cv_path_cp="$vi_cv_path_cp" # Let the user override the test with a dos path. + ;; *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_path_vi_cv_path_cp="$ac_dir/$ac_word" @@ -1111,6 +1454,7 @@ # Extract the first word of "ln", so it can be a program name with args. set dummy ln; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1458: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_vi_cv_path_ln'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1118,9 +1462,13 @@ /*) ac_cv_path_vi_cv_path_ln="$vi_cv_path_ln" # Let the user override the test with a path. ;; + ?:/*) + ac_cv_path_vi_cv_path_ln="$vi_cv_path_ln" # Let the user override the test with a dos path. + ;; *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_path_vi_cv_path_ln="$ac_dir/$ac_word" @@ -1142,6 +1490,7 @@ # Extract the first word of "mkdir", so it can be a program name with args. set dummy mkdir; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1494: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_vi_cv_path_mkdir'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1149,9 +1498,13 @@ /*) ac_cv_path_vi_cv_path_mkdir="$vi_cv_path_mkdir" # Let the user override the test with a path. ;; + ?:/*) + ac_cv_path_vi_cv_path_mkdir="$vi_cv_path_mkdir" # Let the user override the test with a dos path. + ;; *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_path_vi_cv_path_mkdir="$ac_dir/$ac_word" @@ -1173,6 +1526,7 @@ # Extract the first word of "rm", so it can be a program name with args. set dummy rm; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1530: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_vi_cv_path_rm'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1180,9 +1534,13 @@ /*) ac_cv_path_vi_cv_path_rm="$vi_cv_path_rm" # Let the user override the test with a path. ;; + ?:/*) + ac_cv_path_vi_cv_path_rm="$vi_cv_path_rm" # Let the user override the test with a dos path. + ;; *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_path_vi_cv_path_rm="$ac_dir/$ac_word" @@ -1204,6 +1562,7 @@ # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1566: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_vi_cv_path_strip'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1211,9 +1570,13 @@ /*) ac_cv_path_vi_cv_path_strip="$vi_cv_path_strip" # Let the user override the test with a path. ;; + ?:/*) + ac_cv_path_vi_cv_path_strip="$vi_cv_path_strip" # Let the user override the test with a dos path. + ;; *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_path_vi_cv_path_strip="$ac_dir/$ac_word" @@ -1234,6 +1597,7 @@ echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-soc-all@FreeBSD.ORG Wed May 18 19:29:38 2011 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id C9033106564A for ; Wed, 18 May 2011 19:29:36 +0000 (UTC) (envelope-from zy@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 18 May 2011 19:29:36 +0000 Date: Wed, 18 May 2011 19:29:36 +0000 From: zy@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20110518192936.C9033106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r222157 - in soc2011/zy/nvi-iconv/head/usr.bin/nvi: cl common ex include X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 May 2011 19:29:38 -0000 Author: zy Date: Wed May 18 19:29:36 2011 New Revision: 222157 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=222157 Log: Stops hiding O_DIRECTORY in fcntl.h; eliminates some warnings. Modified: soc2011/zy/nvi-iconv/head/usr.bin/nvi/cl/cl_funcs.c soc2011/zy/nvi-iconv/head/usr.bin/nvi/cl/cl_main.c soc2011/zy/nvi-iconv/head/usr.bin/nvi/common/exf.c soc2011/zy/nvi-iconv/head/usr.bin/nvi/common/options.c soc2011/zy/nvi-iconv/head/usr.bin/nvi/ex/ex_cscope.c soc2011/zy/nvi-iconv/head/usr.bin/nvi/ex/ex_tag.c soc2011/zy/nvi-iconv/head/usr.bin/nvi/include/options_def.h Modified: soc2011/zy/nvi-iconv/head/usr.bin/nvi/cl/cl_funcs.c ============================================================================== --- soc2011/zy/nvi-iconv/head/usr.bin/nvi/cl/cl_funcs.c Wed May 18 18:36:40 2011 (r222156) +++ soc2011/zy/nvi-iconv/head/usr.bin/nvi/cl/cl_funcs.c Wed May 18 19:29:36 2011 (r222157) @@ -24,7 +24,11 @@ #include #include #include +#ifdef HAVE_TERM_H +#include +#else #include +#endif #include #include "../common/common.h" Modified: soc2011/zy/nvi-iconv/head/usr.bin/nvi/cl/cl_main.c ============================================================================== --- soc2011/zy/nvi-iconv/head/usr.bin/nvi/cl/cl_main.c Wed May 18 18:36:40 2011 (r222156) +++ soc2011/zy/nvi-iconv/head/usr.bin/nvi/cl/cl_main.c Wed May 18 19:29:36 2011 (r222157) @@ -24,7 +24,11 @@ #include #include #include +#ifdef HAVE_TERM_H +#include +#else #include +#endif #include #include "../common/common.h" Modified: soc2011/zy/nvi-iconv/head/usr.bin/nvi/common/exf.c ============================================================================== --- soc2011/zy/nvi-iconv/head/usr.bin/nvi/common/exf.c Wed May 18 18:36:40 2011 (r222156) +++ soc2011/zy/nvi-iconv/head/usr.bin/nvi/common/exf.c Wed May 18 19:29:36 2011 (r222157) @@ -187,10 +187,10 @@ */ oname = frp->name; if (LF_ISSET(FS_OPENERR) || oname == NULL || !exists) { - if (opts_empty(sp, O_DIRECTORY, 0)) + if (opts_empty(sp, O_TMPDIR, 0)) goto err; (void)snprintf(tname, sizeof(tname), - "%s/vi.XXXXXXXXXX", O_STR(sp, O_DIRECTORY)); + "%s/vi.XXXXXXXXXX", O_STR(sp, O_TMPDIR)); if ((fd = mkstemp(tname)) == -1) { msgq(sp, M_SYSERR, "237|Unable to create temporary file"); Modified: soc2011/zy/nvi-iconv/head/usr.bin/nvi/common/options.c ============================================================================== --- soc2011/zy/nvi-iconv/head/usr.bin/nvi/common/options.c Wed May 18 18:36:40 2011 (r222156) +++ soc2011/zy/nvi-iconv/head/usr.bin/nvi/common/options.c Wed May 18 19:29:36 2011 (r222157) @@ -64,7 +64,7 @@ {"columns", f_columns, OPT_NUM, OPT_NOSAVE}, /* O_COMMENT 4.4BSD */ {"comment", NULL, OPT_0BOOL, 0}, -/* O_DIRECTORY 4BSD */ +/* O_TMPDIR 4BSD */ {"directory", NULL, OPT_STR, 0}, /* O_EDCOMPATIBLE 4BSD */ {"edcompatible",NULL, OPT_0BOOL, 0}, @@ -244,7 +244,7 @@ {"aw", O_AUTOWRITE}, /* 4BSD */ {"bf", O_BEAUTIFY}, /* 4BSD */ {"co", O_COLUMNS}, /* 4.4BSD */ - {"dir", O_DIRECTORY}, /* 4BSD */ + {"dir", O_TMPDIR}, /* 4BSD */ {"eb", O_ERRORBELLS}, /* 4BSD */ {"ed", O_EDCOMPATIBLE}, /* 4BSD */ {"ex", O_EXRC}, /* System V (undocumented) */ @@ -347,7 +347,7 @@ */ (void)snprintf(b1, sizeof(b1), "directory=%s", (s = getenv("TMPDIR")) == NULL ? _PATH_TMP : s); - OI(O_DIRECTORY, b1); + OI(O_TMPDIR, b1); OI(O_ESCAPETIME, "escapetime=6"); OI(O_KEYTIME, "keytime=6"); OI(O_MATCHTIME, "matchtime=7"); Modified: soc2011/zy/nvi-iconv/head/usr.bin/nvi/ex/ex_cscope.c ============================================================================== --- soc2011/zy/nvi-iconv/head/usr.bin/nvi/ex/ex_cscope.c Wed May 18 18:36:40 2011 (r222156) +++ soc2011/zy/nvi-iconv/head/usr.bin/nvi/ex/ex_cscope.c Wed May 18 19:29:36 2011 (r222157) @@ -496,7 +496,7 @@ * search cscope command character and a leading space * there.) */ - (void)fprintf(csc->to_fp, "%d%s\n", search, tqp->tag + 2); + (void)fprintf(csc->to_fp, "%lu%s\n", search, tqp->tag + 2); (void)fflush(csc->to_fp); /* Read the output. */ Modified: soc2011/zy/nvi-iconv/head/usr.bin/nvi/ex/ex_tag.c ============================================================================== --- soc2011/zy/nvi-iconv/head/usr.bin/nvi/ex/ex_tag.c Wed May 18 18:36:40 2011 (r222156) +++ soc2011/zy/nvi-iconv/head/usr.bin/nvi/ex/ex_tag.c Wed May 18 19:29:36 2011 (r222157) @@ -1083,7 +1083,7 @@ * then only if we didn't find the tag. */ snprintf(command, sizeof(command), "global -%s '%s'", ref ? "rx" : "x", tag); - if (fp = popen(command, "r")) { + if ((fp = popen(command, "r"))) { while (fgets(buf, sizeof(buf), fp)) { if (buf[strlen(buf)-1] == '\n') /* chop(buf) */ buf[strlen(buf)-1] = 0; Modified: soc2011/zy/nvi-iconv/head/usr.bin/nvi/include/options_def.h ============================================================================== --- soc2011/zy/nvi-iconv/head/usr.bin/nvi/include/options_def.h Wed May 18 18:36:40 2011 (r222156) +++ soc2011/zy/nvi-iconv/head/usr.bin/nvi/include/options_def.h Wed May 18 19:29:36 2011 (r222157) @@ -8,7 +8,7 @@ #define O_CEDIT 7 #define O_COLUMNS 8 #define O_COMMENT 9 -#define O_DIRECTORY 10 +#define O_TMPDIR 10 #define O_EDCOMPATIBLE 11 #define O_ESCAPETIME 12 #define O_ERRORBELLS 13