From dc9db6e4a940b2e3e0fa8d73a677cfba1b3c69a1 Mon Sep 17 00:00:00 2001 From: Michael Emmi Date: Tue, 10 Jun 2014 01:28:36 +0200 Subject: [PATCH 001/140] Partial support for invoke & resume. --- include/smack/SmackInstGenerator.h | 6 +++--- include/smack/SmackRep.h | 3 ++- lib/smack/SmackInstGenerator.cpp | 33 ++++++++++++++++++++++++++++++ lib/smack/SmackRep.cpp | 14 +++++++++++-- 4 files changed, 50 insertions(+), 6 deletions(-) diff --git a/include/smack/SmackInstGenerator.h b/include/smack/SmackInstGenerator.h index 3aa99ad67..2e3b28c72 100644 --- a/include/smack/SmackInstGenerator.h +++ b/include/smack/SmackInstGenerator.h @@ -51,8 +51,8 @@ class SmackInstGenerator : public llvm::InstVisitor { void visitBranchInst(llvm::BranchInst& i); void visitSwitchInst(llvm::SwitchInst& i); // TODO implement indirectbr - // TODO implement invoke - // TODO implement resume + void visitInvokeInst(llvm::InvokeInst& i); + void visitResumeInst(llvm::ResumeInst& i); void visitUnreachableInst(llvm::UnreachableInst& i); void visitBinaryOperator(llvm::BinaryOperator& i); @@ -92,7 +92,7 @@ class SmackInstGenerator : public llvm::InstVisitor { void visitSelectInst(llvm::SelectInst& i); void visitCallInst(llvm::CallInst& i); // TODO implement va_arg - // TODO landingpad + void visitLandingPadInst(llvm::LandingPadInst& i); void visitMemCpyInst(llvm::MemCpyInst& i); void visitMemSetInst(llvm::MemSetInst& i); diff --git a/include/smack/SmackRep.h b/include/smack/SmackRep.h index 6d64c429f..daa23fbbf 100644 --- a/include/smack/SmackRep.h +++ b/include/smack/SmackRep.h @@ -30,6 +30,7 @@ class SmackRep { public: static const string BLOCK_LBL; static const string RET_VAR; + static const string EXN_VAR; static const string BOOL_VAR; static const string FLOAT_VAR; static const string PTR_VAR; @@ -196,7 +197,7 @@ class SmackRep { const Expr* pred(llvm::CmpInst& ci); const Expr* arg(llvm::Function* f, unsigned pos, llvm::Value* v); - const Stmt* call(llvm::Function* f, llvm::CallInst& ci); + const Stmt* call(llvm::Function* f, llvm::User& u); string code(llvm::CallInst& ci); ProcDecl* proc(llvm::Function* f, int n); diff --git a/lib/smack/SmackInstGenerator.cpp b/lib/smack/SmackInstGenerator.cpp index a0c9f289d..7a73c9b59 100644 --- a/lib/smack/SmackInstGenerator.cpp +++ b/lib/smack/SmackInstGenerator.cpp @@ -148,6 +148,7 @@ void SmackInstGenerator::visitReturnInst(llvm::ReturnInst& ri) { currBlock->addStmt(Stmt::assign( Expr::id(SmackRep::RET_VAR), rep.expr(v))); + currBlock->addStmt(Stmt::assign(Expr::id(SmackRep::EXN_VAR), Expr::lit(false))); currBlock->addStmt(Stmt::return_()); } @@ -211,6 +212,32 @@ void SmackInstGenerator::visitSwitchInst(llvm::SwitchInst& si) { generateGotoStmts(si, targets); } +void SmackInstGenerator::visitInvokeInst(llvm::InvokeInst& ii) { + processInstruction(ii); + llvm::Function* f = ii.getCalledFunction(); + if (f) { + currBlock->addStmt(rep.call(f, ii)); + } else { + assert(false && "unexpected invoke instruction."); + } + vector > targets; + targets.push_back(make_pair( + Expr::not_(Expr::id(SmackRep::EXN_VAR)), + blockMap[ii.getUnwindDest()]->getName())); + targets.push_back(make_pair( + Expr::id(SmackRep::EXN_VAR), + blockMap[ii.getUnwindDest()]->getName())); + generateGotoStmts(ii, targets); +} + +void SmackInstGenerator::visitResumeInst(llvm::ResumeInst& ri) { + processInstruction(ri); + // TODO set a return variable indication exceptional flow + WARN("unsoundly ignoring value of resume instruction: " + i2s(ri)); + currBlock->addStmt(Stmt::assign(Expr::id(SmackRep::EXN_VAR), Expr::lit(true))); + currBlock->addStmt(Stmt::return_()); +} + void SmackInstGenerator::visitUnreachableInst(llvm::UnreachableInst& ii) { processInstruction(ii); @@ -554,6 +581,12 @@ void SmackInstGenerator::visitCallInst(llvm::CallInst& ci) { currBlock->addStmt(Stmt::assume(Expr::fn("$isExternal",rep.expr(&ci)))); } +void SmackInstGenerator::visitLandingPadInst(llvm::LandingPadInst& lpi) { + processInstruction(lpi); + // TODO what exactly!? + WARN("unsoundly ignoring landingpad instruction: " + i2s(lpi)); +} + /******************************************************************************/ /* INTRINSIC FUNCTIONS */ /******************************************************************************/ diff --git a/lib/smack/SmackRep.cpp b/lib/smack/SmackRep.cpp index 7450724df..5c75c4823 100644 --- a/lib/smack/SmackRep.cpp +++ b/lib/smack/SmackRep.cpp @@ -12,6 +12,7 @@ namespace smack { const string SmackRep::BLOCK_LBL = "$bb"; const string SmackRep::RET_VAR = "$r"; +const string SmackRep::EXN_VAR = "$ex"; const string SmackRep::BOOL_VAR = "$b"; const string SmackRep::FLOAT_VAR = "$f"; const string SmackRep::PTR_VAR = "$p"; @@ -729,6 +730,7 @@ ProcDecl* SmackRep::proc(llvm::Function* f, int nargs) { if (!f->getReturnType()->isVoidTy()) rets.push_back(make_pair(RET_VAR,type(f->getReturnType()))); + rets.push_back(make_pair(EXN_VAR,BOOL_TYPE)); return (ProcDecl*) Decl::procedure( *program, @@ -742,19 +744,27 @@ const Expr* SmackRep::arg(llvm::Function* f, unsigned pos, llvm::Value* v) { return (f && f->isVarArg() && isFloat(v)) ? fp2si(v) : expr(v); } -const Stmt* SmackRep::call(llvm::Function* f, llvm::CallInst& ci) { +const Stmt* SmackRep::call(llvm::Function* f, llvm::User& ci) { + using namespace llvm; assert(f && "Call encountered unresolved function."); string name = id(f); vector args; vector rets; + + unsigned num_arg_operands = ci.getNumOperands(); + if (isa(ci)) + num_arg_operands -= 1; + else if (isa(ci)) + num_arg_operands -= 3; - for (unsigned i = 0; i < ci.getNumOperands() - 1; i++) + for (unsigned i = 0; i < num_arg_operands; i++) args.push_back(arg(f, i, ci.getOperand(i))); if (!ci.getType()->isVoidTy()) rets.push_back(id(&ci)); + rets.push_back(EXN_VAR); if (name == "malloc") { assert(args.size() == 1); From d695417712f95dd8a23e9e06a784b49a711ae978 Mon Sep 17 00:00:00 2001 From: Michael Emmi Date: Mon, 16 Jun 2014 00:27:42 +0200 Subject: [PATCH 002/140] Better matching for built-in names. --- lib/smack/SmackInstGenerator.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/smack/SmackInstGenerator.cpp b/lib/smack/SmackInstGenerator.cpp index 7a73c9b59..bc2120fa3 100644 --- a/lib/smack/SmackInstGenerator.cpp +++ b/lib/smack/SmackInstGenerator.cpp @@ -491,16 +491,16 @@ void SmackInstGenerator::visitCallInst(llvm::CallInst& ci) { WARN("ignoring llvm.debug call."); currBlock->addStmt(Stmt::skip()); - } else if (f && rep.id(f) == "__SMACK_mod") { + } else if (f && rep.id(f).find("__SMACK_mod") != string::npos) { proc.addMod(rep.code(ci)); - } else if (f && rep.id(f) == "__SMACK_code") { + } else if (f && rep.id(f).find("__SMACK_code") != string::npos) { currBlock->addStmt(Stmt::code(rep.code(ci))); - } else if (f && rep.id(f) == "__SMACK_decl") { + } else if (f && rep.id(f).find("__SMACK_decl") != string::npos) { proc.addDecl(Decl::code(rep.code(ci))); - } else if (f && rep.id(f) == "__SMACK_top_decl") { + } else if (f && rep.id(f).find("__SMACK_top_decl") != string::npos) { string decl = rep.code(ci); proc.getProg().addDecl(Decl::code(decl)); if (VAR_DECL.match(decl)) { From 7bc60189420e3163ac20cb16e31265f05000bb05 Mon Sep 17 00:00:00 2001 From: Michael Emmi Date: Wed, 18 Jun 2014 01:17:05 +0200 Subject: [PATCH 003/140] Initial implementation for insert/extractvalue. --- include/smack/SmackInstGenerator.h | 4 ++-- include/smack/SmackRep.h | 2 ++ include/smack/smack.h | 2 ++ lib/smack/SmackInstGenerator.cpp | 31 ++++++++++++++++++++++++++---- lib/smack/SmackRep.cpp | 4 ++++ 5 files changed, 37 insertions(+), 6 deletions(-) diff --git a/include/smack/SmackInstGenerator.h b/include/smack/SmackInstGenerator.h index 2e3b28c72..69603d50e 100644 --- a/include/smack/SmackInstGenerator.h +++ b/include/smack/SmackInstGenerator.h @@ -61,8 +61,8 @@ class SmackInstGenerator : public llvm::InstVisitor { // TODO implement insertelement // TODO implement shufflevector - // TODO implement extractvalue - // TODO implement insertvalue + void visitExtractValueInst(llvm::ExtractValueInst& i); + void visitInsertValueInst(llvm::InsertValueInst& i); void visitAllocaInst(llvm::AllocaInst& i); void visitLoadInst(llvm::LoadInst& i); diff --git a/include/smack/SmackRep.h b/include/smack/SmackRep.h index daa23fbbf..09c358436 100644 --- a/include/smack/SmackRep.h +++ b/include/smack/SmackRep.h @@ -232,6 +232,8 @@ class SmackRep { virtual string memcpyProc(int dstReg, int srcReg); virtual string memsetProc(int dstReg); + + const Expr* extractValue(const llvm::Value* v, unsigned idx); }; class RegionCollector : public llvm::InstVisitor { diff --git a/include/smack/smack.h b/include/smack/smack.h index ef6509d66..3afbde4f0 100644 --- a/include/smack/smack.h +++ b/include/smack/smack.h @@ -269,6 +269,8 @@ void __SMACK_decls() { "ensures n >= 0 ==> (forall q: int :: {$obj(q)} p <= q && q < p+n ==> $obj(q) == p);"); #endif + D("function $ev(p: int, i: int) returns (int);"); + #undef D } diff --git a/lib/smack/SmackInstGenerator.cpp b/lib/smack/SmackInstGenerator.cpp index bc2120fa3..9f3dc21f7 100644 --- a/lib/smack/SmackInstGenerator.cpp +++ b/lib/smack/SmackInstGenerator.cpp @@ -218,7 +218,8 @@ void SmackInstGenerator::visitInvokeInst(llvm::InvokeInst& ii) { if (f) { currBlock->addStmt(rep.call(f, ii)); } else { - assert(false && "unexpected invoke instruction."); + // assert(false && "unexpected invoke instruction."); + WARN("unsoundly ignoring invoke instruction... "); } vector > targets; targets.push_back(make_pair( @@ -233,7 +234,7 @@ void SmackInstGenerator::visitInvokeInst(llvm::InvokeInst& ii) { void SmackInstGenerator::visitResumeInst(llvm::ResumeInst& ri) { processInstruction(ri); // TODO set a return variable indication exceptional flow - WARN("unsoundly ignoring value of resume instruction: " + i2s(ri)); + WARN("unsoundly ignoring value of resume instruction... "); currBlock->addStmt(Stmt::assign(Expr::id(SmackRep::EXN_VAR), Expr::lit(true))); currBlock->addStmt(Stmt::return_()); } @@ -263,7 +264,29 @@ void SmackInstGenerator::visitBinaryOperator(llvm::BinaryOperator& bo) { /* AGGREGATE OPERATIONS */ /******************************************************************************/ -// TODO implement aggregate operations +void SmackInstGenerator::visitExtractValueInst(llvm::ExtractValueInst& i) { + processInstruction(i); + assert (i.getNumIndices() == 1); + unsigned idx = i.getIndices()[0]; + currBlock->addStmt(Stmt::assign(rep.expr(&i), + rep.extractValue(i.getAggregateOperand(),idx))); +} + +void SmackInstGenerator::visitInsertValueInst(llvm::InsertValueInst& i) { + processInstruction(i); + llvm::StructType* t = llvm::dyn_cast(i.getType()); + assert (t != NULL); + assert (i.getNumIndices() == 1); + unsigned idx = i.getIndices()[0]; + + for (unsigned j = 0; j < t->getNumElements(); j++) + currBlock->addStmt(Stmt::assume(Expr::eq( + rep.extractValue(&i,j), + j == idx + ? rep.expr(i.getInsertedValueOperand()) + : rep.extractValue(i.getAggregateOperand(),j) + ))); +} /******************************************************************************/ /* MEMORY ACCESS AND ADDRESSING OPERATIONS */ @@ -584,7 +607,7 @@ void SmackInstGenerator::visitCallInst(llvm::CallInst& ci) { void SmackInstGenerator::visitLandingPadInst(llvm::LandingPadInst& lpi) { processInstruction(lpi); // TODO what exactly!? - WARN("unsoundly ignoring landingpad instruction: " + i2s(lpi)); + WARN("unsoundly ignoring landingpad instruction..."); } /******************************************************************************/ diff --git a/lib/smack/SmackRep.cpp b/lib/smack/SmackRep.cpp index 5c75c4823..b48047b09 100644 --- a/lib/smack/SmackRep.cpp +++ b/lib/smack/SmackRep.cpp @@ -1024,5 +1024,9 @@ string SmackRep::memsetProc(int dstReg) { return s.str(); } +const Expr* SmackRep::extractValue(const llvm::Value* v, unsigned idx) { + return Expr::fn("$ev",expr(v),Expr::lit((int)idx)); +} + } // namespace smack From 5ac950ec5e74a2b1c7df08d56f9c73f6f533e775 Mon Sep 17 00:00:00 2001 From: Michael Emmi Date: Wed, 18 Jun 2014 23:38:40 +0200 Subject: [PATCH 004/140] Better implementation of new features: * `extractvalue` and `insertvalue` are fully handled. * `resume` value propagated to `landingpad`. * exception variable is global, to avoid return parameter conflicts. --- include/smack/SmackRep.h | 3 +- include/smack/smack.h | 4 +- lib/smack/SmackInstGenerator.cpp | 68 +++++++++++++++++++++----------- lib/smack/SmackRep.cpp | 9 +---- 4 files changed, 50 insertions(+), 34 deletions(-) diff --git a/include/smack/SmackRep.h b/include/smack/SmackRep.h index 09c358436..f8d50bbbe 100644 --- a/include/smack/SmackRep.h +++ b/include/smack/SmackRep.h @@ -31,6 +31,7 @@ class SmackRep { static const string BLOCK_LBL; static const string RET_VAR; static const string EXN_VAR; + static const string EXN_VAL_VAR; static const string BOOL_VAR; static const string FLOAT_VAR; static const string PTR_VAR; @@ -232,8 +233,6 @@ class SmackRep { virtual string memcpyProc(int dstReg, int srcReg); virtual string memsetProc(int dstReg); - - const Expr* extractValue(const llvm::Value* v, unsigned idx); }; class RegionCollector : public llvm::InstVisitor { diff --git a/include/smack/smack.h b/include/smack/smack.h index 3afbde4f0..72ae615c8 100644 --- a/include/smack/smack.h +++ b/include/smack/smack.h @@ -269,7 +269,9 @@ void __SMACK_decls() { "ensures n >= 0 ==> (forall q: int :: {$obj(q)} p <= q && q < p+n ==> $obj(q) == p);"); #endif - D("function $ev(p: int, i: int) returns (int);"); + D("var $exn: bool;"); + D("var $exnv: int;"); + D("function $extractvalue(p: int, i: int) returns (int);"); #undef D } diff --git a/lib/smack/SmackInstGenerator.cpp b/lib/smack/SmackInstGenerator.cpp index 9f3dc21f7..8f80dd3a3 100644 --- a/lib/smack/SmackInstGenerator.cpp +++ b/lib/smack/SmackInstGenerator.cpp @@ -233,9 +233,8 @@ void SmackInstGenerator::visitInvokeInst(llvm::InvokeInst& ii) { void SmackInstGenerator::visitResumeInst(llvm::ResumeInst& ri) { processInstruction(ri); - // TODO set a return variable indication exceptional flow - WARN("unsoundly ignoring value of resume instruction... "); currBlock->addStmt(Stmt::assign(Expr::id(SmackRep::EXN_VAR), Expr::lit(true))); + currBlock->addStmt(Stmt::assign(Expr::id(SmackRep::EXN_VAL_VAR), rep.expr(ri.getValue()))); currBlock->addStmt(Stmt::return_()); } @@ -264,28 +263,46 @@ void SmackInstGenerator::visitBinaryOperator(llvm::BinaryOperator& bo) { /* AGGREGATE OPERATIONS */ /******************************************************************************/ -void SmackInstGenerator::visitExtractValueInst(llvm::ExtractValueInst& i) { - processInstruction(i); - assert (i.getNumIndices() == 1); - unsigned idx = i.getIndices()[0]; - currBlock->addStmt(Stmt::assign(rep.expr(&i), - rep.extractValue(i.getAggregateOperand(),idx))); -} - -void SmackInstGenerator::visitInsertValueInst(llvm::InsertValueInst& i) { - processInstruction(i); - llvm::StructType* t = llvm::dyn_cast(i.getType()); - assert (t != NULL); - assert (i.getNumIndices() == 1); - unsigned idx = i.getIndices()[0]; +void SmackInstGenerator::visitExtractValueInst(llvm::ExtractValueInst& evi) { + processInstruction(evi); + const Expr* e = rep.expr(evi.getAggregateOperand()); + for (unsigned i = 0; i < evi.getNumIndices(); i++) + e = Expr::fn("$extractvalue", e, Expr::lit((int)evi.getIndices()[i])); + currBlock->addStmt(Stmt::assign(rep.expr(&evi),e)); +} + +void SmackInstGenerator::visitInsertValueInst(llvm::InsertValueInst& ivi) { + processInstruction(ivi); + const Expr* old = rep.expr(ivi.getAggregateOperand()); + const Expr* res = rep.expr(&ivi); + const llvm::Type* t = ivi.getType(); + + for (unsigned i = 0; i < ivi.getNumIndices(); i++) { + unsigned idx = ivi.getIndices()[i]; + + unsigned num_elements; + if (const llvm::StructType* st = llvm::dyn_cast(t)) { + num_elements = st->getNumElements(); + t = st->getElementType(idx); + } else if (const llvm::ArrayType* at = llvm::dyn_cast(t)) { + num_elements = at->getNumElements(); + t = at->getElementType(); + } else { + assert (false && "Unexpected aggregate type"); + } - for (unsigned j = 0; j < t->getNumElements(); j++) - currBlock->addStmt(Stmt::assume(Expr::eq( - rep.extractValue(&i,j), - j == idx - ? rep.expr(i.getInsertedValueOperand()) - : rep.extractValue(i.getAggregateOperand(),j) - ))); + for (unsigned j = 0; j < num_elements; j++) { + if (j != idx) { + currBlock->addStmt(Stmt::assume(Expr::eq( + Expr::fn("$extractvalue", res, Expr::lit((int)j)), + Expr::fn("$extractvalue", old, Expr::lit((int)j)) + ))); + } + } + res = Expr::fn("$extractvalue", res, Expr::lit((int)idx)); + old = Expr::fn("$extractvalue", old, Expr::lit((int)idx)); + } + currBlock->addStmt(Stmt::assume(Expr::eq(res,rep.expr(ivi.getInsertedValueOperand())))); } /******************************************************************************/ @@ -607,7 +624,10 @@ void SmackInstGenerator::visitCallInst(llvm::CallInst& ci) { void SmackInstGenerator::visitLandingPadInst(llvm::LandingPadInst& lpi) { processInstruction(lpi); // TODO what exactly!? - WARN("unsoundly ignoring landingpad instruction..."); + currBlock->addStmt(Stmt::assign(rep.expr(&lpi),Expr::id(SmackRep::EXN_VAL_VAR))); + if (lpi.isCleanup()) + currBlock->addStmt(Stmt::assign(Expr::id(SmackRep::EXN_VAR),Expr::lit(false))); + WARN("unsoundly ignoring landingpad clauses..."); } /******************************************************************************/ diff --git a/lib/smack/SmackRep.cpp b/lib/smack/SmackRep.cpp index b48047b09..3176a6214 100644 --- a/lib/smack/SmackRep.cpp +++ b/lib/smack/SmackRep.cpp @@ -12,7 +12,8 @@ namespace smack { const string SmackRep::BLOCK_LBL = "$bb"; const string SmackRep::RET_VAR = "$r"; -const string SmackRep::EXN_VAR = "$ex"; +const string SmackRep::EXN_VAR = "$exn"; +const string SmackRep::EXN_VAL_VAR = "$exnv"; const string SmackRep::BOOL_VAR = "$b"; const string SmackRep::FLOAT_VAR = "$f"; const string SmackRep::PTR_VAR = "$p"; @@ -730,7 +731,6 @@ ProcDecl* SmackRep::proc(llvm::Function* f, int nargs) { if (!f->getReturnType()->isVoidTy()) rets.push_back(make_pair(RET_VAR,type(f->getReturnType()))); - rets.push_back(make_pair(EXN_VAR,BOOL_TYPE)); return (ProcDecl*) Decl::procedure( *program, @@ -764,7 +764,6 @@ const Stmt* SmackRep::call(llvm::Function* f, llvm::User& ci) { if (!ci.getType()->isVoidTy()) rets.push_back(id(&ci)); - rets.push_back(EXN_VAR); if (name == "malloc") { assert(args.size() == 1); @@ -1024,9 +1023,5 @@ string SmackRep::memsetProc(int dstReg) { return s.str(); } -const Expr* SmackRep::extractValue(const llvm::Value* v, unsigned idx) { - return Expr::fn("$ev",expr(v),Expr::lit((int)idx)); -} - } // namespace smack From 6accbd2d1e22bbec263f0a439316706c4c2bd7d1 Mon Sep 17 00:00:00 2001 From: Michael Emmi Date: Mon, 23 Jun 2014 23:45:02 +0200 Subject: [PATCH 005/140] Adjusted scripts to handle C++ files. --- bin/smackgen.py | 15 +++++++++++++-- test/Makefile | 12 ++++++++++-- test/regtest.py | 12 +++++++++++- 3 files changed, 34 insertions(+), 5 deletions(-) diff --git a/bin/smackgen.py b/bin/smackgen.py index bbcf9eac1..9d8d9bdac 100755 --- a/bin/smackgen.py +++ b/bin/smackgen.py @@ -51,8 +51,15 @@ def clang(scriptPathName, inputFile, memoryModel, clangArgs): smackHeaders = path.join(smackRoot, 'include', 'smack') fileName = path.splitext(inputFile.name)[0] + fileExtension = path.splitext(inputFile.name)[1] + + if fileExtension in ['.c']: + clangCommand = ['clang'] + elif fileExtension in ['.cc', '.cpp']: + clangCommand = ['clang++'] + else: + sys.exit('Unexpected source file extension `' + fileExtension + '\'') - clangCommand = ['clang'] clangCommand += ['-c', '-emit-llvm', '-O0', '-g', '-DMEMORY_MODEL_' + memoryModel.upper().replace('-','_'), '-I' + smackHeaders] @@ -79,7 +86,7 @@ def smackGenerate(sysArgv): fileExtension = path.splitext(inputFile.name)[1] options = [] - if fileExtension == '.c': + if fileExtension in ['.c','.cc','.cpp']: # if input file is .c, then search for options in comments and compile it with clang lines = inputFile.readlines() for line in lines: @@ -88,6 +95,10 @@ def smackGenerate(sysArgv): options = optionsMatch.group(1).split() args = parser.parse_args(options + sysArgv[1:]) inputFile = clang(scriptPathName, inputFile, args.memmod, args.clang) + elif fileExtension in ['.bc', '.ll']: + pass # do nothing + else: + sys.exit('Unexpected source file extension `' + fileExtension + '\'') bpl = llvm2bpl(inputFile, args.debug, "impls" in args.memmod) inputFile.close() diff --git a/test/Makefile b/test/Makefile index 57ec322fc..2eb818405 100644 --- a/test/Makefile +++ b/test/Makefile @@ -1,8 +1,10 @@ CC = clang +CPP = clang++ INC = ../include/smack CFLAGS = -c -Wall -emit-llvm -O0 -g -I$(INC) -SOURCES = simple.c simple_fail.c \ +SOURCES = hello.cc hello_fail.cc \ + simple.c simple_fail.c \ simple_pre.c simple_pre_fail.c \ simple_pre1.c simple_pre1_fail.c \ simple_pre2.c simple_pre2_fail.c \ @@ -50,13 +52,19 @@ SOURCES = simple.c simple_fail.c \ two_arrays5.c \ two_arrays6.c two_arrays6_fail.c -BITCODE = $(SOURCES:.c=.bc) +BITCODE = $(SOURCES:.c=.bc) $(SOURCES:.cc=.bc) $(SOURCES:.cpp=.bc) all: $(BITCODE) %.bc: %.c $(CC) $(CFLAGS) $< -o $@ +%.bc: %.cc + $(CPP) $(CFLAGS) $< -o $@ + +%.bc: %.cpp + $(CPP) $(CFLAGS) $< -o $@ + clean: rm -f *.bc *.bpl diff --git a/test/regtest.py b/test/regtest.py index 28c5cc8fc..203e91b7b 100755 --- a/test/regtest.py +++ b/test/regtest.py @@ -3,9 +3,12 @@ import subprocess import re import time +import os.path # list of regression tests with the expected outputs tests = [ + ('hello', r'1 verified, 0 errors?', 2), + ('hello_fail', r'0 verified, 1 errors?', 2), ('simple', r'1 verified, 0 errors?', 2), ('simple_fail', r'0 verified, 1 errors?', 2), ('simple_pre', r'1 verified, 0 errors?', 2), @@ -102,9 +105,16 @@ def runtests(): print "{0:>20} {1:>16}:".format(test[0], "(" + mem + ")"), + if os.path.isfile(test[0] + '.c'): + sourceFile = test[0] + '.c' + elif os.path.isfile(test[0] + '.cc'): + sourceFile = test[0] + '.cc' + elif os.path.isfile(test[0] + '.cpp'): + sourceFile = test[0] + '.cpp' + # invoke SMACK t0 = time.time() - p = subprocess.Popen(['smack-verify.py', test[0] + '.c', '--verifier=boogie-inline', + p = subprocess.Popen(['smack-verify.py', sourceFile, '--verifier=boogie-inline', '--unroll=' + str(test[2]), '--mem-mod=' + mem, '-o', test[0] +'.bpl'], stdout=subprocess.PIPE) From 235a1e2f26fb58c6e96d82e2f351f26f3adca874 Mon Sep 17 00:00:00 2001 From: Michael Emmi Date: Mon, 23 Jun 2014 23:45:53 +0200 Subject: [PATCH 006/140] Added new (C++) tests. --- test/hello.cc | 9 +++++++++ test/hello_fail.cc | 9 +++++++++ 2 files changed, 18 insertions(+) create mode 100644 test/hello.cc create mode 100644 test/hello_fail.cc diff --git a/test/hello.cc b/test/hello.cc new file mode 100644 index 000000000..0e8fe4bb1 --- /dev/null +++ b/test/hello.cc @@ -0,0 +1,9 @@ +#include +#include + +int main() +{ + std::cout << "Hello, world!" << std::endl; + __SMACK_assert(true); + return 0; +} diff --git a/test/hello_fail.cc b/test/hello_fail.cc new file mode 100644 index 000000000..521dc24a5 --- /dev/null +++ b/test/hello_fail.cc @@ -0,0 +1,9 @@ +#include +#include + +int main() +{ + std::cout << "Hello, world!" << std::endl; + __SMACK_assert(false); + return 0; +} From 168331ad67d3b7dc23976f9355f2648681c23c59 Mon Sep 17 00:00:00 2001 From: Michael Emmi Date: Tue, 24 Jun 2014 21:10:19 +0200 Subject: [PATCH 007/140] Ridiculous typo bug in invoke instruction. --- lib/smack/SmackInstGenerator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/smack/SmackInstGenerator.cpp b/lib/smack/SmackInstGenerator.cpp index 8f80dd3a3..4ba0cf153 100644 --- a/lib/smack/SmackInstGenerator.cpp +++ b/lib/smack/SmackInstGenerator.cpp @@ -224,7 +224,7 @@ void SmackInstGenerator::visitInvokeInst(llvm::InvokeInst& ii) { vector > targets; targets.push_back(make_pair( Expr::not_(Expr::id(SmackRep::EXN_VAR)), - blockMap[ii.getUnwindDest()]->getName())); + blockMap[ii.getNormalDest()]->getName())); targets.push_back(make_pair( Expr::id(SmackRep::EXN_VAR), blockMap[ii.getUnwindDest()]->getName())); From da624cfe4c091af6816c3a59958a912226f692d4 Mon Sep 17 00:00:00 2001 From: Michael Emmi Date: Thu, 10 Jul 2014 16:44:45 +0200 Subject: [PATCH 008/140] Ignoring static inits of X86 floating points. --- lib/smack/SmackRep.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/smack/SmackRep.cpp b/lib/smack/SmackRep.cpp index 3176a6214..9257945ef 100644 --- a/lib/smack/SmackRep.cpp +++ b/lib/smack/SmackRep.cpp @@ -884,6 +884,9 @@ void SmackRep::addInit(unsigned region, const Expr* addr, const llvm::Constant* addInit( region, pa(addr,fieldOffset(st,i),1), elem ); } + } else if (val->getType()->isX86_FP80Ty()) { + staticInits.push_back(Stmt::code("// ignored X86 FP80 initializer")); + } else { assert (false && "Unexpected static initializer."); } From f276b2402998c85c962cb2b47272046d72b34b16 Mon Sep 17 00:00:00 2001 From: Michael Emmi Date: Wed, 23 Jul 2014 02:54:35 +0200 Subject: [PATCH 009/140] First steps to adding code contracts. * Cleaned up code generation visitor. * Generalized code generation to include code expressions. * Added prototypes for `requires`, `ensures`, `forall`, etc. * Collection of specifications. * TODO slicing for argument values to `requires` and `ensures`. --- include/smack/BoogieAst.h | 97 ++++++++++++++++++------------ include/smack/SmackInstGenerator.h | 32 +++++----- include/smack/smack.h | 7 +++ lib/smack/BoogieAst.cpp | 8 +++ lib/smack/SmackInstGenerator.cpp | 41 +++++++------ lib/smack/SmackModuleGenerator.cpp | 95 +++++++++++++++++++---------- lib/smack/SmackRep.cpp | 2 +- 7 files changed, 174 insertions(+), 108 deletions(-) diff --git a/include/smack/BoogieAst.h b/include/smack/BoogieAst.h index 62b52a575..89e1a1684 100644 --- a/include/smack/BoogieAst.h +++ b/include/smack/BoogieAst.h @@ -15,7 +15,6 @@ namespace smack { using namespace std; -class Block; class Program; class Expr { @@ -355,20 +354,71 @@ class VarDecl : public Decl { void print(ostream& os) const; }; -class ProcDecl : public Decl { +class Block { + string name; + vector stmts; +public: + Block() : name("") {} + Block(string n) : name(n) {} + void print(ostream& os) const; + void insert(const Stmt* s) { + stmts.insert(stmts.begin(), s); + } + void addStmt(const Stmt* s) { + stmts.push_back(s); + } + string getName() { + return name; + } +}; + +class CodeContainer { +protected: Program& prog; + set decls; + vector blocks; + vector mods; + CodeContainer(Program& p) : prog(p) {} +public: + Program& getProg() const { + return prog; + } + void addDecl(Decl* d) { + decls.insert(d); + } + void insert(const Stmt* s) { + blocks.front()->insert(s); + } + void addBlock(Block* b) { + blocks.push_back(b); + } + bool hasBody() { + return decls.size() > 0 || blocks.size() > 0; + } + void addMod(string m) { + mods.push_back(m); + } + void addMods(vector ms) { + for (unsigned i = 0; i < ms.size(); i++) + addMod(ms[i]); + } +}; + +class CodeExpr : public Expr, public CodeContainer { +public: + CodeExpr(Program& p) : CodeContainer(p) {} + void print(ostream& os) const; +}; + +class ProcDecl : public Decl, public CodeContainer { vector< pair > params; vector< pair > rets; - vector mods; vector requires; vector ensures; - set decls; - vector blocks; public: ProcDecl(Program& p, string n, vector< pair > ps, vector< pair > rs) - : Decl(n), prog(p), params(ps), rets(rs) {} + : Decl(n), CodeContainer(p), params(ps), rets(rs) {} kind getKind() const { return PROC; } - Program& getProg() const { return prog; } void addParam(string x, string t) { params.push_back(make_pair(x, t)); } @@ -378,28 +428,12 @@ class ProcDecl : public Decl { vector< pair > getRets() { return rets; } - void addMod(string m) { - mods.push_back(m); - } - void addMods(vector ms) { - for (unsigned i = 0; i < ms.size(); i++) - addMod(ms[i]); - } void addRequires(const Expr* e) { requires.push_back(e); } void addEnsures(const Expr* e) { ensures.push_back(e); } - void addDecl(Decl* d) { - decls.insert(d); - } - void addBlock(Block* b) { - blocks.push_back(b); - } - bool hasBody() { - return decls.size() > 0 || blocks.size() > 0; - } void print(ostream& os) const; }; @@ -410,23 +444,6 @@ class CodeDecl : public Decl { void print(ostream& os) const; }; -class Block { - ProcDecl& proc; - string name; - vector stmts; -public: - Block(ProcDecl& p) : proc(p), name("") {} - Block(ProcDecl& p, string n) : proc(p), name(n) {} - void print(ostream& os) const; - ProcDecl& getProc() const { return proc; } - void addStmt(const Stmt* s) { - stmts.push_back(s); - } - string getName() { - return name; - } -}; - class Program { // TODO While I would prefer that a program is just a set or sequence of // declarations, putting the Prelude in a CodeDeclaration does not work, diff --git a/include/smack/SmackInstGenerator.h b/include/smack/SmackInstGenerator.h index 3aa99ad67..5408f3070 100644 --- a/include/smack/SmackInstGenerator.h +++ b/include/smack/SmackInstGenerator.h @@ -16,12 +16,16 @@ class SmackInstGenerator : public llvm::InstVisitor { private: SmackRep& rep; - ProcDecl& proc; + CodeContainer& proc; Block* currBlock; - map& blockMap; + map blockMap; int blockNum; int varNum; + string createVar(); + Block* createBlock(); + Block* getBlock(llvm::BasicBlock* bb); + void generatePhiAssigns(llvm::TerminatorInst& i); void generateGotoStmts(llvm::Instruction& i, vector > target); @@ -29,22 +33,16 @@ class SmackInstGenerator : public llvm::InstVisitor { void nameInstruction(llvm::Instruction& i); void annotate(llvm::Instruction& i, Block* b); -public: - SmackInstGenerator(SmackRep& r, ProcDecl& p, - map& bm) - : rep(r), proc(p), - blockMap(bm), blockNum(0), varNum(0) {} - - Block* createBlock(); - void setCurrBlock(Block* b) { - currBlock = b; - } - Block* getCurrBlock() { - return currBlock; - } - - string createVar(); + void addDecl(Decl* d) { proc.addDecl(d); } + void addMod(string x) { proc.addMod(x); } + void addTopDecl(Decl* d) { proc.getProg().addDecl(d); } + void addBlock(Block* b) { proc.addBlock(b); } +public: + SmackInstGenerator(SmackRep& r, CodeContainer& p) + : rep(r), proc(p), blockNum(0), varNum(0) {} + + void visitBasicBlock(llvm::BasicBlock& bb); void visitInstruction(llvm::Instruction& i); void visitReturnInst(llvm::ReturnInst& i); diff --git a/include/smack/smack.h b/include/smack/smack.h index ef6509d66..d2a2d8984 100644 --- a/include/smack/smack.h +++ b/include/smack/smack.h @@ -45,6 +45,13 @@ void __SMACK_assume(bool v) { __SMACK_code("assume {@} != 0;", v); } +void requires(bool expr); +void ensures(bool expr); + +int forall(const char *var, bool expr); +int exists(const char *var, bool expr); +int var(const char *var); + //// PROBLEM: in the 2D memory model, the declaration of boogie_si_record_int //// should have a type $ptr parameter, not an int. How should we do this? // void __SMACK_record_int(int i) { diff --git a/lib/smack/BoogieAst.cpp b/lib/smack/BoogieAst.cpp index b4b1d190a..ef81dbcdd 100644 --- a/lib/smack/BoogieAst.cpp +++ b/lib/smack/BoogieAst.cpp @@ -457,6 +457,14 @@ void VarExpr::print(ostream& os) const { os << var; } +void CodeExpr::print(ostream& os) const { + os << "|{" << endl; + if (decls.size() > 0) + print_set(os, decls, " ", "\n ", "\n"); + print_seq(os, blocks, "\n"); + os << endl << "}|"; +} + void StrVal::print(ostream& os) const { os << "\"" << val << "\""; } diff --git a/lib/smack/SmackInstGenerator.cpp b/lib/smack/SmackInstGenerator.cpp index a0c9f289d..192a04aa3 100644 --- a/lib/smack/SmackInstGenerator.cpp +++ b/lib/smack/SmackInstGenerator.cpp @@ -39,8 +39,8 @@ string i2s(llvm::Instruction& i) { Block* SmackInstGenerator::createBlock() { stringstream s; s << SmackRep::BLOCK_LBL << blockNum++; - Block* b = new Block(proc, s.str()); - proc.addBlock(b); + Block* b = new Block(s.str()); + addBlock(b); return b; } @@ -48,10 +48,16 @@ string SmackInstGenerator::createVar() { stringstream s; s << "$x" << varNum++; string name = s.str(); - proc.addDecl(Decl::variable(name, rep.getPtrType())); + addDecl(Decl::variable(name, rep.getPtrType())); return name; } +Block* SmackInstGenerator::getBlock(llvm::BasicBlock* bb) { + if (blockMap.count(bb) == 0) + blockMap[bb] = createBlock(); + return blockMap[bb]; +} + void SmackInstGenerator::nameInstruction(llvm::Instruction& inst) { if (!inst.getType()->isVoidTy()) { if (!inst.hasName() || !rep.isSmackGeneratedName(inst.getName())) { @@ -62,7 +68,7 @@ void SmackInstGenerator::nameInstruction(llvm::Instruction& inst) { else inst.setName(SmackRep::PTR_VAR); } - proc.addDecl(Decl::variable(rep.id(&inst), rep.type(&inst))); + addDecl(Decl::variable(rep.id(&inst), rep.type(&inst))); } } @@ -88,6 +94,10 @@ void SmackInstGenerator::processInstruction(llvm::Instruction& inst) { nameInstruction(inst); } +void SmackInstGenerator::visitBasicBlock(llvm::BasicBlock& bb) { + currBlock = getBlock(&bb); +} + void SmackInstGenerator::visitInstruction(llvm::Instruction& inst) { DEBUG(errs() << "Instruction not handled: " << inst << "\n"); assert(false && "Instruction not handled"); @@ -160,22 +170,18 @@ void SmackInstGenerator::visitBranchInst(llvm::BranchInst& bi) { if (bi.getNumSuccessors() == 1) { // Unconditional branch - assert(blockMap.count(bi.getSuccessor(0)) != 0); targets.push_back(make_pair(Expr::lit(true), - blockMap[bi.getSuccessor(0)]->getName())); + getBlock(bi.getSuccessor(0))->getName())); } else { // Conditional branch assert(bi.getNumSuccessors() == 2); - assert(blockMap.count(bi.getSuccessor(0)) != 0); - assert(blockMap.count(bi.getSuccessor(1)) != 0); - const Expr* e = rep.expr(bi.getCondition()); targets.push_back(make_pair(e, - blockMap[bi.getSuccessor(0)]->getName())); + getBlock(bi.getSuccessor(0))->getName())); targets.push_back(make_pair(Expr::not_(e), - blockMap[bi.getSuccessor(1)]->getName())); + getBlock(bi.getSuccessor(1))->getName())); } generatePhiAssigns(bi); generateGotoStmts(bi, targets); @@ -193,19 +199,16 @@ void SmackInstGenerator::visitSwitchInst(llvm::SwitchInst& si) { for (llvm::SwitchInst::CaseIt i = si.case_begin(); i != si.case_begin(); ++i) { - assert(blockMap.count(i.getCaseSuccessor()) != 0); const Expr* v = rep.expr(i.getCaseValue()); targets.push_back(make_pair(Expr::eq(e, v), - blockMap[i.getCaseSuccessor()]->getName())); + getBlock(i.getCaseSuccessor())->getName())); // Add the negation of this case to the default case n = Expr::and_(n, Expr::neq(e, v)); } // The default case - assert(blockMap.count(si.getDefaultDest()) != 0); - targets.push_back(make_pair(n, - blockMap[si.getDefaultDest()]->getName())); + targets.push_back(make_pair(n,getBlock(si.getDefaultDest())->getName())); generatePhiAssigns(si); generateGotoStmts(si, targets); @@ -465,17 +468,17 @@ void SmackInstGenerator::visitCallInst(llvm::CallInst& ci) { currBlock->addStmt(Stmt::skip()); } else if (f && rep.id(f) == "__SMACK_mod") { - proc.addMod(rep.code(ci)); + addMod(rep.code(ci)); } else if (f && rep.id(f) == "__SMACK_code") { currBlock->addStmt(Stmt::code(rep.code(ci))); } else if (f && rep.id(f) == "__SMACK_decl") { - proc.addDecl(Decl::code(rep.code(ci))); + addDecl(Decl::code(rep.code(ci))); } else if (f && rep.id(f) == "__SMACK_top_decl") { string decl = rep.code(ci); - proc.getProg().addDecl(Decl::code(decl)); + addTopDecl(Decl::code(decl)); if (VAR_DECL.match(decl)) { string var = VAR_DECL.sub("\\1",decl); rep.addBplGlobal(var); diff --git a/lib/smack/SmackModuleGenerator.cpp b/lib/smack/SmackModuleGenerator.cpp index ab0a11d70..bca3a6edd 100644 --- a/lib/smack/SmackModuleGenerator.cpp +++ b/lib/smack/SmackModuleGenerator.cpp @@ -10,6 +10,64 @@ namespace smack { llvm::RegisterPass X("smack", "SMACK generator pass"); char SmackModuleGenerator::ID = 0; +class SpecCollector : public llvm::InstVisitor { +private: + SmackRep& rep; + ProcDecl& proc; + Program& program; + set specs; + set blocks; + +public: + SpecCollector(SmackRep& r, ProcDecl& d, Program& p) + : rep(r), proc(d), program(p) {} + + // void slicing???(llvm::CallInst& ci) { + // stack worklist; + // worklist.push(&ci); + // while (!worklist.empty()) { + // llvm::Instruction* i = worklist.top(); + // worklist.pop(); + // specs.insert(i); + // // i->removeFromParent(); + // // blocks.insert(i->getParent()); + // // i->getParent()->removeFromParent(); + // + // if (llvm::PHINode* phi = llvm::dyn_cast(i)) { + // for (llvm::PHINode::block_iterator bb = phi->block_begin(); bb != phi->block_end(); ++bb) { + // worklist.push( (*bb)->getTerminator() ); + // } + // + // } else if (llvm::BranchInst* br = llvm::dyn_cast(i)) { + // if (br->isConditional()) { + // DEBUG(errs() << "GOT COND BR.\n"); + // // worklist.push( br->getCondition() ); + // } + // + // } else { + // i->removeFromParent(); + // for (llvm::User::op_iterator ops = i->op_begin(); ops != i->op_end(); ++ops) { + // if (llvm::Instruction* ii = llvm::dyn_cast(ops)) { + // worklist.push(ii); + // } + // } + // } + // } + // } + + void visitCallInst(llvm::CallInst& ci) { + llvm::Function* f = ci.getCalledFunction(); + if (f && rep.id(f).find("requires") != string::npos) { + CodeExpr* code = new CodeExpr(program); + SmackInstGenerator igen(rep, *code); + // TODO visit the slice, not the whole proc! + igen.visit(ci.getParent()->getParent()); + proc.addRequires(code); + } + } + +}; + void SmackModuleGenerator::generateProgram(llvm::Module& m, SmackRep* rep) { rep->setProgram( &program ); @@ -49,40 +107,15 @@ void SmackModuleGenerator::generateProgram(llvm::Module& m, SmackRep* rep) { DEBUG(errs() << "Analyzing function: " << rep->id(func) << "\n"); - map known; - stack workStack; - SmackInstGenerator igen(*rep, (ProcDecl&) *proc, known); + SpecCollector sc(*rep, *proc, program); + sc.visit(func); + + SmackInstGenerator igen(*rep, *proc); + igen.visit(func); - llvm::BasicBlock& entry = func->getEntryBlock(); - workStack.push(&entry); - known[&entry] = igen.createBlock(); - // First execute static initializers, in the main procedure. if (rep->id(func) == "main" && rep->hasStaticInits()) - known[&entry]->addStmt(Stmt::call(SmackRep::STATIC_INIT)); - - // INVARIANT: knownBlocks.CONTAINS(b) iff workStack.CONTAINS(b) - // or workStack.CONTAINED(b) at some point in time. - while (!workStack.empty()) { - llvm::BasicBlock* b = workStack.top(); - workStack.pop(); - - for (llvm::succ_iterator s = succ_begin(b), - e = succ_end(b); s != e; ++s) { - - // uncovered basic block - if (known.count(*s) == 0) { - known[*s] = igen.createBlock(); - workStack.push(*s); - } - } - - // NOTE: here we are sure that all successor blocks have - // already been created, and are mapped for the visitor. - - igen.setCurrBlock(known[b]); - igen.visit(b); - } + proc->insert(Stmt::call(SmackRep::STATIC_INIT)); DEBUG(errs() << "Finished analyzing function: " << rep->id(func) << "\n\n"); } diff --git a/lib/smack/SmackRep.cpp b/lib/smack/SmackRep.cpp index 7450724df..f07847f27 100644 --- a/lib/smack/SmackRep.cpp +++ b/lib/smack/SmackRep.cpp @@ -886,7 +886,7 @@ bool SmackRep::hasStaticInits() { Decl* SmackRep::getStaticInit() { ProcDecl* proc = (ProcDecl*) Decl::procedure(*program, STATIC_INIT); - Block* b = new Block(*proc); + Block* b = new Block(); for (unsigned i=0; iaddStmt(staticInits[i]); b->addStmt(Stmt::return_()); From db87ae6f827ec57674d269ce9134d8177d1ca07b Mon Sep 17 00:00:00 2001 From: Michael Emmi Date: Wed, 23 Jul 2014 19:42:56 +0200 Subject: [PATCH 010/140] More progress on contracts. * Computing function slice from requires call. --- CMakeLists.txt | 1 + include/smack/BoogieAst.h | 15 +++- include/smack/Slicing.h | 10 +++ include/smack/SmackRep.h | 1 + lib/smack/BoogieAst.cpp | 23 ++++++- lib/smack/Slicing.cpp | 107 +++++++++++++++++++++++++++++ lib/smack/SmackInstGenerator.cpp | 22 ++++++ lib/smack/SmackModuleGenerator.cpp | 42 +---------- 8 files changed, 176 insertions(+), 45 deletions(-) create mode 100644 include/smack/Slicing.h create mode 100644 lib/smack/Slicing.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 6c026d6db..4598e1f62 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -151,6 +151,7 @@ add_library(smackTranslator STATIC lib/smack/BplFilePrinter.cpp lib/smack/BplPrinter.cpp lib/smack/DSAAliasAnalysis.cpp + lib/smack/Slicing.cpp lib/smack/SmackInstGenerator.cpp lib/smack/SmackModuleGenerator.cpp lib/smack/SmackOptions.cpp diff --git a/include/smack/BoogieAst.h b/include/smack/BoogieAst.h index 89e1a1684..33d20883d 100644 --- a/include/smack/BoogieAst.h +++ b/include/smack/BoogieAst.h @@ -20,6 +20,8 @@ class Program; class Expr { public: virtual void print(ostream& os) const = 0; + static const Expr* exists(string v, string t, const Expr* e); + static const Expr* forall(string v, string t, const Expr* e); static const Expr* and_(const Expr* l, const Expr* r); static const Expr* cond(const Expr* c, const Expr* t, const Expr* e); static const Expr* eq(const Expr* l, const Expr* r); @@ -99,10 +101,13 @@ class NotExpr : public Expr { class QuantExpr : public Expr { public: - enum Quantifier { Forall, Exists }; + enum Quantifier { Exists, Forall }; private: - Quantifier q; + Quantifier quant; + vector< pair > vars; + const Expr* expr; public: + QuantExpr(Quantifier q, vector< pair > vs, const Expr* e) : quant(q), vars(vs), expr(e) {} void print(ostream& os) const; }; @@ -192,6 +197,7 @@ class Stmt { static const Stmt* goto_(vector ts); static const Stmt* havoc(string x); static const Stmt* return_(); + static const Stmt* return_(const Expr* e); static const Stmt* skip(); static const Stmt* code(string s); virtual void print(ostream& os) const = 0; @@ -257,8 +263,9 @@ class HavocStmt : public Stmt { }; class ReturnStmt : public Stmt { + const Expr* expr; public: - ReturnStmt() {} + ReturnStmt(const Expr* e = nullptr) : expr(e) {} void print(ostream& os) const; }; @@ -402,6 +409,7 @@ class CodeContainer { for (unsigned i = 0; i < ms.size(); i++) addMod(ms[i]); } + virtual bool isProc() { return false; } }; class CodeExpr : public Expr, public CodeContainer { @@ -434,6 +442,7 @@ class ProcDecl : public Decl, public CodeContainer { void addEnsures(const Expr* e) { ensures.push_back(e); } + bool isProc() { return true; } void print(ostream& os) const; }; diff --git a/include/smack/Slicing.h b/include/smack/Slicing.h new file mode 100644 index 000000000..927c51118 --- /dev/null +++ b/include/smack/Slicing.h @@ -0,0 +1,10 @@ + +#include "llvm/InstVisitor.h" + +namespace llvm { + Function* slice(Function* f, Value* v, bool keep=false); +} + +namespace smack { + Expr* slice(SmackRep& rep, llvm::Value* v, bool keep=false); +} diff --git a/include/smack/SmackRep.h b/include/smack/SmackRep.h index 6d64c429f..18ca46fad 100644 --- a/include/smack/SmackRep.h +++ b/include/smack/SmackRep.h @@ -157,6 +157,7 @@ class SmackRep { const Expr* b2i(const llvm::Value* v); public: + Program* getProgram() { return program; } void setProgram(Program* p) { program = p; } bool isSmackName(string n); diff --git a/lib/smack/BoogieAst.cpp b/lib/smack/BoogieAst.cpp index ef81dbcdd..9a8671399 100644 --- a/lib/smack/BoogieAst.cpp +++ b/lib/smack/BoogieAst.cpp @@ -13,6 +13,18 @@ using namespace std; unsigned Decl::uniqueId = 0; +const Expr* Expr::exists(string v, string t, const Expr* e) { + vector< pair > vars; + vars.push_back(make_pair(v,t)); + return new QuantExpr(QuantExpr::Exists, vars, e); +} + +const Expr* Expr::forall(string v, string t, const Expr* e) { + vector< pair > vars; + vars.push_back(make_pair(v,t)); + return new QuantExpr(QuantExpr::Forall, vars, e); +} + const Expr* Expr::and_(const Expr* l, const Expr* r) { return new BinExpr(BinExpr::And, l, r); } @@ -219,6 +231,10 @@ const Stmt* Stmt::havoc(string x) { return new HavocStmt(vector(1, x)); } +const Stmt* Stmt::return_(const Expr* e) { + return new ReturnStmt(e); +} + const Stmt* Stmt::return_() { return new ReturnStmt(); } @@ -430,7 +446,7 @@ void NotExpr::print(ostream& os) const { void QuantExpr::print(ostream& os) const { os << "("; - switch (q) { + switch (quant) { case Forall: os << "forall"; break; @@ -526,7 +542,10 @@ void HavocStmt::print(ostream& os) const { } void ReturnStmt::print(ostream& os) const { - os << "return;"; + os << "return"; + if (expr) + os << " " << expr; + os << ";"; } void CodeStmt::print(ostream& os) const { diff --git a/lib/smack/Slicing.cpp b/lib/smack/Slicing.cpp new file mode 100644 index 000000000..66624772a --- /dev/null +++ b/lib/smack/Slicing.cpp @@ -0,0 +1,107 @@ +// +// Copyright (c) 2013 Zvonimir Rakamaric (zvonimir@cs.utah.edu), +// Michael Emmi (michael.emmi@gmail.com) +// This file is distributed under the MIT License. See LICENSE for details. +// + +#include "llvm/Transforms/Utils/Cloning.h" +#include "llvm/IR/Instructions.h" +#include "smack/BoogieAst.h" +#include "smack/SmackRep.h" +#include "smack/SmackInstGenerator.h" +#include +#include +#include + +using namespace std; + +namespace llvm { + + Function* slice(Function* f, Value* v, bool keep=false) { + ValueToValueMapTy VMap; + Function* slice = CloneFunction(f,VMap,true); + v = VMap[v]; + + set markedI; + set markedB; + queue workList; + + if (Instruction* I = dyn_cast(v)) { + workList.push(I); + } + + while (!workList.empty()) { + Instruction* I = workList.front(); + workList.pop(); + + markedI.insert(I); + markedB.insert(I->getParent()); + + if (PHINode* Phi = dyn_cast(I)) { + for (PHINode::block_iterator B = Phi->block_begin(); B != Phi->block_end(); ++B) { + workList.push( (*B)->getTerminator() ); + } + } + + if (BranchInst* Br = dyn_cast(I)) { + if (Br->isConditional()) { + if (Instruction* J = dyn_cast(Br->getCondition())) { + workList.push(J); + } + } + } else { + for (User::op_iterator U = I->op_begin(); U != I->op_end(); ++U) { + if (Instruction* J = dyn_cast(U)) { + workList.push(J); + } + } + } + } + + vector goneI; + vector goneB; + + for (Function::iterator B = slice->begin(); B != slice->end(); ++B) { + for (BasicBlock::iterator I = B->begin(); I != B->end(); ++I) + if (markedI.count(I) == 0) + goneI.push_back(I); + if (markedB.count(B) == 0) + goneB.push_back(B); + } + + // TODO ERASE FROM THE ORIGINAL COPY + // for (Function::iterator B = f->begin(); B != f->end(); ++B) { + // for (BasicBlock::iterator I = B->begin(); I != B->end(); ++I) { + // Value* V = VMap[I]; + // if (Instruction* J = dyn_cast(V)) { + // if (markedI.count(J) > 0) { + // goneI.push_back(I); + // } + // } + // } + // } + + for (vector::iterator I = goneI.begin(); I != goneI.end(); ++I) + (*I)->eraseFromParent(); + + for (vector::iterator B = goneB.begin(); B != goneB.end(); ++B) + (*B)->eraseFromParent(); + + return slice; + } + +} + +namespace smack { + + Expr* slice(SmackRep& rep, llvm::Value* v, bool keep=false) { + CodeExpr* code = new CodeExpr(*rep.getProgram()); + SmackInstGenerator igen(rep, *code); + if (llvm::Instruction* I = llvm::dyn_cast(v)) { + llvm::Function* sliced = llvm::slice(I->getParent()->getParent(),v,keep); + igen.visit(sliced); + delete sliced; + } + return code; + } +} diff --git a/lib/smack/SmackInstGenerator.cpp b/lib/smack/SmackInstGenerator.cpp index 192a04aa3..59859a5a5 100644 --- a/lib/smack/SmackInstGenerator.cpp +++ b/lib/smack/SmackInstGenerator.cpp @@ -4,6 +4,7 @@ // #include "smack/SmackInstGenerator.h" #include "smack/SmackOptions.h" +#include "smack/Slicing.h" #include "llvm/InstVisitor.h" #include "llvm/DebugInfo.h" #include "llvm/Support/Debug.h" @@ -484,6 +485,27 @@ void SmackInstGenerator::visitCallInst(llvm::CallInst& ci) { rep.addBplGlobal(var); } + } else if (f && rep.id(f).find("requires") != string::npos) { + if (!proc.isProc()) { + assert(ci.getNumArgOperands() == 1 && "Unexpected operands to requires."); + currBlock->addStmt(Stmt::return_(rep.expr(ci.getArgOperand(0)))); + } + + // } else if (f && rep.id(f).find("var") != string::npos) { + // if (!proc.isProc()) { + // assert(ci.getNumArgOperands() == 1 && "Unexpected operands to var."); + // currBlock->addStmt(Stmt::assign(rep.expr(&ci),Expr::id(rep.getString(ci.getArgOperand(0))))); + // } + + // } else if (f && rep.id(f).find("forall") != string::npos) { + // assert(ci.getNumArgOperands() == 2 && "Unexpected operands to forall."); + // currBlock->addStmt(Stmt::assign(rep.expr(&ci),Expr::forall( + // rep.getString(ci.getArgOperand(0)), + // "int", + // slice(rep ,ci.getArgOperand(1)) + // ))); + // currBlock->addStmt(Stmt::return_(rep.expr(ci.getArgOperand(0)))); + } else if (f) { currBlock->addStmt(rep.call(f, ci)); diff --git a/lib/smack/SmackModuleGenerator.cpp b/lib/smack/SmackModuleGenerator.cpp index bca3a6edd..7807c435f 100644 --- a/lib/smack/SmackModuleGenerator.cpp +++ b/lib/smack/SmackModuleGenerator.cpp @@ -4,6 +4,7 @@ // #include "smack/SmackModuleGenerator.h" #include "smack/SmackOptions.h" +#include "smack/Slicing.h" namespace smack { @@ -15,54 +16,15 @@ class SpecCollector : public llvm::InstVisitor { SmackRep& rep; ProcDecl& proc; Program& program; - set specs; - set blocks; public: SpecCollector(SmackRep& r, ProcDecl& d, Program& p) : rep(r), proc(d), program(p) {} - - // void slicing???(llvm::CallInst& ci) { - // stack worklist; - // worklist.push(&ci); - // while (!worklist.empty()) { - // llvm::Instruction* i = worklist.top(); - // worklist.pop(); - // specs.insert(i); - // // i->removeFromParent(); - // // blocks.insert(i->getParent()); - // // i->getParent()->removeFromParent(); - // - // if (llvm::PHINode* phi = llvm::dyn_cast(i)) { - // for (llvm::PHINode::block_iterator bb = phi->block_begin(); bb != phi->block_end(); ++bb) { - // worklist.push( (*bb)->getTerminator() ); - // } - // - // } else if (llvm::BranchInst* br = llvm::dyn_cast(i)) { - // if (br->isConditional()) { - // DEBUG(errs() << "GOT COND BR.\n"); - // // worklist.push( br->getCondition() ); - // } - // - // } else { - // i->removeFromParent(); - // for (llvm::User::op_iterator ops = i->op_begin(); ops != i->op_end(); ++ops) { - // if (llvm::Instruction* ii = llvm::dyn_cast(ops)) { - // worklist.push(ii); - // } - // } - // } - // } - // } void visitCallInst(llvm::CallInst& ci) { llvm::Function* f = ci.getCalledFunction(); if (f && rep.id(f).find("requires") != string::npos) { - CodeExpr* code = new CodeExpr(program); - SmackInstGenerator igen(rep, *code); - // TODO visit the slice, not the whole proc! - igen.visit(ci.getParent()->getParent()); - proc.addRequires(code); + proc.addRequires(slice(rep,&ci)); } } From d0af8e9f247af89910b0ec86df5bd455e900ba1f Mon Sep 17 00:00:00 2001 From: Michael Emmi Date: Thu, 24 Jul 2014 18:40:32 +0200 Subject: [PATCH 011/140] Code contracts prototype working! --- include/smack/Slicing.h | 6 +-- include/smack/SmackInstGenerator.h | 8 ++- include/smack/smack.h | 4 +- lib/smack/BoogieAst.cpp | 13 +++-- lib/smack/Slicing.cpp | 85 +++++++++++++++++------------- lib/smack/SmackInstGenerator.cpp | 56 +++++++++++--------- lib/smack/SmackModuleGenerator.cpp | 36 +++++++++++-- 7 files changed, 129 insertions(+), 79 deletions(-) diff --git a/include/smack/Slicing.h b/include/smack/Slicing.h index 927c51118..dd4da9002 100644 --- a/include/smack/Slicing.h +++ b/include/smack/Slicing.h @@ -2,9 +2,5 @@ #include "llvm/InstVisitor.h" namespace llvm { - Function* slice(Function* f, Value* v, bool keep=false); -} - -namespace smack { - Expr* slice(SmackRep& rep, llvm::Value* v, bool keep=false); + Function* slice(Value* v, bool exclude=false, bool inPlace=false); } diff --git a/include/smack/SmackInstGenerator.h b/include/smack/SmackInstGenerator.h index 5408f3070..b8147a383 100644 --- a/include/smack/SmackInstGenerator.h +++ b/include/smack/SmackInstGenerator.h @@ -21,6 +21,8 @@ class SmackInstGenerator : public llvm::InstVisitor { map blockMap; int blockNum; int varNum; + int varNs; + vector* qMap; string createVar(); Block* createBlock(); @@ -39,8 +41,10 @@ class SmackInstGenerator : public llvm::InstVisitor { void addBlock(Block* b) { proc.addBlock(b); } public: - SmackInstGenerator(SmackRep& r, CodeContainer& p) - : rep(r), proc(p), blockNum(0), varNum(0) {} + SmackInstGenerator(SmackRep& r, CodeContainer& p, int varNamespace = -1) + : rep(r), proc(p), blockNum(0), varNum(0), varNs(varNamespace) {} + + void setQuantifierMap(vector* qm) { qMap = qm; } void visitBasicBlock(llvm::BasicBlock& bb); void visitInstruction(llvm::Instruction& i); diff --git a/include/smack/smack.h b/include/smack/smack.h index d2a2d8984..f544f0dff 100644 --- a/include/smack/smack.h +++ b/include/smack/smack.h @@ -48,8 +48,8 @@ void __SMACK_assume(bool v) { void requires(bool expr); void ensures(bool expr); -int forall(const char *var, bool expr); -int exists(const char *var, bool expr); +bool forall(const char *var, bool expr); +bool exists(const char *var, bool expr); int var(const char *var); //// PROBLEM: in the 2D memory model, the declaration of boogie_si_record_int diff --git a/lib/smack/BoogieAst.cpp b/lib/smack/BoogieAst.cpp index 9a8671399..277ef8233 100644 --- a/lib/smack/BoogieAst.cpp +++ b/lib/smack/BoogieAst.cpp @@ -317,6 +317,11 @@ ostream& operator<<(ostream& os, Program& p) { return os; } +template ostream& operator<<(ostream& os, pair p) { + os << p.first << ": " << p.second; + return os; +} + template void print_seq(ostream& os, vector ts, string init, string sep, string term) { @@ -448,14 +453,14 @@ void QuantExpr::print(ostream& os) const { os << "("; switch (quant) { case Forall: - os << "forall"; + os << "forall "; break; case Exists: - os << "exists"; + os << "exists "; break; } - os << " -- ToDo: Implement quantified expressions. "; - os << ")"; + print_seq< pair >(os, vars, ","); + os << " :: " << expr << ")"; } void SelExpr::print(ostream& os) const { diff --git a/lib/smack/Slicing.cpp b/lib/smack/Slicing.cpp index 66624772a..46831e4e5 100644 --- a/lib/smack/Slicing.cpp +++ b/lib/smack/Slicing.cpp @@ -17,17 +17,39 @@ using namespace std; namespace llvm { - Function* slice(Function* f, Value* v, bool keep=false) { - ValueToValueMapTy VMap; - Function* slice = CloneFunction(f,VMap,true); - v = VMap[v]; + Function* slice(Value* v, bool exclude=false, bool inPlace=false) { + Function* slice; + queue workList; set markedI; set markedB; - queue workList; - if (Instruction* I = dyn_cast(v)) { + Instruction* I = dyn_cast(v); + assert(I && "Expected instruction value."); + + Function* f = I->getParent()->getParent(); + + // DEBUG(llvm::errs() << "COMPUTING SLICE " << *v << "\n"); + // DEBUG(llvm::errs() << "IN " << *f << "\n"); + // DEBUG(llvm::errs() << "exclude? " << exclude << "\n"); + // DEBUG(llvm::errs() << "inPlace? " << inPlace << "\n"); + + if (inPlace) { + slice = f; + } else { + ValueToValueMapTy VMap; + slice = CloneFunction(f,VMap,true); + v = VMap[v]; + } + + I = dyn_cast(v); + assert(I && "Expected instruction value."); + + if (exclude) { workList.push(I); + } else { + I->getParent()->getTerminator()->eraseFromParent(); + workList.push( ReturnInst::Create(I->getContext(),I,I->getParent()) ); } while (!workList.empty()) { @@ -63,45 +85,32 @@ namespace llvm { for (Function::iterator B = slice->begin(); B != slice->end(); ++B) { for (BasicBlock::iterator I = B->begin(); I != B->end(); ++I) - if (markedI.count(I) == 0) + if (!markedI.count(I) == !exclude) goneI.push_back(I); - if (markedB.count(B) == 0) + + if (!exclude && markedB.count(B) == 0) goneB.push_back(B); } - - // TODO ERASE FROM THE ORIGINAL COPY - // for (Function::iterator B = f->begin(); B != f->end(); ++B) { - // for (BasicBlock::iterator I = B->begin(); I != B->end(); ++I) { - // Value* V = VMap[I]; - // if (Instruction* J = dyn_cast(V)) { - // if (markedI.count(J) > 0) { - // goneI.push_back(I); - // } - // } - // } - // } - - for (vector::iterator I = goneI.begin(); I != goneI.end(); ++I) + + for (vector::reverse_iterator I = goneI.rbegin(); I != goneI.rend(); ++I) { + BasicBlock* B = (*I)->getParent(); + // DEBUG(errs() << "ERASING " << **I << "\n"); + // DEBUG(errs() << "FROM " << *(*I)->getParent() << "\n"); + // DEBUG(errs() << "IN " << *(*I)->getParent()->getParent() << "\n"); (*I)->eraseFromParent(); + if (exclude && B->empty()) + goneB.push_back(B); + } + + for (vector::iterator B = goneB.begin(); B != goneB.end(); ++B) { + // DEBUG(errs() << "ERASING " << **B << "\n"); + // DEBUG(errs() << "FROM " << *(*B)->getParent() << "\n"); + (*B)->eraseFromParent(); + } - for (vector::iterator B = goneB.begin(); B != goneB.end(); ++B) - (*B)->eraseFromParent(); + // DEBUG(llvm::errs() << "COMPUTED SLICE " << *slice << "\n"); return slice; } } - -namespace smack { - - Expr* slice(SmackRep& rep, llvm::Value* v, bool keep=false) { - CodeExpr* code = new CodeExpr(*rep.getProgram()); - SmackInstGenerator igen(rep, *code); - if (llvm::Instruction* I = llvm::dyn_cast(v)) { - llvm::Function* sliced = llvm::slice(I->getParent()->getParent(),v,keep); - igen.visit(sliced); - delete sliced; - } - return code; - } -} diff --git a/lib/smack/SmackInstGenerator.cpp b/lib/smack/SmackInstGenerator.cpp index 59859a5a5..54b35564a 100644 --- a/lib/smack/SmackInstGenerator.cpp +++ b/lib/smack/SmackInstGenerator.cpp @@ -47,7 +47,10 @@ Block* SmackInstGenerator::createBlock() { string SmackInstGenerator::createVar() { stringstream s; - s << "$x" << varNum++; + s << "$x"; + if (varNs >= 0) + s << "." << varNs << "."; + s << varNum++; string name = s.str(); addDecl(Decl::variable(name, rep.getPtrType())); return name; @@ -62,12 +65,16 @@ Block* SmackInstGenerator::getBlock(llvm::BasicBlock* bb) { void SmackInstGenerator::nameInstruction(llvm::Instruction& inst) { if (!inst.getType()->isVoidTy()) { if (!inst.hasName() || !rep.isSmackGeneratedName(inst.getName())) { + stringstream s; if (rep.isBool(&inst)) - inst.setName(SmackRep::BOOL_VAR); + s << SmackRep::BOOL_VAR; else if (rep.isFloat(&inst)) - inst.setName(SmackRep::FLOAT_VAR); + s << SmackRep::FLOAT_VAR; else - inst.setName(SmackRep::PTR_VAR); + s << SmackRep::PTR_VAR; + if (varNs >= 0) + s << "." << varNs << "."; + inst.setName(s.str()); } addDecl(Decl::variable(rep.id(&inst), rep.type(&inst))); } @@ -155,11 +162,17 @@ void SmackInstGenerator::generateGotoStmts( void SmackInstGenerator::visitReturnInst(llvm::ReturnInst& ri) { processInstruction(ri); - if (llvm::Value* v = ri.getReturnValue()) - currBlock->addStmt(Stmt::assign( - Expr::id(SmackRep::RET_VAR), rep.expr(v))); + llvm::Value* v = ri.getReturnValue(); - currBlock->addStmt(Stmt::return_()); + if (proc.isProc()) { + if (v) + currBlock->addStmt(Stmt::assign(Expr::id(SmackRep::RET_VAR), rep.expr(v))); + currBlock->addStmt(Stmt::return_()); + + } else { + assert (v && "Expected return value."); + currBlock->addStmt(Stmt::return_(rep.expr(v))); + } } void SmackInstGenerator::visitBranchInst(llvm::BranchInst& bi) { @@ -485,26 +498,19 @@ void SmackInstGenerator::visitCallInst(llvm::CallInst& ci) { rep.addBplGlobal(var); } - } else if (f && rep.id(f).find("requires") != string::npos) { + } else if (f && rep.id(f).find("var") != string::npos) { if (!proc.isProc()) { - assert(ci.getNumArgOperands() == 1 && "Unexpected operands to requires."); - currBlock->addStmt(Stmt::return_(rep.expr(ci.getArgOperand(0)))); + assert(ci.getNumArgOperands() == 1 && "Unexpected operands to var."); + currBlock->addStmt(Stmt::assign(rep.expr(&ci),Expr::id(rep.getString(ci.getArgOperand(0))))); } - // } else if (f && rep.id(f).find("var") != string::npos) { - // if (!proc.isProc()) { - // assert(ci.getNumArgOperands() == 1 && "Unexpected operands to var."); - // currBlock->addStmt(Stmt::assign(rep.expr(&ci),Expr::id(rep.getString(ci.getArgOperand(0))))); - // } - - // } else if (f && rep.id(f).find("forall") != string::npos) { - // assert(ci.getNumArgOperands() == 2 && "Unexpected operands to forall."); - // currBlock->addStmt(Stmt::assign(rep.expr(&ci),Expr::forall( - // rep.getString(ci.getArgOperand(0)), - // "int", - // slice(rep ,ci.getArgOperand(1)) - // ))); - // currBlock->addStmt(Stmt::return_(rep.expr(ci.getArgOperand(0)))); + } else if (f && rep.id(f).find("forall") != string::npos) { + assert(ci.getNumArgOperands() == 2 && "Unexpected operands to forall."); + llvm::ConstantInt* cidx = llvm::dyn_cast(ci.getArgOperand(1)); + if (cidx && qMap) { + uint64_t idx = cidx->getLimitedValue(); + currBlock->addStmt(Stmt::assign(rep.expr(&ci),(*qMap)[idx])); + } } else if (f) { currBlock->addStmt(rep.call(f, ci)); diff --git a/lib/smack/SmackModuleGenerator.cpp b/lib/smack/SmackModuleGenerator.cpp index 7807c435f..400696af8 100644 --- a/lib/smack/SmackModuleGenerator.cpp +++ b/lib/smack/SmackModuleGenerator.cpp @@ -16,15 +16,45 @@ class SpecCollector : public llvm::InstVisitor { SmackRep& rep; ProcDecl& proc; Program& program; + + vector slices; public: SpecCollector(SmackRep& r, ProcDecl& d, Program& p) : rep(r), proc(d), program(p) {} + Expr* slice(SmackRep& rep, llvm::Value* v) { + CodeExpr* code = new CodeExpr(*rep.getProgram()); + SmackInstGenerator igen(rep, *code, slices.size()); + llvm::Function* sliced = llvm::slice(v); + igen.setQuantifierMap(&slices); + igen.visit(sliced); + delete sliced; + return code; + } + void visitCallInst(llvm::CallInst& ci) { - llvm::Function* f = ci.getCalledFunction(); - if (f && rep.id(f).find("requires") != string::npos) { - proc.addRequires(slice(rep,&ci)); + using namespace llvm; + Function* f = ci.getCalledFunction(); + + if (f && rep.id(f).find("forall") != string::npos) { + assert(ci.getNumArgOperands() == 2 && "Unexpected operands to forall."); + Value* var = ci.getArgOperand(0); + Value* arg = ci.getArgOperand(1); + const Expr* e = Expr::forall(rep.getString(var), "int", slice(rep,arg)); + ci.setArgOperand(1,ConstantInt::get(IntegerType::get(ci.getContext(),32),slices.size())); + slices.push_back(e); + llvm::slice(arg,true,true); + + } else if (f && rep.id(f).find("requires") != string::npos) { + assert(ci.getNumArgOperands() == 1 && "Unexpected operands to requires."); + proc.addRequires(slice(rep,ci.getArgOperand(0))); + llvm::slice(&ci,true,true); + + } else if (f && rep.id(f).find("ensures") != string::npos) { + assert(ci.getNumArgOperands() == 1 && "Unexpected operands to ensures."); + proc.addEnsures(slice(rep,ci.getArgOperand(0))); + llvm::slice(&ci,true,true); } } From f9dbe513fe5d1386135fe61823492465e89a6161 Mon Sep 17 00:00:00 2001 From: Michael Emmi Date: Fri, 25 Jul 2014 00:24:11 +0200 Subject: [PATCH 012/140] Code contract slicing with loops. --- bin/smack-verify.py | 6 +++++- include/smack/Slicing.h | 2 ++ include/smack/smack.h | 2 ++ lib/smack/Slicing.cpp | 19 +++++++++++++++---- lib/smack/SmackModuleGenerator.cpp | 22 ++++++++++++++-------- 5 files changed, 38 insertions(+), 13 deletions(-) diff --git a/bin/smack-verify.py b/bin/smack-verify.py index ffc55b434..03acbfc7b 100755 --- a/bin/smack-verify.py +++ b/bin/smack-verify.py @@ -134,7 +134,11 @@ def smackdOutput(corralOutput): if args.verifier == 'boogie-plain' or args.verifier == 'boogie-inline': # invoke Boogie - p = subprocess.Popen(['boogie', args.outfile.name, '/nologo', '/timeLimit:' + str(args.timeLimit), '/loopUnroll:' + str(args.unroll)], stdout=subprocess.PIPE) + cmd = ['boogie', args.outfile.name, '/nologo'] + cmd += ['/timeLimit:' + str(args.timeLimit)] + if args.verifier == 'boogie-inline': + cmd += ['/loopUnroll:' + str(args.unroll)] + p = subprocess.Popen(cmd, stdout=subprocess.PIPE) boogieOutput = p.communicate()[0] if p.returncode: print boogieOutput diff --git a/include/smack/Slicing.h b/include/smack/Slicing.h index dd4da9002..ab14e0b18 100644 --- a/include/smack/Slicing.h +++ b/include/smack/Slicing.h @@ -3,4 +3,6 @@ namespace llvm { Function* slice(Value* v, bool exclude=false, bool inPlace=false); + Function* get_slice(Value* v); + void remove_slice(Value* v); } diff --git a/include/smack/smack.h b/include/smack/smack.h index f544f0dff..b107e44a8 100644 --- a/include/smack/smack.h +++ b/include/smack/smack.h @@ -47,10 +47,12 @@ void __SMACK_assume(bool v) { void requires(bool expr); void ensures(bool expr); +void invariant(bool expr); bool forall(const char *var, bool expr); bool exists(const char *var, bool expr); int var(const char *var); +int old(int term); //// PROBLEM: in the 2D memory model, the declaration of boogie_si_record_int //// should have a type $ptr parameter, not an int. How should we do this? diff --git a/lib/smack/Slicing.cpp b/lib/smack/Slicing.cpp index 46831e4e5..062f301c7 100644 --- a/lib/smack/Slicing.cpp +++ b/lib/smack/Slicing.cpp @@ -51,7 +51,7 @@ namespace llvm { I->getParent()->getTerminator()->eraseFromParent(); workList.push( ReturnInst::Create(I->getContext(),I,I->getParent()) ); } - + while (!workList.empty()) { Instruction* I = workList.front(); workList.pop(); @@ -79,14 +79,16 @@ namespace llvm { } } } - + vector goneI; vector goneB; - + for (Function::iterator B = slice->begin(); B != slice->end(); ++B) { for (BasicBlock::iterator I = B->begin(); I != B->end(); ++I) - if (!markedI.count(I) == !exclude) + if (!markedI.count(I) == !exclude) { goneI.push_back(I); + I->dropAllReferences(); + } if (!exclude && markedB.count(B) == 0) goneB.push_back(B); @@ -94,6 +96,7 @@ namespace llvm { for (vector::reverse_iterator I = goneI.rbegin(); I != goneI.rend(); ++I) { BasicBlock* B = (*I)->getParent(); + // NOTE THIS WILL BREAK SINCE I'S REFERENCES HAVE BEEN DROPPED // DEBUG(errs() << "ERASING " << **I << "\n"); // DEBUG(errs() << "FROM " << *(*I)->getParent() << "\n"); // DEBUG(errs() << "IN " << *(*I)->getParent()->getParent() << "\n"); @@ -113,4 +116,12 @@ namespace llvm { return slice; } + Function* get_slice(Value* v) { + return slice(v); + } + + void remove_slice(Value* v) { + slice(v,true,true); + } + } diff --git a/lib/smack/SmackModuleGenerator.cpp b/lib/smack/SmackModuleGenerator.cpp index 400696af8..f572c640c 100644 --- a/lib/smack/SmackModuleGenerator.cpp +++ b/lib/smack/SmackModuleGenerator.cpp @@ -23,10 +23,10 @@ class SpecCollector : public llvm::InstVisitor { SpecCollector(SmackRep& r, ProcDecl& d, Program& p) : rep(r), proc(d), program(p) {} - Expr* slice(SmackRep& rep, llvm::Value* v) { + Expr* slice_expr(SmackRep& rep, llvm::Value* v) { CodeExpr* code = new CodeExpr(*rep.getProgram()); SmackInstGenerator igen(rep, *code, slices.size()); - llvm::Function* sliced = llvm::slice(v); + llvm::Function* sliced = llvm::get_slice(v); igen.setQuantifierMap(&slices); igen.visit(sliced); delete sliced; @@ -41,20 +41,26 @@ class SpecCollector : public llvm::InstVisitor { assert(ci.getNumArgOperands() == 2 && "Unexpected operands to forall."); Value* var = ci.getArgOperand(0); Value* arg = ci.getArgOperand(1); - const Expr* e = Expr::forall(rep.getString(var), "int", slice(rep,arg)); + const Expr* e = Expr::forall(rep.getString(var), "int", slice_expr(rep,arg)); ci.setArgOperand(1,ConstantInt::get(IntegerType::get(ci.getContext(),32),slices.size())); slices.push_back(e); - llvm::slice(arg,true,true); + llvm::remove_slice(arg); } else if (f && rep.id(f).find("requires") != string::npos) { assert(ci.getNumArgOperands() == 1 && "Unexpected operands to requires."); - proc.addRequires(slice(rep,ci.getArgOperand(0))); - llvm::slice(&ci,true,true); + proc.addRequires(slice_expr(rep,ci.getArgOperand(0))); + llvm::remove_slice(&ci); } else if (f && rep.id(f).find("ensures") != string::npos) { assert(ci.getNumArgOperands() == 1 && "Unexpected operands to ensures."); - proc.addEnsures(slice(rep,ci.getArgOperand(0))); - llvm::slice(&ci,true,true); + proc.addEnsures(slice_expr(rep,ci.getArgOperand(0))); + llvm::remove_slice(&ci); + + } else if (f && rep.id(f).find("invariant") != string::npos) { + assert(ci.getNumArgOperands() == 1 && "Unexpected operands to ensures."); + // TODO WHERE CAN WE STICK THIS INVARIANT? + // ???_ADD_INVARIANT_???(slice_expr(rep,ci.getArgOperand(0))); + llvm::remove_slice(&ci); } } From 912a362a644fc230da89b410269376c0eb027e54 Mon Sep 17 00:00:00 2001 From: Michael Emmi Date: Fri, 25 Jul 2014 00:43:38 +0200 Subject: [PATCH 013/140] Started to add `old` expressions. --- lib/smack/SmackInstGenerator.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/smack/SmackInstGenerator.cpp b/lib/smack/SmackInstGenerator.cpp index 54b35564a..327d2761c 100644 --- a/lib/smack/SmackInstGenerator.cpp +++ b/lib/smack/SmackInstGenerator.cpp @@ -504,6 +504,13 @@ void SmackInstGenerator::visitCallInst(llvm::CallInst& ci) { currBlock->addStmt(Stmt::assign(rep.expr(&ci),Expr::id(rep.getString(ci.getArgOperand(0))))); } + } else if (f && rep.id(f).find("old") != string::npos) { + assert(ci.getNumArgOperands() == 1 && "Unexpected operands to var."); + // TODO NEED TO ELIMiNATE TEMPORARY SSA VARIABLES HERE + // .... IT'S NO USE TO USE OLD ON A PROCEDURE-LOCAL SSA VARIABLE. + currBlock->addStmt(Stmt::assign(rep.expr(&ci), + Expr::fn("old",rep.expr(ci.getArgOperand(0))) )); + } else if (f && rep.id(f).find("forall") != string::npos) { assert(ci.getNumArgOperands() == 2 && "Unexpected operands to forall."); llvm::ConstantInt* cidx = llvm::dyn_cast(ci.getArgOperand(1)); From bc19fb47ff121bf5930ef0a0fecef90218270aa9 Mon Sep 17 00:00:00 2001 From: Michael Emmi Date: Fri, 25 Jul 2014 01:42:00 +0200 Subject: [PATCH 014/140] Added `invariant`s, though not yet working right. --- include/smack/smack.h | 2 +- lib/smack/SmackInstGenerator.cpp | 12 +++++++++++- lib/smack/SmackModuleGenerator.cpp | 15 +++++++++++---- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/include/smack/smack.h b/include/smack/smack.h index b107e44a8..38028c6de 100644 --- a/include/smack/smack.h +++ b/include/smack/smack.h @@ -51,7 +51,7 @@ void invariant(bool expr); bool forall(const char *var, bool expr); bool exists(const char *var, bool expr); -int var(const char *var); +int qvar(const char *var); int old(int term); //// PROBLEM: in the 2D memory model, the declaration of boogie_si_record_int diff --git a/lib/smack/SmackInstGenerator.cpp b/lib/smack/SmackInstGenerator.cpp index 327d2761c..210363161 100644 --- a/lib/smack/SmackInstGenerator.cpp +++ b/lib/smack/SmackInstGenerator.cpp @@ -498,7 +498,7 @@ void SmackInstGenerator::visitCallInst(llvm::CallInst& ci) { rep.addBplGlobal(var); } - } else if (f && rep.id(f).find("var") != string::npos) { + } else if (f && rep.id(f).find("qvar") != string::npos) { if (!proc.isProc()) { assert(ci.getNumArgOperands() == 1 && "Unexpected operands to var."); currBlock->addStmt(Stmt::assign(rep.expr(&ci),Expr::id(rep.getString(ci.getArgOperand(0))))); @@ -516,9 +516,19 @@ void SmackInstGenerator::visitCallInst(llvm::CallInst& ci) { llvm::ConstantInt* cidx = llvm::dyn_cast(ci.getArgOperand(1)); if (cidx && qMap) { uint64_t idx = cidx->getLimitedValue(); + assert(qMap->size() > idx && "Did not find slice expression."); currBlock->addStmt(Stmt::assign(rep.expr(&ci),(*qMap)[idx])); } + } else if (f && rep.id(f).find("invariant") != string::npos) { + assert(ci.getNumArgOperands() == 1 && "Unexpected operands to invariant."); + llvm::ConstantInt* cidx = llvm::dyn_cast(ci.getArgOperand(0)); + if (cidx && qMap) { + uint64_t idx = cidx->getLimitedValue(); + assert(qMap->size() > idx && "Did not find slice expression."); + currBlock->addStmt(Stmt::assert_((*qMap)[idx])); + } + } else if (f) { currBlock->addStmt(rep.call(f, ci)); diff --git a/lib/smack/SmackModuleGenerator.cpp b/lib/smack/SmackModuleGenerator.cpp index f572c640c..c827887ec 100644 --- a/lib/smack/SmackModuleGenerator.cpp +++ b/lib/smack/SmackModuleGenerator.cpp @@ -22,6 +22,10 @@ class SpecCollector : public llvm::InstVisitor { public: SpecCollector(SmackRep& r, ProcDecl& d, Program& p) : rep(r), proc(d), program(p) {} + + vector& getSlices() { + return slices; + } Expr* slice_expr(SmackRep& rep, llvm::Value* v) { CodeExpr* code = new CodeExpr(*rep.getProgram()); @@ -57,10 +61,12 @@ class SpecCollector : public llvm::InstVisitor { llvm::remove_slice(&ci); } else if (f && rep.id(f).find("invariant") != string::npos) { - assert(ci.getNumArgOperands() == 1 && "Unexpected operands to ensures."); - // TODO WHERE CAN WE STICK THIS INVARIANT? - // ???_ADD_INVARIANT_???(slice_expr(rep,ci.getArgOperand(0))); - llvm::remove_slice(&ci); + assert(ci.getNumArgOperands() == 1 && "Unexpected operands to invariant."); + Value* arg = ci.getArgOperand(0); + const Expr* e = slice_expr(rep,arg); + ci.setArgOperand(0,ConstantInt::get(IntegerType::get(ci.getContext(),32),slices.size())); + slices.push_back(e); + llvm::remove_slice(arg); } } @@ -109,6 +115,7 @@ void SmackModuleGenerator::generateProgram(llvm::Module& m, SmackRep* rep) { sc.visit(func); SmackInstGenerator igen(*rep, *proc); + igen.setQuantifierMap(&sc.getSlices()); igen.visit(func); // First execute static initializers, in the main procedure. From 9ce403c5e9f0d42add833222f6cd5202f3194e98 Mon Sep 17 00:00:00 2001 From: Michael Emmi Date: Fri, 25 Jul 2014 15:16:59 +0200 Subject: [PATCH 015/140] Loop invariants working. --- lib/smack/SmackInstGenerator.cpp | 11 +++++++- lib/smack/SmackModuleGenerator.cpp | 43 +++++++++++++++++++++++++++--- 2 files changed, 50 insertions(+), 4 deletions(-) diff --git a/lib/smack/SmackInstGenerator.cpp b/lib/smack/SmackInstGenerator.cpp index 210363161..0c13cfbb1 100644 --- a/lib/smack/SmackInstGenerator.cpp +++ b/lib/smack/SmackInstGenerator.cpp @@ -520,7 +520,7 @@ void SmackInstGenerator::visitCallInst(llvm::CallInst& ci) { currBlock->addStmt(Stmt::assign(rep.expr(&ci),(*qMap)[idx])); } - } else if (f && rep.id(f).find("invariant") != string::npos) { + } else if (f && rep.id(f).find("iassert") != string::npos) { assert(ci.getNumArgOperands() == 1 && "Unexpected operands to invariant."); llvm::ConstantInt* cidx = llvm::dyn_cast(ci.getArgOperand(0)); if (cidx && qMap) { @@ -529,6 +529,15 @@ void SmackInstGenerator::visitCallInst(llvm::CallInst& ci) { currBlock->addStmt(Stmt::assert_((*qMap)[idx])); } + } else if (f && rep.id(f).find("iassume") != string::npos) { + assert(ci.getNumArgOperands() == 1 && "Unexpected operands to invariant."); + llvm::ConstantInt* cidx = llvm::dyn_cast(ci.getArgOperand(0)); + if (cidx && qMap) { + uint64_t idx = cidx->getLimitedValue(); + assert(qMap->size() > idx && "Did not find slice expression."); + currBlock->addStmt(Stmt::assume((*qMap)[idx])); + } + } else if (f) { currBlock->addStmt(rep.call(f, ci)); diff --git a/lib/smack/SmackModuleGenerator.cpp b/lib/smack/SmackModuleGenerator.cpp index c827887ec..3cddec09d 100644 --- a/lib/smack/SmackModuleGenerator.cpp +++ b/lib/smack/SmackModuleGenerator.cpp @@ -46,7 +46,16 @@ class SpecCollector : public llvm::InstVisitor { Value* var = ci.getArgOperand(0); Value* arg = ci.getArgOperand(1); const Expr* e = Expr::forall(rep.getString(var), "int", slice_expr(rep,arg)); - ci.setArgOperand(1,ConstantInt::get(IntegerType::get(ci.getContext(),32),slices.size())); + ci.setArgOperand(1,ConstantInt::get(Type::getInt32Ty(ci.getContext()),slices.size())); + slices.push_back(e); + llvm::remove_slice(arg); + + } else if (f && rep.id(f).find("exists") != string::npos) { + assert(ci.getNumArgOperands() == 2 && "Unexpected operands to exists."); + Value* var = ci.getArgOperand(0); + Value* arg = ci.getArgOperand(1); + const Expr* e = Expr::exists(rep.getString(var), "int", slice_expr(rep,arg)); + ci.setArgOperand(1,ConstantInt::get(Type::getInt32Ty(ci.getContext()),slices.size())); slices.push_back(e); llvm::remove_slice(arg); @@ -64,9 +73,37 @@ class SpecCollector : public llvm::InstVisitor { assert(ci.getNumArgOperands() == 1 && "Unexpected operands to invariant."); Value* arg = ci.getArgOperand(0); const Expr* e = slice_expr(rep,arg); - ci.setArgOperand(0,ConstantInt::get(IntegerType::get(ci.getContext(),32),slices.size())); + Value* sliceIdx = ConstantInt::get(Type::getInt32Ty(ci.getContext()),slices.size()); + ci.setArgOperand(0,sliceIdx); slices.push_back(e); - llvm::remove_slice(arg); + + BasicBlock* body = ci.getParent(); + BasicBlock* head = body->getSinglePredecessor(); + assert(head && "Expected single predecessor block."); + ArrayRef args(sliceIdx); + ArrayRef params(Type::getInt32Ty(ci.getContext())); + CallInst::Create( + Function::Create( + FunctionType::get(Type::getVoidTy(ci.getContext()),params,false), + GlobalValue::ExternalLinkage, "iassume"), + args,"",head->getTerminator()); + unsigned count = 0; + for (pred_iterator B = pred_begin(head), E = pred_end(head); B != E; ++B) { + CallInst::Create( + Function::Create( + FunctionType::get(Type::getVoidTy(ci.getContext()),params,false), + GlobalValue::ExternalLinkage, "iassert"), + args,"",(*B)->getTerminator()); + count++; + } + assert(count == 2 && "Expected head with two predecessors."); + count = 0; + for (succ_iterator B = succ_begin(head), E = succ_end(head); B != E; ++B) { + count++; + } + assert(count == 2 && "Expected head with two successors."); + + llvm::remove_slice(&ci); } } From d4b3e17f01b521630420ed51c28f26f80dddb192 Mon Sep 17 00:00:00 2001 From: Michael Emmi Date: Fri, 25 Jul 2014 16:00:07 +0200 Subject: [PATCH 016/140] Refactoring code contract extraction. --- include/smack/Contracts.h | 25 +++++++ include/smack/SmackInstGenerator.h | 4 +- lib/smack/Contracts.cpp | 85 +++++++++++++++++++++++ lib/smack/SmackInstGenerator.cpp | 18 ++--- lib/smack/SmackModuleGenerator.cpp | 106 ++--------------------------- 5 files changed, 125 insertions(+), 113 deletions(-) create mode 100644 include/smack/Contracts.h create mode 100644 lib/smack/Contracts.cpp diff --git a/include/smack/Contracts.h b/include/smack/Contracts.h new file mode 100644 index 000000000..384022fce --- /dev/null +++ b/include/smack/Contracts.h @@ -0,0 +1,25 @@ +#include "llvm/InstVisitor.h" +#include "llvm/Support/CFG.h" +#include "smack/Slicing.h" +#include "smack/SmackRep.h" +#include "smack/SmackInstGenerator.h" +#include "smack/BoogieAst.h" + +namespace smack { + +class ContractsExtractor : public llvm::InstVisitor { +private: + SmackRep& rep; + ProcDecl& proc; + + vector slices; + +public: + ContractsExtractor(SmackRep& r, ProcDecl& d) : rep(r), proc(d) {} + void visitCallInst(llvm::CallInst& ci); + + Expr* sliceExpr(llvm::Value* v); + vector& getSlices() { return slices; } +}; + +} diff --git a/include/smack/SmackInstGenerator.h b/include/smack/SmackInstGenerator.h index b8147a383..2942791c4 100644 --- a/include/smack/SmackInstGenerator.h +++ b/include/smack/SmackInstGenerator.h @@ -22,7 +22,7 @@ class SmackInstGenerator : public llvm::InstVisitor { int blockNum; int varNum; int varNs; - vector* qMap; + vector* slices; string createVar(); Block* createBlock(); @@ -44,7 +44,7 @@ class SmackInstGenerator : public llvm::InstVisitor { SmackInstGenerator(SmackRep& r, CodeContainer& p, int varNamespace = -1) : rep(r), proc(p), blockNum(0), varNum(0), varNs(varNamespace) {} - void setQuantifierMap(vector* qm) { qMap = qm; } + void setSliceMap(vector* sm) { slices = sm; } void visitBasicBlock(llvm::BasicBlock& bb); void visitInstruction(llvm::Instruction& i); diff --git a/lib/smack/Contracts.cpp b/lib/smack/Contracts.cpp new file mode 100644 index 000000000..5144db263 --- /dev/null +++ b/lib/smack/Contracts.cpp @@ -0,0 +1,85 @@ +#include "smack/Contracts.h" + +namespace smack { + +Expr* ContractsExtractor::sliceExpr(llvm::Value* v) { + CodeExpr* code = new CodeExpr(*rep.getProgram()); + SmackInstGenerator igen(rep, *code, slices.size()); + llvm::Function* sliced = llvm::get_slice(v); + igen.setSliceMap(&slices); + igen.visit(sliced); + delete sliced; + return code; +} + +void ContractsExtractor::visitCallInst(llvm::CallInst& ci) { + using namespace llvm; + Function* f = ci.getCalledFunction(); + + if (f && rep.id(f).find("forall") != string::npos) { + assert(ci.getNumArgOperands() == 2 && "Unexpected operands to forall."); + Value* var = ci.getArgOperand(0); + Value* arg = ci.getArgOperand(1); + const Expr* e = Expr::forall(rep.getString(var), "int", sliceExpr(arg)); + ci.setArgOperand(1,ConstantInt::get(Type::getInt32Ty(ci.getContext()),slices.size())); + slices.push_back(e); + llvm::remove_slice(arg); + + } else if (f && rep.id(f).find("exists") != string::npos) { + assert(ci.getNumArgOperands() == 2 && "Unexpected operands to exists."); + Value* var = ci.getArgOperand(0); + Value* arg = ci.getArgOperand(1); + const Expr* e = Expr::exists(rep.getString(var), "int", sliceExpr(arg)); + ci.setArgOperand(1,ConstantInt::get(Type::getInt32Ty(ci.getContext()),slices.size())); + slices.push_back(e); + llvm::remove_slice(arg); + + } else if (f && rep.id(f).find("requires") != string::npos) { + assert(ci.getNumArgOperands() == 1 && "Unexpected operands to requires."); + proc.addRequires(sliceExpr(ci.getArgOperand(0))); + llvm::remove_slice(&ci); + + } else if (f && rep.id(f).find("ensures") != string::npos) { + assert(ci.getNumArgOperands() == 1 && "Unexpected operands to ensures."); + proc.addEnsures(sliceExpr(ci.getArgOperand(0))); + llvm::remove_slice(&ci); + + } else if (f && rep.id(f).find("invariant") != string::npos) { + assert(ci.getNumArgOperands() == 1 && "Unexpected operands to invariant."); + Value* arg = ci.getArgOperand(0); + const Expr* e = sliceExpr(arg); + Value* sliceIdx = ConstantInt::get(Type::getInt32Ty(ci.getContext()),slices.size()); + ci.setArgOperand(0,sliceIdx); + slices.push_back(e); + + BasicBlock* body = ci.getParent(); + BasicBlock* head = body->getSinglePredecessor(); + assert(head && "Expected single predecessor block."); + ArrayRef args(sliceIdx); + ArrayRef params(Type::getInt32Ty(ci.getContext())); + CallInst::Create( + Function::Create( + FunctionType::get(Type::getVoidTy(ci.getContext()),params,false), + GlobalValue::ExternalLinkage, "iassume"), + args,"",head->getTerminator()); + unsigned count = 0; + for (pred_iterator B = pred_begin(head), E = pred_end(head); B != E; ++B) { + CallInst::Create( + Function::Create( + FunctionType::get(Type::getVoidTy(ci.getContext()),params,false), + GlobalValue::ExternalLinkage, "iassert"), + args,"",(*B)->getTerminator()); + count++; + } + assert(count == 2 && "Expected head with two predecessors."); + count = 0; + for (succ_iterator B = succ_begin(head), E = succ_end(head); B != E; ++B) { + count++; + } + assert(count == 2 && "Expected head with two successors."); + + llvm::remove_slice(&ci); + } +} + +} diff --git a/lib/smack/SmackInstGenerator.cpp b/lib/smack/SmackInstGenerator.cpp index 0c13cfbb1..86116f81b 100644 --- a/lib/smack/SmackInstGenerator.cpp +++ b/lib/smack/SmackInstGenerator.cpp @@ -514,28 +514,28 @@ void SmackInstGenerator::visitCallInst(llvm::CallInst& ci) { } else if (f && rep.id(f).find("forall") != string::npos) { assert(ci.getNumArgOperands() == 2 && "Unexpected operands to forall."); llvm::ConstantInt* cidx = llvm::dyn_cast(ci.getArgOperand(1)); - if (cidx && qMap) { + if (cidx && slices) { uint64_t idx = cidx->getLimitedValue(); - assert(qMap->size() > idx && "Did not find slice expression."); - currBlock->addStmt(Stmt::assign(rep.expr(&ci),(*qMap)[idx])); + assert(slices->size() > idx && "Did not find slice expression."); + currBlock->addStmt(Stmt::assign(rep.expr(&ci),(*slices)[idx])); } } else if (f && rep.id(f).find("iassert") != string::npos) { assert(ci.getNumArgOperands() == 1 && "Unexpected operands to invariant."); llvm::ConstantInt* cidx = llvm::dyn_cast(ci.getArgOperand(0)); - if (cidx && qMap) { + if (cidx && slices) { uint64_t idx = cidx->getLimitedValue(); - assert(qMap->size() > idx && "Did not find slice expression."); - currBlock->addStmt(Stmt::assert_((*qMap)[idx])); + assert(slices->size() > idx && "Did not find slice expression."); + currBlock->addStmt(Stmt::assert_((*slices)[idx])); } } else if (f && rep.id(f).find("iassume") != string::npos) { assert(ci.getNumArgOperands() == 1 && "Unexpected operands to invariant."); llvm::ConstantInt* cidx = llvm::dyn_cast(ci.getArgOperand(0)); - if (cidx && qMap) { + if (cidx && slices) { uint64_t idx = cidx->getLimitedValue(); - assert(qMap->size() > idx && "Did not find slice expression."); - currBlock->addStmt(Stmt::assume((*qMap)[idx])); + assert(slices->size() > idx && "Did not find slice expression."); + currBlock->addStmt(Stmt::assume((*slices)[idx])); } } else if (f) { diff --git a/lib/smack/SmackModuleGenerator.cpp b/lib/smack/SmackModuleGenerator.cpp index 3cddec09d..06d5ef724 100644 --- a/lib/smack/SmackModuleGenerator.cpp +++ b/lib/smack/SmackModuleGenerator.cpp @@ -4,111 +4,13 @@ // #include "smack/SmackModuleGenerator.h" #include "smack/SmackOptions.h" -#include "smack/Slicing.h" +#include "smack/Contracts.h" namespace smack { llvm::RegisterPass X("smack", "SMACK generator pass"); char SmackModuleGenerator::ID = 0; -class SpecCollector : public llvm::InstVisitor { -private: - SmackRep& rep; - ProcDecl& proc; - Program& program; - - vector slices; - -public: - SpecCollector(SmackRep& r, ProcDecl& d, Program& p) - : rep(r), proc(d), program(p) {} - - vector& getSlices() { - return slices; - } - - Expr* slice_expr(SmackRep& rep, llvm::Value* v) { - CodeExpr* code = new CodeExpr(*rep.getProgram()); - SmackInstGenerator igen(rep, *code, slices.size()); - llvm::Function* sliced = llvm::get_slice(v); - igen.setQuantifierMap(&slices); - igen.visit(sliced); - delete sliced; - return code; - } - - void visitCallInst(llvm::CallInst& ci) { - using namespace llvm; - Function* f = ci.getCalledFunction(); - - if (f && rep.id(f).find("forall") != string::npos) { - assert(ci.getNumArgOperands() == 2 && "Unexpected operands to forall."); - Value* var = ci.getArgOperand(0); - Value* arg = ci.getArgOperand(1); - const Expr* e = Expr::forall(rep.getString(var), "int", slice_expr(rep,arg)); - ci.setArgOperand(1,ConstantInt::get(Type::getInt32Ty(ci.getContext()),slices.size())); - slices.push_back(e); - llvm::remove_slice(arg); - - } else if (f && rep.id(f).find("exists") != string::npos) { - assert(ci.getNumArgOperands() == 2 && "Unexpected operands to exists."); - Value* var = ci.getArgOperand(0); - Value* arg = ci.getArgOperand(1); - const Expr* e = Expr::exists(rep.getString(var), "int", slice_expr(rep,arg)); - ci.setArgOperand(1,ConstantInt::get(Type::getInt32Ty(ci.getContext()),slices.size())); - slices.push_back(e); - llvm::remove_slice(arg); - - } else if (f && rep.id(f).find("requires") != string::npos) { - assert(ci.getNumArgOperands() == 1 && "Unexpected operands to requires."); - proc.addRequires(slice_expr(rep,ci.getArgOperand(0))); - llvm::remove_slice(&ci); - - } else if (f && rep.id(f).find("ensures") != string::npos) { - assert(ci.getNumArgOperands() == 1 && "Unexpected operands to ensures."); - proc.addEnsures(slice_expr(rep,ci.getArgOperand(0))); - llvm::remove_slice(&ci); - - } else if (f && rep.id(f).find("invariant") != string::npos) { - assert(ci.getNumArgOperands() == 1 && "Unexpected operands to invariant."); - Value* arg = ci.getArgOperand(0); - const Expr* e = slice_expr(rep,arg); - Value* sliceIdx = ConstantInt::get(Type::getInt32Ty(ci.getContext()),slices.size()); - ci.setArgOperand(0,sliceIdx); - slices.push_back(e); - - BasicBlock* body = ci.getParent(); - BasicBlock* head = body->getSinglePredecessor(); - assert(head && "Expected single predecessor block."); - ArrayRef args(sliceIdx); - ArrayRef params(Type::getInt32Ty(ci.getContext())); - CallInst::Create( - Function::Create( - FunctionType::get(Type::getVoidTy(ci.getContext()),params,false), - GlobalValue::ExternalLinkage, "iassume"), - args,"",head->getTerminator()); - unsigned count = 0; - for (pred_iterator B = pred_begin(head), E = pred_end(head); B != E; ++B) { - CallInst::Create( - Function::Create( - FunctionType::get(Type::getVoidTy(ci.getContext()),params,false), - GlobalValue::ExternalLinkage, "iassert"), - args,"",(*B)->getTerminator()); - count++; - } - assert(count == 2 && "Expected head with two predecessors."); - count = 0; - for (succ_iterator B = succ_begin(head), E = succ_end(head); B != E; ++B) { - count++; - } - assert(count == 2 && "Expected head with two successors."); - - llvm::remove_slice(&ci); - } - } - -}; - void SmackModuleGenerator::generateProgram(llvm::Module& m, SmackRep* rep) { rep->setProgram( &program ); @@ -148,11 +50,11 @@ void SmackModuleGenerator::generateProgram(llvm::Module& m, SmackRep* rep) { DEBUG(errs() << "Analyzing function: " << rep->id(func) << "\n"); - SpecCollector sc(*rep, *proc, program); - sc.visit(func); + ContractsExtractor ce(*rep, *proc); + ce.visit(func); SmackInstGenerator igen(*rep, *proc); - igen.setQuantifierMap(&sc.getSlices()); + igen.setSliceMap(&ce.getSlices()); igen.visit(func); // First execute static initializers, in the main procedure. From 7c066ba312d2032d592f978b1fe5ffb48a790a48 Mon Sep 17 00:00:00 2001 From: Michael Emmi Date: Fri, 25 Jul 2014 19:14:10 +0200 Subject: [PATCH 017/140] Regression tests for contracts. --- test/contracts/.gitignore | 4 ++++ test/contracts/run.py | 45 ++++++++++++++++++++++++++++++++++++ test/contracts/simple.c | 27 ++++++++++++++++++++++ test/contracts/simple_fail.c | 27 ++++++++++++++++++++++ 4 files changed, 103 insertions(+) create mode 100644 test/contracts/.gitignore create mode 100755 test/contracts/run.py create mode 100644 test/contracts/simple.c create mode 100644 test/contracts/simple_fail.c diff --git a/test/contracts/.gitignore b/test/contracts/.gitignore new file mode 100644 index 000000000..5f36c5029 --- /dev/null +++ b/test/contracts/.gitignore @@ -0,0 +1,4 @@ +*.ll +*.bc +*.o +*.bpl diff --git a/test/contracts/run.py b/test/contracts/run.py new file mode 100755 index 000000000..65e56c697 --- /dev/null +++ b/test/contracts/run.py @@ -0,0 +1,45 @@ +#! /usr/bin/env python + +import subprocess +import re +import glob +import time + +def red(text): + return '\033[0;31m' + text + '\033[0m' + +def green(text): + return '\033[0;32m' + text + '\033[0m' + +def expect(file): + for line in open(file).readlines(): + match = re.search(r'@expect (.*)',line) + if match: + return match.group(1) + print red("WARNING: @expect MISSING IN %s" % file), + return "" + +print "Running CONTRACTS regression tests..." +print + +passed = failed = 0 +for test in glob.glob("*.c"): + + print "{0:>20} :".format(test), + + # invoke SMACK + t0 = time.time() + cmd = ['smack-verify.py', test, '--verifier=boogie-plain'] + p = subprocess.Popen(cmd, stdout=subprocess.PIPE) + + # check SMACK output + if re.search(expect(test), p.communicate()[0]): + print green('PASSED') + ' [%.2fs]' % round(time.time() - t0, 2) + passed += 1 + else: + print red('FAILED') + failed += 1 + +print +print 'PASSED count: ', passed +print 'FAILED count: ', failed diff --git a/test/contracts/simple.c b/test/contracts/simple.c new file mode 100644 index 000000000..4bf91fc1a --- /dev/null +++ b/test/contracts/simple.c @@ -0,0 +1,27 @@ +#include +#include +#include "smack.h" + +// @expect 5 verified, 1 errors? + +int g; + +void p() { + requires(g > 0); + ensures(g > 0); + for (int i=0; i < 10; i++) { + invariant(g > 0); + g++; + } + return; +} + +int main(void) { + g = 1; + for (int i=0; i<10; i++) { + invariant(g > 0); + p(); + } + __SMACK_assert(g > 0); + return 0; +} \ No newline at end of file diff --git a/test/contracts/simple_fail.c b/test/contracts/simple_fail.c new file mode 100644 index 000000000..2d3a214d2 --- /dev/null +++ b/test/contracts/simple_fail.c @@ -0,0 +1,27 @@ +#include +#include +#include "smack.h" + +// @expect 4 verified, 2 errors? + +int g; + +void p() { + requires(g > 0); + ensures(g > 0); + for (int i=0; i < 10; i++) { + invariant(g >= 0); + g++; + } + return; +} + +int main(void) { + g = 1; + for (int i=0; i<10; i++) { + invariant(g > 0); + p(); + } + __SMACK_assert(g > 0); + return 0; +} \ No newline at end of file From 58332e00c0c56e9ae80fa9b2928594020bbf165c Mon Sep 17 00:00:00 2001 From: Michael Emmi Date: Wed, 30 Jul 2014 00:37:54 +0200 Subject: [PATCH 018/140] Better contract extraction. --- bin/smackgen.py | 3 + include/smack/Contracts.h | 1 + include/smack/Slicing.h | 17 +++- include/smack/SmackInstGenerator.h | 20 +++- include/smack/SmackRep.h | 3 +- lib/smack/Contracts.cpp | 47 ++++++---- lib/smack/Slicing.cpp | 144 ++++++++++++++--------------- lib/smack/SmackInstGenerator.cpp | 119 ++++++++++++------------ test/contracts/array.c | 12 +++ test/contracts/array_fail.c | 12 +++ test/contracts/simple.c | 2 +- test/contracts/simple_fail.c | 2 +- 12 files changed, 226 insertions(+), 156 deletions(-) create mode 100644 test/contracts/array.c create mode 100644 test/contracts/array_fail.c diff --git a/bin/smackgen.py b/bin/smackgen.py index bbcf9eac1..79ccc1a20 100755 --- a/bin/smackgen.py +++ b/bin/smackgen.py @@ -93,6 +93,9 @@ def smackGenerate(sysArgv): inputFile.close() p = re.compile('procedure\s+([^\s(]*)\s*\(') + si = re.compile('procedure\s+(\$static_init)\s*\(') + if args.verifier == 'boogie-plain': + bpl = si.sub(lambda match: addInline(match, args.entryPoints, args.unroll), bpl) if args.verifier == 'boogie-inline': # put inline on procedures bpl = p.sub(lambda match: addInline(match, args.entryPoints, args.unroll), bpl) diff --git a/include/smack/Contracts.h b/include/smack/Contracts.h index 384022fce..f90a9d58e 100644 --- a/include/smack/Contracts.h +++ b/include/smack/Contracts.h @@ -19,6 +19,7 @@ class ContractsExtractor : public llvm::InstVisitor { void visitCallInst(llvm::CallInst& ci); Expr* sliceExpr(llvm::Value* v); + llvm::Value* sliceIdx(llvm::Value& ctx); vector& getSlices() { return slices; } }; diff --git a/include/smack/Slicing.h b/include/smack/Slicing.h index ab14e0b18..84241c56e 100644 --- a/include/smack/Slicing.h +++ b/include/smack/Slicing.h @@ -1,8 +1,19 @@ +// +// Copyright (c) 2013 Zvonimir Rakamaric (zvonimir@cs.utah.edu), +// Michael Emmi (michael.emmi@gmail.com) +// This file is distributed under the MIT License. See LICENSE for details. +// #include "llvm/InstVisitor.h" +#include "llvm/Analysis/AliasAnalysis.h" +#include + +using namespace std; namespace llvm { - Function* slice(Value* v, bool exclude=false, bool inPlace=false); - Function* get_slice(Value* v); - void remove_slice(Value* v); + + unordered_set getSlice(Value* V); + + Function* slice(Value* V); + } diff --git a/include/smack/SmackInstGenerator.h b/include/smack/SmackInstGenerator.h index 2942791c4..498e4cbea 100644 --- a/include/smack/SmackInstGenerator.h +++ b/include/smack/SmackInstGenerator.h @@ -8,7 +8,7 @@ #include "smack/BoogieAst.h" #include "smack/SmackRep.h" #include "llvm/InstVisitor.h" -#include +#include namespace smack { @@ -40,12 +40,30 @@ class SmackInstGenerator : public llvm::InstVisitor { void addTopDecl(Decl* d) { proc.getProg().addDecl(d); } void addBlock(Block* b) { proc.addBlock(b); } + void emit(const Stmt* s) { currBlock->addStmt(s); } + public: SmackInstGenerator(SmackRep& r, CodeContainer& p, int varNamespace = -1) : rep(r), proc(p), blockNum(0), varNum(0), varNs(varNamespace) {} void setSliceMap(vector* sm) { slices = sm; } + void visitSlice(llvm::Function* F, unordered_set slice) { + using namespace llvm; + for (Function::iterator B = F->begin(), E = F->end(); B != E; ++B) { + bool blockVisited = false; + for (BasicBlock::iterator I = B->begin(), G = B->end(); I != G; ++I) { + if (slice.count(&*I)) { + if (!blockVisited) { + visitBasicBlock(*B); + blockVisited = true; + } + visit(*I); + } + } + } + } + void visitBasicBlock(llvm::BasicBlock& bb); void visitInstruction(llvm::Instruction& i); diff --git a/include/smack/SmackRep.h b/include/smack/SmackRep.h index 18ca46fad..439269c20 100644 --- a/include/smack/SmackRep.h +++ b/include/smack/SmackRep.h @@ -143,7 +143,8 @@ class SmackRep { : aliasAnalysis(aa), targetData(aa->getDataLayout()), globalsBottom(0) { uniqueFpNum = 0; uniqueUndefNum = 0; - } + } + DSAAliasAnalysis* getAliasAnalysis() { return aliasAnalysis; } private: void addInit(unsigned region, const Expr* addr, const llvm::Constant* val); diff --git a/lib/smack/Contracts.cpp b/lib/smack/Contracts.cpp index 5144db263..d6310a7a4 100644 --- a/lib/smack/Contracts.cpp +++ b/lib/smack/Contracts.cpp @@ -1,17 +1,31 @@ #include "smack/Contracts.h" +#include "llvm/Support/InstIterator.h" namespace smack { -Expr* ContractsExtractor::sliceExpr(llvm::Value* v) { +Expr* ContractsExtractor::sliceExpr(llvm::Value* V) { + using namespace llvm; + CodeExpr* code = new CodeExpr(*rep.getProgram()); SmackInstGenerator igen(rep, *code, slices.size()); - llvm::Function* sliced = llvm::get_slice(v); + + Instruction* I = dyn_cast(V); + assert(I && "Expected instruction."); + llvm::Function* F = I->getParent()->getParent(); + Instruction* J = ReturnInst::Create(I->getContext(), I, I->getParent()); + unordered_set slice = llvm::getSlice(J); igen.setSliceMap(&slices); - igen.visit(sliced); + igen.visitSlice(F,slice); + llvm::Function* sliced = llvm::slice(J); delete sliced; return code; } +llvm::Value* ContractsExtractor::sliceIdx(llvm::Value& ctx) { + using namespace llvm; + return ConstantInt::get(Type::getInt32Ty(ctx.getContext()),slices.size()); +} + void ContractsExtractor::visitCallInst(llvm::CallInst& ci) { using namespace llvm; Function* f = ci.getCalledFunction(); @@ -21,41 +35,43 @@ void ContractsExtractor::visitCallInst(llvm::CallInst& ci) { Value* var = ci.getArgOperand(0); Value* arg = ci.getArgOperand(1); const Expr* e = Expr::forall(rep.getString(var), "int", sliceExpr(arg)); - ci.setArgOperand(1,ConstantInt::get(Type::getInt32Ty(ci.getContext()),slices.size())); + ci.setArgOperand(1,sliceIdx(ci)); slices.push_back(e); - llvm::remove_slice(arg); } else if (f && rep.id(f).find("exists") != string::npos) { assert(ci.getNumArgOperands() == 2 && "Unexpected operands to exists."); Value* var = ci.getArgOperand(0); Value* arg = ci.getArgOperand(1); const Expr* e = Expr::exists(rep.getString(var), "int", sliceExpr(arg)); - ci.setArgOperand(1,ConstantInt::get(Type::getInt32Ty(ci.getContext()),slices.size())); + ci.setArgOperand(1,sliceIdx(ci)); slices.push_back(e); - llvm::remove_slice(arg); } else if (f && rep.id(f).find("requires") != string::npos) { assert(ci.getNumArgOperands() == 1 && "Unexpected operands to requires."); - proc.addRequires(sliceExpr(ci.getArgOperand(0))); - llvm::remove_slice(&ci); + Value* V = ci.getArgOperand(0); + ci.setArgOperand(0,sliceIdx(ci)); + proc.addRequires(sliceExpr(V)); + ci.eraseFromParent(); } else if (f && rep.id(f).find("ensures") != string::npos) { assert(ci.getNumArgOperands() == 1 && "Unexpected operands to ensures."); - proc.addEnsures(sliceExpr(ci.getArgOperand(0))); - llvm::remove_slice(&ci); + Value* V = ci.getArgOperand(0); + ci.setArgOperand(0,sliceIdx(ci)); + proc.addEnsures(sliceExpr(V)); + ci.eraseFromParent(); } else if (f && rep.id(f).find("invariant") != string::npos) { assert(ci.getNumArgOperands() == 1 && "Unexpected operands to invariant."); Value* arg = ci.getArgOperand(0); + Value* idx = sliceIdx(ci); + ci.setArgOperand(0,idx); const Expr* e = sliceExpr(arg); - Value* sliceIdx = ConstantInt::get(Type::getInt32Ty(ci.getContext()),slices.size()); - ci.setArgOperand(0,sliceIdx); slices.push_back(e); BasicBlock* body = ci.getParent(); BasicBlock* head = body->getSinglePredecessor(); assert(head && "Expected single predecessor block."); - ArrayRef args(sliceIdx); + ArrayRef args(idx); ArrayRef params(Type::getInt32Ty(ci.getContext())); CallInst::Create( Function::Create( @@ -77,8 +93,7 @@ void ContractsExtractor::visitCallInst(llvm::CallInst& ci) { count++; } assert(count == 2 && "Expected head with two successors."); - - llvm::remove_slice(&ci); + ci.eraseFromParent(); } } diff --git a/lib/smack/Slicing.cpp b/lib/smack/Slicing.cpp index 062f301c7..88e39ae3b 100644 --- a/lib/smack/Slicing.cpp +++ b/lib/smack/Slicing.cpp @@ -4,11 +4,10 @@ // This file is distributed under the MIT License. See LICENSE for details. // +#include "smack/Slicing.h" #include "llvm/Transforms/Utils/Cloning.h" #include "llvm/IR/Instructions.h" -#include "smack/BoogieAst.h" -#include "smack/SmackRep.h" -#include "smack/SmackInstGenerator.h" +#include "llvm/Support/Debug.h" #include #include #include @@ -17,53 +16,84 @@ using namespace std; namespace llvm { - Function* slice(Value* v, bool exclude=false, bool inPlace=false) { - Function* slice; + unordered_set getSlice(Value* V) { + unordered_set slice; + Instruction* I = dyn_cast(V); + assert( I && "Expected instruction value."); queue workList; - set markedI; - set markedB; + workList.push(I); - Instruction* I = dyn_cast(v); - assert(I && "Expected instruction value."); - - Function* f = I->getParent()->getParent(); + while (!workList.empty()) { + Instruction* I = workList.front(); + workList.pop(); + if (slice.find(I) != slice.end()) + continue; + slice.insert(I); - // DEBUG(llvm::errs() << "COMPUTING SLICE " << *v << "\n"); - // DEBUG(llvm::errs() << "IN " << *f << "\n"); - // DEBUG(llvm::errs() << "exclude? " << exclude << "\n"); - // DEBUG(llvm::errs() << "inPlace? " << inPlace << "\n"); + if (BranchInst* Br = dyn_cast(I)) { + if (Br->isConditional()) { + if (Instruction* J = dyn_cast(Br->getCondition())) { + workList.push(J); + } + } + } else { + for (User::op_iterator U = I->op_begin(); U != I->op_end(); ++U) { + if (Instruction* J = dyn_cast(U)) { + workList.push(J); + } + } + } - if (inPlace) { - slice = f; - } else { - ValueToValueMapTy VMap; - slice = CloneFunction(f,VMap,true); - v = VMap[v]; + if (PHINode* Phi = dyn_cast(I)) { + for (PHINode::block_iterator B = Phi->block_begin(); B != Phi->block_end(); ++B) { + workList.push( (*B)->getTerminator() ); + } + } } - I = dyn_cast(v); + return slice; + } + + Function* slice(Value* V) { + map blockMap; + + Instruction* I = dyn_cast(V); assert(I && "Expected instruction value."); + Function* F = I->getParent()->getParent(); + Function* slice = Function::Create(F->getFunctionType(), GlobalValue::ExternalLinkage); - if (exclude) { - workList.push(I); - } else { - I->getParent()->getTerminator()->eraseFromParent(); - workList.push( ReturnInst::Create(I->getContext(),I,I->getParent()) ); - } + queue workList; + set covered; + + DEBUG(errs() << "COMPUTING SLICE " << *V << "\n"); + DEBUG(errs() << "FROM " << *F << "\n"); + + BasicBlock* B = BasicBlock::Create(slice->getContext(), "", slice, 0); + blockMap.insert(make_pair(I->getParent(),B)); + ReturnInst::Create(slice->getContext(),I,B); + workList.push(I); while (!workList.empty()) { Instruction* I = workList.front(); workList.pop(); + if (covered.count(I)) + continue; + covered.insert(I); - markedI.insert(I); - markedB.insert(I->getParent()); + BasicBlock* B = I->getParent(); + I->removeFromParent(); - if (PHINode* Phi = dyn_cast(I)) { - for (PHINode::block_iterator B = Phi->block_begin(); B != Phi->block_end(); ++B) { - workList.push( (*B)->getTerminator() ); - } - } + // TODO REMOVE THE BLOCK? + // TODO REMOVE TERMINATORS? + + BasicBlock* C; + if (blockMap.count(B)) + C = blockMap.find(B)->second; + else + blockMap.insert(make_pair(B, + C = BasicBlock::Create(slice->getContext(), "", slice, 0))); + C->getInstList().push_front(I); if (BranchInst* Br = dyn_cast(I)) { if (Br->isConditional()) { @@ -78,50 +108,18 @@ namespace llvm { } } } - } - - vector goneI; - vector goneB; - for (Function::iterator B = slice->begin(); B != slice->end(); ++B) { - for (BasicBlock::iterator I = B->begin(); I != B->end(); ++I) - if (!markedI.count(I) == !exclude) { - goneI.push_back(I); - I->dropAllReferences(); + if (PHINode* Phi = dyn_cast(I)) { + for (PHINode::block_iterator B = Phi->block_begin(); B != Phi->block_end(); ++B) { + workList.push( (*B)->getTerminator() ); } - - if (!exclude && markedB.count(B) == 0) - goneB.push_back(B); - } - - for (vector::reverse_iterator I = goneI.rbegin(); I != goneI.rend(); ++I) { - BasicBlock* B = (*I)->getParent(); - // NOTE THIS WILL BREAK SINCE I'S REFERENCES HAVE BEEN DROPPED - // DEBUG(errs() << "ERASING " << **I << "\n"); - // DEBUG(errs() << "FROM " << *(*I)->getParent() << "\n"); - // DEBUG(errs() << "IN " << *(*I)->getParent()->getParent() << "\n"); - (*I)->eraseFromParent(); - if (exclude && B->empty()) - goneB.push_back(B); - } - - for (vector::iterator B = goneB.begin(); B != goneB.end(); ++B) { - // DEBUG(errs() << "ERASING " << **B << "\n"); - // DEBUG(errs() << "FROM " << *(*B)->getParent() << "\n"); - (*B)->eraseFromParent(); + } } - // DEBUG(llvm::errs() << "COMPUTED SLICE " << *slice << "\n"); + DEBUG(errs() << "COMPUTED SLICE " << *slice << "\n"); + DEBUG(errs() << "WITH LEFTOVER " << *F << "\n"); return slice; } - Function* get_slice(Value* v) { - return slice(v); - } - - void remove_slice(Value* v) { - slice(v,true,true); - } - } diff --git a/lib/smack/SmackInstGenerator.cpp b/lib/smack/SmackInstGenerator.cpp index 86116f81b..2a03146b5 100644 --- a/lib/smack/SmackInstGenerator.cpp +++ b/lib/smack/SmackInstGenerator.cpp @@ -23,9 +23,9 @@ const bool CODE_WARN = true; const bool SHOW_ORIG = false; #define WARN(str) \ - if (CODE_WARN) currBlock->addStmt(Stmt::comment(string("WARNING: ") + str)) + if (CODE_WARN) emit(Stmt::comment(string("WARNING: ") + str)) #define ORIG(ins) \ - if (SHOW_ORIG) currBlock->addStmt(Stmt::comment(i2s(ins))) + if (SHOW_ORIG) emit(Stmt::comment(i2s(ins))) Regex VAR_DECL("^[[:space:]]*var[[:space:]]+([[:alpha:]_.$#'`~^\\?][[:alnum:]_.$#'`~^\\?]*):.*;"); @@ -125,8 +125,7 @@ void SmackInstGenerator::generatePhiAssigns(llvm::TerminatorInst& ti) { phi->getIncomingValueForBlock(block)) { nameInstruction(*phi); - currBlock->addStmt(Stmt::assign( - rep.expr(phi), rep.expr(v))); + emit(Stmt::assign(rep.expr(phi), rep.expr(v))); } } } @@ -149,10 +148,10 @@ void SmackInstGenerator::generateGotoStmts( dispatch.push_back(b->getName()); } - currBlock->addStmt(Stmt::goto_(dispatch)); + emit(Stmt::goto_(dispatch)); } else - currBlock->addStmt(Stmt::goto_(targets[0].second)); + emit(Stmt::goto_(targets[0].second)); } /******************************************************************************/ @@ -166,12 +165,12 @@ void SmackInstGenerator::visitReturnInst(llvm::ReturnInst& ri) { if (proc.isProc()) { if (v) - currBlock->addStmt(Stmt::assign(Expr::id(SmackRep::RET_VAR), rep.expr(v))); - currBlock->addStmt(Stmt::return_()); + emit(Stmt::assign(Expr::id(SmackRep::RET_VAR), rep.expr(v))); + emit(Stmt::return_()); } else { assert (v && "Expected return value."); - currBlock->addStmt(Stmt::return_(rep.expr(v))); + emit(Stmt::return_(rep.expr(v))); } } @@ -231,7 +230,7 @@ void SmackInstGenerator::visitSwitchInst(llvm::SwitchInst& si) { void SmackInstGenerator::visitUnreachableInst(llvm::UnreachableInst& ii) { processInstruction(ii); - currBlock->addStmt(Stmt::assume(Expr::lit(false))); + emit(Stmt::assume(Expr::lit(false))); } /******************************************************************************/ @@ -240,7 +239,7 @@ void SmackInstGenerator::visitUnreachableInst(llvm::UnreachableInst& ii) { void SmackInstGenerator::visitBinaryOperator(llvm::BinaryOperator& bo) { processInstruction(bo); - currBlock->addStmt(Stmt::assign(rep.expr(&bo), rep.op(&bo))); + emit(Stmt::assign(rep.expr(&bo), rep.op(&bo))); } /******************************************************************************/ @@ -261,30 +260,30 @@ void SmackInstGenerator::visitBinaryOperator(llvm::BinaryOperator& bo) { void SmackInstGenerator::visitAllocaInst(llvm::AllocaInst& ai) { processInstruction(ai); - currBlock->addStmt(rep.alloca(ai)); + emit(rep.alloca(ai)); } void SmackInstGenerator::visitLoadInst(llvm::LoadInst& li) { processInstruction(li); - currBlock->addStmt(Stmt::assign(rep.expr(&li),rep.mem(li.getPointerOperand()))); + emit(Stmt::assign(rep.expr(&li),rep.mem(li.getPointerOperand()))); if (SmackOptions::MemoryModelDebug) { - currBlock->addStmt(Stmt::call(SmackRep::REC_MEM_OP, Expr::id(SmackRep::MEM_OP_VAL))); - currBlock->addStmt(Stmt::call("boogie_si_record_int", Expr::lit(0))); - currBlock->addStmt(Stmt::call("boogie_si_record_int", rep.expr(li.getPointerOperand()))); - currBlock->addStmt(Stmt::call("boogie_si_record_int", rep.expr(&li))); + emit(Stmt::call(SmackRep::REC_MEM_OP, Expr::id(SmackRep::MEM_OP_VAL))); + emit(Stmt::call("boogie_si_record_int", Expr::lit(0))); + emit(Stmt::call("boogie_si_record_int", rep.expr(li.getPointerOperand()))); + emit(Stmt::call("boogie_si_record_int", rep.expr(&li))); } } void SmackInstGenerator::visitStoreInst(llvm::StoreInst& si) { processInstruction(si); - currBlock->addStmt(Stmt::assign(rep.mem(si.getPointerOperand()),rep.expr(si.getOperand(0)))); + emit(Stmt::assign(rep.mem(si.getPointerOperand()),rep.expr(si.getOperand(0)))); if (SmackOptions::MemoryModelDebug) { - currBlock->addStmt(Stmt::call(SmackRep::REC_MEM_OP, Expr::id(SmackRep::MEM_OP_VAL))); - currBlock->addStmt(Stmt::call("boogie_si_record_int", Expr::lit(1))); - currBlock->addStmt(Stmt::call("boogie_si_record_int", rep.expr(si.getPointerOperand()))); - currBlock->addStmt(Stmt::call("boogie_si_record_int", rep.expr(si.getOperand(0)))); + emit(Stmt::call(SmackRep::REC_MEM_OP, Expr::id(SmackRep::MEM_OP_VAL))); + emit(Stmt::call("boogie_si_record_int", Expr::lit(1))); + emit(Stmt::call("boogie_si_record_int", rep.expr(si.getPointerOperand()))); + emit(Stmt::call("boogie_si_record_int", rep.expr(si.getOperand(0)))); } } @@ -294,8 +293,8 @@ void SmackInstGenerator::visitAtomicCmpXchgInst(llvm::AtomicCmpXchgInst& i) { const Expr* ptr = rep.mem(i.getOperand(0)); const Expr* cmp = rep.expr(i.getOperand(1)); const Expr* swp = rep.expr(i.getOperand(2)); - currBlock->addStmt(Stmt::assign(res,ptr)); - currBlock->addStmt(Stmt::assign(ptr,Expr::cond(Expr::eq(ptr,cmp),swp,ptr))); + emit(Stmt::assign(res,ptr)); + emit(Stmt::assign(ptr,Expr::cond(Expr::eq(ptr,cmp),swp,ptr))); } void SmackInstGenerator::visitAtomicRMWInst(llvm::AtomicRMWInst& i) { @@ -345,8 +344,8 @@ void SmackInstGenerator::visitAtomicRMWInst(llvm::AtomicRMWInst& i) { assert(false && "unexpected atomic operation."); } - currBlock->addStmt(Stmt::assign(res,mem)); - currBlock->addStmt(Stmt::assign(mem,op)); + emit(Stmt::assign(res,mem)); + emit(Stmt::assign(mem,op)); } void SmackInstGenerator::visitGetElementPtrInst(llvm::GetElementPtrInst& gepi) { @@ -359,7 +358,7 @@ void SmackInstGenerator::visitGetElementPtrInst(llvm::GetElementPtrInst& gepi) { ps.push_back(gepi.getOperand(i)); ts.push_back(*typeI); } - currBlock->addStmt(Stmt::assign(rep.expr(&gepi), + emit(Stmt::assign(rep.expr(&gepi), rep.ptrArith(gepi.getPointerOperand(), ps, ts))); } @@ -369,67 +368,67 @@ void SmackInstGenerator::visitGetElementPtrInst(llvm::GetElementPtrInst& gepi) { void SmackInstGenerator::visitTruncInst(llvm::TruncInst& ti) { processInstruction(ti); - currBlock->addStmt(Stmt::assign(rep.expr(&ti), + emit(Stmt::assign(rep.expr(&ti), rep.trunc(ti.getOperand(0),ti.getType()))); } void SmackInstGenerator::visitZExtInst(llvm::ZExtInst& ci) { processInstruction(ci); - currBlock->addStmt(Stmt::assign(rep.expr(&ci), + emit(Stmt::assign(rep.expr(&ci), rep.zext(ci.getOperand(0),ci.getType()))); } void SmackInstGenerator::visitSExtInst(llvm::SExtInst& ci) { processInstruction(ci); - currBlock->addStmt(Stmt::assign(rep.expr(&ci), + emit(Stmt::assign(rep.expr(&ci), rep.sext(ci.getOperand(0),ci.getType()))); } void SmackInstGenerator::visitFPTruncInst(llvm::FPTruncInst& i) { processInstruction(i); - currBlock->addStmt(Stmt::assign(rep.expr(&i), + emit(Stmt::assign(rep.expr(&i), rep.fptrunc(i.getOperand(0),i.getType()))); } void SmackInstGenerator::visitFPExtInst(llvm::FPExtInst& i) { processInstruction(i); - currBlock->addStmt(Stmt::assign(rep.expr(&i), + emit(Stmt::assign(rep.expr(&i), rep.fpext(i.getOperand(0),i.getType()))); } void SmackInstGenerator::visitFPToUIInst(llvm::FPToUIInst& i) { processInstruction(i); - currBlock->addStmt(Stmt::assign(rep.expr(&i),rep.fp2ui(i.getOperand(0)))); + emit(Stmt::assign(rep.expr(&i),rep.fp2ui(i.getOperand(0)))); } void SmackInstGenerator::visitFPToSIInst(llvm::FPToSIInst& i) { processInstruction(i); - currBlock->addStmt(Stmt::assign(rep.expr(&i),rep.fp2si(i.getOperand(0)))); + emit(Stmt::assign(rep.expr(&i),rep.fp2si(i.getOperand(0)))); } void SmackInstGenerator::visitUIToFPInst(llvm::UIToFPInst& i) { processInstruction(i); - currBlock->addStmt(Stmt::assign(rep.expr(&i),rep.ui2fp(i.getOperand(0)))); + emit(Stmt::assign(rep.expr(&i),rep.ui2fp(i.getOperand(0)))); } void SmackInstGenerator::visitSIToFPInst(llvm::SIToFPInst& i) { processInstruction(i); - currBlock->addStmt(Stmt::assign(rep.expr(&i),rep.si2fp(i.getOperand(0)))); + emit(Stmt::assign(rep.expr(&i),rep.si2fp(i.getOperand(0)))); } void SmackInstGenerator::visitPtrToIntInst(llvm::PtrToIntInst& i) { processInstruction(i); - currBlock->addStmt(Stmt::assign(rep.expr(&i),rep.p2i(i.getOperand(0)))); + emit(Stmt::assign(rep.expr(&i),rep.p2i(i.getOperand(0)))); } void SmackInstGenerator::visitIntToPtrInst(llvm::IntToPtrInst& i) { processInstruction(i); - currBlock->addStmt(Stmt::assign(rep.expr(&i),rep.i2p(i.getOperand(0)))); + emit(Stmt::assign(rep.expr(&i),rep.i2p(i.getOperand(0)))); } void SmackInstGenerator::visitBitCastInst(llvm::BitCastInst& ci) { processInstruction(ci); - currBlock->addStmt(Stmt::assign(rep.expr(&ci), + emit(Stmt::assign(rep.expr(&ci), rep.bitcast(ci.getOperand(0),ci.getType()))); } @@ -439,12 +438,12 @@ void SmackInstGenerator::visitBitCastInst(llvm::BitCastInst& ci) { void SmackInstGenerator::visitICmpInst(llvm::ICmpInst& ci) { processInstruction(ci); - currBlock->addStmt(Stmt::assign(rep.expr(&ci), rep.pred(ci))); + emit(Stmt::assign(rep.expr(&ci), rep.pred(ci))); } void SmackInstGenerator::visitFCmpInst(llvm::FCmpInst& ci) { processInstruction(ci); - currBlock->addStmt(Stmt::assign(rep.expr(&ci), rep.pred(ci))); + emit(Stmt::assign(rep.expr(&ci), rep.pred(ci))); } void SmackInstGenerator::visitPHINode(llvm::PHINode& phi) { @@ -461,8 +460,8 @@ void SmackInstGenerator::visitSelectInst(llvm::SelectInst& i) { *v1 = rep.expr(i.getOperand(1)), *v2 = rep.expr(i.getOperand(2)); - currBlock->addStmt(Stmt::havoc(x)); - currBlock->addStmt(Stmt::assume(Expr::and_( + emit(Stmt::havoc(x)); + emit(Stmt::assume(Expr::and_( Expr::impl(c, Expr::eq(Expr::id(x), v1)), Expr::impl(Expr::not_(c), Expr::eq(Expr::id(x), v2)) ))); @@ -475,17 +474,17 @@ void SmackInstGenerator::visitCallInst(llvm::CallInst& ci) { if (ci.isInlineAsm()) { WARN("unsoundly ignoring inline asm call: " + i2s(ci)); - currBlock->addStmt(Stmt::skip()); + emit(Stmt::skip()); } else if (f && rep.id(f).find("llvm.dbg.") != string::npos) { WARN("ignoring llvm.debug call."); - currBlock->addStmt(Stmt::skip()); + emit(Stmt::skip()); } else if (f && rep.id(f) == "__SMACK_mod") { addMod(rep.code(ci)); } else if (f && rep.id(f) == "__SMACK_code") { - currBlock->addStmt(Stmt::code(rep.code(ci))); + emit(Stmt::code(rep.code(ci))); } else if (f && rep.id(f) == "__SMACK_decl") { addDecl(Decl::code(rep.code(ci))); @@ -501,14 +500,14 @@ void SmackInstGenerator::visitCallInst(llvm::CallInst& ci) { } else if (f && rep.id(f).find("qvar") != string::npos) { if (!proc.isProc()) { assert(ci.getNumArgOperands() == 1 && "Unexpected operands to var."); - currBlock->addStmt(Stmt::assign(rep.expr(&ci),Expr::id(rep.getString(ci.getArgOperand(0))))); + emit(Stmt::assign(rep.expr(&ci),Expr::id(rep.getString(ci.getArgOperand(0))))); } } else if (f && rep.id(f).find("old") != string::npos) { assert(ci.getNumArgOperands() == 1 && "Unexpected operands to var."); // TODO NEED TO ELIMiNATE TEMPORARY SSA VARIABLES HERE // .... IT'S NO USE TO USE OLD ON A PROCEDURE-LOCAL SSA VARIABLE. - currBlock->addStmt(Stmt::assign(rep.expr(&ci), + emit(Stmt::assign(rep.expr(&ci), Expr::fn("old",rep.expr(ci.getArgOperand(0))) )); } else if (f && rep.id(f).find("forall") != string::npos) { @@ -517,7 +516,7 @@ void SmackInstGenerator::visitCallInst(llvm::CallInst& ci) { if (cidx && slices) { uint64_t idx = cidx->getLimitedValue(); assert(slices->size() > idx && "Did not find slice expression."); - currBlock->addStmt(Stmt::assign(rep.expr(&ci),(*slices)[idx])); + emit(Stmt::assign(rep.expr(&ci),(*slices)[idx])); } } else if (f && rep.id(f).find("iassert") != string::npos) { @@ -526,7 +525,7 @@ void SmackInstGenerator::visitCallInst(llvm::CallInst& ci) { if (cidx && slices) { uint64_t idx = cidx->getLimitedValue(); assert(slices->size() > idx && "Did not find slice expression."); - currBlock->addStmt(Stmt::assert_((*slices)[idx])); + emit(Stmt::assert_((*slices)[idx])); } } else if (f && rep.id(f).find("iassume") != string::npos) { @@ -535,11 +534,11 @@ void SmackInstGenerator::visitCallInst(llvm::CallInst& ci) { if (cidx && slices) { uint64_t idx = cidx->getLimitedValue(); assert(slices->size() > idx && "Did not find slice expression."); - currBlock->addStmt(Stmt::assume((*slices)[idx])); + emit(Stmt::assume((*slices)[idx])); } } else if (f) { - currBlock->addStmt(rep.call(f, ci)); + emit(rep.call(f, ci)); } else { // function pointer call... @@ -554,9 +553,9 @@ void SmackInstGenerator::visitCallInst(llvm::CallInst& ci) { if (ce->isCast()) { llvm::Value* castValue = ce->getOperand(0); if (llvm::Function* castFunc = llvm::dyn_cast(castValue)) { - currBlock->addStmt(rep.call(castFunc, ci)); + emit(rep.call(castFunc, ci)); if (castFunc->isDeclaration() && rep.isExternal(&ci)) - currBlock->addStmt(Stmt::assume(Expr::fn("$isExternal",rep.expr(&ci)))); + emit(Stmt::assume(Expr::fn("$isExternal",rep.expr(&ci)))); return; } } @@ -576,7 +575,7 @@ void SmackInstGenerator::visitCallInst(llvm::CallInst& ci) { if (fs.size() == 1) { // Q: is this case really possible? - currBlock->addStmt(rep.call(fs[0], ci)); + emit(rep.call(fs[0], ci)); } else if (fs.size() > 1) { Block* tail = createBlock(); @@ -594,7 +593,7 @@ void SmackInstGenerator::visitCallInst(llvm::CallInst& ci) { } // Jump to the dispatch blocks. - currBlock->addStmt(Stmt::goto_(targets)); + emit(Stmt::goto_(targets)); // Update the current block for subsequent visits. currBlock = tail; @@ -603,12 +602,12 @@ void SmackInstGenerator::visitCallInst(llvm::CallInst& ci) { // In the worst case, we have no idea what function may have // been called... WARN("unsoundly ignoring indeterminate call: " + i2s(ci)); - currBlock->addStmt(Stmt::skip()); + emit(Stmt::skip()); } } if (f && f->isDeclaration() && rep.isExternal(&ci)) - currBlock->addStmt(Stmt::assume(Expr::fn("$isExternal",rep.expr(&ci)))); + emit(Stmt::assume(Expr::fn("$isExternal",rep.expr(&ci)))); } /******************************************************************************/ @@ -618,13 +617,13 @@ void SmackInstGenerator::visitCallInst(llvm::CallInst& ci) { void SmackInstGenerator::visitMemCpyInst(llvm::MemCpyInst& mci) { processInstruction(mci); assert (mci.getNumOperands() == 6); - currBlock->addStmt(rep.memcpy(mci)); + emit(rep.memcpy(mci)); } void SmackInstGenerator::visitMemSetInst(llvm::MemSetInst& msi) { processInstruction(msi); assert (msi.getNumOperands() == 6); - currBlock->addStmt(rep.memset(msi)); + emit(rep.memset(msi)); } } // namespace smack diff --git a/test/contracts/array.c b/test/contracts/array.c new file mode 100644 index 000000000..89ae58e83 --- /dev/null +++ b/test/contracts/array.c @@ -0,0 +1,12 @@ +#include +#include +#include "smack.h" + +// @expect 3 verified, 1 errors? + +int g[10]; + +int main(void) { + ensures(g[0] == 0); + return 0; +} \ No newline at end of file diff --git a/test/contracts/array_fail.c b/test/contracts/array_fail.c new file mode 100644 index 000000000..817feb920 --- /dev/null +++ b/test/contracts/array_fail.c @@ -0,0 +1,12 @@ +#include +#include +#include "smack.h" + +// @expect 2 verified, 2 errors? + +int g[10]; + +int main(void) { + ensures(g[0] == 1); + return 0; +} \ No newline at end of file diff --git a/test/contracts/simple.c b/test/contracts/simple.c index 4bf91fc1a..bad6df506 100644 --- a/test/contracts/simple.c +++ b/test/contracts/simple.c @@ -2,7 +2,7 @@ #include #include "smack.h" -// @expect 5 verified, 1 errors? +// @expect 4 verified, 1 errors? int g; diff --git a/test/contracts/simple_fail.c b/test/contracts/simple_fail.c index 2d3a214d2..0c50c2c2d 100644 --- a/test/contracts/simple_fail.c +++ b/test/contracts/simple_fail.c @@ -2,7 +2,7 @@ #include #include "smack.h" -// @expect 4 verified, 2 errors? +// @expect 3 verified, 2 errors? int g; From 3fc01f3a49dd9bf3e671927670c37cca1231ba42 Mon Sep 17 00:00:00 2001 From: Michael Emmi Date: Wed, 30 Jul 2014 10:06:57 -0400 Subject: [PATCH 019/140] Cleaned up contract extraction a bit. --- include/smack/Contracts.h | 19 ++++++++----- include/smack/SmackInstGenerator.h | 13 +++++++-- lib/smack/Contracts.cpp | 43 ++++++++++++------------------ lib/smack/Slicing.cpp | 2 +- lib/smack/SmackInstGenerator.cpp | 21 +++------------ lib/smack/SmackModuleGenerator.cpp | 2 +- 6 files changed, 46 insertions(+), 54 deletions(-) diff --git a/include/smack/Contracts.h b/include/smack/Contracts.h index f90a9d58e..99c0d3ebd 100644 --- a/include/smack/Contracts.h +++ b/include/smack/Contracts.h @@ -6,21 +6,28 @@ #include "smack/BoogieAst.h" namespace smack { +using namespace llvm; -class ContractsExtractor : public llvm::InstVisitor { +class ContractsExtractor : public InstVisitor { private: SmackRep& rep; ProcDecl& proc; - vector slices; + vector extracted; public: ContractsExtractor(SmackRep& r, ProcDecl& d) : rep(r), proc(d) {} - void visitCallInst(llvm::CallInst& ci); - Expr* sliceExpr(llvm::Value* v); - llvm::Value* sliceIdx(llvm::Value& ctx); - vector& getSlices() { return slices; } + vector& getExtracted() { return extracted; } + + void visitCallInst(CallInst& ci); + +private: + Expr* sliceExpr(Value* v); + + Value* extractionIdx(LLVMContext& ctx) { + return ConstantInt::get(Type::getInt32Ty(ctx),extracted.size()); + } }; } diff --git a/include/smack/SmackInstGenerator.h b/include/smack/SmackInstGenerator.h index 498e4cbea..619814063 100644 --- a/include/smack/SmackInstGenerator.h +++ b/include/smack/SmackInstGenerator.h @@ -22,7 +22,7 @@ class SmackInstGenerator : public llvm::InstVisitor { int blockNum; int varNum; int varNs; - vector* slices; + vector* extracted; string createVar(); Block* createBlock(); @@ -46,7 +46,16 @@ class SmackInstGenerator : public llvm::InstVisitor { SmackInstGenerator(SmackRep& r, CodeContainer& p, int varNamespace = -1) : rep(r), proc(p), blockNum(0), varNum(0), varNs(varNamespace) {} - void setSliceMap(vector* sm) { slices = sm; } + void setExtracted(vector& e) { extracted = &e; } + const Expr* getExtracted(llvm::Value* V) { + using namespace llvm; + if (ConstantInt* CI = dyn_cast(V)) { + uint64_t i = CI->getLimitedValue(); + assert(extracted && extracted->size() > i && "Did not find extracted expression."); + return (*extracted)[i]; + } + assert(false && "Unexpected value."); + } void visitSlice(llvm::Function* F, unordered_set slice) { using namespace llvm; diff --git a/lib/smack/Contracts.cpp b/lib/smack/Contracts.cpp index d6310a7a4..fdfbb985b 100644 --- a/lib/smack/Contracts.cpp +++ b/lib/smack/Contracts.cpp @@ -2,32 +2,23 @@ #include "llvm/Support/InstIterator.h" namespace smack { - -Expr* ContractsExtractor::sliceExpr(llvm::Value* V) { using namespace llvm; - CodeExpr* code = new CodeExpr(*rep.getProgram()); - SmackInstGenerator igen(rep, *code, slices.size()); - +Expr* ContractsExtractor::sliceExpr(Value* V) { Instruction* I = dyn_cast(V); assert(I && "Expected instruction."); - llvm::Function* F = I->getParent()->getParent(); + Function* F = I->getParent()->getParent(); Instruction* J = ReturnInst::Create(I->getContext(), I, I->getParent()); - unordered_set slice = llvm::getSlice(J); - igen.setSliceMap(&slices); - igen.visitSlice(F,slice); - llvm::Function* sliced = llvm::slice(J); - delete sliced; - return code; -} -llvm::Value* ContractsExtractor::sliceIdx(llvm::Value& ctx) { - using namespace llvm; - return ConstantInt::get(Type::getInt32Ty(ctx.getContext()),slices.size()); + CodeExpr* code = new CodeExpr(*rep.getProgram()); + SmackInstGenerator igen(rep, *code, extracted.size()); + igen.setExtracted(extracted); + igen.visitSlice(F,getSlice(J)); + delete llvm::slice(J); + return code; } -void ContractsExtractor::visitCallInst(llvm::CallInst& ci) { - using namespace llvm; +void ContractsExtractor::visitCallInst(CallInst& ci) { Function* f = ci.getCalledFunction(); if (f && rep.id(f).find("forall") != string::npos) { @@ -35,38 +26,38 @@ void ContractsExtractor::visitCallInst(llvm::CallInst& ci) { Value* var = ci.getArgOperand(0); Value* arg = ci.getArgOperand(1); const Expr* e = Expr::forall(rep.getString(var), "int", sliceExpr(arg)); - ci.setArgOperand(1,sliceIdx(ci)); - slices.push_back(e); + ci.setArgOperand(1,extractionIdx(ci.getContext())); + extracted.push_back(e); } else if (f && rep.id(f).find("exists") != string::npos) { assert(ci.getNumArgOperands() == 2 && "Unexpected operands to exists."); Value* var = ci.getArgOperand(0); Value* arg = ci.getArgOperand(1); const Expr* e = Expr::exists(rep.getString(var), "int", sliceExpr(arg)); - ci.setArgOperand(1,sliceIdx(ci)); - slices.push_back(e); + ci.setArgOperand(1,extractionIdx(ci.getContext())); + extracted.push_back(e); } else if (f && rep.id(f).find("requires") != string::npos) { assert(ci.getNumArgOperands() == 1 && "Unexpected operands to requires."); Value* V = ci.getArgOperand(0); - ci.setArgOperand(0,sliceIdx(ci)); + ci.setArgOperand(0,ConstantInt::getTrue(ci.getContext())); proc.addRequires(sliceExpr(V)); ci.eraseFromParent(); } else if (f && rep.id(f).find("ensures") != string::npos) { assert(ci.getNumArgOperands() == 1 && "Unexpected operands to ensures."); Value* V = ci.getArgOperand(0); - ci.setArgOperand(0,sliceIdx(ci)); + ci.setArgOperand(0,ConstantInt::getTrue(ci.getContext())); proc.addEnsures(sliceExpr(V)); ci.eraseFromParent(); } else if (f && rep.id(f).find("invariant") != string::npos) { assert(ci.getNumArgOperands() == 1 && "Unexpected operands to invariant."); Value* arg = ci.getArgOperand(0); - Value* idx = sliceIdx(ci); + Value* idx = extractionIdx(ci.getContext()); ci.setArgOperand(0,idx); const Expr* e = sliceExpr(arg); - slices.push_back(e); + extracted.push_back(e); BasicBlock* body = ci.getParent(); BasicBlock* head = body->getSinglePredecessor(); diff --git a/lib/smack/Slicing.cpp b/lib/smack/Slicing.cpp index 88e39ae3b..d7e90f168 100644 --- a/lib/smack/Slicing.cpp +++ b/lib/smack/Slicing.cpp @@ -27,7 +27,7 @@ namespace llvm { while (!workList.empty()) { Instruction* I = workList.front(); workList.pop(); - if (slice.find(I) != slice.end()) + if (slice.count(I)) continue; slice.insert(I); diff --git a/lib/smack/SmackInstGenerator.cpp b/lib/smack/SmackInstGenerator.cpp index 2a03146b5..0a5a10958 100644 --- a/lib/smack/SmackInstGenerator.cpp +++ b/lib/smack/SmackInstGenerator.cpp @@ -512,30 +512,15 @@ void SmackInstGenerator::visitCallInst(llvm::CallInst& ci) { } else if (f && rep.id(f).find("forall") != string::npos) { assert(ci.getNumArgOperands() == 2 && "Unexpected operands to forall."); - llvm::ConstantInt* cidx = llvm::dyn_cast(ci.getArgOperand(1)); - if (cidx && slices) { - uint64_t idx = cidx->getLimitedValue(); - assert(slices->size() > idx && "Did not find slice expression."); - emit(Stmt::assign(rep.expr(&ci),(*slices)[idx])); - } + emit(Stmt::assign(rep.expr(&ci),getExtracted(ci.getArgOperand(1)))); } else if (f && rep.id(f).find("iassert") != string::npos) { assert(ci.getNumArgOperands() == 1 && "Unexpected operands to invariant."); - llvm::ConstantInt* cidx = llvm::dyn_cast(ci.getArgOperand(0)); - if (cidx && slices) { - uint64_t idx = cidx->getLimitedValue(); - assert(slices->size() > idx && "Did not find slice expression."); - emit(Stmt::assert_((*slices)[idx])); - } + emit(Stmt::assert_(getExtracted(ci.getArgOperand(0)))); } else if (f && rep.id(f).find("iassume") != string::npos) { assert(ci.getNumArgOperands() == 1 && "Unexpected operands to invariant."); - llvm::ConstantInt* cidx = llvm::dyn_cast(ci.getArgOperand(0)); - if (cidx && slices) { - uint64_t idx = cidx->getLimitedValue(); - assert(slices->size() > idx && "Did not find slice expression."); - emit(Stmt::assume((*slices)[idx])); - } + emit(Stmt::assume(getExtracted(ci.getArgOperand(0)))); } else if (f) { emit(rep.call(f, ci)); diff --git a/lib/smack/SmackModuleGenerator.cpp b/lib/smack/SmackModuleGenerator.cpp index 06d5ef724..cab659fd7 100644 --- a/lib/smack/SmackModuleGenerator.cpp +++ b/lib/smack/SmackModuleGenerator.cpp @@ -54,7 +54,7 @@ void SmackModuleGenerator::generateProgram(llvm::Module& m, SmackRep* rep) { ce.visit(func); SmackInstGenerator igen(*rep, *proc); - igen.setSliceMap(&ce.getSlices()); + igen.setExtracted(ce.getExtracted()); igen.visit(func); // First execute static initializers, in the main procedure. From 17459ef0fafc89689b35c2140103829ac5b05e88 Mon Sep 17 00:00:00 2001 From: Michael Emmi Date: Thu, 31 Jul 2014 09:02:55 -0400 Subject: [PATCH 020/140] Quantified array expressions in ensures. --- lib/smack/Contracts.cpp | 4 ++-- test/contracts/forall.c | 12 ++++++++++++ test/contracts/forall_fail.c | 12 ++++++++++++ 3 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 test/contracts/forall.c create mode 100644 test/contracts/forall_fail.c diff --git a/lib/smack/Contracts.cpp b/lib/smack/Contracts.cpp index fdfbb985b..43e7e72e8 100644 --- a/lib/smack/Contracts.cpp +++ b/lib/smack/Contracts.cpp @@ -25,16 +25,16 @@ void ContractsExtractor::visitCallInst(CallInst& ci) { assert(ci.getNumArgOperands() == 2 && "Unexpected operands to forall."); Value* var = ci.getArgOperand(0); Value* arg = ci.getArgOperand(1); - const Expr* e = Expr::forall(rep.getString(var), "int", sliceExpr(arg)); ci.setArgOperand(1,extractionIdx(ci.getContext())); + const Expr* e = Expr::forall(rep.getString(var), "int", sliceExpr(arg)); extracted.push_back(e); } else if (f && rep.id(f).find("exists") != string::npos) { assert(ci.getNumArgOperands() == 2 && "Unexpected operands to exists."); Value* var = ci.getArgOperand(0); Value* arg = ci.getArgOperand(1); - const Expr* e = Expr::exists(rep.getString(var), "int", sliceExpr(arg)); ci.setArgOperand(1,extractionIdx(ci.getContext())); + const Expr* e = Expr::exists(rep.getString(var), "int", sliceExpr(arg)); extracted.push_back(e); } else if (f && rep.id(f).find("requires") != string::npos) { diff --git a/test/contracts/forall.c b/test/contracts/forall.c new file mode 100644 index 000000000..525688998 --- /dev/null +++ b/test/contracts/forall.c @@ -0,0 +1,12 @@ +#include +#include +#include "smack.h" + +// @expect 3 verified, 1 errors? + +int g[10]; + +int main(void) { + ensures(forall("x", g[qvar("x")] == 0 || qvar("x") < 0 || qvar("x") > 9)); + return 0; +} \ No newline at end of file diff --git a/test/contracts/forall_fail.c b/test/contracts/forall_fail.c new file mode 100644 index 000000000..9b1ea36de --- /dev/null +++ b/test/contracts/forall_fail.c @@ -0,0 +1,12 @@ +#include +#include +#include "smack.h" + +// @expect 2 verified, 2 errors? + +int g[10]; + +int main(void) { + ensures(forall("x", g[qvar("x")] == 0 || qvar("x") < 0 || qvar("x") > 10)); + return 0; +} \ No newline at end of file From 1e7fb41b15d217517bc13dd0a48f691fe954f47d Mon Sep 17 00:00:00 2001 From: Michael Emmi Date: Thu, 31 Jul 2014 09:21:33 -0400 Subject: [PATCH 021/140] Small simplification. --- lib/smack/SmackInstGenerator.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/smack/SmackInstGenerator.cpp b/lib/smack/SmackInstGenerator.cpp index 0a5a10958..9b3a31880 100644 --- a/lib/smack/SmackInstGenerator.cpp +++ b/lib/smack/SmackInstGenerator.cpp @@ -498,10 +498,8 @@ void SmackInstGenerator::visitCallInst(llvm::CallInst& ci) { } } else if (f && rep.id(f).find("qvar") != string::npos) { - if (!proc.isProc()) { - assert(ci.getNumArgOperands() == 1 && "Unexpected operands to var."); - emit(Stmt::assign(rep.expr(&ci),Expr::id(rep.getString(ci.getArgOperand(0))))); - } + assert(ci.getNumArgOperands() == 1 && "Unexpected operands to var."); + emit(Stmt::assign(rep.expr(&ci),Expr::id(rep.getString(ci.getArgOperand(0))))); } else if (f && rep.id(f).find("old") != string::npos) { assert(ci.getNumArgOperands() == 1 && "Unexpected operands to var."); From 238bbfc30feafbb5efe2f32ca9ee8951bf4955a7 Mon Sep 17 00:00:00 2001 From: Michael Emmi Date: Thu, 31 Jul 2014 10:10:06 -0400 Subject: [PATCH 022/140] Added result function. + A fix for smack-verify.py renaming. --- Makefile.llvm.rules | 2 +- bin/smackgen.py | 2 +- include/smack/smack.h | 1 + lib/smack/SmackInstGenerator.cpp | 8 ++++++-- test/contracts/run.py | 2 +- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Makefile.llvm.rules b/Makefile.llvm.rules index 98407b641..0ed8b54c6 100644 --- a/Makefile.llvm.rules +++ b/Makefile.llvm.rules @@ -2189,7 +2189,7 @@ install-local:: -o -name 'corral' \ ')' -print | grep -v CVS | \ grep -v .svn` ; do \ - instdir=`dirname "$(DESTDIR)$(PROJ_includedir)/$$scr"` ; \ + instdir=`dirname "$(DESTDIR)$(PROJ_bindir)/$$scr"` ; \ if test \! -d "$$instdir" ; then \ $(EchoCmd) Making install directory $$instdir ; \ $(MKDIR) $$instdir ;\ diff --git a/bin/smackgen.py b/bin/smackgen.py index f1d458166..afe9be711 100755 --- a/bin/smackgen.py +++ b/bin/smackgen.py @@ -102,7 +102,7 @@ def smackGenerate(sysArgv): si = re.compile('procedure\s+(\$static_init)\s*\(') if args.verifier == 'boogie-plain': bpl = si.sub(lambda match: addInline(match, args.entryPoints, args.unroll), bpl) - if args.verifier == 'boogie-inline': + elif args.verifier == 'boogie-inline': # put inline on procedures bpl = p.sub(lambda match: addInline(match, args.entryPoints, args.unroll), bpl) elif args.verifier == 'corral': diff --git a/include/smack/smack.h b/include/smack/smack.h index 38028c6de..ae7c5207e 100644 --- a/include/smack/smack.h +++ b/include/smack/smack.h @@ -53,6 +53,7 @@ bool forall(const char *var, bool expr); bool exists(const char *var, bool expr); int qvar(const char *var); int old(int term); +int result(); //// PROBLEM: in the 2D memory model, the declaration of boogie_si_record_int //// should have a type $ptr parameter, not an int. How should we do this? diff --git a/lib/smack/SmackInstGenerator.cpp b/lib/smack/SmackInstGenerator.cpp index 9b3a31880..4920b314f 100644 --- a/lib/smack/SmackInstGenerator.cpp +++ b/lib/smack/SmackInstGenerator.cpp @@ -497,12 +497,16 @@ void SmackInstGenerator::visitCallInst(llvm::CallInst& ci) { rep.addBplGlobal(var); } + } else if (f && rep.id(f).find("result") != string::npos) { + assert(ci.getNumArgOperands() == 0 && "Unexpected operands to result."); + emit(Stmt::assign(rep.expr(&ci),Expr::id(SmackRep::RET_VAR))); + } else if (f && rep.id(f).find("qvar") != string::npos) { - assert(ci.getNumArgOperands() == 1 && "Unexpected operands to var."); + assert(ci.getNumArgOperands() == 1 && "Unexpected operands to qvar."); emit(Stmt::assign(rep.expr(&ci),Expr::id(rep.getString(ci.getArgOperand(0))))); } else if (f && rep.id(f).find("old") != string::npos) { - assert(ci.getNumArgOperands() == 1 && "Unexpected operands to var."); + assert(ci.getNumArgOperands() == 1 && "Unexpected operands to old."); // TODO NEED TO ELIMiNATE TEMPORARY SSA VARIABLES HERE // .... IT'S NO USE TO USE OLD ON A PROCEDURE-LOCAL SSA VARIABLE. emit(Stmt::assign(rep.expr(&ci), diff --git a/test/contracts/run.py b/test/contracts/run.py index 65e56c697..36377e804 100755 --- a/test/contracts/run.py +++ b/test/contracts/run.py @@ -29,7 +29,7 @@ def expect(file): # invoke SMACK t0 = time.time() - cmd = ['smack-verify.py', test, '--verifier=boogie-plain'] + cmd = ['smackverify.py', test, '--verifier=boogie-plain'] p = subprocess.Popen(cmd, stdout=subprocess.PIPE) # check SMACK output From b7d6ae51ec1417a469cb1f705180c14edb1d723c Mon Sep 17 00:00:00 2001 From: Michael Emmi Date: Thu, 31 Jul 2014 10:30:28 -0400 Subject: [PATCH 023/140] Inlining all __SMACK procedures in boogie-plain mode. --- bin/smackgen.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/smackgen.py b/bin/smackgen.py index afe9be711..cb5e0624d 100755 --- a/bin/smackgen.py +++ b/bin/smackgen.py @@ -99,7 +99,7 @@ def smackGenerate(sysArgv): inputFile.close() p = re.compile('procedure\s+([^\s(]*)\s*\(') - si = re.compile('procedure\s+(\$static_init)\s*\(') + si = re.compile('procedure\s+(\$static_init|__SMACK_.*|)\s*\(') if args.verifier == 'boogie-plain': bpl = si.sub(lambda match: addInline(match, args.entryPoints, args.unroll), bpl) elif args.verifier == 'boogie-inline': From c037321830571df5b469a454319fb86c656f70ee Mon Sep 17 00:00:00 2001 From: Michael Emmi Date: Thu, 31 Jul 2014 10:32:52 -0400 Subject: [PATCH 024/140] Adjusting regression results. --- test/contracts/array.c | 2 +- test/contracts/array_fail.c | 2 +- test/contracts/forall.c | 2 +- test/contracts/forall_fail.c | 2 +- test/contracts/simple.c | 2 +- test/contracts/simple_fail.c | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/test/contracts/array.c b/test/contracts/array.c index 89ae58e83..d54d3654d 100644 --- a/test/contracts/array.c +++ b/test/contracts/array.c @@ -2,7 +2,7 @@ #include #include "smack.h" -// @expect 3 verified, 1 errors? +// @expect 1 verified, 0 errors? int g[10]; diff --git a/test/contracts/array_fail.c b/test/contracts/array_fail.c index 817feb920..39e58f894 100644 --- a/test/contracts/array_fail.c +++ b/test/contracts/array_fail.c @@ -2,7 +2,7 @@ #include #include "smack.h" -// @expect 2 verified, 2 errors? +// @expect 0 verified, 1 errors? int g[10]; diff --git a/test/contracts/forall.c b/test/contracts/forall.c index 525688998..f8c638406 100644 --- a/test/contracts/forall.c +++ b/test/contracts/forall.c @@ -2,7 +2,7 @@ #include #include "smack.h" -// @expect 3 verified, 1 errors? +// @expect 1 verified, 0 errors? int g[10]; diff --git a/test/contracts/forall_fail.c b/test/contracts/forall_fail.c index 9b1ea36de..e6863be83 100644 --- a/test/contracts/forall_fail.c +++ b/test/contracts/forall_fail.c @@ -2,7 +2,7 @@ #include #include "smack.h" -// @expect 2 verified, 2 errors? +// @expect 0 verified, 1 errors? int g[10]; diff --git a/test/contracts/simple.c b/test/contracts/simple.c index bad6df506..eb77d624c 100644 --- a/test/contracts/simple.c +++ b/test/contracts/simple.c @@ -2,7 +2,7 @@ #include #include "smack.h" -// @expect 4 verified, 1 errors? +// @expect 2 verified, 0 errors? int g; diff --git a/test/contracts/simple_fail.c b/test/contracts/simple_fail.c index 0c50c2c2d..929b4abac 100644 --- a/test/contracts/simple_fail.c +++ b/test/contracts/simple_fail.c @@ -2,7 +2,7 @@ #include #include "smack.h" -// @expect 3 verified, 2 errors? +// @expect 1 verified, 1 errors? int g; From 0f33f18c2d629d0148fdde6d03cbe1425ac46dba Mon Sep 17 00:00:00 2001 From: Michael Emmi Date: Thu, 31 Jul 2014 11:48:55 -0400 Subject: [PATCH 025/140] Old expression in contracts. --- lib/smack/SmackInstGenerator.cpp | 6 +++--- test/contracts/old.c | 17 +++++++++++++++++ test/contracts/old_fail.c | 17 +++++++++++++++++ 3 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 test/contracts/old.c create mode 100644 test/contracts/old_fail.c diff --git a/lib/smack/SmackInstGenerator.cpp b/lib/smack/SmackInstGenerator.cpp index 4920b314f..7ed6603b9 100644 --- a/lib/smack/SmackInstGenerator.cpp +++ b/lib/smack/SmackInstGenerator.cpp @@ -507,10 +507,10 @@ void SmackInstGenerator::visitCallInst(llvm::CallInst& ci) { } else if (f && rep.id(f).find("old") != string::npos) { assert(ci.getNumArgOperands() == 1 && "Unexpected operands to old."); - // TODO NEED TO ELIMiNATE TEMPORARY SSA VARIABLES HERE - // .... IT'S NO USE TO USE OLD ON A PROCEDURE-LOCAL SSA VARIABLE. + llvm::LoadInst* LI = llvm::dyn_cast(ci.getArgOperand(0)); + assert(LI && "Expected value from Load."); emit(Stmt::assign(rep.expr(&ci), - Expr::fn("old",rep.expr(ci.getArgOperand(0))) )); + Expr::fn("old",rep.mem(LI->getPointerOperand())) )); } else if (f && rep.id(f).find("forall") != string::npos) { assert(ci.getNumArgOperands() == 2 && "Unexpected operands to forall."); diff --git a/test/contracts/old.c b/test/contracts/old.c new file mode 100644 index 000000000..5ad4f02d7 --- /dev/null +++ b/test/contracts/old.c @@ -0,0 +1,17 @@ +#include +#include +#include "smack.h" + +// @expect 2 verified, 0 errors? + +int g; + +void p() { + ensures(g > old(g)); + g++; +} + +int main(void) { + p(); + return 0; +} \ No newline at end of file diff --git a/test/contracts/old_fail.c b/test/contracts/old_fail.c new file mode 100644 index 000000000..b81e7fd05 --- /dev/null +++ b/test/contracts/old_fail.c @@ -0,0 +1,17 @@ +#include +#include +#include "smack.h" + +// @expect 1 verified, 1 errors? + +int g; + +void p() { + ensures(g == old(g)); + g++; +} + +int main(void) { + p(); + return 0; +} \ No newline at end of file From 3291eb51f5ff9347eec1564e9b663b2461e9ff04 Mon Sep 17 00:00:00 2001 From: Pantazis Deligiannis Date: Mon, 4 Aug 2014 12:01:52 +0100 Subject: [PATCH 026/140] fixed cmake scripts to support removal of 2d memory model --- CMakeLists.txt | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 89ef5605f..d0a20120a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,38 +1,38 @@ -# +# # Copyright (c) 2013 Pantazis Deligiannis (p.deligiannis@imperial.ac.uk) # This file is distributed under the MIT License. See LICENSE for details. -# +# cmake_minimum_required(VERSION 2.8) project(smack) if (NOT WIN32 OR MSYS OR CYGWIN) find_program(LLVM_CONFIG_EXECUTABLE NAMES llvm-config PATHS ${LLVM_CONFIG} NO_DEFAULT_PATH DOC "llvm-config") - + if (LLVM_CONFIG_EXECUTABLE STREQUAL "LLVM_CONFIG_EXECUTABLE-NOTFOUND") message(FATAL_ERROR "llvm-config could not be found!") endif() - + execute_process( COMMAND ${LLVM_CONFIG_EXECUTABLE} --cxxflags OUTPUT_VARIABLE LLVM_CXXFLAGS OUTPUT_STRIP_TRAILING_WHITESPACE ) - + set(LLVM_CXXFLAGS "${LLVM_CXXFLAGS} -fno-exceptions -fno-rtti") - + execute_process( COMMAND ${LLVM_CONFIG_EXECUTABLE} --libs OUTPUT_VARIABLE LLVM_LIBS OUTPUT_STRIP_TRAILING_WHITESPACE ) - + execute_process( COMMAND ${LLVM_CONFIG_EXECUTABLE} --ldflags OUTPUT_VARIABLE LLVM_LDFLAGS OUTPUT_STRIP_TRAILING_WHITESPACE ) - + else() set(LLVM_SRC "" CACHE PATH "LLVM source directory") set(LLVM_BUILD "" CACHE PATH "LLVM build directory") @@ -50,7 +50,7 @@ else() set(LLVM_CXXFLAGS "\"/I${LLVM_SRC}/include\" \"/I${LLVM_BUILD}/include\" -D_SCL_SECURE_NO_WARNINGS -wd4146 -wd4244 -wd4355 -wd4482 -wd4800") set(LLVM_LDFLAGS "") set(LLVM_LIBS "${LLVM_LIBDIR}/LLVMTransformUtils.lib" "${LLVM_LIBDIR}/LLVMipa.lib" "${LLVM_LIBDIR}/LLVMAnalysis.lib" "${LLVM_LIBDIR}/LLVMTarget.lib" "${LLVM_LIBDIR}/LLVMMC.lib" "${LLVM_LIBDIR}/LLVMObject.lib" "${LLVM_LIBDIR}/LLVMBitReader.lib" "${LLVM_LIBDIR}/LLVMCore.lib" "${LLVM_LIBDIR}/LLVMSupport.lib") - + endif() include_directories(include) @@ -145,7 +145,6 @@ add_library(smackTranslator STATIC include/smack/SmackModuleGenerator.h include/smack/SmackOptions.h include/smack/SmackRep.h - include/smack/SmackRep2dMem.h include/smack/SmackRepFlatMem.h lib/smack/BoogieAst.cpp lib/smack/BplFilePrinter.cpp @@ -155,7 +154,6 @@ add_library(smackTranslator STATIC lib/smack/SmackModuleGenerator.cpp lib/smack/SmackOptions.cpp lib/smack/SmackRep.cpp - lib/smack/SmackRep2dMem.cpp lib/smack/SmackRepFlatMem.cpp ) @@ -184,4 +182,3 @@ INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/bin/boogie GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ DESTINATION bin ) - From 8da3ef31779b29e41c8ba91668a4d8b9d73feb03 Mon Sep 17 00:00:00 2001 From: Michael Emmi Date: Mon, 4 Aug 2014 10:24:32 -0400 Subject: [PATCH 027/140] Replaced C++11 nullptr keyword with 0. --- include/smack/BoogieAst.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/smack/BoogieAst.h b/include/smack/BoogieAst.h index 33d20883d..5e9b4e310 100644 --- a/include/smack/BoogieAst.h +++ b/include/smack/BoogieAst.h @@ -265,7 +265,7 @@ class HavocStmt : public Stmt { class ReturnStmt : public Stmt { const Expr* expr; public: - ReturnStmt(const Expr* e = nullptr) : expr(e) {} + ReturnStmt(const Expr* e = 0) : expr(e) {} void print(ostream& os) const; }; From f9e70ce58976633055088c41e27700af07cc36c0 Mon Sep 17 00:00:00 2001 From: Michael Emmi Date: Mon, 4 Aug 2014 11:19:53 -0400 Subject: [PATCH 028/140] Progress on branching in contracts. --- include/smack/Slicing.h | 2 +- include/smack/SmackInstGenerator.h | 3 +- lib/smack/Contracts.cpp | 3 +- lib/smack/Slicing.cpp | 64 ++++++++++++------------------ lib/smack/SmackInstGenerator.cpp | 42 +++++++++++--------- 5 files changed, 55 insertions(+), 59 deletions(-) diff --git a/include/smack/Slicing.h b/include/smack/Slicing.h index 84241c56e..96e67f2fc 100644 --- a/include/smack/Slicing.h +++ b/include/smack/Slicing.h @@ -14,6 +14,6 @@ namespace llvm { unordered_set getSlice(Value* V); - Function* slice(Value* V); + void removeSlice(Value* V); } diff --git a/include/smack/SmackInstGenerator.h b/include/smack/SmackInstGenerator.h index 619814063..380b08557 100644 --- a/include/smack/SmackInstGenerator.h +++ b/include/smack/SmackInstGenerator.h @@ -30,7 +30,7 @@ class SmackInstGenerator : public llvm::InstVisitor { void generatePhiAssigns(llvm::TerminatorInst& i); void generateGotoStmts(llvm::Instruction& i, - vector > target); + vector > target); void processInstruction(llvm::Instruction& i); void nameInstruction(llvm::Instruction& i); void annotate(llvm::Instruction& i, Block* b); @@ -70,6 +70,7 @@ class SmackInstGenerator : public llvm::InstVisitor { visit(*I); } } + // TODO WHAT TO DO WITH TERMINATORLESS BLOCKS? } } diff --git a/lib/smack/Contracts.cpp b/lib/smack/Contracts.cpp index 43e7e72e8..249bce090 100644 --- a/lib/smack/Contracts.cpp +++ b/lib/smack/Contracts.cpp @@ -14,7 +14,8 @@ Expr* ContractsExtractor::sliceExpr(Value* V) { SmackInstGenerator igen(rep, *code, extracted.size()); igen.setExtracted(extracted); igen.visitSlice(F,getSlice(J)); - delete llvm::slice(J); + J->eraseFromParent(); + removeSlice(I); return code; } diff --git a/lib/smack/Slicing.cpp b/lib/smack/Slicing.cpp index d7e90f168..1d5a00419 100644 --- a/lib/smack/Slicing.cpp +++ b/lib/smack/Slicing.cpp @@ -19,7 +19,7 @@ namespace llvm { unordered_set getSlice(Value* V) { unordered_set slice; Instruction* I = dyn_cast(V); - assert( I && "Expected instruction value."); + assert(I && "Expected instruction value."); queue workList; workList.push(I); @@ -50,28 +50,24 @@ namespace llvm { workList.push( (*B)->getTerminator() ); } } + + // ENSURE EACH BLOCK HAS A TERMINATOR + if (BranchInst* Br = dyn_cast(I->getParent()->getTerminator())) + workList.push(Br); } return slice; } - Function* slice(Value* V) { - map blockMap; + void removeSlice(Value* V) { Instruction* I = dyn_cast(V); assert(I && "Expected instruction value."); - Function* F = I->getParent()->getParent(); - Function* slice = Function::Create(F->getFunctionType(), GlobalValue::ExternalLinkage); queue workList; set covered; + map succ; - DEBUG(errs() << "COMPUTING SLICE " << *V << "\n"); - DEBUG(errs() << "FROM " << *F << "\n"); - - BasicBlock* B = BasicBlock::Create(slice->getContext(), "", slice, 0); - blockMap.insert(make_pair(I->getParent(),B)); - ReturnInst::Create(slice->getContext(),I,B); workList.push(I); while (!workList.empty()) { @@ -79,47 +75,39 @@ namespace llvm { workList.pop(); if (covered.count(I)) continue; - covered.insert(I); - - BasicBlock* B = I->getParent(); - I->removeFromParent(); - // TODO REMOVE THE BLOCK? - // TODO REMOVE TERMINATORS? + covered.insert(I); - BasicBlock* C; - if (blockMap.count(B)) - C = blockMap.find(B)->second; - else - blockMap.insert(make_pair(B, - C = BasicBlock::Create(slice->getContext(), "", slice, 0))); - C->getInstList().push_front(I); + if (I->getNumUses() > 1) + continue; if (BranchInst* Br = dyn_cast(I)) { - if (Br->isConditional()) { - if (Instruction* J = dyn_cast(Br->getCondition())) { + succ.insert(make_pair(Br->getParent(),Br->getSuccessor(0))); + if (Br->isConditional()) + if (Instruction* J = dyn_cast(Br->getCondition())) workList.push(J); - } - } } else { - for (User::op_iterator U = I->op_begin(); U != I->op_end(); ++U) { - if (Instruction* J = dyn_cast(U)) { + for (User::op_iterator U = I->op_begin(); U != I->op_end(); ++U) + if (Instruction* J = dyn_cast(U)) workList.push(J); - } - } } if (PHINode* Phi = dyn_cast(I)) { - for (PHINode::block_iterator B = Phi->block_begin(); B != Phi->block_end(); ++B) { - workList.push( (*B)->getTerminator() ); + for (PHINode::block_iterator A = Phi->block_begin(); A != Phi->block_end(); ++A) { + workList.push( (*A)->getTerminator() ); } } - } - DEBUG(errs() << "COMPUTED SLICE " << *slice << "\n"); - DEBUG(errs() << "WITH LEFTOVER " << *F << "\n"); + BasicBlock* B = I->getParent(); + I->eraseFromParent(); - return slice; + if (B->getInstList().size() == 0) { + BasicBlock* C = succ[B]; + assert(C && "Successor not found!"); + B->replaceAllUsesWith(C); + B->eraseFromParent(); + } + } } } diff --git a/lib/smack/SmackInstGenerator.cpp b/lib/smack/SmackInstGenerator.cpp index 7ed6603b9..0a2b3e73e 100644 --- a/lib/smack/SmackInstGenerator.cpp +++ b/lib/smack/SmackInstGenerator.cpp @@ -133,7 +133,7 @@ void SmackInstGenerator::generatePhiAssigns(llvm::TerminatorInst& ti) { void SmackInstGenerator::generateGotoStmts( llvm::Instruction& inst, - vector > targets) { + vector > targets) { assert(targets.size() > 0); @@ -141,17 +141,27 @@ void SmackInstGenerator::generateGotoStmts( vector dispatch; for (unsigned i = 0; i < targets.size(); i++) { - Block* b = createBlock(); - annotate(inst, b); - b->addStmt(Stmt::assume(targets[i].first)); - b->addStmt(Stmt::goto_(targets[i].second)); - dispatch.push_back(b->getName()); + const Expr* condition = targets[i].first; + llvm::BasicBlock* target = targets[i].second; + + if (target->getUniquePredecessor() == inst.getParent()) { + Block* b = getBlock(target); + b->insert(Stmt::assume(condition)); + dispatch.push_back(b->getName()); + + } else { + Block* b = createBlock(); + annotate(inst, b); + b->addStmt(Stmt::assume(condition)); + b->addStmt(Stmt::goto_(getBlock(target)->getName())); + dispatch.push_back(b->getName()); + } } emit(Stmt::goto_(dispatch)); } else - emit(Stmt::goto_(targets[0].second)); + emit(Stmt::goto_(getBlock(targets[0].second)->getName())); } /******************************************************************************/ @@ -178,23 +188,20 @@ void SmackInstGenerator::visitBranchInst(llvm::BranchInst& bi) { processInstruction(bi); // Collect the list of tarets - vector > targets; + vector > targets; if (bi.getNumSuccessors() == 1) { // Unconditional branch - targets.push_back(make_pair(Expr::lit(true), - getBlock(bi.getSuccessor(0))->getName())); + targets.push_back(make_pair(Expr::lit(true),bi.getSuccessor(0))); } else { // Conditional branch assert(bi.getNumSuccessors() == 2); const Expr* e = rep.expr(bi.getCondition()); - targets.push_back(make_pair(e, - getBlock(bi.getSuccessor(0))->getName())); - targets.push_back(make_pair(Expr::not_(e), - getBlock(bi.getSuccessor(1))->getName())); + targets.push_back(make_pair(e,bi.getSuccessor(0))); + targets.push_back(make_pair(Expr::not_(e),bi.getSuccessor(1))); } generatePhiAssigns(bi); generateGotoStmts(bi, targets); @@ -204,7 +211,7 @@ void SmackInstGenerator::visitSwitchInst(llvm::SwitchInst& si) { processInstruction(si); // Collect the list of tarets - vector > targets; + vector > targets; const Expr* e = rep.expr(si.getCondition()); const Expr* n = Expr::lit(true); @@ -213,15 +220,14 @@ void SmackInstGenerator::visitSwitchInst(llvm::SwitchInst& si) { i = si.case_begin(); i != si.case_begin(); ++i) { const Expr* v = rep.expr(i.getCaseValue()); - targets.push_back(make_pair(Expr::eq(e, v), - getBlock(i.getCaseSuccessor())->getName())); + targets.push_back(make_pair(Expr::eq(e,v),i.getCaseSuccessor())); // Add the negation of this case to the default case n = Expr::and_(n, Expr::neq(e, v)); } // The default case - targets.push_back(make_pair(n,getBlock(si.getDefaultDest())->getName())); + targets.push_back(make_pair(n,si.getDefaultDest())); generatePhiAssigns(si); generateGotoStmts(si, targets); From f0cdf52eca8c63f60ea713085138f86d02eec97b Mon Sep 17 00:00:00 2001 From: Michael Emmi Date: Mon, 4 Aug 2014 18:26:21 -0400 Subject: [PATCH 029/140] Revert "Merge branch 'code-contracts' into develop" This reverts commit 19afd5c65dff7fa38b364ad59dd400b36943c0f1, reversing changes made to 9dc3fd9869978503af31576d9c598e18326d2d44. Conflicts: include/smack/BoogieAst.h --- CMakeLists.txt | 1 - bin/smackgen.py | 3 - bin/smackverify.py | 6 +- include/smack/BoogieAst.h | 112 +++++++--------- include/smack/Contracts.h | 33 ----- include/smack/Slicing.h | 19 --- include/smack/SmackInstGenerator.h | 59 +++------ include/smack/SmackRep.h | 4 +- include/smack/smack.h | 9 -- lib/smack/BoogieAst.cpp | 44 +------ lib/smack/Contracts.cpp | 91 ------------- lib/smack/Slicing.cpp | 125 ------------------ lib/smack/SmackInstGenerator.cpp | 197 ++++++++++++----------------- lib/smack/SmackModuleGenerator.cpp | 39 ++++-- lib/smack/SmackRep.cpp | 2 +- test/contracts/.gitignore | 4 - test/contracts/array.c | 12 -- test/contracts/array_fail.c | 12 -- test/contracts/forall.c | 12 -- test/contracts/forall_fail.c | 12 -- test/contracts/run.py | 45 ------- test/contracts/simple.c | 27 ---- test/contracts/simple_fail.c | 27 ---- 23 files changed, 177 insertions(+), 718 deletions(-) delete mode 100644 include/smack/Contracts.h delete mode 100644 include/smack/Slicing.h delete mode 100644 lib/smack/Contracts.cpp delete mode 100644 lib/smack/Slicing.cpp delete mode 100644 test/contracts/.gitignore delete mode 100644 test/contracts/array.c delete mode 100644 test/contracts/array_fail.c delete mode 100644 test/contracts/forall.c delete mode 100644 test/contracts/forall_fail.c delete mode 100755 test/contracts/run.py delete mode 100644 test/contracts/simple.c delete mode 100644 test/contracts/simple_fail.c diff --git a/CMakeLists.txt b/CMakeLists.txt index 39692852a..89ef5605f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -151,7 +151,6 @@ add_library(smackTranslator STATIC lib/smack/BplFilePrinter.cpp lib/smack/BplPrinter.cpp lib/smack/DSAAliasAnalysis.cpp - lib/smack/Slicing.cpp lib/smack/SmackInstGenerator.cpp lib/smack/SmackModuleGenerator.cpp lib/smack/SmackOptions.cpp diff --git a/bin/smackgen.py b/bin/smackgen.py index f1d458166..37c89c6db 100755 --- a/bin/smackgen.py +++ b/bin/smackgen.py @@ -99,9 +99,6 @@ def smackGenerate(sysArgv): inputFile.close() p = re.compile('procedure\s+([^\s(]*)\s*\(') - si = re.compile('procedure\s+(\$static_init)\s*\(') - if args.verifier == 'boogie-plain': - bpl = si.sub(lambda match: addInline(match, args.entryPoints, args.unroll), bpl) if args.verifier == 'boogie-inline': # put inline on procedures bpl = p.sub(lambda match: addInline(match, args.entryPoints, args.unroll), bpl) diff --git a/bin/smackverify.py b/bin/smackverify.py index 4ada8c177..5d0433df8 100755 --- a/bin/smackverify.py +++ b/bin/smackverify.py @@ -120,11 +120,7 @@ def smackdOutput(corralOutput): def verify(verifier, bplFileName, timeLimit, unroll, debug, smackd): if verifier == 'boogie-plain' or verifier == 'boogie-inline': # invoke Boogie - cmd = ['boogie', args.outfile.name, '/nologo'] - cmd += ['/timeLimit:' + str(args.timeLimit)] - if args.verifier == 'boogie-inline': - cmd += ['/loopUnroll:' + str(args.unroll)] - p = subprocess.Popen(cmd, stdout=subprocess.PIPE) + p = subprocess.Popen(['boogie', bplFileName, '/nologo', '/timeLimit:' + str(timeLimit), '/loopUnroll:' + str(unroll)], stdout=subprocess.PIPE) boogieOutput = p.communicate()[0] if p.returncode: return boogieOutput diff --git a/include/smack/BoogieAst.h b/include/smack/BoogieAst.h index 5e9b4e310..62b52a575 100644 --- a/include/smack/BoogieAst.h +++ b/include/smack/BoogieAst.h @@ -15,13 +15,12 @@ namespace smack { using namespace std; +class Block; class Program; class Expr { public: virtual void print(ostream& os) const = 0; - static const Expr* exists(string v, string t, const Expr* e); - static const Expr* forall(string v, string t, const Expr* e); static const Expr* and_(const Expr* l, const Expr* r); static const Expr* cond(const Expr* c, const Expr* t, const Expr* e); static const Expr* eq(const Expr* l, const Expr* r); @@ -101,13 +100,10 @@ class NotExpr : public Expr { class QuantExpr : public Expr { public: - enum Quantifier { Exists, Forall }; + enum Quantifier { Forall, Exists }; private: - Quantifier quant; - vector< pair > vars; - const Expr* expr; + Quantifier q; public: - QuantExpr(Quantifier q, vector< pair > vs, const Expr* e) : quant(q), vars(vs), expr(e) {} void print(ostream& os) const; }; @@ -197,7 +193,6 @@ class Stmt { static const Stmt* goto_(vector ts); static const Stmt* havoc(string x); static const Stmt* return_(); - static const Stmt* return_(const Expr* e); static const Stmt* skip(); static const Stmt* code(string s); virtual void print(ostream& os) const = 0; @@ -263,9 +258,8 @@ class HavocStmt : public Stmt { }; class ReturnStmt : public Stmt { - const Expr* expr; public: - ReturnStmt(const Expr* e = 0) : expr(e) {} + ReturnStmt() {} void print(ostream& os) const; }; @@ -361,72 +355,20 @@ class VarDecl : public Decl { void print(ostream& os) const; }; -class Block { - string name; - vector stmts; -public: - Block() : name("") {} - Block(string n) : name(n) {} - void print(ostream& os) const; - void insert(const Stmt* s) { - stmts.insert(stmts.begin(), s); - } - void addStmt(const Stmt* s) { - stmts.push_back(s); - } - string getName() { - return name; - } -}; - -class CodeContainer { -protected: +class ProcDecl : public Decl { Program& prog; - set decls; - vector blocks; - vector mods; - CodeContainer(Program& p) : prog(p) {} -public: - Program& getProg() const { - return prog; - } - void addDecl(Decl* d) { - decls.insert(d); - } - void insert(const Stmt* s) { - blocks.front()->insert(s); - } - void addBlock(Block* b) { - blocks.push_back(b); - } - bool hasBody() { - return decls.size() > 0 || blocks.size() > 0; - } - void addMod(string m) { - mods.push_back(m); - } - void addMods(vector ms) { - for (unsigned i = 0; i < ms.size(); i++) - addMod(ms[i]); - } - virtual bool isProc() { return false; } -}; - -class CodeExpr : public Expr, public CodeContainer { -public: - CodeExpr(Program& p) : CodeContainer(p) {} - void print(ostream& os) const; -}; - -class ProcDecl : public Decl, public CodeContainer { vector< pair > params; vector< pair > rets; + vector mods; vector requires; vector ensures; + set decls; + vector blocks; public: ProcDecl(Program& p, string n, vector< pair > ps, vector< pair > rs) - : Decl(n), CodeContainer(p), params(ps), rets(rs) {} + : Decl(n), prog(p), params(ps), rets(rs) {} kind getKind() const { return PROC; } + Program& getProg() const { return prog; } void addParam(string x, string t) { params.push_back(make_pair(x, t)); } @@ -436,13 +378,28 @@ class ProcDecl : public Decl, public CodeContainer { vector< pair > getRets() { return rets; } + void addMod(string m) { + mods.push_back(m); + } + void addMods(vector ms) { + for (unsigned i = 0; i < ms.size(); i++) + addMod(ms[i]); + } void addRequires(const Expr* e) { requires.push_back(e); } void addEnsures(const Expr* e) { ensures.push_back(e); } - bool isProc() { return true; } + void addDecl(Decl* d) { + decls.insert(d); + } + void addBlock(Block* b) { + blocks.push_back(b); + } + bool hasBody() { + return decls.size() > 0 || blocks.size() > 0; + } void print(ostream& os) const; }; @@ -453,6 +410,23 @@ class CodeDecl : public Decl { void print(ostream& os) const; }; +class Block { + ProcDecl& proc; + string name; + vector stmts; +public: + Block(ProcDecl& p) : proc(p), name("") {} + Block(ProcDecl& p, string n) : proc(p), name(n) {} + void print(ostream& os) const; + ProcDecl& getProc() const { return proc; } + void addStmt(const Stmt* s) { + stmts.push_back(s); + } + string getName() { + return name; + } +}; + class Program { // TODO While I would prefer that a program is just a set or sequence of // declarations, putting the Prelude in a CodeDeclaration does not work, diff --git a/include/smack/Contracts.h b/include/smack/Contracts.h deleted file mode 100644 index 99c0d3ebd..000000000 --- a/include/smack/Contracts.h +++ /dev/null @@ -1,33 +0,0 @@ -#include "llvm/InstVisitor.h" -#include "llvm/Support/CFG.h" -#include "smack/Slicing.h" -#include "smack/SmackRep.h" -#include "smack/SmackInstGenerator.h" -#include "smack/BoogieAst.h" - -namespace smack { -using namespace llvm; - -class ContractsExtractor : public InstVisitor { -private: - SmackRep& rep; - ProcDecl& proc; - - vector extracted; - -public: - ContractsExtractor(SmackRep& r, ProcDecl& d) : rep(r), proc(d) {} - - vector& getExtracted() { return extracted; } - - void visitCallInst(CallInst& ci); - -private: - Expr* sliceExpr(Value* v); - - Value* extractionIdx(LLVMContext& ctx) { - return ConstantInt::get(Type::getInt32Ty(ctx),extracted.size()); - } -}; - -} diff --git a/include/smack/Slicing.h b/include/smack/Slicing.h deleted file mode 100644 index 84241c56e..000000000 --- a/include/smack/Slicing.h +++ /dev/null @@ -1,19 +0,0 @@ -// -// Copyright (c) 2013 Zvonimir Rakamaric (zvonimir@cs.utah.edu), -// Michael Emmi (michael.emmi@gmail.com) -// This file is distributed under the MIT License. See LICENSE for details. -// - -#include "llvm/InstVisitor.h" -#include "llvm/Analysis/AliasAnalysis.h" -#include - -using namespace std; - -namespace llvm { - - unordered_set getSlice(Value* V); - - Function* slice(Value* V); - -} diff --git a/include/smack/SmackInstGenerator.h b/include/smack/SmackInstGenerator.h index 619814063..3aa99ad67 100644 --- a/include/smack/SmackInstGenerator.h +++ b/include/smack/SmackInstGenerator.h @@ -8,7 +8,7 @@ #include "smack/BoogieAst.h" #include "smack/SmackRep.h" #include "llvm/InstVisitor.h" -#include +#include namespace smack { @@ -16,17 +16,11 @@ class SmackInstGenerator : public llvm::InstVisitor { private: SmackRep& rep; - CodeContainer& proc; + ProcDecl& proc; Block* currBlock; - map blockMap; + map& blockMap; int blockNum; int varNum; - int varNs; - vector* extracted; - - string createVar(); - Block* createBlock(); - Block* getBlock(llvm::BasicBlock* bb); void generatePhiAssigns(llvm::TerminatorInst& i); void generateGotoStmts(llvm::Instruction& i, @@ -35,45 +29,22 @@ class SmackInstGenerator : public llvm::InstVisitor { void nameInstruction(llvm::Instruction& i); void annotate(llvm::Instruction& i, Block* b); - void addDecl(Decl* d) { proc.addDecl(d); } - void addMod(string x) { proc.addMod(x); } - void addTopDecl(Decl* d) { proc.getProg().addDecl(d); } - void addBlock(Block* b) { proc.addBlock(b); } - - void emit(const Stmt* s) { currBlock->addStmt(s); } - public: - SmackInstGenerator(SmackRep& r, CodeContainer& p, int varNamespace = -1) - : rep(r), proc(p), blockNum(0), varNum(0), varNs(varNamespace) {} - - void setExtracted(vector& e) { extracted = &e; } - const Expr* getExtracted(llvm::Value* V) { - using namespace llvm; - if (ConstantInt* CI = dyn_cast(V)) { - uint64_t i = CI->getLimitedValue(); - assert(extracted && extracted->size() > i && "Did not find extracted expression."); - return (*extracted)[i]; - } - assert(false && "Unexpected value."); + SmackInstGenerator(SmackRep& r, ProcDecl& p, + map& bm) + : rep(r), proc(p), + blockMap(bm), blockNum(0), varNum(0) {} + + Block* createBlock(); + void setCurrBlock(Block* b) { + currBlock = b; } - - void visitSlice(llvm::Function* F, unordered_set slice) { - using namespace llvm; - for (Function::iterator B = F->begin(), E = F->end(); B != E; ++B) { - bool blockVisited = false; - for (BasicBlock::iterator I = B->begin(), G = B->end(); I != G; ++I) { - if (slice.count(&*I)) { - if (!blockVisited) { - visitBasicBlock(*B); - blockVisited = true; - } - visit(*I); - } - } - } + Block* getCurrBlock() { + return currBlock; } - void visitBasicBlock(llvm::BasicBlock& bb); + string createVar(); + void visitInstruction(llvm::Instruction& i); void visitReturnInst(llvm::ReturnInst& i); diff --git a/include/smack/SmackRep.h b/include/smack/SmackRep.h index 439269c20..6d64c429f 100644 --- a/include/smack/SmackRep.h +++ b/include/smack/SmackRep.h @@ -143,8 +143,7 @@ class SmackRep { : aliasAnalysis(aa), targetData(aa->getDataLayout()), globalsBottom(0) { uniqueFpNum = 0; uniqueUndefNum = 0; - } - DSAAliasAnalysis* getAliasAnalysis() { return aliasAnalysis; } + } private: void addInit(unsigned region, const Expr* addr, const llvm::Constant* val); @@ -158,7 +157,6 @@ class SmackRep { const Expr* b2i(const llvm::Value* v); public: - Program* getProgram() { return program; } void setProgram(Program* p) { program = p; } bool isSmackName(string n); diff --git a/include/smack/smack.h b/include/smack/smack.h index 38028c6de..ef6509d66 100644 --- a/include/smack/smack.h +++ b/include/smack/smack.h @@ -45,15 +45,6 @@ void __SMACK_assume(bool v) { __SMACK_code("assume {@} != 0;", v); } -void requires(bool expr); -void ensures(bool expr); -void invariant(bool expr); - -bool forall(const char *var, bool expr); -bool exists(const char *var, bool expr); -int qvar(const char *var); -int old(int term); - //// PROBLEM: in the 2D memory model, the declaration of boogie_si_record_int //// should have a type $ptr parameter, not an int. How should we do this? // void __SMACK_record_int(int i) { diff --git a/lib/smack/BoogieAst.cpp b/lib/smack/BoogieAst.cpp index 277ef8233..b4b1d190a 100644 --- a/lib/smack/BoogieAst.cpp +++ b/lib/smack/BoogieAst.cpp @@ -13,18 +13,6 @@ using namespace std; unsigned Decl::uniqueId = 0; -const Expr* Expr::exists(string v, string t, const Expr* e) { - vector< pair > vars; - vars.push_back(make_pair(v,t)); - return new QuantExpr(QuantExpr::Exists, vars, e); -} - -const Expr* Expr::forall(string v, string t, const Expr* e) { - vector< pair > vars; - vars.push_back(make_pair(v,t)); - return new QuantExpr(QuantExpr::Forall, vars, e); -} - const Expr* Expr::and_(const Expr* l, const Expr* r) { return new BinExpr(BinExpr::And, l, r); } @@ -231,10 +219,6 @@ const Stmt* Stmt::havoc(string x) { return new HavocStmt(vector(1, x)); } -const Stmt* Stmt::return_(const Expr* e) { - return new ReturnStmt(e); -} - const Stmt* Stmt::return_() { return new ReturnStmt(); } @@ -317,11 +301,6 @@ ostream& operator<<(ostream& os, Program& p) { return os; } -template ostream& operator<<(ostream& os, pair p) { - os << p.first << ": " << p.second; - return os; -} - template void print_seq(ostream& os, vector ts, string init, string sep, string term) { @@ -451,16 +430,16 @@ void NotExpr::print(ostream& os) const { void QuantExpr::print(ostream& os) const { os << "("; - switch (quant) { + switch (q) { case Forall: - os << "forall "; + os << "forall"; break; case Exists: - os << "exists "; + os << "exists"; break; } - print_seq< pair >(os, vars, ","); - os << " :: " << expr << ")"; + os << " -- ToDo: Implement quantified expressions. "; + os << ")"; } void SelExpr::print(ostream& os) const { @@ -478,14 +457,6 @@ void VarExpr::print(ostream& os) const { os << var; } -void CodeExpr::print(ostream& os) const { - os << "|{" << endl; - if (decls.size() > 0) - print_set(os, decls, " ", "\n ", "\n"); - print_seq(os, blocks, "\n"); - os << endl << "}|"; -} - void StrVal::print(ostream& os) const { os << "\"" << val << "\""; } @@ -547,10 +518,7 @@ void HavocStmt::print(ostream& os) const { } void ReturnStmt::print(ostream& os) const { - os << "return"; - if (expr) - os << " " << expr; - os << ";"; + os << "return;"; } void CodeStmt::print(ostream& os) const { diff --git a/lib/smack/Contracts.cpp b/lib/smack/Contracts.cpp deleted file mode 100644 index 43e7e72e8..000000000 --- a/lib/smack/Contracts.cpp +++ /dev/null @@ -1,91 +0,0 @@ -#include "smack/Contracts.h" -#include "llvm/Support/InstIterator.h" - -namespace smack { - using namespace llvm; - -Expr* ContractsExtractor::sliceExpr(Value* V) { - Instruction* I = dyn_cast(V); - assert(I && "Expected instruction."); - Function* F = I->getParent()->getParent(); - Instruction* J = ReturnInst::Create(I->getContext(), I, I->getParent()); - - CodeExpr* code = new CodeExpr(*rep.getProgram()); - SmackInstGenerator igen(rep, *code, extracted.size()); - igen.setExtracted(extracted); - igen.visitSlice(F,getSlice(J)); - delete llvm::slice(J); - return code; -} - -void ContractsExtractor::visitCallInst(CallInst& ci) { - Function* f = ci.getCalledFunction(); - - if (f && rep.id(f).find("forall") != string::npos) { - assert(ci.getNumArgOperands() == 2 && "Unexpected operands to forall."); - Value* var = ci.getArgOperand(0); - Value* arg = ci.getArgOperand(1); - ci.setArgOperand(1,extractionIdx(ci.getContext())); - const Expr* e = Expr::forall(rep.getString(var), "int", sliceExpr(arg)); - extracted.push_back(e); - - } else if (f && rep.id(f).find("exists") != string::npos) { - assert(ci.getNumArgOperands() == 2 && "Unexpected operands to exists."); - Value* var = ci.getArgOperand(0); - Value* arg = ci.getArgOperand(1); - ci.setArgOperand(1,extractionIdx(ci.getContext())); - const Expr* e = Expr::exists(rep.getString(var), "int", sliceExpr(arg)); - extracted.push_back(e); - - } else if (f && rep.id(f).find("requires") != string::npos) { - assert(ci.getNumArgOperands() == 1 && "Unexpected operands to requires."); - Value* V = ci.getArgOperand(0); - ci.setArgOperand(0,ConstantInt::getTrue(ci.getContext())); - proc.addRequires(sliceExpr(V)); - ci.eraseFromParent(); - - } else if (f && rep.id(f).find("ensures") != string::npos) { - assert(ci.getNumArgOperands() == 1 && "Unexpected operands to ensures."); - Value* V = ci.getArgOperand(0); - ci.setArgOperand(0,ConstantInt::getTrue(ci.getContext())); - proc.addEnsures(sliceExpr(V)); - ci.eraseFromParent(); - - } else if (f && rep.id(f).find("invariant") != string::npos) { - assert(ci.getNumArgOperands() == 1 && "Unexpected operands to invariant."); - Value* arg = ci.getArgOperand(0); - Value* idx = extractionIdx(ci.getContext()); - ci.setArgOperand(0,idx); - const Expr* e = sliceExpr(arg); - extracted.push_back(e); - - BasicBlock* body = ci.getParent(); - BasicBlock* head = body->getSinglePredecessor(); - assert(head && "Expected single predecessor block."); - ArrayRef args(idx); - ArrayRef params(Type::getInt32Ty(ci.getContext())); - CallInst::Create( - Function::Create( - FunctionType::get(Type::getVoidTy(ci.getContext()),params,false), - GlobalValue::ExternalLinkage, "iassume"), - args,"",head->getTerminator()); - unsigned count = 0; - for (pred_iterator B = pred_begin(head), E = pred_end(head); B != E; ++B) { - CallInst::Create( - Function::Create( - FunctionType::get(Type::getVoidTy(ci.getContext()),params,false), - GlobalValue::ExternalLinkage, "iassert"), - args,"",(*B)->getTerminator()); - count++; - } - assert(count == 2 && "Expected head with two predecessors."); - count = 0; - for (succ_iterator B = succ_begin(head), E = succ_end(head); B != E; ++B) { - count++; - } - assert(count == 2 && "Expected head with two successors."); - ci.eraseFromParent(); - } -} - -} diff --git a/lib/smack/Slicing.cpp b/lib/smack/Slicing.cpp deleted file mode 100644 index d7e90f168..000000000 --- a/lib/smack/Slicing.cpp +++ /dev/null @@ -1,125 +0,0 @@ -// -// Copyright (c) 2013 Zvonimir Rakamaric (zvonimir@cs.utah.edu), -// Michael Emmi (michael.emmi@gmail.com) -// This file is distributed under the MIT License. See LICENSE for details. -// - -#include "smack/Slicing.h" -#include "llvm/Transforms/Utils/Cloning.h" -#include "llvm/IR/Instructions.h" -#include "llvm/Support/Debug.h" -#include -#include -#include - -using namespace std; - -namespace llvm { - - unordered_set getSlice(Value* V) { - unordered_set slice; - Instruction* I = dyn_cast(V); - assert( I && "Expected instruction value."); - - queue workList; - workList.push(I); - - while (!workList.empty()) { - Instruction* I = workList.front(); - workList.pop(); - if (slice.count(I)) - continue; - slice.insert(I); - - if (BranchInst* Br = dyn_cast(I)) { - if (Br->isConditional()) { - if (Instruction* J = dyn_cast(Br->getCondition())) { - workList.push(J); - } - } - } else { - for (User::op_iterator U = I->op_begin(); U != I->op_end(); ++U) { - if (Instruction* J = dyn_cast(U)) { - workList.push(J); - } - } - } - - if (PHINode* Phi = dyn_cast(I)) { - for (PHINode::block_iterator B = Phi->block_begin(); B != Phi->block_end(); ++B) { - workList.push( (*B)->getTerminator() ); - } - } - } - - return slice; - } - - Function* slice(Value* V) { - map blockMap; - - Instruction* I = dyn_cast(V); - assert(I && "Expected instruction value."); - Function* F = I->getParent()->getParent(); - Function* slice = Function::Create(F->getFunctionType(), GlobalValue::ExternalLinkage); - - queue workList; - set covered; - - DEBUG(errs() << "COMPUTING SLICE " << *V << "\n"); - DEBUG(errs() << "FROM " << *F << "\n"); - - BasicBlock* B = BasicBlock::Create(slice->getContext(), "", slice, 0); - blockMap.insert(make_pair(I->getParent(),B)); - ReturnInst::Create(slice->getContext(),I,B); - workList.push(I); - - while (!workList.empty()) { - Instruction* I = workList.front(); - workList.pop(); - if (covered.count(I)) - continue; - covered.insert(I); - - BasicBlock* B = I->getParent(); - I->removeFromParent(); - - // TODO REMOVE THE BLOCK? - // TODO REMOVE TERMINATORS? - - BasicBlock* C; - if (blockMap.count(B)) - C = blockMap.find(B)->second; - else - blockMap.insert(make_pair(B, - C = BasicBlock::Create(slice->getContext(), "", slice, 0))); - C->getInstList().push_front(I); - - if (BranchInst* Br = dyn_cast(I)) { - if (Br->isConditional()) { - if (Instruction* J = dyn_cast(Br->getCondition())) { - workList.push(J); - } - } - } else { - for (User::op_iterator U = I->op_begin(); U != I->op_end(); ++U) { - if (Instruction* J = dyn_cast(U)) { - workList.push(J); - } - } - } - - if (PHINode* Phi = dyn_cast(I)) { - for (PHINode::block_iterator B = Phi->block_begin(); B != Phi->block_end(); ++B) { - workList.push( (*B)->getTerminator() ); - } - } - } - - DEBUG(errs() << "COMPUTED SLICE " << *slice << "\n"); - DEBUG(errs() << "WITH LEFTOVER " << *F << "\n"); - - return slice; - } - -} diff --git a/lib/smack/SmackInstGenerator.cpp b/lib/smack/SmackInstGenerator.cpp index 9b3a31880..a0c9f289d 100644 --- a/lib/smack/SmackInstGenerator.cpp +++ b/lib/smack/SmackInstGenerator.cpp @@ -4,7 +4,6 @@ // #include "smack/SmackInstGenerator.h" #include "smack/SmackOptions.h" -#include "smack/Slicing.h" #include "llvm/InstVisitor.h" #include "llvm/DebugInfo.h" #include "llvm/Support/Debug.h" @@ -23,9 +22,9 @@ const bool CODE_WARN = true; const bool SHOW_ORIG = false; #define WARN(str) \ - if (CODE_WARN) emit(Stmt::comment(string("WARNING: ") + str)) + if (CODE_WARN) currBlock->addStmt(Stmt::comment(string("WARNING: ") + str)) #define ORIG(ins) \ - if (SHOW_ORIG) emit(Stmt::comment(i2s(ins))) + if (SHOW_ORIG) currBlock->addStmt(Stmt::comment(i2s(ins))) Regex VAR_DECL("^[[:space:]]*var[[:space:]]+([[:alpha:]_.$#'`~^\\?][[:alnum:]_.$#'`~^\\?]*):.*;"); @@ -40,43 +39,30 @@ string i2s(llvm::Instruction& i) { Block* SmackInstGenerator::createBlock() { stringstream s; s << SmackRep::BLOCK_LBL << blockNum++; - Block* b = new Block(s.str()); - addBlock(b); + Block* b = new Block(proc, s.str()); + proc.addBlock(b); return b; } string SmackInstGenerator::createVar() { stringstream s; - s << "$x"; - if (varNs >= 0) - s << "." << varNs << "."; - s << varNum++; + s << "$x" << varNum++; string name = s.str(); - addDecl(Decl::variable(name, rep.getPtrType())); + proc.addDecl(Decl::variable(name, rep.getPtrType())); return name; } -Block* SmackInstGenerator::getBlock(llvm::BasicBlock* bb) { - if (blockMap.count(bb) == 0) - blockMap[bb] = createBlock(); - return blockMap[bb]; -} - void SmackInstGenerator::nameInstruction(llvm::Instruction& inst) { if (!inst.getType()->isVoidTy()) { if (!inst.hasName() || !rep.isSmackGeneratedName(inst.getName())) { - stringstream s; if (rep.isBool(&inst)) - s << SmackRep::BOOL_VAR; + inst.setName(SmackRep::BOOL_VAR); else if (rep.isFloat(&inst)) - s << SmackRep::FLOAT_VAR; + inst.setName(SmackRep::FLOAT_VAR); else - s << SmackRep::PTR_VAR; - if (varNs >= 0) - s << "." << varNs << "."; - inst.setName(s.str()); + inst.setName(SmackRep::PTR_VAR); } - addDecl(Decl::variable(rep.id(&inst), rep.type(&inst))); + proc.addDecl(Decl::variable(rep.id(&inst), rep.type(&inst))); } } @@ -102,10 +88,6 @@ void SmackInstGenerator::processInstruction(llvm::Instruction& inst) { nameInstruction(inst); } -void SmackInstGenerator::visitBasicBlock(llvm::BasicBlock& bb) { - currBlock = getBlock(&bb); -} - void SmackInstGenerator::visitInstruction(llvm::Instruction& inst) { DEBUG(errs() << "Instruction not handled: " << inst << "\n"); assert(false && "Instruction not handled"); @@ -125,7 +107,8 @@ void SmackInstGenerator::generatePhiAssigns(llvm::TerminatorInst& ti) { phi->getIncomingValueForBlock(block)) { nameInstruction(*phi); - emit(Stmt::assign(rep.expr(phi), rep.expr(v))); + currBlock->addStmt(Stmt::assign( + rep.expr(phi), rep.expr(v))); } } } @@ -148,10 +131,10 @@ void SmackInstGenerator::generateGotoStmts( dispatch.push_back(b->getName()); } - emit(Stmt::goto_(dispatch)); + currBlock->addStmt(Stmt::goto_(dispatch)); } else - emit(Stmt::goto_(targets[0].second)); + currBlock->addStmt(Stmt::goto_(targets[0].second)); } /******************************************************************************/ @@ -161,17 +144,11 @@ void SmackInstGenerator::generateGotoStmts( void SmackInstGenerator::visitReturnInst(llvm::ReturnInst& ri) { processInstruction(ri); - llvm::Value* v = ri.getReturnValue(); + if (llvm::Value* v = ri.getReturnValue()) + currBlock->addStmt(Stmt::assign( + Expr::id(SmackRep::RET_VAR), rep.expr(v))); - if (proc.isProc()) { - if (v) - emit(Stmt::assign(Expr::id(SmackRep::RET_VAR), rep.expr(v))); - emit(Stmt::return_()); - - } else { - assert (v && "Expected return value."); - emit(Stmt::return_(rep.expr(v))); - } + currBlock->addStmt(Stmt::return_()); } void SmackInstGenerator::visitBranchInst(llvm::BranchInst& bi) { @@ -183,18 +160,22 @@ void SmackInstGenerator::visitBranchInst(llvm::BranchInst& bi) { if (bi.getNumSuccessors() == 1) { // Unconditional branch + assert(blockMap.count(bi.getSuccessor(0)) != 0); targets.push_back(make_pair(Expr::lit(true), - getBlock(bi.getSuccessor(0))->getName())); + blockMap[bi.getSuccessor(0)]->getName())); } else { // Conditional branch assert(bi.getNumSuccessors() == 2); + assert(blockMap.count(bi.getSuccessor(0)) != 0); + assert(blockMap.count(bi.getSuccessor(1)) != 0); + const Expr* e = rep.expr(bi.getCondition()); targets.push_back(make_pair(e, - getBlock(bi.getSuccessor(0))->getName())); + blockMap[bi.getSuccessor(0)]->getName())); targets.push_back(make_pair(Expr::not_(e), - getBlock(bi.getSuccessor(1))->getName())); + blockMap[bi.getSuccessor(1)]->getName())); } generatePhiAssigns(bi); generateGotoStmts(bi, targets); @@ -212,16 +193,19 @@ void SmackInstGenerator::visitSwitchInst(llvm::SwitchInst& si) { for (llvm::SwitchInst::CaseIt i = si.case_begin(); i != si.case_begin(); ++i) { + assert(blockMap.count(i.getCaseSuccessor()) != 0); const Expr* v = rep.expr(i.getCaseValue()); targets.push_back(make_pair(Expr::eq(e, v), - getBlock(i.getCaseSuccessor())->getName())); + blockMap[i.getCaseSuccessor()]->getName())); // Add the negation of this case to the default case n = Expr::and_(n, Expr::neq(e, v)); } // The default case - targets.push_back(make_pair(n,getBlock(si.getDefaultDest())->getName())); + assert(blockMap.count(si.getDefaultDest()) != 0); + targets.push_back(make_pair(n, + blockMap[si.getDefaultDest()]->getName())); generatePhiAssigns(si); generateGotoStmts(si, targets); @@ -230,7 +214,7 @@ void SmackInstGenerator::visitSwitchInst(llvm::SwitchInst& si) { void SmackInstGenerator::visitUnreachableInst(llvm::UnreachableInst& ii) { processInstruction(ii); - emit(Stmt::assume(Expr::lit(false))); + currBlock->addStmt(Stmt::assume(Expr::lit(false))); } /******************************************************************************/ @@ -239,7 +223,7 @@ void SmackInstGenerator::visitUnreachableInst(llvm::UnreachableInst& ii) { void SmackInstGenerator::visitBinaryOperator(llvm::BinaryOperator& bo) { processInstruction(bo); - emit(Stmt::assign(rep.expr(&bo), rep.op(&bo))); + currBlock->addStmt(Stmt::assign(rep.expr(&bo), rep.op(&bo))); } /******************************************************************************/ @@ -260,30 +244,30 @@ void SmackInstGenerator::visitBinaryOperator(llvm::BinaryOperator& bo) { void SmackInstGenerator::visitAllocaInst(llvm::AllocaInst& ai) { processInstruction(ai); - emit(rep.alloca(ai)); + currBlock->addStmt(rep.alloca(ai)); } void SmackInstGenerator::visitLoadInst(llvm::LoadInst& li) { processInstruction(li); - emit(Stmt::assign(rep.expr(&li),rep.mem(li.getPointerOperand()))); + currBlock->addStmt(Stmt::assign(rep.expr(&li),rep.mem(li.getPointerOperand()))); if (SmackOptions::MemoryModelDebug) { - emit(Stmt::call(SmackRep::REC_MEM_OP, Expr::id(SmackRep::MEM_OP_VAL))); - emit(Stmt::call("boogie_si_record_int", Expr::lit(0))); - emit(Stmt::call("boogie_si_record_int", rep.expr(li.getPointerOperand()))); - emit(Stmt::call("boogie_si_record_int", rep.expr(&li))); + currBlock->addStmt(Stmt::call(SmackRep::REC_MEM_OP, Expr::id(SmackRep::MEM_OP_VAL))); + currBlock->addStmt(Stmt::call("boogie_si_record_int", Expr::lit(0))); + currBlock->addStmt(Stmt::call("boogie_si_record_int", rep.expr(li.getPointerOperand()))); + currBlock->addStmt(Stmt::call("boogie_si_record_int", rep.expr(&li))); } } void SmackInstGenerator::visitStoreInst(llvm::StoreInst& si) { processInstruction(si); - emit(Stmt::assign(rep.mem(si.getPointerOperand()),rep.expr(si.getOperand(0)))); + currBlock->addStmt(Stmt::assign(rep.mem(si.getPointerOperand()),rep.expr(si.getOperand(0)))); if (SmackOptions::MemoryModelDebug) { - emit(Stmt::call(SmackRep::REC_MEM_OP, Expr::id(SmackRep::MEM_OP_VAL))); - emit(Stmt::call("boogie_si_record_int", Expr::lit(1))); - emit(Stmt::call("boogie_si_record_int", rep.expr(si.getPointerOperand()))); - emit(Stmt::call("boogie_si_record_int", rep.expr(si.getOperand(0)))); + currBlock->addStmt(Stmt::call(SmackRep::REC_MEM_OP, Expr::id(SmackRep::MEM_OP_VAL))); + currBlock->addStmt(Stmt::call("boogie_si_record_int", Expr::lit(1))); + currBlock->addStmt(Stmt::call("boogie_si_record_int", rep.expr(si.getPointerOperand()))); + currBlock->addStmt(Stmt::call("boogie_si_record_int", rep.expr(si.getOperand(0)))); } } @@ -293,8 +277,8 @@ void SmackInstGenerator::visitAtomicCmpXchgInst(llvm::AtomicCmpXchgInst& i) { const Expr* ptr = rep.mem(i.getOperand(0)); const Expr* cmp = rep.expr(i.getOperand(1)); const Expr* swp = rep.expr(i.getOperand(2)); - emit(Stmt::assign(res,ptr)); - emit(Stmt::assign(ptr,Expr::cond(Expr::eq(ptr,cmp),swp,ptr))); + currBlock->addStmt(Stmt::assign(res,ptr)); + currBlock->addStmt(Stmt::assign(ptr,Expr::cond(Expr::eq(ptr,cmp),swp,ptr))); } void SmackInstGenerator::visitAtomicRMWInst(llvm::AtomicRMWInst& i) { @@ -344,8 +328,8 @@ void SmackInstGenerator::visitAtomicRMWInst(llvm::AtomicRMWInst& i) { assert(false && "unexpected atomic operation."); } - emit(Stmt::assign(res,mem)); - emit(Stmt::assign(mem,op)); + currBlock->addStmt(Stmt::assign(res,mem)); + currBlock->addStmt(Stmt::assign(mem,op)); } void SmackInstGenerator::visitGetElementPtrInst(llvm::GetElementPtrInst& gepi) { @@ -358,7 +342,7 @@ void SmackInstGenerator::visitGetElementPtrInst(llvm::GetElementPtrInst& gepi) { ps.push_back(gepi.getOperand(i)); ts.push_back(*typeI); } - emit(Stmt::assign(rep.expr(&gepi), + currBlock->addStmt(Stmt::assign(rep.expr(&gepi), rep.ptrArith(gepi.getPointerOperand(), ps, ts))); } @@ -368,67 +352,67 @@ void SmackInstGenerator::visitGetElementPtrInst(llvm::GetElementPtrInst& gepi) { void SmackInstGenerator::visitTruncInst(llvm::TruncInst& ti) { processInstruction(ti); - emit(Stmt::assign(rep.expr(&ti), + currBlock->addStmt(Stmt::assign(rep.expr(&ti), rep.trunc(ti.getOperand(0),ti.getType()))); } void SmackInstGenerator::visitZExtInst(llvm::ZExtInst& ci) { processInstruction(ci); - emit(Stmt::assign(rep.expr(&ci), + currBlock->addStmt(Stmt::assign(rep.expr(&ci), rep.zext(ci.getOperand(0),ci.getType()))); } void SmackInstGenerator::visitSExtInst(llvm::SExtInst& ci) { processInstruction(ci); - emit(Stmt::assign(rep.expr(&ci), + currBlock->addStmt(Stmt::assign(rep.expr(&ci), rep.sext(ci.getOperand(0),ci.getType()))); } void SmackInstGenerator::visitFPTruncInst(llvm::FPTruncInst& i) { processInstruction(i); - emit(Stmt::assign(rep.expr(&i), + currBlock->addStmt(Stmt::assign(rep.expr(&i), rep.fptrunc(i.getOperand(0),i.getType()))); } void SmackInstGenerator::visitFPExtInst(llvm::FPExtInst& i) { processInstruction(i); - emit(Stmt::assign(rep.expr(&i), + currBlock->addStmt(Stmt::assign(rep.expr(&i), rep.fpext(i.getOperand(0),i.getType()))); } void SmackInstGenerator::visitFPToUIInst(llvm::FPToUIInst& i) { processInstruction(i); - emit(Stmt::assign(rep.expr(&i),rep.fp2ui(i.getOperand(0)))); + currBlock->addStmt(Stmt::assign(rep.expr(&i),rep.fp2ui(i.getOperand(0)))); } void SmackInstGenerator::visitFPToSIInst(llvm::FPToSIInst& i) { processInstruction(i); - emit(Stmt::assign(rep.expr(&i),rep.fp2si(i.getOperand(0)))); + currBlock->addStmt(Stmt::assign(rep.expr(&i),rep.fp2si(i.getOperand(0)))); } void SmackInstGenerator::visitUIToFPInst(llvm::UIToFPInst& i) { processInstruction(i); - emit(Stmt::assign(rep.expr(&i),rep.ui2fp(i.getOperand(0)))); + currBlock->addStmt(Stmt::assign(rep.expr(&i),rep.ui2fp(i.getOperand(0)))); } void SmackInstGenerator::visitSIToFPInst(llvm::SIToFPInst& i) { processInstruction(i); - emit(Stmt::assign(rep.expr(&i),rep.si2fp(i.getOperand(0)))); + currBlock->addStmt(Stmt::assign(rep.expr(&i),rep.si2fp(i.getOperand(0)))); } void SmackInstGenerator::visitPtrToIntInst(llvm::PtrToIntInst& i) { processInstruction(i); - emit(Stmt::assign(rep.expr(&i),rep.p2i(i.getOperand(0)))); + currBlock->addStmt(Stmt::assign(rep.expr(&i),rep.p2i(i.getOperand(0)))); } void SmackInstGenerator::visitIntToPtrInst(llvm::IntToPtrInst& i) { processInstruction(i); - emit(Stmt::assign(rep.expr(&i),rep.i2p(i.getOperand(0)))); + currBlock->addStmt(Stmt::assign(rep.expr(&i),rep.i2p(i.getOperand(0)))); } void SmackInstGenerator::visitBitCastInst(llvm::BitCastInst& ci) { processInstruction(ci); - emit(Stmt::assign(rep.expr(&ci), + currBlock->addStmt(Stmt::assign(rep.expr(&ci), rep.bitcast(ci.getOperand(0),ci.getType()))); } @@ -438,12 +422,12 @@ void SmackInstGenerator::visitBitCastInst(llvm::BitCastInst& ci) { void SmackInstGenerator::visitICmpInst(llvm::ICmpInst& ci) { processInstruction(ci); - emit(Stmt::assign(rep.expr(&ci), rep.pred(ci))); + currBlock->addStmt(Stmt::assign(rep.expr(&ci), rep.pred(ci))); } void SmackInstGenerator::visitFCmpInst(llvm::FCmpInst& ci) { processInstruction(ci); - emit(Stmt::assign(rep.expr(&ci), rep.pred(ci))); + currBlock->addStmt(Stmt::assign(rep.expr(&ci), rep.pred(ci))); } void SmackInstGenerator::visitPHINode(llvm::PHINode& phi) { @@ -460,8 +444,8 @@ void SmackInstGenerator::visitSelectInst(llvm::SelectInst& i) { *v1 = rep.expr(i.getOperand(1)), *v2 = rep.expr(i.getOperand(2)); - emit(Stmt::havoc(x)); - emit(Stmt::assume(Expr::and_( + currBlock->addStmt(Stmt::havoc(x)); + currBlock->addStmt(Stmt::assume(Expr::and_( Expr::impl(c, Expr::eq(Expr::id(x), v1)), Expr::impl(Expr::not_(c), Expr::eq(Expr::id(x), v2)) ))); @@ -474,54 +458,31 @@ void SmackInstGenerator::visitCallInst(llvm::CallInst& ci) { if (ci.isInlineAsm()) { WARN("unsoundly ignoring inline asm call: " + i2s(ci)); - emit(Stmt::skip()); + currBlock->addStmt(Stmt::skip()); } else if (f && rep.id(f).find("llvm.dbg.") != string::npos) { WARN("ignoring llvm.debug call."); - emit(Stmt::skip()); + currBlock->addStmt(Stmt::skip()); } else if (f && rep.id(f) == "__SMACK_mod") { - addMod(rep.code(ci)); + proc.addMod(rep.code(ci)); } else if (f && rep.id(f) == "__SMACK_code") { - emit(Stmt::code(rep.code(ci))); + currBlock->addStmt(Stmt::code(rep.code(ci))); } else if (f && rep.id(f) == "__SMACK_decl") { - addDecl(Decl::code(rep.code(ci))); + proc.addDecl(Decl::code(rep.code(ci))); } else if (f && rep.id(f) == "__SMACK_top_decl") { string decl = rep.code(ci); - addTopDecl(Decl::code(decl)); + proc.getProg().addDecl(Decl::code(decl)); if (VAR_DECL.match(decl)) { string var = VAR_DECL.sub("\\1",decl); rep.addBplGlobal(var); } - } else if (f && rep.id(f).find("qvar") != string::npos) { - assert(ci.getNumArgOperands() == 1 && "Unexpected operands to var."); - emit(Stmt::assign(rep.expr(&ci),Expr::id(rep.getString(ci.getArgOperand(0))))); - - } else if (f && rep.id(f).find("old") != string::npos) { - assert(ci.getNumArgOperands() == 1 && "Unexpected operands to var."); - // TODO NEED TO ELIMiNATE TEMPORARY SSA VARIABLES HERE - // .... IT'S NO USE TO USE OLD ON A PROCEDURE-LOCAL SSA VARIABLE. - emit(Stmt::assign(rep.expr(&ci), - Expr::fn("old",rep.expr(ci.getArgOperand(0))) )); - - } else if (f && rep.id(f).find("forall") != string::npos) { - assert(ci.getNumArgOperands() == 2 && "Unexpected operands to forall."); - emit(Stmt::assign(rep.expr(&ci),getExtracted(ci.getArgOperand(1)))); - - } else if (f && rep.id(f).find("iassert") != string::npos) { - assert(ci.getNumArgOperands() == 1 && "Unexpected operands to invariant."); - emit(Stmt::assert_(getExtracted(ci.getArgOperand(0)))); - - } else if (f && rep.id(f).find("iassume") != string::npos) { - assert(ci.getNumArgOperands() == 1 && "Unexpected operands to invariant."); - emit(Stmt::assume(getExtracted(ci.getArgOperand(0)))); - } else if (f) { - emit(rep.call(f, ci)); + currBlock->addStmt(rep.call(f, ci)); } else { // function pointer call... @@ -536,9 +497,9 @@ void SmackInstGenerator::visitCallInst(llvm::CallInst& ci) { if (ce->isCast()) { llvm::Value* castValue = ce->getOperand(0); if (llvm::Function* castFunc = llvm::dyn_cast(castValue)) { - emit(rep.call(castFunc, ci)); + currBlock->addStmt(rep.call(castFunc, ci)); if (castFunc->isDeclaration() && rep.isExternal(&ci)) - emit(Stmt::assume(Expr::fn("$isExternal",rep.expr(&ci)))); + currBlock->addStmt(Stmt::assume(Expr::fn("$isExternal",rep.expr(&ci)))); return; } } @@ -558,7 +519,7 @@ void SmackInstGenerator::visitCallInst(llvm::CallInst& ci) { if (fs.size() == 1) { // Q: is this case really possible? - emit(rep.call(fs[0], ci)); + currBlock->addStmt(rep.call(fs[0], ci)); } else if (fs.size() > 1) { Block* tail = createBlock(); @@ -576,7 +537,7 @@ void SmackInstGenerator::visitCallInst(llvm::CallInst& ci) { } // Jump to the dispatch blocks. - emit(Stmt::goto_(targets)); + currBlock->addStmt(Stmt::goto_(targets)); // Update the current block for subsequent visits. currBlock = tail; @@ -585,12 +546,12 @@ void SmackInstGenerator::visitCallInst(llvm::CallInst& ci) { // In the worst case, we have no idea what function may have // been called... WARN("unsoundly ignoring indeterminate call: " + i2s(ci)); - emit(Stmt::skip()); + currBlock->addStmt(Stmt::skip()); } } if (f && f->isDeclaration() && rep.isExternal(&ci)) - emit(Stmt::assume(Expr::fn("$isExternal",rep.expr(&ci)))); + currBlock->addStmt(Stmt::assume(Expr::fn("$isExternal",rep.expr(&ci)))); } /******************************************************************************/ @@ -600,13 +561,13 @@ void SmackInstGenerator::visitCallInst(llvm::CallInst& ci) { void SmackInstGenerator::visitMemCpyInst(llvm::MemCpyInst& mci) { processInstruction(mci); assert (mci.getNumOperands() == 6); - emit(rep.memcpy(mci)); + currBlock->addStmt(rep.memcpy(mci)); } void SmackInstGenerator::visitMemSetInst(llvm::MemSetInst& msi) { processInstruction(msi); assert (msi.getNumOperands() == 6); - emit(rep.memset(msi)); + currBlock->addStmt(rep.memset(msi)); } } // namespace smack diff --git a/lib/smack/SmackModuleGenerator.cpp b/lib/smack/SmackModuleGenerator.cpp index cab659fd7..ab0a11d70 100644 --- a/lib/smack/SmackModuleGenerator.cpp +++ b/lib/smack/SmackModuleGenerator.cpp @@ -4,7 +4,6 @@ // #include "smack/SmackModuleGenerator.h" #include "smack/SmackOptions.h" -#include "smack/Contracts.h" namespace smack { @@ -50,16 +49,40 @@ void SmackModuleGenerator::generateProgram(llvm::Module& m, SmackRep* rep) { DEBUG(errs() << "Analyzing function: " << rep->id(func) << "\n"); - ContractsExtractor ce(*rep, *proc); - ce.visit(func); - - SmackInstGenerator igen(*rep, *proc); - igen.setExtracted(ce.getExtracted()); - igen.visit(func); + map known; + stack workStack; + SmackInstGenerator igen(*rep, (ProcDecl&) *proc, known); + llvm::BasicBlock& entry = func->getEntryBlock(); + workStack.push(&entry); + known[&entry] = igen.createBlock(); + // First execute static initializers, in the main procedure. if (rep->id(func) == "main" && rep->hasStaticInits()) - proc->insert(Stmt::call(SmackRep::STATIC_INIT)); + known[&entry]->addStmt(Stmt::call(SmackRep::STATIC_INIT)); + + // INVARIANT: knownBlocks.CONTAINS(b) iff workStack.CONTAINS(b) + // or workStack.CONTAINED(b) at some point in time. + while (!workStack.empty()) { + llvm::BasicBlock* b = workStack.top(); + workStack.pop(); + + for (llvm::succ_iterator s = succ_begin(b), + e = succ_end(b); s != e; ++s) { + + // uncovered basic block + if (known.count(*s) == 0) { + known[*s] = igen.createBlock(); + workStack.push(*s); + } + } + + // NOTE: here we are sure that all successor blocks have + // already been created, and are mapped for the visitor. + + igen.setCurrBlock(known[b]); + igen.visit(b); + } DEBUG(errs() << "Finished analyzing function: " << rep->id(func) << "\n\n"); } diff --git a/lib/smack/SmackRep.cpp b/lib/smack/SmackRep.cpp index f07847f27..7450724df 100644 --- a/lib/smack/SmackRep.cpp +++ b/lib/smack/SmackRep.cpp @@ -886,7 +886,7 @@ bool SmackRep::hasStaticInits() { Decl* SmackRep::getStaticInit() { ProcDecl* proc = (ProcDecl*) Decl::procedure(*program, STATIC_INIT); - Block* b = new Block(); + Block* b = new Block(*proc); for (unsigned i=0; iaddStmt(staticInits[i]); b->addStmt(Stmt::return_()); diff --git a/test/contracts/.gitignore b/test/contracts/.gitignore deleted file mode 100644 index 5f36c5029..000000000 --- a/test/contracts/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -*.ll -*.bc -*.o -*.bpl diff --git a/test/contracts/array.c b/test/contracts/array.c deleted file mode 100644 index 89ae58e83..000000000 --- a/test/contracts/array.c +++ /dev/null @@ -1,12 +0,0 @@ -#include -#include -#include "smack.h" - -// @expect 3 verified, 1 errors? - -int g[10]; - -int main(void) { - ensures(g[0] == 0); - return 0; -} \ No newline at end of file diff --git a/test/contracts/array_fail.c b/test/contracts/array_fail.c deleted file mode 100644 index 817feb920..000000000 --- a/test/contracts/array_fail.c +++ /dev/null @@ -1,12 +0,0 @@ -#include -#include -#include "smack.h" - -// @expect 2 verified, 2 errors? - -int g[10]; - -int main(void) { - ensures(g[0] == 1); - return 0; -} \ No newline at end of file diff --git a/test/contracts/forall.c b/test/contracts/forall.c deleted file mode 100644 index 525688998..000000000 --- a/test/contracts/forall.c +++ /dev/null @@ -1,12 +0,0 @@ -#include -#include -#include "smack.h" - -// @expect 3 verified, 1 errors? - -int g[10]; - -int main(void) { - ensures(forall("x", g[qvar("x")] == 0 || qvar("x") < 0 || qvar("x") > 9)); - return 0; -} \ No newline at end of file diff --git a/test/contracts/forall_fail.c b/test/contracts/forall_fail.c deleted file mode 100644 index 9b1ea36de..000000000 --- a/test/contracts/forall_fail.c +++ /dev/null @@ -1,12 +0,0 @@ -#include -#include -#include "smack.h" - -// @expect 2 verified, 2 errors? - -int g[10]; - -int main(void) { - ensures(forall("x", g[qvar("x")] == 0 || qvar("x") < 0 || qvar("x") > 10)); - return 0; -} \ No newline at end of file diff --git a/test/contracts/run.py b/test/contracts/run.py deleted file mode 100755 index 65e56c697..000000000 --- a/test/contracts/run.py +++ /dev/null @@ -1,45 +0,0 @@ -#! /usr/bin/env python - -import subprocess -import re -import glob -import time - -def red(text): - return '\033[0;31m' + text + '\033[0m' - -def green(text): - return '\033[0;32m' + text + '\033[0m' - -def expect(file): - for line in open(file).readlines(): - match = re.search(r'@expect (.*)',line) - if match: - return match.group(1) - print red("WARNING: @expect MISSING IN %s" % file), - return "" - -print "Running CONTRACTS regression tests..." -print - -passed = failed = 0 -for test in glob.glob("*.c"): - - print "{0:>20} :".format(test), - - # invoke SMACK - t0 = time.time() - cmd = ['smack-verify.py', test, '--verifier=boogie-plain'] - p = subprocess.Popen(cmd, stdout=subprocess.PIPE) - - # check SMACK output - if re.search(expect(test), p.communicate()[0]): - print green('PASSED') + ' [%.2fs]' % round(time.time() - t0, 2) - passed += 1 - else: - print red('FAILED') - failed += 1 - -print -print 'PASSED count: ', passed -print 'FAILED count: ', failed diff --git a/test/contracts/simple.c b/test/contracts/simple.c deleted file mode 100644 index bad6df506..000000000 --- a/test/contracts/simple.c +++ /dev/null @@ -1,27 +0,0 @@ -#include -#include -#include "smack.h" - -// @expect 4 verified, 1 errors? - -int g; - -void p() { - requires(g > 0); - ensures(g > 0); - for (int i=0; i < 10; i++) { - invariant(g > 0); - g++; - } - return; -} - -int main(void) { - g = 1; - for (int i=0; i<10; i++) { - invariant(g > 0); - p(); - } - __SMACK_assert(g > 0); - return 0; -} \ No newline at end of file diff --git a/test/contracts/simple_fail.c b/test/contracts/simple_fail.c deleted file mode 100644 index 0c50c2c2d..000000000 --- a/test/contracts/simple_fail.c +++ /dev/null @@ -1,27 +0,0 @@ -#include -#include -#include "smack.h" - -// @expect 3 verified, 2 errors? - -int g; - -void p() { - requires(g > 0); - ensures(g > 0); - for (int i=0; i < 10; i++) { - invariant(g >= 0); - g++; - } - return; -} - -int main(void) { - g = 1; - for (int i=0; i<10; i++) { - invariant(g > 0); - p(); - } - __SMACK_assert(g > 0); - return 0; -} \ No newline at end of file From 534349daf6f2296d16aa44b9790bc93d1a4f1b0c Mon Sep 17 00:00:00 2001 From: Michael Emmi Date: Wed, 6 Aug 2014 17:06:15 -0400 Subject: [PATCH 030/140] Factored out Naming from SmackRep. * Need more intricate naming scheme for code expressions inside procedures. --- include/smack/Contracts.h | 13 ++- include/smack/Naming.h | 46 +++++++++++ include/smack/Slicing.h | 2 +- include/smack/SmackInstGenerator.h | 59 ++++++++------ include/smack/SmackModuleGenerator.h | 5 +- include/smack/SmackRep.h | 14 +--- lib/smack/Contracts.cpp | 32 ++++---- lib/smack/Naming.cpp | 113 +++++++++++++++++++++++++++ lib/smack/Slicing.cpp | 38 +++++++-- lib/smack/SmackInstGenerator.cpp | 69 ++++++---------- lib/smack/SmackModuleGenerator.cpp | 47 ++++++----- lib/smack/SmackRep.cpp | 88 +++------------------ 12 files changed, 313 insertions(+), 213 deletions(-) create mode 100644 include/smack/Naming.h create mode 100644 lib/smack/Naming.cpp diff --git a/include/smack/Contracts.h b/include/smack/Contracts.h index 99c0d3ebd..b1e41fb0b 100644 --- a/include/smack/Contracts.h +++ b/include/smack/Contracts.h @@ -12,21 +12,20 @@ class ContractsExtractor : public InstVisitor { private: SmackRep& rep; ProcDecl& proc; - - vector extracted; + Naming& naming; + ExpressionList& exprs; public: - ContractsExtractor(SmackRep& r, ProcDecl& d) : rep(r), proc(d) {} - - vector& getExtracted() { return extracted; } + ContractsExtractor(SmackRep& R, ProcDecl& P, Naming& N, ExpressionList& E) + : rep(R), proc(P), naming(N), exprs(E) {} void visitCallInst(CallInst& ci); private: Expr* sliceExpr(Value* v); - Value* extractionIdx(LLVMContext& ctx) { - return ConstantInt::get(Type::getInt32Ty(ctx),extracted.size()); + Value* expressionIdx(LLVMContext& ctx) { + return ConstantInt::get(Type::getInt32Ty(ctx),exprs.size()); } }; diff --git a/include/smack/Naming.h b/include/smack/Naming.h new file mode 100644 index 000000000..b1e77e847 --- /dev/null +++ b/include/smack/Naming.h @@ -0,0 +1,46 @@ +#ifndef NAMING_H +#define NAMING_H + +#include "llvm/Support/Regex.h" +#include "llvm/IR/Value.h" +#include +#include + +namespace smack { + +using namespace std; +using llvm::Regex; +using llvm::Value; + +class Naming { + static Regex BPL_KW; + static Regex SMACK_NAME; + + typedef map NameMap; + stack nameStack; + unsigned blockNum; + unsigned varNum; + +public: + static const string BLOCK_LBL; + static const string RET_VAR; + static const string BOOL_VAR; + static const string FLOAT_VAR; + static const string PTR_VAR; + + Naming() : blockNum(0), varNum(0) { } + void enter(); + void leave(); + string get(const Value& V); + string freshBlockName(); + string freshVarName(const Value& V); + + static bool isBplKeyword(string s); + static bool isSmackName(string s); + static bool isSmackGeneratedName(string s); + static string escape(string s); +}; + +} + +#endif diff --git a/include/smack/Slicing.h b/include/smack/Slicing.h index 96e67f2fc..ce65ddb1c 100644 --- a/include/smack/Slicing.h +++ b/include/smack/Slicing.h @@ -12,7 +12,7 @@ using namespace std; namespace llvm { - unordered_set getSlice(Value* V); + unordered_set getSlice(Value* V); void removeSlice(Value* V); diff --git a/include/smack/SmackInstGenerator.h b/include/smack/SmackInstGenerator.h index 380b08557..b7437fe54 100644 --- a/include/smack/SmackInstGenerator.h +++ b/include/smack/SmackInstGenerator.h @@ -7,24 +7,26 @@ #include "smack/BoogieAst.h" #include "smack/SmackRep.h" +#include "smack/Naming.h" +#include "smack/Slicing.h" #include "llvm/InstVisitor.h" #include namespace smack { - + +typedef vector ExpressionList; + class SmackInstGenerator : public llvm::InstVisitor { private: SmackRep& rep; CodeContainer& proc; + Naming& naming; + ExpressionList& exprs; + Block* currBlock; map blockMap; - int blockNum; - int varNum; - int varNs; - vector* extracted; - string createVar(); Block* createBlock(); Block* getBlock(llvm::BasicBlock* bb); @@ -39,38 +41,47 @@ class SmackInstGenerator : public llvm::InstVisitor { void addMod(string x) { proc.addMod(x); } void addTopDecl(Decl* d) { proc.getProg().addDecl(d); } void addBlock(Block* b) { proc.addBlock(b); } - void emit(const Stmt* s) { currBlock->addStmt(s); } public: - SmackInstGenerator(SmackRep& r, CodeContainer& p, int varNamespace = -1) - : rep(r), proc(p), blockNum(0), varNum(0), varNs(varNamespace) {} - - void setExtracted(vector& e) { extracted = &e; } - const Expr* getExtracted(llvm::Value* V) { + SmackInstGenerator(SmackRep& R, CodeContainer& P, Naming& N, ExpressionList& E) + : rep(R), proc(P), naming(N), exprs(E) {} + + const Expr* getExpression(llvm::Value* V) { using namespace llvm; if (ConstantInt* CI = dyn_cast(V)) { uint64_t i = CI->getLimitedValue(); - assert(extracted && extracted->size() > i && "Did not find extracted expression."); - return (*extracted)[i]; + assert(exprs.size() > i && "Did not find expression."); + return exprs[i]; } assert(false && "Unexpected value."); } - void visitSlice(llvm::Function* F, unordered_set slice) { + void visitSlice(llvm::Function* F, llvm::Instruction* I) { using namespace llvm; + + unordered_set slice = getSlice(I); + + DEBUG(errs() << "SLICE OF SIZE " << slice.size() << "\n"); + for (Function::iterator B = F->begin(), E = F->end(); B != E; ++B) { - bool blockVisited = false; + if (!slice.count(B)) + continue; + visitBasicBlock(*B); + for (BasicBlock::iterator I = B->begin(), G = B->end(); I != G; ++I) { - if (slice.count(&*I)) { - if (!blockVisited) { - visitBasicBlock(*B); - blockVisited = true; - } - visit(*I); - } + if (!slice.count(&*I)) + continue; + visit(*I); + } + + if (I->getParent() == B) { + emit(Stmt::return_(rep.expr(I))); + + } else if (!slice.count(B->getTerminator())) { + emit(Stmt::assume(Expr::lit(false))); + emit(Stmt::goto_(getBlock(I->getParent())->getName())); } - // TODO WHAT TO DO WITH TERMINATORLESS BLOCKS? } } diff --git a/include/smack/SmackModuleGenerator.h b/include/smack/SmackModuleGenerator.h index 19fcafb24..4b4846587 100644 --- a/include/smack/SmackModuleGenerator.h +++ b/include/smack/SmackModuleGenerator.h @@ -38,12 +38,11 @@ class SmackModuleGenerator : public llvm::ModulePass { } virtual bool runOnModule(llvm::Module& m) { - SmackRep* rep = new SmackRep(&getAnalysis()); - generateProgram(m,rep); + generateProgram(m); return false; } - void generateProgram(llvm::Module& m, SmackRep* rep); + void generateProgram(llvm::Module& m); Program& getProgram() { return program; diff --git a/include/smack/SmackRep.h b/include/smack/SmackRep.h index 439269c20..f12b3eb09 100644 --- a/include/smack/SmackRep.h +++ b/include/smack/SmackRep.h @@ -6,6 +6,7 @@ #ifndef SMACKREP_H #define SMACKREP_H +#include "smack/Naming.h" #include "smack/BoogieAst.h" #include "smack/SmackOptions.h" #include "smack/DSAAliasAnalysis.h" @@ -28,11 +29,6 @@ using namespace std; class SmackRep { public: - static const string BLOCK_LBL; - static const string RET_VAR; - static const string BOOL_VAR; - static const string FLOAT_VAR; - static const string PTR_VAR; static const string BOOL_TYPE; static const string FLOAT_TYPE; static const string NULL_VAL; @@ -127,6 +123,7 @@ class SmackRep { protected: DSAAliasAnalysis* aliasAnalysis; + Naming& naming; vector bplGlobals; vector< pair > memoryRegions; const llvm::DataLayout* targetData; @@ -139,8 +136,8 @@ class SmackRep { unsigned uniqueUndefNum; public: - SmackRep(DSAAliasAnalysis* aa) - : aliasAnalysis(aa), targetData(aa->getDataLayout()), globalsBottom(0) { + SmackRep(DSAAliasAnalysis* aa, Naming& N) + : aliasAnalysis(aa), naming(N), targetData(aa->getDataLayout()), globalsBottom(0) { uniqueFpNum = 0; uniqueUndefNum = 0; } @@ -161,8 +158,6 @@ class SmackRep { Program* getProgram() { return program; } void setProgram(Program* p) { program = p; } - bool isSmackName(string n); - bool isSmackGeneratedName(string n); bool isMallocOrFree(llvm::Function* f); bool isIgnore(llvm::Function* f); bool isInt(const llvm::Type* t); @@ -186,7 +181,6 @@ class SmackRep { const Expr* mem(const llvm::Value* v); const Expr* mem(unsigned region, const Expr* addr); - string id(const llvm::Value* v); const Expr* undef(); const Expr* lit(const llvm::Value* v); const Expr* lit(unsigned v); diff --git a/lib/smack/Contracts.cpp b/lib/smack/Contracts.cpp index 249bce090..cec158b9c 100644 --- a/lib/smack/Contracts.cpp +++ b/lib/smack/Contracts.cpp @@ -8,13 +8,11 @@ Expr* ContractsExtractor::sliceExpr(Value* V) { Instruction* I = dyn_cast(V); assert(I && "Expected instruction."); Function* F = I->getParent()->getParent(); - Instruction* J = ReturnInst::Create(I->getContext(), I, I->getParent()); - CodeExpr* code = new CodeExpr(*rep.getProgram()); - SmackInstGenerator igen(rep, *code, extracted.size()); - igen.setExtracted(extracted); - igen.visitSlice(F,getSlice(J)); - J->eraseFromParent(); + SmackInstGenerator igen(rep, *code, naming, exprs); + naming.enter(); + igen.visitSlice(F,I); + naming.leave(); removeSlice(I); return code; } @@ -22,43 +20,43 @@ Expr* ContractsExtractor::sliceExpr(Value* V) { void ContractsExtractor::visitCallInst(CallInst& ci) { Function* f = ci.getCalledFunction(); - if (f && rep.id(f).find("forall") != string::npos) { + if (f && naming.get(*f).find("forall") != string::npos) { assert(ci.getNumArgOperands() == 2 && "Unexpected operands to forall."); Value* var = ci.getArgOperand(0); Value* arg = ci.getArgOperand(1); - ci.setArgOperand(1,extractionIdx(ci.getContext())); + ci.setArgOperand(1,expressionIdx(ci.getContext())); const Expr* e = Expr::forall(rep.getString(var), "int", sliceExpr(arg)); - extracted.push_back(e); + exprs.push_back(e); - } else if (f && rep.id(f).find("exists") != string::npos) { + } else if (f && naming.get(*f).find("exists") != string::npos) { assert(ci.getNumArgOperands() == 2 && "Unexpected operands to exists."); Value* var = ci.getArgOperand(0); Value* arg = ci.getArgOperand(1); - ci.setArgOperand(1,extractionIdx(ci.getContext())); + ci.setArgOperand(1,expressionIdx(ci.getContext())); const Expr* e = Expr::exists(rep.getString(var), "int", sliceExpr(arg)); - extracted.push_back(e); + exprs.push_back(e); - } else if (f && rep.id(f).find("requires") != string::npos) { + } else if (f && naming.get(*f).find("requires") != string::npos) { assert(ci.getNumArgOperands() == 1 && "Unexpected operands to requires."); Value* V = ci.getArgOperand(0); ci.setArgOperand(0,ConstantInt::getTrue(ci.getContext())); proc.addRequires(sliceExpr(V)); ci.eraseFromParent(); - } else if (f && rep.id(f).find("ensures") != string::npos) { + } else if (f && naming.get(*f).find("ensures") != string::npos) { assert(ci.getNumArgOperands() == 1 && "Unexpected operands to ensures."); Value* V = ci.getArgOperand(0); ci.setArgOperand(0,ConstantInt::getTrue(ci.getContext())); proc.addEnsures(sliceExpr(V)); ci.eraseFromParent(); - } else if (f && rep.id(f).find("invariant") != string::npos) { + } else if (f && naming.get(*f).find("invariant") != string::npos) { assert(ci.getNumArgOperands() == 1 && "Unexpected operands to invariant."); Value* arg = ci.getArgOperand(0); - Value* idx = extractionIdx(ci.getContext()); + Value* idx = expressionIdx(ci.getContext()); ci.setArgOperand(0,idx); const Expr* e = sliceExpr(arg); - extracted.push_back(e); + exprs.push_back(e); BasicBlock* body = ci.getParent(); BasicBlock* head = body->getSinglePredecessor(); diff --git a/lib/smack/Naming.cpp b/lib/smack/Naming.cpp new file mode 100644 index 000000000..0fe6b4000 --- /dev/null +++ b/lib/smack/Naming.cpp @@ -0,0 +1,113 @@ +#include "smack/Naming.h" +#include "llvm/Support/GraphWriter.h" +#include "llvm/IR/Type.h" +#include + +namespace smack { + +const string Naming::BLOCK_LBL = "$bb"; +const string Naming::RET_VAR = "$r"; +const string Naming::BOOL_VAR = "$b"; +const string Naming::FLOAT_VAR = "$f"; +const string Naming::PTR_VAR = "$p"; + +Regex Naming::BPL_KW( + "^(bool|int|false|true|old|forall|exists|requires|modifies|ensures|invariant|free" + "|unique|finite|complete|type|const|function|axiom|var|procedure" + "|implementation|where|returns|assume|assert|havoc|call|return|while" + "|break|goto|if|else|div)$"); + +Regex Naming::SMACK_NAME(".*__SMACK_.*"); + +bool Naming::isBplKeyword(string s) { + return BPL_KW.match(s); +} + +bool Naming::isSmackName(string n) { + return SMACK_NAME.match(n); +} + +bool Naming::isSmackGeneratedName(string n) { + return n.size() > 0 && n[0] == '$'; +} + +string Naming::escape(string s) { + string Str(llvm::DOT::EscapeString(s)); + for (unsigned i = 0; i != Str.length(); ++i) + switch (Str[i]) { + case '\01': + Str[i] = '_'; + break; + case '@': + Str[i] = '.'; + break; + } + return Str; +} + +void Naming::enter() { + NameMap N; + nameStack.push(N); +} + +void Naming::leave() { + assert(nameStack.size() > 0 && "Name stack should not be empty."); + nameStack.pop(); + if (nameStack.size() == 0) { + varNum = 0; + blockNum = 0; + } +} + +string Naming::get(const llvm::Value& V) { + + if (nameStack.size() > 0 && nameStack.top().count(&V)) + return nameStack.top()[&V]; + + string name; + + if (V.hasName() && !llvm::isa(&V)) { + name = escape(V.getName().str()); + if (isBplKeyword(name)) + name = name + "_"; + + } else if (llvm::isa(&V)) { + assert(nameStack.size() > 0 && "Name stack should not be empty."); + name = freshBlockName(); + + } else if (llvm::isa(&V)) { + assert(nameStack.size() > 0 && "Name stack should not be empty."); + name = freshVarName(V); + + } else { + name = ""; + } + + if (nameStack.size() > 0) + nameStack.top()[&V] = name; + return name; +} + +string Naming::freshBlockName() { + stringstream s; + s << BLOCK_LBL << blockNum++; + return s.str(); +} + +string Naming::freshVarName(const llvm::Value& V) { + stringstream s; + + if (V.getType()->isIntegerTy(1)) + s << BOOL_VAR; + + else if (V.getType()->isFloatingPointTy()) + s << FLOAT_VAR; + + else + s << PTR_VAR; + + s << varNum++; + return s.str(); +} + +} diff --git a/lib/smack/Slicing.cpp b/lib/smack/Slicing.cpp index 1d5a00419..903aea578 100644 --- a/lib/smack/Slicing.cpp +++ b/lib/smack/Slicing.cpp @@ -5,7 +5,8 @@ // #include "smack/Slicing.h" -#include "llvm/Transforms/Utils/Cloning.h" +#include "llvm/Transforms/Utils/BasicBlockUtils.h" +#include "llvm/Analysis/CFG.h" #include "llvm/IR/Instructions.h" #include "llvm/Support/Debug.h" #include @@ -16,11 +17,26 @@ using namespace std; namespace llvm { - unordered_set getSlice(Value* V) { - unordered_set slice; + typedef SmallVector< pair, 10 > EdgeList; + + bool contains(EdgeList& backedges, const BasicBlock* src, const BasicBlock* tgt) { + for (EdgeList::iterator E = backedges.begin(), End = backedges.end(); E != End; ++E) { + if (E->first == src && E->second == tgt) + return true; + } + return false; + } + + unordered_set getSlice(Value* V) { + unordered_set slice; Instruction* I = dyn_cast(V); assert(I && "Expected instruction value."); + const BasicBlock* B = I->getParent(); + const Function* F = B->getParent(); + EdgeList backedges; + FindFunctionBackedges(*F,backedges); + queue workList; workList.push(I); @@ -30,30 +46,36 @@ namespace llvm { if (slice.count(I)) continue; slice.insert(I); + slice.insert(I->getParent()); if (BranchInst* Br = dyn_cast(I)) { if (Br->isConditional()) { if (Instruction* J = dyn_cast(Br->getCondition())) { workList.push(J); } + slice.insert(Br->getSuccessor(1)); } + slice.insert(Br->getSuccessor(0)); + } else { for (User::op_iterator U = I->op_begin(); U != I->op_end(); ++U) { - if (Instruction* J = dyn_cast(U)) { - workList.push(J); - } + if (Instruction* J = dyn_cast(U)) + if (!contains(backedges,J->getParent(),I->getParent())) + workList.push(J); } } if (PHINode* Phi = dyn_cast(I)) { for (PHINode::block_iterator B = Phi->block_begin(); B != Phi->block_end(); ++B) { - workList.push( (*B)->getTerminator() ); + if (!contains(backedges,*B,I->getParent())) + workList.push( (*B)->getTerminator() ); } } // ENSURE EACH BLOCK HAS A TERMINATOR if (BranchInst* Br = dyn_cast(I->getParent()->getTerminator())) - workList.push(Br); + if (I->getParent() != B) + workList.push(Br); } return slice; diff --git a/lib/smack/SmackInstGenerator.cpp b/lib/smack/SmackInstGenerator.cpp index 0a2b3e73e..7bc272bf0 100644 --- a/lib/smack/SmackInstGenerator.cpp +++ b/lib/smack/SmackInstGenerator.cpp @@ -38,24 +38,11 @@ string i2s(llvm::Instruction& i) { } Block* SmackInstGenerator::createBlock() { - stringstream s; - s << SmackRep::BLOCK_LBL << blockNum++; - Block* b = new Block(s.str()); + Block* b = new Block(naming.freshBlockName()); addBlock(b); return b; } -string SmackInstGenerator::createVar() { - stringstream s; - s << "$x"; - if (varNs >= 0) - s << "." << varNs << "."; - s << varNum++; - string name = s.str(); - addDecl(Decl::variable(name, rep.getPtrType())); - return name; -} - Block* SmackInstGenerator::getBlock(llvm::BasicBlock* bb) { if (blockMap.count(bb) == 0) blockMap[bb] = createBlock(); @@ -63,21 +50,10 @@ Block* SmackInstGenerator::getBlock(llvm::BasicBlock* bb) { } void SmackInstGenerator::nameInstruction(llvm::Instruction& inst) { - if (!inst.getType()->isVoidTy()) { - if (!inst.hasName() || !rep.isSmackGeneratedName(inst.getName())) { - stringstream s; - if (rep.isBool(&inst)) - s << SmackRep::BOOL_VAR; - else if (rep.isFloat(&inst)) - s << SmackRep::FLOAT_VAR; - else - s << SmackRep::PTR_VAR; - if (varNs >= 0) - s << "." << varNs << "."; - inst.setName(s.str()); - } - addDecl(Decl::variable(rep.id(&inst), rep.type(&inst))); - } + if (inst.getType()->isVoidTy()) + return; + + addDecl(Decl::variable(naming.get(inst), rep.type(&inst))); } void SmackInstGenerator::annotate(llvm::Instruction& i, Block* b) { @@ -175,9 +151,8 @@ void SmackInstGenerator::visitReturnInst(llvm::ReturnInst& ri) { if (proc.isProc()) { if (v) - emit(Stmt::assign(Expr::id(SmackRep::RET_VAR), rep.expr(v))); + emit(Stmt::assign(Expr::id(Naming::RET_VAR), rep.expr(v))); emit(Stmt::return_()); - } else { assert (v && "Expected return value."); emit(Stmt::return_(rep.expr(v))); @@ -460,7 +435,7 @@ void SmackInstGenerator::visitPHINode(llvm::PHINode& phi) { void SmackInstGenerator::visitSelectInst(llvm::SelectInst& i) { processInstruction(i); - string x = rep.id(&i); + string x = naming.get(i); const Expr *c = rep.expr(i.getOperand(0)), *v1 = rep.expr(i.getOperand(1)), @@ -482,20 +457,20 @@ void SmackInstGenerator::visitCallInst(llvm::CallInst& ci) { WARN("unsoundly ignoring inline asm call: " + i2s(ci)); emit(Stmt::skip()); - } else if (f && rep.id(f).find("llvm.dbg.") != string::npos) { + } else if (f && naming.get(*f).find("llvm.dbg.") != string::npos) { WARN("ignoring llvm.debug call."); emit(Stmt::skip()); - } else if (f && rep.id(f) == "__SMACK_mod") { + } else if (f && naming.get(*f) == "__SMACK_mod") { addMod(rep.code(ci)); - } else if (f && rep.id(f) == "__SMACK_code") { + } else if (f && naming.get(*f) == "__SMACK_code") { emit(Stmt::code(rep.code(ci))); - } else if (f && rep.id(f) == "__SMACK_decl") { + } else if (f && naming.get(*f) == "__SMACK_decl") { addDecl(Decl::code(rep.code(ci))); - } else if (f && rep.id(f) == "__SMACK_top_decl") { + } else if (f && naming.get(*f) == "__SMACK_top_decl") { string decl = rep.code(ci); addTopDecl(Decl::code(decl)); if (VAR_DECL.match(decl)) { @@ -503,32 +478,32 @@ void SmackInstGenerator::visitCallInst(llvm::CallInst& ci) { rep.addBplGlobal(var); } - } else if (f && rep.id(f).find("result") != string::npos) { + } else if (f && naming.get(*f).find("result") != string::npos) { assert(ci.getNumArgOperands() == 0 && "Unexpected operands to result."); - emit(Stmt::assign(rep.expr(&ci),Expr::id(SmackRep::RET_VAR))); + emit(Stmt::assign(rep.expr(&ci),Expr::id(Naming::RET_VAR))); - } else if (f && rep.id(f).find("qvar") != string::npos) { + } else if (f && naming.get(*f).find("qvar") != string::npos) { assert(ci.getNumArgOperands() == 1 && "Unexpected operands to qvar."); emit(Stmt::assign(rep.expr(&ci),Expr::id(rep.getString(ci.getArgOperand(0))))); - } else if (f && rep.id(f).find("old") != string::npos) { + } else if (f && naming.get(*f).find("old") != string::npos) { assert(ci.getNumArgOperands() == 1 && "Unexpected operands to old."); llvm::LoadInst* LI = llvm::dyn_cast(ci.getArgOperand(0)); assert(LI && "Expected value from Load."); emit(Stmt::assign(rep.expr(&ci), Expr::fn("old",rep.mem(LI->getPointerOperand())) )); - } else if (f && rep.id(f).find("forall") != string::npos) { + } else if (f && naming.get(*f).find("forall") != string::npos) { assert(ci.getNumArgOperands() == 2 && "Unexpected operands to forall."); - emit(Stmt::assign(rep.expr(&ci),getExtracted(ci.getArgOperand(1)))); + emit(Stmt::assign(rep.expr(&ci),getExpression(ci.getArgOperand(1)))); - } else if (f && rep.id(f).find("iassert") != string::npos) { + } else if (f && naming.get(*f).find("iassert") != string::npos) { assert(ci.getNumArgOperands() == 1 && "Unexpected operands to invariant."); - emit(Stmt::assert_(getExtracted(ci.getArgOperand(0)))); + emit(Stmt::assert_(getExpression(ci.getArgOperand(0)))); - } else if (f && rep.id(f).find("iassume") != string::npos) { + } else if (f && naming.get(*f).find("iassume") != string::npos) { assert(ci.getNumArgOperands() == 1 && "Unexpected operands to invariant."); - emit(Stmt::assume(getExtracted(ci.getArgOperand(0)))); + emit(Stmt::assume(getExpression(ci.getArgOperand(0)))); } else if (f) { emit(rep.call(f, ci)); diff --git a/lib/smack/SmackModuleGenerator.cpp b/lib/smack/SmackModuleGenerator.cpp index cab659fd7..5a38306c0 100644 --- a/lib/smack/SmackModuleGenerator.cpp +++ b/lib/smack/SmackModuleGenerator.cpp @@ -11,57 +11,62 @@ namespace smack { llvm::RegisterPass X("smack", "SMACK generator pass"); char SmackModuleGenerator::ID = 0; -void SmackModuleGenerator::generateProgram(llvm::Module& m, SmackRep* rep) { +void SmackModuleGenerator::generateProgram(llvm::Module& m) { - rep->setProgram( &program ); - rep->collectRegions(m); + Naming naming; + SmackRep rep(&getAnalysis(), naming); + + rep.setProgram( &program ); + rep.collectRegions(m); DEBUG(errs() << "Analyzing globals...\n"); for (llvm::Module::const_global_iterator x = m.global_begin(), e = m.global_end(); x != e; ++x) - program.addDecls(rep->globalDecl(x)); + program.addDecls(rep.globalDecl(x)); - if (rep->hasStaticInits()) - program.addDecl(rep->getStaticInit()); + if (rep.hasStaticInits()) + program.addDecl(rep.getStaticInit()); DEBUG(errs() << "Analyzing functions...\n"); for (llvm::Module::iterator func = m.begin(), e = m.end(); func != e; ++func) { - if (rep->isIgnore(func)) + if (rep.isIgnore(func)) continue; - if (rep->isMallocOrFree(func)) { - program.addDecls(rep->globalDecl(func)); + if (rep.isMallocOrFree(func)) { + program.addDecls(rep.globalDecl(func)); continue; } if (!func->isVarArg()) - program.addDecls(rep->globalDecl(func)); + program.addDecls(rep.globalDecl(func)); - ProcDecl* proc = rep->proc(func,0); + ProcDecl* proc = rep.proc(func,0); if (proc->getName() != "__SMACK_decls") program.addDecl(proc); if (!func->isDeclaration() && !func->empty() && !func->getEntryBlock().empty()) { - DEBUG(errs() << "Analyzing function: " << rep->id(func) << "\n"); + DEBUG(errs() << "Analyzing function: " << naming.get(*func) << "\n"); - ContractsExtractor ce(*rep, *proc); - ce.visit(func); + ExpressionList E; + ContractsExtractor ce(rep, *proc, naming, E); + SmackInstGenerator igen(rep, *proc, naming, E); - SmackInstGenerator igen(*rep, *proc); - igen.setExtracted(ce.getExtracted()); + naming.enter(); + ce.visit(func); igen.visit(func); + naming.leave(); // First execute static initializers, in the main procedure. - if (rep->id(func) == "main" && rep->hasStaticInits()) + if (naming.get(*func) == "main" && rep.hasStaticInits()) proc->insert(Stmt::call(SmackRep::STATIC_INIT)); - DEBUG(errs() << "Finished analyzing function: " << rep->id(func) << "\n\n"); + DEBUG(errs() << "Finished analyzing function: " << naming.get(*func) << "\n\n"); } // MODIFIES @@ -73,7 +78,7 @@ void SmackModuleGenerator::generateProgram(llvm::Module& m, SmackRep* rep) { for (unsigned i=0; ihasBody()) { - procs[i]->addMods(rep->getModifies()); + procs[i]->addMods(rep.getModifies()); } else { vector< pair > rets = procs[i]->getRets(); @@ -81,14 +86,14 @@ void SmackModuleGenerator::generateProgram(llvm::Module& m, SmackRep* rep) { r != rets.end(); ++r) { // TODO should only do this for returned POINTERS. - // procs[i]->addEnsures(rep->declareIsExternal(Expr::id(r->first))); + // procs[i]->addEnsures(rep.declareIsExternal(Expr::id(r->first))); } } } // NOTE we must do this after instruction generation, since we would not // otherwise know how many regions to declare. - program.appendPrelude(rep->getPrelude()); + program.appendPrelude(rep.getPrelude()); } } // namespace smack diff --git a/lib/smack/SmackRep.cpp b/lib/smack/SmackRep.cpp index f07847f27..53836bdea 100644 --- a/lib/smack/SmackRep.cpp +++ b/lib/smack/SmackRep.cpp @@ -10,11 +10,6 @@ namespace smack { -const string SmackRep::BLOCK_LBL = "$bb"; -const string SmackRep::RET_VAR = "$r"; -const string SmackRep::BOOL_VAR = "$b"; -const string SmackRep::FLOAT_VAR = "$f"; -const string SmackRep::PTR_VAR = "$p"; const string SmackRep::BOOL_TYPE = "bool"; const string SmackRep::FLOAT_TYPE = "float"; const string SmackRep::NULL_VAL = "$NULL"; @@ -107,52 +102,18 @@ const string SmackRep::STATIC_INIT = "$static_init"; const int SmackRep::width = 0; -// TODO Do the following functions belong here ? - -string EscapeString(string s) { - string Str(llvm::DOT::EscapeString(s)); - for (unsigned i = 0; i != Str.length(); ++i) - switch (Str[i]) { - case '\01': - Str[i] = '_'; - break; - case '@': - Str[i] = '.'; - break; - } - return Str; -} - -Regex BPL_KW( - "^(bool|int|false|true|old|forall|exists|requires|modifies|ensures|invariant|free" - "|unique|finite|complete|type|const|function|axiom|var|procedure" - "|implementation|where|returns|assume|assert|havoc|call|return|while" - "|break|goto|if|else|div)$"); -Regex SMACK_NAME(".*__SMACK_.*"); Regex PROC_MALLOC_FREE("^(malloc|free_)$"); Regex PROC_IGNORE("^(" "llvm\\.memcpy\\..*|llvm\\.memset\\..*|llvm\\.dbg\\..*|" "__SMACK_code|__SMACK_decl|__SMACK_top_decl" ")$"); -bool isBplKeyword(string s) { - return BPL_KW.match(s); -} - -bool SmackRep::isSmackName(string n) { - return SMACK_NAME.match(n); -} - -bool SmackRep::isSmackGeneratedName(string n) { - return n.size() > 0 && n[0] == '$'; -} - bool SmackRep::isMallocOrFree(llvm::Function* f) { - return PROC_MALLOC_FREE.match(id(f)); + return PROC_MALLOC_FREE.match(naming.get(*f)); } bool SmackRep::isIgnore(llvm::Function* f) { - return PROC_IGNORE.match(id(f)); + return PROC_IGNORE.match(naming.get(*f)); } bool SmackRep::isInt(const llvm::Type* t) { @@ -293,7 +254,7 @@ const Stmt* SmackRep::alloca(llvm::AllocaInst& i) { const Expr* size = Expr::fn(MUL,lit(storageSize(i.getAllocatedType())),lit(i.getArraySize())); - return Stmt::call(ALLOCA,size,id(&i)); + return Stmt::call(ALLOCA,size,naming.get(i)); } const Stmt* SmackRep::memcpy(const llvm::MemCpyInst& mci) { @@ -348,29 +309,6 @@ const Expr* SmackRep::undef() { return Expr::id(s.str()); } -string SmackRep::id(const llvm::Value* v) { - string name; - - if (v->hasName()) { - name = v->getName().str(); - - } else { - assert(false && "expected named value."); - - // OLD NAME-HANDLING CODE - // llvm::raw_string_ostream ss(name); - // ss << *v; - // name = name.substr(name.find("%")); - // name = name.substr(0, name.find(" ")); - } - name = EscapeString(name); - - if (isBplKeyword(name)) - name = name + "_"; - - return name; -} - const Expr* SmackRep::lit(const llvm::Value* v) { if (const llvm::ConstantInt* ci = llvm::dyn_cast(v)) { if (ci->getBitWidth() == 1) @@ -437,10 +375,10 @@ const Expr* SmackRep::expr(const llvm::Value* v) { if (const GlobalValue* g = dyn_cast(v)) { assert(g->hasName()); - return Expr::id(id(v)); + return Expr::id(naming.get(*v)); - } else if (v->hasName()) - return Expr::id(id(v)); + } else if (naming.get(*v) != "") + return Expr::id(naming.get(*v)); else if (const Constant* constant = dyn_cast(v)) { @@ -715,7 +653,7 @@ ProcDecl* SmackRep::proc(llvm::Function* f, int nargs) { arg = f->arg_begin(), e = f->arg_end(); arg != e; ++arg, ++i) { string name; if (arg->hasName()) { - name = id(arg); + name = naming.get(*arg); } else { name = indexedName("p",i); arg->setName(name); @@ -728,11 +666,11 @@ ProcDecl* SmackRep::proc(llvm::Function* f, int nargs) { args.push_back(make_pair(indexedName("p",i), getPtrType())); if (!f->getReturnType()->isVoidTy()) - rets.push_back(make_pair(RET_VAR,type(f->getReturnType()))); + rets.push_back(make_pair(Naming::RET_VAR,type(f->getReturnType()))); return (ProcDecl*) Decl::procedure( *program, - f->isVarArg() ? indexedName(id(f),nargs) : id(f), + f->isVarArg() ? indexedName(naming.get(*f),nargs) : naming.get(*f), args, rets ); @@ -746,7 +684,7 @@ const Stmt* SmackRep::call(llvm::Function* f, llvm::CallInst& ci) { assert(f && "Call encountered unresolved function."); - string name = id(f); + string name = naming.get(*f); vector args; vector rets; @@ -754,7 +692,7 @@ const Stmt* SmackRep::call(llvm::Function* f, llvm::CallInst& ci) { args.push_back(arg(f, i, ci.getOperand(i))); if (!ci.getType()->isVoidTy()) - rets.push_back(id(&ci)); + rets.push_back(naming.get(ci)); if (name == "malloc") { assert(args.size() == 1); @@ -764,7 +702,7 @@ const Stmt* SmackRep::call(llvm::Function* f, llvm::CallInst& ci) { assert(args.size() == 1); return Stmt::call(FREE, args[0]); - } else if (f->isVarArg() || (f->isDeclaration() && !isSmackName(name))) { + } else if (f->isVarArg() || (f->isDeclaration() && !Naming::isSmackName(name))) { Decl* p = proc(f,args.size()); program->addDecl(p); @@ -899,7 +837,7 @@ vector SmackRep::globalDecl(const llvm::Value* v) { using namespace llvm; vector decls; vector ax; - string name = id(v); + string name = naming.get(*v); if (const GlobalVariable* g = dyn_cast(v)) { if (g->hasInitializer()) { From c0e228b9e0e15c9ebc6484d3ddbd1a33c39c0b9b Mon Sep 17 00:00:00 2001 From: Michael Emmi Date: Wed, 6 Aug 2014 18:27:40 -0400 Subject: [PATCH 031/140] Small cleanup. --- include/smack/BoogieAst.h | 7 +++++-- include/smack/SmackRep.h | 11 +++++------ lib/smack/BoogieAst.cpp | 3 +++ lib/smack/Contracts.cpp | 2 +- lib/smack/SmackModuleGenerator.cpp | 4 +--- lib/smack/SmackRep.cpp | 10 +++++----- 6 files changed, 20 insertions(+), 17 deletions(-) diff --git a/include/smack/BoogieAst.h b/include/smack/BoogieAst.h index 33d20883d..3a2d2b1d7 100644 --- a/include/smack/BoogieAst.h +++ b/include/smack/BoogieAst.h @@ -291,9 +291,11 @@ class Decl { unsigned getId() const { return id; } string getName() const { return name; } virtual kind getKind() const = 0; + void addAttr(const Attr* a) { attrs.push_back(a); } static Decl* typee(string name, string type); static Decl* axiom(const Expr* e); + static Decl* function(string name, vector< pair > args, string type, const Expr* e); static Decl* constant(string name, string type); static Decl* constant(string name, string type, bool unique); static Decl* constant(string name, string type, vector ax, bool unique); @@ -347,8 +349,9 @@ class FuncDecl : public Decl { string type; const Expr* body; public: - FuncDecl(string n, vector< pair > ps, string t, Expr* b) - : Decl(n), params(ps), type(t), body(b) {} + FuncDecl(string n, vector ax, vector< pair > ps, + string t, const Expr* b) + : Decl(n,ax), params(ps), type(t), body(b) {} kind getKind() const { return FUNC; } void print(ostream& os) const; }; diff --git a/include/smack/SmackRep.h b/include/smack/SmackRep.h index f12b3eb09..a2b6c7a8e 100644 --- a/include/smack/SmackRep.h +++ b/include/smack/SmackRep.h @@ -124,10 +124,10 @@ class SmackRep { protected: DSAAliasAnalysis* aliasAnalysis; Naming& naming; + Program& program; vector bplGlobals; vector< pair > memoryRegions; const llvm::DataLayout* targetData; - Program* program; int globalsBottom; vector staticInits; @@ -136,12 +136,14 @@ class SmackRep { unsigned uniqueUndefNum; public: - SmackRep(DSAAliasAnalysis* aa, Naming& N) - : aliasAnalysis(aa), naming(N), targetData(aa->getDataLayout()), globalsBottom(0) { + SmackRep(DSAAliasAnalysis* aa, Naming& N, Program& P) + : aliasAnalysis(aa), naming(N), program(P), + targetData(aa->getDataLayout()), globalsBottom(0) { uniqueFpNum = 0; uniqueUndefNum = 0; } DSAAliasAnalysis* getAliasAnalysis() { return aliasAnalysis; } + Program& getProgram() { return program; } private: void addInit(unsigned region, const Expr* addr, const llvm::Constant* val); @@ -155,9 +157,6 @@ class SmackRep { const Expr* b2i(const llvm::Value* v); public: - Program* getProgram() { return program; } - void setProgram(Program* p) { program = p; } - bool isMallocOrFree(llvm::Function* f); bool isIgnore(llvm::Function* f); bool isInt(const llvm::Type* t); diff --git a/lib/smack/BoogieAst.cpp b/lib/smack/BoogieAst.cpp index 277ef8233..6b3dec429 100644 --- a/lib/smack/BoogieAst.cpp +++ b/lib/smack/BoogieAst.cpp @@ -253,6 +253,9 @@ Decl* Decl::typee(string name, string type) { Decl* Decl::axiom(const Expr* e) { return new AxiomDecl(e); } +Decl* Decl::function(string name, vector< pair > args, string type, const Expr* e) { + return new FuncDecl(name,vector(),args,type,e); +} Decl* Decl::constant(string name, string type) { return Decl::constant(name, type, vector(), false); } diff --git a/lib/smack/Contracts.cpp b/lib/smack/Contracts.cpp index cec158b9c..24a862774 100644 --- a/lib/smack/Contracts.cpp +++ b/lib/smack/Contracts.cpp @@ -8,7 +8,7 @@ Expr* ContractsExtractor::sliceExpr(Value* V) { Instruction* I = dyn_cast(V); assert(I && "Expected instruction."); Function* F = I->getParent()->getParent(); - CodeExpr* code = new CodeExpr(*rep.getProgram()); + CodeExpr* code = new CodeExpr(rep.getProgram()); SmackInstGenerator igen(rep, *code, naming, exprs); naming.enter(); igen.visitSlice(F,I); diff --git a/lib/smack/SmackModuleGenerator.cpp b/lib/smack/SmackModuleGenerator.cpp index 5a38306c0..e1f2206b0 100644 --- a/lib/smack/SmackModuleGenerator.cpp +++ b/lib/smack/SmackModuleGenerator.cpp @@ -14,9 +14,7 @@ char SmackModuleGenerator::ID = 0; void SmackModuleGenerator::generateProgram(llvm::Module& m) { Naming naming; - SmackRep rep(&getAnalysis(), naming); - - rep.setProgram( &program ); + SmackRep rep(&getAnalysis(), naming, program); rep.collectRegions(m); DEBUG(errs() << "Analyzing globals...\n"); diff --git a/lib/smack/SmackRep.cpp b/lib/smack/SmackRep.cpp index 53836bdea..b492a0c46 100644 --- a/lib/smack/SmackRep.cpp +++ b/lib/smack/SmackRep.cpp @@ -261,7 +261,7 @@ const Stmt* SmackRep::memcpy(const llvm::MemCpyInst& mci) { int dstRegion = getRegion(mci.getOperand(0)); int srcRegion = getRegion(mci.getOperand(1)); - program->addDecl(memcpyProc(dstRegion,srcRegion)); + program.addDecl(memcpyProc(dstRegion,srcRegion)); stringstream name; name << "$memcpy." << dstRegion << "." << srcRegion; @@ -274,7 +274,7 @@ const Stmt* SmackRep::memcpy(const llvm::MemCpyInst& mci) { const Stmt* SmackRep::memset(const llvm::MemSetInst& msi) { int region = getRegion(msi.getOperand(0)); - program->addDecl(memsetProc(region)); + program.addDecl(memsetProc(region)); stringstream name; vector args; @@ -669,7 +669,7 @@ ProcDecl* SmackRep::proc(llvm::Function* f, int nargs) { rets.push_back(make_pair(Naming::RET_VAR,type(f->getReturnType()))); return (ProcDecl*) Decl::procedure( - *program, + program, f->isVarArg() ? indexedName(naming.get(*f),nargs) : naming.get(*f), args, rets @@ -705,7 +705,7 @@ const Stmt* SmackRep::call(llvm::Function* f, llvm::CallInst& ci) { } else if (f->isVarArg() || (f->isDeclaration() && !Naming::isSmackName(name))) { Decl* p = proc(f,args.size()); - program->addDecl(p); + program.addDecl(p); return Stmt::call(p->getName(), args, rets); } else { @@ -823,7 +823,7 @@ bool SmackRep::hasStaticInits() { } Decl* SmackRep::getStaticInit() { - ProcDecl* proc = (ProcDecl*) Decl::procedure(*program, STATIC_INIT); + ProcDecl* proc = (ProcDecl*) Decl::procedure(program, STATIC_INIT); Block* b = new Block(); for (unsigned i=0; iaddStmt(staticInits[i]); From 7c82e7ef5df2fcb65ae1f103d03a3a82052e6059 Mon Sep 17 00:00:00 2001 From: Michael Emmi Date: Wed, 6 Aug 2014 18:48:53 -0400 Subject: [PATCH 032/140] Prevent invariant slice from using phi nodes with back edges. --- lib/smack/Slicing.cpp | 36 +++++++++++++++++++++------------ test/contracts/invariant.c | 17 ++++++++++++++++ test/contracts/invariant_fail.c | 17 ++++++++++++++++ 3 files changed, 57 insertions(+), 13 deletions(-) create mode 100644 test/contracts/invariant.c create mode 100644 test/contracts/invariant_fail.c diff --git a/lib/smack/Slicing.cpp b/lib/smack/Slicing.cpp index 903aea578..c46ede694 100644 --- a/lib/smack/Slicing.cpp +++ b/lib/smack/Slicing.cpp @@ -48,6 +48,11 @@ namespace llvm { slice.insert(I); slice.insert(I->getParent()); + // ENSURE EACH BLOCK HAS A TERMINATOR + if (BranchInst* Br = dyn_cast(I->getParent()->getTerminator())) + if (I->getParent() != B) + workList.push(Br); + if (BranchInst* Br = dyn_cast(I)) { if (Br->isConditional()) { if (Instruction* J = dyn_cast(Br->getCondition())) { @@ -56,26 +61,31 @@ namespace llvm { slice.insert(Br->getSuccessor(1)); } slice.insert(Br->getSuccessor(0)); - - } else { - for (User::op_iterator U = I->op_begin(); U != I->op_end(); ++U) { - if (Instruction* J = dyn_cast(U)) - if (!contains(backedges,J->getParent(),I->getParent())) - workList.push(J); - } + continue; } if (PHINode* Phi = dyn_cast(I)) { for (PHINode::block_iterator B = Phi->block_begin(); B != Phi->block_end(); ++B) { - if (!contains(backedges,*B,I->getParent())) - workList.push( (*B)->getTerminator() ); + if (contains(backedges,*B,I->getParent())) { + goto NEXT; + } + } + + for (PHINode::block_iterator B = Phi->block_begin(); B != Phi->block_end(); ++B) { + workList.push( (*B)->getTerminator() ); } } - // ENSURE EACH BLOCK HAS A TERMINATOR - if (BranchInst* Br = dyn_cast(I->getParent()->getTerminator())) - if (I->getParent() != B) - workList.push(Br); + for (User::op_iterator U = I->op_begin(); U != I->op_end(); ++U) { + if (Instruction* J = dyn_cast(U)) { + if (!contains(backedges,J->getParent(),I->getParent())) { + workList.push(J); + } + } + } + +NEXT: + (void)0; // no-op } return slice; diff --git a/test/contracts/invariant.c b/test/contracts/invariant.c new file mode 100644 index 000000000..304af6f8f --- /dev/null +++ b/test/contracts/invariant.c @@ -0,0 +1,17 @@ +#include +#include +#include "smack.h" + +// @expect 1 verified, 0 errors? + +int g[10]; + +int main(void) { + + for (int i=0; i<4; i++) { + invariant(i < 4); + g[i] = i; + } + + return 0; +} \ No newline at end of file diff --git a/test/contracts/invariant_fail.c b/test/contracts/invariant_fail.c new file mode 100644 index 000000000..5efaeeb3a --- /dev/null +++ b/test/contracts/invariant_fail.c @@ -0,0 +1,17 @@ +#include +#include +#include "smack.h" + +// @expect 0 verified, 1 errors? + +int g[10]; + +int main(void) { + + for (int i=0; i<4; i++) { + invariant(i < 3); + g[i] = i; + } + + return 0; +} \ No newline at end of file From 93f3b6bb06d1490264c41bf3f46ee18ddbe7a937 Mon Sep 17 00:00:00 2001 From: Michael Emmi Date: Sat, 9 Aug 2014 09:33:12 -0400 Subject: [PATCH 033/140] Added result contract regressions. --- test/contracts/result.c | 13 +++++++++++++ test/contracts/result_fail.c | 13 +++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 test/contracts/result.c create mode 100644 test/contracts/result_fail.c diff --git a/test/contracts/result.c b/test/contracts/result.c new file mode 100644 index 000000000..4d9ad1ab7 --- /dev/null +++ b/test/contracts/result.c @@ -0,0 +1,13 @@ +#include +#include +#include "smack.h" + +// @expect 1 verified, 0 errors? + +int g; + +int p() { + requires(g > 0); + ensures(result() > 10); + return g + 10; +} diff --git a/test/contracts/result_fail.c b/test/contracts/result_fail.c new file mode 100644 index 000000000..6127baa16 --- /dev/null +++ b/test/contracts/result_fail.c @@ -0,0 +1,13 @@ +#include +#include +#include "smack.h" + +// @expect 0 verified, 1 errors? + +int g; + +int p() { + requires(g > 0); + ensures(result() > 11); + return g + 10; +} From 0915af529409c0b7f62683670eee533eb3ee24d4 Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Sat, 9 Aug 2014 09:24:29 -0600 Subject: [PATCH 034/140] Refactored verifier selection and unrolling in SMACK scripts. --- bin/smackgen.py | 6 +++--- bin/smackreach.py | 4 ++-- bin/smackverify.py | 12 +++++++++--- examples/svcomp/locks/regtest-corral.py | 2 +- examples/svcomp/locks/regtest.py | 4 ++-- .../svcomp/ntdrivers-simplified/regtest-corral.py | 2 +- examples/svcomp/ntdrivers-simplified/regtest.py | 4 ++-- examples/svcomp/ntdrivers/regtest-corral.py | 2 +- examples/svcomp/ntdrivers/regtest.py | 4 ++-- test/regtest.py | 2 +- 10 files changed, 24 insertions(+), 18 deletions(-) diff --git a/bin/smackgen.py b/bin/smackgen.py index 37c89c6db..57c2dcaae 100755 --- a/bin/smackgen.py +++ b/bin/smackgen.py @@ -14,11 +14,11 @@ def smackParser(): parser = argparse.ArgumentParser(add_help=False, parents=[llvm2bplParser()]) parser.add_argument('--clang', dest='clang', default='', help='pass arguments to clang (e.g., --clang="-w -g")') - parser.add_argument('--verifier', dest='verifier', choices=['boogie-plain', 'boogie-inline', 'corral'], default='boogie-inline', + parser.add_argument('--verifier', dest='verifier', choices=['boogie', 'corral'], default='corral', help='set the underlying verifier format') parser.add_argument('--entry-points', metavar='PROC', dest='entryPoints', default='main', nargs='+', help='specify entry procedures') - parser.add_argument('--unroll', metavar='N', dest='unroll', default='2', type=int, + parser.add_argument('--unroll', metavar='N', dest='unroll', type=int, help='unroll loops/recursion in Boogie/Corral N number of times') parser.add_argument('--mem-mod', dest='memmod', choices=['no-reuse', 'no-reuse-impls', 'reuse'], default='no-reuse', help='set the memory model (no-reuse=never reallocate the same address, reuse=reallocate freed addresses)') @@ -99,7 +99,7 @@ def smackGenerate(sysArgv): inputFile.close() p = re.compile('procedure\s+([^\s(]*)\s*\(') - if args.verifier == 'boogie-inline': + if args.verifier == 'boogie' and args.unroll is not None: # put inline on procedures bpl = p.sub(lambda match: addInline(match, args.entryPoints, args.unroll), bpl) elif args.verifier == 'corral': diff --git a/bin/smackreach.py b/bin/smackreach.py index 1afa131ac..775c583da 100644 --- a/bin/smackreach.py +++ b/bin/smackreach.py @@ -161,7 +161,7 @@ def UpdateSourceInfo(corralOutput, sourceInfo, verifier): parser = argparse.ArgumentParser(description='Checks the input LLVM file for code reachability.', parents=[reachParser()]) parser.parse_args() # just check if arguments are looking good - #!!!!!!START COPY OF SECTION FROM smack-verify.py!!!!!!!!!!! + #!!!!!!START COPY OF SECTION FROM smackverify.py!!!!!!!!!!! # Probably should pull into subroutine or something # remove arguments not recognized by lower scripts # not sure of a better way to do this @@ -182,6 +182,6 @@ def UpdateSourceInfo(corralOutput, sourceInfo, verifier): # write final output args.outfile.write(bpl) args.outfile.close() - #!!!!!!END COPY OF SECTION FROM smack-verify.py!!!!!!!!!!! + #!!!!!!END COPY OF SECTION FROM smackverify.py!!!!!!!!!!! GetCodeCoverage(args.verifier, args.outfile.name, args.timeLimit, args.unroll, args.debug, args.smackd, clangOutput) diff --git a/bin/smackverify.py b/bin/smackverify.py index 5d0433df8..6eb827210 100755 --- a/bin/smackverify.py +++ b/bin/smackverify.py @@ -118,9 +118,12 @@ def smackdOutput(corralOutput): print json_string def verify(verifier, bplFileName, timeLimit, unroll, debug, smackd): - if verifier == 'boogie-plain' or verifier == 'boogie-inline': + if verifier == 'boogie': # invoke Boogie - p = subprocess.Popen(['boogie', bplFileName, '/nologo', '/timeLimit:' + str(timeLimit), '/loopUnroll:' + str(unroll)], stdout=subprocess.PIPE) + boogieCommand = ['boogie', bplFileName, '/nologo', '/timeLimit:' + str(timeLimit)] + if unroll is not None: + boogieCommand += ['/loopUnroll:' + str(unroll)] + p = subprocess.Popen(boogieCommand, stdout=subprocess.PIPE) boogieOutput = p.communicate()[0] if p.returncode: return boogieOutput @@ -134,7 +137,10 @@ def verify(verifier, bplFileName, timeLimit, unroll, debug, smackd): return boogieOutput else: # invoke Corral - p = subprocess.Popen(['corral', bplFileName, '/recursionBound:' + str(unroll), '/tryCTrace'], stdout=subprocess.PIPE) + corralCommand = ['corral', bplFileName, '/tryCTrace'] + if unroll is not None: + corralCommand += ['/recursionBound:' + str(unroll)] + p = subprocess.Popen(corralCommand, stdout=subprocess.PIPE) corralOutput = p.communicate()[0] if p.returncode: return corralOutput diff --git a/examples/svcomp/locks/regtest-corral.py b/examples/svcomp/locks/regtest-corral.py index 56854f01e..d04f66de4 100755 --- a/examples/svcomp/locks/regtest-corral.py +++ b/examples/svcomp/locks/regtest-corral.py @@ -38,7 +38,7 @@ def runtests(): # invoke SMACK t0 = time.time() p = subprocess.Popen(['smackverify.py', test[0] + '.c', '--verifier=corral', - '--mem-mod=' + mem, '-o', test[0] +'.bpl'], + '--mem-mod=' + mem, '--unroll=2', '-o', test[0] +'.bpl'], stdout=subprocess.PIPE) smackOutput = p.communicate()[0] diff --git a/examples/svcomp/locks/regtest.py b/examples/svcomp/locks/regtest.py index bc4068a41..8df71d068 100755 --- a/examples/svcomp/locks/regtest.py +++ b/examples/svcomp/locks/regtest.py @@ -37,8 +37,8 @@ def runtests(): # invoke SMACK t0 = time.time() - p = subprocess.Popen(['smackverify.py', test[0] + '.c', '--verifier=boogie-inline', - '--mem-mod=' + mem, '-o', test[0] +'.bpl'], + p = subprocess.Popen(['smackverify.py', test[0] + '.c', '--verifier=boogie', + '--mem-mod=' + mem, '--unroll=2', '-o', test[0] +'.bpl'], stdout=subprocess.PIPE) smackOutput = p.communicate()[0] diff --git a/examples/svcomp/ntdrivers-simplified/regtest-corral.py b/examples/svcomp/ntdrivers-simplified/regtest-corral.py index a98f6ef70..ad05d387c 100755 --- a/examples/svcomp/ntdrivers-simplified/regtest-corral.py +++ b/examples/svcomp/ntdrivers-simplified/regtest-corral.py @@ -35,7 +35,7 @@ def runtests(): # invoke SMACK t0 = time.time() p = subprocess.Popen(['smackverify.py', test[0] + '.c', '--verifier=corral', - '--mem-mod=' + mem, '--clang=-w', '-o', test[0] +'.bpl'], + '--mem-mod=' + mem, '--unroll=2', '--clang=-w', '-o', test[0] +'.bpl'], stdout=subprocess.PIPE) smackOutput = p.communicate()[0] diff --git a/examples/svcomp/ntdrivers-simplified/regtest.py b/examples/svcomp/ntdrivers-simplified/regtest.py index 2f48da038..4573de395 100755 --- a/examples/svcomp/ntdrivers-simplified/regtest.py +++ b/examples/svcomp/ntdrivers-simplified/regtest.py @@ -34,8 +34,8 @@ def runtests(): # invoke SMACK t0 = time.time() - p = subprocess.Popen(['smackverify.py', test[0] + '.c', '--verifier=boogie-inline', - '--mem-mod=' + mem, '--clang=-w', '-o', test[0] +'.bpl'], + p = subprocess.Popen(['smackverify.py', test[0] + '.c', '--verifier=boogie', + '--mem-mod=' + mem, '--unroll=2', '--clang=-w', '-o', test[0] +'.bpl'], stdout=subprocess.PIPE) smackOutput = p.communicate()[0] diff --git a/examples/svcomp/ntdrivers/regtest-corral.py b/examples/svcomp/ntdrivers/regtest-corral.py index 181c2b579..eca2abfdc 100755 --- a/examples/svcomp/ntdrivers/regtest-corral.py +++ b/examples/svcomp/ntdrivers/regtest-corral.py @@ -34,7 +34,7 @@ def runtests(): # invoke SMACK t0 = time.time() p = subprocess.Popen(['smackverify.py', test[0] + '.c', '--verifier=corral', - '--mem-mod=' + mem, '--clang=-w', '-o', test[0] +'.bpl'], + '--mem-mod=' + mem, '--unroll=2', '--clang=-w', '-o', test[0] +'.bpl'], stdout=subprocess.PIPE) smackOutput = p.communicate()[0] diff --git a/examples/svcomp/ntdrivers/regtest.py b/examples/svcomp/ntdrivers/regtest.py index 6a0a53482..3e4cb735d 100755 --- a/examples/svcomp/ntdrivers/regtest.py +++ b/examples/svcomp/ntdrivers/regtest.py @@ -33,8 +33,8 @@ def runtests(): # invoke SMACK t0 = time.time() - p = subprocess.Popen(['smackverify.py', test[0] + '.c', '--verifier=boogie-inline', - '--mem-mod=' + mem, '--clang=-w', '-o', test[0] +'.bpl'], + p = subprocess.Popen(['smackverify.py', test[0] + '.c', '--verifier=boogie', + '--mem-mod=' + mem, '--unroll=2', '--clang=-w', '-o', test[0] +'.bpl'], stdout=subprocess.PIPE) smackOutput = p.communicate()[0] diff --git a/test/regtest.py b/test/regtest.py index 1b52b2020..603103aa4 100755 --- a/test/regtest.py +++ b/test/regtest.py @@ -104,7 +104,7 @@ def runtests(): # invoke SMACK t0 = time.time() - p = subprocess.Popen(['smackverify.py', test[0] + '.c', '--verifier=boogie-inline', + p = subprocess.Popen(['smackverify.py', test[0] + '.c', '--verifier=boogie', '--unroll=' + str(test[2]), '--mem-mod=' + mem, '-o', test[0] +'.bpl'], stdout=subprocess.PIPE) From e2478f85efb894438aadbaf107b203dcee90efd1 Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Sat, 9 Aug 2014 09:47:49 -0600 Subject: [PATCH 035/140] Added inline attribute to function definitions in our prelude. --- include/smack/smack.h | 41 ++++++++++++++++++----------------------- 1 file changed, 18 insertions(+), 23 deletions(-) diff --git a/include/smack/smack.h b/include/smack/smack.h index ef6509d66..ad825457e 100644 --- a/include/smack/smack.h +++ b/include/smack/smack.h @@ -63,9 +63,9 @@ void __SMACK_decls() { #define D(d) __SMACK_top_decl(d) // Integer arithmetic - D("function $add(p1:int, p2:int) returns (int) {p1 + p2}"); - D("function $sub(p1:int, p2:int) returns (int) {p1 - p2}"); - D("function $mul(p1:int, p2:int) returns (int) {p1 * p2}"); + D("function {:inline} $add(p1:int, p2:int) returns (int) {p1 + p2}"); + D("function {:inline} $sub(p1:int, p2:int) returns (int) {p1 - p2}"); + D("function {:inline} $mul(p1:int, p2:int) returns (int) {p1 * p2}"); D("function $sdiv(p1:int, p2:int) returns (int);"); D("function $udiv(p1:int, p2:int) returns (int);"); D("function $srem(p1:int, p2:int) returns (int);"); @@ -88,14 +88,14 @@ void __SMACK_decls() { D("function $lshr(p1:int, p2:int) returns (int);"); D("function $ashr(p1:int, p2:int) returns (int);"); D("function $shl(p1:int, p2:int) returns (int);"); - D("function $ult(p1:int, p2:int) returns (bool) {p1 < p2}"); - D("function $ugt(p1:int, p2:int) returns (bool) {p1 > p2}"); - D("function $ule(p1:int, p2:int) returns (bool) {p1 <= p2}"); - D("function $uge(p1:int, p2:int) returns (bool) {p1 >= p2}"); - D("function $slt(p1:int, p2:int) returns (bool) {p1 < p2}"); - D("function $sgt(p1:int, p2:int) returns (bool) {p1 > p2}"); - D("function $sle(p1:int, p2:int) returns (bool) {p1 <= p2}"); - D("function $sge(p1:int, p2:int) returns (bool) {p1 >= p2}"); + D("function {:inline} $ult(p1:int, p2:int) returns (bool) {p1 < p2}"); + D("function {:inline} $ugt(p1:int, p2:int) returns (bool) {p1 > p2}"); + D("function {:inline} $ule(p1:int, p2:int) returns (bool) {p1 <= p2}"); + D("function {:inline} $uge(p1:int, p2:int) returns (bool) {p1 >= p2}"); + D("function {:inline} $slt(p1:int, p2:int) returns (bool) {p1 < p2}"); + D("function {:inline} $sgt(p1:int, p2:int) returns (bool) {p1 > p2}"); + D("function {:inline} $sle(p1:int, p2:int) returns (bool) {p1 <= p2}"); + D("function {:inline} $sge(p1:int, p2:int) returns (bool) {p1 >= p2}"); D("function $nand(p1:int, p2:int) returns (int);"); D("function $max(p1:int, p2:int) returns (int);"); D("function $min(p1:int, p2:int) returns (int);"); @@ -138,30 +138,25 @@ void __SMACK_decls() { D("function $ui2fp(i:int) returns (float);"); // Memory Model - D("function $ptr(obj:int, off:int) returns (int) {obj + off}"); + D("function {:inline} $ptr(obj:int, off:int) returns (int) {obj + off}"); D("function $obj(int) returns (int);"); - D("function $off(ptr:int) returns (int) {ptr}"); + D("function {:inline} $off(ptr:int) returns (int) {ptr}"); D("const unique $NULL: int;"); D("axiom $NULL == 0;"); D("const $UNDEF: int;"); - D("function $pa(pointer: int, index: int, size: int) returns (int);"); - D("function $trunc(p: int, size: int) returns (int);"); - D("function $p2i(p: int) returns (int);"); - D("function $i2p(p: int) returns (int);"); + D("function {:inline} $pa(pointer: int, index: int, size: int) returns (int) {pointer + index * size}"); + D("function {:inline} $trunc(p: int, size: int) returns (int) {p}"); + D("function {:inline} $p2i(p: int) returns (int) {p}"); + D("function {:inline} $i2p(p: int) returns (int) {p}"); D("function $p2b(p: int) returns (bool);"); D("function $b2p(b: bool) returns (int);"); - D("axiom (forall p:int, i:int, s:int :: {$pa(p,i,s)} $pa(p,i,s) == p + i * s);"); - D("axiom (forall p,s:int :: $trunc(p,s) == p);"); - D("axiom $b2p(true) == 1;"); D("axiom $b2p(false) == 0;"); D("axiom (forall i:int :: $p2b(i) <==> i != 0);"); D("axiom $p2b(0) == false;"); - D("axiom (forall i:int :: $p2i(i) == i);"); - D("axiom (forall i:int :: $i2p(i) == i);"); // Memory debugging symbols D("type $mop;"); @@ -170,7 +165,7 @@ void __SMACK_decls() { D("const $MOP: $mop;"); D("const $GLOBALS_BOTTOM: int;"); - D("function $isExternal(p: int) returns (bool) { p < $GLOBALS_BOTTOM - 32768 }"); + D("function {:inline} $isExternal(p: int) returns (bool) { p < $GLOBALS_BOTTOM - 32768 }"); #if MEMORY_MODEL_NO_REUSE_IMPLS D("var $Alloc: [int] bool;"); From 654265650bb1b43aef67077c826758bb61553c9d Mon Sep 17 00:00:00 2001 From: Michael Emmi Date: Tue, 12 Aug 2014 11:17:06 -0400 Subject: [PATCH 036/140] Fixed logical and in contracts. --- lib/smack/Slicing.cpp | 20 ++++++++++++-------- test/contracts/and.c | 12 ++++++++++++ test/contracts/and_fail.c | 12 ++++++++++++ 3 files changed, 36 insertions(+), 8 deletions(-) create mode 100644 test/contracts/and.c create mode 100644 test/contracts/and_fail.c diff --git a/lib/smack/Slicing.cpp b/lib/smack/Slicing.cpp index c46ede694..53185aea1 100644 --- a/lib/smack/Slicing.cpp +++ b/lib/smack/Slicing.cpp @@ -84,8 +84,7 @@ namespace llvm { } } -NEXT: - (void)0; // no-op +NEXT: ; // no-op } return slice; @@ -114,10 +113,13 @@ namespace llvm { continue; if (BranchInst* Br = dyn_cast(I)) { - succ.insert(make_pair(Br->getParent(),Br->getSuccessor(0))); - if (Br->isConditional()) + if (Br->isConditional()) { if (Instruction* J = dyn_cast(Br->getCondition())) workList.push(J); + } else { + // TODO FIGURE THIS OUT & CLEAN IT UP + succ.insert(make_pair(Br->getParent(),Br->getSuccessor(0))); + } } else { for (User::op_iterator U = I->op_begin(); U != I->op_end(); ++U) if (Instruction* J = dyn_cast(U)) @@ -134,10 +136,12 @@ namespace llvm { I->eraseFromParent(); if (B->getInstList().size() == 0) { - BasicBlock* C = succ[B]; - assert(C && "Successor not found!"); - B->replaceAllUsesWith(C); - B->eraseFromParent(); + // TODO FIGURE THIS OUT & CLEAN IT UP + if (BasicBlock* C = succ[B]) { + // assert(C && "Successor not found!"); + B->replaceAllUsesWith(C); + B->eraseFromParent(); + } } } } diff --git a/test/contracts/and.c b/test/contracts/and.c new file mode 100644 index 000000000..f14f2b5cc --- /dev/null +++ b/test/contracts/and.c @@ -0,0 +1,12 @@ +#include +#include +#include "smack.h" + +// @expect 1 verified, 0 errors? + +int g; + +void p() { + ensures(g == 0 && g == 0); + g = 0; +} diff --git a/test/contracts/and_fail.c b/test/contracts/and_fail.c new file mode 100644 index 000000000..1d87d8f6f --- /dev/null +++ b/test/contracts/and_fail.c @@ -0,0 +1,12 @@ +#include +#include +#include "smack.h" + +// @expect 0 verified, 1 errors? + +int g; + +void p() { + ensures(g == 0 && g == 1); + g = 0; +} From bbb9c8080edde148d2f85dfe08b6419633cb5ae3 Mon Sep 17 00:00:00 2001 From: Michael Emmi Date: Tue, 12 Aug 2014 15:54:06 -0400 Subject: [PATCH 037/140] Better strategy for loop invariants. --- include/smack/SmackInstGenerator.h | 9 +++++--- lib/smack/Contracts.cpp | 37 +++++++++--------------------- lib/smack/SmackInstGenerator.cpp | 7 +----- lib/smack/SmackModuleGenerator.cpp | 7 ++++++ 4 files changed, 25 insertions(+), 35 deletions(-) diff --git a/include/smack/SmackInstGenerator.h b/include/smack/SmackInstGenerator.h index b7437fe54..8a9e01c5e 100644 --- a/include/smack/SmackInstGenerator.h +++ b/include/smack/SmackInstGenerator.h @@ -41,7 +41,12 @@ class SmackInstGenerator : public llvm::InstVisitor { void addMod(string x) { proc.addMod(x); } void addTopDecl(Decl* d) { proc.getProg().addDecl(d); } void addBlock(Block* b) { proc.addBlock(b); } - void emit(const Stmt* s) { currBlock->addStmt(s); } + void emit(const Stmt* s) { + // stringstream str; + // s->print(str); + // DEBUG(llvm::errs() << "emit: " << str.str() << "\n"); + currBlock->addStmt(s); + } public: SmackInstGenerator(SmackRep& R, CodeContainer& P, Naming& N, ExpressionList& E) @@ -62,8 +67,6 @@ class SmackInstGenerator : public llvm::InstVisitor { unordered_set slice = getSlice(I); - DEBUG(errs() << "SLICE OF SIZE " << slice.size() << "\n"); - for (Function::iterator B = F->begin(), E = F->end(); B != E; ++B) { if (!slice.count(B)) continue; diff --git a/lib/smack/Contracts.cpp b/lib/smack/Contracts.cpp index 24a862774..b89673ac5 100644 --- a/lib/smack/Contracts.cpp +++ b/lib/smack/Contracts.cpp @@ -52,38 +52,23 @@ void ContractsExtractor::visitCallInst(CallInst& ci) { } else if (f && naming.get(*f).find("invariant") != string::npos) { assert(ci.getNumArgOperands() == 1 && "Unexpected operands to invariant."); - Value* arg = ci.getArgOperand(0); + Value* V = ci.getArgOperand(0); Value* idx = expressionIdx(ci.getContext()); ci.setArgOperand(0,idx); - const Expr* e = sliceExpr(arg); - exprs.push_back(e); + exprs.push_back(sliceExpr(V)); BasicBlock* body = ci.getParent(); BasicBlock* head = body->getSinglePredecessor(); assert(head && "Expected single predecessor block."); - ArrayRef args(idx); - ArrayRef params(Type::getInt32Ty(ci.getContext())); - CallInst::Create( - Function::Create( - FunctionType::get(Type::getVoidTy(ci.getContext()),params,false), - GlobalValue::ExternalLinkage, "iassume"), - args,"",head->getTerminator()); - unsigned count = 0; - for (pred_iterator B = pred_begin(head), E = pred_end(head); B != E; ++B) { - CallInst::Create( - Function::Create( - FunctionType::get(Type::getVoidTy(ci.getContext()),params,false), - GlobalValue::ExternalLinkage, "iassert"), - args,"",(*B)->getTerminator()); - count++; - } - assert(count == 2 && "Expected head with two predecessors."); - count = 0; - for (succ_iterator B = succ_begin(head), E = succ_end(head); B != E; ++B) { - count++; - } - assert(count == 2 && "Expected head with two successors."); - ci.eraseFromParent(); + + ci.removeFromParent(); + + // NOTE Boogie only considers only assertions at the beginning of the loop + // head block to be loop invariants. Therefore we push this instruction to + // the front -- just after any Phi nodes. + BasicBlock::iterator I = head->begin(); + while (isa(I)) ++I; + head->getInstList().insert(I,&ci); } } diff --git a/lib/smack/SmackInstGenerator.cpp b/lib/smack/SmackInstGenerator.cpp index 7bc272bf0..c3812be80 100644 --- a/lib/smack/SmackInstGenerator.cpp +++ b/lib/smack/SmackInstGenerator.cpp @@ -72,7 +72,6 @@ void SmackInstGenerator::annotate(llvm::Instruction& i, Block* b) { void SmackInstGenerator::processInstruction(llvm::Instruction& inst) { DEBUG(errs() << "Inst: " << inst << "\n"); - DEBUG(errs() << "Inst name: " << inst.getName().str() << "\n"); annotate(inst, currBlock); ORIG(inst); nameInstruction(inst); @@ -497,14 +496,10 @@ void SmackInstGenerator::visitCallInst(llvm::CallInst& ci) { assert(ci.getNumArgOperands() == 2 && "Unexpected operands to forall."); emit(Stmt::assign(rep.expr(&ci),getExpression(ci.getArgOperand(1)))); - } else if (f && naming.get(*f).find("iassert") != string::npos) { + } else if (f && naming.get(*f).find("invariant") != string::npos) { assert(ci.getNumArgOperands() == 1 && "Unexpected operands to invariant."); emit(Stmt::assert_(getExpression(ci.getArgOperand(0)))); - } else if (f && naming.get(*f).find("iassume") != string::npos) { - assert(ci.getNumArgOperands() == 1 && "Unexpected operands to invariant."); - emit(Stmt::assume(getExpression(ci.getArgOperand(0)))); - } else if (f) { emit(rep.call(f, ci)); diff --git a/lib/smack/SmackModuleGenerator.cpp b/lib/smack/SmackModuleGenerator.cpp index e1f2206b0..789383a09 100644 --- a/lib/smack/SmackModuleGenerator.cpp +++ b/lib/smack/SmackModuleGenerator.cpp @@ -56,8 +56,15 @@ void SmackModuleGenerator::generateProgram(llvm::Module& m) { SmackInstGenerator igen(rep, *proc, naming, E); naming.enter(); + DEBUG(errs() << "Extracting contracts for " << naming.get(*func) << " from "); + DEBUG(errs() << *func << "\n"); ce.visit(func); + DEBUG(errs() << "\n"); + + DEBUG(errs() << "Generating body for " << naming.get(*func) << " from "); + DEBUG(errs() << *func << "\n"); igen.visit(func); + DEBUG(errs() << "\n"); naming.leave(); // First execute static initializers, in the main procedure. From c4679edaa12d43d91452e4ef80c2fcb2cc176c07 Mon Sep 17 00:00:00 2001 From: Michael Emmi Date: Tue, 12 Aug 2014 19:46:07 -0400 Subject: [PATCH 038/140] Contracts contained in Boogie functions. --- include/smack/BoogieAst.h | 1 + include/smack/Contracts.h | 3 +- include/smack/Slicing.h | 33 +++- include/smack/SmackInstGenerator.h | 50 +++--- lib/smack/BoogieAst.cpp | 13 +- lib/smack/Contracts.cpp | 22 +-- lib/smack/Slicing.cpp | 247 ++++++++++++++++++----------- 7 files changed, 231 insertions(+), 138 deletions(-) diff --git a/include/smack/BoogieAst.h b/include/smack/BoogieAst.h index 3a2d2b1d7..d4b53d8f7 100644 --- a/include/smack/BoogieAst.h +++ b/include/smack/BoogieAst.h @@ -29,6 +29,7 @@ class Expr { static const Expr* fn(string f, const Expr* x); static const Expr* fn(string f, const Expr* x, const Expr* y); static const Expr* fn(string f, const Expr* x, const Expr* y, const Expr* z); + static const Expr* fn(string f, vector args); static const Expr* id(string x); static const Expr* impl(const Expr* l, const Expr* r); static const Expr* lit(int i); diff --git a/include/smack/Contracts.h b/include/smack/Contracts.h index b1e41fb0b..6d93ce5fc 100644 --- a/include/smack/Contracts.h +++ b/include/smack/Contracts.h @@ -14,6 +14,7 @@ class ContractsExtractor : public InstVisitor { ProcDecl& proc; Naming& naming; ExpressionList& exprs; + static unsigned uniqueSliceId; public: ContractsExtractor(SmackRep& R, ProcDecl& P, Naming& N, ExpressionList& E) @@ -22,7 +23,7 @@ class ContractsExtractor : public InstVisitor { void visitCallInst(CallInst& ci); private: - Expr* sliceExpr(Value* v); + const Expr* sliceExpr(Value* v); Value* expressionIdx(LLVMContext& ctx) { return ConstantInt::get(Type::getInt32Ty(ctx),exprs.size()); diff --git a/include/smack/Slicing.h b/include/smack/Slicing.h index ce65ddb1c..5d52ece23 100644 --- a/include/smack/Slicing.h +++ b/include/smack/Slicing.h @@ -4,16 +4,43 @@ // This file is distributed under the MIT License. See LICENSE for details. // +#ifndef SLICING_H +#define SLICING_H + #include "llvm/InstVisitor.h" #include "llvm/Analysis/AliasAnalysis.h" +#include "smack/BoogieAst.h" +#include "smack/Naming.h" +#include "smack/SmackRep.h" #include using namespace std; +using namespace llvm; + +namespace smack { + +typedef vector ExpressionList; -namespace llvm { +class Slice { + string name; + Value& value; + BasicBlock& block; + Function& function; + LLVMContext& context; - unordered_set getSlice(Value* V); + unordered_set inputs; + unordered_set values; - void removeSlice(Value* V); +public: + Slice(string name, Instruction& I); + + void remove(); + + string getName(); + const Decl* getBoogieDecl(Naming& naming, SmackRep& rep, ExpressionList& exprs); + const Expr* getBoogieExpression(Naming& naming); +}; } + +#endif diff --git a/include/smack/SmackInstGenerator.h b/include/smack/SmackInstGenerator.h index 8a9e01c5e..ed03ad68d 100644 --- a/include/smack/SmackInstGenerator.h +++ b/include/smack/SmackInstGenerator.h @@ -61,32 +61,32 @@ class SmackInstGenerator : public llvm::InstVisitor { } assert(false && "Unexpected value."); } - - void visitSlice(llvm::Function* F, llvm::Instruction* I) { - using namespace llvm; - - unordered_set slice = getSlice(I); - - for (Function::iterator B = F->begin(), E = F->end(); B != E; ++B) { - if (!slice.count(B)) - continue; - visitBasicBlock(*B); - for (BasicBlock::iterator I = B->begin(), G = B->end(); I != G; ++I) { - if (!slice.count(&*I)) - continue; - visit(*I); - } - - if (I->getParent() == B) { - emit(Stmt::return_(rep.expr(I))); - - } else if (!slice.count(B->getTerminator())) { - emit(Stmt::assume(Expr::lit(false))); - emit(Stmt::goto_(getBlock(I->getParent())->getName())); - } - } - } + // void visitSlice(llvm::Function* F, llvm::Instruction* I) { + // using namespace llvm; + // + // unordered_set slice = getSlice(I); + // + // for (Function::iterator B = F->begin(), E = F->end(); B != E; ++B) { + // if (!slice.count(B)) + // continue; + // visitBasicBlock(*B); + // + // for (BasicBlock::iterator I = B->begin(), G = B->end(); I != G; ++I) { + // if (!slice.count(&*I)) + // continue; + // visit(*I); + // } + // + // if (I->getParent() == B) { + // emit(Stmt::return_(rep.expr(I))); + // + // } else if (!slice.count(B->getTerminator())) { + // emit(Stmt::assume(Expr::lit(false))); + // emit(Stmt::goto_(getBlock(I->getParent())->getName())); + // } + // } + // } void visitBasicBlock(llvm::BasicBlock& bb); void visitInstruction(llvm::Instruction& i); diff --git a/lib/smack/BoogieAst.cpp b/lib/smack/BoogieAst.cpp index 6b3dec429..539291327 100644 --- a/lib/smack/BoogieAst.cpp +++ b/lib/smack/BoogieAst.cpp @@ -41,6 +41,10 @@ const Expr* Expr::lt(const Expr* l, const Expr* r) { return new BinExpr(BinExpr::Lt, l, r); } +const Expr* Expr::fn(string f, vector args) { + return new FunExpr(f, args); +} + const Expr* Expr::fn(string f, const Expr* x) { return new FunExpr(f, vector(1, x)); } @@ -585,13 +589,18 @@ void ConstDecl::print(ostream& os) const { } void FuncDecl::print(ostream& os) const { - os << "function " << name; + os << "function "; if (attrs.size() > 0) print_seq(os, attrs, "", " ", " "); + os << name << "("; for (unsigned i = 0; i < params.size(); i++) os << params[i].first << ": " << params[i].second << (i < params.size() - 1 ? ", " : ""); - os << ": " << type << " { " << body << " };"; + os << ") returns (" << type << ")"; + if (body) + os << " { " << body << " }"; + else + os << ";"; } void VarDecl::print(ostream& os) const { diff --git a/lib/smack/Contracts.cpp b/lib/smack/Contracts.cpp index b89673ac5..769c4872a 100644 --- a/lib/smack/Contracts.cpp +++ b/lib/smack/Contracts.cpp @@ -1,20 +1,22 @@ #include "smack/Contracts.h" #include "llvm/Support/InstIterator.h" +using namespace llvm; + namespace smack { - using namespace llvm; -Expr* ContractsExtractor::sliceExpr(Value* V) { +unsigned ContractsExtractor::uniqueSliceId = 0; + +const Expr* ContractsExtractor::sliceExpr(Value* V) { Instruction* I = dyn_cast(V); assert(I && "Expected instruction."); - Function* F = I->getParent()->getParent(); - CodeExpr* code = new CodeExpr(rep.getProgram()); - SmackInstGenerator igen(rep, *code, naming, exprs); - naming.enter(); - igen.visitSlice(F,I); - naming.leave(); - removeSlice(I); - return code; + + stringstream name; + name << "$expr" << uniqueSliceId++; + Slice S(name.str(),*I); + rep.getProgram().addDecl((Decl*) S.getBoogieDecl(naming,rep,exprs)); + S.remove(); + return S.getBoogieExpression(naming); } void ContractsExtractor::visitCallInst(CallInst& ci) { diff --git a/lib/smack/Slicing.cpp b/lib/smack/Slicing.cpp index 53185aea1..197c22990 100644 --- a/lib/smack/Slicing.cpp +++ b/lib/smack/Slicing.cpp @@ -5,6 +5,7 @@ // #include "smack/Slicing.h" +#include "smack/SmackInstGenerator.h" #include "llvm/Transforms/Utils/BasicBlockUtils.h" #include "llvm/Analysis/CFG.h" #include "llvm/IR/Instructions.h" @@ -14,136 +15,188 @@ #include using namespace std; +using namespace llvm; -namespace llvm { +namespace smack { - typedef SmallVector< pair, 10 > EdgeList; +typedef SmallVector< pair, 10 > EdgeList; - bool contains(EdgeList& backedges, const BasicBlock* src, const BasicBlock* tgt) { - for (EdgeList::iterator E = backedges.begin(), End = backedges.end(); E != End; ++E) { - if (E->first == src && E->second == tgt) - return true; - } - return false; +bool contains(EdgeList& backedges, const BasicBlock* src, const BasicBlock* tgt) { + for (EdgeList::iterator E = backedges.begin(), End = backedges.end(); E != End; ++E) { + if (E->first == src && E->second == tgt) + return true; } + return false; +} - unordered_set getSlice(Value* V) { - unordered_set slice; - Instruction* I = dyn_cast(V); - assert(I && "Expected instruction value."); - - const BasicBlock* B = I->getParent(); - const Function* F = B->getParent(); - EdgeList backedges; - FindFunctionBackedges(*F,backedges); - - queue workList; - workList.push(I); - - while (!workList.empty()) { - Instruction* I = workList.front(); - workList.pop(); - if (slice.count(I)) - continue; - slice.insert(I); - slice.insert(I->getParent()); - - // ENSURE EACH BLOCK HAS A TERMINATOR - if (BranchInst* Br = dyn_cast(I->getParent()->getTerminator())) - if (I->getParent() != B) - workList.push(Br); - - if (BranchInst* Br = dyn_cast(I)) { - if (Br->isConditional()) { - if (Instruction* J = dyn_cast(Br->getCondition())) { - workList.push(J); - } - slice.insert(Br->getSuccessor(1)); +Slice::Slice(string name, Instruction& I) + : name(name), value(I), block(*I.getParent()), + function(*block.getParent()), context(function.getContext()) { + + EdgeList backedges; + FindFunctionBackedges(function,backedges); + + queue workList; + workList.push(&I); + + while (!workList.empty()) { + Instruction* I = workList.front(); + workList.pop(); + if (values.count(I)) + continue; + values.insert(I); + values.insert(I->getParent()); + + // ENSURE EACH BLOCK HAS A TERMINATOR + if (BranchInst* Br = dyn_cast(I->getParent()->getTerminator())) + if (I->getParent() != &block) + workList.push(Br); + + if (BranchInst* Br = dyn_cast(I)) { + if (Br->isConditional()) { + if (Instruction* J = dyn_cast(Br->getCondition())) { + workList.push(J); } - slice.insert(Br->getSuccessor(0)); - continue; + values.insert(Br->getSuccessor(1)); } + values.insert(Br->getSuccessor(0)); + continue; + } - if (PHINode* Phi = dyn_cast(I)) { - for (PHINode::block_iterator B = Phi->block_begin(); B != Phi->block_end(); ++B) { - if (contains(backedges,*B,I->getParent())) { - goto NEXT; - } + if (PHINode* Phi = dyn_cast(I)) { + for (PHINode::block_iterator B = Phi->block_begin(); B != Phi->block_end(); ++B) { + if (contains(backedges,*B,I->getParent())) { + goto NEXT; } + } - for (PHINode::block_iterator B = Phi->block_begin(); B != Phi->block_end(); ++B) { - workList.push( (*B)->getTerminator() ); - } + for (PHINode::block_iterator B = Phi->block_begin(); B != Phi->block_end(); ++B) { + workList.push( (*B)->getTerminator() ); } + } - for (User::op_iterator U = I->op_begin(); U != I->op_end(); ++U) { - if (Instruction* J = dyn_cast(U)) { - if (!contains(backedges,J->getParent(),I->getParent())) { - workList.push(J); - } + for (User::op_iterator U = I->op_begin(); U != I->op_end(); ++U) { + if (Instruction* J = dyn_cast(U)) { + if (!contains(backedges,J->getParent(),I->getParent())) { + workList.push(J); } } - -NEXT: ; // no-op } - return slice; +NEXT: ; // no-op } - void removeSlice(Value* V) { +} - Instruction* I = dyn_cast(V); - assert(I && "Expected instruction value."); +void Slice::remove() { + Instruction* I = dyn_cast(&value); + assert(I && "Expected instruction value."); - queue workList; - set covered; - map succ; + queue workList; + set covered; + map succ; - workList.push(I); + workList.push(I); - while (!workList.empty()) { - Instruction* I = workList.front(); - workList.pop(); - if (covered.count(I)) - continue; + while (!workList.empty()) { + Instruction* I = workList.front(); + workList.pop(); + if (covered.count(I)) + continue; - covered.insert(I); + covered.insert(I); - if (I->getNumUses() > 1) - continue; + if (I->getNumUses() > 1) + continue; - if (BranchInst* Br = dyn_cast(I)) { - if (Br->isConditional()) { - if (Instruction* J = dyn_cast(Br->getCondition())) - workList.push(J); - } else { - // TODO FIGURE THIS OUT & CLEAN IT UP - succ.insert(make_pair(Br->getParent(),Br->getSuccessor(0))); - } + if (BranchInst* Br = dyn_cast(I)) { + if (Br->isConditional()) { + if (Instruction* J = dyn_cast(Br->getCondition())) + workList.push(J); } else { - for (User::op_iterator U = I->op_begin(); U != I->op_end(); ++U) - if (Instruction* J = dyn_cast(U)) - workList.push(J); + // TODO FIGURE THIS OUT & CLEAN IT UP + succ.insert(make_pair(Br->getParent(),Br->getSuccessor(0))); } + } else { + for (User::op_iterator U = I->op_begin(); U != I->op_end(); ++U) + if (Instruction* J = dyn_cast(U)) + workList.push(J); + } - if (PHINode* Phi = dyn_cast(I)) { - for (PHINode::block_iterator A = Phi->block_begin(); A != Phi->block_end(); ++A) { - workList.push( (*A)->getTerminator() ); - } + if (PHINode* Phi = dyn_cast(I)) { + for (PHINode::block_iterator A = Phi->block_begin(); A != Phi->block_end(); ++A) { + workList.push( (*A)->getTerminator() ); } + } - BasicBlock* B = I->getParent(); - I->eraseFromParent(); + BasicBlock* B = I->getParent(); + I->eraseFromParent(); - if (B->getInstList().size() == 0) { - // TODO FIGURE THIS OUT & CLEAN IT UP - if (BasicBlock* C = succ[B]) { - // assert(C && "Successor not found!"); - B->replaceAllUsesWith(C); - B->eraseFromParent(); - } + if (B->getInstList().size() == 0) { + // TODO FIGURE THIS OUT & CLEAN IT UP + if (BasicBlock* C = succ[B]) { + // assert(C && "Successor not found!"); + B->replaceAllUsesWith(C); + B->eraseFromParent(); } } } +} + +string Slice::getName() { + return name; +} + +const Decl* Slice::getBoogieDecl(Naming& naming, SmackRep& rep, ExpressionList& exprs) { + vector< pair > params; + for (unordered_set::iterator V = inputs.begin(), E = inputs.end(); V != E; ++V) + params.push_back(make_pair(naming.get(**V), rep.type(*V))); + + CodeExpr* code = new CodeExpr(rep.getProgram()); + SmackInstGenerator igen(rep, *code, naming, exprs); + naming.enter(); + + // igen.visitSlice(function,value); + + for (Function::iterator B = function.begin(), E = function.end(); B != E; ++B) { + if (!values.count(B)) + continue; + igen.visitBasicBlock(*B); + + for (BasicBlock::iterator I = B->begin(), G = B->end(); I != G; ++I) { + if (!values.count(&*I)) + continue; + igen.visit(*I); + } + + if (B == block) { + // emit(Stmt::return_(rep.expr(I))); + Instruction* I = ReturnInst::Create(context,&value); + igen.visit(I); + delete I; + + } else if (!values.count(B->getTerminator())) { + // emit(Stmt::assume(Expr::lit(false))); + // emit(Stmt::goto_(getBlock(I->getParent())->getName())); + igen.visit(new UnreachableInst(context)); + Instruction* I = ReturnInst::Create(context,ConstantInt::getTrue(context)); + igen.visit(I); + delete I; + } + } + + naming.leave(); + + Decl* D = Decl::function(getName(),params,"bool",code); + D->addAttr(Attr::attr("inline")); + return D; +} + +const Expr* Slice::getBoogieExpression(Naming& naming) { + vector args; + for (unordered_set::iterator V = inputs.begin(), E = inputs.end(); V != E; ++V) + args.push_back(Expr::id(naming.get(**V))); + return Expr::fn(getName(),args); +} } From 878ad9e7544c623568fbeeaad1cab1414a55df2b Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Tue, 12 Aug 2014 19:09:09 -0500 Subject: [PATCH 039/140] Set default verifier to Boogie after all. --- bin/smackgen.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/smackgen.py b/bin/smackgen.py index 57c2dcaae..8c8beab87 100755 --- a/bin/smackgen.py +++ b/bin/smackgen.py @@ -14,7 +14,7 @@ def smackParser(): parser = argparse.ArgumentParser(add_help=False, parents=[llvm2bplParser()]) parser.add_argument('--clang', dest='clang', default='', help='pass arguments to clang (e.g., --clang="-w -g")') - parser.add_argument('--verifier', dest='verifier', choices=['boogie', 'corral'], default='corral', + parser.add_argument('--verifier', dest='verifier', choices=['boogie', 'corral'], default='boogie', help='set the underlying verifier format') parser.add_argument('--entry-points', metavar='PROC', dest='entryPoints', default='main', nargs='+', help='specify entry procedures') From af01b2d1bfb692bc0549955042a610a33ae2596a Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Tue, 12 Aug 2014 19:54:26 -0500 Subject: [PATCH 040/140] Added more inline attributes to prelude functions. Implemented max and min. --- include/smack/smack.h | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/include/smack/smack.h b/include/smack/smack.h index ad825457e..d535eecf8 100644 --- a/include/smack/smack.h +++ b/include/smack/smack.h @@ -97,16 +97,12 @@ void __SMACK_decls() { D("function {:inline} $sle(p1:int, p2:int) returns (bool) {p1 <= p2}"); D("function {:inline} $sge(p1:int, p2:int) returns (bool) {p1 >= p2}"); D("function $nand(p1:int, p2:int) returns (int);"); - D("function $max(p1:int, p2:int) returns (int);"); - D("function $min(p1:int, p2:int) returns (int);"); - D("function $umax(p1:int, p2:int) returns (int);"); - D("function $umin(p1:int, p2:int) returns (int);"); - D("function $i2b(i: int) returns (bool);"); - D("axiom (forall i:int :: $i2b(i) <==> i != 0);"); - D("axiom $i2b(0) == false;"); - D("function $b2i(b: bool) returns (int);"); - D("axiom $b2i(true) == 1;"); - D("axiom $b2i(false) == 0;"); + D("function {:inline} $max(p1:int, p2:int) returns (int) {if p1 > p2 then p1 else p2}"); + D("function {:inline} $min(p1:int, p2:int) returns (int) {if p1 > p2 then p2 else p1}"); + D("function {:inline} $umax(p1:int, p2:int) returns (int) {if p1 > p2 then p1 else p2}"); + D("function {:inline} $umin(p1:int, p2:int) returns (int) {if p1 > p2 then p2 else p1}"); + D("function {:inline} $i2b(i: int) returns (bool) {i != 0}"); + D("function {:inline} $b2i(b: bool) returns (int) {if b then 1 else 0}"); // Floating point D("type float;"); @@ -150,13 +146,8 @@ void __SMACK_decls() { D("function {:inline} $trunc(p: int, size: int) returns (int) {p}"); D("function {:inline} $p2i(p: int) returns (int) {p}"); D("function {:inline} $i2p(p: int) returns (int) {p}"); - D("function $p2b(p: int) returns (bool);"); - D("function $b2p(b: bool) returns (int);"); - - D("axiom $b2p(true) == 1;"); - D("axiom $b2p(false) == 0;"); - D("axiom (forall i:int :: $p2b(i) <==> i != 0);"); - D("axiom $p2b(0) == false;"); + D("function {:inline} $p2b(p: int) returns (bool) {p != 0}"); + D("function {:inline} $b2p(b: bool) returns (int) {if b then 1 else 0}"); // Memory debugging symbols D("type $mop;"); From 9a7c05f0244e90261e0483591ac400cfcbd5713a Mon Sep 17 00:00:00 2001 From: Michael Emmi Date: Tue, 12 Aug 2014 23:51:30 -0400 Subject: [PATCH 041/140] Inputs for extracted expressions. --- include/smack/Slicing.h | 2 +- include/smack/SmackInstGenerator.h | 28 +-------- lib/smack/Contracts.cpp | 2 +- lib/smack/Slicing.cpp | 92 +++++++++++++++++++++--------- test/contracts/invariant.c | 2 +- test/contracts/invariant_fail.c | 2 +- 6 files changed, 71 insertions(+), 57 deletions(-) diff --git a/include/smack/Slicing.h b/include/smack/Slicing.h index 5d52ece23..ce9737e6c 100644 --- a/include/smack/Slicing.h +++ b/include/smack/Slicing.h @@ -38,7 +38,7 @@ class Slice { string getName(); const Decl* getBoogieDecl(Naming& naming, SmackRep& rep, ExpressionList& exprs); - const Expr* getBoogieExpression(Naming& naming); + const Expr* getBoogieExpression(Naming& naming, SmackRep& rep); }; } diff --git a/include/smack/SmackInstGenerator.h b/include/smack/SmackInstGenerator.h index ed03ad68d..802e82166 100644 --- a/include/smack/SmackInstGenerator.h +++ b/include/smack/SmackInstGenerator.h @@ -41,6 +41,8 @@ class SmackInstGenerator : public llvm::InstVisitor { void addMod(string x) { proc.addMod(x); } void addTopDecl(Decl* d) { proc.getProg().addDecl(d); } void addBlock(Block* b) { proc.addBlock(b); } + +public: void emit(const Stmt* s) { // stringstream str; // s->print(str); @@ -62,32 +64,6 @@ class SmackInstGenerator : public llvm::InstVisitor { assert(false && "Unexpected value."); } - // void visitSlice(llvm::Function* F, llvm::Instruction* I) { - // using namespace llvm; - // - // unordered_set slice = getSlice(I); - // - // for (Function::iterator B = F->begin(), E = F->end(); B != E; ++B) { - // if (!slice.count(B)) - // continue; - // visitBasicBlock(*B); - // - // for (BasicBlock::iterator I = B->begin(), G = B->end(); I != G; ++I) { - // if (!slice.count(&*I)) - // continue; - // visit(*I); - // } - // - // if (I->getParent() == B) { - // emit(Stmt::return_(rep.expr(I))); - // - // } else if (!slice.count(B->getTerminator())) { - // emit(Stmt::assume(Expr::lit(false))); - // emit(Stmt::goto_(getBlock(I->getParent())->getName())); - // } - // } - // } - void visitBasicBlock(llvm::BasicBlock& bb); void visitInstruction(llvm::Instruction& i); diff --git a/lib/smack/Contracts.cpp b/lib/smack/Contracts.cpp index 769c4872a..f44c373f2 100644 --- a/lib/smack/Contracts.cpp +++ b/lib/smack/Contracts.cpp @@ -16,7 +16,7 @@ const Expr* ContractsExtractor::sliceExpr(Value* V) { Slice S(name.str(),*I); rep.getProgram().addDecl((Decl*) S.getBoogieDecl(naming,rep,exprs)); S.remove(); - return S.getBoogieExpression(naming); + return S.getBoogieExpression(naming,rep); } void ContractsExtractor::visitCallInst(CallInst& ci) { diff --git a/lib/smack/Slicing.cpp b/lib/smack/Slicing.cpp index 197c22990..f6306ff95 100644 --- a/lib/smack/Slicing.cpp +++ b/lib/smack/Slicing.cpp @@ -29,12 +29,33 @@ bool contains(EdgeList& backedges, const BasicBlock* src, const BasicBlock* tgt) return false; } +bool hasIncomingBackEdge(PHINode* Phi, EdgeList& backedges) { + for (PHINode::block_iterator B = Phi->block_begin(); B != Phi->block_end(); ++B) { + if (contains(backedges,*B,Phi->getParent())) + return true; + } + return false; +} + +GlobalValue* usedGlobal(User* U) { + GlobalValue* G = 0; + for (User::op_iterator V = U->op_begin(), E = U->op_end(); V != E; ++V) { + if (dyn_cast(V)) + continue; + if ((G = dyn_cast(V))) + break; + if ((U = dyn_cast(V)) && (G = usedGlobal(U))) + break; + } + return G; +} + Slice::Slice(string name, Instruction& I) : name(name), value(I), block(*I.getParent()), function(*block.getParent()), context(function.getContext()) { EdgeList backedges; - FindFunctionBackedges(function,backedges); + FindFunctionBackedges(function, backedges); queue workList; workList.push(&I); @@ -42,8 +63,16 @@ Slice::Slice(string name, Instruction& I) while (!workList.empty()) { Instruction* I = workList.front(); workList.pop(); - if (values.count(I)) + if (values.count(I) || inputs.count(I)) continue; + + if (PHINode* Phi = dyn_cast(I)) { + if (hasIncomingBackEdge(Phi, backedges)) { + inputs.insert(I); + continue; + } + } + values.insert(I); values.insert(I->getParent()); @@ -64,12 +93,6 @@ Slice::Slice(string name, Instruction& I) } if (PHINode* Phi = dyn_cast(I)) { - for (PHINode::block_iterator B = Phi->block_begin(); B != Phi->block_end(); ++B) { - if (contains(backedges,*B,I->getParent())) { - goto NEXT; - } - } - for (PHINode::block_iterator B = Phi->block_begin(); B != Phi->block_end(); ++B) { workList.push( (*B)->getTerminator() ); } @@ -83,7 +106,8 @@ Slice::Slice(string name, Instruction& I) } } -NEXT: ; // no-op + if (GlobalValue* G = usedGlobal(I)) + inputs.insert(G); } } @@ -149,14 +173,27 @@ string Slice::getName() { const Decl* Slice::getBoogieDecl(Naming& naming, SmackRep& rep, ExpressionList& exprs) { vector< pair > params; - for (unordered_set::iterator V = inputs.begin(), E = inputs.end(); V != E; ++V) - params.push_back(make_pair(naming.get(**V), rep.type(*V))); - CodeExpr* code = new CodeExpr(rep.getProgram()); - SmackInstGenerator igen(rep, *code, naming, exprs); naming.enter(); - // igen.visitSlice(function,value); + for (unordered_set::iterator V = inputs.begin(), E = inputs.end(); V != E; ++V) { + string param, type; + + if (GlobalVariable* G = dyn_cast(*V)) { + param = rep.memReg(rep.getRegion(G)); + type = "[int] int"; + } else if ((*V)->hasName() && (*V)->getName().find("result") != string::npos) { + param = Naming::RET_VAR; + type = rep.type(*V); + } else { + param = naming.get(**V); + type = rep.type(*V); + } + params.push_back(make_pair(param, type)); + } + + CodeExpr* code = new CodeExpr(rep.getProgram()); + SmackInstGenerator igen(rep, *code, naming, exprs); for (Function::iterator B = function.begin(), E = function.end(); B != E; ++B) { if (!values.count(B)) @@ -170,18 +207,11 @@ const Decl* Slice::getBoogieDecl(Naming& naming, SmackRep& rep, ExpressionList& } if (B == block) { - // emit(Stmt::return_(rep.expr(I))); - Instruction* I = ReturnInst::Create(context,&value); - igen.visit(I); - delete I; + igen.emit(Stmt::return_(rep.expr(&value))); } else if (!values.count(B->getTerminator())) { - // emit(Stmt::assume(Expr::lit(false))); - // emit(Stmt::goto_(getBlock(I->getParent())->getName())); - igen.visit(new UnreachableInst(context)); - Instruction* I = ReturnInst::Create(context,ConstantInt::getTrue(context)); - igen.visit(I); - delete I; + igen.emit(Stmt::assume(Expr::lit(false))); + igen.emit(Stmt::return_(Expr::lit(true))); } } @@ -192,10 +222,18 @@ const Decl* Slice::getBoogieDecl(Naming& naming, SmackRep& rep, ExpressionList& return D; } -const Expr* Slice::getBoogieExpression(Naming& naming) { +const Expr* Slice::getBoogieExpression(Naming& naming, SmackRep& rep) { vector args; - for (unordered_set::iterator V = inputs.begin(), E = inputs.end(); V != E; ++V) - args.push_back(Expr::id(naming.get(**V))); + for (unordered_set::iterator V = inputs.begin(), E = inputs.end(); V != E; ++V) { + string arg; + if (GlobalVariable* G = dyn_cast(*V)) + arg = rep.memReg(rep.getRegion(G)); + else if ((*V)->hasName() && (*V)->getName().find("result") != string::npos) + arg = Naming::RET_VAR; + else + arg = naming.get(**V); + args.push_back(Expr::id(arg)); + } return Expr::fn(getName(),args); } diff --git a/test/contracts/invariant.c b/test/contracts/invariant.c index 304af6f8f..6a9f50b20 100644 --- a/test/contracts/invariant.c +++ b/test/contracts/invariant.c @@ -9,7 +9,7 @@ int g[10]; int main(void) { for (int i=0; i<4; i++) { - invariant(i < 4); + invariant(i <= 4); g[i] = i; } diff --git a/test/contracts/invariant_fail.c b/test/contracts/invariant_fail.c index 5efaeeb3a..44a42b021 100644 --- a/test/contracts/invariant_fail.c +++ b/test/contracts/invariant_fail.c @@ -9,7 +9,7 @@ int g[10]; int main(void) { for (int i=0; i<4; i++) { - invariant(i < 3); + invariant(i < 4); g[i] = i; } From 7b81d19d0cce40bdbe33604ceb67d96b7dcc2ef2 Mon Sep 17 00:00:00 2001 From: Michael Emmi Date: Wed, 13 Aug 2014 11:10:15 -0400 Subject: [PATCH 042/140] Inputs for quantified variables and subslices. --- include/smack/Contracts.h | 12 +-- include/smack/Slicing.h | 11 ++- include/smack/SmackInstGenerator.h | 14 ++-- lib/smack/Contracts.cpp | 32 ++++---- lib/smack/Slicing.cpp | 121 +++++++++++++++++++---------- lib/smack/SmackInstGenerator.cpp | 17 +++- lib/smack/SmackModuleGenerator.cpp | 6 +- 7 files changed, 132 insertions(+), 81 deletions(-) diff --git a/include/smack/Contracts.h b/include/smack/Contracts.h index 6d93ce5fc..cc84d2e67 100644 --- a/include/smack/Contracts.h +++ b/include/smack/Contracts.h @@ -13,20 +13,20 @@ class ContractsExtractor : public InstVisitor { SmackRep& rep; ProcDecl& proc; Naming& naming; - ExpressionList& exprs; + Slices& slices; static unsigned uniqueSliceId; public: - ContractsExtractor(SmackRep& R, ProcDecl& P, Naming& N, ExpressionList& E) - : rep(R), proc(P), naming(N), exprs(E) {} + ContractsExtractor(SmackRep& R, ProcDecl& P, Naming& N, Slices& S) + : rep(R), proc(P), naming(N), slices(S) {} void visitCallInst(CallInst& ci); private: - const Expr* sliceExpr(Value* v); + Slice* extractSlice(Value* v); - Value* expressionIdx(LLVMContext& ctx) { - return ConstantInt::get(Type::getInt32Ty(ctx),exprs.size()); + Value* sliceIdx(LLVMContext& ctx) { + return ConstantInt::get(Type::getInt32Ty(ctx),slices.size()); } }; diff --git a/include/smack/Slicing.h b/include/smack/Slicing.h index ce9737e6c..58f8d3ef5 100644 --- a/include/smack/Slicing.h +++ b/include/smack/Slicing.h @@ -19,25 +19,28 @@ using namespace llvm; namespace smack { -typedef vector ExpressionList; +class Slice; +typedef vector Slices; class Slice { - string name; Value& value; BasicBlock& block; Function& function; LLVMContext& context; + Slices& slices; + string name; unordered_set inputs; unordered_set values; public: - Slice(string name, Instruction& I); + Slice(Instruction& I, Slices& S, string name = ""); void remove(); string getName(); - const Decl* getBoogieDecl(Naming& naming, SmackRep& rep, ExpressionList& exprs); + const Expr* getCode(Naming& naming, SmackRep& rep); + const Decl* getBoogieDecl(Naming& naming, SmackRep& rep); const Expr* getBoogieExpression(Naming& naming, SmackRep& rep); }; diff --git a/include/smack/SmackInstGenerator.h b/include/smack/SmackInstGenerator.h index 802e82166..4a62eb475 100644 --- a/include/smack/SmackInstGenerator.h +++ b/include/smack/SmackInstGenerator.h @@ -14,7 +14,7 @@ namespace smack { -typedef vector ExpressionList; +typedef vector Slices; class SmackInstGenerator : public llvm::InstVisitor { @@ -22,7 +22,7 @@ class SmackInstGenerator : public llvm::InstVisitor { SmackRep& rep; CodeContainer& proc; Naming& naming; - ExpressionList& exprs; + Slices& slices; Block* currBlock; map blockMap; @@ -51,15 +51,15 @@ class SmackInstGenerator : public llvm::InstVisitor { } public: - SmackInstGenerator(SmackRep& R, CodeContainer& P, Naming& N, ExpressionList& E) - : rep(R), proc(P), naming(N), exprs(E) {} + SmackInstGenerator(SmackRep& R, CodeContainer& P, Naming& N, Slices& S) + : rep(R), proc(P), naming(N), slices(S) {} - const Expr* getExpression(llvm::Value* V) { + Slice* getSlice(llvm::Value* V) { using namespace llvm; if (ConstantInt* CI = dyn_cast(V)) { uint64_t i = CI->getLimitedValue(); - assert(exprs.size() > i && "Did not find expression."); - return exprs[i]; + assert(slices.size() > i && "Did not find expression."); + return slices[i]; } assert(false && "Unexpected value."); } diff --git a/lib/smack/Contracts.cpp b/lib/smack/Contracts.cpp index f44c373f2..bfae16de6 100644 --- a/lib/smack/Contracts.cpp +++ b/lib/smack/Contracts.cpp @@ -7,16 +7,17 @@ namespace smack { unsigned ContractsExtractor::uniqueSliceId = 0; -const Expr* ContractsExtractor::sliceExpr(Value* V) { +Slice* ContractsExtractor::extractSlice(Value* V) { Instruction* I = dyn_cast(V); assert(I && "Expected instruction."); stringstream name; name << "$expr" << uniqueSliceId++; - Slice S(name.str(),*I); - rep.getProgram().addDecl((Decl*) S.getBoogieDecl(naming,rep,exprs)); - S.remove(); - return S.getBoogieExpression(naming,rep); + Slice* S = new Slice(*I, slices, name.str()); + if (Decl* D = (Decl*) S->getBoogieDecl(naming,rep)) + rep.getProgram().addDecl(D); + S->remove(); + return S; } void ContractsExtractor::visitCallInst(CallInst& ci) { @@ -24,40 +25,35 @@ void ContractsExtractor::visitCallInst(CallInst& ci) { if (f && naming.get(*f).find("forall") != string::npos) { assert(ci.getNumArgOperands() == 2 && "Unexpected operands to forall."); - Value* var = ci.getArgOperand(0); Value* arg = ci.getArgOperand(1); - ci.setArgOperand(1,expressionIdx(ci.getContext())); - const Expr* e = Expr::forall(rep.getString(var), "int", sliceExpr(arg)); - exprs.push_back(e); + ci.setArgOperand(1,sliceIdx(ci.getContext())); + slices.push_back(extractSlice(arg)); } else if (f && naming.get(*f).find("exists") != string::npos) { assert(ci.getNumArgOperands() == 2 && "Unexpected operands to exists."); - Value* var = ci.getArgOperand(0); Value* arg = ci.getArgOperand(1); - ci.setArgOperand(1,expressionIdx(ci.getContext())); - const Expr* e = Expr::exists(rep.getString(var), "int", sliceExpr(arg)); - exprs.push_back(e); + ci.setArgOperand(1,sliceIdx(ci.getContext())); + slices.push_back(extractSlice(arg)); } else if (f && naming.get(*f).find("requires") != string::npos) { assert(ci.getNumArgOperands() == 1 && "Unexpected operands to requires."); Value* V = ci.getArgOperand(0); ci.setArgOperand(0,ConstantInt::getTrue(ci.getContext())); - proc.addRequires(sliceExpr(V)); + proc.addRequires(extractSlice(V)->getBoogieExpression(naming,rep)); ci.eraseFromParent(); } else if (f && naming.get(*f).find("ensures") != string::npos) { assert(ci.getNumArgOperands() == 1 && "Unexpected operands to ensures."); Value* V = ci.getArgOperand(0); ci.setArgOperand(0,ConstantInt::getTrue(ci.getContext())); - proc.addEnsures(sliceExpr(V)); + proc.addEnsures(extractSlice(V)->getBoogieExpression(naming,rep)); ci.eraseFromParent(); } else if (f && naming.get(*f).find("invariant") != string::npos) { assert(ci.getNumArgOperands() == 1 && "Unexpected operands to invariant."); Value* V = ci.getArgOperand(0); - Value* idx = expressionIdx(ci.getContext()); - ci.setArgOperand(0,idx); - exprs.push_back(sliceExpr(V)); + ci.setArgOperand(0,sliceIdx(ci.getContext())); + slices.push_back(extractSlice(V)); BasicBlock* body = ci.getParent(); BasicBlock* head = body->getSinglePredecessor(); diff --git a/lib/smack/Slicing.cpp b/lib/smack/Slicing.cpp index f6306ff95..9e8eed032 100644 --- a/lib/smack/Slicing.cpp +++ b/lib/smack/Slicing.cpp @@ -37,6 +37,18 @@ bool hasIncomingBackEdge(PHINode* Phi, EdgeList& backedges) { return false; } +Value* getQuantifiedVariable(Instruction* I) { + if (CallInst* CI = dyn_cast(I)) + if (Function* F = CI->getCalledFunction()) + if (F->hasName() && F->getName().find("qvar") != string::npos) + if (ConstantExpr* CE = dyn_cast(CI->getArgOperand(0))) + if (CE->getOpcode() == Instruction::GetElementPtr) + if (GlobalValue* G = dyn_cast(CE->getOperand(0))) + if (ConstantDataSequential* S = dyn_cast(G->getOperand(0))) + return S; + return 0; +} + GlobalValue* usedGlobal(User* U) { GlobalValue* G = 0; for (User::op_iterator V = U->op_begin(), E = U->op_end(); V != E; ++V) { @@ -50,9 +62,39 @@ GlobalValue* usedGlobal(User* U) { return G; } -Slice::Slice(string name, Instruction& I) - : name(name), value(I), block(*I.getParent()), - function(*block.getParent()), context(function.getContext()) { +Slice* getSubslice(Instruction* I, Slices& slices) { + if (CallInst* CI = dyn_cast(I)) + if (Function* F = CI->getCalledFunction()) + if (F->hasName()) + if (F->getName().find("forall") != string::npos || + F->getName().find("exists") != string::npos) + if (ConstantInt* C = dyn_cast(CI->getArgOperand(1))) { + uint64_t i = C->getLimitedValue(); + assert(slices.size() > i && "Did not find expression."); + return slices[i]; + } + + return 0; +} + +pair getParameter(Value* V, Naming& naming, SmackRep& rep) { + + if (GlobalVariable* G = dyn_cast(V)) + return make_pair(rep.memReg(rep.getRegion(G)), "[int] int"); + + else if (ConstantDataSequential* S = dyn_cast(V)) + return make_pair(S->getAsCString(), "int"); + + else if (V->hasName() && V->getName().find("result") != string::npos) + return make_pair(Naming::RET_VAR, rep.type(V)); + + else + return make_pair(naming.get(*V), rep.type(V)); +} + +Slice::Slice(Instruction& I, Slices& S, string name) + : value(I), block(*I.getParent()), function(*block.getParent()), + context(function.getContext()), slices(S), name(name) { EdgeList backedges; FindFunctionBackedges(function, backedges); @@ -73,6 +115,19 @@ Slice::Slice(string name, Instruction& I) } } + if (GlobalValue* G = usedGlobal(I)) + inputs.insert(G); + + if (Value* Q = getQuantifiedVariable(I)) + inputs.insert(Q); + + // Add inputs from any subslices, excluding quantified variables + if (Slice* S = getSubslice(I,slices)) + for (unordered_set::iterator V = S->inputs.begin(), + E = S->inputs.end(); V != E; ++V) + if (!inputs.count(*V) && !dyn_cast(*V)) + inputs.insert(*V); + values.insert(I); values.insert(I->getParent()); @@ -105,9 +160,6 @@ Slice::Slice(string name, Instruction& I) } } } - - if (GlobalValue* G = usedGlobal(I)) - inputs.insert(G); } } @@ -171,29 +223,9 @@ string Slice::getName() { return name; } -const Decl* Slice::getBoogieDecl(Naming& naming, SmackRep& rep, ExpressionList& exprs) { - vector< pair > params; - - naming.enter(); - - for (unordered_set::iterator V = inputs.begin(), E = inputs.end(); V != E; ++V) { - string param, type; - - if (GlobalVariable* G = dyn_cast(*V)) { - param = rep.memReg(rep.getRegion(G)); - type = "[int] int"; - } else if ((*V)->hasName() && (*V)->getName().find("result") != string::npos) { - param = Naming::RET_VAR; - type = rep.type(*V); - } else { - param = naming.get(**V); - type = rep.type(*V); - } - params.push_back(make_pair(param, type)); - } - +const Expr* Slice::getCode(Naming& naming, SmackRep& rep) { CodeExpr* code = new CodeExpr(rep.getProgram()); - SmackInstGenerator igen(rep, *code, naming, exprs); + SmackInstGenerator igen(rep, *code, naming, slices); for (Function::iterator B = function.begin(), E = function.end(); B != E; ++B) { if (!values.count(B)) @@ -214,26 +246,33 @@ const Decl* Slice::getBoogieDecl(Naming& naming, SmackRep& rep, ExpressionList& igen.emit(Stmt::return_(Expr::lit(true))); } } + return code; +} - naming.leave(); - - Decl* D = Decl::function(getName(),params,"bool",code); +const Decl* Slice::getBoogieDecl(Naming& naming, SmackRep& rep) { + if (name == "") + return 0; + naming.enter(); + vector< pair > params; + for (unordered_set::iterator V = inputs.begin(), E = inputs.end(); V != E; ++V) + params.push_back(getParameter(*V,naming,rep)); + Decl* D = Decl::function(getName(),params,"bool",getCode(naming,rep)); D->addAttr(Attr::attr("inline")); + naming.leave(); return D; } const Expr* Slice::getBoogieExpression(Naming& naming, SmackRep& rep) { - vector args; - for (unordered_set::iterator V = inputs.begin(), E = inputs.end(); V != E; ++V) { - string arg; - if (GlobalVariable* G = dyn_cast(*V)) - arg = rep.memReg(rep.getRegion(G)); - else if ((*V)->hasName() && (*V)->getName().find("result") != string::npos) - arg = Naming::RET_VAR; - else - arg = naming.get(**V); - args.push_back(Expr::id(arg)); + if (name == "") { + naming.enter(); + const Expr* code = getCode(naming,rep); + naming.leave(); + return code; } + + vector args; + for (unordered_set::iterator V = inputs.begin(), E = inputs.end(); V != E; ++V) + args.push_back(Expr::id(getParameter(*V,naming,rep).first)); return Expr::fn(getName(),args); } diff --git a/lib/smack/SmackInstGenerator.cpp b/lib/smack/SmackInstGenerator.cpp index c3812be80..9490fd29f 100644 --- a/lib/smack/SmackInstGenerator.cpp +++ b/lib/smack/SmackInstGenerator.cpp @@ -494,11 +494,24 @@ void SmackInstGenerator::visitCallInst(llvm::CallInst& ci) { } else if (f && naming.get(*f).find("forall") != string::npos) { assert(ci.getNumArgOperands() == 2 && "Unexpected operands to forall."); - emit(Stmt::assign(rep.expr(&ci),getExpression(ci.getArgOperand(1)))); + Value* var = ci.getArgOperand(0); + Value* arg = ci.getArgOperand(1); + Slice* S = getSlice(arg); + emit(Stmt::assign(rep.expr(&ci), + Expr::forall(rep.getString(var), "int", S->getBoogieExpression(naming,rep)))); + + } else if (f && naming.get(*f).find("exists") != string::npos) { + assert(ci.getNumArgOperands() == 2 && "Unexpected operands to forall."); + Value* var = ci.getArgOperand(0); + Value* arg = ci.getArgOperand(1); + Slice* S = getSlice(arg); + emit(Stmt::assign(rep.expr(&ci), + Expr::exists(rep.getString(var), "int", S->getBoogieExpression(naming,rep)))); } else if (f && naming.get(*f).find("invariant") != string::npos) { assert(ci.getNumArgOperands() == 1 && "Unexpected operands to invariant."); - emit(Stmt::assert_(getExpression(ci.getArgOperand(0)))); + Slice* S = getSlice(ci.getArgOperand(0)); + emit(Stmt::assert_(S->getBoogieExpression(naming,rep))); } else if (f) { emit(rep.call(f, ci)); diff --git a/lib/smack/SmackModuleGenerator.cpp b/lib/smack/SmackModuleGenerator.cpp index 789383a09..12348bf74 100644 --- a/lib/smack/SmackModuleGenerator.cpp +++ b/lib/smack/SmackModuleGenerator.cpp @@ -51,9 +51,9 @@ void SmackModuleGenerator::generateProgram(llvm::Module& m) { DEBUG(errs() << "Analyzing function: " << naming.get(*func) << "\n"); - ExpressionList E; - ContractsExtractor ce(rep, *proc, naming, E); - SmackInstGenerator igen(rep, *proc, naming, E); + Slices slices; + ContractsExtractor ce(rep, *proc, naming, slices); + SmackInstGenerator igen(rep, *proc, naming, slices); naming.enter(); DEBUG(errs() << "Extracting contracts for " << naming.get(*func) << " from "); From de85a587649f1171108203e2701e5af162c128fb Mon Sep 17 00:00:00 2001 From: Michael Emmi Date: Wed, 13 Aug 2014 13:45:37 -0400 Subject: [PATCH 043/140] More reliable slice removal. --- include/smack/Naming.h | 1 + include/smack/SmackRep.h | 3 -- lib/smack/Contracts.cpp | 27 ++++++++++--- lib/smack/Naming.cpp | 10 ++++- lib/smack/Slicing.cpp | 64 +++++++++++++----------------- lib/smack/SmackRep.cpp | 25 +++--------- test/contracts/array_forall.c | 17 ++++++++ test/contracts/array_forall_fail.c | 17 ++++++++ 8 files changed, 99 insertions(+), 65 deletions(-) create mode 100644 test/contracts/array_forall.c create mode 100644 test/contracts/array_forall_fail.c diff --git a/include/smack/Naming.h b/include/smack/Naming.h index b1e77e847..714a00dc9 100644 --- a/include/smack/Naming.h +++ b/include/smack/Naming.h @@ -27,6 +27,7 @@ class Naming { static const string BOOL_VAR; static const string FLOAT_VAR; static const string PTR_VAR; + static const string UNDEF_SYM; Naming() : blockNum(0), varNum(0) { } void enter(); diff --git a/include/smack/SmackRep.h b/include/smack/SmackRep.h index a2b6c7a8e..8646bad60 100644 --- a/include/smack/SmackRep.h +++ b/include/smack/SmackRep.h @@ -133,14 +133,12 @@ class SmackRep { vector staticInits; unsigned uniqueFpNum; - unsigned uniqueUndefNum; public: SmackRep(DSAAliasAnalysis* aa, Naming& N, Program& P) : aliasAnalysis(aa), naming(N), program(P), targetData(aa->getDataLayout()), globalsBottom(0) { uniqueFpNum = 0; - uniqueUndefNum = 0; } DSAAliasAnalysis* getAliasAnalysis() { return aliasAnalysis; } Program& getProgram() { return program; } @@ -180,7 +178,6 @@ class SmackRep { const Expr* mem(const llvm::Value* v); const Expr* mem(unsigned region, const Expr* addr); - const Expr* undef(); const Expr* lit(const llvm::Value* v); const Expr* lit(unsigned v); const Expr* ptrArith(const llvm::Value* p, vector ps, diff --git a/lib/smack/Contracts.cpp b/lib/smack/Contracts.cpp index bfae16de6..68913dc72 100644 --- a/lib/smack/Contracts.cpp +++ b/lib/smack/Contracts.cpp @@ -1,5 +1,6 @@ #include "smack/Contracts.h" #include "llvm/Support/InstIterator.h" +#include "llvm/Analysis/CFG.h" using namespace llvm; @@ -20,6 +21,18 @@ Slice* ContractsExtractor::extractSlice(Value* V) { return S; } +typedef SmallVector< pair, 10 > EdgeList; + +bool looksLikeLoopHead(BasicBlock* B) { + EdgeList backedges; + FindFunctionBackedges(*B->getParent(), backedges); + for (pred_iterator A = pred_begin(B), Z = pred_end(B); A != Z; ++A) + for (EdgeList::iterator E = backedges.begin(), End = backedges.end(); E != End; ++E) + if (E->first == *A && E->second == B) + return true; + return false; +} + void ContractsExtractor::visitCallInst(CallInst& ci) { Function* f = ci.getCalledFunction(); @@ -51,14 +64,18 @@ void ContractsExtractor::visitCallInst(CallInst& ci) { } else if (f && naming.get(*f).find("invariant") != string::npos) { assert(ci.getNumArgOperands() == 1 && "Unexpected operands to invariant."); - Value* V = ci.getArgOperand(0); - ci.setArgOperand(0,sliceIdx(ci.getContext())); - slices.push_back(extractSlice(V)); BasicBlock* body = ci.getParent(); - BasicBlock* head = body->getSinglePredecessor(); - assert(head && "Expected single predecessor block."); + BasicBlock* head = body; + do { + pred_iterator P = pred_begin(head); + assert(P != pred_end(head) && "Expected predecessors!"); + head = *P; + } while (!looksLikeLoopHead(head)); + Value* V = ci.getArgOperand(0); + ci.setArgOperand(0,sliceIdx(ci.getContext())); + slices.push_back(extractSlice(V)); ci.removeFromParent(); // NOTE Boogie only considers only assertions at the beginning of the loop diff --git a/lib/smack/Naming.cpp b/lib/smack/Naming.cpp index 0fe6b4000..24af26387 100644 --- a/lib/smack/Naming.cpp +++ b/lib/smack/Naming.cpp @@ -1,6 +1,7 @@ #include "smack/Naming.h" #include "llvm/Support/GraphWriter.h" #include "llvm/IR/Type.h" +#include "llvm/IR/Constants.h" #include namespace smack { @@ -10,6 +11,7 @@ const string Naming::RET_VAR = "$r"; const string Naming::BOOL_VAR = "$b"; const string Naming::FLOAT_VAR = "$f"; const string Naming::PTR_VAR = "$p"; +const string Naming::UNDEF_SYM = "$u"; Regex Naming::BPL_KW( "^(bool|int|false|true|old|forall|exists|requires|modifies|ensures|invariant|free" @@ -75,6 +77,9 @@ string Naming::get(const llvm::Value& V) { assert(nameStack.size() > 0 && "Name stack should not be empty."); name = freshBlockName(); + } else if (llvm::isa(&V)) { + return freshVarName(V); + } else if (llvm::isa(&V)) { assert(nameStack.size() > 0 && "Name stack should not be empty."); name = freshVarName(V); @@ -97,7 +102,10 @@ string Naming::freshBlockName() { string Naming::freshVarName(const llvm::Value& V) { stringstream s; - if (V.getType()->isIntegerTy(1)) + if (llvm::isa(&V)) + s << UNDEF_SYM; + + else if (V.getType()->isIntegerTy(1)) s << BOOL_VAR; else if (V.getType()->isFloatingPointTy()) diff --git a/lib/smack/Slicing.cpp b/lib/smack/Slicing.cpp index 9e8eed032..f6ad15f4f 100644 --- a/lib/smack/Slicing.cpp +++ b/lib/smack/Slicing.cpp @@ -165,57 +165,47 @@ Slice::Slice(Instruction& I, Slices& S, string name) } void Slice::remove() { - Instruction* I = dyn_cast(&value); - assert(I && "Expected instruction value."); + // Instruction* I = dyn_cast(&value); + // assert(I && "Expected instruction value."); - queue workList; - set covered; - map succ; + // map succ; - workList.push(I); + queue workList; + set deleted; + workList.push(&value); while (!workList.empty()) { - Instruction* I = workList.front(); + Value* V = workList.front(); workList.pop(); - if (covered.count(I)) - continue; - covered.insert(I); + if (deleted.count(V)) + continue; - if (I->getNumUses() > 1) + if (V->getNumUses() > 0) continue; - if (BranchInst* Br = dyn_cast(I)) { - if (Br->isConditional()) { - if (Instruction* J = dyn_cast(Br->getCondition())) - workList.push(J); - } else { - // TODO FIGURE THIS OUT & CLEAN IT UP - succ.insert(make_pair(Br->getParent(),Br->getSuccessor(0))); - } - } else { - for (User::op_iterator U = I->op_begin(); U != I->op_end(); ++U) - if (Instruction* J = dyn_cast(U)) - workList.push(J); - } + if (User* U = dyn_cast(V)) + for (User::op_iterator W = U->op_begin(); W != U->op_end(); ++W) + workList.push(*W); - if (PHINode* Phi = dyn_cast(I)) { - for (PHINode::block_iterator A = Phi->block_begin(); A != Phi->block_end(); ++A) { - workList.push( (*A)->getTerminator() ); + if (PHINode* I = dyn_cast(V)) + for (PHINode::block_iterator A = I->block_begin(), Z = I->block_end(); + A != Z; ++ A) + workList.push((*A)->getTerminator()); + + if (BranchInst* I = dyn_cast(V)) { + if (I->isConditional()) { + Value* C = I->getCondition(); + workList.push(C); + I->setCondition(UndefValue::get(C->getType())); } + continue; } - BasicBlock* B = I->getParent(); - I->eraseFromParent(); + if (Instruction* I = dyn_cast(V)) + I->eraseFromParent(); - if (B->getInstList().size() == 0) { - // TODO FIGURE THIS OUT & CLEAN IT UP - if (BasicBlock* C = succ[B]) { - // assert(C && "Successor not found!"); - B->replaceAllUsesWith(C); - B->eraseFromParent(); - } - } + deleted.insert(V); } } diff --git a/lib/smack/SmackRep.cpp b/lib/smack/SmackRep.cpp index b492a0c46..0c4d50e8d 100644 --- a/lib/smack/SmackRep.cpp +++ b/lib/smack/SmackRep.cpp @@ -303,12 +303,6 @@ const Expr* SmackRep::b2i(const llvm::Value* v) { return Expr::fn(B2I, expr(v)); } -const Expr* SmackRep::undef() { - stringstream s; - s << "$u." << uniqueUndefNum++; - return Expr::id(s.str()); -} - const Expr* SmackRep::lit(const llvm::Value* v) { if (const llvm::ConstantInt* ci = llvm::dyn_cast(v)) { if (ci->getBitWidth() == 1) @@ -377,6 +371,11 @@ const Expr* SmackRep::expr(const llvm::Value* v) { assert(g->hasName()); return Expr::id(naming.get(*v)); + } else if (isa(v)) { + string name = naming.get(*v); + program.addDecl(Decl::constant(name,type(v->getType()))); + return Expr::id(name); + } else if (naming.get(*v) != "") return Expr::id(naming.get(*v)); @@ -430,9 +429,6 @@ const Expr* SmackRep::expr(const llvm::Value* v) { } else if (constant->isNullValue()) return lit((unsigned)0); - else if (isa(constant)) - return undef(); - else { DEBUG(errs() << "VALUE : " << *v << "\n"); assert(false && "this type of constant not supported"); @@ -749,17 +745,8 @@ string SmackRep::getPrelude() { for (unsigned i=0; i 0) { - s << "// Undefined values" << endl; - s << "const "; - for (unsigned i=0; i 0 ? ", " : "") << "$u." << i; - s << ": " << getPtrType() << ";" << endl; - s << endl; - } + s << endl; s << "axiom $GLOBALS_BOTTOM == " << globalsBottom << ";" << endl; diff --git a/test/contracts/array_forall.c b/test/contracts/array_forall.c new file mode 100644 index 000000000..5e22251a8 --- /dev/null +++ b/test/contracts/array_forall.c @@ -0,0 +1,17 @@ +#include +#include +#include "smack.h" + +// @expect 1 verified, 0 errors? + +#define SIZE 10 +int g[SIZE]; + +void p() { + ensures(forall("i", qvar("i") < 0 || qvar("i") >= SIZE || g[qvar("i")] == qvar("i"))); + + for (int i=0; i= i || g[qvar("x")] == qvar("x"))); + g[i] = i; + } +} diff --git a/test/contracts/array_forall_fail.c b/test/contracts/array_forall_fail.c new file mode 100644 index 000000000..f7dd85d6d --- /dev/null +++ b/test/contracts/array_forall_fail.c @@ -0,0 +1,17 @@ +#include +#include +#include "smack.h" + +// @expect 0 verified, 2 errors? + +#define SIZE 10 +int g[SIZE]; + +void p() { + ensures(forall("i", qvar("i") < 0 || qvar("i") >= SIZE || g[qvar("i")] == qvar("i"))); + + for (int i=0; i i || g[qvar("x")] == qvar("x"))); + g[i] = i; + } +} From 88509aef4b1a871bd5bf5cbb29929b78356c3fb1 Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Wed, 13 Aug 2014 13:18:29 -0600 Subject: [PATCH 044/140] Fixed several bugs in python scripts. --- bin/llvm2bpl.py | 4 +++- bin/smackgen.py | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/bin/llvm2bpl.py b/bin/llvm2bpl.py index 9a979fd08..f41cb1356 100755 --- a/bin/llvm2bpl.py +++ b/bin/llvm2bpl.py @@ -28,6 +28,8 @@ def llvm2bplParser(): help='output Boogie file (default: %(default)s)') parser.add_argument('-d', '--debug', dest='debug', action="store_true", default=False, help='turn on debug info') + parser.add_argument('--mem-mod', dest='memmod', choices=['no-reuse', 'no-reuse-impls', 'reuse'], default='no-reuse', + help='set the memory model (no-reuse=never reallocate the same address, reuse=reallocate freed addresses)') return parser @@ -59,7 +61,7 @@ def llvm2bpl(infile, debugFlag, memImpls): parser = argparse.ArgumentParser(description='Outputs a plain Boogie file generated from the input LLVM file.', parents=[llvm2bplParser()]) args = parser.parse_args() - bpl = llvm2bpl(args.infile, args.debug, args.memmod, args.memimpls) + bpl = llvm2bpl(args.infile, args.debug, "impls" in args.memmod) # write final output args.outfile.write(bpl) diff --git a/bin/smackgen.py b/bin/smackgen.py index 37c89c6db..61adf5911 100755 --- a/bin/smackgen.py +++ b/bin/smackgen.py @@ -20,8 +20,6 @@ def smackParser(): help='specify entry procedures') parser.add_argument('--unroll', metavar='N', dest='unroll', default='2', type=int, help='unroll loops/recursion in Boogie/Corral N number of times') - parser.add_argument('--mem-mod', dest='memmod', choices=['no-reuse', 'no-reuse-impls', 'reuse'], default='no-reuse', - help='set the memory model (no-reuse=never reallocate the same address, reuse=reallocate freed addresses)') return parser @@ -82,6 +80,7 @@ def smackGenerate(sysArgv): args = parser.parse_args(sysArgv[1:]) inputFile = args.infile scriptPathName = path.dirname(sysArgv[0]) + clangOutput = None fileExtension = path.splitext(inputFile.name)[1] options = [] @@ -115,7 +114,8 @@ def smackGenerate(sysArgv): args = parser.parse_args() bpl, options, clangOutput = smackGenerate(sys.argv) - print clangOutput + if clangOutput is not None: + print clangOutput # write final output args.outfile.write(bpl) From 8655fcabceaf62f5f7cf5ca8bda9c2e5fbf6a24f Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Wed, 13 Aug 2014 14:44:40 -0600 Subject: [PATCH 045/140] Temporary (and often emply) a.bpl file is not being unnecessarily generated any more. --- bin/llvm2bpl.py | 15 +++++++++------ bin/smackgen.py | 7 ++++--- bin/smackverify.py | 7 ++++--- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/bin/llvm2bpl.py b/bin/llvm2bpl.py index f41cb1356..6341b6d13 100755 --- a/bin/llvm2bpl.py +++ b/bin/llvm2bpl.py @@ -24,7 +24,7 @@ def llvm2bplParser(): type=lambda x: is_valid_file(parser,x), help='input LLVM file') parser.add_argument('-o', '--output', dest='outfile', metavar='', default='a.bpl', - type=argparse.FileType('w'), + type=str, help='output Boogie file (default: %(default)s)') parser.add_argument('-d', '--debug', dest='debug', action="store_true", default=False, help='turn on debug info') @@ -33,11 +33,12 @@ def llvm2bplParser(): return parser -def llvm2bpl(infile, debugFlag, memImpls): +def llvm2bpl(infile, outfile, debugFlag, memImpls): cmd = ['smack', '-source-loc-syms', infile.name] if debugFlag: cmd.append('-debug') if memImpls: cmd.append('-mem-mod-impls') + cmd.append('-o=' + outfile) p = subprocess.Popen(cmd) p.wait() @@ -46,8 +47,9 @@ def llvm2bpl(infile, debugFlag, memImpls): print >> sys.stderr, output[0:1000], "... (output truncated)" sys.exit("SMACK returned exit status %s" % p.returncode) - with open('a.bpl', 'r') as outputFile: + with open(outfile, 'r') as outputFile: output = outputFile.read() + outputFile.close() # bplStartIndex = output.find('// SMACK-PRELUDE-BEGIN') # bpl = output[bplStartIndex:] @@ -61,9 +63,10 @@ def llvm2bpl(infile, debugFlag, memImpls): parser = argparse.ArgumentParser(description='Outputs a plain Boogie file generated from the input LLVM file.', parents=[llvm2bplParser()]) args = parser.parse_args() - bpl = llvm2bpl(args.infile, args.debug, "impls" in args.memmod) + bpl = llvm2bpl(args.infile, args.outfile, args.debug, "impls" in args.memmod) # write final output - args.outfile.write(bpl) - args.outfile.close() + with open(args.outfile, 'w') as outputFile: + outputFile.write(bpl) + outputFile.close() diff --git a/bin/smackgen.py b/bin/smackgen.py index 75371cf3b..204132307 100755 --- a/bin/smackgen.py +++ b/bin/smackgen.py @@ -94,7 +94,7 @@ def smackGenerate(sysArgv): args = parser.parse_args(options + sysArgv[1:]) inputFile, clangOutput = clang(scriptPathName, inputFile, args.memmod, args.clang) - bpl = llvm2bpl(inputFile, args.debug, "impls" in args.memmod) + bpl = llvm2bpl(inputFile, args.outfile, args.debug, "impls" in args.memmod) inputFile.close() p = re.compile('procedure\s+([^\s(]*)\s*\(') @@ -118,6 +118,7 @@ def smackGenerate(sysArgv): print clangOutput # write final output - args.outfile.write(bpl) - args.outfile.close() + with open(args.outfile, 'w') as outputFile: + outputFile.write(bpl) + outputFile.close() diff --git a/bin/smackverify.py b/bin/smackverify.py index 6eb827210..1a7bd31b1 100755 --- a/bin/smackverify.py +++ b/bin/smackverify.py @@ -168,8 +168,9 @@ def verify(verifier, bplFileName, timeLimit, unroll, debug, smackd): args = parser.parse_args(options + sys.argv[1:]) # write final output - args.outfile.write(bpl) - args.outfile.close() + with open(args.outfile, 'w') as outputFile: + outputFile.write(bpl) + outputFile.close() - print(verify(args.verifier, args.outfile.name, args.timeLimit, args.unroll, args.debug, args.smackd)) + print(verify(args.verifier, args.outfile, args.timeLimit, args.unroll, args.debug, args.smackd)) From 1c4d9bb463324878c745ef61e718f1ee42372b11 Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Wed, 13 Aug 2014 15:56:24 -0600 Subject: [PATCH 046/140] Minor fix. --- bin/smackverify.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/smackverify.py b/bin/smackverify.py index 1a7bd31b1..e387a942a 100755 --- a/bin/smackverify.py +++ b/bin/smackverify.py @@ -160,7 +160,7 @@ def verify(verifier, bplFileName, timeLimit, unroll, debug, smackd): for i in reversed(range(len(sysArgv))): if sysArgv[i] == '--smackd': del sysArgv[i] - elif sys.argv[i] == '--time-limit': + elif sysArgv[i] == '--time-limit': del sysArgv[i] del sysArgv[i] From f02769e6245519dddcb7e7d749e7edf084c5e495 Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Wed, 13 Aug 2014 17:11:42 -0600 Subject: [PATCH 047/140] Creating the output bc file with clang in the same folder where the output bpl file is generated. --- bin/smackgen.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/bin/smackgen.py b/bin/smackgen.py index b7bf4a63e..fb6e89164 100755 --- a/bin/smackgen.py +++ b/bin/smackgen.py @@ -43,19 +43,20 @@ def addEntryPoint(match, entryPoints): return procDef -def clang(scriptPathName, inputFile, memoryModel, clangArgs): +def clang(scriptPathName, inputFile, outputFileName, memoryModel, clangArgs): scriptFullPath = path.abspath(scriptPathName) smackRoot = path.dirname(scriptFullPath) smackHeaders = path.join(smackRoot, 'include', 'smack') - fileName = path.splitext(inputFile.name)[0] + fileName = path.join(path.dirname(path.abspath(outputFileName)), + path.splitext(path.basename(inputFile.name))[0]) + '.bc' clangCommand = ['clang'] clangCommand += ['-c', '-emit-llvm', '-O0', '-g', '-gcolumn-info', '-DMEMORY_MODEL_' + memoryModel.upper().replace('-','_'), '-I' + smackHeaders] clangCommand += clangArgs.split() - clangCommand += [inputFile.name, '-o', fileName + '.bc'] + clangCommand += [inputFile.name, '-o', fileName] #Redirect stderr to stdout, then grab stdout (communicate() calls wait()) #This should more or less maintain stdout/stderr interleaving order #However, this will be problematic if any callers want to differentiate @@ -68,7 +69,7 @@ def clang(scriptPathName, inputFile, memoryModel, clangArgs): print clangOutput sys.exit("SMACK encountered a clang error. Exiting...") - inputFileName = path.join(path.curdir, fileName + '.bc') + inputFileName = path.join(path.curdir, fileName) inputFile = open(inputFileName, 'r') return inputFile, clangOutput @@ -92,7 +93,7 @@ def smackGenerate(sysArgv): if optionsMatch: options = optionsMatch.group(1).split() args = parser.parse_args(options + sysArgv[1:]) - inputFile, clangOutput = clang(scriptPathName, inputFile, args.memmod, args.clang) + inputFile, clangOutput = clang(scriptPathName, inputFile, args.outfile, args.memmod, args.clang) bpl = llvm2bpl(inputFile, args.outfile, args.debug, "impls" in args.memmod) inputFile.close() From f4a7d24caf8ad285e0e261c2acee7318d29c8ccf Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Thu, 14 Aug 2014 10:44:04 -0600 Subject: [PATCH 048/140] Removed $ptr and $off since we do not need it any more. Renamed $obj into $base. --- include/smack/SmackRep.h | 4 +--- include/smack/smack.h | 14 +++++--------- lib/smack/SmackRep.cpp | 4 +--- 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/include/smack/SmackRep.h b/include/smack/SmackRep.h index 6d64c429f..4cbc3c889 100644 --- a/include/smack/SmackRep.h +++ b/include/smack/SmackRep.h @@ -42,9 +42,7 @@ class SmackRep { static const string FREE; static const string MEMCPY; - static const string PTR; - static const string OBJ; - static const string OFF; + static const string BASE; static const string PA; static const string FP; diff --git a/include/smack/smack.h b/include/smack/smack.h index d535eecf8..01a715d53 100644 --- a/include/smack/smack.h +++ b/include/smack/smack.h @@ -45,8 +45,6 @@ void __SMACK_assume(bool v) { __SMACK_code("assume {@} != 0;", v); } -//// PROBLEM: in the 2D memory model, the declaration of boogie_si_record_int -//// should have a type $ptr parameter, not an int. How should we do this? // void __SMACK_record_int(int i) { // __SMACK_top_decl("procedure boogie_si_record_int(i:int);"); // __SMACK_code("call boogie_si_record_int(@);", i); @@ -134,9 +132,7 @@ void __SMACK_decls() { D("function $ui2fp(i:int) returns (float);"); // Memory Model - D("function {:inline} $ptr(obj:int, off:int) returns (int) {obj + off}"); - D("function $obj(int) returns (int);"); - D("function {:inline} $off(ptr:int) returns (int) {ptr}"); + D("function $base(int) returns (int);"); D("const unique $NULL: int;"); D("axiom $NULL == 0;"); @@ -207,7 +203,7 @@ void __SMACK_decls() { "ensures $Size[p] == n;\n" "ensures (forall q: int :: {$Size[q]} q != p ==> $Size[q] == old($Size[q]));\n" "ensures (forall q: int :: {$Alloc[q]} q != p ==> $Alloc[q] == old($Alloc[q]));\n" - "ensures n >= 0 ==> (forall q: int :: {$obj(q)} p <= q && q < p+n ==> $obj(q) == p);"); + "ensures n >= 0 ==> (forall q: int :: {$base(q)} p <= q && q < p+n ==> $base(q) == p);"); D("procedure $free(p: int);\n" "modifies $Alloc;\n" @@ -223,7 +219,7 @@ void __SMACK_decls() { "ensures $Size[p] == n;\n" "ensures (forall q: int :: {$Size[q]} q != p ==> $Size[q] == old($Size[q]));\n" "ensures (forall q: int :: {$Alloc[q]} q != p ==> $Alloc[q] == old($Alloc[q]));\n" - "ensures n >= 0 ==> (forall q: int :: {$obj(q)} p <= q && q < p+n ==> $obj(q) == p);"); + "ensures n >= 0 ==> (forall q: int :: {$base(q)} p <= q && q < p+n ==> $base(q) == p);"); #else // NO_REUSE does not reuse previously-allocated addresses D("var $Alloc: [int] bool;"); @@ -237,7 +233,7 @@ void __SMACK_decls() { "ensures n >= 0 ==> $CurrAddr >= old($CurrAddr) + n;\n" "ensures $Alloc[p];\n" "ensures (forall q: int :: {$Alloc[q]} q != p ==> $Alloc[q] == old($Alloc[q]));\n" - "ensures n >= 0 ==> (forall q: int :: {$obj(q)} p <= q && q < p+n ==> $obj(q) == p);"); + "ensures n >= 0 ==> (forall q: int :: {$base(q)} p <= q && q < p+n ==> $base(q) == p);"); D("procedure $free(p: int);\n" "modifies $Alloc;\n" @@ -252,7 +248,7 @@ void __SMACK_decls() { "ensures n >= 0 ==> $CurrAddr >= old($CurrAddr) + n;\n" "ensures $Alloc[p];\n" "ensures (forall q: int :: {$Alloc[q]} q != p ==> $Alloc[q] == old($Alloc[q]));\n" - "ensures n >= 0 ==> (forall q: int :: {$obj(q)} p <= q && q < p+n ==> $obj(q) == p);"); + "ensures n >= 0 ==> (forall q: int :: {$base(q)} p <= q && q < p+n ==> $base(q) == p);"); #endif #undef D diff --git a/lib/smack/SmackRep.cpp b/lib/smack/SmackRep.cpp index 7450724df..26b819472 100644 --- a/lib/smack/SmackRep.cpp +++ b/lib/smack/SmackRep.cpp @@ -24,9 +24,7 @@ const string SmackRep::MALLOC = "$malloc"; const string SmackRep::FREE = "$free"; const string SmackRep::MEMCPY = "$memcpy"; -const string SmackRep::PTR = "$ptr"; -const string SmackRep::OBJ = "$obj"; -const string SmackRep::OFF = "$off"; +const string SmackRep::BASE = "$base"; const string SmackRep::PA = "$pa"; const string SmackRep::FP = "$fp"; From 3146b721c0c70f4a9e866675e76a59c94bb83c6b Mon Sep 17 00:00:00 2001 From: zvonimir Date: Fri, 15 Aug 2014 12:49:55 -0600 Subject: [PATCH 049/140] Added support for Duality. Restructured regression scripts so that all verifiers are now being invoked from the same script and selected through command line. --- bin/build-linux-cmake.sh | 12 +- bin/build-linux-ubuntu_1404.sh | 12 +- bin/build-linux.sh | 12 +- bin/smackgen.py | 4 +- bin/smackverify.py | 15 +- examples/svcomp/locks/regtest-corral.py | 63 ------ examples/svcomp/locks/regtest.py | 66 +++--- .../ntdrivers-simplified/regtest-corral.py | 60 ------ .../svcomp/ntdrivers-simplified/regtest.py | 58 +++--- examples/svcomp/ntdrivers/regtest-corral.py | 59 ------ examples/svcomp/ntdrivers/regtest.py | 54 +++-- test/regtest-corral.py | 130 ------------ test/regtest.py | 190 ++++++++++-------- 13 files changed, 239 insertions(+), 496 deletions(-) delete mode 100755 examples/svcomp/locks/regtest-corral.py delete mode 100755 examples/svcomp/ntdrivers-simplified/regtest-corral.py delete mode 100755 examples/svcomp/ntdrivers/regtest-corral.py delete mode 100755 test/regtest-corral.py diff --git a/bin/build-linux-cmake.sh b/bin/build-linux-cmake.sh index 44f821656..0f9494e0e 100755 --- a/bin/build-linux-cmake.sh +++ b/bin/build-linux-cmake.sh @@ -120,18 +120,16 @@ mkdir -p ${Z3_DIR}/install # Get Z3 cd ${Z3_DIR}/src/ -wget "http://download-codeplex.sec.s-msft.com/Download/SourceControlFileDownload.ashx?ProjectName=z3&changeSetId=89c1785b73225a1b363c0e485f854613121b70a7" +wget "http://download-codeplex.sec.s-msft.com/Download/SourceControlFileDownload.ashx?ProjectName=z3&changeSetId=37ed4b04d078d6d1e35db2799d769e8d4b87f775" unzip -o SourceControlFileDownload* rm -f SourceControlFileDownload* # Configure Z3 and build cd ${Z3_DIR}/src/ -autoconf -./configure --prefix=${Z3_DIR}/install -python scripts/mk_make.py +python scripts/mk_make.py --prefix=${Z3_DIR}/install cd build make -sudo make install +make install cd ${BASE_DIR} @@ -146,7 +144,7 @@ if [ ${INSTALL_BOOGIE} -eq 1 ]; then mkdir -p ${BOOGIE_DIR} # Get Boogie -hg clone -r 661c32e8d5ca https://hg.codeplex.com/boogie ${BOOGIE_DIR} +hg clone -r ec9955650676 https://hg.codeplex.com/boogie ${BOOGIE_DIR} # Build Boogie cd ${BOOGIE_DIR}/Source @@ -168,7 +166,7 @@ mkdir -p ${CORRAL_DIR} # Get Corral git clone https://git01.codeplex.com/corral ${CORRAL_DIR} cd ${CORRAL_DIR} -git checkout df4d2e2ace82 +git checkout 1aeddf73b63c # Build Corral cd ${CORRAL_DIR}/references diff --git a/bin/build-linux-ubuntu_1404.sh b/bin/build-linux-ubuntu_1404.sh index 889c9fcef..cd3174574 100755 --- a/bin/build-linux-ubuntu_1404.sh +++ b/bin/build-linux-ubuntu_1404.sh @@ -74,18 +74,16 @@ mkdir -p ${Z3_DIR}/install # Get Z3 cd ${Z3_DIR}/src/ -wget "http://download-codeplex.sec.s-msft.com/Download/SourceControlFileDownload.ashx?ProjectName=z3&changeSetId=89c1785b73225a1b363c0e485f854613121b70a7" +wget "http://download-codeplex.sec.s-msft.com/Download/SourceControlFileDownload.ashx?ProjectName=z3&changeSetId=37ed4b04d078d6d1e35db2799d769e8d4b87f775" unzip -o SourceControlFileDownload* rm -f SourceControlFileDownload* # Configure Z3 and build cd ${Z3_DIR}/src/ -autoconf -./configure --prefix=${Z3_DIR}/install -python scripts/mk_make.py +python scripts/mk_make.py --prefix=${Z3_DIR}/install cd build make -sudo make install +make install cd ${BASE_DIR} @@ -100,7 +98,7 @@ if [ ${INSTALL_BOOGIE} -eq 1 ]; then mkdir -p ${BOOGIE_DIR} # Get Boogie -hg clone -r 661c32e8d5ca https://hg.codeplex.com/boogie ${BOOGIE_DIR} +hg clone -r ec9955650676 https://hg.codeplex.com/boogie ${BOOGIE_DIR} # Build Boogie cd ${BOOGIE_DIR}/Source @@ -122,7 +120,7 @@ mkdir -p ${CORRAL_DIR} # Get Corral git clone https://git01.codeplex.com/corral ${CORRAL_DIR} cd ${CORRAL_DIR} -git checkout df4d2e2ace82 +git checkout 1aeddf73b63c # Build Corral cd ${CORRAL_DIR}/references diff --git a/bin/build-linux.sh b/bin/build-linux.sh index 62d1e789a..a71c3808f 100755 --- a/bin/build-linux.sh +++ b/bin/build-linux.sh @@ -107,18 +107,16 @@ mkdir -p ${Z3_DIR}/install # Get Z3 cd ${Z3_DIR}/src/ -wget "http://download-codeplex.sec.s-msft.com/Download/SourceControlFileDownload.ashx?ProjectName=z3&changeSetId=89c1785b73225a1b363c0e485f854613121b70a7" +wget "http://download-codeplex.sec.s-msft.com/Download/SourceControlFileDownload.ashx?ProjectName=z3&changeSetId=37ed4b04d078d6d1e35db2799d769e8d4b87f775" unzip -o SourceControlFileDownload* rm -f SourceControlFileDownload* # Configure Z3 and build cd ${Z3_DIR}/src/ -autoconf -./configure --prefix=${Z3_DIR}/install -python scripts/mk_make.py +python scripts/mk_make.py --prefix=${Z3_DIR}/install cd build make -sudo make install +make install cd ${BASE_DIR} @@ -133,7 +131,7 @@ if [ ${INSTALL_BOOGIE} -eq 1 ]; then mkdir -p ${BOOGIE_DIR} # Get Boogie -hg clone -r 661c32e8d5ca https://hg.codeplex.com/boogie ${BOOGIE_DIR} +hg clone -r ec9955650676 https://hg.codeplex.com/boogie ${BOOGIE_DIR} # Build Boogie cd ${BOOGIE_DIR}/Source @@ -155,7 +153,7 @@ mkdir -p ${CORRAL_DIR} # Get Corral git clone https://git01.codeplex.com/corral ${CORRAL_DIR} cd ${CORRAL_DIR} -git checkout df4d2e2ace82 +git checkout 1aeddf73b63c # Build Corral cd ${CORRAL_DIR}/references diff --git a/bin/smackgen.py b/bin/smackgen.py index fb6e89164..581ff56fa 100755 --- a/bin/smackgen.py +++ b/bin/smackgen.py @@ -14,7 +14,7 @@ def smackParser(): parser = argparse.ArgumentParser(add_help=False, parents=[llvm2bplParser()]) parser.add_argument('--clang', dest='clang', default='', help='pass arguments to clang (e.g., --clang="-w -g")') - parser.add_argument('--verifier', dest='verifier', choices=['boogie', 'corral'], default='boogie', + parser.add_argument('--verifier', dest='verifier', choices=['boogie', 'corral', 'duality'], default='boogie', help='set the underlying verifier format') parser.add_argument('--entry-points', metavar='PROC', dest='entryPoints', default='main', nargs='+', help='specify entry procedures') @@ -102,7 +102,7 @@ def smackGenerate(sysArgv): if args.verifier == 'boogie' and args.unroll is not None: # put inline on procedures bpl = p.sub(lambda match: addInline(match, args.entryPoints, args.unroll), bpl) - elif args.verifier == 'corral': + elif args.verifier == 'corral' or args.verifier == 'duality': # annotate entry points bpl = p.sub(lambda match: addEntryPoint(match, args.entryPoints), bpl) return bpl, options, clangOutput diff --git a/bin/smackverify.py b/bin/smackverify.py index e387a942a..ed4673a16 100755 --- a/bin/smackverify.py +++ b/bin/smackverify.py @@ -135,7 +135,7 @@ def verify(verifier, bplFileName, timeLimit, unroll, debug, smackd): return sourceTrace else: return boogieOutput - else: + elif verifier == 'corral': # invoke Corral corralCommand = ['corral', bplFileName, '/tryCTrace'] if unroll is not None: @@ -149,6 +149,19 @@ def verify(verifier, bplFileName, timeLimit, unroll, debug, smackd): smackdOutput(corralOutput) else: return corralOutput + else: + # invoke Duality + dualityCommand = ['corral', bplFileName, '/tryCTrace', '/useDuality'] + dualityCommand += ['/recursionBound:10000'] # hack for providing infinite recursion bound + p = subprocess.Popen(dualityCommand, stdout=subprocess.PIPE) + dualityOutput = p.communicate()[0] + if p.returncode: + return dualityOutput + sys.exit("SMACK encountered an error invoking Duality. Exiting...") + if smackd: + smackdOutput(dualityOutput) + else: + return dualityOutput if __name__ == '__main__': parser = argparse.ArgumentParser(description='Checks the input LLVM file for assertion violations.', parents=[verifyParser()]) diff --git a/examples/svcomp/locks/regtest-corral.py b/examples/svcomp/locks/regtest-corral.py deleted file mode 100755 index d04f66de4..000000000 --- a/examples/svcomp/locks/regtest-corral.py +++ /dev/null @@ -1,63 +0,0 @@ -#! /usr/bin/env python - -import subprocess -import re -import time - -# list of regression tests with the expected outputs -tests = [ - ('test_locks_5_true', r'Program has no bugs'), - ('test_locks_6_true', r'Program has no bugs'), - ('test_locks_7_true', r'Program has no bugs'), - ('test_locks_8_true', r'Program has no bugs'), - ('test_locks_9_true', r'Program has no bugs'), - ('test_locks_10_true', r'Program has no bugs'), - ('test_locks_11_true', r'Program has no bugs'), - ('test_locks_12_true', r'Program has no bugs'), - ('test_locks_13_true', r'Program has no bugs'), - ('test_locks_14_true', r'Program has no bugs'), - ('test_locks_14_false', r'This assertion can fail'), - ('test_locks_15_true', r'Program has no bugs'), - ('test_locks_15_false', r'This assertion can fail') -] - -def red(text): - return '\033[0;31m' + text + '\033[0m' - -def green(text): - return '\033[0;32m' + text + '\033[0m' - -def runtests(): - passed = failed = 0 - for test in tests: - - for mem in ['no-reuse', 'no-reuse-impls', 'reuse']: - - print "{0:>20} {1:>16}:".format(test[0], "(" + mem + ")"), - - # invoke SMACK - t0 = time.time() - p = subprocess.Popen(['smackverify.py', test[0] + '.c', '--verifier=corral', - '--mem-mod=' + mem, '--unroll=2', '-o', test[0] +'.bpl'], - stdout=subprocess.PIPE) - - smackOutput = p.communicate()[0] - elapsed = time.time() - t0 - - # check SMACK output - if re.search(test[1], smackOutput): - print green('PASSED') + ' [%.2fs]' % round(elapsed, 2) - passed += 1 - else: - print red('FAILED') - failed += 1 - - return passed, failed - -if __name__ == '__main__': - - passed, failed = runtests() - - print '\nPASSED count: ', passed - print 'FAILED count: ', failed - diff --git a/examples/svcomp/locks/regtest.py b/examples/svcomp/locks/regtest.py index 8df71d068..68982bdc4 100755 --- a/examples/svcomp/locks/regtest.py +++ b/examples/svcomp/locks/regtest.py @@ -2,62 +2,74 @@ import subprocess import re +import argparse import time +from collections import namedtuple + +RegTest = namedtuple('RegTest', 'name boogie corral duality unroll') # list of regression tests with the expected outputs tests = [ - ('test_locks_5_true', r'1 verified, 0 errors?'), - ('test_locks_6_true', r'1 verified, 0 errors?'), - ('test_locks_7_true', r'1 verified, 0 errors?'), - ('test_locks_8_true', r'1 verified, 0 errors?'), - ('test_locks_9_true', r'1 verified, 0 errors?'), - ('test_locks_10_true', r'1 verified, 0 errors?'), - ('test_locks_11_true', r'1 verified, 0 errors?'), - ('test_locks_12_true', r'1 verified, 0 errors?'), - ('test_locks_13_true', r'1 verified, 0 errors?'), - ('test_locks_14_true', r'1 verified, 0 errors?'), - ('test_locks_14_false', r'0 verified, 1 errors?'), - ('test_locks_15_true', r'1 verified, 0 errors?'), - ('test_locks_15_false', r'0 verified, 1 errors?') + RegTest('test_locks_5_true', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), + RegTest('test_locks_6_true', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), + RegTest('test_locks_7_true', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), + RegTest('test_locks_8_true', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), + RegTest('test_locks_9_true', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), + RegTest('test_locks_10_true', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), + RegTest('test_locks_11_true', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), + RegTest('test_locks_12_true', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), + RegTest('test_locks_13_true', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), + RegTest('test_locks_14_true', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), + RegTest('test_locks_14_false', r'0 verified, 1 errors?', r'This assertion can fail', r'This assertion can fail', 2), + RegTest('test_locks_15_true', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), + RegTest('test_locks_15_false', r'0 verified, 1 errors?', r'This assertion can fail', r'This assertion can fail', 2) ] def red(text): return '\033[0;31m' + text + '\033[0m' - + def green(text): return '\033[0;32m' + text + '\033[0m' -def runtests(): +def runtests(verifier): passed = failed = 0 for test in tests: - + for mem in ['no-reuse', 'no-reuse-impls', 'reuse']: - - print "{0:>20} {1:>16}:".format(test[0], "(" + mem + ")"), + + print "{0:>25} {1:>16}:".format(test.name, "(" + mem + ")"), # invoke SMACK t0 = time.time() - p = subprocess.Popen(['smackverify.py', test[0] + '.c', '--verifier=boogie', - '--mem-mod=' + mem, '--unroll=2', '-o', test[0] +'.bpl'], + p = subprocess.Popen(['smackverify.py', test.name + '.c', '--verifier=' + verifier, + '--unroll=' + str(test.unroll), '--mem-mod=' + mem, '-o', test.name +'.bpl'], stdout=subprocess.PIPE) - + smackOutput = p.communicate()[0] elapsed = time.time() - t0 # check SMACK output - if re.search(test[1], smackOutput): + if re.search(getattr(test, verifier), smackOutput): print green('PASSED') + ' [%.2fs]' % round(elapsed, 2) passed += 1 else: print red('FAILED') failed += 1 - + return passed, failed if __name__ == '__main__': - passed, failed = runtests() - - print '\nPASSED count: ', passed - print 'FAILED count: ', failed + # parse command line arguments + parser = argparse.ArgumentParser(description='Runs regressions in this folder.') + parser.add_argument('--verifier', dest='verifier', choices=['boogie', 'corral', 'duality'], default=['boogie'], nargs='*', + help='choose verifiers to be used') + args = parser.parse_args() + + for verifier in args.verifier: + print '\nRunning regressions using', verifier + passed, failed = runtests(verifier) + + print '\nPASSED count: ', passed + print 'FAILED count: ', failed diff --git a/examples/svcomp/ntdrivers-simplified/regtest-corral.py b/examples/svcomp/ntdrivers-simplified/regtest-corral.py deleted file mode 100755 index ad05d387c..000000000 --- a/examples/svcomp/ntdrivers-simplified/regtest-corral.py +++ /dev/null @@ -1,60 +0,0 @@ -#! /usr/bin/env python - -import subprocess -import re -import time - -# list of regression tests with the expected outputs -tests = [ - ('cdaudio_simpl1_true.cil', r'Program has no bugs'), - ('cdaudio_simpl1_false.cil', r'This assertion can fail'), - ('diskperf_simpl1_true.cil', r'Program has no bugs'), - ('floppy_simpl3_true.cil', r'Program has no bugs'), - ('floppy_simpl3_false.cil', r'This assertion can fail'), - ('floppy_simpl4_true.cil', r'Program has no bugs'), - ('floppy_simpl4_false.cil', r'This assertion can fail'), - ('kbfiltr_simpl1_true.cil', r'Program has no bugs'), - ('kbfiltr_simpl2_true.cil', r'Program has no bugs'), - ('kbfiltr_simpl2_false.cil', r'This assertion can fail') -] - -def red(text): - return '\033[0;31m' + text + '\033[0m' - -def green(text): - return '\033[0;32m' + text + '\033[0m' - -def runtests(): - passed = failed = 0 - for test in tests: - - for mem in ['no-reuse', 'no-reuse-impls', 'reuse']: - - print "{0:>25} {1:>16}:".format(test[0], "(" + mem + ")"), - - # invoke SMACK - t0 = time.time() - p = subprocess.Popen(['smackverify.py', test[0] + '.c', '--verifier=corral', - '--mem-mod=' + mem, '--unroll=2', '--clang=-w', '-o', test[0] +'.bpl'], - stdout=subprocess.PIPE) - - smackOutput = p.communicate()[0] - elapsed = time.time() - t0 - - # check SMACK output - if re.search(test[1], smackOutput): - print green('PASSED') + ' [%.2fs]' % round(elapsed, 2) - passed += 1 - else: - print red('FAILED') - failed += 1 - - return passed, failed - -if __name__ == '__main__': - - passed, failed = runtests() - - print '\nPASSED count: ', passed - print 'FAILED count: ', failed - diff --git a/examples/svcomp/ntdrivers-simplified/regtest.py b/examples/svcomp/ntdrivers-simplified/regtest.py index 4573de395..bbed78085 100755 --- a/examples/svcomp/ntdrivers-simplified/regtest.py +++ b/examples/svcomp/ntdrivers-simplified/regtest.py @@ -2,20 +2,24 @@ import subprocess import re +import argparse import time +from collections import namedtuple + +RegTest = namedtuple('RegTest', 'name boogie corral duality unroll') # list of regression tests with the expected outputs tests = [ - ('cdaudio_simpl1_true.cil', r'1 verified, 0 errors?'), - ('cdaudio_simpl1_false.cil', r'0 verified, 1 errors?'), - ('diskperf_simpl1_true.cil', r'1 verified, 0 errors?'), - ('floppy_simpl3_true.cil', r'1 verified, 0 errors?'), - ('floppy_simpl3_false.cil', r'0 verified, 1 errors?'), - ('floppy_simpl4_true.cil', r'1 verified, 0 errors?'), - ('floppy_simpl4_false.cil', r'0 verified, 1 errors?'), - ('kbfiltr_simpl1_true.cil', r'1 verified, 0 errors?'), - ('kbfiltr_simpl2_true.cil', r'1 verified, 0 errors?'), - ('kbfiltr_simpl2_false.cil', r'0 verified, 1 errors?') + RegTest('cdaudio_simpl1_true.cil', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), + RegTest('cdaudio_simpl1_false.cil', r'0 verified, 1 errors?', r'This assertion can fail', r'This assertion can fail', 2), + RegTest('diskperf_simpl1_true.cil', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), + RegTest('floppy_simpl3_true.cil', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), + RegTest('floppy_simpl3_false.cil', r'0 verified, 1 errors?', r'This assertion can fail', r'This assertion can fail', 2), + RegTest('floppy_simpl4_true.cil', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), + RegTest('floppy_simpl4_false.cil', r'0 verified, 1 errors?', r'This assertion can fail', r'This assertion can fail', 2), + RegTest('kbfiltr_simpl1_true.cil', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), + RegTest('kbfiltr_simpl2_true.cil', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), + RegTest('kbfiltr_simpl2_false.cil', r'0 verified, 1 errors?', r'This assertion can fail', r'This assertion can fail', 2) ] def red(text): @@ -24,37 +28,45 @@ def red(text): def green(text): return '\033[0;32m' + text + '\033[0m' -def runtests(): +def runtests(verifier): passed = failed = 0 for test in tests: - + for mem in ['no-reuse', 'no-reuse-impls', 'reuse']: - - print "{0:>25} {1:>16}:".format(test[0], "(" + mem + ")"), + + print "{0:>25} {1:>16}:".format(test.name, "(" + mem + ")"), # invoke SMACK t0 = time.time() - p = subprocess.Popen(['smackverify.py', test[0] + '.c', '--verifier=boogie', - '--mem-mod=' + mem, '--unroll=2', '--clang=-w', '-o', test[0] +'.bpl'], + p = subprocess.Popen(['smackverify.py', test.name + '.c', '--verifier=' + verifier, + '--unroll=' + str(test.unroll), '--mem-mod=' + mem, '-o', test.name +'.bpl'], stdout=subprocess.PIPE) - + smackOutput = p.communicate()[0] elapsed = time.time() - t0 # check SMACK output - if re.search(test[1], smackOutput): + if re.search(getattr(test, verifier), smackOutput): print green('PASSED') + ' [%.2fs]' % round(elapsed, 2) passed += 1 else: print red('FAILED') failed += 1 - + return passed, failed if __name__ == '__main__': - passed, failed = runtests() - - print '\nPASSED count: ', passed - print 'FAILED count: ', failed + # parse command line arguments + parser = argparse.ArgumentParser(description='Runs regressions in this folder.') + parser.add_argument('--verifier', dest='verifier', choices=['boogie', 'corral', 'duality'], default=['boogie'], nargs='*', + help='choose verifiers to be used') + args = parser.parse_args() + + for verifier in args.verifier: + print '\nRunning regressions using', verifier + passed, failed = runtests(verifier) + + print '\nPASSED count: ', passed + print 'FAILED count: ', failed diff --git a/examples/svcomp/ntdrivers/regtest-corral.py b/examples/svcomp/ntdrivers/regtest-corral.py deleted file mode 100755 index eca2abfdc..000000000 --- a/examples/svcomp/ntdrivers/regtest-corral.py +++ /dev/null @@ -1,59 +0,0 @@ -#! /usr/bin/env python - -import subprocess -import re -import time - -# list of regression tests with the expected outputs -tests = [ - ('cdaudio_true.i.cil', r'Program has no bugs'), - ('diskperf_true.i.cil', r'Program has no bugs'), - ('diskperf_false.i.cil', r'This assertion can fail'), - ('floppy2_true.i.cil', r'Program has no bugs'), - ('floppy_true.i.cil', r'Program has no bugs'), - ('floppy_false.i.cil', r'This assertion can fail'), - ('kbfiltr_false.i.cil', r'This assertion can fail'), - ('parport_true.i.cil', r'Program has no bugs'), - ('parport_false.i.cil', r'This assertion can fail') -] - -def red(text): - return '\033[0;31m' + text + '\033[0m' - -def green(text): - return '\033[0;32m' + text + '\033[0m' - -def runtests(): - passed = failed = 0 - for test in tests: - - for mem in ['no-reuse', 'no-reuse-impls', 'reuse']: - - print "{0:>25} {1:>16}:".format(test[0], "(" + mem + ")"), - - # invoke SMACK - t0 = time.time() - p = subprocess.Popen(['smackverify.py', test[0] + '.c', '--verifier=corral', - '--mem-mod=' + mem, '--unroll=2', '--clang=-w', '-o', test[0] +'.bpl'], - stdout=subprocess.PIPE) - - smackOutput = p.communicate()[0] - elapsed = time.time() - t0 - - # check SMACK output - if re.search(test[1], smackOutput): - print green('PASSED') + ' [%.2fs]' % round(elapsed, 2) - passed += 1 - else: - print red('FAILED') - failed += 1 - - return passed, failed - -if __name__ == '__main__': - - passed, failed = runtests() - - print '\nPASSED count: ', passed - print 'FAILED count: ', failed - diff --git a/examples/svcomp/ntdrivers/regtest.py b/examples/svcomp/ntdrivers/regtest.py index 3e4cb735d..1770f9366 100755 --- a/examples/svcomp/ntdrivers/regtest.py +++ b/examples/svcomp/ntdrivers/regtest.py @@ -2,19 +2,23 @@ import subprocess import re +import argparse import time +from collections import namedtuple + +RegTest = namedtuple('RegTest', 'name boogie corral duality unroll') # list of regression tests with the expected outputs tests = [ - ('cdaudio_true.i.cil', r'1 verified, 0 errors?'), -# ('diskperf_true.i.cil', r'1 verified, 0 errors?'), -# ('diskperf_false.i.cil', r'0 verified, 1 errors?'), - ('floppy2_true.i.cil', r'1 verified, 0 errors?'), - ('floppy_true.i.cil', r'1 verified, 0 errors?'), - ('floppy_false.i.cil', r'0 verified, 1 errors?'), - ('kbfiltr_false.i.cil', r'0 verified, 1 errors?'), - ('parport_true.i.cil', r'1 verified, 0 errors?'), - ('parport_false.i.cil', r'0 verified, 1 errors?') + RegTest('cdaudio_true.i.cil', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), + RegTest('diskperf_true.i.cil', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), + RegTest('diskperf_false.i.cil', r'0 verified, 1 errors?', r'This assertion can fail', r'This assertion can fail', 2), + RegTest('floppy2_true.i.cil', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), + RegTest('floppy_true.i.cil', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), + RegTest('floppy_false.i.cil', r'0 verified, 1 errors?', r'This assertion can fail', r'This assertion can fail', 2), + RegTest('kbfiltr_false.i.cil', r'0 verified, 1 errors?', r'This assertion can fail', r'This assertion can fail', 2), + RegTest('parport_true.i.cil', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), + RegTest('parport_false.i.cil', r'0 verified, 1 errors?', r'This assertion can fail', r'This assertion can fail', 2) ] def red(text): @@ -23,37 +27,45 @@ def red(text): def green(text): return '\033[0;32m' + text + '\033[0m' -def runtests(): +def runtests(verifier): passed = failed = 0 for test in tests: - + for mem in ['no-reuse', 'no-reuse-impls', 'reuse']: - - print "{0:>25} {1:>16}:".format(test[0], "(" + mem + ")"), + + print "{0:>25} {1:>16}:".format(test.name, "(" + mem + ")"), # invoke SMACK t0 = time.time() - p = subprocess.Popen(['smackverify.py', test[0] + '.c', '--verifier=boogie', - '--mem-mod=' + mem, '--unroll=2', '--clang=-w', '-o', test[0] +'.bpl'], + p = subprocess.Popen(['smackverify.py', test.name + '.c', '--verifier=' + verifier, + '--unroll=' + str(test.unroll), '--mem-mod=' + mem, '-o', test.name +'.bpl'], stdout=subprocess.PIPE) - + smackOutput = p.communicate()[0] elapsed = time.time() - t0 # check SMACK output - if re.search(test[1], smackOutput): + if re.search(getattr(test, verifier), smackOutput): print green('PASSED') + ' [%.2fs]' % round(elapsed, 2) passed += 1 else: print red('FAILED') failed += 1 - + return passed, failed if __name__ == '__main__': - passed, failed = runtests() + # parse command line arguments + parser = argparse.ArgumentParser(description='Runs regressions in this folder.') + parser.add_argument('--verifier', dest='verifier', choices=['boogie', 'corral', 'duality'], default=['boogie'], nargs='*', + help='choose verifiers to be used') + args = parser.parse_args() - print '\nPASSED count: ', passed - print 'FAILED count: ', failed + for verifier in args.verifier: + print '\nRunning regressions using', verifier + passed, failed = runtests(verifier) + + print '\nPASSED count: ', passed + print 'FAILED count: ', failed diff --git a/test/regtest-corral.py b/test/regtest-corral.py deleted file mode 100755 index 9b0d9c319..000000000 --- a/test/regtest-corral.py +++ /dev/null @@ -1,130 +0,0 @@ -#! /usr/bin/env python - -import subprocess -import re -import time - -# list of regression tests with the expected outputs -tests = [ - ('simple', r'Program has no bugs', 2), - ('simple_fail', r'This assertion can fail', 2), - ('simple_pre', r'Program has no bugs', 2), - ('simple_pre_fail', r'This assertion can fail', 2), - ('simple_pre1', r'Program has no bugs', 2), - ('simple_pre1_fail', r'This assertion can fail', 2), - ('simple_pre2', r'Program has no bugs', 2), - ('simple_pre2_fail', r'This assertion can fail', 2), - ('simple_pre3', r'Program has no bugs', 2), - ('simple_pre3_fail', r'This assertion can fail', 2), -# ('simple_double_free', r'This assertion can fail', 2), - ('pointers', r'Program has no bugs', 2), - ('pointers_fail', r'This assertion can fail', 2), - ('pointers1', r'Program has no bugs', 2), - ('pointers1_fail', r'This assertion can fail', 2), - ('pointers2', r'Program has no bugs', 2), - ('pointers2_fail', r'This assertion can fail', 2), - ('pointers3', r'Program has no bugs', 2), - ('pointers3_fail', r'This assertion can fail', 2), - ('globals', r'Program has no bugs', 2), - ('globals_fail', r'This assertion can fail', 2), - ('loop', r'Program has no bugs', 11), - ('loop_fail', r'This assertion can fail', 11), - ('loop1', r'Program has no bugs', 11), - ('loop1_fail', r'This assertion can fail', 11), - ('nondet', r'Program has no bugs', 2), - ('printfs', r'Program has no bugs', 2), - ('struct_return', r'Program has no bugs', 2), - ('struct_init', r'Program has no bugs', 2), - ('struct_init_fail', r'This assertion can fail', 2), - ('extern_struct', r'This assertion can fail', 2), - ('extern_func', r'Program has no bugs', 2), - ('extern_mem', r'Program has no bugs', 2), - ('extern_mem_fail', r'This assertion can fail', 2), - ('smack_code_call', r'Program has no bugs', 2), - ('smack_code_call_fail', r'This assertion can fail', 2), - ('return_label', r'Program has no bugs', 2), - ('struct_cast', r'Program has no bugs', 2), - ('struct_cast_fail', r'This assertion can fail', 2), - ('struct_cast1', r'Program has no bugs', 2), - ('struct_cast1_fail', r'This assertion can fail', 2), - ('nested_struct', r'Program has no bugs', 2), - ('nested_struct_fail', r'This assertion can fail', 2), - ('nested_struct1', r'Program has no bugs', 2), - ('nested_struct1_fail', r'This assertion can fail', 2), - ('nested_struct2', r'Program has no bugs', 2), - ('nested_struct2_fail', r'This assertion can fail', 2), - ('struct_assign', r'Program has no bugs', 2), - ('struct_assign_fail', r'This assertion can fail', 2), - ('func_ptr', r'Program has no bugs', 2), - ('func_ptr_fail', r'This assertion can fail', 2), - ('func_ptr1', r'Program has no bugs', 2), - ('func_ptr1_fail', r'This assertion can fail', 2), - ('array', r'Program has no bugs', 2), - ('array1', r'Program has no bugs', 2), - ('array1_fail', r'This assertion can fail', 2), - ('array2', r'Program has no bugs', 11), - ('array2_fail', r'This assertion can fail', 11), - ('array3', r'Program has no bugs', 11), - ('array3_fail', r'This assertion can fail', 11), - ('array4', r'Program has no bugs', 11), - ('array4_fail', r'This assertion can fail', 11), -# ('array_free', r'Program has no bugs', 11), -# ('array_free_fail', r'This assertion can fail', 11), -# ('array_free1', r'Program has no bugs', 11), -# ('array_free1_fail', r'This assertion can fail', 11), -# ('array_free2', r'Program has no bugs', 11), -# ('array_free2_fail', r'This assertion can fail', 11), - ('lock', r'Program has no bugs', 2), - ('lock_fail', r'This assertion can fail', 2), - ('ase_example', r'Program has no bugs', 11), - ('ase_example_fail', r'This assertion can fail', 11), - ('two_arrays', r'Program has no bugs', 2), - ('two_arrays1', r'Program has no bugs', 2), - ('two_arrays2', r'Program has no bugs', 2), - ('two_arrays3', r'Program has no bugs', 2), - ('two_arrays4', r'Program has no bugs', 2), - ('two_arrays5', r'Program has no bugs', 2), - ('two_arrays6', r'Program has no bugs', 2), - ('two_arrays6_fail', r'This assertion can fail', 2) -] - -def red(text): - return '\033[0;31m' + text + '\033[0m' - -def green(text): - return '\033[0;32m' + text + '\033[0m' - -def runtests(): - passed = failed = 0 - for test in tests: - - for mem in ['no-reuse', 'no-reuse-impls', 'reuse']: - - print "{0:>20} {1:>16}:".format(test[0], "(" + mem + ")"), - - # invoke SMACK - t0 = time.time() - p = subprocess.Popen(['smackverify.py', test[0] + '.c', '--verifier=corral', - '--unroll=' + str(test[2]), '--mem-mod=' + mem, '-o', test[0] +'.bpl'], - stdout=subprocess.PIPE) - - smackOutput = p.communicate()[0] - elapsed = time.time() - t0 - - # check SMACK output - if re.search(test[1], smackOutput): - print green('PASSED') + ' [%.2fs]' % round(elapsed, 2) - passed += 1 - else: - print red('FAILED') - failed += 1 - - return passed, failed - -if __name__ == '__main__': - - passed, failed = runtests() - - print '\nPASSED count: ', passed - print 'FAILED count: ', failed - diff --git a/test/regtest.py b/test/regtest.py index 603103aa4..7d9242192 100755 --- a/test/regtest.py +++ b/test/regtest.py @@ -2,117 +2,121 @@ import subprocess import re +import argparse import time +from collections import namedtuple + +RegTest = namedtuple('RegTest', 'name boogie corral duality unroll') # list of regression tests with the expected outputs tests = [ - ('simple', r'1 verified, 0 errors?', 2), - ('simple_fail', r'0 verified, 1 errors?', 2), - ('simple_pre', r'1 verified, 0 errors?', 2), - ('simple_pre_fail', r'0 verified, 1 errors?', 2), - ('simple_pre1', r'1 verified, 0 errors?', 2), - ('simple_pre1_fail', r'0 verified, 1 errors?', 2), - ('simple_pre2', r'1 verified, 0 errors?', 2), - ('simple_pre2_fail', r'0 verified, 1 errors?', 2), - ('simple_pre3', r'1 verified, 0 errors?', 2), - ('simple_pre3_fail', r'0 verified, 1 errors?', 2), -# ('simple_double_free', r'0 verified, 1 errors?', 2), - ('pointers', r'1 verified, 0 errors?', 2), - ('pointers_fail', r'0 verified, 1 errors?', 2), - ('pointers1', r'1 verified, 0 errors?', 2), - ('pointers1_fail', r'0 verified, 1 errors?', 2), - ('pointers2', r'1 verified, 0 errors?', 2), - ('pointers2_fail', r'0 verified, 1 errors?', 2), - ('pointers3', r'1 verified, 0 errors?', 2), - ('pointers3_fail', r'0 verified, 1 errors?', 2), - ('globals', r'1 verified, 0 errors?', 2), - ('globals_fail', r'0 verified, 1 errors?', 2), - ('loop', r'1 verified, 0 errors?', 11), - ('loop_fail', r'0 verified, 1 errors?', 11), - ('loop1', r'1 verified, 0 errors?', 11), - ('loop1_fail', r'0 verified, 1 errors?', 11), - ('nondet', r'1 verified, 0 errors?', 2), - ('printfs', r'1 verified, 0 errors?', 2), - ('struct_return', r'1 verified, 0 errors?', 2), - ('struct_init', r'1 verified, 0 errors?', 2), - ('struct_init_fail', r'0 verified, 1 errors?', 2), - ('extern_struct', r'0 verified, 1 errors?', 2), - ('extern_func', r'1 verified, 0 errors?', 2), - ('extern_mem', r'1 verified, 0 errors?', 2), - ('extern_mem_fail', r'0 verified, 1 errors?', 2), - ('smack_code_call', r'1 verified, 0 errors?', 2), - ('smack_code_call_fail', r'0 verified, 1 errors?', 2), - ('return_label', r'1 verified, 0 errors?', 2), - ('struct_cast', r'1 verified, 0 errors?', 2), - ('struct_cast_fail', r'0 verified, 1 errors?', 2), - ('struct_cast1', r'1 verified, 0 errors?', 2), - ('struct_cast1_fail', r'0 verified, 1 errors?', 2), - ('nested_struct', r'1 verified, 0 errors?', 2), - ('nested_struct_fail', r'0 verified, 1 errors?', 2), - ('nested_struct1', r'1 verified, 0 errors?', 2), - ('nested_struct1_fail', r'0 verified, 1 errors?', 2), - ('nested_struct2', r'1 verified, 0 errors?', 2), - ('nested_struct2_fail', r'0 verified, 1 errors?', 2), - ('struct_assign', r'1 verified, 0 errors?', 2), - ('struct_assign_fail', r'0 verified, 1 errors?', 2), - ('func_ptr', r'1 verified, 0 errors?', 2), - ('func_ptr_fail', r'0 verified, 1 errors?', 2), - ('func_ptr1', r'1 verified, 0 errors?', 2), - ('func_ptr1_fail', r'0 verified, 1 errors?', 2), - ('array', r'1 verified, 0 errors?', 2), - ('array1', r'1 verified, 0 errors?', 2), - ('array1_fail', r'0 verified, 1 errors?', 2), - ('array2', r'1 verified, 0 errors?', 11), - ('array2_fail', r'0 verified, 1 errors?', 11), - ('array3', r'1 verified, 0 errors?', 11), - ('array3_fail', r'0 verified, 1 errors?', 11), - ('array4', r'1 verified, 0 errors?', 11), - ('array4_fail', r'0 verified, 1 errors?', 11), -# ('array_free', r'1 verified, 0 errors?', 11), -# ('array_free_fail', r'0 verified, 3 errors?', 11), -# ('array_free1', r'1 verified, 0 errors?', 11), -# ('array_free1_fail', r'0 verified, 4 errors?', 11), -# ('array_free2', r'1 verified, 0 errors?', 11), -# ('array_free2_fail', r'0 verified, 5 errors?', 11), - ('lock', r'1 verified, 0 errors?', 2), - ('lock_fail', r'0 verified, 1 errors?', 2), - ('ase_example', r'1 verified, 0 errors?', 11), - ('ase_example_fail', r'0 verified, 1 errors?', 11), - ('two_arrays', r'1 verified, 0 errors?', 2), - ('two_arrays1', r'1 verified, 0 errors?', 2), - ('two_arrays2', r'1 verified, 0 errors?', 2), - ('two_arrays3', r'1 verified, 0 errors?', 2), - ('two_arrays4', r'1 verified, 0 errors?', 2), - ('two_arrays5', r'1 verified, 0 errors?', 2), - ('two_arrays6', r'1 verified, 0 errors?', 2), - ('two_arrays6_fail', r'0 verified, 1 errors?', 2) + RegTest('simple', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), + RegTest('simple_fail', r'0 verified, 1 errors?', r'This assertion can fail', r'This assertion can fail', 2), + RegTest('simple_pre', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), + RegTest('simple_pre_fail', r'0 verified, 1 errors?', r'This assertion can fail', r'This assertion can fail', 2), + RegTest('simple_pre1', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), + RegTest('simple_pre1_fail', r'0 verified, 1 errors?', r'This assertion can fail', r'This assertion can fail', 2), + RegTest('simple_pre2', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), + RegTest('simple_pre2_fail', r'0 verified, 1 errors?', r'This assertion can fail', r'This assertion can fail', 2), + RegTest('simple_pre3', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), + RegTest('simple_pre3_fail', r'0 verified, 1 errors?', r'This assertion can fail', r'This assertion can fail', 2), +# RegTest('simple_double_free', r'0 verified, 1 errors?', r'This assertion can fail', r'This assertion can fail', 2), + RegTest('pointers', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), + RegTest('pointers_fail', r'0 verified, 1 errors?', r'This assertion can fail', r'This assertion can fail', 2), + RegTest('pointers1', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), + RegTest('pointers1_fail', r'0 verified, 1 errors?', r'This assertion can fail', r'This assertion can fail', 2), + RegTest('pointers2', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), + RegTest('pointers2_fail', r'0 verified, 1 errors?', r'This assertion can fail', r'This assertion can fail', 2), + RegTest('pointers3', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), + RegTest('pointers3_fail', r'0 verified, 1 errors?', r'This assertion can fail', r'This assertion can fail', 2), + RegTest('globals', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), + RegTest('globals_fail', r'0 verified, 1 errors?', r'This assertion can fail', r'This assertion can fail', 2), + RegTest('loop', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 11), + RegTest('loop_fail', r'0 verified, 1 errors?', r'This assertion can fail', r'This assertion can fail', 11), + RegTest('loop1', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 11), + RegTest('loop1_fail', r'0 verified, 1 errors?', r'This assertion can fail', r'This assertion can fail', 11), + RegTest('nondet', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), + RegTest('printfs', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), + RegTest('struct_return', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), + RegTest('struct_init', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), + RegTest('struct_init_fail', r'0 verified, 1 errors?', r'This assertion can fail', r'This assertion can fail', 2), + RegTest('extern_struct', r'0 verified, 1 errors?', r'This assertion can fail', r'This assertion can fail', 2), + RegTest('extern_func', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), + RegTest('extern_mem', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), + RegTest('extern_mem_fail', r'0 verified, 1 errors?', r'This assertion can fail', r'This assertion can fail', 2), + RegTest('smack_code_call', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), + RegTest('smack_code_call_fail', r'0 verified, 1 errors?', r'This assertion can fail', r'This assertion can fail', 2), + RegTest('return_label', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), + RegTest('struct_cast', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), + RegTest('struct_cast_fail', r'0 verified, 1 errors?', r'This assertion can fail', r'This assertion can fail', 2), + RegTest('struct_cast1', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), + RegTest('struct_cast1_fail', r'0 verified, 1 errors?', r'This assertion can fail', r'This assertion can fail', 2), + RegTest('nested_struct', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), + RegTest('nested_struct_fail', r'0 verified, 1 errors?', r'This assertion can fail', r'This assertion can fail', 2), + RegTest('nested_struct1', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), + RegTest('nested_struct1_fail', r'0 verified, 1 errors?', r'This assertion can fail', r'This assertion can fail', 2), + RegTest('nested_struct2', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), + RegTest('nested_struct2_fail', r'0 verified, 1 errors?', r'This assertion can fail', r'This assertion can fail', 2), + RegTest('struct_assign', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), + RegTest('struct_assign_fail', r'0 verified, 1 errors?', r'This assertion can fail', r'This assertion can fail', 2), + RegTest('func_ptr', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), + RegTest('func_ptr_fail', r'0 verified, 1 errors?', r'This assertion can fail', r'This assertion can fail', 2), + RegTest('func_ptr1', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), + RegTest('func_ptr1_fail', r'0 verified, 1 errors?', r'This assertion can fail', r'This assertion can fail', 2), + RegTest('array', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), + RegTest('array1', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), + RegTest('array1_fail', r'0 verified, 1 errors?', r'This assertion can fail', r'This assertion can fail', 2), + RegTest('array2', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 11), + RegTest('array2_fail', r'0 verified, 1 errors?', r'This assertion can fail', r'This assertion can fail', 11), + RegTest('array3', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 11), + RegTest('array3_fail', r'0 verified, 1 errors?', r'This assertion can fail', r'This assertion can fail', 11), + RegTest('array4', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 11), + RegTest('array4_fail', r'0 verified, 1 errors?', r'This assertion can fail', r'This assertion can fail', 11), +# RegTest('array_free', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 11), +# RegTest('array_free_fail', r'0 verified, 3 errors?', r'This assertion can fail', r'This assertion can fail', 11), +# RegTest('array_free1', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 11), +# RegTest('array_free1_fail', r'0 verified, 4 errors?', r'This assertion can fail', r'This assertion can fail', 11), +# RegTest('array_free2', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 11), +# RegTest('array_free2_fail', r'0 verified, 5 errors?', r'This assertion can fail', r'This assertion can fail', 11), + RegTest('lock', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), + RegTest('lock_fail', r'0 verified, 1 errors?', r'This assertion can fail', r'This assertion can fail', 2), + RegTest('ase_example', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 11), + RegTest('ase_example_fail', r'0 verified, 1 errors?', r'This assertion can fail', r'This assertion can fail', 11), + RegTest('two_arrays', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), + RegTest('two_arrays1', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), + RegTest('two_arrays2', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), + RegTest('two_arrays3', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), + RegTest('two_arrays4', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), + RegTest('two_arrays5', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), + RegTest('two_arrays6', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), + RegTest('two_arrays6_fail', r'0 verified, 1 errors?', r'This assertion can fail', r'This assertion can fail', 2) ] def red(text): return '\033[0;31m' + text + '\033[0m' - + def green(text): return '\033[0;32m' + text + '\033[0m' -def runtests(): +def runtests(verifier): passed = failed = 0 for test in tests: for mem in ['no-reuse', 'no-reuse-impls', 'reuse']: - print "{0:>20} {1:>16}:".format(test[0], "(" + mem + ")"), + print "{0:>25} {1:>16}:".format(test.name, "(" + mem + ")"), # invoke SMACK t0 = time.time() - p = subprocess.Popen(['smackverify.py', test[0] + '.c', '--verifier=boogie', - '--unroll=' + str(test[2]), '--mem-mod=' + mem, '-o', test[0] +'.bpl'], + p = subprocess.Popen(['smackverify.py', test.name + '.c', '--verifier=' + verifier, + '--unroll=' + str(test.unroll), '--mem-mod=' + mem, '-o', test.name +'.bpl'], stdout=subprocess.PIPE) smackOutput = p.communicate()[0] elapsed = time.time() - t0 # check SMACK output - if re.search(test[1], smackOutput): + if re.search(getattr(test, verifier), smackOutput): print green('PASSED') + ' [%.2fs]' % round(elapsed, 2) passed += 1 else: @@ -123,8 +127,16 @@ def runtests(): if __name__ == '__main__': - passed, failed = runtests() + # parse command line arguments + parser = argparse.ArgumentParser(description='Runs regressions in this folder.') + parser.add_argument('--verifier', dest='verifier', choices=['boogie', 'corral', 'duality'], default=['boogie'], nargs='*', + help='choose verifiers to be used') + args = parser.parse_args() + + for verifier in args.verifier: + print '\nRunning regressions using', verifier + passed, failed = runtests(verifier) - print '\nPASSED count: ', passed - print 'FAILED count: ', failed + print '\nPASSED count: ', passed + print 'FAILED count: ', failed From 6114a7aa34c4212d5507099b2ed861a0760e0a2e Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Wed, 20 Aug 2014 11:52:08 -0600 Subject: [PATCH 050/140] Added command line option --bc to specify the generated bc file name. --- bin/smackgen.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/bin/smackgen.py b/bin/smackgen.py index 581ff56fa..caf63aa40 100755 --- a/bin/smackgen.py +++ b/bin/smackgen.py @@ -20,6 +20,8 @@ def smackParser(): help='specify entry procedures') parser.add_argument('--unroll', metavar='N', dest='unroll', type=int, help='unroll loops/recursion in Boogie/Corral N number of times') + parser.add_argument('--bc', dest='bcfile', metavar='', type=str, + help='output clang (bc) file') return parser @@ -43,20 +45,21 @@ def addEntryPoint(match, entryPoints): return procDef -def clang(scriptPathName, inputFile, outputFileName, memoryModel, clangArgs): +def clang(scriptPathName, inputFile, bcFileName, outputFileName, memoryModel, clangArgs): scriptFullPath = path.abspath(scriptPathName) smackRoot = path.dirname(scriptFullPath) smackHeaders = path.join(smackRoot, 'include', 'smack') - fileName = path.join(path.dirname(path.abspath(outputFileName)), - path.splitext(path.basename(inputFile.name))[0]) + '.bc' + if bcFileName is None: + bcFileName = path.join(path.dirname(path.abspath(outputFileName)), + path.splitext(path.basename(inputFile.name))[0]) + '.bc' clangCommand = ['clang'] clangCommand += ['-c', '-emit-llvm', '-O0', '-g', '-gcolumn-info', '-DMEMORY_MODEL_' + memoryModel.upper().replace('-','_'), '-I' + smackHeaders] clangCommand += clangArgs.split() - clangCommand += [inputFile.name, '-o', fileName] + clangCommand += [inputFile.name, '-o', bcFileName] #Redirect stderr to stdout, then grab stdout (communicate() calls wait()) #This should more or less maintain stdout/stderr interleaving order #However, this will be problematic if any callers want to differentiate @@ -69,8 +72,7 @@ def clang(scriptPathName, inputFile, outputFileName, memoryModel, clangArgs): print clangOutput sys.exit("SMACK encountered a clang error. Exiting...") - inputFileName = path.join(path.curdir, fileName) - inputFile = open(inputFileName, 'r') + inputFile = open(bcFileName, 'r') return inputFile, clangOutput @@ -93,7 +95,7 @@ def smackGenerate(sysArgv): if optionsMatch: options = optionsMatch.group(1).split() args = parser.parse_args(options + sysArgv[1:]) - inputFile, clangOutput = clang(scriptPathName, inputFile, args.outfile, args.memmod, args.clang) + inputFile, clangOutput = clang(scriptPathName, inputFile, args.bcfile, args.outfile, args.memmod, args.clang) bpl = llvm2bpl(inputFile, args.outfile, args.debug, "impls" in args.memmod) inputFile.close() From 6f7a1ccfde7774f6660419d013df48b01e1d1e1e Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Wed, 27 Aug 2014 20:27:17 -0600 Subject: [PATCH 051/140] Updated build scripts to use cleaned up regressions scripts. --- bin/build-cygwin-cmake.sh | 3 +-- bin/build-cygwin.sh | 3 +-- bin/build-linux-cmake.sh | 3 +-- bin/build-linux-ubuntu_1404.sh | 3 +-- bin/build-linux.sh | 3 +-- 5 files changed, 5 insertions(+), 10 deletions(-) diff --git a/bin/build-cygwin-cmake.sh b/bin/build-cygwin-cmake.sh index 9e997ce9f..d0c476cc3 100755 --- a/bin/build-cygwin-cmake.sh +++ b/bin/build-cygwin-cmake.sh @@ -99,8 +99,7 @@ export PATH=${SMACK_DIR}/install/bin:$PATH # Run SMACK regressions cd ${SMACK_DIR}/src/test make -./regtest.py -./regtest-corral.py +./regtest.py --verifier {boogie,corral,duality} cd ${BASE_DIR} diff --git a/bin/build-cygwin.sh b/bin/build-cygwin.sh index 467fcfc7d..6a90bf3fe 100755 --- a/bin/build-cygwin.sh +++ b/bin/build-cygwin.sh @@ -99,8 +99,7 @@ export PATH=${SMACK_DIR}/install/bin:$PATH # Run SMACK regressions cd ${SMACK_DIR}/src/test make -./regtest.py -./regtest-corral.py +./regtest.py --verifier {boogie,corral,duality} cd ${BASE_DIR} diff --git a/bin/build-linux-cmake.sh b/bin/build-linux-cmake.sh index 0f9494e0e..7b02052c8 100755 --- a/bin/build-linux-cmake.sh +++ b/bin/build-linux-cmake.sh @@ -258,8 +258,7 @@ export PATH=${SMACK_DIR}/install/bin:$PATH # Run SMACK regressions cd ${SMACK_DIR}/src/test make -./regtest.py -./regtest-corral.py +./regtest.py --verifier {boogie,corral,duality} cd ${BASE_DIR} diff --git a/bin/build-linux-ubuntu_1404.sh b/bin/build-linux-ubuntu_1404.sh index cd3174574..44d78a190 100755 --- a/bin/build-linux-ubuntu_1404.sh +++ b/bin/build-linux-ubuntu_1404.sh @@ -212,8 +212,7 @@ export PATH=${SMACK_DIR}/install/bin:$PATH # Run SMACK regressions cd ${SMACK_DIR}/src/test make -./regtest.py -./regtest-corral.py +./regtest.py --verifier {boogie,corral,duality} cd ${BASE_DIR} diff --git a/bin/build-linux.sh b/bin/build-linux.sh index a71c3808f..3f1341bb7 100755 --- a/bin/build-linux.sh +++ b/bin/build-linux.sh @@ -245,8 +245,7 @@ export PATH=${SMACK_DIR}/install/bin:$PATH # Run SMACK regressions cd ${SMACK_DIR}/src/test make -./regtest.py -./regtest-corral.py +./regtest.py --verifier {boogie,corral,duality} cd ${BASE_DIR} From 622b52d62bdeb0457b3c127a7acf78435d6c5e70 Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Fri, 29 Aug 2014 15:52:13 -0600 Subject: [PATCH 052/140] Implemented support for CompareConstantExpr. --- include/smack/SmackRep.h | 2 +- lib/smack/SmackInstGenerator.cpp | 4 ++-- lib/smack/SmackRep.cpp | 21 ++++++++++++++++----- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/include/smack/SmackRep.h b/include/smack/SmackRep.h index 4cbc3c889..0b45427fe 100644 --- a/include/smack/SmackRep.h +++ b/include/smack/SmackRep.h @@ -191,7 +191,7 @@ class SmackRep { const Expr* expr(const llvm::Value* v); string getString(const llvm::Value* v); const Expr* op(const llvm::User* v); - const Expr* pred(llvm::CmpInst& ci); + const Expr* pred(const llvm::User* v); const Expr* arg(llvm::Function* f, unsigned pos, llvm::Value* v); const Stmt* call(llvm::Function* f, llvm::CallInst& ci); diff --git a/lib/smack/SmackInstGenerator.cpp b/lib/smack/SmackInstGenerator.cpp index a0c9f289d..040245e30 100644 --- a/lib/smack/SmackInstGenerator.cpp +++ b/lib/smack/SmackInstGenerator.cpp @@ -422,12 +422,12 @@ void SmackInstGenerator::visitBitCastInst(llvm::BitCastInst& ci) { void SmackInstGenerator::visitICmpInst(llvm::ICmpInst& ci) { processInstruction(ci); - currBlock->addStmt(Stmt::assign(rep.expr(&ci), rep.pred(ci))); + currBlock->addStmt(Stmt::assign(rep.expr(&ci), rep.pred(&ci))); } void SmackInstGenerator::visitFCmpInst(llvm::FCmpInst& ci) { processInstruction(ci); - currBlock->addStmt(Stmt::assign(rep.expr(&ci), rep.pred(ci))); + currBlock->addStmt(Stmt::assign(rep.expr(&ci), rep.pred(&ci))); } void SmackInstGenerator::visitPHINode(llvm::PHINode& phi) { diff --git a/lib/smack/SmackRep.cpp b/lib/smack/SmackRep.cpp index 26b819472..e3e844713 100644 --- a/lib/smack/SmackRep.cpp +++ b/lib/smack/SmackRep.cpp @@ -473,6 +473,9 @@ const Expr* SmackRep::expr(const llvm::Value* v) { else if (Instruction::isBinaryOp(constantExpr->getOpcode())) return op(constantExpr); + else if (constantExpr->isCompare()) + return pred(constantExpr); + else { DEBUG(errs() << "VALUE : " << *v << "\n"); assert(false && "constant expression of this type not supported"); @@ -601,14 +604,22 @@ const Expr* SmackRep::op(const llvm::User* v) { return isBool(v) ? Expr::fn("$i2b",e) : e; } -const Expr* SmackRep::pred(llvm::CmpInst& ci) { +const Expr* SmackRep::pred(const llvm::User* v) { + using namespace llvm; const Expr* e = NULL; string o; - const Expr - *l = expr(ci.getOperand(0)), - *r = expr(ci.getOperand(1)); + unsigned predicate; + const Expr *l = expr(v->getOperand(0)), *r = expr(v->getOperand(1)); + + if (const CmpInst* ci = dyn_cast(v)) + predicate = ci->getPredicate(); + + else if (const ConstantExpr* ce = dyn_cast(v)) + predicate = ce->getPredicate(); + + else assert(false && "unexpected operator value."); - switch (ci.getPredicate()) { + switch (predicate) { using llvm::CmpInst; // integer comparison From 5e782aba823c028631f6072bc95d16c8bf7bb111 Mon Sep 17 00:00:00 2001 From: snoopsmsc Date: Mon, 1 Sep 2014 13:29:37 -0700 Subject: [PATCH 053/140] Bug fix for __SMACK_code() when '@' is first char in source string --- lib/smack/SmackRep.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/smack/SmackRep.cpp b/lib/smack/SmackRep.cpp index e3e844713..e57027ca8 100644 --- a/lib/smack/SmackRep.cpp +++ b/lib/smack/SmackRep.cpp @@ -800,7 +800,7 @@ string SmackRep::code(llvm::CallInst& ci) { ostringstream ss; - if (s.find("{@}") == idx-1) { + if (s.find("{@}") == idx-1 && idx != 0) { a->print(ss); s = s.replace(idx-1,3,ss.str()); From 5c513d1912e200d4ac6f4a42fb4b54b8248024fc Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Mon, 1 Sep 2014 17:39:31 -0600 Subject: [PATCH 054/140] Got rid of the obsolete {@} that was used with our two-dim memory model that does not exist any more. --- include/smack/smack.h | 4 ++-- lib/smack/SmackRep.cpp | 11 ++--------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/include/smack/smack.h b/include/smack/smack.h index 01a715d53..cc64f6f0b 100644 --- a/include/smack/smack.h +++ b/include/smack/smack.h @@ -38,11 +38,11 @@ void __SMACK_decl(const char *fmt, ...); void __SMACK_top_decl(const char *fmt, ...); void __SMACK_assert(bool v) { - __SMACK_code("assert {@} != 0;", v); + __SMACK_code("assert @ != 0;", v); } void __SMACK_assume(bool v) { - __SMACK_code("assume {@} != 0;", v); + __SMACK_code("assume @ != 0;", v); } // void __SMACK_record_int(int i) { diff --git a/lib/smack/SmackRep.cpp b/lib/smack/SmackRep.cpp index e57027ca8..6a898b537 100644 --- a/lib/smack/SmackRep.cpp +++ b/lib/smack/SmackRep.cpp @@ -799,15 +799,8 @@ string SmackRep::code(llvm::CallInst& ci) { assert(idx != string::npos && "__SMACK_code: too many arguments."); ostringstream ss; - - if (s.find("{@}") == idx-1 && idx != 0) { - a->print(ss); - s = s.replace(idx-1,3,ss.str()); - - } else { - a->print(ss); - s = s.replace(idx,1,ss.str()); - } + a->print(ss); + s = s.replace(idx,1,ss.str()); } return s; } From 8d0ee29c2c93fe1f267c17b3c9d54cd2ee14250e Mon Sep 17 00:00:00 2001 From: Michael Emmi Date: Sat, 13 Sep 2014 18:08:56 +0200 Subject: [PATCH 055/140] Updated to LLVM 3.5.0. --- Makefile.llvm.rules | 723 +++++++++------------- include/assistDS/DataStructureCallGraph.h | 10 +- include/assistDS/Devirt.h | 6 +- include/assistDS/Int2PtrCmp.h | 4 +- include/assistDS/SimplifyGEP.h | 4 +- include/assistDS/TypeChecks.h | 10 +- include/assistDS/TypeChecksOpt.h | 2 +- include/dsa/CallTargets.h | 2 +- include/dsa/DSCallGraph.h | 2 +- include/dsa/DSSupport.h | 2 +- include/dsa/DataStructure.h | 12 +- include/dsa/TypeSafety.h | 4 +- include/smack/DSAAliasAnalysis.h | 2 +- include/smack/SmackInstGenerator.h | 2 +- include/smack/SmackModuleGenerator.h | 4 +- include/smack/SmackRep.h | 4 +- lib/AssistDS/ArgCast.cpp | 6 +- lib/AssistDS/ArgSimplify.cpp | 6 +- lib/AssistDS/DSNodeEquivs.cpp | 12 +- lib/AssistDS/DataStructureCallGraph.cpp | 6 +- lib/AssistDS/Devirt.cpp | 2 +- lib/AssistDS/DynCount.cpp | 2 +- lib/AssistDS/FuncSpec.cpp | 2 +- lib/AssistDS/GEPExprArgs.cpp | 4 +- lib/AssistDS/IndCloner.cpp | 6 +- lib/AssistDS/Int2PtrCmp.cpp | 4 +- lib/AssistDS/LoadArgs.cpp | 4 +- lib/AssistDS/MergeGEP.cpp | 2 +- lib/AssistDS/SVADevirt.cpp | 4 +- lib/AssistDS/SimplifyExtractValue.cpp | 2 +- lib/AssistDS/SimplifyGEP.cpp | 4 +- lib/AssistDS/SimplifyInsertValue.cpp | 2 +- lib/AssistDS/SimplifyLoad.cpp | 2 +- lib/AssistDS/StructReturnToPointer.cpp | 4 +- lib/AssistDS/TypeChecks.cpp | 30 +- lib/AssistDS/TypeChecksOpt.cpp | 20 +- lib/DSA/AddressTakenAnalysis.cpp | 8 +- lib/DSA/AllocatorIdentification.cpp | 6 +- lib/DSA/Basic.cpp | 8 +- lib/DSA/CallTargets.cpp | 1 + lib/DSA/DSGraph.cpp | 2 +- lib/DSA/DSTest.cpp | 1 - lib/DSA/DataStructure.cpp | 4 +- lib/DSA/DataStructureStats.cpp | 7 +- lib/DSA/EquivClassGraphs.cpp | 2 +- lib/DSA/Local.cpp | 6 +- lib/DSA/Printer.cpp | 8 +- lib/DSA/StdLibPass.cpp | 14 +- lib/DSA/TypeSafety.cpp | 2 +- lib/smack/SmackInstGenerator.cpp | 7 +- lib/smack/SmackModuleGenerator.cpp | 1 + lib/smack/SmackRep.cpp | 1 + tools/smack/smack.cpp | 13 +- 53 files changed, 453 insertions(+), 555 deletions(-) diff --git a/Makefile.llvm.rules b/Makefile.llvm.rules index 98407b641..ebebc0a85 100644 --- a/Makefile.llvm.rules +++ b/Makefile.llvm.rules @@ -42,7 +42,7 @@ VPATH=$(PROJ_SRC_DIR) # Reset the list of suffixes we know how to build. #-------------------------------------------------------------------- .SUFFIXES: -.SUFFIXES: .c .cpp .cc .h .hpp .o .a .bc .td .ps .dot .ll .m .mm +.SUFFIXES: .c .cpp .cc .h .hpp .o .a .td .ps .dot .m .mm .SUFFIXES: $(SHLIBEXT) $(SUFFIXES) #-------------------------------------------------------------------- @@ -57,6 +57,81 @@ VPATH=$(PROJ_SRC_DIR) $(UserTargets):: +#------------------------------------------------------------------------ +# LLVMBuild Integration +#------------------------------------------------------------------------ +# +# We use llvm-build to generate all the data required by the Makefile based +# build system in one swoop: +# +# - We generate a file (a Makefile fragment) in the object root which contains +# all the definitions that are required by Makefiles across the entire +# project. +# +# - We generate the library table used by llvm-config. +# +# - We generate the dependencies for the Makefile fragment, so that we will +# automatically reconfigure outselves. + +# The path to the llvm-build tool itself. +LLVMBuildTool := $(PROJ_SRC_ROOT)/utils/llvm-build/llvm-build + +# The files we are going to generate using llvm-build. +LLVMBuildMakeFrag := $(PROJ_OBJ_ROOT)/Makefile.llvmbuild +LLVMBuildCMakeFrag := $(PROJ_OBJ_ROOT)/LLVMBuild.cmake +LLVMBuildCMakeExportsFrag := $(PROJ_OBJ_ROOT)/cmake/modules/LLVMBuildExports.cmake +LLVMBuildMakeFrags := \ + $(LLVMBuildMakeFrag) \ + $(LLVMBuildCMakeFrag) \ + $(LLVMBuildCMakeExportsFrag) +LLVMConfigLibraryDependenciesInc := \ + $(PROJ_OBJ_ROOT)/tools/llvm-config/LibraryDependencies.inc + +# This is for temporary backwards compatibility. +ifndef TARGET_NATIVE_ARCH +TARGET_NATIVE_ARCH := $(ARCH) +endif + +# The rule to create the LLVMBuild Makefile fragment as well as the llvm-config +# library table. +# +# Note that this target gets its real dependencies generated for us by +# llvm-build. +# +# We include a dependency on this Makefile to ensure that changes to the +# generation command get picked up. +$(LLVMBuildMakeFrags): $(PROJ_SRC_ROOT)/Makefile.rules \ + $(PROJ_OBJ_ROOT)/Makefile.config + $(Echo) Constructing LLVMBuild project information. + $(Verb)$(PYTHON) $(LLVMBuildTool) \ + --native-target "$(TARGET_NATIVE_ARCH)" \ + --enable-targets "$(TARGETS_TO_BUILD)" \ + --enable-optional-components "$(OPTIONAL_COMPONENTS)" \ + --write-library-table $(LLVMConfigLibraryDependenciesInc) \ + --write-make-fragment $(LLVMBuildMakeFrag) \ + --write-cmake-fragment $(LLVMBuildCMakeFrag) \ + --write-cmake-exports-fragment $(LLVMBuildCMakeExportsFrag) + +# For completeness, let Make know how the extra files are generated. +$(LLVMConfigLibraryDependenciesInc): $(LLVMBuildMakeFrags) + +# Include the generated Makefile fragment. +# +# We currently only include the dependencies for the fragment itself if we are +# at the top-level. Otherwise, recursive invocations would ends up doing +# substantially more redundant stat'ing. +# +# This means that we won't properly regenerate things for developers used to +# building from a subdirectory, but that is always somewhat unreliable. +ifeq ($(LEVEL),.) +LLVMBUILD_INCLUDE_DEPENDENCIES := 1 + +# Clean the generated makefile fragment at the top-level. +clean-local:: + -$(Verb) $(RM) -f $(LLVMBuildMakeFrags) +endif +-include $(LLVMBuildMakeFrag) + ################################################################################ # PRECONDITIONS: that which must be built/checked first ################################################################################ @@ -207,18 +282,10 @@ CPP.Defines := ifeq ($(ENABLE_OPTIMIZED),1) BuildMode := Release # Don't use -fomit-frame-pointer on Darwin or FreeBSD. - ifneq ($(HOST_OS),FreeBSD) - ifneq ($(HOST_OS),Darwin) + ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin Darwin DragonFly FreeBSD GNU/kFreeBSD)) OmitFramePointer := -fomit-frame-pointer endif - endif - # Darwin requires -fstrict-aliasing to be explicitly enabled. - # Avoid -fstrict-aliasing on Darwin for now, there are unresolved issues - # with -fstrict-aliasing and ipa-type-escape radr://6756684 - #ifeq ($(HOST_OS),Darwin) - # EXTRA_OPTIONS += -fstrict-aliasing -Wstrict-aliasing - #endif CXX.Flags += $(OPTIMIZE_OPTION) $(OmitFramePointer) C.Flags += $(OPTIMIZE_OPTION) $(OmitFramePointer) LD.Flags += $(OPTIMIZE_OPTION) @@ -226,7 +293,6 @@ ifeq ($(ENABLE_OPTIMIZED),1) BuildMode := $(BuildMode)+Debug CXX.Flags += -g C.Flags += -g - LD.Flags += -g KEEP_SYMBOLS := 1 endif else @@ -234,13 +300,16 @@ else BuildMode := Unoptimized CXX.Flags += C.Flags += - LD.Flags += KEEP_SYMBOLS := 1 else BuildMode := Debug + ifeq ($(ENABLE_SPLIT_DWARF), 1) + CXX.Flags += -gsplit-dwarf + C.Flags += -gsplit-dwarf + else CXX.Flags += -g C.Flags += -g - LD.Flags += -g + endif KEEP_SYMBOLS := 1 endif endif @@ -250,17 +319,34 @@ ifeq ($(ENABLE_LIBCPP),1) LD.Flags += -stdlib=libc++ endif +ifeq ($(ENABLE_CXX1Y),1) + CXX.Flags += -std=c++1y +else + ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW)) + # MinGW and Cygwin are a bit stricter and lack things like + # 'strdup', 'stricmp', etc in c++11 mode. + CXX.Flags += -std=gnu++11 + else + CXX.Flags += -std=c++11 + endif +endif + +ifeq ($(ENABLE_WERROR),1) + CXX.Flags += -Werror + C.Flags += -Werror +endif + ifeq ($(ENABLE_PROFILING),1) BuildMode := $(BuildMode)+Profile CXX.Flags := $(filter-out -fomit-frame-pointer,$(CXX.Flags)) -pg -g C.Flags := $(filter-out -fomit-frame-pointer,$(C.Flags)) -pg -g - LD.Flags := $(filter-out -fomit-frame-pointer,$(LD.Flags)) -pg -g + LD.Flags := $(filter-out -fomit-frame-pointer,$(LD.Flags)) -pg KEEP_SYMBOLS := 1 endif -#ifeq ($(ENABLE_VISIBILITY_INLINES_HIDDEN),1) -# CXX.Flags += -fvisibility-inlines-hidden -#endif +ifeq ($(ENABLE_VISIBILITY_INLINES_HIDDEN),1) + CXX.Flags += -fvisibility-inlines-hidden +endif ifdef ENABLE_EXPENSIVE_CHECKS # GNU libstdc++ uses RTTI if you define _GLIBCXX_DEBUG, which we did above. @@ -291,6 +377,7 @@ ifeq ($(ENABLE_COVERAGE),1) BuildMode := $(BuildMode)+Coverage CXX.Flags += -ftest-coverage -fprofile-arcs C.Flags += -ftest-coverage -fprofile-arcs + LD.Flags += -ftest-coverage -fprofile-arcs endif # If DISABLE_ASSERTIONS=1 is specified (make command line or configured), @@ -427,31 +514,14 @@ ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW)) endif #-------------------------------------------------------------------- -# LLVM Capable Compiler +# Full Paths To Compiled Tools and Utilities #-------------------------------------------------------------------- - -ifneq ($(findstring llvm-gcc,$(LLVMCC_OPTION)),) - LLVMCC := $(LLVMGCC) - LLVMCXX := $(LLVMGXX) -else - ifneq ($(findstring clang,$(LLVMCC_OPTION)),) - ifneq ($(CLANGPATH),) - LLVMCC := $(CLANGPATH) - LLVMCXX := $(CLANGXXPATH) - else - ifeq ($(ENABLE_BUILT_CLANG),1) - LLVMCC := $(LLVMToolDir)/clang - LLVMCXX := $(LLVMToolDir)/clang++ - endif - endif - endif +EchoCmd := $(ECHO) llvm[$(MAKELEVEL)]: +ifdef BUILD_DIRS_ONLY +EchoCmd := $(EchoCmd) "(build tools)": endif -#-------------------------------------------------------------------- -# Full Paths To Compiled Tools and Utilities -#-------------------------------------------------------------------- -EchoCmd = $(ECHO) llvm[$(MAKELEVEL)]: -Echo = @$(EchoCmd) +Echo := @$(EchoCmd) ifndef LLVMAS LLVMAS := $(LLVMToolDir)/llvm-as$(EXEEXT) endif @@ -462,7 +532,11 @@ ifndef LLVM_TBLGEN LLVM_TBLGEN := $(LLVMToolDir)/llvm-tblgen$(EXEEXT) endif endif -LLVM_CONFIG := $(LLVMToolDir)/llvm-config +ifeq ($(LLVM_CROSS_COMPILING),1) + LLVM_CONFIG := $(BuildLLVMToolDir)/llvm-config$(BUILD_EXEEXT) +else + LLVM_CONFIG := $(LLVMToolDir)/llvm-config$(EXEEXT) +endif ifndef LLVMDIS LLVMDIS := $(LLVMToolDir)/llvm-dis$(EXEEXT) endif @@ -478,30 +552,45 @@ endif ifndef LBUGPOINT LBUGPOINT := $(LLVMToolDir)/bugpoint$(EXEEXT) endif +ifndef LLVMLINK +LLVMLINK := $(LLVMToolDir)/llvm-link$(EXEEXT) +endif #-------------------------------------------------------------------- # Adjust to user's request #-------------------------------------------------------------------- ifeq ($(HOST_OS),Darwin) + ifdef MACOSX_DEPLOYMENT_TARGET + DARWIN_VERSION := $(MACOSX_DEPLOYMENT_TARGET) + else DARWIN_VERSION := `sw_vers -productVersion` + endif # Strip a number like 10.4.7 to 10.4 - DARWIN_VERSION := $(shell echo $(DARWIN_VERSION)| sed -E 's/(10.[0-9]).*/\1/') + DARWIN_VERSION := $(shell echo $(DARWIN_VERSION)| sed -E 's/(10.[0-9]+).*/\1/') # Get "4" out of 10.4 for later pieces in the makefile. - DARWIN_MAJVERS := $(shell echo $(DARWIN_VERSION)| sed -E 's/10.([0-9]).*/\1/') + DARWIN_MAJVERS := $(shell echo $(DARWIN_VERSION)| sed -E 's/10.([0-9]+).*/\1/') LoadableModuleOptions := -Wl,-flat_namespace -Wl,-undefined,suppress SharedLinkOptions := -dynamiclib - ifneq ($(ARCH),ARM) - SharedLinkOptions += -mmacosx-version-min=$(DARWIN_VERSION) + ifdef DEPLOYMENT_TARGET + SharedLinkOptions += $(DEPLOYMENT_TARGET) + else + ifneq ($(ARCH),ARM) + SharedLinkOptions += -mmacosx-version-min=$(DARWIN_VERSION) + endif endif else SharedLinkOptions=-shared endif ifeq ($(TARGET_OS),Darwin) - ifneq ($(ARCH),ARM) - TargetCommonOpts += -mmacosx-version-min=$(DARWIN_VERSION) + ifdef DEPLOYMENT_TARGET + TargetCommonOpts += $(DEPLOYMENT_TARGET) + else + ifneq ($(ARCH),ARM) + TargetCommonOpts += -mmacosx-version-min=$(DARWIN_VERSION) + endif endif endif @@ -509,6 +598,8 @@ ifdef SHARED_LIBRARY ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW)) ifneq ($(HOST_OS),Darwin) LD.Flags += $(RPATH) -Wl,'$$ORIGIN' +else + LD.Flags += -Wl,-install_name -Wl,"@rpath/lib$(LIBRARYNAME)$(SHLIBEXT)" endif endif endif @@ -536,29 +627,43 @@ ifndef KEEP_SYMBOLS Install.StripFlag += -s endif -ifdef TOOL_NO_EXPORTS - DynamicFlags := -else - DynamicFlag := $(RDYNAMIC) +# By default, strip dead symbols at link time +ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW)) +ifneq ($(HOST_OS),Darwin) +ifneq ($(HOST_ARCH),Mips) + CXX.Flags += -ffunction-sections -fdata-sections +endif +endif +endif +ifndef NO_DEAD_STRIP + ifeq ($(HOST_OS),Darwin) + LD.Flags += -Wl,-dead_strip + else + ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW)) + LD.Flags += -Wl,--gc-sections + endif + endif endif # Adjust linker flags for building an executable ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW)) -ifneq ($(HOST_OS), Darwin) -ifdef TOOLNAME - LD.Flags += $(RPATH) -Wl,'$$ORIGIN/../lib' - ifdef EXAMPLE_TOOL - LD.Flags += $(RPATH) -Wl,$(ExmplDir) $(DynamicFlag) + ifndef TOOL_NO_EXPORTS + LD.Flags += $(RDYNAMIC) + endif + ifneq ($(HOST_OS), Darwin) + ifdef TOOLNAME + LD.Flags += $(RPATH) -Wl,'$$ORIGIN/../lib' + endif else - LD.Flags += $(RPATH) -Wl,$(ToolDir) $(DynamicFlag) + ifneq ($(DARWIN_MAJVERS),4) + LD.Flags += $(RPATH) -Wl,@executable_path/../lib + endif + ifeq ($(RC_XBS),YES) + TempFile := $(shell mkdir -p ${OBJROOT}/dSYMs ; mktemp ${OBJROOT}/dSYMs/llvm-lto.XXXXXX) + LD.Flags += -Wl,-object_path_lto -Wl,$(TempFile) + endif endif endif -else -ifneq ($(DARWIN_MAJVERS),4) - LD.Flags += $(RPATH) -Wl,@executable_path/../lib -endif -endif -endif #---------------------------------------------------------- @@ -573,7 +678,9 @@ ifndef NO_PEDANTIC CompileCommonOpts += -pedantic -Wno-long-long endif CompileCommonOpts += -Wall -W -Wno-unused-parameter -Wwrite-strings \ - $(EXTRA_OPTIONS) $(COVERED_SWITCH_DEFAULT) + $(EXTRA_OPTIONS) $(COVERED_SWITCH_DEFAULT) \ + $(NO_UNINITIALIZED) $(NO_MAYBE_UNINITIALIZED) \ + $(NO_MISSING_FIELD_INITIALIZERS) # Enable cast-qual for C++; the workaround is to use const_cast. CXX.Flags += -Wcast-qual @@ -581,13 +688,13 @@ ifeq ($(HOST_OS),HP-UX) CompileCommonOpts := -D_REENTRANT -D_HPUX_SOURCE endif -# If we are building a universal binary on Mac OS/X, pass extra options. This +# If we are building a universal binary on Mac OS X, pass extra options. This # is useful to people that want to link the LLVM libraries into their universal # apps. # # The following can be optionally specified: # UNIVERSAL_SDK_PATH variable can be specified as a path to the SDK to use. -# For Mac OS/X 10.4 Intel machines, the traditional one is: +# For Mac OS X 10.4 Intel machines, the traditional one is: # UNIVERSAL_SDK_PATH=/Developer/SDKs/MacOSX10.4u.sdk/ # UNIVERSAL_ARCH can be optionally specified to be a list of architectures # to build for, e.g. UNIVERSAL_ARCH="i386 ppc ppc64". This defaults to @@ -597,9 +704,9 @@ ifdef UNIVERSAL UNIVERSAL_ARCH := i386 ppc endif UNIVERSAL_ARCH_OPTIONS := $(UNIVERSAL_ARCH:%=-arch %) - CompileCommonOpts += $(UNIVERSAL_ARCH_OPTIONS) + TargetCommonOpts += $(UNIVERSAL_ARCH_OPTIONS) ifdef UNIVERSAL_SDK_PATH - CompileCommonOpts += -isysroot $(UNIVERSAL_SDK_PATH) + TargetCommonOpts += -isysroot $(UNIVERSAL_SDK_PATH) endif # Building universal cannot compute dependencies automatically. @@ -624,7 +731,13 @@ ifeq ($(HOST_OS),AuroraUX) CPP.BaseFlags += -include llvm/Support/Solaris.h endif # !HOST_OS - AuroraUX. -LD.Flags += -L$(LibDir) -L$(LLVMLibDir) +# On Windows, SharedLibDir != LibDir. The order is important. +ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW)) + LD.Flags += -L$(SharedLibDir) -L$(LibDir) -L$(LLVMToolDir) -L$(LLVMLibDir) +else + LD.Flags += -L$(LibDir) -L$(LLVMLibDir) +endif + CPP.BaseFlags += -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS # All -I flags should go here, so that they don't confuse llvm-config. CPP.Flags += $(sort -I$(PROJ_OBJ_DIR) -I$(PROJ_SRC_DIR) \ @@ -633,6 +746,10 @@ CPP.Flags += $(sort -I$(PROJ_OBJ_DIR) -I$(PROJ_SRC_DIR) \ $(LLVM_OBJ_ROOT) $(LLVM_SRC_ROOT))) \ $(CPP.BaseFlags) +ifeq ($(INCLUDE_BUILD_DIR),1) + CPP.Flags += -I$(ObjDir) +endif + # SHOW_DIAGNOSTICS support. ifeq ($(SHOW_DIAGNOSTICS),1) Compile.Wrapper := env CC_LOG_DIAGNOSTICS=1 \ @@ -641,44 +758,22 @@ else Compile.Wrapper := endif -ifeq ($(BUILD_COMPONENT), 1) - Compile.C = $(Compile.Wrapper) \ - $(BUILD_CC) $(CPP.Flags) $(C.Flags) $(CFLAGS) $(CPPFLAGS) \ - $(TargetCommonOpts) $(CompileCommonOpts) -c - Compile.CXX = $(Compile.Wrapper) \ - $(BUILD_CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) \ - $(CPPFLAGS) \ - $(TargetCommonOpts) $(CompileCommonOpts) -c - Preprocess.CXX= $(Compile.Wrapper) \ - $(BUILD_CXX) $(CPP.Flags) $(CPPFLAGS) $(TargetCommonOpts) \ - $(CompileCommonOpts) $(CXX.Flags) -E - Link = $(Compile.Wrapper) \ - $(BUILD_CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) \ - $(LD.Flags) $(LDFLAGS) \ - $(TargetCommonOpts) $(CompileCommonOpts) $(Strip) -else - Compile.C = $(Compile.Wrapper) \ +Compile.C = $(Compile.Wrapper) \ $(CC) $(CPP.Flags) $(C.Flags) $(CFLAGS) $(CPPFLAGS) \ - $(TargetCommonOpts) $(CompileCommonOpts) -c - Compile.CXX = $(Compile.Wrapper) \ + $(TargetCommonOpts) $(CompileCommonOpts) -c +Compile.CXX = $(Compile.Wrapper) \ $(CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) $(CPPFLAGS) \ - $(TargetCommonOpts) $(CompileCommonOpts) -c - Preprocess.CXX= $(Compile.Wrapper) \ + $(TargetCommonOpts) $(CompileCommonOpts) -c +Preprocess.CXX= $(Compile.Wrapper) \ $(CXX) $(CPP.Flags) $(TargetCommonOpts) $(CPPFLAGS) \ - $(CompileCommonOpts) $(CXX.Flags) -E - Link = $(Compile.Wrapper) \ - $(CXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) $(LD.Flags) \ - $(LDFLAGS) $(TargetCommonOpts) $(CompileCommonOpts) $(Strip) -endif + $(CompileCommonOpts) $(CXX.Flags) -E +Link = $(Compile.Wrapper) \ + $(CXX) $(CXXFLAGS) $(LD.Flags) $(LDFLAGS) \ + $(TargetCommonOpts) $(Strip) -BCCompile.C = $(LLVMCC) $(CPP.Flags) $(C.Flags) $(CFLAGS) $(CPPFLAGS) \ - $(TargetCommonOpts) $(CompileCommonOpts) Preprocess.C = $(CC) $(CPP.Flags) $(C.Flags) $(CPPFLAGS) \ $(TargetCommonOpts) $(CompileCommonOpts) -E -BCCompile.CXX = $(LLVMCXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) $(CPPFLAGS) \ - $(TargetCommonOpts) $(CompileCommonOpts) - ProgInstall = $(INSTALL) $(Install.StripFlag) -m 0755 ScriptInstall = $(INSTALL) -m 0755 DataInstall = $(INSTALL) -m 0644 @@ -693,14 +788,13 @@ TableGen.Flags= -I $(call SYSPATH, $(PROJ_SRC_DIR)) \ LLVMTableGen = $(LLVM_TBLGEN) $(TableGen.Flags) Archive = $(AR) $(AR.Flags) -LArchive = $(LLVMToolDir)/llvm-ar rcsf ifdef RANLIB Ranlib = $(RANLIB) else Ranlib = ranlib endif -AliasTool = ln -s +AliasTool = ln -sf #---------------------------------------------------------- # Get the list of source files and compute object file @@ -719,9 +813,10 @@ Sources += $(filter %.cpp %.c %.cc,$(BUILT_SOURCES)) endif BaseNameSources := $(sort $(basename $(Sources))) +SourceDirs := $(sort $(dir $(Sources))) ObjectsO := $(BaseNameSources:%=$(ObjDir)/%.o) -ObjectsBC := $(BaseNameSources:%=$(ObjDir)/%.bc) +ObjectDirs := $(SourceDirs:%=$(ObjDir)/%) #---------------------------------------------------------- # For Mingw MSYS bash and Python/w32: @@ -736,7 +831,7 @@ ObjectsBC := $(BaseNameSources:%=$(ObjDir)/%.bc) #---------------------------------------------------------- ifeq (-mingw32,$(findstring -mingw32,$(BUILD_TRIPLE))) - ECHOPATH := $(Verb)python -u -c "import sys;print ' '.join(sys.argv[1:])" + ECHOPATH := $(Verb)$(PYTHON) -u -c "import sys;print ' '.join(sys.argv[1:])" else ECHOPATH := $(Verb)$(ECHO) endif @@ -758,9 +853,18 @@ $(DESTDIR)$(PROJ_bindir) $(DESTDIR)$(PROJ_libdir) $(DESTDIR)$(PROJ_includedir) $ $(Verb) $(MKDIR) $* > /dev/null $(Verb) $(DOTDIR_TIMESTAMP_COMMAND) > $@ -.PRECIOUS: $(ObjDir)/.dir $(LibDir)/.dir $(ToolDir)/.dir $(ExmplDir)/.dir +.PRECIOUS: $(LibDir)/.dir $(ToolDir)/.dir $(ExmplDir)/.dir .PRECIOUS: $(LLVMLibDir)/.dir $(LLVMToolDir)/.dir $(LLVMExmplDir)/.dir +#--------------------------------------------------------- +# Collect the object directories (as there may be more +# than one if the source code is spread across +# subdirectories). +#--------------------------------------------------------- + +OBJECT_DIRS := $(ObjDir)/.dir $(ObjectDirs:%=%/.dir) +.PRECIOUS: $(OBJECT_DIRS) + #--------------------------------------------------------- # Handle the DIRS options for sequential construction #--------------------------------------------------------- @@ -808,7 +912,7 @@ endif # Handle the OPTIONAL_PARALLEL_DIRS options for optional parallel construction #----------------------------------------------------------- ifdef OPTIONAL_PARALLEL_DIRS - PARALLEL_DIRS += $(foreach T,$(OPTIONAL_PARALLEL_DIRS),$(shell test -d $(PROJ_SRC_DIR)/$(T) && echo "$(T)")) + PARALLEL_DIRS += $(foreach T,$(OPTIONAL_PARALLEL_DIRS),$(shell test -d $(PROJ_SRC_DIR)/$(T) -o -f $(T)/Makefile && echo "$(T)")) endif #----------------------------------------------------------- @@ -830,13 +934,20 @@ unitcheck:: $(addsuffix /.makeunitcheck,$(PARALLEL_DIRS)) ParallelTargets := $(foreach T,$(RecursiveTargets),%/.make$(T)) $(ParallelTargets) : - $(Verb) if ([ ! -f $(@D)/Makefile ] || \ - command test $(@D)/Makefile -ot \ - $(PROJ_SRC_DIR)/$(@D)/Makefile ); then \ - $(MKDIR) $(@D); \ - $(CP) $(PROJ_SRC_DIR)/$(@D)/Makefile $(@D)/Makefile; \ + $(Verb) \ + SD=$(PROJ_SRC_DIR)/$(@D); \ + DD=$(@D); \ + if [ ! -f $$SD/Makefile ]; then \ + SD=$(@D); \ + DD=$(notdir $(@D)); \ + fi; \ + if ([ ! -f $$DD/Makefile ] || \ + command test $$DD/Makefile -ot \ + $$SD/Makefile ); then \ + $(MKDIR) $$DD; \ + $(CP) $$SD/Makefile $$DD/Makefile; \ fi; \ - $(MAKE) -C $(@D) $(subst $(@D)/.make,,$@) + $(MAKE) -C $$DD $(subst $(@D)/.make,,$@) endif #--------------------------------------------------------- @@ -953,8 +1064,9 @@ ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW)) LLVMLibsOptions += -Wl,--enable-auto-import,--enable-runtime-pseudo-reloc \ -L $(SharedLibDir) endif -LLVMLibsOptions += -lLLVM-$(LLVMVersion) -LLVMLibsPaths += $(LLVMSharedLibDir)/$(SharedPrefix)LLVM-$(LLVMVersion)$(SHLIBEXT) +LLVM_SO_NAME = LLVM-$(LLVM_VERSION_MAJOR).$(LLVM_VERSION_MINOR)$(LLVM_VERSION_SUFFIX) +LLVMLibsOptions += -l$(LLVM_SO_NAME) +LLVMLibsPaths += $(SharedLibDir)/$(SharedPrefix)$(LLVM_SO_NAME)$(SHLIBEXT) else ifndef NO_LLVM_CONFIG @@ -993,7 +1105,7 @@ ifeq ($(HAVE_LINK_VERSION_SCRIPT),1) NativeExportsFile := $(ObjDir)/$(notdir $(EXPORTED_SYMBOL_FILE)).map $(NativeExportsFile): $(EXPORTED_SYMBOL_FILE) $(ObjDir)/.dir $(Verb) echo "{" > $@ - $(Verb) grep -q "\<" $< && echo " global:" >> $@ || : + $(Verb) grep -q '[[:alnum:]_]' $< && echo " global:" >> $@ || : $(Verb) sed -e 's/$$/;/' -e 's/^/ /' < $< >> $@ ifneq ($(HOST_OS),OpenBSD) $(Verb) echo " local: *;" >> $@ @@ -1042,83 +1154,25 @@ endif # Library Build Rules: Four ways to build a library ############################################################################### -#--------------------------------------------------------- -# Bytecode Module Targets: -# If the user set MODULE_NAME then they want to build a -# bytecode module from the sources. We compile all the -# sources and link it together into a single bytecode -# module. -#--------------------------------------------------------- - -ifdef MODULE_NAME -ifeq ($(strip $(LLVMCC)),) -$(warning Modules require LLVM capable compiler but none is available ****) -else - -Module := $(LibDir)/$(MODULE_NAME).bc -LinkModule := $(LLVMLD) -r - - -ifdef EXPORTED_SYMBOL_FILE -LinkModule += -internalize-public-api-file=$(EXPORTED_SYMBOL_FILE) -endif - -$(Module): $(BUILT_SOURCES) $(ObjectsBC) $(LibDir)/.dir $(LLVMLD) - $(Echo) Building $(BuildMode) Bytecode Module $(notdir $@) - $(Verb) $(LinkModule) -o $@ $(ObjectsBC) - -all-local:: $(Module) - -clean-local:: -ifneq ($(strip $(Module)),) - -$(Verb) $(RM) -f $(Module) -endif - -ifdef BYTECODE_DESTINATION -ModuleDestDir := $(BYTECODE_DESTINATION) -else -ModuleDestDir := $(DESTDIR)$(PROJ_libdir) -endif - -ifdef NO_INSTALL -install-local:: - $(Echo) Install circumvented with NO_INSTALL -uninstall-local:: - $(Echo) Uninstall circumvented with NO_INSTALL -else -DestModule := $(ModuleDestDir)/$(MODULE_NAME).bc - -install-module:: $(DestModule) -install-local:: $(DestModule) - -$(DestModule): $(ModuleDestDir) $(Module) - $(Echo) Installing $(BuildMode) Bytecode Module $(DestModule) - $(Verb) $(DataInstall) $(Module) $(DestModule) - -uninstall-local:: - $(Echo) Uninstalling $(BuildMode) Bytecode Module $(DestModule) - -$(Verb) $(RM) -f $(DestModule) -endif - -endif -endif - # if we're building a library ... ifdef LIBRARYNAME # Make sure there isn't any extraneous whitespace on the LIBRARYNAME option LIBRARYNAME := $(strip $(LIBRARYNAME)) +LIBRARYALIASNAME := $(strip $(LIBRARYALIASNAME)) ifdef LOADABLE_MODULE BaseLibName.A := $(LIBRARYNAME).a BaseLibName.SO := $(LIBRARYNAME)$(SHLIBEXT) +BaseAliasName.SO := $(LIBRARYALIASNAME)$(SHLIBEXT) else BaseLibName.A := lib$(LIBRARYNAME).a BaseLibName.SO := $(SharedPrefix)$(LIBRARYNAME)$(SHLIBEXT) +BaseAliasName.SO := $(SharedPrefix)$(LIBRARYALIASNAME)$(SHLIBEXT) endif LibName.A := $(LibDir)/$(BaseLibName.A) LibName.SO := $(SharedLibDir)/$(BaseLibName.SO) +AliasName.SO := $(SharedLibDir)/$(BaseAliasName.SO) LibName.O := $(LibDir)/$(LIBRARYNAME).o -LibName.BCA:= $(LibDir)/lib$(LIBRARYNAME).bca #--------------------------------------------------------- # Shared Library Targets: @@ -1128,7 +1182,12 @@ LibName.BCA:= $(LibDir)/lib$(LIBRARYNAME).bca #--------------------------------------------------------- ifdef SHARED_LIBRARY -all-local:: $(LibName.SO) +all-local:: $(AliasName.SO) + +$(AliasName.SO): $(LibName.SO) +ifdef SHARED_ALIAS + $(Verb) $(AliasTool) $(BaseLibName.SO) $(AliasName.SO) +endif ifdef EXPORTED_SYMBOL_FILE $(LibName.SO): $(NativeExportsFile) @@ -1145,7 +1204,7 @@ $(LibName.SO): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths) $(SharedLibDir)/.di $(Echo) Linking $(BuildMode) $(SharedLibKindMessage) \ $(notdir $@) $(Verb) $(Link) $(SharedLinkOptions) -o $@ $(ObjectsO) \ - $(ProjLibsOptions) -L$(LLVMSharedLibDir) $(LLVMLibsOptions) $(LIBS) + $(ProjLibsOptions) $(LLVMLibsOptions) $(LIBS) else $(LibName.SO): $(ObjectsO) $(SharedLibDir)/.dir $(Echo) Linking $(BuildMode) Shared Library $(notdir $@) @@ -1171,81 +1230,23 @@ else DestSharedLibDir := $(DESTDIR)$(PROJ_libdir) endif DestSharedLib := $(DestSharedLibDir)/$(BaseLibName.SO) +DestSharedAlias := $(DestSharedLibDir)/$(BaseAliasName.SO) install-local:: $(DestSharedLib) $(DestSharedLib): $(LibName.SO) $(DestSharedLibDir) $(Echo) Installing $(BuildMode) Shared Library $(DestSharedLib) $(Verb) $(INSTALL) $(LibName.SO) $(DestSharedLib) - -uninstall-local:: - $(Echo) Uninstalling $(BuildMode) Shared Library $(DestSharedLib) - -$(Verb) $(RM) -f $(DestSharedLibDir)/$(SharedPrefix)$(LIBRARYNAME).* -endif -endif - -#--------------------------------------------------------- -# Bytecode Library Targets: -# If the user asked for a bytecode library to be built -# with the BYTECODE_LIBRARY variable, then we provide -# targets for building them. -#--------------------------------------------------------- -ifdef BYTECODE_LIBRARY -ifeq ($(strip $(LLVMCC)),) -$(warning Bytecode libraries require LLVM capable compiler but none is available ****) -else - -all-local:: $(LibName.BCA) - -ifdef EXPORTED_SYMBOL_FILE -BCLinkLib = $(LLVMLD) -internalize-public-api-file=$(EXPORTED_SYMBOL_FILE) - -$(LibName.BCA): $(ObjectsBC) $(LibDir)/.dir $(LLVMLD) \ - $(LLVMToolDir)/llvm-ar - $(Echo) Building $(BuildMode) Bytecode Archive $(notdir $@) \ - "(internalize)" - $(Verb) $(BCLinkLib) -o $(ObjDir)/$(LIBRARYNAME).internalize $(ObjectsBC) - $(Verb) $(RM) -f $@ - $(Verb) $(LArchive) $@ $(ObjDir)/$(LIBRARYNAME).internalize.bc -else -$(LibName.BCA): $(ObjectsBC) $(LibDir)/.dir \ - $(LLVMToolDir)/llvm-ar - $(Echo) Building $(BuildMode) Bytecode Archive $(notdir $@) - $(Verb) $(RM) -f $@ - $(Verb) $(LArchive) $@ $(ObjectsBC) - -endif - -clean-local:: -ifneq ($(strip $(LibName.BCA)),) - -$(Verb) $(RM) -f $(LibName.BCA) +ifdef SHARED_ALIAS + $(Echo) Creating alias from $(DestSharedLib) to $(DestSharedAlias) + $(Verb) $(AliasTool) $(BaseLibName.SO) $(DestSharedAlias) endif -ifdef BYTECODE_DESTINATION -BytecodeDestDir := $(BYTECODE_DESTINATION) -else -BytecodeDestDir := $(DESTDIR)$(PROJ_libdir) -endif - -DestBytecodeLib = $(BytecodeDestDir)/lib$(LIBRARYNAME).bca - -install-bytecode-local:: $(DestBytecodeLib) - -ifdef NO_INSTALL -install-local:: - $(Echo) Install circumvented with NO_INSTALL -uninstall-local:: - $(Echo) Uninstall circumvented with NO_INSTALL -else -install-local:: $(DestBytecodeLib) - -$(DestBytecodeLib): $(LibName.BCA) $(BytecodeDestDir) - $(Echo) Installing $(BuildMode) Bytecode Archive $(DestBytecodeLib) - $(Verb) $(DataInstall) $(LibName.BCA) $(DestBytecodeLib) - uninstall-local:: - $(Echo) Uninstalling $(BuildMode) Bytecode Archive $(DestBytecodeLib) - -$(Verb) $(RM) -f $(DestBytecodeLib) + $(Echo) Uninstalling $(BuildMode) Shared Library $(DestSharedLib) + -$(Verb) $(RM) -f $(DestSharedLib) +ifdef SHARED_ALIAS + -$(Verb) $(RM) -f $(DestSharedAlias) endif endif endif @@ -1355,9 +1356,9 @@ LD.Flags += -Wl,-exported_symbol,_main endif endif -ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux NetBSD FreeBSD)) +ifeq ($(HOST_OS), $(filter $(HOST_OS), DragonFly Linux NetBSD FreeBSD GNU/kFreeBSD GNU)) ifneq ($(ARCH), Mips) - LD.Flags += -Wl,--version-script=$(PROJ_SRC_ROOT)/autoconf/ExportMap.map + LD.Flags += -Wl,--version-script=$(LLVM_SRC_ROOT)/autoconf/ExportMap.map endif endif endif @@ -1415,18 +1416,31 @@ else $(ToolBuildPath): $(ToolDir)/.dir endif +ifdef CODESIGN_TOOLS +TOOL_CODESIGN_IDENTITY ?= - + $(ToolBuildPath): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths) $(Echo) Linking $(BuildMode) executable $(TOOLNAME) $(StripWarnMsg) $(Verb) $(Link) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \ $(LLVMLibsOptions) $(ExtraLibs) $(TOOLLINKOPTSB) $(LIBS) $(Echo) ======= Finished Linking $(BuildMode) Executable $(TOOLNAME) \ $(StripWarnMsg) + $(Echo) ======= Code-Signing $(BuildMode) Executable $(TOOLNAME) + $(Verb) codesign -s $(TOOL_CODESIGN_IDENTITY) $@ +else +$(ToolBuildPath): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths) + $(Echo) Linking $(BuildMode) executable $(TOOLNAME) $(StripWarnMsg) + $(Verb) $(Link) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \ + $(LLVMLibsOptions) $(ExtraLibs) $(TOOLLINKOPTSB) $(LIBS) + $(Echo) ======= Finished Linking $(BuildMode) Executable $(TOOLNAME) \ + $(StripWarnMsg) +endif ifneq ($(strip $(ToolAliasBuildPath)),) $(ToolAliasBuildPath): $(ToolBuildPath) $(Echo) Creating $(BuildMode) Alias $(TOOLALIAS) $(StripWarnMsg) $(Verb) $(RM) -f $(ToolAliasBuildPath) - $(Verb) $(AliasTool) $(TOOLEXENAME) $(ToolAliasBuildPath) + $(Verb) $(AliasTool) $(notdir $(ToolBuildPath)) $(ToolAliasBuildPath) $(Echo) ======= Finished Creating $(BuildMode) Alias $(TOOLALIAS) \ $(StripWarnMsg) endif @@ -1437,12 +1451,19 @@ install-local:: uninstall-local:: $(Echo) Uninstall circumvented with NO_INSTALL else -DestTool = $(DESTDIR)$(PROJ_bindir)/$(program_prefix)$(TOOLEXENAME) + +ifdef INTERNAL_TOOL +ToolBinDir = $(DESTDIR)$(PROJ_internal_prefix)/bin +else +ToolBinDir = $(DESTDIR)$(PROJ_bindir) +endif +DestTool = $(ToolBinDir)/$(program_prefix)$(TOOLEXENAME) install-local:: $(DestTool) -$(DestTool): $(ToolBuildPath) $(DESTDIR)$(PROJ_bindir) +$(DestTool): $(ToolBuildPath) $(Echo) Installing $(BuildMode) $(DestTool) + $(Verb) $(MKDIR) $(ToolBinDir) $(Verb) $(ProgInstall) $(ToolBuildPath) $(DestTool) uninstall-local:: @@ -1451,14 +1472,14 @@ uninstall-local:: # TOOLALIAS install. ifdef TOOLALIAS -DestToolAlias = $(DESTDIR)$(PROJ_bindir)/$(program_prefix)$(TOOLALIAS)$(EXEEXT) +DestToolAlias = $(ToolBinDir)/$(program_prefix)$(TOOLALIAS)$(EXEEXT) install-local:: $(DestToolAlias) $(DestToolAlias): $(DestTool) $(Echo) Installing $(BuildMode) $(DestToolAlias) $(Verb) $(RM) -f $(DestToolAlias) - $(Verb) $(AliasTool) $(TOOLEXENAME) $(DestToolAlias) + $(Verb) $(AliasTool) $(notdir $(DestTool)) $(DestToolAlias) uninstall-local:: $(Echo) Uninstalling $(BuildMode) $(DestToolAlias) @@ -1477,6 +1498,8 @@ ifeq ($(HOST_OS),HP-UX) DISABLE_AUTO_DEPENDENCIES=1 endif +COMPILE_DEPS = $(OBJECT_DIRS) $(BUILT_SOURCES) $(PROJ_MAKEFILE) + # Provide rule sets for when dependency generation is enabled ifndef DISABLE_AUTO_DEPENDENCIES @@ -1492,182 +1515,98 @@ DEPEND_OPTIONS = -MMD -MP -MF "$(ObjDir)/$*.d.tmp" \ DEPEND_MOVEFILE = then $(MV) -f "$(ObjDir)/$*.d.tmp" "$(ObjDir)/$*.d"; \ else $(RM) "$(ObjDir)/$*.d.tmp"; exit 1; fi -$(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE) +$(ObjDir)/%.o: %.cpp $(COMPILE_DEPS) $(Echo) "Compiling $*.cpp for $(BuildMode) build" $(PIC_FLAG) $(Verb) if $(Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \ $(DEPEND_MOVEFILE) -$(ObjDir)/%.o: %.mm $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE) +$(ObjDir)/%.o: %.mm $(COMPILE_DEPS) $(Echo) "Compiling $*.mm for $(BuildMode) build" $(PIC_FLAG) $(Verb) if $(Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \ $(DEPEND_MOVEFILE) -$(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE) +$(ObjDir)/%.o: %.cc $(COMPILE_DEPS) $(Echo) "Compiling $*.cc for $(BuildMode) build" $(PIC_FLAG) $(Verb) if $(Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \ $(DEPEND_MOVEFILE) -$(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE) +$(ObjDir)/%.o: %.c $(COMPILE_DEPS) $(Echo) "Compiling $*.c for $(BuildMode) build" $(PIC_FLAG) $(Verb) if $(Compile.C) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \ $(DEPEND_MOVEFILE) -$(ObjDir)/%.o: %.m $(ObjDir)/.dir $(BUILT_SOURCES) $(PROJ_MAKEFILE) +$(ObjDir)/%.o: %.m $(COMPILE_DEPS) $(Echo) "Compiling $*.m for $(BuildMode) build" $(PIC_FLAG) $(Verb) if $(Compile.C) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \ $(DEPEND_MOVEFILE) -#--------------------------------------------------------- -# Create .bc files in the ObjDir directory from .cpp .cc and .c files... -#--------------------------------------------------------- - -BC_DEPEND_OPTIONS = -MMD -MP -MF "$(ObjDir)/$*.bc.d.tmp" \ - -MT "$(ObjDir)/$*.ll" -MT "$(ObjDir)/$*.bc.d" - -# If the build succeeded, move the dependency file over, otherwise -# remove it. -BC_DEPEND_MOVEFILE = then $(MV) -f "$(ObjDir)/$*.bc.d.tmp" "$(ObjDir)/$*.bc.d"; \ - else $(RM) "$(ObjDir)/$*.bc.d.tmp"; exit 1; fi - -$(ObjDir)/%.ll: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX) - $(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)" - $(Verb) if $(BCCompile.CXX) $(BC_DEPEND_OPTIONS) \ - $< -o $(ObjDir)/$*.ll -S $(LLVMCC_EMITIR_FLAG) ; \ - $(BC_DEPEND_MOVEFILE) - -$(ObjDir)/%.ll: %.mm $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX) - $(Echo) "Compiling $*.mm for $(BuildMode) build (bytecode)" - $(Verb) if $(BCCompile.CXX) $(BC_DEPEND_OPTIONS) \ - $< -o $(ObjDir)/$*.ll -S $(LLVMCC_EMITIR_FLAG) ; \ - $(BC_DEPEND_MOVEFILE) - -$(ObjDir)/%.ll: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX) - $(Echo) "Compiling $*.cc for $(BuildMode) build (bytecode)" - $(Verb) if $(BCCompile.CXX) $(BC_DEPEND_OPTIONS) \ - $< -o $(ObjDir)/$*.ll -S $(LLVMCC_EMITIR_FLAG) ; \ - $(BC_DEPEND_MOVEFILE) - -$(ObjDir)/%.ll: %.c $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCC) - $(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)" - $(Verb) if $(BCCompile.C) $(BC_DEPEND_OPTIONS) \ - $< -o $(ObjDir)/$*.ll -S $(LLVMCC_EMITIR_FLAG) ; \ - $(BC_DEPEND_MOVEFILE) - -$(ObjDir)/%.ll: %.m $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCC) - $(Echo) "Compiling $*.m for $(BuildMode) build (bytecode)" - $(Verb) if $(BCCompile.C) $(BC_DEPEND_OPTIONS) \ - $< -o $(ObjDir)/$*.ll -S $(LLVMCC_EMITIR_FLAG) ; \ - $(BC_DEPEND_MOVEFILE) - # Provide alternate rule sets if dependencies are disabled else -$(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) +$(ObjDir)/%.o: %.cpp $(COMPILE_DEPS) $(Echo) "Compiling $*.cpp for $(BuildMode) build" $(PIC_FLAG) $(Compile.CXX) $< -o $@ -$(ObjDir)/%.o: %.mm $(ObjDir)/.dir $(BUILT_SOURCES) +$(ObjDir)/%.o: %.mm $(COMPILE_DEPS) $(Echo) "Compiling $*.mm for $(BuildMode) build" $(PIC_FLAG) $(Compile.CXX) $< -o $@ -$(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) +$(ObjDir)/%.o: %.cc $(COMPILE_DEPS) $(Echo) "Compiling $*.cc for $(BuildMode) build" $(PIC_FLAG) $(Compile.CXX) $< -o $@ -$(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES) +$(ObjDir)/%.o: %.c $(COMPILE_DEPS) $(Echo) "Compiling $*.c for $(BuildMode) build" $(PIC_FLAG) $(Compile.C) $< -o $@ -$(ObjDir)/%.o: %.m $(ObjDir)/.dir $(BUILT_SOURCES) +$(ObjDir)/%.o: %.m $(COMPILE_DEPS) $(Echo) "Compiling $*.m for $(BuildMode) build" $(PIC_FLAG) $(Compile.C) $< -o $@ - -$(ObjDir)/%.ll: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX) - $(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)" - $(BCCompile.CXX) $< -o $@ -S $(LLVMCC_EMITIR_FLAG) - -$(ObjDir)/%.ll: %.mm $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX) - $(Echo) "Compiling $*.mm for $(BuildMode) build (bytecode)" - $(BCCompile.CXX) $< -o $@ -S $(LLVMCC_EMITIR_FLAG) - -$(ObjDir)/%.ll: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCXX) - $(Echo) "Compiling $*.cc for $(BuildMode) build (bytecode)" - $(BCCompile.CXX) $< -o $@ -S $(LLVMCC_EMITIR_FLAG) - -$(ObjDir)/%.ll: %.c $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCC) - $(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)" - $(BCCompile.C) $< -o $@ -S $(LLVMCC_EMITIR_FLAG) - -$(ObjDir)/%.ll: %.m $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMCC) - $(Echo) "Compiling $*.m for $(BuildMode) build (bytecode)" - $(BCCompile.C) $< -o $@ -S $(LLVMCC_EMITIR_FLAG) - endif ## Rules for building preprocessed (.i/.ii) outputs. -$(BuildMode)/%.ii: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) +$(BuildMode)/%.ii: %.cpp $(COMPILE_DEPS) $(Echo) "Compiling $*.cpp for $(BuildMode) build to .ii file" $(Verb) $(Preprocess.CXX) $< -o $@ -$(BuildMode)/%.ii: %.mm $(ObjDir)/.dir $(BUILT_SOURCES) +$(BuildMode)/%.ii: %.mm $(COMPILE_DEPS) $(Echo) "Compiling $*.mm for $(BuildMode) build to .ii file" $(Verb) $(Preprocess.CXX) $< -o $@ -$(BuildMode)/%.ii: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) +$(BuildMode)/%.ii: %.cc $(COMPILE_DEPS) $(Echo) "Compiling $*.cc for $(BuildMode) build to .ii file" $(Verb) $(Preprocess.CXX) $< -o $@ -$(BuildMode)/%.i: %.c $(ObjDir)/.dir $(BUILT_SOURCES) +$(BuildMode)/%.i: %.c $(COMPILE_DEPS) $(Echo) "Compiling $*.c for $(BuildMode) build to .i file" $(Verb) $(Preprocess.C) $< -o $@ -$(BuildMode)/%.i: %.m $(ObjDir)/.dir $(BUILT_SOURCES) +$(BuildMode)/%.i: %.m $(COMPILE_DEPS) $(Echo) "Compiling $*.m for $(BuildMode) build to .i file" $(Verb) $(Preprocess.C) $< -o $@ -$(ObjDir)/%.s: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) +$(ObjDir)/%.s: %.cpp $(COMPILE_DEPS) $(Echo) "Compiling $*.cpp to asm for $(BuildMode) build" $(PIC_FLAG) $(Compile.CXX) $< -o $@ -S -$(ObjDir)/%.s: %.mm $(ObjDir)/.dir $(BUILT_SOURCES) +$(ObjDir)/%.s: %.mm $(COMPILE_DEPS) $(Echo) "Compiling $*.mm to asm for $(BuildMode) build" $(PIC_FLAG) $(Compile.CXX) $< -o $@ -S -$(ObjDir)/%.s: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) +$(ObjDir)/%.s: %.cc $(COMPILE_DEPS) $(Echo) "Compiling $*.cc to asm for $(BuildMode) build" $(PIC_FLAG) $(Compile.CXX) $< -o $@ -S -$(ObjDir)/%.s: %.c $(ObjDir)/.dir $(BUILT_SOURCES) +$(ObjDir)/%.s: %.c $(COMPILE_DEPS) $(Echo) "Compiling $*.c to asm for $(BuildMode) build" $(PIC_FLAG) $(Compile.C) $< -o $@ -S -$(ObjDir)/%.s: %.m $(ObjDir)/.dir $(BUILT_SOURCES) +$(ObjDir)/%.s: %.m $(COMPILE_DEPS) $(Echo) "Compiling $*.m to asm for $(BuildMode) build" $(PIC_FLAG) $(Compile.C) $< -o $@ -S - -# make the C and C++ compilers strip debug info out of bytecode libraries. -ifdef DEBUG_RUNTIME -$(ObjectsBC): $(ObjDir)/%.bc: $(ObjDir)/%.ll $(LOPT) - $(Echo) "Compiling $*.ll to $*.bc for $(BuildMode) build (bytecode)" - $(Verb) $(LOPT) $< -std-compile-opts -o $@ -else -$(ObjectsBC): $(ObjDir)/%.bc: $(ObjDir)/%.ll $(LOPT) - $(Echo) "Compiling $*.ll to $*.bc for $(BuildMode) build (bytecode)" - $(Verb) $(LOPT) $< -std-compile-opts -strip-debug -o $@ -endif - - -#--------------------------------------------------------- -# Provide rule to build .bc files from .ll sources, -# regardless of dependencies -#--------------------------------------------------------- -$(ObjDir)/%.bc: %.ll $(ObjDir)/.dir $(LLVMAS) - $(Echo) "Compiling $*.ll for $(BuildMode) build" - $(Verb) $(LLVMAS) $< -f -o $@ - ############################################################################### # TABLEGEN: Provide rules for running tblgen to produce *.inc files ############################################################################### @@ -1701,7 +1640,7 @@ TDFiles := $(strip $(wildcard $(PROJ_SRC_DIR)/*.td) \ $(LLVM_SRC_ROOT)/include/llvm/Target/TargetSchedule.td \ $(LLVM_SRC_ROOT)/include/llvm/Target/TargetSelectionDAG.td \ $(LLVM_SRC_ROOT)/include/llvm/CodeGen/ValueTypes.td) \ - $(wildcard $(LLVM_SRC_ROOT)/include/llvm/Intrinsics*.td) + $(wildcard $(LLVM_SRC_ROOT)/include/llvm/IR/Intrinsics*.td) # All .inc.tmp files depend on the .td files. $(INCTMPFiles) : $(TDFiles) @@ -1756,11 +1695,6 @@ $(ObjDir)/%GenDisassemblerTables.inc.tmp : %.td $(ObjDir)/.dir $(LLVM_TBLGEN) $(Echo) "Building $(.td.expanded. This is useful for debugging. +$(TARGET:%=%.td.expanded): \ +%.td.expanded : %.td $(LLVM_TBLGEN) $(TDFiles) + $(Echo) "Building a fully expanded version of $(>\n"; } - CallGraph::print(OS, 0); + CallGraphWrapperPass::print(OS, 0); } virtual void releaseMemory() { @@ -73,7 +73,7 @@ class DataStructureCallGraph : public CallGraph { // override this to adjust the this pointer as needed for the specified pass // info. virtual void *getAdjustedAnalysisPointer(AnalysisID PI) { - if (PI == &CallGraph::ID) + if (PI == &CallGraphAnalysis::ID) return (CallGraph*)this; return this; } @@ -95,11 +95,11 @@ class DataStructureCallGraph : public CallGraph { virtual void destroy() { // CallsExternalNode is not in the function map, delete it explicitly. if (CallsExternalNode) { - CallsExternalNode->allReferencesDropped(); + // CallsExternalNode->allReferencesDropped(); FIXME FIXME FIXME FIXME delete CallsExternalNode; CallsExternalNode = 0; } - CallGraph::releaseMemory(); + CallGraphWrapperPass::releaseMemory(); } }; diff --git a/include/assistDS/Devirt.h b/include/assistDS/Devirt.h index ee386aca9..0dba3ac81 100644 --- a/include/assistDS/Devirt.h +++ b/include/assistDS/Devirt.h @@ -21,7 +21,7 @@ #include "llvm/IR/Function.h" #include "llvm/IR/Instructions.h" #include "llvm/IR/DerivedTypes.h" -#include "llvm/InstVisitor.h" +#include "llvm/IR/InstVisitor.h" #include "llvm/IR/DataLayout.h" using namespace llvm; @@ -41,7 +41,7 @@ namespace llvm { dsa::CallTargetFinder *CTF; // Access to the target data analysis pass - DataLayout * TD; + const DataLayout * TD; // Worklist of call sites to transform std::vector Worklist; @@ -63,7 +63,7 @@ namespace llvm { virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequired >(); - AU.addRequired(); + AU.addRequired(); } // Visitor methods for analyzing instructions diff --git a/include/assistDS/Int2PtrCmp.h b/include/assistDS/Int2PtrCmp.h index eca1d42a9..414b2ed0d 100644 --- a/include/assistDS/Int2PtrCmp.h +++ b/include/assistDS/Int2PtrCmp.h @@ -26,13 +26,13 @@ namespace llvm { // class Int2PtrCmp : public ModulePass { private: - DataLayout * TD; + const DataLayout * TD; public: static char ID; Int2PtrCmp() : ModulePass(ID) {} virtual bool runOnModule(Module& M); virtual void getAnalysisUsage(AnalysisUsage &AU) const { - AU.addRequired(); + AU.addRequired(); } }; diff --git a/include/assistDS/SimplifyGEP.h b/include/assistDS/SimplifyGEP.h index 12a77979e..550150997 100644 --- a/include/assistDS/SimplifyGEP.h +++ b/include/assistDS/SimplifyGEP.h @@ -22,13 +22,13 @@ namespace llvm { // class SimplifyGEP : public ModulePass { private: - DataLayout * TD; + const DataLayout * TD; public: static char ID; SimplifyGEP() : ModulePass(ID) {} virtual bool runOnModule(Module& M); virtual void getAnalysisUsage(AnalysisUsage &AU) const { - AU.addRequired(); + AU.addRequired(); } }; } diff --git a/include/assistDS/TypeChecks.h b/include/assistDS/TypeChecks.h index 279edd256..92de3b6ff 100644 --- a/include/assistDS/TypeChecks.h +++ b/include/assistDS/TypeChecks.h @@ -20,8 +20,8 @@ #include "llvm/IR/Instructions.h" #include "llvm/IR/Function.h" #include "llvm/Pass.h" -#include "llvm/Support/CallSite.h" -#include "llvm/Analysis/Dominators.h" +#include "llvm/IR/CallSite.h" +#include "llvm/IR/Dominators.h" #include "llvm/Analysis/LoopInfo.h" #include @@ -49,7 +49,7 @@ class TypeChecks : public ModulePass { std::map BitCast_MD_Map; // Analysis from other passes. - DataLayout *TD; + const DataLayout *TD; AddressTakenAnalysis* addrAnalysis; unsigned int getTypeMarker(Type*); @@ -100,8 +100,8 @@ class TypeChecks : public ModulePass { virtual void print(raw_ostream &OS, const Module *M) const; virtual void getAnalysisUsage(AnalysisUsage &AU) const { - AU.addRequired(); - AU.addRequired(); + AU.addRequired(); + AU.addRequired(); AU.addRequired(); AU.addRequired(); } diff --git a/include/assistDS/TypeChecksOpt.h b/include/assistDS/TypeChecksOpt.h index b2ae7415c..0bf0e5dda 100644 --- a/include/assistDS/TypeChecksOpt.h +++ b/include/assistDS/TypeChecksOpt.h @@ -19,7 +19,7 @@ #include "llvm/Pass.h" #include "llvm/IR/DataLayout.h" #include "llvm/IR/Instructions.h" -#include "llvm/Support/CallSite.h" +#include "llvm/IR/CallSite.h" #include diff --git a/include/dsa/CallTargets.h b/include/dsa/CallTargets.h index 344cc54d0..7130340d7 100644 --- a/include/dsa/CallTargets.h +++ b/include/dsa/CallTargets.h @@ -16,7 +16,7 @@ #define LLVM_ANALYSIS_CALLTARGETS_H #include "llvm/Pass.h" -#include "llvm/Support/CallSite.h" +#include "llvm/IR/CallSite.h" #include "dsa/DataStructure.h" #include diff --git a/include/dsa/DSCallGraph.h b/include/dsa/DSCallGraph.h index 062bea6da..b39a662f3 100644 --- a/include/dsa/DSCallGraph.h +++ b/include/dsa/DSCallGraph.h @@ -19,7 +19,7 @@ #include #include "llvm/ADT/EquivalenceClasses.h" -#include "llvm/Support/CallSite.h" +#include "llvm/IR/CallSite.h" #include #include diff --git a/include/dsa/DSSupport.h b/include/dsa/DSSupport.h index d233bb060..8d58bb434 100644 --- a/include/dsa/DSSupport.h +++ b/include/dsa/DSSupport.h @@ -20,7 +20,7 @@ #include #include "llvm/ADT/DenseSet.h" -#include "llvm/Support/CallSite.h" +#include "llvm/IR/CallSite.h" namespace llvm { diff --git a/include/dsa/DataStructure.h b/include/dsa/DataStructure.h index d27085a98..bd2be4871 100644 --- a/include/dsa/DataStructure.h +++ b/include/dsa/DataStructure.h @@ -22,7 +22,7 @@ #include "llvm/Pass.h" #include "llvm/IR/DataLayout.h" -#include "llvm/Support/CallSite.h" +#include "llvm/IR/CallSite.h" #include "llvm/ADT/EquivalenceClasses.h" #include "llvm/ADT/DenseSet.h" @@ -45,7 +45,7 @@ class DataStructures : public ModulePass { typedef std::map DSInfoTy; /// DataLayout, comes in handy - DataLayout* TD; + const DataLayout* TD; /// Pass to get Graphs from DataStructures* GraphSource; @@ -87,7 +87,7 @@ class DataStructures : public ModulePass { std::vector GlobalFunctionList; void init(DataStructures* D, bool clone, bool useAuxCalls, bool copyGlobalAuxCalls, bool resetAux); - void init(DataLayout* T); + void init(const DataLayout* T); void formGlobalECs(); @@ -139,7 +139,7 @@ class DataStructures : public ModulePass { EquivalenceClasses &getGlobalECs() { return GlobalECs; } - DataLayout& getDataLayout() const { return *TD; } + const DataLayout& getDataLayout() const { return *TD; } const DSCallGraph& getCallGraph() const { return callgraph; } @@ -165,7 +165,7 @@ class BasicDataStructures : public DataStructures { /// getAnalysisUsage - This obviously provides a data structure graph. /// virtual void getAnalysisUsage(AnalysisUsage &AU) const { - AU.addRequired(); + AU.addRequired(); AU.setPreservesAll(); } }; @@ -188,7 +188,7 @@ class LocalDataStructures : public DataStructures { /// getAnalysisUsage - This obviously provides a data structure graph. /// virtual void getAnalysisUsage(AnalysisUsage &AU) const { - AU.addRequired(); + AU.addRequired(); AU.addRequired(); AU.setPreservesAll(); } diff --git a/include/dsa/TypeSafety.h b/include/dsa/TypeSafety.h index ee0740250..3317997b2 100644 --- a/include/dsa/TypeSafety.h +++ b/include/dsa/TypeSafety.h @@ -49,7 +49,7 @@ struct TypeSafety : public ModulePass { bool typeFieldsOverlap (const DSNode * N); // Pointers to prerequisite passes - DataLayout * TD; + const DataLayout * TD; dsa * dsaPass; // Data structures @@ -65,7 +65,7 @@ struct TypeSafety : public ModulePass { } virtual void getAnalysisUsage(AnalysisUsage &AU) const { - AU.addRequired(); + AU.addRequired(); AU.addRequired(); AU.setPreservesAll(); } diff --git a/include/smack/DSAAliasAnalysis.h b/include/smack/DSAAliasAnalysis.h index bec471ab1..2add8c689 100644 --- a/include/smack/DSAAliasAnalysis.h +++ b/include/smack/DSAAliasAnalysis.h @@ -15,7 +15,7 @@ #ifndef LLVM_ANALYSIS_DATA_STRUCTURE_AA_H #define LLVM_ANALYSIS_DATA_STRUCTURE_AA_H -#include "llvm/InstVisitor.h" +#include "llvm/IR/InstVisitor.h" #include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Analysis/Passes.h" #include "llvm/IR/Constants.h" diff --git a/include/smack/SmackInstGenerator.h b/include/smack/SmackInstGenerator.h index 3aa99ad67..a909970a2 100644 --- a/include/smack/SmackInstGenerator.h +++ b/include/smack/SmackInstGenerator.h @@ -7,7 +7,7 @@ #include "smack/BoogieAst.h" #include "smack/SmackRep.h" -#include "llvm/InstVisitor.h" +#include "llvm/IR/InstVisitor.h" #include namespace smack { diff --git a/include/smack/SmackModuleGenerator.h b/include/smack/SmackModuleGenerator.h index 19fcafb24..416449872 100644 --- a/include/smack/SmackModuleGenerator.h +++ b/include/smack/SmackModuleGenerator.h @@ -10,7 +10,7 @@ #include "smack/DSAAliasAnalysis.h" #include "llvm/Analysis/AliasAnalysis.h" #include "llvm/IR/DataLayout.h" -#include "llvm/Support/CFG.h" +#include "llvm/IR/CFG.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/Debug.h" #include "llvm/Support/GraphWriter.h" @@ -33,7 +33,7 @@ class SmackModuleGenerator : public llvm::ModulePass { virtual void getAnalysisUsage(llvm::AnalysisUsage& AU) const { AU.setPreservesAll(); - AU.addRequired(); + AU.addRequired(); AU.addRequired(); } diff --git a/include/smack/SmackRep.h b/include/smack/SmackRep.h index 0b45427fe..e18453119 100644 --- a/include/smack/SmackRep.h +++ b/include/smack/SmackRep.h @@ -9,11 +9,11 @@ #include "smack/BoogieAst.h" #include "smack/SmackOptions.h" #include "smack/DSAAliasAnalysis.h" -#include "llvm/InstVisitor.h" +#include "llvm/IR/InstVisitor.h" #include "llvm/IR/DataLayout.h" #include "llvm/IR/InstrTypes.h" #include "llvm/Support/Debug.h" -#include "llvm/Support/GetElementPtrTypeIterator.h" +#include "llvm/IR/GetElementPtrTypeIterator.h" #include "llvm/Support/GraphWriter.h" #include "llvm/Support/Regex.h" #include diff --git a/lib/AssistDS/ArgCast.cpp b/lib/AssistDS/ArgCast.cpp index 3b931cdb7..8154526f2 100644 --- a/lib/AssistDS/ArgCast.cpp +++ b/lib/AssistDS/ArgCast.cpp @@ -56,7 +56,7 @@ bool ArgCast::runOnModule(Module& M) { if (I->mayBeOverridden()) continue; // Find all uses of this function - for(Value::use_iterator ui = I->use_begin(), ue = I->use_end(); ui != ue; ) { + for(Value::user_iterator ui = I->user_begin(), ue = I->user_end(); ui != ue; ) { // check if is ever casted to a different function type ConstantExpr *CE = dyn_cast(*ui++); if(!CE) @@ -78,8 +78,8 @@ bool ArgCast::runOnModule(Module& M) { if(FTy->getNumParams() != I->arg_size() && !FTy->isVarArg()) continue; - for(Value::use_iterator uii = CE->use_begin(), - uee = CE->use_end(); uii != uee; ++uii) { + for(Value::user_iterator uii = CE->user_begin(), + uee = CE->user_end(); uii != uee; ++uii) { // Find all uses of the casted value, and check if it is // used in a Call Instruction if (CallInst* CI = dyn_cast(*uii)) { diff --git a/lib/AssistDS/ArgSimplify.cpp b/lib/AssistDS/ArgSimplify.cpp index c11b26dd3..26459eb80 100644 --- a/lib/AssistDS/ArgSimplify.cpp +++ b/lib/AssistDS/ArgSimplify.cpp @@ -34,14 +34,14 @@ namespace { static void simplify(Function *F, unsigned arg_count, Type* type) { // Go through all uses of the function - for(Value::use_iterator ui = F->use_begin(), ue = F->use_end(); + for(Value::user_iterator ui = F->user_begin(), ue = F->user_end(); ui != ue; ++ui) { if (Constant *C = dyn_cast(*ui)) { if (ConstantExpr *CE = dyn_cast(C)) { if (CE->getOpcode() == Instruction::BitCast) { if(CE->getOperand(0) == F) { - for(Value::use_iterator uii = CE->use_begin(), uee = CE->use_end(); + for(Value::user_iterator uii = CE->user_begin(), uee = CE->user_end(); uii != uee; ) { // check if it is ever used as a call (bitcast F to ...)() if (CallInst* CI = dyn_cast(*uii++)) { @@ -150,7 +150,7 @@ namespace { for (Function::arg_iterator ii = I->arg_begin(), ee = I->arg_end(); ii != ee; ++ii) { bool change = true; - for(Value::use_iterator ui = ii->use_begin(), ue = ii->use_end(); + for(Value::user_iterator ui = ii->user_begin(), ue = ii->user_end(); ui != ue; ++ui) { // check if the argument is used exclusively in ICmp Instructions if(!isa(*ui)){ diff --git a/lib/AssistDS/DSNodeEquivs.cpp b/lib/AssistDS/DSNodeEquivs.cpp index d0bed286d..eaa3c3a47 100644 --- a/lib/AssistDS/DSNodeEquivs.cpp +++ b/lib/AssistDS/DSNodeEquivs.cpp @@ -12,11 +12,12 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "DSNodeEquivs" #include "assistDS/DSNodeEquivs.h" #include "llvm/IR/Constants.h" #include "llvm/IR/Module.h" -#include "llvm/Support/InstIterator.h" +#include "llvm/IR/InstIterator.h" #include "llvm/ADT/SmallSet.h" #include @@ -245,11 +246,10 @@ const DSNode *DSNodeEquivs::getMemberForValue(const Value *V) { std::deque WL; SmallSet Visited; - // BEGIN BANDAGE: caught a bug here after upgrade to OSX Mavericks - // ORIGINAL: WL.insert(WL.end(), V->use_begin(), V->use_end()); - for ( llvm::Value::const_use_iterator i = V->use_begin(); i != V->use_end(); ++i ) + // FIXME FIXME FIXME for some reason the first attempt segfaults + // WL.insert(WL.end(), V->user_begin(), V->user_end()); + for (llvm::Value::const_user_iterator i = V->user_begin(), e = V->user_end(); i != e; ++i) WL.push_back(*i); - // END BANDAGE do { const User *TheUser = WL.front(); @@ -276,7 +276,7 @@ const DSNode *DSNodeEquivs::getMemberForValue(const Value *V) { // // If this use is of some other nature, look at the users of this use. // - WL.insert(WL.end(), TheUser->use_begin(), TheUser->use_end()); + WL.insert(WL.end(), TheUser->user_begin(), TheUser->user_end()); } } while (!WL.empty()); } diff --git a/lib/AssistDS/DataStructureCallGraph.cpp b/lib/AssistDS/DataStructureCallGraph.cpp index adddd1f99..7f039a17a 100644 --- a/lib/AssistDS/DataStructureCallGraph.cpp +++ b/lib/AssistDS/DataStructureCallGraph.cpp @@ -19,8 +19,8 @@ #include "llvm/ADT/SmallPtrSet.h" #include "llvm/IR/Instructions.h" #include "llvm/IR/IntrinsicInst.h" -#include "llvm/Support/CallSite.h" -#include "llvm/Support/InstIterator.h" +#include "llvm/IR/CallSite.h" +#include "llvm/IR/InstIterator.h" using namespace llvm; @@ -31,7 +31,7 @@ namespace { static RegisterPass X("dsa-cg", "DSA-based CallGraph implementation"); -RegisterAnalysisGroup Y(X); +RegisterAnalysisGroup Y(X); } diff --git a/lib/AssistDS/Devirt.cpp b/lib/AssistDS/Devirt.cpp index 4a860a28f..b861a8f04 100644 --- a/lib/AssistDS/Devirt.cpp +++ b/lib/AssistDS/Devirt.cpp @@ -399,7 +399,7 @@ Devirtualize::runOnModule (Module & M) { // Get information on the target system. // // - TD = &getAnalysis(); + TD = &getAnalysis().getDataLayout(); // Visit all of the call instructions in this function and record those that // are indirect function calls. diff --git a/lib/AssistDS/DynCount.cpp b/lib/AssistDS/DynCount.cpp index c0e9d0391..bdcac72c1 100644 --- a/lib/AssistDS/DynCount.cpp +++ b/lib/AssistDS/DynCount.cpp @@ -34,7 +34,7 @@ class Dyncount : public ModulePass { } virtual bool runOnModule (Module & M); virtual void getAnalysisUsage(AnalysisUsage &AU) const { - AU.addRequired(); + AU.addRequired(); AU.addRequired >(); } }; diff --git a/lib/AssistDS/FuncSpec.cpp b/lib/AssistDS/FuncSpec.cpp index 8f4077d1a..2d6b4bd7d 100644 --- a/lib/AssistDS/FuncSpec.cpp +++ b/lib/AssistDS/FuncSpec.cpp @@ -69,7 +69,7 @@ bool FuncSpec::runOnModule(Module& M) { } } // Now find all call sites that it is called from - for(Value::use_iterator ui = I->use_begin(), ue = I->use_end(); + for(Value::user_iterator ui = I->user_begin(), ue = I->user_end(); ui != ue; ++ui) { if (CallInst* CI = dyn_cast(*ui)) { // Check that it is the called value (and not an argument) diff --git a/lib/AssistDS/GEPExprArgs.cpp b/lib/AssistDS/GEPExprArgs.cpp index 13bd4b905..5a65e7af3 100644 --- a/lib/AssistDS/GEPExprArgs.cpp +++ b/lib/AssistDS/GEPExprArgs.cpp @@ -16,10 +16,10 @@ #include "llvm/IR/Constants.h" #include "llvm/IR/Operator.h" #include "llvm/IR/Use.h" -#include "llvm/Support/GetElementPtrTypeIterator.h" +#include "llvm/IR/GetElementPtrTypeIterator.h" #include "llvm/Transforms/Utils/Cloning.h" #include "llvm/ADT/Statistic.h" -#include "llvm/ADT/ValueMap.h" +#include "llvm/IR/ValueMap.h" #include "llvm/Support/FormattedStream.h" #include "llvm/Support/Debug.h" #include diff --git a/lib/AssistDS/IndCloner.cpp b/lib/AssistDS/IndCloner.cpp index eab32df42..2618385bd 100644 --- a/lib/AssistDS/IndCloner.cpp +++ b/lib/AssistDS/IndCloner.cpp @@ -71,7 +71,7 @@ IndClone::runOnModule(Module& M) { // function by the linker. // if (!I->isDeclaration() && !I->mayBeOverridden()) { - for (Value::use_iterator ui = I->use_begin(), ue = I->use_end(); + for (Value::user_iterator ui = I->user_begin(), ue = I->user_end(); ui != ue; ++ui) { if (!isa(*ui) && !isa(*ui)) { if(!ui->use_empty()) @@ -146,8 +146,8 @@ IndClone::runOnModule(Module& M) { // Find all uses of the function that use it as a direct call. Change // them to use the clone. // - for (Value::use_iterator ui = Original->use_begin(), - ue = Original->use_end(); + for (Value::user_iterator ui = Original->user_begin(), + ue = Original->user_end(); ui != ue; ) { CallInst *CI = dyn_cast(*ui); ui++; diff --git a/lib/AssistDS/Int2PtrCmp.cpp b/lib/AssistDS/Int2PtrCmp.cpp index f6cd44d04..7242f12b4 100644 --- a/lib/AssistDS/Int2PtrCmp.cpp +++ b/lib/AssistDS/Int2PtrCmp.cpp @@ -18,7 +18,7 @@ #include "llvm/ADT/Statistic.h" #include "llvm/Support/FormattedStream.h" #include "llvm/Support/Debug.h" -#include "llvm/Support/PatternMatch.h" +#include "llvm/IR/PatternMatch.h" #include #include @@ -45,7 +45,7 @@ using namespace PatternMatch; // false - The module was not modified. // bool Int2PtrCmp::runOnModule(Module& M) { - TD = &getAnalysis(); + TD = &getAnalysis().getDataLayout(); for (Module::iterator F = M.begin(); F != M.end(); ++F) { for (Function::iterator B = F->begin(), FE = F->end(); B != FE; ++B) { for (BasicBlock::iterator I = B->begin(), BE = B->end(); I != BE;) { diff --git a/lib/AssistDS/LoadArgs.cpp b/lib/AssistDS/LoadArgs.cpp index 4039ec0d4..595b82b02 100644 --- a/lib/AssistDS/LoadArgs.cpp +++ b/lib/AssistDS/LoadArgs.cpp @@ -17,10 +17,10 @@ #include "assistDS/LoadArgs.h" #include "llvm/IR/Constants.h" #include "llvm/IR/Use.h" -#include "llvm/Support/GetElementPtrTypeIterator.h" +#include "llvm/IR/GetElementPtrTypeIterator.h" #include "llvm/Transforms/Utils/Cloning.h" #include "llvm/ADT/Statistic.h" -#include "llvm/ADT/ValueMap.h" +#include "llvm/IR/ValueMap.h" #include "llvm/Support/FormattedStream.h" #include "llvm/Support/Debug.h" #include diff --git a/lib/AssistDS/MergeGEP.cpp b/lib/AssistDS/MergeGEP.cpp index 2378a33eb..70739ced3 100644 --- a/lib/AssistDS/MergeGEP.cpp +++ b/lib/AssistDS/MergeGEP.cpp @@ -18,7 +18,7 @@ #include "llvm/IR/Instructions.h" #include "llvm/IR/Operator.h" #include "llvm/IR/Module.h" -#include "llvm/Support/GetElementPtrTypeIterator.h" +#include "llvm/IR/GetElementPtrTypeIterator.h" #include "llvm/Transforms/Utils/Cloning.h" #include "llvm/ADT/Statistic.h" #include "llvm/Support/FormattedStream.h" diff --git a/lib/AssistDS/SVADevirt.cpp b/lib/AssistDS/SVADevirt.cpp index 070ba3e35..53fe10856 100644 --- a/lib/AssistDS/SVADevirt.cpp +++ b/lib/AssistDS/SVADevirt.cpp @@ -176,7 +176,7 @@ namespace { std::set safecalls; std::vector toDelete; - for (Value::use_iterator ii = ams->use_begin(), ee = ams->use_end(); + for (Value::user_iterator ii = ams->user_begin(), ee = ams->user_end(); ii != ee; ++ii) { if (CallInst* CI = dyn_cast(*ii)) { std::cerr << "Found safe call site in " @@ -195,7 +195,7 @@ namespace { for(std::set::iterator i = safecalls.begin(), e = safecalls.end(); i != e; ++i) { - for (Value::use_iterator uii = (*i)->use_begin(), uie = (*i)->use_end(); + for (Value::user_iterator uii = (*i)->user_begin(), uie = (*i)->user_end(); uii != uie; ++uii) { CallSite cs = CallSite::get(*uii); bool isSafeCall = cs.getInstruction() && diff --git a/lib/AssistDS/SimplifyExtractValue.cpp b/lib/AssistDS/SimplifyExtractValue.cpp index 8a62ee557..5a4eb9597 100644 --- a/lib/AssistDS/SimplifyExtractValue.cpp +++ b/lib/AssistDS/SimplifyExtractValue.cpp @@ -20,7 +20,7 @@ #include "llvm/ADT/ArrayRef.h" #include "llvm/Support/FormattedStream.h" #include "llvm/Support/Debug.h" -#include "llvm/Support/PatternMatch.h" +#include "llvm/IR/PatternMatch.h" #include "llvm/IR/DataLayout.h" #include diff --git a/lib/AssistDS/SimplifyGEP.cpp b/lib/AssistDS/SimplifyGEP.cpp index 08257ba56..7aa3bf2cd 100644 --- a/lib/AssistDS/SimplifyGEP.cpp +++ b/lib/AssistDS/SimplifyGEP.cpp @@ -15,7 +15,7 @@ #define DEBUG_TYPE "simplify-gep" #include "assistDS/SimplifyGEP.h" -#include "llvm/Support/GetElementPtrTypeIterator.h" +#include "llvm/IR/GetElementPtrTypeIterator.h" #include "llvm/Support/FormattedStream.h" #include "llvm/Support/Debug.h" #include "llvm/IR/Constants.h" @@ -75,7 +75,7 @@ static void preprocess(Module& M) { // false - The module was not modified. // bool SimplifyGEP::runOnModule(Module& M) { - TD = &getAnalysis(); + TD = &getAnalysis().getDataLayout(); preprocess(M); for (Module::iterator F = M.begin(); F != M.end(); ++F){ for (Function::iterator B = F->begin(), FE = F->end(); B != FE; ++B) { diff --git a/lib/AssistDS/SimplifyInsertValue.cpp b/lib/AssistDS/SimplifyInsertValue.cpp index 9944cd000..b4f7053c6 100644 --- a/lib/AssistDS/SimplifyInsertValue.cpp +++ b/lib/AssistDS/SimplifyInsertValue.cpp @@ -18,7 +18,7 @@ #include "llvm/ADT/Statistic.h" #include "llvm/Support/FormattedStream.h" #include "llvm/Support/Debug.h" -#include "llvm/Support/PatternMatch.h" +#include "llvm/IR/PatternMatch.h" #include "llvm/IR/DataLayout.h" #include diff --git a/lib/AssistDS/SimplifyLoad.cpp b/lib/AssistDS/SimplifyLoad.cpp index df01be878..1716d6e3c 100644 --- a/lib/AssistDS/SimplifyLoad.cpp +++ b/lib/AssistDS/SimplifyLoad.cpp @@ -16,7 +16,7 @@ #include "llvm/ADT/Statistic.h" #include "llvm/Support/FormattedStream.h" #include "llvm/Support/Debug.h" -#include "llvm/Support/PatternMatch.h" +#include "llvm/IR/PatternMatch.h" #include "llvm/IR/DataLayout.h" #include diff --git a/lib/AssistDS/StructReturnToPointer.cpp b/lib/AssistDS/StructReturnToPointer.cpp index f7dd4fe9a..323a29122 100644 --- a/lib/AssistDS/StructReturnToPointer.cpp +++ b/lib/AssistDS/StructReturnToPointer.cpp @@ -18,7 +18,7 @@ #include "llvm/IR/IRBuilder.h" #include "llvm/Transforms/Utils/Cloning.h" #include "llvm/ADT/Statistic.h" -#include "llvm/ADT/ValueMap.h" +#include "llvm/IR/ValueMap.h" #include "llvm/Support/FormattedStream.h" #include "llvm/Support/Debug.h" @@ -119,7 +119,7 @@ bool StructRet::runOnModule(Module& M) { } } - for(Value::use_iterator ui = F->use_begin(), ue = F->use_end(); + for(Value::user_iterator ui = F->user_begin(), ue = F->user_end(); ui != ue; ) { CallInst *CI = dyn_cast(*ui++); if(!CI) diff --git a/lib/AssistDS/TypeChecks.cpp b/lib/AssistDS/TypeChecks.cpp index 7d1a1e873..051836c59 100644 --- a/lib/AssistDS/TypeChecks.cpp +++ b/lib/AssistDS/TypeChecks.cpp @@ -11,14 +11,14 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "dsa-type-checks" #include "assistDS/TypeChecks.h" #include "llvm/IR/Constants.h" #include "llvm/Transforms/Utils/Cloning.h" #include "llvm/IR/DerivedTypes.h" #include "llvm/IR/Module.h" -#include "llvm/Assembly/Writer.h" #include "llvm/Support/Debug.h" -#include "llvm/Support/InstIterator.h" +#include "llvm/IR/InstIterator.h" #include "llvm/Support/raw_ostream.h" #include "llvm/IR/Intrinsics.h" #include "llvm/Support/CommandLine.h" @@ -152,7 +152,7 @@ bool TypeChecks::runOnModule(Module &M) { bool modified = false; // Flags whether we modified the module. bool transformIndirectCalls = true; - TD = &getAnalysis(); + TD = &getAnalysis().getDataLayout(); addrAnalysis = &getAnalysis(); // Create the necessary prototypes @@ -257,7 +257,7 @@ bool TypeChecks::runOnModule(Module &M) { Function &F = *MI; if(F.isDeclaration()) continue; - DominatorTree & DT = getAnalysis(F); + DominatorTree & DT = getAnalysis(F).getDomTree(); std::deque Worklist; Worklist.push_back (DT.getRootNode()); while(Worklist.size()) { @@ -321,8 +321,8 @@ bool TypeChecks::runOnModule(Module &M) { Constant *CNew = ConstantExpr::getBitCast(FI->second, F->getType()); std::set toReplace; - for(Function::use_iterator User = F->use_begin(); - User != F->use_end();++User) { + for(Function::user_iterator User = F->user_begin(); + User != F->user_end();++User) { toReplace.insert(*User); } for(std::set::iterator userI = toReplace.begin(); userI != toReplace.end(); ++userI) { @@ -330,8 +330,8 @@ bool TypeChecks::runOnModule(Module &M) { if(Constant *C = dyn_cast(user)) { if(!isa(C)) { bool changeUse = true; - for(Value::use_iterator II = user->use_begin(); - II != user->use_end(); II++) { + for(Value::user_iterator II = user->user_begin(); + II != user->user_end(); II++) { if(CallInst *CI = dyn_cast(*II)) if(CI->getCalledFunction()) { if(CI->getCalledFunction()->isDeclaration()) @@ -506,7 +506,7 @@ void TypeChecks::optimizeChecks(Module &M) { Function &F = *MI; if(F.isDeclaration()) continue; - DominatorTree & DT = getAnalysis(F); + DominatorTree & DT = getAnalysis(F).getDomTree(); std::deque Worklist; Worklist.push_back (DT.getRootNode()); while(Worklist.size()) { @@ -520,7 +520,7 @@ void TypeChecks::optimizeChecks(Module &M) { if(CI->getCalledFunction() != checkTypeInst) continue; std::listtoDelete; - for(Value::use_iterator User = CI->getOperand(3)->use_begin(); User != CI->getOperand(3)->use_end(); ++User) { + for(Value::user_iterator User = CI->getOperand(3)->user_begin(); User != CI->getOperand(3)->user_end(); ++User) { CallInst *CI2 = dyn_cast(*User); if(!CI2) continue; @@ -550,7 +550,7 @@ void TypeChecks::optimizeChecks(Module &M) { Function &F = *MI; if(F.isDeclaration()) continue; - DominatorTree & DT = getAnalysis(F); + DominatorTree & DT = getAnalysis(F).getDomTree(); LoopInfo & LI = getAnalysis(F); std::deque Worklist; Worklist.push_back (DT.getRootNode()); @@ -697,7 +697,7 @@ bool TypeChecks::visitAddressTakenFunction(Module &M, Function &F) { std::vectortoDelete; // Find all uses of the function - for(Value::use_iterator ui = F.use_begin(), ue = F.use_end(); + for(Value::user_iterator ui = F.user_begin(), ue = F.user_end(); ui != ue;++ui) { if(InvokeInst *II = dyn_cast(*ui)) { if(II->getCalledValue()->stripPointerCasts() != &F) @@ -927,7 +927,7 @@ bool TypeChecks::visitInternalVarArgFunction(Module &M, Function &F) { std::vectortoDelete; // Find all uses of the function - for(Value::use_iterator ui = F.use_begin(), ue = F.use_end(); + for(Value::user_iterator ui = F.user_begin(), ue = F.user_end(); ui != ue;ui ++) { // Check for call sites @@ -1051,7 +1051,7 @@ bool TypeChecks::visitInternalByValFunction(Module &M, Function &F) { // Update the call sites std::vectortoDelete; - for(Value::use_iterator ui = F.use_begin(), ue = F.use_end(); + for(Value::user_iterator ui = F.user_begin(), ue = F.user_end(); ui != ue; ui++) { // Check that F is the called value if(InvokeInst *II = dyn_cast(*ui)) { @@ -2124,7 +2124,7 @@ bool TypeChecks::visitLoadInst(Module &M, LoadInst &LI) { // BCI - ptr // I - instruction whose uses to instrument bool TypeChecks::visitUses(Instruction *I, Instruction *AI, Value *BCI) { - for(Value::use_iterator II = I->use_begin(); II != I->use_end(); ++II) { + for(Value::user_iterator II = I->user_begin(); II != I->user_end(); ++II) { if(DisablePtrCmpChecks) { if(isa(*II)) { if(I->getType()->isPointerTy()) diff --git a/lib/AssistDS/TypeChecksOpt.cpp b/lib/AssistDS/TypeChecksOpt.cpp index a78a3be9d..b8ec53b73 100644 --- a/lib/AssistDS/TypeChecksOpt.cpp +++ b/lib/AssistDS/TypeChecksOpt.cpp @@ -11,14 +11,14 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "dsa-type-checks-opt" #include "assistDS/TypeChecksOpt.h" #include "llvm/IR/Constants.h" #include "llvm/Transforms/Utils/Cloning.h" #include "llvm/IR/DerivedTypes.h" #include "llvm/IR/Module.h" -#include "llvm/Assembly/Writer.h" #include "llvm/Support/Debug.h" -#include "llvm/Support/InstIterator.h" +#include "llvm/IR/InstIterator.h" #include "llvm/Support/raw_ostream.h" #include "llvm/IR/Intrinsics.h" #include "llvm/Support/CommandLine.h" @@ -136,7 +136,7 @@ bool TypeChecksOpt::runOnModule(Module &M) { NULL); MallocFunc = M.getFunction("malloc"); - for(Value::use_iterator User = trackGlobal->use_begin(); User != trackGlobal->use_end(); ++User) { + for(Value::user_iterator User = trackGlobal->user_begin(); User != trackGlobal->user_end(); ++User) { CallInst *CI = dyn_cast(*User); assert(CI); if(TS->isTypeSafe(CI->getOperand(1)->stripPointerCasts(), CI->getParent()->getParent())) { @@ -149,7 +149,7 @@ bool TypeChecksOpt::runOnModule(Module &M) { } } - for(Value::use_iterator User = checkTypeInst->use_begin(); User != checkTypeInst->use_end(); ++User) { + for(Value::user_iterator User = checkTypeInst->user_begin(); User != checkTypeInst->user_end(); ++User) { CallInst *CI = dyn_cast(*User); assert(CI); @@ -158,7 +158,7 @@ bool TypeChecksOpt::runOnModule(Module &M) { } } - for(Value::use_iterator User = trackStoreInst->use_begin(); User != trackStoreInst->use_end(); ++User) { + for(Value::user_iterator User = trackStoreInst->user_begin(); User != trackStoreInst->user_end(); ++User) { CallInst *CI = dyn_cast(*User); assert(CI); @@ -169,7 +169,7 @@ bool TypeChecksOpt::runOnModule(Module &M) { // for alloca's if they are type known // assume initialized with TOP - for(Value::use_iterator User = trackUnInitInst->use_begin(); User != trackUnInitInst->use_end(); ) { + for(Value::user_iterator User = trackUnInitInst->user_begin(); User != trackUnInitInst->user_end(); ) { CallInst *CI = dyn_cast(*(User++)); assert(CI); @@ -190,7 +190,7 @@ bool TypeChecksOpt::runOnModule(Module &M) { } if(MallocFunc) { - for(Value::use_iterator User = MallocFunc->use_begin(); User != MallocFunc->use_end(); User ++) { + for(Value::user_iterator User = MallocFunc->user_begin(); User != MallocFunc->user_end(); User ++) { CallInst *CI = dyn_cast(*User); if(!CI) continue; @@ -212,7 +212,7 @@ bool TypeChecksOpt::runOnModule(Module &M) { // also do for mallocs/calloc/other allocators??? // other allocators?? - for(Value::use_iterator User = copyTypeInfo->use_begin(); User != copyTypeInfo->use_end(); ++User) { + for(Value::user_iterator User = copyTypeInfo->user_begin(); User != copyTypeInfo->user_end(); ++User) { CallInst *CI = dyn_cast(*User); assert(CI); @@ -225,7 +225,7 @@ bool TypeChecksOpt::runOnModule(Module &M) { toDelete.push_back(CI); } } - for(Value::use_iterator User = setTypeInfo->use_begin(); User != setTypeInfo->use_end(); ++User) { + for(Value::user_iterator User = setTypeInfo->user_begin(); User != setTypeInfo->user_end(); ++User) { CallInst *CI = dyn_cast(*User); assert(CI); @@ -239,7 +239,7 @@ bool TypeChecksOpt::runOnModule(Module &M) { } } - for(Value::use_iterator User = getTypeTag->use_begin(); User != getTypeTag->use_end(); ++User) { + for(Value::user_iterator User = getTypeTag->user_begin(); User != getTypeTag->user_end(); ++User) { CallInst *CI = dyn_cast(*User); assert(CI); if(TS->isTypeSafe(CI->getOperand(1)->stripPointerCasts(), CI->getParent()->getParent())) { diff --git a/lib/DSA/AddressTakenAnalysis.cpp b/lib/DSA/AddressTakenAnalysis.cpp index 7c5ed38e6..f106f20cc 100644 --- a/lib/DSA/AddressTakenAnalysis.cpp +++ b/lib/DSA/AddressTakenAnalysis.cpp @@ -22,7 +22,7 @@ #include "llvm/Support/CommandLine.h" #include "llvm/Support/FormattedStream.h" #include "llvm/Support/Debug.h" -#include "llvm/Support/CallSite.h" +#include "llvm/IR/CallSite.h" #include #include @@ -35,8 +35,8 @@ using namespace llvm; AddressTakenAnalysis::~AddressTakenAnalysis() {} static bool isAddressTaken(Value* V) { - for (Value::use_iterator I = V->use_begin(), E = V->use_end(); I != E; ++I) { - User *U = *I; + for (Value::const_use_iterator I = V->use_begin(), E = V->use_end(); I != E; ++I) { + User *U = I->getUser(); if(isa(U)) return true; if (!isa(U) && !isa(U)) { @@ -60,7 +60,7 @@ static bool isAddressTaken(Value* V) { // are never used } else { llvm::CallSite CS(cast(U)); - if (!CS.isCallee(I)) + if (!CS.isCallee(&*I)) return true; } } diff --git a/lib/DSA/AllocatorIdentification.cpp b/lib/DSA/AllocatorIdentification.cpp index 292b95001..9102f3e01 100644 --- a/lib/DSA/AllocatorIdentification.cpp +++ b/lib/DSA/AllocatorIdentification.cpp @@ -62,7 +62,7 @@ bool AllocIdentify::flowsFrom(Value *Dest,Value *Src) { bool isNotStored(Value *V) { // check that V is not stored to a location that is accessible outside this fn - for(Value::use_iterator ui = V->use_begin(), ue = V->use_end(); + for(Value::user_iterator ui = V->user_begin(), ue = V->user_end(); ui != ue; ++ui) { if(isa(*ui)) return false; @@ -110,7 +110,7 @@ bool AllocIdentify::runOnModule(Module& M) { Function* F = M.getFunction(*it); if(!F) continue; - for(Value::use_iterator ui = F->use_begin(), ue = F->use_end(); + for(Value::user_iterator ui = F->user_begin(), ue = F->user_end(); ui != ue; ++ui) { // iterate though all calls to malloc if (CallInst* CI = dyn_cast(*ui)) { @@ -162,7 +162,7 @@ bool AllocIdentify::runOnModule(Module& M) { if(!F) continue; - for(Value::use_iterator ui = F->use_begin(), ue = F->use_end(); + for(Value::user_iterator ui = F->user_begin(), ue = F->user_end(); ui != ue; ++ui) { // iterate though all calls to malloc if (CallInst* CI = dyn_cast(*ui)) { diff --git a/lib/DSA/Basic.cpp b/lib/DSA/Basic.cpp index 7c109f891..6f127f833 100644 --- a/lib/DSA/Basic.cpp +++ b/lib/DSA/Basic.cpp @@ -15,15 +15,15 @@ #include "dsa/DataStructure.h" #include "dsa/DSGraph.h" -#include "llvm/InstVisitor.h" +#include "llvm/IR/InstVisitor.h" #include "llvm/IR/Constants.h" #include "llvm/IR/DerivedTypes.h" #include "llvm/IR/Instructions.h" #include "llvm/IR/Intrinsics.h" #include "llvm/IR/Module.h" #include "llvm/IR/TypeBuilder.h" -#include "llvm/Support/InstIterator.h" -#include "llvm/Support/GetElementPtrTypeIterator.h" +#include "llvm/IR/InstIterator.h" +#include "llvm/IR/GetElementPtrTypeIterator.h" using namespace llvm; @@ -33,7 +33,7 @@ X("dsa-basic", "Basic Data Structure Analysis(No Analysis)"); char BasicDataStructures::ID = 0; bool BasicDataStructures::runOnModule(Module &M) { - init(&getAnalysis()); + init(&getAnalysis().getDataLayout()); // // Create a void pointer type. This is simply a pointer to an 8 bit value. diff --git a/lib/DSA/CallTargets.cpp b/lib/DSA/CallTargets.cpp index 72d0f523b..0814a43f8 100644 --- a/lib/DSA/CallTargets.cpp +++ b/lib/DSA/CallTargets.cpp @@ -17,6 +17,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "call-targets" #include "llvm/IR/Module.h" #include "llvm/IR/Instructions.h" #include "dsa/DataStructure.h" diff --git a/lib/DSA/DSGraph.cpp b/lib/DSA/DSGraph.cpp index 866ef1d94..3f75c776b 100644 --- a/lib/DSA/DSGraph.cpp +++ b/lib/DSA/DSGraph.cpp @@ -11,6 +11,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "DSGraph" #include "dsa/DSGraphTraits.h" #include "dsa/DataStructure.h" #include "dsa/DSGraph.h" @@ -23,7 +24,6 @@ #include "llvm/IR/Instructions.h" #include "llvm/IR/DerivedTypes.h" #include "llvm/IR/DataLayout.h" -#include "llvm/Assembly/Writer.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/Debug.h" #include "llvm/ADT/DepthFirstIterator.h" diff --git a/lib/DSA/DSTest.cpp b/lib/DSA/DSTest.cpp index 036746d0f..7d50f7da9 100644 --- a/lib/DSA/DSTest.cpp +++ b/lib/DSA/DSTest.cpp @@ -45,7 +45,6 @@ #include "llvm/Support/CommandLine.h" #include "llvm/Support/raw_ostream.h" #include "llvm/IR/ValueSymbolTable.h" -#include "llvm/Assembly/Writer.h" using namespace llvm; namespace { diff --git a/lib/DSA/DataStructure.cpp b/lib/DSA/DataStructure.cpp index 7aaa26921..b7acac7e4 100644 --- a/lib/DSA/DataStructure.cpp +++ b/lib/DSA/DataStructure.cpp @@ -11,6 +11,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "data-structure" #include "dsa/DSGraphTraits.h" #include "dsa/DataStructure.h" #include "dsa/DSGraph.h" @@ -22,7 +23,6 @@ #include "llvm/IR/Instructions.h" #include "llvm/IR/DerivedTypes.h" #include "llvm/IR/DataLayout.h" -#include "llvm/Assembly/Writer.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/Debug.h" #include "llvm/ADT/DepthFirstIterator.h" @@ -1496,7 +1496,7 @@ void DataStructures::init(DataStructures* D, bool clone, bool useAuxCalls, if (!clone) D->DSGraphsStolen = true; } -void DataStructures::init(DataLayout* T) { +void DataStructures::init(const DataLayout* T) { assert (!TD && "Already init"); GraphSource = 0; Clone = false; diff --git a/lib/DSA/DataStructureStats.cpp b/lib/DSA/DataStructureStats.cpp index 9da70bbb5..c1d2e0dfc 100644 --- a/lib/DSA/DataStructureStats.cpp +++ b/lib/DSA/DataStructureStats.cpp @@ -11,6 +11,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "DSStats" #include "dsa/DataStructure.h" #include "dsa/DSGraph.h" #include "dsa/TypeSafety.h" @@ -18,7 +19,7 @@ #include "llvm/IR/Constants.h" #include "llvm/IR/Function.h" #include "llvm/IR/Instructions.h" -#include "llvm/InstVisitor.h" +#include "llvm/IR/InstVisitor.h" #include "llvm/Pass.h" #include "llvm/ADT/Statistic.h" #include "llvm/Support/Debug.h" @@ -80,7 +81,7 @@ namespace { void getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesAll(); AU.addRequired(); - AU.addRequired(); + AU.addRequired(); AU.addRequired >(); } @@ -236,7 +237,7 @@ void DSGraphStats::visitStore(StoreInst &SI) { bool DSGraphStats::runOnFunction(Function& F) { DS = &getAnalysis(); - TD = &getAnalysis(); + TD = &getAnalysis().getDataLayout(); TS = &getAnalysis >(); TDGraph = DS->getDSGraph(F); countCallees(F); diff --git a/lib/DSA/EquivClassGraphs.cpp b/lib/DSA/EquivClassGraphs.cpp index 0cf08b2df..a92abb649 100644 --- a/lib/DSA/EquivClassGraphs.cpp +++ b/lib/DSA/EquivClassGraphs.cpp @@ -20,7 +20,7 @@ #include "llvm/IR/Module.h" #include "llvm/Pass.h" #include "dsa/DSGraph.h" -#include "llvm/Support/CallSite.h" +#include "llvm/IR/CallSite.h" #include "llvm/Support/Debug.h" #include "llvm/ADT/SCCIterator.h" #include "llvm/ADT/Statistic.h" diff --git a/lib/DSA/Local.cpp b/lib/DSA/Local.cpp index 87ee031a6..e80c4d6c1 100644 --- a/lib/DSA/Local.cpp +++ b/lib/DSA/Local.cpp @@ -31,8 +31,8 @@ #include "llvm/Support/CommandLine.h" #include "llvm/Support/Debug.h" #include "llvm/Support/FormattedStream.h" -#include "llvm/Support/GetElementPtrTypeIterator.h" -#include "llvm/InstVisitor.h" +#include "llvm/IR/GetElementPtrTypeIterator.h" +#include "llvm/IR/InstVisitor.h" #include "llvm/Support/Timer.h" #include @@ -1440,7 +1440,7 @@ void handleMagicSections(DSGraph* GlobalsGraph, Module& M) { char LocalDataStructures::ID; bool LocalDataStructures::runOnModule(Module &M) { - init(&getAnalysis()); + init(&getAnalysis().getDataLayout()); addrAnalysis = &getAnalysis(); // First step, build the globals graph. diff --git a/lib/DSA/Printer.cpp b/lib/DSA/Printer.cpp index 6a1e0d446..cadde3ef7 100644 --- a/lib/DSA/Printer.cpp +++ b/lib/DSA/Printer.cpp @@ -18,7 +18,7 @@ #include "dsa/DSGraphTraits.h" #include "llvm/IR/Module.h" #include "llvm/IR/Constants.h" -#include "llvm/Assembly/Writer.h" +#include "llvm/Support/FileSystem.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/GraphWriter.h" #include "llvm/ADT/Statistic.h" @@ -116,7 +116,7 @@ static std::string getCaption(const DSNode *N, const DSGraph *G) { for (DSNode::globals_iterator i = N->globals_begin(), e = N->globals_end(); i != e; ++i) { - WriteAsOperand(OS, *i, false, M); + (*i)->printAsOperand(OS,false,M); // Figure out how many globals are equivalent to this one. if (GlobalECs) { @@ -214,7 +214,7 @@ struct DOTGraphTraits : public DefaultDOTGraphTraits { if (!isa(I->first)) { std::string OS_str; llvm::raw_string_ostream OS(OS_str); - WriteAsOperand(OS, I->first, false, CurMod); + I->first->printAsOperand(OS, false, CurMod); GW.emitSimpleNode(I->first, "", OS.str()); // Add edge from return node to real destination @@ -305,7 +305,7 @@ void DSGraph::writeGraphToFile(llvm::raw_ostream &O, O << "Writing '" << Filename << "'..."; if (!DontPrintGraphs) { std::string Error; - llvm::raw_fd_ostream F(Filename.c_str(), Error); + llvm::raw_fd_ostream F(Filename.c_str(), Error, sys::fs::F_None); if (Error.size()) { O << " error opening file for writing! " << Error << "\n"; diff --git a/lib/DSA/StdLibPass.cpp b/lib/DSA/StdLibPass.cpp index beca6d872..a902b779a 100644 --- a/lib/DSA/StdLibPass.cpp +++ b/lib/DSA/StdLibPass.cpp @@ -10,6 +10,7 @@ // may query it. //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "stdlib-pass" #include "llvm/ADT/Statistic.h" #include "dsa/DataStructure.h" #include "dsa/AllocatorIdentification.h" @@ -18,7 +19,7 @@ #include "llvm/IR/DerivedTypes.h" #include "llvm/IR/Instructions.h" #include "llvm/IR/Intrinsics.h" -#include "llvm/Support/GetElementPtrTypeIterator.h" +#include "llvm/IR/GetElementPtrTypeIterator.h" #include "llvm/IR/DataLayout.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/Debug.h" @@ -451,7 +452,7 @@ void StdLibDataStructures::eraseCallsTo(Function* F) { typedef std::pair RemovalPair; DenseSet ToRemove; - for (Value::use_iterator ii = F->use_begin(), ee = F->use_end(); + for (Value::user_iterator ii = F->user_begin(), ee = F->user_end(); ii != ee; ++ii) if (CallInst* CI = dyn_cast(*ii)){ if (CI->getCalledValue() == F) { @@ -471,7 +472,7 @@ StdLibDataStructures::eraseCallsTo(Function* F) { } } else if(ConstantExpr *CE = dyn_cast(*ii)) { if(CE->isCast()) { - for (Value::use_iterator ci = CE->use_begin(), ce = CE->use_end(); + for (Value::user_iterator ci = CE->user_begin(), ce = CE->user_end(); ci != ce; ++ci) { if (CallInst* CI = dyn_cast(*ci)){ if(CI->getCalledValue() == CE) { @@ -522,7 +523,7 @@ StdLibDataStructures::processRuntimeCheck (Module & M, // Scan through all direct calls to the function (there should only be direct // calls) and process each one. // - for (Value::use_iterator ii = F->use_begin(), ee = F->use_end(); + for (Value::user_iterator ii = F->user_begin(), ee = F->user_end(); ii != ee; ++ii) { if (CallInst* CI = dyn_cast(*ii)) { if (CI->getCalledValue() == F) { @@ -677,8 +678,9 @@ StdLibDataStructures::runOnModule (Module &M) { void StdLibDataStructures::processFunction(int x, Function *F) { - for (Value::use_iterator ii = F->use_begin(), ee = F->use_end(); + for (Value::user_iterator ii = F->user_begin(), ee = F->user_end(); ii != ee; ++ii) + if (CallInst* CI = dyn_cast(*ii)){ if (CI->getCalledValue() == F) { DSGraph* Graph = getDSGraph(*CI->getParent()->getParent()); @@ -825,7 +827,7 @@ void StdLibDataStructures::processFunction(int x, Function *F) { } } else if(ConstantExpr *CE = dyn_cast(*ii)) { if(CE->isCast()) - for (Value::use_iterator ci = CE->use_begin(), ce = CE->use_end(); + for (Value::user_iterator ci = CE->user_begin(), ce = CE->user_end(); ci != ce; ++ci) { if (CallInst* CI = dyn_cast(*ci)){ diff --git a/lib/DSA/TypeSafety.cpp b/lib/DSA/TypeSafety.cpp index 969e1d0bd..0c0f6f8c4 100644 --- a/lib/DSA/TypeSafety.cpp +++ b/lib/DSA/TypeSafety.cpp @@ -333,7 +333,7 @@ TypeSafety::runOnModule(Module & M) { // // Get access to prerequisite passes. // - TD = &getAnalysis(); + TD = &getAnalysis().getDataLayout(); dsaPass = &getAnalysis(); // diff --git a/lib/smack/SmackInstGenerator.cpp b/lib/smack/SmackInstGenerator.cpp index 040245e30..20327e132 100644 --- a/lib/smack/SmackInstGenerator.cpp +++ b/lib/smack/SmackInstGenerator.cpp @@ -2,12 +2,13 @@ // Copyright (c) 2008 Zvonimir Rakamaric (zvonimir@cs.utah.edu) // This file is distributed under the MIT License. See LICENSE for details. // +#define DEBUG_TYPE "smack-inst-gen" #include "smack/SmackInstGenerator.h" #include "smack/SmackOptions.h" -#include "llvm/InstVisitor.h" -#include "llvm/DebugInfo.h" +#include "llvm/IR/InstVisitor.h" +#include "llvm/IR/DebugInfo.h" #include "llvm/Support/Debug.h" -#include "llvm/Support/GetElementPtrTypeIterator.h" +#include "llvm/IR/GetElementPtrTypeIterator.h" #include "llvm/Support/GraphWriter.h" #include diff --git a/lib/smack/SmackModuleGenerator.cpp b/lib/smack/SmackModuleGenerator.cpp index ab0a11d70..7ebab07b6 100644 --- a/lib/smack/SmackModuleGenerator.cpp +++ b/lib/smack/SmackModuleGenerator.cpp @@ -2,6 +2,7 @@ // Copyright (c) 2008 Zvonimir Rakamaric (zvonimir@cs.utah.edu) // This file is distributed under the MIT License. See LICENSE for details. // +#define DEBUG_TYPE "smack-mod-gen" #include "smack/SmackModuleGenerator.h" #include "smack/SmackOptions.h" diff --git a/lib/smack/SmackRep.cpp b/lib/smack/SmackRep.cpp index 6a898b537..3733d980c 100644 --- a/lib/smack/SmackRep.cpp +++ b/lib/smack/SmackRep.cpp @@ -3,6 +3,7 @@ // Michael Emmi (michael.emmi@gmail.com) // This file is distributed under the MIT License. See LICENSE for details. // +#define DEBUG_TYPE "smack-rep" #include "smack/SmackRep.h" #include "smack/SmackOptions.h" diff --git a/tools/smack/smack.cpp b/tools/smack/smack.cpp index 1e547a1b5..d9f270d9e 100644 --- a/tools/smack/smack.cpp +++ b/tools/smack/smack.cpp @@ -14,6 +14,7 @@ #include "llvm/Support/PrettyStackTrace.h" #include "llvm/Support/Signals.h" #include "llvm/Support/SourceMgr.h" +#include "llvm/Support/FileSystem.h" #include "llvm/Support/ToolOutputFile.h" #include "llvm/Support/raw_ostream.h" @@ -61,8 +62,8 @@ int main(int argc, char **argv) { std::string error_msg; llvm::SMDiagnostic err; llvm::LLVMContext &context = llvm::getGlobalContext(); - llvm::OwningPtr module; - llvm::OwningPtr output; + std::unique_ptr module; + std::unique_ptr output; module.reset(llvm::ParseIRFile(InputFilename, err, context)); if (module.get() == 0) { @@ -72,7 +73,7 @@ int main(int argc, char **argv) { return 1; } - output.reset(new llvm::tool_output_file(OutputFilename.c_str(), error_msg)); + output.reset(new llvm::tool_output_file(OutputFilename.c_str(), error_msg, llvm::sys::fs::F_None)); if (!error_msg.empty()) { if (llvm::errs().has_colors()) llvm::errs().changeColor(llvm::raw_ostream::RED); llvm::errs() << "error: " << error_msg << "\n"; @@ -89,13 +90,13 @@ int main(int argc, char **argv) { llvm::initializeAnalysis(Registry); // add an appropriate DataLayout instance for the module - llvm::DataLayout *dl = 0; - const std::string &moduleDataLayout = module.get()->getDataLayout(); + const llvm::DataLayout *dl = 0; + const std::string &moduleDataLayout = module.get()->getDataLayoutStr(); if (!moduleDataLayout.empty()) dl = new llvm::DataLayout(moduleDataLayout); else if (!DefaultDataLayout.empty()) dl = new llvm::DataLayout(moduleDataLayout); - if (dl) pass_manager.add(dl); + if (dl) pass_manager.add(new llvm::DataLayoutPass(*dl)); pass_manager.add(llvm::createInternalizePass()); pass_manager.add(llvm::createPromoteMemoryToRegisterPass()); From 034e9fc31d5a8e2005f4806082e16cffc90f4dc4 Mon Sep 17 00:00:00 2001 From: Michael Emmi Date: Tue, 16 Sep 2014 17:52:56 +0200 Subject: [PATCH 056/140] More handling of floating point. + Load and store from memory. + Uninitialized values. + Simple equality reasoning. + fixes #50 --- include/smack/SmackRep.h | 2 +- include/smack/smack.h | 8 ++++++- lib/smack/SmackInstGenerator.cpp | 14 ++++++++++-- lib/smack/SmackRep.cpp | 37 +++++++++++++++++++++----------- test/Makefile | 3 ++- test/floats_in_memory.c | 20 +++++++++++++++++ test/floats_in_memory_fail.c | 20 +++++++++++++++++ test/regtest.py | 4 +++- 8 files changed, 89 insertions(+), 19 deletions(-) create mode 100644 test/floats_in_memory.c create mode 100644 test/floats_in_memory_fail.c diff --git a/include/smack/SmackRep.h b/include/smack/SmackRep.h index 0b45427fe..65dfda106 100644 --- a/include/smack/SmackRep.h +++ b/include/smack/SmackRep.h @@ -183,7 +183,7 @@ class SmackRep { const Expr* mem(unsigned region, const Expr* addr); string id(const llvm::Value* v); - const Expr* undef(); + const Expr* undef(llvm::Type* t = 0); const Expr* lit(const llvm::Value* v); const Expr* lit(unsigned v); const Expr* ptrArith(const llvm::Value* p, vector ps, diff --git a/include/smack/smack.h b/include/smack/smack.h index cc64f6f0b..744433eb6 100644 --- a/include/smack/smack.h +++ b/include/smack/smack.h @@ -104,7 +104,7 @@ void __SMACK_decls() { // Floating point D("type float;"); - D("function $fp(a:int) returns (float);"); + D("function $fp(ipart:int, fpart:int, epart:int) returns (float);"); D("const $ffalse: float;"); D("const $ftrue: float;"); D("function $fadd(f1:float, f2:float) returns (float);"); @@ -131,6 +131,12 @@ void __SMACK_decls() { D("function $si2fp(i:int) returns (float);"); D("function $ui2fp(i:int) returns (float);"); + D("axiom (forall f1, f2: float :: f1 != f2 || $foeq(f1,f2));"); + D("axiom (forall i: int :: $fp2ui($ui2fp(i)) == i);"); + D("axiom (forall f: float :: $ui2fp($fp2ui(f)) == f);"); + D("axiom (forall i: int :: $fp2si($si2fp(i)) == i);"); + D("axiom (forall f: float :: $si2fp($fp2si(f)) == f);"); + // Memory Model D("function $base(int) returns (int);"); diff --git a/lib/smack/SmackInstGenerator.cpp b/lib/smack/SmackInstGenerator.cpp index 040245e30..7628eee69 100644 --- a/lib/smack/SmackInstGenerator.cpp +++ b/lib/smack/SmackInstGenerator.cpp @@ -249,7 +249,12 @@ void SmackInstGenerator::visitAllocaInst(llvm::AllocaInst& ai) { void SmackInstGenerator::visitLoadInst(llvm::LoadInst& li) { processInstruction(li); - currBlock->addStmt(Stmt::assign(rep.expr(&li),rep.mem(li.getPointerOperand()))); + const Expr* rhs = rep.mem(li.getPointerOperand()); + + if (rep.isFloat(&li)) + rhs = Expr::fn("$si2fp", rhs); + + currBlock->addStmt(Stmt::assign(rep.expr(&li),rhs)); if (SmackOptions::MemoryModelDebug) { currBlock->addStmt(Stmt::call(SmackRep::REC_MEM_OP, Expr::id(SmackRep::MEM_OP_VAL))); @@ -261,7 +266,12 @@ void SmackInstGenerator::visitLoadInst(llvm::LoadInst& li) { void SmackInstGenerator::visitStoreInst(llvm::StoreInst& si) { processInstruction(si); - currBlock->addStmt(Stmt::assign(rep.mem(si.getPointerOperand()),rep.expr(si.getOperand(0)))); + const Expr* rhs = rep.expr(si.getOperand(0)); + + if (rep.isFloat(si.getOperand(0))) + rhs = Expr::fn("$fp2si", rhs); + + currBlock->addStmt(Stmt::assign(rep.mem(si.getPointerOperand()),rhs)); if (SmackOptions::MemoryModelDebug) { currBlock->addStmt(Stmt::call(SmackRep::REC_MEM_OP, Expr::id(SmackRep::MEM_OP_VAL))); diff --git a/lib/smack/SmackRep.cpp b/lib/smack/SmackRep.cpp index 6a898b537..b914f643c 100644 --- a/lib/smack/SmackRep.cpp +++ b/lib/smack/SmackRep.cpp @@ -340,9 +340,10 @@ const Expr* SmackRep::b2i(const llvm::Value* v) { return Expr::fn(B2I, expr(v)); } -const Expr* SmackRep::undef() { +const Expr* SmackRep::undef(llvm::Type* t) { stringstream s; s << "$u." << uniqueUndefNum++; + program->addDecl(Decl::constant(s.str(), t ? type(t) : "int")); return Expr::id(s.str()); } @@ -370,6 +371,8 @@ string SmackRep::id(const llvm::Value* v) { } const Expr* SmackRep::lit(const llvm::Value* v) { + using namespace llvm; + if (const llvm::ConstantInt* ci = llvm::dyn_cast(v)) { if (ci->getBitWidth() == 1) return Expr::lit(!ci->isZero()); @@ -380,7 +383,25 @@ const Expr* SmackRep::lit(const llvm::Value* v) { else return Expr::lit(val, width); - } else if (llvm::isa(v)) { + } else if (const ConstantFP* CFP = dyn_cast(v)) { + const APFloat APF = CFP->getValueAPF(); + string str; + raw_string_ostream ss(str); + ss << *CFP; + istringstream iss(str); + string float_type; + int integerPart, fractionalPart, exponentPart; + char point, sign, exponent; + iss >> float_type; + iss >> integerPart; + iss >> point; + iss >> fractionalPart; + iss >> sign; + iss >> exponent; + iss >> exponentPart; + + return Expr::fn(FP, Expr::lit(integerPart), Expr::lit(fractionalPart), + Expr::lit(exponentPart)); // TODO encode floating point return Expr::fn(FP,Expr::lit((int) uniqueFpNum++)); @@ -494,7 +515,7 @@ const Expr* SmackRep::expr(const llvm::Value* v) { return lit((unsigned)0); else if (isa(constant)) - return undef(); + return undef(constant->getType()); else { DEBUG(errs() << "VALUE : " << *v << "\n"); @@ -815,16 +836,6 @@ string SmackRep::getPrelude() { << ": [" << getPtrType() << "] " << getPtrType() << ";" << endl; s << endl; - - if (uniqueUndefNum > 0) { - s << "// Undefined values" << endl; - s << "const "; - for (unsigned i=0; i 0 ? ", " : "") << "$u." << i; - s << ": " << getPtrType() << ";" << endl; - s << endl; - } - s << "axiom $GLOBALS_BOTTOM == " << globalsBottom << ";" << endl; return s.str(); diff --git a/test/Makefile b/test/Makefile index 57ec322fc..faae442ed 100644 --- a/test/Makefile +++ b/test/Makefile @@ -48,7 +48,8 @@ SOURCES = simple.c simple_fail.c \ two_arrays3.c \ two_arrays4.c \ two_arrays5.c \ - two_arrays6.c two_arrays6_fail.c + two_arrays6.c two_arrays6_fail.c \ + floats_in_memory.c floats_in_memory_fail.c BITCODE = $(SOURCES:.c=.bc) diff --git a/test/floats_in_memory.c b/test/floats_in_memory.c new file mode 100644 index 000000000..9e43772a9 --- /dev/null +++ b/test/floats_in_memory.c @@ -0,0 +1,20 @@ +#include + +void ff1(float f); +void ff2(float *f1, float *f2) { + *f1 = *f2; +} + +int main() { + float f1; + float f2 = 0.0; + float f3 = 1.0; + + ff1(f1); + ff1(f2); + ff2(&f2,&f3); + + __SMACK_assert(f2 == f3); + + return 0; +} diff --git a/test/floats_in_memory_fail.c b/test/floats_in_memory_fail.c new file mode 100644 index 000000000..c04e8ea04 --- /dev/null +++ b/test/floats_in_memory_fail.c @@ -0,0 +1,20 @@ +#include + +void ff1(float f); +void ff2(float *f1, float *f2) { + *f1 = *f2 + 1; +} + +int main() { + float f1; + float f2 = 0.0; + float f3 = 1.0; + + ff1(f1); + ff1(f2); + ff2(&f2,&f3); + + __SMACK_assert(f2 == f3); + + return 0; +} diff --git a/test/regtest.py b/test/regtest.py index 7d9242192..d5da1a879 100755 --- a/test/regtest.py +++ b/test/regtest.py @@ -89,7 +89,9 @@ RegTest('two_arrays4', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), RegTest('two_arrays5', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), RegTest('two_arrays6', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), - RegTest('two_arrays6_fail', r'0 verified, 1 errors?', r'This assertion can fail', r'This assertion can fail', 2) + RegTest('two_arrays6_fail', r'0 verified, 1 errors?', r'This assertion can fail', r'This assertion can fail', 2), + RegTest('floats_in_memory', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2) + RegTest('floats_in_memory_fail', r'0 verified, 1 errors?', r'This assertion can fail', r'This assertion can fail', 2) ] def red(text): From b02c12d210a0fd12f4855ab25a77b15106197369 Mon Sep 17 00:00:00 2001 From: Michael Emmi Date: Tue, 16 Sep 2014 17:57:39 +0200 Subject: [PATCH 057/140] Fixed typos in previous commit. --- lib/smack/SmackRep.cpp | 3 --- test/regtest.py | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/smack/SmackRep.cpp b/lib/smack/SmackRep.cpp index b914f643c..c05ebc8e5 100644 --- a/lib/smack/SmackRep.cpp +++ b/lib/smack/SmackRep.cpp @@ -403,9 +403,6 @@ const Expr* SmackRep::lit(const llvm::Value* v) { return Expr::fn(FP, Expr::lit(integerPart), Expr::lit(fractionalPart), Expr::lit(exponentPart)); - // TODO encode floating point - return Expr::fn(FP,Expr::lit((int) uniqueFpNum++)); - } else if (llvm::isa(v)) return Expr::lit(0, width); diff --git a/test/regtest.py b/test/regtest.py index d5da1a879..42d3bcf3d 100755 --- a/test/regtest.py +++ b/test/regtest.py @@ -90,7 +90,7 @@ RegTest('two_arrays5', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), RegTest('two_arrays6', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), RegTest('two_arrays6_fail', r'0 verified, 1 errors?', r'This assertion can fail', r'This assertion can fail', 2), - RegTest('floats_in_memory', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2) + RegTest('floats_in_memory', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), RegTest('floats_in_memory_fail', r'0 verified, 1 errors?', r'This assertion can fail', r'This assertion can fail', 2) ] From 63a96040ba81a0aeea90c352716b225063784c7b Mon Sep 17 00:00:00 2001 From: Michael Emmi Date: Wed, 17 Sep 2014 12:39:57 +0200 Subject: [PATCH 058/140] Makefile rules for installing scripts. --- Makefile.common.in | 2 ++ Makefile.smack.scripts | 43 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 Makefile.smack.scripts diff --git a/Makefile.common.in b/Makefile.common.in index 103c0c86f..bc20923a7 100644 --- a/Makefile.common.in +++ b/Makefile.common.in @@ -27,3 +27,5 @@ include $(PROJ_OBJ_ROOT)/Makefile.llvm.config # Include all of the build rules used for making LLVM include $(PROJ_SRC_ROOT)/Makefile.llvm.rules +# SMACK-specific scripts +include $(PROJ_SRC_ROOT)/Makefile.smack.scripts diff --git a/Makefile.smack.scripts b/Makefile.smack.scripts new file mode 100644 index 000000000..984e4610c --- /dev/null +++ b/Makefile.smack.scripts @@ -0,0 +1,43 @@ +#------------------------------------------------------------------------ +# Installation of SMACK scripts +#------------------------------------------------------------------------ +ifdef NO_INSTALL +install-local:: + $(Echo) Install circumvented with NO_INSTALL +uninstall-local:: + $(Echo) Uninstall circumvented with NO_INSTALL +else +install-local:: + $(Echo) Installing scripts + $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_bindir) + $(Verb) if test -d "$(PROJ_SRC_ROOT)/bin" ; then \ + cd $(PROJ_SRC_ROOT)/bin && \ + for scr in `find . -type f \ + '(' -name '*.py' \ + -o -name '*.rb' \ + -o -name 'boogie' \ + -o -name 'corral' \ + ')' -print | grep -v CVS | \ + grep -v .svn` ; do \ + instdir=`dirname "$(DESTDIR)$(PROJ_includedir)/$$scr"` ; \ + if test \! -d "$$instdir" ; then \ + $(EchoCmd) Making install directory $$instdir ; \ + $(MKDIR) $$instdir ;\ + fi ; \ + $(ScriptInstall) $$scr $(DESTDIR)$(PROJ_bindir)/$$scr ; \ + done ; \ + fi + +uninstall-local:: + $(Echo) Uninstalling scripts + $(Verb) if [ -d "$(PROJ_SRC_ROOT)/bin" ] ; then \ + cd $(PROJ_SRC_ROOT)/bin && \ + $(RM) -f `find . -path '*/Internal' -prune -o '(' -type f \ + '!' '(' -name '*~' -o -name '.#*' \ + -o -name '*.in' ')' -print ')' | \ + grep -v CVS | sed 's#^#$(DESTDIR)$(PROJ_bindir)/#'` ; \ + cd $(PROJ_SRC_ROOT)/bin && \ + $(RM) -f `find . -path '*/Internal' -prune -o '(' -type f -name '*.in' \ + -print ')' | sed 's#\.in$$##;s#^#$(DESTDIR)$(PROJ_bindir)/#'` ; \ + fi +endif From abf69959d14344f99282c7cf175a2fafc8021b8a Mon Sep 17 00:00:00 2001 From: smack Date: Fri, 19 Sep 2014 10:36:37 -0600 Subject: [PATCH 059/140] Switched linux build script to LLVM 3.5. --- bin/build-linux.sh | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/bin/build-linux.sh b/bin/build-linux.sh index 3f1341bb7..2cc09a5e1 100755 --- a/bin/build-linux.sh +++ b/bin/build-linux.sh @@ -49,7 +49,14 @@ SMACK_DIR="${BASE_DIR}/smack" if [ ${INSTALL_PACKAGES} -eq 1 ]; then -sudo apt-get install -y g++ +sudo add-apt-repository ppa:ubuntu-toolchain-r/test +sudo apt-get update +sudo apt-get install -y g++-4.8 +sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 20 +sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 20 +sudo update-alternatives --config gcc +sudo update-alternatives --config g++ + sudo apt-get install -y git sudo apt-get install -y mercurial sudo apt-get install -y autoconf @@ -73,7 +80,7 @@ if [ ${INSTALL_MONO} -eq 1 ]; then mkdir -p ${MONO_DIR} # Install mono -sudo apt-get install -y git build-essential autoconf automake bison flex libtool gettext gdb mono-gmcs +sudo apt-get install -y git autoconf automake bison flex libtool gettext gdb mono-gmcs cd ${MONO_DIR} git clone git://github.com/mono/mono.git cd mono @@ -195,15 +202,16 @@ mkdir -p ${LLVM_DIR}/build mkdir -p ${LLVM_DIR}/install # Get llvm and extract -wget http://llvm.org/releases/3.4/llvm-3.4.src.tar.gz -wget http://llvm.org/releases/3.4/clang-3.4.src.tar.gz -wget http://llvm.org/releases/3.4/compiler-rt-3.4.src.tar.gz -tar -C ${LLVM_DIR}/src -xzvf llvm-3.4.src.tar.gz --strip 1 +wget http://llvm.org/releases/3.5.0/llvm-3.5.0.src.tar.xz +wget http://llvm.org/releases/3.5.0/cfe-3.5.0.src.tar.xz +wget http://llvm.org/releases/3.5.0/compiler-rt-3.5.0.src.tar.xz + +tar -C ${LLVM_DIR}/src -xvf llvm-3.5.0.src.tar.xz --strip 1 mkdir -p ${LLVM_DIR}/src/tools/clang -tar -C ${LLVM_DIR}/src/tools/clang -xzvf clang-3.4.src.tar.gz --strip 1 +tar -C ${LLVM_DIR}/src/tools/clang -xvf cfe-3.5.0.src.tar.xz --strip 1 mkdir -p ${LLVM_DIR}/src/projects/compiler-rt -tar -C ${LLVM_DIR}/src/projects/compiler-rt -xzvf compiler-rt-3.4.src.tar.gz --strip 1 +tar -C ${LLVM_DIR}/src/projects/compiler-rt -xvf compiler-rt-3.5.0.src.tar.xz --strip 1 # Configure llvm and build cd ${LLVM_DIR}/build/ From b7115e7f225d3a74b291e4ed8033c1426f85b8a3 Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Fri, 19 Sep 2014 18:11:21 -0600 Subject: [PATCH 060/140] Updated cygwin build script to LLVM 3.5. --- bin/build-cygwin.sh | 12 ++++++------ bin/build-linux.sh | 1 - 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/bin/build-cygwin.sh b/bin/build-cygwin.sh index 6a90bf3fe..2cb99823e 100755 --- a/bin/build-cygwin.sh +++ b/bin/build-cygwin.sh @@ -49,15 +49,15 @@ mkdir -p ${LLVM_DIR}/build mkdir -p ${LLVM_DIR}/install # Get llvm and extract -wget http://llvm.org/releases/3.4/llvm-3.4.src.tar.gz -wget http://llvm.org/releases/3.4/clang-3.4.src.tar.gz -wget http://llvm.org/releases/3.4/compiler-rt-3.4.src.tar.gz +wget http://llvm.org/releases/3.5.0/llvm-3.5.0.src.tar.xz +wget http://llvm.org/releases/3.5.0/cfe-3.5.0.src.tar.xz +wget http://llvm.org/releases/3.5.0/compiler-rt-3.5.0.src.tar.xz -tar -C ${LLVM_DIR}/src -xzvf llvm-3.4.src.tar.gz --strip 1 +tar -C ${LLVM_DIR}/src -xvf llvm-3.5.0.src.tar.xz --strip 1 mkdir -p ${LLVM_DIR}/src/tools/clang -tar -C ${LLVM_DIR}/src/tools/clang -xzvf clang-3.4.src.tar.gz --strip 1 +tar -C ${LLVM_DIR}/src/tools/clang -xvf cfe-3.5.0.src.tar.xz --strip 1 mkdir -p ${LLVM_DIR}/src/projects/compiler-rt -tar -C ${LLVM_DIR}/src/projects/compiler-rt -xzvf compiler-rt-3.4.src.tar.gz --strip 1 +tar -C ${LLVM_DIR}/src/projects/compiler-rt -xvf compiler-rt-3.5.0.src.tar.xz --strip 1 # Configure llvm and build cd ${LLVM_DIR}/build/ diff --git a/bin/build-linux.sh b/bin/build-linux.sh index 2cc09a5e1..683ee38fe 100755 --- a/bin/build-linux.sh +++ b/bin/build-linux.sh @@ -202,7 +202,6 @@ mkdir -p ${LLVM_DIR}/build mkdir -p ${LLVM_DIR}/install # Get llvm and extract - wget http://llvm.org/releases/3.5.0/llvm-3.5.0.src.tar.xz wget http://llvm.org/releases/3.5.0/cfe-3.5.0.src.tar.xz wget http://llvm.org/releases/3.5.0/compiler-rt-3.5.0.src.tar.xz From d8480c951811e7065aa12976ad5de395f7e61cd1 Mon Sep 17 00:00:00 2001 From: Michael Emmi Date: Sun, 21 Sep 2014 18:42:08 +0200 Subject: [PATCH 061/140] Ignoring annoying warning from smack/opt on OSX. i.e. "warning: ignoring debug info with an invalid version" --- bin/llvm2bpl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/llvm2bpl.py b/bin/llvm2bpl.py index 6341b6d13..6e06822da 100755 --- a/bin/llvm2bpl.py +++ b/bin/llvm2bpl.py @@ -39,7 +39,7 @@ def llvm2bpl(infile, outfile, debugFlag, memImpls): if debugFlag: cmd.append('-debug') if memImpls: cmd.append('-mem-mod-impls') cmd.append('-o=' + outfile) - p = subprocess.Popen(cmd) + p = subprocess.Popen(cmd, stderr=subprocess.PIPE) p.wait() if p.returncode != 0: From 39e7587ca87415846971e0f18ccde5f64bbb8e35 Mon Sep 17 00:00:00 2001 From: smack Date: Fri, 26 Sep 2014 13:27:23 -0600 Subject: [PATCH 062/140] Updated Z3, Boogie, and Corral versions. --- bin/build-linux.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/build-linux.sh b/bin/build-linux.sh index 683ee38fe..235d49f75 100755 --- a/bin/build-linux.sh +++ b/bin/build-linux.sh @@ -114,7 +114,7 @@ mkdir -p ${Z3_DIR}/install # Get Z3 cd ${Z3_DIR}/src/ -wget "http://download-codeplex.sec.s-msft.com/Download/SourceControlFileDownload.ashx?ProjectName=z3&changeSetId=37ed4b04d078d6d1e35db2799d769e8d4b87f775" +wget "http://download-codeplex.sec.s-msft.com/Download/SourceControlFileDownload.ashx?ProjectName=z3&changeSetId=4995ce1fdee47ffd61d4726c89ff908f468d6450" unzip -o SourceControlFileDownload* rm -f SourceControlFileDownload* @@ -138,7 +138,7 @@ if [ ${INSTALL_BOOGIE} -eq 1 ]; then mkdir -p ${BOOGIE_DIR} # Get Boogie -hg clone -r ec9955650676 https://hg.codeplex.com/boogie ${BOOGIE_DIR} +hg clone -r b388523c1c71 https://hg.codeplex.com/boogie ${BOOGIE_DIR} # Build Boogie cd ${BOOGIE_DIR}/Source @@ -160,7 +160,7 @@ mkdir -p ${CORRAL_DIR} # Get Corral git clone https://git01.codeplex.com/corral ${CORRAL_DIR} cd ${CORRAL_DIR} -git checkout 1aeddf73b63c +git checkout e476c4252f7e # Build Corral cd ${CORRAL_DIR}/references From cb33f20e7ca0ae2c0d848f832c04a0a859a73e0e Mon Sep 17 00:00:00 2001 From: smack Date: Fri, 26 Sep 2014 13:51:53 -0600 Subject: [PATCH 063/140] Updated cmake build scripts. --- bin/build-cygwin-cmake.sh | 12 ++++++------ bin/build-linux-cmake.sh | 29 ++++++++++++++++++----------- 2 files changed, 24 insertions(+), 17 deletions(-) diff --git a/bin/build-cygwin-cmake.sh b/bin/build-cygwin-cmake.sh index d0c476cc3..e3700443d 100755 --- a/bin/build-cygwin-cmake.sh +++ b/bin/build-cygwin-cmake.sh @@ -49,15 +49,15 @@ mkdir -p ${LLVM_DIR}/build mkdir -p ${LLVM_DIR}/install # Get llvm and extract -wget http://llvm.org/releases/3.4/llvm-3.4.src.tar.gz -wget http://llvm.org/releases/3.4/clang-3.4.src.tar.gz -wget http://llvm.org/releases/3.4/compiler-rt-3.4.src.tar.gz +wget http://llvm.org/releases/3.5.0/llvm-3.5.0.src.tar.xz +wget http://llvm.org/releases/3.5.0/cfe-3.5.0.src.tar.xz +wget http://llvm.org/releases/3.5.0/compiler-rt-3.5.0.src.tar.xz -tar -C ${LLVM_DIR}/src -xzvf llvm-3.4.src.tar.gz --strip 1 +tar -C ${LLVM_DIR}/src -xvf llvm-3.5.0.src.tar.xz --strip 1 mkdir -p ${LLVM_DIR}/src/tools/clang -tar -C ${LLVM_DIR}/src/tools/clang -xzvf clang-3.4.src.tar.gz --strip 1 +tar -C ${LLVM_DIR}/src/tools/clang -xvf cfe-3.5.0.src.tar.xz --strip 1 mkdir -p ${LLVM_DIR}/src/projects/compiler-rt -tar -C ${LLVM_DIR}/src/projects/compiler-rt -xzvf compiler-rt-3.4.src.tar.gz --strip 1 +tar -C ${LLVM_DIR}/src/projects/compiler-rt -xvf compiler-rt-3.5.0.src.tar.xz --strip 1 # Configure llvm and build cd ${LLVM_DIR}/build/ diff --git a/bin/build-linux-cmake.sh b/bin/build-linux-cmake.sh index 7b02052c8..4f2b9ec8d 100755 --- a/bin/build-linux-cmake.sh +++ b/bin/build-linux-cmake.sh @@ -50,7 +50,14 @@ SMACK_DIR="${BASE_DIR}/smack" if [ ${INSTALL_PACKAGES} -eq 1 ]; then -sudo apt-get install -y g++ +sudo add-apt-repository ppa:ubuntu-toolchain-r/test +sudo apt-get update +sudo apt-get install -y g++-4.8 +sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 20 +sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 20 +sudo update-alternatives --config gcc +sudo update-alternatives --config g++ + sudo apt-get install -y git sudo apt-get install -y mercurial sudo apt-get install -y autoconf @@ -86,7 +93,7 @@ if [ ${INSTALL_MONO} -eq 1 ]; then mkdir -p ${MONO_DIR} # Install mono -sudo apt-get install -y git build-essential autoconf automake bison flex libtool gettext gdb mono-gmcs +sudo apt-get install -y git autoconf automake bison flex libtool gettext gdb mono-gmcs cd ${MONO_DIR} git clone git://github.com/mono/mono.git cd mono @@ -120,7 +127,7 @@ mkdir -p ${Z3_DIR}/install # Get Z3 cd ${Z3_DIR}/src/ -wget "http://download-codeplex.sec.s-msft.com/Download/SourceControlFileDownload.ashx?ProjectName=z3&changeSetId=37ed4b04d078d6d1e35db2799d769e8d4b87f775" +wget "http://download-codeplex.sec.s-msft.com/Download/SourceControlFileDownload.ashx?ProjectName=z3&changeSetId=4995ce1fdee47ffd61d4726c89ff908f468d6450" unzip -o SourceControlFileDownload* rm -f SourceControlFileDownload* @@ -144,7 +151,7 @@ if [ ${INSTALL_BOOGIE} -eq 1 ]; then mkdir -p ${BOOGIE_DIR} # Get Boogie -hg clone -r ec9955650676 https://hg.codeplex.com/boogie ${BOOGIE_DIR} +hg clone -r b388523c1c71 https://hg.codeplex.com/boogie ${BOOGIE_DIR} # Build Boogie cd ${BOOGIE_DIR}/Source @@ -166,7 +173,7 @@ mkdir -p ${CORRAL_DIR} # Get Corral git clone https://git01.codeplex.com/corral ${CORRAL_DIR} cd ${CORRAL_DIR} -git checkout 1aeddf73b63c +git checkout e476c4252f7e # Build Corral cd ${CORRAL_DIR}/references @@ -208,15 +215,15 @@ mkdir -p ${LLVM_DIR}/build mkdir -p ${LLVM_DIR}/install # Get llvm and extract -wget http://llvm.org/releases/3.4/llvm-3.4.src.tar.gz -wget http://llvm.org/releases/3.4/clang-3.4.src.tar.gz -wget http://llvm.org/releases/3.4/compiler-rt-3.4.src.tar.gz +wget http://llvm.org/releases/3.5.0/llvm-3.5.0.src.tar.xz +wget http://llvm.org/releases/3.5.0/cfe-3.5.0.src.tar.xz +wget http://llvm.org/releases/3.5.0/compiler-rt-3.5.0.src.tar.xz -tar -C ${LLVM_DIR}/src -xzvf llvm-3.4.src.tar.gz --strip 1 +tar -C ${LLVM_DIR}/src -xvf llvm-3.5.0.src.tar.xz --strip 1 mkdir -p ${LLVM_DIR}/src/tools/clang -tar -C ${LLVM_DIR}/src/tools/clang -xzvf clang-3.4.src.tar.gz --strip 1 +tar -C ${LLVM_DIR}/src/tools/clang -xvf cfe-3.5.0.src.tar.xz --strip 1 mkdir -p ${LLVM_DIR}/src/projects/compiler-rt -tar -C ${LLVM_DIR}/src/projects/compiler-rt -xzvf compiler-rt-3.4.src.tar.gz --strip 1 +tar -C ${LLVM_DIR}/src/projects/compiler-rt -xvf compiler-rt-3.5.0.src.tar.xz --strip 1 # Configure llvm and build cd ${LLVM_DIR}/build/ From 9948a163c46078431b4c2fc92dd23c057c885be4 Mon Sep 17 00:00:00 2001 From: smack Date: Sat, 27 Sep 2014 15:22:44 -0600 Subject: [PATCH 064/140] Upgraded to mono 3.8.0. --- bin/build-linux.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/bin/build-linux.sh b/bin/build-linux.sh index 235d49f75..1ca4c6f4c 100755 --- a/bin/build-linux.sh +++ b/bin/build-linux.sh @@ -80,13 +80,14 @@ if [ ${INSTALL_MONO} -eq 1 ]; then mkdir -p ${MONO_DIR} # Install mono -sudo apt-get install -y git autoconf automake bison flex libtool gettext gdb mono-gmcs +sudo apt-get install -y git autoconf automake bison flex libtool gettext gdb cd ${MONO_DIR} git clone git://github.com/mono/mono.git cd mono -git checkout mono-3.2.6 +git checkout mono-3.8.0 ./autogen.sh --prefix=/usr/local -make +make get-monolite-latest +make EXTERNAL_MCS=${PWD}/mcs/class/lib/monolite/gmcs.exe sudo make install # Install libgdiplus @@ -99,6 +100,8 @@ cd libgdiplus make sudo make install +export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib + cd ${BASE_DIR} fi From 08e597353808aebae4564b46bb2e441ec82fae6d Mon Sep 17 00:00:00 2001 From: smack Date: Sat, 27 Sep 2014 16:32:58 -0600 Subject: [PATCH 065/140] Removed autoconf folder that we are not using any more. --- autoconf/AutoRegen.sh | 45 - autoconf/ExportMap.map | 7 - autoconf/LICENSE.TXT | 24 - autoconf/config.guess | 1519 ----- autoconf/config.sub | 1768 ------ autoconf/configure.ac | 1550 ----- autoconf/install-sh | 322 - autoconf/ltmain.sh | 6863 ---------------------- autoconf/m4/build_exeext.m4 | 42 - autoconf/m4/c_printf_a.m4 | 31 - autoconf/m4/check_gnu_make.m4 | 26 - autoconf/m4/config_makefile.m4 | 9 - autoconf/m4/config_project.m4 | 14 - autoconf/m4/cxx_flag_check.m4 | 2 - autoconf/m4/find_std_program.m4 | 118 - autoconf/m4/func_isinf.m4 | 36 - autoconf/m4/func_isnan.m4 | 27 - autoconf/m4/func_mmap_file.m4 | 26 - autoconf/m4/header_mmap_anonymous.m4 | 21 - autoconf/m4/huge_val.m4 | 20 - autoconf/m4/libtool.m4 | 6389 -------------------- autoconf/m4/link_options.m4 | 109 - autoconf/m4/linux_mixed_64_32.m4 | 17 - autoconf/m4/ltdl.m4 | 403 -- autoconf/m4/need_dev_zero_for_mmap.m4 | 17 - autoconf/m4/path_tclsh.m4 | 39 - autoconf/m4/rand48.m4 | 12 - autoconf/m4/sanity_check.m4 | 31 - autoconf/m4/single_cxx_check.m4 | 10 - autoconf/m4/visibility_inlines_hidden.m4 | 24 - autoconf/mkinstalldirs | 150 - 31 files changed, 19671 deletions(-) delete mode 100755 autoconf/AutoRegen.sh delete mode 100644 autoconf/ExportMap.map delete mode 100644 autoconf/LICENSE.TXT delete mode 100755 autoconf/config.guess delete mode 100755 autoconf/config.sub delete mode 100644 autoconf/configure.ac delete mode 100755 autoconf/install-sh delete mode 100644 autoconf/ltmain.sh delete mode 100644 autoconf/m4/build_exeext.m4 delete mode 100644 autoconf/m4/c_printf_a.m4 delete mode 100644 autoconf/m4/check_gnu_make.m4 delete mode 100644 autoconf/m4/config_makefile.m4 delete mode 100644 autoconf/m4/config_project.m4 delete mode 100644 autoconf/m4/cxx_flag_check.m4 delete mode 100644 autoconf/m4/find_std_program.m4 delete mode 100644 autoconf/m4/func_isinf.m4 delete mode 100644 autoconf/m4/func_isnan.m4 delete mode 100644 autoconf/m4/func_mmap_file.m4 delete mode 100644 autoconf/m4/header_mmap_anonymous.m4 delete mode 100644 autoconf/m4/huge_val.m4 delete mode 100644 autoconf/m4/libtool.m4 delete mode 100644 autoconf/m4/link_options.m4 delete mode 100644 autoconf/m4/linux_mixed_64_32.m4 delete mode 100644 autoconf/m4/ltdl.m4 delete mode 100644 autoconf/m4/need_dev_zero_for_mmap.m4 delete mode 100644 autoconf/m4/path_tclsh.m4 delete mode 100644 autoconf/m4/rand48.m4 delete mode 100644 autoconf/m4/sanity_check.m4 delete mode 100644 autoconf/m4/single_cxx_check.m4 delete mode 100644 autoconf/m4/visibility_inlines_hidden.m4 delete mode 100755 autoconf/mkinstalldirs diff --git a/autoconf/AutoRegen.sh b/autoconf/AutoRegen.sh deleted file mode 100755 index b91b3e446..000000000 --- a/autoconf/AutoRegen.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/sh -die () { - echo "$@" 1>&2 - exit 1 -} -test -d autoconf && test -f autoconf/configure.ac && cd autoconf -test -f configure.ac || die "Can't find 'autoconf' dir; please cd into it first" -autoconf --version | egrep '2\.[56][0-9]' > /dev/null -if test $? -ne 0 ; then - die "Your autoconf was not detected as being 2.5x or 2.6x" -fi -cwd=`pwd` -if test -d ../../../autoconf/m4 ; then - cd ../../../autoconf/m4 - llvm_src_root=../.. - llvm_obj_root=../.. - cd $cwd -elif test -d ../../llvm/autoconf/m4 ; then - cd ../../llvm/autoconf/m4 - llvm_src_root=../.. - llvm_obj_root=../.. - cd $cwd -else - while true ; do - echo "LLVM source root not found." - read -p "Enter full path to LLVM source:" REPLY - if test -d "$REPLY/autoconf/m4" ; then - llvm_src_root="$REPLY" - read -p "Enter full path to LLVM objects (empty for same as source):" REPLY - if test -d "$REPLY" ; then - llvm_obj_root="$REPLY" - else - llvm_obj_root="$llvm_src_root" - fi - break - fi - done -fi -echo "Regenerating aclocal.m4 with aclocal" -rm -f aclocal.m4 -aclocal -I $cwd/m4 || die "aclocal failed" -echo "Regenerating configure with autoconf" -autoconf --warnings=all -o ../configure configure.ac || die "autoconf failed" -cd .. -exit 0 diff --git a/autoconf/ExportMap.map b/autoconf/ExportMap.map deleted file mode 100644 index 17b185fed..000000000 --- a/autoconf/ExportMap.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - global: main; - __progname; - environ; - - local: *; -}; diff --git a/autoconf/LICENSE.TXT b/autoconf/LICENSE.TXT deleted file mode 100644 index 72fdd39ed..000000000 --- a/autoconf/LICENSE.TXT +++ /dev/null @@ -1,24 +0,0 @@ ------------------------------------------------------------------------------- -Autoconf Files ------------------------------------------------------------------------------- -All autoconf files are licensed under the LLVM license with the following -additions: - -llvm/autoconf/install-sh: - This script is licensed under the LLVM license, with the following - additional copyrights and restrictions: - - Copyright 1991 by the Massachusetts Institute of Technology - - Permission to use, copy, modify, distribute, and sell this software and its - documentation for any purpose is hereby granted without fee, provided that - the above copyright notice appear in all copies and that both that - copyright notice and this permission notice appear in supporting - documentation, and that the name of M.I.T. not be used in advertising or - publicity pertaining to distribution of the software without specific, - written prior permission. M.I.T. makes no representations about the - suitability of this software for any purpose. It is provided "as is" - without express or implied warranty. - -Please see the source files for additional copyrights. - diff --git a/autoconf/config.guess b/autoconf/config.guess deleted file mode 100755 index 40e2c708f..000000000 --- a/autoconf/config.guess +++ /dev/null @@ -1,1519 +0,0 @@ -#! /bin/sh -# Attempt to guess a canonical system name. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, -# 2011 Free Software Foundation, Inc. - -timestamp='2011-08-20' - -# This file is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA -# 02110-1301, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - - -# Originally written by Per Bothner. Please send patches (context -# diff format) to and include a ChangeLog -# entry. -# -# This script attempts to guess a canonical system name similar to -# config.sub. If it succeeds, it prints the system name on stdout, and -# exits with 0. Otherwise, it exits with 1. -# -# You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] - -Output the configuration name of the system \`$me' is run on. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.guess ($timestamp) - -Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, -2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free -Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit ;; - --version | -v ) - echo "$version" ; exit ;; - --help | --h* | -h ) - echo "$usage"; exit ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" >&2 - exit 1 ;; - * ) - break ;; - esac -done - -if test $# != 0; then - echo "$me: too many arguments$help" >&2 - exit 1 -fi - -trap 'exit 1' 1 2 15 - -# CC_FOR_BUILD -- compiler used by this script. Note that the use of a -# compiler to aid in system detection is discouraged as it requires -# temporary files to be created and, as you can see below, it is a -# headache to deal with in a portable fashion. - -# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still -# use `HOST_CC' if defined, but it is deprecated. - -# Portable tmp directory creation inspired by the Autoconf team. - -set_cc_for_build=' -trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; -trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; -: ${TMPDIR=/tmp} ; - { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || - { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || - { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || - { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; -dummy=$tmp/dummy ; -tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; -case $CC_FOR_BUILD,$HOST_CC,$CC in - ,,) echo "int x;" > $dummy.c ; - for c in cc gcc c89 c99 ; do - if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then - CC_FOR_BUILD="$c"; break ; - fi ; - done ; - if test x"$CC_FOR_BUILD" = x ; then - CC_FOR_BUILD=no_compiler_found ; - fi - ;; - ,,*) CC_FOR_BUILD=$CC ;; - ,*,*) CC_FOR_BUILD=$HOST_CC ;; -esac ; set_cc_for_build= ;' - -# This is needed to find uname on a Pyramid OSx when run in the BSD universe. -# (ghazi@noc.rutgers.edu 1994-08-24) -if (test -f /.attbin/uname) >/dev/null 2>&1 ; then - PATH=$PATH:/.attbin ; export PATH -fi - -UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown -UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown -UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown -UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown - -# Note: order is significant - the case branches are not exclusive. - -case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in - *:NetBSD:*:*) - # NetBSD (nbsd) targets should (where applicable) match one or - # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, - # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently - # switched to ELF, *-*-netbsd* would select the old - # object file format. This provides both forward - # compatibility and a consistent mechanism for selecting the - # object file format. - # - # Note: NetBSD doesn't particularly care about the vendor - # portion of the name. We always set it to "unknown". - sysctl="sysctl -n hw.machine_arch" - UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ - /usr/sbin/$sysctl 2>/dev/null || echo unknown)` - case "${UNAME_MACHINE_ARCH}" in - armeb) machine=armeb-unknown ;; - arm*) machine=arm-unknown ;; - sh3el) machine=shl-unknown ;; - sh3eb) machine=sh-unknown ;; - sh5el) machine=sh5le-unknown ;; - *) machine=${UNAME_MACHINE_ARCH}-unknown ;; - esac - # The Operating System including object format, if it has switched - # to ELF recently, or will in the future. - case "${UNAME_MACHINE_ARCH}" in - arm*|i386|m68k|ns32k|sh3*|sparc|vax) - eval $set_cc_for_build - if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep -q __ELF__ - then - # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). - # Return netbsd for either. FIX? - os=netbsd - else - os=netbsdelf - fi - ;; - *) - os=netbsd - ;; - esac - # The OS release - # Debian GNU/NetBSD machines have a different userland, and - # thus, need a distinct triplet. However, they do not need - # kernel version information, so it can be replaced with a - # suitable tag, in the style of linux-gnu. - case "${UNAME_VERSION}" in - Debian*) - release='-gnu' - ;; - *) - release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - ;; - esac - # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: - # contains redundant information, the shorter form: - # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "${machine}-${os}${release}" - exit ;; - *:OpenBSD:*:*) - UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` - echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} - exit ;; - *:ekkoBSD:*:*) - echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} - exit ;; - *:SolidBSD:*:*) - echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} - exit ;; - macppc:MirBSD:*:*) - echo powerpc-unknown-mirbsd${UNAME_RELEASE} - exit ;; - *:MirBSD:*:*) - echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} - exit ;; - alpha:OSF1:*:*) - case $UNAME_RELEASE in - *4.0) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` - ;; - *5.*) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` - ;; - esac - # According to Compaq, /usr/sbin/psrinfo has been available on - # OSF/1 and Tru64 systems produced since 1995. I hope that - # covers most systems running today. This code pipes the CPU - # types through head -n 1, so we only detect the type of CPU 0. - ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` - case "$ALPHA_CPU_TYPE" in - "EV4 (21064)") - UNAME_MACHINE="alpha" ;; - "EV4.5 (21064)") - UNAME_MACHINE="alpha" ;; - "LCA4 (21066/21068)") - UNAME_MACHINE="alpha" ;; - "EV5 (21164)") - UNAME_MACHINE="alphaev5" ;; - "EV5.6 (21164A)") - UNAME_MACHINE="alphaev56" ;; - "EV5.6 (21164PC)") - UNAME_MACHINE="alphapca56" ;; - "EV5.7 (21164PC)") - UNAME_MACHINE="alphapca57" ;; - "EV6 (21264)") - UNAME_MACHINE="alphaev6" ;; - "EV6.7 (21264A)") - UNAME_MACHINE="alphaev67" ;; - "EV6.8CB (21264C)") - UNAME_MACHINE="alphaev68" ;; - "EV6.8AL (21264B)") - UNAME_MACHINE="alphaev68" ;; - "EV6.8CX (21264D)") - UNAME_MACHINE="alphaev68" ;; - "EV6.9A (21264/EV69A)") - UNAME_MACHINE="alphaev69" ;; - "EV7 (21364)") - UNAME_MACHINE="alphaev7" ;; - "EV7.9 (21364A)") - UNAME_MACHINE="alphaev79" ;; - esac - # A Pn.n version is a patched version. - # A Vn.n version is a released version. - # A Tn.n version is a released field test version. - # A Xn.n version is an unreleased experimental baselevel. - # 1.2 uses "1.2" for uname -r. - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Reset EXIT trap before exiting to avoid spurious non-zero exit code. - exitcode=$? - trap '' 0 - exit $exitcode ;; - Alpha\ *:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # Should we change UNAME_MACHINE based on the output of uname instead - # of the specific Alpha model? - echo alpha-pc-interix - exit ;; - 21064:Windows_NT:50:3) - echo alpha-dec-winnt3.5 - exit ;; - Amiga*:UNIX_System_V:4.0:*) - echo m68k-unknown-sysv4 - exit ;; - *:[Aa]miga[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-amigaos - exit ;; - *:[Mm]orph[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-morphos - exit ;; - *:OS/390:*:*) - echo i370-ibm-openedition - exit ;; - *:z/VM:*:*) - echo s390-ibm-zvmoe - exit ;; - *:OS400:*:*) - echo powerpc-ibm-os400 - exit ;; - arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) - echo arm-acorn-riscix${UNAME_RELEASE} - exit ;; - arm:riscos:*:*|arm:RISCOS:*:*) - echo arm-unknown-riscos - exit ;; - SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) - echo hppa1.1-hitachi-hiuxmpp - exit ;; - Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) - # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. - if test "`(/bin/universe) 2>/dev/null`" = att ; then - echo pyramid-pyramid-sysv3 - else - echo pyramid-pyramid-bsd - fi - exit ;; - NILE*:*:*:dcosx) - echo pyramid-pyramid-svr4 - exit ;; - DRS?6000:unix:4.0:6*) - echo sparc-icl-nx6 - exit ;; - DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) - case `/usr/bin/uname -p` in - sparc) echo sparc-icl-nx7; exit ;; - esac ;; - s390x:SunOS:*:*) - echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4H:SunOS:5.*:*) - echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) - echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) - echo i386-pc-auroraux${UNAME_RELEASE} - exit ;; - i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) - eval $set_cc_for_build - SUN_ARCH="i386" - # If there is a compiler, see if it is configured for 64-bit objects. - # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. - # This test works for both compilers. - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then - if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - SUN_ARCH="x86_64" - fi - fi - echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:6*:*) - # According to config.sub, this is the proper way to canonicalize - # SunOS6. Hard to guess exactly what SunOS6 will be like, but - # it's likely to be more like Solaris than SunOS4. - echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:*:*) - case "`/usr/bin/arch -k`" in - Series*|S4*) - UNAME_RELEASE=`uname -v` - ;; - esac - # Japanese Language versions have a version number like `4.1.3-JL'. - echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` - exit ;; - sun3*:SunOS:*:*) - echo m68k-sun-sunos${UNAME_RELEASE} - exit ;; - sun*:*:4.2BSD:*) - UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` - test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 - case "`/bin/arch`" in - sun3) - echo m68k-sun-sunos${UNAME_RELEASE} - ;; - sun4) - echo sparc-sun-sunos${UNAME_RELEASE} - ;; - esac - exit ;; - aushp:SunOS:*:*) - echo sparc-auspex-sunos${UNAME_RELEASE} - exit ;; - # The situation for MiNT is a little confusing. The machine name - # can be virtually everything (everything which is not - # "atarist" or "atariste" at least should have a processor - # > m68000). The system name ranges from "MiNT" over "FreeMiNT" - # to the lowercase version "mint" (or "freemint"). Finally - # the system name "TOS" denotes a system which is actually not - # MiNT. But MiNT is downward compatible to TOS, so this should - # be no problem. - atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint${UNAME_RELEASE} - exit ;; - hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint${UNAME_RELEASE} - exit ;; - *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint${UNAME_RELEASE} - exit ;; - m68k:machten:*:*) - echo m68k-apple-machten${UNAME_RELEASE} - exit ;; - powerpc:machten:*:*) - echo powerpc-apple-machten${UNAME_RELEASE} - exit ;; - RISC*:Mach:*:*) - echo mips-dec-mach_bsd4.3 - exit ;; - RISC*:ULTRIX:*:*) - echo mips-dec-ultrix${UNAME_RELEASE} - exit ;; - VAX*:ULTRIX*:*:*) - echo vax-dec-ultrix${UNAME_RELEASE} - exit ;; - 2020:CLIX:*:* | 2430:CLIX:*:*) - echo clipper-intergraph-clix${UNAME_RELEASE} - exit ;; - mips:*:*:UMIPS | mips:*:*:RISCos) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c -#ifdef __cplusplus -#include /* for printf() prototype */ - int main (int argc, char *argv[]) { -#else - int main (argc, argv) int argc; char *argv[]; { -#endif - #if defined (host_mips) && defined (MIPSEB) - #if defined (SYSTYPE_SYSV) - printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_SVR4) - printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) - printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); - #endif - #endif - exit (-1); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c && - dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && - SYSTEM_NAME=`$dummy $dummyarg` && - { echo "$SYSTEM_NAME"; exit; } - echo mips-mips-riscos${UNAME_RELEASE} - exit ;; - Motorola:PowerMAX_OS:*:*) - echo powerpc-motorola-powermax - exit ;; - Motorola:*:4.3:PL8-*) - echo powerpc-harris-powermax - exit ;; - Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) - echo powerpc-harris-powermax - exit ;; - Night_Hawk:Power_UNIX:*:*) - echo powerpc-harris-powerunix - exit ;; - m88k:CX/UX:7*:*) - echo m88k-harris-cxux7 - exit ;; - m88k:*:4*:R4*) - echo m88k-motorola-sysv4 - exit ;; - m88k:*:3*:R3*) - echo m88k-motorola-sysv3 - exit ;; - AViiON:dgux:*:*) - # DG/UX returns AViiON for all architectures - UNAME_PROCESSOR=`/usr/bin/uname -p` - if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] - then - if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ - [ ${TARGET_BINARY_INTERFACE}x = x ] - then - echo m88k-dg-dgux${UNAME_RELEASE} - else - echo m88k-dg-dguxbcs${UNAME_RELEASE} - fi - else - echo i586-dg-dgux${UNAME_RELEASE} - fi - exit ;; - M88*:DolphinOS:*:*) # DolphinOS (SVR3) - echo m88k-dolphin-sysv3 - exit ;; - M88*:*:R3*:*) - # Delta 88k system running SVR3 - echo m88k-motorola-sysv3 - exit ;; - XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) - echo m88k-tektronix-sysv3 - exit ;; - Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) - echo m68k-tektronix-bsd - exit ;; - *:IRIX*:*:*) - echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` - exit ;; - ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. - echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id - exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' - i*86:AIX:*:*) - echo i386-ibm-aix - exit ;; - ia64:AIX:*:*) - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} - exit ;; - *:AIX:2:3) - if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - - main() - { - if (!__power_pc()) - exit(1); - puts("powerpc-ibm-aix3.2.5"); - exit(0); - } -EOF - if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` - then - echo "$SYSTEM_NAME" - else - echo rs6000-ibm-aix3.2.5 - fi - elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then - echo rs6000-ibm-aix3.2.4 - else - echo rs6000-ibm-aix3.2 - fi - exit ;; - *:AIX:*:[4567]) - IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` - if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then - IBM_ARCH=rs6000 - else - IBM_ARCH=powerpc - fi - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${IBM_ARCH}-ibm-aix${IBM_REV} - exit ;; - *:AIX:*:*) - echo rs6000-ibm-aix - exit ;; - ibmrt:4.4BSD:*|romp-ibm:BSD:*) - echo romp-ibm-bsd4.4 - exit ;; - ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and - echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to - exit ;; # report: romp-ibm BSD 4.3 - *:BOSX:*:*) - echo rs6000-bull-bosx - exit ;; - DPX/2?00:B.O.S.:*:*) - echo m68k-bull-sysv3 - exit ;; - 9000/[34]??:4.3bsd:1.*:*) - echo m68k-hp-bsd - exit ;; - hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) - echo m68k-hp-bsd4.4 - exit ;; - 9000/[34678]??:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - case "${UNAME_MACHINE}" in - 9000/31? ) HP_ARCH=m68000 ;; - 9000/[34]?? ) HP_ARCH=m68k ;; - 9000/[678][0-9][0-9]) - if [ -x /usr/bin/getconf ]; then - sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` - sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` - case "${sc_cpu_version}" in - 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 - 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 - 532) # CPU_PA_RISC2_0 - case "${sc_kernel_bits}" in - 32) HP_ARCH="hppa2.0n" ;; - 64) HP_ARCH="hppa2.0w" ;; - '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 - esac ;; - esac - fi - if [ "${HP_ARCH}" = "" ]; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - - #define _HPUX_SOURCE - #include - #include - - int main () - { - #if defined(_SC_KERNEL_BITS) - long bits = sysconf(_SC_KERNEL_BITS); - #endif - long cpu = sysconf (_SC_CPU_VERSION); - - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1"); break; - case CPU_PA_RISC2_0: - #if defined(_SC_KERNEL_BITS) - switch (bits) - { - case 64: puts ("hppa2.0w"); break; - case 32: puts ("hppa2.0n"); break; - default: puts ("hppa2.0"); break; - } break; - #else /* !defined(_SC_KERNEL_BITS) */ - puts ("hppa2.0"); break; - #endif - default: puts ("hppa1.0"); break; - } - exit (0); - } -EOF - (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` - test -z "$HP_ARCH" && HP_ARCH=hppa - fi ;; - esac - if [ ${HP_ARCH} = "hppa2.0w" ] - then - eval $set_cc_for_build - - # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating - # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler - # generating 64-bit code. GNU and HP use different nomenclature: - # - # $ CC_FOR_BUILD=cc ./config.guess - # => hppa2.0w-hp-hpux11.23 - # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess - # => hppa64-hp-hpux11.23 - - if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | - grep -q __LP64__ - then - HP_ARCH="hppa2.0w" - else - HP_ARCH="hppa64" - fi - fi - echo ${HP_ARCH}-hp-hpux${HPUX_REV} - exit ;; - ia64:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - echo ia64-hp-hpux${HPUX_REV} - exit ;; - 3050*:HI-UX:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - int - main () - { - long cpu = sysconf (_SC_CPU_VERSION); - /* The order matters, because CPU_IS_HP_MC68K erroneously returns - true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct - results, however. */ - if (CPU_IS_PA_RISC (cpu)) - { - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; - case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; - default: puts ("hppa-hitachi-hiuxwe2"); break; - } - } - else if (CPU_IS_HP_MC68K (cpu)) - puts ("m68k-hitachi-hiuxwe2"); - else puts ("unknown-hitachi-hiuxwe2"); - exit (0); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && - { echo "$SYSTEM_NAME"; exit; } - echo unknown-hitachi-hiuxwe2 - exit ;; - 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) - echo hppa1.1-hp-bsd - exit ;; - 9000/8??:4.3bsd:*:*) - echo hppa1.0-hp-bsd - exit ;; - *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) - echo hppa1.0-hp-mpeix - exit ;; - hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) - echo hppa1.1-hp-osf - exit ;; - hp8??:OSF1:*:*) - echo hppa1.0-hp-osf - exit ;; - i*86:OSF1:*:*) - if [ -x /usr/sbin/sysversion ] ; then - echo ${UNAME_MACHINE}-unknown-osf1mk - else - echo ${UNAME_MACHINE}-unknown-osf1 - fi - exit ;; - parisc*:Lites*:*:*) - echo hppa1.1-hp-lites - exit ;; - C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) - echo c1-convex-bsd - exit ;; - C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit ;; - C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) - echo c34-convex-bsd - exit ;; - C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) - echo c38-convex-bsd - exit ;; - C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) - echo c4-convex-bsd - exit ;; - CRAY*Y-MP:*:*:*) - echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*[A-Z]90:*:*:*) - echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ - | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ - -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ - -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*TS:*:*:*) - echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*T3E:*:*:*) - echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*SV1:*:*:*) - echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - *:UNICOS/mp:*:*) - echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) - FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` - echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; - 5000:UNIX_System_V:4.*:*) - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` - echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; - i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) - echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} - exit ;; - sparc*:BSD/OS:*:*) - echo sparc-unknown-bsdi${UNAME_RELEASE} - exit ;; - *:BSD/OS:*:*) - echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} - exit ;; - *:FreeBSD:*:*) - UNAME_PROCESSOR=`/usr/bin/uname -p` - case ${UNAME_PROCESSOR} in - amd64) - echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - *) - echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - esac - exit ;; - i*:CYGWIN*:*) - echo ${UNAME_MACHINE}-pc-cygwin - exit ;; - *:MINGW*:*) - echo ${UNAME_MACHINE}-pc-mingw32 - exit ;; - i*:windows32*:*) - # uname -m includes "-pc" on this system. - echo ${UNAME_MACHINE}-mingw32 - exit ;; - i*:PW*:*) - echo ${UNAME_MACHINE}-pc-pw32 - exit ;; - *:Interix*:*) - case ${UNAME_MACHINE} in - x86) - echo i586-pc-interix${UNAME_RELEASE} - exit ;; - authenticamd | genuineintel | EM64T) - echo x86_64-unknown-interix${UNAME_RELEASE} - exit ;; - IA64) - echo ia64-unknown-interix${UNAME_RELEASE} - exit ;; - esac ;; - [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) - echo i${UNAME_MACHINE}-pc-mks - exit ;; - 8664:Windows_NT:*) - echo x86_64-pc-mks - exit ;; - i*:Windows_NT*:* | Pentium*:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we - # UNAME_MACHINE based on the output of uname instead of i386? - echo i586-pc-interix - exit ;; - i*:UWIN*:*) - echo ${UNAME_MACHINE}-pc-uwin - exit ;; - amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) - echo x86_64-unknown-cygwin - exit ;; - p*:CYGWIN*:*) - echo powerpcle-unknown-cygwin - exit ;; - prep*:SunOS:5.*:*) - echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - *:GNU:*:*) - # the GNU system - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` - exit ;; - *:GNU/*:*:*) - # other systems with GNU libc and userland - echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu - exit ;; - i*86:Minix:*:*) - echo ${UNAME_MACHINE}-pc-minix - exit ;; - alpha:Linux:*:*) - case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in - EV5) UNAME_MACHINE=alphaev5 ;; - EV56) UNAME_MACHINE=alphaev56 ;; - PCA56) UNAME_MACHINE=alphapca56 ;; - PCA57) UNAME_MACHINE=alphapca56 ;; - EV6) UNAME_MACHINE=alphaev6 ;; - EV67) UNAME_MACHINE=alphaev67 ;; - EV68*) UNAME_MACHINE=alphaev68 ;; - esac - objdump --private-headers /bin/sh | grep -q ld.so.1 - if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} - exit ;; - arm*:Linux:*:*) - eval $set_cc_for_build - if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep -q __ARM_EABI__ - then - echo ${UNAME_MACHINE}-unknown-linux-gnu - else - if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep -q __ARM_PCS_VFP - then - echo ${UNAME_MACHINE}-unknown-linux-gnueabi - else - echo ${UNAME_MACHINE}-unknown-linux-gnueabihf - fi - fi - exit ;; - avr32*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - cris:Linux:*:*) - echo cris-axis-linux-gnu - exit ;; - crisv32:Linux:*:*) - echo crisv32-axis-linux-gnu - exit ;; - frv:Linux:*:*) - echo frv-unknown-linux-gnu - exit ;; - i*86:Linux:*:*) - LIBC=gnu - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #ifdef __dietlibc__ - LIBC=dietlibc - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` - echo "${UNAME_MACHINE}-pc-linux-${LIBC}" - exit ;; - ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - mips:Linux:*:* | mips64:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #undef CPU - #undef ${UNAME_MACHINE} - #undef ${UNAME_MACHINE}el - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=${UNAME_MACHINE}el - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=${UNAME_MACHINE} - #else - CPU= - #endif - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } - ;; - or32:Linux:*:*) - echo or32-unknown-linux-gnu - exit ;; - padre:Linux:*:*) - echo sparc-unknown-linux-gnu - exit ;; - parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu - exit ;; - parisc:Linux:*:* | hppa:Linux:*:*) - # Look for CPU level - case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-gnu ;; - PA8*) echo hppa2.0-unknown-linux-gnu ;; - *) echo hppa-unknown-linux-gnu ;; - esac - exit ;; - ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu - exit ;; - ppc64le:Linux:*:*) - echo powerpc64le-unknown-linux-gnu - exit ;; - ppc:Linux:*:*) - echo powerpc-unknown-linux-gnu - exit ;; - s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux - exit ;; - sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - tile*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - vax:Linux:*:*) - echo ${UNAME_MACHINE}-dec-linux-gnu - exit ;; - x86_64:Linux:*:*) - echo x86_64-unknown-linux-gnu - exit ;; - xtensa*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - i*86:DYNIX/ptx:4*:*) - # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. - # earlier versions are messed up and put the nodename in both - # sysname and nodename. - echo i386-sequent-sysv4 - exit ;; - i*86:UNIX_SV:4.2MP:2.*) - # Unixware is an offshoot of SVR4, but it has its own version - # number series starting with 2... - # I am not positive that other SVR4 systems won't match this, - # I just have to hope. -- rms. - # Use sysv4.2uw... so that sysv4* matches it. - echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} - exit ;; - i*86:OS/2:*:*) - # If we were able to find `uname', then EMX Unix compatibility - # is probably installed. - echo ${UNAME_MACHINE}-pc-os2-emx - exit ;; - i*86:XTS-300:*:STOP) - echo ${UNAME_MACHINE}-unknown-stop - exit ;; - i*86:atheos:*:*) - echo ${UNAME_MACHINE}-unknown-atheos - exit ;; - i*86:syllable:*:*) - echo ${UNAME_MACHINE}-pc-syllable - exit ;; - i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) - echo i386-unknown-lynxos${UNAME_RELEASE} - exit ;; - i*86:*DOS:*:*) - echo ${UNAME_MACHINE}-pc-msdosdjgpp - exit ;; - i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) - UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` - if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then - echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} - else - echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} - fi - exit ;; - i*86:*:5:[678]*) - # UnixWare 7.x, OpenUNIX and OpenServer 6. - case `/bin/uname -X | grep "^Machine"` in - *486*) UNAME_MACHINE=i486 ;; - *Pentium) UNAME_MACHINE=i586 ;; - *Pent*|*Celeron) UNAME_MACHINE=i686 ;; - esac - echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} - exit ;; - i*86:*:3.2:*) - if test -f /usr/options/cb.name; then - UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then - UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` - (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 - (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ - && UNAME_MACHINE=i586 - (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ - && UNAME_MACHINE=i686 - (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ - && UNAME_MACHINE=i686 - echo ${UNAME_MACHINE}-pc-sco$UNAME_REL - else - echo ${UNAME_MACHINE}-pc-sysv32 - fi - exit ;; - pc:*:*:*) - # Left here for compatibility: - # uname -m prints for DJGPP always 'pc', but it prints nothing about - # the processor, so we play safe by assuming i586. - # Note: whatever this is, it MUST be the same as what config.sub - # prints for the "djgpp" host, or else GDB configury will decide that - # this is a cross-build. - echo i586-pc-msdosdjgpp - exit ;; - Intel:Mach:3*:*) - echo i386-pc-mach3 - exit ;; - paragon:*:*:*) - echo i860-intel-osf1 - exit ;; - i860:*:4.*:*) # i860-SVR4 - if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then - echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 - else # Add other i860-SVR4 vendors below as they are discovered. - echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 - fi - exit ;; - mini*:CTIX:SYS*5:*) - # "miniframe" - echo m68010-convergent-sysv - exit ;; - mc68k:UNIX:SYSTEM5:3.51m) - echo m68k-convergent-sysv - exit ;; - M680?0:D-NIX:5.3:*) - echo m68k-diab-dnix - exit ;; - M68*:*:R3V[5678]*:*) - test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; - 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) - OS_REL='' - test -r /etc/.relid \ - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4.3${OS_REL}; exit; } - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; - 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4; exit; } ;; - NCR*:*:4.2:* | MPRAS*:*:4.2:*) - OS_REL='.3' - test -r /etc/.relid \ - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4.3${OS_REL}; exit; } - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } - /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; - m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) - echo m68k-unknown-lynxos${UNAME_RELEASE} - exit ;; - mc68030:UNIX_System_V:4.*:*) - echo m68k-atari-sysv4 - exit ;; - TSUNAMI:LynxOS:2.*:*) - echo sparc-unknown-lynxos${UNAME_RELEASE} - exit ;; - rs6000:LynxOS:2.*:*) - echo rs6000-unknown-lynxos${UNAME_RELEASE} - exit ;; - PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) - echo powerpc-unknown-lynxos${UNAME_RELEASE} - exit ;; - SM[BE]S:UNIX_SV:*:*) - echo mips-dde-sysv${UNAME_RELEASE} - exit ;; - RM*:ReliantUNIX-*:*:*) - echo mips-sni-sysv4 - exit ;; - RM*:SINIX-*:*:*) - echo mips-sni-sysv4 - exit ;; - *:SINIX-*:*:*) - if uname -p 2>/dev/null >/dev/null ; then - UNAME_MACHINE=`(uname -p) 2>/dev/null` - echo ${UNAME_MACHINE}-sni-sysv4 - else - echo ns32k-sni-sysv - fi - exit ;; - PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says - echo i586-unisys-sysv4 - exit ;; - *:UNIX_System_V:4*:FTX*) - # From Gerald Hewes . - # How about differentiating between stratus architectures? -djm - echo hppa1.1-stratus-sysv4 - exit ;; - *:*:*:FTX*) - # From seanf@swdc.stratus.com. - echo i860-stratus-sysv4 - exit ;; - i*86:VOS:*:*) - # From Paul.Green@stratus.com. - echo ${UNAME_MACHINE}-stratus-vos - exit ;; - *:VOS:*:*) - # From Paul.Green@stratus.com. - echo hppa1.1-stratus-vos - exit ;; - mc68*:A/UX:*:*) - echo m68k-apple-aux${UNAME_RELEASE} - exit ;; - news*:NEWS-OS:6*:*) - echo mips-sony-newsos6 - exit ;; - R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) - if [ -d /usr/nec ]; then - echo mips-nec-sysv${UNAME_RELEASE} - else - echo mips-unknown-sysv${UNAME_RELEASE} - fi - exit ;; - BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. - echo powerpc-be-beos - exit ;; - BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. - echo powerpc-apple-beos - exit ;; - BePC:BeOS:*:*) # BeOS running on Intel PC compatible. - echo i586-pc-beos - exit ;; - BePC:Haiku:*:*) # Haiku running on Intel PC compatible. - echo i586-pc-haiku - exit ;; - SX-4:SUPER-UX:*:*) - echo sx4-nec-superux${UNAME_RELEASE} - exit ;; - SX-5:SUPER-UX:*:*) - echo sx5-nec-superux${UNAME_RELEASE} - exit ;; - SX-6:SUPER-UX:*:*) - echo sx6-nec-superux${UNAME_RELEASE} - exit ;; - SX-7:SUPER-UX:*:*) - echo sx7-nec-superux${UNAME_RELEASE} - exit ;; - SX-8:SUPER-UX:*:*) - echo sx8-nec-superux${UNAME_RELEASE} - exit ;; - SX-8R:SUPER-UX:*:*) - echo sx8r-nec-superux${UNAME_RELEASE} - exit ;; - Power*:Rhapsody:*:*) - echo powerpc-apple-rhapsody${UNAME_RELEASE} - exit ;; - *:Rhapsody:*:*) - echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} - exit ;; - *:Darwin:*:*) - UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown - case $UNAME_PROCESSOR in - i386) - eval $set_cc_for_build - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then - if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - UNAME_PROCESSOR="x86_64" - fi - fi ;; - unknown) UNAME_PROCESSOR=powerpc ;; - esac - echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} - exit ;; - *:procnto*:*:* | *:QNX:[0123456789]*:*) - UNAME_PROCESSOR=`uname -p` - if test "$UNAME_PROCESSOR" = "x86"; then - UNAME_PROCESSOR=i386 - UNAME_MACHINE=pc - fi - echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} - exit ;; - *:QNX:*:4*) - echo i386-pc-qnx - exit ;; - NEO-?:NONSTOP_KERNEL:*:*) - echo neo-tandem-nsk${UNAME_RELEASE} - exit ;; - NSE-?:NONSTOP_KERNEL:*:*) - echo nse-tandem-nsk${UNAME_RELEASE} - exit ;; - NSR-?:NONSTOP_KERNEL:*:*) - echo nsr-tandem-nsk${UNAME_RELEASE} - exit ;; - *:NonStop-UX:*:*) - echo mips-compaq-nonstopux - exit ;; - BS2000:POSIX*:*:*) - echo bs2000-siemens-sysv - exit ;; - DS/*:UNIX_System_V:*:*) - echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} - exit ;; - *:Plan9:*:*) - # "uname -m" is not consistent, so use $cputype instead. 386 - # is converted to i386 for consistency with other x86 - # operating systems. - if test "$cputype" = "386"; then - UNAME_MACHINE=i386 - else - UNAME_MACHINE="$cputype" - fi - echo ${UNAME_MACHINE}-unknown-plan9 - exit ;; - *:TOPS-10:*:*) - echo pdp10-unknown-tops10 - exit ;; - *:TENEX:*:*) - echo pdp10-unknown-tenex - exit ;; - KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) - echo pdp10-dec-tops20 - exit ;; - XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) - echo pdp10-xkl-tops20 - exit ;; - *:TOPS-20:*:*) - echo pdp10-unknown-tops20 - exit ;; - *:ITS:*:*) - echo pdp10-unknown-its - exit ;; - SEI:*:*:SEIUX) - echo mips-sei-seiux${UNAME_RELEASE} - exit ;; - *:DragonFly:*:*) - echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` - exit ;; - *:*VMS:*:*) - UNAME_MACHINE=`(uname -p) 2>/dev/null` - case "${UNAME_MACHINE}" in - A*) echo alpha-dec-vms ; exit ;; - I*) echo ia64-dec-vms ; exit ;; - V*) echo vax-dec-vms ; exit ;; - esac ;; - *:XENIX:*:SysV) - echo i386-pc-xenix - exit ;; - i*86:skyos:*:*) - echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' - exit ;; - i*86:rdos:*:*) - echo ${UNAME_MACHINE}-pc-rdos - exit ;; - i*86:AROS:*:*) - echo ${UNAME_MACHINE}-pc-aros - exit ;; -esac - -#echo '(No uname command or uname output not recognized.)' 1>&2 -#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 - -eval $set_cc_for_build -cat >$dummy.c < -# include -#endif -main () -{ -#if defined (sony) -#if defined (MIPSEB) - /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, - I don't know.... */ - printf ("mips-sony-bsd\n"); exit (0); -#else -#include - printf ("m68k-sony-newsos%s\n", -#ifdef NEWSOS4 - "4" -#else - "" -#endif - ); exit (0); -#endif -#endif - -#if defined (__arm) && defined (__acorn) && defined (__unix) - printf ("arm-acorn-riscix\n"); exit (0); -#endif - -#if defined (hp300) && !defined (hpux) - printf ("m68k-hp-bsd\n"); exit (0); -#endif - -#if defined (NeXT) -#if !defined (__ARCHITECTURE__) -#define __ARCHITECTURE__ "m68k" -#endif - int version; - version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; - if (version < 4) - printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); - else - printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); - exit (0); -#endif - -#if defined (MULTIMAX) || defined (n16) -#if defined (UMAXV) - printf ("ns32k-encore-sysv\n"); exit (0); -#else -#if defined (CMU) - printf ("ns32k-encore-mach\n"); exit (0); -#else - printf ("ns32k-encore-bsd\n"); exit (0); -#endif -#endif -#endif - -#if defined (__386BSD__) - printf ("i386-pc-bsd\n"); exit (0); -#endif - -#if defined (sequent) -#if defined (i386) - printf ("i386-sequent-dynix\n"); exit (0); -#endif -#if defined (ns32000) - printf ("ns32k-sequent-dynix\n"); exit (0); -#endif -#endif - -#if defined (_SEQUENT_) - struct utsname un; - - uname(&un); - - if (strncmp(un.version, "V2", 2) == 0) { - printf ("i386-sequent-ptx2\n"); exit (0); - } - if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ - printf ("i386-sequent-ptx1\n"); exit (0); - } - printf ("i386-sequent-ptx\n"); exit (0); - -#endif - -#if defined (vax) -# if !defined (ultrix) -# include -# if defined (BSD) -# if BSD == 43 - printf ("vax-dec-bsd4.3\n"); exit (0); -# else -# if BSD == 199006 - printf ("vax-dec-bsd4.3reno\n"); exit (0); -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# endif -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# else - printf ("vax-dec-ultrix\n"); exit (0); -# endif -#endif - -#if defined (alliant) && defined (i860) - printf ("i860-alliant-bsd\n"); exit (0); -#endif - - exit (1); -} -EOF - -$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && - { echo "$SYSTEM_NAME"; exit; } - -# Apollos put the system type in the environment. - -test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } - -# Convex versions that predate uname can use getsysinfo(1) - -if [ -x /usr/convex/getsysinfo ] -then - case `getsysinfo -f cpu_type` in - c1*) - echo c1-convex-bsd - exit ;; - c2*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit ;; - c34*) - echo c34-convex-bsd - exit ;; - c38*) - echo c38-convex-bsd - exit ;; - c4*) - echo c4-convex-bsd - exit ;; - esac -fi - -cat >&2 < in order to provide the needed -information to handle your system. - -config.guess timestamp = $timestamp - -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null` - -hostinfo = `(hostinfo) 2>/dev/null` -/bin/universe = `(/bin/universe) 2>/dev/null` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` -/bin/arch = `(/bin/arch) 2>/dev/null` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` - -UNAME_MACHINE = ${UNAME_MACHINE} -UNAME_RELEASE = ${UNAME_RELEASE} -UNAME_SYSTEM = ${UNAME_SYSTEM} -UNAME_VERSION = ${UNAME_VERSION} -EOF - -exit 1 - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/autoconf/config.sub b/autoconf/config.sub deleted file mode 100755 index 9d22c1e52..000000000 --- a/autoconf/config.sub +++ /dev/null @@ -1,1768 +0,0 @@ -#! /bin/sh -# Configuration validation subroutine script. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, -# 2011 Free Software Foundation, Inc. - -timestamp='2011-11-02' - -# This file is (in principle) common to ALL GNU software. -# The presence of a machine in this file suggests that SOME GNU software -# can handle that machine. It does not imply ALL GNU software can. -# -# This file is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA -# 02110-1301, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - - -# Please send patches to . Submit a context -# diff and a properly formatted GNU ChangeLog entry. -# -# Configuration subroutine to validate and canonicalize a configuration type. -# Supply the specified configuration type as an argument. -# If it is invalid, we print an error message on stderr and exit with code 1. -# Otherwise, we print the canonical config type on stdout and succeed. - -# You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD - -# This file is supposed to be the same for all GNU packages -# and recognize all the CPU types, system types and aliases -# that are meaningful with *any* GNU software. -# Each package is responsible for reporting which valid configurations -# it does not support. The user should be able to distinguish -# a failure to support a valid configuration from a meaningless -# configuration. - -# The goal of this file is to map all the various variations of a given -# machine specification into a single specification in the form: -# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM -# or in some cases, the newer four-part form: -# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM -# It is wrong to echo any other type of specification. - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] CPU-MFR-OPSYS - $0 [OPTION] ALIAS - -Canonicalize a configuration name. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.sub ($timestamp) - -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, -2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free -Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit ;; - --version | -v ) - echo "$version" ; exit ;; - --help | --h* | -h ) - echo "$usage"; exit ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" - exit 1 ;; - - *local*) - # First pass through any local machine types. - echo $1 - exit ;; - - * ) - break ;; - esac -done - -case $# in - 0) echo "$me: missing argument$help" >&2 - exit 1;; - 1) ;; - *) echo "$me: too many arguments$help" >&2 - exit 1;; -esac - -# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). -# Here we must recognize all the valid KERNEL-OS combinations. -maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` -case $maybe_os in - nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ - linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ - knetbsd*-gnu* | netbsd*-gnu* | \ - kopensolaris*-gnu* | \ - storm-chaos* | os2-emx* | rtmk-nova*) - os=-$maybe_os - basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` - ;; - *) - basic_machine=`echo $1 | sed 's/-[^-]*$//'` - if [ $basic_machine != $1 ] - then os=`echo $1 | sed 's/.*-/-/'` - else os=; fi - ;; -esac - -### Let's recognize common machines as not being operating systems so -### that things like config.sub decstation-3100 work. We also -### recognize some manufacturers as not being operating systems, so we -### can provide default operating systems below. -case $os in - -sun*os*) - # Prevent following clause from handling this invalid input. - ;; - -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ - -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ - -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ - -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ - -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ - -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis | -knuth | -cray | -microblaze) - os= - basic_machine=$1 - ;; - -bluegene*) - os=-cnk - ;; - -sim | -cisco | -oki | -wec | -winbond) - os= - basic_machine=$1 - ;; - -scout) - ;; - -wrs) - os=-vxworks - basic_machine=$1 - ;; - -chorusos*) - os=-chorusos - basic_machine=$1 - ;; - -chorusrdb) - os=-chorusrdb - basic_machine=$1 - ;; - -hiux*) - os=-hiuxwe2 - ;; - -sco6) - os=-sco5v6 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco5) - os=-sco3.2v5 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco4) - os=-sco3.2v4 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2.[4-9]*) - os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2v[4-9]*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco5v6*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco*) - os=-sco3.2v2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -udk*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -isc) - os=-isc2.2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -clix*) - basic_machine=clipper-intergraph - ;; - -isc*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -lynx*) - os=-lynxos - ;; - -ptx*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` - ;; - -windowsnt*) - os=`echo $os | sed -e 's/windowsnt/winnt/'` - ;; - -psos*) - os=-psos - ;; - -mint | -mint[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; -esac - -# Decode aliases for certain CPU-COMPANY combinations. -case $basic_machine in - # Recognize the basic CPU types without company name. - # Some are omitted here because they have special meanings below. - 1750a | 580 \ - | a29k \ - | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ - | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ - | am33_2.0 \ - | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ - | be32 | be64 \ - | aarch64 \ - | bfin \ - | c4x | clipper \ - | d10v | d30v | dlx | dsp16xx \ - | fido | fr30 | frv \ - | hexagon \ - | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ - | i370 | i860 | i960 | ia64 \ - | ip2k | iq2000 \ - | le32 | le64 \ - | lm32 \ - | m32c | m32r | m32rle | m68000 | m68k | m88k \ - | maxq | mb | microblaze | mcore | mep | metag \ - | mips | mipsbe | mipseb | mipsel | mipsle \ - | mips16 \ - | mips64 | mips64el \ - | mips64octeon | mips64octeonel \ - | mips64orion | mips64orionel \ - | mips64r5900 | mips64r5900el \ - | mips64vr | mips64vrel \ - | mips64vr4100 | mips64vr4100el \ - | mips64vr4300 | mips64vr4300el \ - | mips64vr5000 | mips64vr5000el \ - | mips64vr5900 | mips64vr5900el \ - | mipsisa32 | mipsisa32el \ - | mipsisa32r2 | mipsisa32r2el \ - | mipsisa64 | mipsisa64el \ - | mipsisa64r2 | mipsisa64r2el \ - | mipsisa64sb1 | mipsisa64sb1el \ - | mipsisa64sr71k | mipsisa64sr71kel \ - | mipstx39 | mipstx39el \ - | mn10200 | mn10300 \ - | moxie \ - | mt \ - | msp430 \ - | nds32 | nds32le | nds32be \ - | nios | nios2 \ - | ns16k | ns32k \ - | open8 \ - | or32 \ - | pdp10 | pdp11 | pj | pjl \ - | powerpc | powerpc64 | powerpc64le | powerpcle \ - | pyramid \ - | rx \ - | score \ - | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ - | sh64 | sh64le \ - | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ - | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ - | spu \ - | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ - | ubicom32 \ - | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ - | we32k \ - | x86 | xc16x | xstormy16 | xtensa \ - | z8k | z80) - basic_machine=$basic_machine-unknown - ;; - c54x) - basic_machine=tic54x-unknown - ;; - c55x) - basic_machine=tic55x-unknown - ;; - c6x) - basic_machine=tic6x-unknown - ;; - m6811 | m68hc11 | m6812 | m68hc12 | picochip) - # Motorola 68HC11/12. - basic_machine=$basic_machine-unknown - os=-none - ;; - m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) - ;; - ms1) - basic_machine=mt-unknown - ;; - - strongarm | thumb | xscale) - basic_machine=arm-unknown - ;; - - xscaleeb) - basic_machine=armeb-unknown - ;; - - xscaleel) - basic_machine=armel-unknown - ;; - - # We use `pc' rather than `unknown' - # because (1) that's what they normally are, and - # (2) the word "unknown" tends to confuse beginning users. - i*86 | x86_64) - basic_machine=$basic_machine-pc - ;; - # Object if more than one company name word. - *-*-*) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; - # Recognize the basic CPU types with company name. - 580-* \ - | a29k-* \ - | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ - | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ - | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ - | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ - | aarch64-* \ - | avr-* | avr32-* \ - | be32-* | be64-* \ - | bfin-* | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c4x-* \ - | clipper-* | craynv-* | cydra-* \ - | d10v-* | d30v-* | dlx-* \ - | elxsi-* \ - | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ - | h8300-* | h8500-* \ - | hexagon-* \ - | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ - | i*86-* | i860-* | i960-* | ia64-* \ - | ip2k-* | iq2000-* \ - | le32-* | le64-* \ - | lm32-* \ - | m32c-* | m32r-* | m32rle-* \ - | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ - | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ - | mips16-* \ - | mips64-* | mips64el-* \ - | mips64octeon-* | mips64octeonel-* \ - | mips64orion-* | mips64orionel-* \ - | mips64r5900-* | mips64r5900el-* \ - | mips64vr-* | mips64vrel-* \ - | mips64vr4100-* | mips64vr4100el-* \ - | mips64vr4300-* | mips64vr4300el-* \ - | mips64vr5000-* | mips64vr5000el-* \ - | mips64vr5900-* | mips64vr5900el-* \ - | mipsisa32-* | mipsisa32el-* \ - | mipsisa32r2-* | mipsisa32r2el-* \ - | mipsisa64-* | mipsisa64el-* \ - | mipsisa64r2-* | mipsisa64r2el-* \ - | mipsisa64sb1-* | mipsisa64sb1el-* \ - | mipsisa64sr71k-* | mipsisa64sr71kel-* \ - | mipstx39-* | mipstx39el-* \ - | mmix-* \ - | mt-* \ - | msp430-* \ - | nds32-* | nds32le-* | nds32be-* \ - | nios-* | nios2-* \ - | none-* | np1-* | ns16k-* | ns32k-* \ - | open8-* \ - | orion-* \ - | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ - | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ - | pyramid-* \ - | romp-* | rs6000-* | rx-* \ - | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ - | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ - | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ - | sparclite-* \ - | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ - | tahoe-* \ - | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ - | tile*-* \ - | tron-* \ - | ubicom32-* \ - | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ - | vax-* \ - | we32k-* \ - | x86-* | x86_64-* | xc16x-* | xps100-* \ - | xstormy16-* | xtensa*-* \ - | ymp-* \ - | z8k-* | z80-*) - ;; - # Recognize the basic CPU types without company name, with glob match. - xtensa*) - basic_machine=$basic_machine-unknown - ;; - # Recognize the various machine names and aliases which stand - # for a CPU type and a company and sometimes even an OS. - 386bsd) - basic_machine=i386-unknown - os=-bsd - ;; - 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) - basic_machine=m68000-att - ;; - 3b*) - basic_machine=we32k-att - ;; - a29khif) - basic_machine=a29k-amd - os=-udi - ;; - abacus) - basic_machine=abacus-unknown - ;; - adobe68k) - basic_machine=m68010-adobe - os=-scout - ;; - alliant | fx80) - basic_machine=fx80-alliant - ;; - altos | altos3068) - basic_machine=m68k-altos - ;; - am29k) - basic_machine=a29k-none - os=-bsd - ;; - amd64) - basic_machine=x86_64-pc - ;; - amd64-*) - basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - amdahl) - basic_machine=580-amdahl - os=-sysv - ;; - amiga | amiga-*) - basic_machine=m68k-unknown - ;; - amigaos | amigados) - basic_machine=m68k-unknown - os=-amigaos - ;; - amigaunix | amix) - basic_machine=m68k-unknown - os=-sysv4 - ;; - apollo68) - basic_machine=m68k-apollo - os=-sysv - ;; - apollo68bsd) - basic_machine=m68k-apollo - os=-bsd - ;; - aros) - basic_machine=i386-pc - os=-aros - ;; - aux) - basic_machine=m68k-apple - os=-aux - ;; - balance) - basic_machine=ns32k-sequent - os=-dynix - ;; - blackfin) - basic_machine=bfin-unknown - os=-linux - ;; - blackfin-*) - basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` - os=-linux - ;; - bluegene*) - basic_machine=powerpc-ibm - os=-cnk - ;; - c54x-*) - basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - c55x-*) - basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - c6x-*) - basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - c90) - basic_machine=c90-cray - os=-unicos - ;; - cegcc) - basic_machine=arm-unknown - os=-cegcc - ;; - convex-c1) - basic_machine=c1-convex - os=-bsd - ;; - convex-c2) - basic_machine=c2-convex - os=-bsd - ;; - convex-c32) - basic_machine=c32-convex - os=-bsd - ;; - convex-c34) - basic_machine=c34-convex - os=-bsd - ;; - convex-c38) - basic_machine=c38-convex - os=-bsd - ;; - cray | j90) - basic_machine=j90-cray - os=-unicos - ;; - craynv) - basic_machine=craynv-cray - os=-unicosmp - ;; - cr16 | cr16-*) - basic_machine=cr16-unknown - os=-elf - ;; - crds | unos) - basic_machine=m68k-crds - ;; - crisv32 | crisv32-* | etraxfs*) - basic_machine=crisv32-axis - ;; - cris | cris-* | etrax*) - basic_machine=cris-axis - ;; - crx) - basic_machine=crx-unknown - os=-elf - ;; - da30 | da30-*) - basic_machine=m68k-da30 - ;; - decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) - basic_machine=mips-dec - ;; - decsystem10* | dec10*) - basic_machine=pdp10-dec - os=-tops10 - ;; - decsystem20* | dec20*) - basic_machine=pdp10-dec - os=-tops20 - ;; - delta | 3300 | motorola-3300 | motorola-delta \ - | 3300-motorola | delta-motorola) - basic_machine=m68k-motorola - ;; - delta88) - basic_machine=m88k-motorola - os=-sysv3 - ;; - dicos) - basic_machine=i686-pc - os=-dicos - ;; - djgpp) - basic_machine=i586-pc - os=-msdosdjgpp - ;; - dpx20 | dpx20-*) - basic_machine=rs6000-bull - os=-bosx - ;; - dpx2* | dpx2*-bull) - basic_machine=m68k-bull - os=-sysv3 - ;; - ebmon29k) - basic_machine=a29k-amd - os=-ebmon - ;; - elxsi) - basic_machine=elxsi-elxsi - os=-bsd - ;; - encore | umax | mmax) - basic_machine=ns32k-encore - ;; - es1800 | OSE68k | ose68k | ose | OSE) - basic_machine=m68k-ericsson - os=-ose - ;; - fx2800) - basic_machine=i860-alliant - ;; - genix) - basic_machine=ns32k-ns - ;; - gmicro) - basic_machine=tron-gmicro - os=-sysv - ;; - go32) - basic_machine=i386-pc - os=-go32 - ;; - h3050r* | hiux*) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - h8300hms) - basic_machine=h8300-hitachi - os=-hms - ;; - h8300xray) - basic_machine=h8300-hitachi - os=-xray - ;; - h8500hms) - basic_machine=h8500-hitachi - os=-hms - ;; - harris) - basic_machine=m88k-harris - os=-sysv3 - ;; - hp300-*) - basic_machine=m68k-hp - ;; - hp300bsd) - basic_machine=m68k-hp - os=-bsd - ;; - hp300hpux) - basic_machine=m68k-hp - os=-hpux - ;; - hp3k9[0-9][0-9] | hp9[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k2[0-9][0-9] | hp9k31[0-9]) - basic_machine=m68000-hp - ;; - hp9k3[2-9][0-9]) - basic_machine=m68k-hp - ;; - hp9k6[0-9][0-9] | hp6[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k7[0-79][0-9] | hp7[0-79][0-9]) - basic_machine=hppa1.1-hp - ;; - hp9k78[0-9] | hp78[0-9]) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][13679] | hp8[0-9][13679]) - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][0-9] | hp8[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hppa-next) - os=-nextstep3 - ;; - hppaosf) - basic_machine=hppa1.1-hp - os=-osf - ;; - hppro) - basic_machine=hppa1.1-hp - os=-proelf - ;; - i370-ibm* | ibm*) - basic_machine=i370-ibm - ;; -# I'm not sure what "Sysv32" means. Should this be sysv3.2? - i*86v32) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv32 - ;; - i*86v4*) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv4 - ;; - i*86v) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv - ;; - i*86sol2) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-solaris2 - ;; - i386mach) - basic_machine=i386-mach - os=-mach - ;; - i386-vsta | vsta) - basic_machine=i386-unknown - os=-vsta - ;; - iris | iris4d) - basic_machine=mips-sgi - case $os in - -irix*) - ;; - *) - os=-irix4 - ;; - esac - ;; - isi68 | isi) - basic_machine=m68k-isi - os=-sysv - ;; - m68knommu) - basic_machine=m68k-unknown - os=-linux - ;; - m68knommu-*) - basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` - os=-linux - ;; - m88k-omron*) - basic_machine=m88k-omron - ;; - magnum | m3230) - basic_machine=mips-mips - os=-sysv - ;; - merlin) - basic_machine=ns32k-utek - os=-sysv - ;; - microblaze) - basic_machine=microblaze-xilinx - ;; - mingw32) - basic_machine=i386-pc - os=-mingw32 - ;; - mingw32ce) - basic_machine=arm-unknown - os=-mingw32ce - ;; - miniframe) - basic_machine=m68000-convergent - ;; - *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; - mips3*-*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` - ;; - mips3*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown - ;; - monitor) - basic_machine=m68k-rom68k - os=-coff - ;; - morphos) - basic_machine=powerpc-unknown - os=-morphos - ;; - msdos) - basic_machine=i386-pc - os=-msdos - ;; - ms1-*) - basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` - ;; - mvs) - basic_machine=i370-ibm - os=-mvs - ;; - nacl) - basic_machine=le32-unknown - os=-nacl - ;; - ncr3000) - basic_machine=i486-ncr - os=-sysv4 - ;; - netbsd386) - basic_machine=i386-unknown - os=-netbsd - ;; - netwinder) - basic_machine=armv4l-rebel - os=-linux - ;; - news | news700 | news800 | news900) - basic_machine=m68k-sony - os=-newsos - ;; - news1000) - basic_machine=m68030-sony - os=-newsos - ;; - news-3600 | risc-news) - basic_machine=mips-sony - os=-newsos - ;; - necv70) - basic_machine=v70-nec - os=-sysv - ;; - next | m*-next ) - basic_machine=m68k-next - case $os in - -nextstep* ) - ;; - -ns2*) - os=-nextstep2 - ;; - *) - os=-nextstep3 - ;; - esac - ;; - nh3000) - basic_machine=m68k-harris - os=-cxux - ;; - nh[45]000) - basic_machine=m88k-harris - os=-cxux - ;; - nindy960) - basic_machine=i960-intel - os=-nindy - ;; - mon960) - basic_machine=i960-intel - os=-mon960 - ;; - nonstopux) - basic_machine=mips-compaq - os=-nonstopux - ;; - np1) - basic_machine=np1-gould - ;; - neo-tandem) - basic_machine=neo-tandem - ;; - nse-tandem) - basic_machine=nse-tandem - ;; - nsr-tandem) - basic_machine=nsr-tandem - ;; - op50n-* | op60c-*) - basic_machine=hppa1.1-oki - os=-proelf - ;; - openrisc | openrisc-*) - basic_machine=or32-unknown - ;; - os400) - basic_machine=powerpc-ibm - os=-os400 - ;; - OSE68000 | ose68000) - basic_machine=m68000-ericsson - os=-ose - ;; - os68k) - basic_machine=m68k-none - os=-os68k - ;; - pa-hitachi) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - paragon) - basic_machine=i860-intel - os=-osf - ;; - parisc) - basic_machine=hppa-unknown - os=-linux - ;; - parisc-*) - basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` - os=-linux - ;; - pbd) - basic_machine=sparc-tti - ;; - pbb) - basic_machine=m68k-tti - ;; - pc532 | pc532-*) - basic_machine=ns32k-pc532 - ;; - pc98) - basic_machine=i386-pc - ;; - pc98-*) - basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentium | p5 | k5 | k6 | nexgen | viac3) - basic_machine=i586-pc - ;; - pentiumpro | p6 | 6x86 | athlon | athlon_*) - basic_machine=i686-pc - ;; - pentiumii | pentium2 | pentiumiii | pentium3) - basic_machine=i686-pc - ;; - pentium4) - basic_machine=i786-pc - ;; - pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) - basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumpro-* | p6-* | 6x86-* | athlon-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentium4-*) - basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pn) - basic_machine=pn-gould - ;; - power) basic_machine=power-ibm - ;; - ppc | ppcbe) basic_machine=powerpc-unknown - ;; - ppc-* | ppcbe-*) - basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppcle | powerpclittle | ppc-le | powerpc-little) - basic_machine=powerpcle-unknown - ;; - ppcle-* | powerpclittle-*) - basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64) basic_machine=powerpc64-unknown - ;; - ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64le | powerpc64little | ppc64-le | powerpc64-little) - basic_machine=powerpc64le-unknown - ;; - ppc64le-* | powerpc64little-*) - basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ps2) - basic_machine=i386-ibm - ;; - pw32) - basic_machine=i586-unknown - os=-pw32 - ;; - rdos) - basic_machine=i386-pc - os=-rdos - ;; - rom68k) - basic_machine=m68k-rom68k - os=-coff - ;; - rm[46]00) - basic_machine=mips-siemens - ;; - rtpc | rtpc-*) - basic_machine=romp-ibm - ;; - s390 | s390-*) - basic_machine=s390-ibm - ;; - s390x | s390x-*) - basic_machine=s390x-ibm - ;; - sa29200) - basic_machine=a29k-amd - os=-udi - ;; - sb1) - basic_machine=mipsisa64sb1-unknown - ;; - sb1el) - basic_machine=mipsisa64sb1el-unknown - ;; - sde) - basic_machine=mipsisa32-sde - os=-elf - ;; - sei) - basic_machine=mips-sei - os=-seiux - ;; - sequent) - basic_machine=i386-sequent - ;; - sh) - basic_machine=sh-hitachi - os=-hms - ;; - sh5el) - basic_machine=sh5le-unknown - ;; - sh64) - basic_machine=sh64-unknown - ;; - sparclite-wrs | simso-wrs) - basic_machine=sparclite-wrs - os=-vxworks - ;; - sps7) - basic_machine=m68k-bull - os=-sysv2 - ;; - spur) - basic_machine=spur-unknown - ;; - st2000) - basic_machine=m68k-tandem - ;; - stratus) - basic_machine=i860-stratus - os=-sysv4 - ;; - strongarm-* | thumb-*) - basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - sun2) - basic_machine=m68000-sun - ;; - sun2os3) - basic_machine=m68000-sun - os=-sunos3 - ;; - sun2os4) - basic_machine=m68000-sun - os=-sunos4 - ;; - sun3os3) - basic_machine=m68k-sun - os=-sunos3 - ;; - sun3os4) - basic_machine=m68k-sun - os=-sunos4 - ;; - sun4os3) - basic_machine=sparc-sun - os=-sunos3 - ;; - sun4os4) - basic_machine=sparc-sun - os=-sunos4 - ;; - sun4sol2) - basic_machine=sparc-sun - os=-solaris2 - ;; - sun3 | sun3-*) - basic_machine=m68k-sun - ;; - sun4) - basic_machine=sparc-sun - ;; - sun386 | sun386i | roadrunner) - basic_machine=i386-sun - ;; - sv1) - basic_machine=sv1-cray - os=-unicos - ;; - symmetry) - basic_machine=i386-sequent - os=-dynix - ;; - t3e) - basic_machine=alphaev5-cray - os=-unicos - ;; - t90) - basic_machine=t90-cray - os=-unicos - ;; - tile*) - basic_machine=$basic_machine-unknown - os=-linux-gnu - ;; - tx39) - basic_machine=mipstx39-unknown - ;; - tx39el) - basic_machine=mipstx39el-unknown - ;; - toad1) - basic_machine=pdp10-xkl - os=-tops20 - ;; - tower | tower-32) - basic_machine=m68k-ncr - ;; - tpf) - basic_machine=s390x-ibm - os=-tpf - ;; - udi29k) - basic_machine=a29k-amd - os=-udi - ;; - ultra3) - basic_machine=a29k-nyu - os=-sym1 - ;; - v810 | necv810) - basic_machine=v810-nec - os=-none - ;; - vaxv) - basic_machine=vax-dec - os=-sysv - ;; - vms) - basic_machine=vax-dec - os=-vms - ;; - vpp*|vx|vx-*) - basic_machine=f301-fujitsu - ;; - vxworks960) - basic_machine=i960-wrs - os=-vxworks - ;; - vxworks68) - basic_machine=m68k-wrs - os=-vxworks - ;; - vxworks29k) - basic_machine=a29k-wrs - os=-vxworks - ;; - w65*) - basic_machine=w65-wdc - os=-none - ;; - w89k-*) - basic_machine=hppa1.1-winbond - os=-proelf - ;; - xbox) - basic_machine=i686-pc - os=-mingw32 - ;; - xps | xps100) - basic_machine=xps100-honeywell - ;; - xscale-* | xscalee[bl]-*) - basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` - ;; - ymp) - basic_machine=ymp-cray - os=-unicos - ;; - z8k-*-coff) - basic_machine=z8k-unknown - os=-sim - ;; - z80-*-coff) - basic_machine=z80-unknown - os=-sim - ;; - none) - basic_machine=none-none - os=-none - ;; - -# Here we handle the default manufacturer of certain CPU types. It is in -# some cases the only manufacturer, in others, it is the most popular. - w89k) - basic_machine=hppa1.1-winbond - ;; - op50n) - basic_machine=hppa1.1-oki - ;; - op60c) - basic_machine=hppa1.1-oki - ;; - romp) - basic_machine=romp-ibm - ;; - mmix) - basic_machine=mmix-knuth - ;; - rs6000) - basic_machine=rs6000-ibm - ;; - vax) - basic_machine=vax-dec - ;; - pdp10) - # there are many clones, so DEC is not a safe bet - basic_machine=pdp10-unknown - ;; - pdp11) - basic_machine=pdp11-dec - ;; - we32k) - basic_machine=we32k-att - ;; - sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) - basic_machine=sh-unknown - ;; - sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) - basic_machine=sparc-sun - ;; - cydra) - basic_machine=cydra-cydrome - ;; - orion) - basic_machine=orion-highlevel - ;; - orion105) - basic_machine=clipper-highlevel - ;; - mac | mpw | mac-mpw) - basic_machine=m68k-apple - ;; - pmac | pmac-mpw) - basic_machine=powerpc-apple - ;; - *-unknown) - # Make sure to match an already-canonicalized machine name. - ;; - *) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; -esac - -# Here we canonicalize certain aliases for manufacturers. -case $basic_machine in - *-digital*) - basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` - ;; - *-commodore*) - basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` - ;; - *) - ;; -esac - -# Decode manufacturer-specific aliases for certain operating systems. - -if [ x"$os" != x"" ] -then -case $os in - # First match some system type aliases - # that might get confused with valid system types. - # -solaris* is a basic system type, with this one exception. - -auroraux) - os=-auroraux - ;; - -solaris1 | -solaris1.*) - os=`echo $os | sed -e 's|solaris1|sunos4|'` - ;; - -solaris) - os=-solaris2 - ;; - -svr4*) - os=-sysv4 - ;; - -unixware*) - os=-sysv4.2uw - ;; - -gnu/linux*) - os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` - ;; - # First accept the basic system types. - # The portable systems comes first. - # Each alternative MUST END IN A *, to match a version number. - # -sysv* is not here because it comes later, after sysvr4. - -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ - | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ - | -sym* | -kopensolaris* \ - | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* | -aros* \ - | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ - | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ - | -openbsd* | -solidbsd* \ - | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ - | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ - | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ - | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -chorusos* | -chorusrdb* | -cegcc* \ - | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -linux-android* \ - | -linux-newlib* | -linux-uclibc* \ - | -uxpv* | -beos* | -mpeix* | -udk* \ - | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ - | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ - | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ - | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ - | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ - | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) - # Remember, each alternative MUST END IN *, to match a version number. - ;; - -qnx*) - case $basic_machine in - x86-* | i*86-*) - ;; - *) - os=-nto$os - ;; - esac - ;; - -nto-qnx*) - ;; - -nto*) - os=`echo $os | sed -e 's|nto|nto-qnx|'` - ;; - -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ - | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ - | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) - ;; - -mac*) - os=`echo $os | sed -e 's|mac|macos|'` - ;; - -linux-dietlibc) - os=-linux-dietlibc - ;; - -linux*) - os=`echo $os | sed -e 's|linux|linux-gnu|'` - ;; - -sunos5*) - os=`echo $os | sed -e 's|sunos5|solaris2|'` - ;; - -sunos6*) - os=`echo $os | sed -e 's|sunos6|solaris3|'` - ;; - -opened*) - os=-openedition - ;; - -os400*) - os=-os400 - ;; - -wince*) - os=-wince - ;; - -osfrose*) - os=-osfrose - ;; - -osf*) - os=-osf - ;; - -utek*) - os=-bsd - ;; - -dynix*) - os=-bsd - ;; - -acis*) - os=-aos - ;; - -atheos*) - os=-atheos - ;; - -syllable*) - os=-syllable - ;; - -386bsd) - os=-bsd - ;; - -ctix* | -uts*) - os=-sysv - ;; - -nova*) - os=-rtmk-nova - ;; - -ns2 ) - os=-nextstep2 - ;; - -nsk*) - os=-nsk - ;; - # Preserve the version number of sinix5. - -sinix5.*) - os=`echo $os | sed -e 's|sinix|sysv|'` - ;; - -sinix*) - os=-sysv4 - ;; - -tpf*) - os=-tpf - ;; - -triton*) - os=-sysv3 - ;; - -oss*) - os=-sysv3 - ;; - -svr4) - os=-sysv4 - ;; - -svr3) - os=-sysv3 - ;; - -sysvr4) - os=-sysv4 - ;; - # This must come after -sysvr4. - -sysv*) - ;; - -ose*) - os=-ose - ;; - -es1800*) - os=-ose - ;; - -xenix) - os=-xenix - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - os=-mint - ;; - -aros*) - os=-aros - ;; - -kaos*) - os=-kaos - ;; - -zvmoe) - os=-zvmoe - ;; - -dicos*) - os=-dicos - ;; - -nacl*) - ;; - -none) - ;; - *) - # Get rid of the `-' at the beginning of $os. - os=`echo $os | sed 's/[^-]*-//'` - echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 - exit 1 - ;; -esac -else - -# Here we handle the default operating systems that come with various machines. -# The value should be what the vendor currently ships out the door with their -# machine or put another way, the most popular os provided with the machine. - -# Note that if you're going to try to match "-MANUFACTURER" here (say, -# "-sun"), then you have to tell the case statement up towards the top -# that MANUFACTURER isn't an operating system. Otherwise, code above -# will signal an error saying that MANUFACTURER isn't an operating -# system, and we'll never get to this point. - -case $basic_machine in - score-*) - os=-elf - ;; - spu-*) - os=-elf - ;; - *-acorn) - os=-riscix1.2 - ;; - arm*-rebel) - os=-linux - ;; - arm*-semi) - os=-aout - ;; - c4x-* | tic4x-*) - os=-coff - ;; - tic54x-*) - os=-coff - ;; - tic55x-*) - os=-coff - ;; - tic6x-*) - os=-coff - ;; - # This must come before the *-dec entry. - pdp10-*) - os=-tops20 - ;; - pdp11-*) - os=-none - ;; - *-dec | vax-*) - os=-ultrix4.2 - ;; - m68*-apollo) - os=-domain - ;; - i386-sun) - os=-sunos4.0.2 - ;; - m68000-sun) - os=-sunos3 - # This also exists in the configure program, but was not the - # default. - # os=-sunos4 - ;; - m68*-cisco) - os=-aout - ;; - mep-*) - os=-elf - ;; - mips*-cisco) - os=-elf - ;; - mips*-*) - os=-elf - ;; - or32-*) - os=-coff - ;; - *-tti) # must be before sparc entry or we get the wrong os. - os=-sysv3 - ;; - sparc-* | *-sun) - os=-sunos4.1.1 - ;; - *-be) - os=-beos - ;; - *-haiku) - os=-haiku - ;; - *-ibm) - os=-aix - ;; - *-knuth) - os=-mmixware - ;; - *-wec) - os=-proelf - ;; - *-winbond) - os=-proelf - ;; - *-oki) - os=-proelf - ;; - *-hp) - os=-hpux - ;; - *-hitachi) - os=-hiux - ;; - i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) - os=-sysv - ;; - *-cbm) - os=-amigaos - ;; - *-dg) - os=-dgux - ;; - *-dolphin) - os=-sysv3 - ;; - m68k-ccur) - os=-rtu - ;; - m88k-omron*) - os=-luna - ;; - *-next ) - os=-nextstep - ;; - *-sequent) - os=-ptx - ;; - *-crds) - os=-unos - ;; - *-ns) - os=-genix - ;; - i370-*) - os=-mvs - ;; - *-next) - os=-nextstep3 - ;; - *-gould) - os=-sysv - ;; - *-highlevel) - os=-bsd - ;; - *-encore) - os=-bsd - ;; - *-sgi) - os=-irix - ;; - *-siemens) - os=-sysv4 - ;; - *-masscomp) - os=-rtu - ;; - f30[01]-fujitsu | f700-fujitsu) - os=-uxpv - ;; - *-rom68k) - os=-coff - ;; - *-*bug) - os=-coff - ;; - *-apple) - os=-macos - ;; - *-atari*) - os=-mint - ;; - *) - os=-none - ;; -esac -fi - -# Here we handle the case where we know the os, and the CPU type, but not the -# manufacturer. We pick the logical manufacturer. -vendor=unknown -case $basic_machine in - *-unknown) - case $os in - -riscix*) - vendor=acorn - ;; - -sunos*) - vendor=sun - ;; - -cnk*|-aix*) - vendor=ibm - ;; - -beos*) - vendor=be - ;; - -hpux*) - vendor=hp - ;; - -mpeix*) - vendor=hp - ;; - -hiux*) - vendor=hitachi - ;; - -unos*) - vendor=crds - ;; - -dgux*) - vendor=dg - ;; - -luna*) - vendor=omron - ;; - -genix*) - vendor=ns - ;; - -mvs* | -opened*) - vendor=ibm - ;; - -os400*) - vendor=ibm - ;; - -ptx*) - vendor=sequent - ;; - -tpf*) - vendor=ibm - ;; - -vxsim* | -vxworks* | -windiss*) - vendor=wrs - ;; - -aux*) - vendor=apple - ;; - -hms*) - vendor=hitachi - ;; - -mpw* | -macos*) - vendor=apple - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - vendor=atari - ;; - -vos*) - vendor=stratus - ;; - esac - basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` - ;; -esac - -echo $basic_machine$os -exit - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/autoconf/configure.ac b/autoconf/configure.ac deleted file mode 100644 index 7216b2ec8..000000000 --- a/autoconf/configure.ac +++ /dev/null @@ -1,1550 +0,0 @@ -dnl ************************************************************************** -dnl * Initialize -dnl ************************************************************************** -AC_INIT([[SMACK]],[[1.4.1]],[smack-dev@googlegroups.com],[smack],[http://github.com/smackers/smack]) - -dnl Identify where LLVM source tree is -LLVM_SRC_ROOT="../.." -LLVM_OBJ_ROOT="../.." - -dnl Find absolute paths to LLVM source and object trees -LLVM_ABS_SRC_ROOT="`cd $srcdir ; cd $LLVM_SRC_ROOT ; pwd`" -LLVM_ABS_OBJ_ROOT="`cd $LLVM_OBJ_ROOT ; pwd`" - -dnl Tell autoconf that this is an LLVM project being configured -dnl This provides the --with-llvmsrc and --with-llvmobj options -LLVM_CONFIG_PROJECT($LLVM_ABS_SRC_ROOT,$LLVM_ABS_OBJ_ROOT) - -dnl Try and find an llvm-config in the build directory. We are only using this -dnl to detect the package level LLVM information (currently just the version), -dnl so we just whatever one we find regardless of build mode. -AC_MSG_CHECKING([llvm-config]) -llvm_config_path="`ls -1 $llvm_obj/*/bin/llvm-config 2> /dev/null | head -1`" -if ! test -f "$llvm_config_path" ; then - llvm_config_path="no" -fi -AC_MSG_RESULT([$llvm_config_path]) - -dnl Determine the LLVM version, which may be required by the current Makefile -dnl rules. -AC_MSG_CHECKING([LLVM package version]) -if test "$llvm_config_path" != no ; then - llvm_package_version=`$llvm_config_path --version` -else - llvm_package_version="unknown"; -fi -AC_MSG_RESULT([$llvm_package_version]) -AC_SUBST(LLVM_VERSION, [$llvm_package_version]) - -dnl Verify that the source directory is valid -AC_CONFIG_SRCDIR(["Makefile.common.in"]) - -dnl Place all of the extra autoconf files into the config subdirectory. Tell -dnl various tools where the m4 autoconf macros are. -AC_CONFIG_AUX_DIR([autoconf]) - -dnl ************************************************************************** -dnl Begin LLVM configure.ac Import -dnl ************************************************************************** -dnl -dnl Derived from LLVM's configure.ac. This was imported directly here so that we -dnl could reuse LLVM's build infrastructure without introducing a direct source -dnl dependency on the LLVM files. - -dnl We need to check for the compiler up here to avoid anything else -dnl starting with a different one. -AC_PROG_CC(clang llvm-gcc gcc) -AC_PROG_CXX(clang++ llvm-g++ g++) -AC_PROG_CPP - -dnl Configure all of the projects present in our source tree. While we could -dnl just AC_CONFIG_SUBDIRS on the set of directories in projects that have a -dnl configure script, that usage of the AC_CONFIG_SUBDIRS macro is deprecated. -dnl Instead we match on the known projects. - -dnl -dnl One tricky part of doing this is that some projects depend upon other -dnl projects. For example, several projects rely upon the LLVM test suite. -dnl We want to configure those projects first so that their object trees are -dnl created before running the configure scripts of projects that depend upon -dnl them. -dnl - -dnl Disable the build of polly, even if it is checked out into tools/polly. -AC_ARG_ENABLE(polly, - AS_HELP_STRING([--enable-polly], - [Use polly if available (default is YES)]),, - enableval=default) -case "$enableval" in - yes) AC_SUBST(ENABLE_POLLY,[1]) ;; - no) AC_SUBST(ENABLE_POLLY,[0]) ;; - default) AC_SUBST(ENABLE_POLLY,[1]) ;; - *) AC_MSG_ERROR([Invalid setting for --enable-polly. Use "yes" or "no"]) ;; -esac - - -dnl Check if polly is checked out into tools/polly and configure it if -dnl available. -if (test -d ${srcdir}/tools/polly) && (test $ENABLE_POLLY -eq 1) ; then - AC_SUBST(LLVM_HAS_POLLY,1) - AC_CONFIG_SUBDIRS([tools/polly]) -fi - -dnl===-----------------------------------------------------------------------=== -dnl=== -dnl=== SECTION 2: Architecture, target, and host checks -dnl=== -dnl===-----------------------------------------------------------------------=== - -dnl Check the target for which we're compiling and the host that will do the -dnl compilations. This will tell us which LLVM compiler will be used for -dnl compiling SSA into object code. This needs to be done early because -dnl following tests depend on it. -AC_CANONICAL_TARGET - -dnl Determine the platform type and cache its value. This helps us configure -dnl the System library to the correct build platform. -AC_CACHE_CHECK([type of operating system we're going to host on], - [llvm_cv_os_type], -[case $host in - *-*-aix*) - llvm_cv_link_all_option="-Wl,--whole-archive" - llvm_cv_no_link_all_option="-Wl,--no-whole-archive" - llvm_cv_os_type="AIX" - llvm_cv_platform_type="Unix" ;; - *-*-irix*) - llvm_cv_link_all_option="-Wl,--whole-archive" - llvm_cv_no_link_all_option="-Wl,--no-whole-archive" - llvm_cv_os_type="IRIX" - llvm_cv_platform_type="Unix" ;; - *-*-cygwin*) - llvm_cv_link_all_option="-Wl,--whole-archive" - llvm_cv_no_link_all_option="-Wl,--no-whole-archive" - llvm_cv_os_type="Cygwin" - llvm_cv_platform_type="Unix" ;; - *-*-darwin*) - llvm_cv_link_all_option="-Wl,-all_load" - llvm_cv_no_link_all_option="-Wl,-noall_load" - llvm_cv_os_type="Darwin" - llvm_cv_platform_type="Unix" ;; - *-*-minix*) - llvm_cv_link_all_option="-Wl,-all_load" - llvm_cv_no_link_all_option="-Wl,-noall_load" - llvm_cv_os_type="Minix" - llvm_cv_platform_type="Unix" ;; - *-*-freebsd* | *-*-kfreebsd-gnu) - llvm_cv_link_all_option="-Wl,--whole-archive" - llvm_cv_no_link_all_option="-Wl,--no-whole-archive" - llvm_cv_os_type="FreeBSD" - llvm_cv_platform_type="Unix" ;; - *-*-openbsd*) - llvm_cv_link_all_option="-Wl,--whole-archive" - llvm_cv_no_link_all_option="-Wl,--no-whole-archive" - llvm_cv_os_type="OpenBSD" - llvm_cv_platform_type="Unix" ;; - *-*-netbsd*) - llvm_cv_link_all_option="-Wl,--whole-archive" - llvm_cv_no_link_all_option="-Wl,--no-whole-archive" - llvm_cv_os_type="NetBSD" - llvm_cv_platform_type="Unix" ;; - *-*-dragonfly*) - llvm_cv_link_all_option="-Wl,--whole-archive" - llvm_cv_no_link_all_option="-Wl,--no-whole-archive" - llvm_cv_os_type="DragonFly" - llvm_cv_platform_type="Unix" ;; - *-*-hpux*) - llvm_cv_link_all_option="-Wl,--whole-archive" - llvm_cv_no_link_all_option="-Wl,--no-whole-archive" - llvm_cv_os_type="HP-UX" - llvm_cv_platform_type="Unix" ;; - *-*-interix*) - llvm_cv_link_all_option="-Wl,--whole-archive" - llvm_cv_no_link_all_option="-Wl,--no-whole-archive" - llvm_cv_os_type="Interix" - llvm_cv_platform_type="Unix" ;; - *-*-linux*) - llvm_cv_link_all_option="-Wl,--whole-archive" - llvm_cv_no_link_all_option="-Wl,--no-whole-archive" - llvm_cv_os_type="Linux" - llvm_cv_platform_type="Unix" ;; - *-*-gnu*) - llvm_cv_link_all_option="-Wl,--whole-archive" - llvm_cv_no_link_all_option="-Wl,--no-whole-archive" - llvm_cv_os_type="GNU" - llvm_cv_platform_type="Unix" ;; - *-*-solaris*) - llvm_cv_link_all_option="-Wl,-z,allextract" - llvm_cv_no_link_all_option="-Wl,-z,defaultextract" - llvm_cv_os_type="SunOS" - llvm_cv_platform_type="Unix" ;; - *-*-auroraux*) - llvm_cv_link_all_option="-Wl,-z,allextract" - llvm_cv_link_all_option="-Wl,-z,defaultextract" - llvm_cv_os_type="AuroraUX" - llvm_cv_platform_type="Unix" ;; - *-*-win32*) - llvm_cv_link_all_option="-Wl,--whole-archive" - llvm_cv_no_link_all_option="-Wl,--no-whole-archive" - llvm_cv_os_type="Win32" - llvm_cv_platform_type="Win32" ;; - *-*-mingw*) - llvm_cv_link_all_option="-Wl,--whole-archive" - llvm_cv_no_link_all_option="-Wl,--no-whole-archive" - llvm_cv_os_type="MingW" - llvm_cv_platform_type="Win32" ;; - *-*-haiku*) - llvm_cv_link_all_option="-Wl,--whole-archive" - llvm_cv_no_link_all_option="-Wl,--no-whole-archive" - llvm_cv_os_type="Haiku" - llvm_cv_platform_type="Unix" ;; - *-unknown-eabi*) - llvm_cv_link_all_option="-Wl,--whole-archive" - llvm_cv_no_link_all_option="-Wl,--no-whole-archive" - llvm_cv_os_type="Freestanding" - llvm_cv_platform_type="Unix" ;; - *-unknown-elf*) - llvm_cv_link_all_option="-Wl,--whole-archive" - llvm_cv_no_link_all_option="-Wl,--no-whole-archive" - llvm_cv_os_type="Freestanding" - llvm_cv_platform_type="Unix" ;; - *) - llvm_cv_link_all_option="" - llvm_cv_no_link_all_option="" - llvm_cv_os_type="Unknown" - llvm_cv_platform_type="Unknown" ;; -esac]) - -AC_CACHE_CHECK([type of operating system we're going to target], - [llvm_cv_target_os_type], -[case $target in - *-*-aix*) - llvm_cv_target_os_type="AIX" ;; - *-*-irix*) - llvm_cv_target_os_type="IRIX" ;; - *-*-cygwin*) - llvm_cv_target_os_type="Cygwin" ;; - *-*-darwin*) - llvm_cv_target_os_type="Darwin" ;; - *-*-minix*) - llvm_cv_target_os_type="Minix" ;; - *-*-freebsd* | *-*-kfreebsd-gnu) - llvm_cv_target_os_type="FreeBSD" ;; - *-*-openbsd*) - llvm_cv_target_os_type="OpenBSD" ;; - *-*-netbsd*) - llvm_cv_target_os_type="NetBSD" ;; - *-*-dragonfly*) - llvm_cv_target_os_type="DragonFly" ;; - *-*-hpux*) - llvm_cv_target_os_type="HP-UX" ;; - *-*-interix*) - llvm_cv_target_os_type="Interix" ;; - *-*-linux*) - llvm_cv_target_os_type="Linux" ;; - *-*-gnu*) - llvm_cv_target_os_type="GNU" ;; - *-*-solaris*) - llvm_cv_target_os_type="SunOS" ;; - *-*-auroraux*) - llvm_cv_target_os_type="AuroraUX" ;; - *-*-win32*) - llvm_cv_target_os_type="Win32" ;; - *-*-mingw*) - llvm_cv_target_os_type="MingW" ;; - *-*-haiku*) - llvm_cv_target_os_type="Haiku" ;; - *-*-rtems*) - llvm_cv_target_os_type="RTEMS" ;; - *-*-nacl*) - llvm_cv_target_os_type="NativeClient" ;; - *-unknown-eabi*) - llvm_cv_target_os_type="Freestanding" ;; - *) - llvm_cv_target_os_type="Unknown" ;; -esac]) - -dnl Make sure we aren't attempting to configure for an unknown system -if test "$llvm_cv_os_type" = "Unknown" ; then - AC_MSG_ERROR([Operating system is unknown, configure can't continue]) -fi - -dnl Set the "OS" Makefile variable based on the platform type so the -dnl makefile can configure itself to specific build hosts -AC_SUBST(OS,$llvm_cv_os_type) -AC_SUBST(HOST_OS,$llvm_cv_os_type) -AC_SUBST(TARGET_OS,$llvm_cv_target_os_type) - -dnl Set the LINKALL and NOLINKALL Makefile variables based on the platform -AC_SUBST(LINKALL,$llvm_cv_link_all_option) -AC_SUBST(NOLINKALL,$llvm_cv_no_link_all_option) - -dnl Set the "LLVM_ON_*" variables based on llvm_cv_platform_type -dnl This is used by lib/Support to determine the basic kind of implementation -dnl to use. -case $llvm_cv_platform_type in - Unix) - AC_DEFINE([LLVM_ON_UNIX],[1],[Define if this is Unixish platform]) - AC_SUBST(LLVM_ON_UNIX,[1]) - AC_SUBST(LLVM_ON_WIN32,[0]) - ;; - Win32) - AC_DEFINE([LLVM_ON_WIN32],[1],[Define if this is Win32ish platform]) - AC_SUBST(LLVM_ON_UNIX,[0]) - AC_SUBST(LLVM_ON_WIN32,[1]) - ;; -esac - -dnl Determine what our target architecture is and configure accordingly. -dnl This will allow Makefiles to make a distinction between the hardware and -dnl the OS. -AC_CACHE_CHECK([target architecture],[llvm_cv_target_arch], -[case $target in - i?86-*) llvm_cv_target_arch="x86" ;; - amd64-* | x86_64-*) llvm_cv_target_arch="x86_64" ;; - sparc*-*) llvm_cv_target_arch="Sparc" ;; - powerpc*-*) llvm_cv_target_arch="PowerPC" ;; - arm*-*) llvm_cv_target_arch="ARM" ;; - aarch64*-*) llvm_cv_target_arch="AArch64" ;; - mips-* | mips64-*) llvm_cv_target_arch="Mips" ;; - mipsel-* | mips64el-*) llvm_cv_target_arch="Mips" ;; - xcore-*) llvm_cv_target_arch="XCore" ;; - msp430-*) llvm_cv_target_arch="MSP430" ;; - hexagon-*) llvm_cv_target_arch="Hexagon" ;; - nvptx-*) llvm_cv_target_arch="NVPTX" ;; - s390x-*) llvm_cv_target_arch="SystemZ" ;; - *) llvm_cv_target_arch="Unknown" ;; -esac]) - -if test "$llvm_cv_target_arch" = "Unknown" ; then - AC_MSG_WARN([Configuring LLVM for an unknown target archicture]) -fi - -# Determine the LLVM native architecture for the target -case "$llvm_cv_target_arch" in - x86) LLVM_NATIVE_ARCH="X86" ;; - x86_64) LLVM_NATIVE_ARCH="X86" ;; - *) LLVM_NATIVE_ARCH="$llvm_cv_target_arch" ;; -esac - -dnl Define a substitution, ARCH, for the target architecture -AC_SUBST(ARCH,$llvm_cv_target_arch) - -dnl Check for the endianness of the target -AC_C_BIGENDIAN(AC_SUBST([ENDIAN],[big]),AC_SUBST([ENDIAN],[little])) - -dnl Check for build platform executable suffix if we're crosscompiling -if test "$cross_compiling" = yes; then - AC_SUBST(LLVM_CROSS_COMPILING, [1]) - AC_BUILD_EXEEXT - ac_build_prefix=${build_alias}- - AC_CHECK_PROG(BUILD_CXX, ${ac_build_prefix}g++, ${ac_build_prefix}g++) - if test -z "$BUILD_CXX"; then - AC_CHECK_PROG(BUILD_CXX, g++, g++) - if test -z "$BUILD_CXX"; then - AC_CHECK_PROG(BUILD_CXX, c++, c++, , , /usr/ucb/c++) - fi - fi -else - AC_SUBST(LLVM_CROSS_COMPILING, [0]) -fi - -dnl Check to see if there's a .svn or .git directory indicating that this -dnl build is being done from a checkout. This sets up several defaults for -dnl the command line switches. When we build with a checkout directory, -dnl we get a debug with assertions turned on. Without, we assume a source -dnl release and we get an optimized build without assertions. -dnl See --enable-optimized and --enable-assertions below -if test -d ".svn" -o -d "${srcdir}/.svn" -o -d ".git" -o -d "${srcdir}/.git"; then - cvsbuild="yes" - optimize="no" - AC_SUBST(CVSBUILD,[[CVSBUILD=1]]) -else - cvsbuild="no" - optimize="yes" -fi - -dnl===-----------------------------------------------------------------------=== -dnl=== -dnl=== SECTION 3: Command line arguments for the configure script. -dnl=== -dnl===-----------------------------------------------------------------------=== - -dnl --enable-libcpp : check whether or not to use libc++ on the command line -AC_ARG_ENABLE(libcpp, - AS_HELP_STRING([--enable-libcpp], - [Use libc++ if available (default is NO)]),, - enableval=default) -case "$enableval" in - yes) AC_SUBST(ENABLE_LIBCPP,[1]) ;; - no) AC_SUBST(ENABLE_LIBCPP,[0]) ;; - default) AC_SUBST(ENABLE_LIBCPP,[0]);; - *) AC_MSG_ERROR([Invalid setting for --enable-libcpp. Use "yes" or "no"]) ;; -esac - -dnl --enable-cxx11 : check whether or not to use -std=c++11 on the command line -AC_ARG_ENABLE(cxx11, - AS_HELP_STRING([--enable-cxx11], - [Use c++11 if available (default is NO)]),, - enableval=default) -case "$enableval" in - yes) AC_SUBST(ENABLE_CXX11,[1]) ;; - no) AC_SUBST(ENABLE_CXX11,[0]) ;; - default) AC_SUBST(ENABLE_CXX11,[0]);; - *) AC_MSG_ERROR([Invalid setting for --enable-cxx11. Use "yes" or "no"]) ;; -esac - -dnl --enable-optimized : check whether they want to do an optimized build: -AC_ARG_ENABLE(optimized, AS_HELP_STRING( - --enable-optimized,[Compile with optimizations enabled (default is NO)]),,enableval=$optimize) -if test ${enableval} = "no" ; then - AC_SUBST(ENABLE_OPTIMIZED,[[]]) -else - AC_SUBST(ENABLE_OPTIMIZED,[[ENABLE_OPTIMIZED=1]]) -fi - -dnl --enable-profiling : check whether they want to do a profile build: -AC_ARG_ENABLE(profiling, AS_HELP_STRING( - --enable-profiling,[Compile with profiling enabled (default is NO)]),,enableval="no") -if test ${enableval} = "no" ; then - AC_SUBST(ENABLE_PROFILING,[[]]) -else - AC_SUBST(ENABLE_PROFILING,[[ENABLE_PROFILING=1]]) -fi - -dnl --enable-assertions : check whether they want to turn on assertions or not: -AC_ARG_ENABLE(assertions,AS_HELP_STRING( - --enable-assertions,[Compile with assertion checks enabled (default is YES)]),, enableval="yes") -if test ${enableval} = "yes" ; then - AC_SUBST(DISABLE_ASSERTIONS,[[]]) -else - AC_SUBST(DISABLE_ASSERTIONS,[[DISABLE_ASSERTIONS=1]]) -fi - -dnl --enable-werror : check whether we want Werror on by default -AC_ARG_ENABLE(werror,AS_HELP_STRING( - --enable-werror,[Compile with -Werror enabled (default is NO)]),, enableval="no") -case "$enableval" in - yes) AC_SUBST(ENABLE_WERROR,[1]) ;; - no) AC_SUBST(ENABLE_WERROR,[0]) ;; - default) AC_SUBST(ENABLE_WERROR,[0]);; - *) AC_MSG_ERROR([Invalid setting for --enable-werror. Use "yes" or "no"]) ;; -esac - -dnl --enable-expensive-checks : check whether they want to turn on expensive debug checks: -AC_ARG_ENABLE(expensive-checks,AS_HELP_STRING( - --enable-expensive-checks,[Compile with expensive debug checks enabled (default is NO)]),, enableval="no") -if test ${enableval} = "yes" ; then - AC_SUBST(ENABLE_EXPENSIVE_CHECKS,[[ENABLE_EXPENSIVE_CHECKS=1]]) - AC_SUBST(EXPENSIVE_CHECKS,[[yes]]) -else - AC_SUBST(ENABLE_EXPENSIVE_CHECKS,[[]]) - AC_SUBST(EXPENSIVE_CHECKS,[[no]]) -fi - -dnl --enable-debug-runtime : should runtime libraries have debug symbols? -AC_ARG_ENABLE(debug-runtime, - AS_HELP_STRING(--enable-debug-runtime,[Build runtime libs with debug symbols (default is NO)]),,enableval=no) -if test ${enableval} = "no" ; then - AC_SUBST(DEBUG_RUNTIME,[[]]) -else - AC_SUBST(DEBUG_RUNTIME,[[DEBUG_RUNTIME=1]]) -fi - -dnl --enable-debug-symbols : should even optimized compiler libraries -dnl have debug symbols? -AC_ARG_ENABLE(debug-symbols, - AS_HELP_STRING(--enable-debug-symbols,[Build compiler with debug symbols (default is NO if optimization is on and YES if it's off)]),,enableval=no) -if test ${enableval} = "no" ; then - AC_SUBST(DEBUG_SYMBOLS,[[]]) -else - AC_SUBST(DEBUG_SYMBOLS,[[DEBUG_SYMBOLS=1]]) -fi - -dnl --enable-jit: check whether they want to enable the jit -AC_ARG_ENABLE(jit, - AS_HELP_STRING(--enable-jit, - [Enable Just In Time Compiling (default is YES)]),, - enableval=default) -if test ${enableval} = "no" -then - AC_SUBST(JIT,[[]]) -else - case "$llvm_cv_target_arch" in - x86) AC_SUBST(TARGET_HAS_JIT,1) ;; - Sparc) AC_SUBST(TARGET_HAS_JIT,0) ;; - PowerPC) AC_SUBST(TARGET_HAS_JIT,1) ;; - x86_64) AC_SUBST(TARGET_HAS_JIT,1) ;; - ARM) AC_SUBST(TARGET_HAS_JIT,1) ;; - AArch64) AC_SUBST(TARGET_HAS_JIT,0) ;; - Mips) AC_SUBST(TARGET_HAS_JIT,1) ;; - XCore) AC_SUBST(TARGET_HAS_JIT,0) ;; - MSP430) AC_SUBST(TARGET_HAS_JIT,0) ;; - Hexagon) AC_SUBST(TARGET_HAS_JIT,0) ;; - NVPTX) AC_SUBST(TARGET_HAS_JIT,0) ;; - SystemZ) AC_SUBST(TARGET_HAS_JIT,1) ;; - *) AC_SUBST(TARGET_HAS_JIT,0) ;; - esac -fi - -dnl Allow enablement of building and installing docs -AC_ARG_ENABLE(docs, - AS_HELP_STRING([--enable-docs], - [Build documents (default is YES)]),, - enableval=default) -case "$enableval" in - yes) AC_SUBST(ENABLE_DOCS,[1]) ;; - no) AC_SUBST(ENABLE_DOCS,[0]) ;; - default) AC_SUBST(ENABLE_DOCS,[1]) ;; - *) AC_MSG_ERROR([Invalid setting for --enable-docs. Use "yes" or "no"]) ;; -esac - -dnl Allow enablement of doxygen generated documentation -AC_ARG_ENABLE(doxygen, - AS_HELP_STRING([--enable-doxygen], - [Build doxygen documentation (default is NO)]),, - enableval=default) -case "$enableval" in - yes) AC_SUBST(ENABLE_DOXYGEN,[1]) ;; - no) AC_SUBST(ENABLE_DOXYGEN,[0]) ;; - default) AC_SUBST(ENABLE_DOXYGEN,[0]) ;; - *) AC_MSG_ERROR([Invalid setting for --enable-doxygen. Use "yes" or "no"]) ;; -esac - -dnl Allow disablement of threads -AC_ARG_ENABLE(threads, - AS_HELP_STRING([--enable-threads], - [Use threads if available (default is YES)]),, - enableval=default) -case "$enableval" in - yes) AC_SUBST(ENABLE_THREADS,[1]) ;; - no) AC_SUBST(ENABLE_THREADS,[0]) ;; - default) AC_SUBST(ENABLE_THREADS,[1]) ;; - *) AC_MSG_ERROR([Invalid setting for --enable-threads. Use "yes" or "no"]) ;; -esac -AC_DEFINE_UNQUOTED([ENABLE_THREADS],$ENABLE_THREADS,[Define if threads enabled]) - -dnl Allow disablement of pthread.h -AC_ARG_ENABLE(pthreads, - AS_HELP_STRING([--enable-pthreads], - [Use pthreads if available (default is YES)]),, - enableval=default) -case "$enableval" in - yes) AC_SUBST(ENABLE_PTHREADS,[1]) ;; - no) AC_SUBST(ENABLE_PTHREADS,[0]) ;; - default) AC_SUBST(ENABLE_PTHREADS,[1]) ;; - *) AC_MSG_ERROR([Invalid setting for --enable-pthreads. Use "yes" or "no"]) ;; -esac - -dnl Allow disablement of zlib -AC_ARG_ENABLE(zlib, - AS_HELP_STRING([--enable-zlib], - [Use zlib for compression/decompression if - available (default is YES)]),, - enableval=default) -case "$enableval" in - yes) AC_SUBST(LLVM_ENABLE_ZLIB,[1]) ;; - no) AC_SUBST(LLVM_ENABLE_ZLIB,[0]) ;; - default) AC_SUBST(LLVM_ENABLE_ZLIB,[1]) ;; - *) AC_MSG_ERROR([Invalid setting for --enable-zlib. Use "yes" or "no"]) ;; -esac -AC_DEFINE_UNQUOTED([LLVM_ENABLE_ZLIB],$LLVM_ENABLE_ZLIB, - [Define if zlib is enabled]) - -dnl Allow building without position independent code -AC_ARG_ENABLE(pic, - AS_HELP_STRING([--enable-pic], - [Build LLVM with Position Independent Code (default is YES)]),, - enableval=default) -case "$enableval" in - yes) AC_SUBST(ENABLE_PIC,[1]) ;; - no) AC_SUBST(ENABLE_PIC,[0]) ;; - default) AC_SUBST(ENABLE_PIC,[1]) ;; - *) AC_MSG_ERROR([Invalid setting for --enable-pic. Use "yes" or "no"]) ;; -esac -AC_DEFINE_UNQUOTED([ENABLE_PIC],$ENABLE_PIC, - [Define if position independent code is enabled]) - -dnl Allow building a shared library and linking tools against it. -AC_ARG_ENABLE(shared, - AS_HELP_STRING([--enable-shared], - [Build a shared library and link tools against it (default is NO)]),, - enableval=default) -case "$enableval" in - yes) AC_SUBST(ENABLE_SHARED,[1]) ;; - no) AC_SUBST(ENABLE_SHARED,[0]) ;; - default) AC_SUBST(ENABLE_SHARED,[0]) ;; - *) AC_MSG_ERROR([Invalid setting for --enable-shared. Use "yes" or "no"]) ;; -esac - -dnl Allow libstdc++ is embedded in LLVM.dll. -AC_ARG_ENABLE(embed-stdcxx, - AS_HELP_STRING([--enable-embed-stdcxx], - [Build a shared library with embedded libstdc++ for Win32 DLL (default is YES)]),, - enableval=default) -case "$enableval" in - yes) AC_SUBST(ENABLE_EMBED_STDCXX,[1]) ;; - no) AC_SUBST(ENABLE_EMBED_STDCXX,[0]) ;; - default) AC_SUBST(ENABLE_EMBED_STDCXX,[1]) ;; - *) AC_MSG_ERROR([Invalid setting for --enable-embed-stdcxx. Use "yes" or "no"]) ;; -esac - -dnl Enable embedding timestamp information into build. -AC_ARG_ENABLE(timestamps, - AS_HELP_STRING([--enable-timestamps], - [Enable embedding timestamp information in build (default is YES)]),, - enableval=default) -case "$enableval" in - yes) AC_SUBST(ENABLE_TIMESTAMPS,[1]) ;; - no) AC_SUBST(ENABLE_TIMESTAMPS,[0]) ;; - default) AC_SUBST(ENABLE_TIMESTAMPS,[1]) ;; - *) AC_MSG_ERROR([Invalid setting for --enable-timestamps. Use "yes" or "no"]) ;; -esac -AC_DEFINE_UNQUOTED([ENABLE_TIMESTAMPS],$ENABLE_TIMESTAMPS, - [Define if timestamp information (e.g., __DATE___) is allowed]) - -dnl Allow specific targets to be specified for building (or not) -TARGETS_TO_BUILD="" -AC_ARG_ENABLE([targets],AS_HELP_STRING([--enable-targets], - [Build specific host targets: all or target1,target2,... Valid targets are: - host, x86, x86_64, sparc, powerpc, arm, aarch64, mips, hexagon, - xcore, msp430, nvptx, systemz, r600, and cpp (default=all)]),, - enableval=all) -if test "$enableval" = host-only ; then - enableval=host -fi -case "$enableval" in - all) TARGETS_TO_BUILD="X86 Sparc PowerPC AArch64 ARM Mips XCore MSP430 CppBackend NVPTX Hexagon SystemZ R600" ;; - *)for a_target in `echo $enableval|sed -e 's/,/ /g' ` ; do - case "$a_target" in - x86) TARGETS_TO_BUILD="X86 $TARGETS_TO_BUILD" ;; - x86_64) TARGETS_TO_BUILD="X86 $TARGETS_TO_BUILD" ;; - sparc) TARGETS_TO_BUILD="Sparc $TARGETS_TO_BUILD" ;; - powerpc) TARGETS_TO_BUILD="PowerPC $TARGETS_TO_BUILD" ;; - aarch64) TARGETS_TO_BUILD="AArch64 $TARGETS_TO_BUILD" ;; - arm) TARGETS_TO_BUILD="ARM $TARGETS_TO_BUILD" ;; - mips) TARGETS_TO_BUILD="Mips $TARGETS_TO_BUILD" ;; - mipsel) TARGETS_TO_BUILD="Mips $TARGETS_TO_BUILD" ;; - mips64) TARGETS_TO_BUILD="Mips $TARGETS_TO_BUILD" ;; - mips64el) TARGETS_TO_BUILD="Mips $TARGETS_TO_BUILD" ;; - xcore) TARGETS_TO_BUILD="XCore $TARGETS_TO_BUILD" ;; - msp430) TARGETS_TO_BUILD="MSP430 $TARGETS_TO_BUILD" ;; - cpp) TARGETS_TO_BUILD="CppBackend $TARGETS_TO_BUILD" ;; - hexagon) TARGETS_TO_BUILD="Hexagon $TARGETS_TO_BUILD" ;; - nvptx) TARGETS_TO_BUILD="NVPTX $TARGETS_TO_BUILD" ;; - systemz) TARGETS_TO_BUILD="SystemZ $TARGETS_TO_BUILD" ;; - r600) TARGETS_TO_BUILD="R600 $TARGETS_TO_BUILD" ;; - host) case "$llvm_cv_target_arch" in - x86) TARGETS_TO_BUILD="X86 $TARGETS_TO_BUILD" ;; - x86_64) TARGETS_TO_BUILD="X86 $TARGETS_TO_BUILD" ;; - Sparc) TARGETS_TO_BUILD="Sparc $TARGETS_TO_BUILD" ;; - PowerPC) TARGETS_TO_BUILD="PowerPC $TARGETS_TO_BUILD" ;; - AArch64) TARGETS_TO_BUILD="AArch64 $TARGETS_TO_BUILD" ;; - ARM) TARGETS_TO_BUILD="ARM $TARGETS_TO_BUILD" ;; - Mips) TARGETS_TO_BUILD="Mips $TARGETS_TO_BUILD" ;; - XCore) TARGETS_TO_BUILD="XCore $TARGETS_TO_BUILD" ;; - MSP430) TARGETS_TO_BUILD="MSP430 $TARGETS_TO_BUILD" ;; - Hexagon) TARGETS_TO_BUILD="Hexagon $TARGETS_TO_BUILD" ;; - NVPTX) TARGETS_TO_BUILD="NVPTX $TARGETS_TO_BUILD" ;; - SystemZ) TARGETS_TO_BUILD="SystemZ $TARGETS_TO_BUILD" ;; - *) AC_MSG_ERROR([Can not set target to build]) ;; - esac ;; - *) AC_MSG_ERROR([Unrecognized target $a_target]) ;; - esac - done - ;; -esac -AC_SUBST(TARGETS_TO_BUILD,$TARGETS_TO_BUILD) - -# Determine whether we are building LLVM support for the native architecture. -# If so, define LLVM_NATIVE_ARCH to that LLVM target. -for a_target in $TARGETS_TO_BUILD; do - if test "$a_target" = "$LLVM_NATIVE_ARCH"; then - AC_DEFINE_UNQUOTED(LLVM_NATIVE_ARCH, $LLVM_NATIVE_ARCH, - [LLVM architecture name for the native architecture, if available]) - LLVM_NATIVE_TARGET="LLVMInitialize${LLVM_NATIVE_ARCH}Target" - LLVM_NATIVE_TARGETINFO="LLVMInitialize${LLVM_NATIVE_ARCH}TargetInfo" - LLVM_NATIVE_TARGETMC="LLVMInitialize${LLVM_NATIVE_ARCH}TargetMC" - LLVM_NATIVE_ASMPRINTER="LLVMInitialize${LLVM_NATIVE_ARCH}AsmPrinter" - if test -f ${srcdir}/lib/Target/${LLVM_NATIVE_ARCH}/AsmParser/Makefile ; then - LLVM_NATIVE_ASMPARSER="LLVMInitialize${LLVM_NATIVE_ARCH}AsmParser" - fi - if test -f ${srcdir}/lib/Target/${LLVM_NATIVE_ARCH}/Disassembler/Makefile ; then - LLVM_NATIVE_DISASSEMBLER="LLVMInitialize${LLVM_NATIVE_ARCH}Disassembler" - fi - AC_DEFINE_UNQUOTED(LLVM_NATIVE_TARGET, $LLVM_NATIVE_TARGET, - [LLVM name for the native Target init function, if available]) - AC_DEFINE_UNQUOTED(LLVM_NATIVE_TARGETINFO, $LLVM_NATIVE_TARGETINFO, - [LLVM name for the native TargetInfo init function, if available]) - AC_DEFINE_UNQUOTED(LLVM_NATIVE_TARGETMC, $LLVM_NATIVE_TARGETMC, - [LLVM name for the native target MC init function, if available]) - AC_DEFINE_UNQUOTED(LLVM_NATIVE_ASMPRINTER, $LLVM_NATIVE_ASMPRINTER, - [LLVM name for the native AsmPrinter init function, if available]) - if test -f ${srcdir}/lib/Target/${LLVM_NATIVE_ARCH}/AsmParser/Makefile ; then - AC_DEFINE_UNQUOTED(LLVM_NATIVE_ASMPARSER, $LLVM_NATIVE_ASMPARSER, - [LLVM name for the native AsmParser init function, if available]) - fi - if test -f ${srcdir}/lib/Target/${LLVM_NATIVE_ARCH}/Disassembler/Makefile ; then - AC_DEFINE_UNQUOTED(LLVM_NATIVE_DISASSEMBLER, $LLVM_NATIVE_DISASSEMBLER, - [LLVM name for the native Disassembler init function, if available]) - fi - fi -done - -# Build the LLVM_TARGET and LLVM_... macros for Targets.def and the individual -# target feature def files. -LLVM_ENUM_TARGETS="" -LLVM_ENUM_ASM_PRINTERS="" -LLVM_ENUM_ASM_PARSERS="" -LLVM_ENUM_DISASSEMBLERS="" -for target_to_build in $TARGETS_TO_BUILD; do - LLVM_ENUM_TARGETS="LLVM_TARGET($target_to_build) $LLVM_ENUM_TARGETS" - if test -f ${srcdir}/lib/Target/${target_to_build}/*AsmPrinter.cpp ; then - LLVM_ENUM_ASM_PRINTERS="LLVM_ASM_PRINTER($target_to_build) $LLVM_ENUM_ASM_PRINTERS"; - fi - if test -f ${srcdir}/lib/Target/${target_to_build}/AsmParser/Makefile ; then - LLVM_ENUM_ASM_PARSERS="LLVM_ASM_PARSER($target_to_build) $LLVM_ENUM_ASM_PARSERS"; - fi - if test -f ${srcdir}/lib/Target/${target_to_build}/Disassembler/Makefile ; then - LLVM_ENUM_DISASSEMBLERS="LLVM_DISASSEMBLER($target_to_build) $LLVM_ENUM_DISASSEMBLERS"; - fi -done -AC_SUBST(LLVM_ENUM_TARGETS) -AC_SUBST(LLVM_ENUM_ASM_PRINTERS) -AC_SUBST(LLVM_ENUM_ASM_PARSERS) -AC_SUBST(LLVM_ENUM_DISASSEMBLERS) - -dnl Override the option to use for optimized builds. -AC_ARG_WITH(optimize-option, - AS_HELP_STRING([--with-optimize-option], - [Select the compiler options to use for optimized builds]),, - withval=default) -AC_MSG_CHECKING([optimization flags]) -case "$withval" in - default) - case "$llvm_cv_os_type" in - FreeBSD) optimize_option=-O2 ;; - MingW) optimize_option=-O2 ;; - *) optimize_option=-O3 ;; - esac ;; - *) optimize_option="$withval" ;; -esac -AC_SUBST(OPTIMIZE_OPTION,$optimize_option) -AC_MSG_RESULT([$optimize_option]) - -dnl Specify extra build options -AC_ARG_WITH(extra-options, - AS_HELP_STRING([--with-extra-options], - [Specify additional options to compile LLVM with]),, - withval=default) -case "$withval" in - default) EXTRA_OPTIONS= ;; - *) EXTRA_OPTIONS=$withval ;; -esac -AC_SUBST(EXTRA_OPTIONS,$EXTRA_OPTIONS) - -dnl Specify extra linker build options -AC_ARG_WITH(extra-ld-options, - AS_HELP_STRING([--with-extra-ld-options], - [Specify additional options to link LLVM with]),, - withval=default) -case "$withval" in - default) EXTRA_LD_OPTIONS= ;; - *) EXTRA_LD_OPTIONS=$withval ;; -esac -AC_SUBST(EXTRA_LD_OPTIONS,$EXTRA_LD_OPTIONS) - -dnl Allow specific bindings to be specified for building (or not) -AC_ARG_ENABLE([bindings],AS_HELP_STRING([--enable-bindings], - [Build specific language bindings: all,auto,none,{binding-name} (default=auto)]),, - enableval=default) -BINDINGS_TO_BUILD="" -case "$enableval" in - yes | default | auto) BINDINGS_TO_BUILD="auto" ;; - all ) BINDINGS_TO_BUILD="ocaml" ;; - none | no) BINDINGS_TO_BUILD="" ;; - *)for a_binding in `echo $enableval|sed -e 's/,/ /g' ` ; do - case "$a_binding" in - ocaml) BINDINGS_TO_BUILD="ocaml $BINDINGS_TO_BUILD" ;; - *) AC_MSG_ERROR([Unrecognized binding $a_binding]) ;; - esac - done - ;; -esac - -dnl Allow the ocaml libdir to be overridden. This could go in a configure -dnl script for bindings/ocaml/configure, except that its auto value depends on -dnl OCAMLC, which is found here to support tests. -AC_ARG_WITH([ocaml-libdir], - [AS_HELP_STRING([--with-ocaml-libdir], - [Specify install location for ocaml bindings (default is stdlib)])], - [], - [withval=auto]) -case "$withval" in - auto) with_ocaml_libdir="$withval" ;; - /* | [[A-Za-z]]:[[\\/]]*) with_ocaml_libdir="$withval" ;; - *) AC_MSG_ERROR([Invalid path for --with-ocaml-libdir. Provide full path]) ;; -esac - -AC_ARG_WITH(clang-resource-dir, - AS_HELP_STRING([--with-clang-resource-dir], - [Relative directory from the Clang binary for resource files]),, - withval="") -AC_DEFINE_UNQUOTED(CLANG_RESOURCE_DIR,"$withval", - [Relative directory for resource files]) - -AC_ARG_WITH(c-include-dirs, - AS_HELP_STRING([--with-c-include-dirs], - [Colon separated list of directories clang will search for headers]),, - withval="") -AC_DEFINE_UNQUOTED(C_INCLUDE_DIRS,"$withval", - [Directories clang will search for headers]) - -# Clang normally uses the system c++ headers and libraries. With this option, -# clang will use the ones provided by a gcc installation instead. This option should -# be passed the same value that was used with --prefix when configuring gcc. -AC_ARG_WITH(gcc-toolchain, - AS_HELP_STRING([--with-gcc-toolchain], - [Directory where gcc is installed.]),, - withval="") -AC_DEFINE_UNQUOTED(GCC_INSTALL_PREFIX,"$withval", - [Directory where gcc is installed.]) - -dnl Allow linking of LLVM with GPLv3 binutils code. -AC_ARG_WITH(binutils-include, - AS_HELP_STRING([--with-binutils-include], - [Specify path to binutils/include/ containing plugin-api.h file for gold plugin.]),, - withval=default) -case "$withval" in - default) WITH_BINUTILS_INCDIR=default ;; - /* | [[A-Za-z]]:[[\\/]]*) WITH_BINUTILS_INCDIR=$withval ;; - *) AC_MSG_ERROR([Invalid path for --with-binutils-include. Provide full path]) ;; -esac -if test "x$WITH_BINUTILS_INCDIR" != xdefault ; then - AC_SUBST(BINUTILS_INCDIR,$WITH_BINUTILS_INCDIR) - if test ! -f "$WITH_BINUTILS_INCDIR/plugin-api.h"; then - echo "$WITH_BINUTILS_INCDIR/plugin-api.h" - AC_MSG_ERROR([Invalid path to directory containing plugin-api.h.]); - fi -fi - -dnl Specify the URL where bug reports should be submitted. -AC_ARG_WITH(bug-report-url, - AS_HELP_STRING([--with-bug-report-url], - [Specify the URL where bug reports should be submitted (default=http://llvm.org/bugs/)]),, - withval="http://llvm.org/bugs/") -AC_DEFINE_UNQUOTED(BUG_REPORT_URL,"$withval", - [Bug report URL.]) - -dnl --enable-terminfo: check whether the user wants to control use of terminfo: -AC_ARG_ENABLE(terminfo,AS_HELP_STRING( - [--enable-terminfo], - [Query the terminfo database if available (default is YES)]), - [case "$enableval" in - yes) llvm_cv_enable_terminfo="yes" ;; - no) llvm_cv_enable_terminfo="no" ;; - *) AC_MSG_ERROR([Invalid setting for --enable-terminfo. Use "yes" or "no"]) ;; - esac], - llvm_cv_enable_terminfo="yes") - -dnl --enable-libffi : check whether the user wants to turn off libffi: -AC_ARG_ENABLE(libffi,AS_HELP_STRING( - --enable-libffi,[Check for the presence of libffi (default is NO)]), - [case "$enableval" in - yes) llvm_cv_enable_libffi="yes" ;; - no) llvm_cv_enable_libffi="no" ;; - *) AC_MSG_ERROR([Invalid setting for --enable-libffi. Use "yes" or "no"]) ;; - esac], - llvm_cv_enable_libffi=no) - -dnl===-----------------------------------------------------------------------=== -dnl=== -dnl=== SECTION 4: Check for programs we need and that they are the right version -dnl=== -dnl===-----------------------------------------------------------------------=== - -AC_PROG_NM -AC_SUBST(NM) - -dnl Check for the tools that the makefiles require -AC_CHECK_GNU_MAKE -AC_PROG_LN_S -AC_PATH_PROG(CMP, [cmp], [cmp]) -AC_PATH_PROG(CP, [cp], [cp]) -AC_PATH_PROG(DATE, [date], [date]) -AC_PATH_PROG(FIND, [find], [find]) -AC_PATH_PROG(GREP, [grep], [grep]) -AC_PATH_PROG(MKDIR,[mkdir],[mkdir]) -AC_PATH_PROG(MV, [mv], [mv]) -AC_PROG_RANLIB -AC_CHECK_TOOL(AR, ar, false) -AC_PATH_PROG(RM, [rm], [rm]) -AC_PATH_PROG(SED, [sed], [sed]) -AC_PATH_PROG(TAR, [tar], [gtar]) -AC_PATH_PROG(BINPWD,[pwd], [pwd]) - -dnl Looking for misc. graph plotting software -AC_PATH_PROG(GRAPHVIZ, [Graphviz], [echo Graphviz]) -if test "$GRAPHVIZ" != "echo Graphviz" ; then - AC_DEFINE([HAVE_GRAPHVIZ],[1],[Define if the Graphviz program is available]) - dnl If we're targeting for mingw we should emit windows paths, not msys - if test "$llvm_cv_os_type" = "MingW" ; then - GRAPHVIZ=`echo $GRAPHVIZ | sed 's/^\/\([[A-Za-z]]\)\//\1:\//' ` - fi - AC_DEFINE_UNQUOTED([LLVM_PATH_GRAPHVIZ],"$GRAPHVIZ${EXEEXT}", - [Define to path to Graphviz program if found or 'echo Graphviz' otherwise]) -fi -AC_PATH_PROG(DOT, [dot], [echo dot]) -if test "$DOT" != "echo dot" ; then - AC_DEFINE([HAVE_DOT],[1],[Define if the dot program is available]) - dnl If we're targeting for mingw we should emit windows paths, not msys - if test "$llvm_cv_os_type" = "MingW" ; then - DOT=`echo $DOT | sed 's/^\/\([[A-Za-z]]\)\//\1:\//' ` - fi - AC_DEFINE_UNQUOTED([LLVM_PATH_DOT],"$DOT${EXEEXT}", - [Define to path to dot program if found or 'echo dot' otherwise]) -fi -AC_PATH_PROG(FDP, [fdp], [echo fdp]) -if test "$FDP" != "echo fdp" ; then - AC_DEFINE([HAVE_FDP],[1],[Define if the neat program is available]) - dnl If we're targeting for mingw we should emit windows paths, not msys - if test "$llvm_cv_os_type" = "MingW" ; then - FDP=`echo $FDP | sed 's/^\/\([[A-Za-z]]\)\//\1:\//' ` - fi - AC_DEFINE_UNQUOTED([LLVM_PATH_FDP],"$FDP${EXEEXT}", - [Define to path to fdp program if found or 'echo fdp' otherwise]) -fi -AC_PATH_PROG(NEATO, [neato], [echo neato]) -if test "$NEATO" != "echo neato" ; then - AC_DEFINE([HAVE_NEATO],[1],[Define if the neat program is available]) - dnl If we're targeting for mingw we should emit windows paths, not msys - if test "$llvm_cv_os_type" = "MingW" ; then - NEATO=`echo $NEATO | sed 's/^\/\([[A-Za-z]]\)\//\1:\//' ` - fi - AC_DEFINE_UNQUOTED([LLVM_PATH_NEATO],"$NEATO${EXEEXT}", - [Define to path to neato program if found or 'echo neato' otherwise]) -fi -AC_PATH_PROG(TWOPI, [twopi], [echo twopi]) -if test "$TWOPI" != "echo twopi" ; then - AC_DEFINE([HAVE_TWOPI],[1],[Define if the neat program is available]) - dnl If we're targeting for mingw we should emit windows paths, not msys - if test "$llvm_cv_os_type" = "MingW" ; then - TWOPI=`echo $TWOPI | sed 's/^\/\([[A-Za-z]]\)\//\1:\//' ` - fi - AC_DEFINE_UNQUOTED([LLVM_PATH_TWOPI],"$TWOPI${EXEEXT}", - [Define to path to twopi program if found or 'echo twopi' otherwise]) -fi -AC_PATH_PROG(CIRCO, [circo], [echo circo]) -if test "$CIRCO" != "echo circo" ; then - AC_DEFINE([HAVE_CIRCO],[1],[Define if the neat program is available]) - dnl If we're targeting for mingw we should emit windows paths, not msys - if test "$llvm_cv_os_type" = "MingW" ; then - CIRCO=`echo $CIRCO | sed 's/^\/\([[A-Za-z]]\)\//\1:\//' ` - fi - AC_DEFINE_UNQUOTED([LLVM_PATH_CIRCO],"$CIRCO${EXEEXT}", - [Define to path to circo program if found or 'echo circo' otherwise]) -fi -AC_PATH_PROGS(GV, [gv gsview32], [echo gv]) -if test "$GV" != "echo gv" ; then - AC_DEFINE([HAVE_GV],[1],[Define if the gv program is available]) - dnl If we're targeting for mingw we should emit windows paths, not msys - if test "$llvm_cv_os_type" = "MingW" ; then - GV=`echo $GV | sed 's/^\/\([[A-Za-z]]\)\//\1:\//' ` - fi - AC_DEFINE_UNQUOTED([LLVM_PATH_GV],"$GV${EXEEXT}", - [Define to path to gv program if found or 'echo gv' otherwise]) -fi -AC_PATH_PROG(DOTTY, [dotty], [echo dotty]) -if test "$DOTTY" != "echo dotty" ; then - AC_DEFINE([HAVE_DOTTY],[1],[Define if the dotty program is available]) - dnl If we're targeting for mingw we should emit windows paths, not msys - if test "$llvm_cv_os_type" = "MingW" ; then - DOTTY=`echo $DOTTY | sed 's/^\/\([[A-Za-z]]\)\//\1:\//' ` - fi - AC_DEFINE_UNQUOTED([LLVM_PATH_DOTTY],"$DOTTY${EXEEXT}", - [Define to path to dotty program if found or 'echo dotty' otherwise]) -fi -AC_PATH_PROG(XDOT_PY, [xdot.py], [echo xdot.py]) -if test "$XDOT_PY" != "echo xdot.py" ; then - AC_DEFINE([HAVE_XDOT_PY],[1],[Define if the xdot.py program is available]) - dnl If we're targeting for mingw we should emit windows paths, not msys - if test "$llvm_cv_os_type" = "MingW" ; then - XDOT_PY=`echo $XDOT_PY | sed 's/^\/\([[A-Za-z]]\)\//\1:\//' ` - fi - AC_DEFINE_UNQUOTED([LLVM_PATH_XDOT_PY],"$XDOT_PY${EXEEXT}", - [Define to path to xdot.py program if found or 'echo xdot.py' otherwise]) -fi - -dnl Find the install program -AC_PROG_INSTALL -dnl Prepend src dir to install path dir if it's a relative path -dnl This is a hack for installs that take place in something other -dnl than the top level. -case "$INSTALL" in - [[\\/$]]* | ?:[[\\/]]* ) ;; - *) INSTALL="\\\$(TOPSRCDIR)/$INSTALL" ;; -esac - -dnl Checks for documentation and testing tools that we can do without. If these -dnl are not found then they are set to "true" which always succeeds but does -dnl nothing. This just lets the build output show that we could have done -dnl something if the tool was available. -AC_PATH_PROG(BZIP2, [bzip2]) -AC_PATH_PROG(CAT, [cat]) -AC_PATH_PROG(DOXYGEN, [doxygen]) -AC_PATH_PROG(GROFF, [groff]) -AC_PATH_PROG(GZIPBIN, [gzip]) -AC_PATH_PROG(POD2HTML, [pod2html]) -AC_PATH_PROG(POD2MAN, [pod2man]) -AC_PATH_PROG(PDFROFF, [pdfroff]) -AC_PATH_PROG(RUNTEST, [runtest]) -DJ_AC_PATH_TCLSH -AC_PATH_PROG(ZIP, [zip]) -AC_PATH_PROGS(OCAMLC, [ocamlc]) -AC_PATH_PROGS(OCAMLOPT, [ocamlopt]) -AC_PATH_PROGS(OCAMLDEP, [ocamldep]) -AC_PATH_PROGS(OCAMLDOC, [ocamldoc]) -AC_PATH_PROGS(GAS, [gas as]) - -dnl Get the version of the linker in use. -AC_LINK_GET_VERSION - -dnl Determine whether the linker supports the -R option. -AC_LINK_USE_R - -dnl Determine whether the compiler supports the -rdynamic option. -AC_LINK_EXPORT_DYNAMIC - -dnl Determine whether the linker supports the --version-script option. -AC_LINK_VERSION_SCRIPT - -dnl Check for libtool and the library that has dlopen function (which must come -dnl before the AC_PROG_LIBTOOL check in order to enable dlopening libraries with -dnl libtool). -AC_LIBTOOL_DLOPEN -AC_LIB_LTDL - -AC_MSG_CHECKING([tool compatibility]) - -dnl Ensure that compilation tools are GCC or a GNU compatible compiler such as -dnl ICC; we use GCC specific options in the makefiles so the compiler needs -dnl to support those options. -dnl "icc" emits gcc signatures -dnl "icc -no-gcc" emits no gcc signature BUT is still compatible -ICC=no -IXX=no -case $CC in - icc*|icpc*) - ICC=yes - IXX=yes - ;; - *) - ;; -esac - -if test "$GCC" != "yes" && test "$ICC" != "yes" -then - AC_MSG_ERROR([gcc|icc required but not found]) -fi - -dnl Ensure that compilation tools are compatible with GCC extensions -if test "$GXX" != "yes" && test "$IXX" != "yes" -then - AC_MSG_ERROR([g++|clang++|icc required but not found]) -fi - -dnl Verify that GCC is version 3.0 or higher -if test "$GCC" = "yes" -then - AC_COMPILE_IFELSE([[#if !defined(__GNUC__) || __GNUC__ < 3 -#error Unsupported GCC version -#endif -]], [], [AC_MSG_ERROR([gcc 3.x required, but you have a lower version])]) -fi - -dnl Check for GNU Make. We use its extensions, so don't build without it -if test -z "$llvm_cv_gnu_make_command" -then - AC_MSG_ERROR([GNU Make required but not found]) -fi - -dnl Tool compatibility is okay if we make it here. -AC_MSG_RESULT([ok]) - -dnl Check optional compiler flags. -AC_MSG_CHECKING([optional compiler flags]) -CXX_FLAG_CHECK(NO_VARIADIC_MACROS, [-Wno-variadic-macros]) -CXX_FLAG_CHECK(NO_MISSING_FIELD_INITIALIZERS, [-Wno-missing-field-initializers]) -CXX_FLAG_CHECK(COVERED_SWITCH_DEFAULT, [-Wcovered-switch-default]) -AC_MSG_RESULT([$NO_VARIADIC_MACROS $NO_MISSING_FIELD_INITIALIZERS $COVERED_SWITCH_DEFAULT]) - -dnl===-----------------------------------------------------------------------=== -dnl=== -dnl=== SECTION 5: Check for libraries -dnl=== -dnl===-----------------------------------------------------------------------=== - -AC_CHECK_LIB(m,sin) -if test "$llvm_cv_os_type" = "MingW" ; then - AC_CHECK_LIB(imagehlp, main) - AC_CHECK_LIB(psapi, main) - AC_CHECK_LIB(shell32, main) -fi - -dnl dlopen() is required for plugin support. -AC_SEARCH_LIBS(dlopen,dl,AC_DEFINE([HAVE_DLOPEN],[1], - [Define if dlopen() is available on this platform.]), - AC_MSG_WARN([dlopen() not found - disabling plugin support])) - -dnl Search for the clock_gettime() function. Note that we rely on the POSIX -dnl macros to detect whether clock_gettime is available, this just finds the -dnl right libraries to link with. -AC_SEARCH_LIBS(clock_gettime,rt) - -dnl The curses library is optional; used for querying terminal info -if test "$llvm_cv_enable_terminfo" = "yes" ; then - dnl We need the has_color functionality in curses for it to be useful. - AC_SEARCH_LIBS(setupterm,tinfo curses ncurses ncursesw, - AC_DEFINE([HAVE_TERMINFO],[1], - [Define if the setupterm() function is supported this platform.])) -fi - -dnl libffi is optional; used to call external functions from the interpreter -if test "$llvm_cv_enable_libffi" = "yes" ; then - AC_SEARCH_LIBS(ffi_call,ffi,AC_DEFINE([HAVE_FFI_CALL],[1], - [Define if libffi is available on this platform.]), - AC_MSG_ERROR([libffi not found - configure without --enable-libffi to compile without it])) -fi - -dnl mallinfo is optional; the code can compile (minus features) without it -AC_SEARCH_LIBS(mallinfo,malloc,AC_DEFINE([HAVE_MALLINFO],[1], - [Define if mallinfo() is available on this platform.])) - -dnl pthread locking functions are optional - but llvm will not be thread-safe -dnl without locks. -if test "$ENABLE_THREADS" -eq 1 && test "$ENABLE_PTHREADS" -eq 1 ; then - AC_CHECK_LIB(pthread, pthread_mutex_init) - AC_SEARCH_LIBS(pthread_mutex_lock,pthread, - AC_DEFINE([HAVE_PTHREAD_MUTEX_LOCK],[1], - [Have pthread_mutex_lock])) - AC_SEARCH_LIBS(pthread_rwlock_init,pthread, - AC_DEFINE([HAVE_PTHREAD_RWLOCK_INIT],[1], - [Have pthread_rwlock_init])) - AC_SEARCH_LIBS(pthread_getspecific,pthread, - AC_DEFINE([HAVE_PTHREAD_GETSPECIFIC],[1], - [Have pthread_getspecific])) -fi - -dnl zlib is optional; used for compression/uncompression -if test "$LLVM_ENABLE_ZLIB" -eq 1 ; then - AC_CHECK_LIB(z, compress2) -fi - -dnl Allow extra x86-disassembler library -AC_ARG_WITH(udis86, - AS_HELP_STRING([--with-udis86=], - [Use udis86 external x86 disassembler library]), - [ - AC_SUBST(USE_UDIS86, [1]) - case "$withval" in - /usr/lib|yes) ;; - *) LDFLAGS="$LDFLAGS -L${withval}" ;; - esac - AC_CHECK_LIB(udis86, ud_init, [], [ - echo "Error! You need to have libudis86 around." - exit -1 - ]) - ], - AC_SUBST(USE_UDIS86, [0])) -AC_DEFINE_UNQUOTED([USE_UDIS86],$USE_UDIS86, - [Define if use udis86 library]) - -dnl Allow OProfile support for JIT output. -AC_ARG_WITH(oprofile, - AS_HELP_STRING([--with-oprofile=], - [Tell OProfile >= 0.9.4 how to symbolize JIT output]), - [ - AC_SUBST(USE_OPROFILE, [1]) - case "$withval" in - /usr|yes) llvm_cv_oppath=/usr/lib/oprofile ;; - no) llvm_cv_oppath= - AC_SUBST(USE_OPROFILE, [0]) ;; - *) llvm_cv_oppath="${withval}/lib/oprofile" - CPPFLAGS="-I${withval}/include";; - esac - if test -n "$llvm_cv_oppath" ; then - LIBS="$LIBS -L${llvm_cv_oppath} -Wl,-rpath,${llvm_cv_oppath}" - dnl Work around http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=537744: - dnl libbfd is not included properly in libopagent in some Debian - dnl versions. If libbfd isn't found at all, we assume opagent works - dnl anyway. - AC_SEARCH_LIBS(bfd_init, bfd, [], []) - AC_SEARCH_LIBS(op_open_agent, opagent, [], [ - echo "Error! You need to have libopagent around." - exit -1 - ]) - AC_CHECK_HEADER([opagent.h], [], [ - echo "Error! You need to have opagent.h around." - exit -1 - ]) - fi - ], - [ - AC_SUBST(USE_OPROFILE, [0]) - ]) -AC_DEFINE_UNQUOTED([USE_OPROFILE],$USE_OPROFILE, - [Define if we have the oprofile JIT-support library]) - -dnl===-----------------------------------------------------------------------=== -dnl=== -dnl=== SECTION 6: Check for header files -dnl=== -dnl===-----------------------------------------------------------------------=== - -dnl First, use autoconf provided macros for specific headers that we need -dnl We don't check for ancient stuff or things that are guaranteed to be there -dnl by the C++ standard. We always use the versions of C headers. -dnl Generally we're looking for POSIX headers. -AC_HEADER_DIRENT -AC_HEADER_MMAP_ANONYMOUS -AC_HEADER_STAT -AC_HEADER_SYS_WAIT -AC_HEADER_TIME - -AC_CHECK_HEADERS([dlfcn.h execinfo.h fcntl.h inttypes.h limits.h link.h]) -AC_CHECK_HEADERS([malloc.h setjmp.h signal.h stdint.h termios.h unistd.h]) -AC_CHECK_HEADERS([utime.h windows.h]) -AC_CHECK_HEADERS([sys/mman.h sys/param.h sys/resource.h sys/time.h sys/uio.h]) -AC_CHECK_HEADERS([sys/types.h sys/ioctl.h malloc/malloc.h mach/mach.h]) -AC_CHECK_HEADERS([valgrind/valgrind.h]) -AC_CHECK_HEADERS([fenv.h]) -if test "$ENABLE_THREADS" -eq 1 && test "$ENABLE_PTHREADS" -eq 1 ; then - AC_CHECK_HEADERS(pthread.h, - AC_SUBST(HAVE_PTHREAD, 1), - AC_SUBST(HAVE_PTHREAD, 0)) -else - AC_SUBST(HAVE_PTHREAD, 0) -fi -if test "$LLVM_ENABLE_ZLIB" -eq 1 ; then - AC_CHECK_HEADERS(zlib.h, - AC_SUBST(HAVE_LIBZ, 1), - AC_SUBST(HAVE_LIBZ, 0)) -else - AC_SUBST(HAVE_LIBZ, 0) -fi - -dnl Try to find ffi.h. -if test "$llvm_cv_enable_libffi" = "yes" ; then - AC_CHECK_HEADERS([ffi.h ffi/ffi.h]) -fi - -dnl Try to find Darwin specific crash reporting libraries. -AC_CHECK_HEADERS([CrashReporterClient.h]) - -dnl Try to find Darwin specific crash reporting global. -AC_MSG_CHECKING([__crashreporter_info__]) -AC_LINK_IFELSE( - AC_LANG_SOURCE( - [[extern const char *__crashreporter_info__; - int main() { - __crashreporter_info__ = "test"; - return 0; - } - ]]), - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_CRASHREPORTER_INFO, 1, Can use __crashreporter_info__), - AC_MSG_RESULT(no) - AC_DEFINE(HAVE_CRASHREPORTER_INFO, 0, - Define if __crashreporter_info__ exists.)) - -dnl===-----------------------------------------------------------------------=== -dnl=== -dnl=== SECTION 7: Check for types and structures -dnl=== -dnl===-----------------------------------------------------------------------=== - -AC_HUGE_VAL_CHECK -AC_TYPE_PID_T -AC_TYPE_SIZE_T -AC_DEFINE_UNQUOTED([RETSIGTYPE],[void],[Define as the return type of signal handlers (`int' or `void').]) -AC_STRUCT_TM -AC_CHECK_TYPES([int64_t],,AC_MSG_ERROR([Type int64_t required but not found])) -AC_CHECK_TYPES([uint64_t],, - AC_CHECK_TYPES([u_int64_t],, - AC_MSG_ERROR([Type uint64_t or u_int64_t required but not found]))) - -dnl===-----------------------------------------------------------------------=== -dnl=== -dnl=== SECTION 8: Check for specific functions needed -dnl=== -dnl===-----------------------------------------------------------------------=== - -AC_CHECK_FUNCS([backtrace ceilf floorf roundf rintf nearbyintf getcwd ]) -AC_CHECK_FUNCS([powf fmodf strtof round ]) -AC_CHECK_FUNCS([getpagesize getrusage getrlimit setrlimit gettimeofday ]) -AC_CHECK_FUNCS([isatty mkdtemp mkstemp ]) -AC_CHECK_FUNCS([mktemp posix_spawn realpath sbrk setrlimit strdup ]) -AC_CHECK_FUNCS([strerror strerror_r setenv ]) -AC_CHECK_FUNCS([strtoll strtoq sysconf malloc_zone_statistics ]) -AC_CHECK_FUNCS([setjmp longjmp sigsetjmp siglongjmp writev]) -AC_C_PRINTF_A -AC_FUNC_RAND48 - -dnl Check the declaration "Secure API" on Windows environments. -AC_CHECK_DECLS([strerror_s]) - -dnl Check symbols in libgcc.a for JIT on Mingw. -if test "$llvm_cv_os_type" = "MingW" ; then - AC_CHECK_LIB(gcc,_alloca,AC_DEFINE([HAVE__ALLOCA],[1],[Have host's _alloca])) - AC_CHECK_LIB(gcc,__alloca,AC_DEFINE([HAVE___ALLOCA],[1],[Have host's __alloca])) - AC_CHECK_LIB(gcc,__chkstk,AC_DEFINE([HAVE___CHKSTK],[1],[Have host's __chkstk])) - AC_CHECK_LIB(gcc,___chkstk,AC_DEFINE([HAVE____CHKSTK],[1],[Have host's ___chkstk])) - - AC_CHECK_LIB(gcc,__ashldi3,AC_DEFINE([HAVE___ASHLDI3],[1],[Have host's __ashldi3])) - AC_CHECK_LIB(gcc,__ashrdi3,AC_DEFINE([HAVE___ASHRDI3],[1],[Have host's __ashrdi3])) - AC_CHECK_LIB(gcc,__divdi3,AC_DEFINE([HAVE___DIVDI3],[1],[Have host's __divdi3])) - AC_CHECK_LIB(gcc,__fixdfdi,AC_DEFINE([HAVE___FIXDFDI],[1],[Have host's __fixdfdi])) - AC_CHECK_LIB(gcc,__fixsfdi,AC_DEFINE([HAVE___FIXSFDI],[1],[Have host's __fixsfdi])) - AC_CHECK_LIB(gcc,__floatdidf,AC_DEFINE([HAVE___FLOATDIDF],[1],[Have host's __floatdidf])) - AC_CHECK_LIB(gcc,__lshrdi3,AC_DEFINE([HAVE___LSHRDI3],[1],[Have host's __lshrdi3])) - AC_CHECK_LIB(gcc,__moddi3,AC_DEFINE([HAVE___MODDI3],[1],[Have host's __moddi3])) - AC_CHECK_LIB(gcc,__udivdi3,AC_DEFINE([HAVE___UDIVDI3],[1],[Have host's __udivdi3])) - AC_CHECK_LIB(gcc,__umoddi3,AC_DEFINE([HAVE___UMODDI3],[1],[Have host's __umoddi3])) - - AC_CHECK_LIB(gcc,__main,AC_DEFINE([HAVE___MAIN],[1],[Have host's __main])) - AC_CHECK_LIB(gcc,__cmpdi2,AC_DEFINE([HAVE___CMPDI2],[1],[Have host's __cmpdi2])) -fi - -dnl Check Win32 API EnumerateLoadedModules. -if test "$llvm_cv_os_type" = "MingW" ; then - AC_MSG_CHECKING([whether EnumerateLoadedModules() accepts new decl]) - AC_COMPILE_IFELSE([[#include -#include -extern void foo(PENUMLOADED_MODULES_CALLBACK); -extern void foo(BOOL(CALLBACK*)(PCSTR,ULONG_PTR,ULONG,PVOID));]], -[ - AC_MSG_RESULT([yes]) - llvm_cv_win32_elmcb_pcstr="PCSTR" -], -[ - AC_MSG_RESULT([no]) - llvm_cv_win32_elmcb_pcstr="PSTR" -]) - AC_DEFINE_UNQUOTED([WIN32_ELMCB_PCSTR],$llvm_cv_win32_elmcb_pcstr,[Type of 1st arg on ELM Callback]) -fi - -dnl Check for variations in the Standard C++ library and STL. These macros are -dnl provided by LLVM in the autoconf/m4 directory. -AC_FUNC_ISNAN -AC_FUNC_ISINF - -dnl Check for mmap support.We also need to know if /dev/zero is required to -dnl be opened for allocating RWX memory. -dnl Make sure we aren't attempting to configure for an unknown system -if test "$llvm_cv_platform_type" = "Unix" ; then - AC_FUNC_MMAP - AC_FUNC_MMAP_FILE - AC_NEED_DEV_ZERO_FOR_MMAP - - if test "$ac_cv_func_mmap_fixed_mapped" = "no" - then - AC_MSG_WARN([mmap() of a fixed address required but not supported]) - fi - if test "$ac_cv_func_mmap_file" = "no" - then - AC_MSG_WARN([mmap() of files required but not found]) - fi -fi - -dnl atomic builtins are required for threading support. -AC_MSG_CHECKING(for GCC atomic builtins) -dnl Since we'll be using these atomic builtins in C++ files we should test -dnl the C++ compiler. -AC_LANG_PUSH([C++]) -AC_LINK_IFELSE( - AC_LANG_SOURCE( - [[int main() { - volatile unsigned long val = 1; - __sync_synchronize(); - __sync_val_compare_and_swap(&val, 1, 0); - __sync_add_and_fetch(&val, 1); - __sync_sub_and_fetch(&val, 1); - return 0; - } - ]]), - AC_LANG_POP([C++]) - AC_MSG_RESULT(yes) - AC_DEFINE(LLVM_HAS_ATOMICS, 1, Has gcc/MSVC atomic intrinsics), - AC_MSG_RESULT(no) - AC_DEFINE(LLVM_HAS_ATOMICS, 0, Has gcc/MSVC atomic intrinsics) - AC_MSG_WARN([LLVM will be built thread-unsafe because atomic builtins are missing])) - -dnl===-----------------------------------------------------------------------=== -dnl=== -dnl=== SECTION 9: Additional checks, variables, etc. -dnl=== -dnl===-----------------------------------------------------------------------=== - -dnl Handle 32-bit linux systems running a 64-bit kernel. -dnl This has to come after section 4 because it invokes the compiler. -if test "$llvm_cv_os_type" = "Linux" -a "$llvm_cv_target_arch" = "x86_64" ; then - AC_IS_LINUX_MIXED - if test "$llvm_cv_linux_mixed" = "yes"; then - llvm_cv_target_arch="x86" - ARCH="x86" - fi -fi - -dnl Check whether __dso_handle is present -AC_CHECK_FUNCS([__dso_handle]) - -dnl Propagate the shared library extension that the libltdl checks did to -dnl the Makefiles so we can use it there too -AC_SUBST(SHLIBEXT,$libltdl_cv_shlibext) - -dnl Propagate the run-time library path variable that the libltdl -dnl checks found to the Makefiles so we can use it there too -AC_SUBST(SHLIBPATH_VAR,$libltdl_cv_shlibpath_var) - -# Translate the various configuration directories and other basic -# information into substitutions that will end up in Makefile.config.in -# that these configured values can be used by the makefiles -if test "${prefix}" = "NONE" ; then - prefix="/usr/local" -fi -eval LLVM_PREFIX="${prefix}"; -eval LLVM_BINDIR="${prefix}/bin"; -eval LLVM_DATADIR="${prefix}/share/llvm"; -eval LLVM_DOCSDIR="${prefix}/share/doc/llvm"; -eval LLVM_ETCDIR="${prefix}/etc/llvm"; -eval LLVM_INCLUDEDIR="${prefix}/include"; -eval LLVM_INFODIR="${prefix}/info"; -eval LLVM_MANDIR="${prefix}/man"; -LLVM_CONFIGTIME=`date` -AC_SUBST(LLVM_PREFIX) -AC_SUBST(LLVM_BINDIR) -AC_SUBST(LLVM_DATADIR) -AC_SUBST(LLVM_DOCSDIR) -AC_SUBST(LLVM_ETCDIR) -AC_SUBST(LLVM_INCLUDEDIR) -AC_SUBST(LLVM_INFODIR) -AC_SUBST(LLVM_MANDIR) -AC_SUBST(LLVM_CONFIGTIME) - -# Place the various directores into the config.h file as #defines so that we -# can know about the installation paths within LLVM. -AC_DEFINE_UNQUOTED(LLVM_PREFIX,"$LLVM_PREFIX", - [Installation prefix directory]) -AC_DEFINE_UNQUOTED(LLVM_BINDIR, "$LLVM_BINDIR", - [Installation directory for binary executables]) -AC_DEFINE_UNQUOTED(LLVM_DATADIR, "$LLVM_DATADIR", - [Installation directory for data files]) -AC_DEFINE_UNQUOTED(LLVM_DOCSDIR, "$LLVM_DOCSDIR", - [Installation directory for documentation]) -AC_DEFINE_UNQUOTED(LLVM_ETCDIR, "$LLVM_ETCDIR", - [Installation directory for config files]) -AC_DEFINE_UNQUOTED(LLVM_INCLUDEDIR, "$LLVM_INCLUDEDIR", - [Installation directory for include files]) -AC_DEFINE_UNQUOTED(LLVM_INFODIR, "$LLVM_INFODIR", - [Installation directory for .info files]) -AC_DEFINE_UNQUOTED(LLVM_MANDIR, "$LLVM_MANDIR", - [Installation directory for man pages]) -AC_DEFINE_UNQUOTED(LLVM_CONFIGTIME, "$LLVM_CONFIGTIME", - [Time at which LLVM was configured]) -AC_DEFINE_UNQUOTED(LLVM_DEFAULT_TARGET_TRIPLE, "$target", - [Target triple LLVM will generate code for by default]) - -# Determine which bindings to build. -if test "$BINDINGS_TO_BUILD" = auto ; then - BINDINGS_TO_BUILD="" - if test "x$OCAMLC" != x -a "x$OCAMLDEP" != x ; then - BINDINGS_TO_BUILD="ocaml $BINDINGS_TO_BUILD" - fi -fi -AC_SUBST(BINDINGS_TO_BUILD,$BINDINGS_TO_BUILD) - -# This isn't really configurey, but it avoids having to repeat the list in -# other files. -AC_SUBST(ALL_BINDINGS,ocaml) - -# Do any work necessary to ensure that bindings have what they need. -binding_prereqs_failed=0 -for a_binding in $BINDINGS_TO_BUILD ; do - case "$a_binding" in - ocaml) - if test "x$OCAMLC" = x ; then - AC_MSG_WARN([--enable-bindings=ocaml specified, but ocamlc not found. Try configure OCAMLC=/path/to/ocamlc]) - binding_prereqs_failed=1 - fi - if test "x$OCAMLDEP" = x ; then - AC_MSG_WARN([--enable-bindings=ocaml specified, but ocamldep not found. Try configure OCAMLDEP=/path/to/ocamldep]) - binding_prereqs_failed=1 - fi - if test "x$OCAMLOPT" = x ; then - AC_MSG_WARN([--enable-bindings=ocaml specified, but ocamlopt not found. Try configure OCAMLOPT=/path/to/ocamlopt]) - dnl ocamlopt is optional! - fi - if test "x$with_ocaml_libdir" != xauto ; then - AC_SUBST(OCAML_LIBDIR,$with_ocaml_libdir) - else - ocaml_stdlib="`"$OCAMLC" -where`" - if test "$LLVM_PREFIX" '<' "$ocaml_stdlib" -a "$ocaml_stdlib" '<' "$LLVM_PREFIX~" - then - # ocaml stdlib is beneath our prefix; use stdlib - AC_SUBST(OCAML_LIBDIR,$ocaml_stdlib) - else - # ocaml stdlib is outside our prefix; use libdir/ocaml - AC_SUBST(OCAML_LIBDIR,${prefix}/lib/ocaml) - fi - fi - ;; - esac -done -if test "$binding_prereqs_failed" = 1 ; then - AC_MSG_ERROR([Prequisites for bindings not satisfied. Fix them or use configure --disable-bindings.]) -fi - -dnl Determine whether the compiler supports -fvisibility-inlines-hidden. -AC_CXX_USE_VISIBILITY_INLINES_HIDDEN - -dnl Determine linker rpath flag -if test "$llvm_cv_link_use_r" = "yes" ; then - RPATH="-Wl,-R" -else - RPATH="-Wl,-rpath" -fi -AC_SUBST(RPATH) - -dnl Determine linker rdynamic flag -if test "$llvm_cv_link_use_export_dynamic" = "yes" ; then - RDYNAMIC="-rdynamic" -else - RDYNAMIC="" -fi -AC_SUBST(RDYNAMIC) - -dnl===-----------------------------------------------------------------------=== -dnl=== -dnl=== SECTION 10: Specify the output files and generate it -dnl=== -dnl===-----------------------------------------------------------------------=== - -dnl ************************************************************************** -dnl End LLVM configure.ac Import -dnl ************************************************************************** - -dnl Configure a common Makefile -AC_CONFIG_FILES(Makefile.common) -AC_CONFIG_FILES(Makefile.llvm.config) - -dnl Configure project makefiles -dnl List every Makefile that exists within your source tree -AC_CONFIG_MAKEFILE(Makefile) -AC_CONFIG_MAKEFILE(lib/Makefile) -AC_CONFIG_MAKEFILE(lib/AssistDS/Makefile) -AC_CONFIG_MAKEFILE(lib/DSA/Makefile) -AC_CONFIG_MAKEFILE(lib/smack/Makefile) -AC_CONFIG_MAKEFILE(tools/Makefile) -AC_CONFIG_MAKEFILE(tools/smack/Makefile) - -dnl This must be last -AC_OUTPUT diff --git a/autoconf/install-sh b/autoconf/install-sh deleted file mode 100755 index dd97db7aa..000000000 --- a/autoconf/install-sh +++ /dev/null @@ -1,322 +0,0 @@ -#!/bin/sh -# install - install a program, script, or datafile - -scriptversion=2004-09-10.20 - -# This originates from X11R5 (mit/util/scripts/install.sh), which was -# later released in X11R6 (xc/config/util/install.sh) with the -# following copyright and license. -# -# Copyright (C) 1994 X Consortium -# -# 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 -# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- -# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -# Except as contained in this notice, the name of the X Consortium shall not -# be used in advertising or otherwise to promote the sale, use or other deal- -# ings in this Software without prior written authorization from the X Consor- -# tium. -# -# -# FSF changes to this file are in the public domain. -# -# Calling this script install-sh is preferred over install.sh, to prevent -# `make' implicit rules from creating a file called install from it -# when there is no Makefile. -# -# This script is compatible with the BSD install script, but was written -# from scratch. It can only install one file at a time, a restriction -# shared with many OS's install programs. - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit="${DOITPROG-}" - -# put in absolute paths if you don't have them in your path; or use env. vars. - -mvprog="${MVPROG-mv}" -cpprog="${CPPROG-cp}" -chmodprog="${CHMODPROG-chmod}" -chownprog="${CHOWNPROG-chown}" -chgrpprog="${CHGRPPROG-chgrp}" -stripprog="${STRIPPROG-strip}" -rmprog="${RMPROG-rm}" -mkdirprog="${MKDIRPROG-mkdir}" - -chmodcmd="$chmodprog 0755" -chowncmd= -chgrpcmd= -stripcmd= -rmcmd="$rmprog -f" -mvcmd="$mvprog" -src= -dst= -dir_arg= -dstarg= -no_target_directory= - -usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE - or: $0 [OPTION]... SRCFILES... DIRECTORY - or: $0 [OPTION]... -t DIRECTORY SRCFILES... - or: $0 [OPTION]... -d DIRECTORIES... - -In the 1st form, copy SRCFILE to DSTFILE. -In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. -In the 4th, create DIRECTORIES. - -Options: --c (ignored) --d create directories instead of installing files. --g GROUP $chgrpprog installed files to GROUP. --m MODE $chmodprog installed files to MODE. --o USER $chownprog installed files to USER. --s $stripprog installed files. --t DIRECTORY install into DIRECTORY. --T report an error if DSTFILE is a directory. ---help display this help and exit. ---version display version info and exit. - -Environment variables override the default commands: - CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG -" - -while test -n "$1"; do - case $1 in - -c) shift - continue;; - - -d) dir_arg=true - shift - continue;; - - -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; - - --help) echo "$usage"; exit 0;; - - -m) chmodcmd="$chmodprog $2" - shift - shift - continue;; - - -o) chowncmd="$chownprog $2" - shift - shift - continue;; - - -s) stripcmd=$stripprog - shift - continue;; - - -t) dstarg=$2 - shift - shift - continue;; - - -T) no_target_directory=true - shift - continue;; - - --version) echo "$0 $scriptversion"; exit 0;; - - *) # When -d is used, all remaining arguments are directories to create. - # When -t is used, the destination is already specified. - test -n "$dir_arg$dstarg" && break - # Otherwise, the last argument is the destination. Remove it from $@. - for arg - do - if test -n "$dstarg"; then - # $@ is not empty: it contains at least $arg. - set fnord "$@" "$dstarg" - shift # fnord - fi - shift # arg - dstarg=$arg - done - break;; - esac -done - -if test -z "$1"; then - if test -z "$dir_arg"; then - echo "$0: no input file specified." >&2 - exit 1 - fi - # It's OK to call `install-sh -d' without argument. - # This can happen when creating conditional directories. - exit 0 -fi - -for src -do - # Protect names starting with `-'. - case $src in - -*) src=./$src ;; - esac - - if test -n "$dir_arg"; then - dst=$src - src= - - if test -d "$dst"; then - mkdircmd=: - chmodcmd= - else - mkdircmd=$mkdirprog - fi - else - # Waiting for this to be detected by the "$cpprog $src $dsttmp" command - # might cause directories to be created, which would be especially bad - # if $src (and thus $dsttmp) contains '*'. - if test ! -f "$src" && test ! -d "$src"; then - echo "$0: $src does not exist." >&2 - exit 1 - fi - - if test -z "$dstarg"; then - echo "$0: no destination specified." >&2 - exit 1 - fi - - dst=$dstarg - # Protect names starting with `-'. - case $dst in - -*) dst=./$dst ;; - esac - - # If destination is a directory, append the input filename; won't work - # if double slashes aren't ignored. - if test -d "$dst"; then - if test -n "$no_target_directory"; then - echo "$0: $dstarg: Is a directory" >&2 - exit 1 - fi - dst=$dst/`basename "$src"` - fi - fi - - # This sed command emulates the dirname command. - dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` - - # Make sure that the destination directory exists. - - # Skip lots of stat calls in the usual case. - if test ! -d "$dstdir"; then - defaultIFS=' - ' - IFS="${IFS-$defaultIFS}" - - oIFS=$IFS - # Some sh's can't handle IFS=/ for some reason. - IFS='%' - set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` - IFS=$oIFS - - pathcomp= - - while test $# -ne 0 ; do - pathcomp=$pathcomp$1 - shift - if test ! -d "$pathcomp"; then - $mkdirprog "$pathcomp" - # mkdir can fail with a `File exist' error in case several - # install-sh are creating the directory concurrently. This - # is OK. - test -d "$pathcomp" || exit - fi - pathcomp=$pathcomp/ - done - fi - - if test -n "$dir_arg"; then - $doit $mkdircmd "$dst" \ - && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ - && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ - && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ - && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } - - else - dstfile=`basename "$dst"` - - # Make a couple of temp file names in the proper directory. - dsttmp=$dstdir/_inst.$$_ - rmtmp=$dstdir/_rm.$$_ - - # Trap to clean up those temp files at exit. - trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 - trap '(exit $?); exit' 1 2 13 15 - - # Copy the file name to the temp name. - $doit $cpprog "$src" "$dsttmp" && - - # and set any options; do chmod last to preserve setuid bits. - # - # If any of these fail, we abort the whole thing. If we want to - # ignore errors from any of these, just make sure not to ignore - # errors from the above "$doit $cpprog $src $dsttmp" command. - # - { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ - && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ - && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ - && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && - - # Now rename the file to the real destination. - { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \ - || { - # The rename failed, perhaps because mv can't rename something else - # to itself, or perhaps because mv is so ancient that it does not - # support -f. - - # Now remove or move aside any old file at destination location. - # We try this two ways since rm can't unlink itself on some - # systems and the destination file might be busy for other - # reasons. In this case, the final cleanup might fail but the new - # file should still install successfully. - { - if test -f "$dstdir/$dstfile"; then - $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ - || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ - || { - echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 - (exit 1); exit - } - else - : - fi - } && - - # Now rename the file to the real destination. - $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" - } - } - fi || { (exit 1); exit; } -done - -# The final little trick to "correctly" pass the exit status to the exit trap. -{ - (exit 0); exit -} - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" -# End: diff --git a/autoconf/ltmain.sh b/autoconf/ltmain.sh deleted file mode 100644 index 2455278a4..000000000 --- a/autoconf/ltmain.sh +++ /dev/null @@ -1,6863 +0,0 @@ -# ltmain.sh - Provide generalized library-building support services. -# NOTE: Changing this file will not affect anything until you rerun configure. -# -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005 -# Free Software Foundation, Inc. -# Originally by Gordon Matzigkeit , 1996 -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -basename="s,^.*/,,g" - -# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh -# is ksh but when the shell is invoked as "sh" and the current value of -# the _XPG environment variable is not equal to 1 (one), the special -# positional parameter $0, within a function call, is the name of the -# function. -progpath="$0" - -# The name of this program: -progname=`echo "$progpath" | $SED $basename` -modename="$progname" - -# Global variables: -EXIT_SUCCESS=0 -EXIT_FAILURE=1 - -PROGRAM=ltmain.sh -PACKAGE=libtool -VERSION=1.5.22 -TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)" - -# See if we are running on zsh, and set the options which allow our -# commands through without removal of \ escapes. -if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST -fi - -# Check that we have a working $echo. -if test "X$1" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift -elif test "X$1" = X--fallback-echo; then - # Avoid inline document here, it may be left over - : -elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then - # Yippee, $echo works! - : -else - # Restart under the correct shell, and then maybe $echo will work. - exec $SHELL "$progpath" --no-reexec ${1+"$@"} -fi - -if test "X$1" = X--fallback-echo; then - # used as fallback echo - shift - cat <&2 - $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 - exit $EXIT_FAILURE -fi - -# Global variables. -mode=$default_mode -nonopt= -prev= -prevopt= -run= -show="$echo" -show_help= -execute_dlfiles= -duplicate_deps=no -preserve_args= -lo2o="s/\\.lo\$/.${objext}/" -o2lo="s/\\.${objext}\$/.lo/" - -##################################### -# Shell function definitions: -# This seems to be the best place for them - -# func_mktempdir [string] -# Make a temporary directory that won't clash with other running -# libtool processes, and avoids race conditions if possible. If -# given, STRING is the basename for that directory. -func_mktempdir () -{ - my_template="${TMPDIR-/tmp}/${1-$progname}" - - if test "$run" = ":"; then - # Return a directory name, but don't create it in dry-run mode - my_tmpdir="${my_template}-$$" - else - - # If mktemp works, use that first and foremost - my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` - - if test ! -d "$my_tmpdir"; then - # Failing that, at least try and use $RANDOM to avoid a race - my_tmpdir="${my_template}-${RANDOM-0}$$" - - save_mktempdir_umask=`umask` - umask 0077 - $mkdir "$my_tmpdir" - umask $save_mktempdir_umask - fi - - # If we're not in dry-run mode, bomb out on failure - test -d "$my_tmpdir" || { - $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2 - exit $EXIT_FAILURE - } - fi - - $echo "X$my_tmpdir" | $Xsed -} - - -# func_win32_libid arg -# return the library type of file 'arg' -# -# Need a lot of goo to handle *both* DLLs and import libs -# Has to be a shell function in order to 'eat' the argument -# that is supplied when $file_magic_command is called. -func_win32_libid () -{ - win32_libid_type="unknown" - win32_fileres=`file -L $1 2>/dev/null` - case $win32_fileres in - *ar\ archive\ import\ library*) # definitely import - win32_libid_type="x86 archive import" - ;; - *ar\ archive*) # could be an import, or static - if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ - $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then - win32_nmres=`eval $NM -f posix -A $1 | \ - $SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'` - case $win32_nmres in - import*) win32_libid_type="x86 archive import";; - *) win32_libid_type="x86 archive static";; - esac - fi - ;; - *DLL*) - win32_libid_type="x86 DLL" - ;; - *executable*) # but shell scripts are "executable" too... - case $win32_fileres in - *MS\ Windows\ PE\ Intel*) - win32_libid_type="x86 DLL" - ;; - esac - ;; - esac - $echo $win32_libid_type -} - - -# func_infer_tag arg -# Infer tagged configuration to use if any are available and -# if one wasn't chosen via the "--tag" command line option. -# Only attempt this if the compiler in the base compile -# command doesn't match the default compiler. -# arg is usually of the form 'gcc ...' -func_infer_tag () -{ - if test -n "$available_tags" && test -z "$tagname"; then - CC_quoted= - for arg in $CC; do - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - CC_quoted="$CC_quoted $arg" - done - case $@ in - # Blanks in the command may have been stripped by the calling shell, - # but not from the CC environment variable when configure was run. - " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; - # Blanks at the start of $base_compile will cause this to fail - # if we don't check for them as well. - *) - for z in $available_tags; do - if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then - # Evaluate the configuration. - eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" - CC_quoted= - for arg in $CC; do - # Double-quote args containing other shell metacharacters. - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - CC_quoted="$CC_quoted $arg" - done - case "$@ " in - " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) - # The compiler in the base compile command matches - # the one in the tagged configuration. - # Assume this is the tagged configuration we want. - tagname=$z - break - ;; - esac - fi - done - # If $tagname still isn't set, then no tagged configuration - # was found and let the user know that the "--tag" command - # line option must be used. - if test -z "$tagname"; then - $echo "$modename: unable to infer tagged configuration" - $echo "$modename: specify a tag with \`--tag'" 1>&2 - exit $EXIT_FAILURE -# else -# $echo "$modename: using $tagname tagged configuration" - fi - ;; - esac - fi -} - - -# func_extract_an_archive dir oldlib -func_extract_an_archive () -{ - f_ex_an_ar_dir="$1"; shift - f_ex_an_ar_oldlib="$1" - - $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" - $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $? - if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then - : - else - $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2 - exit $EXIT_FAILURE - fi -} - -# func_extract_archives gentop oldlib ... -func_extract_archives () -{ - my_gentop="$1"; shift - my_oldlibs=${1+"$@"} - my_oldobjs="" - my_xlib="" - my_xabs="" - my_xdir="" - my_status="" - - $show "${rm}r $my_gentop" - $run ${rm}r "$my_gentop" - $show "$mkdir $my_gentop" - $run $mkdir "$my_gentop" - my_status=$? - if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then - exit $my_status - fi - - for my_xlib in $my_oldlibs; do - # Extract the objects. - case $my_xlib in - [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; - *) my_xabs=`pwd`"/$my_xlib" ;; - esac - my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` - my_xdir="$my_gentop/$my_xlib" - - $show "${rm}r $my_xdir" - $run ${rm}r "$my_xdir" - $show "$mkdir $my_xdir" - $run $mkdir "$my_xdir" - exit_status=$? - if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then - exit $exit_status - fi - case $host in - *-darwin*) - $show "Extracting $my_xabs" - # Do not bother doing anything if just a dry run - if test -z "$run"; then - darwin_orig_dir=`pwd` - cd $my_xdir || exit $? - darwin_archive=$my_xabs - darwin_curdir=`pwd` - darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'` - darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null` - if test -n "$darwin_arches"; then - darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` - darwin_arch= - $show "$darwin_base_archive has multiple architectures $darwin_arches" - for darwin_arch in $darwin_arches ; do - mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" - lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" - cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" - func_extract_an_archive "`pwd`" "${darwin_base_archive}" - cd "$darwin_curdir" - $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" - done # $darwin_arches - ## Okay now we have a bunch of thin objects, gotta fatten them up :) - darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP` - darwin_file= - darwin_files= - for darwin_file in $darwin_filelist; do - darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` - lipo -create -output "$darwin_file" $darwin_files - done # $darwin_filelist - ${rm}r unfat-$$ - cd "$darwin_orig_dir" - else - cd "$darwin_orig_dir" - func_extract_an_archive "$my_xdir" "$my_xabs" - fi # $darwin_arches - fi # $run - ;; - *) - func_extract_an_archive "$my_xdir" "$my_xabs" - ;; - esac - my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` - done - func_extract_archives_result="$my_oldobjs" -} -# End of Shell function definitions -##################################### - -# Darwin sucks -eval std_shrext=\"$shrext_cmds\" - -disable_libs=no - -# Parse our command line options once, thoroughly. -while test "$#" -gt 0 -do - arg="$1" - shift - - case $arg in - -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; - *) optarg= ;; - esac - - # If the previous option needs an argument, assign it. - if test -n "$prev"; then - case $prev in - execute_dlfiles) - execute_dlfiles="$execute_dlfiles $arg" - ;; - tag) - tagname="$arg" - preserve_args="${preserve_args}=$arg" - - # Check whether tagname contains only valid characters - case $tagname in - *[!-_A-Za-z0-9,/]*) - $echo "$progname: invalid tag name: $tagname" 1>&2 - exit $EXIT_FAILURE - ;; - esac - - case $tagname in - CC) - # Don't test for the "default" C tag, as we know, it's there, but - # not specially marked. - ;; - *) - if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then - taglist="$taglist $tagname" - # Evaluate the configuration. - eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`" - else - $echo "$progname: ignoring unknown tag $tagname" 1>&2 - fi - ;; - esac - ;; - *) - eval "$prev=\$arg" - ;; - esac - - prev= - prevopt= - continue - fi - - # Have we seen a non-optional argument yet? - case $arg in - --help) - show_help=yes - ;; - - --version) - $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" - $echo - $echo "Copyright (C) 2005 Free Software Foundation, Inc." - $echo "This is free software; see the source for copying conditions. There is NO" - $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - exit $? - ;; - - --config) - ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath - # Now print the configurations for the tags. - for tagname in $taglist; do - ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" - done - exit $? - ;; - - --debug) - $echo "$progname: enabling shell trace mode" - set -x - preserve_args="$preserve_args $arg" - ;; - - --dry-run | -n) - run=: - ;; - - --features) - $echo "host: $host" - if test "$build_libtool_libs" = yes; then - $echo "enable shared libraries" - else - $echo "disable shared libraries" - fi - if test "$build_old_libs" = yes; then - $echo "enable static libraries" - else - $echo "disable static libraries" - fi - exit $? - ;; - - --finish) mode="finish" ;; - - --mode) prevopt="--mode" prev=mode ;; - --mode=*) mode="$optarg" ;; - - --preserve-dup-deps) duplicate_deps="yes" ;; - - --quiet | --silent) - show=: - preserve_args="$preserve_args $arg" - ;; - - --tag) - prevopt="--tag" - prev=tag - preserve_args="$preserve_args --tag" - ;; - --tag=*) - set tag "$optarg" ${1+"$@"} - shift - prev=tag - preserve_args="$preserve_args --tag" - ;; - - -dlopen) - prevopt="-dlopen" - prev=execute_dlfiles - ;; - - -*) - $echo "$modename: unrecognized option \`$arg'" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - ;; - - *) - nonopt="$arg" - break - ;; - esac -done - -if test -n "$prevopt"; then - $echo "$modename: option \`$prevopt' requires an argument" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE -fi - -case $disable_libs in -no) - ;; -shared) - build_libtool_libs=no - build_old_libs=yes - ;; -static) - build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` - ;; -esac - -# If this variable is set in any of the actions, the command in it -# will be execed at the end. This prevents here-documents from being -# left over by shells. -exec_cmd= - -if test -z "$show_help"; then - - # Infer the operation mode. - if test -z "$mode"; then - $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 - $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2 - case $nonopt in - *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) - mode=link - for arg - do - case $arg in - -c) - mode=compile - break - ;; - esac - done - ;; - *db | *dbx | *strace | *truss) - mode=execute - ;; - *install*|cp|mv) - mode=install - ;; - *rm) - mode=uninstall - ;; - *) - # If we have no mode, but dlfiles were specified, then do execute mode. - test -n "$execute_dlfiles" && mode=execute - - # Just use the default operation mode. - if test -z "$mode"; then - if test -n "$nonopt"; then - $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 - else - $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 - fi - fi - ;; - esac - fi - - # Only execute mode is allowed to have -dlopen flags. - if test -n "$execute_dlfiles" && test "$mode" != execute; then - $echo "$modename: unrecognized option \`-dlopen'" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - # Change the help message to a mode-specific one. - generic_help="$help" - help="Try \`$modename --help --mode=$mode' for more information." - - # These modes are in order of execution frequency so that they run quickly. - case $mode in - # libtool compile mode - compile) - modename="$modename: compile" - # Get the compilation command and the source file. - base_compile= - srcfile="$nonopt" # always keep a non-empty value in "srcfile" - suppress_opt=yes - suppress_output= - arg_mode=normal - libobj= - later= - - for arg - do - case $arg_mode in - arg ) - # do not "continue". Instead, add this to base_compile - lastarg="$arg" - arg_mode=normal - ;; - - target ) - libobj="$arg" - arg_mode=normal - continue - ;; - - normal ) - # Accept any command-line options. - case $arg in - -o) - if test -n "$libobj" ; then - $echo "$modename: you cannot specify \`-o' more than once" 1>&2 - exit $EXIT_FAILURE - fi - arg_mode=target - continue - ;; - - -static | -prefer-pic | -prefer-non-pic) - later="$later $arg" - continue - ;; - - -no-suppress) - suppress_opt=no - continue - ;; - - -Xcompiler) - arg_mode=arg # the next one goes into the "base_compile" arg list - continue # The current "srcfile" will either be retained or - ;; # replaced later. I would guess that would be a bug. - - -Wc,*) - args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` - lastarg= - save_ifs="$IFS"; IFS=',' - for arg in $args; do - IFS="$save_ifs" - - # Double-quote args containing other shell metacharacters. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - lastarg="$lastarg $arg" - done - IFS="$save_ifs" - lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` - - # Add the arguments to base_compile. - base_compile="$base_compile $lastarg" - continue - ;; - - * ) - # Accept the current argument as the source file. - # The previous "srcfile" becomes the current argument. - # - lastarg="$srcfile" - srcfile="$arg" - ;; - esac # case $arg - ;; - esac # case $arg_mode - - # Aesthetically quote the previous argument. - lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` - - case $lastarg in - # Double-quote args containing other shell metacharacters. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, and some SunOS ksh mistreat backslash-escaping - # in scan sets (worked around with variable expansion), - # and furthermore cannot handle '|' '&' '(' ')' in scan sets - # at all, so we specify them separately. - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - lastarg="\"$lastarg\"" - ;; - esac - - base_compile="$base_compile $lastarg" - done # for arg - - case $arg_mode in - arg) - $echo "$modename: you must specify an argument for -Xcompile" - exit $EXIT_FAILURE - ;; - target) - $echo "$modename: you must specify a target with \`-o'" 1>&2 - exit $EXIT_FAILURE - ;; - *) - # Get the name of the library object. - [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` - ;; - esac - - # Recognize several different file suffixes. - # If the user specifies -o file.o, it is replaced with file.lo - xform='[cCFSifmso]' - case $libobj in - *.ada) xform=ada ;; - *.adb) xform=adb ;; - *.ads) xform=ads ;; - *.asm) xform=asm ;; - *.c++) xform=c++ ;; - *.cc) xform=cc ;; - *.ii) xform=ii ;; - *.class) xform=class ;; - *.cpp) xform=cpp ;; - *.cxx) xform=cxx ;; - *.f90) xform=f90 ;; - *.for) xform=for ;; - *.java) xform=java ;; - esac - - libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` - - case $libobj in - *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; - *) - $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 - exit $EXIT_FAILURE - ;; - esac - - func_infer_tag $base_compile - - for arg in $later; do - case $arg in - -static) - build_old_libs=yes - continue - ;; - - -prefer-pic) - pic_mode=yes - continue - ;; - - -prefer-non-pic) - pic_mode=no - continue - ;; - esac - done - - qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"` - case $qlibobj in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - qlibobj="\"$qlibobj\"" ;; - esac - test "X$libobj" != "X$qlibobj" \ - && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \ - && $echo "$modename: libobj name \`$libobj' may not contain shell special characters." - objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` - xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$obj"; then - xdir= - else - xdir=$xdir/ - fi - lobj=${xdir}$objdir/$objname - - if test -z "$base_compile"; then - $echo "$modename: you must specify a compilation command" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - # Delete any leftover library objects. - if test "$build_old_libs" = yes; then - removelist="$obj $lobj $libobj ${libobj}T" - else - removelist="$lobj $libobj ${libobj}T" - fi - - $run $rm $removelist - trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 - - # On Cygwin there's no "real" PIC flag so we must build both object types - case $host_os in - cygwin* | mingw* | pw32* | os2*) - pic_mode=default - ;; - esac - if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then - # non-PIC code in shared libraries is not supported - pic_mode=default - fi - - # Calculate the filename of the output object if compiler does - # not support -o with -c - if test "$compiler_c_o" = no; then - output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} - lockfile="$output_obj.lock" - removelist="$removelist $output_obj $lockfile" - trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 - else - output_obj= - need_locks=no - lockfile= - fi - - # Lock this critical section if it is needed - # We use this script file to make the link, it avoids creating a new file - if test "$need_locks" = yes; then - until $run ln "$progpath" "$lockfile" 2>/dev/null; do - $show "Waiting for $lockfile to be removed" - sleep 2 - done - elif test "$need_locks" = warn; then - if test -f "$lockfile"; then - $echo "\ -*** ERROR, $lockfile exists and contains: -`cat $lockfile 2>/dev/null` - -This indicates that another process is trying to use the same -temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you -repeat this compilation, it may succeed, by chance, but you had better -avoid parallel builds (make -j) in this platform, or get a better -compiler." - - $run $rm $removelist - exit $EXIT_FAILURE - fi - $echo "$srcfile" > "$lockfile" - fi - - if test -n "$fix_srcfile_path"; then - eval srcfile=\"$fix_srcfile_path\" - fi - qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"` - case $qsrcfile in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - qsrcfile="\"$qsrcfile\"" ;; - esac - - $run $rm "$libobj" "${libobj}T" - - # Create a libtool object file (analogous to a ".la" file), - # but don't create it if we're doing a dry run. - test -z "$run" && cat > ${libobj}T </dev/null`" != "X$srcfile"; then - $echo "\ -*** ERROR, $lockfile contains: -`cat $lockfile 2>/dev/null` - -but it should contain: -$srcfile - -This indicates that another process is trying to use the same -temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you -repeat this compilation, it may succeed, by chance, but you had better -avoid parallel builds (make -j) in this platform, or get a better -compiler." - - $run $rm $removelist - exit $EXIT_FAILURE - fi - - # Just move the object if needed, then go on to compile the next one - if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then - $show "$mv $output_obj $lobj" - if $run $mv $output_obj $lobj; then : - else - error=$? - $run $rm $removelist - exit $error - fi - fi - - # Append the name of the PIC object to the libtool object file. - test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null`" != "X$srcfile"; then - $echo "\ -*** ERROR, $lockfile contains: -`cat $lockfile 2>/dev/null` - -but it should contain: -$srcfile - -This indicates that another process is trying to use the same -temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you -repeat this compilation, it may succeed, by chance, but you had better -avoid parallel builds (make -j) in this platform, or get a better -compiler." - - $run $rm $removelist - exit $EXIT_FAILURE - fi - - # Just move the object if needed - if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then - $show "$mv $output_obj $obj" - if $run $mv $output_obj $obj; then : - else - error=$? - $run $rm $removelist - exit $error - fi - fi - - # Append the name of the non-PIC object the libtool object file. - # Only append if the libtool object file exists. - test -z "$run" && cat >> ${libobj}T <> ${libobj}T <&2 - fi - if test -n "$link_static_flag"; then - dlopen_self=$dlopen_self_static - fi - prefer_static_libs=yes - else - if test -z "$pic_flag" && test -n "$link_static_flag"; then - dlopen_self=$dlopen_self_static - fi - prefer_static_libs=built - fi - build_libtool_libs=no - build_old_libs=yes - break - ;; - esac - done - - # See if our shared archives depend on static archives. - test -n "$old_archive_from_new_cmds" && build_old_libs=yes - - # Go through the arguments, transforming them on the way. - while test "$#" -gt 0; do - arg="$1" - shift - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test - ;; - *) qarg=$arg ;; - esac - libtool_args="$libtool_args $qarg" - - # If the previous option needs an argument, assign it. - if test -n "$prev"; then - case $prev in - output) - compile_command="$compile_command @OUTPUT@" - finalize_command="$finalize_command @OUTPUT@" - ;; - esac - - case $prev in - dlfiles|dlprefiles) - if test "$preload" = no; then - # Add the symbol object into the linking commands. - compile_command="$compile_command @SYMFILE@" - finalize_command="$finalize_command @SYMFILE@" - preload=yes - fi - case $arg in - *.la | *.lo) ;; # We handle these cases below. - force) - if test "$dlself" = no; then - dlself=needless - export_dynamic=yes - fi - prev= - continue - ;; - self) - if test "$prev" = dlprefiles; then - dlself=yes - elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then - dlself=yes - else - dlself=needless - export_dynamic=yes - fi - prev= - continue - ;; - *) - if test "$prev" = dlfiles; then - dlfiles="$dlfiles $arg" - else - dlprefiles="$dlprefiles $arg" - fi - prev= - continue - ;; - esac - ;; - expsyms) - export_symbols="$arg" - if test ! -f "$arg"; then - $echo "$modename: symbol file \`$arg' does not exist" - exit $EXIT_FAILURE - fi - prev= - continue - ;; - expsyms_regex) - export_symbols_regex="$arg" - prev= - continue - ;; - inst_prefix) - inst_prefix_dir="$arg" - prev= - continue - ;; - precious_regex) - precious_files_regex="$arg" - prev= - continue - ;; - release) - release="-$arg" - prev= - continue - ;; - objectlist) - if test -f "$arg"; then - save_arg=$arg - moreargs= - for fil in `cat $save_arg` - do -# moreargs="$moreargs $fil" - arg=$fil - # A libtool-controlled object. - - # Check to see that this really is a libtool object. - if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - pic_object= - non_pic_object= - - # Read the .lo file - # If there is no directory component, then add one. - case $arg in - */* | *\\*) . $arg ;; - *) . ./$arg ;; - esac - - if test -z "$pic_object" || \ - test -z "$non_pic_object" || - test "$pic_object" = none && \ - test "$non_pic_object" = none; then - $echo "$modename: cannot find name of object for \`$arg'" 1>&2 - exit $EXIT_FAILURE - fi - - # Extract subdirectory from the argument. - xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$arg"; then - xdir= - else - xdir="$xdir/" - fi - - if test "$pic_object" != none; then - # Prepend the subdirectory the object is found in. - pic_object="$xdir$pic_object" - - if test "$prev" = dlfiles; then - if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then - dlfiles="$dlfiles $pic_object" - prev= - continue - else - # If libtool objects are unsupported, then we need to preload. - prev=dlprefiles - fi - fi - - # CHECK ME: I think I busted this. -Ossama - if test "$prev" = dlprefiles; then - # Preload the old-style object. - dlprefiles="$dlprefiles $pic_object" - prev= - fi - - # A PIC object. - libobjs="$libobjs $pic_object" - arg="$pic_object" - fi - - # Non-PIC object. - if test "$non_pic_object" != none; then - # Prepend the subdirectory the object is found in. - non_pic_object="$xdir$non_pic_object" - - # A standard non-PIC object - non_pic_objects="$non_pic_objects $non_pic_object" - if test -z "$pic_object" || test "$pic_object" = none ; then - arg="$non_pic_object" - fi - else - # If the PIC object exists, use it instead. - # $xdir was prepended to $pic_object above. - non_pic_object="$pic_object" - non_pic_objects="$non_pic_objects $non_pic_object" - fi - else - # Only an error if not doing a dry-run. - if test -z "$run"; then - $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 - exit $EXIT_FAILURE - else - # Dry-run case. - - # Extract subdirectory from the argument. - xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$arg"; then - xdir= - else - xdir="$xdir/" - fi - - pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` - non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` - libobjs="$libobjs $pic_object" - non_pic_objects="$non_pic_objects $non_pic_object" - fi - fi - done - else - $echo "$modename: link input file \`$save_arg' does not exist" - exit $EXIT_FAILURE - fi - arg=$save_arg - prev= - continue - ;; - rpath | xrpath) - # We need an absolute path. - case $arg in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - $echo "$modename: only absolute run-paths are allowed" 1>&2 - exit $EXIT_FAILURE - ;; - esac - if test "$prev" = rpath; then - case "$rpath " in - *" $arg "*) ;; - *) rpath="$rpath $arg" ;; - esac - else - case "$xrpath " in - *" $arg "*) ;; - *) xrpath="$xrpath $arg" ;; - esac - fi - prev= - continue - ;; - xcompiler) - compiler_flags="$compiler_flags $qarg" - prev= - compile_command="$compile_command $qarg" - finalize_command="$finalize_command $qarg" - continue - ;; - xlinker) - linker_flags="$linker_flags $qarg" - compiler_flags="$compiler_flags $wl$qarg" - prev= - compile_command="$compile_command $wl$qarg" - finalize_command="$finalize_command $wl$qarg" - continue - ;; - xcclinker) - linker_flags="$linker_flags $qarg" - compiler_flags="$compiler_flags $qarg" - prev= - compile_command="$compile_command $qarg" - finalize_command="$finalize_command $qarg" - continue - ;; - shrext) - shrext_cmds="$arg" - prev= - continue - ;; - darwin_framework|darwin_framework_skip) - test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg" - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" - prev= - continue - ;; - *) - eval "$prev=\"\$arg\"" - prev= - continue - ;; - esac - fi # test -n "$prev" - - prevarg="$arg" - - case $arg in - -all-static) - if test -n "$link_static_flag"; then - compile_command="$compile_command $link_static_flag" - finalize_command="$finalize_command $link_static_flag" - fi - continue - ;; - - -allow-undefined) - # FIXME: remove this flag sometime in the future. - $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 - continue - ;; - - -avoid-version) - avoid_version=yes - continue - ;; - - -dlopen) - prev=dlfiles - continue - ;; - - -dlpreopen) - prev=dlprefiles - continue - ;; - - -export-dynamic) - export_dynamic=yes - continue - ;; - - -export-symbols | -export-symbols-regex) - if test -n "$export_symbols" || test -n "$export_symbols_regex"; then - $echo "$modename: more than one -exported-symbols argument is not allowed" - exit $EXIT_FAILURE - fi - if test "X$arg" = "X-export-symbols"; then - prev=expsyms - else - prev=expsyms_regex - fi - continue - ;; - - -framework|-arch|-isysroot) - case " $CC " in - *" ${arg} ${1} "* | *" ${arg} ${1} "*) - prev=darwin_framework_skip ;; - *) compiler_flags="$compiler_flags $arg" - prev=darwin_framework ;; - esac - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" - continue - ;; - - -inst-prefix-dir) - prev=inst_prefix - continue - ;; - - # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* - # so, if we see these flags be careful not to treat them like -L - -L[A-Z][A-Z]*:*) - case $with_gcc/$host in - no/*-*-irix* | /*-*-irix*) - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" - ;; - esac - continue - ;; - - -L*) - dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` - # We need an absolute path. - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - absdir=`cd "$dir" && pwd` - if test -z "$absdir"; then - $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 - absdir="$dir" - notinst_path="$notinst_path $dir" - fi - dir="$absdir" - ;; - esac - case "$deplibs " in - *" -L$dir "*) ;; - *) - deplibs="$deplibs -L$dir" - lib_search_path="$lib_search_path $dir" - ;; - esac - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) - testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'` - case :$dllsearchpath: in - *":$dir:"*) ;; - *) dllsearchpath="$dllsearchpath:$dir";; - esac - case :$dllsearchpath: in - *":$testbindir:"*) ;; - *) dllsearchpath="$dllsearchpath:$testbindir";; - esac - ;; - esac - continue - ;; - - -l*) - if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*) - # These systems don't actually have a C or math library (as such) - continue - ;; - *-*-os2*) - # These systems don't actually have a C library (as such) - test "X$arg" = "X-lc" && continue - ;; - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) - # Do not include libc due to us having libc/libc_r. - test "X$arg" = "X-lc" && continue - ;; - *-*-rhapsody* | *-*-darwin1.[012]) - # Rhapsody C and math libraries are in the System framework - deplibs="$deplibs -framework System" - continue - ;; - *-*-sco3.2v5* | *-*-sco5v6*) - # Causes problems with __ctype - test "X$arg" = "X-lc" && continue - ;; - *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) - # Compiler inserts libc in the correct place for threads to work - test "X$arg" = "X-lc" && continue - ;; - esac - elif test "X$arg" = "X-lc_r"; then - case $host in - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) - # Do not include libc_r directly, use -pthread flag. - continue - ;; - esac - fi - deplibs="$deplibs $arg" - continue - ;; - - # Tru64 UNIX uses -model [arg] to determine the layout of C++ - # classes, name mangling, and exception handling. - -model) - compile_command="$compile_command $arg" - compiler_flags="$compiler_flags $arg" - finalize_command="$finalize_command $arg" - prev=xcompiler - continue - ;; - - -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) - compiler_flags="$compiler_flags $arg" - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" - continue - ;; - - -module) - module=yes - continue - ;; - - # -64, -mips[0-9] enable 64-bit mode on the SGI compiler - # -r[0-9][0-9]* specifies the processor on the SGI compiler - # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler - # +DA*, +DD* enable 64-bit mode on the HP compiler - # -q* pass through compiler args for the IBM compiler - # -m* pass through architecture-specific compiler args for GCC - # -m*, -t[45]*, -txscale* pass through architecture-specific - # compiler args for GCC - # -pg pass through profiling flag for GCC - # @file GCC response files - -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \ - -t[45]*|-txscale*|@*) - - # Unknown arguments in both finalize_command and compile_command need - # to be aesthetically quoted because they are evaled later. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" - compiler_flags="$compiler_flags $arg" - continue - ;; - - -shrext) - prev=shrext - continue - ;; - - -no-fast-install) - fast_install=no - continue - ;; - - -no-install) - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) - # The PATH hackery in wrapper scripts is required on Windows - # in order for the loader to find any dlls it needs. - $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 - $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 - fast_install=no - ;; - *) no_install=yes ;; - esac - continue - ;; - - -no-undefined) - allow_undefined=no - continue - ;; - - -objectlist) - prev=objectlist - continue - ;; - - -o) prev=output ;; - - -precious-files-regex) - prev=precious_regex - continue - ;; - - -release) - prev=release - continue - ;; - - -rpath) - prev=rpath - continue - ;; - - -R) - prev=xrpath - continue - ;; - - -R*) - dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` - # We need an absolute path. - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - $echo "$modename: only absolute run-paths are allowed" 1>&2 - exit $EXIT_FAILURE - ;; - esac - case "$xrpath " in - *" $dir "*) ;; - *) xrpath="$xrpath $dir" ;; - esac - continue - ;; - - -static) - # The effects of -static are defined in a previous loop. - # We used to do the same as -all-static on platforms that - # didn't have a PIC flag, but the assumption that the effects - # would be equivalent was wrong. It would break on at least - # Digital Unix and AIX. - continue - ;; - - -thread-safe) - thread_safe=yes - continue - ;; - - -version-info) - prev=vinfo - continue - ;; - -version-number) - prev=vinfo - vinfo_number=yes - continue - ;; - - -Wc,*) - args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` - arg= - save_ifs="$IFS"; IFS=',' - for flag in $args; do - IFS="$save_ifs" - case $flag in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - flag="\"$flag\"" - ;; - esac - arg="$arg $wl$flag" - compiler_flags="$compiler_flags $flag" - done - IFS="$save_ifs" - arg=`$echo "X$arg" | $Xsed -e "s/^ //"` - ;; - - -Wl,*) - args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` - arg= - save_ifs="$IFS"; IFS=',' - for flag in $args; do - IFS="$save_ifs" - case $flag in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - flag="\"$flag\"" - ;; - esac - arg="$arg $wl$flag" - compiler_flags="$compiler_flags $wl$flag" - linker_flags="$linker_flags $flag" - done - IFS="$save_ifs" - arg=`$echo "X$arg" | $Xsed -e "s/^ //"` - ;; - - -Xcompiler) - prev=xcompiler - continue - ;; - - -Xlinker) - prev=xlinker - continue - ;; - - -XCClinker) - prev=xcclinker - continue - ;; - - # Some other compiler flag. - -* | +*) - # Unknown arguments in both finalize_command and compile_command need - # to be aesthetically quoted because they are evaled later. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - ;; - - *.$objext) - # A standard object. - objs="$objs $arg" - ;; - - *.lo) - # A libtool-controlled object. - - # Check to see that this really is a libtool object. - if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - pic_object= - non_pic_object= - - # Read the .lo file - # If there is no directory component, then add one. - case $arg in - */* | *\\*) . $arg ;; - *) . ./$arg ;; - esac - - if test -z "$pic_object" || \ - test -z "$non_pic_object" || - test "$pic_object" = none && \ - test "$non_pic_object" = none; then - $echo "$modename: cannot find name of object for \`$arg'" 1>&2 - exit $EXIT_FAILURE - fi - - # Extract subdirectory from the argument. - xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$arg"; then - xdir= - else - xdir="$xdir/" - fi - - if test "$pic_object" != none; then - # Prepend the subdirectory the object is found in. - pic_object="$xdir$pic_object" - - if test "$prev" = dlfiles; then - if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then - dlfiles="$dlfiles $pic_object" - prev= - continue - else - # If libtool objects are unsupported, then we need to preload. - prev=dlprefiles - fi - fi - - # CHECK ME: I think I busted this. -Ossama - if test "$prev" = dlprefiles; then - # Preload the old-style object. - dlprefiles="$dlprefiles $pic_object" - prev= - fi - - # A PIC object. - libobjs="$libobjs $pic_object" - arg="$pic_object" - fi - - # Non-PIC object. - if test "$non_pic_object" != none; then - # Prepend the subdirectory the object is found in. - non_pic_object="$xdir$non_pic_object" - - # A standard non-PIC object - non_pic_objects="$non_pic_objects $non_pic_object" - if test -z "$pic_object" || test "$pic_object" = none ; then - arg="$non_pic_object" - fi - else - # If the PIC object exists, use it instead. - # $xdir was prepended to $pic_object above. - non_pic_object="$pic_object" - non_pic_objects="$non_pic_objects $non_pic_object" - fi - else - # Only an error if not doing a dry-run. - if test -z "$run"; then - $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 - exit $EXIT_FAILURE - else - # Dry-run case. - - # Extract subdirectory from the argument. - xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$arg"; then - xdir= - else - xdir="$xdir/" - fi - - pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` - non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` - libobjs="$libobjs $pic_object" - non_pic_objects="$non_pic_objects $non_pic_object" - fi - fi - ;; - - *.$libext) - # An archive. - deplibs="$deplibs $arg" - old_deplibs="$old_deplibs $arg" - continue - ;; - - *.la) - # A libtool-controlled library. - - if test "$prev" = dlfiles; then - # This library was specified with -dlopen. - dlfiles="$dlfiles $arg" - prev= - elif test "$prev" = dlprefiles; then - # The library was specified with -dlpreopen. - dlprefiles="$dlprefiles $arg" - prev= - else - deplibs="$deplibs $arg" - fi - continue - ;; - - # Some other compiler argument. - *) - # Unknown arguments in both finalize_command and compile_command need - # to be aesthetically quoted because they are evaled later. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - ;; - esac # arg - - # Now actually substitute the argument into the commands. - if test -n "$arg"; then - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" - fi - done # argument parsing loop - - if test -n "$prev"; then - $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then - eval arg=\"$export_dynamic_flag_spec\" - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" - fi - - oldlibs= - # calculate the name of the file, without its directory - outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` - libobjs_save="$libobjs" - - if test -n "$shlibpath_var"; then - # get the directories listed in $shlibpath_var - eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` - else - shlib_search_path= - fi - eval sys_lib_search_path=\"$sys_lib_search_path_spec\" - eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" - - output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` - if test "X$output_objdir" = "X$output"; then - output_objdir="$objdir" - else - output_objdir="$output_objdir/$objdir" - fi - # Create the object directory. - if test ! -d "$output_objdir"; then - $show "$mkdir $output_objdir" - $run $mkdir $output_objdir - exit_status=$? - if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then - exit $exit_status - fi - fi - - # Determine the type of output - case $output in - "") - $echo "$modename: you must specify an output file" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - ;; - *.$libext) linkmode=oldlib ;; - *.lo | *.$objext) linkmode=obj ;; - *.la) linkmode=lib ;; - *) linkmode=prog ;; # Anything else should be a program. - esac - - case $host in - *cygwin* | *mingw* | *pw32*) - # don't eliminate duplications in $postdeps and $predeps - duplicate_compiler_generated_deps=yes - ;; - *) - duplicate_compiler_generated_deps=$duplicate_deps - ;; - esac - specialdeplibs= - - libs= - # Find all interdependent deplibs by searching for libraries - # that are linked more than once (e.g. -la -lb -la) - for deplib in $deplibs; do - if test "X$duplicate_deps" = "Xyes" ; then - case "$libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; - esac - fi - libs="$libs $deplib" - done - - if test "$linkmode" = lib; then - libs="$predeps $libs $compiler_lib_search_path $postdeps" - - # Compute libraries that are listed more than once in $predeps - # $postdeps and mark them as special (i.e., whose duplicates are - # not to be eliminated). - pre_post_deps= - if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then - for pre_post_dep in $predeps $postdeps; do - case "$pre_post_deps " in - *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; - esac - pre_post_deps="$pre_post_deps $pre_post_dep" - done - fi - pre_post_deps= - fi - - deplibs= - newdependency_libs= - newlib_search_path= - need_relink=no # whether we're linking any uninstalled libtool libraries - notinst_deplibs= # not-installed libtool libraries - case $linkmode in - lib) - passes="conv link" - for file in $dlfiles $dlprefiles; do - case $file in - *.la) ;; - *) - $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 - exit $EXIT_FAILURE - ;; - esac - done - ;; - prog) - compile_deplibs= - finalize_deplibs= - alldeplibs=no - newdlfiles= - newdlprefiles= - passes="conv scan dlopen dlpreopen link" - ;; - *) passes="conv" - ;; - esac - for pass in $passes; do - if test "$linkmode,$pass" = "lib,link" || - test "$linkmode,$pass" = "prog,scan"; then - libs="$deplibs" - deplibs= - fi - if test "$linkmode" = prog; then - case $pass in - dlopen) libs="$dlfiles" ;; - dlpreopen) libs="$dlprefiles" ;; - link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; - esac - fi - if test "$pass" = dlopen; then - # Collect dlpreopened libraries - save_deplibs="$deplibs" - deplibs= - fi - for deplib in $libs; do - lib= - found=no - case $deplib in - -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - compiler_flags="$compiler_flags $deplib" - fi - continue - ;; - -l*) - if test "$linkmode" != lib && test "$linkmode" != prog; then - $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 - continue - fi - name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` - for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do - for search_ext in .la $std_shrext .so .a; do - # Search the libtool library - lib="$searchdir/lib${name}${search_ext}" - if test -f "$lib"; then - if test "$search_ext" = ".la"; then - found=yes - else - found=no - fi - break 2 - fi - done - done - if test "$found" != yes; then - # deplib doesn't seem to be a libtool library - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - deplibs="$deplib $deplibs" - test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" - fi - continue - else # deplib is a libtool library - # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, - # We need to do some special things here, and not later. - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - case " $predeps $postdeps " in - *" $deplib "*) - if (${SED} -e '2q' $lib | - grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - library_names= - old_library= - case $lib in - */* | *\\*) . $lib ;; - *) . ./$lib ;; - esac - for l in $old_library $library_names; do - ll="$l" - done - if test "X$ll" = "X$old_library" ; then # only static version available - found=no - ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` - test "X$ladir" = "X$lib" && ladir="." - lib=$ladir/$old_library - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - deplibs="$deplib $deplibs" - test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" - fi - continue - fi - fi - ;; - *) ;; - esac - fi - fi - ;; # -l - -L*) - case $linkmode in - lib) - deplibs="$deplib $deplibs" - test "$pass" = conv && continue - newdependency_libs="$deplib $newdependency_libs" - newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` - ;; - prog) - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - continue - fi - if test "$pass" = scan; then - deplibs="$deplib $deplibs" - else - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - fi - newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` - ;; - *) - $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 - ;; - esac # linkmode - continue - ;; # -L - -R*) - if test "$pass" = link; then - dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` - # Make sure the xrpath contains only unique directories. - case "$xrpath " in - *" $dir "*) ;; - *) xrpath="$xrpath $dir" ;; - esac - fi - deplibs="$deplib $deplibs" - continue - ;; - *.la) lib="$deplib" ;; - *.$libext) - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - continue - fi - case $linkmode in - lib) - valid_a_lib=no - case $deplibs_check_method in - match_pattern*) - set dummy $deplibs_check_method - match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` - if eval $echo \"$deplib\" 2>/dev/null \ - | $SED 10q \ - | $EGREP "$match_pattern_regex" > /dev/null; then - valid_a_lib=yes - fi - ;; - pass_all) - valid_a_lib=yes - ;; - esac - if test "$valid_a_lib" != yes; then - $echo - $echo "*** Warning: Trying to link with static lib archive $deplib." - $echo "*** I have the capability to make that library automatically link in when" - $echo "*** you link to this library. But I can only do this if you have a" - $echo "*** shared version of the library, which you do not appear to have" - $echo "*** because the file extensions .$libext of this argument makes me believe" - $echo "*** that it is just a static archive that I should not used here." - else - $echo - $echo "*** Warning: Linking the shared library $output against the" - $echo "*** static library $deplib is not portable!" - deplibs="$deplib $deplibs" - fi - continue - ;; - prog) - if test "$pass" != link; then - deplibs="$deplib $deplibs" - else - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - fi - continue - ;; - esac # linkmode - ;; # *.$libext - *.lo | *.$objext) - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - elif test "$linkmode" = prog; then - if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then - # If there is no dlopen support or we're linking statically, - # we need to preload. - newdlprefiles="$newdlprefiles $deplib" - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - newdlfiles="$newdlfiles $deplib" - fi - fi - continue - ;; - %DEPLIBS%) - alldeplibs=yes - continue - ;; - esac # case $deplib - if test "$found" = yes || test -f "$lib"; then : - else - $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2 - exit $EXIT_FAILURE - fi - - # Check to see that this really is a libtool archive. - if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : - else - $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - exit $EXIT_FAILURE - fi - - ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` - test "X$ladir" = "X$lib" && ladir="." - - dlname= - dlopen= - dlpreopen= - libdir= - library_names= - old_library= - # If the library was installed with an old release of libtool, - # it will not redefine variables installed, or shouldnotlink - installed=yes - shouldnotlink=no - avoidtemprpath= - - - # Read the .la file - case $lib in - */* | *\\*) . $lib ;; - *) . ./$lib ;; - esac - - if test "$linkmode,$pass" = "lib,link" || - test "$linkmode,$pass" = "prog,scan" || - { test "$linkmode" != prog && test "$linkmode" != lib; }; then - test -n "$dlopen" && dlfiles="$dlfiles $dlopen" - test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" - fi - - if test "$pass" = conv; then - # Only check for convenience libraries - deplibs="$lib $deplibs" - if test -z "$libdir"; then - if test -z "$old_library"; then - $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 - exit $EXIT_FAILURE - fi - # It is a libtool convenience library, so add in its objects. - convenience="$convenience $ladir/$objdir/$old_library" - old_convenience="$old_convenience $ladir/$objdir/$old_library" - tmp_libs= - for deplib in $dependency_libs; do - deplibs="$deplib $deplibs" - if test "X$duplicate_deps" = "Xyes" ; then - case "$tmp_libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; - esac - fi - tmp_libs="$tmp_libs $deplib" - done - elif test "$linkmode" != prog && test "$linkmode" != lib; then - $echo "$modename: \`$lib' is not a convenience library" 1>&2 - exit $EXIT_FAILURE - fi - continue - fi # $pass = conv - - - # Get the name of the library we link against. - linklib= - for l in $old_library $library_names; do - linklib="$l" - done - if test -z "$linklib"; then - $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 - exit $EXIT_FAILURE - fi - - # This library was specified with -dlopen. - if test "$pass" = dlopen; then - if test -z "$libdir"; then - $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 - exit $EXIT_FAILURE - fi - if test -z "$dlname" || - test "$dlopen_support" != yes || - test "$build_libtool_libs" = no; then - # If there is no dlname, no dlopen support or we're linking - # statically, we need to preload. We also need to preload any - # dependent libraries so libltdl's deplib preloader doesn't - # bomb out in the load deplibs phase. - dlprefiles="$dlprefiles $lib $dependency_libs" - else - newdlfiles="$newdlfiles $lib" - fi - continue - fi # $pass = dlopen - - # We need an absolute path. - case $ladir in - [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; - *) - abs_ladir=`cd "$ladir" && pwd` - if test -z "$abs_ladir"; then - $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 - $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 - abs_ladir="$ladir" - fi - ;; - esac - laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` - - # Find the relevant object directory and library name. - if test "X$installed" = Xyes; then - if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then - $echo "$modename: warning: library \`$lib' was moved." 1>&2 - dir="$ladir" - absdir="$abs_ladir" - libdir="$abs_ladir" - else - dir="$libdir" - absdir="$libdir" - fi - test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes - else - if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then - dir="$ladir" - absdir="$abs_ladir" - # Remove this search path later - notinst_path="$notinst_path $abs_ladir" - else - dir="$ladir/$objdir" - absdir="$abs_ladir/$objdir" - # Remove this search path later - notinst_path="$notinst_path $abs_ladir" - fi - fi # $installed = yes - name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` - - # This library was specified with -dlpreopen. - if test "$pass" = dlpreopen; then - if test -z "$libdir"; then - $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 - exit $EXIT_FAILURE - fi - # Prefer using a static library (so that no silly _DYNAMIC symbols - # are required to link). - if test -n "$old_library"; then - newdlprefiles="$newdlprefiles $dir/$old_library" - # Otherwise, use the dlname, so that lt_dlopen finds it. - elif test -n "$dlname"; then - newdlprefiles="$newdlprefiles $dir/$dlname" - else - newdlprefiles="$newdlprefiles $dir/$linklib" - fi - fi # $pass = dlpreopen - - if test -z "$libdir"; then - # Link the convenience library - if test "$linkmode" = lib; then - deplibs="$dir/$old_library $deplibs" - elif test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$dir/$old_library $compile_deplibs" - finalize_deplibs="$dir/$old_library $finalize_deplibs" - else - deplibs="$lib $deplibs" # used for prog,scan pass - fi - continue - fi - - - if test "$linkmode" = prog && test "$pass" != link; then - newlib_search_path="$newlib_search_path $ladir" - deplibs="$lib $deplibs" - - linkalldeplibs=no - if test "$link_all_deplibs" != no || test -z "$library_names" || - test "$build_libtool_libs" = no; then - linkalldeplibs=yes - fi - - tmp_libs= - for deplib in $dependency_libs; do - case $deplib in - -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test - esac - # Need to link against all dependency_libs? - if test "$linkalldeplibs" = yes; then - deplibs="$deplib $deplibs" - else - # Need to hardcode shared library paths - # or/and link against static libraries - newdependency_libs="$deplib $newdependency_libs" - fi - if test "X$duplicate_deps" = "Xyes" ; then - case "$tmp_libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; - esac - fi - tmp_libs="$tmp_libs $deplib" - done # for deplib - continue - fi # $linkmode = prog... - - if test "$linkmode,$pass" = "prog,link"; then - if test -n "$library_names" && - { test "$prefer_static_libs" = no || test -z "$old_library"; }; then - # We need to hardcode the library path - if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then - # Make sure the rpath contains only unique directories. - case "$temp_rpath " in - *" $dir "*) ;; - *" $absdir "*) ;; - *) temp_rpath="$temp_rpath $absdir" ;; - esac - fi - - # Hardcode the library path. - # Skip directories that are in the system default run-time - # search path. - case " $sys_lib_dlsearch_path " in - *" $absdir "*) ;; - *) - case "$compile_rpath " in - *" $absdir "*) ;; - *) compile_rpath="$compile_rpath $absdir" - esac - ;; - esac - case " $sys_lib_dlsearch_path " in - *" $libdir "*) ;; - *) - case "$finalize_rpath " in - *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" - esac - ;; - esac - fi # $linkmode,$pass = prog,link... - - if test "$alldeplibs" = yes && - { test "$deplibs_check_method" = pass_all || - { test "$build_libtool_libs" = yes && - test -n "$library_names"; }; }; then - # We only need to search for static libraries - continue - fi - fi - - link_static=no # Whether the deplib will be linked statically - use_static_libs=$prefer_static_libs - if test "$use_static_libs" = built && test "$installed" = yes ; then - use_static_libs=no - fi - if test -n "$library_names" && - { test "$use_static_libs" = no || test -z "$old_library"; }; then - if test "$installed" = no; then - notinst_deplibs="$notinst_deplibs $lib" - need_relink=yes - fi - # This is a shared library - - # Warn about portability, can't link against -module's on - # some systems (darwin) - if test "$shouldnotlink" = yes && test "$pass" = link ; then - $echo - if test "$linkmode" = prog; then - $echo "*** Warning: Linking the executable $output against the loadable module" - else - $echo "*** Warning: Linking the shared library $output against the loadable module" - fi - $echo "*** $linklib is not portable!" - fi - if test "$linkmode" = lib && - test "$hardcode_into_libs" = yes; then - # Hardcode the library path. - # Skip directories that are in the system default run-time - # search path. - case " $sys_lib_dlsearch_path " in - *" $absdir "*) ;; - *) - case "$compile_rpath " in - *" $absdir "*) ;; - *) compile_rpath="$compile_rpath $absdir" - esac - ;; - esac - case " $sys_lib_dlsearch_path " in - *" $libdir "*) ;; - *) - case "$finalize_rpath " in - *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" - esac - ;; - esac - fi - - if test -n "$old_archive_from_expsyms_cmds"; then - # figure out the soname - set dummy $library_names - realname="$2" - shift; shift - libname=`eval \\$echo \"$libname_spec\"` - # use dlname if we got it. it's perfectly good, no? - if test -n "$dlname"; then - soname="$dlname" - elif test -n "$soname_spec"; then - # bleh windows - case $host in - *cygwin* | mingw*) - major=`expr $current - $age` - versuffix="-$major" - ;; - esac - eval soname=\"$soname_spec\" - else - soname="$realname" - fi - - # Make a new name for the extract_expsyms_cmds to use - soroot="$soname" - soname=`$echo $soroot | ${SED} -e 's/^.*\///'` - newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" - - # If the library has no export list, then create one now - if test -f "$output_objdir/$soname-def"; then : - else - $show "extracting exported symbol list from \`$soname'" - save_ifs="$IFS"; IFS='~' - cmds=$extract_expsyms_cmds - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - fi - - # Create $newlib - if test -f "$output_objdir/$newlib"; then :; else - $show "generating import library for \`$soname'" - save_ifs="$IFS"; IFS='~' - cmds=$old_archive_from_expsyms_cmds - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - fi - # make sure the library variables are pointing to the new library - dir=$output_objdir - linklib=$newlib - fi # test -n "$old_archive_from_expsyms_cmds" - - if test "$linkmode" = prog || test "$mode" != relink; then - add_shlibpath= - add_dir= - add= - lib_linked=yes - case $hardcode_action in - immediate | unsupported) - if test "$hardcode_direct" = no; then - add="$dir/$linklib" - case $host in - *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; - *-*-sysv4*uw2*) add_dir="-L$dir" ;; - *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ - *-*-unixware7*) add_dir="-L$dir" ;; - *-*-darwin* ) - # if the lib is a module then we can not link against - # it, someone is ignoring the new warnings I added - if /usr/bin/file -L $add 2> /dev/null | - $EGREP ": [^:]* bundle" >/dev/null ; then - $echo "** Warning, lib $linklib is a module, not a shared library" - if test -z "$old_library" ; then - $echo - $echo "** And there doesn't seem to be a static archive available" - $echo "** The link will probably fail, sorry" - else - add="$dir/$old_library" - fi - fi - esac - elif test "$hardcode_minus_L" = no; then - case $host in - *-*-sunos*) add_shlibpath="$dir" ;; - esac - add_dir="-L$dir" - add="-l$name" - elif test "$hardcode_shlibpath_var" = no; then - add_shlibpath="$dir" - add="-l$name" - else - lib_linked=no - fi - ;; - relink) - if test "$hardcode_direct" = yes; then - add="$dir/$linklib" - elif test "$hardcode_minus_L" = yes; then - add_dir="-L$dir" - # Try looking first in the location we're being installed to. - if test -n "$inst_prefix_dir"; then - case $libdir in - [\\/]*) - add_dir="$add_dir -L$inst_prefix_dir$libdir" - ;; - esac - fi - add="-l$name" - elif test "$hardcode_shlibpath_var" = yes; then - add_shlibpath="$dir" - add="-l$name" - else - lib_linked=no - fi - ;; - *) lib_linked=no ;; - esac - - if test "$lib_linked" != yes; then - $echo "$modename: configuration error: unsupported hardcode properties" - exit $EXIT_FAILURE - fi - - if test -n "$add_shlibpath"; then - case :$compile_shlibpath: in - *":$add_shlibpath:"*) ;; - *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; - esac - fi - if test "$linkmode" = prog; then - test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" - test -n "$add" && compile_deplibs="$add $compile_deplibs" - else - test -n "$add_dir" && deplibs="$add_dir $deplibs" - test -n "$add" && deplibs="$add $deplibs" - if test "$hardcode_direct" != yes && \ - test "$hardcode_minus_L" != yes && \ - test "$hardcode_shlibpath_var" = yes; then - case :$finalize_shlibpath: in - *":$libdir:"*) ;; - *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; - esac - fi - fi - fi - - if test "$linkmode" = prog || test "$mode" = relink; then - add_shlibpath= - add_dir= - add= - # Finalize command for both is simple: just hardcode it. - if test "$hardcode_direct" = yes; then - add="$libdir/$linklib" - elif test "$hardcode_minus_L" = yes; then - add_dir="-L$libdir" - add="-l$name" - elif test "$hardcode_shlibpath_var" = yes; then - case :$finalize_shlibpath: in - *":$libdir:"*) ;; - *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; - esac - add="-l$name" - elif test "$hardcode_automatic" = yes; then - if test -n "$inst_prefix_dir" && - test -f "$inst_prefix_dir$libdir/$linklib" ; then - add="$inst_prefix_dir$libdir/$linklib" - else - add="$libdir/$linklib" - fi - else - # We cannot seem to hardcode it, guess we'll fake it. - add_dir="-L$libdir" - # Try looking first in the location we're being installed to. - if test -n "$inst_prefix_dir"; then - case $libdir in - [\\/]*) - add_dir="$add_dir -L$inst_prefix_dir$libdir" - ;; - esac - fi - add="-l$name" - fi - - if test "$linkmode" = prog; then - test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" - test -n "$add" && finalize_deplibs="$add $finalize_deplibs" - else - test -n "$add_dir" && deplibs="$add_dir $deplibs" - test -n "$add" && deplibs="$add $deplibs" - fi - fi - elif test "$linkmode" = prog; then - # Here we assume that one of hardcode_direct or hardcode_minus_L - # is not unsupported. This is valid on all known static and - # shared platforms. - if test "$hardcode_direct" != unsupported; then - test -n "$old_library" && linklib="$old_library" - compile_deplibs="$dir/$linklib $compile_deplibs" - finalize_deplibs="$dir/$linklib $finalize_deplibs" - else - compile_deplibs="-l$name -L$dir $compile_deplibs" - finalize_deplibs="-l$name -L$dir $finalize_deplibs" - fi - elif test "$build_libtool_libs" = yes; then - # Not a shared library - if test "$deplibs_check_method" != pass_all; then - # We're trying link a shared library against a static one - # but the system doesn't support it. - - # Just print a warning and add the library to dependency_libs so - # that the program can be linked against the static library. - $echo - $echo "*** Warning: This system can not link to static lib archive $lib." - $echo "*** I have the capability to make that library automatically link in when" - $echo "*** you link to this library. But I can only do this if you have a" - $echo "*** shared version of the library, which you do not appear to have." - if test "$module" = yes; then - $echo "*** But as you try to build a module library, libtool will still create " - $echo "*** a static module, that should work as long as the dlopening application" - $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." - if test -z "$global_symbol_pipe"; then - $echo - $echo "*** However, this would only work if libtool was able to extract symbol" - $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" - $echo "*** not find such a program. So, this module is probably useless." - $echo "*** \`nm' from GNU binutils and a full rebuild may help." - fi - if test "$build_old_libs" = no; then - build_libtool_libs=module - build_old_libs=yes - else - build_libtool_libs=no - fi - fi - else - deplibs="$dir/$old_library $deplibs" - link_static=yes - fi - fi # link shared/static library? - - if test "$linkmode" = lib; then - if test -n "$dependency_libs" && - { test "$hardcode_into_libs" != yes || - test "$build_old_libs" = yes || - test "$link_static" = yes; }; then - # Extract -R from dependency_libs - temp_deplibs= - for libdir in $dependency_libs; do - case $libdir in - -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` - case " $xrpath " in - *" $temp_xrpath "*) ;; - *) xrpath="$xrpath $temp_xrpath";; - esac;; - *) temp_deplibs="$temp_deplibs $libdir";; - esac - done - dependency_libs="$temp_deplibs" - fi - - newlib_search_path="$newlib_search_path $absdir" - # Link against this library - test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" - # ... and its dependency_libs - tmp_libs= - for deplib in $dependency_libs; do - newdependency_libs="$deplib $newdependency_libs" - if test "X$duplicate_deps" = "Xyes" ; then - case "$tmp_libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; - esac - fi - tmp_libs="$tmp_libs $deplib" - done - - if test "$link_all_deplibs" != no; then - # Add the search paths of all dependency libraries - for deplib in $dependency_libs; do - case $deplib in - -L*) path="$deplib" ;; - *.la) - dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` - test "X$dir" = "X$deplib" && dir="." - # We need an absolute path. - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; - *) - absdir=`cd "$dir" && pwd` - if test -z "$absdir"; then - $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 - absdir="$dir" - fi - ;; - esac - if grep "^installed=no" $deplib > /dev/null; then - path="$absdir/$objdir" - else - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` - if test -z "$libdir"; then - $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 - exit $EXIT_FAILURE - fi - if test "$absdir" != "$libdir"; then - $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 - fi - path="$absdir" - fi - depdepl= - case $host in - *-*-darwin*) - # we do not want to link against static libs, - # but need to link against shared - eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` - if test -n "$deplibrary_names" ; then - for tmp in $deplibrary_names ; do - depdepl=$tmp - done - if test -f "$path/$depdepl" ; then - depdepl="$path/$depdepl" - fi - # do not add paths which are already there - case " $newlib_search_path " in - *" $path "*) ;; - *) newlib_search_path="$newlib_search_path $path";; - esac - fi - path="" - ;; - *) - path="-L$path" - ;; - esac - ;; - -l*) - case $host in - *-*-darwin*) - # Again, we only want to link against shared libraries - eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` - for tmp in $newlib_search_path ; do - if test -f "$tmp/lib$tmp_libs.dylib" ; then - eval depdepl="$tmp/lib$tmp_libs.dylib" - break - fi - done - path="" - ;; - *) continue ;; - esac - ;; - *) continue ;; - esac - case " $deplibs " in - *" $path "*) ;; - *) deplibs="$path $deplibs" ;; - esac - case " $deplibs " in - *" $depdepl "*) ;; - *) deplibs="$depdepl $deplibs" ;; - esac - done - fi # link_all_deplibs != no - fi # linkmode = lib - done # for deplib in $libs - dependency_libs="$newdependency_libs" - if test "$pass" = dlpreopen; then - # Link the dlpreopened libraries before other libraries - for deplib in $save_deplibs; do - deplibs="$deplib $deplibs" - done - fi - if test "$pass" != dlopen; then - if test "$pass" != conv; then - # Make sure lib_search_path contains only unique directories. - lib_search_path= - for dir in $newlib_search_path; do - case "$lib_search_path " in - *" $dir "*) ;; - *) lib_search_path="$lib_search_path $dir" ;; - esac - done - newlib_search_path= - fi - - if test "$linkmode,$pass" != "prog,link"; then - vars="deplibs" - else - vars="compile_deplibs finalize_deplibs" - fi - for var in $vars dependency_libs; do - # Add libraries to $var in reverse order - eval tmp_libs=\"\$$var\" - new_libs= - for deplib in $tmp_libs; do - # FIXME: Pedantically, this is the right thing to do, so - # that some nasty dependency loop isn't accidentally - # broken: - #new_libs="$deplib $new_libs" - # Pragmatically, this seems to cause very few problems in - # practice: - case $deplib in - -L*) new_libs="$deplib $new_libs" ;; - -R*) ;; - *) - # And here is the reason: when a library appears more - # than once as an explicit dependence of a library, or - # is implicitly linked in more than once by the - # compiler, it is considered special, and multiple - # occurrences thereof are not removed. Compare this - # with having the same library being listed as a - # dependency of multiple other libraries: in this case, - # we know (pedantically, we assume) the library does not - # need to be listed more than once, so we keep only the - # last copy. This is not always right, but it is rare - # enough that we require users that really mean to play - # such unportable linking tricks to link the library - # using -Wl,-lname, so that libtool does not consider it - # for duplicate removal. - case " $specialdeplibs " in - *" $deplib "*) new_libs="$deplib $new_libs" ;; - *) - case " $new_libs " in - *" $deplib "*) ;; - *) new_libs="$deplib $new_libs" ;; - esac - ;; - esac - ;; - esac - done - tmp_libs= - for deplib in $new_libs; do - case $deplib in - -L*) - case " $tmp_libs " in - *" $deplib "*) ;; - *) tmp_libs="$tmp_libs $deplib" ;; - esac - ;; - *) tmp_libs="$tmp_libs $deplib" ;; - esac - done - eval $var=\"$tmp_libs\" - done # for var - fi - # Last step: remove runtime libs from dependency_libs - # (they stay in deplibs) - tmp_libs= - for i in $dependency_libs ; do - case " $predeps $postdeps $compiler_lib_search_path " in - *" $i "*) - i="" - ;; - esac - if test -n "$i" ; then - tmp_libs="$tmp_libs $i" - fi - done - dependency_libs=$tmp_libs - done # for pass - if test "$linkmode" = prog; then - dlfiles="$newdlfiles" - dlprefiles="$newdlprefiles" - fi - - case $linkmode in - oldlib) - if test -n "$deplibs"; then - $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 - fi - - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 - fi - - if test -n "$rpath"; then - $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 - fi - - if test -n "$xrpath"; then - $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 - fi - - if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 - fi - - if test -n "$release"; then - $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 - fi - - if test -n "$export_symbols" || test -n "$export_symbols_regex"; then - $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 - fi - - # Now set the variables for building old libraries. - build_libtool_libs=no - oldlibs="$output" - objs="$objs$old_deplibs" - ;; - - lib) - # Make sure we only generate libraries of the form `libNAME.la'. - case $outputname in - lib*) - name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` - eval shared_ext=\"$shrext_cmds\" - eval libname=\"$libname_spec\" - ;; - *) - if test "$module" = no; then - $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - if test "$need_lib_prefix" != no; then - # Add the "lib" prefix for modules if required - name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` - eval shared_ext=\"$shrext_cmds\" - eval libname=\"$libname_spec\" - else - libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` - fi - ;; - esac - - if test -n "$objs"; then - if test "$deplibs_check_method" != pass_all; then - $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 - exit $EXIT_FAILURE - else - $echo - $echo "*** Warning: Linking the shared library $output against the non-libtool" - $echo "*** objects $objs is not portable!" - libobjs="$libobjs $objs" - fi - fi - - if test "$dlself" != no; then - $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 - fi - - set dummy $rpath - if test "$#" -gt 2; then - $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 - fi - install_libdir="$2" - - oldlibs= - if test -z "$rpath"; then - if test "$build_libtool_libs" = yes; then - # Building a libtool convenience library. - # Some compilers have problems with a `.al' extension so - # convenience libraries should have the same extension an - # archive normally would. - oldlibs="$output_objdir/$libname.$libext $oldlibs" - build_libtool_libs=convenience - build_old_libs=yes - fi - - if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 - fi - - if test -n "$release"; then - $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 - fi - else - - # Parse the version information argument. - save_ifs="$IFS"; IFS=':' - set dummy $vinfo 0 0 0 - IFS="$save_ifs" - - if test -n "$8"; then - $echo "$modename: too many parameters to \`-version-info'" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - # convert absolute version numbers to libtool ages - # this retains compatibility with .la files and attempts - # to make the code below a bit more comprehensible - - case $vinfo_number in - yes) - number_major="$2" - number_minor="$3" - number_revision="$4" - # - # There are really only two kinds -- those that - # use the current revision as the major version - # and those that subtract age and use age as - # a minor version. But, then there is irix - # which has an extra 1 added just for fun - # - case $version_type in - darwin|linux|osf|windows) - current=`expr $number_major + $number_minor` - age="$number_minor" - revision="$number_revision" - ;; - freebsd-aout|freebsd-elf|sunos) - current="$number_major" - revision="$number_minor" - age="0" - ;; - irix|nonstopux) - current=`expr $number_major + $number_minor - 1` - age="$number_minor" - revision="$number_minor" - ;; - esac - ;; - no) - current="$2" - revision="$3" - age="$4" - ;; - esac - - # Check that each of the things are valid numbers. - case $current in - 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; - *) - $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit $EXIT_FAILURE - ;; - esac - - case $revision in - 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; - *) - $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit $EXIT_FAILURE - ;; - esac - - case $age in - 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; - *) - $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit $EXIT_FAILURE - ;; - esac - - if test "$age" -gt "$current"; then - $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit $EXIT_FAILURE - fi - - # Calculate the version variables. - major= - versuffix= - verstring= - case $version_type in - none) ;; - - darwin) - # Like Linux, but with the current version available in - # verstring for coding it into the library header - major=.`expr $current - $age` - versuffix="$major.$age.$revision" - # Darwin ld doesn't like 0 for these options... - minor_current=`expr $current + 1` - verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" - ;; - - freebsd-aout) - major=".$current" - versuffix=".$current.$revision"; - ;; - - freebsd-elf) - major=".$current" - versuffix=".$current"; - ;; - - irix | nonstopux) - major=`expr $current - $age + 1` - - case $version_type in - nonstopux) verstring_prefix=nonstopux ;; - *) verstring_prefix=sgi ;; - esac - verstring="$verstring_prefix$major.$revision" - - # Add in all the interfaces that we are compatible with. - loop=$revision - while test "$loop" -ne 0; do - iface=`expr $revision - $loop` - loop=`expr $loop - 1` - verstring="$verstring_prefix$major.$iface:$verstring" - done - - # Before this point, $major must not contain `.'. - major=.$major - versuffix="$major.$revision" - ;; - - linux) - major=.`expr $current - $age` - versuffix="$major.$age.$revision" - ;; - - osf) - major=.`expr $current - $age` - versuffix=".$current.$age.$revision" - verstring="$current.$age.$revision" - - # Add in all the interfaces that we are compatible with. - loop=$age - while test "$loop" -ne 0; do - iface=`expr $current - $loop` - loop=`expr $loop - 1` - verstring="$verstring:${iface}.0" - done - - # Make executables depend on our current version. - verstring="$verstring:${current}.0" - ;; - - sunos) - major=".$current" - versuffix=".$current.$revision" - ;; - - windows) - # Use '-' rather than '.', since we only want one - # extension on DOS 8.3 filesystems. - major=`expr $current - $age` - versuffix="-$major" - ;; - - *) - $echo "$modename: unknown library version type \`$version_type'" 1>&2 - $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 - exit $EXIT_FAILURE - ;; - esac - - # Clear the version info if we defaulted, and they specified a release. - if test -z "$vinfo" && test -n "$release"; then - major= - case $version_type in - darwin) - # we can't check for "0.0" in archive_cmds due to quoting - # problems, so we reset it completely - verstring= - ;; - *) - verstring="0.0" - ;; - esac - if test "$need_version" = no; then - versuffix= - else - versuffix=".0.0" - fi - fi - - # Remove version info from name if versioning should be avoided - if test "$avoid_version" = yes && test "$need_version" = no; then - major= - versuffix= - verstring="" - fi - - # Check to see if the archive will have undefined symbols. - if test "$allow_undefined" = yes; then - if test "$allow_undefined_flag" = unsupported; then - $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 - build_libtool_libs=no - build_old_libs=yes - fi - else - # Don't allow undefined symbols. - allow_undefined_flag="$no_undefined_flag" - fi - fi - - if test "$mode" != relink; then - # Remove our outputs, but don't remove object files since they - # may have been created when compiling PIC objects. - removelist= - tempremovelist=`$echo "$output_objdir/*"` - for p in $tempremovelist; do - case $p in - *.$objext) - ;; - $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) - if test "X$precious_files_regex" != "X"; then - if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 - then - continue - fi - fi - removelist="$removelist $p" - ;; - *) ;; - esac - done - if test -n "$removelist"; then - $show "${rm}r $removelist" - $run ${rm}r $removelist - fi - fi - - # Now set the variables for building old libraries. - if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then - oldlibs="$oldlibs $output_objdir/$libname.$libext" - - # Transform .lo files to .o files. - oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` - fi - - # Eliminate all temporary directories. - for path in $notinst_path; do - lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"` - deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"` - dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"` - done - - if test -n "$xrpath"; then - # If the user specified any rpath flags, then add them. - temp_xrpath= - for libdir in $xrpath; do - temp_xrpath="$temp_xrpath -R$libdir" - case "$finalize_rpath " in - *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" ;; - esac - done - if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then - dependency_libs="$temp_xrpath $dependency_libs" - fi - fi - - # Make sure dlfiles contains only unique files that won't be dlpreopened - old_dlfiles="$dlfiles" - dlfiles= - for lib in $old_dlfiles; do - case " $dlprefiles $dlfiles " in - *" $lib "*) ;; - *) dlfiles="$dlfiles $lib" ;; - esac - done - - # Make sure dlprefiles contains only unique files - old_dlprefiles="$dlprefiles" - dlprefiles= - for lib in $old_dlprefiles; do - case "$dlprefiles " in - *" $lib "*) ;; - *) dlprefiles="$dlprefiles $lib" ;; - esac - done - - if test "$build_libtool_libs" = yes; then - if test -n "$rpath"; then - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) - # these systems don't actually have a c library (as such)! - ;; - *-*-rhapsody* | *-*-darwin1.[012]) - # Rhapsody C library is in the System framework - deplibs="$deplibs -framework System" - ;; - *-*-netbsd*) - # Don't link with libc until the a.out ld.so is fixed. - ;; - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) - # Do not include libc due to us having libc/libc_r. - ;; - *-*-sco3.2v5* | *-*-sco5v6*) - # Causes problems with __ctype - ;; - *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) - # Compiler inserts libc in the correct place for threads to work - ;; - *) - # Add libc to deplibs on all other systems if necessary. - if test "$build_libtool_need_lc" = "yes"; then - deplibs="$deplibs -lc" - fi - ;; - esac - fi - - # Transform deplibs into only deplibs that can be linked in shared. - name_save=$name - libname_save=$libname - release_save=$release - versuffix_save=$versuffix - major_save=$major - # I'm not sure if I'm treating the release correctly. I think - # release should show up in the -l (ie -lgmp5) so we don't want to - # add it in twice. Is that correct? - release="" - versuffix="" - major="" - newdeplibs= - droppeddeps=no - case $deplibs_check_method in - pass_all) - # Don't check for shared/static. Everything works. - # This might be a little naive. We might want to check - # whether the library exists or not. But this is on - # osf3 & osf4 and I'm not really sure... Just - # implementing what was already the behavior. - newdeplibs=$deplibs - ;; - test_compile) - # This code stresses the "libraries are programs" paradigm to its - # limits. Maybe even breaks it. We compile a program, linking it - # against the deplibs as a proxy for the library. Then we can check - # whether they linked in statically or dynamically with ldd. - $rm conftest.c - cat > conftest.c </dev/null` - for potent_lib in $potential_libs; do - # Follow soft links. - if ls -lLd "$potent_lib" 2>/dev/null \ - | grep " -> " >/dev/null; then - continue - fi - # The statement above tries to avoid entering an - # endless loop below, in case of cyclic links. - # We might still enter an endless loop, since a link - # loop can be closed while we follow links, - # but so what? - potlib="$potent_lib" - while test -h "$potlib" 2>/dev/null; do - potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` - case $potliblink in - [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; - *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; - esac - done - if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ - | ${SED} 10q \ - | $EGREP "$file_magic_regex" > /dev/null; then - newdeplibs="$newdeplibs $a_deplib" - a_deplib="" - break 2 - fi - done - done - fi - if test -n "$a_deplib" ; then - droppeddeps=yes - $echo - $echo "*** Warning: linker path does not have real file for library $a_deplib." - $echo "*** I have the capability to make that library automatically link in when" - $echo "*** you link to this library. But I can only do this if you have a" - $echo "*** shared version of the library, which you do not appear to have" - $echo "*** because I did check the linker path looking for a file starting" - if test -z "$potlib" ; then - $echo "*** with $libname but no candidates were found. (...for file magic test)" - else - $echo "*** with $libname and none of the candidates passed a file format test" - $echo "*** using a file magic. Last file checked: $potlib" - fi - fi - else - # Add a -L argument. - newdeplibs="$newdeplibs $a_deplib" - fi - done # Gone through all deplibs. - ;; - match_pattern*) - set dummy $deplibs_check_method - match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` - for a_deplib in $deplibs; do - name=`expr $a_deplib : '-l\(.*\)'` - # If $name is empty we are operating on a -L argument. - if test -n "$name" && test "$name" != "0"; then - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - case " $predeps $postdeps " in - *" $a_deplib "*) - newdeplibs="$newdeplibs $a_deplib" - a_deplib="" - ;; - esac - fi - if test -n "$a_deplib" ; then - libname=`eval \\$echo \"$libname_spec\"` - for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do - potential_libs=`ls $i/$libname[.-]* 2>/dev/null` - for potent_lib in $potential_libs; do - potlib="$potent_lib" # see symlink-check above in file_magic test - if eval $echo \"$potent_lib\" 2>/dev/null \ - | ${SED} 10q \ - | $EGREP "$match_pattern_regex" > /dev/null; then - newdeplibs="$newdeplibs $a_deplib" - a_deplib="" - break 2 - fi - done - done - fi - if test -n "$a_deplib" ; then - droppeddeps=yes - $echo - $echo "*** Warning: linker path does not have real file for library $a_deplib." - $echo "*** I have the capability to make that library automatically link in when" - $echo "*** you link to this library. But I can only do this if you have a" - $echo "*** shared version of the library, which you do not appear to have" - $echo "*** because I did check the linker path looking for a file starting" - if test -z "$potlib" ; then - $echo "*** with $libname but no candidates were found. (...for regex pattern test)" - else - $echo "*** with $libname and none of the candidates passed a file format test" - $echo "*** using a regex pattern. Last file checked: $potlib" - fi - fi - else - # Add a -L argument. - newdeplibs="$newdeplibs $a_deplib" - fi - done # Gone through all deplibs. - ;; - none | unknown | *) - newdeplibs="" - tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ - -e 's/ -[LR][^ ]*//g'` - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - for i in $predeps $postdeps ; do - # can't use Xsed below, because $i might contain '/' - tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` - done - fi - if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ - | grep . >/dev/null; then - $echo - if test "X$deplibs_check_method" = "Xnone"; then - $echo "*** Warning: inter-library dependencies are not supported in this platform." - else - $echo "*** Warning: inter-library dependencies are not known to be supported." - fi - $echo "*** All declared inter-library dependencies are being dropped." - droppeddeps=yes - fi - ;; - esac - versuffix=$versuffix_save - major=$major_save - release=$release_save - libname=$libname_save - name=$name_save - - case $host in - *-*-rhapsody* | *-*-darwin1.[012]) - # On Rhapsody replace the C library is the System framework - newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` - ;; - esac - - if test "$droppeddeps" = yes; then - if test "$module" = yes; then - $echo - $echo "*** Warning: libtool could not satisfy all declared inter-library" - $echo "*** dependencies of module $libname. Therefore, libtool will create" - $echo "*** a static module, that should work as long as the dlopening" - $echo "*** application is linked with the -dlopen flag." - if test -z "$global_symbol_pipe"; then - $echo - $echo "*** However, this would only work if libtool was able to extract symbol" - $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" - $echo "*** not find such a program. So, this module is probably useless." - $echo "*** \`nm' from GNU binutils and a full rebuild may help." - fi - if test "$build_old_libs" = no; then - oldlibs="$output_objdir/$libname.$libext" - build_libtool_libs=module - build_old_libs=yes - else - build_libtool_libs=no - fi - else - $echo "*** The inter-library dependencies that have been dropped here will be" - $echo "*** automatically added whenever a program is linked with this library" - $echo "*** or is declared to -dlopen it." - - if test "$allow_undefined" = no; then - $echo - $echo "*** Since this library must not contain undefined symbols," - $echo "*** because either the platform does not support them or" - $echo "*** it was explicitly requested with -no-undefined," - $echo "*** libtool will only create a static version of it." - if test "$build_old_libs" = no; then - oldlibs="$output_objdir/$libname.$libext" - build_libtool_libs=module - build_old_libs=yes - else - build_libtool_libs=no - fi - fi - fi - fi - # Done checking deplibs! - deplibs=$newdeplibs - fi - - - # move library search paths that coincide with paths to not yet - # installed libraries to the beginning of the library search list - new_libs= - for path in $notinst_path; do - case " $new_libs " in - *" -L$path/$objdir "*) ;; - *) - case " $deplibs " in - *" -L$path/$objdir "*) - new_libs="$new_libs -L$path/$objdir" ;; - esac - ;; - esac - done - for deplib in $deplibs; do - case $deplib in - -L*) - case " $new_libs " in - *" $deplib "*) ;; - *) new_libs="$new_libs $deplib" ;; - esac - ;; - *) new_libs="$new_libs $deplib" ;; - esac - done - deplibs="$new_libs" - - - # All the library-specific variables (install_libdir is set above). - library_names= - old_library= - dlname= - - # Test again, we may have decided not to build it any more - if test "$build_libtool_libs" = yes; then - if test "$hardcode_into_libs" = yes; then - # Hardcode the library paths - hardcode_libdirs= - dep_rpath= - rpath="$finalize_rpath" - test "$mode" != relink && rpath="$compile_rpath$rpath" - for libdir in $rpath; do - if test -n "$hardcode_libdir_flag_spec"; then - if test -n "$hardcode_libdir_separator"; then - if test -z "$hardcode_libdirs"; then - hardcode_libdirs="$libdir" - else - # Just accumulate the unique libdirs. - case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in - *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) - ;; - *) - hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" - ;; - esac - fi - else - eval flag=\"$hardcode_libdir_flag_spec\" - dep_rpath="$dep_rpath $flag" - fi - elif test -n "$runpath_var"; then - case "$perm_rpath " in - *" $libdir "*) ;; - *) perm_rpath="$perm_rpath $libdir" ;; - esac - fi - done - # Substitute the hardcoded libdirs into the rpath. - if test -n "$hardcode_libdir_separator" && - test -n "$hardcode_libdirs"; then - libdir="$hardcode_libdirs" - if test -n "$hardcode_libdir_flag_spec_ld"; then - eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" - else - eval dep_rpath=\"$hardcode_libdir_flag_spec\" - fi - fi - if test -n "$runpath_var" && test -n "$perm_rpath"; then - # We should set the runpath_var. - rpath= - for dir in $perm_rpath; do - rpath="$rpath$dir:" - done - eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" - fi - test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" - fi - - shlibpath="$finalize_shlibpath" - test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" - if test -n "$shlibpath"; then - eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" - fi - - # Get the real and link names of the library. - eval shared_ext=\"$shrext_cmds\" - eval library_names=\"$library_names_spec\" - set dummy $library_names - realname="$2" - shift; shift - - if test -n "$soname_spec"; then - eval soname=\"$soname_spec\" - else - soname="$realname" - fi - if test -z "$dlname"; then - dlname=$soname - fi - - lib="$output_objdir/$realname" - linknames= - for link - do - linknames="$linknames $link" - done - - # Use standard objects if they are pic - test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` - - # Prepare the list of exported symbols - if test -z "$export_symbols"; then - if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then - $show "generating symbol list for \`$libname.la'" - export_symbols="$output_objdir/$libname.exp" - $run $rm $export_symbols - cmds=$export_symbols_cmds - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - if len=`expr "X$cmd" : ".*"` && - test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then - $show "$cmd" - $run eval "$cmd" || exit $? - skipped_export=false - else - # The command line is too long to execute in one step. - $show "using reloadable object file for export list..." - skipped_export=: - # Break out early, otherwise skipped_export may be - # set to false by a later but shorter cmd. - break - fi - done - IFS="$save_ifs" - if test -n "$export_symbols_regex"; then - $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" - $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' - $show "$mv \"${export_symbols}T\" \"$export_symbols\"" - $run eval '$mv "${export_symbols}T" "$export_symbols"' - fi - fi - fi - - if test -n "$export_symbols" && test -n "$include_expsyms"; then - $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' - fi - - tmp_deplibs= - for test_deplib in $deplibs; do - case " $convenience " in - *" $test_deplib "*) ;; - *) - tmp_deplibs="$tmp_deplibs $test_deplib" - ;; - esac - done - deplibs="$tmp_deplibs" - - if test -n "$convenience"; then - if test -n "$whole_archive_flag_spec"; then - save_libobjs=$libobjs - eval libobjs=\"\$libobjs $whole_archive_flag_spec\" - else - gentop="$output_objdir/${outputname}x" - generated="$generated $gentop" - - func_extract_archives $gentop $convenience - libobjs="$libobjs $func_extract_archives_result" - fi - fi - - if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then - eval flag=\"$thread_safe_flag_spec\" - linker_flags="$linker_flags $flag" - fi - - # Make a backup of the uninstalled library when relinking - if test "$mode" = relink; then - $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? - fi - - # Do each of the archive commands. - if test "$module" = yes && test -n "$module_cmds" ; then - if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then - eval test_cmds=\"$module_expsym_cmds\" - cmds=$module_expsym_cmds - else - eval test_cmds=\"$module_cmds\" - cmds=$module_cmds - fi - else - if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then - eval test_cmds=\"$archive_expsym_cmds\" - cmds=$archive_expsym_cmds - else - eval test_cmds=\"$archive_cmds\" - cmds=$archive_cmds - fi - fi - - if test "X$skipped_export" != "X:" && - len=`expr "X$test_cmds" : ".*" 2>/dev/null` && - test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then - : - else - # The command line is too long to link in one step, link piecewise. - $echo "creating reloadable object files..." - - # Save the value of $output and $libobjs because we want to - # use them later. If we have whole_archive_flag_spec, we - # want to use save_libobjs as it was before - # whole_archive_flag_spec was expanded, because we can't - # assume the linker understands whole_archive_flag_spec. - # This may have to be revisited, in case too many - # convenience libraries get linked in and end up exceeding - # the spec. - if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then - save_libobjs=$libobjs - fi - save_output=$output - output_la=`$echo "X$output" | $Xsed -e "$basename"` - - # Clear the reloadable object creation command queue and - # initialize k to one. - test_cmds= - concat_cmds= - objlist= - delfiles= - last_robj= - k=1 - output=$output_objdir/$output_la-${k}.$objext - # Loop over the list of objects to be linked. - for obj in $save_libobjs - do - eval test_cmds=\"$reload_cmds $objlist $last_robj\" - if test "X$objlist" = X || - { len=`expr "X$test_cmds" : ".*" 2>/dev/null` && - test "$len" -le "$max_cmd_len"; }; then - objlist="$objlist $obj" - else - # The command $test_cmds is almost too long, add a - # command to the queue. - if test "$k" -eq 1 ; then - # The first file doesn't have a previous command to add. - eval concat_cmds=\"$reload_cmds $objlist $last_robj\" - else - # All subsequent reloadable object files will link in - # the last one created. - eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" - fi - last_robj=$output_objdir/$output_la-${k}.$objext - k=`expr $k + 1` - output=$output_objdir/$output_la-${k}.$objext - objlist=$obj - len=1 - fi - done - # Handle the remaining objects by creating one last - # reloadable object file. All subsequent reloadable object - # files will link in the last one created. - test -z "$concat_cmds" || concat_cmds=$concat_cmds~ - eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" - - if ${skipped_export-false}; then - $show "generating symbol list for \`$libname.la'" - export_symbols="$output_objdir/$libname.exp" - $run $rm $export_symbols - libobjs=$output - # Append the command to create the export file. - eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" - fi - - # Set up a command to remove the reloadable object files - # after they are used. - i=0 - while test "$i" -lt "$k" - do - i=`expr $i + 1` - delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" - done - - $echo "creating a temporary reloadable object file: $output" - - # Loop through the commands generated above and execute them. - save_ifs="$IFS"; IFS='~' - for cmd in $concat_cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - - libobjs=$output - # Restore the value of output. - output=$save_output - - if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then - eval libobjs=\"\$libobjs $whole_archive_flag_spec\" - fi - # Expand the library linking commands again to reset the - # value of $libobjs for piecewise linking. - - # Do each of the archive commands. - if test "$module" = yes && test -n "$module_cmds" ; then - if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then - cmds=$module_expsym_cmds - else - cmds=$module_cmds - fi - else - if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then - cmds=$archive_expsym_cmds - else - cmds=$archive_cmds - fi - fi - - # Append the command to remove the reloadable object files - # to the just-reset $cmds. - eval cmds=\"\$cmds~\$rm $delfiles\" - fi - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" || { - lt_exit=$? - - # Restore the uninstalled library and exit - if test "$mode" = relink; then - $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' - fi - - exit $lt_exit - } - done - IFS="$save_ifs" - - # Restore the uninstalled library and exit - if test "$mode" = relink; then - $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? - - if test -n "$convenience"; then - if test -z "$whole_archive_flag_spec"; then - $show "${rm}r $gentop" - $run ${rm}r "$gentop" - fi - fi - - exit $EXIT_SUCCESS - fi - - # Create links to the real library. - for linkname in $linknames; do - if test "$realname" != "$linkname"; then - $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" - $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? - fi - done - - # If -module or -export-dynamic was specified, set the dlname. - if test "$module" = yes || test "$export_dynamic" = yes; then - # On all known operating systems, these are identical. - dlname="$soname" - fi - fi - ;; - - obj) - if test -n "$deplibs"; then - $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 - fi - - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 - fi - - if test -n "$rpath"; then - $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 - fi - - if test -n "$xrpath"; then - $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 - fi - - if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 - fi - - if test -n "$release"; then - $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 - fi - - case $output in - *.lo) - if test -n "$objs$old_deplibs"; then - $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 - exit $EXIT_FAILURE - fi - libobj="$output" - obj=`$echo "X$output" | $Xsed -e "$lo2o"` - ;; - *) - libobj= - obj="$output" - ;; - esac - - # Delete the old objects. - $run $rm $obj $libobj - - # Objects from convenience libraries. This assumes - # single-version convenience libraries. Whenever we create - # different ones for PIC/non-PIC, this we'll have to duplicate - # the extraction. - reload_conv_objs= - gentop= - # reload_cmds runs $LD directly, so let us get rid of - # -Wl from whole_archive_flag_spec - wl= - - if test -n "$convenience"; then - if test -n "$whole_archive_flag_spec"; then - eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" - else - gentop="$output_objdir/${obj}x" - generated="$generated $gentop" - - func_extract_archives $gentop $convenience - reload_conv_objs="$reload_objs $func_extract_archives_result" - fi - fi - - # Create the old-style object. - reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test - - output="$obj" - cmds=$reload_cmds - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - - # Exit if we aren't doing a library object file. - if test -z "$libobj"; then - if test -n "$gentop"; then - $show "${rm}r $gentop" - $run ${rm}r $gentop - fi - - exit $EXIT_SUCCESS - fi - - if test "$build_libtool_libs" != yes; then - if test -n "$gentop"; then - $show "${rm}r $gentop" - $run ${rm}r $gentop - fi - - # Create an invalid libtool object if no PIC, so that we don't - # accidentally link it into a program. - # $show "echo timestamp > $libobj" - # $run eval "echo timestamp > $libobj" || exit $? - exit $EXIT_SUCCESS - fi - - if test -n "$pic_flag" || test "$pic_mode" != default; then - # Only do commands if we really have different PIC objects. - reload_objs="$libobjs $reload_conv_objs" - output="$libobj" - cmds=$reload_cmds - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - fi - - if test -n "$gentop"; then - $show "${rm}r $gentop" - $run ${rm}r $gentop - fi - - exit $EXIT_SUCCESS - ;; - - prog) - case $host in - *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; - esac - if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 - fi - - if test -n "$release"; then - $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 - fi - - if test "$preload" = yes; then - if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && - test "$dlopen_self_static" = unknown; then - $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." - fi - fi - - case $host in - *-*-rhapsody* | *-*-darwin1.[012]) - # On Rhapsody replace the C library is the System framework - compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` - finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` - ;; - esac - - case $host in - *darwin*) - # Don't allow lazy linking, it breaks C++ global constructors - if test "$tagname" = CXX ; then - compile_command="$compile_command ${wl}-bind_at_load" - finalize_command="$finalize_command ${wl}-bind_at_load" - fi - ;; - esac - - - # move library search paths that coincide with paths to not yet - # installed libraries to the beginning of the library search list - new_libs= - for path in $notinst_path; do - case " $new_libs " in - *" -L$path/$objdir "*) ;; - *) - case " $compile_deplibs " in - *" -L$path/$objdir "*) - new_libs="$new_libs -L$path/$objdir" ;; - esac - ;; - esac - done - for deplib in $compile_deplibs; do - case $deplib in - -L*) - case " $new_libs " in - *" $deplib "*) ;; - *) new_libs="$new_libs $deplib" ;; - esac - ;; - *) new_libs="$new_libs $deplib" ;; - esac - done - compile_deplibs="$new_libs" - - - compile_command="$compile_command $compile_deplibs" - finalize_command="$finalize_command $finalize_deplibs" - - if test -n "$rpath$xrpath"; then - # If the user specified any rpath flags, then add them. - for libdir in $rpath $xrpath; do - # This is the magic to use -rpath. - case "$finalize_rpath " in - *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" ;; - esac - done - fi - - # Now hardcode the library paths - rpath= - hardcode_libdirs= - for libdir in $compile_rpath $finalize_rpath; do - if test -n "$hardcode_libdir_flag_spec"; then - if test -n "$hardcode_libdir_separator"; then - if test -z "$hardcode_libdirs"; then - hardcode_libdirs="$libdir" - else - # Just accumulate the unique libdirs. - case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in - *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) - ;; - *) - hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" - ;; - esac - fi - else - eval flag=\"$hardcode_libdir_flag_spec\" - rpath="$rpath $flag" - fi - elif test -n "$runpath_var"; then - case "$perm_rpath " in - *" $libdir "*) ;; - *) perm_rpath="$perm_rpath $libdir" ;; - esac - fi - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) - testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'` - case :$dllsearchpath: in - *":$libdir:"*) ;; - *) dllsearchpath="$dllsearchpath:$libdir";; - esac - case :$dllsearchpath: in - *":$testbindir:"*) ;; - *) dllsearchpath="$dllsearchpath:$testbindir";; - esac - ;; - esac - done - # Substitute the hardcoded libdirs into the rpath. - if test -n "$hardcode_libdir_separator" && - test -n "$hardcode_libdirs"; then - libdir="$hardcode_libdirs" - eval rpath=\" $hardcode_libdir_flag_spec\" - fi - compile_rpath="$rpath" - - rpath= - hardcode_libdirs= - for libdir in $finalize_rpath; do - if test -n "$hardcode_libdir_flag_spec"; then - if test -n "$hardcode_libdir_separator"; then - if test -z "$hardcode_libdirs"; then - hardcode_libdirs="$libdir" - else - # Just accumulate the unique libdirs. - case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in - *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) - ;; - *) - hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" - ;; - esac - fi - else - eval flag=\"$hardcode_libdir_flag_spec\" - rpath="$rpath $flag" - fi - elif test -n "$runpath_var"; then - case "$finalize_perm_rpath " in - *" $libdir "*) ;; - *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; - esac - fi - done - # Substitute the hardcoded libdirs into the rpath. - if test -n "$hardcode_libdir_separator" && - test -n "$hardcode_libdirs"; then - libdir="$hardcode_libdirs" - eval rpath=\" $hardcode_libdir_flag_spec\" - fi - finalize_rpath="$rpath" - - if test -n "$libobjs" && test "$build_old_libs" = yes; then - # Transform all the library objects into standard objects. - compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` - finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` - fi - - dlsyms= - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - if test -n "$NM" && test -n "$global_symbol_pipe"; then - dlsyms="${outputname}S.c" - else - $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 - fi - fi - - if test -n "$dlsyms"; then - case $dlsyms in - "") ;; - *.c) - # Discover the nlist of each of the dlfiles. - nlist="$output_objdir/${outputname}.nm" - - $show "$rm $nlist ${nlist}S ${nlist}T" - $run $rm "$nlist" "${nlist}S" "${nlist}T" - - # Parse the name list into a source file. - $show "creating $output_objdir/$dlsyms" - - test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ -/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ -/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ - -#ifdef __cplusplus -extern \"C\" { -#endif - -/* Prevent the only kind of declaration conflicts we can make. */ -#define lt_preloaded_symbols some_other_symbol - -/* External symbol declarations for the compiler. */\ -" - - if test "$dlself" = yes; then - $show "generating symbol list for \`$output'" - - test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" - - # Add our own program objects to the symbol list. - progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` - for arg in $progfiles; do - $show "extracting global C symbols from \`$arg'" - $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" - done - - if test -n "$exclude_expsyms"; then - $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' - $run eval '$mv "$nlist"T "$nlist"' - fi - - if test -n "$export_symbols_regex"; then - $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' - $run eval '$mv "$nlist"T "$nlist"' - fi - - # Prepare the list of exported symbols - if test -z "$export_symbols"; then - export_symbols="$output_objdir/$outputname.exp" - $run $rm $export_symbols - $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' - case $host in - *cygwin* | *mingw* ) - $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' - $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' - ;; - esac - else - $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' - $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' - $run eval 'mv "$nlist"T "$nlist"' - case $host in - *cygwin* | *mingw* ) - $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' - $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' - ;; - esac - fi - fi - - for arg in $dlprefiles; do - $show "extracting global C symbols from \`$arg'" - name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` - $run eval '$echo ": $name " >> "$nlist"' - $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" - done - - if test -z "$run"; then - # Make sure we have at least an empty file. - test -f "$nlist" || : > "$nlist" - - if test -n "$exclude_expsyms"; then - $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T - $mv "$nlist"T "$nlist" - fi - - # Try sorting and uniquifying the output. - if grep -v "^: " < "$nlist" | - if sort -k 3 /dev/null 2>&1; then - sort -k 3 - else - sort +2 - fi | - uniq > "$nlist"S; then - : - else - grep -v "^: " < "$nlist" > "$nlist"S - fi - - if test -f "$nlist"S; then - eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' - else - $echo '/* NONE */' >> "$output_objdir/$dlsyms" - fi - - $echo >> "$output_objdir/$dlsyms" "\ - -#undef lt_preloaded_symbols - -#if defined (__STDC__) && __STDC__ -# define lt_ptr void * -#else -# define lt_ptr char * -# define const -#endif - -/* The mapping between symbol names and symbols. */ -" - - case $host in - *cygwin* | *mingw* ) - $echo >> "$output_objdir/$dlsyms" "\ -/* DATA imports from DLLs on WIN32 can't be const, because - runtime relocations are performed -- see ld's documentation - on pseudo-relocs */ -struct { -" - ;; - * ) - $echo >> "$output_objdir/$dlsyms" "\ -const struct { -" - ;; - esac - - - $echo >> "$output_objdir/$dlsyms" "\ - const char *name; - lt_ptr address; -} -lt_preloaded_symbols[] = -{\ -" - - eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" - - $echo >> "$output_objdir/$dlsyms" "\ - {0, (lt_ptr) 0} -}; - -/* This works around a problem in FreeBSD linker */ -#ifdef FREEBSD_WORKAROUND -static const void *lt_preloaded_setup() { - return lt_preloaded_symbols; -} -#endif - -#ifdef __cplusplus -} -#endif\ -" - fi - - pic_flag_for_symtable= - case $host in - # compiling the symbol table file with pic_flag works around - # a FreeBSD bug that causes programs to crash when -lm is - # linked before any other PIC object. But we must not use - # pic_flag when linking with -static. The problem exists in - # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. - *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) - case "$compile_command " in - *" -static "*) ;; - *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; - esac;; - *-*-hpux*) - case "$compile_command " in - *" -static "*) ;; - *) pic_flag_for_symtable=" $pic_flag";; - esac - esac - - # Now compile the dynamic symbol file. - $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" - $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? - - # Clean up the generated files. - $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" - $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" - - # Transform the symbol file into the correct name. - case $host in - *cygwin* | *mingw* ) - if test -f "$output_objdir/${outputname}.def" ; then - compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` - finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` - else - compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` - finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` - fi - ;; - * ) - compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` - finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` - ;; - esac - ;; - *) - $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 - exit $EXIT_FAILURE - ;; - esac - else - # We keep going just in case the user didn't refer to - # lt_preloaded_symbols. The linker will fail if global_symbol_pipe - # really was required. - - # Nullify the symbol file. - compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` - finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` - fi - - if test "$need_relink" = no || test "$build_libtool_libs" != yes; then - # Replace the output file specification. - compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` - link_command="$compile_command$compile_rpath" - - # We have no uninstalled library dependencies, so finalize right now. - $show "$link_command" - $run eval "$link_command" - exit_status=$? - - # Delete the generated files. - if test -n "$dlsyms"; then - $show "$rm $output_objdir/${outputname}S.${objext}" - $run $rm "$output_objdir/${outputname}S.${objext}" - fi - - exit $exit_status - fi - - if test -n "$shlibpath_var"; then - # We should set the shlibpath_var - rpath= - for dir in $temp_rpath; do - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) - # Absolute path. - rpath="$rpath$dir:" - ;; - *) - # Relative path: add a thisdir entry. - rpath="$rpath\$thisdir/$dir:" - ;; - esac - done - temp_rpath="$rpath" - fi - - if test -n "$compile_shlibpath$finalize_shlibpath"; then - compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" - fi - if test -n "$finalize_shlibpath"; then - finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" - fi - - compile_var= - finalize_var= - if test -n "$runpath_var"; then - if test -n "$perm_rpath"; then - # We should set the runpath_var. - rpath= - for dir in $perm_rpath; do - rpath="$rpath$dir:" - done - compile_var="$runpath_var=\"$rpath\$$runpath_var\" " - fi - if test -n "$finalize_perm_rpath"; then - # We should set the runpath_var. - rpath= - for dir in $finalize_perm_rpath; do - rpath="$rpath$dir:" - done - finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " - fi - fi - - if test "$no_install" = yes; then - # We don't need to create a wrapper script. - link_command="$compile_var$compile_command$compile_rpath" - # Replace the output file specification. - link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` - # Delete the old output file. - $run $rm $output - # Link the executable and exit - $show "$link_command" - $run eval "$link_command" || exit $? - exit $EXIT_SUCCESS - fi - - if test "$hardcode_action" = relink; then - # Fast installation is not supported - link_command="$compile_var$compile_command$compile_rpath" - relink_command="$finalize_var$finalize_command$finalize_rpath" - - $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 - $echo "$modename: \`$output' will be relinked during installation" 1>&2 - else - if test "$fast_install" != no; then - link_command="$finalize_var$compile_command$finalize_rpath" - if test "$fast_install" = yes; then - relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` - else - # fast_install is set to needless - relink_command= - fi - else - link_command="$compile_var$compile_command$compile_rpath" - relink_command="$finalize_var$finalize_command$finalize_rpath" - fi - fi - - # Replace the output file specification. - link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` - - # Delete the old output files. - $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname - - $show "$link_command" - $run eval "$link_command" || exit $? - - # Now create the wrapper script. - $show "creating $output" - - # Quote the relink command for shipping. - if test -n "$relink_command"; then - # Preserve any variables that may affect compiler behavior - for var in $variables_saved_for_relink; do - if eval test -z \"\${$var+set}\"; then - relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" - elif eval var_value=\$$var; test -z "$var_value"; then - relink_command="$var=; export $var; $relink_command" - else - var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` - relink_command="$var=\"$var_value\"; export $var; $relink_command" - fi - done - relink_command="(cd `pwd`; $relink_command)" - relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` - fi - - # Quote $echo for shipping. - if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then - case $progpath in - [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; - *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; - esac - qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` - else - qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` - fi - - # Only actually do things if our run command is non-null. - if test -z "$run"; then - # win32 will think the script is a binary if it has - # a .exe suffix, so we strip it off here. - case $output in - *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; - esac - # test for cygwin because mv fails w/o .exe extensions - case $host in - *cygwin*) - exeext=.exe - outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; - *) exeext= ;; - esac - case $host in - *cygwin* | *mingw* ) - output_name=`basename $output` - output_path=`dirname $output` - cwrappersource="$output_path/$objdir/lt-$output_name.c" - cwrapper="$output_path/$output_name.exe" - $rm $cwrappersource $cwrapper - trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 - - cat > $cwrappersource <> $cwrappersource<<"EOF" -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#if defined(PATH_MAX) -# define LT_PATHMAX PATH_MAX -#elif defined(MAXPATHLEN) -# define LT_PATHMAX MAXPATHLEN -#else -# define LT_PATHMAX 1024 -#endif - -#ifndef DIR_SEPARATOR -# define DIR_SEPARATOR '/' -# define PATH_SEPARATOR ':' -#endif - -#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ - defined (__OS2__) -# define HAVE_DOS_BASED_FILE_SYSTEM -# ifndef DIR_SEPARATOR_2 -# define DIR_SEPARATOR_2 '\\' -# endif -# ifndef PATH_SEPARATOR_2 -# define PATH_SEPARATOR_2 ';' -# endif -#endif - -#ifndef DIR_SEPARATOR_2 -# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) -#else /* DIR_SEPARATOR_2 */ -# define IS_DIR_SEPARATOR(ch) \ - (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) -#endif /* DIR_SEPARATOR_2 */ - -#ifndef PATH_SEPARATOR_2 -# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) -#else /* PATH_SEPARATOR_2 */ -# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) -#endif /* PATH_SEPARATOR_2 */ - -#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) -#define XFREE(stale) do { \ - if (stale) { free ((void *) stale); stale = 0; } \ -} while (0) - -/* -DDEBUG is fairly common in CFLAGS. */ -#undef DEBUG -#if defined DEBUGWRAPPER -# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__) -#else -# define DEBUG(format, ...) -#endif - -const char *program_name = NULL; - -void * xmalloc (size_t num); -char * xstrdup (const char *string); -const char * base_name (const char *name); -char * find_executable(const char *wrapper); -int check_executable(const char *path); -char * strendzap(char *str, const char *pat); -void lt_fatal (const char *message, ...); - -int -main (int argc, char *argv[]) -{ - char **newargz; - int i; - - program_name = (char *) xstrdup (base_name (argv[0])); - DEBUG("(main) argv[0] : %s\n",argv[0]); - DEBUG("(main) program_name : %s\n",program_name); - newargz = XMALLOC(char *, argc+2); -EOF - - cat >> $cwrappersource <> $cwrappersource <<"EOF" - newargz[1] = find_executable(argv[0]); - if (newargz[1] == NULL) - lt_fatal("Couldn't find %s", argv[0]); - DEBUG("(main) found exe at : %s\n",newargz[1]); - /* we know the script has the same name, without the .exe */ - /* so make sure newargz[1] doesn't end in .exe */ - strendzap(newargz[1],".exe"); - for (i = 1; i < argc; i++) - newargz[i+1] = xstrdup(argv[i]); - newargz[argc+1] = NULL; - - for (i=0; i> $cwrappersource <> $cwrappersource <> $cwrappersource <<"EOF" - return 127; -} - -void * -xmalloc (size_t num) -{ - void * p = (void *) malloc (num); - if (!p) - lt_fatal ("Memory exhausted"); - - return p; -} - -char * -xstrdup (const char *string) -{ - return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL -; -} - -const char * -base_name (const char *name) -{ - const char *base; - -#if defined (HAVE_DOS_BASED_FILE_SYSTEM) - /* Skip over the disk name in MSDOS pathnames. */ - if (isalpha ((unsigned char)name[0]) && name[1] == ':') - name += 2; -#endif - - for (base = name; *name; name++) - if (IS_DIR_SEPARATOR (*name)) - base = name + 1; - return base; -} - -int -check_executable(const char * path) -{ - struct stat st; - - DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!"); - if ((!path) || (!*path)) - return 0; - - if ((stat (path, &st) >= 0) && - ( - /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */ -#if defined (S_IXOTH) - ((st.st_mode & S_IXOTH) == S_IXOTH) || -#endif -#if defined (S_IXGRP) - ((st.st_mode & S_IXGRP) == S_IXGRP) || -#endif - ((st.st_mode & S_IXUSR) == S_IXUSR)) - ) - return 1; - else - return 0; -} - -/* Searches for the full path of the wrapper. Returns - newly allocated full path name if found, NULL otherwise */ -char * -find_executable (const char* wrapper) -{ - int has_slash = 0; - const char* p; - const char* p_next; - /* static buffer for getcwd */ - char tmp[LT_PATHMAX + 1]; - int tmp_len; - char* concat_name; - - DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"); - - if ((wrapper == NULL) || (*wrapper == '\0')) - return NULL; - - /* Absolute path? */ -#if defined (HAVE_DOS_BASED_FILE_SYSTEM) - if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':') - { - concat_name = xstrdup (wrapper); - if (check_executable(concat_name)) - return concat_name; - XFREE(concat_name); - } - else - { -#endif - if (IS_DIR_SEPARATOR (wrapper[0])) - { - concat_name = xstrdup (wrapper); - if (check_executable(concat_name)) - return concat_name; - XFREE(concat_name); - } -#if defined (HAVE_DOS_BASED_FILE_SYSTEM) - } -#endif - - for (p = wrapper; *p; p++) - if (*p == '/') - { - has_slash = 1; - break; - } - if (!has_slash) - { - /* no slashes; search PATH */ - const char* path = getenv ("PATH"); - if (path != NULL) - { - for (p = path; *p; p = p_next) - { - const char* q; - size_t p_len; - for (q = p; *q; q++) - if (IS_PATH_SEPARATOR(*q)) - break; - p_len = q - p; - p_next = (*q == '\0' ? q : q + 1); - if (p_len == 0) - { - /* empty path: current directory */ - if (getcwd (tmp, LT_PATHMAX) == NULL) - lt_fatal ("getcwd failed"); - tmp_len = strlen(tmp); - concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); - memcpy (concat_name, tmp, tmp_len); - concat_name[tmp_len] = '/'; - strcpy (concat_name + tmp_len + 1, wrapper); - } - else - { - concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1); - memcpy (concat_name, p, p_len); - concat_name[p_len] = '/'; - strcpy (concat_name + p_len + 1, wrapper); - } - if (check_executable(concat_name)) - return concat_name; - XFREE(concat_name); - } - } - /* not found in PATH; assume curdir */ - } - /* Relative path | not found in path: prepend cwd */ - if (getcwd (tmp, LT_PATHMAX) == NULL) - lt_fatal ("getcwd failed"); - tmp_len = strlen(tmp); - concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); - memcpy (concat_name, tmp, tmp_len); - concat_name[tmp_len] = '/'; - strcpy (concat_name + tmp_len + 1, wrapper); - - if (check_executable(concat_name)) - return concat_name; - XFREE(concat_name); - return NULL; -} - -char * -strendzap(char *str, const char *pat) -{ - size_t len, patlen; - - assert(str != NULL); - assert(pat != NULL); - - len = strlen(str); - patlen = strlen(pat); - - if (patlen <= len) - { - str += len - patlen; - if (strcmp(str, pat) == 0) - *str = '\0'; - } - return str; -} - -static void -lt_error_core (int exit_status, const char * mode, - const char * message, va_list ap) -{ - fprintf (stderr, "%s: %s: ", program_name, mode); - vfprintf (stderr, message, ap); - fprintf (stderr, ".\n"); - - if (exit_status >= 0) - exit (exit_status); -} - -void -lt_fatal (const char *message, ...) -{ - va_list ap; - va_start (ap, message); - lt_error_core (EXIT_FAILURE, "FATAL", message, ap); - va_end (ap); -} -EOF - # we should really use a build-platform specific compiler - # here, but OTOH, the wrappers (shell script and this C one) - # are only useful if you want to execute the "real" binary. - # Since the "real" binary is built for $host, then this - # wrapper might as well be built for $host, too. - $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource - ;; - esac - $rm $output - trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 - - $echo > $output "\ -#! $SHELL - -# $output - temporary wrapper script for $objdir/$outputname -# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP -# -# The $output program cannot be directly executed until all the libtool -# libraries that it depends on are installed. -# -# This wrapper script should never be moved out of the build directory. -# If it is, it will not operate correctly. - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed='${SED} -e 1s/^X//' -sed_quote_subst='$sed_quote_subst' - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -relink_command=\"$relink_command\" - -# This environment variable determines our operation mode. -if test \"\$libtool_install_magic\" = \"$magic\"; then - # install mode needs the following variable: - notinst_deplibs='$notinst_deplibs' -else - # When we are sourced in execute mode, \$file and \$echo are already set. - if test \"\$libtool_execute_magic\" != \"$magic\"; then - echo=\"$qecho\" - file=\"\$0\" - # Make sure echo works. - if test \"X\$1\" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift - elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then - # Yippee, \$echo works! - : - else - # Restart under the correct shell, and then maybe \$echo will work. - exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} - fi - fi\ -" - $echo >> $output "\ - - # Find the directory that this script lives in. - thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` - test \"x\$thisdir\" = \"x\$file\" && thisdir=. - - # Follow symbolic links until we get to the real thisdir. - file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` - while test -n \"\$file\"; do - destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` - - # If there was a directory component, then change thisdir. - if test \"x\$destdir\" != \"x\$file\"; then - case \"\$destdir\" in - [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; - *) thisdir=\"\$thisdir/\$destdir\" ;; - esac - fi - - file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` - file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` - done - - # Try to get the absolute directory name. - absdir=\`cd \"\$thisdir\" && pwd\` - test -n \"\$absdir\" && thisdir=\"\$absdir\" -" - - if test "$fast_install" = yes; then - $echo >> $output "\ - program=lt-'$outputname'$exeext - progdir=\"\$thisdir/$objdir\" - - if test ! -f \"\$progdir/\$program\" || \\ - { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ - test \"X\$file\" != \"X\$progdir/\$program\"; }; then - - file=\"\$\$-\$program\" - - if test ! -d \"\$progdir\"; then - $mkdir \"\$progdir\" - else - $rm \"\$progdir/\$file\" - fi" - - $echo >> $output "\ - - # relink executable if necessary - if test -n \"\$relink_command\"; then - if relink_command_output=\`eval \$relink_command 2>&1\`; then : - else - $echo \"\$relink_command_output\" >&2 - $rm \"\$progdir/\$file\" - exit $EXIT_FAILURE - fi - fi - - $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || - { $rm \"\$progdir/\$program\"; - $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } - $rm \"\$progdir/\$file\" - fi" - else - $echo >> $output "\ - program='$outputname' - progdir=\"\$thisdir/$objdir\" -" - fi - - $echo >> $output "\ - - if test -f \"\$progdir/\$program\"; then" - - # Export our shlibpath_var if we have one. - if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then - $echo >> $output "\ - # Add our own library path to $shlibpath_var - $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" - - # Some systems cannot cope with colon-terminated $shlibpath_var - # The second colon is a workaround for a bug in BeOS R4 sed - $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` - - export $shlibpath_var -" - fi - - # fixup the dll searchpath if we need to. - if test -n "$dllsearchpath"; then - $echo >> $output "\ - # Add the dll search path components to the executable PATH - PATH=$dllsearchpath:\$PATH -" - fi - - $echo >> $output "\ - if test \"\$libtool_execute_magic\" != \"$magic\"; then - # Run the actual program with our arguments. -" - case $host in - # Backslashes separate directories on plain windows - *-*-mingw | *-*-os2*) - $echo >> $output "\ - exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} -" - ;; - - *) - $echo >> $output "\ - exec \"\$progdir/\$program\" \${1+\"\$@\"} -" - ;; - esac - $echo >> $output "\ - \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" - exit $EXIT_FAILURE - fi - else - # The program doesn't exist. - \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 - \$echo \"This script is just a wrapper for \$program.\" 1>&2 - $echo \"See the $PACKAGE documentation for more information.\" 1>&2 - exit $EXIT_FAILURE - fi -fi\ -" - chmod +x $output - fi - exit $EXIT_SUCCESS - ;; - esac - - # See if we need to build an old-fashioned archive. - for oldlib in $oldlibs; do - - if test "$build_libtool_libs" = convenience; then - oldobjs="$libobjs_save" - addlibs="$convenience" - build_libtool_libs=no - else - if test "$build_libtool_libs" = module; then - oldobjs="$libobjs_save" - build_libtool_libs=no - else - oldobjs="$old_deplibs $non_pic_objects" - fi - addlibs="$old_convenience" - fi - - if test -n "$addlibs"; then - gentop="$output_objdir/${outputname}x" - generated="$generated $gentop" - - func_extract_archives $gentop $addlibs - oldobjs="$oldobjs $func_extract_archives_result" - fi - - # Do each command in the archive commands. - if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then - cmds=$old_archive_from_new_cmds - else - # POSIX demands no paths to be encoded in archives. We have - # to avoid creating archives with duplicate basenames if we - # might have to extract them afterwards, e.g., when creating a - # static archive out of a convenience library, or when linking - # the entirety of a libtool archive into another (currently - # not supported by libtool). - if (for obj in $oldobjs - do - $echo "X$obj" | $Xsed -e 's%^.*/%%' - done | sort | sort -uc >/dev/null 2>&1); then - : - else - $echo "copying selected object files to avoid basename conflicts..." - - if test -z "$gentop"; then - gentop="$output_objdir/${outputname}x" - generated="$generated $gentop" - - $show "${rm}r $gentop" - $run ${rm}r "$gentop" - $show "$mkdir $gentop" - $run $mkdir "$gentop" - exit_status=$? - if test "$exit_status" -ne 0 && test ! -d "$gentop"; then - exit $exit_status - fi - fi - - save_oldobjs=$oldobjs - oldobjs= - counter=1 - for obj in $save_oldobjs - do - objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` - case " $oldobjs " in - " ") oldobjs=$obj ;; - *[\ /]"$objbase "*) - while :; do - # Make sure we don't pick an alternate name that also - # overlaps. - newobj=lt$counter-$objbase - counter=`expr $counter + 1` - case " $oldobjs " in - *[\ /]"$newobj "*) ;; - *) if test ! -f "$gentop/$newobj"; then break; fi ;; - esac - done - $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" - $run ln "$obj" "$gentop/$newobj" || - $run cp "$obj" "$gentop/$newobj" - oldobjs="$oldobjs $gentop/$newobj" - ;; - *) oldobjs="$oldobjs $obj" ;; - esac - done - fi - - eval cmds=\"$old_archive_cmds\" - - if len=`expr "X$cmds" : ".*"` && - test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then - cmds=$old_archive_cmds - else - # the command line is too long to link in one step, link in parts - $echo "using piecewise archive linking..." - save_RANLIB=$RANLIB - RANLIB=: - objlist= - concat_cmds= - save_oldobjs=$oldobjs - - # Is there a better way of finding the last object in the list? - for obj in $save_oldobjs - do - last_oldobj=$obj - done - for obj in $save_oldobjs - do - oldobjs="$objlist $obj" - objlist="$objlist $obj" - eval test_cmds=\"$old_archive_cmds\" - if len=`expr "X$test_cmds" : ".*" 2>/dev/null` && - test "$len" -le "$max_cmd_len"; then - : - else - # the above command should be used before it gets too long - oldobjs=$objlist - if test "$obj" = "$last_oldobj" ; then - RANLIB=$save_RANLIB - fi - test -z "$concat_cmds" || concat_cmds=$concat_cmds~ - eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" - objlist= - fi - done - RANLIB=$save_RANLIB - oldobjs=$objlist - if test "X$oldobjs" = "X" ; then - eval cmds=\"\$concat_cmds\" - else - eval cmds=\"\$concat_cmds~\$old_archive_cmds\" - fi - fi - fi - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - eval cmd=\"$cmd\" - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - done - - if test -n "$generated"; then - $show "${rm}r$generated" - $run ${rm}r$generated - fi - - # Now create the libtool archive. - case $output in - *.la) - old_library= - test "$build_old_libs" = yes && old_library="$libname.$libext" - $show "creating $output" - - # Preserve any variables that may affect compiler behavior - for var in $variables_saved_for_relink; do - if eval test -z \"\${$var+set}\"; then - relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" - elif eval var_value=\$$var; test -z "$var_value"; then - relink_command="$var=; export $var; $relink_command" - else - var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` - relink_command="$var=\"$var_value\"; export $var; $relink_command" - fi - done - # Quote the link command for shipping. - relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" - relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` - if test "$hardcode_automatic" = yes ; then - relink_command= - fi - - - # Only create the output if not a dry run. - if test -z "$run"; then - for installed in no yes; do - if test "$installed" = yes; then - if test -z "$install_libdir"; then - break - fi - output="$output_objdir/$outputname"i - # Replace all uninstalled libtool libraries with the installed ones - newdependency_libs= - for deplib in $dependency_libs; do - case $deplib in - *.la) - name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` - if test -z "$libdir"; then - $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 - exit $EXIT_FAILURE - fi - newdependency_libs="$newdependency_libs $libdir/$name" - ;; - *) newdependency_libs="$newdependency_libs $deplib" ;; - esac - done - dependency_libs="$newdependency_libs" - newdlfiles= - for lib in $dlfiles; do - name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` - if test -z "$libdir"; then - $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - exit $EXIT_FAILURE - fi - newdlfiles="$newdlfiles $libdir/$name" - done - dlfiles="$newdlfiles" - newdlprefiles= - for lib in $dlprefiles; do - name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` - if test -z "$libdir"; then - $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - exit $EXIT_FAILURE - fi - newdlprefiles="$newdlprefiles $libdir/$name" - done - dlprefiles="$newdlprefiles" - else - newdlfiles= - for lib in $dlfiles; do - case $lib in - [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; - *) abs=`pwd`"/$lib" ;; - esac - newdlfiles="$newdlfiles $abs" - done - dlfiles="$newdlfiles" - newdlprefiles= - for lib in $dlprefiles; do - case $lib in - [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; - *) abs=`pwd`"/$lib" ;; - esac - newdlprefiles="$newdlprefiles $abs" - done - dlprefiles="$newdlprefiles" - fi - $rm $output - # place dlname in correct position for cygwin - tdlname=$dlname - case $host,$output,$installed,$module,$dlname in - *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; - esac - $echo > $output "\ -# $outputname - a libtool library file -# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='$tdlname' - -# Names of this library. -library_names='$library_names' - -# The name of the static archive. -old_library='$old_library' - -# Libraries that this one depends upon. -dependency_libs='$dependency_libs' - -# Version information for $libname. -current=$current -age=$age -revision=$revision - -# Is this an already installed library? -installed=$installed - -# Should we warn about portability when linking against -modules? -shouldnotlink=$module - -# Files to dlopen/dlpreopen -dlopen='$dlfiles' -dlpreopen='$dlprefiles' - -# Directory that this library needs to be installed in: -libdir='$install_libdir'" - if test "$installed" = no && test "$need_relink" = yes; then - $echo >> $output "\ -relink_command=\"$relink_command\"" - fi - done - fi - - # Do a symbolic link so that the libtool archive can be found in - # LD_LIBRARY_PATH before the program is installed. - $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" - $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? - ;; - esac - exit $EXIT_SUCCESS - ;; - - # libtool install mode - install) - modename="$modename: install" - - # There may be an optional sh(1) argument at the beginning of - # install_prog (especially on Windows NT). - if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || - # Allow the use of GNU shtool's install command. - $echo "X$nonopt" | grep shtool > /dev/null; then - # Aesthetically quote it. - arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - install_prog="$arg " - arg="$1" - shift - else - install_prog= - arg=$nonopt - fi - - # The real first argument should be the name of the installation program. - # Aesthetically quote it. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - install_prog="$install_prog$arg" - - # We need to accept at least all the BSD install flags. - dest= - files= - opts= - prev= - install_type= - isdir=no - stripme= - for arg - do - if test -n "$dest"; then - files="$files $dest" - dest=$arg - continue - fi - - case $arg in - -d) isdir=yes ;; - -f) - case " $install_prog " in - *[\\\ /]cp\ *) ;; - *) prev=$arg ;; - esac - ;; - -g | -m | -o) prev=$arg ;; - -s) - stripme=" -s" - continue - ;; - -*) - ;; - *) - # If the previous option needed an argument, then skip it. - if test -n "$prev"; then - prev= - else - dest=$arg - continue - fi - ;; - esac - - # Aesthetically quote the argument. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - install_prog="$install_prog $arg" - done - - if test -z "$install_prog"; then - $echo "$modename: you must specify an install program" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - if test -n "$prev"; then - $echo "$modename: the \`$prev' option requires an argument" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - if test -z "$files"; then - if test -z "$dest"; then - $echo "$modename: no file or destination specified" 1>&2 - else - $echo "$modename: you must specify a destination" 1>&2 - fi - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - # Strip any trailing slash from the destination. - dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` - - # Check to see that the destination is a directory. - test -d "$dest" && isdir=yes - if test "$isdir" = yes; then - destdir="$dest" - destname= - else - destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` - test "X$destdir" = "X$dest" && destdir=. - destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` - - # Not a directory, so check to see that there is only one file specified. - set dummy $files - if test "$#" -gt 2; then - $echo "$modename: \`$dest' is not a directory" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - fi - case $destdir in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - for file in $files; do - case $file in - *.lo) ;; - *) - $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - ;; - esac - done - ;; - esac - - # This variable tells wrapper scripts just to set variables rather - # than running their programs. - libtool_install_magic="$magic" - - staticlibs= - future_libdirs= - current_libdirs= - for file in $files; do - - # Do each installation. - case $file in - *.$libext) - # Do the static libraries later. - staticlibs="$staticlibs $file" - ;; - - *.la) - # Check to see that this really is a libtool archive. - if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : - else - $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - library_names= - old_library= - relink_command= - # If there is no directory component, then add one. - case $file in - */* | *\\*) . $file ;; - *) . ./$file ;; - esac - - # Add the libdir to current_libdirs if it is the destination. - if test "X$destdir" = "X$libdir"; then - case "$current_libdirs " in - *" $libdir "*) ;; - *) current_libdirs="$current_libdirs $libdir" ;; - esac - else - # Note the libdir as a future libdir. - case "$future_libdirs " in - *" $libdir "*) ;; - *) future_libdirs="$future_libdirs $libdir" ;; - esac - fi - - dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ - test "X$dir" = "X$file/" && dir= - dir="$dir$objdir" - - if test -n "$relink_command"; then - # Determine the prefix the user has applied to our future dir. - inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` - - # Don't allow the user to place us outside of our expected - # location b/c this prevents finding dependent libraries that - # are installed to the same prefix. - # At present, this check doesn't affect windows .dll's that - # are installed into $libdir/../bin (currently, that works fine) - # but it's something to keep an eye on. - if test "$inst_prefix_dir" = "$destdir"; then - $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 - exit $EXIT_FAILURE - fi - - if test -n "$inst_prefix_dir"; then - # Stick the inst_prefix_dir data into the link command. - relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` - else - relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` - fi - - $echo "$modename: warning: relinking \`$file'" 1>&2 - $show "$relink_command" - if $run eval "$relink_command"; then : - else - $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 - exit $EXIT_FAILURE - fi - fi - - # See the names of the shared library. - set dummy $library_names - if test -n "$2"; then - realname="$2" - shift - shift - - srcname="$realname" - test -n "$relink_command" && srcname="$realname"T - - # Install the shared library and build the symlinks. - $show "$install_prog $dir/$srcname $destdir/$realname" - $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? - if test -n "$stripme" && test -n "$striplib"; then - $show "$striplib $destdir/$realname" - $run eval "$striplib $destdir/$realname" || exit $? - fi - - if test "$#" -gt 0; then - # Delete the old symlinks, and create new ones. - # Try `ln -sf' first, because the `ln' binary might depend on - # the symlink we replace! Solaris /bin/ln does not understand -f, - # so we also need to try rm && ln -s. - for linkname - do - if test "$linkname" != "$realname"; then - $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" - $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" - fi - done - fi - - # Do each command in the postinstall commands. - lib="$destdir/$realname" - cmds=$postinstall_cmds - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" || { - lt_exit=$? - - # Restore the uninstalled library and exit - if test "$mode" = relink; then - $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' - fi - - exit $lt_exit - } - done - IFS="$save_ifs" - fi - - # Install the pseudo-library for information purposes. - name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - instname="$dir/$name"i - $show "$install_prog $instname $destdir/$name" - $run eval "$install_prog $instname $destdir/$name" || exit $? - - # Maybe install the static library, too. - test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" - ;; - - *.lo) - # Install (i.e. copy) a libtool object. - - # Figure out destination file name, if it wasn't already specified. - if test -n "$destname"; then - destfile="$destdir/$destname" - else - destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - destfile="$destdir/$destfile" - fi - - # Deduce the name of the destination old-style object file. - case $destfile in - *.lo) - staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` - ;; - *.$objext) - staticdest="$destfile" - destfile= - ;; - *) - $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - ;; - esac - - # Install the libtool object if requested. - if test -n "$destfile"; then - $show "$install_prog $file $destfile" - $run eval "$install_prog $file $destfile" || exit $? - fi - - # Install the old object if enabled. - if test "$build_old_libs" = yes; then - # Deduce the name of the old-style object file. - staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` - - $show "$install_prog $staticobj $staticdest" - $run eval "$install_prog \$staticobj \$staticdest" || exit $? - fi - exit $EXIT_SUCCESS - ;; - - *) - # Figure out destination file name, if it wasn't already specified. - if test -n "$destname"; then - destfile="$destdir/$destname" - else - destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - destfile="$destdir/$destfile" - fi - - # If the file is missing, and there is a .exe on the end, strip it - # because it is most likely a libtool script we actually want to - # install - stripped_ext="" - case $file in - *.exe) - if test ! -f "$file"; then - file=`$echo $file|${SED} 's,.exe$,,'` - stripped_ext=".exe" - fi - ;; - esac - - # Do a test to see if this is really a libtool program. - case $host in - *cygwin*|*mingw*) - wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` - ;; - *) - wrapper=$file - ;; - esac - if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then - notinst_deplibs= - relink_command= - - # Note that it is not necessary on cygwin/mingw to append a dot to - # foo even if both foo and FILE.exe exist: automatic-append-.exe - # behavior happens only for exec(3), not for open(2)! Also, sourcing - # `FILE.' does not work on cygwin managed mounts. - # - # If there is no directory component, then add one. - case $wrapper in - */* | *\\*) . ${wrapper} ;; - *) . ./${wrapper} ;; - esac - - # Check the variables that should have been set. - if test -z "$notinst_deplibs"; then - $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 - exit $EXIT_FAILURE - fi - - finalize=yes - for lib in $notinst_deplibs; do - # Check to see that each library is installed. - libdir= - if test -f "$lib"; then - # If there is no directory component, then add one. - case $lib in - */* | *\\*) . $lib ;; - *) . ./$lib ;; - esac - fi - libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test - if test -n "$libdir" && test ! -f "$libfile"; then - $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 - finalize=no - fi - done - - relink_command= - # Note that it is not necessary on cygwin/mingw to append a dot to - # foo even if both foo and FILE.exe exist: automatic-append-.exe - # behavior happens only for exec(3), not for open(2)! Also, sourcing - # `FILE.' does not work on cygwin managed mounts. - # - # If there is no directory component, then add one. - case $wrapper in - */* | *\\*) . ${wrapper} ;; - *) . ./${wrapper} ;; - esac - - outputname= - if test "$fast_install" = no && test -n "$relink_command"; then - if test "$finalize" = yes && test -z "$run"; then - tmpdir=`func_mktempdir` - file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` - outputname="$tmpdir/$file" - # Replace the output file specification. - relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` - - $show "$relink_command" - if $run eval "$relink_command"; then : - else - $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 - ${rm}r "$tmpdir" - continue - fi - file="$outputname" - else - $echo "$modename: warning: cannot relink \`$file'" 1>&2 - fi - else - # Install the binary that we compiled earlier. - file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` - fi - fi - - # remove .exe since cygwin /usr/bin/install will append another - # one anyway - case $install_prog,$host in - */usr/bin/install*,*cygwin*) - case $file:$destfile in - *.exe:*.exe) - # this is ok - ;; - *.exe:*) - destfile=$destfile.exe - ;; - *:*.exe) - destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` - ;; - esac - ;; - esac - $show "$install_prog$stripme $file $destfile" - $run eval "$install_prog\$stripme \$file \$destfile" || exit $? - test -n "$outputname" && ${rm}r "$tmpdir" - ;; - esac - done - - for file in $staticlibs; do - name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - - # Set up the ranlib parameters. - oldlib="$destdir/$name" - - $show "$install_prog $file $oldlib" - $run eval "$install_prog \$file \$oldlib" || exit $? - - if test -n "$stripme" && test -n "$old_striplib"; then - $show "$old_striplib $oldlib" - $run eval "$old_striplib $oldlib" || exit $? - fi - - # Do each command in the postinstall commands. - cmds=$old_postinstall_cmds - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - done - - if test -n "$future_libdirs"; then - $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 - fi - - if test -n "$current_libdirs"; then - # Maybe just do a dry run. - test -n "$run" && current_libdirs=" -n$current_libdirs" - exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' - else - exit $EXIT_SUCCESS - fi - ;; - - # libtool finish mode - finish) - modename="$modename: finish" - libdirs="$nonopt" - admincmds= - - if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then - for dir - do - libdirs="$libdirs $dir" - done - - for libdir in $libdirs; do - if test -n "$finish_cmds"; then - # Do each command in the finish commands. - cmds=$finish_cmds - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" || admincmds="$admincmds - $cmd" - done - IFS="$save_ifs" - fi - if test -n "$finish_eval"; then - # Do the single finish_eval. - eval cmds=\"$finish_eval\" - $run eval "$cmds" || admincmds="$admincmds - $cmds" - fi - done - fi - - # Exit here if they wanted silent mode. - test "$show" = : && exit $EXIT_SUCCESS - - $echo "X----------------------------------------------------------------------" | $Xsed - $echo "Libraries have been installed in:" - for libdir in $libdirs; do - $echo " $libdir" - done - $echo - $echo "If you ever happen to want to link against installed libraries" - $echo "in a given directory, LIBDIR, you must either use libtool, and" - $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" - $echo "flag during linking and do at least one of the following:" - if test -n "$shlibpath_var"; then - $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" - $echo " during execution" - fi - if test -n "$runpath_var"; then - $echo " - add LIBDIR to the \`$runpath_var' environment variable" - $echo " during linking" - fi - if test -n "$hardcode_libdir_flag_spec"; then - libdir=LIBDIR - eval flag=\"$hardcode_libdir_flag_spec\" - - $echo " - use the \`$flag' linker flag" - fi - if test -n "$admincmds"; then - $echo " - have your system administrator run these commands:$admincmds" - fi - if test -f /etc/ld.so.conf; then - $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" - fi - $echo - $echo "See any operating system documentation about shared libraries for" - $echo "more information, such as the ld(1) and ld.so(8) manual pages." - $echo "X----------------------------------------------------------------------" | $Xsed - exit $EXIT_SUCCESS - ;; - - # libtool execute mode - execute) - modename="$modename: execute" - - # The first argument is the command name. - cmd="$nonopt" - if test -z "$cmd"; then - $echo "$modename: you must specify a COMMAND" 1>&2 - $echo "$help" - exit $EXIT_FAILURE - fi - - # Handle -dlopen flags immediately. - for file in $execute_dlfiles; do - if test ! -f "$file"; then - $echo "$modename: \`$file' is not a file" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - dir= - case $file in - *.la) - # Check to see that this really is a libtool archive. - if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : - else - $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - # Read the libtool library. - dlname= - library_names= - - # If there is no directory component, then add one. - case $file in - */* | *\\*) . $file ;; - *) . ./$file ;; - esac - - # Skip this library if it cannot be dlopened. - if test -z "$dlname"; then - # Warn if it was a shared library. - test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" - continue - fi - - dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` - test "X$dir" = "X$file" && dir=. - - if test -f "$dir/$objdir/$dlname"; then - dir="$dir/$objdir" - else - $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 - exit $EXIT_FAILURE - fi - ;; - - *.lo) - # Just add the directory containing the .lo file. - dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` - test "X$dir" = "X$file" && dir=. - ;; - - *) - $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 - continue - ;; - esac - - # Get the absolute pathname. - absdir=`cd "$dir" && pwd` - test -n "$absdir" && dir="$absdir" - - # Now add the directory to shlibpath_var. - if eval "test -z \"\$$shlibpath_var\""; then - eval "$shlibpath_var=\"\$dir\"" - else - eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" - fi - done - - # This variable tells wrapper scripts just to set shlibpath_var - # rather than running their programs. - libtool_execute_magic="$magic" - - # Check if any of the arguments is a wrapper script. - args= - for file - do - case $file in - -*) ;; - *) - # Do a test to see if this is really a libtool program. - if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - # If there is no directory component, then add one. - case $file in - */* | *\\*) . $file ;; - *) . ./$file ;; - esac - - # Transform arg to wrapped name. - file="$progdir/$program" - fi - ;; - esac - # Quote arguments (to preserve shell metacharacters). - file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` - args="$args \"$file\"" - done - - if test -z "$run"; then - if test -n "$shlibpath_var"; then - # Export the shlibpath_var. - eval "export $shlibpath_var" - fi - - # Restore saved environment variables - if test "${save_LC_ALL+set}" = set; then - LC_ALL="$save_LC_ALL"; export LC_ALL - fi - if test "${save_LANG+set}" = set; then - LANG="$save_LANG"; export LANG - fi - - # Now prepare to actually exec the command. - exec_cmd="\$cmd$args" - else - # Display what would be done. - if test -n "$shlibpath_var"; then - eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" - $echo "export $shlibpath_var" - fi - $echo "$cmd$args" - exit $EXIT_SUCCESS - fi - ;; - - # libtool clean and uninstall mode - clean | uninstall) - modename="$modename: $mode" - rm="$nonopt" - files= - rmforce= - exit_status=0 - - # This variable tells wrapper scripts just to set variables rather - # than running their programs. - libtool_install_magic="$magic" - - for arg - do - case $arg in - -f) rm="$rm $arg"; rmforce=yes ;; - -*) rm="$rm $arg" ;; - *) files="$files $arg" ;; - esac - done - - if test -z "$rm"; then - $echo "$modename: you must specify an RM program" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - rmdirs= - - origobjdir="$objdir" - for file in $files; do - dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` - if test "X$dir" = "X$file"; then - dir=. - objdir="$origobjdir" - else - objdir="$dir/$origobjdir" - fi - name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - test "$mode" = uninstall && objdir="$dir" - - # Remember objdir for removal later, being careful to avoid duplicates - if test "$mode" = clean; then - case " $rmdirs " in - *" $objdir "*) ;; - *) rmdirs="$rmdirs $objdir" ;; - esac - fi - - # Don't error if the file doesn't exist and rm -f was used. - if (test -L "$file") >/dev/null 2>&1 \ - || (test -h "$file") >/dev/null 2>&1 \ - || test -f "$file"; then - : - elif test -d "$file"; then - exit_status=1 - continue - elif test "$rmforce" = yes; then - continue - fi - - rmfiles="$file" - - case $name in - *.la) - # Possibly a libtool archive, so verify it. - if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - . $dir/$name - - # Delete the libtool libraries and symlinks. - for n in $library_names; do - rmfiles="$rmfiles $objdir/$n" - done - test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" - - case "$mode" in - clean) - case " $library_names " in - # " " in the beginning catches empty $dlname - *" $dlname "*) ;; - *) rmfiles="$rmfiles $objdir/$dlname" ;; - esac - test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" - ;; - uninstall) - if test -n "$library_names"; then - # Do each command in the postuninstall commands. - cmds=$postuninstall_cmds - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" - if test "$?" -ne 0 && test "$rmforce" != yes; then - exit_status=1 - fi - done - IFS="$save_ifs" - fi - - if test -n "$old_library"; then - # Do each command in the old_postuninstall commands. - cmds=$old_postuninstall_cmds - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" - if test "$?" -ne 0 && test "$rmforce" != yes; then - exit_status=1 - fi - done - IFS="$save_ifs" - fi - # FIXME: should reinstall the best remaining shared library. - ;; - esac - fi - ;; - - *.lo) - # Possibly a libtool object, so verify it. - if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - - # Read the .lo file - . $dir/$name - - # Add PIC object to the list of files to remove. - if test -n "$pic_object" \ - && test "$pic_object" != none; then - rmfiles="$rmfiles $dir/$pic_object" - fi - - # Add non-PIC object to the list of files to remove. - if test -n "$non_pic_object" \ - && test "$non_pic_object" != none; then - rmfiles="$rmfiles $dir/$non_pic_object" - fi - fi - ;; - - *) - if test "$mode" = clean ; then - noexename=$name - case $file in - *.exe) - file=`$echo $file|${SED} 's,.exe$,,'` - noexename=`$echo $name|${SED} 's,.exe$,,'` - # $file with .exe has already been added to rmfiles, - # add $file without .exe - rmfiles="$rmfiles $file" - ;; - esac - # Do a test to see if this is a libtool program. - if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - relink_command= - . $dir/$noexename - - # note $name still contains .exe if it was in $file originally - # as does the version of $file that was added into $rmfiles - rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" - if test "$fast_install" = yes && test -n "$relink_command"; then - rmfiles="$rmfiles $objdir/lt-$name" - fi - if test "X$noexename" != "X$name" ; then - rmfiles="$rmfiles $objdir/lt-${noexename}.c" - fi - fi - fi - ;; - esac - $show "$rm $rmfiles" - $run $rm $rmfiles || exit_status=1 - done - objdir="$origobjdir" - - # Try to remove the ${objdir}s in the directories where we deleted files - for dir in $rmdirs; do - if test -d "$dir"; then - $show "rmdir $dir" - $run rmdir $dir >/dev/null 2>&1 - fi - done - - exit $exit_status - ;; - - "") - $echo "$modename: you must specify a MODE" 1>&2 - $echo "$generic_help" 1>&2 - exit $EXIT_FAILURE - ;; - esac - - if test -z "$exec_cmd"; then - $echo "$modename: invalid operation mode \`$mode'" 1>&2 - $echo "$generic_help" 1>&2 - exit $EXIT_FAILURE - fi -fi # test -z "$show_help" - -if test -n "$exec_cmd"; then - eval exec $exec_cmd - exit $EXIT_FAILURE -fi - -# We need to display help for each of the modes. -case $mode in -"") $echo \ -"Usage: $modename [OPTION]... [MODE-ARG]... - -Provide generalized library-building support services. - - --config show all configuration variables - --debug enable verbose shell tracing --n, --dry-run display commands without modifying any files - --features display basic configuration information and exit - --finish same as \`--mode=finish' - --help display this help message and exit - --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] - --quiet same as \`--silent' - --silent don't print informational messages - --tag=TAG use configuration variables from tag TAG - --version print version information - -MODE must be one of the following: - - clean remove files from the build directory - compile compile a source file into a libtool object - execute automatically set library path, then run a program - finish complete the installation of libtool libraries - install install libraries or executables - link create a library or an executable - uninstall remove libraries from an installed directory - -MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for -a more detailed description of MODE. - -Report bugs to ." - exit $EXIT_SUCCESS - ;; - -clean) - $echo \ -"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... - -Remove files from the build directory. - -RM is the name of the program to use to delete files associated with each FILE -(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed -to RM. - -If FILE is a libtool library, object or program, all the files associated -with it are deleted. Otherwise, only FILE itself is deleted using RM." - ;; - -compile) - $echo \ -"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE - -Compile a source file into a libtool library object. - -This mode accepts the following additional options: - - -o OUTPUT-FILE set the output file name to OUTPUT-FILE - -prefer-pic try to building PIC objects only - -prefer-non-pic try to building non-PIC objects only - -static always build a \`.o' file suitable for static linking - -COMPILE-COMMAND is a command to be used in creating a \`standard' object file -from the given SOURCEFILE. - -The output file name is determined by removing the directory component from -SOURCEFILE, then substituting the C source code suffix \`.c' with the -library object suffix, \`.lo'." - ;; - -execute) - $echo \ -"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... - -Automatically set library path, then run a program. - -This mode accepts the following additional options: - - -dlopen FILE add the directory containing FILE to the library path - -This mode sets the library path environment variable according to \`-dlopen' -flags. - -If any of the ARGS are libtool executable wrappers, then they are translated -into their corresponding uninstalled binary, and any of their required library -directories are added to the library path. - -Then, COMMAND is executed, with ARGS as arguments." - ;; - -finish) - $echo \ -"Usage: $modename [OPTION]... --mode=finish [LIBDIR]... - -Complete the installation of libtool libraries. - -Each LIBDIR is a directory that contains libtool libraries. - -The commands that this mode executes may require superuser privileges. Use -the \`--dry-run' option if you just want to see what would be executed." - ;; - -install) - $echo \ -"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... - -Install executables or libraries. - -INSTALL-COMMAND is the installation command. The first component should be -either the \`install' or \`cp' program. - -The rest of the components are interpreted as arguments to that command (only -BSD-compatible install options are recognized)." - ;; - -link) - $echo \ -"Usage: $modename [OPTION]... --mode=link LINK-COMMAND... - -Link object files or libraries together to form another library, or to -create an executable program. - -LINK-COMMAND is a command using the C compiler that you would use to create -a program from several object files. - -The following components of LINK-COMMAND are treated specially: - - -all-static do not do any dynamic linking at all - -avoid-version do not add a version suffix if possible - -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime - -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols - -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) - -export-symbols SYMFILE - try to export only the symbols listed in SYMFILE - -export-symbols-regex REGEX - try to export only the symbols matching REGEX - -LLIBDIR search LIBDIR for required installed libraries - -lNAME OUTPUT-FILE requires the installed library libNAME - -module build a library that can dlopened - -no-fast-install disable the fast-install mode - -no-install link a not-installable executable - -no-undefined declare that a library does not refer to external symbols - -o OUTPUT-FILE create OUTPUT-FILE from the specified objects - -objectlist FILE Use a list of object files found in FILE to specify objects - -precious-files-regex REGEX - don't remove output files matching REGEX - -release RELEASE specify package release information - -rpath LIBDIR the created library will eventually be installed in LIBDIR - -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries - -static do not do any dynamic linking of libtool libraries - -version-info CURRENT[:REVISION[:AGE]] - specify library version info [each variable defaults to 0] - -All other options (arguments beginning with \`-') are ignored. - -Every other argument is treated as a filename. Files ending in \`.la' are -treated as uninstalled libtool libraries, other files are standard or library -object files. - -If the OUTPUT-FILE ends in \`.la', then a libtool library is created, -only library objects (\`.lo' files) may be specified, and \`-rpath' is -required, except when creating a convenience library. - -If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created -using \`ar' and \`ranlib', or on Windows using \`lib'. - -If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file -is created, otherwise an executable program is created." - ;; - -uninstall) - $echo \ -"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... - -Remove libraries from an installation directory. - -RM is the name of the program to use to delete files associated with each FILE -(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed -to RM. - -If FILE is a libtool library, all the files associated with it are deleted. -Otherwise, only FILE itself is deleted using RM." - ;; - -*) - $echo "$modename: invalid operation mode \`$mode'" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - ;; -esac - -$echo -$echo "Try \`$modename --help' for more information about other modes." - -exit $? - -# The TAGs below are defined such that we never get into a situation -# in which we disable both kinds of libraries. Given conflicting -# choices, we go for a static library, that is the most portable, -# since we can't tell whether shared libraries were disabled because -# the user asked for that or because the platform doesn't support -# them. This is particularly important on AIX, because we don't -# support having both static and shared libraries enabled at the same -# time on that platform, so we default to a shared-only configuration. -# If a disable-shared tag is given, we'll fallback to a static-only -# configuration. But we'll never go from static-only to shared-only. - -# ### BEGIN LIBTOOL TAG CONFIG: disable-shared -disable_libs=shared -# ### END LIBTOOL TAG CONFIG: disable-shared - -# ### BEGIN LIBTOOL TAG CONFIG: disable-static -disable_libs=static -# ### END LIBTOOL TAG CONFIG: disable-static - -# Local Variables: -# mode:shell-script -# sh-indentation:2 -# End: diff --git a/autoconf/m4/build_exeext.m4 b/autoconf/m4/build_exeext.m4 deleted file mode 100644 index 1bdecc1ba..000000000 --- a/autoconf/m4/build_exeext.m4 +++ /dev/null @@ -1,42 +0,0 @@ -# Check for the extension used for executables on build platform. -# This is necessary for cross-compiling where the build platform -# may differ from the host platform. -AC_DEFUN([AC_BUILD_EXEEXT], -[ -AC_MSG_CHECKING([for executable suffix on build platform]) -AC_CACHE_VAL(ac_cv_build_exeext, -[if test "$CYGWIN" = yes || test "$MINGW32" = yes; then - ac_cv_build_exeext=.exe -else - ac_build_prefix=${build_alias}- - - AC_CHECK_PROG(BUILD_CC, ${ac_build_prefix}gcc, ${ac_build_prefix}gcc) - if test -z "$BUILD_CC"; then - AC_CHECK_PROG(BUILD_CC, gcc, gcc) - if test -z "$BUILD_CC"; then - AC_CHECK_PROG(BUILD_CC, cc, cc, , , /usr/ucb/cc) - fi - fi - test -z "$BUILD_CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH]) - ac_build_link='${BUILD_CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&AS_MESSAGE_LOG_FD' - rm -f conftest* - echo 'int main () { return 0; }' > conftest.$ac_ext - ac_cv_build_exeext= - if AC_TRY_EVAL(ac_build_link); then - for file in conftest.*; do - case $file in - *.c | *.o | *.obj | *.dSYM) ;; - *) ac_cv_build_exeext=`echo $file | sed -e s/conftest//` ;; - esac - done - else - AC_MSG_ERROR([installation or configuration problem: compiler cannot create executables.]) - fi - rm -f conftest* - test x"${ac_cv_build_exeext}" = x && ac_cv_build_exeext=blank -fi]) -BUILD_EXEEXT="" -test x"${ac_cv_build_exeext}" != xblank && BUILD_EXEEXT=${ac_cv_build_exeext} -AC_MSG_RESULT(${ac_cv_build_exeext}) -ac_build_exeext=$BUILD_EXEEXT -AC_SUBST(BUILD_EXEEXT)]) diff --git a/autoconf/m4/c_printf_a.m4 b/autoconf/m4/c_printf_a.m4 deleted file mode 100644 index 61bac8c9d..000000000 --- a/autoconf/m4/c_printf_a.m4 +++ /dev/null @@ -1,31 +0,0 @@ -# -# Determine if the printf() functions have the %a format character. -# This is modified from: -# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_slist.html -AC_DEFUN([AC_C_PRINTF_A], -[AC_CACHE_CHECK([if printf has the %a format character],[llvm_cv_c_printf_a], -[AC_LANG_PUSH([C]) - AC_RUN_IFELSE([ - AC_LANG_PROGRAM([[ -#include -#include -]],[[ -volatile double A, B; -char Buffer[100]; -A = 1; -A /= 10.0; -sprintf(Buffer, "%a", A); -B = atof(Buffer); -if (A != B) - return (1); -if (A != 0x1.999999999999ap-4) - return (1); -return (0);]])], - llvm_cv_c_printf_a=yes, - llvmac_cv_c_printf_a=no, - llvmac_cv_c_printf_a=no) - AC_LANG_POP([C])]) - if test "$llvm_cv_c_printf_a" = "yes"; then - AC_DEFINE([HAVE_PRINTF_A],[1],[Define to have the %a format string]) - fi -]) diff --git a/autoconf/m4/check_gnu_make.m4 b/autoconf/m4/check_gnu_make.m4 deleted file mode 100644 index 7355e1c85..000000000 --- a/autoconf/m4/check_gnu_make.m4 +++ /dev/null @@ -1,26 +0,0 @@ -# -# Check for GNU Make. This is originally from -# http://www.gnu.org/software/ac-archive/htmldoc/check_gnu_make.html -# -AC_DEFUN([AC_CHECK_GNU_MAKE], -[AC_CACHE_CHECK([for GNU make],[llvm_cv_gnu_make_command], -dnl Search all the common names for GNU make -[llvm_cv_gnu_make_command='' - for a in "$MAKE" make gmake gnumake ; do - if test -z "$a" ; then continue ; fi ; - if ( sh -c "$a --version" 2> /dev/null | grep GNU 2>&1 > /dev/null ) - then - llvm_cv_gnu_make_command=$a ; - break; - fi - done]) -dnl If there was a GNU version, then set @ifGNUmake@ to the empty string, -dnl '#' otherwise - if test "x$llvm_cv_gnu_make_command" != "x" ; then - ifGNUmake='' ; - else - ifGNUmake='#' ; - AC_MSG_RESULT("Not found"); - fi - AC_SUBST(ifGNUmake) -]) diff --git a/autoconf/m4/config_makefile.m4 b/autoconf/m4/config_makefile.m4 deleted file mode 100644 index b1eaffdcd..000000000 --- a/autoconf/m4/config_makefile.m4 +++ /dev/null @@ -1,9 +0,0 @@ -# -# Configure a Makefile without clobbering it if it exists and is not out of -# date. This macro is unique to LLVM. -# -AC_DEFUN([AC_CONFIG_MAKEFILE], -[AC_CONFIG_COMMANDS($1, - [${llvm_src}/autoconf/mkinstalldirs `dirname $1` - ${SHELL} ${llvm_src}/autoconf/install-sh -m 0644 -c ${srcdir}/$1 $1]) -]) diff --git a/autoconf/m4/config_project.m4 b/autoconf/m4/config_project.m4 deleted file mode 100644 index eea7faf16..000000000 --- a/autoconf/m4/config_project.m4 +++ /dev/null @@ -1,14 +0,0 @@ -# -# Provide the arguments and other processing needed for an LLVM project -# -AC_DEFUN([LLVM_CONFIG_PROJECT], - [AC_ARG_WITH([llvmsrc], - AS_HELP_STRING([--with-llvmsrc],[Location of LLVM Source Code]), - [llvm_src="$withval"],[llvm_src="]$1["]) - AC_SUBST(LLVM_SRC,$llvm_src) - AC_ARG_WITH([llvmobj], - AS_HELP_STRING([--with-llvmobj],[Location of LLVM Object Code]), - [llvm_obj="$withval"],[llvm_obj="]$2["]) - AC_SUBST(LLVM_OBJ,$llvm_obj) - AC_CONFIG_COMMANDS([setup],,[llvm_src="${LLVM_SRC}"]) -]) diff --git a/autoconf/m4/cxx_flag_check.m4 b/autoconf/m4/cxx_flag_check.m4 deleted file mode 100644 index 62454b714..000000000 --- a/autoconf/m4/cxx_flag_check.m4 +++ /dev/null @@ -1,2 +0,0 @@ -AC_DEFUN([CXX_FLAG_CHECK], - [AC_SUBST($1, `$CXX -Werror $2 -fsyntax-only -xc /dev/null 2>/dev/null && echo $2`)]) diff --git a/autoconf/m4/find_std_program.m4 b/autoconf/m4/find_std_program.m4 deleted file mode 100644 index c789df8e6..000000000 --- a/autoconf/m4/find_std_program.m4 +++ /dev/null @@ -1,118 +0,0 @@ -dnl Check for a standard program that has a bin, include and lib directory -dnl -dnl Parameters: -dnl $1 - prefix directory to check -dnl $2 - program name to check -dnl $3 - header file to check -dnl $4 - library file to check -AC_DEFUN([CHECK_STD_PROGRAM], -[m4_define([allcapsname],translit($2,a-z,A-Z)) -if test -n "$1" -a -d "$1" -a -n "$2" -a -d "$1/bin" -a -x "$1/bin/$2" ; then - AC_SUBST([USE_]allcapsname(),["USE_]allcapsname()[ = 1"]) - AC_SUBST(allcapsname(),[$1/bin/$2]) - AC_SUBST(allcapsname()[_BIN],[$1/bin]) - AC_SUBST(allcapsname()[_DIR],[$1]) - if test -n "$3" -a -d "$1/include" -a -f "$1/include/$3" ; then - AC_SUBST(allcapsname()[_INC],[$1/include]) - fi - if test -n "$4" -a -d "$1/lib" -a -f "$1/lib/$4" ; then - AC_SUBST(allcapsname()[_LIB],[$1/lib]) - fi -fi -]) - -dnl Find a program via --with options, in the path, or well known places -dnl -dnl Parameters: -dnl $1 - program's executable name -dnl $2 - header file name to check (optional) -dnl $3 - library file name to check (optional) -dnl $4 - alternate (long) name for the program -AC_DEFUN([FIND_STD_PROGRAM], -[m4_define([allcapsname],translit($1,a-z,A-Z)) -m4_define([stdprog_long_name],ifelse($4,,translit($1,[ !@#$%^&*()-+={}[]:;"',./?],[-]),translit($4,[ !@#$%^&*()-+={}[]:;"',./?],[-]))) -AC_MSG_CHECKING([for ]stdprog_long_name()[ bin/lib/include locations]) -AC_ARG_WITH($1, - AS_HELP_STRING([--with-]stdprog_long_name()[=DIR], - [Specify that the ]stdprog_long_name()[ install prefix is DIR]), - $1[pfxdir=$withval],$1[pfxdir=nada]) -AC_ARG_WITH($1[-bin], - AS_HELP_STRING([--with-]stdprog_long_name()[-bin=DIR], - [Specify that the ]stdprog_long_name()[ binary is in DIR]), - $1[bindir=$withval],$1[bindir=nada]) -AC_ARG_WITH($1[-lib], - AS_HELP_STRING([--with-]stdprog_long_name()[-lib=DIR], - [Specify that ]stdprog_long_name()[ libraries are in DIR]), - $1[libdir=$withval],$1[libdir=nada]) -AC_ARG_WITH($1[-inc], - AS_HELP_STRING([--with-]stdprog_long_name()[-inc=DIR], - [Specify that the ]stdprog_long_name()[ includes are in DIR]), - $1[incdir=$withval],$1[incdir=nada]) -eval pfxval=\$\{$1pfxdir\} -eval binval=\$\{$1bindir\} -eval incval=\$\{$1incdir\} -eval libval=\$\{$1libdir\} -if test "${pfxval}" != "nada" ; then - CHECK_STD_PROGRAM(${pfxval},$1,$2,$3) -elif test "${binval}" != "nada" ; then - if test "${libval}" != "nada" ; then - if test "${incval}" != "nada" ; then - if test -d "${binval}" ; then - if test -d "${incval}" ; then - if test -d "${libval}" ; then - AC_SUBST(allcapsname(),${binval}/$1) - AC_SUBST(allcapsname()[_BIN],${binval}) - AC_SUBST(allcapsname()[_INC],${incval}) - AC_SUBST(allcapsname()[_LIB],${libval}) - AC_SUBST([USE_]allcapsname(),["USE_]allcapsname()[ = 1"]) - AC_MSG_RESULT([found via --with options]) - else - AC_MSG_RESULT([failed]) - AC_MSG_ERROR([The --with-]$1[-libdir value must be a directory]) - fi - else - AC_MSG_RESULT([failed]) - AC_MSG_ERROR([The --with-]$1[-incdir value must be a directory]) - fi - else - AC_MSG_RESULT([failed]) - AC_MSG_ERROR([The --with-]$1[-bindir value must be a directory]) - fi - else - AC_MSG_RESULT([failed]) - AC_MSG_ERROR([The --with-]$1[-incdir option must be specified]) - fi - else - AC_MSG_RESULT([failed]) - AC_MSG_ERROR([The --with-]$1[-libdir option must be specified]) - fi -else - tmppfxdir=`which $1 2>&1` - if test -n "$tmppfxdir" -a -d "${tmppfxdir%*$1}" -a \ - -d "${tmppfxdir%*$1}/.." ; then - tmppfxdir=`cd "${tmppfxdir%*$1}/.." ; pwd` - CHECK_STD_PROGRAM($tmppfxdir,$1,$2,$3) - AC_MSG_RESULT([found in PATH at ]$tmppfxdir) - else - checkresult="yes" - eval checkval=\$\{"USE_"allcapsname()\} - CHECK_STD_PROGRAM([/usr],$1,$2,$3) - if test -z "${checkval}" ; then - CHECK_STD_PROGRAM([/usr/local],$1,$2,$3) - if test -z "${checkval}" ; then - CHECK_STD_PROGRAM([/sw],$1,$2,$3) - if test -z "${checkval}" ; then - CHECK_STD_PROGRAM([/opt],$1,$2,$3) - if test -z "${checkval}" ; then - CHECK_STD_PROGRAM([/],$1,$2,$3) - if test -z "${checkval}" ; then - checkresult="no" - fi - fi - fi - fi - fi - AC_MSG_RESULT($checkresult) - fi -fi -]) diff --git a/autoconf/m4/func_isinf.m4 b/autoconf/m4/func_isinf.m4 deleted file mode 100644 index 22ba81d54..000000000 --- a/autoconf/m4/func_isinf.m4 +++ /dev/null @@ -1,36 +0,0 @@ -# -# This function determins if the isinf function isavailable on this -# platform. -# -AC_DEFUN([AC_FUNC_ISINF],[ -AC_SINGLE_CXX_CHECK([ac_cv_func_isinf_in_math_h], - [isinf], [], - [float f; isinf(f);]) -if test "$ac_cv_func_isinf_in_math_h" = "yes" ; then - AC_DEFINE([HAVE_ISINF_IN_MATH_H],1,[Set to 1 if the isinf function is found in ]) -fi - -AC_SINGLE_CXX_CHECK([ac_cv_func_isinf_in_cmath], - [isinf], [], - [float f; isinf(f);]) -if test "$ac_cv_func_isinf_in_cmath" = "yes" ; then - AC_DEFINE([HAVE_ISINF_IN_CMATH],1,[Set to 1 if the isinf function is found in ]) -fi - -AC_SINGLE_CXX_CHECK([ac_cv_func_std_isinf_in_cmath], - [std::isinf], [], - [float f; std::isinf(f);]) -if test "$ac_cv_func_std_isinf_in_cmath" = "yes" ; then - AC_DEFINE([HAVE_STD_ISINF_IN_CMATH],1,[Set to 1 if the std::isinf function is found in ]) -fi - -AC_SINGLE_CXX_CHECK([ac_cv_func_finite_in_ieeefp_h], - [finite], [], - [float f; finite(f);]) -if test "$ac_cv_func_finite_in_ieeefp_h" = "yes" ; then - AC_DEFINE([HAVE_FINITE_IN_IEEEFP_H],1,[Set to 1 if the finite function is found in ]) -fi - -]) - - diff --git a/autoconf/m4/func_isnan.m4 b/autoconf/m4/func_isnan.m4 deleted file mode 100644 index eb5ca0dae..000000000 --- a/autoconf/m4/func_isnan.m4 +++ /dev/null @@ -1,27 +0,0 @@ -# -# This function determines if the isnan function is available on this -# platform. -# -AC_DEFUN([AC_FUNC_ISNAN],[ -AC_SINGLE_CXX_CHECK([ac_cv_func_isnan_in_math_h], - [isnan], [], - [float f; isnan(f);]) - -if test "$ac_cv_func_isnan_in_math_h" = "yes" ; then - AC_DEFINE([HAVE_ISNAN_IN_MATH_H],1,[Set to 1 if the isnan function is found in ]) -fi - -AC_SINGLE_CXX_CHECK([ac_cv_func_isnan_in_cmath], - [isnan], [], - [float f; isnan(f);]) -if test "$ac_cv_func_isnan_in_cmath" = "yes" ; then - AC_DEFINE([HAVE_ISNAN_IN_CMATH],1,[Set to 1 if the isnan function is found in ]) -fi - -AC_SINGLE_CXX_CHECK([ac_cv_func_std_isnan_in_cmath], - [std::isnan], [], - [float f; std::isnan(f);]) -if test "$ac_cv_func_std_isnan_in_cmath" = "yes" ; then - AC_DEFINE([HAVE_STD_ISNAN_IN_CMATH],1,[Set to 1 if the std::isnan function is found in ]) -fi -]) diff --git a/autoconf/m4/func_mmap_file.m4 b/autoconf/m4/func_mmap_file.m4 deleted file mode 100644 index 372c87fbe..000000000 --- a/autoconf/m4/func_mmap_file.m4 +++ /dev/null @@ -1,26 +0,0 @@ -# -# Check for the ability to mmap a file. -# -AC_DEFUN([AC_FUNC_MMAP_FILE], -[AC_CACHE_CHECK(for mmap of files, -ac_cv_func_mmap_file, -[ AC_LANG_PUSH([C]) - AC_RUN_IFELSE([ - AC_LANG_PROGRAM([[ -#include -#include -#include -]],[[ - int fd; - fd = creat ("foo",0777); - fd = (int) mmap (0, 1, PROT_READ, MAP_SHARED, fd, 0); - unlink ("foo"); - return (fd != (int) MAP_FAILED);]])], - [ac_cv_func_mmap_file=yes],[ac_cv_func_mmap_file=no],[ac_cv_func_mmap_file=no]) - AC_LANG_POP([C]) -]) -if test "$ac_cv_func_mmap_file" = yes; then - AC_DEFINE([HAVE_MMAP_FILE],[],[Define if mmap() can map files into memory]) - AC_SUBST(MMAP_FILE,[yes]) -fi -]) diff --git a/autoconf/m4/header_mmap_anonymous.m4 b/autoconf/m4/header_mmap_anonymous.m4 deleted file mode 100644 index 2270d2955..000000000 --- a/autoconf/m4/header_mmap_anonymous.m4 +++ /dev/null @@ -1,21 +0,0 @@ -# -# Check for anonymous mmap macros. This is modified from -# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_slist.html -# -AC_DEFUN([AC_HEADER_MMAP_ANONYMOUS], -[AC_CACHE_CHECK(for MAP_ANONYMOUS vs. MAP_ANON, -ac_cv_header_mmap_anon, -[ AC_LANG_PUSH([C]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM( - [[#include -#include -#include ]], - [[mmap (0, 1, PROT_READ, MAP_ANONYMOUS, -1, 0); return (0);]])], - ac_cv_header_mmap_anon=yes, - ac_cv_header_mmap_anon=no) - AC_LANG_POP([C]) -]) -if test "$ac_cv_header_mmap_anon" = yes; then - AC_DEFINE([HAVE_MMAP_ANONYMOUS],[1],[Define if mmap() uses MAP_ANONYMOUS to map anonymous pages, or undefine if it uses MAP_ANON]) -fi -]) diff --git a/autoconf/m4/huge_val.m4 b/autoconf/m4/huge_val.m4 deleted file mode 100644 index 6c9a22eab..000000000 --- a/autoconf/m4/huge_val.m4 +++ /dev/null @@ -1,20 +0,0 @@ -# -# This function determins if the HUGE_VAL macro is compilable with the -# -pedantic switch or not. XCode < 2.4.1 doesn't get it right. -# -AC_DEFUN([AC_HUGE_VAL_CHECK],[ - AC_CACHE_CHECK([for HUGE_VAL sanity], [ac_cv_huge_val_sanity],[ - AC_LANG_PUSH([C++]) - ac_save_CXXFLAGS=$CXXFLAGS - CXXFLAGS="$CXXFLAGS -pedantic" - AC_RUN_IFELSE( - AC_LANG_PROGRAM( - [#include ], - [double x = HUGE_VAL; return x != x; ]), - [ac_cv_huge_val_sanity=yes],[ac_cv_huge_val_sanity=no], - [ac_cv_huge_val_sanity=yes]) - CXXFLAGS=$ac_save_CXXFLAGS - AC_LANG_POP([C++]) - ]) - AC_SUBST(HUGE_VAL_SANITY,$ac_cv_huge_val_sanity) -]) diff --git a/autoconf/m4/libtool.m4 b/autoconf/m4/libtool.m4 deleted file mode 100644 index b8bd4b803..000000000 --- a/autoconf/m4/libtool.m4 +++ /dev/null @@ -1,6389 +0,0 @@ -# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- -## Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005 -## Free Software Foundation, Inc. -## Originally by Gordon Matzigkeit , 1996 -## -## This file is free software; the Free Software Foundation gives -## unlimited permission to copy and/or distribute it, with or without -## modifications, as long as this notice is preserved. - -# serial 48 AC_PROG_LIBTOOL - - -# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED) -# ----------------------------------------------------------- -# If this macro is not defined by Autoconf, define it here. -m4_ifdef([AC_PROVIDE_IFELSE], - [], - [m4_define([AC_PROVIDE_IFELSE], - [m4_ifdef([AC_PROVIDE_$1], - [$2], [$3])])]) - - -# AC_PROG_LIBTOOL -# --------------- -AC_DEFUN([AC_PROG_LIBTOOL], -[AC_REQUIRE([_AC_PROG_LIBTOOL])dnl -dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX -dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX. - AC_PROVIDE_IFELSE([AC_PROG_CXX], - [AC_LIBTOOL_CXX], - [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX - ])]) -dnl And a similar setup for Fortran 77 support - AC_PROVIDE_IFELSE([AC_PROG_F77], - [AC_LIBTOOL_F77], - [define([AC_PROG_F77], defn([AC_PROG_F77])[AC_LIBTOOL_F77 -])]) - -dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly. -dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run -dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both. - AC_PROVIDE_IFELSE([AC_PROG_GCJ], - [AC_LIBTOOL_GCJ], - [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], - [AC_LIBTOOL_GCJ], - [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ], - [AC_LIBTOOL_GCJ], - [ifdef([AC_PROG_GCJ], - [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ])]) - ifdef([A][M_PROG_GCJ], - [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ])]) - ifdef([LT_AC_PROG_GCJ], - [define([LT_AC_PROG_GCJ], - defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])])]) -])])# AC_PROG_LIBTOOL - - -# _AC_PROG_LIBTOOL -# ---------------- -AC_DEFUN([_AC_PROG_LIBTOOL], -[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl -AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl -AC_BEFORE([$0],[AC_LIBTOOL_F77])dnl -AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl - -# This can be used to rebuild libtool when needed -LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" - -# Always use our own libtool. -LIBTOOL='$(SHELL) $(top_builddir)/mklib' -AC_SUBST(LIBTOOL)dnl - -# Prevent multiple expansion -define([AC_PROG_LIBTOOL], []) -])# _AC_PROG_LIBTOOL - - -# AC_LIBTOOL_SETUP -# ---------------- -AC_DEFUN([AC_LIBTOOL_SETUP], -[AC_PREREQ(2.60)dnl -AC_REQUIRE([AC_ENABLE_SHARED])dnl -AC_REQUIRE([AC_ENABLE_STATIC])dnl -AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl -AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_PROG_LD])dnl -AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl -AC_REQUIRE([AC_PROG_NM])dnl - -AC_REQUIRE([AC_PROG_LN_S])dnl -AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl -# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! -AC_REQUIRE([AC_OBJEXT])dnl -AC_REQUIRE([AC_EXEEXT])dnl -dnl - -AC_LIBTOOL_SYS_MAX_CMD_LEN -AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE -AC_LIBTOOL_OBJDIR - -AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl -_LT_AC_PROG_ECHO_BACKSLASH - -case $host_os in -aix3*) - # AIX sometimes has problems with the GCC collect2 program. For some - # reason, if we set the COLLECT_NAMES environment variable, the problems - # vanish in a puff of smoke. - if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES - fi - ;; -esac - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed='sed -e 1s/^X//' -[sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'] - -# Same as above, but do not quote variable references. -[double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g'] - -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - -# Sed substitution to avoid accidental globbing in evaled expressions -no_glob_subst='s/\*/\\\*/g' - -# Constants: -rm="rm -f" - -# Global variables: -default_ofile=mklib -can_build_shared=yes - -# All known linkers require a `.a' archive for static linking (except MSVC, -# which needs '.lib'). -libext=a -ltmain="$ac_aux_dir/ltmain.sh" -ofile="$default_ofile" -with_gnu_ld="$lt_cv_prog_gnu_ld" - -AC_CHECK_TOOL(AR, ar, false) -AC_CHECK_TOOL(RANLIB, ranlib, :) -AC_CHECK_TOOL(STRIP, strip, :) - -old_CC="$CC" -old_CFLAGS="$CFLAGS" - -# Set sane defaults for various variables -test -z "$AR" && AR=ar -test -z "$AR_FLAGS" && AR_FLAGS=cru -test -z "$AS" && AS=as -test -z "$CC" && CC=cc -test -z "$LTCC" && LTCC=$CC -test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS -test -z "$DLLTOOL" && DLLTOOL=dlltool -test -z "$LD" && LD=ld -test -z "$LN_S" && LN_S="ln -s" -test -z "$MAGIC_CMD" && MAGIC_CMD=file -test -z "$NM" && NM=nm -test -z "$SED" && SED=sed -test -z "$OBJDUMP" && OBJDUMP=objdump -test -z "$RANLIB" && RANLIB=: -test -z "$STRIP" && STRIP=: -test -z "$ac_objext" && ac_objext=o - -# Determine commands to create old-style static archives. -old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' -old_postinstall_cmds='chmod 644 $oldlib' -old_postuninstall_cmds= - -if test -n "$RANLIB"; then - case $host_os in - openbsd*) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" - ;; - *) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" - ;; - esac - old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" -fi - -_LT_CC_BASENAME([$compiler]) - -# Only perform the check for file, if the check method requires it -case $deplibs_check_method in -file_magic*) - if test "$file_magic_cmd" = '$MAGIC_CMD'; then - AC_PATH_MAGIC - fi - ;; -esac - -AC_PROVIDE_IFELSE([AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no) -AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], -enable_win32_dll=yes, enable_win32_dll=no) - -AC_ARG_ENABLE([libtool-lock], - [AS_HELP_STRING([--disable-libtool-lock],[avoid locking (might break parallel builds)])]) -test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes - -AC_ARG_WITH([pic], - [AS_HELP_STRING([--with-pic],[try to use only PIC/non-PIC objects @<:@default=use both@:>@])], - [pic_mode="$withval"], - [pic_mode=default]) -test -z "$pic_mode" && pic_mode=default - -# Use C for the default configuration in the libtool script -tagname= -AC_LIBTOOL_LANG_C_CONFIG -_LT_AC_TAGCONFIG -])# AC_LIBTOOL_SETUP - - -# _LT_AC_SYS_COMPILER -# ------------------- -AC_DEFUN([_LT_AC_SYS_COMPILER], -[AC_REQUIRE([AC_PROG_CC])dnl - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# If no C compiler flags were specified, use CFLAGS. -LTCFLAGS=${LTCFLAGS-"$CFLAGS"} - -# Allow CC to be a program name with arguments. -compiler=$CC -])# _LT_AC_SYS_COMPILER - - -# _LT_CC_BASENAME(CC) -# ------------------- -# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. -AC_DEFUN([_LT_CC_BASENAME], -[for cc_temp in $1""; do - case $cc_temp in - compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; - distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` -]) - - -# _LT_COMPILER_BOILERPLATE -# ------------------------ -# Check for compiler boilerplate output or warnings with -# the simple compiler test code. -AC_DEFUN([_LT_COMPILER_BOILERPLATE], -[ac_outfile=conftest.$ac_objext -printf "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$rm conftest* -])# _LT_COMPILER_BOILERPLATE - - -# _LT_LINKER_BOILERPLATE -# ---------------------- -# Check for linker boilerplate output or warnings with -# the simple link test code. -AC_DEFUN([_LT_LINKER_BOILERPLATE], -[ac_outfile=conftest.$ac_objext -printf "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$rm conftest* -])# _LT_LINKER_BOILERPLATE - - -# _LT_AC_SYS_LIBPATH_AIX -# ---------------------- -# Links a minimal program and checks the executable -# for the system default hardcoded library path. In most cases, -# this is /usr/lib:/lib, but when the MPI compilers are used -# the location of the communication and MPI libs are included too. -# If we don't find anything, use the default library path according -# to the aix ld manual. -AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX], -[AC_LINK_IFELSE(AC_LANG_PROGRAM,[ -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi],[]) -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi -])# _LT_AC_SYS_LIBPATH_AIX - - -# _LT_AC_SHELL_INIT(ARG) -# ---------------------- -AC_DEFUN([_LT_AC_SHELL_INIT], -[ifdef([AC_DIVERSION_NOTICE], - [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], - [AC_DIVERT_PUSH(NOTICE)]) -$1 -AC_DIVERT_POP -])# _LT_AC_SHELL_INIT - - -# _LT_AC_PROG_ECHO_BACKSLASH -# -------------------------- -# Add some code to the start of the generated configure script which -# will find an echo command which doesn't interpret backslashes. -AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH], -[_LT_AC_SHELL_INIT([ -# Check that we are running under the correct shell. -SHELL=${CONFIG_SHELL-/bin/sh} - -case X$ECHO in -X*--fallback-echo) - # Remove one level of quotation (which was required for Make). - ECHO=`echo "$ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','` - ;; -esac - -echo=${ECHO-echo} -if test "X[$]1" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift -elif test "X[$]1" = X--fallback-echo; then - # Avoid inline document here, it may be left over - : -elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then - # Yippee, $echo works! - : -else - # Restart under the correct shell. - exec $SHELL "[$]0" --no-reexec ${1+"[$]@"} -fi - -if test "X[$]1" = X--fallback-echo; then - # used as fallback echo - shift - cat </dev/null 2>&1 && unset CDPATH - -if test -z "$ECHO"; then -if test "X${echo_test_string+set}" != Xset; then -# find a string as large as possible, as long as the shell can cope with it - for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do - # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... - if (echo_test_string=`eval $cmd`) 2>/dev/null && - echo_test_string=`eval $cmd` && - (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null - then - break - fi - done -fi - -if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - : -else - # The Solaris, AIX, and Digital Unix default echo programs unquote - # backslashes. This makes it impossible to quote backslashes using - # echo "$something" | sed 's/\\/\\\\/g' - # - # So, first we look for a working echo in the user's PATH. - - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for dir in $PATH /usr/ucb; do - IFS="$lt_save_ifs" - if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && - test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - echo="$dir/echo" - break - fi - done - IFS="$lt_save_ifs" - - if test "X$echo" = Xecho; then - # We didn't find a better echo, so look for alternatives. - if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - # This shell has a builtin print -r that does the trick. - echo='print -r' - elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && - test "X$CONFIG_SHELL" != X/bin/ksh; then - # If we have ksh, try running configure again with it. - ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} - export ORIGINAL_CONFIG_SHELL - CONFIG_SHELL=/bin/ksh - export CONFIG_SHELL - exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"} - else - # Try using printf. - echo='printf %s\n' - if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - # Cool, printf works - : - elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && - test "X$echo_testing_string" = 'X\t' && - echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL - export CONFIG_SHELL - SHELL="$CONFIG_SHELL" - export SHELL - echo="$CONFIG_SHELL [$]0 --fallback-echo" - elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && - test "X$echo_testing_string" = 'X\t' && - echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - echo="$CONFIG_SHELL [$]0 --fallback-echo" - else - # maybe with a smaller string... - prev=: - - for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do - if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null - then - break - fi - prev="$cmd" - done - - if test "$prev" != 'sed 50q "[$]0"'; then - echo_test_string=`eval $prev` - export echo_test_string - exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"} - else - # Oops. We lost completely, so just stick with echo. - echo=echo - fi - fi - fi - fi -fi -fi - -# Copy echo and quote the copy suitably for passing to libtool from -# the Makefile, instead of quoting the original, which is used later. -ECHO=$echo -if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then - ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo" -fi - -AC_SUBST(ECHO) -])])# _LT_AC_PROG_ECHO_BACKSLASH - - -# _LT_AC_LOCK -# ----------- -AC_DEFUN([_LT_AC_LOCK], -[AC_ARG_ENABLE([libtool-lock], - [AS_HELP_STRING([--disable-libtool-lock],[avoid locking (might break parallel builds)])]) -test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes - -# Some flags need to be propagated to the compiler or linker for good -# libtool support. -case $host in -ia64-*-hpux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case `/usr/bin/file conftest.$ac_objext` in - *ELF-32*) - HPUX_IA64_MODE="32" - ;; - *ELF-64*) - HPUX_IA64_MODE="64" - ;; - esac - fi - rm -rf conftest* - ;; -*-*-irix6*) - # Find out which ABI we are using. - echo '[#]line __oline__ "configure"' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - if test "$lt_cv_prog_gnu_ld" = yes; then - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -melf32bsmip" - ;; - *N32*) - LD="${LD-ld} -melf32bmipn32" - ;; - *64-bit*) - LD="${LD-ld} -melf64bmip" - ;; - esac - else - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -32" - ;; - *N32*) - LD="${LD-ld} -n32" - ;; - *64-bit*) - LD="${LD-ld} -64" - ;; - esac - fi - fi - rm -rf conftest* - ;; - -x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case `/usr/bin/file conftest.o` in - *32-bit*) - case $host in - x86_64-*linux*) - LD="${LD-ld} -m elf_i386" - ;; - ppc64-*linux*|powerpc64-*linux*|ppc64le-$linux*|powerpc64le-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) - LD="${LD-ld} -m elf_s390" - ;; - sparc64-*linux*) - LD="${LD-ld} -m elf32_sparc" - ;; - esac - ;; - *64-bit*) - case $host in - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; - ppc*-*linux*|powerpc*-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*) - LD="${LD-ld} -m elf64_s390" - ;; - sparc*-*linux*) - LD="${LD-ld} -m elf64_sparc" - ;; - esac - ;; - esac - fi - rm -rf conftest* - ;; - -*-*-sco3.2v5*) - # On SCO OpenServer 5, we need -belf to get full-featured binaries. - SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -belf" - AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, - [AC_LANG_PUSH(C) - AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) - AC_LANG_POP]) - if test x"$lt_cv_cc_needs_belf" != x"yes"; then - # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf - CFLAGS="$SAVE_CFLAGS" - fi - ;; -sparc*-*solaris*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case `/usr/bin/file conftest.o` in - *64-bit*) - case $lt_cv_prog_gnu_ld in - yes*) LD="${LD-ld} -m elf64_sparc" ;; - *) LD="${LD-ld} -64" ;; - esac - ;; - esac - fi - rm -rf conftest* - ;; - -AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], -[*-*-cygwin* | *-*-mingw* | *-*-pw32*) - AC_CHECK_TOOL(DLLTOOL, dlltool, false) - AC_CHECK_TOOL(AS, as, false) - AC_CHECK_TOOL(OBJDUMP, objdump, false) - ;; - ]) -esac - -need_locks="$enable_libtool_lock" - -])# _LT_AC_LOCK - - -# AC_LIBTOOL_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, -# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) -# ---------------------------------------------------------------- -# Check whether the given compiler option works -AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], -[AC_REQUIRE([LT_AC_PROG_SED]) -AC_CACHE_CHECK([$1], [$2], - [$2=no - ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$3" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&AS_MESSAGE_LOG_FD - echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then - $2=yes - fi - fi - $rm conftest* -]) - -if test x"[$]$2" = xyes; then - ifelse([$5], , :, [$5]) -else - ifelse([$6], , :, [$6]) -fi -])# AC_LIBTOOL_COMPILER_OPTION - - -# AC_LIBTOOL_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, -# [ACTION-SUCCESS], [ACTION-FAILURE]) -# ------------------------------------------------------------ -# Check whether the given compiler option works -AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], -[AC_CACHE_CHECK([$1], [$2], - [$2=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $3" - printf "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The linker can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&AS_MESSAGE_LOG_FD - $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if diff conftest.exp conftest.er2 >/dev/null; then - $2=yes - fi - else - $2=yes - fi - fi - $rm conftest* - LDFLAGS="$save_LDFLAGS" -]) - -if test x"[$]$2" = xyes; then - ifelse([$4], , :, [$4]) -else - ifelse([$5], , :, [$5]) -fi -])# AC_LIBTOOL_LINKER_OPTION - - -# AC_LIBTOOL_SYS_MAX_CMD_LEN -# -------------------------- -AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], -[# find the maximum length of command line arguments -AC_MSG_CHECKING([the maximum length of command line arguments]) -AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl - i=0 - teststring="ABCD" - - case $build_os in - msdosdjgpp*) - # On DJGPP, this test can blow up pretty badly due to problems in libc - # (any single argument exceeding 2000 bytes causes a buffer overrun - # during glob expansion). Even if it were fixed, the result of this - # check would be larger than it should be. - lt_cv_sys_max_cmd_len=12288; # 12K is about right - ;; - - gnu*) - # Under GNU Hurd, this test is not required because there is - # no limit to the length of command line arguments. - # Libtool will interpret -1 as no limit whatsoever - lt_cv_sys_max_cmd_len=-1; - ;; - - cygwin* | mingw*) - # On Win9x/ME, this test blows up -- it succeeds, but takes - # about 5 minutes as the teststring grows exponentially. - # Worse, since 9x/ME are not pre-emptively multitasking, - # you end up with a "frozen" computer, even though with patience - # the test eventually succeeds (with a max line length of 256k). - # Instead, let's just punt: use the minimum linelength reported by - # all of the supported platforms: 8192 (on NT/2K/XP). - lt_cv_sys_max_cmd_len=8192; - ;; - - amigaos*) - # On AmigaOS with pdksh, this test takes hours, literally. - # So we just punt and use a minimum line length of 8192. - lt_cv_sys_max_cmd_len=8192; - ;; - - netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) - # This has been around since 386BSD, at least. Likely further. - if test -x /sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` - elif test -x /usr/sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` - else - lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs - fi - # And add a safety zone - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` - ;; - - interix*) - # We know the value 262144 and hardcode it with a safety zone (like BSD) - lt_cv_sys_max_cmd_len=196608 - ;; - - osf*) - # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure - # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not - # nice to cause kernel panics so lets avoid the loop below. - # First set a reasonable default. - lt_cv_sys_max_cmd_len=16384 - # - if test -x /sbin/sysconfig; then - case `/sbin/sysconfig -q proc exec_disable_arg_limit` in - *1*) lt_cv_sys_max_cmd_len=-1 ;; - esac - fi - ;; - sco3.2v5*) - lt_cv_sys_max_cmd_len=102400 - ;; - sysv5* | sco5v6* | sysv4.2uw2*) - kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` - if test -n "$kargmax"; then - lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` - else - lt_cv_sys_max_cmd_len=32768 - fi - ;; - *) - # If test is not a shell built-in, we'll probably end up computing a - # maximum length that is only half of the actual maximum length, but - # we can't tell. - SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} - while (test "X"`$SHELL [$]0 --fallback-echo "X$teststring" 2>/dev/null` \ - = "XX$teststring") >/dev/null 2>&1 && - new_result=`expr "X$teststring" : ".*" 2>&1` && - lt_cv_sys_max_cmd_len=$new_result && - test $i != 17 # 1/2 MB should be enough - do - i=`expr $i + 1` - teststring=$teststring$teststring - done - teststring= - # Add a significant safety factor because C++ compilers can tack on massive - # amounts of additional arguments before passing them to the linker. - # It appears as though 1/2 is a usable value. - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` - ;; - esac -]) -if test -n $lt_cv_sys_max_cmd_len ; then - AC_MSG_RESULT($lt_cv_sys_max_cmd_len) -else - AC_MSG_RESULT(none) -fi -])# AC_LIBTOOL_SYS_MAX_CMD_LEN - - -# _LT_AC_CHECK_DLFCN -# ------------------ -AC_DEFUN([_LT_AC_CHECK_DLFCN], -[AC_CHECK_HEADERS(dlfcn.h)dnl -])# _LT_AC_CHECK_DLFCN - - -# _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, -# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) -# --------------------------------------------------------------------- -AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF], -[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl -if test "$cross_compiling" = yes; then : - [$4] -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext < -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -#ifdef __cplusplus -extern "C" void exit (int); -#endif - -void fnord() { int i=42;} -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - /* dlclose (self); */ - } - else - puts (dlerror ()); - - exit (status); -}] -EOF - if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) $1 ;; - x$lt_dlneed_uscore) $2 ;; - x$lt_dlunknown|x*) $3 ;; - esac - else : - # compilation failed - $3 - fi -fi -rm -fr conftest* -])# _LT_AC_TRY_DLOPEN_SELF - - -# AC_LIBTOOL_DLOPEN_SELF -# ---------------------- -AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], -[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl -if test "x$enable_dlopen" != xyes; then - enable_dlopen=unknown - enable_dlopen_self=unknown - enable_dlopen_self_static=unknown -else - lt_cv_dlopen=no - lt_cv_dlopen_libs= - - case $host_os in - beos*) - lt_cv_dlopen="load_add_on" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ;; - - mingw* | pw32*) - lt_cv_dlopen="LoadLibrary" - lt_cv_dlopen_libs= - ;; - - cygwin*) - lt_cv_dlopen="dlopen" - lt_cv_dlopen_libs= - ;; - - darwin*) - # if libdl is installed we need to link against it - AC_CHECK_LIB([dl], [dlopen], - [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ - lt_cv_dlopen="dyld" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ]) - ;; - - *) - AC_CHECK_FUNC([shl_load], - [lt_cv_dlopen="shl_load"], - [AC_CHECK_LIB([dld], [shl_load], - [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"], - [AC_CHECK_FUNC([dlopen], - [lt_cv_dlopen="dlopen"], - [AC_CHECK_LIB([dl], [dlopen], - [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], - [AC_CHECK_LIB([svld], [dlopen], - [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], - [AC_CHECK_LIB([dld], [dld_link], - [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"]) - ]) - ]) - ]) - ]) - ]) - ;; - esac - - if test "x$lt_cv_dlopen" != xno; then - enable_dlopen=yes - else - enable_dlopen=no - fi - - case $lt_cv_dlopen in - dlopen) - save_CPPFLAGS="$CPPFLAGS" - test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" - - save_LDFLAGS="$LDFLAGS" - wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" - - save_LIBS="$LIBS" - LIBS="$lt_cv_dlopen_libs $LIBS" - - AC_CACHE_CHECK([whether a program can dlopen itself], - lt_cv_dlopen_self, [dnl - _LT_AC_TRY_DLOPEN_SELF( - lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, - lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) - ]) - - if test "x$lt_cv_dlopen_self" = xyes; then - wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" - AC_CACHE_CHECK([whether a statically linked program can dlopen itself], - lt_cv_dlopen_self_static, [dnl - _LT_AC_TRY_DLOPEN_SELF( - lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, - lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) - ]) - fi - - CPPFLAGS="$save_CPPFLAGS" - LDFLAGS="$save_LDFLAGS" - LIBS="$save_LIBS" - ;; - esac - - case $lt_cv_dlopen_self in - yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; - *) enable_dlopen_self=unknown ;; - esac - - case $lt_cv_dlopen_self_static in - yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; - *) enable_dlopen_self_static=unknown ;; - esac -fi -])# AC_LIBTOOL_DLOPEN_SELF - - -# AC_LIBTOOL_PROG_CC_C_O([TAGNAME]) -# --------------------------------- -# Check to see if options -c and -o are simultaneously supported by compiler -AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O], -[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl -AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], - [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)], - [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no - $rm -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&AS_MESSAGE_LOG_FD - echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp - $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then - _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes - fi - fi - chmod u+w . 2>&AS_MESSAGE_LOG_FD - $rm conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files - $rm out/* && rmdir out - cd .. - rmdir conftest - $rm conftest* -]) -])# AC_LIBTOOL_PROG_CC_C_O - - -# AC_LIBTOOL_SYS_HARD_LINK_LOCKS([TAGNAME]) -# ----------------------------------------- -# Check to see if we can do hard links to lock some files if needed -AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], -[AC_REQUIRE([_LT_AC_LOCK])dnl - -hard_links="nottested" -if test "$_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - AC_MSG_CHECKING([if we can lock with hard links]) - hard_links=yes - $rm conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - AC_MSG_RESULT([$hard_links]) - if test "$hard_links" = no; then - AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) - need_locks=warn - fi -else - need_locks=no -fi -])# AC_LIBTOOL_SYS_HARD_LINK_LOCKS - - -# AC_LIBTOOL_OBJDIR -# ----------------- -AC_DEFUN([AC_LIBTOOL_OBJDIR], -[AC_CACHE_CHECK([for objdir], [lt_cv_objdir], -[rm -f .libs 2>/dev/null -mkdir .libs 2>/dev/null -if test -d .libs; then - lt_cv_objdir=.libs -else - # MS-DOS does not allow filenames that begin with a dot. - lt_cv_objdir=_libs -fi -rmdir .libs 2>/dev/null]) -objdir=$lt_cv_objdir -])# AC_LIBTOOL_OBJDIR - - -# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH([TAGNAME]) -# ---------------------------------------------- -# Check hardcoding attributes. -AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], -[AC_MSG_CHECKING([how to hardcode library paths into programs]) -_LT_AC_TAGVAR(hardcode_action, $1)= -if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \ - test -n "$_LT_AC_TAGVAR(runpath_var, $1)" || \ - test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then - - # We can hardcode non-existent directories. - if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)" != no && - test "$_LT_AC_TAGVAR(hardcode_minus_L, $1)" != no; then - # Linking always hardcodes the temporary library directory. - _LT_AC_TAGVAR(hardcode_action, $1)=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - _LT_AC_TAGVAR(hardcode_action, $1)=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - _LT_AC_TAGVAR(hardcode_action, $1)=unsupported -fi -AC_MSG_RESULT([$_LT_AC_TAGVAR(hardcode_action, $1)]) - -if test "$_LT_AC_TAGVAR(hardcode_action, $1)" = relink; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi -])# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH - - -# AC_LIBTOOL_SYS_LIB_STRIP -# ------------------------ -AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP], -[striplib= -old_striplib= -AC_MSG_CHECKING([whether stripping libraries is possible]) -if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - AC_MSG_RESULT([yes]) -else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) -fi - ;; - *) - AC_MSG_RESULT([no]) - ;; - esac -fi -])# AC_LIBTOOL_SYS_LIB_STRIP - - -# AC_LIBTOOL_SYS_DYNAMIC_LINKER -# ----------------------------- -# PORTME Fill in your ld.so characteristics -AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER], -[AC_MSG_CHECKING([dynamic linker characteristics]) -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext_cmds=".so" -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown - -case $host_os in -aix3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' - ;; - -aix4* | aix5*) - version_type=linux - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test "$host_cpu" = ia64; then - # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line `#! .'. This would cause the generated library to - # depend on `.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[[01]] | aix4.[[01]].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - if test "$aix_use_runtimelinking" = yes; then - # If using run time linking (on AIX 4.2 or later) use lib.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' - ;; - -beos*) - library_names_spec='${libname}${shared_ext}' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi[[45]]*) - version_type=linux - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw* | pw32*) - version_type=windows - shrext_cmds=".dll" - need_version=no - need_lib_prefix=no - - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32*) - library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname~ - chmod a+x \$dldir/$dlname' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $rm \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" - ;; - mingw*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | [grep ';[c-zC-Z]:/' >/dev/null]; then - # It is most probably a Windows format PATH printed by - # mingw gcc, but we are running on Cygwin. Gcc prints its search - # path with ; separators, and with drive letters. We can handle the - # drive letters (cygwin fileutils understands them), so leave them, - # especially as we might pass files found there to a mingw objdump, - # which wouldn't understand a cygwinified path. Ahh. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - ;; - esac - ;; - - *) - library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' - ;; - esac - dynamic_linker='Win32 ld.exe' - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='.dylib' - # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. - if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` - else - sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' - fi - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -freebsd1.*) - dynamic_linker=no - ;; - -kfreebsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - -freebsd* | dragonfly*) - # DragonFly does not have aout. When/if they implement a new - # versioning mechanism, adjust this. - if test -x /usr/bin/objformat; then - objformat=`/usr/bin/objformat` - else - case $host_os in - freebsd[[123]].*) objformat=aout ;; - *) objformat=elf ;; - esac - fi - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2.*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.[[01]]* | freebsdelf3.[[01]]*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ - freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - freebsd*) # from 4.6 on - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - esac - ;; - -gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case $host_cpu in - ia64*) - shrext_cmds='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext_cmds='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext_cmds='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555. - postinstall_cmds='chmod 555 $lib' - ;; - -interix3*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -# This must be Linux ELF. -linux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" - fi - - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; - -knetbsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - -newsos6) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -nto-qnx*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -openbsd*) - version_type=sunos - sys_lib_dlsearch_path_spec="/usr/lib" - need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[[89]] | openbsd2.[[89]].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac - else - shlibpath_overrides_runpath=yes - fi - ;; - -os2*) - libname_spec='$name' - shrext_cmds=".dll" - need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - ;; - -solaris*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - export_dynamic_flag_spec='${wl}-Blargedynsym' - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - version_type=freebsd-elf - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - hardcode_into_libs=yes - if test "$with_gnu_ld" = yes; then - sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' - shlibpath_overrides_runpath=no - else - sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' - shlibpath_overrides_runpath=yes - case $host_os in - sco3.2v5*) - sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" - ;; - esac - fi - sys_lib_dlsearch_path_spec='/usr/lib' - ;; - -uts4*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no - ;; -esac -AC_MSG_RESULT([$dynamic_linker]) -test "$dynamic_linker" = no && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi -])# AC_LIBTOOL_SYS_DYNAMIC_LINKER - - -# _LT_AC_TAGCONFIG -# ---------------- -AC_DEFUN([_LT_AC_TAGCONFIG], -[AC_ARG_WITH([tags], - [AS_HELP_STRING([--with-tags@<:@=TAGS@:>@],[include additional configurations @<:@automatic@:>@])], - [tagnames="$withval"]) - -if test -f "$ltmain" && test -n "$tagnames"; then - if test ! -f "${ofile}"; then - AC_MSG_WARN([output file `$ofile' does not exist]) - fi - - if test -z "$LTCC"; then - eval "`$SHELL ${ofile} --config | grep '^LTCC='`" - if test -z "$LTCC"; then - AC_MSG_WARN([output file `$ofile' does not look like a libtool script]) - else - AC_MSG_WARN([using `LTCC=$LTCC', extracted from `$ofile']) - fi - fi - if test -z "$LTCFLAGS"; then - eval "`$SHELL ${ofile} --config | grep '^LTCFLAGS='`" - fi - - # Extract list of available tagged configurations in $ofile. - # Note that this assumes the entire list is on one line. - available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` - - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for tagname in $tagnames; do - IFS="$lt_save_ifs" - # Check whether tagname contains only valid characters - case `$echo "X$tagname" | $Xsed -e 's:[[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]]::g'` in - "") ;; - *) AC_MSG_ERROR([invalid tag name: $tagname]) - ;; - esac - - if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null - then - AC_MSG_ERROR([tag name "$tagname" already exists]) - fi - - # Update the list of available tags. - if test -n "$tagname"; then - echo appending configuration tag \"$tagname\" to $ofile - - case $tagname in - CXX) - if test -n "$CXX" && ( test "X$CXX" != "Xno" && - ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || - (test "X$CXX" != "Xg++"))) ; then - AC_LIBTOOL_LANG_CXX_CONFIG - else - tagname="" - fi - ;; - - F77) - if test -n "$F77" && test "X$F77" != "Xno"; then - AC_LIBTOOL_LANG_F77_CONFIG - else - tagname="" - fi - ;; - - GCJ) - if test -n "$GCJ" && test "X$GCJ" != "Xno"; then - AC_LIBTOOL_LANG_GCJ_CONFIG - else - tagname="" - fi - ;; - - RC) - AC_LIBTOOL_LANG_RC_CONFIG - ;; - - *) - AC_MSG_ERROR([Unsupported tag name: $tagname]) - ;; - esac - - # Append the new tag name to the list of available tags. - if test -n "$tagname" ; then - available_tags="$available_tags $tagname" - fi - fi - done - IFS="$lt_save_ifs" - - # Now substitute the updated list of available tags. - if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then - mv "${ofile}T" "$ofile" - chmod +x "$ofile" - else - rm -f "${ofile}T" - AC_MSG_ERROR([unable to update list of available tagged configurations.]) - fi -fi -])# _LT_AC_TAGCONFIG - - -# AC_LIBTOOL_DLOPEN -# ----------------- -# enable checks for dlopen support -AC_DEFUN([AC_LIBTOOL_DLOPEN], - [AC_BEFORE([$0],[AC_LIBTOOL_SETUP]) -])# AC_LIBTOOL_DLOPEN - - -# AC_LIBTOOL_WIN32_DLL -# -------------------- -# declare package support for building win32 DLLs -AC_DEFUN([AC_LIBTOOL_WIN32_DLL], -[AC_BEFORE([$0], [AC_LIBTOOL_SETUP]) -])# AC_LIBTOOL_WIN32_DLL - - -# AC_ENABLE_SHARED([DEFAULT]) -# --------------------------- -# implement the --enable-shared flag -# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. -AC_DEFUN([AC_ENABLE_SHARED], -[define([enable_shared_default], ifelse($1, no, no, yes))dnl -AC_ARG_ENABLE([shared], - AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],[build shared libraries @<:@default=enable_shared_default@:>@]), - [p=${PACKAGE-default} - case $enableval in - yes) enable_shared=yes ;; - no) enable_shared=no ;; - *) - enable_shared=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_shared=]enable_shared_default) -])# AC_ENABLE_SHARED - - -# AC_DISABLE_SHARED -# ----------------- -# set the default shared flag to --disable-shared -AC_DEFUN([AC_DISABLE_SHARED], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -AC_ENABLE_SHARED(no) -])# AC_DISABLE_SHARED - - -# AC_ENABLE_STATIC([DEFAULT]) -# --------------------------- -# implement the --enable-static flag -# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. -AC_DEFUN([AC_ENABLE_STATIC], -[define([enable_static_default], ifelse($1, no, no, yes))dnl -AC_ARG_ENABLE([static], - AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],[build static libraries @<:@default=enable_static_default@:>@]), - [p=${PACKAGE-default} - case $enableval in - yes) enable_static=yes ;; - no) enable_static=no ;; - *) - enable_static=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_static=]enable_static_default) -])# AC_ENABLE_STATIC - - -# AC_DISABLE_STATIC -# ----------------- -# set the default static flag to --disable-static -AC_DEFUN([AC_DISABLE_STATIC], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -AC_ENABLE_STATIC(no) -])# AC_DISABLE_STATIC - - -# AC_ENABLE_FAST_INSTALL([DEFAULT]) -# --------------------------------- -# implement the --enable-fast-install flag -# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. -AC_DEFUN([AC_ENABLE_FAST_INSTALL], -[define([enable_Fast_install_default], ifelse($1, no, no, yes))dnl -AC_ARG_ENABLE([fast-install], - AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],[optimize for fast installation @<:@default=enable_Fast_install_default@:>@]), - [p=${PACKAGE-default} - case $enableval in - yes) enable_fast_install=yes ;; - no) enable_fast_install=no ;; - *) - enable_fast_install=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_fast_install=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_fast_install=]enable_Fast_install_default) -])# AC_ENABLE_FAST_INSTALL - - -# AC_DISABLE_FAST_INSTALL -# ----------------------- -# set the default to --disable-fast-install -AC_DEFUN([AC_DISABLE_FAST_INSTALL], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -AC_ENABLE_FAST_INSTALL(no) -])# AC_DISABLE_FAST_INSTALL - - -# AC_LIBTOOL_PICMODE([MODE]) -# -------------------------- -# implement the --with-pic flag -# MODE is either `yes' or `no'. If omitted, it defaults to `both'. -AC_DEFUN([AC_LIBTOOL_PICMODE], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -pic_mode=ifelse($#,1,$1,default) -])# AC_LIBTOOL_PICMODE - - -# AC_PROG_EGREP -# ------------- -# This is predefined starting with Autoconf 2.54, so this conditional -# definition can be removed once we require Autoconf 2.54 or later. -m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP], -[AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep], - [if echo a | (grep -E '(a|b)') >/dev/null 2>&1 - then ac_cv_prog_egrep='grep -E' - else ac_cv_prog_egrep='egrep' - fi]) - EGREP=$ac_cv_prog_egrep - AC_SUBST([EGREP]) -])]) - - -# AC_PATH_TOOL_PREFIX -# ------------------- -# find a file program which can recognise shared library -AC_DEFUN([AC_PATH_TOOL_PREFIX], -[AC_REQUIRE([AC_PROG_EGREP])dnl -AC_MSG_CHECKING([for $1]) -AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, -[case $MAGIC_CMD in -[[\\/*] | ?:[\\/]*]) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. - ;; -*) - lt_save_MAGIC_CMD="$MAGIC_CMD" - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR -dnl $ac_dummy forces splitting on constant user-supplied paths. -dnl POSIX.2 word splitting is done only on the output of word expansions, -dnl not every word. This closes a longstanding sh security hole. - ac_dummy="ifelse([$2], , $PATH, [$2])" - for ac_dir in $ac_dummy; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$1; then - lt_cv_path_MAGIC_CMD="$ac_dir/$1" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` - MAGIC_CMD="$lt_cv_path_MAGIC_CMD" - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - $EGREP "$file_magic_regex" > /dev/null; then - : - else - cat <&2 - -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool@gnu.org - -EOF - fi ;; - esac - fi - break - fi - done - IFS="$lt_save_ifs" - MAGIC_CMD="$lt_save_MAGIC_CMD" - ;; -esac]) -MAGIC_CMD="$lt_cv_path_MAGIC_CMD" -if test -n "$MAGIC_CMD"; then - AC_MSG_RESULT($MAGIC_CMD) -else - AC_MSG_RESULT(no) -fi -])# AC_PATH_TOOL_PREFIX - - -# AC_PATH_MAGIC -# ------------- -# find a file program which can recognise a shared library -AC_DEFUN([AC_PATH_MAGIC], -[AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) -if test -z "$lt_cv_path_MAGIC_CMD"; then - if test -n "$ac_tool_prefix"; then - AC_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) - else - MAGIC_CMD=: - fi -fi -])# AC_PATH_MAGIC - - -# AC_PROG_LD -# ---------- -# find the pathname to the GNU or non-GNU linker -AC_DEFUN([AC_PROG_LD], -[AC_ARG_WITH([gnu-ld], - [AS_HELP_STRING([--with-gnu-ld],[assume the C compiler uses GNU ld @<:@default=no@:>@])], - [test "$withval" = no || with_gnu_ld=yes], - [with_gnu_ld=no]) -AC_REQUIRE([LT_AC_PROG_SED])dnl -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -ac_prog=ld -if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - AC_MSG_CHECKING([for ld used by $CC]) - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return which upsets mingw - ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $ac_prog in - # Accept absolute paths. - [[\\/]]* | ?:[[\\/]]*) - re_direlt='/[[^/]][[^/]]*/\.\./' - # Canonicalize the pathname of ld - ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'` - while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do - ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test "$with_gnu_ld" = yes; then - AC_MSG_CHECKING([for GNU ld]) -else - AC_MSG_CHECKING([for non-GNU ld]) -fi -AC_CACHE_VAL(lt_cv_path_LD, -[if test -z "$LD"; then - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - lt_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some variants of GNU ld only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - case `"$lt_cv_path_LD" -v 2>&1 &1 /dev/null; then - case $host_cpu in - i*86 ) - # Not sure whether the presence of OpenBSD here was a mistake. - # Let's accept both of them until this is cleared up. - lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` - ;; - esac - else - lt_cv_deplibs_check_method=pass_all - fi - ;; - -gnu*) - lt_cv_deplibs_check_method=pass_all - ;; - -hpux10.20* | hpux11*) - lt_cv_file_magic_cmd=/usr/bin/file - case $host_cpu in - ia64*) - lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' - lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so - ;; - hppa*64*) - [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'] - lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl - ;; - *) - lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library' - lt_cv_file_magic_test_file=/usr/lib/libc.sl - ;; - esac - ;; - -interix3*) - # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' - ;; - -irix5* | irix6* | nonstopux*) - case $LD in - *-32|*"-32 ") libmagic=32-bit;; - *-n32|*"-n32 ") libmagic=N32;; - *-64|*"-64 ") libmagic=64-bit;; - *) libmagic=never-match;; - esac - lt_cv_deplibs_check_method=pass_all - ;; - -# This must be Linux ELF. -linux*) - lt_cv_deplibs_check_method=pass_all - ;; - -netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' - fi - ;; - -newos6*) - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=/usr/lib/libnls.so - ;; - -nto-qnx*) - lt_cv_deplibs_check_method=unknown - ;; - -openbsd*) - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' - fi - ;; - -osf3* | osf4* | osf5*) - lt_cv_deplibs_check_method=pass_all - ;; - -solaris*) - lt_cv_deplibs_check_method=pass_all - ;; - -sysv4 | sysv4.3*) - case $host_vendor in - motorola) - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` - ;; - ncr) - lt_cv_deplibs_check_method=pass_all - ;; - sequent) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' - ;; - sni) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" - lt_cv_file_magic_test_file=/lib/libc.so - ;; - siemens) - lt_cv_deplibs_check_method=pass_all - ;; - pc) - lt_cv_deplibs_check_method=pass_all - ;; - esac - ;; - -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - lt_cv_deplibs_check_method=pass_all - ;; -esac -]) -file_magic_cmd=$lt_cv_file_magic_cmd -deplibs_check_method=$lt_cv_deplibs_check_method -test -z "$deplibs_check_method" && deplibs_check_method=unknown -])# AC_DEPLIBS_CHECK_METHOD - - -# AC_PROG_NM -# ---------- -# find the pathname to a BSD-compatible name lister -AC_DEFUN([AC_PROG_NM], -[AC_CACHE_CHECK([for BSD-compatible nm], lt_cv_path_NM, -[if test -n "$NM"; then - # Let the user override the test. - lt_cv_path_NM="$NM" -else - lt_nm_to_check="${ac_tool_prefix}nm" - if test -n "$ac_tool_prefix" && test "$build" = "$host"; then - lt_nm_to_check="$lt_nm_to_check nm" - fi - for lt_tmp_nm in $lt_nm_to_check; do - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - tmp_nm="$ac_dir/$lt_tmp_nm" - if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then - # Check to see if the nm accepts a BSD-compat flag. - # Adding the `sed 1q' prevents false positives on HP-UX, which says: - # nm: unknown option "B" ignored - # Tru64's nm complains that /dev/null is an invalid object file - case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in - */dev/null* | *'Invalid file or object type'*) - lt_cv_path_NM="$tmp_nm -B" - break - ;; - *) - case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in - */dev/null*) - lt_cv_path_NM="$tmp_nm -p" - break - ;; - *) - lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but - continue # so that we can try to find one that supports BSD flags - ;; - esac - ;; - esac - fi - done - IFS="$lt_save_ifs" - done - test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm -fi]) -NM="$lt_cv_path_NM" -])# AC_PROG_NM - - -# AC_CHECK_LIBM -# ------------- -# check for math library -AC_DEFUN([AC_CHECK_LIBM], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -LIBM= -case $host in -*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*) - # These system don't have libm, or don't need it - ;; -*-ncr-sysv4.3*) - AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") - AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") - ;; -*) - AC_CHECK_LIB(m, cos, LIBM="-lm") - ;; -esac -])# AC_CHECK_LIBM - - -# AC_LIBLTDL_CONVENIENCE([DIRECTORY]) -# ----------------------------------- -# sets LIBLTDL to the link flags for the libltdl convenience library and -# LTDLINCL to the include flags for the libltdl header and adds -# --enable-ltdl-convenience to the configure arguments. Note that -# AC_CONFIG_SUBDIRS is not called here. If DIRECTORY is not provided, -# it is assumed to be `libltdl'. LIBLTDL will be prefixed with -# '${top_builddir}/' and LTDLINCL will be prefixed with '${top_srcdir}/' -# (note the single quotes!). If your package is not flat and you're not -# using automake, define top_builddir and top_srcdir appropriately in -# the Makefiles. -AC_DEFUN([AC_LIBLTDL_CONVENIENCE], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl - case $enable_ltdl_convenience in - no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; - "") enable_ltdl_convenience=yes - ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; - esac - LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la - LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) - # For backwards non-gettext consistent compatibility... - INCLTDL="$LTDLINCL" -])# AC_LIBLTDL_CONVENIENCE - - -# AC_LIBLTDL_INSTALLABLE([DIRECTORY]) -# ----------------------------------- -# sets LIBLTDL to the link flags for the libltdl installable library and -# LTDLINCL to the include flags for the libltdl header and adds -# --enable-ltdl-install to the configure arguments. Note that -# AC_CONFIG_SUBDIRS is not called here. If DIRECTORY is not provided, -# and an installed libltdl is not found, it is assumed to be `libltdl'. -# LIBLTDL will be prefixed with '${top_builddir}/'# and LTDLINCL with -# '${top_srcdir}/' (note the single quotes!). If your package is not -# flat and you're not using automake, define top_builddir and top_srcdir -# appropriately in the Makefiles. -# In the future, this macro may have to be called after AC_PROG_LIBTOOL. -AC_DEFUN([AC_LIBLTDL_INSTALLABLE], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl - AC_CHECK_LIB(ltdl, lt_dlinit, - [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], - [if test x"$enable_ltdl_install" = xno; then - AC_MSG_WARN([libltdl not installed, but installation disabled]) - else - enable_ltdl_install=yes - fi - ]) - if test x"$enable_ltdl_install" = x"yes"; then - ac_configure_args="$ac_configure_args --enable-ltdl-install" - LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la - LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) - else - ac_configure_args="$ac_configure_args --enable-ltdl-install=no" - LIBLTDL="-lltdl" - LTDLINCL= - fi - # For backwards non-gettext consistent compatibility... - INCLTDL="$LTDLINCL" -])# AC_LIBLTDL_INSTALLABLE - - -# AC_LIBTOOL_CXX -# -------------- -# enable support for C++ libraries -AC_DEFUN([AC_LIBTOOL_CXX], -[AC_REQUIRE([_LT_AC_LANG_CXX]) -])# AC_LIBTOOL_CXX - - -# _LT_AC_LANG_CXX -# --------------- -AC_DEFUN([_LT_AC_LANG_CXX], -[AC_REQUIRE([AC_PROG_CXX]) -AC_REQUIRE([_LT_AC_PROG_CXXCPP]) -_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}CXX]) -])# _LT_AC_LANG_CXX - -# _LT_AC_PROG_CXXCPP -# ------------------ -AC_DEFUN([_LT_AC_PROG_CXXCPP], -[ -AC_REQUIRE([AC_PROG_CXX]) -if test -n "$CXX" && ( test "X$CXX" != "Xno" && - ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || - (test "X$CXX" != "Xg++"))) ; then - AC_PROG_CXXCPP -fi -])# _LT_AC_PROG_CXXCPP - -# AC_LIBTOOL_F77 -# -------------- -# enable support for Fortran 77 libraries -AC_DEFUN([AC_LIBTOOL_F77], -[AC_REQUIRE([_LT_AC_LANG_F77]) -])# AC_LIBTOOL_F77 - - -# _LT_AC_LANG_F77 -# --------------- -AC_DEFUN([_LT_AC_LANG_F77], -[AC_REQUIRE([AC_PROG_F77]) -_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}F77]) -])# _LT_AC_LANG_F77 - - -# AC_LIBTOOL_GCJ -# -------------- -# enable support for GCJ libraries -AC_DEFUN([AC_LIBTOOL_GCJ], -[AC_REQUIRE([_LT_AC_LANG_GCJ]) -])# AC_LIBTOOL_GCJ - - -# _LT_AC_LANG_GCJ -# --------------- -AC_DEFUN([_LT_AC_LANG_GCJ], -[AC_PROVIDE_IFELSE([AC_PROG_GCJ],[], - [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[], - [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[], - [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])], - [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])], - [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])]) -_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}GCJ]) -])# _LT_AC_LANG_GCJ - - -# AC_LIBTOOL_RC -# ------------- -# enable support for Windows resource files -AC_DEFUN([AC_LIBTOOL_RC], -[AC_REQUIRE([LT_AC_PROG_RC]) -_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}RC]) -])# AC_LIBTOOL_RC - - -# AC_LIBTOOL_LANG_C_CONFIG -# ------------------------ -# Ensure that the configuration vars for the C compiler are -# suitably defined. Those variables are subsequently used by -# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. -AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG], [_LT_AC_LANG_C_CONFIG]) -AC_DEFUN([_LT_AC_LANG_C_CONFIG], -[lt_save_CC="$CC" -AC_LANG_PUSH(C) - -# Source file extension for C test sources. -ac_ext=c - -# Object file extension for compiled C test sources. -objext=o -_LT_AC_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;\n" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(){return(0);}\n' - -_LT_AC_SYS_COMPILER - -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - -## CAVEAT EMPTOR: -## There is no encapsulation within the following macros, do not change -## the running order or otherwise move them around unless you know exactly -## what you are doing... -AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) -AC_LIBTOOL_PROG_COMPILER_PIC($1) -AC_LIBTOOL_PROG_CC_C_O($1) -AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) -AC_LIBTOOL_PROG_LD_SHLIBS($1) -AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) -AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) -AC_LIBTOOL_SYS_LIB_STRIP -AC_LIBTOOL_DLOPEN_SELF - -# Report which library types will actually be built -AC_MSG_CHECKING([if libtool supports shared libraries]) -AC_MSG_RESULT([$can_build_shared]) - -AC_MSG_CHECKING([whether to build shared libraries]) -test "$can_build_shared" = "no" && enable_shared=no - -# On AIX, shared libraries and static libraries use the same namespace, and -# are all built from PIC. -case $host_os in -aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; - -aix4* | aix5*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi - ;; -esac -AC_MSG_RESULT([$enable_shared]) - -AC_MSG_CHECKING([whether to build static libraries]) -# Make sure either enable_shared or enable_static is yes. -test "$enable_shared" = yes || enable_static=yes -AC_MSG_RESULT([$enable_static]) - -AC_LIBTOOL_CONFIG($1) - -AC_LANG_POP -CC="$lt_save_CC" -])# AC_LIBTOOL_LANG_C_CONFIG - - -# AC_LIBTOOL_LANG_CXX_CONFIG -# -------------------------- -# Ensure that the configuration vars for the C compiler are -# suitably defined. Those variables are subsequently used by -# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. -AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG], [_LT_AC_LANG_CXX_CONFIG(CXX)]) -AC_DEFUN([_LT_AC_LANG_CXX_CONFIG], -[AC_LANG_PUSH(C++) -AC_REQUIRE([AC_PROG_CXX]) -AC_REQUIRE([_LT_AC_PROG_CXXCPP]) - -_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no -_LT_AC_TAGVAR(allow_undefined_flag, $1)= -_LT_AC_TAGVAR(always_export_symbols, $1)=no -_LT_AC_TAGVAR(archive_expsym_cmds, $1)= -_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= -_LT_AC_TAGVAR(hardcode_direct, $1)=no -_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= -_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= -_LT_AC_TAGVAR(hardcode_libdir_separator, $1)= -_LT_AC_TAGVAR(hardcode_minus_L, $1)=no -_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported -_LT_AC_TAGVAR(hardcode_automatic, $1)=no -_LT_AC_TAGVAR(module_cmds, $1)= -_LT_AC_TAGVAR(module_expsym_cmds, $1)= -_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown -_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_AC_TAGVAR(no_undefined_flag, $1)= -_LT_AC_TAGVAR(whole_archive_flag_spec, $1)= -_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no - -# Dependencies to place before and after the object being linked: -_LT_AC_TAGVAR(predep_objects, $1)= -_LT_AC_TAGVAR(postdep_objects, $1)= -_LT_AC_TAGVAR(predeps, $1)= -_LT_AC_TAGVAR(postdeps, $1)= -_LT_AC_TAGVAR(compiler_lib_search_path, $1)= - -# Source file extension for C++ test sources. -ac_ext=cpp - -# Object file extension for compiled C++ test sources. -objext=o -_LT_AC_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;\n" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }\n' - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. -_LT_AC_SYS_COMPILER - -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - -# Allow CC to be a program name with arguments. -lt_save_CC=$CC -lt_save_LD=$LD -lt_save_GCC=$GCC -GCC=$GXX -lt_save_with_gnu_ld=$with_gnu_ld -lt_save_path_LD=$lt_cv_path_LD -if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then - lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx -else - $as_unset lt_cv_prog_gnu_ld -fi -if test -n "${lt_cv_path_LDCXX+set}"; then - lt_cv_path_LD=$lt_cv_path_LDCXX -else - $as_unset lt_cv_path_LD -fi -test -z "${LDCXX+set}" || LD=$LDCXX -CC=${CXX-"c++"} -compiler=$CC -_LT_AC_TAGVAR(compiler, $1)=$CC -_LT_CC_BASENAME([$compiler]) - -# We don't want -fno-exception wen compiling C++ code, so set the -# no_builtin_flag separately -if test "$GXX" = yes; then - _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' -else - _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= -fi - -if test "$GXX" = yes; then - # Set up default GNU C++ configuration - - AC_PROG_LD - - # Check if GNU C++ uses GNU ld as the underlying linker, since the - # archiving commands below assume that GNU ld is being used. - if test "$with_gnu_ld" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - - # If archive_cmds runs LD, not CC, wlarc should be empty - # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to - # investigate it a little bit more. (MM) - wlarc='${wl}' - - # ancient GNU ld didn't support --whole-archive et. al. - if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ - grep 'no-whole-archive' > /dev/null; then - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= - fi - else - with_gnu_ld=no - wlarc= - - # A generic and very simple default shared library creation - # command for GNU C++ for the case where it uses the native - # linker, instead of GNU ld. If possible, this setting should - # overridden to take advantage of the native linker features on - # the platform it is being used on. - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - fi - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' - -else - GXX=no - with_gnu_ld=no - wlarc= -fi - -# PORTME: fill in a description of your system's C++ link characteristics -AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) -_LT_AC_TAGVAR(ld_shlibs, $1)=yes -case $host_os in - aix3*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) - for ld_flag in $LDFLAGS; do - case $ld_flag in - *-brtl*) - aix_use_runtimelinking=yes - break - ;; - esac - done - ;; - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - _LT_AC_TAGVAR(archive_cmds, $1)='' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - - if test "$GXX" = yes; then - case $host_os in aix4.[[012]]|aix4.[[012]].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - else - # We have old collect2 - _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= - fi - ;; - esac - shared_flag='-shared' - if test "$aix_use_runtimelinking" = yes; then - shared_flag="$shared_flag "'${wl}-G' - fi - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' - # Determine the default libpath from the value encoded in an empty executable. - _LT_AC_SYS_LIBPATH_AIX - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' - _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an empty executable. - _LT_AC_SYS_LIBPATH_AIX - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - # Exported symbols can be pulled into shared objects from archives - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='$convenience' - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes - # This is similar to how AIX traditionally builds its shared libraries. - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - beos*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - chorus*) - case $cc_basename in - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - cygwin* | mingw* | pw32*) - # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, - # as there is no search path for DLLs. - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_AC_TAGVAR(always_export_symbols, $1)=no - _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - - if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - darwin* | rhapsody*) - case $host_os in - rhapsody* | darwin1.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - ;; - 10.*) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup' - ;; - esac - fi - ;; - esac - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_automatic, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - - if test "$GXX" = yes ; then - lt_int_apple_cc_single_mod=no - output_verbose_link_cmd='echo' - if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then - lt_int_apple_cc_single_mod=yes - fi - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - fi - _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - case $cc_basename in - xlc*) - output_verbose_link_cmd='echo' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' - _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - ;; - *) - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - fi - ;; - - dgux*) - case $cc_basename in - ec++*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - ghcx*) - # Green Hills C++ Compiler - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - freebsd[[12]].*) - # C++ shared libraries reported to be fairly broken before switch to ELF - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - freebsd-elf*) - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - ;; - freebsd* | kfreebsd*-gnu | dragonfly*) - # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF - # conventions - _LT_AC_TAGVAR(ld_shlibs, $1)=yes - ;; - gnu*) - ;; - hpux9*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, - # but as the default - # location of the library. - - case $cc_basename in - CC*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - aCC*) - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[[-]]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - hpux10*|hpux11*) - if test $with_gnu_ld = no; then - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - case $host_cpu in - hppa*64*|ia64*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' - ;; - *) - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - ;; - esac - fi - case $host_cpu in - hppa*64*|ia64*) - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - *) - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, - # but as the default - # location of the library. - ;; - esac - - case $cc_basename in - CC*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - aCC*) - case $host_cpu in - hppa*64*) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - ia64*) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes; then - if test $with_gnu_ld = no; then - case $host_cpu in - hppa*64*) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - ia64*) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - fi - else - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - interix3*) - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. - # Instead, shared libraries are loaded at an image base (0x10000000 by - # default) and relocated if they conflict, which is a slow very memory - # consuming and fragmenting process. To avoid this, we pick a random, - # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link - # time. Moving up from 0x10000000 also allows more sbrk(2) space. - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - ;; - irix5* | irix6*) - case $cc_basename in - CC*) - # SGI C++ - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - - # Archives containing C++ object files must be created using - # "CC -ar", where "CC" is the IRIX C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' - ;; - *) - if test "$GXX" = yes; then - if test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' - fi - fi - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - ;; - esac - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - linux*) - case $cc_basename in - KCC*) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath,$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - - # Archives containing C++ object files must be created using - # "CC -Bstatic", where "CC" is the KAI C++ compiler. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' - ;; - icpc*) - # Intel C++ - with_gnu_ld=yes - # version 8.0 and above of icpc choke on multiply defined symbols - # if we add $predep_objects and $postdep_objects, however 7.1 and - # earlier do not add the objects themselves. - case `$CC -V 2>&1` in - *"Version 7."*) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - ;; - *) # Version 8.0 or newer - tmp_idyn= - case $host_cpu in - ia64*) tmp_idyn=' -i_dynamic';; - esac - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - ;; - esac - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - ;; - pgCC*) - # Portland Group C++ compiler - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - ;; - cxx*) - # Compaq C++ - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' - - runpath_var=LD_RUN_PATH - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - esac - ;; - lynxos*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - m88k*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - mvs*) - case $cc_basename in - cxx*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' - wlarc= - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - fi - # Workaround some broken pre-1.5 toolchains - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' - ;; - openbsd2*) - # C++ shared libraries are fairly broken - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - openbsd*) - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - fi - output_verbose_link_cmd='echo' - ;; - osf3*) - case $cc_basename in - KCC*) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Archives containing C++ object files must be created using - # "CC -Bstatic", where "CC" is the KAI C++ compiler. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' - - ;; - RCC*) - # Rational C++ 2.4.1 - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - cxx*) - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' - - else - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - osf4* | osf5*) - case $cc_basename in - KCC*) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Archives containing C++ object files must be created using - # the KAI C++ compiler. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' - ;; - RCC*) - # Rational C++ 2.4.1 - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - cxx*) - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ - echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~ - $rm $lib.exp' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' - - else - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - psos*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - sunos4*) - case $cc_basename in - CC*) - # Sun C++ 4.x - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - lcc*) - # Lucid - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - solaris*) - case $cc_basename in - CC*) - # Sun C++ 4.2, 5.x and Centerline C++ - _LT_AC_TAGVAR(archive_cmds_need_lc,$1)=yes - _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - case $host_os in - solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) - # The C++ compiler is used as linker so we must use $wl - # flag to pass the commands to the underlying system - # linker. We must also pass each convience library through - # to the system linker between allextract/defaultextract. - # The C++ compiler will combine linker options so we - # cannot just pass the convience library names through - # without $wl. - # Supported since Solaris 2.6 (maybe 2.5.1?) - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' - ;; - esac - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - - output_verbose_link_cmd='echo' - - # Archives containing C++ object files must be created using - # "CC -xar", where "CC" is the Sun C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' - ;; - gcx*) - # Green Hills C++ Compiler - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - - # The C++ compiler must be used to create the archive. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' - ;; - *) - # GNU C++ compiler with Solaris linker - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' - if $CC --version | grep -v '^2\.7' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" - else - # g++ 2.7 appears to require `-G' NOT `-shared' on this - # platform. - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" - fi - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' - fi - ;; - esac - ;; - sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) - _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - runpath_var='LD_RUN_PATH' - - case $cc_basename in - CC*) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - ;; - sysv5* | sco3.2v5* | sco5v6*) - # Note: We can NOT use -z defs as we might desire, because we do not - # link with -lc, and that would cause any symbols used from libc to - # always be unresolved, which means just about no library would - # ever link correctly. If we're not using GNU ld we use -z text - # though, which does catch some bad symbols but isn't as heavy-handed - # as -z defs. - # For security reasons, it is highly recommended that you always - # use absolute paths for naming shared libraries, and exclude the - # DT_RUNPATH tag from executables and libraries. But doing so - # requires that you compile everything twice, which is a pain. - # So that behaviour is only enabled if SCOABSPATH is set to a - # non-empty value in the environment. Most likely only useful for - # creating official distributions of packages. - # This is a hack until libtool officially supports absolute path - # names for shared libraries. - _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' - _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' - runpath_var='LD_RUN_PATH' - - case $cc_basename in - CC*) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - ;; - tandem*) - case $cc_basename in - NCC*) - # NonStop-UX NCC 3.20 - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - vxworks*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; -esac -AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) -test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no - -_LT_AC_TAGVAR(GCC, $1)="$GXX" -_LT_AC_TAGVAR(LD, $1)="$LD" - -## CAVEAT EMPTOR: -## There is no encapsulation within the following macros, do not change -## the running order or otherwise move them around unless you know exactly -## what you are doing... -AC_LIBTOOL_POSTDEP_PREDEP($1) -AC_LIBTOOL_PROG_COMPILER_PIC($1) -AC_LIBTOOL_PROG_CC_C_O($1) -AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) -AC_LIBTOOL_PROG_LD_SHLIBS($1) -AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) -AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) - -AC_LIBTOOL_CONFIG($1) - -AC_LANG_POP -CC=$lt_save_CC -LDCXX=$LD -LD=$lt_save_LD -GCC=$lt_save_GCC -with_gnu_ldcxx=$with_gnu_ld -with_gnu_ld=$lt_save_with_gnu_ld -lt_cv_path_LDCXX=$lt_cv_path_LD -lt_cv_path_LD=$lt_save_path_LD -lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld -lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld -])# AC_LIBTOOL_LANG_CXX_CONFIG - -# AC_LIBTOOL_POSTDEP_PREDEP([TAGNAME]) -# ------------------------------------ -# Figure out "hidden" library dependencies from verbose -# compiler output when linking a shared library. -# Parse the compiler output and extract the necessary -# objects, libraries and library flags. -AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP],[ -dnl we can't use the lt_simple_compile_test_code here, -dnl because it contains code intended for an executable, -dnl not a library. It's possible we should let each -dnl tag define a new lt_????_link_test_code variable, -dnl but it's only used here... -ifelse([$1],[],[cat > conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext <> "$cfgfile" -ifelse([$1], [], -[#! $SHELL - -# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. -# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) -# NOTE: Changes made to this file will be lost: look at ltmain.sh. -# -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 -# Free Software Foundation, Inc. -# -# This file is part of GNU Libtool: -# Originally by Gordon Matzigkeit , 1996 -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# A sed program that does not truncate output. -SED=$lt_SED - -# Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="$SED -e 1s/^X//" - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -# The names of the tagged configurations supported by this script. -available_tags= - -# ### BEGIN LIBTOOL CONFIG], -[# ### BEGIN LIBTOOL TAG CONFIG: $tagname]) - -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: - -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL - -# Whether or not to build shared libraries. -build_libtool_libs=$enable_shared - -# Whether or not to build static libraries. -build_old_libs=$enable_static - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$_LT_AC_TAGVAR(archive_cmds_need_lc, $1) - -# Whether or not to disallow shared libs when runtime libs are static -allow_libtool_libs_with_static_runtimes=$_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) - -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install - -# The host system. -host_alias=$host_alias -host=$host -host_os=$host_os - -# The build system. -build_alias=$build_alias -build=$build -build_os=$build_os - -# An echo program that does not interpret backslashes. -echo=$lt_echo - -# The archiver. -AR=$lt_AR -AR_FLAGS=$lt_AR_FLAGS - -# A C compiler. -LTCC=$lt_LTCC - -# LTCC compiler flags. -LTCFLAGS=$lt_LTCFLAGS - -# A language-specific compiler. -CC=$lt_[]_LT_AC_TAGVAR(compiler, $1) - -# Is the compiler the GNU C compiler? -with_gcc=$_LT_AC_TAGVAR(GCC, $1) - -# An ERE matcher. -EGREP=$lt_EGREP - -# The linker used to build libraries. -LD=$lt_[]_LT_AC_TAGVAR(LD, $1) - -# Whether we need hard or soft links. -LN_S=$lt_LN_S - -# A BSD-compatible nm program. -NM=$lt_NM - -# A symbol stripping program -STRIP=$lt_STRIP - -# Used to examine libraries when file_magic_cmd begins "file" -MAGIC_CMD=$MAGIC_CMD - -# Used on cygwin: DLL creation program. -DLLTOOL="$DLLTOOL" - -# Used on cygwin: object dumper. -OBJDUMP="$OBJDUMP" - -# Used on cygwin: assembler. -AS="$AS" - -# The name of the directory that contains temporary libtool files. -objdir=$objdir - -# How to create reloadable object files. -reload_flag=$lt_reload_flag -reload_cmds=$lt_reload_cmds - -# How to pass a linker flag through the compiler. -wl=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) - -# Object file suffix (normally "o"). -objext="$ac_objext" - -# Old archive suffix (normally "a"). -libext="$libext" - -# Shared library suffix (normally ".so"). -shrext_cmds='$shrext_cmds' - -# Executable file suffix (normally ""). -exeext="$exeext" - -# Additional compiler flags for building library objects. -pic_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) -pic_mode=$pic_mode - -# What is the maximum length of a command? -max_cmd_len=$lt_cv_sys_max_cmd_len - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) - -# Must we lock files when doing compilation? -need_locks=$lt_need_locks - -# Do we need the lib prefix for modules? -need_lib_prefix=$need_lib_prefix - -# Do we need a version for libraries? -need_version=$need_version - -# Whether dlopen is supported. -dlopen_support=$enable_dlopen - -# Whether dlopen of programs is supported. -dlopen_self=$enable_dlopen_self - -# Whether dlopen of statically linked programs is supported. -dlopen_self_static=$enable_dlopen_self_static - -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_static, $1) - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_[]_LT_AC_TAGVAR(export_dynamic_flag_spec, $1) - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_[]_LT_AC_TAGVAR(whole_archive_flag_spec, $1) - -# Compiler flag to generate thread-safe objects. -thread_safe_flag_spec=$lt_[]_LT_AC_TAGVAR(thread_safe_flag_spec, $1) - -# Library versioning type. -version_type=$version_type - -# Format of library name prefix. -libname_spec=$lt_libname_spec - -# List of archive names. First name is the real one, the rest are links. -# The last name is the one that the linker finds with -lNAME. -library_names_spec=$lt_library_names_spec - -# The coded name of the library, if different from the real name. -soname_spec=$lt_soname_spec - -# Commands used to build and install an old-style archive. -RANLIB=$lt_RANLIB -old_archive_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_cmds, $1) -old_postinstall_cmds=$lt_old_postinstall_cmds -old_postuninstall_cmds=$lt_old_postuninstall_cmds - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_new_cmds, $1) - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) - -# Commands used to build and install a shared archive. -archive_cmds=$lt_[]_LT_AC_TAGVAR(archive_cmds, $1) -archive_expsym_cmds=$lt_[]_LT_AC_TAGVAR(archive_expsym_cmds, $1) -postinstall_cmds=$lt_postinstall_cmds -postuninstall_cmds=$lt_postuninstall_cmds - -# Commands used to build a loadable module (assumed same as above if empty) -module_cmds=$lt_[]_LT_AC_TAGVAR(module_cmds, $1) -module_expsym_cmds=$lt_[]_LT_AC_TAGVAR(module_expsym_cmds, $1) - -# Commands to strip libraries. -old_striplib=$lt_old_striplib -striplib=$lt_striplib - -# Dependencies to place before the objects being linked to create a -# shared library. -predep_objects=$lt_[]_LT_AC_TAGVAR(predep_objects, $1) - -# Dependencies to place after the objects being linked to create a -# shared library. -postdep_objects=$lt_[]_LT_AC_TAGVAR(postdep_objects, $1) - -# Dependencies to place before the objects being linked to create a -# shared library. -predeps=$lt_[]_LT_AC_TAGVAR(predeps, $1) - -# Dependencies to place after the objects being linked to create a -# shared library. -postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1) - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1) - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method=$lt_deplibs_check_method - -# Command to use when deplibs_check_method == file_magic. -file_magic_cmd=$lt_file_magic_cmd - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_[]_LT_AC_TAGVAR(allow_undefined_flag, $1) - -# Flag that forces no undefined symbols. -no_undefined_flag=$lt_[]_LT_AC_TAGVAR(no_undefined_flag, $1) - -# Commands used to finish a libtool library installation in a directory. -finish_cmds=$lt_finish_cmds - -# Same as above, but a single script fragment to be evaled but not shown. -finish_eval=$lt_finish_eval - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe - -# Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl - -# Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address - -# This is the shared library runtime path variable. -runpath_var=$runpath_var - -# This is the shared library path variable. -shlibpath_var=$shlibpath_var - -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=$shlibpath_overrides_runpath - -# How to hardcode a shared library path into an executable. -hardcode_action=$_LT_AC_TAGVAR(hardcode_action, $1) - -# Whether we should hardcode library paths into libraries. -hardcode_into_libs=$hardcode_into_libs - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) - -# If ld is used when linking, flag to hardcode \$libdir into -# a binary during linking. This must work even if \$libdir does -# not exist. -hardcode_libdir_flag_spec_ld=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) - -# Whether we need a single -rpath flag with a separated argument. -hardcode_libdir_separator=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_separator, $1) - -# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the -# resulting binary. -hardcode_direct=$_LT_AC_TAGVAR(hardcode_direct, $1) - -# Set to yes if using the -LDIR flag during linking hardcodes DIR into the -# resulting binary. -hardcode_minus_L=$_LT_AC_TAGVAR(hardcode_minus_L, $1) - -# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into -# the resulting binary. -hardcode_shlibpath_var=$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1) - -# Set to yes if building a shared library automatically hardcodes DIR into the library -# and all subsequent libraries and executables linked against it. -hardcode_automatic=$_LT_AC_TAGVAR(hardcode_automatic, $1) - -# Variables whose values should be saved in libtool wrapper scripts and -# restored at relink time. -variables_saved_for_relink="$variables_saved_for_relink" - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$_LT_AC_TAGVAR(link_all_deplibs, $1) - -# Compile-time system search path for libraries -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec - -# Run-time system search path for libraries -sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec - -# Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$_LT_AC_TAGVAR(fix_srcfile_path, $1)" - -# Set to yes if exported symbols are required. -always_export_symbols=$_LT_AC_TAGVAR(always_export_symbols, $1) - -# The commands to list exported symbols. -export_symbols_cmds=$lt_[]_LT_AC_TAGVAR(export_symbols_cmds, $1) - -# The commands to extract the exported symbol list from a shared archive. -extract_expsyms_cmds=$lt_extract_expsyms_cmds - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_[]_LT_AC_TAGVAR(exclude_expsyms, $1) - -# Symbols that must always be exported. -include_expsyms=$lt_[]_LT_AC_TAGVAR(include_expsyms, $1) - -ifelse([$1],[], -[# ### END LIBTOOL CONFIG], -[# ### END LIBTOOL TAG CONFIG: $tagname]) - -__EOF__ - -ifelse([$1],[], [ - case $host_os in - aix3*) - cat <<\EOF >> "$cfgfile" - -# AIX sometimes has problems with the GCC collect2 program. For some -# reason, if we set the COLLECT_NAMES environment variable, the problems -# vanish in a puff of smoke. -if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES -fi -EOF - ;; - esac - - # We use sed instead of cat because bash on DJGPP gets confused if - # if finds mixed CR/LF and LF-only lines. Since sed operates in - # text mode, it properly converts lines to CR/LF. This bash problem - # is reportedly fixed, but why not run on old versions too? - sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) - - mv -f "$cfgfile" "$ofile" || \ - (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") - chmod +x "$ofile" -]) -else - # If there is no Makefile yet, we rely on a make rule to execute - # `config.status --recheck' to rerun these tests and create the - # libtool script then. - ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` - if test -f "$ltmain_in"; then - test -f Makefile && make "$ltmain" - fi -fi -])# AC_LIBTOOL_CONFIG - - -# AC_LIBTOOL_PROG_COMPILER_NO_RTTI([TAGNAME]) -# ------------------------------------------- -AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], -[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl - -_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= - -if test "$GCC" = yes; then - _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' - - AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], - lt_cv_prog_compiler_rtti_exceptions, - [-fno-rtti -fno-exceptions], [], - [_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) -fi -])# AC_LIBTOOL_PROG_COMPILER_NO_RTTI - - -# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE -# --------------------------------- -AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], -[AC_REQUIRE([AC_CANONICAL_HOST]) -AC_REQUIRE([AC_PROG_NM]) -AC_REQUIRE([AC_OBJEXT]) -# Check for command to grab the raw symbol name followed by C symbol from nm. -AC_MSG_CHECKING([command to parse $NM output from $compiler object]) -AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], -[ -# These are sane defaults that work on at least a few old systems. -# [They come from Ultrix. What could be older than Ultrix?!! ;)] - -# Character class describing NM global symbol codes. -symcode='[[BCDEGRST]]' - -# Regexp to match symbols that can be accessed directly from C. -sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' - -# Transform an extracted symbol line into a proper C declaration -lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" - -# Transform an extracted symbol line into symbol name and symbol address -lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - -# Define system-specific variables. -case $host_os in -aix*) - symcode='[[BCDT]]' - ;; -cygwin* | mingw* | pw32*) - symcode='[[ABCDGISTW]]' - ;; -hpux*) # Its linker distinguishes data from code symbols - if test "$host_cpu" = ia64; then - symcode='[[ABCDEGRST]]' - fi - lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" - lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - ;; -linux*) - if test "$host_cpu" = ia64; then - symcode='[[ABCDGIRSTW]]' - lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" - lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - fi - ;; -irix* | nonstopux*) - symcode='[[BCDEGRST]]' - ;; -osf*) - symcode='[[BCDEGQRST]]' - ;; -solaris*) - symcode='[[BDRT]]' - ;; -sco3.2v5*) - symcode='[[DT]]' - ;; -sysv4.2uw2*) - symcode='[[DT]]' - ;; -sysv5* | sco5v6* | unixware* | OpenUNIX*) - symcode='[[ABDT]]' - ;; -sysv4) - symcode='[[DFNSTU]]' - ;; -esac - -# Handle CRLF in mingw tool chain -opt_cr= -case $build_os in -mingw*) - opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp - ;; -esac - -# If we're using GNU nm, then use its standard symbol codes. -case `$NM -V 2>&1` in -*GNU* | *'with BFD'*) - symcode='[[ABCDGIRSTW]]' ;; -esac - -# Try without a prefix undercore, then with it. -for ac_symprfx in "" "_"; do - - # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. - symxfrm="\\1 $ac_symprfx\\2 \\2" - - # Write the raw and C identifiers. - lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" - - # Check to see that the pipe works correctly. - pipe_works=no - - rm -f conftest* - cat > conftest.$ac_ext < $nlist) && test -s "$nlist"; then - # Try sorting and uniquifying the output. - if sort "$nlist" | uniq > "$nlist"T; then - mv -f "$nlist"T "$nlist" - else - rm -f "$nlist"T - fi - - # Make sure that we snagged all the symbols we need. - if grep ' nm_test_var$' "$nlist" >/dev/null; then - if grep ' nm_test_func$' "$nlist" >/dev/null; then - cat < conftest.$ac_ext -#ifdef __cplusplus -extern "C" { -#endif - -EOF - # Now generate the symbol file. - eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' - - cat <> conftest.$ac_ext -#if defined (__STDC__) && __STDC__ -# define lt_ptr_t void * -#else -# define lt_ptr_t char * -# define const -#endif - -/* The mapping between symbol names and symbols. */ -const struct { - const char *name; - lt_ptr_t address; -} -lt_preloaded_symbols[[]] = -{ -EOF - $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext - cat <<\EOF >> conftest.$ac_ext - {0, (lt_ptr_t) 0} -}; - -#ifdef __cplusplus -} -#endif -EOF - # Now try linking the two files. - mv conftest.$ac_objext conftstm.$ac_objext - lt_save_LIBS="$LIBS" - lt_save_CFLAGS="$CFLAGS" - LIBS="conftstm.$ac_objext" - CFLAGS="$CFLAGS$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" - if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then - pipe_works=yes - fi - LIBS="$lt_save_LIBS" - CFLAGS="$lt_save_CFLAGS" - else - echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD - fi - else - echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD - fi - else - echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD - fi - else - echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD - cat conftest.$ac_ext >&5 - fi - rm -f conftest* conftst* - - # Do not use the global_symbol_pipe unless it works. - if test "$pipe_works" = yes; then - break - else - lt_cv_sys_global_symbol_pipe= - fi -done -]) -if test -z "$lt_cv_sys_global_symbol_pipe"; then - lt_cv_sys_global_symbol_to_cdecl= -fi -if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then - AC_MSG_RESULT(failed) -else - AC_MSG_RESULT(ok) -fi -]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE - - -# AC_LIBTOOL_PROG_COMPILER_PIC([TAGNAME]) -# --------------------------------------- -AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC], -[_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)= -_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= -_LT_AC_TAGVAR(lt_prog_compiler_static, $1)= - -AC_MSG_CHECKING([for $compiler option to produce PIC]) - ifelse([$1],[CXX],[ - # C++ specific cases for pic, static, wl, etc. - if test "$GXX" = yes; then - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - amigaos*) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' - ;; - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - mingw* | os2* | pw32*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' - ;; - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' - ;; - *djgpp*) - # DJGPP does not support shared libraries at all - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - ;; - interix3*) - # Interix 3.x gcc -fpic/-fPIC options generate broken code. - # Instead, we relocate shared libraries at runtime. - ;; - sysv4*MP*) - if test -d /usr/nec; then - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic - fi - ;; - hpux*) - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case $host_cpu in - hppa*64*|ia64*) - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - else - case $host_os in - aix4* | aix5*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - else - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' - fi - ;; - chorus*) - case $cc_basename in - cxch68*) - # Green Hills C++ Compiler - # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" - ;; - esac - ;; - darwin*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - case $cc_basename in - xlc*) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon' - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - ;; - esac - ;; - dgux*) - case $cc_basename in - ec++*) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - ;; - ghcx*) - # Green Hills C++ Compiler - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - *) - ;; - esac - ;; - freebsd* | kfreebsd*-gnu | dragonfly*) - # FreeBSD uses GNU C++ - ;; - hpux9* | hpux10* | hpux11*) - case $cc_basename in - CC*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' - if test "$host_cpu" != ia64; then - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - fi - ;; - aCC*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' - case $host_cpu in - hppa*64*|ia64*) - # +Z the default - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - ;; - esac - ;; - *) - ;; - esac - ;; - interix*) - # This is c89, which is MS Visual C++ (no shared libs) - # Anyone wants to do a port? - ;; - irix5* | irix6* | nonstopux*) - case $cc_basename in - CC*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - # CC pic flag -KPIC is the default. - ;; - *) - ;; - esac - ;; - linux*) - case $cc_basename in - KCC*) - # KAI C++ Compiler - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - icpc* | ecpc*) - # Intel C++ - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - pgCC*) - # Portland Group C++ compiler. - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - cxx*) - # Compaq C++ - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - *) - ;; - esac - ;; - lynxos*) - ;; - m88k*) - ;; - mvs*) - case $cc_basename in - cxx*) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' - ;; - *) - ;; - esac - ;; - netbsd*) - ;; - osf3* | osf4* | osf5*) - case $cc_basename in - KCC*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' - ;; - RCC*) - # Rational C++ 2.4.1 - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - cxx*) - # Digital/Compaq C++ - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - *) - ;; - esac - ;; - psos*) - ;; - solaris*) - case $cc_basename in - CC*) - # Sun C++ 4.2, 5.x and Centerline C++ - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - ;; - gcx*) - # Green Hills C++ Compiler - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' - ;; - *) - ;; - esac - ;; - sunos4*) - case $cc_basename in - CC*) - # Sun C++ 4.x - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - lcc*) - # Lucid - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - *) - ;; - esac - ;; - tandem*) - case $cc_basename in - NCC*) - # NonStop-UX NCC 3.20 - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - ;; - *) - ;; - esac - ;; - sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) - case $cc_basename in - CC*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - esac - ;; - vxworks*) - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - esac - fi -], -[ - if test "$GCC" = yes; then - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - - amigaos*) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' - ;; - - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' - ;; - - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' - ;; - - interix3*) - # Interix 3.x gcc -fpic/-fPIC options generate broken code. - # Instead, we relocate shared libraries at runtime. - ;; - - msdosdjgpp*) - # Just because we use GCC doesn't mean we suddenly get shared libraries - # on systems that don't support them. - _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - enable_shared=no - ;; - - sysv4*MP*) - if test -d /usr/nec; then - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic - fi - ;; - - hpux*) - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case $host_cpu in - hppa*64*|ia64*) - # +Z the default - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - ;; - - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - else - # PORTME Check for flag to pass linker flags through the system compiler. - case $host_os in - aix*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - else - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' - fi - ;; - darwin*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - case $cc_basename in - xlc*) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon' - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - ;; - esac - ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' - ;; - - hpux9* | hpux10* | hpux11*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case $host_cpu in - hppa*64*|ia64*) - # +Z the default - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - ;; - esac - # Is there a better lt_prog_compiler_static that works with the bundled CC? - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' - ;; - - irix5* | irix6* | nonstopux*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # PIC (with -KPIC) is the default. - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - - newsos6) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - linux*) - case $cc_basename in - icc* | ecc*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - pgcc* | pgf77* | pgf90* | pgf95*) - # Portland Group compilers (*not* the Pentium gcc compiler, - # which looks to be a dead project) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - ccc*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # All Alpha code is PIC. - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - esac - ;; - - osf3* | osf4* | osf5*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # All OSF/1 code is PIC. - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - - solaris*) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - case $cc_basename in - f77* | f90* | f95*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; - *) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; - esac - ;; - - sunos4*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - sysv4*MP*) - if test -d /usr/nec ;then - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - - sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - unicos*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - - uts4*) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - *) - _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - esac - fi -]) -AC_MSG_RESULT([$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)]) - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then - AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works], - _LT_AC_TAGVAR(lt_prog_compiler_pic_works, $1), - [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])], [], - [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in - "" | " "*) ;; - *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)" ;; - esac], - [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) -fi -case $host_os in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])" - ;; -esac - -# -# Check to make sure the static flag actually works. -# -wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_AC_TAGVAR(lt_prog_compiler_static, $1)\" -AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], - _LT_AC_TAGVAR(lt_prog_compiler_static_works, $1), - $lt_tmp_static_flag, - [], - [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=]) -]) - - -# AC_LIBTOOL_PROG_LD_SHLIBS([TAGNAME]) -# ------------------------------------ -# See if the linker supports building shared libraries. -AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS], -[AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) -ifelse([$1],[CXX],[ - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - case $host_os in - aix4* | aix5*) - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | grep 'GNU' > /dev/null; then - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' - else - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' - fi - ;; - pw32*) - _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" - ;; - cygwin* | mingw*) - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]] /s/.* \([[^ ]]*\)/\1 DATA/;/^.* __nm__/s/^.* __nm__\([[^ ]]*\) [[^ ]]*/\1 DATA/;/^I /d;/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' - ;; - *) - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - ;; - esac -],[ - runpath_var= - _LT_AC_TAGVAR(allow_undefined_flag, $1)= - _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no - _LT_AC_TAGVAR(archive_cmds, $1)= - _LT_AC_TAGVAR(archive_expsym_cmds, $1)= - _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)= - _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)= - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= - _LT_AC_TAGVAR(thread_safe_flag_spec, $1)= - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_minus_L, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown - _LT_AC_TAGVAR(hardcode_automatic, $1)=no - _LT_AC_TAGVAR(module_cmds, $1)= - _LT_AC_TAGVAR(module_expsym_cmds, $1)= - _LT_AC_TAGVAR(always_export_symbols, $1)=no - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - # include_expsyms should be a list of space-separated symbols to be *always* - # included in the symbol list - _LT_AC_TAGVAR(include_expsyms, $1)= - # exclude_expsyms can be an extended regexp of symbols to exclude - # it will be wrapped by ` (' and `)$', so one must not match beginning or - # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', - # as well as any symbol that contains `d'. - _LT_AC_TAGVAR(exclude_expsyms, $1)="_GLOBAL_OFFSET_TABLE_" - # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out - # platforms (ab)use it in PIC code, but their linkers get confused if - # the symbol is explicitly referenced. Since portable code cannot - # rely on this symbol name, it's probably fine to never include it in - # preloaded symbol tables. - extract_expsyms_cmds= - # Just being paranoid about ensuring that cc_basename is set. - _LT_CC_BASENAME([$compiler]) - case $host_os in - cygwin* | mingw* | pw32*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no - fi - ;; - interix*) - # we just hope/assume this is gcc and not c89 (= MSVC++) - with_gnu_ld=yes - ;; - openbsd*) - with_gnu_ld=no - ;; - esac - - _LT_AC_TAGVAR(ld_shlibs, $1)=yes - if test "$with_gnu_ld" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # Set some defaults for GNU ld with shared library support. These - # are reset later if shared libraries are not supported. Putting them - # here allows them to be overridden if necessary. - runpath_var=LD_RUN_PATH - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= - fi - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - - # See if GNU ld supports shared libraries. - case $host_os in - aix3* | aix4* | aix5*) - # On AIX/PPC, the GNU linker is very broken - if test "$host_cpu" != ia64; then - _LT_AC_TAGVAR(ld_shlibs, $1)=no - cat <&2 - -*** Warning: the GNU linker, at least up to release 2.9.1, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to modify your PATH -*** so that a non-GNU linker is found, and then restart. - -EOF - fi - ;; - - amigaos*) - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - - # Samuel A. Falvo II reports - # that the semantics of dynamic libraries on AmigaOS, at least up - # to version 4, is to share data among multiple programs linked - # with the same dynamic library. Since this doesn't match the - # behavior of shared libraries on other platforms, we can't use - # them. - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - - beos*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - cygwin* | mingw* | pw32*) - # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, - # as there is no search path for DLLs. - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_AC_TAGVAR(always_export_symbols, $1)=no - _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' - - if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - interix3*) - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. - # Instead, shared libraries are loaded at an image base (0x10000000 by - # default) and relocated if they conflict, which is a slow very memory - # consuming and fragmenting process. To avoid this, we pick a random, - # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link - # time. Moving up from 0x10000000 also allows more sbrk(2) space. - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - ;; - - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_addflag= - case $cc_basename,$host_cpu in - pgcc*) # Portland Group C compiler - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag' - ;; - pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag -Mnomain' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - esac - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - - if test $supports_anon_versioning = yes; then - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - $echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris*) - if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then - _LT_AC_TAGVAR(ld_shlibs, $1)=no - cat <&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -EOF - elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) - case `$LD -v 2>&1` in - *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) - _LT_AC_TAGVAR(ld_shlibs, $1)=no - cat <<_LT_EOF 1>&2 - -*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not -*** reliably create shared libraries on SCO systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.16.91.0.3 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -_LT_EOF - ;; - *) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib' - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - - sunos4*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - *) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - - if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no; then - runpath_var= - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= - fi - else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported - fi - ;; - - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | grep 'GNU' > /dev/null; then - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' - else - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' - fi - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then - aix_use_runtimelinking=yes - break - fi - done - ;; - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - _LT_AC_TAGVAR(archive_cmds, $1)='' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - - if test "$GCC" = yes; then - case $host_os in aix4.[[012]]|aix4.[[012]].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - else - # We have old collect2 - _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= - fi - ;; - esac - shared_flag='-shared' - if test "$aix_use_runtimelinking" = yes; then - shared_flag="$shared_flag "'${wl}-G' - fi - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' - # Determine the default libpath from the value encoded in an empty executable. - _LT_AC_SYS_LIBPATH_AIX - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' - _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an empty executable. - _LT_AC_SYS_LIBPATH_AIX - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - # Exported symbols can be pulled into shared objects from archives - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='$convenience' - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes - # This is similar to how AIX traditionally builds its shared libraries. - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - amigaos*) - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - # see comment about different semantics on the GNU ld section - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - - bsdi[[45]]*) - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic - ;; - - cygwin* | mingw* | pw32*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='true' - # FIXME: Should let the user specify the lib program. - _LT_AC_TAGVAR(old_archive_cmds, $1)='lib /OUT:$oldlib$oldobjs$old_deplibs' - _LT_AC_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`' - _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - ;; - - darwin* | rhapsody*) - case $host_os in - rhapsody* | darwin1.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - ;; - 10.*) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup' - ;; - esac - fi - ;; - esac - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_automatic, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - if test "$GCC" = yes ; then - output_verbose_link_cmd='echo' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - case $cc_basename in - xlc*) - output_verbose_link_cmd='echo' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' - _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - ;; - *) - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - fi - ;; - - dgux*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - freebsd1.*) - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2.*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | kfreebsd*-gnu | dragonfly*) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - hpux9*) - if test "$GCC" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - ;; - - hpux10*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' - fi - if test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - fi - ;; - - hpux11*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then - case $host_cpu in - hppa*64*) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - else - case $host_cpu in - hppa*64*) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - fi - if test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - case $host_cpu in - hppa*64*|ia64*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - *) - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - ;; - esac - fi - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - newsos6) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - openbsd*) - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - else - case $host_os in - openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - ;; - esac - fi - ;; - - os2*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_AC_TAGVAR(archive_cmds, $1)='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - else - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' - - # Both c and cxx compiler support -rpath directly - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - fi - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - - solaris*) - _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' - if test "$GCC" = yes; then - wlarc='${wl}' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' - else - wlarc='' - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - case $host_os in - solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) - # The compiler driver will combine linker options so we - # cannot just pass the convience library names through - # without $wl, iff we do not link with $LD. - # Luckily, gcc supports the same syntax we need for Sun Studio. - # Supported since Solaris 2.6 (maybe 2.5.1?) - case $wlarc in - '') - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; - *) - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; - esac ;; - esac - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - ;; - - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - sysv4) - case $host_vendor in - sni) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' - _LT_AC_TAGVAR(hardcode_direct, $1)=no - ;; - motorola) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - sysv4.3*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - _LT_AC_TAGVAR(ld_shlibs, $1)=yes - fi - ;; - - sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7*) - _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - runpath_var='LD_RUN_PATH' - - if test "$GCC" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - ;; - - sysv5* | sco3.2v5* | sco5v6*) - # Note: We can NOT use -z defs as we might desire, because we do not - # link with -lc, and that would cause any symbols used from libc to - # always be unresolved, which means just about no library would - # ever link correctly. If we're not using GNU ld we use -z text - # though, which does catch some bad symbols but isn't as heavy-handed - # as -z defs. - _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' - _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' - runpath_var='LD_RUN_PATH' - - if test "$GCC" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - ;; - - uts4*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - *) - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - fi -]) -AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) -test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no - -# -# Do we need to explicitly link libc? -# -case "x$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)" in -x|xyes) - # Assume -lc should be added - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $_LT_AC_TAGVAR(archive_cmds, $1) in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - AC_MSG_CHECKING([whether -lc should be explicitly linked in]) - $rm conftest* - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - - if AC_TRY_EVAL(ac_compile) 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) - pic_flag=$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$_LT_AC_TAGVAR(allow_undefined_flag, $1) - _LT_AC_TAGVAR(allow_undefined_flag, $1)= - if AC_TRY_EVAL(_LT_AC_TAGVAR(archive_cmds, $1) 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) - then - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - else - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes - fi - _LT_AC_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $rm conftest* - AC_MSG_RESULT([$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)]) - ;; - esac - fi - ;; -esac -])# AC_LIBTOOL_PROG_LD_SHLIBS - - -# _LT_AC_FILE_LTDLL_C -# ------------------- -# Be careful that the start marker always follows a newline. -AC_DEFUN([_LT_AC_FILE_LTDLL_C], [ -# /* ltdll.c starts here */ -# #define WIN32_LEAN_AND_MEAN -# #include -# #undef WIN32_LEAN_AND_MEAN -# #include -# -# #ifndef __CYGWIN__ -# # ifdef __CYGWIN32__ -# # define __CYGWIN__ __CYGWIN32__ -# # endif -# #endif -# -# #ifdef __cplusplus -# extern "C" { -# #endif -# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); -# #ifdef __cplusplus -# } -# #endif -# -# #ifdef __CYGWIN__ -# #include -# DECLARE_CYGWIN_DLL( DllMain ); -# #endif -# HINSTANCE __hDllInstance_base; -# -# BOOL APIENTRY -# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) -# { -# __hDllInstance_base = hInst; -# return TRUE; -# } -# /* ltdll.c ends here */ -])# _LT_AC_FILE_LTDLL_C - - -# _LT_AC_TAGVAR(VARNAME, [TAGNAME]) -# --------------------------------- -AC_DEFUN([_LT_AC_TAGVAR], [ifelse([$2], [], [$1], [$1_$2])]) - - -# old names -AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL]) -AC_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) -AC_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) -AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) -AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) -AC_DEFUN([AM_PROG_LD], [AC_PROG_LD]) -AC_DEFUN([AM_PROG_NM], [AC_PROG_NM]) - -# This is just to silence aclocal about the macro not being used -ifelse([AC_DISABLE_FAST_INSTALL]) - -AC_DEFUN([LT_AC_PROG_GCJ], -[AC_CHECK_TOOL(GCJ, gcj, no) - test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" - AC_SUBST(GCJFLAGS) -]) - -AC_DEFUN([LT_AC_PROG_RC], -[AC_CHECK_TOOL(RC, windres, no) -]) - -############################################################ -# NOTE: This macro has been submitted for inclusion into # -# GNU Autoconf as AC_PROG_SED. When it is available in # -# a released version of Autoconf we should remove this # -# macro and use it instead. # -############################################################ -# LT_AC_PROG_SED -# -------------- -# Check for a fully-functional sed program, that truncates -# as few characters as possible. Prefer GNU sed if found. -AC_DEFUN([LT_AC_PROG_SED], -[AC_MSG_CHECKING([for a sed that does not truncate output]) -AC_CACHE_VAL(lt_cv_path_SED, -[# Loop through the user's path and test for sed and gsed. -# Then use that list of sed's as ones to test for truncation. -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for lt_ac_prog in sed gsed; do - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then - lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" - fi - done - done -done -lt_ac_max=0 -lt_ac_count=0 -# Add /usr/xpg4/bin/sed as it is typically found on Solaris -# along with /bin/sed that truncates output. -for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do - test ! -f $lt_ac_sed && continue - cat /dev/null > conftest.in - lt_ac_count=0 - echo $ECHO_N "0123456789$ECHO_C" >conftest.in - # Check for GNU sed and select it if it is found. - if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then - lt_cv_path_SED=$lt_ac_sed - break - fi - while true; do - cat conftest.in conftest.in >conftest.tmp - mv conftest.tmp conftest.in - cp conftest.in conftest.nl - echo >>conftest.nl - $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break - cmp -s conftest.out conftest.nl || break - # 10000 chars as input seems more than enough - test $lt_ac_count -gt 10 && break - lt_ac_count=`expr $lt_ac_count + 1` - if test $lt_ac_count -gt $lt_ac_max; then - lt_ac_max=$lt_ac_count - lt_cv_path_SED=$lt_ac_sed - fi - done -done -]) -SED=$lt_cv_path_SED -AC_MSG_RESULT([$SED]) -]) diff --git a/autoconf/m4/link_options.m4 b/autoconf/m4/link_options.m4 deleted file mode 100644 index b58d61745..000000000 --- a/autoconf/m4/link_options.m4 +++ /dev/null @@ -1,109 +0,0 @@ -# -# Get the linker version string. -# -# This macro is specific to LLVM. -# -AC_DEFUN([AC_LINK_GET_VERSION], - [AC_CACHE_CHECK([for linker version],[llvm_cv_link_version], - [ - version_string="$(ld -v 2>&1 | head -1)" - - # Check for ld64. - if (echo "$version_string" | grep -q "ld64"); then - llvm_cv_link_version=$(echo "$version_string" | sed -e "s#.*ld64-\([^ ]*\)\( (.*)\)\{0,1\}#\1#") - else - llvm_cv_link_version=$(echo "$version_string" | sed -e "s#[^0-9]*\([0-9.]*\).*#\1#") - fi - ]) - AC_DEFINE_UNQUOTED([HOST_LINK_VERSION],"$llvm_cv_link_version", - [Linker version detected at compile time.]) -]) - -# -# Determine if the system can handle the -R option being passed to the linker. -# -# This macro is specific to LLVM. -# -AC_DEFUN([AC_LINK_USE_R], -[AC_CACHE_CHECK([for compiler -Wl,-R option],[llvm_cv_link_use_r], -[ AC_LANG_PUSH([C]) - oldcflags="$CFLAGS" - CFLAGS="$CFLAGS -Wl,-R." - AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])], - [llvm_cv_link_use_r=yes],[llvm_cv_link_use_r=no]) - CFLAGS="$oldcflags" - AC_LANG_POP([C]) -]) -if test "$llvm_cv_link_use_r" = yes ; then - AC_DEFINE([HAVE_LINK_R],[1],[Define if you can use -Wl,-R. to pass -R. to the linker, in order to add the current directory to the dynamic linker search path.]) - fi -]) - -# -# Determine if the system can handle the -rdynamic option being passed -# to the compiler. -# -# This macro is specific to LLVM. -# -AC_DEFUN([AC_LINK_EXPORT_DYNAMIC], -[AC_CACHE_CHECK([for compiler -rdynamic option], - [llvm_cv_link_use_export_dynamic], -[ AC_LANG_PUSH([C]) - oldcflags="$CFLAGS" - CFLAGS="$CFLAGS -rdynamic" - AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])], - [llvm_cv_link_use_export_dynamic=yes],[llvm_cv_link_use_export_dynamic=no]) - CFLAGS="$oldcflags" - AC_LANG_POP([C]) -]) -if test "$llvm_cv_link_use_export_dynamic" = yes ; then - AC_DEFINE([HAVE_LINK_EXPORT_DYNAMIC],[1],[Define if you can use -rdynamic.]) - fi -]) - -# -# Determine if the system can handle the --version-script option being -# passed to the linker. -# -# This macro is specific to LLVM. -# -AC_DEFUN([AC_LINK_VERSION_SCRIPT], -[AC_CACHE_CHECK([for compiler -Wl,--version-script option], - [llvm_cv_link_use_version_script], -[ AC_LANG_PUSH([C]) - oldcflags="$CFLAGS" - - # The following code is from the autoconf manual, - # "11.13: Limitations of Usual Tools". - # Create a temporary directory $tmp in $TMPDIR (default /tmp). - # Use mktemp if possible; otherwise fall back on mkdir, - # with $RANDOM to make collisions less likely. - : ${TMPDIR=/tmp} - { - tmp=` - (umask 077 && mktemp -d "$TMPDIR/fooXXXXXX") 2>/dev/null - ` && - test -n "$tmp" && test -d "$tmp" - } || { - tmp=$TMPDIR/foo$$-$RANDOM - (umask 077 && mkdir "$tmp") - } || exit $? - - echo "{" > "$tmp/export.map" - echo " global: main;" >> "$tmp/export.map" - echo " local: *;" >> "$tmp/export.map" - echo "};" >> "$tmp/export.map" - - CFLAGS="$CFLAGS -Wl,--version-script=$tmp/export.map" - AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])], - [llvm_cv_link_use_version_script=yes],[llvm_cv_link_use_version_script=no]) - rm "$tmp/export.map" - rmdir "$tmp" - CFLAGS="$oldcflags" - AC_LANG_POP([C]) -]) -if test "$llvm_cv_link_use_version_script" = yes ; then - AC_SUBST(HAVE_LINK_VERSION_SCRIPT,1) - fi -]) - diff --git a/autoconf/m4/linux_mixed_64_32.m4 b/autoconf/m4/linux_mixed_64_32.m4 deleted file mode 100644 index 123491f87..000000000 --- a/autoconf/m4/linux_mixed_64_32.m4 +++ /dev/null @@ -1,17 +0,0 @@ -# -# Some Linux machines run a 64-bit kernel with a 32-bit userspace. 'uname -m' -# shows these as x86_64. Ask the system 'gcc' what it thinks. -# -AC_DEFUN([AC_IS_LINUX_MIXED], -[AC_CACHE_CHECK(for 32-bit userspace on 64-bit system,llvm_cv_linux_mixed, -[ AC_LANG_PUSH([C]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM( - [[#ifndef __x86_64__ - error: Not x86-64 even if uname says so! - #endif - ]])], - [llvm_cv_linux_mixed=no], - [llvm_cv_linux_mixed=yes]) - AC_LANG_POP([C]) -]) -]) diff --git a/autoconf/m4/ltdl.m4 b/autoconf/m4/ltdl.m4 deleted file mode 100644 index 0a36dbe7c..000000000 --- a/autoconf/m4/ltdl.m4 +++ /dev/null @@ -1,403 +0,0 @@ -## ltdl.m4 - Configure ltdl for the target system. -*-Autoconf-*- -## Copyright (C) 1999-2000 Free Software Foundation, Inc. -## -## This file is free software; the Free Software Foundation gives -## unlimited permission to copy and/or distribute it, with or without -## modifications, as long as this notice is preserved. - -# serial 7 AC_LIB_LTDL - -# AC_WITH_LTDL -# ------------ -# Clients of libltdl can use this macro to allow the installer to -# choose between a shipped copy of the ltdl sources or a preinstalled -# version of the library. -AC_DEFUN([AC_WITH_LTDL], -[AC_REQUIRE([AC_LIB_LTDL]) -AC_SUBST([LIBLTDL]) -AC_SUBST([INCLTDL]) - -# Unless the user asks us to check, assume no installed ltdl exists. -use_installed_libltdl=no - -AC_ARG_WITH([included_ltdl], - [ --with-included-ltdl use the GNU ltdl sources included here]) - -if test "x$with_included_ltdl" != xyes; then - # We are not being forced to use the included libltdl sources, so - # decide whether there is a useful installed version we can use. - AC_CHECK_HEADER([ltdl.h], - [AC_CHECK_LIB([ltdl], [lt_dlcaller_register], - [with_included_ltdl=no], - [with_included_ltdl=yes]) - ]) -fi - -if test "x$enable_ltdl_install" != xyes; then - # If the user did not specify an installable libltdl, then default - # to a convenience lib. - AC_LIBLTDL_CONVENIENCE -fi - -if test "x$with_included_ltdl" = xno; then - # If the included ltdl is not to be used. then Use the - # preinstalled libltdl we found. - AC_DEFINE([HAVE_LTDL], [1], - [Define this if a modern libltdl is already installed]) - LIBLTDL=-lltdl -fi - -# Report our decision... -AC_MSG_CHECKING([whether to use included libltdl]) -AC_MSG_RESULT([$with_included_ltdl]) - -AC_CONFIG_SUBDIRS([libltdl]) -])# AC_WITH_LTDL - - -# AC_LIB_LTDL -# ----------- -# Perform all the checks necessary for compilation of the ltdl objects -# -- including compiler checks and header checks. -AC_DEFUN([AC_LIB_LTDL], -[AC_PREREQ(2.60) -AC_REQUIRE([AC_PROG_CC]) -AC_REQUIRE([AC_C_CONST]) -AC_REQUIRE([AC_HEADER_STDC]) -AC_REQUIRE([AC_HEADER_DIRENT]) -AC_REQUIRE([_LT_AC_CHECK_DLFCN]) -AC_REQUIRE([AC_LTDL_ENABLE_INSTALL]) -AC_REQUIRE([AC_LTDL_SHLIBEXT]) -AC_REQUIRE([AC_LTDL_SYSSEARCHPATH]) -AC_REQUIRE([AC_LTDL_OBJDIR]) -AC_REQUIRE([AC_LTDL_DLPREOPEN]) -AC_REQUIRE([AC_LTDL_DLLIB]) -AC_REQUIRE([AC_LTDL_SYMBOL_USCORE]) -AC_REQUIRE([AC_LTDL_DLSYM_USCORE]) -AC_REQUIRE([AC_LTDL_SYS_DLOPEN_DEPLIBS]) -AC_REQUIRE([AC_LTDL_FUNC_ARGZ]) - -AC_CHECK_HEADERS([assert.h ctype.h errno.h malloc.h memory.h stdlib.h \ - stdio.h unistd.h]) -AC_CHECK_HEADERS([dl.h sys/dl.h dld.h mach-o/dyld.h]) -AC_CHECK_HEADERS([string.h strings.h], [break]) - -AC_CHECK_FUNCS([strchr index], [break]) -AC_CHECK_FUNCS([strrchr rindex], [break]) -AC_CHECK_FUNCS([memcpy bcopy], [break]) -AC_CHECK_FUNCS([memmove strcmp]) -AC_CHECK_FUNCS([closedir opendir readdir]) -])# AC_LIB_LTDL - - -# AC_LTDL_ENABLE_INSTALL -# ---------------------- -AC_DEFUN([AC_LTDL_ENABLE_INSTALL], -[AC_ARG_ENABLE([ltdl-install], - [AS_HELP_STRING([--enable-ltdl-install],[install libltdl])]) - -AM_CONDITIONAL(INSTALL_LTDL, test x"${enable_ltdl_install-no}" != xno) -AM_CONDITIONAL(CONVENIENCE_LTDL, test x"${enable_ltdl_convenience-no}" != xno) -])# AC_LTDL_ENABLE_INSTALL - - -# AC_LTDL_SYS_DLOPEN_DEPLIBS -# -------------------------- -AC_DEFUN([AC_LTDL_SYS_DLOPEN_DEPLIBS], -[AC_REQUIRE([AC_CANONICAL_HOST]) -AC_CACHE_CHECK([whether deplibs are loaded by dlopen], - [libltdl_cv_sys_dlopen_deplibs], - [# PORTME does your system automatically load deplibs for dlopen? - # or its logical equivalent (e.g. shl_load for HP-UX < 11) - # For now, we just catch OSes we know something about -- in the - # future, we'll try test this programmatically. - libltdl_cv_sys_dlopen_deplibs=unknown - case "$host_os" in - aix3*|aix4.1.*|aix4.2.*) - # Unknown whether this is true for these versions of AIX, but - # we want this `case' here to explicitly catch those versions. - libltdl_cv_sys_dlopen_deplibs=unknown - ;; - aix[[45]]*) - libltdl_cv_sys_dlopen_deplibs=yes - ;; - darwin*) - # Assuming the user has installed a libdl from somewhere, this is true - # If you are looking for one http://www.opendarwin.org/projects/dlcompat - libltdl_cv_sys_dlopen_deplibs=yes - ;; - gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu) - # GNU and its variants, using gnu ld.so (Glibc) - libltdl_cv_sys_dlopen_deplibs=yes - ;; - hpux10*|hpux11*) - libltdl_cv_sys_dlopen_deplibs=yes - ;; - interix*) - libltdl_cv_sys_dlopen_deplibs=yes - ;; - irix[[12345]]*|irix6.[[01]]*) - # Catch all versions of IRIX before 6.2, and indicate that we don't - # know how it worked for any of those versions. - libltdl_cv_sys_dlopen_deplibs=unknown - ;; - irix*) - # The case above catches anything before 6.2, and it's known that - # at 6.2 and later dlopen does load deplibs. - libltdl_cv_sys_dlopen_deplibs=yes - ;; - netbsd*) - libltdl_cv_sys_dlopen_deplibs=yes - ;; - openbsd*) - libltdl_cv_sys_dlopen_deplibs=yes - ;; - osf[[1234]]*) - # dlopen did load deplibs (at least at 4.x), but until the 5.x series, - # it did *not* use an RPATH in a shared library to find objects the - # library depends on, so we explicitly say `no'. - libltdl_cv_sys_dlopen_deplibs=no - ;; - osf5.0|osf5.0a|osf5.1) - # dlopen *does* load deplibs and with the right loader patch applied - # it even uses RPATH in a shared library to search for shared objects - # that the library depends on, but there's no easy way to know if that - # patch is installed. Since this is the case, all we can really - # say is unknown -- it depends on the patch being installed. If - # it is, this changes to `yes'. Without it, it would be `no'. - libltdl_cv_sys_dlopen_deplibs=unknown - ;; - osf*) - # the two cases above should catch all versions of osf <= 5.1. Read - # the comments above for what we know about them. - # At > 5.1, deplibs are loaded *and* any RPATH in a shared library - # is used to find them so we can finally say `yes'. - libltdl_cv_sys_dlopen_deplibs=yes - ;; - solaris*) - libltdl_cv_sys_dlopen_deplibs=yes - ;; - sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - libltdl_cv_sys_dlopen_deplibs=yes - ;; - esac - ]) -if test "$libltdl_cv_sys_dlopen_deplibs" != yes; then - AC_DEFINE([LTDL_DLOPEN_DEPLIBS], [1], - [Define if the OS needs help to load dependent libraries for dlopen().]) -fi -])# AC_LTDL_SYS_DLOPEN_DEPLIBS - - -# AC_LTDL_SHLIBEXT -# ---------------- -AC_DEFUN([AC_LTDL_SHLIBEXT], -[AC_REQUIRE([AC_LIBTOOL_SYS_DYNAMIC_LINKER]) -AC_CACHE_CHECK([which extension is used for loadable modules], - [libltdl_cv_shlibext], -[ -module=yes -eval libltdl_cv_shlibext=$shrext_cmds - ]) -if test -n "$libltdl_cv_shlibext"; then - AC_DEFINE_UNQUOTED([LTDL_SHLIB_EXT], ["$libltdl_cv_shlibext"], - [Define to the extension used for shared libraries, say, ".so".]) -fi -])# AC_LTDL_SHLIBEXT - -# AC_LTDL_SYSSEARCHPATH -# --------------------- -AC_DEFUN([AC_LTDL_SYSSEARCHPATH], -[AC_REQUIRE([AC_LIBTOOL_SYS_DYNAMIC_LINKER]) -AC_CACHE_CHECK([for the default library search path], - [libltdl_cv_sys_search_path], - [libltdl_cv_sys_search_path="$sys_lib_dlsearch_path_spec"]) -if test -n "$libltdl_cv_sys_search_path"; then - sys_search_path= - for dir in $libltdl_cv_sys_search_path; do - if test -z "$sys_search_path"; then - sys_search_path="$dir" - else - sys_search_path="$sys_search_path$PATH_SEPARATOR$dir" - fi - done - AC_DEFINE_UNQUOTED([LTDL_SYSSEARCHPATH], ["$sys_search_path"], - [Define to the system default library search path.]) -fi -])# AC_LTDL_SYSSEARCHPATH - - -# AC_LTDL_OBJDIR -# -------------- -AC_DEFUN([AC_LTDL_OBJDIR], -[AC_CACHE_CHECK([for objdir], - [libltdl_cv_objdir], - [libltdl_cv_objdir="$objdir" - if test -n "$objdir"; then - : - else - rm -f .libs 2>/dev/null - mkdir .libs 2>/dev/null - if test -d .libs; then - libltdl_cv_objdir=.libs - else - # MS-DOS does not allow filenames that begin with a dot. - libltdl_cv_objdir=_libs - fi - rmdir .libs 2>/dev/null - fi - ]) -AC_DEFINE_UNQUOTED([LTDL_OBJDIR], ["$libltdl_cv_objdir/"], - [Define to the sub-directory in which libtool stores uninstalled libraries.]) -])# AC_LTDL_OBJDIR - - -# AC_LTDL_DLPREOPEN -# ----------------- -AC_DEFUN([AC_LTDL_DLPREOPEN], -[AC_REQUIRE([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE]) -AC_CACHE_CHECK([whether libtool supports -dlopen/-dlpreopen], - [libltdl_cv_preloaded_symbols], - [if test -n "$lt_cv_sys_global_symbol_pipe"; then - libltdl_cv_preloaded_symbols=yes - else - libltdl_cv_preloaded_symbols=no - fi - ]) -if test x"$libltdl_cv_preloaded_symbols" = xyes; then - AC_DEFINE([HAVE_PRELOADED_SYMBOLS], [1], - [Define if libtool can extract symbol lists from object files.]) -fi -])# AC_LTDL_DLPREOPEN - - -# AC_LTDL_DLLIB -# ------------- -AC_DEFUN([AC_LTDL_DLLIB], -[LIBADD_DL= -AC_SUBST(LIBADD_DL) -AC_LANG_PUSH([C]) - -AC_CHECK_FUNC([shl_load], - [AC_DEFINE([HAVE_SHL_LOAD], [1], - [Define if you have the shl_load function.])], - [AC_CHECK_LIB([dld], [shl_load], - [AC_DEFINE([HAVE_SHL_LOAD], [1], - [Define if you have the shl_load function.]) - LIBADD_DL="$LIBADD_DL -ldld"], - [AC_CHECK_LIB([dl], [dlopen], - [AC_DEFINE([HAVE_LIBDL], [1], - [Define if you have the libdl library or equivalent.]) - LIBADD_DL="-ldl" libltdl_cv_lib_dl_dlopen="yes"], - [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#if HAVE_DLFCN_H -# include -#endif - ]], [[dlopen(0, 0);]])],[AC_DEFINE([HAVE_LIBDL], [1], - [Define if you have the libdl library or equivalent.]) libltdl_cv_func_dlopen="yes"],[AC_CHECK_LIB([svld], [dlopen], - [AC_DEFINE([HAVE_LIBDL], [1], - [Define if you have the libdl library or equivalent.]) - LIBADD_DL="-lsvld" libltdl_cv_func_dlopen="yes"], - [AC_CHECK_LIB([dld], [dld_link], - [AC_DEFINE([HAVE_DLD], [1], - [Define if you have the GNU dld library.]) - LIBADD_DL="$LIBADD_DL -ldld"], - [AC_CHECK_FUNC([_dyld_func_lookup], - [AC_DEFINE([HAVE_DYLD], [1], - [Define if you have the _dyld_func_lookup function.])]) - ]) - ]) - ]) - ]) - ]) -]) - -if test x"$libltdl_cv_func_dlopen" = xyes || test x"$libltdl_cv_lib_dl_dlopen" = xyes -then - lt_save_LIBS="$LIBS" - LIBS="$LIBS $LIBADD_DL" - AC_CHECK_FUNCS([dlerror]) - LIBS="$lt_save_LIBS" -fi -AC_LANG_POP -])# AC_LTDL_DLLIB - - -# AC_LTDL_SYMBOL_USCORE -# --------------------- -# does the compiler prefix global symbols with an underscore? -AC_DEFUN([AC_LTDL_SYMBOL_USCORE], -[AC_REQUIRE([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE]) -AC_CACHE_CHECK([for _ prefix in compiled symbols], - [ac_cv_sys_symbol_underscore], - [ac_cv_sys_symbol_underscore=no - cat > conftest.$ac_ext < $ac_nlist) && test -s "$ac_nlist"; then - # See whether the symbols have a leading underscore. - if grep '^. _nm_test_func' "$ac_nlist" >/dev/null; then - ac_cv_sys_symbol_underscore=yes - else - if grep '^. nm_test_func ' "$ac_nlist" >/dev/null; then - : - else - echo "configure: cannot find nm_test_func in $ac_nlist" >&AS_MESSAGE_LOG_FD - fi - fi - else - echo "configure: cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD - fi - else - echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD - cat conftest.c >&AS_MESSAGE_LOG_FD - fi - rm -rf conftest* - ]) -])# AC_LTDL_SYMBOL_USCORE - - -# AC_LTDL_DLSYM_USCORE -# -------------------- -AC_DEFUN([AC_LTDL_DLSYM_USCORE], -[AC_REQUIRE([AC_LTDL_SYMBOL_USCORE]) -if test x"$ac_cv_sys_symbol_underscore" = xyes; then - if test x"$libltdl_cv_func_dlopen" = xyes || - test x"$libltdl_cv_lib_dl_dlopen" = xyes ; then - AC_CACHE_CHECK([whether we have to add an underscore for dlsym], - [libltdl_cv_need_uscore], - [libltdl_cv_need_uscore=unknown - save_LIBS="$LIBS" - LIBS="$LIBS $LIBADD_DL" - _LT_AC_TRY_DLOPEN_SELF( - [libltdl_cv_need_uscore=no], [libltdl_cv_need_uscore=yes], - [], [libltdl_cv_need_uscore=cross]) - LIBS="$save_LIBS" - ]) - fi -fi - -if test x"$libltdl_cv_need_uscore" = xyes; then - AC_DEFINE([NEED_USCORE], [1], - [Define if dlsym() requires a leading underscore in symbol names.]) -fi -])# AC_LTDL_DLSYM_USCORE - -# AC_LTDL_FUNC_ARGZ -# ----------------- -AC_DEFUN([AC_LTDL_FUNC_ARGZ], -[AC_CHECK_HEADERS([argz.h]) - -AC_CHECK_TYPES([error_t], - [], - [AC_DEFINE([error_t], [int], - [Define to a type to use for `error_t' if it is not otherwise available.])], - [#if HAVE_ARGZ_H -# include -#endif]) - -AC_CHECK_FUNCS([argz_append argz_create_sep argz_insert argz_next argz_stringify]) -])# AC_LTDL_FUNC_ARGZ diff --git a/autoconf/m4/need_dev_zero_for_mmap.m4 b/autoconf/m4/need_dev_zero_for_mmap.m4 deleted file mode 100644 index 57b322830..000000000 --- a/autoconf/m4/need_dev_zero_for_mmap.m4 +++ /dev/null @@ -1,17 +0,0 @@ -# -# When allocating RWX memory, check whether we need to use /dev/zero -# as the file descriptor or not. -# -AC_DEFUN([AC_NEED_DEV_ZERO_FOR_MMAP], -[AC_CACHE_CHECK([if /dev/zero is needed for mmap], -ac_cv_need_dev_zero_for_mmap, -[if test "$llvm_cv_os_type" = "Interix" ; then - ac_cv_need_dev_zero_for_mmap=yes - else - ac_cv_need_dev_zero_for_mmap=no - fi -]) -if test "$ac_cv_need_dev_zero_for_mmap" = yes; then - AC_DEFINE([NEED_DEV_ZERO_FOR_MMAP],[1], - [Define if /dev/zero should be used when mapping RWX memory, or undefine if its not necessary]) -fi]) diff --git a/autoconf/m4/path_tclsh.m4 b/autoconf/m4/path_tclsh.m4 deleted file mode 100644 index 85433de71..000000000 --- a/autoconf/m4/path_tclsh.m4 +++ /dev/null @@ -1,39 +0,0 @@ -dnl This macro checks for tclsh which is required to run dejagnu. On some -dnl platforms (notably FreeBSD), tclsh is named tclshX.Y - this handles -dnl that for us so we can get the latest installed tclsh version. -dnl -AC_DEFUN([DJ_AC_PATH_TCLSH], [ -no_itcl=true -AC_MSG_CHECKING(for the tclsh program in tclinclude directory) -AC_ARG_WITH(tclinclude, - AS_HELP_STRING([--with-tclinclude], - [directory where tcl headers are]), - [with_tclinclude=${withval}],[with_tclinclude='']) -AC_CACHE_VAL(ac_cv_path_tclsh,[ -dnl first check to see if --with-itclinclude was specified -if test x"${with_tclinclude}" != x ; then - if test -f ${with_tclinclude}/tclsh ; then - ac_cv_path_tclsh=`(cd ${with_tclinclude}; pwd)` - elif test -f ${with_tclinclude}/src/tclsh ; then - ac_cv_path_tclsh=`(cd ${with_tclinclude}/src; pwd)` - else - AC_MSG_ERROR([${with_tclinclude} directory doesn't contain tclsh]) - fi -fi]) - -dnl see if one is installed -if test x"${ac_cv_path_tclsh}" = x ; then - AC_MSG_RESULT(none) - AC_PATH_PROGS([TCLSH],[tclsh8.4 tclsh8.4.8 tclsh8.4.7 tclsh8.4.6 tclsh8.4.5 tclsh8.4.4 tclsh8.4.3 tclsh8.4.2 tclsh8.4.1 tclsh8.4.0 tclsh8.3 tclsh8.3.5 tclsh8.3.4 tclsh8.3.3 tclsh8.3.2 tclsh8.3.1 tclsh8.3.0 tclsh]) - if test x"${TCLSH}" = x ; then - ac_cv_path_tclsh=''; - else - ac_cv_path_tclsh="${TCLSH}"; - fi -else - AC_MSG_RESULT(${ac_cv_path_tclsh}) - TCLSH="${ac_cv_path_tclsh}" - AC_SUBST(TCLSH) -fi -]) - diff --git a/autoconf/m4/rand48.m4 b/autoconf/m4/rand48.m4 deleted file mode 100644 index 76f08faad..000000000 --- a/autoconf/m4/rand48.m4 +++ /dev/null @@ -1,12 +0,0 @@ -# -# This function determins if the srand48,drand48,lrand48 functions are -# available on this platform. -# -AC_DEFUN([AC_FUNC_RAND48],[ -AC_SINGLE_CXX_CHECK([ac_cv_func_rand48], - [srand48/lrand48/drand48], [], - [srand48(0);lrand48();drand48();]) -if test "$ac_cv_func_rand48" = "yes" ; then -AC_DEFINE([HAVE_RAND48],1,[Define to 1 if srand48/lrand48/drand48 exist in ]) -fi -]) diff --git a/autoconf/m4/sanity_check.m4 b/autoconf/m4/sanity_check.m4 deleted file mode 100644 index 639fccca2..000000000 --- a/autoconf/m4/sanity_check.m4 +++ /dev/null @@ -1,31 +0,0 @@ -dnl Check a program for version sanity. The test runs a program, passes it an -dnl argument to make it print out some identification string, and filters that -dnl output with a regular expression. If the output is non-empty, the program -dnl passes the sanity check. -dnl $1 - Name or full path of the program to run -dnl $2 - Argument to pass to print out identification string -dnl $3 - grep RE to match identification string -dnl $4 - set to 1 to make errors only a warning -AC_DEFUN([CHECK_PROGRAM_SANITY], -[ -AC_MSG_CHECKING([sanity for program ]$1) -sanity="0" -sanity_path=`which $1 2>/dev/null` -if test "$?" -eq 0 -a -x "$sanity_path" ; then - sanity=`$1 $2 2>&1 | grep "$3"` - if test -z "$sanity" ; then - AC_MSG_RESULT([no]) - sanity="0" - if test "$4" -eq 1 ; then - AC_MSG_WARN([Program ]$1[ failed to pass sanity check.]) - else - AC_MSG_ERROR([Program ]$1[ failed to pass sanity check.]) - fi - else - AC_MSG_RESULT([yes]) - sanity="1" - fi -else - AC_MSG_RESULT([not found]) -fi -]) diff --git a/autoconf/m4/single_cxx_check.m4 b/autoconf/m4/single_cxx_check.m4 deleted file mode 100644 index 21efa4bed..000000000 --- a/autoconf/m4/single_cxx_check.m4 +++ /dev/null @@ -1,10 +0,0 @@ -dnl AC_SINGLE_CXX_CHECK(CACHEVAR, FUNCTION, HEADER, PROGRAM) -dnl $1, $2, $3, $4, -dnl -AC_DEFUN([AC_SINGLE_CXX_CHECK], - [AC_CACHE_CHECK([for $2 in $3], [$1], - [AC_LANG_PUSH([C++]) - AC_COMPILE_IFELSE(AC_LANG_PROGRAM([#include $3],[$4]),[$1=yes],[$1=no]) - AC_LANG_POP([C++])]) - ]) - diff --git a/autoconf/m4/visibility_inlines_hidden.m4 b/autoconf/m4/visibility_inlines_hidden.m4 deleted file mode 100644 index b1cc42aa5..000000000 --- a/autoconf/m4/visibility_inlines_hidden.m4 +++ /dev/null @@ -1,24 +0,0 @@ -# -# Determine if the compiler accepts -fvisibility-inlines-hidden -# -# This macro is specific to LLVM. -# -AC_DEFUN([AC_CXX_USE_VISIBILITY_INLINES_HIDDEN], -[AC_CACHE_CHECK([for compiler -fvisibility-inlines-hidden option], - [llvm_cv_cxx_visibility_inlines_hidden], -[ AC_LANG_PUSH([C++]) - oldcxxflags="$CXXFLAGS" - CXXFLAGS="$CXXFLAGS -O0 -fvisibility-inlines-hidden -Werror" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM( - [template struct X { void __attribute__((noinline)) f() {} };], - [X().f();])], - [llvm_cv_cxx_visibility_inlines_hidden=yes],[llvm_cv_cxx_visibility_inlines_hidden=no]) - CXXFLAGS="$oldcxxflags" - AC_LANG_POP([C++]) -]) -if test "$llvm_cv_cxx_visibility_inlines_hidden" = yes ; then - AC_SUBST([ENABLE_VISIBILITY_INLINES_HIDDEN],[1]) -else - AC_SUBST([ENABLE_VISIBILITY_INLINES_HIDDEN],[0]) -fi -]) diff --git a/autoconf/mkinstalldirs b/autoconf/mkinstalldirs deleted file mode 100755 index 1ee2d5801..000000000 --- a/autoconf/mkinstalldirs +++ /dev/null @@ -1,150 +0,0 @@ -#! /bin/sh -# mkinstalldirs --- make directory hierarchy - -scriptversion=2004-02-15.20 - -# Original author: Noah Friedman -# Created: 1993-05-16 -# Public domain. -# -# This file is maintained in Automake, please report -# bugs to or send patches to -# . - -errstatus=0 -dirmode="" - -usage="\ -Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ... - -Create each directory DIR (with mode MODE, if specified), including all -leading file name components. - -Report bugs to ." - -# process command line arguments -while test $# -gt 0 ; do - case $1 in - -h | --help | --h*) # -h for help - echo "$usage" - exit 0 - ;; - -m) # -m PERM arg - shift - test $# -eq 0 && { echo "$usage" 1>&2; exit 1; } - dirmode=$1 - shift - ;; - --version) - echo "$0 $scriptversion" - exit 0 - ;; - --) # stop option processing - shift - break - ;; - -*) # unknown option - echo "$usage" 1>&2 - exit 1 - ;; - *) # first non-opt arg - break - ;; - esac -done - -for file -do - if test -d "$file"; then - shift - else - break - fi -done - -case $# in - 0) exit 0 ;; -esac - -# Solaris 8's mkdir -p isn't thread-safe. If you mkdir -p a/b and -# mkdir -p a/c at the same time, both will detect that a is missing, -# one will create a, then the other will try to create a and die with -# a "File exists" error. This is a problem when calling mkinstalldirs -# from a parallel make. We use --version in the probe to restrict -# ourselves to GNU mkdir, which is thread-safe. -case $dirmode in - '') - if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then - # echo "mkdir -p -- $*" - exec mkdir -p -- "$@" - else - # On NextStep and OpenStep, the `mkdir' command does not - # recognize any option. It will interpret all options as - # directories to create, and then abort because `.' already - # exists. - test -d ./-p && rmdir ./-p - test -d ./--version && rmdir ./--version - fi - ;; - *) - if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 && - test ! -d ./--version; then - # echo "mkdir -m $dirmode -p -- $*" - exec mkdir -m "$dirmode" -p -- "$@" - else - # Clean up after NextStep and OpenStep mkdir. - for d in ./-m ./-p ./--version "./$dirmode"; - do - test -d $d && rmdir $d - done - fi - ;; -esac - -for file -do - set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` - shift - - pathcomp= - for d - do - pathcomp="$pathcomp$d" - case $pathcomp in - -*) pathcomp=./$pathcomp ;; - esac - - if test ! -d "$pathcomp"; then - # echo "mkdir $pathcomp" - - mkdir "$pathcomp" || lasterr=$? - - if test ! -d "$pathcomp"; then - errstatus=$lasterr - else - if test ! -z "$dirmode"; then - # echo "chmod $dirmode $pathcomp" - lasterr="" - chmod "$dirmode" "$pathcomp" || lasterr=$? - - if test ! -z "$lasterr"; then - errstatus=$lasterr - fi - fi - fi - fi - - pathcomp="$pathcomp/" - done -done - -exit $errstatus - -# Local Variables: -# mode: shell-script -# sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" -# End: From 7dc81ee7116140392102c8ccd804d332325fae0e Mon Sep 17 00:00:00 2001 From: smack Date: Sat, 27 Sep 2014 17:25:17 -0600 Subject: [PATCH 066/140] Updated to mono 3.8.0. --- bin/build-linux-cmake.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/bin/build-linux-cmake.sh b/bin/build-linux-cmake.sh index 4f2b9ec8d..38c6af074 100755 --- a/bin/build-linux-cmake.sh +++ b/bin/build-linux-cmake.sh @@ -93,13 +93,14 @@ if [ ${INSTALL_MONO} -eq 1 ]; then mkdir -p ${MONO_DIR} # Install mono -sudo apt-get install -y git autoconf automake bison flex libtool gettext gdb mono-gmcs +sudo apt-get install -y git autoconf automake bison flex libtool gettext gdb cd ${MONO_DIR} git clone git://github.com/mono/mono.git cd mono -git checkout mono-3.2.6 +git checkout mono-3.8.0 ./autogen.sh --prefix=/usr/local -make +make get-monolite-latest +make EXTERNAL_MCS=${PWD}/mcs/class/lib/monolite/gmcs.exe sudo make install # Install libgdiplus @@ -112,6 +113,8 @@ cd libgdiplus make sudo make install +export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib + cd ${BASE_DIR} fi From 31d40cb05d638a499d5c121af24874180f7f0587 Mon Sep 17 00:00:00 2001 From: Pantazis Deligiannis Date: Sun, 28 Sep 2014 16:23:19 +0100 Subject: [PATCH 067/140] updated CMakeLists.txt to properly link with LLVM system libs --- CMakeLists.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d0a20120a..652878bc4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,6 +27,12 @@ if (NOT WIN32 OR MSYS OR CYGWIN) OUTPUT_STRIP_TRAILING_WHITESPACE ) + execute_process( + COMMAND ${LLVM_CONFIG_EXECUTABLE} --system-libs + OUTPUT_VARIABLE LLVM_SYSTEM_LIBS + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + execute_process( COMMAND ${LLVM_CONFIG_EXECUTABLE} --ldflags OUTPUT_VARIABLE LLVM_LDFLAGS @@ -164,7 +170,7 @@ add_executable(smack set_target_properties(smack smackTranslator assistDS dsa PROPERTIES COMPILE_FLAGS "${LLVM_CXXFLAGS}") -target_link_libraries(smackTranslator ${LLVM_LIBS} ${LLVM_LDFLAGS}) +target_link_libraries(smackTranslator ${LLVM_LIBS} ${LLVM_SYSTEM_LIBS} ${LLVM_LDFLAGS}) target_link_libraries(smack smackTranslator assistDS dsa) INSTALL(TARGETS smack smackTranslator assistDS dsa From 4a3603b10be8ca0ce64412705516d7f7edfd926b Mon Sep 17 00:00:00 2001 From: smack Date: Mon, 29 Sep 2014 14:10:47 -0600 Subject: [PATCH 068/140] Revert "Removed autoconf folder that we are not using any more." As it turns out, configure needs it after all. This reverts commit 08e597353808aebae4564b46bb2e441ec82fae6d. --- autoconf/AutoRegen.sh | 45 + autoconf/ExportMap.map | 7 + autoconf/LICENSE.TXT | 24 + autoconf/config.guess | 1519 +++++ autoconf/config.sub | 1768 ++++++ autoconf/configure.ac | 1550 +++++ autoconf/install-sh | 322 + autoconf/ltmain.sh | 6863 ++++++++++++++++++++++ autoconf/m4/build_exeext.m4 | 42 + autoconf/m4/c_printf_a.m4 | 31 + autoconf/m4/check_gnu_make.m4 | 26 + autoconf/m4/config_makefile.m4 | 9 + autoconf/m4/config_project.m4 | 14 + autoconf/m4/cxx_flag_check.m4 | 2 + autoconf/m4/find_std_program.m4 | 118 + autoconf/m4/func_isinf.m4 | 36 + autoconf/m4/func_isnan.m4 | 27 + autoconf/m4/func_mmap_file.m4 | 26 + autoconf/m4/header_mmap_anonymous.m4 | 21 + autoconf/m4/huge_val.m4 | 20 + autoconf/m4/libtool.m4 | 6389 ++++++++++++++++++++ autoconf/m4/link_options.m4 | 109 + autoconf/m4/linux_mixed_64_32.m4 | 17 + autoconf/m4/ltdl.m4 | 403 ++ autoconf/m4/need_dev_zero_for_mmap.m4 | 17 + autoconf/m4/path_tclsh.m4 | 39 + autoconf/m4/rand48.m4 | 12 + autoconf/m4/sanity_check.m4 | 31 + autoconf/m4/single_cxx_check.m4 | 10 + autoconf/m4/visibility_inlines_hidden.m4 | 24 + autoconf/mkinstalldirs | 150 + 31 files changed, 19671 insertions(+) create mode 100755 autoconf/AutoRegen.sh create mode 100644 autoconf/ExportMap.map create mode 100644 autoconf/LICENSE.TXT create mode 100755 autoconf/config.guess create mode 100755 autoconf/config.sub create mode 100644 autoconf/configure.ac create mode 100755 autoconf/install-sh create mode 100644 autoconf/ltmain.sh create mode 100644 autoconf/m4/build_exeext.m4 create mode 100644 autoconf/m4/c_printf_a.m4 create mode 100644 autoconf/m4/check_gnu_make.m4 create mode 100644 autoconf/m4/config_makefile.m4 create mode 100644 autoconf/m4/config_project.m4 create mode 100644 autoconf/m4/cxx_flag_check.m4 create mode 100644 autoconf/m4/find_std_program.m4 create mode 100644 autoconf/m4/func_isinf.m4 create mode 100644 autoconf/m4/func_isnan.m4 create mode 100644 autoconf/m4/func_mmap_file.m4 create mode 100644 autoconf/m4/header_mmap_anonymous.m4 create mode 100644 autoconf/m4/huge_val.m4 create mode 100644 autoconf/m4/libtool.m4 create mode 100644 autoconf/m4/link_options.m4 create mode 100644 autoconf/m4/linux_mixed_64_32.m4 create mode 100644 autoconf/m4/ltdl.m4 create mode 100644 autoconf/m4/need_dev_zero_for_mmap.m4 create mode 100644 autoconf/m4/path_tclsh.m4 create mode 100644 autoconf/m4/rand48.m4 create mode 100644 autoconf/m4/sanity_check.m4 create mode 100644 autoconf/m4/single_cxx_check.m4 create mode 100644 autoconf/m4/visibility_inlines_hidden.m4 create mode 100755 autoconf/mkinstalldirs diff --git a/autoconf/AutoRegen.sh b/autoconf/AutoRegen.sh new file mode 100755 index 000000000..b91b3e446 --- /dev/null +++ b/autoconf/AutoRegen.sh @@ -0,0 +1,45 @@ +#!/bin/sh +die () { + echo "$@" 1>&2 + exit 1 +} +test -d autoconf && test -f autoconf/configure.ac && cd autoconf +test -f configure.ac || die "Can't find 'autoconf' dir; please cd into it first" +autoconf --version | egrep '2\.[56][0-9]' > /dev/null +if test $? -ne 0 ; then + die "Your autoconf was not detected as being 2.5x or 2.6x" +fi +cwd=`pwd` +if test -d ../../../autoconf/m4 ; then + cd ../../../autoconf/m4 + llvm_src_root=../.. + llvm_obj_root=../.. + cd $cwd +elif test -d ../../llvm/autoconf/m4 ; then + cd ../../llvm/autoconf/m4 + llvm_src_root=../.. + llvm_obj_root=../.. + cd $cwd +else + while true ; do + echo "LLVM source root not found." + read -p "Enter full path to LLVM source:" REPLY + if test -d "$REPLY/autoconf/m4" ; then + llvm_src_root="$REPLY" + read -p "Enter full path to LLVM objects (empty for same as source):" REPLY + if test -d "$REPLY" ; then + llvm_obj_root="$REPLY" + else + llvm_obj_root="$llvm_src_root" + fi + break + fi + done +fi +echo "Regenerating aclocal.m4 with aclocal" +rm -f aclocal.m4 +aclocal -I $cwd/m4 || die "aclocal failed" +echo "Regenerating configure with autoconf" +autoconf --warnings=all -o ../configure configure.ac || die "autoconf failed" +cd .. +exit 0 diff --git a/autoconf/ExportMap.map b/autoconf/ExportMap.map new file mode 100644 index 000000000..17b185fed --- /dev/null +++ b/autoconf/ExportMap.map @@ -0,0 +1,7 @@ +{ + global: main; + __progname; + environ; + + local: *; +}; diff --git a/autoconf/LICENSE.TXT b/autoconf/LICENSE.TXT new file mode 100644 index 000000000..72fdd39ed --- /dev/null +++ b/autoconf/LICENSE.TXT @@ -0,0 +1,24 @@ +------------------------------------------------------------------------------ +Autoconf Files +------------------------------------------------------------------------------ +All autoconf files are licensed under the LLVM license with the following +additions: + +llvm/autoconf/install-sh: + This script is licensed under the LLVM license, with the following + additional copyrights and restrictions: + + Copyright 1991 by the Massachusetts Institute of Technology + + Permission to use, copy, modify, distribute, and sell this software and its + documentation for any purpose is hereby granted without fee, provided that + the above copyright notice appear in all copies and that both that + copyright notice and this permission notice appear in supporting + documentation, and that the name of M.I.T. not be used in advertising or + publicity pertaining to distribution of the software without specific, + written prior permission. M.I.T. makes no representations about the + suitability of this software for any purpose. It is provided "as is" + without express or implied warranty. + +Please see the source files for additional copyrights. + diff --git a/autoconf/config.guess b/autoconf/config.guess new file mode 100755 index 000000000..40e2c708f --- /dev/null +++ b/autoconf/config.guess @@ -0,0 +1,1519 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, +# 2011 Free Software Foundation, Inc. + +timestamp='2011-08-20' + +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + + +# Originally written by Per Bothner. Please send patches (context +# diff format) to and include a ChangeLog +# entry. +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# You can get the latest version of this script from: +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, +2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free +Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + +trap 'exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. + +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +# Portable tmp directory creation inspired by the Autoconf team. + +set_cc_for_build=' +trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; +trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; +: ${TMPDIR=/tmp} ; + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; +dummy=$tmp/dummy ; +tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int x;" > $dummy.c ; + for c in cc gcc c89 c99 ; do + if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac ; set_cc_for_build= ;' + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + sysctl="sysctl -n hw.machine_arch" + UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + case "${UNAME_MACHINE_ARCH}" in + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + sh5el) machine=sh5le-unknown ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE_ARCH}" in + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ELF__ + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case "${UNAME_VERSION}" in + Debian*) + release='-gnu' + ;; + *) + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + ;; + esac + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit ;; + *:OpenBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} + exit ;; + *:ekkoBSD:*:*) + echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} + exit ;; + *:SolidBSD:*:*) + echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} + exit ;; + macppc:MirBSD:*:*) + echo powerpc-unknown-mirbsd${UNAME_RELEASE} + exit ;; + *:MirBSD:*:*) + echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} + exit ;; + alpha:OSF1:*:*) + case $UNAME_RELEASE in + *4.0) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + ;; + *5.*) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + case "$ALPHA_CPU_TYPE" in + "EV4 (21064)") + UNAME_MACHINE="alpha" ;; + "EV4.5 (21064)") + UNAME_MACHINE="alpha" ;; + "LCA4 (21066/21068)") + UNAME_MACHINE="alpha" ;; + "EV5 (21164)") + UNAME_MACHINE="alphaev5" ;; + "EV5.6 (21164A)") + UNAME_MACHINE="alphaev56" ;; + "EV5.6 (21164PC)") + UNAME_MACHINE="alphapca56" ;; + "EV5.7 (21164PC)") + UNAME_MACHINE="alphapca57" ;; + "EV6 (21264)") + UNAME_MACHINE="alphaev6" ;; + "EV6.7 (21264A)") + UNAME_MACHINE="alphaev67" ;; + "EV6.8CB (21264C)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8AL (21264B)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8CX (21264D)") + UNAME_MACHINE="alphaev68" ;; + "EV6.9A (21264/EV69A)") + UNAME_MACHINE="alphaev69" ;; + "EV7 (21364)") + UNAME_MACHINE="alphaev7" ;; + "EV7.9 (21364A)") + UNAME_MACHINE="alphaev79" ;; + esac + # A Pn.n version is a patched version. + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + # Reset EXIT trap before exiting to avoid spurious non-zero exit code. + exitcode=$? + trap '' 0 + exit $exitcode ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-morphos + exit ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit ;; + *:z/VM:*:*) + echo s390-ibm-zvmoe + exit ;; + *:OS400:*:*) + echo powerpc-ibm-os400 + exit ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit ;; + arm:riscos:*:*|arm:RISCOS:*:*) + echo arm-unknown-riscos + exit ;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit ;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit ;; + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 + exit ;; + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7; exit ;; + esac ;; + s390x:SunOS:*:*) + echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) + echo i386-pc-auroraux${UNAME_RELEASE} + exit ;; + i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) + eval $set_cc_for_build + SUN_ARCH="i386" + # If there is a compiler, see if it is configured for 64-bit objects. + # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. + # This test works for both compilers. + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + SUN_ARCH="x86_64" + fi + fi + echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit ;; + m68k:machten:*:*) + echo m68k-apple-machten${UNAME_RELEASE} + exit ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && + dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`$dummy $dummyarg` && + { echo "$SYSTEM_NAME"; exit; } + echo mips-mips-riscos${UNAME_RELEASE} + exit ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` + then + echo "$SYSTEM_NAME" + else + echo rs6000-ibm-aix3.2.5 + fi + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit ;; + *:AIX:*:[4567]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + esac ;; + esac + fi + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + test -z "$HP_ARCH" && HP_ARCH=hppa + fi ;; + esac + if [ ${HP_ARCH} = "hppa2.0w" ] + then + eval $set_cc_for_build + + # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating + # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler + # generating 64-bit code. GNU and HP use different nomenclature: + # + # $ CC_FOR_BUILD=cc ./config.guess + # => hppa2.0w-hp-hpux11.23 + # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess + # => hppa64-hp-hpux11.23 + + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + grep -q __LP64__ + then + HP_ARCH="hppa2.0w" + else + HP_ARCH="hppa64" + fi + fi + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit ;; + 3050*:HI-UX:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + echo unknown-hitachi-hiuxwe2 + exit ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + *:UNICOS/mp:*:*) + echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + 5000:UNIX_System_V:4.*:*) + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:FreeBSD:*:*) + UNAME_PROCESSOR=`/usr/bin/uname -p` + case ${UNAME_PROCESSOR} in + amd64) + echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + *) + echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + esac + exit ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit ;; + *:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit ;; + i*:windows32*:*) + # uname -m includes "-pc" on this system. + echo ${UNAME_MACHINE}-mingw32 + exit ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit ;; + *:Interix*:*) + case ${UNAME_MACHINE} in + x86) + echo i586-pc-interix${UNAME_RELEASE} + exit ;; + authenticamd | genuineintel | EM64T) + echo x86_64-unknown-interix${UNAME_RELEASE} + exit ;; + IA64) + echo ia64-unknown-interix${UNAME_RELEASE} + exit ;; + esac ;; + [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) + echo i${UNAME_MACHINE}-pc-mks + exit ;; + 8664:Windows_NT:*) + echo x86_64-pc-mks + exit ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i586-pc-interix + exit ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) + echo x86_64-unknown-cygwin + exit ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + *:GNU:*:*) + # the GNU system + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu + exit ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep -q ld.so.1 + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit ;; + arm*:Linux:*:*) + eval $set_cc_for_build + if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_EABI__ + then + echo ${UNAME_MACHINE}-unknown-linux-gnu + else + if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_PCS_VFP + then + echo ${UNAME_MACHINE}-unknown-linux-gnueabi + else + echo ${UNAME_MACHINE}-unknown-linux-gnueabihf + fi + fi + exit ;; + avr32*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + cris:Linux:*:*) + echo cris-axis-linux-gnu + exit ;; + crisv32:Linux:*:*) + echo crisv32-axis-linux-gnu + exit ;; + frv:Linux:*:*) + echo frv-unknown-linux-gnu + exit ;; + i*86:Linux:*:*) + LIBC=gnu + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #ifdef __dietlibc__ + LIBC=dietlibc + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` + echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + exit ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m32r*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + mips:Linux:*:* | mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef ${UNAME_MACHINE} + #undef ${UNAME_MACHINE}el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=${UNAME_MACHINE}el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=${UNAME_MACHINE} + #else + CPU= + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + ;; + or32:Linux:*:*) + echo or32-unknown-linux-gnu + exit ;; + padre:Linux:*:*) + echo sparc-unknown-linux-gnu + exit ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit ;; + ppc64le:Linux:*:*) + echo powerpc64le-unknown-linux-gnu + exit ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit ;; + sh64*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + tile*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + vax:Linux:*:*) + echo ${UNAME_MACHINE}-dec-linux-gnu + exit ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit ;; + xtensa*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 + exit ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit ;; + i*86:syllable:*:*) + echo ${UNAME_MACHINE}-pc-syllable + exit ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit ;; + i*86:*:5:[678]*) + # UnixWare 7.x, OpenUNIX and OpenServer 6. + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + exit ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i586. + # Note: whatever this is, it MUST be the same as what config.sub + # prints for the "djgpp" host, or else GDB configury will decide that + # this is a cross-build. + echo i586-pc-msdosdjgpp + exit ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv + exit ;; + M680?0:D-NIX:5.3:*) + echo m68k-diab-dnix + exit ;; + M68*:*:R3V[5678]*:*) + test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4; exit; } ;; + NCR*:*:4.2:* | MPRAS*:*:4.2:*) + OS_REL='.3' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit ;; + i*86:VOS:*:*) + # From Paul.Green@stratus.com. + echo ${UNAME_MACHINE}-stratus-vos + exit ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit ;; + BePC:Haiku:*:*) # Haiku running on Intel PC compatible. + echo i586-pc-haiku + exit ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux${UNAME_RELEASE} + exit ;; + SX-7:SUPER-UX:*:*) + echo sx7-nec-superux${UNAME_RELEASE} + exit ;; + SX-8:SUPER-UX:*:*) + echo sx8-nec-superux${UNAME_RELEASE} + exit ;; + SX-8R:SUPER-UX:*:*) + echo sx8r-nec-superux${UNAME_RELEASE} + exit ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Darwin:*:*) + UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown + case $UNAME_PROCESSOR in + i386) + eval $set_cc_for_build + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + UNAME_PROCESSOR="x86_64" + fi + fi ;; + unknown) UNAME_PROCESSOR=powerpc ;; + esac + echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} + exit ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = "x86"; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} + exit ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit ;; + NEO-?:NONSTOP_KERNEL:*:*) + echo neo-tandem-nsk${UNAME_RELEASE} + exit ;; + NSE-?:NONSTOP_KERNEL:*:*) + echo nse-tandem-nsk${UNAME_RELEASE} + exit ;; + NSR-?:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit ;; + SEI:*:*:SEIUX) + echo mips-sei-seiux${UNAME_RELEASE} + exit ;; + *:DragonFly:*:*) + echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case "${UNAME_MACHINE}" in + A*) echo alpha-dec-vms ; exit ;; + I*) echo ia64-dec-vms ; exit ;; + V*) echo vax-dec-vms ; exit ;; + esac ;; + *:XENIX:*:SysV) + echo i386-pc-xenix + exit ;; + i*86:skyos:*:*) + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' + exit ;; + i*86:rdos:*:*) + echo ${UNAME_MACHINE}-pc-rdos + exit ;; + i*86:AROS:*:*) + echo ${UNAME_MACHINE}-pc-aros + exit ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +eval $set_cc_for_build +cat >$dummy.c < +# include +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix\n"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +# if !defined (ultrix) +# include +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + c34*) + echo c34-convex-bsd + exit ;; + c38*) + echo c38-convex-bsd + exit ;; + c4*) + echo c4-convex-bsd + exit ;; + esac +fi + +cat >&2 < in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF + +exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/autoconf/config.sub b/autoconf/config.sub new file mode 100755 index 000000000..9d22c1e52 --- /dev/null +++ b/autoconf/config.sub @@ -0,0 +1,1768 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, +# 2011 Free Software Foundation, Inc. + +timestamp='2011-11-02' + +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + + +# Please send patches to . Submit a context +# diff and a properly formatted GNU ChangeLog entry. +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# You can get the latest version of this script from: +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, +2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free +Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit ;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ + linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ + knetbsd*-gnu* | netbsd*-gnu* | \ + kopensolaris*-gnu* | \ + storm-chaos* | os2-emx* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple | -axis | -knuth | -cray | -microblaze) + os= + basic_machine=$1 + ;; + -bluegene*) + os=-cnk + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco6) + os=-sco5v6 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5v6*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + 1750a | 580 \ + | a29k \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | am33_2.0 \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ + | be32 | be64 \ + | aarch64 \ + | bfin \ + | c4x | clipper \ + | d10v | d30v | dlx | dsp16xx \ + | fido | fr30 | frv \ + | hexagon \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ + | ip2k | iq2000 \ + | le32 | le64 \ + | lm32 \ + | m32c | m32r | m32rle | m68000 | m68k | m88k \ + | maxq | mb | microblaze | mcore | mep | metag \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64octeon | mips64octeonel \ + | mips64orion | mips64orionel \ + | mips64r5900 | mips64r5900el \ + | mips64vr | mips64vrel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mips64vr5900 | mips64vr5900el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | moxie \ + | mt \ + | msp430 \ + | nds32 | nds32le | nds32be \ + | nios | nios2 \ + | ns16k | ns32k \ + | open8 \ + | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle \ + | pyramid \ + | rx \ + | score \ + | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ + | spu \ + | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ + | ubicom32 \ + | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ + | we32k \ + | x86 | xc16x | xstormy16 | xtensa \ + | z8k | z80) + basic_machine=$basic_machine-unknown + ;; + c54x) + basic_machine=tic54x-unknown + ;; + c55x) + basic_machine=tic55x-unknown + ;; + c6x) + basic_machine=tic6x-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12 | picochip) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + ms1) + basic_machine=mt-unknown + ;; + + strongarm | thumb | xscale) + basic_machine=arm-unknown + ;; + + xscaleeb) + basic_machine=armeb-unknown + ;; + + xscaleel) + basic_machine=armel-unknown + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i*86 | x86_64) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | aarch64-* \ + | avr-* | avr32-* \ + | be32-* | be64-* \ + | bfin-* | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* \ + | clipper-* | craynv-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hexagon-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* | iq2000-* \ + | le32-* | le64-* \ + | lm32-* \ + | m32c-* | m32r-* | m32rle-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64octeon-* | mips64octeonel-* \ + | mips64orion-* | mips64orionel-* \ + | mips64r5900-* | mips64r5900el-* \ + | mips64vr-* | mips64vrel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mips64vr5900-* | mips64vr5900el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipstx39-* | mipstx39el-* \ + | mmix-* \ + | mt-* \ + | msp430-* \ + | nds32-* | nds32le-* | nds32be-* \ + | nios-* | nios2-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | open8-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ + | pyramid-* \ + | romp-* | rs6000-* | rx-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ + | sparclite-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ + | tahoe-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ + | tile*-* \ + | tron-* \ + | ubicom32-* \ + | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ + | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xc16x-* | xps100-* \ + | xstormy16-* | xtensa*-* \ + | ymp-* \ + | z8k-* | z80-*) + ;; + # Recognize the basic CPU types without company name, with glob match. + xtensa*) + basic_machine=$basic_machine-unknown + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + abacus) + basic_machine=abacus-unknown + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amd64) + basic_machine=x86_64-pc + ;; + amd64-*) + basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aros) + basic_machine=i386-pc + os=-aros + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + blackfin) + basic_machine=bfin-unknown + os=-linux + ;; + blackfin-*) + basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + bluegene*) + basic_machine=powerpc-ibm + os=-cnk + ;; + c54x-*) + basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + c55x-*) + basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + c6x-*) + basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; + cegcc) + basic_machine=arm-unknown + os=-cegcc + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | j90) + basic_machine=j90-cray + os=-unicos + ;; + craynv) + basic_machine=craynv-cray + os=-unicosmp + ;; + cr16 | cr16-*) + basic_machine=cr16-unknown + os=-elf + ;; + crds | unos) + basic_machine=m68k-crds + ;; + crisv32 | crisv32-* | etraxfs*) + basic_machine=crisv32-axis + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + crx) + basic_machine=crx-unknown + os=-elf + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + decsystem10* | dec10*) + basic_machine=pdp10-dec + os=-tops10 + ;; + decsystem20* | dec20*) + basic_machine=pdp10-dec + os=-tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dicos) + basic_machine=i686-pc + os=-dicos + ;; + djgpp) + basic_machine=i586-pc + os=-msdosdjgpp + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m68knommu) + basic_machine=m68k-unknown + os=-linux + ;; + m68knommu-*) + basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + microblaze) + basic_machine=microblaze-xilinx + ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; + mingw32ce) + basic_machine=arm-unknown + os=-mingw32ce + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + morphos) + basic_machine=powerpc-unknown + os=-morphos + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + ms1-*) + basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + nacl) + basic_machine=le32-unknown + os=-nacl + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould + ;; + neo-tandem) + basic_machine=neo-tandem + ;; + nse-tandem) + basic_machine=nse-tandem + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + openrisc | openrisc-*) + basic_machine=or32-unknown + ;; + os400) + basic_machine=powerpc-ibm + os=-os400 + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + parisc) + basic_machine=hppa-unknown + os=-linux + ;; + parisc-*) + basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pc98) + basic_machine=i386-pc + ;; + pc98-*) + basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium | p5 | k5 | k6 | nexgen | viac3) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon | athlon_*) + basic_machine=i686-pc + ;; + pentiumii | pentium2 | pentiumiii | pentium3) + basic_machine=i686-pc + ;; + pentium4) + basic_machine=i786-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium4-*) + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc | ppcbe) basic_machine=powerpc-unknown + ;; + ppc-* | ppcbe-*) + basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little | ppc64-le | powerpc64-little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rdos) + basic_machine=i386-pc + os=-rdos + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + s390 | s390-*) + basic_machine=s390-ibm + ;; + s390x | s390x-*) + basic_machine=s390x-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sb1) + basic_machine=mipsisa64sb1-unknown + ;; + sb1el) + basic_machine=mipsisa64sb1el-unknown + ;; + sde) + basic_machine=mipsisa32-sde + os=-elf + ;; + sei) + basic_machine=mips-sei + os=-seiux + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sh5el) + basic_machine=sh5le-unknown + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparclite-wrs | simso-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + strongarm-* | thumb-*) + basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3e) + basic_machine=alphaev5-cray + os=-unicos + ;; + t90) + basic_machine=t90-cray + os=-unicos + ;; + tile*) + basic_machine=$basic_machine-unknown + os=-linux-gnu + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + toad1) + basic_machine=pdp10-xkl + os=-tops20 + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + tpf) + basic_machine=s390x-ibm + os=-tpf + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + xbox) + basic_machine=i686-pc + os=-mingw32 + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + xscale-* | xscalee[bl]-*) + basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` + ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + z80-*-coff) + basic_machine=z80-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + romp) + basic_machine=romp-ibm + ;; + mmix) + basic_machine=mmix-knuth + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) + basic_machine=sh-unknown + ;; + sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -auroraux) + os=-auroraux + ;; + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ + | -sym* | -kopensolaris* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* | -aros* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ + | -openbsd* | -solidbsd* \ + | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ + | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* | -cegcc* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -linux-android* \ + | -linux-newlib* | -linux-uclibc* \ + | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ + | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto-qnx*) + ;; + -nto*) + os=`echo $os | sed -e 's|nto|nto-qnx|'` + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux-dietlibc) + os=-linux-dietlibc + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -os400*) + os=-os400 + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -atheos*) + os=-atheos + ;; + -syllable*) + os=-syllable + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -nova*) + os=-rtmk-nova + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk*) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -tpf*) + os=-tpf + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -aros*) + os=-aros + ;; + -kaos*) + os=-kaos + ;; + -zvmoe) + os=-zvmoe + ;; + -dicos*) + os=-dicos + ;; + -nacl*) + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + score-*) + os=-elf + ;; + spu-*) + os=-elf + ;; + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + c4x-* | tic4x-*) + os=-coff + ;; + tic54x-*) + os=-coff + ;; + tic55x-*) + os=-coff + ;; + tic6x-*) + os=-coff + ;; + # This must come before the *-dec entry. + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; + mep-*) + os=-elf + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + or32-*) + os=-coff + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-haiku) + os=-haiku + ;; + *-ibm) + os=-aix + ;; + *-knuth) + os=-mmixware + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -cnk*|-aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -os400*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -tpf*) + vendor=ibm + ;; + -vxsim* | -vxworks* | -windiss*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + -vos*) + vendor=stratus + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os +exit + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/autoconf/configure.ac b/autoconf/configure.ac new file mode 100644 index 000000000..7216b2ec8 --- /dev/null +++ b/autoconf/configure.ac @@ -0,0 +1,1550 @@ +dnl ************************************************************************** +dnl * Initialize +dnl ************************************************************************** +AC_INIT([[SMACK]],[[1.4.1]],[smack-dev@googlegroups.com],[smack],[http://github.com/smackers/smack]) + +dnl Identify where LLVM source tree is +LLVM_SRC_ROOT="../.." +LLVM_OBJ_ROOT="../.." + +dnl Find absolute paths to LLVM source and object trees +LLVM_ABS_SRC_ROOT="`cd $srcdir ; cd $LLVM_SRC_ROOT ; pwd`" +LLVM_ABS_OBJ_ROOT="`cd $LLVM_OBJ_ROOT ; pwd`" + +dnl Tell autoconf that this is an LLVM project being configured +dnl This provides the --with-llvmsrc and --with-llvmobj options +LLVM_CONFIG_PROJECT($LLVM_ABS_SRC_ROOT,$LLVM_ABS_OBJ_ROOT) + +dnl Try and find an llvm-config in the build directory. We are only using this +dnl to detect the package level LLVM information (currently just the version), +dnl so we just whatever one we find regardless of build mode. +AC_MSG_CHECKING([llvm-config]) +llvm_config_path="`ls -1 $llvm_obj/*/bin/llvm-config 2> /dev/null | head -1`" +if ! test -f "$llvm_config_path" ; then + llvm_config_path="no" +fi +AC_MSG_RESULT([$llvm_config_path]) + +dnl Determine the LLVM version, which may be required by the current Makefile +dnl rules. +AC_MSG_CHECKING([LLVM package version]) +if test "$llvm_config_path" != no ; then + llvm_package_version=`$llvm_config_path --version` +else + llvm_package_version="unknown"; +fi +AC_MSG_RESULT([$llvm_package_version]) +AC_SUBST(LLVM_VERSION, [$llvm_package_version]) + +dnl Verify that the source directory is valid +AC_CONFIG_SRCDIR(["Makefile.common.in"]) + +dnl Place all of the extra autoconf files into the config subdirectory. Tell +dnl various tools where the m4 autoconf macros are. +AC_CONFIG_AUX_DIR([autoconf]) + +dnl ************************************************************************** +dnl Begin LLVM configure.ac Import +dnl ************************************************************************** +dnl +dnl Derived from LLVM's configure.ac. This was imported directly here so that we +dnl could reuse LLVM's build infrastructure without introducing a direct source +dnl dependency on the LLVM files. + +dnl We need to check for the compiler up here to avoid anything else +dnl starting with a different one. +AC_PROG_CC(clang llvm-gcc gcc) +AC_PROG_CXX(clang++ llvm-g++ g++) +AC_PROG_CPP + +dnl Configure all of the projects present in our source tree. While we could +dnl just AC_CONFIG_SUBDIRS on the set of directories in projects that have a +dnl configure script, that usage of the AC_CONFIG_SUBDIRS macro is deprecated. +dnl Instead we match on the known projects. + +dnl +dnl One tricky part of doing this is that some projects depend upon other +dnl projects. For example, several projects rely upon the LLVM test suite. +dnl We want to configure those projects first so that their object trees are +dnl created before running the configure scripts of projects that depend upon +dnl them. +dnl + +dnl Disable the build of polly, even if it is checked out into tools/polly. +AC_ARG_ENABLE(polly, + AS_HELP_STRING([--enable-polly], + [Use polly if available (default is YES)]),, + enableval=default) +case "$enableval" in + yes) AC_SUBST(ENABLE_POLLY,[1]) ;; + no) AC_SUBST(ENABLE_POLLY,[0]) ;; + default) AC_SUBST(ENABLE_POLLY,[1]) ;; + *) AC_MSG_ERROR([Invalid setting for --enable-polly. Use "yes" or "no"]) ;; +esac + + +dnl Check if polly is checked out into tools/polly and configure it if +dnl available. +if (test -d ${srcdir}/tools/polly) && (test $ENABLE_POLLY -eq 1) ; then + AC_SUBST(LLVM_HAS_POLLY,1) + AC_CONFIG_SUBDIRS([tools/polly]) +fi + +dnl===-----------------------------------------------------------------------=== +dnl=== +dnl=== SECTION 2: Architecture, target, and host checks +dnl=== +dnl===-----------------------------------------------------------------------=== + +dnl Check the target for which we're compiling and the host that will do the +dnl compilations. This will tell us which LLVM compiler will be used for +dnl compiling SSA into object code. This needs to be done early because +dnl following tests depend on it. +AC_CANONICAL_TARGET + +dnl Determine the platform type and cache its value. This helps us configure +dnl the System library to the correct build platform. +AC_CACHE_CHECK([type of operating system we're going to host on], + [llvm_cv_os_type], +[case $host in + *-*-aix*) + llvm_cv_link_all_option="-Wl,--whole-archive" + llvm_cv_no_link_all_option="-Wl,--no-whole-archive" + llvm_cv_os_type="AIX" + llvm_cv_platform_type="Unix" ;; + *-*-irix*) + llvm_cv_link_all_option="-Wl,--whole-archive" + llvm_cv_no_link_all_option="-Wl,--no-whole-archive" + llvm_cv_os_type="IRIX" + llvm_cv_platform_type="Unix" ;; + *-*-cygwin*) + llvm_cv_link_all_option="-Wl,--whole-archive" + llvm_cv_no_link_all_option="-Wl,--no-whole-archive" + llvm_cv_os_type="Cygwin" + llvm_cv_platform_type="Unix" ;; + *-*-darwin*) + llvm_cv_link_all_option="-Wl,-all_load" + llvm_cv_no_link_all_option="-Wl,-noall_load" + llvm_cv_os_type="Darwin" + llvm_cv_platform_type="Unix" ;; + *-*-minix*) + llvm_cv_link_all_option="-Wl,-all_load" + llvm_cv_no_link_all_option="-Wl,-noall_load" + llvm_cv_os_type="Minix" + llvm_cv_platform_type="Unix" ;; + *-*-freebsd* | *-*-kfreebsd-gnu) + llvm_cv_link_all_option="-Wl,--whole-archive" + llvm_cv_no_link_all_option="-Wl,--no-whole-archive" + llvm_cv_os_type="FreeBSD" + llvm_cv_platform_type="Unix" ;; + *-*-openbsd*) + llvm_cv_link_all_option="-Wl,--whole-archive" + llvm_cv_no_link_all_option="-Wl,--no-whole-archive" + llvm_cv_os_type="OpenBSD" + llvm_cv_platform_type="Unix" ;; + *-*-netbsd*) + llvm_cv_link_all_option="-Wl,--whole-archive" + llvm_cv_no_link_all_option="-Wl,--no-whole-archive" + llvm_cv_os_type="NetBSD" + llvm_cv_platform_type="Unix" ;; + *-*-dragonfly*) + llvm_cv_link_all_option="-Wl,--whole-archive" + llvm_cv_no_link_all_option="-Wl,--no-whole-archive" + llvm_cv_os_type="DragonFly" + llvm_cv_platform_type="Unix" ;; + *-*-hpux*) + llvm_cv_link_all_option="-Wl,--whole-archive" + llvm_cv_no_link_all_option="-Wl,--no-whole-archive" + llvm_cv_os_type="HP-UX" + llvm_cv_platform_type="Unix" ;; + *-*-interix*) + llvm_cv_link_all_option="-Wl,--whole-archive" + llvm_cv_no_link_all_option="-Wl,--no-whole-archive" + llvm_cv_os_type="Interix" + llvm_cv_platform_type="Unix" ;; + *-*-linux*) + llvm_cv_link_all_option="-Wl,--whole-archive" + llvm_cv_no_link_all_option="-Wl,--no-whole-archive" + llvm_cv_os_type="Linux" + llvm_cv_platform_type="Unix" ;; + *-*-gnu*) + llvm_cv_link_all_option="-Wl,--whole-archive" + llvm_cv_no_link_all_option="-Wl,--no-whole-archive" + llvm_cv_os_type="GNU" + llvm_cv_platform_type="Unix" ;; + *-*-solaris*) + llvm_cv_link_all_option="-Wl,-z,allextract" + llvm_cv_no_link_all_option="-Wl,-z,defaultextract" + llvm_cv_os_type="SunOS" + llvm_cv_platform_type="Unix" ;; + *-*-auroraux*) + llvm_cv_link_all_option="-Wl,-z,allextract" + llvm_cv_link_all_option="-Wl,-z,defaultextract" + llvm_cv_os_type="AuroraUX" + llvm_cv_platform_type="Unix" ;; + *-*-win32*) + llvm_cv_link_all_option="-Wl,--whole-archive" + llvm_cv_no_link_all_option="-Wl,--no-whole-archive" + llvm_cv_os_type="Win32" + llvm_cv_platform_type="Win32" ;; + *-*-mingw*) + llvm_cv_link_all_option="-Wl,--whole-archive" + llvm_cv_no_link_all_option="-Wl,--no-whole-archive" + llvm_cv_os_type="MingW" + llvm_cv_platform_type="Win32" ;; + *-*-haiku*) + llvm_cv_link_all_option="-Wl,--whole-archive" + llvm_cv_no_link_all_option="-Wl,--no-whole-archive" + llvm_cv_os_type="Haiku" + llvm_cv_platform_type="Unix" ;; + *-unknown-eabi*) + llvm_cv_link_all_option="-Wl,--whole-archive" + llvm_cv_no_link_all_option="-Wl,--no-whole-archive" + llvm_cv_os_type="Freestanding" + llvm_cv_platform_type="Unix" ;; + *-unknown-elf*) + llvm_cv_link_all_option="-Wl,--whole-archive" + llvm_cv_no_link_all_option="-Wl,--no-whole-archive" + llvm_cv_os_type="Freestanding" + llvm_cv_platform_type="Unix" ;; + *) + llvm_cv_link_all_option="" + llvm_cv_no_link_all_option="" + llvm_cv_os_type="Unknown" + llvm_cv_platform_type="Unknown" ;; +esac]) + +AC_CACHE_CHECK([type of operating system we're going to target], + [llvm_cv_target_os_type], +[case $target in + *-*-aix*) + llvm_cv_target_os_type="AIX" ;; + *-*-irix*) + llvm_cv_target_os_type="IRIX" ;; + *-*-cygwin*) + llvm_cv_target_os_type="Cygwin" ;; + *-*-darwin*) + llvm_cv_target_os_type="Darwin" ;; + *-*-minix*) + llvm_cv_target_os_type="Minix" ;; + *-*-freebsd* | *-*-kfreebsd-gnu) + llvm_cv_target_os_type="FreeBSD" ;; + *-*-openbsd*) + llvm_cv_target_os_type="OpenBSD" ;; + *-*-netbsd*) + llvm_cv_target_os_type="NetBSD" ;; + *-*-dragonfly*) + llvm_cv_target_os_type="DragonFly" ;; + *-*-hpux*) + llvm_cv_target_os_type="HP-UX" ;; + *-*-interix*) + llvm_cv_target_os_type="Interix" ;; + *-*-linux*) + llvm_cv_target_os_type="Linux" ;; + *-*-gnu*) + llvm_cv_target_os_type="GNU" ;; + *-*-solaris*) + llvm_cv_target_os_type="SunOS" ;; + *-*-auroraux*) + llvm_cv_target_os_type="AuroraUX" ;; + *-*-win32*) + llvm_cv_target_os_type="Win32" ;; + *-*-mingw*) + llvm_cv_target_os_type="MingW" ;; + *-*-haiku*) + llvm_cv_target_os_type="Haiku" ;; + *-*-rtems*) + llvm_cv_target_os_type="RTEMS" ;; + *-*-nacl*) + llvm_cv_target_os_type="NativeClient" ;; + *-unknown-eabi*) + llvm_cv_target_os_type="Freestanding" ;; + *) + llvm_cv_target_os_type="Unknown" ;; +esac]) + +dnl Make sure we aren't attempting to configure for an unknown system +if test "$llvm_cv_os_type" = "Unknown" ; then + AC_MSG_ERROR([Operating system is unknown, configure can't continue]) +fi + +dnl Set the "OS" Makefile variable based on the platform type so the +dnl makefile can configure itself to specific build hosts +AC_SUBST(OS,$llvm_cv_os_type) +AC_SUBST(HOST_OS,$llvm_cv_os_type) +AC_SUBST(TARGET_OS,$llvm_cv_target_os_type) + +dnl Set the LINKALL and NOLINKALL Makefile variables based on the platform +AC_SUBST(LINKALL,$llvm_cv_link_all_option) +AC_SUBST(NOLINKALL,$llvm_cv_no_link_all_option) + +dnl Set the "LLVM_ON_*" variables based on llvm_cv_platform_type +dnl This is used by lib/Support to determine the basic kind of implementation +dnl to use. +case $llvm_cv_platform_type in + Unix) + AC_DEFINE([LLVM_ON_UNIX],[1],[Define if this is Unixish platform]) + AC_SUBST(LLVM_ON_UNIX,[1]) + AC_SUBST(LLVM_ON_WIN32,[0]) + ;; + Win32) + AC_DEFINE([LLVM_ON_WIN32],[1],[Define if this is Win32ish platform]) + AC_SUBST(LLVM_ON_UNIX,[0]) + AC_SUBST(LLVM_ON_WIN32,[1]) + ;; +esac + +dnl Determine what our target architecture is and configure accordingly. +dnl This will allow Makefiles to make a distinction between the hardware and +dnl the OS. +AC_CACHE_CHECK([target architecture],[llvm_cv_target_arch], +[case $target in + i?86-*) llvm_cv_target_arch="x86" ;; + amd64-* | x86_64-*) llvm_cv_target_arch="x86_64" ;; + sparc*-*) llvm_cv_target_arch="Sparc" ;; + powerpc*-*) llvm_cv_target_arch="PowerPC" ;; + arm*-*) llvm_cv_target_arch="ARM" ;; + aarch64*-*) llvm_cv_target_arch="AArch64" ;; + mips-* | mips64-*) llvm_cv_target_arch="Mips" ;; + mipsel-* | mips64el-*) llvm_cv_target_arch="Mips" ;; + xcore-*) llvm_cv_target_arch="XCore" ;; + msp430-*) llvm_cv_target_arch="MSP430" ;; + hexagon-*) llvm_cv_target_arch="Hexagon" ;; + nvptx-*) llvm_cv_target_arch="NVPTX" ;; + s390x-*) llvm_cv_target_arch="SystemZ" ;; + *) llvm_cv_target_arch="Unknown" ;; +esac]) + +if test "$llvm_cv_target_arch" = "Unknown" ; then + AC_MSG_WARN([Configuring LLVM for an unknown target archicture]) +fi + +# Determine the LLVM native architecture for the target +case "$llvm_cv_target_arch" in + x86) LLVM_NATIVE_ARCH="X86" ;; + x86_64) LLVM_NATIVE_ARCH="X86" ;; + *) LLVM_NATIVE_ARCH="$llvm_cv_target_arch" ;; +esac + +dnl Define a substitution, ARCH, for the target architecture +AC_SUBST(ARCH,$llvm_cv_target_arch) + +dnl Check for the endianness of the target +AC_C_BIGENDIAN(AC_SUBST([ENDIAN],[big]),AC_SUBST([ENDIAN],[little])) + +dnl Check for build platform executable suffix if we're crosscompiling +if test "$cross_compiling" = yes; then + AC_SUBST(LLVM_CROSS_COMPILING, [1]) + AC_BUILD_EXEEXT + ac_build_prefix=${build_alias}- + AC_CHECK_PROG(BUILD_CXX, ${ac_build_prefix}g++, ${ac_build_prefix}g++) + if test -z "$BUILD_CXX"; then + AC_CHECK_PROG(BUILD_CXX, g++, g++) + if test -z "$BUILD_CXX"; then + AC_CHECK_PROG(BUILD_CXX, c++, c++, , , /usr/ucb/c++) + fi + fi +else + AC_SUBST(LLVM_CROSS_COMPILING, [0]) +fi + +dnl Check to see if there's a .svn or .git directory indicating that this +dnl build is being done from a checkout. This sets up several defaults for +dnl the command line switches. When we build with a checkout directory, +dnl we get a debug with assertions turned on. Without, we assume a source +dnl release and we get an optimized build without assertions. +dnl See --enable-optimized and --enable-assertions below +if test -d ".svn" -o -d "${srcdir}/.svn" -o -d ".git" -o -d "${srcdir}/.git"; then + cvsbuild="yes" + optimize="no" + AC_SUBST(CVSBUILD,[[CVSBUILD=1]]) +else + cvsbuild="no" + optimize="yes" +fi + +dnl===-----------------------------------------------------------------------=== +dnl=== +dnl=== SECTION 3: Command line arguments for the configure script. +dnl=== +dnl===-----------------------------------------------------------------------=== + +dnl --enable-libcpp : check whether or not to use libc++ on the command line +AC_ARG_ENABLE(libcpp, + AS_HELP_STRING([--enable-libcpp], + [Use libc++ if available (default is NO)]),, + enableval=default) +case "$enableval" in + yes) AC_SUBST(ENABLE_LIBCPP,[1]) ;; + no) AC_SUBST(ENABLE_LIBCPP,[0]) ;; + default) AC_SUBST(ENABLE_LIBCPP,[0]);; + *) AC_MSG_ERROR([Invalid setting for --enable-libcpp. Use "yes" or "no"]) ;; +esac + +dnl --enable-cxx11 : check whether or not to use -std=c++11 on the command line +AC_ARG_ENABLE(cxx11, + AS_HELP_STRING([--enable-cxx11], + [Use c++11 if available (default is NO)]),, + enableval=default) +case "$enableval" in + yes) AC_SUBST(ENABLE_CXX11,[1]) ;; + no) AC_SUBST(ENABLE_CXX11,[0]) ;; + default) AC_SUBST(ENABLE_CXX11,[0]);; + *) AC_MSG_ERROR([Invalid setting for --enable-cxx11. Use "yes" or "no"]) ;; +esac + +dnl --enable-optimized : check whether they want to do an optimized build: +AC_ARG_ENABLE(optimized, AS_HELP_STRING( + --enable-optimized,[Compile with optimizations enabled (default is NO)]),,enableval=$optimize) +if test ${enableval} = "no" ; then + AC_SUBST(ENABLE_OPTIMIZED,[[]]) +else + AC_SUBST(ENABLE_OPTIMIZED,[[ENABLE_OPTIMIZED=1]]) +fi + +dnl --enable-profiling : check whether they want to do a profile build: +AC_ARG_ENABLE(profiling, AS_HELP_STRING( + --enable-profiling,[Compile with profiling enabled (default is NO)]),,enableval="no") +if test ${enableval} = "no" ; then + AC_SUBST(ENABLE_PROFILING,[[]]) +else + AC_SUBST(ENABLE_PROFILING,[[ENABLE_PROFILING=1]]) +fi + +dnl --enable-assertions : check whether they want to turn on assertions or not: +AC_ARG_ENABLE(assertions,AS_HELP_STRING( + --enable-assertions,[Compile with assertion checks enabled (default is YES)]),, enableval="yes") +if test ${enableval} = "yes" ; then + AC_SUBST(DISABLE_ASSERTIONS,[[]]) +else + AC_SUBST(DISABLE_ASSERTIONS,[[DISABLE_ASSERTIONS=1]]) +fi + +dnl --enable-werror : check whether we want Werror on by default +AC_ARG_ENABLE(werror,AS_HELP_STRING( + --enable-werror,[Compile with -Werror enabled (default is NO)]),, enableval="no") +case "$enableval" in + yes) AC_SUBST(ENABLE_WERROR,[1]) ;; + no) AC_SUBST(ENABLE_WERROR,[0]) ;; + default) AC_SUBST(ENABLE_WERROR,[0]);; + *) AC_MSG_ERROR([Invalid setting for --enable-werror. Use "yes" or "no"]) ;; +esac + +dnl --enable-expensive-checks : check whether they want to turn on expensive debug checks: +AC_ARG_ENABLE(expensive-checks,AS_HELP_STRING( + --enable-expensive-checks,[Compile with expensive debug checks enabled (default is NO)]),, enableval="no") +if test ${enableval} = "yes" ; then + AC_SUBST(ENABLE_EXPENSIVE_CHECKS,[[ENABLE_EXPENSIVE_CHECKS=1]]) + AC_SUBST(EXPENSIVE_CHECKS,[[yes]]) +else + AC_SUBST(ENABLE_EXPENSIVE_CHECKS,[[]]) + AC_SUBST(EXPENSIVE_CHECKS,[[no]]) +fi + +dnl --enable-debug-runtime : should runtime libraries have debug symbols? +AC_ARG_ENABLE(debug-runtime, + AS_HELP_STRING(--enable-debug-runtime,[Build runtime libs with debug symbols (default is NO)]),,enableval=no) +if test ${enableval} = "no" ; then + AC_SUBST(DEBUG_RUNTIME,[[]]) +else + AC_SUBST(DEBUG_RUNTIME,[[DEBUG_RUNTIME=1]]) +fi + +dnl --enable-debug-symbols : should even optimized compiler libraries +dnl have debug symbols? +AC_ARG_ENABLE(debug-symbols, + AS_HELP_STRING(--enable-debug-symbols,[Build compiler with debug symbols (default is NO if optimization is on and YES if it's off)]),,enableval=no) +if test ${enableval} = "no" ; then + AC_SUBST(DEBUG_SYMBOLS,[[]]) +else + AC_SUBST(DEBUG_SYMBOLS,[[DEBUG_SYMBOLS=1]]) +fi + +dnl --enable-jit: check whether they want to enable the jit +AC_ARG_ENABLE(jit, + AS_HELP_STRING(--enable-jit, + [Enable Just In Time Compiling (default is YES)]),, + enableval=default) +if test ${enableval} = "no" +then + AC_SUBST(JIT,[[]]) +else + case "$llvm_cv_target_arch" in + x86) AC_SUBST(TARGET_HAS_JIT,1) ;; + Sparc) AC_SUBST(TARGET_HAS_JIT,0) ;; + PowerPC) AC_SUBST(TARGET_HAS_JIT,1) ;; + x86_64) AC_SUBST(TARGET_HAS_JIT,1) ;; + ARM) AC_SUBST(TARGET_HAS_JIT,1) ;; + AArch64) AC_SUBST(TARGET_HAS_JIT,0) ;; + Mips) AC_SUBST(TARGET_HAS_JIT,1) ;; + XCore) AC_SUBST(TARGET_HAS_JIT,0) ;; + MSP430) AC_SUBST(TARGET_HAS_JIT,0) ;; + Hexagon) AC_SUBST(TARGET_HAS_JIT,0) ;; + NVPTX) AC_SUBST(TARGET_HAS_JIT,0) ;; + SystemZ) AC_SUBST(TARGET_HAS_JIT,1) ;; + *) AC_SUBST(TARGET_HAS_JIT,0) ;; + esac +fi + +dnl Allow enablement of building and installing docs +AC_ARG_ENABLE(docs, + AS_HELP_STRING([--enable-docs], + [Build documents (default is YES)]),, + enableval=default) +case "$enableval" in + yes) AC_SUBST(ENABLE_DOCS,[1]) ;; + no) AC_SUBST(ENABLE_DOCS,[0]) ;; + default) AC_SUBST(ENABLE_DOCS,[1]) ;; + *) AC_MSG_ERROR([Invalid setting for --enable-docs. Use "yes" or "no"]) ;; +esac + +dnl Allow enablement of doxygen generated documentation +AC_ARG_ENABLE(doxygen, + AS_HELP_STRING([--enable-doxygen], + [Build doxygen documentation (default is NO)]),, + enableval=default) +case "$enableval" in + yes) AC_SUBST(ENABLE_DOXYGEN,[1]) ;; + no) AC_SUBST(ENABLE_DOXYGEN,[0]) ;; + default) AC_SUBST(ENABLE_DOXYGEN,[0]) ;; + *) AC_MSG_ERROR([Invalid setting for --enable-doxygen. Use "yes" or "no"]) ;; +esac + +dnl Allow disablement of threads +AC_ARG_ENABLE(threads, + AS_HELP_STRING([--enable-threads], + [Use threads if available (default is YES)]),, + enableval=default) +case "$enableval" in + yes) AC_SUBST(ENABLE_THREADS,[1]) ;; + no) AC_SUBST(ENABLE_THREADS,[0]) ;; + default) AC_SUBST(ENABLE_THREADS,[1]) ;; + *) AC_MSG_ERROR([Invalid setting for --enable-threads. Use "yes" or "no"]) ;; +esac +AC_DEFINE_UNQUOTED([ENABLE_THREADS],$ENABLE_THREADS,[Define if threads enabled]) + +dnl Allow disablement of pthread.h +AC_ARG_ENABLE(pthreads, + AS_HELP_STRING([--enable-pthreads], + [Use pthreads if available (default is YES)]),, + enableval=default) +case "$enableval" in + yes) AC_SUBST(ENABLE_PTHREADS,[1]) ;; + no) AC_SUBST(ENABLE_PTHREADS,[0]) ;; + default) AC_SUBST(ENABLE_PTHREADS,[1]) ;; + *) AC_MSG_ERROR([Invalid setting for --enable-pthreads. Use "yes" or "no"]) ;; +esac + +dnl Allow disablement of zlib +AC_ARG_ENABLE(zlib, + AS_HELP_STRING([--enable-zlib], + [Use zlib for compression/decompression if + available (default is YES)]),, + enableval=default) +case "$enableval" in + yes) AC_SUBST(LLVM_ENABLE_ZLIB,[1]) ;; + no) AC_SUBST(LLVM_ENABLE_ZLIB,[0]) ;; + default) AC_SUBST(LLVM_ENABLE_ZLIB,[1]) ;; + *) AC_MSG_ERROR([Invalid setting for --enable-zlib. Use "yes" or "no"]) ;; +esac +AC_DEFINE_UNQUOTED([LLVM_ENABLE_ZLIB],$LLVM_ENABLE_ZLIB, + [Define if zlib is enabled]) + +dnl Allow building without position independent code +AC_ARG_ENABLE(pic, + AS_HELP_STRING([--enable-pic], + [Build LLVM with Position Independent Code (default is YES)]),, + enableval=default) +case "$enableval" in + yes) AC_SUBST(ENABLE_PIC,[1]) ;; + no) AC_SUBST(ENABLE_PIC,[0]) ;; + default) AC_SUBST(ENABLE_PIC,[1]) ;; + *) AC_MSG_ERROR([Invalid setting for --enable-pic. Use "yes" or "no"]) ;; +esac +AC_DEFINE_UNQUOTED([ENABLE_PIC],$ENABLE_PIC, + [Define if position independent code is enabled]) + +dnl Allow building a shared library and linking tools against it. +AC_ARG_ENABLE(shared, + AS_HELP_STRING([--enable-shared], + [Build a shared library and link tools against it (default is NO)]),, + enableval=default) +case "$enableval" in + yes) AC_SUBST(ENABLE_SHARED,[1]) ;; + no) AC_SUBST(ENABLE_SHARED,[0]) ;; + default) AC_SUBST(ENABLE_SHARED,[0]) ;; + *) AC_MSG_ERROR([Invalid setting for --enable-shared. Use "yes" or "no"]) ;; +esac + +dnl Allow libstdc++ is embedded in LLVM.dll. +AC_ARG_ENABLE(embed-stdcxx, + AS_HELP_STRING([--enable-embed-stdcxx], + [Build a shared library with embedded libstdc++ for Win32 DLL (default is YES)]),, + enableval=default) +case "$enableval" in + yes) AC_SUBST(ENABLE_EMBED_STDCXX,[1]) ;; + no) AC_SUBST(ENABLE_EMBED_STDCXX,[0]) ;; + default) AC_SUBST(ENABLE_EMBED_STDCXX,[1]) ;; + *) AC_MSG_ERROR([Invalid setting for --enable-embed-stdcxx. Use "yes" or "no"]) ;; +esac + +dnl Enable embedding timestamp information into build. +AC_ARG_ENABLE(timestamps, + AS_HELP_STRING([--enable-timestamps], + [Enable embedding timestamp information in build (default is YES)]),, + enableval=default) +case "$enableval" in + yes) AC_SUBST(ENABLE_TIMESTAMPS,[1]) ;; + no) AC_SUBST(ENABLE_TIMESTAMPS,[0]) ;; + default) AC_SUBST(ENABLE_TIMESTAMPS,[1]) ;; + *) AC_MSG_ERROR([Invalid setting for --enable-timestamps. Use "yes" or "no"]) ;; +esac +AC_DEFINE_UNQUOTED([ENABLE_TIMESTAMPS],$ENABLE_TIMESTAMPS, + [Define if timestamp information (e.g., __DATE___) is allowed]) + +dnl Allow specific targets to be specified for building (or not) +TARGETS_TO_BUILD="" +AC_ARG_ENABLE([targets],AS_HELP_STRING([--enable-targets], + [Build specific host targets: all or target1,target2,... Valid targets are: + host, x86, x86_64, sparc, powerpc, arm, aarch64, mips, hexagon, + xcore, msp430, nvptx, systemz, r600, and cpp (default=all)]),, + enableval=all) +if test "$enableval" = host-only ; then + enableval=host +fi +case "$enableval" in + all) TARGETS_TO_BUILD="X86 Sparc PowerPC AArch64 ARM Mips XCore MSP430 CppBackend NVPTX Hexagon SystemZ R600" ;; + *)for a_target in `echo $enableval|sed -e 's/,/ /g' ` ; do + case "$a_target" in + x86) TARGETS_TO_BUILD="X86 $TARGETS_TO_BUILD" ;; + x86_64) TARGETS_TO_BUILD="X86 $TARGETS_TO_BUILD" ;; + sparc) TARGETS_TO_BUILD="Sparc $TARGETS_TO_BUILD" ;; + powerpc) TARGETS_TO_BUILD="PowerPC $TARGETS_TO_BUILD" ;; + aarch64) TARGETS_TO_BUILD="AArch64 $TARGETS_TO_BUILD" ;; + arm) TARGETS_TO_BUILD="ARM $TARGETS_TO_BUILD" ;; + mips) TARGETS_TO_BUILD="Mips $TARGETS_TO_BUILD" ;; + mipsel) TARGETS_TO_BUILD="Mips $TARGETS_TO_BUILD" ;; + mips64) TARGETS_TO_BUILD="Mips $TARGETS_TO_BUILD" ;; + mips64el) TARGETS_TO_BUILD="Mips $TARGETS_TO_BUILD" ;; + xcore) TARGETS_TO_BUILD="XCore $TARGETS_TO_BUILD" ;; + msp430) TARGETS_TO_BUILD="MSP430 $TARGETS_TO_BUILD" ;; + cpp) TARGETS_TO_BUILD="CppBackend $TARGETS_TO_BUILD" ;; + hexagon) TARGETS_TO_BUILD="Hexagon $TARGETS_TO_BUILD" ;; + nvptx) TARGETS_TO_BUILD="NVPTX $TARGETS_TO_BUILD" ;; + systemz) TARGETS_TO_BUILD="SystemZ $TARGETS_TO_BUILD" ;; + r600) TARGETS_TO_BUILD="R600 $TARGETS_TO_BUILD" ;; + host) case "$llvm_cv_target_arch" in + x86) TARGETS_TO_BUILD="X86 $TARGETS_TO_BUILD" ;; + x86_64) TARGETS_TO_BUILD="X86 $TARGETS_TO_BUILD" ;; + Sparc) TARGETS_TO_BUILD="Sparc $TARGETS_TO_BUILD" ;; + PowerPC) TARGETS_TO_BUILD="PowerPC $TARGETS_TO_BUILD" ;; + AArch64) TARGETS_TO_BUILD="AArch64 $TARGETS_TO_BUILD" ;; + ARM) TARGETS_TO_BUILD="ARM $TARGETS_TO_BUILD" ;; + Mips) TARGETS_TO_BUILD="Mips $TARGETS_TO_BUILD" ;; + XCore) TARGETS_TO_BUILD="XCore $TARGETS_TO_BUILD" ;; + MSP430) TARGETS_TO_BUILD="MSP430 $TARGETS_TO_BUILD" ;; + Hexagon) TARGETS_TO_BUILD="Hexagon $TARGETS_TO_BUILD" ;; + NVPTX) TARGETS_TO_BUILD="NVPTX $TARGETS_TO_BUILD" ;; + SystemZ) TARGETS_TO_BUILD="SystemZ $TARGETS_TO_BUILD" ;; + *) AC_MSG_ERROR([Can not set target to build]) ;; + esac ;; + *) AC_MSG_ERROR([Unrecognized target $a_target]) ;; + esac + done + ;; +esac +AC_SUBST(TARGETS_TO_BUILD,$TARGETS_TO_BUILD) + +# Determine whether we are building LLVM support for the native architecture. +# If so, define LLVM_NATIVE_ARCH to that LLVM target. +for a_target in $TARGETS_TO_BUILD; do + if test "$a_target" = "$LLVM_NATIVE_ARCH"; then + AC_DEFINE_UNQUOTED(LLVM_NATIVE_ARCH, $LLVM_NATIVE_ARCH, + [LLVM architecture name for the native architecture, if available]) + LLVM_NATIVE_TARGET="LLVMInitialize${LLVM_NATIVE_ARCH}Target" + LLVM_NATIVE_TARGETINFO="LLVMInitialize${LLVM_NATIVE_ARCH}TargetInfo" + LLVM_NATIVE_TARGETMC="LLVMInitialize${LLVM_NATIVE_ARCH}TargetMC" + LLVM_NATIVE_ASMPRINTER="LLVMInitialize${LLVM_NATIVE_ARCH}AsmPrinter" + if test -f ${srcdir}/lib/Target/${LLVM_NATIVE_ARCH}/AsmParser/Makefile ; then + LLVM_NATIVE_ASMPARSER="LLVMInitialize${LLVM_NATIVE_ARCH}AsmParser" + fi + if test -f ${srcdir}/lib/Target/${LLVM_NATIVE_ARCH}/Disassembler/Makefile ; then + LLVM_NATIVE_DISASSEMBLER="LLVMInitialize${LLVM_NATIVE_ARCH}Disassembler" + fi + AC_DEFINE_UNQUOTED(LLVM_NATIVE_TARGET, $LLVM_NATIVE_TARGET, + [LLVM name for the native Target init function, if available]) + AC_DEFINE_UNQUOTED(LLVM_NATIVE_TARGETINFO, $LLVM_NATIVE_TARGETINFO, + [LLVM name for the native TargetInfo init function, if available]) + AC_DEFINE_UNQUOTED(LLVM_NATIVE_TARGETMC, $LLVM_NATIVE_TARGETMC, + [LLVM name for the native target MC init function, if available]) + AC_DEFINE_UNQUOTED(LLVM_NATIVE_ASMPRINTER, $LLVM_NATIVE_ASMPRINTER, + [LLVM name for the native AsmPrinter init function, if available]) + if test -f ${srcdir}/lib/Target/${LLVM_NATIVE_ARCH}/AsmParser/Makefile ; then + AC_DEFINE_UNQUOTED(LLVM_NATIVE_ASMPARSER, $LLVM_NATIVE_ASMPARSER, + [LLVM name for the native AsmParser init function, if available]) + fi + if test -f ${srcdir}/lib/Target/${LLVM_NATIVE_ARCH}/Disassembler/Makefile ; then + AC_DEFINE_UNQUOTED(LLVM_NATIVE_DISASSEMBLER, $LLVM_NATIVE_DISASSEMBLER, + [LLVM name for the native Disassembler init function, if available]) + fi + fi +done + +# Build the LLVM_TARGET and LLVM_... macros for Targets.def and the individual +# target feature def files. +LLVM_ENUM_TARGETS="" +LLVM_ENUM_ASM_PRINTERS="" +LLVM_ENUM_ASM_PARSERS="" +LLVM_ENUM_DISASSEMBLERS="" +for target_to_build in $TARGETS_TO_BUILD; do + LLVM_ENUM_TARGETS="LLVM_TARGET($target_to_build) $LLVM_ENUM_TARGETS" + if test -f ${srcdir}/lib/Target/${target_to_build}/*AsmPrinter.cpp ; then + LLVM_ENUM_ASM_PRINTERS="LLVM_ASM_PRINTER($target_to_build) $LLVM_ENUM_ASM_PRINTERS"; + fi + if test -f ${srcdir}/lib/Target/${target_to_build}/AsmParser/Makefile ; then + LLVM_ENUM_ASM_PARSERS="LLVM_ASM_PARSER($target_to_build) $LLVM_ENUM_ASM_PARSERS"; + fi + if test -f ${srcdir}/lib/Target/${target_to_build}/Disassembler/Makefile ; then + LLVM_ENUM_DISASSEMBLERS="LLVM_DISASSEMBLER($target_to_build) $LLVM_ENUM_DISASSEMBLERS"; + fi +done +AC_SUBST(LLVM_ENUM_TARGETS) +AC_SUBST(LLVM_ENUM_ASM_PRINTERS) +AC_SUBST(LLVM_ENUM_ASM_PARSERS) +AC_SUBST(LLVM_ENUM_DISASSEMBLERS) + +dnl Override the option to use for optimized builds. +AC_ARG_WITH(optimize-option, + AS_HELP_STRING([--with-optimize-option], + [Select the compiler options to use for optimized builds]),, + withval=default) +AC_MSG_CHECKING([optimization flags]) +case "$withval" in + default) + case "$llvm_cv_os_type" in + FreeBSD) optimize_option=-O2 ;; + MingW) optimize_option=-O2 ;; + *) optimize_option=-O3 ;; + esac ;; + *) optimize_option="$withval" ;; +esac +AC_SUBST(OPTIMIZE_OPTION,$optimize_option) +AC_MSG_RESULT([$optimize_option]) + +dnl Specify extra build options +AC_ARG_WITH(extra-options, + AS_HELP_STRING([--with-extra-options], + [Specify additional options to compile LLVM with]),, + withval=default) +case "$withval" in + default) EXTRA_OPTIONS= ;; + *) EXTRA_OPTIONS=$withval ;; +esac +AC_SUBST(EXTRA_OPTIONS,$EXTRA_OPTIONS) + +dnl Specify extra linker build options +AC_ARG_WITH(extra-ld-options, + AS_HELP_STRING([--with-extra-ld-options], + [Specify additional options to link LLVM with]),, + withval=default) +case "$withval" in + default) EXTRA_LD_OPTIONS= ;; + *) EXTRA_LD_OPTIONS=$withval ;; +esac +AC_SUBST(EXTRA_LD_OPTIONS,$EXTRA_LD_OPTIONS) + +dnl Allow specific bindings to be specified for building (or not) +AC_ARG_ENABLE([bindings],AS_HELP_STRING([--enable-bindings], + [Build specific language bindings: all,auto,none,{binding-name} (default=auto)]),, + enableval=default) +BINDINGS_TO_BUILD="" +case "$enableval" in + yes | default | auto) BINDINGS_TO_BUILD="auto" ;; + all ) BINDINGS_TO_BUILD="ocaml" ;; + none | no) BINDINGS_TO_BUILD="" ;; + *)for a_binding in `echo $enableval|sed -e 's/,/ /g' ` ; do + case "$a_binding" in + ocaml) BINDINGS_TO_BUILD="ocaml $BINDINGS_TO_BUILD" ;; + *) AC_MSG_ERROR([Unrecognized binding $a_binding]) ;; + esac + done + ;; +esac + +dnl Allow the ocaml libdir to be overridden. This could go in a configure +dnl script for bindings/ocaml/configure, except that its auto value depends on +dnl OCAMLC, which is found here to support tests. +AC_ARG_WITH([ocaml-libdir], + [AS_HELP_STRING([--with-ocaml-libdir], + [Specify install location for ocaml bindings (default is stdlib)])], + [], + [withval=auto]) +case "$withval" in + auto) with_ocaml_libdir="$withval" ;; + /* | [[A-Za-z]]:[[\\/]]*) with_ocaml_libdir="$withval" ;; + *) AC_MSG_ERROR([Invalid path for --with-ocaml-libdir. Provide full path]) ;; +esac + +AC_ARG_WITH(clang-resource-dir, + AS_HELP_STRING([--with-clang-resource-dir], + [Relative directory from the Clang binary for resource files]),, + withval="") +AC_DEFINE_UNQUOTED(CLANG_RESOURCE_DIR,"$withval", + [Relative directory for resource files]) + +AC_ARG_WITH(c-include-dirs, + AS_HELP_STRING([--with-c-include-dirs], + [Colon separated list of directories clang will search for headers]),, + withval="") +AC_DEFINE_UNQUOTED(C_INCLUDE_DIRS,"$withval", + [Directories clang will search for headers]) + +# Clang normally uses the system c++ headers and libraries. With this option, +# clang will use the ones provided by a gcc installation instead. This option should +# be passed the same value that was used with --prefix when configuring gcc. +AC_ARG_WITH(gcc-toolchain, + AS_HELP_STRING([--with-gcc-toolchain], + [Directory where gcc is installed.]),, + withval="") +AC_DEFINE_UNQUOTED(GCC_INSTALL_PREFIX,"$withval", + [Directory where gcc is installed.]) + +dnl Allow linking of LLVM with GPLv3 binutils code. +AC_ARG_WITH(binutils-include, + AS_HELP_STRING([--with-binutils-include], + [Specify path to binutils/include/ containing plugin-api.h file for gold plugin.]),, + withval=default) +case "$withval" in + default) WITH_BINUTILS_INCDIR=default ;; + /* | [[A-Za-z]]:[[\\/]]*) WITH_BINUTILS_INCDIR=$withval ;; + *) AC_MSG_ERROR([Invalid path for --with-binutils-include. Provide full path]) ;; +esac +if test "x$WITH_BINUTILS_INCDIR" != xdefault ; then + AC_SUBST(BINUTILS_INCDIR,$WITH_BINUTILS_INCDIR) + if test ! -f "$WITH_BINUTILS_INCDIR/plugin-api.h"; then + echo "$WITH_BINUTILS_INCDIR/plugin-api.h" + AC_MSG_ERROR([Invalid path to directory containing plugin-api.h.]); + fi +fi + +dnl Specify the URL where bug reports should be submitted. +AC_ARG_WITH(bug-report-url, + AS_HELP_STRING([--with-bug-report-url], + [Specify the URL where bug reports should be submitted (default=http://llvm.org/bugs/)]),, + withval="http://llvm.org/bugs/") +AC_DEFINE_UNQUOTED(BUG_REPORT_URL,"$withval", + [Bug report URL.]) + +dnl --enable-terminfo: check whether the user wants to control use of terminfo: +AC_ARG_ENABLE(terminfo,AS_HELP_STRING( + [--enable-terminfo], + [Query the terminfo database if available (default is YES)]), + [case "$enableval" in + yes) llvm_cv_enable_terminfo="yes" ;; + no) llvm_cv_enable_terminfo="no" ;; + *) AC_MSG_ERROR([Invalid setting for --enable-terminfo. Use "yes" or "no"]) ;; + esac], + llvm_cv_enable_terminfo="yes") + +dnl --enable-libffi : check whether the user wants to turn off libffi: +AC_ARG_ENABLE(libffi,AS_HELP_STRING( + --enable-libffi,[Check for the presence of libffi (default is NO)]), + [case "$enableval" in + yes) llvm_cv_enable_libffi="yes" ;; + no) llvm_cv_enable_libffi="no" ;; + *) AC_MSG_ERROR([Invalid setting for --enable-libffi. Use "yes" or "no"]) ;; + esac], + llvm_cv_enable_libffi=no) + +dnl===-----------------------------------------------------------------------=== +dnl=== +dnl=== SECTION 4: Check for programs we need and that they are the right version +dnl=== +dnl===-----------------------------------------------------------------------=== + +AC_PROG_NM +AC_SUBST(NM) + +dnl Check for the tools that the makefiles require +AC_CHECK_GNU_MAKE +AC_PROG_LN_S +AC_PATH_PROG(CMP, [cmp], [cmp]) +AC_PATH_PROG(CP, [cp], [cp]) +AC_PATH_PROG(DATE, [date], [date]) +AC_PATH_PROG(FIND, [find], [find]) +AC_PATH_PROG(GREP, [grep], [grep]) +AC_PATH_PROG(MKDIR,[mkdir],[mkdir]) +AC_PATH_PROG(MV, [mv], [mv]) +AC_PROG_RANLIB +AC_CHECK_TOOL(AR, ar, false) +AC_PATH_PROG(RM, [rm], [rm]) +AC_PATH_PROG(SED, [sed], [sed]) +AC_PATH_PROG(TAR, [tar], [gtar]) +AC_PATH_PROG(BINPWD,[pwd], [pwd]) + +dnl Looking for misc. graph plotting software +AC_PATH_PROG(GRAPHVIZ, [Graphviz], [echo Graphviz]) +if test "$GRAPHVIZ" != "echo Graphviz" ; then + AC_DEFINE([HAVE_GRAPHVIZ],[1],[Define if the Graphviz program is available]) + dnl If we're targeting for mingw we should emit windows paths, not msys + if test "$llvm_cv_os_type" = "MingW" ; then + GRAPHVIZ=`echo $GRAPHVIZ | sed 's/^\/\([[A-Za-z]]\)\//\1:\//' ` + fi + AC_DEFINE_UNQUOTED([LLVM_PATH_GRAPHVIZ],"$GRAPHVIZ${EXEEXT}", + [Define to path to Graphviz program if found or 'echo Graphviz' otherwise]) +fi +AC_PATH_PROG(DOT, [dot], [echo dot]) +if test "$DOT" != "echo dot" ; then + AC_DEFINE([HAVE_DOT],[1],[Define if the dot program is available]) + dnl If we're targeting for mingw we should emit windows paths, not msys + if test "$llvm_cv_os_type" = "MingW" ; then + DOT=`echo $DOT | sed 's/^\/\([[A-Za-z]]\)\//\1:\//' ` + fi + AC_DEFINE_UNQUOTED([LLVM_PATH_DOT],"$DOT${EXEEXT}", + [Define to path to dot program if found or 'echo dot' otherwise]) +fi +AC_PATH_PROG(FDP, [fdp], [echo fdp]) +if test "$FDP" != "echo fdp" ; then + AC_DEFINE([HAVE_FDP],[1],[Define if the neat program is available]) + dnl If we're targeting for mingw we should emit windows paths, not msys + if test "$llvm_cv_os_type" = "MingW" ; then + FDP=`echo $FDP | sed 's/^\/\([[A-Za-z]]\)\//\1:\//' ` + fi + AC_DEFINE_UNQUOTED([LLVM_PATH_FDP],"$FDP${EXEEXT}", + [Define to path to fdp program if found or 'echo fdp' otherwise]) +fi +AC_PATH_PROG(NEATO, [neato], [echo neato]) +if test "$NEATO" != "echo neato" ; then + AC_DEFINE([HAVE_NEATO],[1],[Define if the neat program is available]) + dnl If we're targeting for mingw we should emit windows paths, not msys + if test "$llvm_cv_os_type" = "MingW" ; then + NEATO=`echo $NEATO | sed 's/^\/\([[A-Za-z]]\)\//\1:\//' ` + fi + AC_DEFINE_UNQUOTED([LLVM_PATH_NEATO],"$NEATO${EXEEXT}", + [Define to path to neato program if found or 'echo neato' otherwise]) +fi +AC_PATH_PROG(TWOPI, [twopi], [echo twopi]) +if test "$TWOPI" != "echo twopi" ; then + AC_DEFINE([HAVE_TWOPI],[1],[Define if the neat program is available]) + dnl If we're targeting for mingw we should emit windows paths, not msys + if test "$llvm_cv_os_type" = "MingW" ; then + TWOPI=`echo $TWOPI | sed 's/^\/\([[A-Za-z]]\)\//\1:\//' ` + fi + AC_DEFINE_UNQUOTED([LLVM_PATH_TWOPI],"$TWOPI${EXEEXT}", + [Define to path to twopi program if found or 'echo twopi' otherwise]) +fi +AC_PATH_PROG(CIRCO, [circo], [echo circo]) +if test "$CIRCO" != "echo circo" ; then + AC_DEFINE([HAVE_CIRCO],[1],[Define if the neat program is available]) + dnl If we're targeting for mingw we should emit windows paths, not msys + if test "$llvm_cv_os_type" = "MingW" ; then + CIRCO=`echo $CIRCO | sed 's/^\/\([[A-Za-z]]\)\//\1:\//' ` + fi + AC_DEFINE_UNQUOTED([LLVM_PATH_CIRCO],"$CIRCO${EXEEXT}", + [Define to path to circo program if found or 'echo circo' otherwise]) +fi +AC_PATH_PROGS(GV, [gv gsview32], [echo gv]) +if test "$GV" != "echo gv" ; then + AC_DEFINE([HAVE_GV],[1],[Define if the gv program is available]) + dnl If we're targeting for mingw we should emit windows paths, not msys + if test "$llvm_cv_os_type" = "MingW" ; then + GV=`echo $GV | sed 's/^\/\([[A-Za-z]]\)\//\1:\//' ` + fi + AC_DEFINE_UNQUOTED([LLVM_PATH_GV],"$GV${EXEEXT}", + [Define to path to gv program if found or 'echo gv' otherwise]) +fi +AC_PATH_PROG(DOTTY, [dotty], [echo dotty]) +if test "$DOTTY" != "echo dotty" ; then + AC_DEFINE([HAVE_DOTTY],[1],[Define if the dotty program is available]) + dnl If we're targeting for mingw we should emit windows paths, not msys + if test "$llvm_cv_os_type" = "MingW" ; then + DOTTY=`echo $DOTTY | sed 's/^\/\([[A-Za-z]]\)\//\1:\//' ` + fi + AC_DEFINE_UNQUOTED([LLVM_PATH_DOTTY],"$DOTTY${EXEEXT}", + [Define to path to dotty program if found or 'echo dotty' otherwise]) +fi +AC_PATH_PROG(XDOT_PY, [xdot.py], [echo xdot.py]) +if test "$XDOT_PY" != "echo xdot.py" ; then + AC_DEFINE([HAVE_XDOT_PY],[1],[Define if the xdot.py program is available]) + dnl If we're targeting for mingw we should emit windows paths, not msys + if test "$llvm_cv_os_type" = "MingW" ; then + XDOT_PY=`echo $XDOT_PY | sed 's/^\/\([[A-Za-z]]\)\//\1:\//' ` + fi + AC_DEFINE_UNQUOTED([LLVM_PATH_XDOT_PY],"$XDOT_PY${EXEEXT}", + [Define to path to xdot.py program if found or 'echo xdot.py' otherwise]) +fi + +dnl Find the install program +AC_PROG_INSTALL +dnl Prepend src dir to install path dir if it's a relative path +dnl This is a hack for installs that take place in something other +dnl than the top level. +case "$INSTALL" in + [[\\/$]]* | ?:[[\\/]]* ) ;; + *) INSTALL="\\\$(TOPSRCDIR)/$INSTALL" ;; +esac + +dnl Checks for documentation and testing tools that we can do without. If these +dnl are not found then they are set to "true" which always succeeds but does +dnl nothing. This just lets the build output show that we could have done +dnl something if the tool was available. +AC_PATH_PROG(BZIP2, [bzip2]) +AC_PATH_PROG(CAT, [cat]) +AC_PATH_PROG(DOXYGEN, [doxygen]) +AC_PATH_PROG(GROFF, [groff]) +AC_PATH_PROG(GZIPBIN, [gzip]) +AC_PATH_PROG(POD2HTML, [pod2html]) +AC_PATH_PROG(POD2MAN, [pod2man]) +AC_PATH_PROG(PDFROFF, [pdfroff]) +AC_PATH_PROG(RUNTEST, [runtest]) +DJ_AC_PATH_TCLSH +AC_PATH_PROG(ZIP, [zip]) +AC_PATH_PROGS(OCAMLC, [ocamlc]) +AC_PATH_PROGS(OCAMLOPT, [ocamlopt]) +AC_PATH_PROGS(OCAMLDEP, [ocamldep]) +AC_PATH_PROGS(OCAMLDOC, [ocamldoc]) +AC_PATH_PROGS(GAS, [gas as]) + +dnl Get the version of the linker in use. +AC_LINK_GET_VERSION + +dnl Determine whether the linker supports the -R option. +AC_LINK_USE_R + +dnl Determine whether the compiler supports the -rdynamic option. +AC_LINK_EXPORT_DYNAMIC + +dnl Determine whether the linker supports the --version-script option. +AC_LINK_VERSION_SCRIPT + +dnl Check for libtool and the library that has dlopen function (which must come +dnl before the AC_PROG_LIBTOOL check in order to enable dlopening libraries with +dnl libtool). +AC_LIBTOOL_DLOPEN +AC_LIB_LTDL + +AC_MSG_CHECKING([tool compatibility]) + +dnl Ensure that compilation tools are GCC or a GNU compatible compiler such as +dnl ICC; we use GCC specific options in the makefiles so the compiler needs +dnl to support those options. +dnl "icc" emits gcc signatures +dnl "icc -no-gcc" emits no gcc signature BUT is still compatible +ICC=no +IXX=no +case $CC in + icc*|icpc*) + ICC=yes + IXX=yes + ;; + *) + ;; +esac + +if test "$GCC" != "yes" && test "$ICC" != "yes" +then + AC_MSG_ERROR([gcc|icc required but not found]) +fi + +dnl Ensure that compilation tools are compatible with GCC extensions +if test "$GXX" != "yes" && test "$IXX" != "yes" +then + AC_MSG_ERROR([g++|clang++|icc required but not found]) +fi + +dnl Verify that GCC is version 3.0 or higher +if test "$GCC" = "yes" +then + AC_COMPILE_IFELSE([[#if !defined(__GNUC__) || __GNUC__ < 3 +#error Unsupported GCC version +#endif +]], [], [AC_MSG_ERROR([gcc 3.x required, but you have a lower version])]) +fi + +dnl Check for GNU Make. We use its extensions, so don't build without it +if test -z "$llvm_cv_gnu_make_command" +then + AC_MSG_ERROR([GNU Make required but not found]) +fi + +dnl Tool compatibility is okay if we make it here. +AC_MSG_RESULT([ok]) + +dnl Check optional compiler flags. +AC_MSG_CHECKING([optional compiler flags]) +CXX_FLAG_CHECK(NO_VARIADIC_MACROS, [-Wno-variadic-macros]) +CXX_FLAG_CHECK(NO_MISSING_FIELD_INITIALIZERS, [-Wno-missing-field-initializers]) +CXX_FLAG_CHECK(COVERED_SWITCH_DEFAULT, [-Wcovered-switch-default]) +AC_MSG_RESULT([$NO_VARIADIC_MACROS $NO_MISSING_FIELD_INITIALIZERS $COVERED_SWITCH_DEFAULT]) + +dnl===-----------------------------------------------------------------------=== +dnl=== +dnl=== SECTION 5: Check for libraries +dnl=== +dnl===-----------------------------------------------------------------------=== + +AC_CHECK_LIB(m,sin) +if test "$llvm_cv_os_type" = "MingW" ; then + AC_CHECK_LIB(imagehlp, main) + AC_CHECK_LIB(psapi, main) + AC_CHECK_LIB(shell32, main) +fi + +dnl dlopen() is required for plugin support. +AC_SEARCH_LIBS(dlopen,dl,AC_DEFINE([HAVE_DLOPEN],[1], + [Define if dlopen() is available on this platform.]), + AC_MSG_WARN([dlopen() not found - disabling plugin support])) + +dnl Search for the clock_gettime() function. Note that we rely on the POSIX +dnl macros to detect whether clock_gettime is available, this just finds the +dnl right libraries to link with. +AC_SEARCH_LIBS(clock_gettime,rt) + +dnl The curses library is optional; used for querying terminal info +if test "$llvm_cv_enable_terminfo" = "yes" ; then + dnl We need the has_color functionality in curses for it to be useful. + AC_SEARCH_LIBS(setupterm,tinfo curses ncurses ncursesw, + AC_DEFINE([HAVE_TERMINFO],[1], + [Define if the setupterm() function is supported this platform.])) +fi + +dnl libffi is optional; used to call external functions from the interpreter +if test "$llvm_cv_enable_libffi" = "yes" ; then + AC_SEARCH_LIBS(ffi_call,ffi,AC_DEFINE([HAVE_FFI_CALL],[1], + [Define if libffi is available on this platform.]), + AC_MSG_ERROR([libffi not found - configure without --enable-libffi to compile without it])) +fi + +dnl mallinfo is optional; the code can compile (minus features) without it +AC_SEARCH_LIBS(mallinfo,malloc,AC_DEFINE([HAVE_MALLINFO],[1], + [Define if mallinfo() is available on this platform.])) + +dnl pthread locking functions are optional - but llvm will not be thread-safe +dnl without locks. +if test "$ENABLE_THREADS" -eq 1 && test "$ENABLE_PTHREADS" -eq 1 ; then + AC_CHECK_LIB(pthread, pthread_mutex_init) + AC_SEARCH_LIBS(pthread_mutex_lock,pthread, + AC_DEFINE([HAVE_PTHREAD_MUTEX_LOCK],[1], + [Have pthread_mutex_lock])) + AC_SEARCH_LIBS(pthread_rwlock_init,pthread, + AC_DEFINE([HAVE_PTHREAD_RWLOCK_INIT],[1], + [Have pthread_rwlock_init])) + AC_SEARCH_LIBS(pthread_getspecific,pthread, + AC_DEFINE([HAVE_PTHREAD_GETSPECIFIC],[1], + [Have pthread_getspecific])) +fi + +dnl zlib is optional; used for compression/uncompression +if test "$LLVM_ENABLE_ZLIB" -eq 1 ; then + AC_CHECK_LIB(z, compress2) +fi + +dnl Allow extra x86-disassembler library +AC_ARG_WITH(udis86, + AS_HELP_STRING([--with-udis86=], + [Use udis86 external x86 disassembler library]), + [ + AC_SUBST(USE_UDIS86, [1]) + case "$withval" in + /usr/lib|yes) ;; + *) LDFLAGS="$LDFLAGS -L${withval}" ;; + esac + AC_CHECK_LIB(udis86, ud_init, [], [ + echo "Error! You need to have libudis86 around." + exit -1 + ]) + ], + AC_SUBST(USE_UDIS86, [0])) +AC_DEFINE_UNQUOTED([USE_UDIS86],$USE_UDIS86, + [Define if use udis86 library]) + +dnl Allow OProfile support for JIT output. +AC_ARG_WITH(oprofile, + AS_HELP_STRING([--with-oprofile=], + [Tell OProfile >= 0.9.4 how to symbolize JIT output]), + [ + AC_SUBST(USE_OPROFILE, [1]) + case "$withval" in + /usr|yes) llvm_cv_oppath=/usr/lib/oprofile ;; + no) llvm_cv_oppath= + AC_SUBST(USE_OPROFILE, [0]) ;; + *) llvm_cv_oppath="${withval}/lib/oprofile" + CPPFLAGS="-I${withval}/include";; + esac + if test -n "$llvm_cv_oppath" ; then + LIBS="$LIBS -L${llvm_cv_oppath} -Wl,-rpath,${llvm_cv_oppath}" + dnl Work around http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=537744: + dnl libbfd is not included properly in libopagent in some Debian + dnl versions. If libbfd isn't found at all, we assume opagent works + dnl anyway. + AC_SEARCH_LIBS(bfd_init, bfd, [], []) + AC_SEARCH_LIBS(op_open_agent, opagent, [], [ + echo "Error! You need to have libopagent around." + exit -1 + ]) + AC_CHECK_HEADER([opagent.h], [], [ + echo "Error! You need to have opagent.h around." + exit -1 + ]) + fi + ], + [ + AC_SUBST(USE_OPROFILE, [0]) + ]) +AC_DEFINE_UNQUOTED([USE_OPROFILE],$USE_OPROFILE, + [Define if we have the oprofile JIT-support library]) + +dnl===-----------------------------------------------------------------------=== +dnl=== +dnl=== SECTION 6: Check for header files +dnl=== +dnl===-----------------------------------------------------------------------=== + +dnl First, use autoconf provided macros for specific headers that we need +dnl We don't check for ancient stuff or things that are guaranteed to be there +dnl by the C++ standard. We always use the versions of C headers. +dnl Generally we're looking for POSIX headers. +AC_HEADER_DIRENT +AC_HEADER_MMAP_ANONYMOUS +AC_HEADER_STAT +AC_HEADER_SYS_WAIT +AC_HEADER_TIME + +AC_CHECK_HEADERS([dlfcn.h execinfo.h fcntl.h inttypes.h limits.h link.h]) +AC_CHECK_HEADERS([malloc.h setjmp.h signal.h stdint.h termios.h unistd.h]) +AC_CHECK_HEADERS([utime.h windows.h]) +AC_CHECK_HEADERS([sys/mman.h sys/param.h sys/resource.h sys/time.h sys/uio.h]) +AC_CHECK_HEADERS([sys/types.h sys/ioctl.h malloc/malloc.h mach/mach.h]) +AC_CHECK_HEADERS([valgrind/valgrind.h]) +AC_CHECK_HEADERS([fenv.h]) +if test "$ENABLE_THREADS" -eq 1 && test "$ENABLE_PTHREADS" -eq 1 ; then + AC_CHECK_HEADERS(pthread.h, + AC_SUBST(HAVE_PTHREAD, 1), + AC_SUBST(HAVE_PTHREAD, 0)) +else + AC_SUBST(HAVE_PTHREAD, 0) +fi +if test "$LLVM_ENABLE_ZLIB" -eq 1 ; then + AC_CHECK_HEADERS(zlib.h, + AC_SUBST(HAVE_LIBZ, 1), + AC_SUBST(HAVE_LIBZ, 0)) +else + AC_SUBST(HAVE_LIBZ, 0) +fi + +dnl Try to find ffi.h. +if test "$llvm_cv_enable_libffi" = "yes" ; then + AC_CHECK_HEADERS([ffi.h ffi/ffi.h]) +fi + +dnl Try to find Darwin specific crash reporting libraries. +AC_CHECK_HEADERS([CrashReporterClient.h]) + +dnl Try to find Darwin specific crash reporting global. +AC_MSG_CHECKING([__crashreporter_info__]) +AC_LINK_IFELSE( + AC_LANG_SOURCE( + [[extern const char *__crashreporter_info__; + int main() { + __crashreporter_info__ = "test"; + return 0; + } + ]]), + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_CRASHREPORTER_INFO, 1, Can use __crashreporter_info__), + AC_MSG_RESULT(no) + AC_DEFINE(HAVE_CRASHREPORTER_INFO, 0, + Define if __crashreporter_info__ exists.)) + +dnl===-----------------------------------------------------------------------=== +dnl=== +dnl=== SECTION 7: Check for types and structures +dnl=== +dnl===-----------------------------------------------------------------------=== + +AC_HUGE_VAL_CHECK +AC_TYPE_PID_T +AC_TYPE_SIZE_T +AC_DEFINE_UNQUOTED([RETSIGTYPE],[void],[Define as the return type of signal handlers (`int' or `void').]) +AC_STRUCT_TM +AC_CHECK_TYPES([int64_t],,AC_MSG_ERROR([Type int64_t required but not found])) +AC_CHECK_TYPES([uint64_t],, + AC_CHECK_TYPES([u_int64_t],, + AC_MSG_ERROR([Type uint64_t or u_int64_t required but not found]))) + +dnl===-----------------------------------------------------------------------=== +dnl=== +dnl=== SECTION 8: Check for specific functions needed +dnl=== +dnl===-----------------------------------------------------------------------=== + +AC_CHECK_FUNCS([backtrace ceilf floorf roundf rintf nearbyintf getcwd ]) +AC_CHECK_FUNCS([powf fmodf strtof round ]) +AC_CHECK_FUNCS([getpagesize getrusage getrlimit setrlimit gettimeofday ]) +AC_CHECK_FUNCS([isatty mkdtemp mkstemp ]) +AC_CHECK_FUNCS([mktemp posix_spawn realpath sbrk setrlimit strdup ]) +AC_CHECK_FUNCS([strerror strerror_r setenv ]) +AC_CHECK_FUNCS([strtoll strtoq sysconf malloc_zone_statistics ]) +AC_CHECK_FUNCS([setjmp longjmp sigsetjmp siglongjmp writev]) +AC_C_PRINTF_A +AC_FUNC_RAND48 + +dnl Check the declaration "Secure API" on Windows environments. +AC_CHECK_DECLS([strerror_s]) + +dnl Check symbols in libgcc.a for JIT on Mingw. +if test "$llvm_cv_os_type" = "MingW" ; then + AC_CHECK_LIB(gcc,_alloca,AC_DEFINE([HAVE__ALLOCA],[1],[Have host's _alloca])) + AC_CHECK_LIB(gcc,__alloca,AC_DEFINE([HAVE___ALLOCA],[1],[Have host's __alloca])) + AC_CHECK_LIB(gcc,__chkstk,AC_DEFINE([HAVE___CHKSTK],[1],[Have host's __chkstk])) + AC_CHECK_LIB(gcc,___chkstk,AC_DEFINE([HAVE____CHKSTK],[1],[Have host's ___chkstk])) + + AC_CHECK_LIB(gcc,__ashldi3,AC_DEFINE([HAVE___ASHLDI3],[1],[Have host's __ashldi3])) + AC_CHECK_LIB(gcc,__ashrdi3,AC_DEFINE([HAVE___ASHRDI3],[1],[Have host's __ashrdi3])) + AC_CHECK_LIB(gcc,__divdi3,AC_DEFINE([HAVE___DIVDI3],[1],[Have host's __divdi3])) + AC_CHECK_LIB(gcc,__fixdfdi,AC_DEFINE([HAVE___FIXDFDI],[1],[Have host's __fixdfdi])) + AC_CHECK_LIB(gcc,__fixsfdi,AC_DEFINE([HAVE___FIXSFDI],[1],[Have host's __fixsfdi])) + AC_CHECK_LIB(gcc,__floatdidf,AC_DEFINE([HAVE___FLOATDIDF],[1],[Have host's __floatdidf])) + AC_CHECK_LIB(gcc,__lshrdi3,AC_DEFINE([HAVE___LSHRDI3],[1],[Have host's __lshrdi3])) + AC_CHECK_LIB(gcc,__moddi3,AC_DEFINE([HAVE___MODDI3],[1],[Have host's __moddi3])) + AC_CHECK_LIB(gcc,__udivdi3,AC_DEFINE([HAVE___UDIVDI3],[1],[Have host's __udivdi3])) + AC_CHECK_LIB(gcc,__umoddi3,AC_DEFINE([HAVE___UMODDI3],[1],[Have host's __umoddi3])) + + AC_CHECK_LIB(gcc,__main,AC_DEFINE([HAVE___MAIN],[1],[Have host's __main])) + AC_CHECK_LIB(gcc,__cmpdi2,AC_DEFINE([HAVE___CMPDI2],[1],[Have host's __cmpdi2])) +fi + +dnl Check Win32 API EnumerateLoadedModules. +if test "$llvm_cv_os_type" = "MingW" ; then + AC_MSG_CHECKING([whether EnumerateLoadedModules() accepts new decl]) + AC_COMPILE_IFELSE([[#include +#include +extern void foo(PENUMLOADED_MODULES_CALLBACK); +extern void foo(BOOL(CALLBACK*)(PCSTR,ULONG_PTR,ULONG,PVOID));]], +[ + AC_MSG_RESULT([yes]) + llvm_cv_win32_elmcb_pcstr="PCSTR" +], +[ + AC_MSG_RESULT([no]) + llvm_cv_win32_elmcb_pcstr="PSTR" +]) + AC_DEFINE_UNQUOTED([WIN32_ELMCB_PCSTR],$llvm_cv_win32_elmcb_pcstr,[Type of 1st arg on ELM Callback]) +fi + +dnl Check for variations in the Standard C++ library and STL. These macros are +dnl provided by LLVM in the autoconf/m4 directory. +AC_FUNC_ISNAN +AC_FUNC_ISINF + +dnl Check for mmap support.We also need to know if /dev/zero is required to +dnl be opened for allocating RWX memory. +dnl Make sure we aren't attempting to configure for an unknown system +if test "$llvm_cv_platform_type" = "Unix" ; then + AC_FUNC_MMAP + AC_FUNC_MMAP_FILE + AC_NEED_DEV_ZERO_FOR_MMAP + + if test "$ac_cv_func_mmap_fixed_mapped" = "no" + then + AC_MSG_WARN([mmap() of a fixed address required but not supported]) + fi + if test "$ac_cv_func_mmap_file" = "no" + then + AC_MSG_WARN([mmap() of files required but not found]) + fi +fi + +dnl atomic builtins are required for threading support. +AC_MSG_CHECKING(for GCC atomic builtins) +dnl Since we'll be using these atomic builtins in C++ files we should test +dnl the C++ compiler. +AC_LANG_PUSH([C++]) +AC_LINK_IFELSE( + AC_LANG_SOURCE( + [[int main() { + volatile unsigned long val = 1; + __sync_synchronize(); + __sync_val_compare_and_swap(&val, 1, 0); + __sync_add_and_fetch(&val, 1); + __sync_sub_and_fetch(&val, 1); + return 0; + } + ]]), + AC_LANG_POP([C++]) + AC_MSG_RESULT(yes) + AC_DEFINE(LLVM_HAS_ATOMICS, 1, Has gcc/MSVC atomic intrinsics), + AC_MSG_RESULT(no) + AC_DEFINE(LLVM_HAS_ATOMICS, 0, Has gcc/MSVC atomic intrinsics) + AC_MSG_WARN([LLVM will be built thread-unsafe because atomic builtins are missing])) + +dnl===-----------------------------------------------------------------------=== +dnl=== +dnl=== SECTION 9: Additional checks, variables, etc. +dnl=== +dnl===-----------------------------------------------------------------------=== + +dnl Handle 32-bit linux systems running a 64-bit kernel. +dnl This has to come after section 4 because it invokes the compiler. +if test "$llvm_cv_os_type" = "Linux" -a "$llvm_cv_target_arch" = "x86_64" ; then + AC_IS_LINUX_MIXED + if test "$llvm_cv_linux_mixed" = "yes"; then + llvm_cv_target_arch="x86" + ARCH="x86" + fi +fi + +dnl Check whether __dso_handle is present +AC_CHECK_FUNCS([__dso_handle]) + +dnl Propagate the shared library extension that the libltdl checks did to +dnl the Makefiles so we can use it there too +AC_SUBST(SHLIBEXT,$libltdl_cv_shlibext) + +dnl Propagate the run-time library path variable that the libltdl +dnl checks found to the Makefiles so we can use it there too +AC_SUBST(SHLIBPATH_VAR,$libltdl_cv_shlibpath_var) + +# Translate the various configuration directories and other basic +# information into substitutions that will end up in Makefile.config.in +# that these configured values can be used by the makefiles +if test "${prefix}" = "NONE" ; then + prefix="/usr/local" +fi +eval LLVM_PREFIX="${prefix}"; +eval LLVM_BINDIR="${prefix}/bin"; +eval LLVM_DATADIR="${prefix}/share/llvm"; +eval LLVM_DOCSDIR="${prefix}/share/doc/llvm"; +eval LLVM_ETCDIR="${prefix}/etc/llvm"; +eval LLVM_INCLUDEDIR="${prefix}/include"; +eval LLVM_INFODIR="${prefix}/info"; +eval LLVM_MANDIR="${prefix}/man"; +LLVM_CONFIGTIME=`date` +AC_SUBST(LLVM_PREFIX) +AC_SUBST(LLVM_BINDIR) +AC_SUBST(LLVM_DATADIR) +AC_SUBST(LLVM_DOCSDIR) +AC_SUBST(LLVM_ETCDIR) +AC_SUBST(LLVM_INCLUDEDIR) +AC_SUBST(LLVM_INFODIR) +AC_SUBST(LLVM_MANDIR) +AC_SUBST(LLVM_CONFIGTIME) + +# Place the various directores into the config.h file as #defines so that we +# can know about the installation paths within LLVM. +AC_DEFINE_UNQUOTED(LLVM_PREFIX,"$LLVM_PREFIX", + [Installation prefix directory]) +AC_DEFINE_UNQUOTED(LLVM_BINDIR, "$LLVM_BINDIR", + [Installation directory for binary executables]) +AC_DEFINE_UNQUOTED(LLVM_DATADIR, "$LLVM_DATADIR", + [Installation directory for data files]) +AC_DEFINE_UNQUOTED(LLVM_DOCSDIR, "$LLVM_DOCSDIR", + [Installation directory for documentation]) +AC_DEFINE_UNQUOTED(LLVM_ETCDIR, "$LLVM_ETCDIR", + [Installation directory for config files]) +AC_DEFINE_UNQUOTED(LLVM_INCLUDEDIR, "$LLVM_INCLUDEDIR", + [Installation directory for include files]) +AC_DEFINE_UNQUOTED(LLVM_INFODIR, "$LLVM_INFODIR", + [Installation directory for .info files]) +AC_DEFINE_UNQUOTED(LLVM_MANDIR, "$LLVM_MANDIR", + [Installation directory for man pages]) +AC_DEFINE_UNQUOTED(LLVM_CONFIGTIME, "$LLVM_CONFIGTIME", + [Time at which LLVM was configured]) +AC_DEFINE_UNQUOTED(LLVM_DEFAULT_TARGET_TRIPLE, "$target", + [Target triple LLVM will generate code for by default]) + +# Determine which bindings to build. +if test "$BINDINGS_TO_BUILD" = auto ; then + BINDINGS_TO_BUILD="" + if test "x$OCAMLC" != x -a "x$OCAMLDEP" != x ; then + BINDINGS_TO_BUILD="ocaml $BINDINGS_TO_BUILD" + fi +fi +AC_SUBST(BINDINGS_TO_BUILD,$BINDINGS_TO_BUILD) + +# This isn't really configurey, but it avoids having to repeat the list in +# other files. +AC_SUBST(ALL_BINDINGS,ocaml) + +# Do any work necessary to ensure that bindings have what they need. +binding_prereqs_failed=0 +for a_binding in $BINDINGS_TO_BUILD ; do + case "$a_binding" in + ocaml) + if test "x$OCAMLC" = x ; then + AC_MSG_WARN([--enable-bindings=ocaml specified, but ocamlc not found. Try configure OCAMLC=/path/to/ocamlc]) + binding_prereqs_failed=1 + fi + if test "x$OCAMLDEP" = x ; then + AC_MSG_WARN([--enable-bindings=ocaml specified, but ocamldep not found. Try configure OCAMLDEP=/path/to/ocamldep]) + binding_prereqs_failed=1 + fi + if test "x$OCAMLOPT" = x ; then + AC_MSG_WARN([--enable-bindings=ocaml specified, but ocamlopt not found. Try configure OCAMLOPT=/path/to/ocamlopt]) + dnl ocamlopt is optional! + fi + if test "x$with_ocaml_libdir" != xauto ; then + AC_SUBST(OCAML_LIBDIR,$with_ocaml_libdir) + else + ocaml_stdlib="`"$OCAMLC" -where`" + if test "$LLVM_PREFIX" '<' "$ocaml_stdlib" -a "$ocaml_stdlib" '<' "$LLVM_PREFIX~" + then + # ocaml stdlib is beneath our prefix; use stdlib + AC_SUBST(OCAML_LIBDIR,$ocaml_stdlib) + else + # ocaml stdlib is outside our prefix; use libdir/ocaml + AC_SUBST(OCAML_LIBDIR,${prefix}/lib/ocaml) + fi + fi + ;; + esac +done +if test "$binding_prereqs_failed" = 1 ; then + AC_MSG_ERROR([Prequisites for bindings not satisfied. Fix them or use configure --disable-bindings.]) +fi + +dnl Determine whether the compiler supports -fvisibility-inlines-hidden. +AC_CXX_USE_VISIBILITY_INLINES_HIDDEN + +dnl Determine linker rpath flag +if test "$llvm_cv_link_use_r" = "yes" ; then + RPATH="-Wl,-R" +else + RPATH="-Wl,-rpath" +fi +AC_SUBST(RPATH) + +dnl Determine linker rdynamic flag +if test "$llvm_cv_link_use_export_dynamic" = "yes" ; then + RDYNAMIC="-rdynamic" +else + RDYNAMIC="" +fi +AC_SUBST(RDYNAMIC) + +dnl===-----------------------------------------------------------------------=== +dnl=== +dnl=== SECTION 10: Specify the output files and generate it +dnl=== +dnl===-----------------------------------------------------------------------=== + +dnl ************************************************************************** +dnl End LLVM configure.ac Import +dnl ************************************************************************** + +dnl Configure a common Makefile +AC_CONFIG_FILES(Makefile.common) +AC_CONFIG_FILES(Makefile.llvm.config) + +dnl Configure project makefiles +dnl List every Makefile that exists within your source tree +AC_CONFIG_MAKEFILE(Makefile) +AC_CONFIG_MAKEFILE(lib/Makefile) +AC_CONFIG_MAKEFILE(lib/AssistDS/Makefile) +AC_CONFIG_MAKEFILE(lib/DSA/Makefile) +AC_CONFIG_MAKEFILE(lib/smack/Makefile) +AC_CONFIG_MAKEFILE(tools/Makefile) +AC_CONFIG_MAKEFILE(tools/smack/Makefile) + +dnl This must be last +AC_OUTPUT diff --git a/autoconf/install-sh b/autoconf/install-sh new file mode 100755 index 000000000..dd97db7aa --- /dev/null +++ b/autoconf/install-sh @@ -0,0 +1,322 @@ +#!/bin/sh +# install - install a program, script, or datafile + +scriptversion=2004-09-10.20 + +# This originates from X11R5 (mit/util/scripts/install.sh), which was +# later released in X11R6 (xc/config/util/install.sh) with the +# following copyright and license. +# +# Copyright (C) 1994 X Consortium +# +# 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 +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of the X Consortium shall not +# be used in advertising or otherwise to promote the sale, use or other deal- +# ings in this Software without prior written authorization from the X Consor- +# tium. +# +# +# FSF changes to this file are in the public domain. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +chmodcmd="$chmodprog 0755" +chowncmd= +chgrpcmd= +stripcmd= +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src= +dst= +dir_arg= +dstarg= +no_target_directory= + +usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE + or: $0 [OPTION]... SRCFILES... DIRECTORY + or: $0 [OPTION]... -t DIRECTORY SRCFILES... + or: $0 [OPTION]... -d DIRECTORIES... + +In the 1st form, copy SRCFILE to DSTFILE. +In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. +In the 4th, create DIRECTORIES. + +Options: +-c (ignored) +-d create directories instead of installing files. +-g GROUP $chgrpprog installed files to GROUP. +-m MODE $chmodprog installed files to MODE. +-o USER $chownprog installed files to USER. +-s $stripprog installed files. +-t DIRECTORY install into DIRECTORY. +-T report an error if DSTFILE is a directory. +--help display this help and exit. +--version display version info and exit. + +Environment variables override the default commands: + CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG +" + +while test -n "$1"; do + case $1 in + -c) shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + --help) echo "$usage"; exit 0;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -s) stripcmd=$stripprog + shift + continue;; + + -t) dstarg=$2 + shift + shift + continue;; + + -T) no_target_directory=true + shift + continue;; + + --version) echo "$0 $scriptversion"; exit 0;; + + *) # When -d is used, all remaining arguments are directories to create. + # When -t is used, the destination is already specified. + test -n "$dir_arg$dstarg" && break + # Otherwise, the last argument is the destination. Remove it from $@. + for arg + do + if test -n "$dstarg"; then + # $@ is not empty: it contains at least $arg. + set fnord "$@" "$dstarg" + shift # fnord + fi + shift # arg + dstarg=$arg + done + break;; + esac +done + +if test -z "$1"; then + if test -z "$dir_arg"; then + echo "$0: no input file specified." >&2 + exit 1 + fi + # It's OK to call `install-sh -d' without argument. + # This can happen when creating conditional directories. + exit 0 +fi + +for src +do + # Protect names starting with `-'. + case $src in + -*) src=./$src ;; + esac + + if test -n "$dir_arg"; then + dst=$src + src= + + if test -d "$dst"; then + mkdircmd=: + chmodcmd= + else + mkdircmd=$mkdirprog + fi + else + # Waiting for this to be detected by the "$cpprog $src $dsttmp" command + # might cause directories to be created, which would be especially bad + # if $src (and thus $dsttmp) contains '*'. + if test ! -f "$src" && test ! -d "$src"; then + echo "$0: $src does not exist." >&2 + exit 1 + fi + + if test -z "$dstarg"; then + echo "$0: no destination specified." >&2 + exit 1 + fi + + dst=$dstarg + # Protect names starting with `-'. + case $dst in + -*) dst=./$dst ;; + esac + + # If destination is a directory, append the input filename; won't work + # if double slashes aren't ignored. + if test -d "$dst"; then + if test -n "$no_target_directory"; then + echo "$0: $dstarg: Is a directory" >&2 + exit 1 + fi + dst=$dst/`basename "$src"` + fi + fi + + # This sed command emulates the dirname command. + dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + + # Make sure that the destination directory exists. + + # Skip lots of stat calls in the usual case. + if test ! -d "$dstdir"; then + defaultIFS=' + ' + IFS="${IFS-$defaultIFS}" + + oIFS=$IFS + # Some sh's can't handle IFS=/ for some reason. + IFS='%' + set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` + IFS=$oIFS + + pathcomp= + + while test $# -ne 0 ; do + pathcomp=$pathcomp$1 + shift + if test ! -d "$pathcomp"; then + $mkdirprog "$pathcomp" + # mkdir can fail with a `File exist' error in case several + # install-sh are creating the directory concurrently. This + # is OK. + test -d "$pathcomp" || exit + fi + pathcomp=$pathcomp/ + done + fi + + if test -n "$dir_arg"; then + $doit $mkdircmd "$dst" \ + && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ + && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ + && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ + && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } + + else + dstfile=`basename "$dst"` + + # Make a couple of temp file names in the proper directory. + dsttmp=$dstdir/_inst.$$_ + rmtmp=$dstdir/_rm.$$_ + + # Trap to clean up those temp files at exit. + trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 + trap '(exit $?); exit' 1 2 13 15 + + # Copy the file name to the temp name. + $doit $cpprog "$src" "$dsttmp" && + + # and set any options; do chmod last to preserve setuid bits. + # + # If any of these fail, we abort the whole thing. If we want to + # ignore errors from any of these, just make sure not to ignore + # errors from the above "$doit $cpprog $src $dsttmp" command. + # + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ + && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ + && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ + && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && + + # Now rename the file to the real destination. + { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \ + || { + # The rename failed, perhaps because mv can't rename something else + # to itself, or perhaps because mv is so ancient that it does not + # support -f. + + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + if test -f "$dstdir/$dstfile"; then + $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ + || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ + || { + echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 + (exit 1); exit + } + else + : + fi + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" + } + } + fi || { (exit 1); exit; } +done + +# The final little trick to "correctly" pass the exit status to the exit trap. +{ + (exit 0); exit +} + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/autoconf/ltmain.sh b/autoconf/ltmain.sh new file mode 100644 index 000000000..2455278a4 --- /dev/null +++ b/autoconf/ltmain.sh @@ -0,0 +1,6863 @@ +# ltmain.sh - Provide generalized library-building support services. +# NOTE: Changing this file will not affect anything until you rerun configure. +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# Originally by Gordon Matzigkeit , 1996 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +basename="s,^.*/,,g" + +# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh +# is ksh but when the shell is invoked as "sh" and the current value of +# the _XPG environment variable is not equal to 1 (one), the special +# positional parameter $0, within a function call, is the name of the +# function. +progpath="$0" + +# The name of this program: +progname=`echo "$progpath" | $SED $basename` +modename="$progname" + +# Global variables: +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + +PROGRAM=ltmain.sh +PACKAGE=libtool +VERSION=1.5.22 +TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)" + +# See if we are running on zsh, and set the options which allow our +# commands through without removal of \ escapes. +if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi + +# Check that we have a working $echo. +if test "X$1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X$1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then + # Yippee, $echo works! + : +else + # Restart under the correct shell, and then maybe $echo will work. + exec $SHELL "$progpath" --no-reexec ${1+"$@"} +fi + +if test "X$1" = X--fallback-echo; then + # used as fallback echo + shift + cat <&2 + $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit $EXIT_FAILURE +fi + +# Global variables. +mode=$default_mode +nonopt= +prev= +prevopt= +run= +show="$echo" +show_help= +execute_dlfiles= +duplicate_deps=no +preserve_args= +lo2o="s/\\.lo\$/.${objext}/" +o2lo="s/\\.${objext}\$/.lo/" + +##################################### +# Shell function definitions: +# This seems to be the best place for them + +# func_mktempdir [string] +# Make a temporary directory that won't clash with other running +# libtool processes, and avoids race conditions if possible. If +# given, STRING is the basename for that directory. +func_mktempdir () +{ + my_template="${TMPDIR-/tmp}/${1-$progname}" + + if test "$run" = ":"; then + # Return a directory name, but don't create it in dry-run mode + my_tmpdir="${my_template}-$$" + else + + # If mktemp works, use that first and foremost + my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` + + if test ! -d "$my_tmpdir"; then + # Failing that, at least try and use $RANDOM to avoid a race + my_tmpdir="${my_template}-${RANDOM-0}$$" + + save_mktempdir_umask=`umask` + umask 0077 + $mkdir "$my_tmpdir" + umask $save_mktempdir_umask + fi + + # If we're not in dry-run mode, bomb out on failure + test -d "$my_tmpdir" || { + $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2 + exit $EXIT_FAILURE + } + fi + + $echo "X$my_tmpdir" | $Xsed +} + + +# func_win32_libid arg +# return the library type of file 'arg' +# +# Need a lot of goo to handle *both* DLLs and import libs +# Has to be a shell function in order to 'eat' the argument +# that is supplied when $file_magic_command is called. +func_win32_libid () +{ + win32_libid_type="unknown" + win32_fileres=`file -L $1 2>/dev/null` + case $win32_fileres in + *ar\ archive\ import\ library*) # definitely import + win32_libid_type="x86 archive import" + ;; + *ar\ archive*) # could be an import, or static + if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ + $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then + win32_nmres=`eval $NM -f posix -A $1 | \ + $SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'` + case $win32_nmres in + import*) win32_libid_type="x86 archive import";; + *) win32_libid_type="x86 archive static";; + esac + fi + ;; + *DLL*) + win32_libid_type="x86 DLL" + ;; + *executable*) # but shell scripts are "executable" too... + case $win32_fileres in + *MS\ Windows\ PE\ Intel*) + win32_libid_type="x86 DLL" + ;; + esac + ;; + esac + $echo $win32_libid_type +} + + +# func_infer_tag arg +# Infer tagged configuration to use if any are available and +# if one wasn't chosen via the "--tag" command line option. +# Only attempt this if the compiler in the base compile +# command doesn't match the default compiler. +# arg is usually of the form 'gcc ...' +func_infer_tag () +{ + if test -n "$available_tags" && test -z "$tagname"; then + CC_quoted= + for arg in $CC; do + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + CC_quoted="$CC_quoted $arg" + done + case $@ in + # Blanks in the command may have been stripped by the calling shell, + # but not from the CC environment variable when configure was run. + " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; + # Blanks at the start of $base_compile will cause this to fail + # if we don't check for them as well. + *) + for z in $available_tags; do + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then + # Evaluate the configuration. + eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" + CC_quoted= + for arg in $CC; do + # Double-quote args containing other shell metacharacters. + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + CC_quoted="$CC_quoted $arg" + done + case "$@ " in + " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) + # The compiler in the base compile command matches + # the one in the tagged configuration. + # Assume this is the tagged configuration we want. + tagname=$z + break + ;; + esac + fi + done + # If $tagname still isn't set, then no tagged configuration + # was found and let the user know that the "--tag" command + # line option must be used. + if test -z "$tagname"; then + $echo "$modename: unable to infer tagged configuration" + $echo "$modename: specify a tag with \`--tag'" 1>&2 + exit $EXIT_FAILURE +# else +# $echo "$modename: using $tagname tagged configuration" + fi + ;; + esac + fi +} + + +# func_extract_an_archive dir oldlib +func_extract_an_archive () +{ + f_ex_an_ar_dir="$1"; shift + f_ex_an_ar_oldlib="$1" + + $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" + $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $? + if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then + : + else + $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2 + exit $EXIT_FAILURE + fi +} + +# func_extract_archives gentop oldlib ... +func_extract_archives () +{ + my_gentop="$1"; shift + my_oldlibs=${1+"$@"} + my_oldobjs="" + my_xlib="" + my_xabs="" + my_xdir="" + my_status="" + + $show "${rm}r $my_gentop" + $run ${rm}r "$my_gentop" + $show "$mkdir $my_gentop" + $run $mkdir "$my_gentop" + my_status=$? + if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then + exit $my_status + fi + + for my_xlib in $my_oldlibs; do + # Extract the objects. + case $my_xlib in + [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; + *) my_xabs=`pwd`"/$my_xlib" ;; + esac + my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` + my_xdir="$my_gentop/$my_xlib" + + $show "${rm}r $my_xdir" + $run ${rm}r "$my_xdir" + $show "$mkdir $my_xdir" + $run $mkdir "$my_xdir" + exit_status=$? + if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then + exit $exit_status + fi + case $host in + *-darwin*) + $show "Extracting $my_xabs" + # Do not bother doing anything if just a dry run + if test -z "$run"; then + darwin_orig_dir=`pwd` + cd $my_xdir || exit $? + darwin_archive=$my_xabs + darwin_curdir=`pwd` + darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'` + darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null` + if test -n "$darwin_arches"; then + darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` + darwin_arch= + $show "$darwin_base_archive has multiple architectures $darwin_arches" + for darwin_arch in $darwin_arches ; do + mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" + lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" + cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" + func_extract_an_archive "`pwd`" "${darwin_base_archive}" + cd "$darwin_curdir" + $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" + done # $darwin_arches + ## Okay now we have a bunch of thin objects, gotta fatten them up :) + darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP` + darwin_file= + darwin_files= + for darwin_file in $darwin_filelist; do + darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` + lipo -create -output "$darwin_file" $darwin_files + done # $darwin_filelist + ${rm}r unfat-$$ + cd "$darwin_orig_dir" + else + cd "$darwin_orig_dir" + func_extract_an_archive "$my_xdir" "$my_xabs" + fi # $darwin_arches + fi # $run + ;; + *) + func_extract_an_archive "$my_xdir" "$my_xabs" + ;; + esac + my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` + done + func_extract_archives_result="$my_oldobjs" +} +# End of Shell function definitions +##################################### + +# Darwin sucks +eval std_shrext=\"$shrext_cmds\" + +disable_libs=no + +# Parse our command line options once, thoroughly. +while test "$#" -gt 0 +do + arg="$1" + shift + + case $arg in + -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; + *) optarg= ;; + esac + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case $prev in + execute_dlfiles) + execute_dlfiles="$execute_dlfiles $arg" + ;; + tag) + tagname="$arg" + preserve_args="${preserve_args}=$arg" + + # Check whether tagname contains only valid characters + case $tagname in + *[!-_A-Za-z0-9,/]*) + $echo "$progname: invalid tag name: $tagname" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + case $tagname in + CC) + # Don't test for the "default" C tag, as we know, it's there, but + # not specially marked. + ;; + *) + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then + taglist="$taglist $tagname" + # Evaluate the configuration. + eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`" + else + $echo "$progname: ignoring unknown tag $tagname" 1>&2 + fi + ;; + esac + ;; + *) + eval "$prev=\$arg" + ;; + esac + + prev= + prevopt= + continue + fi + + # Have we seen a non-optional argument yet? + case $arg in + --help) + show_help=yes + ;; + + --version) + $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" + $echo + $echo "Copyright (C) 2005 Free Software Foundation, Inc." + $echo "This is free software; see the source for copying conditions. There is NO" + $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + exit $? + ;; + + --config) + ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath + # Now print the configurations for the tags. + for tagname in $taglist; do + ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" + done + exit $? + ;; + + --debug) + $echo "$progname: enabling shell trace mode" + set -x + preserve_args="$preserve_args $arg" + ;; + + --dry-run | -n) + run=: + ;; + + --features) + $echo "host: $host" + if test "$build_libtool_libs" = yes; then + $echo "enable shared libraries" + else + $echo "disable shared libraries" + fi + if test "$build_old_libs" = yes; then + $echo "enable static libraries" + else + $echo "disable static libraries" + fi + exit $? + ;; + + --finish) mode="finish" ;; + + --mode) prevopt="--mode" prev=mode ;; + --mode=*) mode="$optarg" ;; + + --preserve-dup-deps) duplicate_deps="yes" ;; + + --quiet | --silent) + show=: + preserve_args="$preserve_args $arg" + ;; + + --tag) + prevopt="--tag" + prev=tag + preserve_args="$preserve_args --tag" + ;; + --tag=*) + set tag "$optarg" ${1+"$@"} + shift + prev=tag + preserve_args="$preserve_args --tag" + ;; + + -dlopen) + prevopt="-dlopen" + prev=execute_dlfiles + ;; + + -*) + $echo "$modename: unrecognized option \`$arg'" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + ;; + + *) + nonopt="$arg" + break + ;; + esac +done + +if test -n "$prevopt"; then + $echo "$modename: option \`$prevopt' requires an argument" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE +fi + +case $disable_libs in +no) + ;; +shared) + build_libtool_libs=no + build_old_libs=yes + ;; +static) + build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` + ;; +esac + +# If this variable is set in any of the actions, the command in it +# will be execed at the end. This prevents here-documents from being +# left over by shells. +exec_cmd= + +if test -z "$show_help"; then + + # Infer the operation mode. + if test -z "$mode"; then + $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 + $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2 + case $nonopt in + *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) + mode=link + for arg + do + case $arg in + -c) + mode=compile + break + ;; + esac + done + ;; + *db | *dbx | *strace | *truss) + mode=execute + ;; + *install*|cp|mv) + mode=install + ;; + *rm) + mode=uninstall + ;; + *) + # If we have no mode, but dlfiles were specified, then do execute mode. + test -n "$execute_dlfiles" && mode=execute + + # Just use the default operation mode. + if test -z "$mode"; then + if test -n "$nonopt"; then + $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 + else + $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 + fi + fi + ;; + esac + fi + + # Only execute mode is allowed to have -dlopen flags. + if test -n "$execute_dlfiles" && test "$mode" != execute; then + $echo "$modename: unrecognized option \`-dlopen'" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # Change the help message to a mode-specific one. + generic_help="$help" + help="Try \`$modename --help --mode=$mode' for more information." + + # These modes are in order of execution frequency so that they run quickly. + case $mode in + # libtool compile mode + compile) + modename="$modename: compile" + # Get the compilation command and the source file. + base_compile= + srcfile="$nonopt" # always keep a non-empty value in "srcfile" + suppress_opt=yes + suppress_output= + arg_mode=normal + libobj= + later= + + for arg + do + case $arg_mode in + arg ) + # do not "continue". Instead, add this to base_compile + lastarg="$arg" + arg_mode=normal + ;; + + target ) + libobj="$arg" + arg_mode=normal + continue + ;; + + normal ) + # Accept any command-line options. + case $arg in + -o) + if test -n "$libobj" ; then + $echo "$modename: you cannot specify \`-o' more than once" 1>&2 + exit $EXIT_FAILURE + fi + arg_mode=target + continue + ;; + + -static | -prefer-pic | -prefer-non-pic) + later="$later $arg" + continue + ;; + + -no-suppress) + suppress_opt=no + continue + ;; + + -Xcompiler) + arg_mode=arg # the next one goes into the "base_compile" arg list + continue # The current "srcfile" will either be retained or + ;; # replaced later. I would guess that would be a bug. + + -Wc,*) + args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` + lastarg= + save_ifs="$IFS"; IFS=',' + for arg in $args; do + IFS="$save_ifs" + + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + lastarg="$lastarg $arg" + done + IFS="$save_ifs" + lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` + + # Add the arguments to base_compile. + base_compile="$base_compile $lastarg" + continue + ;; + + * ) + # Accept the current argument as the source file. + # The previous "srcfile" becomes the current argument. + # + lastarg="$srcfile" + srcfile="$arg" + ;; + esac # case $arg + ;; + esac # case $arg_mode + + # Aesthetically quote the previous argument. + lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` + + case $lastarg in + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, and some SunOS ksh mistreat backslash-escaping + # in scan sets (worked around with variable expansion), + # and furthermore cannot handle '|' '&' '(' ')' in scan sets + # at all, so we specify them separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + lastarg="\"$lastarg\"" + ;; + esac + + base_compile="$base_compile $lastarg" + done # for arg + + case $arg_mode in + arg) + $echo "$modename: you must specify an argument for -Xcompile" + exit $EXIT_FAILURE + ;; + target) + $echo "$modename: you must specify a target with \`-o'" 1>&2 + exit $EXIT_FAILURE + ;; + *) + # Get the name of the library object. + [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` + ;; + esac + + # Recognize several different file suffixes. + # If the user specifies -o file.o, it is replaced with file.lo + xform='[cCFSifmso]' + case $libobj in + *.ada) xform=ada ;; + *.adb) xform=adb ;; + *.ads) xform=ads ;; + *.asm) xform=asm ;; + *.c++) xform=c++ ;; + *.cc) xform=cc ;; + *.ii) xform=ii ;; + *.class) xform=class ;; + *.cpp) xform=cpp ;; + *.cxx) xform=cxx ;; + *.f90) xform=f90 ;; + *.for) xform=for ;; + *.java) xform=java ;; + esac + + libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` + + case $libobj in + *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; + *) + $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + func_infer_tag $base_compile + + for arg in $later; do + case $arg in + -static) + build_old_libs=yes + continue + ;; + + -prefer-pic) + pic_mode=yes + continue + ;; + + -prefer-non-pic) + pic_mode=no + continue + ;; + esac + done + + qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"` + case $qlibobj in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + qlibobj="\"$qlibobj\"" ;; + esac + test "X$libobj" != "X$qlibobj" \ + && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \ + && $echo "$modename: libobj name \`$libobj' may not contain shell special characters." + objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` + xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$obj"; then + xdir= + else + xdir=$xdir/ + fi + lobj=${xdir}$objdir/$objname + + if test -z "$base_compile"; then + $echo "$modename: you must specify a compilation command" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # Delete any leftover library objects. + if test "$build_old_libs" = yes; then + removelist="$obj $lobj $libobj ${libobj}T" + else + removelist="$lobj $libobj ${libobj}T" + fi + + $run $rm $removelist + trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 + + # On Cygwin there's no "real" PIC flag so we must build both object types + case $host_os in + cygwin* | mingw* | pw32* | os2*) + pic_mode=default + ;; + esac + if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then + # non-PIC code in shared libraries is not supported + pic_mode=default + fi + + # Calculate the filename of the output object if compiler does + # not support -o with -c + if test "$compiler_c_o" = no; then + output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} + lockfile="$output_obj.lock" + removelist="$removelist $output_obj $lockfile" + trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 + else + output_obj= + need_locks=no + lockfile= + fi + + # Lock this critical section if it is needed + # We use this script file to make the link, it avoids creating a new file + if test "$need_locks" = yes; then + until $run ln "$progpath" "$lockfile" 2>/dev/null; do + $show "Waiting for $lockfile to be removed" + sleep 2 + done + elif test "$need_locks" = warn; then + if test -f "$lockfile"; then + $echo "\ +*** ERROR, $lockfile exists and contains: +`cat $lockfile 2>/dev/null` + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit $EXIT_FAILURE + fi + $echo "$srcfile" > "$lockfile" + fi + + if test -n "$fix_srcfile_path"; then + eval srcfile=\"$fix_srcfile_path\" + fi + qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"` + case $qsrcfile in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + qsrcfile="\"$qsrcfile\"" ;; + esac + + $run $rm "$libobj" "${libobj}T" + + # Create a libtool object file (analogous to a ".la" file), + # but don't create it if we're doing a dry run. + test -z "$run" && cat > ${libobj}T </dev/null`" != "X$srcfile"; then + $echo "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit $EXIT_FAILURE + fi + + # Just move the object if needed, then go on to compile the next one + if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then + $show "$mv $output_obj $lobj" + if $run $mv $output_obj $lobj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi + + # Append the name of the PIC object to the libtool object file. + test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null`" != "X$srcfile"; then + $echo "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit $EXIT_FAILURE + fi + + # Just move the object if needed + if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then + $show "$mv $output_obj $obj" + if $run $mv $output_obj $obj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi + + # Append the name of the non-PIC object the libtool object file. + # Only append if the libtool object file exists. + test -z "$run" && cat >> ${libobj}T <> ${libobj}T <&2 + fi + if test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=yes + else + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=built + fi + build_libtool_libs=no + build_old_libs=yes + break + ;; + esac + done + + # See if our shared archives depend on static archives. + test -n "$old_archive_from_new_cmds" && build_old_libs=yes + + # Go through the arguments, transforming them on the way. + while test "$#" -gt 0; do + arg="$1" + shift + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test + ;; + *) qarg=$arg ;; + esac + libtool_args="$libtool_args $qarg" + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case $prev in + output) + compile_command="$compile_command @OUTPUT@" + finalize_command="$finalize_command @OUTPUT@" + ;; + esac + + case $prev in + dlfiles|dlprefiles) + if test "$preload" = no; then + # Add the symbol object into the linking commands. + compile_command="$compile_command @SYMFILE@" + finalize_command="$finalize_command @SYMFILE@" + preload=yes + fi + case $arg in + *.la | *.lo) ;; # We handle these cases below. + force) + if test "$dlself" = no; then + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + self) + if test "$prev" = dlprefiles; then + dlself=yes + elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then + dlself=yes + else + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + *) + if test "$prev" = dlfiles; then + dlfiles="$dlfiles $arg" + else + dlprefiles="$dlprefiles $arg" + fi + prev= + continue + ;; + esac + ;; + expsyms) + export_symbols="$arg" + if test ! -f "$arg"; then + $echo "$modename: symbol file \`$arg' does not exist" + exit $EXIT_FAILURE + fi + prev= + continue + ;; + expsyms_regex) + export_symbols_regex="$arg" + prev= + continue + ;; + inst_prefix) + inst_prefix_dir="$arg" + prev= + continue + ;; + precious_regex) + precious_files_regex="$arg" + prev= + continue + ;; + release) + release="-$arg" + prev= + continue + ;; + objectlist) + if test -f "$arg"; then + save_arg=$arg + moreargs= + for fil in `cat $save_arg` + do +# moreargs="$moreargs $fil" + arg=$fil + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + pic_object= + non_pic_object= + + # Read the .lo file + # If there is no directory component, then add one. + case $arg in + */* | *\\*) . $arg ;; + *) . ./$arg ;; + esac + + if test -z "$pic_object" || \ + test -z "$non_pic_object" || + test "$pic_object" = none && \ + test "$non_pic_object" = none; then + $echo "$modename: cannot find name of object for \`$arg'" 1>&2 + exit $EXIT_FAILURE + fi + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + if test "$pic_object" != none; then + # Prepend the subdirectory the object is found in. + pic_object="$xdir$pic_object" + + if test "$prev" = dlfiles; then + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + dlfiles="$dlfiles $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test "$prev" = dlprefiles; then + # Preload the old-style object. + dlprefiles="$dlprefiles $pic_object" + prev= + fi + + # A PIC object. + libobjs="$libobjs $pic_object" + arg="$pic_object" + fi + + # Non-PIC object. + if test "$non_pic_object" != none; then + # Prepend the subdirectory the object is found in. + non_pic_object="$xdir$non_pic_object" + + # A standard non-PIC object + non_pic_objects="$non_pic_objects $non_pic_object" + if test -z "$pic_object" || test "$pic_object" = none ; then + arg="$non_pic_object" + fi + else + # If the PIC object exists, use it instead. + # $xdir was prepended to $pic_object above. + non_pic_object="$pic_object" + non_pic_objects="$non_pic_objects $non_pic_object" + fi + else + # Only an error if not doing a dry-run. + if test -z "$run"; then + $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 + exit $EXIT_FAILURE + else + # Dry-run case. + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` + non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` + libobjs="$libobjs $pic_object" + non_pic_objects="$non_pic_objects $non_pic_object" + fi + fi + done + else + $echo "$modename: link input file \`$save_arg' does not exist" + exit $EXIT_FAILURE + fi + arg=$save_arg + prev= + continue + ;; + rpath | xrpath) + # We need an absolute path. + case $arg in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + $echo "$modename: only absolute run-paths are allowed" 1>&2 + exit $EXIT_FAILURE + ;; + esac + if test "$prev" = rpath; then + case "$rpath " in + *" $arg "*) ;; + *) rpath="$rpath $arg" ;; + esac + else + case "$xrpath " in + *" $arg "*) ;; + *) xrpath="$xrpath $arg" ;; + esac + fi + prev= + continue + ;; + xcompiler) + compiler_flags="$compiler_flags $qarg" + prev= + compile_command="$compile_command $qarg" + finalize_command="$finalize_command $qarg" + continue + ;; + xlinker) + linker_flags="$linker_flags $qarg" + compiler_flags="$compiler_flags $wl$qarg" + prev= + compile_command="$compile_command $wl$qarg" + finalize_command="$finalize_command $wl$qarg" + continue + ;; + xcclinker) + linker_flags="$linker_flags $qarg" + compiler_flags="$compiler_flags $qarg" + prev= + compile_command="$compile_command $qarg" + finalize_command="$finalize_command $qarg" + continue + ;; + shrext) + shrext_cmds="$arg" + prev= + continue + ;; + darwin_framework|darwin_framework_skip) + test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + prev= + continue + ;; + *) + eval "$prev=\"\$arg\"" + prev= + continue + ;; + esac + fi # test -n "$prev" + + prevarg="$arg" + + case $arg in + -all-static) + if test -n "$link_static_flag"; then + compile_command="$compile_command $link_static_flag" + finalize_command="$finalize_command $link_static_flag" + fi + continue + ;; + + -allow-undefined) + # FIXME: remove this flag sometime in the future. + $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 + continue + ;; + + -avoid-version) + avoid_version=yes + continue + ;; + + -dlopen) + prev=dlfiles + continue + ;; + + -dlpreopen) + prev=dlprefiles + continue + ;; + + -export-dynamic) + export_dynamic=yes + continue + ;; + + -export-symbols | -export-symbols-regex) + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + $echo "$modename: more than one -exported-symbols argument is not allowed" + exit $EXIT_FAILURE + fi + if test "X$arg" = "X-export-symbols"; then + prev=expsyms + else + prev=expsyms_regex + fi + continue + ;; + + -framework|-arch|-isysroot) + case " $CC " in + *" ${arg} ${1} "* | *" ${arg} ${1} "*) + prev=darwin_framework_skip ;; + *) compiler_flags="$compiler_flags $arg" + prev=darwin_framework ;; + esac + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + continue + ;; + + -inst-prefix-dir) + prev=inst_prefix + continue + ;; + + # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* + # so, if we see these flags be careful not to treat them like -L + -L[A-Z][A-Z]*:*) + case $with_gcc/$host in + no/*-*-irix* | /*-*-irix*) + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + ;; + esac + continue + ;; + + -L*) + dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 + absdir="$dir" + notinst_path="$notinst_path $dir" + fi + dir="$absdir" + ;; + esac + case "$deplibs " in + *" -L$dir "*) ;; + *) + deplibs="$deplibs -L$dir" + lib_search_path="$lib_search_path $dir" + ;; + esac + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'` + case :$dllsearchpath: in + *":$dir:"*) ;; + *) dllsearchpath="$dllsearchpath:$dir";; + esac + case :$dllsearchpath: in + *":$testbindir:"*) ;; + *) dllsearchpath="$dllsearchpath:$testbindir";; + esac + ;; + esac + continue + ;; + + -l*) + if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*) + # These systems don't actually have a C or math library (as such) + continue + ;; + *-*-os2*) + # These systems don't actually have a C library (as such) + test "X$arg" = "X-lc" && continue + ;; + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc due to us having libc/libc_r. + test "X$arg" = "X-lc" && continue + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C and math libraries are in the System framework + deplibs="$deplibs -framework System" + continue + ;; + *-*-sco3.2v5* | *-*-sco5v6*) + # Causes problems with __ctype + test "X$arg" = "X-lc" && continue + ;; + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) + # Compiler inserts libc in the correct place for threads to work + test "X$arg" = "X-lc" && continue + ;; + esac + elif test "X$arg" = "X-lc_r"; then + case $host in + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc_r directly, use -pthread flag. + continue + ;; + esac + fi + deplibs="$deplibs $arg" + continue + ;; + + # Tru64 UNIX uses -model [arg] to determine the layout of C++ + # classes, name mangling, and exception handling. + -model) + compile_command="$compile_command $arg" + compiler_flags="$compiler_flags $arg" + finalize_command="$finalize_command $arg" + prev=xcompiler + continue + ;; + + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) + compiler_flags="$compiler_flags $arg" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + continue + ;; + + -module) + module=yes + continue + ;; + + # -64, -mips[0-9] enable 64-bit mode on the SGI compiler + # -r[0-9][0-9]* specifies the processor on the SGI compiler + # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler + # +DA*, +DD* enable 64-bit mode on the HP compiler + # -q* pass through compiler args for the IBM compiler + # -m* pass through architecture-specific compiler args for GCC + # -m*, -t[45]*, -txscale* pass through architecture-specific + # compiler args for GCC + # -pg pass through profiling flag for GCC + # @file GCC response files + -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \ + -t[45]*|-txscale*|@*) + + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + compiler_flags="$compiler_flags $arg" + continue + ;; + + -shrext) + prev=shrext + continue + ;; + + -no-fast-install) + fast_install=no + continue + ;; + + -no-install) + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + # The PATH hackery in wrapper scripts is required on Windows + # in order for the loader to find any dlls it needs. + $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 + $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 + fast_install=no + ;; + *) no_install=yes ;; + esac + continue + ;; + + -no-undefined) + allow_undefined=no + continue + ;; + + -objectlist) + prev=objectlist + continue + ;; + + -o) prev=output ;; + + -precious-files-regex) + prev=precious_regex + continue + ;; + + -release) + prev=release + continue + ;; + + -rpath) + prev=rpath + continue + ;; + + -R) + prev=xrpath + continue + ;; + + -R*) + dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + $echo "$modename: only absolute run-paths are allowed" 1>&2 + exit $EXIT_FAILURE + ;; + esac + case "$xrpath " in + *" $dir "*) ;; + *) xrpath="$xrpath $dir" ;; + esac + continue + ;; + + -static) + # The effects of -static are defined in a previous loop. + # We used to do the same as -all-static on platforms that + # didn't have a PIC flag, but the assumption that the effects + # would be equivalent was wrong. It would break on at least + # Digital Unix and AIX. + continue + ;; + + -thread-safe) + thread_safe=yes + continue + ;; + + -version-info) + prev=vinfo + continue + ;; + -version-number) + prev=vinfo + vinfo_number=yes + continue + ;; + + -Wc,*) + args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` + arg= + save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + case $flag in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + flag="\"$flag\"" + ;; + esac + arg="$arg $wl$flag" + compiler_flags="$compiler_flags $flag" + done + IFS="$save_ifs" + arg=`$echo "X$arg" | $Xsed -e "s/^ //"` + ;; + + -Wl,*) + args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` + arg= + save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + case $flag in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + flag="\"$flag\"" + ;; + esac + arg="$arg $wl$flag" + compiler_flags="$compiler_flags $wl$flag" + linker_flags="$linker_flags $flag" + done + IFS="$save_ifs" + arg=`$echo "X$arg" | $Xsed -e "s/^ //"` + ;; + + -Xcompiler) + prev=xcompiler + continue + ;; + + -Xlinker) + prev=xlinker + continue + ;; + + -XCClinker) + prev=xcclinker + continue + ;; + + # Some other compiler flag. + -* | +*) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + ;; + + *.$objext) + # A standard object. + objs="$objs $arg" + ;; + + *.lo) + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + pic_object= + non_pic_object= + + # Read the .lo file + # If there is no directory component, then add one. + case $arg in + */* | *\\*) . $arg ;; + *) . ./$arg ;; + esac + + if test -z "$pic_object" || \ + test -z "$non_pic_object" || + test "$pic_object" = none && \ + test "$non_pic_object" = none; then + $echo "$modename: cannot find name of object for \`$arg'" 1>&2 + exit $EXIT_FAILURE + fi + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + if test "$pic_object" != none; then + # Prepend the subdirectory the object is found in. + pic_object="$xdir$pic_object" + + if test "$prev" = dlfiles; then + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + dlfiles="$dlfiles $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test "$prev" = dlprefiles; then + # Preload the old-style object. + dlprefiles="$dlprefiles $pic_object" + prev= + fi + + # A PIC object. + libobjs="$libobjs $pic_object" + arg="$pic_object" + fi + + # Non-PIC object. + if test "$non_pic_object" != none; then + # Prepend the subdirectory the object is found in. + non_pic_object="$xdir$non_pic_object" + + # A standard non-PIC object + non_pic_objects="$non_pic_objects $non_pic_object" + if test -z "$pic_object" || test "$pic_object" = none ; then + arg="$non_pic_object" + fi + else + # If the PIC object exists, use it instead. + # $xdir was prepended to $pic_object above. + non_pic_object="$pic_object" + non_pic_objects="$non_pic_objects $non_pic_object" + fi + else + # Only an error if not doing a dry-run. + if test -z "$run"; then + $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 + exit $EXIT_FAILURE + else + # Dry-run case. + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` + non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` + libobjs="$libobjs $pic_object" + non_pic_objects="$non_pic_objects $non_pic_object" + fi + fi + ;; + + *.$libext) + # An archive. + deplibs="$deplibs $arg" + old_deplibs="$old_deplibs $arg" + continue + ;; + + *.la) + # A libtool-controlled library. + + if test "$prev" = dlfiles; then + # This library was specified with -dlopen. + dlfiles="$dlfiles $arg" + prev= + elif test "$prev" = dlprefiles; then + # The library was specified with -dlpreopen. + dlprefiles="$dlprefiles $arg" + prev= + else + deplibs="$deplibs $arg" + fi + continue + ;; + + # Some other compiler argument. + *) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + ;; + esac # arg + + # Now actually substitute the argument into the commands. + if test -n "$arg"; then + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + fi + done # argument parsing loop + + if test -n "$prev"; then + $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then + eval arg=\"$export_dynamic_flag_spec\" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + fi + + oldlibs= + # calculate the name of the file, without its directory + outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` + libobjs_save="$libobjs" + + if test -n "$shlibpath_var"; then + # get the directories listed in $shlibpath_var + eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` + else + shlib_search_path= + fi + eval sys_lib_search_path=\"$sys_lib_search_path_spec\" + eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" + + output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` + if test "X$output_objdir" = "X$output"; then + output_objdir="$objdir" + else + output_objdir="$output_objdir/$objdir" + fi + # Create the object directory. + if test ! -d "$output_objdir"; then + $show "$mkdir $output_objdir" + $run $mkdir $output_objdir + exit_status=$? + if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then + exit $exit_status + fi + fi + + # Determine the type of output + case $output in + "") + $echo "$modename: you must specify an output file" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + ;; + *.$libext) linkmode=oldlib ;; + *.lo | *.$objext) linkmode=obj ;; + *.la) linkmode=lib ;; + *) linkmode=prog ;; # Anything else should be a program. + esac + + case $host in + *cygwin* | *mingw* | *pw32*) + # don't eliminate duplications in $postdeps and $predeps + duplicate_compiler_generated_deps=yes + ;; + *) + duplicate_compiler_generated_deps=$duplicate_deps + ;; + esac + specialdeplibs= + + libs= + # Find all interdependent deplibs by searching for libraries + # that are linked more than once (e.g. -la -lb -la) + for deplib in $deplibs; do + if test "X$duplicate_deps" = "Xyes" ; then + case "$libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + libs="$libs $deplib" + done + + if test "$linkmode" = lib; then + libs="$predeps $libs $compiler_lib_search_path $postdeps" + + # Compute libraries that are listed more than once in $predeps + # $postdeps and mark them as special (i.e., whose duplicates are + # not to be eliminated). + pre_post_deps= + if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then + for pre_post_dep in $predeps $postdeps; do + case "$pre_post_deps " in + *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; + esac + pre_post_deps="$pre_post_deps $pre_post_dep" + done + fi + pre_post_deps= + fi + + deplibs= + newdependency_libs= + newlib_search_path= + need_relink=no # whether we're linking any uninstalled libtool libraries + notinst_deplibs= # not-installed libtool libraries + case $linkmode in + lib) + passes="conv link" + for file in $dlfiles $dlprefiles; do + case $file in + *.la) ;; + *) + $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 + exit $EXIT_FAILURE + ;; + esac + done + ;; + prog) + compile_deplibs= + finalize_deplibs= + alldeplibs=no + newdlfiles= + newdlprefiles= + passes="conv scan dlopen dlpreopen link" + ;; + *) passes="conv" + ;; + esac + for pass in $passes; do + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan"; then + libs="$deplibs" + deplibs= + fi + if test "$linkmode" = prog; then + case $pass in + dlopen) libs="$dlfiles" ;; + dlpreopen) libs="$dlprefiles" ;; + link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; + esac + fi + if test "$pass" = dlopen; then + # Collect dlpreopened libraries + save_deplibs="$deplibs" + deplibs= + fi + for deplib in $libs; do + lib= + found=no + case $deplib in + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + compiler_flags="$compiler_flags $deplib" + fi + continue + ;; + -l*) + if test "$linkmode" != lib && test "$linkmode" != prog; then + $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 + continue + fi + name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` + for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do + for search_ext in .la $std_shrext .so .a; do + # Search the libtool library + lib="$searchdir/lib${name}${search_ext}" + if test -f "$lib"; then + if test "$search_ext" = ".la"; then + found=yes + else + found=no + fi + break 2 + fi + done + done + if test "$found" != yes; then + # deplib doesn't seem to be a libtool library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + else # deplib is a libtool library + # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, + # We need to do some special things here, and not later. + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $deplib "*) + if (${SED} -e '2q' $lib | + grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + library_names= + old_library= + case $lib in + */* | *\\*) . $lib ;; + *) . ./$lib ;; + esac + for l in $old_library $library_names; do + ll="$l" + done + if test "X$ll" = "X$old_library" ; then # only static version available + found=no + ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` + test "X$ladir" = "X$lib" && ladir="." + lib=$ladir/$old_library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + fi + fi + ;; + *) ;; + esac + fi + fi + ;; # -l + -L*) + case $linkmode in + lib) + deplibs="$deplib $deplibs" + test "$pass" = conv && continue + newdependency_libs="$deplib $newdependency_libs" + newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` + ;; + prog) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + if test "$pass" = scan; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` + ;; + *) + $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 + ;; + esac # linkmode + continue + ;; # -L + -R*) + if test "$pass" = link; then + dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` + # Make sure the xrpath contains only unique directories. + case "$xrpath " in + *" $dir "*) ;; + *) xrpath="$xrpath $dir" ;; + esac + fi + deplibs="$deplib $deplibs" + continue + ;; + *.la) lib="$deplib" ;; + *.$libext) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + case $linkmode in + lib) + valid_a_lib=no + case $deplibs_check_method in + match_pattern*) + set dummy $deplibs_check_method + match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` + if eval $echo \"$deplib\" 2>/dev/null \ + | $SED 10q \ + | $EGREP "$match_pattern_regex" > /dev/null; then + valid_a_lib=yes + fi + ;; + pass_all) + valid_a_lib=yes + ;; + esac + if test "$valid_a_lib" != yes; then + $echo + $echo "*** Warning: Trying to link with static lib archive $deplib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have" + $echo "*** because the file extensions .$libext of this argument makes me believe" + $echo "*** that it is just a static archive that I should not used here." + else + $echo + $echo "*** Warning: Linking the shared library $output against the" + $echo "*** static library $deplib is not portable!" + deplibs="$deplib $deplibs" + fi + continue + ;; + prog) + if test "$pass" != link; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + continue + ;; + esac # linkmode + ;; # *.$libext + *.lo | *.$objext) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + elif test "$linkmode" = prog; then + if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then + # If there is no dlopen support or we're linking statically, + # we need to preload. + newdlprefiles="$newdlprefiles $deplib" + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + newdlfiles="$newdlfiles $deplib" + fi + fi + continue + ;; + %DEPLIBS%) + alldeplibs=yes + continue + ;; + esac # case $deplib + if test "$found" = yes || test -f "$lib"; then : + else + $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2 + exit $EXIT_FAILURE + fi + + # Check to see that this really is a libtool archive. + if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + exit $EXIT_FAILURE + fi + + ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` + test "X$ladir" = "X$lib" && ladir="." + + dlname= + dlopen= + dlpreopen= + libdir= + library_names= + old_library= + # If the library was installed with an old release of libtool, + # it will not redefine variables installed, or shouldnotlink + installed=yes + shouldnotlink=no + avoidtemprpath= + + + # Read the .la file + case $lib in + */* | *\\*) . $lib ;; + *) . ./$lib ;; + esac + + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan" || + { test "$linkmode" != prog && test "$linkmode" != lib; }; then + test -n "$dlopen" && dlfiles="$dlfiles $dlopen" + test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" + fi + + if test "$pass" = conv; then + # Only check for convenience libraries + deplibs="$lib $deplibs" + if test -z "$libdir"; then + if test -z "$old_library"; then + $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 + exit $EXIT_FAILURE + fi + # It is a libtool convenience library, so add in its objects. + convenience="$convenience $ladir/$objdir/$old_library" + old_convenience="$old_convenience $ladir/$objdir/$old_library" + tmp_libs= + for deplib in $dependency_libs; do + deplibs="$deplib $deplibs" + if test "X$duplicate_deps" = "Xyes" ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + tmp_libs="$tmp_libs $deplib" + done + elif test "$linkmode" != prog && test "$linkmode" != lib; then + $echo "$modename: \`$lib' is not a convenience library" 1>&2 + exit $EXIT_FAILURE + fi + continue + fi # $pass = conv + + + # Get the name of the library we link against. + linklib= + for l in $old_library $library_names; do + linklib="$l" + done + if test -z "$linklib"; then + $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 + exit $EXIT_FAILURE + fi + + # This library was specified with -dlopen. + if test "$pass" = dlopen; then + if test -z "$libdir"; then + $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 + exit $EXIT_FAILURE + fi + if test -z "$dlname" || + test "$dlopen_support" != yes || + test "$build_libtool_libs" = no; then + # If there is no dlname, no dlopen support or we're linking + # statically, we need to preload. We also need to preload any + # dependent libraries so libltdl's deplib preloader doesn't + # bomb out in the load deplibs phase. + dlprefiles="$dlprefiles $lib $dependency_libs" + else + newdlfiles="$newdlfiles $lib" + fi + continue + fi # $pass = dlopen + + # We need an absolute path. + case $ladir in + [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; + *) + abs_ladir=`cd "$ladir" && pwd` + if test -z "$abs_ladir"; then + $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 + $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 + abs_ladir="$ladir" + fi + ;; + esac + laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` + + # Find the relevant object directory and library name. + if test "X$installed" = Xyes; then + if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then + $echo "$modename: warning: library \`$lib' was moved." 1>&2 + dir="$ladir" + absdir="$abs_ladir" + libdir="$abs_ladir" + else + dir="$libdir" + absdir="$libdir" + fi + test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes + else + if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then + dir="$ladir" + absdir="$abs_ladir" + # Remove this search path later + notinst_path="$notinst_path $abs_ladir" + else + dir="$ladir/$objdir" + absdir="$abs_ladir/$objdir" + # Remove this search path later + notinst_path="$notinst_path $abs_ladir" + fi + fi # $installed = yes + name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` + + # This library was specified with -dlpreopen. + if test "$pass" = dlpreopen; then + if test -z "$libdir"; then + $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 + exit $EXIT_FAILURE + fi + # Prefer using a static library (so that no silly _DYNAMIC symbols + # are required to link). + if test -n "$old_library"; then + newdlprefiles="$newdlprefiles $dir/$old_library" + # Otherwise, use the dlname, so that lt_dlopen finds it. + elif test -n "$dlname"; then + newdlprefiles="$newdlprefiles $dir/$dlname" + else + newdlprefiles="$newdlprefiles $dir/$linklib" + fi + fi # $pass = dlpreopen + + if test -z "$libdir"; then + # Link the convenience library + if test "$linkmode" = lib; then + deplibs="$dir/$old_library $deplibs" + elif test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$dir/$old_library $compile_deplibs" + finalize_deplibs="$dir/$old_library $finalize_deplibs" + else + deplibs="$lib $deplibs" # used for prog,scan pass + fi + continue + fi + + + if test "$linkmode" = prog && test "$pass" != link; then + newlib_search_path="$newlib_search_path $ladir" + deplibs="$lib $deplibs" + + linkalldeplibs=no + if test "$link_all_deplibs" != no || test -z "$library_names" || + test "$build_libtool_libs" = no; then + linkalldeplibs=yes + fi + + tmp_libs= + for deplib in $dependency_libs; do + case $deplib in + -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test + esac + # Need to link against all dependency_libs? + if test "$linkalldeplibs" = yes; then + deplibs="$deplib $deplibs" + else + # Need to hardcode shared library paths + # or/and link against static libraries + newdependency_libs="$deplib $newdependency_libs" + fi + if test "X$duplicate_deps" = "Xyes" ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + tmp_libs="$tmp_libs $deplib" + done # for deplib + continue + fi # $linkmode = prog... + + if test "$linkmode,$pass" = "prog,link"; then + if test -n "$library_names" && + { test "$prefer_static_libs" = no || test -z "$old_library"; }; then + # We need to hardcode the library path + if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then + # Make sure the rpath contains only unique directories. + case "$temp_rpath " in + *" $dir "*) ;; + *" $absdir "*) ;; + *) temp_rpath="$temp_rpath $absdir" ;; + esac + fi + + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) compile_rpath="$compile_rpath $absdir" + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" + esac + ;; + esac + fi # $linkmode,$pass = prog,link... + + if test "$alldeplibs" = yes && + { test "$deplibs_check_method" = pass_all || + { test "$build_libtool_libs" = yes && + test -n "$library_names"; }; }; then + # We only need to search for static libraries + continue + fi + fi + + link_static=no # Whether the deplib will be linked statically + use_static_libs=$prefer_static_libs + if test "$use_static_libs" = built && test "$installed" = yes ; then + use_static_libs=no + fi + if test -n "$library_names" && + { test "$use_static_libs" = no || test -z "$old_library"; }; then + if test "$installed" = no; then + notinst_deplibs="$notinst_deplibs $lib" + need_relink=yes + fi + # This is a shared library + + # Warn about portability, can't link against -module's on + # some systems (darwin) + if test "$shouldnotlink" = yes && test "$pass" = link ; then + $echo + if test "$linkmode" = prog; then + $echo "*** Warning: Linking the executable $output against the loadable module" + else + $echo "*** Warning: Linking the shared library $output against the loadable module" + fi + $echo "*** $linklib is not portable!" + fi + if test "$linkmode" = lib && + test "$hardcode_into_libs" = yes; then + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) compile_rpath="$compile_rpath $absdir" + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" + esac + ;; + esac + fi + + if test -n "$old_archive_from_expsyms_cmds"; then + # figure out the soname + set dummy $library_names + realname="$2" + shift; shift + libname=`eval \\$echo \"$libname_spec\"` + # use dlname if we got it. it's perfectly good, no? + if test -n "$dlname"; then + soname="$dlname" + elif test -n "$soname_spec"; then + # bleh windows + case $host in + *cygwin* | mingw*) + major=`expr $current - $age` + versuffix="-$major" + ;; + esac + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + + # Make a new name for the extract_expsyms_cmds to use + soroot="$soname" + soname=`$echo $soroot | ${SED} -e 's/^.*\///'` + newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" + + # If the library has no export list, then create one now + if test -f "$output_objdir/$soname-def"; then : + else + $show "extracting exported symbol list from \`$soname'" + save_ifs="$IFS"; IFS='~' + cmds=$extract_expsyms_cmds + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + + # Create $newlib + if test -f "$output_objdir/$newlib"; then :; else + $show "generating import library for \`$soname'" + save_ifs="$IFS"; IFS='~' + cmds=$old_archive_from_expsyms_cmds + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + # make sure the library variables are pointing to the new library + dir=$output_objdir + linklib=$newlib + fi # test -n "$old_archive_from_expsyms_cmds" + + if test "$linkmode" = prog || test "$mode" != relink; then + add_shlibpath= + add_dir= + add= + lib_linked=yes + case $hardcode_action in + immediate | unsupported) + if test "$hardcode_direct" = no; then + add="$dir/$linklib" + case $host in + *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; + *-*-sysv4*uw2*) add_dir="-L$dir" ;; + *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ + *-*-unixware7*) add_dir="-L$dir" ;; + *-*-darwin* ) + # if the lib is a module then we can not link against + # it, someone is ignoring the new warnings I added + if /usr/bin/file -L $add 2> /dev/null | + $EGREP ": [^:]* bundle" >/dev/null ; then + $echo "** Warning, lib $linklib is a module, not a shared library" + if test -z "$old_library" ; then + $echo + $echo "** And there doesn't seem to be a static archive available" + $echo "** The link will probably fail, sorry" + else + add="$dir/$old_library" + fi + fi + esac + elif test "$hardcode_minus_L" = no; then + case $host in + *-*-sunos*) add_shlibpath="$dir" ;; + esac + add_dir="-L$dir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = no; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + relink) + if test "$hardcode_direct" = yes; then + add="$dir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$dir" + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case $libdir in + [\\/]*) + add_dir="$add_dir -L$inst_prefix_dir$libdir" + ;; + esac + fi + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + *) lib_linked=no ;; + esac + + if test "$lib_linked" != yes; then + $echo "$modename: configuration error: unsupported hardcode properties" + exit $EXIT_FAILURE + fi + + if test -n "$add_shlibpath"; then + case :$compile_shlibpath: in + *":$add_shlibpath:"*) ;; + *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; + esac + fi + if test "$linkmode" = prog; then + test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" + test -n "$add" && compile_deplibs="$add $compile_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + if test "$hardcode_direct" != yes && \ + test "$hardcode_minus_L" != yes && \ + test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; + esac + fi + fi + fi + + if test "$linkmode" = prog || test "$mode" = relink; then + add_shlibpath= + add_dir= + add= + # Finalize command for both is simple: just hardcode it. + if test "$hardcode_direct" = yes; then + add="$libdir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$libdir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; + esac + add="-l$name" + elif test "$hardcode_automatic" = yes; then + if test -n "$inst_prefix_dir" && + test -f "$inst_prefix_dir$libdir/$linklib" ; then + add="$inst_prefix_dir$libdir/$linklib" + else + add="$libdir/$linklib" + fi + else + # We cannot seem to hardcode it, guess we'll fake it. + add_dir="-L$libdir" + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case $libdir in + [\\/]*) + add_dir="$add_dir -L$inst_prefix_dir$libdir" + ;; + esac + fi + add="-l$name" + fi + + if test "$linkmode" = prog; then + test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" + test -n "$add" && finalize_deplibs="$add $finalize_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + fi + fi + elif test "$linkmode" = prog; then + # Here we assume that one of hardcode_direct or hardcode_minus_L + # is not unsupported. This is valid on all known static and + # shared platforms. + if test "$hardcode_direct" != unsupported; then + test -n "$old_library" && linklib="$old_library" + compile_deplibs="$dir/$linklib $compile_deplibs" + finalize_deplibs="$dir/$linklib $finalize_deplibs" + else + compile_deplibs="-l$name -L$dir $compile_deplibs" + finalize_deplibs="-l$name -L$dir $finalize_deplibs" + fi + elif test "$build_libtool_libs" = yes; then + # Not a shared library + if test "$deplibs_check_method" != pass_all; then + # We're trying link a shared library against a static one + # but the system doesn't support it. + + # Just print a warning and add the library to dependency_libs so + # that the program can be linked against the static library. + $echo + $echo "*** Warning: This system can not link to static lib archive $lib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have." + if test "$module" = yes; then + $echo "*** But as you try to build a module library, libtool will still create " + $echo "*** a static module, that should work as long as the dlopening application" + $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." + if test -z "$global_symbol_pipe"; then + $echo + $echo "*** However, this would only work if libtool was able to extract symbol" + $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + $echo "*** not find such a program. So, this module is probably useless." + $echo "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + else + deplibs="$dir/$old_library $deplibs" + link_static=yes + fi + fi # link shared/static library? + + if test "$linkmode" = lib; then + if test -n "$dependency_libs" && + { test "$hardcode_into_libs" != yes || + test "$build_old_libs" = yes || + test "$link_static" = yes; }; then + # Extract -R from dependency_libs + temp_deplibs= + for libdir in $dependency_libs; do + case $libdir in + -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` + case " $xrpath " in + *" $temp_xrpath "*) ;; + *) xrpath="$xrpath $temp_xrpath";; + esac;; + *) temp_deplibs="$temp_deplibs $libdir";; + esac + done + dependency_libs="$temp_deplibs" + fi + + newlib_search_path="$newlib_search_path $absdir" + # Link against this library + test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" + # ... and its dependency_libs + tmp_libs= + for deplib in $dependency_libs; do + newdependency_libs="$deplib $newdependency_libs" + if test "X$duplicate_deps" = "Xyes" ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + tmp_libs="$tmp_libs $deplib" + done + + if test "$link_all_deplibs" != no; then + # Add the search paths of all dependency libraries + for deplib in $dependency_libs; do + case $deplib in + -L*) path="$deplib" ;; + *.la) + dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$deplib" && dir="." + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 + absdir="$dir" + fi + ;; + esac + if grep "^installed=no" $deplib > /dev/null; then + path="$absdir/$objdir" + else + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + if test -z "$libdir"; then + $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 + exit $EXIT_FAILURE + fi + if test "$absdir" != "$libdir"; then + $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 + fi + path="$absdir" + fi + depdepl= + case $host in + *-*-darwin*) + # we do not want to link against static libs, + # but need to link against shared + eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` + if test -n "$deplibrary_names" ; then + for tmp in $deplibrary_names ; do + depdepl=$tmp + done + if test -f "$path/$depdepl" ; then + depdepl="$path/$depdepl" + fi + # do not add paths which are already there + case " $newlib_search_path " in + *" $path "*) ;; + *) newlib_search_path="$newlib_search_path $path";; + esac + fi + path="" + ;; + *) + path="-L$path" + ;; + esac + ;; + -l*) + case $host in + *-*-darwin*) + # Again, we only want to link against shared libraries + eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` + for tmp in $newlib_search_path ; do + if test -f "$tmp/lib$tmp_libs.dylib" ; then + eval depdepl="$tmp/lib$tmp_libs.dylib" + break + fi + done + path="" + ;; + *) continue ;; + esac + ;; + *) continue ;; + esac + case " $deplibs " in + *" $path "*) ;; + *) deplibs="$path $deplibs" ;; + esac + case " $deplibs " in + *" $depdepl "*) ;; + *) deplibs="$depdepl $deplibs" ;; + esac + done + fi # link_all_deplibs != no + fi # linkmode = lib + done # for deplib in $libs + dependency_libs="$newdependency_libs" + if test "$pass" = dlpreopen; then + # Link the dlpreopened libraries before other libraries + for deplib in $save_deplibs; do + deplibs="$deplib $deplibs" + done + fi + if test "$pass" != dlopen; then + if test "$pass" != conv; then + # Make sure lib_search_path contains only unique directories. + lib_search_path= + for dir in $newlib_search_path; do + case "$lib_search_path " in + *" $dir "*) ;; + *) lib_search_path="$lib_search_path $dir" ;; + esac + done + newlib_search_path= + fi + + if test "$linkmode,$pass" != "prog,link"; then + vars="deplibs" + else + vars="compile_deplibs finalize_deplibs" + fi + for var in $vars dependency_libs; do + # Add libraries to $var in reverse order + eval tmp_libs=\"\$$var\" + new_libs= + for deplib in $tmp_libs; do + # FIXME: Pedantically, this is the right thing to do, so + # that some nasty dependency loop isn't accidentally + # broken: + #new_libs="$deplib $new_libs" + # Pragmatically, this seems to cause very few problems in + # practice: + case $deplib in + -L*) new_libs="$deplib $new_libs" ;; + -R*) ;; + *) + # And here is the reason: when a library appears more + # than once as an explicit dependence of a library, or + # is implicitly linked in more than once by the + # compiler, it is considered special, and multiple + # occurrences thereof are not removed. Compare this + # with having the same library being listed as a + # dependency of multiple other libraries: in this case, + # we know (pedantically, we assume) the library does not + # need to be listed more than once, so we keep only the + # last copy. This is not always right, but it is rare + # enough that we require users that really mean to play + # such unportable linking tricks to link the library + # using -Wl,-lname, so that libtool does not consider it + # for duplicate removal. + case " $specialdeplibs " in + *" $deplib "*) new_libs="$deplib $new_libs" ;; + *) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$deplib $new_libs" ;; + esac + ;; + esac + ;; + esac + done + tmp_libs= + for deplib in $new_libs; do + case $deplib in + -L*) + case " $tmp_libs " in + *" $deplib "*) ;; + *) tmp_libs="$tmp_libs $deplib" ;; + esac + ;; + *) tmp_libs="$tmp_libs $deplib" ;; + esac + done + eval $var=\"$tmp_libs\" + done # for var + fi + # Last step: remove runtime libs from dependency_libs + # (they stay in deplibs) + tmp_libs= + for i in $dependency_libs ; do + case " $predeps $postdeps $compiler_lib_search_path " in + *" $i "*) + i="" + ;; + esac + if test -n "$i" ; then + tmp_libs="$tmp_libs $i" + fi + done + dependency_libs=$tmp_libs + done # for pass + if test "$linkmode" = prog; then + dlfiles="$newdlfiles" + dlprefiles="$newdlprefiles" + fi + + case $linkmode in + oldlib) + if test -n "$deplibs"; then + $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 + fi + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 + fi + + if test -n "$rpath"; then + $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 + fi + + if test -n "$xrpath"; then + $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 + fi + + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 + fi + + # Now set the variables for building old libraries. + build_libtool_libs=no + oldlibs="$output" + objs="$objs$old_deplibs" + ;; + + lib) + # Make sure we only generate libraries of the form `libNAME.la'. + case $outputname in + lib*) + name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` + eval shared_ext=\"$shrext_cmds\" + eval libname=\"$libname_spec\" + ;; + *) + if test "$module" = no; then + $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + if test "$need_lib_prefix" != no; then + # Add the "lib" prefix for modules if required + name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` + eval shared_ext=\"$shrext_cmds\" + eval libname=\"$libname_spec\" + else + libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` + fi + ;; + esac + + if test -n "$objs"; then + if test "$deplibs_check_method" != pass_all; then + $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 + exit $EXIT_FAILURE + else + $echo + $echo "*** Warning: Linking the shared library $output against the non-libtool" + $echo "*** objects $objs is not portable!" + libobjs="$libobjs $objs" + fi + fi + + if test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 + fi + + set dummy $rpath + if test "$#" -gt 2; then + $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 + fi + install_libdir="$2" + + oldlibs= + if test -z "$rpath"; then + if test "$build_libtool_libs" = yes; then + # Building a libtool convenience library. + # Some compilers have problems with a `.al' extension so + # convenience libraries should have the same extension an + # archive normally would. + oldlibs="$output_objdir/$libname.$libext $oldlibs" + build_libtool_libs=convenience + build_old_libs=yes + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 + fi + else + + # Parse the version information argument. + save_ifs="$IFS"; IFS=':' + set dummy $vinfo 0 0 0 + IFS="$save_ifs" + + if test -n "$8"; then + $echo "$modename: too many parameters to \`-version-info'" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # convert absolute version numbers to libtool ages + # this retains compatibility with .la files and attempts + # to make the code below a bit more comprehensible + + case $vinfo_number in + yes) + number_major="$2" + number_minor="$3" + number_revision="$4" + # + # There are really only two kinds -- those that + # use the current revision as the major version + # and those that subtract age and use age as + # a minor version. But, then there is irix + # which has an extra 1 added just for fun + # + case $version_type in + darwin|linux|osf|windows) + current=`expr $number_major + $number_minor` + age="$number_minor" + revision="$number_revision" + ;; + freebsd-aout|freebsd-elf|sunos) + current="$number_major" + revision="$number_minor" + age="0" + ;; + irix|nonstopux) + current=`expr $number_major + $number_minor - 1` + age="$number_minor" + revision="$number_minor" + ;; + esac + ;; + no) + current="$2" + revision="$3" + age="$4" + ;; + esac + + # Check that each of the things are valid numbers. + case $current in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + case $revision in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + case $age in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + if test "$age" -gt "$current"; then + $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit $EXIT_FAILURE + fi + + # Calculate the version variables. + major= + versuffix= + verstring= + case $version_type in + none) ;; + + darwin) + # Like Linux, but with the current version available in + # verstring for coding it into the library header + major=.`expr $current - $age` + versuffix="$major.$age.$revision" + # Darwin ld doesn't like 0 for these options... + minor_current=`expr $current + 1` + verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" + ;; + + freebsd-aout) + major=".$current" + versuffix=".$current.$revision"; + ;; + + freebsd-elf) + major=".$current" + versuffix=".$current"; + ;; + + irix | nonstopux) + major=`expr $current - $age + 1` + + case $version_type in + nonstopux) verstring_prefix=nonstopux ;; + *) verstring_prefix=sgi ;; + esac + verstring="$verstring_prefix$major.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$revision + while test "$loop" -ne 0; do + iface=`expr $revision - $loop` + loop=`expr $loop - 1` + verstring="$verstring_prefix$major.$iface:$verstring" + done + + # Before this point, $major must not contain `.'. + major=.$major + versuffix="$major.$revision" + ;; + + linux) + major=.`expr $current - $age` + versuffix="$major.$age.$revision" + ;; + + osf) + major=.`expr $current - $age` + versuffix=".$current.$age.$revision" + verstring="$current.$age.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$age + while test "$loop" -ne 0; do + iface=`expr $current - $loop` + loop=`expr $loop - 1` + verstring="$verstring:${iface}.0" + done + + # Make executables depend on our current version. + verstring="$verstring:${current}.0" + ;; + + sunos) + major=".$current" + versuffix=".$current.$revision" + ;; + + windows) + # Use '-' rather than '.', since we only want one + # extension on DOS 8.3 filesystems. + major=`expr $current - $age` + versuffix="-$major" + ;; + + *) + $echo "$modename: unknown library version type \`$version_type'" 1>&2 + $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit $EXIT_FAILURE + ;; + esac + + # Clear the version info if we defaulted, and they specified a release. + if test -z "$vinfo" && test -n "$release"; then + major= + case $version_type in + darwin) + # we can't check for "0.0" in archive_cmds due to quoting + # problems, so we reset it completely + verstring= + ;; + *) + verstring="0.0" + ;; + esac + if test "$need_version" = no; then + versuffix= + else + versuffix=".0.0" + fi + fi + + # Remove version info from name if versioning should be avoided + if test "$avoid_version" = yes && test "$need_version" = no; then + major= + versuffix= + verstring="" + fi + + # Check to see if the archive will have undefined symbols. + if test "$allow_undefined" = yes; then + if test "$allow_undefined_flag" = unsupported; then + $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 + build_libtool_libs=no + build_old_libs=yes + fi + else + # Don't allow undefined symbols. + allow_undefined_flag="$no_undefined_flag" + fi + fi + + if test "$mode" != relink; then + # Remove our outputs, but don't remove object files since they + # may have been created when compiling PIC objects. + removelist= + tempremovelist=`$echo "$output_objdir/*"` + for p in $tempremovelist; do + case $p in + *.$objext) + ;; + $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) + if test "X$precious_files_regex" != "X"; then + if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 + then + continue + fi + fi + removelist="$removelist $p" + ;; + *) ;; + esac + done + if test -n "$removelist"; then + $show "${rm}r $removelist" + $run ${rm}r $removelist + fi + fi + + # Now set the variables for building old libraries. + if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then + oldlibs="$oldlibs $output_objdir/$libname.$libext" + + # Transform .lo files to .o files. + oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` + fi + + # Eliminate all temporary directories. + for path in $notinst_path; do + lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"` + deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"` + dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"` + done + + if test -n "$xrpath"; then + # If the user specified any rpath flags, then add them. + temp_xrpath= + for libdir in $xrpath; do + temp_xrpath="$temp_xrpath -R$libdir" + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" ;; + esac + done + if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then + dependency_libs="$temp_xrpath $dependency_libs" + fi + fi + + # Make sure dlfiles contains only unique files that won't be dlpreopened + old_dlfiles="$dlfiles" + dlfiles= + for lib in $old_dlfiles; do + case " $dlprefiles $dlfiles " in + *" $lib "*) ;; + *) dlfiles="$dlfiles $lib" ;; + esac + done + + # Make sure dlprefiles contains only unique files + old_dlprefiles="$dlprefiles" + dlprefiles= + for lib in $old_dlprefiles; do + case "$dlprefiles " in + *" $lib "*) ;; + *) dlprefiles="$dlprefiles $lib" ;; + esac + done + + if test "$build_libtool_libs" = yes; then + if test -n "$rpath"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) + # these systems don't actually have a c library (as such)! + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C library is in the System framework + deplibs="$deplibs -framework System" + ;; + *-*-netbsd*) + # Don't link with libc until the a.out ld.so is fixed. + ;; + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc due to us having libc/libc_r. + ;; + *-*-sco3.2v5* | *-*-sco5v6*) + # Causes problems with __ctype + ;; + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) + # Compiler inserts libc in the correct place for threads to work + ;; + *) + # Add libc to deplibs on all other systems if necessary. + if test "$build_libtool_need_lc" = "yes"; then + deplibs="$deplibs -lc" + fi + ;; + esac + fi + + # Transform deplibs into only deplibs that can be linked in shared. + name_save=$name + libname_save=$libname + release_save=$release + versuffix_save=$versuffix + major_save=$major + # I'm not sure if I'm treating the release correctly. I think + # release should show up in the -l (ie -lgmp5) so we don't want to + # add it in twice. Is that correct? + release="" + versuffix="" + major="" + newdeplibs= + droppeddeps=no + case $deplibs_check_method in + pass_all) + # Don't check for shared/static. Everything works. + # This might be a little naive. We might want to check + # whether the library exists or not. But this is on + # osf3 & osf4 and I'm not really sure... Just + # implementing what was already the behavior. + newdeplibs=$deplibs + ;; + test_compile) + # This code stresses the "libraries are programs" paradigm to its + # limits. Maybe even breaks it. We compile a program, linking it + # against the deplibs as a proxy for the library. Then we can check + # whether they linked in statically or dynamically with ldd. + $rm conftest.c + cat > conftest.c </dev/null` + for potent_lib in $potential_libs; do + # Follow soft links. + if ls -lLd "$potent_lib" 2>/dev/null \ + | grep " -> " >/dev/null; then + continue + fi + # The statement above tries to avoid entering an + # endless loop below, in case of cyclic links. + # We might still enter an endless loop, since a link + # loop can be closed while we follow links, + # but so what? + potlib="$potent_lib" + while test -h "$potlib" 2>/dev/null; do + potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` + case $potliblink in + [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; + *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; + esac + done + if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ + | ${SED} 10q \ + | $EGREP "$file_magic_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi + done + done + fi + if test -n "$a_deplib" ; then + droppeddeps=yes + $echo + $echo "*** Warning: linker path does not have real file for library $a_deplib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have" + $echo "*** because I did check the linker path looking for a file starting" + if test -z "$potlib" ; then + $echo "*** with $libname but no candidates were found. (...for file magic test)" + else + $echo "*** with $libname and none of the candidates passed a file format test" + $echo "*** using a file magic. Last file checked: $potlib" + fi + fi + else + # Add a -L argument. + newdeplibs="$newdeplibs $a_deplib" + fi + done # Gone through all deplibs. + ;; + match_pattern*) + set dummy $deplibs_check_method + match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` + for a_deplib in $deplibs; do + name=`expr $a_deplib : '-l\(.*\)'` + # If $name is empty we are operating on a -L argument. + if test -n "$name" && test "$name" != "0"; then + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $a_deplib "*) + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + ;; + esac + fi + if test -n "$a_deplib" ; then + libname=`eval \\$echo \"$libname_spec\"` + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + for potent_lib in $potential_libs; do + potlib="$potent_lib" # see symlink-check above in file_magic test + if eval $echo \"$potent_lib\" 2>/dev/null \ + | ${SED} 10q \ + | $EGREP "$match_pattern_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi + done + done + fi + if test -n "$a_deplib" ; then + droppeddeps=yes + $echo + $echo "*** Warning: linker path does not have real file for library $a_deplib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have" + $echo "*** because I did check the linker path looking for a file starting" + if test -z "$potlib" ; then + $echo "*** with $libname but no candidates were found. (...for regex pattern test)" + else + $echo "*** with $libname and none of the candidates passed a file format test" + $echo "*** using a regex pattern. Last file checked: $potlib" + fi + fi + else + # Add a -L argument. + newdeplibs="$newdeplibs $a_deplib" + fi + done # Gone through all deplibs. + ;; + none | unknown | *) + newdeplibs="" + tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ + -e 's/ -[LR][^ ]*//g'` + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + for i in $predeps $postdeps ; do + # can't use Xsed below, because $i might contain '/' + tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` + done + fi + if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ + | grep . >/dev/null; then + $echo + if test "X$deplibs_check_method" = "Xnone"; then + $echo "*** Warning: inter-library dependencies are not supported in this platform." + else + $echo "*** Warning: inter-library dependencies are not known to be supported." + fi + $echo "*** All declared inter-library dependencies are being dropped." + droppeddeps=yes + fi + ;; + esac + versuffix=$versuffix_save + major=$major_save + release=$release_save + libname=$libname_save + name=$name_save + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library is the System framework + newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` + ;; + esac + + if test "$droppeddeps" = yes; then + if test "$module" = yes; then + $echo + $echo "*** Warning: libtool could not satisfy all declared inter-library" + $echo "*** dependencies of module $libname. Therefore, libtool will create" + $echo "*** a static module, that should work as long as the dlopening" + $echo "*** application is linked with the -dlopen flag." + if test -z "$global_symbol_pipe"; then + $echo + $echo "*** However, this would only work if libtool was able to extract symbol" + $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + $echo "*** not find such a program. So, this module is probably useless." + $echo "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + else + $echo "*** The inter-library dependencies that have been dropped here will be" + $echo "*** automatically added whenever a program is linked with this library" + $echo "*** or is declared to -dlopen it." + + if test "$allow_undefined" = no; then + $echo + $echo "*** Since this library must not contain undefined symbols," + $echo "*** because either the platform does not support them or" + $echo "*** it was explicitly requested with -no-undefined," + $echo "*** libtool will only create a static version of it." + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + fi + fi + # Done checking deplibs! + deplibs=$newdeplibs + fi + + + # move library search paths that coincide with paths to not yet + # installed libraries to the beginning of the library search list + new_libs= + for path in $notinst_path; do + case " $new_libs " in + *" -L$path/$objdir "*) ;; + *) + case " $deplibs " in + *" -L$path/$objdir "*) + new_libs="$new_libs -L$path/$objdir" ;; + esac + ;; + esac + done + for deplib in $deplibs; do + case $deplib in + -L*) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$new_libs $deplib" ;; + esac + ;; + *) new_libs="$new_libs $deplib" ;; + esac + done + deplibs="$new_libs" + + + # All the library-specific variables (install_libdir is set above). + library_names= + old_library= + dlname= + + # Test again, we may have decided not to build it any more + if test "$build_libtool_libs" = yes; then + if test "$hardcode_into_libs" = yes; then + # Hardcode the library paths + hardcode_libdirs= + dep_rpath= + rpath="$finalize_rpath" + test "$mode" != relink && rpath="$compile_rpath$rpath" + for libdir in $rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + dep_rpath="$dep_rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) perm_rpath="$perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + if test -n "$hardcode_libdir_flag_spec_ld"; then + eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" + else + eval dep_rpath=\"$hardcode_libdir_flag_spec\" + fi + fi + if test -n "$runpath_var" && test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + rpath="$rpath$dir:" + done + eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" + fi + test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" + fi + + shlibpath="$finalize_shlibpath" + test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" + if test -n "$shlibpath"; then + eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" + fi + + # Get the real and link names of the library. + eval shared_ext=\"$shrext_cmds\" + eval library_names=\"$library_names_spec\" + set dummy $library_names + realname="$2" + shift; shift + + if test -n "$soname_spec"; then + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + if test -z "$dlname"; then + dlname=$soname + fi + + lib="$output_objdir/$realname" + linknames= + for link + do + linknames="$linknames $link" + done + + # Use standard objects if they are pic + test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then + $show "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $run $rm $export_symbols + cmds=$export_symbols_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + if len=`expr "X$cmd" : ".*"` && + test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then + $show "$cmd" + $run eval "$cmd" || exit $? + skipped_export=false + else + # The command line is too long to execute in one step. + $show "using reloadable object file for export list..." + skipped_export=: + # Break out early, otherwise skipped_export may be + # set to false by a later but shorter cmd. + break + fi + done + IFS="$save_ifs" + if test -n "$export_symbols_regex"; then + $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" + $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + $show "$mv \"${export_symbols}T\" \"$export_symbols\"" + $run eval '$mv "${export_symbols}T" "$export_symbols"' + fi + fi + fi + + if test -n "$export_symbols" && test -n "$include_expsyms"; then + $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' + fi + + tmp_deplibs= + for test_deplib in $deplibs; do + case " $convenience " in + *" $test_deplib "*) ;; + *) + tmp_deplibs="$tmp_deplibs $test_deplib" + ;; + esac + done + deplibs="$tmp_deplibs" + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + else + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + + func_extract_archives $gentop $convenience + libobjs="$libobjs $func_extract_archives_result" + fi + fi + + if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then + eval flag=\"$thread_safe_flag_spec\" + linker_flags="$linker_flags $flag" + fi + + # Make a backup of the uninstalled library when relinking + if test "$mode" = relink; then + $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? + fi + + # Do each of the archive commands. + if test "$module" = yes && test -n "$module_cmds" ; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + eval test_cmds=\"$module_expsym_cmds\" + cmds=$module_expsym_cmds + else + eval test_cmds=\"$module_cmds\" + cmds=$module_cmds + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + eval test_cmds=\"$archive_expsym_cmds\" + cmds=$archive_expsym_cmds + else + eval test_cmds=\"$archive_cmds\" + cmds=$archive_cmds + fi + fi + + if test "X$skipped_export" != "X:" && + len=`expr "X$test_cmds" : ".*" 2>/dev/null` && + test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then + : + else + # The command line is too long to link in one step, link piecewise. + $echo "creating reloadable object files..." + + # Save the value of $output and $libobjs because we want to + # use them later. If we have whole_archive_flag_spec, we + # want to use save_libobjs as it was before + # whole_archive_flag_spec was expanded, because we can't + # assume the linker understands whole_archive_flag_spec. + # This may have to be revisited, in case too many + # convenience libraries get linked in and end up exceeding + # the spec. + if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + fi + save_output=$output + output_la=`$echo "X$output" | $Xsed -e "$basename"` + + # Clear the reloadable object creation command queue and + # initialize k to one. + test_cmds= + concat_cmds= + objlist= + delfiles= + last_robj= + k=1 + output=$output_objdir/$output_la-${k}.$objext + # Loop over the list of objects to be linked. + for obj in $save_libobjs + do + eval test_cmds=\"$reload_cmds $objlist $last_robj\" + if test "X$objlist" = X || + { len=`expr "X$test_cmds" : ".*" 2>/dev/null` && + test "$len" -le "$max_cmd_len"; }; then + objlist="$objlist $obj" + else + # The command $test_cmds is almost too long, add a + # command to the queue. + if test "$k" -eq 1 ; then + # The first file doesn't have a previous command to add. + eval concat_cmds=\"$reload_cmds $objlist $last_robj\" + else + # All subsequent reloadable object files will link in + # the last one created. + eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" + fi + last_robj=$output_objdir/$output_la-${k}.$objext + k=`expr $k + 1` + output=$output_objdir/$output_la-${k}.$objext + objlist=$obj + len=1 + fi + done + # Handle the remaining objects by creating one last + # reloadable object file. All subsequent reloadable object + # files will link in the last one created. + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" + + if ${skipped_export-false}; then + $show "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $run $rm $export_symbols + libobjs=$output + # Append the command to create the export file. + eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" + fi + + # Set up a command to remove the reloadable object files + # after they are used. + i=0 + while test "$i" -lt "$k" + do + i=`expr $i + 1` + delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" + done + + $echo "creating a temporary reloadable object file: $output" + + # Loop through the commands generated above and execute them. + save_ifs="$IFS"; IFS='~' + for cmd in $concat_cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + + libobjs=$output + # Restore the value of output. + output=$save_output + + if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + fi + # Expand the library linking commands again to reset the + # value of $libobjs for piecewise linking. + + # Do each of the archive commands. + if test "$module" = yes && test -n "$module_cmds" ; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + cmds=$module_expsym_cmds + else + cmds=$module_cmds + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + cmds=$archive_expsym_cmds + else + cmds=$archive_cmds + fi + fi + + # Append the command to remove the reloadable object files + # to the just-reset $cmds. + eval cmds=\"\$cmds~\$rm $delfiles\" + fi + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || { + lt_exit=$? + + # Restore the uninstalled library and exit + if test "$mode" = relink; then + $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' + fi + + exit $lt_exit + } + done + IFS="$save_ifs" + + # Restore the uninstalled library and exit + if test "$mode" = relink; then + $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? + + if test -n "$convenience"; then + if test -z "$whole_archive_flag_spec"; then + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + fi + fi + + exit $EXIT_SUCCESS + fi + + # Create links to the real library. + for linkname in $linknames; do + if test "$realname" != "$linkname"; then + $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" + $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? + fi + done + + # If -module or -export-dynamic was specified, set the dlname. + if test "$module" = yes || test "$export_dynamic" = yes; then + # On all known operating systems, these are identical. + dlname="$soname" + fi + fi + ;; + + obj) + if test -n "$deplibs"; then + $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 + fi + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 + fi + + if test -n "$rpath"; then + $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 + fi + + if test -n "$xrpath"; then + $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 + fi + + case $output in + *.lo) + if test -n "$objs$old_deplibs"; then + $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 + exit $EXIT_FAILURE + fi + libobj="$output" + obj=`$echo "X$output" | $Xsed -e "$lo2o"` + ;; + *) + libobj= + obj="$output" + ;; + esac + + # Delete the old objects. + $run $rm $obj $libobj + + # Objects from convenience libraries. This assumes + # single-version convenience libraries. Whenever we create + # different ones for PIC/non-PIC, this we'll have to duplicate + # the extraction. + reload_conv_objs= + gentop= + # reload_cmds runs $LD directly, so let us get rid of + # -Wl from whole_archive_flag_spec + wl= + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" + else + gentop="$output_objdir/${obj}x" + generated="$generated $gentop" + + func_extract_archives $gentop $convenience + reload_conv_objs="$reload_objs $func_extract_archives_result" + fi + fi + + # Create the old-style object. + reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test + + output="$obj" + cmds=$reload_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + + # Exit if we aren't doing a library object file. + if test -z "$libobj"; then + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + exit $EXIT_SUCCESS + fi + + if test "$build_libtool_libs" != yes; then + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + # Create an invalid libtool object if no PIC, so that we don't + # accidentally link it into a program. + # $show "echo timestamp > $libobj" + # $run eval "echo timestamp > $libobj" || exit $? + exit $EXIT_SUCCESS + fi + + if test -n "$pic_flag" || test "$pic_mode" != default; then + # Only do commands if we really have different PIC objects. + reload_objs="$libobjs $reload_conv_objs" + output="$libobj" + cmds=$reload_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + exit $EXIT_SUCCESS + ;; + + prog) + case $host in + *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; + esac + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 + fi + + if test "$preload" = yes; then + if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && + test "$dlopen_self_static" = unknown; then + $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." + fi + fi + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library is the System framework + compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` + finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` + ;; + esac + + case $host in + *darwin*) + # Don't allow lazy linking, it breaks C++ global constructors + if test "$tagname" = CXX ; then + compile_command="$compile_command ${wl}-bind_at_load" + finalize_command="$finalize_command ${wl}-bind_at_load" + fi + ;; + esac + + + # move library search paths that coincide with paths to not yet + # installed libraries to the beginning of the library search list + new_libs= + for path in $notinst_path; do + case " $new_libs " in + *" -L$path/$objdir "*) ;; + *) + case " $compile_deplibs " in + *" -L$path/$objdir "*) + new_libs="$new_libs -L$path/$objdir" ;; + esac + ;; + esac + done + for deplib in $compile_deplibs; do + case $deplib in + -L*) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$new_libs $deplib" ;; + esac + ;; + *) new_libs="$new_libs $deplib" ;; + esac + done + compile_deplibs="$new_libs" + + + compile_command="$compile_command $compile_deplibs" + finalize_command="$finalize_command $finalize_deplibs" + + if test -n "$rpath$xrpath"; then + # If the user specified any rpath flags, then add them. + for libdir in $rpath $xrpath; do + # This is the magic to use -rpath. + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" ;; + esac + done + fi + + # Now hardcode the library paths + rpath= + hardcode_libdirs= + for libdir in $compile_rpath $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) perm_rpath="$perm_rpath $libdir" ;; + esac + fi + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'` + case :$dllsearchpath: in + *":$libdir:"*) ;; + *) dllsearchpath="$dllsearchpath:$libdir";; + esac + case :$dllsearchpath: in + *":$testbindir:"*) ;; + *) dllsearchpath="$dllsearchpath:$testbindir";; + esac + ;; + esac + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + compile_rpath="$rpath" + + rpath= + hardcode_libdirs= + for libdir in $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$finalize_perm_rpath " in + *" $libdir "*) ;; + *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + finalize_rpath="$rpath" + + if test -n "$libobjs" && test "$build_old_libs" = yes; then + # Transform all the library objects into standard objects. + compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + fi + + dlsyms= + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + if test -n "$NM" && test -n "$global_symbol_pipe"; then + dlsyms="${outputname}S.c" + else + $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 + fi + fi + + if test -n "$dlsyms"; then + case $dlsyms in + "") ;; + *.c) + # Discover the nlist of each of the dlfiles. + nlist="$output_objdir/${outputname}.nm" + + $show "$rm $nlist ${nlist}S ${nlist}T" + $run $rm "$nlist" "${nlist}S" "${nlist}T" + + # Parse the name list into a source file. + $show "creating $output_objdir/$dlsyms" + + test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ +/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ +/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ + +#ifdef __cplusplus +extern \"C\" { +#endif + +/* Prevent the only kind of declaration conflicts we can make. */ +#define lt_preloaded_symbols some_other_symbol + +/* External symbol declarations for the compiler. */\ +" + + if test "$dlself" = yes; then + $show "generating symbol list for \`$output'" + + test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" + + # Add our own program objects to the symbol list. + progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + for arg in $progfiles; do + $show "extracting global C symbols from \`$arg'" + $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" + done + + if test -n "$exclude_expsyms"; then + $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' + $run eval '$mv "$nlist"T "$nlist"' + fi + + if test -n "$export_symbols_regex"; then + $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' + $run eval '$mv "$nlist"T "$nlist"' + fi + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + export_symbols="$output_objdir/$outputname.exp" + $run $rm $export_symbols + $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' + case $host in + *cygwin* | *mingw* ) + $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' + ;; + esac + else + $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' + $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' + $run eval 'mv "$nlist"T "$nlist"' + case $host in + *cygwin* | *mingw* ) + $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' + ;; + esac + fi + fi + + for arg in $dlprefiles; do + $show "extracting global C symbols from \`$arg'" + name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` + $run eval '$echo ": $name " >> "$nlist"' + $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" + done + + if test -z "$run"; then + # Make sure we have at least an empty file. + test -f "$nlist" || : > "$nlist" + + if test -n "$exclude_expsyms"; then + $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T + $mv "$nlist"T "$nlist" + fi + + # Try sorting and uniquifying the output. + if grep -v "^: " < "$nlist" | + if sort -k 3 /dev/null 2>&1; then + sort -k 3 + else + sort +2 + fi | + uniq > "$nlist"S; then + : + else + grep -v "^: " < "$nlist" > "$nlist"S + fi + + if test -f "$nlist"S; then + eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' + else + $echo '/* NONE */' >> "$output_objdir/$dlsyms" + fi + + $echo >> "$output_objdir/$dlsyms" "\ + +#undef lt_preloaded_symbols + +#if defined (__STDC__) && __STDC__ +# define lt_ptr void * +#else +# define lt_ptr char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +" + + case $host in + *cygwin* | *mingw* ) + $echo >> "$output_objdir/$dlsyms" "\ +/* DATA imports from DLLs on WIN32 can't be const, because + runtime relocations are performed -- see ld's documentation + on pseudo-relocs */ +struct { +" + ;; + * ) + $echo >> "$output_objdir/$dlsyms" "\ +const struct { +" + ;; + esac + + + $echo >> "$output_objdir/$dlsyms" "\ + const char *name; + lt_ptr address; +} +lt_preloaded_symbols[] = +{\ +" + + eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" + + $echo >> "$output_objdir/$dlsyms" "\ + {0, (lt_ptr) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif\ +" + fi + + pic_flag_for_symtable= + case $host in + # compiling the symbol table file with pic_flag works around + # a FreeBSD bug that causes programs to crash when -lm is + # linked before any other PIC object. But we must not use + # pic_flag when linking with -static. The problem exists in + # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. + *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) + case "$compile_command " in + *" -static "*) ;; + *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; + esac;; + *-*-hpux*) + case "$compile_command " in + *" -static "*) ;; + *) pic_flag_for_symtable=" $pic_flag";; + esac + esac + + # Now compile the dynamic symbol file. + $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" + $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? + + # Clean up the generated files. + $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" + $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" + + # Transform the symbol file into the correct name. + case $host in + *cygwin* | *mingw* ) + if test -f "$output_objdir/${outputname}.def" ; then + compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` + else + compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + fi + ;; + * ) + compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + ;; + esac + ;; + *) + $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 + exit $EXIT_FAILURE + ;; + esac + else + # We keep going just in case the user didn't refer to + # lt_preloaded_symbols. The linker will fail if global_symbol_pipe + # really was required. + + # Nullify the symbol file. + compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` + fi + + if test "$need_relink" = no || test "$build_libtool_libs" != yes; then + # Replace the output file specification. + compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + link_command="$compile_command$compile_rpath" + + # We have no uninstalled library dependencies, so finalize right now. + $show "$link_command" + $run eval "$link_command" + exit_status=$? + + # Delete the generated files. + if test -n "$dlsyms"; then + $show "$rm $output_objdir/${outputname}S.${objext}" + $run $rm "$output_objdir/${outputname}S.${objext}" + fi + + exit $exit_status + fi + + if test -n "$shlibpath_var"; then + # We should set the shlibpath_var + rpath= + for dir in $temp_rpath; do + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) + # Absolute path. + rpath="$rpath$dir:" + ;; + *) + # Relative path: add a thisdir entry. + rpath="$rpath\$thisdir/$dir:" + ;; + esac + done + temp_rpath="$rpath" + fi + + if test -n "$compile_shlibpath$finalize_shlibpath"; then + compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" + fi + if test -n "$finalize_shlibpath"; then + finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" + fi + + compile_var= + finalize_var= + if test -n "$runpath_var"; then + if test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + rpath="$rpath$dir:" + done + compile_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + if test -n "$finalize_perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $finalize_perm_rpath; do + rpath="$rpath$dir:" + done + finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + fi + + if test "$no_install" = yes; then + # We don't need to create a wrapper script. + link_command="$compile_var$compile_command$compile_rpath" + # Replace the output file specification. + link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + # Delete the old output file. + $run $rm $output + # Link the executable and exit + $show "$link_command" + $run eval "$link_command" || exit $? + exit $EXIT_SUCCESS + fi + + if test "$hardcode_action" = relink; then + # Fast installation is not supported + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + + $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 + $echo "$modename: \`$output' will be relinked during installation" 1>&2 + else + if test "$fast_install" != no; then + link_command="$finalize_var$compile_command$finalize_rpath" + if test "$fast_install" = yes; then + relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` + else + # fast_install is set to needless + relink_command= + fi + else + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + fi + fi + + # Replace the output file specification. + link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` + + # Delete the old output files. + $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname + + $show "$link_command" + $run eval "$link_command" || exit $? + + # Now create the wrapper script. + $show "creating $output" + + # Quote the relink command for shipping. + if test -n "$relink_command"; then + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` + relink_command="$var=\"$var_value\"; export $var; $relink_command" + fi + done + relink_command="(cd `pwd`; $relink_command)" + relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` + fi + + # Quote $echo for shipping. + if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then + case $progpath in + [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; + *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; + esac + qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` + else + qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` + fi + + # Only actually do things if our run command is non-null. + if test -z "$run"; then + # win32 will think the script is a binary if it has + # a .exe suffix, so we strip it off here. + case $output in + *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; + esac + # test for cygwin because mv fails w/o .exe extensions + case $host in + *cygwin*) + exeext=.exe + outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; + *) exeext= ;; + esac + case $host in + *cygwin* | *mingw* ) + output_name=`basename $output` + output_path=`dirname $output` + cwrappersource="$output_path/$objdir/lt-$output_name.c" + cwrapper="$output_path/$output_name.exe" + $rm $cwrappersource $cwrapper + trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 + + cat > $cwrappersource <> $cwrappersource<<"EOF" +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if defined(PATH_MAX) +# define LT_PATHMAX PATH_MAX +#elif defined(MAXPATHLEN) +# define LT_PATHMAX MAXPATHLEN +#else +# define LT_PATHMAX 1024 +#endif + +#ifndef DIR_SEPARATOR +# define DIR_SEPARATOR '/' +# define PATH_SEPARATOR ':' +#endif + +#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ + defined (__OS2__) +# define HAVE_DOS_BASED_FILE_SYSTEM +# ifndef DIR_SEPARATOR_2 +# define DIR_SEPARATOR_2 '\\' +# endif +# ifndef PATH_SEPARATOR_2 +# define PATH_SEPARATOR_2 ';' +# endif +#endif + +#ifndef DIR_SEPARATOR_2 +# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) +#else /* DIR_SEPARATOR_2 */ +# define IS_DIR_SEPARATOR(ch) \ + (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) +#endif /* DIR_SEPARATOR_2 */ + +#ifndef PATH_SEPARATOR_2 +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) +#else /* PATH_SEPARATOR_2 */ +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) +#endif /* PATH_SEPARATOR_2 */ + +#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) +#define XFREE(stale) do { \ + if (stale) { free ((void *) stale); stale = 0; } \ +} while (0) + +/* -DDEBUG is fairly common in CFLAGS. */ +#undef DEBUG +#if defined DEBUGWRAPPER +# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__) +#else +# define DEBUG(format, ...) +#endif + +const char *program_name = NULL; + +void * xmalloc (size_t num); +char * xstrdup (const char *string); +const char * base_name (const char *name); +char * find_executable(const char *wrapper); +int check_executable(const char *path); +char * strendzap(char *str, const char *pat); +void lt_fatal (const char *message, ...); + +int +main (int argc, char *argv[]) +{ + char **newargz; + int i; + + program_name = (char *) xstrdup (base_name (argv[0])); + DEBUG("(main) argv[0] : %s\n",argv[0]); + DEBUG("(main) program_name : %s\n",program_name); + newargz = XMALLOC(char *, argc+2); +EOF + + cat >> $cwrappersource <> $cwrappersource <<"EOF" + newargz[1] = find_executable(argv[0]); + if (newargz[1] == NULL) + lt_fatal("Couldn't find %s", argv[0]); + DEBUG("(main) found exe at : %s\n",newargz[1]); + /* we know the script has the same name, without the .exe */ + /* so make sure newargz[1] doesn't end in .exe */ + strendzap(newargz[1],".exe"); + for (i = 1; i < argc; i++) + newargz[i+1] = xstrdup(argv[i]); + newargz[argc+1] = NULL; + + for (i=0; i> $cwrappersource <> $cwrappersource <> $cwrappersource <<"EOF" + return 127; +} + +void * +xmalloc (size_t num) +{ + void * p = (void *) malloc (num); + if (!p) + lt_fatal ("Memory exhausted"); + + return p; +} + +char * +xstrdup (const char *string) +{ + return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL +; +} + +const char * +base_name (const char *name) +{ + const char *base; + +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + /* Skip over the disk name in MSDOS pathnames. */ + if (isalpha ((unsigned char)name[0]) && name[1] == ':') + name += 2; +#endif + + for (base = name; *name; name++) + if (IS_DIR_SEPARATOR (*name)) + base = name + 1; + return base; +} + +int +check_executable(const char * path) +{ + struct stat st; + + DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!"); + if ((!path) || (!*path)) + return 0; + + if ((stat (path, &st) >= 0) && + ( + /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */ +#if defined (S_IXOTH) + ((st.st_mode & S_IXOTH) == S_IXOTH) || +#endif +#if defined (S_IXGRP) + ((st.st_mode & S_IXGRP) == S_IXGRP) || +#endif + ((st.st_mode & S_IXUSR) == S_IXUSR)) + ) + return 1; + else + return 0; +} + +/* Searches for the full path of the wrapper. Returns + newly allocated full path name if found, NULL otherwise */ +char * +find_executable (const char* wrapper) +{ + int has_slash = 0; + const char* p; + const char* p_next; + /* static buffer for getcwd */ + char tmp[LT_PATHMAX + 1]; + int tmp_len; + char* concat_name; + + DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"); + + if ((wrapper == NULL) || (*wrapper == '\0')) + return NULL; + + /* Absolute path? */ +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':') + { + concat_name = xstrdup (wrapper); + if (check_executable(concat_name)) + return concat_name; + XFREE(concat_name); + } + else + { +#endif + if (IS_DIR_SEPARATOR (wrapper[0])) + { + concat_name = xstrdup (wrapper); + if (check_executable(concat_name)) + return concat_name; + XFREE(concat_name); + } +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + } +#endif + + for (p = wrapper; *p; p++) + if (*p == '/') + { + has_slash = 1; + break; + } + if (!has_slash) + { + /* no slashes; search PATH */ + const char* path = getenv ("PATH"); + if (path != NULL) + { + for (p = path; *p; p = p_next) + { + const char* q; + size_t p_len; + for (q = p; *q; q++) + if (IS_PATH_SEPARATOR(*q)) + break; + p_len = q - p; + p_next = (*q == '\0' ? q : q + 1); + if (p_len == 0) + { + /* empty path: current directory */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal ("getcwd failed"); + tmp_len = strlen(tmp); + concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + } + else + { + concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1); + memcpy (concat_name, p, p_len); + concat_name[p_len] = '/'; + strcpy (concat_name + p_len + 1, wrapper); + } + if (check_executable(concat_name)) + return concat_name; + XFREE(concat_name); + } + } + /* not found in PATH; assume curdir */ + } + /* Relative path | not found in path: prepend cwd */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal ("getcwd failed"); + tmp_len = strlen(tmp); + concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + + if (check_executable(concat_name)) + return concat_name; + XFREE(concat_name); + return NULL; +} + +char * +strendzap(char *str, const char *pat) +{ + size_t len, patlen; + + assert(str != NULL); + assert(pat != NULL); + + len = strlen(str); + patlen = strlen(pat); + + if (patlen <= len) + { + str += len - patlen; + if (strcmp(str, pat) == 0) + *str = '\0'; + } + return str; +} + +static void +lt_error_core (int exit_status, const char * mode, + const char * message, va_list ap) +{ + fprintf (stderr, "%s: %s: ", program_name, mode); + vfprintf (stderr, message, ap); + fprintf (stderr, ".\n"); + + if (exit_status >= 0) + exit (exit_status); +} + +void +lt_fatal (const char *message, ...) +{ + va_list ap; + va_start (ap, message); + lt_error_core (EXIT_FAILURE, "FATAL", message, ap); + va_end (ap); +} +EOF + # we should really use a build-platform specific compiler + # here, but OTOH, the wrappers (shell script and this C one) + # are only useful if you want to execute the "real" binary. + # Since the "real" binary is built for $host, then this + # wrapper might as well be built for $host, too. + $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource + ;; + esac + $rm $output + trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 + + $echo > $output "\ +#! $SHELL + +# $output - temporary wrapper script for $objdir/$outputname +# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP +# +# The $output program cannot be directly executed until all the libtool +# libraries that it depends on are installed. +# +# This wrapper script should never be moved out of the build directory. +# If it is, it will not operate correctly. + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='${SED} -e 1s/^X//' +sed_quote_subst='$sed_quote_subst' + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +relink_command=\"$relink_command\" + +# This environment variable determines our operation mode. +if test \"\$libtool_install_magic\" = \"$magic\"; then + # install mode needs the following variable: + notinst_deplibs='$notinst_deplibs' +else + # When we are sourced in execute mode, \$file and \$echo are already set. + if test \"\$libtool_execute_magic\" != \"$magic\"; then + echo=\"$qecho\" + file=\"\$0\" + # Make sure echo works. + if test \"X\$1\" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift + elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then + # Yippee, \$echo works! + : + else + # Restart under the correct shell, and then maybe \$echo will work. + exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} + fi + fi\ +" + $echo >> $output "\ + + # Find the directory that this script lives in. + thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` + test \"x\$thisdir\" = \"x\$file\" && thisdir=. + + # Follow symbolic links until we get to the real thisdir. + file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` + while test -n \"\$file\"; do + destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` + + # If there was a directory component, then change thisdir. + if test \"x\$destdir\" != \"x\$file\"; then + case \"\$destdir\" in + [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; + *) thisdir=\"\$thisdir/\$destdir\" ;; + esac + fi + + file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` + file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` + done + + # Try to get the absolute directory name. + absdir=\`cd \"\$thisdir\" && pwd\` + test -n \"\$absdir\" && thisdir=\"\$absdir\" +" + + if test "$fast_install" = yes; then + $echo >> $output "\ + program=lt-'$outputname'$exeext + progdir=\"\$thisdir/$objdir\" + + if test ! -f \"\$progdir/\$program\" || \\ + { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ + test \"X\$file\" != \"X\$progdir/\$program\"; }; then + + file=\"\$\$-\$program\" + + if test ! -d \"\$progdir\"; then + $mkdir \"\$progdir\" + else + $rm \"\$progdir/\$file\" + fi" + + $echo >> $output "\ + + # relink executable if necessary + if test -n \"\$relink_command\"; then + if relink_command_output=\`eval \$relink_command 2>&1\`; then : + else + $echo \"\$relink_command_output\" >&2 + $rm \"\$progdir/\$file\" + exit $EXIT_FAILURE + fi + fi + + $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || + { $rm \"\$progdir/\$program\"; + $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } + $rm \"\$progdir/\$file\" + fi" + else + $echo >> $output "\ + program='$outputname' + progdir=\"\$thisdir/$objdir\" +" + fi + + $echo >> $output "\ + + if test -f \"\$progdir/\$program\"; then" + + # Export our shlibpath_var if we have one. + if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then + $echo >> $output "\ + # Add our own library path to $shlibpath_var + $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" + + # Some systems cannot cope with colon-terminated $shlibpath_var + # The second colon is a workaround for a bug in BeOS R4 sed + $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` + + export $shlibpath_var +" + fi + + # fixup the dll searchpath if we need to. + if test -n "$dllsearchpath"; then + $echo >> $output "\ + # Add the dll search path components to the executable PATH + PATH=$dllsearchpath:\$PATH +" + fi + + $echo >> $output "\ + if test \"\$libtool_execute_magic\" != \"$magic\"; then + # Run the actual program with our arguments. +" + case $host in + # Backslashes separate directories on plain windows + *-*-mingw | *-*-os2*) + $echo >> $output "\ + exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} +" + ;; + + *) + $echo >> $output "\ + exec \"\$progdir/\$program\" \${1+\"\$@\"} +" + ;; + esac + $echo >> $output "\ + \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" + exit $EXIT_FAILURE + fi + else + # The program doesn't exist. + \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 + \$echo \"This script is just a wrapper for \$program.\" 1>&2 + $echo \"See the $PACKAGE documentation for more information.\" 1>&2 + exit $EXIT_FAILURE + fi +fi\ +" + chmod +x $output + fi + exit $EXIT_SUCCESS + ;; + esac + + # See if we need to build an old-fashioned archive. + for oldlib in $oldlibs; do + + if test "$build_libtool_libs" = convenience; then + oldobjs="$libobjs_save" + addlibs="$convenience" + build_libtool_libs=no + else + if test "$build_libtool_libs" = module; then + oldobjs="$libobjs_save" + build_libtool_libs=no + else + oldobjs="$old_deplibs $non_pic_objects" + fi + addlibs="$old_convenience" + fi + + if test -n "$addlibs"; then + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + + func_extract_archives $gentop $addlibs + oldobjs="$oldobjs $func_extract_archives_result" + fi + + # Do each command in the archive commands. + if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then + cmds=$old_archive_from_new_cmds + else + # POSIX demands no paths to be encoded in archives. We have + # to avoid creating archives with duplicate basenames if we + # might have to extract them afterwards, e.g., when creating a + # static archive out of a convenience library, or when linking + # the entirety of a libtool archive into another (currently + # not supported by libtool). + if (for obj in $oldobjs + do + $echo "X$obj" | $Xsed -e 's%^.*/%%' + done | sort | sort -uc >/dev/null 2>&1); then + : + else + $echo "copying selected object files to avoid basename conflicts..." + + if test -z "$gentop"; then + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "$mkdir $gentop" + $run $mkdir "$gentop" + exit_status=$? + if test "$exit_status" -ne 0 && test ! -d "$gentop"; then + exit $exit_status + fi + fi + + save_oldobjs=$oldobjs + oldobjs= + counter=1 + for obj in $save_oldobjs + do + objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` + case " $oldobjs " in + " ") oldobjs=$obj ;; + *[\ /]"$objbase "*) + while :; do + # Make sure we don't pick an alternate name that also + # overlaps. + newobj=lt$counter-$objbase + counter=`expr $counter + 1` + case " $oldobjs " in + *[\ /]"$newobj "*) ;; + *) if test ! -f "$gentop/$newobj"; then break; fi ;; + esac + done + $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" + $run ln "$obj" "$gentop/$newobj" || + $run cp "$obj" "$gentop/$newobj" + oldobjs="$oldobjs $gentop/$newobj" + ;; + *) oldobjs="$oldobjs $obj" ;; + esac + done + fi + + eval cmds=\"$old_archive_cmds\" + + if len=`expr "X$cmds" : ".*"` && + test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then + cmds=$old_archive_cmds + else + # the command line is too long to link in one step, link in parts + $echo "using piecewise archive linking..." + save_RANLIB=$RANLIB + RANLIB=: + objlist= + concat_cmds= + save_oldobjs=$oldobjs + + # Is there a better way of finding the last object in the list? + for obj in $save_oldobjs + do + last_oldobj=$obj + done + for obj in $save_oldobjs + do + oldobjs="$objlist $obj" + objlist="$objlist $obj" + eval test_cmds=\"$old_archive_cmds\" + if len=`expr "X$test_cmds" : ".*" 2>/dev/null` && + test "$len" -le "$max_cmd_len"; then + : + else + # the above command should be used before it gets too long + oldobjs=$objlist + if test "$obj" = "$last_oldobj" ; then + RANLIB=$save_RANLIB + fi + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" + objlist= + fi + done + RANLIB=$save_RANLIB + oldobjs=$objlist + if test "X$oldobjs" = "X" ; then + eval cmds=\"\$concat_cmds\" + else + eval cmds=\"\$concat_cmds~\$old_archive_cmds\" + fi + fi + fi + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + eval cmd=\"$cmd\" + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + done + + if test -n "$generated"; then + $show "${rm}r$generated" + $run ${rm}r$generated + fi + + # Now create the libtool archive. + case $output in + *.la) + old_library= + test "$build_old_libs" = yes && old_library="$libname.$libext" + $show "creating $output" + + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` + relink_command="$var=\"$var_value\"; export $var; $relink_command" + fi + done + # Quote the link command for shipping. + relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" + relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` + if test "$hardcode_automatic" = yes ; then + relink_command= + fi + + + # Only create the output if not a dry run. + if test -z "$run"; then + for installed in no yes; do + if test "$installed" = yes; then + if test -z "$install_libdir"; then + break + fi + output="$output_objdir/$outputname"i + # Replace all uninstalled libtool libraries with the installed ones + newdependency_libs= + for deplib in $dependency_libs; do + case $deplib in + *.la) + name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + if test -z "$libdir"; then + $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 + exit $EXIT_FAILURE + fi + newdependency_libs="$newdependency_libs $libdir/$name" + ;; + *) newdependency_libs="$newdependency_libs $deplib" ;; + esac + done + dependency_libs="$newdependency_libs" + newdlfiles= + for lib in $dlfiles; do + name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + if test -z "$libdir"; then + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + exit $EXIT_FAILURE + fi + newdlfiles="$newdlfiles $libdir/$name" + done + dlfiles="$newdlfiles" + newdlprefiles= + for lib in $dlprefiles; do + name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + if test -z "$libdir"; then + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + exit $EXIT_FAILURE + fi + newdlprefiles="$newdlprefiles $libdir/$name" + done + dlprefiles="$newdlprefiles" + else + newdlfiles= + for lib in $dlfiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; + *) abs=`pwd`"/$lib" ;; + esac + newdlfiles="$newdlfiles $abs" + done + dlfiles="$newdlfiles" + newdlprefiles= + for lib in $dlprefiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; + *) abs=`pwd`"/$lib" ;; + esac + newdlprefiles="$newdlprefiles $abs" + done + dlprefiles="$newdlprefiles" + fi + $rm $output + # place dlname in correct position for cygwin + tdlname=$dlname + case $host,$output,$installed,$module,$dlname in + *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; + esac + $echo > $output "\ +# $outputname - a libtool library file +# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='$tdlname' + +# Names of this library. +library_names='$library_names' + +# The name of the static archive. +old_library='$old_library' + +# Libraries that this one depends upon. +dependency_libs='$dependency_libs' + +# Version information for $libname. +current=$current +age=$age +revision=$revision + +# Is this an already installed library? +installed=$installed + +# Should we warn about portability when linking against -modules? +shouldnotlink=$module + +# Files to dlopen/dlpreopen +dlopen='$dlfiles' +dlpreopen='$dlprefiles' + +# Directory that this library needs to be installed in: +libdir='$install_libdir'" + if test "$installed" = no && test "$need_relink" = yes; then + $echo >> $output "\ +relink_command=\"$relink_command\"" + fi + done + fi + + # Do a symbolic link so that the libtool archive can be found in + # LD_LIBRARY_PATH before the program is installed. + $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" + $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? + ;; + esac + exit $EXIT_SUCCESS + ;; + + # libtool install mode + install) + modename="$modename: install" + + # There may be an optional sh(1) argument at the beginning of + # install_prog (especially on Windows NT). + if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || + # Allow the use of GNU shtool's install command. + $echo "X$nonopt" | grep shtool > /dev/null; then + # Aesthetically quote it. + arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + install_prog="$arg " + arg="$1" + shift + else + install_prog= + arg=$nonopt + fi + + # The real first argument should be the name of the installation program. + # Aesthetically quote it. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + install_prog="$install_prog$arg" + + # We need to accept at least all the BSD install flags. + dest= + files= + opts= + prev= + install_type= + isdir=no + stripme= + for arg + do + if test -n "$dest"; then + files="$files $dest" + dest=$arg + continue + fi + + case $arg in + -d) isdir=yes ;; + -f) + case " $install_prog " in + *[\\\ /]cp\ *) ;; + *) prev=$arg ;; + esac + ;; + -g | -m | -o) prev=$arg ;; + -s) + stripme=" -s" + continue + ;; + -*) + ;; + *) + # If the previous option needed an argument, then skip it. + if test -n "$prev"; then + prev= + else + dest=$arg + continue + fi + ;; + esac + + # Aesthetically quote the argument. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + install_prog="$install_prog $arg" + done + + if test -z "$install_prog"; then + $echo "$modename: you must specify an install program" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + if test -n "$prev"; then + $echo "$modename: the \`$prev' option requires an argument" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + if test -z "$files"; then + if test -z "$dest"; then + $echo "$modename: no file or destination specified" 1>&2 + else + $echo "$modename: you must specify a destination" 1>&2 + fi + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # Strip any trailing slash from the destination. + dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` + + # Check to see that the destination is a directory. + test -d "$dest" && isdir=yes + if test "$isdir" = yes; then + destdir="$dest" + destname= + else + destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` + test "X$destdir" = "X$dest" && destdir=. + destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` + + # Not a directory, so check to see that there is only one file specified. + set dummy $files + if test "$#" -gt 2; then + $echo "$modename: \`$dest' is not a directory" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + fi + case $destdir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + for file in $files; do + case $file in + *.lo) ;; + *) + $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + ;; + esac + done + ;; + esac + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + staticlibs= + future_libdirs= + current_libdirs= + for file in $files; do + + # Do each installation. + case $file in + *.$libext) + # Do the static libraries later. + staticlibs="$staticlibs $file" + ;; + + *.la) + # Check to see that this really is a libtool archive. + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + library_names= + old_library= + relink_command= + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Add the libdir to current_libdirs if it is the destination. + if test "X$destdir" = "X$libdir"; then + case "$current_libdirs " in + *" $libdir "*) ;; + *) current_libdirs="$current_libdirs $libdir" ;; + esac + else + # Note the libdir as a future libdir. + case "$future_libdirs " in + *" $libdir "*) ;; + *) future_libdirs="$future_libdirs $libdir" ;; + esac + fi + + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ + test "X$dir" = "X$file/" && dir= + dir="$dir$objdir" + + if test -n "$relink_command"; then + # Determine the prefix the user has applied to our future dir. + inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` + + # Don't allow the user to place us outside of our expected + # location b/c this prevents finding dependent libraries that + # are installed to the same prefix. + # At present, this check doesn't affect windows .dll's that + # are installed into $libdir/../bin (currently, that works fine) + # but it's something to keep an eye on. + if test "$inst_prefix_dir" = "$destdir"; then + $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 + exit $EXIT_FAILURE + fi + + if test -n "$inst_prefix_dir"; then + # Stick the inst_prefix_dir data into the link command. + relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` + else + relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` + fi + + $echo "$modename: warning: relinking \`$file'" 1>&2 + $show "$relink_command" + if $run eval "$relink_command"; then : + else + $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 + exit $EXIT_FAILURE + fi + fi + + # See the names of the shared library. + set dummy $library_names + if test -n "$2"; then + realname="$2" + shift + shift + + srcname="$realname" + test -n "$relink_command" && srcname="$realname"T + + # Install the shared library and build the symlinks. + $show "$install_prog $dir/$srcname $destdir/$realname" + $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? + if test -n "$stripme" && test -n "$striplib"; then + $show "$striplib $destdir/$realname" + $run eval "$striplib $destdir/$realname" || exit $? + fi + + if test "$#" -gt 0; then + # Delete the old symlinks, and create new ones. + # Try `ln -sf' first, because the `ln' binary might depend on + # the symlink we replace! Solaris /bin/ln does not understand -f, + # so we also need to try rm && ln -s. + for linkname + do + if test "$linkname" != "$realname"; then + $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" + $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" + fi + done + fi + + # Do each command in the postinstall commands. + lib="$destdir/$realname" + cmds=$postinstall_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || { + lt_exit=$? + + # Restore the uninstalled library and exit + if test "$mode" = relink; then + $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' + fi + + exit $lt_exit + } + done + IFS="$save_ifs" + fi + + # Install the pseudo-library for information purposes. + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + instname="$dir/$name"i + $show "$install_prog $instname $destdir/$name" + $run eval "$install_prog $instname $destdir/$name" || exit $? + + # Maybe install the static library, too. + test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" + ;; + + *.lo) + # Install (i.e. copy) a libtool object. + + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + destfile="$destdir/$destfile" + fi + + # Deduce the name of the destination old-style object file. + case $destfile in + *.lo) + staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` + ;; + *.$objext) + staticdest="$destfile" + destfile= + ;; + *) + $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + # Install the libtool object if requested. + if test -n "$destfile"; then + $show "$install_prog $file $destfile" + $run eval "$install_prog $file $destfile" || exit $? + fi + + # Install the old object if enabled. + if test "$build_old_libs" = yes; then + # Deduce the name of the old-style object file. + staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` + + $show "$install_prog $staticobj $staticdest" + $run eval "$install_prog \$staticobj \$staticdest" || exit $? + fi + exit $EXIT_SUCCESS + ;; + + *) + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + destfile="$destdir/$destfile" + fi + + # If the file is missing, and there is a .exe on the end, strip it + # because it is most likely a libtool script we actually want to + # install + stripped_ext="" + case $file in + *.exe) + if test ! -f "$file"; then + file=`$echo $file|${SED} 's,.exe$,,'` + stripped_ext=".exe" + fi + ;; + esac + + # Do a test to see if this is really a libtool program. + case $host in + *cygwin*|*mingw*) + wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` + ;; + *) + wrapper=$file + ;; + esac + if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then + notinst_deplibs= + relink_command= + + # Note that it is not necessary on cygwin/mingw to append a dot to + # foo even if both foo and FILE.exe exist: automatic-append-.exe + # behavior happens only for exec(3), not for open(2)! Also, sourcing + # `FILE.' does not work on cygwin managed mounts. + # + # If there is no directory component, then add one. + case $wrapper in + */* | *\\*) . ${wrapper} ;; + *) . ./${wrapper} ;; + esac + + # Check the variables that should have been set. + if test -z "$notinst_deplibs"; then + $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 + exit $EXIT_FAILURE + fi + + finalize=yes + for lib in $notinst_deplibs; do + # Check to see that each library is installed. + libdir= + if test -f "$lib"; then + # If there is no directory component, then add one. + case $lib in + */* | *\\*) . $lib ;; + *) . ./$lib ;; + esac + fi + libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test + if test -n "$libdir" && test ! -f "$libfile"; then + $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 + finalize=no + fi + done + + relink_command= + # Note that it is not necessary on cygwin/mingw to append a dot to + # foo even if both foo and FILE.exe exist: automatic-append-.exe + # behavior happens only for exec(3), not for open(2)! Also, sourcing + # `FILE.' does not work on cygwin managed mounts. + # + # If there is no directory component, then add one. + case $wrapper in + */* | *\\*) . ${wrapper} ;; + *) . ./${wrapper} ;; + esac + + outputname= + if test "$fast_install" = no && test -n "$relink_command"; then + if test "$finalize" = yes && test -z "$run"; then + tmpdir=`func_mktempdir` + file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` + outputname="$tmpdir/$file" + # Replace the output file specification. + relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` + + $show "$relink_command" + if $run eval "$relink_command"; then : + else + $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 + ${rm}r "$tmpdir" + continue + fi + file="$outputname" + else + $echo "$modename: warning: cannot relink \`$file'" 1>&2 + fi + else + # Install the binary that we compiled earlier. + file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` + fi + fi + + # remove .exe since cygwin /usr/bin/install will append another + # one anyway + case $install_prog,$host in + */usr/bin/install*,*cygwin*) + case $file:$destfile in + *.exe:*.exe) + # this is ok + ;; + *.exe:*) + destfile=$destfile.exe + ;; + *:*.exe) + destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` + ;; + esac + ;; + esac + $show "$install_prog$stripme $file $destfile" + $run eval "$install_prog\$stripme \$file \$destfile" || exit $? + test -n "$outputname" && ${rm}r "$tmpdir" + ;; + esac + done + + for file in $staticlibs; do + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + + # Set up the ranlib parameters. + oldlib="$destdir/$name" + + $show "$install_prog $file $oldlib" + $run eval "$install_prog \$file \$oldlib" || exit $? + + if test -n "$stripme" && test -n "$old_striplib"; then + $show "$old_striplib $oldlib" + $run eval "$old_striplib $oldlib" || exit $? + fi + + # Do each command in the postinstall commands. + cmds=$old_postinstall_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + done + + if test -n "$future_libdirs"; then + $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 + fi + + if test -n "$current_libdirs"; then + # Maybe just do a dry run. + test -n "$run" && current_libdirs=" -n$current_libdirs" + exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' + else + exit $EXIT_SUCCESS + fi + ;; + + # libtool finish mode + finish) + modename="$modename: finish" + libdirs="$nonopt" + admincmds= + + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + for dir + do + libdirs="$libdirs $dir" + done + + for libdir in $libdirs; do + if test -n "$finish_cmds"; then + # Do each command in the finish commands. + cmds=$finish_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || admincmds="$admincmds + $cmd" + done + IFS="$save_ifs" + fi + if test -n "$finish_eval"; then + # Do the single finish_eval. + eval cmds=\"$finish_eval\" + $run eval "$cmds" || admincmds="$admincmds + $cmds" + fi + done + fi + + # Exit here if they wanted silent mode. + test "$show" = : && exit $EXIT_SUCCESS + + $echo "X----------------------------------------------------------------------" | $Xsed + $echo "Libraries have been installed in:" + for libdir in $libdirs; do + $echo " $libdir" + done + $echo + $echo "If you ever happen to want to link against installed libraries" + $echo "in a given directory, LIBDIR, you must either use libtool, and" + $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" + $echo "flag during linking and do at least one of the following:" + if test -n "$shlibpath_var"; then + $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" + $echo " during execution" + fi + if test -n "$runpath_var"; then + $echo " - add LIBDIR to the \`$runpath_var' environment variable" + $echo " during linking" + fi + if test -n "$hardcode_libdir_flag_spec"; then + libdir=LIBDIR + eval flag=\"$hardcode_libdir_flag_spec\" + + $echo " - use the \`$flag' linker flag" + fi + if test -n "$admincmds"; then + $echo " - have your system administrator run these commands:$admincmds" + fi + if test -f /etc/ld.so.conf; then + $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" + fi + $echo + $echo "See any operating system documentation about shared libraries for" + $echo "more information, such as the ld(1) and ld.so(8) manual pages." + $echo "X----------------------------------------------------------------------" | $Xsed + exit $EXIT_SUCCESS + ;; + + # libtool execute mode + execute) + modename="$modename: execute" + + # The first argument is the command name. + cmd="$nonopt" + if test -z "$cmd"; then + $echo "$modename: you must specify a COMMAND" 1>&2 + $echo "$help" + exit $EXIT_FAILURE + fi + + # Handle -dlopen flags immediately. + for file in $execute_dlfiles; do + if test ! -f "$file"; then + $echo "$modename: \`$file' is not a file" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + dir= + case $file in + *.la) + # Check to see that this really is a libtool archive. + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # Read the libtool library. + dlname= + library_names= + + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Skip this library if it cannot be dlopened. + if test -z "$dlname"; then + # Warn if it was a shared library. + test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" + continue + fi + + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$file" && dir=. + + if test -f "$dir/$objdir/$dlname"; then + dir="$dir/$objdir" + else + $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 + exit $EXIT_FAILURE + fi + ;; + + *.lo) + # Just add the directory containing the .lo file. + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$file" && dir=. + ;; + + *) + $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 + continue + ;; + esac + + # Get the absolute pathname. + absdir=`cd "$dir" && pwd` + test -n "$absdir" && dir="$absdir" + + # Now add the directory to shlibpath_var. + if eval "test -z \"\$$shlibpath_var\""; then + eval "$shlibpath_var=\"\$dir\"" + else + eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" + fi + done + + # This variable tells wrapper scripts just to set shlibpath_var + # rather than running their programs. + libtool_execute_magic="$magic" + + # Check if any of the arguments is a wrapper script. + args= + for file + do + case $file in + -*) ;; + *) + # Do a test to see if this is really a libtool program. + if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Transform arg to wrapped name. + file="$progdir/$program" + fi + ;; + esac + # Quote arguments (to preserve shell metacharacters). + file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` + args="$args \"$file\"" + done + + if test -z "$run"; then + if test -n "$shlibpath_var"; then + # Export the shlibpath_var. + eval "export $shlibpath_var" + fi + + # Restore saved environment variables + if test "${save_LC_ALL+set}" = set; then + LC_ALL="$save_LC_ALL"; export LC_ALL + fi + if test "${save_LANG+set}" = set; then + LANG="$save_LANG"; export LANG + fi + + # Now prepare to actually exec the command. + exec_cmd="\$cmd$args" + else + # Display what would be done. + if test -n "$shlibpath_var"; then + eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" + $echo "export $shlibpath_var" + fi + $echo "$cmd$args" + exit $EXIT_SUCCESS + fi + ;; + + # libtool clean and uninstall mode + clean | uninstall) + modename="$modename: $mode" + rm="$nonopt" + files= + rmforce= + exit_status=0 + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + for arg + do + case $arg in + -f) rm="$rm $arg"; rmforce=yes ;; + -*) rm="$rm $arg" ;; + *) files="$files $arg" ;; + esac + done + + if test -z "$rm"; then + $echo "$modename: you must specify an RM program" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + fi + + rmdirs= + + origobjdir="$objdir" + for file in $files; do + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + if test "X$dir" = "X$file"; then + dir=. + objdir="$origobjdir" + else + objdir="$dir/$origobjdir" + fi + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + test "$mode" = uninstall && objdir="$dir" + + # Remember objdir for removal later, being careful to avoid duplicates + if test "$mode" = clean; then + case " $rmdirs " in + *" $objdir "*) ;; + *) rmdirs="$rmdirs $objdir" ;; + esac + fi + + # Don't error if the file doesn't exist and rm -f was used. + if (test -L "$file") >/dev/null 2>&1 \ + || (test -h "$file") >/dev/null 2>&1 \ + || test -f "$file"; then + : + elif test -d "$file"; then + exit_status=1 + continue + elif test "$rmforce" = yes; then + continue + fi + + rmfiles="$file" + + case $name in + *.la) + # Possibly a libtool archive, so verify it. + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + . $dir/$name + + # Delete the libtool libraries and symlinks. + for n in $library_names; do + rmfiles="$rmfiles $objdir/$n" + done + test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" + + case "$mode" in + clean) + case " $library_names " in + # " " in the beginning catches empty $dlname + *" $dlname "*) ;; + *) rmfiles="$rmfiles $objdir/$dlname" ;; + esac + test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" + ;; + uninstall) + if test -n "$library_names"; then + # Do each command in the postuninstall commands. + cmds=$postuninstall_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" + if test "$?" -ne 0 && test "$rmforce" != yes; then + exit_status=1 + fi + done + IFS="$save_ifs" + fi + + if test -n "$old_library"; then + # Do each command in the old_postuninstall commands. + cmds=$old_postuninstall_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" + if test "$?" -ne 0 && test "$rmforce" != yes; then + exit_status=1 + fi + done + IFS="$save_ifs" + fi + # FIXME: should reinstall the best remaining shared library. + ;; + esac + fi + ;; + + *.lo) + # Possibly a libtool object, so verify it. + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + + # Read the .lo file + . $dir/$name + + # Add PIC object to the list of files to remove. + if test -n "$pic_object" \ + && test "$pic_object" != none; then + rmfiles="$rmfiles $dir/$pic_object" + fi + + # Add non-PIC object to the list of files to remove. + if test -n "$non_pic_object" \ + && test "$non_pic_object" != none; then + rmfiles="$rmfiles $dir/$non_pic_object" + fi + fi + ;; + + *) + if test "$mode" = clean ; then + noexename=$name + case $file in + *.exe) + file=`$echo $file|${SED} 's,.exe$,,'` + noexename=`$echo $name|${SED} 's,.exe$,,'` + # $file with .exe has already been added to rmfiles, + # add $file without .exe + rmfiles="$rmfiles $file" + ;; + esac + # Do a test to see if this is a libtool program. + if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + relink_command= + . $dir/$noexename + + # note $name still contains .exe if it was in $file originally + # as does the version of $file that was added into $rmfiles + rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" + if test "$fast_install" = yes && test -n "$relink_command"; then + rmfiles="$rmfiles $objdir/lt-$name" + fi + if test "X$noexename" != "X$name" ; then + rmfiles="$rmfiles $objdir/lt-${noexename}.c" + fi + fi + fi + ;; + esac + $show "$rm $rmfiles" + $run $rm $rmfiles || exit_status=1 + done + objdir="$origobjdir" + + # Try to remove the ${objdir}s in the directories where we deleted files + for dir in $rmdirs; do + if test -d "$dir"; then + $show "rmdir $dir" + $run rmdir $dir >/dev/null 2>&1 + fi + done + + exit $exit_status + ;; + + "") + $echo "$modename: you must specify a MODE" 1>&2 + $echo "$generic_help" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + if test -z "$exec_cmd"; then + $echo "$modename: invalid operation mode \`$mode'" 1>&2 + $echo "$generic_help" 1>&2 + exit $EXIT_FAILURE + fi +fi # test -z "$show_help" + +if test -n "$exec_cmd"; then + eval exec $exec_cmd + exit $EXIT_FAILURE +fi + +# We need to display help for each of the modes. +case $mode in +"") $echo \ +"Usage: $modename [OPTION]... [MODE-ARG]... + +Provide generalized library-building support services. + + --config show all configuration variables + --debug enable verbose shell tracing +-n, --dry-run display commands without modifying any files + --features display basic configuration information and exit + --finish same as \`--mode=finish' + --help display this help message and exit + --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] + --quiet same as \`--silent' + --silent don't print informational messages + --tag=TAG use configuration variables from tag TAG + --version print version information + +MODE must be one of the following: + + clean remove files from the build directory + compile compile a source file into a libtool object + execute automatically set library path, then run a program + finish complete the installation of libtool libraries + install install libraries or executables + link create a library or an executable + uninstall remove libraries from an installed directory + +MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for +a more detailed description of MODE. + +Report bugs to ." + exit $EXIT_SUCCESS + ;; + +clean) + $echo \ +"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... + +Remove files from the build directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, object or program, all the files associated +with it are deleted. Otherwise, only FILE itself is deleted using RM." + ;; + +compile) + $echo \ +"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE + +Compile a source file into a libtool library object. + +This mode accepts the following additional options: + + -o OUTPUT-FILE set the output file name to OUTPUT-FILE + -prefer-pic try to building PIC objects only + -prefer-non-pic try to building non-PIC objects only + -static always build a \`.o' file suitable for static linking + +COMPILE-COMMAND is a command to be used in creating a \`standard' object file +from the given SOURCEFILE. + +The output file name is determined by removing the directory component from +SOURCEFILE, then substituting the C source code suffix \`.c' with the +library object suffix, \`.lo'." + ;; + +execute) + $echo \ +"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... + +Automatically set library path, then run a program. + +This mode accepts the following additional options: + + -dlopen FILE add the directory containing FILE to the library path + +This mode sets the library path environment variable according to \`-dlopen' +flags. + +If any of the ARGS are libtool executable wrappers, then they are translated +into their corresponding uninstalled binary, and any of their required library +directories are added to the library path. + +Then, COMMAND is executed, with ARGS as arguments." + ;; + +finish) + $echo \ +"Usage: $modename [OPTION]... --mode=finish [LIBDIR]... + +Complete the installation of libtool libraries. + +Each LIBDIR is a directory that contains libtool libraries. + +The commands that this mode executes may require superuser privileges. Use +the \`--dry-run' option if you just want to see what would be executed." + ;; + +install) + $echo \ +"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... + +Install executables or libraries. + +INSTALL-COMMAND is the installation command. The first component should be +either the \`install' or \`cp' program. + +The rest of the components are interpreted as arguments to that command (only +BSD-compatible install options are recognized)." + ;; + +link) + $echo \ +"Usage: $modename [OPTION]... --mode=link LINK-COMMAND... + +Link object files or libraries together to form another library, or to +create an executable program. + +LINK-COMMAND is a command using the C compiler that you would use to create +a program from several object files. + +The following components of LINK-COMMAND are treated specially: + + -all-static do not do any dynamic linking at all + -avoid-version do not add a version suffix if possible + -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime + -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols + -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) + -export-symbols SYMFILE + try to export only the symbols listed in SYMFILE + -export-symbols-regex REGEX + try to export only the symbols matching REGEX + -LLIBDIR search LIBDIR for required installed libraries + -lNAME OUTPUT-FILE requires the installed library libNAME + -module build a library that can dlopened + -no-fast-install disable the fast-install mode + -no-install link a not-installable executable + -no-undefined declare that a library does not refer to external symbols + -o OUTPUT-FILE create OUTPUT-FILE from the specified objects + -objectlist FILE Use a list of object files found in FILE to specify objects + -precious-files-regex REGEX + don't remove output files matching REGEX + -release RELEASE specify package release information + -rpath LIBDIR the created library will eventually be installed in LIBDIR + -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries + -static do not do any dynamic linking of libtool libraries + -version-info CURRENT[:REVISION[:AGE]] + specify library version info [each variable defaults to 0] + +All other options (arguments beginning with \`-') are ignored. + +Every other argument is treated as a filename. Files ending in \`.la' are +treated as uninstalled libtool libraries, other files are standard or library +object files. + +If the OUTPUT-FILE ends in \`.la', then a libtool library is created, +only library objects (\`.lo' files) may be specified, and \`-rpath' is +required, except when creating a convenience library. + +If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created +using \`ar' and \`ranlib', or on Windows using \`lib'. + +If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file +is created, otherwise an executable program is created." + ;; + +uninstall) + $echo \ +"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... + +Remove libraries from an installation directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, all the files associated with it are deleted. +Otherwise, only FILE itself is deleted using RM." + ;; + +*) + $echo "$modename: invalid operation mode \`$mode'" 1>&2 + $echo "$help" 1>&2 + exit $EXIT_FAILURE + ;; +esac + +$echo +$echo "Try \`$modename --help' for more information about other modes." + +exit $? + +# The TAGs below are defined such that we never get into a situation +# in which we disable both kinds of libraries. Given conflicting +# choices, we go for a static library, that is the most portable, +# since we can't tell whether shared libraries were disabled because +# the user asked for that or because the platform doesn't support +# them. This is particularly important on AIX, because we don't +# support having both static and shared libraries enabled at the same +# time on that platform, so we default to a shared-only configuration. +# If a disable-shared tag is given, we'll fallback to a static-only +# configuration. But we'll never go from static-only to shared-only. + +# ### BEGIN LIBTOOL TAG CONFIG: disable-shared +disable_libs=shared +# ### END LIBTOOL TAG CONFIG: disable-shared + +# ### BEGIN LIBTOOL TAG CONFIG: disable-static +disable_libs=static +# ### END LIBTOOL TAG CONFIG: disable-static + +# Local Variables: +# mode:shell-script +# sh-indentation:2 +# End: diff --git a/autoconf/m4/build_exeext.m4 b/autoconf/m4/build_exeext.m4 new file mode 100644 index 000000000..1bdecc1ba --- /dev/null +++ b/autoconf/m4/build_exeext.m4 @@ -0,0 +1,42 @@ +# Check for the extension used for executables on build platform. +# This is necessary for cross-compiling where the build platform +# may differ from the host platform. +AC_DEFUN([AC_BUILD_EXEEXT], +[ +AC_MSG_CHECKING([for executable suffix on build platform]) +AC_CACHE_VAL(ac_cv_build_exeext, +[if test "$CYGWIN" = yes || test "$MINGW32" = yes; then + ac_cv_build_exeext=.exe +else + ac_build_prefix=${build_alias}- + + AC_CHECK_PROG(BUILD_CC, ${ac_build_prefix}gcc, ${ac_build_prefix}gcc) + if test -z "$BUILD_CC"; then + AC_CHECK_PROG(BUILD_CC, gcc, gcc) + if test -z "$BUILD_CC"; then + AC_CHECK_PROG(BUILD_CC, cc, cc, , , /usr/ucb/cc) + fi + fi + test -z "$BUILD_CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH]) + ac_build_link='${BUILD_CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&AS_MESSAGE_LOG_FD' + rm -f conftest* + echo 'int main () { return 0; }' > conftest.$ac_ext + ac_cv_build_exeext= + if AC_TRY_EVAL(ac_build_link); then + for file in conftest.*; do + case $file in + *.c | *.o | *.obj | *.dSYM) ;; + *) ac_cv_build_exeext=`echo $file | sed -e s/conftest//` ;; + esac + done + else + AC_MSG_ERROR([installation or configuration problem: compiler cannot create executables.]) + fi + rm -f conftest* + test x"${ac_cv_build_exeext}" = x && ac_cv_build_exeext=blank +fi]) +BUILD_EXEEXT="" +test x"${ac_cv_build_exeext}" != xblank && BUILD_EXEEXT=${ac_cv_build_exeext} +AC_MSG_RESULT(${ac_cv_build_exeext}) +ac_build_exeext=$BUILD_EXEEXT +AC_SUBST(BUILD_EXEEXT)]) diff --git a/autoconf/m4/c_printf_a.m4 b/autoconf/m4/c_printf_a.m4 new file mode 100644 index 000000000..61bac8c9d --- /dev/null +++ b/autoconf/m4/c_printf_a.m4 @@ -0,0 +1,31 @@ +# +# Determine if the printf() functions have the %a format character. +# This is modified from: +# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_slist.html +AC_DEFUN([AC_C_PRINTF_A], +[AC_CACHE_CHECK([if printf has the %a format character],[llvm_cv_c_printf_a], +[AC_LANG_PUSH([C]) + AC_RUN_IFELSE([ + AC_LANG_PROGRAM([[ +#include +#include +]],[[ +volatile double A, B; +char Buffer[100]; +A = 1; +A /= 10.0; +sprintf(Buffer, "%a", A); +B = atof(Buffer); +if (A != B) + return (1); +if (A != 0x1.999999999999ap-4) + return (1); +return (0);]])], + llvm_cv_c_printf_a=yes, + llvmac_cv_c_printf_a=no, + llvmac_cv_c_printf_a=no) + AC_LANG_POP([C])]) + if test "$llvm_cv_c_printf_a" = "yes"; then + AC_DEFINE([HAVE_PRINTF_A],[1],[Define to have the %a format string]) + fi +]) diff --git a/autoconf/m4/check_gnu_make.m4 b/autoconf/m4/check_gnu_make.m4 new file mode 100644 index 000000000..7355e1c85 --- /dev/null +++ b/autoconf/m4/check_gnu_make.m4 @@ -0,0 +1,26 @@ +# +# Check for GNU Make. This is originally from +# http://www.gnu.org/software/ac-archive/htmldoc/check_gnu_make.html +# +AC_DEFUN([AC_CHECK_GNU_MAKE], +[AC_CACHE_CHECK([for GNU make],[llvm_cv_gnu_make_command], +dnl Search all the common names for GNU make +[llvm_cv_gnu_make_command='' + for a in "$MAKE" make gmake gnumake ; do + if test -z "$a" ; then continue ; fi ; + if ( sh -c "$a --version" 2> /dev/null | grep GNU 2>&1 > /dev/null ) + then + llvm_cv_gnu_make_command=$a ; + break; + fi + done]) +dnl If there was a GNU version, then set @ifGNUmake@ to the empty string, +dnl '#' otherwise + if test "x$llvm_cv_gnu_make_command" != "x" ; then + ifGNUmake='' ; + else + ifGNUmake='#' ; + AC_MSG_RESULT("Not found"); + fi + AC_SUBST(ifGNUmake) +]) diff --git a/autoconf/m4/config_makefile.m4 b/autoconf/m4/config_makefile.m4 new file mode 100644 index 000000000..b1eaffdcd --- /dev/null +++ b/autoconf/m4/config_makefile.m4 @@ -0,0 +1,9 @@ +# +# Configure a Makefile without clobbering it if it exists and is not out of +# date. This macro is unique to LLVM. +# +AC_DEFUN([AC_CONFIG_MAKEFILE], +[AC_CONFIG_COMMANDS($1, + [${llvm_src}/autoconf/mkinstalldirs `dirname $1` + ${SHELL} ${llvm_src}/autoconf/install-sh -m 0644 -c ${srcdir}/$1 $1]) +]) diff --git a/autoconf/m4/config_project.m4 b/autoconf/m4/config_project.m4 new file mode 100644 index 000000000..eea7faf16 --- /dev/null +++ b/autoconf/m4/config_project.m4 @@ -0,0 +1,14 @@ +# +# Provide the arguments and other processing needed for an LLVM project +# +AC_DEFUN([LLVM_CONFIG_PROJECT], + [AC_ARG_WITH([llvmsrc], + AS_HELP_STRING([--with-llvmsrc],[Location of LLVM Source Code]), + [llvm_src="$withval"],[llvm_src="]$1["]) + AC_SUBST(LLVM_SRC,$llvm_src) + AC_ARG_WITH([llvmobj], + AS_HELP_STRING([--with-llvmobj],[Location of LLVM Object Code]), + [llvm_obj="$withval"],[llvm_obj="]$2["]) + AC_SUBST(LLVM_OBJ,$llvm_obj) + AC_CONFIG_COMMANDS([setup],,[llvm_src="${LLVM_SRC}"]) +]) diff --git a/autoconf/m4/cxx_flag_check.m4 b/autoconf/m4/cxx_flag_check.m4 new file mode 100644 index 000000000..62454b714 --- /dev/null +++ b/autoconf/m4/cxx_flag_check.m4 @@ -0,0 +1,2 @@ +AC_DEFUN([CXX_FLAG_CHECK], + [AC_SUBST($1, `$CXX -Werror $2 -fsyntax-only -xc /dev/null 2>/dev/null && echo $2`)]) diff --git a/autoconf/m4/find_std_program.m4 b/autoconf/m4/find_std_program.m4 new file mode 100644 index 000000000..c789df8e6 --- /dev/null +++ b/autoconf/m4/find_std_program.m4 @@ -0,0 +1,118 @@ +dnl Check for a standard program that has a bin, include and lib directory +dnl +dnl Parameters: +dnl $1 - prefix directory to check +dnl $2 - program name to check +dnl $3 - header file to check +dnl $4 - library file to check +AC_DEFUN([CHECK_STD_PROGRAM], +[m4_define([allcapsname],translit($2,a-z,A-Z)) +if test -n "$1" -a -d "$1" -a -n "$2" -a -d "$1/bin" -a -x "$1/bin/$2" ; then + AC_SUBST([USE_]allcapsname(),["USE_]allcapsname()[ = 1"]) + AC_SUBST(allcapsname(),[$1/bin/$2]) + AC_SUBST(allcapsname()[_BIN],[$1/bin]) + AC_SUBST(allcapsname()[_DIR],[$1]) + if test -n "$3" -a -d "$1/include" -a -f "$1/include/$3" ; then + AC_SUBST(allcapsname()[_INC],[$1/include]) + fi + if test -n "$4" -a -d "$1/lib" -a -f "$1/lib/$4" ; then + AC_SUBST(allcapsname()[_LIB],[$1/lib]) + fi +fi +]) + +dnl Find a program via --with options, in the path, or well known places +dnl +dnl Parameters: +dnl $1 - program's executable name +dnl $2 - header file name to check (optional) +dnl $3 - library file name to check (optional) +dnl $4 - alternate (long) name for the program +AC_DEFUN([FIND_STD_PROGRAM], +[m4_define([allcapsname],translit($1,a-z,A-Z)) +m4_define([stdprog_long_name],ifelse($4,,translit($1,[ !@#$%^&*()-+={}[]:;"',./?],[-]),translit($4,[ !@#$%^&*()-+={}[]:;"',./?],[-]))) +AC_MSG_CHECKING([for ]stdprog_long_name()[ bin/lib/include locations]) +AC_ARG_WITH($1, + AS_HELP_STRING([--with-]stdprog_long_name()[=DIR], + [Specify that the ]stdprog_long_name()[ install prefix is DIR]), + $1[pfxdir=$withval],$1[pfxdir=nada]) +AC_ARG_WITH($1[-bin], + AS_HELP_STRING([--with-]stdprog_long_name()[-bin=DIR], + [Specify that the ]stdprog_long_name()[ binary is in DIR]), + $1[bindir=$withval],$1[bindir=nada]) +AC_ARG_WITH($1[-lib], + AS_HELP_STRING([--with-]stdprog_long_name()[-lib=DIR], + [Specify that ]stdprog_long_name()[ libraries are in DIR]), + $1[libdir=$withval],$1[libdir=nada]) +AC_ARG_WITH($1[-inc], + AS_HELP_STRING([--with-]stdprog_long_name()[-inc=DIR], + [Specify that the ]stdprog_long_name()[ includes are in DIR]), + $1[incdir=$withval],$1[incdir=nada]) +eval pfxval=\$\{$1pfxdir\} +eval binval=\$\{$1bindir\} +eval incval=\$\{$1incdir\} +eval libval=\$\{$1libdir\} +if test "${pfxval}" != "nada" ; then + CHECK_STD_PROGRAM(${pfxval},$1,$2,$3) +elif test "${binval}" != "nada" ; then + if test "${libval}" != "nada" ; then + if test "${incval}" != "nada" ; then + if test -d "${binval}" ; then + if test -d "${incval}" ; then + if test -d "${libval}" ; then + AC_SUBST(allcapsname(),${binval}/$1) + AC_SUBST(allcapsname()[_BIN],${binval}) + AC_SUBST(allcapsname()[_INC],${incval}) + AC_SUBST(allcapsname()[_LIB],${libval}) + AC_SUBST([USE_]allcapsname(),["USE_]allcapsname()[ = 1"]) + AC_MSG_RESULT([found via --with options]) + else + AC_MSG_RESULT([failed]) + AC_MSG_ERROR([The --with-]$1[-libdir value must be a directory]) + fi + else + AC_MSG_RESULT([failed]) + AC_MSG_ERROR([The --with-]$1[-incdir value must be a directory]) + fi + else + AC_MSG_RESULT([failed]) + AC_MSG_ERROR([The --with-]$1[-bindir value must be a directory]) + fi + else + AC_MSG_RESULT([failed]) + AC_MSG_ERROR([The --with-]$1[-incdir option must be specified]) + fi + else + AC_MSG_RESULT([failed]) + AC_MSG_ERROR([The --with-]$1[-libdir option must be specified]) + fi +else + tmppfxdir=`which $1 2>&1` + if test -n "$tmppfxdir" -a -d "${tmppfxdir%*$1}" -a \ + -d "${tmppfxdir%*$1}/.." ; then + tmppfxdir=`cd "${tmppfxdir%*$1}/.." ; pwd` + CHECK_STD_PROGRAM($tmppfxdir,$1,$2,$3) + AC_MSG_RESULT([found in PATH at ]$tmppfxdir) + else + checkresult="yes" + eval checkval=\$\{"USE_"allcapsname()\} + CHECK_STD_PROGRAM([/usr],$1,$2,$3) + if test -z "${checkval}" ; then + CHECK_STD_PROGRAM([/usr/local],$1,$2,$3) + if test -z "${checkval}" ; then + CHECK_STD_PROGRAM([/sw],$1,$2,$3) + if test -z "${checkval}" ; then + CHECK_STD_PROGRAM([/opt],$1,$2,$3) + if test -z "${checkval}" ; then + CHECK_STD_PROGRAM([/],$1,$2,$3) + if test -z "${checkval}" ; then + checkresult="no" + fi + fi + fi + fi + fi + AC_MSG_RESULT($checkresult) + fi +fi +]) diff --git a/autoconf/m4/func_isinf.m4 b/autoconf/m4/func_isinf.m4 new file mode 100644 index 000000000..22ba81d54 --- /dev/null +++ b/autoconf/m4/func_isinf.m4 @@ -0,0 +1,36 @@ +# +# This function determins if the isinf function isavailable on this +# platform. +# +AC_DEFUN([AC_FUNC_ISINF],[ +AC_SINGLE_CXX_CHECK([ac_cv_func_isinf_in_math_h], + [isinf], [], + [float f; isinf(f);]) +if test "$ac_cv_func_isinf_in_math_h" = "yes" ; then + AC_DEFINE([HAVE_ISINF_IN_MATH_H],1,[Set to 1 if the isinf function is found in ]) +fi + +AC_SINGLE_CXX_CHECK([ac_cv_func_isinf_in_cmath], + [isinf], [], + [float f; isinf(f);]) +if test "$ac_cv_func_isinf_in_cmath" = "yes" ; then + AC_DEFINE([HAVE_ISINF_IN_CMATH],1,[Set to 1 if the isinf function is found in ]) +fi + +AC_SINGLE_CXX_CHECK([ac_cv_func_std_isinf_in_cmath], + [std::isinf], [], + [float f; std::isinf(f);]) +if test "$ac_cv_func_std_isinf_in_cmath" = "yes" ; then + AC_DEFINE([HAVE_STD_ISINF_IN_CMATH],1,[Set to 1 if the std::isinf function is found in ]) +fi + +AC_SINGLE_CXX_CHECK([ac_cv_func_finite_in_ieeefp_h], + [finite], [], + [float f; finite(f);]) +if test "$ac_cv_func_finite_in_ieeefp_h" = "yes" ; then + AC_DEFINE([HAVE_FINITE_IN_IEEEFP_H],1,[Set to 1 if the finite function is found in ]) +fi + +]) + + diff --git a/autoconf/m4/func_isnan.m4 b/autoconf/m4/func_isnan.m4 new file mode 100644 index 000000000..eb5ca0dae --- /dev/null +++ b/autoconf/m4/func_isnan.m4 @@ -0,0 +1,27 @@ +# +# This function determines if the isnan function is available on this +# platform. +# +AC_DEFUN([AC_FUNC_ISNAN],[ +AC_SINGLE_CXX_CHECK([ac_cv_func_isnan_in_math_h], + [isnan], [], + [float f; isnan(f);]) + +if test "$ac_cv_func_isnan_in_math_h" = "yes" ; then + AC_DEFINE([HAVE_ISNAN_IN_MATH_H],1,[Set to 1 if the isnan function is found in ]) +fi + +AC_SINGLE_CXX_CHECK([ac_cv_func_isnan_in_cmath], + [isnan], [], + [float f; isnan(f);]) +if test "$ac_cv_func_isnan_in_cmath" = "yes" ; then + AC_DEFINE([HAVE_ISNAN_IN_CMATH],1,[Set to 1 if the isnan function is found in ]) +fi + +AC_SINGLE_CXX_CHECK([ac_cv_func_std_isnan_in_cmath], + [std::isnan], [], + [float f; std::isnan(f);]) +if test "$ac_cv_func_std_isnan_in_cmath" = "yes" ; then + AC_DEFINE([HAVE_STD_ISNAN_IN_CMATH],1,[Set to 1 if the std::isnan function is found in ]) +fi +]) diff --git a/autoconf/m4/func_mmap_file.m4 b/autoconf/m4/func_mmap_file.m4 new file mode 100644 index 000000000..372c87fbe --- /dev/null +++ b/autoconf/m4/func_mmap_file.m4 @@ -0,0 +1,26 @@ +# +# Check for the ability to mmap a file. +# +AC_DEFUN([AC_FUNC_MMAP_FILE], +[AC_CACHE_CHECK(for mmap of files, +ac_cv_func_mmap_file, +[ AC_LANG_PUSH([C]) + AC_RUN_IFELSE([ + AC_LANG_PROGRAM([[ +#include +#include +#include +]],[[ + int fd; + fd = creat ("foo",0777); + fd = (int) mmap (0, 1, PROT_READ, MAP_SHARED, fd, 0); + unlink ("foo"); + return (fd != (int) MAP_FAILED);]])], + [ac_cv_func_mmap_file=yes],[ac_cv_func_mmap_file=no],[ac_cv_func_mmap_file=no]) + AC_LANG_POP([C]) +]) +if test "$ac_cv_func_mmap_file" = yes; then + AC_DEFINE([HAVE_MMAP_FILE],[],[Define if mmap() can map files into memory]) + AC_SUBST(MMAP_FILE,[yes]) +fi +]) diff --git a/autoconf/m4/header_mmap_anonymous.m4 b/autoconf/m4/header_mmap_anonymous.m4 new file mode 100644 index 000000000..2270d2955 --- /dev/null +++ b/autoconf/m4/header_mmap_anonymous.m4 @@ -0,0 +1,21 @@ +# +# Check for anonymous mmap macros. This is modified from +# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_slist.html +# +AC_DEFUN([AC_HEADER_MMAP_ANONYMOUS], +[AC_CACHE_CHECK(for MAP_ANONYMOUS vs. MAP_ANON, +ac_cv_header_mmap_anon, +[ AC_LANG_PUSH([C]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM( + [[#include +#include +#include ]], + [[mmap (0, 1, PROT_READ, MAP_ANONYMOUS, -1, 0); return (0);]])], + ac_cv_header_mmap_anon=yes, + ac_cv_header_mmap_anon=no) + AC_LANG_POP([C]) +]) +if test "$ac_cv_header_mmap_anon" = yes; then + AC_DEFINE([HAVE_MMAP_ANONYMOUS],[1],[Define if mmap() uses MAP_ANONYMOUS to map anonymous pages, or undefine if it uses MAP_ANON]) +fi +]) diff --git a/autoconf/m4/huge_val.m4 b/autoconf/m4/huge_val.m4 new file mode 100644 index 000000000..6c9a22eab --- /dev/null +++ b/autoconf/m4/huge_val.m4 @@ -0,0 +1,20 @@ +# +# This function determins if the HUGE_VAL macro is compilable with the +# -pedantic switch or not. XCode < 2.4.1 doesn't get it right. +# +AC_DEFUN([AC_HUGE_VAL_CHECK],[ + AC_CACHE_CHECK([for HUGE_VAL sanity], [ac_cv_huge_val_sanity],[ + AC_LANG_PUSH([C++]) + ac_save_CXXFLAGS=$CXXFLAGS + CXXFLAGS="$CXXFLAGS -pedantic" + AC_RUN_IFELSE( + AC_LANG_PROGRAM( + [#include ], + [double x = HUGE_VAL; return x != x; ]), + [ac_cv_huge_val_sanity=yes],[ac_cv_huge_val_sanity=no], + [ac_cv_huge_val_sanity=yes]) + CXXFLAGS=$ac_save_CXXFLAGS + AC_LANG_POP([C++]) + ]) + AC_SUBST(HUGE_VAL_SANITY,$ac_cv_huge_val_sanity) +]) diff --git a/autoconf/m4/libtool.m4 b/autoconf/m4/libtool.m4 new file mode 100644 index 000000000..b8bd4b803 --- /dev/null +++ b/autoconf/m4/libtool.m4 @@ -0,0 +1,6389 @@ +# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- +## Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005 +## Free Software Foundation, Inc. +## Originally by Gordon Matzigkeit , 1996 +## +## This file is free software; the Free Software Foundation gives +## unlimited permission to copy and/or distribute it, with or without +## modifications, as long as this notice is preserved. + +# serial 48 AC_PROG_LIBTOOL + + +# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED) +# ----------------------------------------------------------- +# If this macro is not defined by Autoconf, define it here. +m4_ifdef([AC_PROVIDE_IFELSE], + [], + [m4_define([AC_PROVIDE_IFELSE], + [m4_ifdef([AC_PROVIDE_$1], + [$2], [$3])])]) + + +# AC_PROG_LIBTOOL +# --------------- +AC_DEFUN([AC_PROG_LIBTOOL], +[AC_REQUIRE([_AC_PROG_LIBTOOL])dnl +dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX +dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX. + AC_PROVIDE_IFELSE([AC_PROG_CXX], + [AC_LIBTOOL_CXX], + [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX + ])]) +dnl And a similar setup for Fortran 77 support + AC_PROVIDE_IFELSE([AC_PROG_F77], + [AC_LIBTOOL_F77], + [define([AC_PROG_F77], defn([AC_PROG_F77])[AC_LIBTOOL_F77 +])]) + +dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly. +dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run +dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both. + AC_PROVIDE_IFELSE([AC_PROG_GCJ], + [AC_LIBTOOL_GCJ], + [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], + [AC_LIBTOOL_GCJ], + [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ], + [AC_LIBTOOL_GCJ], + [ifdef([AC_PROG_GCJ], + [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ])]) + ifdef([A][M_PROG_GCJ], + [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ])]) + ifdef([LT_AC_PROG_GCJ], + [define([LT_AC_PROG_GCJ], + defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])])]) +])])# AC_PROG_LIBTOOL + + +# _AC_PROG_LIBTOOL +# ---------------- +AC_DEFUN([_AC_PROG_LIBTOOL], +[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl +AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl +AC_BEFORE([$0],[AC_LIBTOOL_F77])dnl +AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/mklib' +AC_SUBST(LIBTOOL)dnl + +# Prevent multiple expansion +define([AC_PROG_LIBTOOL], []) +])# _AC_PROG_LIBTOOL + + +# AC_LIBTOOL_SETUP +# ---------------- +AC_DEFUN([AC_LIBTOOL_SETUP], +[AC_PREREQ(2.60)dnl +AC_REQUIRE([AC_ENABLE_SHARED])dnl +AC_REQUIRE([AC_ENABLE_STATIC])dnl +AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_PROG_LD])dnl +AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl +AC_REQUIRE([AC_PROG_NM])dnl + +AC_REQUIRE([AC_PROG_LN_S])dnl +AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl +# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! +AC_REQUIRE([AC_OBJEXT])dnl +AC_REQUIRE([AC_EXEEXT])dnl +dnl + +AC_LIBTOOL_SYS_MAX_CMD_LEN +AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE +AC_LIBTOOL_OBJDIR + +AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl +_LT_AC_PROG_ECHO_BACKSLASH + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e 1s/^X//' +[sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'] + +# Same as above, but do not quote variable references. +[double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g'] + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' + +# Constants: +rm="rm -f" + +# Global variables: +default_ofile=mklib +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except MSVC, +# which needs '.lib'). +libext=a +ltmain="$ac_aux_dir/ltmain.sh" +ofile="$default_ofile" +with_gnu_ld="$lt_cv_prog_gnu_ld" + +AC_CHECK_TOOL(AR, ar, false) +AC_CHECK_TOOL(RANLIB, ranlib, :) +AC_CHECK_TOOL(STRIP, strip, :) + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$AR" && AR=ar +test -z "$AR_FLAGS" && AR_FLAGS=cru +test -z "$AS" && AS=as +test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC +test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS +test -z "$DLLTOOL" && DLLTOOL=dlltool +test -z "$LD" && LD=ld +test -z "$LN_S" && LN_S="ln -s" +test -z "$MAGIC_CMD" && MAGIC_CMD=file +test -z "$NM" && NM=nm +test -z "$SED" && SED=sed +test -z "$OBJDUMP" && OBJDUMP=objdump +test -z "$RANLIB" && RANLIB=: +test -z "$STRIP" && STRIP=: +test -z "$ac_objext" && ac_objext=o + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" + ;; + *) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" +fi + +_LT_CC_BASENAME([$compiler]) + +# Only perform the check for file, if the check method requires it +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + AC_PATH_MAGIC + fi + ;; +esac + +AC_PROVIDE_IFELSE([AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no) +AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], +enable_win32_dll=yes, enable_win32_dll=no) + +AC_ARG_ENABLE([libtool-lock], + [AS_HELP_STRING([--disable-libtool-lock],[avoid locking (might break parallel builds)])]) +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +AC_ARG_WITH([pic], + [AS_HELP_STRING([--with-pic],[try to use only PIC/non-PIC objects @<:@default=use both@:>@])], + [pic_mode="$withval"], + [pic_mode=default]) +test -z "$pic_mode" && pic_mode=default + +# Use C for the default configuration in the libtool script +tagname= +AC_LIBTOOL_LANG_C_CONFIG +_LT_AC_TAGCONFIG +])# AC_LIBTOOL_SETUP + + +# _LT_AC_SYS_COMPILER +# ------------------- +AC_DEFUN([_LT_AC_SYS_COMPILER], +[AC_REQUIRE([AC_PROG_CC])dnl + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC +])# _LT_AC_SYS_COMPILER + + +# _LT_CC_BASENAME(CC) +# ------------------- +# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. +AC_DEFUN([_LT_CC_BASENAME], +[for cc_temp in $1""; do + case $cc_temp in + compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; + distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` +]) + + +# _LT_COMPILER_BOILERPLATE +# ------------------------ +# Check for compiler boilerplate output or warnings with +# the simple compiler test code. +AC_DEFUN([_LT_COMPILER_BOILERPLATE], +[ac_outfile=conftest.$ac_objext +printf "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$rm conftest* +])# _LT_COMPILER_BOILERPLATE + + +# _LT_LINKER_BOILERPLATE +# ---------------------- +# Check for linker boilerplate output or warnings with +# the simple link test code. +AC_DEFUN([_LT_LINKER_BOILERPLATE], +[ac_outfile=conftest.$ac_objext +printf "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$rm conftest* +])# _LT_LINKER_BOILERPLATE + + +# _LT_AC_SYS_LIBPATH_AIX +# ---------------------- +# Links a minimal program and checks the executable +# for the system default hardcoded library path. In most cases, +# this is /usr/lib:/lib, but when the MPI compilers are used +# the location of the communication and MPI libs are included too. +# If we don't find anything, use the default library path according +# to the aix ld manual. +AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX], +[AC_LINK_IFELSE(AC_LANG_PROGRAM,[ +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi],[]) +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +])# _LT_AC_SYS_LIBPATH_AIX + + +# _LT_AC_SHELL_INIT(ARG) +# ---------------------- +AC_DEFUN([_LT_AC_SHELL_INIT], +[ifdef([AC_DIVERSION_NOTICE], + [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], + [AC_DIVERT_PUSH(NOTICE)]) +$1 +AC_DIVERT_POP +])# _LT_AC_SHELL_INIT + + +# _LT_AC_PROG_ECHO_BACKSLASH +# -------------------------- +# Add some code to the start of the generated configure script which +# will find an echo command which doesn't interpret backslashes. +AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH], +[_LT_AC_SHELL_INIT([ +# Check that we are running under the correct shell. +SHELL=${CONFIG_SHELL-/bin/sh} + +case X$ECHO in +X*--fallback-echo) + # Remove one level of quotation (which was required for Make). + ECHO=`echo "$ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','` + ;; +esac + +echo=${ECHO-echo} +if test "X[$]1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X[$]1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then + # Yippee, $echo works! + : +else + # Restart under the correct shell. + exec $SHELL "[$]0" --no-reexec ${1+"[$]@"} +fi + +if test "X[$]1" = X--fallback-echo; then + # used as fallback echo + shift + cat </dev/null 2>&1 && unset CDPATH + +if test -z "$ECHO"; then +if test "X${echo_test_string+set}" != Xset; then +# find a string as large as possible, as long as the shell can cope with it + for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do + # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... + if (echo_test_string=`eval $cmd`) 2>/dev/null && + echo_test_string=`eval $cmd` && + (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null + then + break + fi + done +fi + +if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + : +else + # The Solaris, AIX, and Digital Unix default echo programs unquote + # backslashes. This makes it impossible to quote backslashes using + # echo "$something" | sed 's/\\/\\\\/g' + # + # So, first we look for a working echo in the user's PATH. + + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for dir in $PATH /usr/ucb; do + IFS="$lt_save_ifs" + if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && + test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$dir/echo" + break + fi + done + IFS="$lt_save_ifs" + + if test "X$echo" = Xecho; then + # We didn't find a better echo, so look for alternatives. + if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # This shell has a builtin print -r that does the trick. + echo='print -r' + elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && + test "X$CONFIG_SHELL" != X/bin/ksh; then + # If we have ksh, try running configure again with it. + ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} + export ORIGINAL_CONFIG_SHELL + CONFIG_SHELL=/bin/ksh + export CONFIG_SHELL + exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"} + else + # Try using printf. + echo='printf %s\n' + if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # Cool, printf works + : + elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL + export CONFIG_SHELL + SHELL="$CONFIG_SHELL" + export SHELL + echo="$CONFIG_SHELL [$]0 --fallback-echo" + elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$CONFIG_SHELL [$]0 --fallback-echo" + else + # maybe with a smaller string... + prev=: + + for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do + if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null + then + break + fi + prev="$cmd" + done + + if test "$prev" != 'sed 50q "[$]0"'; then + echo_test_string=`eval $prev` + export echo_test_string + exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"} + else + # Oops. We lost completely, so just stick with echo. + echo=echo + fi + fi + fi + fi +fi +fi + +# Copy echo and quote the copy suitably for passing to libtool from +# the Makefile, instead of quoting the original, which is used later. +ECHO=$echo +if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then + ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo" +fi + +AC_SUBST(ECHO) +])])# _LT_AC_PROG_ECHO_BACKSLASH + + +# _LT_AC_LOCK +# ----------- +AC_DEFUN([_LT_AC_LOCK], +[AC_ARG_ENABLE([libtool-lock], + [AS_HELP_STRING([--disable-libtool-lock],[avoid locking (might break parallel builds)])]) +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out which ABI we are using. + echo '[#]line __oline__ "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + if test "$lt_cv_prog_gnu_ld" = yes; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + fi + rm -rf conftest* + ;; + +x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.o` in + *32-bit*) + case $host in + x86_64-*linux*) + LD="${LD-ld} -m elf_i386" + ;; + ppc64-*linux*|powerpc64-*linux*|ppc64le-$linux*|powerpc64le-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + ppc*-*linux*|powerpc*-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, + [AC_LANG_PUSH(C) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) + AC_LANG_POP]) + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; +sparc*-*solaris*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.o` in + *64-bit*) + case $lt_cv_prog_gnu_ld in + yes*) LD="${LD-ld} -m elf64_sparc" ;; + *) LD="${LD-ld} -64" ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + +AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], +[*-*-cygwin* | *-*-mingw* | *-*-pw32*) + AC_CHECK_TOOL(DLLTOOL, dlltool, false) + AC_CHECK_TOOL(AS, as, false) + AC_CHECK_TOOL(OBJDUMP, objdump, false) + ;; + ]) +esac + +need_locks="$enable_libtool_lock" + +])# _LT_AC_LOCK + + +# AC_LIBTOOL_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) +# ---------------------------------------------------------------- +# Check whether the given compiler option works +AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], +[AC_REQUIRE([LT_AC_PROG_SED]) +AC_CACHE_CHECK([$1], [$2], + [$2=no + ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$3" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + $2=yes + fi + fi + $rm conftest* +]) + +if test x"[$]$2" = xyes; then + ifelse([$5], , :, [$5]) +else + ifelse([$6], , :, [$6]) +fi +])# AC_LIBTOOL_COMPILER_OPTION + + +# AC_LIBTOOL_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [ACTION-SUCCESS], [ACTION-FAILURE]) +# ------------------------------------------------------------ +# Check whether the given compiler option works +AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], +[AC_CACHE_CHECK([$1], [$2], + [$2=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $3" + printf "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&AS_MESSAGE_LOG_FD + $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + $2=yes + fi + else + $2=yes + fi + fi + $rm conftest* + LDFLAGS="$save_LDFLAGS" +]) + +if test x"[$]$2" = xyes; then + ifelse([$4], , :, [$4]) +else + ifelse([$5], , :, [$5]) +fi +])# AC_LIBTOOL_LINKER_OPTION + + +# AC_LIBTOOL_SYS_MAX_CMD_LEN +# -------------------------- +AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], +[# find the maximum length of command line arguments +AC_MSG_CHECKING([the maximum length of command line arguments]) +AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl + i=0 + teststring="ABCD" + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + + netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) + # This has been around since 386BSD, at least. Likely further. + if test -x /sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` + elif test -x /usr/sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` + else + lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs + fi + # And add a safety zone + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + ;; + + interix*) + # We know the value 262144 and hardcode it with a safety zone (like BSD) + lt_cv_sys_max_cmd_len=196608 + ;; + + osf*) + # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure + # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not + # nice to cause kernel panics so lets avoid the loop below. + # First set a reasonable default. + lt_cv_sys_max_cmd_len=16384 + # + if test -x /sbin/sysconfig; then + case `/sbin/sysconfig -q proc exec_disable_arg_limit` in + *1*) lt_cv_sys_max_cmd_len=-1 ;; + esac + fi + ;; + sco3.2v5*) + lt_cv_sys_max_cmd_len=102400 + ;; + sysv5* | sco5v6* | sysv4.2uw2*) + kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` + if test -n "$kargmax"; then + lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` + else + lt_cv_sys_max_cmd_len=32768 + fi + ;; + *) + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} + while (test "X"`$SHELL [$]0 --fallback-echo "X$teststring" 2>/dev/null` \ + = "XX$teststring") >/dev/null 2>&1 && + new_result=`expr "X$teststring" : ".*" 2>&1` && + lt_cv_sys_max_cmd_len=$new_result && + test $i != 17 # 1/2 MB should be enough + do + i=`expr $i + 1` + teststring=$teststring$teststring + done + teststring= + # Add a significant safety factor because C++ compilers can tack on massive + # amounts of additional arguments before passing them to the linker. + # It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + ;; + esac +]) +if test -n $lt_cv_sys_max_cmd_len ; then + AC_MSG_RESULT($lt_cv_sys_max_cmd_len) +else + AC_MSG_RESULT(none) +fi +])# AC_LIBTOOL_SYS_MAX_CMD_LEN + + +# _LT_AC_CHECK_DLFCN +# ------------------ +AC_DEFUN([_LT_AC_CHECK_DLFCN], +[AC_CHECK_HEADERS(dlfcn.h)dnl +])# _LT_AC_CHECK_DLFCN + + +# _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, +# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) +# --------------------------------------------------------------------- +AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF], +[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl +if test "$cross_compiling" = yes; then : + [$4] +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + else + puts (dlerror ()); + + exit (status); +}] +EOF + if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) $1 ;; + x$lt_dlneed_uscore) $2 ;; + x$lt_dlunknown|x*) $3 ;; + esac + else : + # compilation failed + $3 + fi +fi +rm -fr conftest* +])# _LT_AC_TRY_DLOPEN_SELF + + +# AC_LIBTOOL_DLOPEN_SELF +# ---------------------- +AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], +[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl +if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ]) + ;; + + *) + AC_CHECK_FUNC([shl_load], + [lt_cv_dlopen="shl_load"], + [AC_CHECK_LIB([dld], [shl_load], + [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"], + [AC_CHECK_FUNC([dlopen], + [lt_cv_dlopen="dlopen"], + [AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], + [AC_CHECK_LIB([svld], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], + [AC_CHECK_LIB([dld], [dld_link], + [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"]) + ]) + ]) + ]) + ]) + ]) + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + AC_CACHE_CHECK([whether a program can dlopen itself], + lt_cv_dlopen_self, [dnl + _LT_AC_TRY_DLOPEN_SELF( + lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, + lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) + ]) + + if test "x$lt_cv_dlopen_self" = xyes; then + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" + AC_CACHE_CHECK([whether a statically linked program can dlopen itself], + lt_cv_dlopen_self_static, [dnl + _LT_AC_TRY_DLOPEN_SELF( + lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, + lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) + ]) + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi +])# AC_LIBTOOL_DLOPEN_SELF + + +# AC_LIBTOOL_PROG_CC_C_O([TAGNAME]) +# --------------------------------- +# Check to see if options -c and -o are simultaneously supported by compiler +AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O], +[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl +AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], + [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)], + [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no + $rm -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes + fi + fi + chmod u+w . 2>&AS_MESSAGE_LOG_FD + $rm conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files + $rm out/* && rmdir out + cd .. + rmdir conftest + $rm conftest* +]) +])# AC_LIBTOOL_PROG_CC_C_O + + +# AC_LIBTOOL_SYS_HARD_LINK_LOCKS([TAGNAME]) +# ----------------------------------------- +# Check to see if we can do hard links to lock some files if needed +AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], +[AC_REQUIRE([_LT_AC_LOCK])dnl + +hard_links="nottested" +if test "$_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + AC_MSG_CHECKING([if we can lock with hard links]) + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + AC_MSG_RESULT([$hard_links]) + if test "$hard_links" = no; then + AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) + need_locks=warn + fi +else + need_locks=no +fi +])# AC_LIBTOOL_SYS_HARD_LINK_LOCKS + + +# AC_LIBTOOL_OBJDIR +# ----------------- +AC_DEFUN([AC_LIBTOOL_OBJDIR], +[AC_CACHE_CHECK([for objdir], [lt_cv_objdir], +[rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null]) +objdir=$lt_cv_objdir +])# AC_LIBTOOL_OBJDIR + + +# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH([TAGNAME]) +# ---------------------------------------------- +# Check hardcoding attributes. +AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], +[AC_MSG_CHECKING([how to hardcode library paths into programs]) +_LT_AC_TAGVAR(hardcode_action, $1)= +if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \ + test -n "$_LT_AC_TAGVAR(runpath_var, $1)" || \ + test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then + + # We can hardcode non-existent directories. + if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)" != no && + test "$_LT_AC_TAGVAR(hardcode_minus_L, $1)" != no; then + # Linking always hardcodes the temporary library directory. + _LT_AC_TAGVAR(hardcode_action, $1)=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + _LT_AC_TAGVAR(hardcode_action, $1)=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + _LT_AC_TAGVAR(hardcode_action, $1)=unsupported +fi +AC_MSG_RESULT([$_LT_AC_TAGVAR(hardcode_action, $1)]) + +if test "$_LT_AC_TAGVAR(hardcode_action, $1)" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi +])# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH + + +# AC_LIBTOOL_SYS_LIB_STRIP +# ------------------------ +AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP], +[striplib= +old_striplib= +AC_MSG_CHECKING([whether stripping libraries is possible]) +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + AC_MSG_RESULT([yes]) +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) +fi + ;; + *) + AC_MSG_RESULT([no]) + ;; + esac +fi +])# AC_LIBTOOL_SYS_LIB_STRIP + + +# AC_LIBTOOL_SYS_DYNAMIC_LINKER +# ----------------------------- +# PORTME Fill in your ld.so characteristics +AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER], +[AC_MSG_CHECKING([dynamic linker characteristics]) +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix4* | aix5*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[[01]] | aix4.[[01]].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[[45]]*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32*) + version_type=windows + shrext_cmds=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32*) + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | [grep ';[c-zC-Z]:/' >/dev/null]; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + ;; + esac + ;; + + *) + library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='.dylib' + # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. + if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + else + sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' + fi + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1.*) + dynamic_linker=no + ;; + +kfreebsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[[123]].*) objformat=aout ;; + *) objformat=elf ;; + esac + fi + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2.*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[[01]]* | freebsdelf3.[[01]]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ + freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + freebsd*) # from 4.6 on + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case $host_cpu in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +interix3*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +knetbsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +nto-qnx*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + sys_lib_dlsearch_path_spec="/usr/lib" + need_lib_prefix=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[[89]] | openbsd2.[[89]].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext_cmds=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + export_dynamic_flag_spec='${wl}-Blargedynsym' + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + version_type=freebsd-elf + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + if test "$with_gnu_ld" = yes; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + shlibpath_overrides_runpath=no + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + shlibpath_overrides_runpath=yes + case $host_os in + sco3.2v5*) + sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" + ;; + esac + fi + sys_lib_dlsearch_path_spec='/usr/lib' + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +AC_MSG_RESULT([$dynamic_linker]) +test "$dynamic_linker" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi +])# AC_LIBTOOL_SYS_DYNAMIC_LINKER + + +# _LT_AC_TAGCONFIG +# ---------------- +AC_DEFUN([_LT_AC_TAGCONFIG], +[AC_ARG_WITH([tags], + [AS_HELP_STRING([--with-tags@<:@=TAGS@:>@],[include additional configurations @<:@automatic@:>@])], + [tagnames="$withval"]) + +if test -f "$ltmain" && test -n "$tagnames"; then + if test ! -f "${ofile}"; then + AC_MSG_WARN([output file `$ofile' does not exist]) + fi + + if test -z "$LTCC"; then + eval "`$SHELL ${ofile} --config | grep '^LTCC='`" + if test -z "$LTCC"; then + AC_MSG_WARN([output file `$ofile' does not look like a libtool script]) + else + AC_MSG_WARN([using `LTCC=$LTCC', extracted from `$ofile']) + fi + fi + if test -z "$LTCFLAGS"; then + eval "`$SHELL ${ofile} --config | grep '^LTCFLAGS='`" + fi + + # Extract list of available tagged configurations in $ofile. + # Note that this assumes the entire list is on one line. + available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` + + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for tagname in $tagnames; do + IFS="$lt_save_ifs" + # Check whether tagname contains only valid characters + case `$echo "X$tagname" | $Xsed -e 's:[[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]]::g'` in + "") ;; + *) AC_MSG_ERROR([invalid tag name: $tagname]) + ;; + esac + + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null + then + AC_MSG_ERROR([tag name "$tagname" already exists]) + fi + + # Update the list of available tags. + if test -n "$tagname"; then + echo appending configuration tag \"$tagname\" to $ofile + + case $tagname in + CXX) + if test -n "$CXX" && ( test "X$CXX" != "Xno" && + ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || + (test "X$CXX" != "Xg++"))) ; then + AC_LIBTOOL_LANG_CXX_CONFIG + else + tagname="" + fi + ;; + + F77) + if test -n "$F77" && test "X$F77" != "Xno"; then + AC_LIBTOOL_LANG_F77_CONFIG + else + tagname="" + fi + ;; + + GCJ) + if test -n "$GCJ" && test "X$GCJ" != "Xno"; then + AC_LIBTOOL_LANG_GCJ_CONFIG + else + tagname="" + fi + ;; + + RC) + AC_LIBTOOL_LANG_RC_CONFIG + ;; + + *) + AC_MSG_ERROR([Unsupported tag name: $tagname]) + ;; + esac + + # Append the new tag name to the list of available tags. + if test -n "$tagname" ; then + available_tags="$available_tags $tagname" + fi + fi + done + IFS="$lt_save_ifs" + + # Now substitute the updated list of available tags. + if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then + mv "${ofile}T" "$ofile" + chmod +x "$ofile" + else + rm -f "${ofile}T" + AC_MSG_ERROR([unable to update list of available tagged configurations.]) + fi +fi +])# _LT_AC_TAGCONFIG + + +# AC_LIBTOOL_DLOPEN +# ----------------- +# enable checks for dlopen support +AC_DEFUN([AC_LIBTOOL_DLOPEN], + [AC_BEFORE([$0],[AC_LIBTOOL_SETUP]) +])# AC_LIBTOOL_DLOPEN + + +# AC_LIBTOOL_WIN32_DLL +# -------------------- +# declare package support for building win32 DLLs +AC_DEFUN([AC_LIBTOOL_WIN32_DLL], +[AC_BEFORE([$0], [AC_LIBTOOL_SETUP]) +])# AC_LIBTOOL_WIN32_DLL + + +# AC_ENABLE_SHARED([DEFAULT]) +# --------------------------- +# implement the --enable-shared flag +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +AC_DEFUN([AC_ENABLE_SHARED], +[define([enable_shared_default], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE([shared], + AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],[build shared libraries @<:@default=enable_shared_default@:>@]), + [p=${PACKAGE-default} + case $enableval in + yes) enable_shared=yes ;; + no) enable_shared=no ;; + *) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_shared=]enable_shared_default) +])# AC_ENABLE_SHARED + + +# AC_DISABLE_SHARED +# ----------------- +# set the default shared flag to --disable-shared +AC_DEFUN([AC_DISABLE_SHARED], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_SHARED(no) +])# AC_DISABLE_SHARED + + +# AC_ENABLE_STATIC([DEFAULT]) +# --------------------------- +# implement the --enable-static flag +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +AC_DEFUN([AC_ENABLE_STATIC], +[define([enable_static_default], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE([static], + AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],[build static libraries @<:@default=enable_static_default@:>@]), + [p=${PACKAGE-default} + case $enableval in + yes) enable_static=yes ;; + no) enable_static=no ;; + *) + enable_static=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_static=]enable_static_default) +])# AC_ENABLE_STATIC + + +# AC_DISABLE_STATIC +# ----------------- +# set the default static flag to --disable-static +AC_DEFUN([AC_DISABLE_STATIC], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_STATIC(no) +])# AC_DISABLE_STATIC + + +# AC_ENABLE_FAST_INSTALL([DEFAULT]) +# --------------------------------- +# implement the --enable-fast-install flag +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +AC_DEFUN([AC_ENABLE_FAST_INSTALL], +[define([enable_Fast_install_default], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE([fast-install], + AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],[optimize for fast installation @<:@default=enable_Fast_install_default@:>@]), + [p=${PACKAGE-default} + case $enableval in + yes) enable_fast_install=yes ;; + no) enable_fast_install=no ;; + *) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_fast_install=]enable_Fast_install_default) +])# AC_ENABLE_FAST_INSTALL + + +# AC_DISABLE_FAST_INSTALL +# ----------------------- +# set the default to --disable-fast-install +AC_DEFUN([AC_DISABLE_FAST_INSTALL], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_FAST_INSTALL(no) +])# AC_DISABLE_FAST_INSTALL + + +# AC_LIBTOOL_PICMODE([MODE]) +# -------------------------- +# implement the --with-pic flag +# MODE is either `yes' or `no'. If omitted, it defaults to `both'. +AC_DEFUN([AC_LIBTOOL_PICMODE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +pic_mode=ifelse($#,1,$1,default) +])# AC_LIBTOOL_PICMODE + + +# AC_PROG_EGREP +# ------------- +# This is predefined starting with Autoconf 2.54, so this conditional +# definition can be removed once we require Autoconf 2.54 or later. +m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP], +[AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep], + [if echo a | (grep -E '(a|b)') >/dev/null 2>&1 + then ac_cv_prog_egrep='grep -E' + else ac_cv_prog_egrep='egrep' + fi]) + EGREP=$ac_cv_prog_egrep + AC_SUBST([EGREP]) +])]) + + +# AC_PATH_TOOL_PREFIX +# ------------------- +# find a file program which can recognise shared library +AC_DEFUN([AC_PATH_TOOL_PREFIX], +[AC_REQUIRE([AC_PROG_EGREP])dnl +AC_MSG_CHECKING([for $1]) +AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, +[case $MAGIC_CMD in +[[\\/*] | ?:[\\/]*]) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR +dnl $ac_dummy forces splitting on constant user-supplied paths. +dnl POSIX.2 word splitting is done only on the output of word expansions, +dnl not every word. This closes a longstanding sh security hole. + ac_dummy="ifelse([$2], , $PATH, [$2])" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$1; then + lt_cv_path_MAGIC_CMD="$ac_dir/$1" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac]) +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + AC_MSG_RESULT($MAGIC_CMD) +else + AC_MSG_RESULT(no) +fi +])# AC_PATH_TOOL_PREFIX + + +# AC_PATH_MAGIC +# ------------- +# find a file program which can recognise a shared library +AC_DEFUN([AC_PATH_MAGIC], +[AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + AC_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) + else + MAGIC_CMD=: + fi +fi +])# AC_PATH_MAGIC + + +# AC_PROG_LD +# ---------- +# find the pathname to the GNU or non-GNU linker +AC_DEFUN([AC_PROG_LD], +[AC_ARG_WITH([gnu-ld], + [AS_HELP_STRING([--with-gnu-ld],[assume the C compiler uses GNU ld @<:@default=no@:>@])], + [test "$withval" = no || with_gnu_ld=yes], + [with_gnu_ld=no]) +AC_REQUIRE([LT_AC_PROG_SED])dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + AC_MSG_CHECKING([for ld used by $CC]) + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [[\\/]]* | ?:[[\\/]]*) + re_direlt='/[[^/]][[^/]]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + AC_MSG_CHECKING([for GNU ld]) +else + AC_MSG_CHECKING([for non-GNU ld]) +fi +AC_CACHE_VAL(lt_cv_path_LD, +[if test -z "$LD"; then + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 &1 /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20* | hpux11*) + lt_cv_file_magic_cmd=/usr/bin/file + case $host_cpu in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'] + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library' + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + esac + ;; + +interix3*) + # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' + ;; + +irix5* | irix6* | nonstopux*) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be Linux ELF. +linux*) + lt_cv_deplibs_check_method=pass_all + ;; + +netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +nto-qnx*) + lt_cv_deplibs_check_method=unknown + ;; + +openbsd*) + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' + fi + ;; + +osf3* | osf4* | osf5*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.3*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + pc) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; +esac +]) +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown +])# AC_DEPLIBS_CHECK_METHOD + + +# AC_PROG_NM +# ---------- +# find the pathname to a BSD-compatible name lister +AC_DEFUN([AC_PROG_NM], +[AC_CACHE_CHECK([for BSD-compatible nm], lt_cv_path_NM, +[if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + lt_nm_to_check="${ac_tool_prefix}nm" + if test -n "$ac_tool_prefix" && test "$build" = "$host"; then + lt_nm_to_check="$lt_nm_to_check nm" + fi + for lt_tmp_nm in $lt_nm_to_check; do + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + tmp_nm="$ac_dir/$lt_tmp_nm" + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break + ;; + *) + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + ;; + esac + ;; + esac + fi + done + IFS="$lt_save_ifs" + done + test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm +fi]) +NM="$lt_cv_path_NM" +])# AC_PROG_NM + + +# AC_CHECK_LIBM +# ------------- +# check for math library +AC_DEFUN([AC_CHECK_LIBM], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +LIBM= +case $host in +*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*) + # These system don't have libm, or don't need it + ;; +*-ncr-sysv4.3*) + AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") + AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") + ;; +*) + AC_CHECK_LIB(m, cos, LIBM="-lm") + ;; +esac +])# AC_CHECK_LIBM + + +# AC_LIBLTDL_CONVENIENCE([DIRECTORY]) +# ----------------------------------- +# sets LIBLTDL to the link flags for the libltdl convenience library and +# LTDLINCL to the include flags for the libltdl header and adds +# --enable-ltdl-convenience to the configure arguments. Note that +# AC_CONFIG_SUBDIRS is not called here. If DIRECTORY is not provided, +# it is assumed to be `libltdl'. LIBLTDL will be prefixed with +# '${top_builddir}/' and LTDLINCL will be prefixed with '${top_srcdir}/' +# (note the single quotes!). If your package is not flat and you're not +# using automake, define top_builddir and top_srcdir appropriately in +# the Makefiles. +AC_DEFUN([AC_LIBLTDL_CONVENIENCE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl + case $enable_ltdl_convenience in + no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; + "") enable_ltdl_convenience=yes + ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; + esac + LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la + LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + # For backwards non-gettext consistent compatibility... + INCLTDL="$LTDLINCL" +])# AC_LIBLTDL_CONVENIENCE + + +# AC_LIBLTDL_INSTALLABLE([DIRECTORY]) +# ----------------------------------- +# sets LIBLTDL to the link flags for the libltdl installable library and +# LTDLINCL to the include flags for the libltdl header and adds +# --enable-ltdl-install to the configure arguments. Note that +# AC_CONFIG_SUBDIRS is not called here. If DIRECTORY is not provided, +# and an installed libltdl is not found, it is assumed to be `libltdl'. +# LIBLTDL will be prefixed with '${top_builddir}/'# and LTDLINCL with +# '${top_srcdir}/' (note the single quotes!). If your package is not +# flat and you're not using automake, define top_builddir and top_srcdir +# appropriately in the Makefiles. +# In the future, this macro may have to be called after AC_PROG_LIBTOOL. +AC_DEFUN([AC_LIBLTDL_INSTALLABLE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl + AC_CHECK_LIB(ltdl, lt_dlinit, + [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], + [if test x"$enable_ltdl_install" = xno; then + AC_MSG_WARN([libltdl not installed, but installation disabled]) + else + enable_ltdl_install=yes + fi + ]) + if test x"$enable_ltdl_install" = x"yes"; then + ac_configure_args="$ac_configure_args --enable-ltdl-install" + LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la + LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + else + ac_configure_args="$ac_configure_args --enable-ltdl-install=no" + LIBLTDL="-lltdl" + LTDLINCL= + fi + # For backwards non-gettext consistent compatibility... + INCLTDL="$LTDLINCL" +])# AC_LIBLTDL_INSTALLABLE + + +# AC_LIBTOOL_CXX +# -------------- +# enable support for C++ libraries +AC_DEFUN([AC_LIBTOOL_CXX], +[AC_REQUIRE([_LT_AC_LANG_CXX]) +])# AC_LIBTOOL_CXX + + +# _LT_AC_LANG_CXX +# --------------- +AC_DEFUN([_LT_AC_LANG_CXX], +[AC_REQUIRE([AC_PROG_CXX]) +AC_REQUIRE([_LT_AC_PROG_CXXCPP]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}CXX]) +])# _LT_AC_LANG_CXX + +# _LT_AC_PROG_CXXCPP +# ------------------ +AC_DEFUN([_LT_AC_PROG_CXXCPP], +[ +AC_REQUIRE([AC_PROG_CXX]) +if test -n "$CXX" && ( test "X$CXX" != "Xno" && + ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || + (test "X$CXX" != "Xg++"))) ; then + AC_PROG_CXXCPP +fi +])# _LT_AC_PROG_CXXCPP + +# AC_LIBTOOL_F77 +# -------------- +# enable support for Fortran 77 libraries +AC_DEFUN([AC_LIBTOOL_F77], +[AC_REQUIRE([_LT_AC_LANG_F77]) +])# AC_LIBTOOL_F77 + + +# _LT_AC_LANG_F77 +# --------------- +AC_DEFUN([_LT_AC_LANG_F77], +[AC_REQUIRE([AC_PROG_F77]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}F77]) +])# _LT_AC_LANG_F77 + + +# AC_LIBTOOL_GCJ +# -------------- +# enable support for GCJ libraries +AC_DEFUN([AC_LIBTOOL_GCJ], +[AC_REQUIRE([_LT_AC_LANG_GCJ]) +])# AC_LIBTOOL_GCJ + + +# _LT_AC_LANG_GCJ +# --------------- +AC_DEFUN([_LT_AC_LANG_GCJ], +[AC_PROVIDE_IFELSE([AC_PROG_GCJ],[], + [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[], + [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[], + [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])], + [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])], + [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}GCJ]) +])# _LT_AC_LANG_GCJ + + +# AC_LIBTOOL_RC +# ------------- +# enable support for Windows resource files +AC_DEFUN([AC_LIBTOOL_RC], +[AC_REQUIRE([LT_AC_PROG_RC]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}RC]) +])# AC_LIBTOOL_RC + + +# AC_LIBTOOL_LANG_C_CONFIG +# ------------------------ +# Ensure that the configuration vars for the C compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG], [_LT_AC_LANG_C_CONFIG]) +AC_DEFUN([_LT_AC_LANG_C_CONFIG], +[lt_save_CC="$CC" +AC_LANG_PUSH(C) + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}\n' + +_LT_AC_SYS_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) +AC_LIBTOOL_PROG_COMPILER_PIC($1) +AC_LIBTOOL_PROG_CC_C_O($1) +AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) +AC_LIBTOOL_PROG_LD_SHLIBS($1) +AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) +AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) +AC_LIBTOOL_SYS_LIB_STRIP +AC_LIBTOOL_DLOPEN_SELF + +# Report which library types will actually be built +AC_MSG_CHECKING([if libtool supports shared libraries]) +AC_MSG_RESULT([$can_build_shared]) + +AC_MSG_CHECKING([whether to build shared libraries]) +test "$can_build_shared" = "no" && enable_shared=no + +# On AIX, shared libraries and static libraries use the same namespace, and +# are all built from PIC. +case $host_os in +aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + +aix4* | aix5*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; +esac +AC_MSG_RESULT([$enable_shared]) + +AC_MSG_CHECKING([whether to build static libraries]) +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes +AC_MSG_RESULT([$enable_static]) + +AC_LIBTOOL_CONFIG($1) + +AC_LANG_POP +CC="$lt_save_CC" +])# AC_LIBTOOL_LANG_C_CONFIG + + +# AC_LIBTOOL_LANG_CXX_CONFIG +# -------------------------- +# Ensure that the configuration vars for the C compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG], [_LT_AC_LANG_CXX_CONFIG(CXX)]) +AC_DEFUN([_LT_AC_LANG_CXX_CONFIG], +[AC_LANG_PUSH(C++) +AC_REQUIRE([AC_PROG_CXX]) +AC_REQUIRE([_LT_AC_PROG_CXXCPP]) + +_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_AC_TAGVAR(allow_undefined_flag, $1)= +_LT_AC_TAGVAR(always_export_symbols, $1)=no +_LT_AC_TAGVAR(archive_expsym_cmds, $1)= +_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_AC_TAGVAR(hardcode_direct, $1)=no +_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= +_LT_AC_TAGVAR(hardcode_libdir_separator, $1)= +_LT_AC_TAGVAR(hardcode_minus_L, $1)=no +_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported +_LT_AC_TAGVAR(hardcode_automatic, $1)=no +_LT_AC_TAGVAR(module_cmds, $1)= +_LT_AC_TAGVAR(module_expsym_cmds, $1)= +_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown +_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_AC_TAGVAR(no_undefined_flag, $1)= +_LT_AC_TAGVAR(whole_archive_flag_spec, $1)= +_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Dependencies to place before and after the object being linked: +_LT_AC_TAGVAR(predep_objects, $1)= +_LT_AC_TAGVAR(postdep_objects, $1)= +_LT_AC_TAGVAR(predeps, $1)= +_LT_AC_TAGVAR(postdeps, $1)= +_LT_AC_TAGVAR(compiler_lib_search_path, $1)= + +# Source file extension for C++ test sources. +ac_ext=cpp + +# Object file extension for compiled C++ test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }\n' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_AC_SYS_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +lt_save_LD=$LD +lt_save_GCC=$GCC +GCC=$GXX +lt_save_with_gnu_ld=$with_gnu_ld +lt_save_path_LD=$lt_cv_path_LD +if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then + lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx +else + $as_unset lt_cv_prog_gnu_ld +fi +if test -n "${lt_cv_path_LDCXX+set}"; then + lt_cv_path_LD=$lt_cv_path_LDCXX +else + $as_unset lt_cv_path_LD +fi +test -z "${LDCXX+set}" || LD=$LDCXX +CC=${CXX-"c++"} +compiler=$CC +_LT_AC_TAGVAR(compiler, $1)=$CC +_LT_CC_BASENAME([$compiler]) + +# We don't want -fno-exception wen compiling C++ code, so set the +# no_builtin_flag separately +if test "$GXX" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' +else + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= +fi + +if test "$GXX" = yes; then + # Set up default GNU C++ configuration + + AC_PROG_LD + + # Check if GNU C++ uses GNU ld as the underlying linker, since the + # archiving commands below assume that GNU ld is being used. + if test "$with_gnu_ld" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + + # If archive_cmds runs LD, not CC, wlarc should be empty + # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to + # investigate it a little bit more. (MM) + wlarc='${wl}' + + # ancient GNU ld didn't support --whole-archive et. al. + if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ + grep 'no-whole-archive' > /dev/null; then + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + fi + else + with_gnu_ld=no + wlarc= + + # A generic and very simple default shared library creation + # command for GNU C++ for the case where it uses the native + # linker, instead of GNU ld. If possible, this setting should + # overridden to take advantage of the native linker features on + # the platform it is being used on. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + fi + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + +else + GXX=no + with_gnu_ld=no + wlarc= +fi + +# PORTME: fill in a description of your system's C++ link characteristics +AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) +_LT_AC_TAGVAR(ld_shlibs, $1)=yes +case $host_os in + aix3*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) + for ld_flag in $LDFLAGS; do + case $ld_flag in + *-brtl*) + aix_use_runtimelinking=yes + break + ;; + esac + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_AC_TAGVAR(archive_cmds, $1)='' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + if test "$GXX" = yes; then + case $host_os in aix4.[[012]]|aix4.[[012]].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + else + # We have old collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= + fi + ;; + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' + _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' + # Exported symbols can be pulled into shared objects from archives + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='$convenience' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + # This is similar to how AIX traditionally builds its shared libraries. + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + chorus*) + case $cc_basename in + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(always_export_symbols, $1)=no + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + darwin* | rhapsody*) + case $host_os in + rhapsody* | darwin1.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + ;; + 10.*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup' + ;; + esac + fi + ;; + esac + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_automatic, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + if test "$GXX" = yes ; then + lt_int_apple_cc_single_mod=no + output_verbose_link_cmd='echo' + if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then + lt_int_apple_cc_single_mod=yes + fi + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + fi + _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + case $cc_basename in + xlc*) + output_verbose_link_cmd='echo' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' + _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + ;; + *) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + fi + ;; + + dgux*) + case $cc_basename in + ec++*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + ghcx*) + # Green Hills C++ Compiler + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + freebsd[[12]].*) + # C++ shared libraries reported to be fairly broken before switch to ELF + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + freebsd-elf*) + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + ;; + freebsd* | kfreebsd*-gnu | dragonfly*) + # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF + # conventions + _LT_AC_TAGVAR(ld_shlibs, $1)=yes + ;; + gnu*) + ;; + hpux9*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + aCC*) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[[-]]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + hpux10*|hpux11*) + if test $with_gnu_ld = no; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + case $host_cpu in + hppa*64*|ia64*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' + ;; + *) + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + ;; + esac + fi + case $host_cpu in + hppa*64*|ia64*) + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + *) + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + esac + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + aCC*) + case $host_cpu in + hppa*64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes; then + if test $with_gnu_ld = no; then + case $host_cpu in + hppa*64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + fi + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + interix3*) + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + irix5* | irix6*) + case $cc_basename in + CC*) + # SGI C++ + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + + # Archives containing C++ object files must be created using + # "CC -ar", where "CC" is the IRIX C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' + ;; + *) + if test "$GXX" = yes; then + if test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' + fi + fi + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + ;; + esac + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + linux*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' + ;; + icpc*) + # Intel C++ + with_gnu_ld=yes + # version 8.0 and above of icpc choke on multiply defined symbols + # if we add $predep_objects and $postdep_objects, however 7.1 and + # earlier do not add the objects themselves. + case `$CC -V 2>&1` in + *"Version 7."*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + ;; + *) # Version 8.0 or newer + tmp_idyn= + case $host_cpu in + ia64*) tmp_idyn=' -i_dynamic';; + esac + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + ;; + esac + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + ;; + pgCC*) + # Portland Group C++ compiler + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + ;; + cxx*) + # Compaq C++ + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' + + runpath_var=LD_RUN_PATH + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + esac + ;; + lynxos*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + m88k*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + mvs*) + case $cc_basename in + cxx*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' + wlarc= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + fi + # Workaround some broken pre-1.5 toolchains + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' + ;; + openbsd2*) + # C++ shared libraries are fairly broken + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + openbsd*) + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + fi + output_verbose_link_cmd='echo' + ;; + osf3*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' + + ;; + RCC*) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + cxx*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + osf4* | osf5*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Archives containing C++ object files must be created using + # the KAI C++ compiler. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' + ;; + RCC*) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + cxx*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ + echo "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~ + $rm $lib.exp' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + psos*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + lcc*) + # Lucid + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + solaris*) + case $cc_basename in + CC*) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_AC_TAGVAR(archive_cmds_need_lc,$1)=yes + _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + # The C++ compiler is used as linker so we must use $wl + # flag to pass the commands to the underlying system + # linker. We must also pass each convience library through + # to the system linker between allextract/defaultextract. + # The C++ compiler will combine linker options so we + # cannot just pass the convience library names through + # without $wl. + # Supported since Solaris 2.6 (maybe 2.5.1?) + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' + ;; + esac + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + output_verbose_link_cmd='echo' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' + ;; + gcx*) + # Green Hills C++ Compiler + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + + # The C++ compiler must be used to create the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' + ;; + *) + # GNU C++ compiler with Solaris linker + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' + if $CC --version | grep -v '^2\.7' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" + else + # g++ 2.7 appears to require `-G' NOT `-shared' on this + # platform. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" + fi + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' + fi + ;; + esac + ;; + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) + _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + # For security reasons, it is highly recommended that you always + # use absolute paths for naming shared libraries, and exclude the + # DT_RUNPATH tag from executables and libraries. But doing so + # requires that you compile everything twice, which is a pain. + # So that behaviour is only enabled if SCOABSPATH is set to a + # non-empty value in the environment. Most likely only useful for + # creating official distributions of packages. + # This is a hack until libtool officially supports absolute path + # names for shared libraries. + _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + vxworks*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; +esac +AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) +test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no + +_LT_AC_TAGVAR(GCC, $1)="$GXX" +_LT_AC_TAGVAR(LD, $1)="$LD" + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +AC_LIBTOOL_POSTDEP_PREDEP($1) +AC_LIBTOOL_PROG_COMPILER_PIC($1) +AC_LIBTOOL_PROG_CC_C_O($1) +AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) +AC_LIBTOOL_PROG_LD_SHLIBS($1) +AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) +AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) + +AC_LIBTOOL_CONFIG($1) + +AC_LANG_POP +CC=$lt_save_CC +LDCXX=$LD +LD=$lt_save_LD +GCC=$lt_save_GCC +with_gnu_ldcxx=$with_gnu_ld +with_gnu_ld=$lt_save_with_gnu_ld +lt_cv_path_LDCXX=$lt_cv_path_LD +lt_cv_path_LD=$lt_save_path_LD +lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld +lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld +])# AC_LIBTOOL_LANG_CXX_CONFIG + +# AC_LIBTOOL_POSTDEP_PREDEP([TAGNAME]) +# ------------------------------------ +# Figure out "hidden" library dependencies from verbose +# compiler output when linking a shared library. +# Parse the compiler output and extract the necessary +# objects, libraries and library flags. +AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP],[ +dnl we can't use the lt_simple_compile_test_code here, +dnl because it contains code intended for an executable, +dnl not a library. It's possible we should let each +dnl tag define a new lt_????_link_test_code variable, +dnl but it's only used here... +ifelse([$1],[],[cat > conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext <> "$cfgfile" +ifelse([$1], [], +[#! $SHELL + +# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. +# +# This file is part of GNU Libtool: +# Originally by Gordon Matzigkeit , 1996 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# A sed program that does not truncate output. +SED=$lt_SED + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="$SED -e 1s/^X//" + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +# The names of the tagged configurations supported by this script. +available_tags= + +# ### BEGIN LIBTOOL CONFIG], +[# ### BEGIN LIBTOOL TAG CONFIG: $tagname]) + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$_LT_AC_TAGVAR(archive_cmds_need_lc, $1) + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host +host_os=$host_os + +# The build system. +build_alias=$build_alias +build=$build +build_os=$build_os + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# LTCC compiler flags. +LTCFLAGS=$lt_LTCFLAGS + +# A language-specific compiler. +CC=$lt_[]_LT_AC_TAGVAR(compiler, $1) + +# Is the compiler the GNU C compiler? +with_gcc=$_LT_AC_TAGVAR(GCC, $1) + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_[]_LT_AC_TAGVAR(LD, $1) + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$lt_STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext_cmds='$shrext_cmds' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) + +# Must we lock files when doing compilation? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_static, $1) + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_[]_LT_AC_TAGVAR(export_dynamic_flag_spec, $1) + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_[]_LT_AC_TAGVAR(whole_archive_flag_spec, $1) + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_[]_LT_AC_TAGVAR(thread_safe_flag_spec, $1) + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_cmds, $1) +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_new_cmds, $1) + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) + +# Commands used to build and install a shared archive. +archive_cmds=$lt_[]_LT_AC_TAGVAR(archive_cmds, $1) +archive_expsym_cmds=$lt_[]_LT_AC_TAGVAR(archive_expsym_cmds, $1) +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_[]_LT_AC_TAGVAR(module_cmds, $1) +module_expsym_cmds=$lt_[]_LT_AC_TAGVAR(module_expsym_cmds, $1) + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_[]_LT_AC_TAGVAR(predep_objects, $1) + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_[]_LT_AC_TAGVAR(postdep_objects, $1) + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_[]_LT_AC_TAGVAR(predeps, $1) + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1) + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1) + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_[]_LT_AC_TAGVAR(allow_undefined_flag, $1) + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_[]_LT_AC_TAGVAR(no_undefined_flag, $1) + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$_LT_AC_TAGVAR(hardcode_action, $1) + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_separator, $1) + +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$_LT_AC_TAGVAR(hardcode_direct, $1) + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$_LT_AC_TAGVAR(hardcode_minus_L, $1) + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1) + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$_LT_AC_TAGVAR(hardcode_automatic, $1) + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$_LT_AC_TAGVAR(link_all_deplibs, $1) + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$_LT_AC_TAGVAR(fix_srcfile_path, $1)" + +# Set to yes if exported symbols are required. +always_export_symbols=$_LT_AC_TAGVAR(always_export_symbols, $1) + +# The commands to list exported symbols. +export_symbols_cmds=$lt_[]_LT_AC_TAGVAR(export_symbols_cmds, $1) + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_[]_LT_AC_TAGVAR(exclude_expsyms, $1) + +# Symbols that must always be exported. +include_expsyms=$lt_[]_LT_AC_TAGVAR(include_expsyms, $1) + +ifelse([$1],[], +[# ### END LIBTOOL CONFIG], +[# ### END LIBTOOL TAG CONFIG: $tagname]) + +__EOF__ + +ifelse([$1],[], [ + case $host_os in + aix3*) + cat <<\EOF >> "$cfgfile" + +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +EOF + ;; + esac + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) + + mv -f "$cfgfile" "$ofile" || \ + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" +]) +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` + if test -f "$ltmain_in"; then + test -f Makefile && make "$ltmain" + fi +fi +])# AC_LIBTOOL_CONFIG + + +# AC_LIBTOOL_PROG_COMPILER_NO_RTTI([TAGNAME]) +# ------------------------------------------- +AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], +[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl + +_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= + +if test "$GCC" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' + + AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], + lt_cv_prog_compiler_rtti_exceptions, + [-fno-rtti -fno-exceptions], [], + [_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) +fi +])# AC_LIBTOOL_PROG_COMPILER_NO_RTTI + + +# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE +# --------------------------------- +AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], +[AC_REQUIRE([AC_CANONICAL_HOST]) +AC_REQUIRE([AC_PROG_NM]) +AC_REQUIRE([AC_OBJEXT]) +# Check for command to grab the raw symbol name followed by C symbol from nm. +AC_MSG_CHECKING([command to parse $NM output from $compiler object]) +AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], +[ +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[[BCDEGRST]]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' + +# Transform an extracted symbol line into a proper C declaration +lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[[BCDT]]' + ;; +cygwin* | mingw* | pw32*) + symcode='[[ABCDGISTW]]' + ;; +hpux*) # Its linker distinguishes data from code symbols + if test "$host_cpu" = ia64; then + symcode='[[ABCDEGRST]]' + fi + lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + ;; +linux*) + if test "$host_cpu" = ia64; then + symcode='[[ABCDGIRSTW]]' + lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + fi + ;; +irix* | nonstopux*) + symcode='[[BCDEGRST]]' + ;; +osf*) + symcode='[[BCDEGQRST]]' + ;; +solaris*) + symcode='[[BDRT]]' + ;; +sco3.2v5*) + symcode='[[DT]]' + ;; +sysv4.2uw2*) + symcode='[[DT]]' + ;; +sysv5* | sco5v6* | unixware* | OpenUNIX*) + symcode='[[ABDT]]' + ;; +sysv4) + symcode='[[DFNSTU]]' + ;; +esac + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[[ABCDGIRSTW]]' ;; +esac + +# Try without a prefix undercore, then with it. +for ac_symprfx in "" "_"; do + + # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. + symxfrm="\\1 $ac_symprfx\\2 \\2" + + # Write the raw and C identifiers. + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext < $nlist) && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if grep ' nm_test_var$' "$nlist" >/dev/null; then + if grep ' nm_test_func$' "$nlist" >/dev/null; then + cat < conftest.$ac_ext +#ifdef __cplusplus +extern "C" { +#endif + +EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' + + cat <> conftest.$ac_ext +#if defined (__STDC__) && __STDC__ +# define lt_ptr_t void * +#else +# define lt_ptr_t char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr_t address; +} +lt_preloaded_symbols[[]] = +{ +EOF + $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext + cat <<\EOF >> conftest.$ac_ext + {0, (lt_ptr_t) 0} +}; + +#ifdef __cplusplus +} +#endif +EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_save_LIBS="$LIBS" + lt_save_CFLAGS="$CFLAGS" + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" + if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then + pipe_works=yes + fi + LIBS="$lt_save_LIBS" + CFLAGS="$lt_save_CFLAGS" + else + echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD + fi + else + echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD + cat conftest.$ac_ext >&5 + fi + rm -f conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done +]) +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + AC_MSG_RESULT(failed) +else + AC_MSG_RESULT(ok) +fi +]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE + + +# AC_LIBTOOL_PROG_COMPILER_PIC([TAGNAME]) +# --------------------------------------- +AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC], +[_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)= +_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= +_LT_AC_TAGVAR(lt_prog_compiler_static, $1)= + +AC_MSG_CHECKING([for $compiler option to produce PIC]) + ifelse([$1],[CXX],[ + # C++ specific cases for pic, static, wl, etc. + if test "$GXX" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + mingw* | os2* | pw32*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + *djgpp*) + # DJGPP does not support shared libraries at all + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + interix3*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + sysv4*MP*) + if test -d /usr/nec; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + else + case $host_os in + aix4* | aix5*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + chorus*) + case $cc_basename in + cxch68*) + # Green Hills C++ Compiler + # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" + ;; + esac + ;; + darwin*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + case $cc_basename in + xlc*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon' + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + ;; + esac + ;; + dgux*) + case $cc_basename in + ec++*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + ghcx*) + # Green Hills C++ Compiler + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + freebsd* | kfreebsd*-gnu | dragonfly*) + # FreeBSD uses GNU C++ + ;; + hpux9* | hpux10* | hpux11*) + case $cc_basename in + CC*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + if test "$host_cpu" != ia64; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + fi + ;; + aCC*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + ;; + *) + ;; + esac + ;; + interix*) + # This is c89, which is MS Visual C++ (no shared libs) + # Anyone wants to do a port? + ;; + irix5* | irix6* | nonstopux*) + case $cc_basename in + CC*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + # CC pic flag -KPIC is the default. + ;; + *) + ;; + esac + ;; + linux*) + case $cc_basename in + KCC*) + # KAI C++ Compiler + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + icpc* | ecpc*) + # Intel C++ + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + pgCC*) + # Portland Group C++ compiler. + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + cxx*) + # Compaq C++ + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + *) + ;; + esac + ;; + lynxos*) + ;; + m88k*) + ;; + mvs*) + case $cc_basename in + cxx*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' + ;; + *) + ;; + esac + ;; + netbsd*) + ;; + osf3* | osf4* | osf5*) + case $cc_basename in + KCC*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + ;; + RCC*) + # Rational C++ 2.4.1 + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + cxx*) + # Digital/Compaq C++ + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + *) + ;; + esac + ;; + psos*) + ;; + solaris*) + case $cc_basename in + CC*) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + gcx*) + # Green Hills C++ Compiler + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + ;; + *) + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + lcc*) + # Lucid + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + *) + ;; + esac + ;; + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + case $cc_basename in + CC*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + esac + ;; + vxworks*) + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +], +[ + if test "$GCC" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + + beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + + interix3*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + enable_shared=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + darwin*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + case $cc_basename in + xlc*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon' + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + ;; + esac + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC (with -KPIC) is the default. + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + newsos6) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + linux*) + case $cc_basename in + icc* | ecc*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + pgcc* | pgf77* | pgf90* | pgf95*) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + ccc*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All Alpha code is PIC. + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + esac + ;; + + osf3* | osf4* | osf5*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All OSF/1 code is PIC. + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + solaris*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + case $cc_basename in + f77* | f90* | f95*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; + *) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; + esac + ;; + + sunos4*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + unicos*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + + uts4*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + *) + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +]) +AC_MSG_RESULT([$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)]) + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then + AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works], + _LT_AC_TAGVAR(lt_prog_compiler_pic_works, $1), + [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])], [], + [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in + "" | " "*) ;; + *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)" ;; + esac], + [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) +fi +case $host_os in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])" + ;; +esac + +# +# Check to make sure the static flag actually works. +# +wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_AC_TAGVAR(lt_prog_compiler_static, $1)\" +AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], + _LT_AC_TAGVAR(lt_prog_compiler_static_works, $1), + $lt_tmp_static_flag, + [], + [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=]) +]) + + +# AC_LIBTOOL_PROG_LD_SHLIBS([TAGNAME]) +# ------------------------------------ +# See if the linker supports building shared libraries. +AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS], +[AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) +ifelse([$1],[CXX],[ + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + case $host_os in + aix4* | aix5*) + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + else + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + fi + ;; + pw32*) + _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" + ;; + cygwin* | mingw*) + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]] /s/.* \([[^ ]]*\)/\1 DATA/;/^.* __nm__/s/^.* __nm__\([[^ ]]*\) [[^ ]]*/\1 DATA/;/^I /d;/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' + ;; + *) + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + ;; + esac +],[ + runpath_var= + _LT_AC_TAGVAR(allow_undefined_flag, $1)= + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no + _LT_AC_TAGVAR(archive_cmds, $1)= + _LT_AC_TAGVAR(archive_expsym_cmds, $1)= + _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)= + _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)= + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + _LT_AC_TAGVAR(thread_safe_flag_spec, $1)= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_minus_L, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown + _LT_AC_TAGVAR(hardcode_automatic, $1)=no + _LT_AC_TAGVAR(module_cmds, $1)= + _LT_AC_TAGVAR(module_expsym_cmds, $1)= + _LT_AC_TAGVAR(always_export_symbols, $1)=no + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + _LT_AC_TAGVAR(include_expsyms, $1)= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + _LT_AC_TAGVAR(exclude_expsyms, $1)="_GLOBAL_OFFSET_TABLE_" + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + extract_expsyms_cmds= + # Just being paranoid about ensuring that cc_basename is set. + _LT_CC_BASENAME([$compiler]) + case $host_os in + cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + _LT_AC_TAGVAR(ld_shlibs, $1)=yes + if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + fi + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + + # See if GNU ld supports shared libraries. + case $host_os in + aix3* | aix4* | aix5*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + _LT_AC_TAGVAR(ld_shlibs, $1)=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + fi + ;; + + amigaos*) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can't use + # them. + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(always_export_symbols, $1)=no + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + interix3*) + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + + linux*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test $supports_anon_versioning = yes; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + $echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris*) + if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then + _LT_AC_TAGVAR(ld_shlibs, $1)=no + cat <&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + cat <<_LT_EOF 1>&2 + +*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not +*** reliably create shared libraries on SCO systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.16.91.0.3 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + ;; + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + sunos4*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + + if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no; then + runpath_var= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported + fi + ;; + + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + else + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_AC_TAGVAR(archive_cmds, $1)='' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + if test "$GCC" = yes; then + case $host_os in aix4.[[012]]|aix4.[[012]].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + else + # We have old collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= + fi + ;; + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' + _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' + # Exported symbols can be pulled into shared objects from archives + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='$convenience' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + # This is similar to how AIX traditionally builds its shared libraries. + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + # see comment about different semantics on the GNU ld section + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + + bsdi[[45]]*) + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic + ;; + + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='true' + # FIXME: Should let the user specify the lib program. + _LT_AC_TAGVAR(old_archive_cmds, $1)='lib /OUT:$oldlib$oldobjs$old_deplibs' + _LT_AC_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`' + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + ;; + + darwin* | rhapsody*) + case $host_os in + rhapsody* | darwin1.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + ;; + 10.*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup' + ;; + esac + fi + ;; + esac + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_automatic, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + if test "$GCC" = yes ; then + output_verbose_link_cmd='echo' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + case $cc_basename in + xlc*) + output_verbose_link_cmd='echo' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' + _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + ;; + *) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + fi + ;; + + dgux*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + freebsd1.*) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2.*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | kfreebsd*-gnu | dragonfly*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + hpux9*) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + ;; + + hpux10*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + fi + if test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + fi + ;; + + hpux11*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + case $host_cpu in + hppa*64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case $host_cpu in + hppa*64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + fi + if test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + case $host_cpu in + hppa*64*|ia64*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + *) + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + newsos6) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + openbsd*) + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + else + case $host_os in + openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + ;; + esac + fi + ;; + + os2*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(archive_cmds, $1)='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + else + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' + + # Both c and cxx compiler support -rpath directly + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + fi + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + solaris*) + _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' + if test "$GCC" = yes; then + wlarc='${wl}' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' + else + wlarc='' + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + # The compiler driver will combine linker options so we + # cannot just pass the convience library names through + # without $wl, iff we do not link with $LD. + # Luckily, gcc supports the same syntax we need for Sun Studio. + # Supported since Solaris 2.6 (maybe 2.5.1?) + case $wlarc in + '') + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; + *) + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; + esac ;; + esac + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4) + case $host_vendor in + sni) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + ;; + motorola) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4.3*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + _LT_AC_TAGVAR(ld_shlibs, $1)=yes + fi + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7*) + _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + uts4*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + fi +]) +AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) +test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no + +# +# Do we need to explicitly link libc? +# +case "x$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)" in +x|xyes) + # Assume -lc should be added + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $_LT_AC_TAGVAR(archive_cmds, $1) in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + AC_MSG_CHECKING([whether -lc should be explicitly linked in]) + $rm conftest* + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + if AC_TRY_EVAL(ac_compile) 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) + pic_flag=$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$_LT_AC_TAGVAR(allow_undefined_flag, $1) + _LT_AC_TAGVAR(allow_undefined_flag, $1)= + if AC_TRY_EVAL(_LT_AC_TAGVAR(archive_cmds, $1) 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) + then + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + else + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + fi + _LT_AC_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + AC_MSG_RESULT([$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)]) + ;; + esac + fi + ;; +esac +])# AC_LIBTOOL_PROG_LD_SHLIBS + + +# _LT_AC_FILE_LTDLL_C +# ------------------- +# Be careful that the start marker always follows a newline. +AC_DEFUN([_LT_AC_FILE_LTDLL_C], [ +# /* ltdll.c starts here */ +# #define WIN32_LEAN_AND_MEAN +# #include +# #undef WIN32_LEAN_AND_MEAN +# #include +# +# #ifndef __CYGWIN__ +# # ifdef __CYGWIN32__ +# # define __CYGWIN__ __CYGWIN32__ +# # endif +# #endif +# +# #ifdef __cplusplus +# extern "C" { +# #endif +# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); +# #ifdef __cplusplus +# } +# #endif +# +# #ifdef __CYGWIN__ +# #include +# DECLARE_CYGWIN_DLL( DllMain ); +# #endif +# HINSTANCE __hDllInstance_base; +# +# BOOL APIENTRY +# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) +# { +# __hDllInstance_base = hInst; +# return TRUE; +# } +# /* ltdll.c ends here */ +])# _LT_AC_FILE_LTDLL_C + + +# _LT_AC_TAGVAR(VARNAME, [TAGNAME]) +# --------------------------------- +AC_DEFUN([_LT_AC_TAGVAR], [ifelse([$2], [], [$1], [$1_$2])]) + + +# old names +AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL]) +AC_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) +AC_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) +AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) +AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) +AC_DEFUN([AM_PROG_LD], [AC_PROG_LD]) +AC_DEFUN([AM_PROG_NM], [AC_PROG_NM]) + +# This is just to silence aclocal about the macro not being used +ifelse([AC_DISABLE_FAST_INSTALL]) + +AC_DEFUN([LT_AC_PROG_GCJ], +[AC_CHECK_TOOL(GCJ, gcj, no) + test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" + AC_SUBST(GCJFLAGS) +]) + +AC_DEFUN([LT_AC_PROG_RC], +[AC_CHECK_TOOL(RC, windres, no) +]) + +############################################################ +# NOTE: This macro has been submitted for inclusion into # +# GNU Autoconf as AC_PROG_SED. When it is available in # +# a released version of Autoconf we should remove this # +# macro and use it instead. # +############################################################ +# LT_AC_PROG_SED +# -------------- +# Check for a fully-functional sed program, that truncates +# as few characters as possible. Prefer GNU sed if found. +AC_DEFUN([LT_AC_PROG_SED], +[AC_MSG_CHECKING([for a sed that does not truncate output]) +AC_CACHE_VAL(lt_cv_path_SED, +[# Loop through the user's path and test for sed and gsed. +# Then use that list of sed's as ones to test for truncation. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for lt_ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then + lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" + fi + done + done +done +lt_ac_max=0 +lt_ac_count=0 +# Add /usr/xpg4/bin/sed as it is typically found on Solaris +# along with /bin/sed that truncates output. +for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do + test ! -f $lt_ac_sed && continue + cat /dev/null > conftest.in + lt_ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >conftest.in + # Check for GNU sed and select it if it is found. + if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then + lt_cv_path_SED=$lt_ac_sed + break + fi + while true; do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo >>conftest.nl + $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break + cmp -s conftest.out conftest.nl || break + # 10000 chars as input seems more than enough + test $lt_ac_count -gt 10 && break + lt_ac_count=`expr $lt_ac_count + 1` + if test $lt_ac_count -gt $lt_ac_max; then + lt_ac_max=$lt_ac_count + lt_cv_path_SED=$lt_ac_sed + fi + done +done +]) +SED=$lt_cv_path_SED +AC_MSG_RESULT([$SED]) +]) diff --git a/autoconf/m4/link_options.m4 b/autoconf/m4/link_options.m4 new file mode 100644 index 000000000..b58d61745 --- /dev/null +++ b/autoconf/m4/link_options.m4 @@ -0,0 +1,109 @@ +# +# Get the linker version string. +# +# This macro is specific to LLVM. +# +AC_DEFUN([AC_LINK_GET_VERSION], + [AC_CACHE_CHECK([for linker version],[llvm_cv_link_version], + [ + version_string="$(ld -v 2>&1 | head -1)" + + # Check for ld64. + if (echo "$version_string" | grep -q "ld64"); then + llvm_cv_link_version=$(echo "$version_string" | sed -e "s#.*ld64-\([^ ]*\)\( (.*)\)\{0,1\}#\1#") + else + llvm_cv_link_version=$(echo "$version_string" | sed -e "s#[^0-9]*\([0-9.]*\).*#\1#") + fi + ]) + AC_DEFINE_UNQUOTED([HOST_LINK_VERSION],"$llvm_cv_link_version", + [Linker version detected at compile time.]) +]) + +# +# Determine if the system can handle the -R option being passed to the linker. +# +# This macro is specific to LLVM. +# +AC_DEFUN([AC_LINK_USE_R], +[AC_CACHE_CHECK([for compiler -Wl,-R option],[llvm_cv_link_use_r], +[ AC_LANG_PUSH([C]) + oldcflags="$CFLAGS" + CFLAGS="$CFLAGS -Wl,-R." + AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])], + [llvm_cv_link_use_r=yes],[llvm_cv_link_use_r=no]) + CFLAGS="$oldcflags" + AC_LANG_POP([C]) +]) +if test "$llvm_cv_link_use_r" = yes ; then + AC_DEFINE([HAVE_LINK_R],[1],[Define if you can use -Wl,-R. to pass -R. to the linker, in order to add the current directory to the dynamic linker search path.]) + fi +]) + +# +# Determine if the system can handle the -rdynamic option being passed +# to the compiler. +# +# This macro is specific to LLVM. +# +AC_DEFUN([AC_LINK_EXPORT_DYNAMIC], +[AC_CACHE_CHECK([for compiler -rdynamic option], + [llvm_cv_link_use_export_dynamic], +[ AC_LANG_PUSH([C]) + oldcflags="$CFLAGS" + CFLAGS="$CFLAGS -rdynamic" + AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])], + [llvm_cv_link_use_export_dynamic=yes],[llvm_cv_link_use_export_dynamic=no]) + CFLAGS="$oldcflags" + AC_LANG_POP([C]) +]) +if test "$llvm_cv_link_use_export_dynamic" = yes ; then + AC_DEFINE([HAVE_LINK_EXPORT_DYNAMIC],[1],[Define if you can use -rdynamic.]) + fi +]) + +# +# Determine if the system can handle the --version-script option being +# passed to the linker. +# +# This macro is specific to LLVM. +# +AC_DEFUN([AC_LINK_VERSION_SCRIPT], +[AC_CACHE_CHECK([for compiler -Wl,--version-script option], + [llvm_cv_link_use_version_script], +[ AC_LANG_PUSH([C]) + oldcflags="$CFLAGS" + + # The following code is from the autoconf manual, + # "11.13: Limitations of Usual Tools". + # Create a temporary directory $tmp in $TMPDIR (default /tmp). + # Use mktemp if possible; otherwise fall back on mkdir, + # with $RANDOM to make collisions less likely. + : ${TMPDIR=/tmp} + { + tmp=` + (umask 077 && mktemp -d "$TMPDIR/fooXXXXXX") 2>/dev/null + ` && + test -n "$tmp" && test -d "$tmp" + } || { + tmp=$TMPDIR/foo$$-$RANDOM + (umask 077 && mkdir "$tmp") + } || exit $? + + echo "{" > "$tmp/export.map" + echo " global: main;" >> "$tmp/export.map" + echo " local: *;" >> "$tmp/export.map" + echo "};" >> "$tmp/export.map" + + CFLAGS="$CFLAGS -Wl,--version-script=$tmp/export.map" + AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])], + [llvm_cv_link_use_version_script=yes],[llvm_cv_link_use_version_script=no]) + rm "$tmp/export.map" + rmdir "$tmp" + CFLAGS="$oldcflags" + AC_LANG_POP([C]) +]) +if test "$llvm_cv_link_use_version_script" = yes ; then + AC_SUBST(HAVE_LINK_VERSION_SCRIPT,1) + fi +]) + diff --git a/autoconf/m4/linux_mixed_64_32.m4 b/autoconf/m4/linux_mixed_64_32.m4 new file mode 100644 index 000000000..123491f87 --- /dev/null +++ b/autoconf/m4/linux_mixed_64_32.m4 @@ -0,0 +1,17 @@ +# +# Some Linux machines run a 64-bit kernel with a 32-bit userspace. 'uname -m' +# shows these as x86_64. Ask the system 'gcc' what it thinks. +# +AC_DEFUN([AC_IS_LINUX_MIXED], +[AC_CACHE_CHECK(for 32-bit userspace on 64-bit system,llvm_cv_linux_mixed, +[ AC_LANG_PUSH([C]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM( + [[#ifndef __x86_64__ + error: Not x86-64 even if uname says so! + #endif + ]])], + [llvm_cv_linux_mixed=no], + [llvm_cv_linux_mixed=yes]) + AC_LANG_POP([C]) +]) +]) diff --git a/autoconf/m4/ltdl.m4 b/autoconf/m4/ltdl.m4 new file mode 100644 index 000000000..0a36dbe7c --- /dev/null +++ b/autoconf/m4/ltdl.m4 @@ -0,0 +1,403 @@ +## ltdl.m4 - Configure ltdl for the target system. -*-Autoconf-*- +## Copyright (C) 1999-2000 Free Software Foundation, Inc. +## +## This file is free software; the Free Software Foundation gives +## unlimited permission to copy and/or distribute it, with or without +## modifications, as long as this notice is preserved. + +# serial 7 AC_LIB_LTDL + +# AC_WITH_LTDL +# ------------ +# Clients of libltdl can use this macro to allow the installer to +# choose between a shipped copy of the ltdl sources or a preinstalled +# version of the library. +AC_DEFUN([AC_WITH_LTDL], +[AC_REQUIRE([AC_LIB_LTDL]) +AC_SUBST([LIBLTDL]) +AC_SUBST([INCLTDL]) + +# Unless the user asks us to check, assume no installed ltdl exists. +use_installed_libltdl=no + +AC_ARG_WITH([included_ltdl], + [ --with-included-ltdl use the GNU ltdl sources included here]) + +if test "x$with_included_ltdl" != xyes; then + # We are not being forced to use the included libltdl sources, so + # decide whether there is a useful installed version we can use. + AC_CHECK_HEADER([ltdl.h], + [AC_CHECK_LIB([ltdl], [lt_dlcaller_register], + [with_included_ltdl=no], + [with_included_ltdl=yes]) + ]) +fi + +if test "x$enable_ltdl_install" != xyes; then + # If the user did not specify an installable libltdl, then default + # to a convenience lib. + AC_LIBLTDL_CONVENIENCE +fi + +if test "x$with_included_ltdl" = xno; then + # If the included ltdl is not to be used. then Use the + # preinstalled libltdl we found. + AC_DEFINE([HAVE_LTDL], [1], + [Define this if a modern libltdl is already installed]) + LIBLTDL=-lltdl +fi + +# Report our decision... +AC_MSG_CHECKING([whether to use included libltdl]) +AC_MSG_RESULT([$with_included_ltdl]) + +AC_CONFIG_SUBDIRS([libltdl]) +])# AC_WITH_LTDL + + +# AC_LIB_LTDL +# ----------- +# Perform all the checks necessary for compilation of the ltdl objects +# -- including compiler checks and header checks. +AC_DEFUN([AC_LIB_LTDL], +[AC_PREREQ(2.60) +AC_REQUIRE([AC_PROG_CC]) +AC_REQUIRE([AC_C_CONST]) +AC_REQUIRE([AC_HEADER_STDC]) +AC_REQUIRE([AC_HEADER_DIRENT]) +AC_REQUIRE([_LT_AC_CHECK_DLFCN]) +AC_REQUIRE([AC_LTDL_ENABLE_INSTALL]) +AC_REQUIRE([AC_LTDL_SHLIBEXT]) +AC_REQUIRE([AC_LTDL_SYSSEARCHPATH]) +AC_REQUIRE([AC_LTDL_OBJDIR]) +AC_REQUIRE([AC_LTDL_DLPREOPEN]) +AC_REQUIRE([AC_LTDL_DLLIB]) +AC_REQUIRE([AC_LTDL_SYMBOL_USCORE]) +AC_REQUIRE([AC_LTDL_DLSYM_USCORE]) +AC_REQUIRE([AC_LTDL_SYS_DLOPEN_DEPLIBS]) +AC_REQUIRE([AC_LTDL_FUNC_ARGZ]) + +AC_CHECK_HEADERS([assert.h ctype.h errno.h malloc.h memory.h stdlib.h \ + stdio.h unistd.h]) +AC_CHECK_HEADERS([dl.h sys/dl.h dld.h mach-o/dyld.h]) +AC_CHECK_HEADERS([string.h strings.h], [break]) + +AC_CHECK_FUNCS([strchr index], [break]) +AC_CHECK_FUNCS([strrchr rindex], [break]) +AC_CHECK_FUNCS([memcpy bcopy], [break]) +AC_CHECK_FUNCS([memmove strcmp]) +AC_CHECK_FUNCS([closedir opendir readdir]) +])# AC_LIB_LTDL + + +# AC_LTDL_ENABLE_INSTALL +# ---------------------- +AC_DEFUN([AC_LTDL_ENABLE_INSTALL], +[AC_ARG_ENABLE([ltdl-install], + [AS_HELP_STRING([--enable-ltdl-install],[install libltdl])]) + +AM_CONDITIONAL(INSTALL_LTDL, test x"${enable_ltdl_install-no}" != xno) +AM_CONDITIONAL(CONVENIENCE_LTDL, test x"${enable_ltdl_convenience-no}" != xno) +])# AC_LTDL_ENABLE_INSTALL + + +# AC_LTDL_SYS_DLOPEN_DEPLIBS +# -------------------------- +AC_DEFUN([AC_LTDL_SYS_DLOPEN_DEPLIBS], +[AC_REQUIRE([AC_CANONICAL_HOST]) +AC_CACHE_CHECK([whether deplibs are loaded by dlopen], + [libltdl_cv_sys_dlopen_deplibs], + [# PORTME does your system automatically load deplibs for dlopen? + # or its logical equivalent (e.g. shl_load for HP-UX < 11) + # For now, we just catch OSes we know something about -- in the + # future, we'll try test this programmatically. + libltdl_cv_sys_dlopen_deplibs=unknown + case "$host_os" in + aix3*|aix4.1.*|aix4.2.*) + # Unknown whether this is true for these versions of AIX, but + # we want this `case' here to explicitly catch those versions. + libltdl_cv_sys_dlopen_deplibs=unknown + ;; + aix[[45]]*) + libltdl_cv_sys_dlopen_deplibs=yes + ;; + darwin*) + # Assuming the user has installed a libdl from somewhere, this is true + # If you are looking for one http://www.opendarwin.org/projects/dlcompat + libltdl_cv_sys_dlopen_deplibs=yes + ;; + gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu) + # GNU and its variants, using gnu ld.so (Glibc) + libltdl_cv_sys_dlopen_deplibs=yes + ;; + hpux10*|hpux11*) + libltdl_cv_sys_dlopen_deplibs=yes + ;; + interix*) + libltdl_cv_sys_dlopen_deplibs=yes + ;; + irix[[12345]]*|irix6.[[01]]*) + # Catch all versions of IRIX before 6.2, and indicate that we don't + # know how it worked for any of those versions. + libltdl_cv_sys_dlopen_deplibs=unknown + ;; + irix*) + # The case above catches anything before 6.2, and it's known that + # at 6.2 and later dlopen does load deplibs. + libltdl_cv_sys_dlopen_deplibs=yes + ;; + netbsd*) + libltdl_cv_sys_dlopen_deplibs=yes + ;; + openbsd*) + libltdl_cv_sys_dlopen_deplibs=yes + ;; + osf[[1234]]*) + # dlopen did load deplibs (at least at 4.x), but until the 5.x series, + # it did *not* use an RPATH in a shared library to find objects the + # library depends on, so we explicitly say `no'. + libltdl_cv_sys_dlopen_deplibs=no + ;; + osf5.0|osf5.0a|osf5.1) + # dlopen *does* load deplibs and with the right loader patch applied + # it even uses RPATH in a shared library to search for shared objects + # that the library depends on, but there's no easy way to know if that + # patch is installed. Since this is the case, all we can really + # say is unknown -- it depends on the patch being installed. If + # it is, this changes to `yes'. Without it, it would be `no'. + libltdl_cv_sys_dlopen_deplibs=unknown + ;; + osf*) + # the two cases above should catch all versions of osf <= 5.1. Read + # the comments above for what we know about them. + # At > 5.1, deplibs are loaded *and* any RPATH in a shared library + # is used to find them so we can finally say `yes'. + libltdl_cv_sys_dlopen_deplibs=yes + ;; + solaris*) + libltdl_cv_sys_dlopen_deplibs=yes + ;; + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + libltdl_cv_sys_dlopen_deplibs=yes + ;; + esac + ]) +if test "$libltdl_cv_sys_dlopen_deplibs" != yes; then + AC_DEFINE([LTDL_DLOPEN_DEPLIBS], [1], + [Define if the OS needs help to load dependent libraries for dlopen().]) +fi +])# AC_LTDL_SYS_DLOPEN_DEPLIBS + + +# AC_LTDL_SHLIBEXT +# ---------------- +AC_DEFUN([AC_LTDL_SHLIBEXT], +[AC_REQUIRE([AC_LIBTOOL_SYS_DYNAMIC_LINKER]) +AC_CACHE_CHECK([which extension is used for loadable modules], + [libltdl_cv_shlibext], +[ +module=yes +eval libltdl_cv_shlibext=$shrext_cmds + ]) +if test -n "$libltdl_cv_shlibext"; then + AC_DEFINE_UNQUOTED([LTDL_SHLIB_EXT], ["$libltdl_cv_shlibext"], + [Define to the extension used for shared libraries, say, ".so".]) +fi +])# AC_LTDL_SHLIBEXT + +# AC_LTDL_SYSSEARCHPATH +# --------------------- +AC_DEFUN([AC_LTDL_SYSSEARCHPATH], +[AC_REQUIRE([AC_LIBTOOL_SYS_DYNAMIC_LINKER]) +AC_CACHE_CHECK([for the default library search path], + [libltdl_cv_sys_search_path], + [libltdl_cv_sys_search_path="$sys_lib_dlsearch_path_spec"]) +if test -n "$libltdl_cv_sys_search_path"; then + sys_search_path= + for dir in $libltdl_cv_sys_search_path; do + if test -z "$sys_search_path"; then + sys_search_path="$dir" + else + sys_search_path="$sys_search_path$PATH_SEPARATOR$dir" + fi + done + AC_DEFINE_UNQUOTED([LTDL_SYSSEARCHPATH], ["$sys_search_path"], + [Define to the system default library search path.]) +fi +])# AC_LTDL_SYSSEARCHPATH + + +# AC_LTDL_OBJDIR +# -------------- +AC_DEFUN([AC_LTDL_OBJDIR], +[AC_CACHE_CHECK([for objdir], + [libltdl_cv_objdir], + [libltdl_cv_objdir="$objdir" + if test -n "$objdir"; then + : + else + rm -f .libs 2>/dev/null + mkdir .libs 2>/dev/null + if test -d .libs; then + libltdl_cv_objdir=.libs + else + # MS-DOS does not allow filenames that begin with a dot. + libltdl_cv_objdir=_libs + fi + rmdir .libs 2>/dev/null + fi + ]) +AC_DEFINE_UNQUOTED([LTDL_OBJDIR], ["$libltdl_cv_objdir/"], + [Define to the sub-directory in which libtool stores uninstalled libraries.]) +])# AC_LTDL_OBJDIR + + +# AC_LTDL_DLPREOPEN +# ----------------- +AC_DEFUN([AC_LTDL_DLPREOPEN], +[AC_REQUIRE([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE]) +AC_CACHE_CHECK([whether libtool supports -dlopen/-dlpreopen], + [libltdl_cv_preloaded_symbols], + [if test -n "$lt_cv_sys_global_symbol_pipe"; then + libltdl_cv_preloaded_symbols=yes + else + libltdl_cv_preloaded_symbols=no + fi + ]) +if test x"$libltdl_cv_preloaded_symbols" = xyes; then + AC_DEFINE([HAVE_PRELOADED_SYMBOLS], [1], + [Define if libtool can extract symbol lists from object files.]) +fi +])# AC_LTDL_DLPREOPEN + + +# AC_LTDL_DLLIB +# ------------- +AC_DEFUN([AC_LTDL_DLLIB], +[LIBADD_DL= +AC_SUBST(LIBADD_DL) +AC_LANG_PUSH([C]) + +AC_CHECK_FUNC([shl_load], + [AC_DEFINE([HAVE_SHL_LOAD], [1], + [Define if you have the shl_load function.])], + [AC_CHECK_LIB([dld], [shl_load], + [AC_DEFINE([HAVE_SHL_LOAD], [1], + [Define if you have the shl_load function.]) + LIBADD_DL="$LIBADD_DL -ldld"], + [AC_CHECK_LIB([dl], [dlopen], + [AC_DEFINE([HAVE_LIBDL], [1], + [Define if you have the libdl library or equivalent.]) + LIBADD_DL="-ldl" libltdl_cv_lib_dl_dlopen="yes"], + [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#if HAVE_DLFCN_H +# include +#endif + ]], [[dlopen(0, 0);]])],[AC_DEFINE([HAVE_LIBDL], [1], + [Define if you have the libdl library or equivalent.]) libltdl_cv_func_dlopen="yes"],[AC_CHECK_LIB([svld], [dlopen], + [AC_DEFINE([HAVE_LIBDL], [1], + [Define if you have the libdl library or equivalent.]) + LIBADD_DL="-lsvld" libltdl_cv_func_dlopen="yes"], + [AC_CHECK_LIB([dld], [dld_link], + [AC_DEFINE([HAVE_DLD], [1], + [Define if you have the GNU dld library.]) + LIBADD_DL="$LIBADD_DL -ldld"], + [AC_CHECK_FUNC([_dyld_func_lookup], + [AC_DEFINE([HAVE_DYLD], [1], + [Define if you have the _dyld_func_lookup function.])]) + ]) + ]) + ]) + ]) + ]) +]) + +if test x"$libltdl_cv_func_dlopen" = xyes || test x"$libltdl_cv_lib_dl_dlopen" = xyes +then + lt_save_LIBS="$LIBS" + LIBS="$LIBS $LIBADD_DL" + AC_CHECK_FUNCS([dlerror]) + LIBS="$lt_save_LIBS" +fi +AC_LANG_POP +])# AC_LTDL_DLLIB + + +# AC_LTDL_SYMBOL_USCORE +# --------------------- +# does the compiler prefix global symbols with an underscore? +AC_DEFUN([AC_LTDL_SYMBOL_USCORE], +[AC_REQUIRE([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE]) +AC_CACHE_CHECK([for _ prefix in compiled symbols], + [ac_cv_sys_symbol_underscore], + [ac_cv_sys_symbol_underscore=no + cat > conftest.$ac_ext < $ac_nlist) && test -s "$ac_nlist"; then + # See whether the symbols have a leading underscore. + if grep '^. _nm_test_func' "$ac_nlist" >/dev/null; then + ac_cv_sys_symbol_underscore=yes + else + if grep '^. nm_test_func ' "$ac_nlist" >/dev/null; then + : + else + echo "configure: cannot find nm_test_func in $ac_nlist" >&AS_MESSAGE_LOG_FD + fi + fi + else + echo "configure: cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD + fi + else + echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD + cat conftest.c >&AS_MESSAGE_LOG_FD + fi + rm -rf conftest* + ]) +])# AC_LTDL_SYMBOL_USCORE + + +# AC_LTDL_DLSYM_USCORE +# -------------------- +AC_DEFUN([AC_LTDL_DLSYM_USCORE], +[AC_REQUIRE([AC_LTDL_SYMBOL_USCORE]) +if test x"$ac_cv_sys_symbol_underscore" = xyes; then + if test x"$libltdl_cv_func_dlopen" = xyes || + test x"$libltdl_cv_lib_dl_dlopen" = xyes ; then + AC_CACHE_CHECK([whether we have to add an underscore for dlsym], + [libltdl_cv_need_uscore], + [libltdl_cv_need_uscore=unknown + save_LIBS="$LIBS" + LIBS="$LIBS $LIBADD_DL" + _LT_AC_TRY_DLOPEN_SELF( + [libltdl_cv_need_uscore=no], [libltdl_cv_need_uscore=yes], + [], [libltdl_cv_need_uscore=cross]) + LIBS="$save_LIBS" + ]) + fi +fi + +if test x"$libltdl_cv_need_uscore" = xyes; then + AC_DEFINE([NEED_USCORE], [1], + [Define if dlsym() requires a leading underscore in symbol names.]) +fi +])# AC_LTDL_DLSYM_USCORE + +# AC_LTDL_FUNC_ARGZ +# ----------------- +AC_DEFUN([AC_LTDL_FUNC_ARGZ], +[AC_CHECK_HEADERS([argz.h]) + +AC_CHECK_TYPES([error_t], + [], + [AC_DEFINE([error_t], [int], + [Define to a type to use for `error_t' if it is not otherwise available.])], + [#if HAVE_ARGZ_H +# include +#endif]) + +AC_CHECK_FUNCS([argz_append argz_create_sep argz_insert argz_next argz_stringify]) +])# AC_LTDL_FUNC_ARGZ diff --git a/autoconf/m4/need_dev_zero_for_mmap.m4 b/autoconf/m4/need_dev_zero_for_mmap.m4 new file mode 100644 index 000000000..57b322830 --- /dev/null +++ b/autoconf/m4/need_dev_zero_for_mmap.m4 @@ -0,0 +1,17 @@ +# +# When allocating RWX memory, check whether we need to use /dev/zero +# as the file descriptor or not. +# +AC_DEFUN([AC_NEED_DEV_ZERO_FOR_MMAP], +[AC_CACHE_CHECK([if /dev/zero is needed for mmap], +ac_cv_need_dev_zero_for_mmap, +[if test "$llvm_cv_os_type" = "Interix" ; then + ac_cv_need_dev_zero_for_mmap=yes + else + ac_cv_need_dev_zero_for_mmap=no + fi +]) +if test "$ac_cv_need_dev_zero_for_mmap" = yes; then + AC_DEFINE([NEED_DEV_ZERO_FOR_MMAP],[1], + [Define if /dev/zero should be used when mapping RWX memory, or undefine if its not necessary]) +fi]) diff --git a/autoconf/m4/path_tclsh.m4 b/autoconf/m4/path_tclsh.m4 new file mode 100644 index 000000000..85433de71 --- /dev/null +++ b/autoconf/m4/path_tclsh.m4 @@ -0,0 +1,39 @@ +dnl This macro checks for tclsh which is required to run dejagnu. On some +dnl platforms (notably FreeBSD), tclsh is named tclshX.Y - this handles +dnl that for us so we can get the latest installed tclsh version. +dnl +AC_DEFUN([DJ_AC_PATH_TCLSH], [ +no_itcl=true +AC_MSG_CHECKING(for the tclsh program in tclinclude directory) +AC_ARG_WITH(tclinclude, + AS_HELP_STRING([--with-tclinclude], + [directory where tcl headers are]), + [with_tclinclude=${withval}],[with_tclinclude='']) +AC_CACHE_VAL(ac_cv_path_tclsh,[ +dnl first check to see if --with-itclinclude was specified +if test x"${with_tclinclude}" != x ; then + if test -f ${with_tclinclude}/tclsh ; then + ac_cv_path_tclsh=`(cd ${with_tclinclude}; pwd)` + elif test -f ${with_tclinclude}/src/tclsh ; then + ac_cv_path_tclsh=`(cd ${with_tclinclude}/src; pwd)` + else + AC_MSG_ERROR([${with_tclinclude} directory doesn't contain tclsh]) + fi +fi]) + +dnl see if one is installed +if test x"${ac_cv_path_tclsh}" = x ; then + AC_MSG_RESULT(none) + AC_PATH_PROGS([TCLSH],[tclsh8.4 tclsh8.4.8 tclsh8.4.7 tclsh8.4.6 tclsh8.4.5 tclsh8.4.4 tclsh8.4.3 tclsh8.4.2 tclsh8.4.1 tclsh8.4.0 tclsh8.3 tclsh8.3.5 tclsh8.3.4 tclsh8.3.3 tclsh8.3.2 tclsh8.3.1 tclsh8.3.0 tclsh]) + if test x"${TCLSH}" = x ; then + ac_cv_path_tclsh=''; + else + ac_cv_path_tclsh="${TCLSH}"; + fi +else + AC_MSG_RESULT(${ac_cv_path_tclsh}) + TCLSH="${ac_cv_path_tclsh}" + AC_SUBST(TCLSH) +fi +]) + diff --git a/autoconf/m4/rand48.m4 b/autoconf/m4/rand48.m4 new file mode 100644 index 000000000..76f08faad --- /dev/null +++ b/autoconf/m4/rand48.m4 @@ -0,0 +1,12 @@ +# +# This function determins if the srand48,drand48,lrand48 functions are +# available on this platform. +# +AC_DEFUN([AC_FUNC_RAND48],[ +AC_SINGLE_CXX_CHECK([ac_cv_func_rand48], + [srand48/lrand48/drand48], [], + [srand48(0);lrand48();drand48();]) +if test "$ac_cv_func_rand48" = "yes" ; then +AC_DEFINE([HAVE_RAND48],1,[Define to 1 if srand48/lrand48/drand48 exist in ]) +fi +]) diff --git a/autoconf/m4/sanity_check.m4 b/autoconf/m4/sanity_check.m4 new file mode 100644 index 000000000..639fccca2 --- /dev/null +++ b/autoconf/m4/sanity_check.m4 @@ -0,0 +1,31 @@ +dnl Check a program for version sanity. The test runs a program, passes it an +dnl argument to make it print out some identification string, and filters that +dnl output with a regular expression. If the output is non-empty, the program +dnl passes the sanity check. +dnl $1 - Name or full path of the program to run +dnl $2 - Argument to pass to print out identification string +dnl $3 - grep RE to match identification string +dnl $4 - set to 1 to make errors only a warning +AC_DEFUN([CHECK_PROGRAM_SANITY], +[ +AC_MSG_CHECKING([sanity for program ]$1) +sanity="0" +sanity_path=`which $1 2>/dev/null` +if test "$?" -eq 0 -a -x "$sanity_path" ; then + sanity=`$1 $2 2>&1 | grep "$3"` + if test -z "$sanity" ; then + AC_MSG_RESULT([no]) + sanity="0" + if test "$4" -eq 1 ; then + AC_MSG_WARN([Program ]$1[ failed to pass sanity check.]) + else + AC_MSG_ERROR([Program ]$1[ failed to pass sanity check.]) + fi + else + AC_MSG_RESULT([yes]) + sanity="1" + fi +else + AC_MSG_RESULT([not found]) +fi +]) diff --git a/autoconf/m4/single_cxx_check.m4 b/autoconf/m4/single_cxx_check.m4 new file mode 100644 index 000000000..21efa4bed --- /dev/null +++ b/autoconf/m4/single_cxx_check.m4 @@ -0,0 +1,10 @@ +dnl AC_SINGLE_CXX_CHECK(CACHEVAR, FUNCTION, HEADER, PROGRAM) +dnl $1, $2, $3, $4, +dnl +AC_DEFUN([AC_SINGLE_CXX_CHECK], + [AC_CACHE_CHECK([for $2 in $3], [$1], + [AC_LANG_PUSH([C++]) + AC_COMPILE_IFELSE(AC_LANG_PROGRAM([#include $3],[$4]),[$1=yes],[$1=no]) + AC_LANG_POP([C++])]) + ]) + diff --git a/autoconf/m4/visibility_inlines_hidden.m4 b/autoconf/m4/visibility_inlines_hidden.m4 new file mode 100644 index 000000000..b1cc42aa5 --- /dev/null +++ b/autoconf/m4/visibility_inlines_hidden.m4 @@ -0,0 +1,24 @@ +# +# Determine if the compiler accepts -fvisibility-inlines-hidden +# +# This macro is specific to LLVM. +# +AC_DEFUN([AC_CXX_USE_VISIBILITY_INLINES_HIDDEN], +[AC_CACHE_CHECK([for compiler -fvisibility-inlines-hidden option], + [llvm_cv_cxx_visibility_inlines_hidden], +[ AC_LANG_PUSH([C++]) + oldcxxflags="$CXXFLAGS" + CXXFLAGS="$CXXFLAGS -O0 -fvisibility-inlines-hidden -Werror" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM( + [template struct X { void __attribute__((noinline)) f() {} };], + [X().f();])], + [llvm_cv_cxx_visibility_inlines_hidden=yes],[llvm_cv_cxx_visibility_inlines_hidden=no]) + CXXFLAGS="$oldcxxflags" + AC_LANG_POP([C++]) +]) +if test "$llvm_cv_cxx_visibility_inlines_hidden" = yes ; then + AC_SUBST([ENABLE_VISIBILITY_INLINES_HIDDEN],[1]) +else + AC_SUBST([ENABLE_VISIBILITY_INLINES_HIDDEN],[0]) +fi +]) diff --git a/autoconf/mkinstalldirs b/autoconf/mkinstalldirs new file mode 100755 index 000000000..1ee2d5801 --- /dev/null +++ b/autoconf/mkinstalldirs @@ -0,0 +1,150 @@ +#! /bin/sh +# mkinstalldirs --- make directory hierarchy + +scriptversion=2004-02-15.20 + +# Original author: Noah Friedman +# Created: 1993-05-16 +# Public domain. +# +# This file is maintained in Automake, please report +# bugs to or send patches to +# . + +errstatus=0 +dirmode="" + +usage="\ +Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ... + +Create each directory DIR (with mode MODE, if specified), including all +leading file name components. + +Report bugs to ." + +# process command line arguments +while test $# -gt 0 ; do + case $1 in + -h | --help | --h*) # -h for help + echo "$usage" + exit 0 + ;; + -m) # -m PERM arg + shift + test $# -eq 0 && { echo "$usage" 1>&2; exit 1; } + dirmode=$1 + shift + ;; + --version) + echo "$0 $scriptversion" + exit 0 + ;; + --) # stop option processing + shift + break + ;; + -*) # unknown option + echo "$usage" 1>&2 + exit 1 + ;; + *) # first non-opt arg + break + ;; + esac +done + +for file +do + if test -d "$file"; then + shift + else + break + fi +done + +case $# in + 0) exit 0 ;; +esac + +# Solaris 8's mkdir -p isn't thread-safe. If you mkdir -p a/b and +# mkdir -p a/c at the same time, both will detect that a is missing, +# one will create a, then the other will try to create a and die with +# a "File exists" error. This is a problem when calling mkinstalldirs +# from a parallel make. We use --version in the probe to restrict +# ourselves to GNU mkdir, which is thread-safe. +case $dirmode in + '') + if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then + # echo "mkdir -p -- $*" + exec mkdir -p -- "$@" + else + # On NextStep and OpenStep, the `mkdir' command does not + # recognize any option. It will interpret all options as + # directories to create, and then abort because `.' already + # exists. + test -d ./-p && rmdir ./-p + test -d ./--version && rmdir ./--version + fi + ;; + *) + if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 && + test ! -d ./--version; then + # echo "mkdir -m $dirmode -p -- $*" + exec mkdir -m "$dirmode" -p -- "$@" + else + # Clean up after NextStep and OpenStep mkdir. + for d in ./-m ./-p ./--version "./$dirmode"; + do + test -d $d && rmdir $d + done + fi + ;; +esac + +for file +do + set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` + shift + + pathcomp= + for d + do + pathcomp="$pathcomp$d" + case $pathcomp in + -*) pathcomp=./$pathcomp ;; + esac + + if test ! -d "$pathcomp"; then + # echo "mkdir $pathcomp" + + mkdir "$pathcomp" || lasterr=$? + + if test ! -d "$pathcomp"; then + errstatus=$lasterr + else + if test ! -z "$dirmode"; then + # echo "chmod $dirmode $pathcomp" + lasterr="" + chmod "$dirmode" "$pathcomp" || lasterr=$? + + if test ! -z "$lasterr"; then + errstatus=$lasterr + fi + fi + fi + fi + + pathcomp="$pathcomp/" + done +done + +exit $errstatus + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: From 9ae9336a090742d7abee55f3060e43f089d2f1f1 Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Mon, 29 Sep 2014 14:52:01 -0600 Subject: [PATCH 069/140] We do not need a special script for Ubuntu 14.04 any more. --- bin/build-linux-ubuntu_1404.sh | 222 --------------------------------- 1 file changed, 222 deletions(-) delete mode 100755 bin/build-linux-ubuntu_1404.sh diff --git a/bin/build-linux-ubuntu_1404.sh b/bin/build-linux-ubuntu_1404.sh deleted file mode 100755 index 44d78a190..000000000 --- a/bin/build-linux-ubuntu_1404.sh +++ /dev/null @@ -1,222 +0,0 @@ -#!/bin/bash - -################################################################################ -# -# Builds and installs SMACK in BASE_DIR (see shell var below in settings). -# -# Requirements (see "Install required packages" below): -# - git -# - mercurial -# - python -# - gcc -# - g++ -# - make -# - autoconf -# - mono -# -################################################################################ - -# Exit on error -set -e - -################################################################################ - -# Settings - -# Change this to the desired path (default uses working-dir/smack-project) -BASE_DIR=`pwd`/smack-project - -# Set these flags to control various installation options -INSTALL_PACKAGES=1 -INSTALL_Z3=1 -INSTALL_BOOGIE=1 -INSTALL_CORRAL=1 -INSTALL_LLVM=1 -INSTALL_SMACK=1 - -# Other dirs -Z3_DIR="${BASE_DIR}/z3" -BOOGIE_DIR="${BASE_DIR}/boogie" -CORRAL_DIR="${BASE_DIR}/corral" -LLVM_DIR="${BASE_DIR}/llvm" -SMACK_DIR="${BASE_DIR}/smack" - -################################################################################ - -# Install required packages - -if [ ${INSTALL_PACKAGES} -eq 1 ]; then - -sudo apt-get install -y g++ -sudo apt-get install -y git -sudo apt-get install -y mercurial -sudo apt-get install -y autoconf -sudo apt-get install -y wget -sudo apt-get install -y unzip -sudo apt-get install -y monodevelop - -fi - -################################################################################ - -# Set up base directory for everything -mkdir -p ${BASE_DIR} -cd ${BASE_DIR} - -################################################################################ - -# Z3 - -if [ ${INSTALL_Z3} -eq 1 ]; then - -mkdir -p ${Z3_DIR}/src -mkdir -p ${Z3_DIR}/install - -# Get Z3 -cd ${Z3_DIR}/src/ -wget "http://download-codeplex.sec.s-msft.com/Download/SourceControlFileDownload.ashx?ProjectName=z3&changeSetId=37ed4b04d078d6d1e35db2799d769e8d4b87f775" -unzip -o SourceControlFileDownload* -rm -f SourceControlFileDownload* - -# Configure Z3 and build -cd ${Z3_DIR}/src/ -python scripts/mk_make.py --prefix=${Z3_DIR}/install -cd build -make -make install - -cd ${BASE_DIR} - -fi - -################################################################################ - -# Boogie - -if [ ${INSTALL_BOOGIE} -eq 1 ]; then - -mkdir -p ${BOOGIE_DIR} - -# Get Boogie -hg clone -r ec9955650676 https://hg.codeplex.com/boogie ${BOOGIE_DIR} - -# Build Boogie -cd ${BOOGIE_DIR}/Source -xbuild Boogie.sln -ln -s ${Z3_DIR}/install/bin/z3 ${BOOGIE_DIR}/Binaries/z3.exe - -cd ${BASE_DIR} - -fi - -################################################################################ - -# Corral - -if [ ${INSTALL_CORRAL} -eq 1 ]; then - -mkdir -p ${CORRAL_DIR} - -# Get Corral -git clone https://git01.codeplex.com/corral ${CORRAL_DIR} -cd ${CORRAL_DIR} -git checkout 1aeddf73b63c - -# Build Corral -cd ${CORRAL_DIR}/references - -cp ${BOOGIE_DIR}/Binaries/AbsInt.dll . -cp ${BOOGIE_DIR}/Binaries/Basetypes.dll . -cp ${BOOGIE_DIR}/Binaries/CodeContractsExtender.dll . -cp ${BOOGIE_DIR}/Binaries/Concurrency.dll . -cp ${BOOGIE_DIR}/Binaries/Core.dll . -cp ${BOOGIE_DIR}/Binaries/ExecutionEngine.dll . -cp ${BOOGIE_DIR}/Binaries/Graph.dll . -cp ${BOOGIE_DIR}/Binaries/Houdini.dll . -cp ${BOOGIE_DIR}/Binaries/Model.dll . -cp ${BOOGIE_DIR}/Binaries/ParserHelper.dll . -cp ${BOOGIE_DIR}/Binaries/Provers.SMTLib.dll . -cp ${BOOGIE_DIR}/Binaries/VCExpr.dll . -cp ${BOOGIE_DIR}/Binaries/VCGeneration.dll . -cp ${BOOGIE_DIR}/Binaries/Boogie.exe . -cp ${BOOGIE_DIR}/Binaries/BVD.exe . -cp ${BOOGIE_DIR}/Binaries/Doomed.dll . -cp ${BOOGIE_DIR}/Binaries/Predication.dll . - -cd ${CORRAL_DIR} -xbuild cba.sln -ln -s ${Z3_DIR}/install/bin/z3 ${CORRAL_DIR}/bin/Debug/z3.exe - -cd ${BASE_DIR} - -fi - -################################################################################ - -# LLVM - -if [ ${INSTALL_LLVM} -eq 1 ]; then - -mkdir -p ${LLVM_DIR}/src -mkdir -p ${LLVM_DIR}/build -mkdir -p ${LLVM_DIR}/install - -# Get llvm and extract -wget http://llvm.org/releases/3.4/llvm-3.4.src.tar.gz -wget http://llvm.org/releases/3.4/clang-3.4.src.tar.gz -wget http://llvm.org/releases/3.4/compiler-rt-3.4.src.tar.gz - -tar -C ${LLVM_DIR}/src -xzvf llvm-3.4.src.tar.gz --strip 1 -mkdir -p ${LLVM_DIR}/src/tools/clang -tar -C ${LLVM_DIR}/src/tools/clang -xzvf clang-3.4.src.tar.gz --strip 1 -mkdir -p ${LLVM_DIR}/src/projects/compiler-rt -tar -C ${LLVM_DIR}/src/projects/compiler-rt -xzvf compiler-rt-3.4.src.tar.gz --strip 1 - -# Configure llvm and build -cd ${LLVM_DIR}/build/ -${LLVM_DIR}/src/configure --prefix=${LLVM_DIR}/install --enable-optimized -make -make install - -cd ${BASE_DIR} - -fi - -################################################################################ - -# SMACK - -if [ ${INSTALL_SMACK} -eq 1 ]; then - -mkdir -p ${SMACK_DIR}/src -mkdir -p ${SMACK_DIR}/build -mkdir -p ${SMACK_DIR}/install - -# Get SMACK -git clone git://github.com/smackers/smack.git ${SMACK_DIR}/src/ - -# Configure SMACK and build -cd ${SMACK_DIR}/build/ -${SMACK_DIR}/src/configure --with-llvmsrc=${LLVM_DIR}/src --with-llvmobj=${LLVM_DIR}/build --prefix=${SMACK_DIR}/install --enable-optimized -make -make install - -cd ${BASE_DIR} - -# Set required paths and environment variables -export BOOGIE="mono ${BOOGIE_DIR}/Binaries/Boogie.exe" -export CORRAL="mono ${CORRAL_DIR}/bin/Debug/corral.exe" -export PATH=${LLVM_DIR}/install/bin:$PATH -export PATH=${SMACK_DIR}/install/bin:$PATH - -# Run SMACK regressions -cd ${SMACK_DIR}/src/test -make -./regtest.py --verifier {boogie,corral,duality} - -cd ${BASE_DIR} - -fi - -################################################################################ - From 244b1571c66498488d64826f1300257361af3f63 Mon Sep 17 00:00:00 2001 From: smack Date: Tue, 30 Sep 2014 15:33:31 -0600 Subject: [PATCH 070/140] config.h is deprecated and llvm-config.h should be used instead. --- lib/DSA/Printer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/DSA/Printer.cpp b/lib/DSA/Printer.cpp index cadde3ef7..67698a6cd 100644 --- a/lib/DSA/Printer.cpp +++ b/lib/DSA/Printer.cpp @@ -22,7 +22,7 @@ #include "llvm/Support/CommandLine.h" #include "llvm/Support/GraphWriter.h" #include "llvm/ADT/Statistic.h" -#include "llvm/Config/config.h" +#include "llvm/Config/llvm-config.h" #include "llvm/Support/FormattedStream.h" #include using namespace llvm; From 6cd9fcdeea0f19fa1cec554fe430f7a49587aafd Mon Sep 17 00:00:00 2001 From: Pantazis Deligiannis Date: Wed, 1 Oct 2014 00:13:17 +0100 Subject: [PATCH 071/140] fixes to cmake build --- CMakeLists.txt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 652878bc4..aa2d4ff7d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -173,10 +173,8 @@ set_target_properties(smack smackTranslator assistDS dsa target_link_libraries(smackTranslator ${LLVM_LIBS} ${LLVM_SYSTEM_LIBS} ${LLVM_LDFLAGS}) target_link_libraries(smack smackTranslator assistDS dsa) -INSTALL(TARGETS smack smackTranslator assistDS dsa +INSTALL(TARGETS smack RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib ) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/bin/boogie @@ -184,7 +182,14 @@ INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/bin/boogie ${CMAKE_CURRENT_SOURCE_DIR}/bin/llvm2bpl.py ${CMAKE_CURRENT_SOURCE_DIR}/bin/smackgen.py ${CMAKE_CURRENT_SOURCE_DIR}/bin/smackverify.py + ${CMAKE_CURRENT_SOURCE_DIR}/include/smack/smack.h PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ DESTINATION bin ) + +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/smack/smack.h + PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ + GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ + DESTINATION include +) From 5b2bbd8313883b92f272059ae6ceb2407d3ba8af Mon Sep 17 00:00:00 2001 From: smack Date: Tue, 30 Sep 2014 17:31:42 -0600 Subject: [PATCH 072/140] Fixed how cmake gets installed. Also, fixed a minor issue with file installation using cmake. --- CMakeLists.txt | 16 ++++++++-------- bin/build-linux-cmake.sh | 15 ++------------- 2 files changed, 10 insertions(+), 21 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index aa2d4ff7d..bf1ad8118 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -178,18 +178,18 @@ INSTALL(TARGETS smack ) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/bin/boogie - ${CMAKE_CURRENT_SOURCE_DIR}/bin/corral - ${CMAKE_CURRENT_SOURCE_DIR}/bin/llvm2bpl.py - ${CMAKE_CURRENT_SOURCE_DIR}/bin/smackgen.py - ${CMAKE_CURRENT_SOURCE_DIR}/bin/smackverify.py - ${CMAKE_CURRENT_SOURCE_DIR}/include/smack/smack.h - PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ - GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ + ${CMAKE_CURRENT_SOURCE_DIR}/bin/corral + ${CMAKE_CURRENT_SOURCE_DIR}/bin/llvm2bpl.py + ${CMAKE_CURRENT_SOURCE_DIR}/bin/smackgen.py + ${CMAKE_CURRENT_SOURCE_DIR}/bin/smackverify.py + PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ + GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ DESTINATION bin ) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/smack/smack.h PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ - DESTINATION include + DESTINATION include/smack ) + diff --git a/bin/build-linux-cmake.sh b/bin/build-linux-cmake.sh index 38c6af074..cf7981211 100755 --- a/bin/build-linux-cmake.sh +++ b/bin/build-linux-cmake.sh @@ -28,7 +28,6 @@ BASE_DIR=`pwd`/smack-project # Set these flags to control various installation options INSTALL_PACKAGES=1 -INSTALL_CMAKE=1 INSTALL_MONO=1 INSTALL_Z3=1 INSTALL_BOOGIE=1 @@ -51,6 +50,7 @@ SMACK_DIR="${BASE_DIR}/smack" if [ ${INSTALL_PACKAGES} -eq 1 ]; then sudo add-apt-repository ppa:ubuntu-toolchain-r/test +sudo add-apt-repository ppa:andykimpe/cmake sudo apt-get update sudo apt-get install -y g++-4.8 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 20 @@ -61,6 +61,7 @@ sudo update-alternatives --config g++ sudo apt-get install -y git sudo apt-get install -y mercurial sudo apt-get install -y autoconf +sudo apt-get install -y cmake sudo apt-get install -y wget sudo apt-get install -y unzip @@ -74,18 +75,6 @@ cd ${BASE_DIR} ################################################################################ -# cmake - -if [ ${INSTALL_CMAKE} -eq 1 ]; then - -cd ${BASE_DIR} -wget http://www.cmake.org/files/v2.8/cmake-2.8.12.2-Linux-i386.sh -sudo sh cmake-2.8.12.2-Linux-i386.sh --prefix=/usr/local --exclude-subdir - -fi - -################################################################################ - # mono if [ ${INSTALL_MONO} -eq 1 ]; then From 963ac2ad7b1770fa7e90094c7ce144634aec444b Mon Sep 17 00:00:00 2001 From: smack Date: Tue, 30 Sep 2014 17:39:22 -0600 Subject: [PATCH 073/140] Regressions do not have to be built prior to running our regressions script. --- bin/build-cygwin-cmake.sh | 1 - bin/build-cygwin.sh | 1 - bin/build-linux-cmake.sh | 1 - bin/build-linux.sh | 1 - 4 files changed, 4 deletions(-) diff --git a/bin/build-cygwin-cmake.sh b/bin/build-cygwin-cmake.sh index e3700443d..5b0f98b3e 100755 --- a/bin/build-cygwin-cmake.sh +++ b/bin/build-cygwin-cmake.sh @@ -98,7 +98,6 @@ export PATH=${SMACK_DIR}/install/bin:$PATH # Run SMACK regressions cd ${SMACK_DIR}/src/test -make ./regtest.py --verifier {boogie,corral,duality} cd ${BASE_DIR} diff --git a/bin/build-cygwin.sh b/bin/build-cygwin.sh index 2cb99823e..42f20532b 100755 --- a/bin/build-cygwin.sh +++ b/bin/build-cygwin.sh @@ -98,7 +98,6 @@ export PATH=${SMACK_DIR}/install/bin:$PATH # Run SMACK regressions cd ${SMACK_DIR}/src/test -make ./regtest.py --verifier {boogie,corral,duality} cd ${BASE_DIR} diff --git a/bin/build-linux-cmake.sh b/bin/build-linux-cmake.sh index cf7981211..b1006e06a 100755 --- a/bin/build-linux-cmake.sh +++ b/bin/build-linux-cmake.sh @@ -256,7 +256,6 @@ export PATH=${SMACK_DIR}/install/bin:$PATH # Run SMACK regressions cd ${SMACK_DIR}/src/test -make ./regtest.py --verifier {boogie,corral,duality} cd ${BASE_DIR} diff --git a/bin/build-linux.sh b/bin/build-linux.sh index 1ca4c6f4c..98b1850d4 100755 --- a/bin/build-linux.sh +++ b/bin/build-linux.sh @@ -254,7 +254,6 @@ export PATH=${SMACK_DIR}/install/bin:$PATH # Run SMACK regressions cd ${SMACK_DIR}/src/test -make ./regtest.py --verifier {boogie,corral,duality} cd ${BASE_DIR} From 24d7ebceec09d39fc9ce01edddc8d54698b6d69a Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Thu, 2 Oct 2014 14:20:12 -0600 Subject: [PATCH 074/140] Removed running Duality by default on our regressions. It is still not ready for that. --- bin/build-cygwin-cmake.sh | 2 +- bin/build-cygwin.sh | 2 +- bin/build-linux-cmake.sh | 2 +- bin/build-linux.sh | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/build-cygwin-cmake.sh b/bin/build-cygwin-cmake.sh index 5b0f98b3e..3ca32a4bc 100755 --- a/bin/build-cygwin-cmake.sh +++ b/bin/build-cygwin-cmake.sh @@ -98,7 +98,7 @@ export PATH=${SMACK_DIR}/install/bin:$PATH # Run SMACK regressions cd ${SMACK_DIR}/src/test -./regtest.py --verifier {boogie,corral,duality} +./regtest.py --verifier {boogie,corral} cd ${BASE_DIR} diff --git a/bin/build-cygwin.sh b/bin/build-cygwin.sh index 42f20532b..4c3812722 100755 --- a/bin/build-cygwin.sh +++ b/bin/build-cygwin.sh @@ -98,7 +98,7 @@ export PATH=${SMACK_DIR}/install/bin:$PATH # Run SMACK regressions cd ${SMACK_DIR}/src/test -./regtest.py --verifier {boogie,corral,duality} +./regtest.py --verifier {boogie,corral} cd ${BASE_DIR} diff --git a/bin/build-linux-cmake.sh b/bin/build-linux-cmake.sh index b1006e06a..5eac3338f 100755 --- a/bin/build-linux-cmake.sh +++ b/bin/build-linux-cmake.sh @@ -256,7 +256,7 @@ export PATH=${SMACK_DIR}/install/bin:$PATH # Run SMACK regressions cd ${SMACK_DIR}/src/test -./regtest.py --verifier {boogie,corral,duality} +./regtest.py --verifier {boogie,corral} cd ${BASE_DIR} diff --git a/bin/build-linux.sh b/bin/build-linux.sh index 98b1850d4..7a6332e71 100755 --- a/bin/build-linux.sh +++ b/bin/build-linux.sh @@ -254,7 +254,7 @@ export PATH=${SMACK_DIR}/install/bin:$PATH # Run SMACK regressions cd ${SMACK_DIR}/src/test -./regtest.py --verifier {boogie,corral,duality} +./regtest.py --verifier {boogie,corral} cd ${BASE_DIR} From 4238245830b38b275226f84b27bbdd55e5025336 Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Thu, 2 Oct 2014 19:08:53 -0600 Subject: [PATCH 075/140] Added some nice messages for tracking build scripts. Also added a warning in the end about setting environment variables. --- bin/build-cygwin-cmake.sh | 16 ++++++++++++++++ bin/build-cygwin.sh | 16 ++++++++++++++++ bin/build-linux-cmake.sh | 36 ++++++++++++++++++++++++++++++++++++ bin/build-linux.sh | 36 ++++++++++++++++++++++++++++++++++++ 4 files changed, 104 insertions(+) diff --git a/bin/build-cygwin-cmake.sh b/bin/build-cygwin-cmake.sh index 3ca32a4bc..09f322d2b 100755 --- a/bin/build-cygwin-cmake.sh +++ b/bin/build-cygwin-cmake.sh @@ -32,6 +32,10 @@ INSTALL_SMACK=1 LLVM_DIR="${BASE_DIR}/llvm" SMACK_DIR="${BASE_DIR}/smack" +# Setting colors +textcolor='\e[0;35m' +nocolor='\e[0m' + ################################################################################ # Set up base directory for everything @@ -44,6 +48,8 @@ cd ${BASE_DIR} if [ ${INSTALL_LLVM} -eq 1 ]; then +echo -e "\n${textcolor}*** SMACK BUILD: Installing LLVM ***${nocolor}" + mkdir -p ${LLVM_DIR}/src mkdir -p ${LLVM_DIR}/build mkdir -p ${LLVM_DIR}/install @@ -67,6 +73,8 @@ make install cd ${BASE_DIR} +echo -e "\n${textcolor}*** SMACK BUILD: Installed LLVM ***${nocolor}" + fi ################################################################################ @@ -75,6 +83,8 @@ fi if [ ${INSTALL_SMACK} -eq 1 ]; then +echo -e "\n${textcolor}*** SMACK BUILD: Installing SMACK ***${nocolor}" + mkdir -p ${SMACK_DIR}/src mkdir -p ${SMACK_DIR}/build mkdir -p ${SMACK_DIR}/install @@ -90,6 +100,8 @@ make install cd ${BASE_DIR} +echo -e "\n${textcolor}*** SMACK BUILD: Installed SMACK ***${nocolor}" + # Set required paths and environment variables export BOOGIE=/cygdrive/c/Users/zvonimir/Boogie/boogie export CORRAL=/cygdrive/c/projects/corral/corral @@ -97,11 +109,15 @@ export PATH=${LLVM_DIR}/install/bin:$PATH export PATH=${SMACK_DIR}/install/bin:$PATH # Run SMACK regressions +echo -e "\n${textcolor}*** SMACK BUILD: Running regressions ***${nocolor}" cd ${SMACK_DIR}/src/test ./regtest.py --verifier {boogie,corral} +echo -e "\n${textcolor}*** SMACK BUILD: Regressions done ***${nocolor}" cd ${BASE_DIR} +echo -e "\n${textcolor}*** SMACK BUILD: You have to set the required environment variables! ***${nocolor}" + fi ################################################################################ diff --git a/bin/build-cygwin.sh b/bin/build-cygwin.sh index 4c3812722..a35dd1ce5 100755 --- a/bin/build-cygwin.sh +++ b/bin/build-cygwin.sh @@ -32,6 +32,10 @@ INSTALL_SMACK=1 LLVM_DIR="${BASE_DIR}/llvm" SMACK_DIR="${BASE_DIR}/smack" +# Setting colors +textcolor='\e[0;35m' +nocolor='\e[0m' + ################################################################################ # Set up base directory for everything @@ -44,6 +48,8 @@ cd ${BASE_DIR} if [ ${INSTALL_LLVM} -eq 1 ]; then +echo -e "\n${textcolor}*** SMACK BUILD: Installing LLVM ***${nocolor}" + mkdir -p ${LLVM_DIR}/src mkdir -p ${LLVM_DIR}/build mkdir -p ${LLVM_DIR}/install @@ -67,6 +73,8 @@ make install cd ${BASE_DIR} +echo -e "\n${textcolor}*** SMACK BUILD: Installed LLVM ***${nocolor}" + fi ################################################################################ @@ -75,6 +83,8 @@ fi if [ ${INSTALL_SMACK} -eq 1 ]; then +echo -e "\n${textcolor}*** SMACK BUILD: Installing SMACK ***${nocolor}" + mkdir -p ${SMACK_DIR}/src mkdir -p ${SMACK_DIR}/build mkdir -p ${SMACK_DIR}/install @@ -90,6 +100,8 @@ make install cd ${BASE_DIR} +echo -e "\n${textcolor}*** SMACK BUILD: Installed SMACK ***${nocolor}" + # Set required paths and environment variables export BOOGIE=/cygdrive/c/Users/zvonimir/Boogie/boogie export CORRAL=/cygdrive/c/projects/corral/corral @@ -97,11 +109,15 @@ export PATH=${LLVM_DIR}/install/bin:$PATH export PATH=${SMACK_DIR}/install/bin:$PATH # Run SMACK regressions +echo -e "\n${textcolor}*** SMACK BUILD: Running regressions ***${nocolor}" cd ${SMACK_DIR}/src/test ./regtest.py --verifier {boogie,corral} +echo -e "\n${textcolor}*** SMACK BUILD: Regressions done ***${nocolor}" cd ${BASE_DIR} +echo -e "\n${textcolor}*** SMACK BUILD: You have to set the required environment variables! ***${nocolor}" + fi ################################################################################ diff --git a/bin/build-linux-cmake.sh b/bin/build-linux-cmake.sh index 5eac3338f..aef754b21 100755 --- a/bin/build-linux-cmake.sh +++ b/bin/build-linux-cmake.sh @@ -43,12 +43,18 @@ CORRAL_DIR="${BASE_DIR}/corral" LLVM_DIR="${BASE_DIR}/llvm" SMACK_DIR="${BASE_DIR}/smack" +# Setting colors +textcolor='\e[0;35m' +nocolor='\e[0m' + ################################################################################ # Install required packages if [ ${INSTALL_PACKAGES} -eq 1 ]; then +echo -e "\n${textcolor}*** SMACK BUILD: Installing required packages ***${nocolor}" + sudo add-apt-repository ppa:ubuntu-toolchain-r/test sudo add-apt-repository ppa:andykimpe/cmake sudo apt-get update @@ -65,6 +71,8 @@ sudo apt-get install -y cmake sudo apt-get install -y wget sudo apt-get install -y unzip +echo -e "\n${textcolor}*** SMACK BUILD: Installed required packages ***${nocolor}" + fi ################################################################################ @@ -79,6 +87,8 @@ cd ${BASE_DIR} if [ ${INSTALL_MONO} -eq 1 ]; then +echo -e "\n${textcolor}*** SMACK BUILD: Installing mono ***${nocolor}" + mkdir -p ${MONO_DIR} # Install mono @@ -106,6 +116,8 @@ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib cd ${BASE_DIR} +echo -e "\n${textcolor}*** SMACK BUILD: Installed mono ***${nocolor}" + fi ################################################################################ @@ -114,6 +126,8 @@ fi if [ ${INSTALL_Z3} -eq 1 ]; then +echo -e "\n${textcolor}*** SMACK BUILD: Installing Z3 ***${nocolor}" + mkdir -p ${Z3_DIR}/src mkdir -p ${Z3_DIR}/install @@ -132,6 +146,8 @@ make install cd ${BASE_DIR} +echo -e "\n${textcolor}*** SMACK BUILD: Installed Z3 ***${nocolor}" + fi ################################################################################ @@ -140,6 +156,8 @@ fi if [ ${INSTALL_BOOGIE} -eq 1 ]; then +echo -e "\n${textcolor}*** SMACK BUILD: Installing Boogie ***${nocolor}" + mkdir -p ${BOOGIE_DIR} # Get Boogie @@ -152,6 +170,8 @@ ln -s ${Z3_DIR}/install/bin/z3 ${BOOGIE_DIR}/Binaries/z3.exe cd ${BASE_DIR} +echo -e "\n${textcolor}*** SMACK BUILD: Installed Boogie ***${nocolor}" + fi ################################################################################ @@ -160,6 +180,8 @@ fi if [ ${INSTALL_CORRAL} -eq 1 ]; then +echo -e "\n${textcolor}*** SMACK BUILD: Installing Corral ***${nocolor}" + mkdir -p ${CORRAL_DIR} # Get Corral @@ -194,6 +216,8 @@ ln -s ${Z3_DIR}/install/bin/z3 ${CORRAL_DIR}/bin/Debug/z3.exe cd ${BASE_DIR} +echo -e "\n${textcolor}*** SMACK BUILD: Installed Corral ***${nocolor}" + fi ################################################################################ @@ -202,6 +226,8 @@ fi if [ ${INSTALL_LLVM} -eq 1 ]; then +echo -e "\n${textcolor}*** SMACK BUILD: Installing LLVM ***${nocolor}" + mkdir -p ${LLVM_DIR}/src mkdir -p ${LLVM_DIR}/build mkdir -p ${LLVM_DIR}/install @@ -225,6 +251,8 @@ make install cd ${BASE_DIR} +echo -e "\n${textcolor}*** SMACK BUILD: Installed LLVM ***${nocolor}" + fi ################################################################################ @@ -233,6 +261,8 @@ fi if [ ${INSTALL_SMACK} -eq 1 ]; then +echo -e "\n${textcolor}*** SMACK BUILD: Installing SMACK ***${nocolor}" + mkdir -p ${SMACK_DIR}/src mkdir -p ${SMACK_DIR}/build mkdir -p ${SMACK_DIR}/install @@ -248,6 +278,8 @@ make install cd ${BASE_DIR} +echo -e "\n${textcolor}*** SMACK BUILD: Installed SMACK ***${nocolor}" + # Set required paths and environment variables export BOOGIE="mono ${BOOGIE_DIR}/Binaries/Boogie.exe" export CORRAL="mono ${CORRAL_DIR}/bin/Debug/corral.exe" @@ -255,11 +287,15 @@ export PATH=${LLVM_DIR}/install/bin:$PATH export PATH=${SMACK_DIR}/install/bin:$PATH # Run SMACK regressions +echo -e "\n${textcolor}*** SMACK BUILD: Running regressions ***${nocolor}" cd ${SMACK_DIR}/src/test ./regtest.py --verifier {boogie,corral} +echo -e "\n${textcolor}*** SMACK BUILD: Regressions done ***${nocolor}" cd ${BASE_DIR} +echo -e "\n${textcolor}*** SMACK BUILD: You have to set the required environment variables! ***${nocolor}" + fi ################################################################################ diff --git a/bin/build-linux.sh b/bin/build-linux.sh index 7a6332e71..c07c2c993 100755 --- a/bin/build-linux.sh +++ b/bin/build-linux.sh @@ -43,12 +43,18 @@ CORRAL_DIR="${BASE_DIR}/corral" LLVM_DIR="${BASE_DIR}/llvm" SMACK_DIR="${BASE_DIR}/smack" +# Setting colors +textcolor='\e[0;35m' +nocolor='\e[0m' + ################################################################################ # Install required packages if [ ${INSTALL_PACKAGES} -eq 1 ]; then +echo -e "\n${textcolor}*** SMACK BUILD: Installing required packages ***${nocolor}" + sudo add-apt-repository ppa:ubuntu-toolchain-r/test sudo apt-get update sudo apt-get install -y g++-4.8 @@ -63,6 +69,8 @@ sudo apt-get install -y autoconf sudo apt-get install -y wget sudo apt-get install -y unzip +echo -e "\n${textcolor}*** SMACK BUILD: Installed required packages ***${nocolor}" + fi ################################################################################ @@ -77,6 +85,8 @@ cd ${BASE_DIR} if [ ${INSTALL_MONO} -eq 1 ]; then +echo -e "\n${textcolor}*** SMACK BUILD: Installing mono ***${nocolor}" + mkdir -p ${MONO_DIR} # Install mono @@ -104,6 +114,8 @@ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib cd ${BASE_DIR} +echo -e "\n${textcolor}*** SMACK BUILD: Installed mono ***${nocolor}" + fi ################################################################################ @@ -112,6 +124,8 @@ fi if [ ${INSTALL_Z3} -eq 1 ]; then +echo -e "\n${textcolor}*** SMACK BUILD: Installing Z3 ***${nocolor}" + mkdir -p ${Z3_DIR}/src mkdir -p ${Z3_DIR}/install @@ -130,6 +144,8 @@ make install cd ${BASE_DIR} +echo -e "\n${textcolor}*** SMACK BUILD: Installed Z3 ***${nocolor}" + fi ################################################################################ @@ -138,6 +154,8 @@ fi if [ ${INSTALL_BOOGIE} -eq 1 ]; then +echo -e "\n${textcolor}*** SMACK BUILD: Installing Boogie ***${nocolor}" + mkdir -p ${BOOGIE_DIR} # Get Boogie @@ -150,6 +168,8 @@ ln -s ${Z3_DIR}/install/bin/z3 ${BOOGIE_DIR}/Binaries/z3.exe cd ${BASE_DIR} +echo -e "\n${textcolor}*** SMACK BUILD: Installed Boogie ***${nocolor}" + fi ################################################################################ @@ -158,6 +178,8 @@ fi if [ ${INSTALL_CORRAL} -eq 1 ]; then +echo -e "\n${textcolor}*** SMACK BUILD: Installing Corral ***${nocolor}" + mkdir -p ${CORRAL_DIR} # Get Corral @@ -192,6 +214,8 @@ ln -s ${Z3_DIR}/install/bin/z3 ${CORRAL_DIR}/bin/Debug/z3.exe cd ${BASE_DIR} +echo -e "\n${textcolor}*** SMACK BUILD: Installed Corral ***${nocolor}" + fi ################################################################################ @@ -200,6 +224,8 @@ fi if [ ${INSTALL_LLVM} -eq 1 ]; then +echo -e "\n${textcolor}*** SMACK BUILD: Installing LLVM ***${nocolor}" + mkdir -p ${LLVM_DIR}/src mkdir -p ${LLVM_DIR}/build mkdir -p ${LLVM_DIR}/install @@ -223,6 +249,8 @@ make install cd ${BASE_DIR} +echo -e "\n${textcolor}*** SMACK BUILD: Installed LLVM ***${nocolor}" + fi ################################################################################ @@ -231,6 +259,8 @@ fi if [ ${INSTALL_SMACK} -eq 1 ]; then +echo -e "\n${textcolor}*** SMACK BUILD: Installing SMACK ***${nocolor}" + mkdir -p ${SMACK_DIR}/src mkdir -p ${SMACK_DIR}/build mkdir -p ${SMACK_DIR}/install @@ -246,6 +276,8 @@ make install cd ${BASE_DIR} +echo -e "\n${textcolor}*** SMACK BUILD: Installed SMACK ***${nocolor}" + # Set required paths and environment variables export BOOGIE="mono ${BOOGIE_DIR}/Binaries/Boogie.exe" export CORRAL="mono ${CORRAL_DIR}/bin/Debug/corral.exe" @@ -253,11 +285,15 @@ export PATH=${LLVM_DIR}/install/bin:$PATH export PATH=${SMACK_DIR}/install/bin:$PATH # Run SMACK regressions +echo -e "\n${textcolor}*** SMACK BUILD: Running regressions ***${nocolor}" cd ${SMACK_DIR}/src/test ./regtest.py --verifier {boogie,corral} +echo -e "\n${textcolor}*** SMACK BUILD: Regressions done ***${nocolor}" cd ${BASE_DIR} +echo -e "\n${textcolor}*** SMACK BUILD: You have to set the required environment variables! ***${nocolor}" + fi ################################################################################ From 203dfc07e3b823a0b9329b704c8fc0e2c0dccf7b Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Fri, 3 Oct 2014 08:00:53 -0600 Subject: [PATCH 076/140] Removed printing of new lines. --- bin/build-cygwin-cmake.sh | 14 +++++++------- bin/build-cygwin.sh | 14 +++++++------- bin/build-linux-cmake.sh | 34 +++++++++++++++++----------------- bin/build-linux.sh | 34 +++++++++++++++++----------------- 4 files changed, 48 insertions(+), 48 deletions(-) diff --git a/bin/build-cygwin-cmake.sh b/bin/build-cygwin-cmake.sh index 09f322d2b..36f4149be 100755 --- a/bin/build-cygwin-cmake.sh +++ b/bin/build-cygwin-cmake.sh @@ -48,7 +48,7 @@ cd ${BASE_DIR} if [ ${INSTALL_LLVM} -eq 1 ]; then -echo -e "\n${textcolor}*** SMACK BUILD: Installing LLVM ***${nocolor}" +echo -e "${textcolor}*** SMACK BUILD: Installing LLVM ***${nocolor}" mkdir -p ${LLVM_DIR}/src mkdir -p ${LLVM_DIR}/build @@ -73,7 +73,7 @@ make install cd ${BASE_DIR} -echo -e "\n${textcolor}*** SMACK BUILD: Installed LLVM ***${nocolor}" +echo -e "${textcolor}*** SMACK BUILD: Installed LLVM ***${nocolor}" fi @@ -83,7 +83,7 @@ fi if [ ${INSTALL_SMACK} -eq 1 ]; then -echo -e "\n${textcolor}*** SMACK BUILD: Installing SMACK ***${nocolor}" +echo -e "${textcolor}*** SMACK BUILD: Installing SMACK ***${nocolor}" mkdir -p ${SMACK_DIR}/src mkdir -p ${SMACK_DIR}/build @@ -100,7 +100,7 @@ make install cd ${BASE_DIR} -echo -e "\n${textcolor}*** SMACK BUILD: Installed SMACK ***${nocolor}" +echo -e "${textcolor}*** SMACK BUILD: Installed SMACK ***${nocolor}" # Set required paths and environment variables export BOOGIE=/cygdrive/c/Users/zvonimir/Boogie/boogie @@ -109,14 +109,14 @@ export PATH=${LLVM_DIR}/install/bin:$PATH export PATH=${SMACK_DIR}/install/bin:$PATH # Run SMACK regressions -echo -e "\n${textcolor}*** SMACK BUILD: Running regressions ***${nocolor}" +echo -e "${textcolor}*** SMACK BUILD: Running regressions ***${nocolor}" cd ${SMACK_DIR}/src/test ./regtest.py --verifier {boogie,corral} -echo -e "\n${textcolor}*** SMACK BUILD: Regressions done ***${nocolor}" +echo -e "${textcolor}*** SMACK BUILD: Regressions done ***${nocolor}" cd ${BASE_DIR} -echo -e "\n${textcolor}*** SMACK BUILD: You have to set the required environment variables! ***${nocolor}" +echo -e "${textcolor}*** SMACK BUILD: You have to set the required environment variables! ***${nocolor}" fi diff --git a/bin/build-cygwin.sh b/bin/build-cygwin.sh index a35dd1ce5..55c713de4 100755 --- a/bin/build-cygwin.sh +++ b/bin/build-cygwin.sh @@ -48,7 +48,7 @@ cd ${BASE_DIR} if [ ${INSTALL_LLVM} -eq 1 ]; then -echo -e "\n${textcolor}*** SMACK BUILD: Installing LLVM ***${nocolor}" +echo -e "${textcolor}*** SMACK BUILD: Installing LLVM ***${nocolor}" mkdir -p ${LLVM_DIR}/src mkdir -p ${LLVM_DIR}/build @@ -73,7 +73,7 @@ make install cd ${BASE_DIR} -echo -e "\n${textcolor}*** SMACK BUILD: Installed LLVM ***${nocolor}" +echo -e "${textcolor}*** SMACK BUILD: Installed LLVM ***${nocolor}" fi @@ -83,7 +83,7 @@ fi if [ ${INSTALL_SMACK} -eq 1 ]; then -echo -e "\n${textcolor}*** SMACK BUILD: Installing SMACK ***${nocolor}" +echo -e "${textcolor}*** SMACK BUILD: Installing SMACK ***${nocolor}" mkdir -p ${SMACK_DIR}/src mkdir -p ${SMACK_DIR}/build @@ -100,7 +100,7 @@ make install cd ${BASE_DIR} -echo -e "\n${textcolor}*** SMACK BUILD: Installed SMACK ***${nocolor}" +echo -e "${textcolor}*** SMACK BUILD: Installed SMACK ***${nocolor}" # Set required paths and environment variables export BOOGIE=/cygdrive/c/Users/zvonimir/Boogie/boogie @@ -109,14 +109,14 @@ export PATH=${LLVM_DIR}/install/bin:$PATH export PATH=${SMACK_DIR}/install/bin:$PATH # Run SMACK regressions -echo -e "\n${textcolor}*** SMACK BUILD: Running regressions ***${nocolor}" +echo -e "${textcolor}*** SMACK BUILD: Running regressions ***${nocolor}" cd ${SMACK_DIR}/src/test ./regtest.py --verifier {boogie,corral} -echo -e "\n${textcolor}*** SMACK BUILD: Regressions done ***${nocolor}" +echo -e "${textcolor}*** SMACK BUILD: Regressions done ***${nocolor}" cd ${BASE_DIR} -echo -e "\n${textcolor}*** SMACK BUILD: You have to set the required environment variables! ***${nocolor}" +echo -e "${textcolor}*** SMACK BUILD: You have to set the required environment variables! ***${nocolor}" fi diff --git a/bin/build-linux-cmake.sh b/bin/build-linux-cmake.sh index aef754b21..dddf80fd8 100755 --- a/bin/build-linux-cmake.sh +++ b/bin/build-linux-cmake.sh @@ -53,7 +53,7 @@ nocolor='\e[0m' if [ ${INSTALL_PACKAGES} -eq 1 ]; then -echo -e "\n${textcolor}*** SMACK BUILD: Installing required packages ***${nocolor}" +echo -e "${textcolor}*** SMACK BUILD: Installing required packages ***${nocolor}" sudo add-apt-repository ppa:ubuntu-toolchain-r/test sudo add-apt-repository ppa:andykimpe/cmake @@ -71,7 +71,7 @@ sudo apt-get install -y cmake sudo apt-get install -y wget sudo apt-get install -y unzip -echo -e "\n${textcolor}*** SMACK BUILD: Installed required packages ***${nocolor}" +echo -e "${textcolor}*** SMACK BUILD: Installed required packages ***${nocolor}" fi @@ -87,7 +87,7 @@ cd ${BASE_DIR} if [ ${INSTALL_MONO} -eq 1 ]; then -echo -e "\n${textcolor}*** SMACK BUILD: Installing mono ***${nocolor}" +echo -e "${textcolor}*** SMACK BUILD: Installing mono ***${nocolor}" mkdir -p ${MONO_DIR} @@ -116,7 +116,7 @@ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib cd ${BASE_DIR} -echo -e "\n${textcolor}*** SMACK BUILD: Installed mono ***${nocolor}" +echo -e "${textcolor}*** SMACK BUILD: Installed mono ***${nocolor}" fi @@ -126,7 +126,7 @@ fi if [ ${INSTALL_Z3} -eq 1 ]; then -echo -e "\n${textcolor}*** SMACK BUILD: Installing Z3 ***${nocolor}" +echo -e "${textcolor}*** SMACK BUILD: Installing Z3 ***${nocolor}" mkdir -p ${Z3_DIR}/src mkdir -p ${Z3_DIR}/install @@ -146,7 +146,7 @@ make install cd ${BASE_DIR} -echo -e "\n${textcolor}*** SMACK BUILD: Installed Z3 ***${nocolor}" +echo -e "${textcolor}*** SMACK BUILD: Installed Z3 ***${nocolor}" fi @@ -156,7 +156,7 @@ fi if [ ${INSTALL_BOOGIE} -eq 1 ]; then -echo -e "\n${textcolor}*** SMACK BUILD: Installing Boogie ***${nocolor}" +echo -e "${textcolor}*** SMACK BUILD: Installing Boogie ***${nocolor}" mkdir -p ${BOOGIE_DIR} @@ -170,7 +170,7 @@ ln -s ${Z3_DIR}/install/bin/z3 ${BOOGIE_DIR}/Binaries/z3.exe cd ${BASE_DIR} -echo -e "\n${textcolor}*** SMACK BUILD: Installed Boogie ***${nocolor}" +echo -e "${textcolor}*** SMACK BUILD: Installed Boogie ***${nocolor}" fi @@ -180,7 +180,7 @@ fi if [ ${INSTALL_CORRAL} -eq 1 ]; then -echo -e "\n${textcolor}*** SMACK BUILD: Installing Corral ***${nocolor}" +echo -e "${textcolor}*** SMACK BUILD: Installing Corral ***${nocolor}" mkdir -p ${CORRAL_DIR} @@ -216,7 +216,7 @@ ln -s ${Z3_DIR}/install/bin/z3 ${CORRAL_DIR}/bin/Debug/z3.exe cd ${BASE_DIR} -echo -e "\n${textcolor}*** SMACK BUILD: Installed Corral ***${nocolor}" +echo -e "${textcolor}*** SMACK BUILD: Installed Corral ***${nocolor}" fi @@ -226,7 +226,7 @@ fi if [ ${INSTALL_LLVM} -eq 1 ]; then -echo -e "\n${textcolor}*** SMACK BUILD: Installing LLVM ***${nocolor}" +echo -e "${textcolor}*** SMACK BUILD: Installing LLVM ***${nocolor}" mkdir -p ${LLVM_DIR}/src mkdir -p ${LLVM_DIR}/build @@ -251,7 +251,7 @@ make install cd ${BASE_DIR} -echo -e "\n${textcolor}*** SMACK BUILD: Installed LLVM ***${nocolor}" +echo -e "${textcolor}*** SMACK BUILD: Installed LLVM ***${nocolor}" fi @@ -261,7 +261,7 @@ fi if [ ${INSTALL_SMACK} -eq 1 ]; then -echo -e "\n${textcolor}*** SMACK BUILD: Installing SMACK ***${nocolor}" +echo -e "${textcolor}*** SMACK BUILD: Installing SMACK ***${nocolor}" mkdir -p ${SMACK_DIR}/src mkdir -p ${SMACK_DIR}/build @@ -278,7 +278,7 @@ make install cd ${BASE_DIR} -echo -e "\n${textcolor}*** SMACK BUILD: Installed SMACK ***${nocolor}" +echo -e "${textcolor}*** SMACK BUILD: Installed SMACK ***${nocolor}" # Set required paths and environment variables export BOOGIE="mono ${BOOGIE_DIR}/Binaries/Boogie.exe" @@ -287,14 +287,14 @@ export PATH=${LLVM_DIR}/install/bin:$PATH export PATH=${SMACK_DIR}/install/bin:$PATH # Run SMACK regressions -echo -e "\n${textcolor}*** SMACK BUILD: Running regressions ***${nocolor}" +echo -e "${textcolor}*** SMACK BUILD: Running regressions ***${nocolor}" cd ${SMACK_DIR}/src/test ./regtest.py --verifier {boogie,corral} -echo -e "\n${textcolor}*** SMACK BUILD: Regressions done ***${nocolor}" +echo -e "${textcolor}*** SMACK BUILD: Regressions done ***${nocolor}" cd ${BASE_DIR} -echo -e "\n${textcolor}*** SMACK BUILD: You have to set the required environment variables! ***${nocolor}" +echo -e "${textcolor}*** SMACK BUILD: You have to set the required environment variables! ***${nocolor}" fi diff --git a/bin/build-linux.sh b/bin/build-linux.sh index c07c2c993..462e03512 100755 --- a/bin/build-linux.sh +++ b/bin/build-linux.sh @@ -53,7 +53,7 @@ nocolor='\e[0m' if [ ${INSTALL_PACKAGES} -eq 1 ]; then -echo -e "\n${textcolor}*** SMACK BUILD: Installing required packages ***${nocolor}" +echo -e "${textcolor}*** SMACK BUILD: Installing required packages ***${nocolor}" sudo add-apt-repository ppa:ubuntu-toolchain-r/test sudo apt-get update @@ -69,7 +69,7 @@ sudo apt-get install -y autoconf sudo apt-get install -y wget sudo apt-get install -y unzip -echo -e "\n${textcolor}*** SMACK BUILD: Installed required packages ***${nocolor}" +echo -e "${textcolor}*** SMACK BUILD: Installed required packages ***${nocolor}" fi @@ -85,7 +85,7 @@ cd ${BASE_DIR} if [ ${INSTALL_MONO} -eq 1 ]; then -echo -e "\n${textcolor}*** SMACK BUILD: Installing mono ***${nocolor}" +echo -e "${textcolor}*** SMACK BUILD: Installing mono ***${nocolor}" mkdir -p ${MONO_DIR} @@ -114,7 +114,7 @@ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib cd ${BASE_DIR} -echo -e "\n${textcolor}*** SMACK BUILD: Installed mono ***${nocolor}" +echo -e "${textcolor}*** SMACK BUILD: Installed mono ***${nocolor}" fi @@ -124,7 +124,7 @@ fi if [ ${INSTALL_Z3} -eq 1 ]; then -echo -e "\n${textcolor}*** SMACK BUILD: Installing Z3 ***${nocolor}" +echo -e "${textcolor}*** SMACK BUILD: Installing Z3 ***${nocolor}" mkdir -p ${Z3_DIR}/src mkdir -p ${Z3_DIR}/install @@ -144,7 +144,7 @@ make install cd ${BASE_DIR} -echo -e "\n${textcolor}*** SMACK BUILD: Installed Z3 ***${nocolor}" +echo -e "${textcolor}*** SMACK BUILD: Installed Z3 ***${nocolor}" fi @@ -154,7 +154,7 @@ fi if [ ${INSTALL_BOOGIE} -eq 1 ]; then -echo -e "\n${textcolor}*** SMACK BUILD: Installing Boogie ***${nocolor}" +echo -e "${textcolor}*** SMACK BUILD: Installing Boogie ***${nocolor}" mkdir -p ${BOOGIE_DIR} @@ -168,7 +168,7 @@ ln -s ${Z3_DIR}/install/bin/z3 ${BOOGIE_DIR}/Binaries/z3.exe cd ${BASE_DIR} -echo -e "\n${textcolor}*** SMACK BUILD: Installed Boogie ***${nocolor}" +echo -e "${textcolor}*** SMACK BUILD: Installed Boogie ***${nocolor}" fi @@ -178,7 +178,7 @@ fi if [ ${INSTALL_CORRAL} -eq 1 ]; then -echo -e "\n${textcolor}*** SMACK BUILD: Installing Corral ***${nocolor}" +echo -e "${textcolor}*** SMACK BUILD: Installing Corral ***${nocolor}" mkdir -p ${CORRAL_DIR} @@ -214,7 +214,7 @@ ln -s ${Z3_DIR}/install/bin/z3 ${CORRAL_DIR}/bin/Debug/z3.exe cd ${BASE_DIR} -echo -e "\n${textcolor}*** SMACK BUILD: Installed Corral ***${nocolor}" +echo -e "${textcolor}*** SMACK BUILD: Installed Corral ***${nocolor}" fi @@ -224,7 +224,7 @@ fi if [ ${INSTALL_LLVM} -eq 1 ]; then -echo -e "\n${textcolor}*** SMACK BUILD: Installing LLVM ***${nocolor}" +echo -e "${textcolor}*** SMACK BUILD: Installing LLVM ***${nocolor}" mkdir -p ${LLVM_DIR}/src mkdir -p ${LLVM_DIR}/build @@ -249,7 +249,7 @@ make install cd ${BASE_DIR} -echo -e "\n${textcolor}*** SMACK BUILD: Installed LLVM ***${nocolor}" +echo -e "${textcolor}*** SMACK BUILD: Installed LLVM ***${nocolor}" fi @@ -259,7 +259,7 @@ fi if [ ${INSTALL_SMACK} -eq 1 ]; then -echo -e "\n${textcolor}*** SMACK BUILD: Installing SMACK ***${nocolor}" +echo -e "${textcolor}*** SMACK BUILD: Installing SMACK ***${nocolor}" mkdir -p ${SMACK_DIR}/src mkdir -p ${SMACK_DIR}/build @@ -276,7 +276,7 @@ make install cd ${BASE_DIR} -echo -e "\n${textcolor}*** SMACK BUILD: Installed SMACK ***${nocolor}" +echo -e "${textcolor}*** SMACK BUILD: Installed SMACK ***${nocolor}" # Set required paths and environment variables export BOOGIE="mono ${BOOGIE_DIR}/Binaries/Boogie.exe" @@ -285,14 +285,14 @@ export PATH=${LLVM_DIR}/install/bin:$PATH export PATH=${SMACK_DIR}/install/bin:$PATH # Run SMACK regressions -echo -e "\n${textcolor}*** SMACK BUILD: Running regressions ***${nocolor}" +echo -e "${textcolor}*** SMACK BUILD: Running regressions ***${nocolor}" cd ${SMACK_DIR}/src/test ./regtest.py --verifier {boogie,corral} -echo -e "\n${textcolor}*** SMACK BUILD: Regressions done ***${nocolor}" +echo -e "${textcolor}*** SMACK BUILD: Regressions done ***${nocolor}" cd ${BASE_DIR} -echo -e "\n${textcolor}*** SMACK BUILD: You have to set the required environment variables! ***${nocolor}" +echo -e "${textcolor}*** SMACK BUILD: You have to set the required environment variables! ***${nocolor}" fi From 1add98eacf6da1ca34c96f933ffad1a00d6366a2 Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Sat, 4 Oct 2014 08:51:00 -0600 Subject: [PATCH 077/140] Minor fix in a regression script. --- examples/svcomp/ntdrivers/regtest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/svcomp/ntdrivers/regtest.py b/examples/svcomp/ntdrivers/regtest.py index 1770f9366..3ebc3c02f 100755 --- a/examples/svcomp/ntdrivers/regtest.py +++ b/examples/svcomp/ntdrivers/regtest.py @@ -15,7 +15,7 @@ RegTest('diskperf_false.i.cil', r'0 verified, 1 errors?', r'This assertion can fail', r'This assertion can fail', 2), RegTest('floppy2_true.i.cil', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), RegTest('floppy_true.i.cil', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), - RegTest('floppy_false.i.cil', r'0 verified, 1 errors?', r'This assertion can fail', r'This assertion can fail', 2), + RegTest('floppy_false.i.cil', r'0 verified, 5 errors?', r'This assertion can fail', r'This assertion can fail', 2), RegTest('kbfiltr_false.i.cil', r'0 verified, 1 errors?', r'This assertion can fail', r'This assertion can fail', 2), RegTest('parport_true.i.cil', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), RegTest('parport_false.i.cil', r'0 verified, 1 errors?', r'This assertion can fail', r'This assertion can fail', 2) From b4cdeb7499754a9bf24299fca57bd2c932bca9a9 Mon Sep 17 00:00:00 2001 From: Michael Emmi Date: Sat, 4 Oct 2014 16:52:08 +0200 Subject: [PATCH 078/140] Updated license authors and headers. --- LICENSE | 1 + bin/llvm2bpl.py | 3 +++ bin/smackgen.py | 3 +++ bin/smackreach.py | 3 +++ bin/smackverify.py | 3 +++ include/smack/BoogieAst.h | 2 -- include/smack/BplFilePrinter.h | 2 -- include/smack/BplPrinter.h | 1 - include/smack/SmackInstGenerator.h | 1 - include/smack/SmackModuleGenerator.h | 1 - include/smack/SmackOptions.h | 2 -- include/smack/SmackRep.h | 2 -- include/smack/SmackRepFlatMem.h | 2 -- include/smack/smack.h | 2 -- lib/smack/BoogieAst.cpp | 2 -- lib/smack/BplFilePrinter.cpp | 2 -- lib/smack/BplPrinter.cpp | 1 - lib/smack/SmackInstGenerator.cpp | 1 - lib/smack/SmackModuleGenerator.cpp | 1 - lib/smack/SmackOptions.cpp | 2 -- lib/smack/SmackRep.cpp | 2 -- lib/smack/SmackRepFlatMem.cpp | 2 -- 22 files changed, 13 insertions(+), 28 deletions(-) mode change 100644 => 100755 bin/smackreach.py diff --git a/LICENSE b/LICENSE index c4c0611e4..29200ceb9 100644 --- a/LICENSE +++ b/LICENSE @@ -2,6 +2,7 @@ The MIT License Copyright (c) 2008-2014 Zvonimir Rakamaric (zvonimir@cs.utah.edu), Michael Emmi (michael.emmi@gmail.com) +Modified work Copyright (c) 2014 Pantazis Deligiannis Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/bin/llvm2bpl.py b/bin/llvm2bpl.py index 6e06822da..d5adf16f6 100755 --- a/bin/llvm2bpl.py +++ b/bin/llvm2bpl.py @@ -1,4 +1,7 @@ #! /usr/bin/env python +# +# This file is distributed under the MIT License. See LICENSE for details. +# from os import path import sys diff --git a/bin/smackgen.py b/bin/smackgen.py index caf63aa40..0f314b7d6 100755 --- a/bin/smackgen.py +++ b/bin/smackgen.py @@ -1,4 +1,7 @@ #! /usr/bin/env python +# +# This file is distributed under the MIT License. See LICENSE for details. +# from os import path import sys diff --git a/bin/smackreach.py b/bin/smackreach.py old mode 100644 new mode 100755 index 775c583da..2a9de7802 --- a/bin/smackreach.py +++ b/bin/smackreach.py @@ -1,4 +1,7 @@ #! /usr/bin/env python +# +# This file is distributed under the MIT License. See LICENSE for details. +# import argparse import re diff --git a/bin/smackverify.py b/bin/smackverify.py index ed4673a16..98e82b4ab 100755 --- a/bin/smackverify.py +++ b/bin/smackverify.py @@ -1,4 +1,7 @@ #! /usr/bin/env python +# +# This file is distributed under the MIT License. See LICENSE for details. +# from os import path import json diff --git a/include/smack/BoogieAst.h b/include/smack/BoogieAst.h index 62b52a575..9b37b2157 100644 --- a/include/smack/BoogieAst.h +++ b/include/smack/BoogieAst.h @@ -1,6 +1,4 @@ // -// Copyright (c) 2013 Zvonimir Rakamaric (zvonimir@cs.utah.edu), -// Michael Emmi (michael.emmi@gmail.com) // This file is distributed under the MIT License. See LICENSE for details. // #ifndef BOOGIEAST_H diff --git a/include/smack/BplFilePrinter.h b/include/smack/BplFilePrinter.h index 4e28b8291..0e2415580 100644 --- a/include/smack/BplFilePrinter.h +++ b/include/smack/BplFilePrinter.h @@ -1,6 +1,4 @@ // -// Copyright (c) 2008 Zvonimir Rakamaric (zvonimir@cs.utah.edu), -// Pantazis Deligiannis (p.deligiannis@imperial.ac.uk) // This file is distributed under the MIT License. See LICENSE for details. // #ifndef BPLFILEPRINTER_H diff --git a/include/smack/BplPrinter.h b/include/smack/BplPrinter.h index 833a04ae7..2979c97a9 100644 --- a/include/smack/BplPrinter.h +++ b/include/smack/BplPrinter.h @@ -1,5 +1,4 @@ // -// Copyright (c) 2008 Zvonimir Rakamaric (zvonimir@cs.utah.edu) // This file is distributed under the MIT License. See LICENSE for details. // #ifndef BPLPRINTER_H diff --git a/include/smack/SmackInstGenerator.h b/include/smack/SmackInstGenerator.h index a909970a2..3ba9172f4 100644 --- a/include/smack/SmackInstGenerator.h +++ b/include/smack/SmackInstGenerator.h @@ -1,5 +1,4 @@ // -// Copyright (c) 2008 Zvonimir Rakamaric (zvonimir@cs.utah.edu) // This file is distributed under the MIT License. See LICENSE for details. // #ifndef SMACKINSTVISITOR_H diff --git a/include/smack/SmackModuleGenerator.h b/include/smack/SmackModuleGenerator.h index 416449872..89d2b5f99 100644 --- a/include/smack/SmackModuleGenerator.h +++ b/include/smack/SmackModuleGenerator.h @@ -1,5 +1,4 @@ // -// Copyright (c) 2008 Zvonimir Rakamaric (zvonimir@cs.utah.edu) // This file is distributed under the MIT License. See LICENSE for details. // #ifndef SMACKMODULEGENERATOR_H diff --git a/include/smack/SmackOptions.h b/include/smack/SmackOptions.h index a980ef592..3c781ceb3 100644 --- a/include/smack/SmackOptions.h +++ b/include/smack/SmackOptions.h @@ -1,6 +1,4 @@ // -// Copyright (c) 2013 Zvonimir Rakamaric (zvonimir@cs.utah.edu), -// Michael Emmi (michael.emmi@gmail.com) // This file is distributed under the MIT License. See LICENSE for details. // diff --git a/include/smack/SmackRep.h b/include/smack/SmackRep.h index c9535798f..61fc01216 100644 --- a/include/smack/SmackRep.h +++ b/include/smack/SmackRep.h @@ -1,6 +1,4 @@ // -// Copyright (c) 2013 Zvonimir Rakamaric (zvonimir@cs.utah.edu), -// Michael Emmi (michael.emmi@gmail.com) // This file is distributed under the MIT License. See LICENSE for details. // #ifndef SMACKREP_H diff --git a/include/smack/SmackRepFlatMem.h b/include/smack/SmackRepFlatMem.h index efbd551a3..b196a070d 100644 --- a/include/smack/SmackRepFlatMem.h +++ b/include/smack/SmackRepFlatMem.h @@ -1,6 +1,4 @@ // -// Copyright (c) 2013 Zvonimir Rakamaric (zvonimir@cs.utah.edu), -// Michael Emmi (michael.emmi@gmail.com) // This file is distributed under the MIT License. See LICENSE for details. // #ifndef SMACKREPFLATMEM_H diff --git a/include/smack/smack.h b/include/smack/smack.h index 744433eb6..649361944 100644 --- a/include/smack/smack.h +++ b/include/smack/smack.h @@ -1,6 +1,4 @@ // -// Copyright (c) 2013 Zvonimir Rakamaric (zvonimir@cs.utah.edu), -// Michael Emmi (michael.emmi@gmail.com) // This file is distributed under the MIT License. See LICENSE for details. // #ifndef SMACK_H_ diff --git a/lib/smack/BoogieAst.cpp b/lib/smack/BoogieAst.cpp index b4b1d190a..ef3a77c05 100644 --- a/lib/smack/BoogieAst.cpp +++ b/lib/smack/BoogieAst.cpp @@ -1,6 +1,4 @@ // -// Copyright (c) 2013 Zvonimir Rakamaric (zvonimir@cs.utah.edu), -// Michael Emmi (michael.emmi@gmail.com) // This file is distributed under the MIT License. See LICENSE for details. // #include "smack/BoogieAst.h" diff --git a/lib/smack/BplFilePrinter.cpp b/lib/smack/BplFilePrinter.cpp index 575eda631..efed9795e 100644 --- a/lib/smack/BplFilePrinter.cpp +++ b/lib/smack/BplFilePrinter.cpp @@ -1,6 +1,4 @@ // -// Copyright (c) 2008 Zvonimir Rakamaric (zvonimir@cs.utah.edu), -// Pantazis Deligiannis (p.deligiannis@imperial.ac.uk) // This file is distributed under the MIT License. See LICENSE for details. // #include "smack/BplFilePrinter.h" diff --git a/lib/smack/BplPrinter.cpp b/lib/smack/BplPrinter.cpp index c6f79591e..fdbf35047 100644 --- a/lib/smack/BplPrinter.cpp +++ b/lib/smack/BplPrinter.cpp @@ -1,5 +1,4 @@ // -// Copyright (c) 2008 Zvonimir Rakamaric (zvonimir@cs.utah.edu) // This file is distributed under the MIT License. See LICENSE for details. // #include "smack/BplPrinter.h" diff --git a/lib/smack/SmackInstGenerator.cpp b/lib/smack/SmackInstGenerator.cpp index a22282539..9034891b3 100644 --- a/lib/smack/SmackInstGenerator.cpp +++ b/lib/smack/SmackInstGenerator.cpp @@ -1,5 +1,4 @@ // -// Copyright (c) 2008 Zvonimir Rakamaric (zvonimir@cs.utah.edu) // This file is distributed under the MIT License. See LICENSE for details. // #define DEBUG_TYPE "smack-inst-gen" diff --git a/lib/smack/SmackModuleGenerator.cpp b/lib/smack/SmackModuleGenerator.cpp index 7ebab07b6..38311056f 100644 --- a/lib/smack/SmackModuleGenerator.cpp +++ b/lib/smack/SmackModuleGenerator.cpp @@ -1,5 +1,4 @@ // -// Copyright (c) 2008 Zvonimir Rakamaric (zvonimir@cs.utah.edu) // This file is distributed under the MIT License. See LICENSE for details. // #define DEBUG_TYPE "smack-mod-gen" diff --git a/lib/smack/SmackOptions.cpp b/lib/smack/SmackOptions.cpp index 26cb9e991..021f4eeb3 100644 --- a/lib/smack/SmackOptions.cpp +++ b/lib/smack/SmackOptions.cpp @@ -1,6 +1,4 @@ // -// Copyright (c) 2013 Zvonimir Rakamaric (zvonimir@cs.utah.edu), -// Michael Emmi (michael.emmi@gmail.com) // This file is distributed under the MIT License. See LICENSE for details. // diff --git a/lib/smack/SmackRep.cpp b/lib/smack/SmackRep.cpp index 9f8446f3e..183ade066 100644 --- a/lib/smack/SmackRep.cpp +++ b/lib/smack/SmackRep.cpp @@ -1,6 +1,4 @@ // -// Copyright (c) 2013 Zvonimir Rakamaric (zvonimir@cs.utah.edu), -// Michael Emmi (michael.emmi@gmail.com) // This file is distributed under the MIT License. See LICENSE for details. // #define DEBUG_TYPE "smack-rep" diff --git a/lib/smack/SmackRepFlatMem.cpp b/lib/smack/SmackRepFlatMem.cpp index da9dd0f14..8a28bdd1d 100644 --- a/lib/smack/SmackRepFlatMem.cpp +++ b/lib/smack/SmackRepFlatMem.cpp @@ -1,6 +1,4 @@ // -// Copyright (c) 2013 Zvonimir Rakamaric (zvonimir@cs.utah.edu), -// Michael Emmi (michael.emmi@gmail.com) // This file is distributed under the MIT License. See LICENSE for details. // #include "smack/SmackRep.h" From a7cde0bd5343ab293c256bef915b9abfea9ff3e5 Mon Sep 17 00:00:00 2001 From: Michael Emmi Date: Sat, 4 Oct 2014 17:04:54 +0200 Subject: [PATCH 079/140] Renamed __SMACK_{assert,assume} to {assert,assume}. Fixes #51. --- README.md | 2 +- examples/failing/atomic_cas.c | 2 +- examples/failing/extern_mem2.c | 2 +- examples/failing/globals_func_ptr.c | 2 +- examples/rise4fun/rise_simple.c | 2 +- examples/rise4fun/rise_simple_buggy.c | 2 +- examples/simple/simple.c | 2 +- examples/svcomp/locks/test_locks_10_true.c | 2 +- examples/svcomp/locks/test_locks_11_true.c | 2 +- examples/svcomp/locks/test_locks_12_true.c | 2 +- examples/svcomp/locks/test_locks_13_true.c | 2 +- examples/svcomp/locks/test_locks_14_false.c | 2 +- examples/svcomp/locks/test_locks_14_true.c | 2 +- examples/svcomp/locks/test_locks_15_false.c | 2 +- examples/svcomp/locks/test_locks_15_true.c | 2 +- examples/svcomp/locks/test_locks_5_true.c | 2 +- examples/svcomp/locks/test_locks_6_true.c | 2 +- examples/svcomp/locks/test_locks_7_true.c | 2 +- examples/svcomp/locks/test_locks_8_true.c | 2 +- examples/svcomp/locks/test_locks_9_true.c | 2 +- .../cdaudio_simpl1_false.cil.c | 2 +- .../cdaudio_simpl1_true.cil.c | 2 +- .../diskperf_simpl1_true.cil.c | 2 +- .../floppy_simpl3_false.cil.c | 2 +- .../floppy_simpl3_true.cil.c | 2 +- .../floppy_simpl4_false.cil.c | 2 +- .../floppy_simpl4_true.cil.c | 2 +- .../kbfiltr_simpl1_true.cil.c | 2 +- .../kbfiltr_simpl2_false.cil.c | 2 +- .../kbfiltr_simpl2_true.cil.c | 2 +- .../svcomp/ntdrivers/cdaudio_true.i.cil.c | 2 +- .../svcomp/ntdrivers/diskperf_false.i.cil.c | 2 +- .../svcomp/ntdrivers/diskperf_true.i.cil.c | 2 +- .../svcomp/ntdrivers/floppy2_true.i.cil.c | 2 +- .../svcomp/ntdrivers/floppy_false.i.cil.c | 2 +- examples/svcomp/ntdrivers/floppy_true.i.cil.c | 2 +- .../svcomp/ntdrivers/kbfiltr_false.i.cil.c | 2 +- .../svcomp/ntdrivers/parport_false.i.cil.c | 2 +- .../svcomp/ntdrivers/parport_true.i.cil.c | 2 +- include/smack/smack.h | 4 +-- rise4fun/smack_server.py | 33 +++++++++-------- test/array1.c | 2 +- test/array1_fail.c | 2 +- test/array2.c | 2 +- test/array2_fail.c | 2 +- test/array3.c | 2 +- test/array3_fail.c | 2 +- test/array4.c | 2 +- test/array4_fail.c | 2 +- test/array_free.c | 2 +- test/array_free1.c | 4 +-- test/array_free1_fail.c | 4 +-- test/array_free2.c | 6 ++-- test/array_free2_fail.c | 6 ++-- test/array_free_fail.c | 2 +- test/ase_example.c | 2 +- test/ase_example_fail.c | 2 +- test/extern_mem.c | 2 +- test/extern_mem_fail.c | 2 +- test/extern_struct.c | 2 +- test/floats_in_memory.c | 2 +- test/floats_in_memory_fail.c | 2 +- test/func_ptr.c | 2 +- test/func_ptr1.c | 2 +- test/func_ptr1_fail.c | 2 +- test/func_ptr_fail.c | 2 +- test/globals.c | 2 +- test/globals_fail.c | 2 +- test/lock.c | 4 +-- test/lock_fail.c | 4 +-- test/loop.c | 2 +- test/loop1.c | 2 +- test/loop1_fail.c | 2 +- test/loop_fail.c | 2 +- test/nested_struct.c | 22 ++++++------ test/nested_struct1.c | 36 +++++++++---------- test/nested_struct1_fail.c | 2 +- test/nested_struct2.c | 36 +++++++++---------- test/nested_struct2_fail.c | 2 +- test/nested_struct_fail.c | 2 +- test/nondet.c | 2 +- test/pointers.c | 4 +-- test/pointers1.c | 4 +-- test/pointers1_fail.c | 4 +-- test/pointers2.c | 4 +-- test/pointers2_fail.c | 4 +-- test/pointers3.c | 4 +-- test/pointers3_fail.c | 4 +-- test/pointers_fail.c | 4 +-- test/simple.c | 2 +- test/simple_fail.c | 2 +- test/simple_pre.c | 2 +- test/simple_pre1.c | 2 +- test/simple_pre1_fail.c | 2 +- test/simple_pre2.c | 2 +- test/simple_pre2_fail.c | 2 +- test/simple_pre3.c | 2 +- test/simple_pre3_fail.c | 2 +- test/simple_pre_fail.c | 2 +- test/smack_code_call.c | 4 +-- test/smack_code_call_fail.c | 4 +-- test/struct_assign.c | 2 +- test/struct_assign_fail.c | 2 +- test/struct_cast.c | 2 +- test/struct_cast1.c | 2 +- test/struct_cast1_fail.c | 2 +- test/struct_cast_fail.c | 2 +- test/struct_init.c | 2 +- test/struct_init_fail.c | 2 +- test/struct_return.c | 2 +- test/two_arrays.c | 8 ++--- test/two_arrays1.c | 12 +++---- test/two_arrays2.c | 14 ++++---- test/two_arrays3.c | 14 ++++---- test/two_arrays4.c | 14 ++++---- test/two_arrays5.c | 2 +- test/two_arrays6.c | 14 ++++---- test/two_arrays6_fail.c | 10 +++--- 118 files changed, 234 insertions(+), 231 deletions(-) diff --git a/README.md b/README.md index 668427b8d..92cb22e34 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ SMACK can verify C programs, such as the following: a = 1; a = incr(a); - __SMACK_assert(a == 2); + assert(a == 2); return 0; } diff --git a/examples/failing/atomic_cas.c b/examples/failing/atomic_cas.c index 52aceb4d0..3d07ca8d1 100644 --- a/examples/failing/atomic_cas.c +++ b/examples/failing/atomic_cas.c @@ -7,6 +7,6 @@ int main() { int y = 0; int *z = x; CAS(&z,x,&y); // if (z == x) z = &y; - __SMACK_assert(*z == y); + assert(*z == y); return 0; } diff --git a/examples/failing/extern_mem2.c b/examples/failing/extern_mem2.c index 75b8abe6b..9cc82b16f 100644 --- a/examples/failing/extern_mem2.c +++ b/examples/failing/extern_mem2.c @@ -15,5 +15,5 @@ int main() { *x = 1; *z = 2; - __SMACK_assert(x != z); + assert(x != z); } \ No newline at end of file diff --git a/examples/failing/globals_func_ptr.c b/examples/failing/globals_func_ptr.c index c76cd1d46..94e26c96e 100644 --- a/examples/failing/globals_func_ptr.c +++ b/examples/failing/globals_func_ptr.c @@ -42,7 +42,7 @@ int main() { fp = my_ops.iops->incr; x = fp(x); - __SMACK_assert(x == 1); + assert(x == 1); return 0; } diff --git a/examples/rise4fun/rise_simple.c b/examples/rise4fun/rise_simple.c index 8eb1bda62..cebf44d13 100644 --- a/examples/rise4fun/rise_simple.c +++ b/examples/rise4fun/rise_simple.c @@ -6,6 +6,6 @@ int main(void) { x = 10; y = 20; z = x + y; - __SMACK_assert(z == 30); + assert(z == 30); return 0; } diff --git a/examples/rise4fun/rise_simple_buggy.c b/examples/rise4fun/rise_simple_buggy.c index 892fa2f7b..b9d8c7ec8 100644 --- a/examples/rise4fun/rise_simple_buggy.c +++ b/examples/rise4fun/rise_simple_buggy.c @@ -6,6 +6,6 @@ int main(void) { x = 10; y = 20; z = x + y; - __SMACK_assert(z != 30); + assert(z != 30); return 0; } diff --git a/examples/simple/simple.c b/examples/simple/simple.c index 16bf72076..8fd140d34 100644 --- a/examples/simple/simple.c +++ b/examples/simple/simple.c @@ -10,7 +10,7 @@ int main(void) { a = 1; a = incr(a); - __SMACK_assert(a == 2); + assert(a == 2); return 0; } diff --git a/examples/svcomp/locks/test_locks_10_true.c b/examples/svcomp/locks/test_locks_10_true.c index aca0fe98a..e99195b07 100644 --- a/examples/svcomp/locks/test_locks_10_true.c +++ b/examples/svcomp/locks/test_locks_10_true.c @@ -157,7 +157,7 @@ int main() } out: return 0; - ERROR: __SMACK_assert(0); + ERROR: assert(0); return 0; } diff --git a/examples/svcomp/locks/test_locks_11_true.c b/examples/svcomp/locks/test_locks_11_true.c index c41644275..fedfcf7d7 100644 --- a/examples/svcomp/locks/test_locks_11_true.c +++ b/examples/svcomp/locks/test_locks_11_true.c @@ -171,7 +171,7 @@ int main() } out: return 0; - ERROR: __SMACK_assert(0); + ERROR: assert(0); return 0; } diff --git a/examples/svcomp/locks/test_locks_12_true.c b/examples/svcomp/locks/test_locks_12_true.c index b054b7807..c29582f6f 100644 --- a/examples/svcomp/locks/test_locks_12_true.c +++ b/examples/svcomp/locks/test_locks_12_true.c @@ -185,7 +185,7 @@ int main() } out: return 0; - ERROR: __SMACK_assert(0); + ERROR: assert(0); return 0; } diff --git a/examples/svcomp/locks/test_locks_13_true.c b/examples/svcomp/locks/test_locks_13_true.c index 4aefa710e..a17d47d9b 100644 --- a/examples/svcomp/locks/test_locks_13_true.c +++ b/examples/svcomp/locks/test_locks_13_true.c @@ -199,7 +199,7 @@ int main() } out: return 0; - ERROR: __SMACK_assert(0); + ERROR: assert(0); return 0; } diff --git a/examples/svcomp/locks/test_locks_14_false.c b/examples/svcomp/locks/test_locks_14_false.c index ce33f7708..f60b00e71 100644 --- a/examples/svcomp/locks/test_locks_14_false.c +++ b/examples/svcomp/locks/test_locks_14_false.c @@ -213,7 +213,7 @@ int main() } out: return 0; - ERROR: __SMACK_assert(0); + ERROR: assert(0); return 0; } diff --git a/examples/svcomp/locks/test_locks_14_true.c b/examples/svcomp/locks/test_locks_14_true.c index a8e547625..a60609164 100644 --- a/examples/svcomp/locks/test_locks_14_true.c +++ b/examples/svcomp/locks/test_locks_14_true.c @@ -213,7 +213,7 @@ int main() } out: return 0; - ERROR: __SMACK_assert(0); + ERROR: assert(0); return 0; } diff --git a/examples/svcomp/locks/test_locks_15_false.c b/examples/svcomp/locks/test_locks_15_false.c index 4e232fc50..8bcd0eb88 100644 --- a/examples/svcomp/locks/test_locks_15_false.c +++ b/examples/svcomp/locks/test_locks_15_false.c @@ -227,7 +227,7 @@ int main() } out: return 0; - ERROR: __SMACK_assert(0); + ERROR: assert(0); return 0; } diff --git a/examples/svcomp/locks/test_locks_15_true.c b/examples/svcomp/locks/test_locks_15_true.c index a1e4da50b..8b21f5cd6 100644 --- a/examples/svcomp/locks/test_locks_15_true.c +++ b/examples/svcomp/locks/test_locks_15_true.c @@ -227,7 +227,7 @@ int main() } out: return 0; - ERROR: __SMACK_assert(0); + ERROR: assert(0); return 0; } diff --git a/examples/svcomp/locks/test_locks_5_true.c b/examples/svcomp/locks/test_locks_5_true.c index fc23676d9..720547c2a 100644 --- a/examples/svcomp/locks/test_locks_5_true.c +++ b/examples/svcomp/locks/test_locks_5_true.c @@ -87,7 +87,7 @@ int main() } out: return 0; - ERROR: __SMACK_assert(0); + ERROR: assert(0); return 0; } diff --git a/examples/svcomp/locks/test_locks_6_true.c b/examples/svcomp/locks/test_locks_6_true.c index 5b5c94d7d..75bfcb309 100644 --- a/examples/svcomp/locks/test_locks_6_true.c +++ b/examples/svcomp/locks/test_locks_6_true.c @@ -101,7 +101,7 @@ int main() } out: return 0; - ERROR: __SMACK_assert(0); + ERROR: assert(0); return 0; } diff --git a/examples/svcomp/locks/test_locks_7_true.c b/examples/svcomp/locks/test_locks_7_true.c index 5b11fcd3d..b50892d95 100644 --- a/examples/svcomp/locks/test_locks_7_true.c +++ b/examples/svcomp/locks/test_locks_7_true.c @@ -115,7 +115,7 @@ int main() } out: return 0; - ERROR: __SMACK_assert(0); + ERROR: assert(0); return 0; } diff --git a/examples/svcomp/locks/test_locks_8_true.c b/examples/svcomp/locks/test_locks_8_true.c index 1d6bdf10d..478bcb355 100644 --- a/examples/svcomp/locks/test_locks_8_true.c +++ b/examples/svcomp/locks/test_locks_8_true.c @@ -129,7 +129,7 @@ int main() } out: return 0; - ERROR: __SMACK_assert(0); + ERROR: assert(0); return 0; } diff --git a/examples/svcomp/locks/test_locks_9_true.c b/examples/svcomp/locks/test_locks_9_true.c index 4ac6bcd72..d9d66c368 100644 --- a/examples/svcomp/locks/test_locks_9_true.c +++ b/examples/svcomp/locks/test_locks_9_true.c @@ -143,7 +143,7 @@ int main() } out: return 0; - ERROR: __SMACK_assert(0); + ERROR: assert(0); return 0; } diff --git a/examples/svcomp/ntdrivers-simplified/cdaudio_simpl1_false.cil.c b/examples/svcomp/ntdrivers-simplified/cdaudio_simpl1_false.cil.c index ab8c63d4d..9e42783f1 100644 --- a/examples/svcomp/ntdrivers-simplified/cdaudio_simpl1_false.cil.c +++ b/examples/svcomp/ntdrivers-simplified/cdaudio_simpl1_false.cil.c @@ -33,7 +33,7 @@ void errorFn(void) { goto ERROR; - ERROR: __SMACK_assert(0); + ERROR: assert(0); #line 60 return; } diff --git a/examples/svcomp/ntdrivers-simplified/cdaudio_simpl1_true.cil.c b/examples/svcomp/ntdrivers-simplified/cdaudio_simpl1_true.cil.c index a1ad31390..d166519a2 100644 --- a/examples/svcomp/ntdrivers-simplified/cdaudio_simpl1_true.cil.c +++ b/examples/svcomp/ntdrivers-simplified/cdaudio_simpl1_true.cil.c @@ -33,7 +33,7 @@ void errorFn(void) { goto ERROR; - ERROR: __SMACK_assert(0); + ERROR: assert(0); #line 60 return; } diff --git a/examples/svcomp/ntdrivers-simplified/diskperf_simpl1_true.cil.c b/examples/svcomp/ntdrivers-simplified/diskperf_simpl1_true.cil.c index 146ca5ad8..f36862899 100644 --- a/examples/svcomp/ntdrivers-simplified/diskperf_simpl1_true.cil.c +++ b/examples/svcomp/ntdrivers-simplified/diskperf_simpl1_true.cil.c @@ -31,7 +31,7 @@ void errorFn(void) { goto ERROR; - ERROR: __SMACK_assert(0); + ERROR: assert(0); #line 58 return; } diff --git a/examples/svcomp/ntdrivers-simplified/floppy_simpl3_false.cil.c b/examples/svcomp/ntdrivers-simplified/floppy_simpl3_false.cil.c index 67955ecaf..15177cc9d 100644 --- a/examples/svcomp/ntdrivers-simplified/floppy_simpl3_false.cil.c +++ b/examples/svcomp/ntdrivers-simplified/floppy_simpl3_false.cil.c @@ -35,7 +35,7 @@ void errorFn(void) { goto ERROR; - ERROR: __SMACK_assert(0); + ERROR: assert(0); return; } } diff --git a/examples/svcomp/ntdrivers-simplified/floppy_simpl3_true.cil.c b/examples/svcomp/ntdrivers-simplified/floppy_simpl3_true.cil.c index cc09ba1d5..74d712679 100644 --- a/examples/svcomp/ntdrivers-simplified/floppy_simpl3_true.cil.c +++ b/examples/svcomp/ntdrivers-simplified/floppy_simpl3_true.cil.c @@ -35,7 +35,7 @@ void errorFn(void) { goto ERROR; - ERROR: __SMACK_assert(0); + ERROR: assert(0); return; } } diff --git a/examples/svcomp/ntdrivers-simplified/floppy_simpl4_false.cil.c b/examples/svcomp/ntdrivers-simplified/floppy_simpl4_false.cil.c index 3758376b3..5715fd475 100644 --- a/examples/svcomp/ntdrivers-simplified/floppy_simpl4_false.cil.c +++ b/examples/svcomp/ntdrivers-simplified/floppy_simpl4_false.cil.c @@ -2160,7 +2160,7 @@ void errorFn(void) { goto ERROR; - ERROR: __SMACK_assert(0); + ERROR: assert(0); #line 53 return; } diff --git a/examples/svcomp/ntdrivers-simplified/floppy_simpl4_true.cil.c b/examples/svcomp/ntdrivers-simplified/floppy_simpl4_true.cil.c index 9ae66f5de..0964718d7 100644 --- a/examples/svcomp/ntdrivers-simplified/floppy_simpl4_true.cil.c +++ b/examples/svcomp/ntdrivers-simplified/floppy_simpl4_true.cil.c @@ -2160,7 +2160,7 @@ void errorFn(void) { goto ERROR; - ERROR: __SMACK_assert(0); + ERROR: assert(0); #line 53 return; } diff --git a/examples/svcomp/ntdrivers-simplified/kbfiltr_simpl1_true.cil.c b/examples/svcomp/ntdrivers-simplified/kbfiltr_simpl1_true.cil.c index 2ea7cb4e7..56036ba2d 100644 --- a/examples/svcomp/ntdrivers-simplified/kbfiltr_simpl1_true.cil.c +++ b/examples/svcomp/ntdrivers-simplified/kbfiltr_simpl1_true.cil.c @@ -761,7 +761,7 @@ void errorFn(void) { goto ERROR; - ERROR: __SMACK_assert(0); + ERROR: assert(0); #line 23 return; } diff --git a/examples/svcomp/ntdrivers-simplified/kbfiltr_simpl2_false.cil.c b/examples/svcomp/ntdrivers-simplified/kbfiltr_simpl2_false.cil.c index b756eba21..ff452becb 100644 --- a/examples/svcomp/ntdrivers-simplified/kbfiltr_simpl2_false.cil.c +++ b/examples/svcomp/ntdrivers-simplified/kbfiltr_simpl2_false.cil.c @@ -1324,7 +1324,7 @@ void errorFn(void) { goto ERROR; - ERROR: __SMACK_assert(0); + ERROR: assert(0); #line 29 return; } diff --git a/examples/svcomp/ntdrivers-simplified/kbfiltr_simpl2_true.cil.c b/examples/svcomp/ntdrivers-simplified/kbfiltr_simpl2_true.cil.c index e269af808..9bf431a8d 100644 --- a/examples/svcomp/ntdrivers-simplified/kbfiltr_simpl2_true.cil.c +++ b/examples/svcomp/ntdrivers-simplified/kbfiltr_simpl2_true.cil.c @@ -1322,7 +1322,7 @@ void errorFn(void) { goto ERROR; - ERROR: __SMACK_assert(0); + ERROR: assert(0); #line 29 return; } diff --git a/examples/svcomp/ntdrivers/cdaudio_true.i.cil.c b/examples/svcomp/ntdrivers/cdaudio_true.i.cil.c index b70e01776..083a71063 100644 --- a/examples/svcomp/ntdrivers/cdaudio_true.i.cil.c +++ b/examples/svcomp/ntdrivers/cdaudio_true.i.cil.c @@ -2836,7 +2836,7 @@ void errorFn(void) { { - ERROR: __SMACK_assert(0); + ERROR: assert(0); goto ERROR; } } diff --git a/examples/svcomp/ntdrivers/diskperf_false.i.cil.c b/examples/svcomp/ntdrivers/diskperf_false.i.cil.c index b3f35b780..e14c48125 100644 --- a/examples/svcomp/ntdrivers/diskperf_false.i.cil.c +++ b/examples/svcomp/ntdrivers/diskperf_false.i.cil.c @@ -1983,7 +1983,7 @@ void errorFn(void) { { - ERROR: __SMACK_assert(0); + ERROR: assert(0); goto ERROR; } } diff --git a/examples/svcomp/ntdrivers/diskperf_true.i.cil.c b/examples/svcomp/ntdrivers/diskperf_true.i.cil.c index 4bc35fc27..ec068004c 100644 --- a/examples/svcomp/ntdrivers/diskperf_true.i.cil.c +++ b/examples/svcomp/ntdrivers/diskperf_true.i.cil.c @@ -1983,7 +1983,7 @@ void errorFn(void) { { - ERROR: __SMACK_assert(0); + ERROR: assert(0); goto ERROR; } } diff --git a/examples/svcomp/ntdrivers/floppy2_true.i.cil.c b/examples/svcomp/ntdrivers/floppy2_true.i.cil.c index 82b8ac9ac..13abd6784 100644 --- a/examples/svcomp/ntdrivers/floppy2_true.i.cil.c +++ b/examples/svcomp/ntdrivers/floppy2_true.i.cil.c @@ -6173,7 +6173,7 @@ NTSTATUS FlAcpiConfigureFloppy(PDISKETTE_EXTENSION DisketteExtension , PFDC_INFO #line 949 void __VERIFIER_assert(int cond) { if (!(cond)) { - ERROR: __SMACK_assert(0); goto ERROR; + ERROR: assert(0); goto ERROR; } return; } diff --git a/examples/svcomp/ntdrivers/floppy_false.i.cil.c b/examples/svcomp/ntdrivers/floppy_false.i.cil.c index ecc90cc3b..68748d2a5 100644 --- a/examples/svcomp/ntdrivers/floppy_false.i.cil.c +++ b/examples/svcomp/ntdrivers/floppy_false.i.cil.c @@ -2096,7 +2096,7 @@ void errorFn(void) { { - ERROR: __SMACK_assert(0); + ERROR: assert(0); goto ERROR; } } diff --git a/examples/svcomp/ntdrivers/floppy_true.i.cil.c b/examples/svcomp/ntdrivers/floppy_true.i.cil.c index 8c3b92755..db12115e6 100644 --- a/examples/svcomp/ntdrivers/floppy_true.i.cil.c +++ b/examples/svcomp/ntdrivers/floppy_true.i.cil.c @@ -2097,7 +2097,7 @@ void errorFn(void) { { - ERROR: __SMACK_assert(0); + ERROR: assert(0); goto ERROR; } } diff --git a/examples/svcomp/ntdrivers/kbfiltr_false.i.cil.c b/examples/svcomp/ntdrivers/kbfiltr_false.i.cil.c index faf23a58b..d7909ca32 100644 --- a/examples/svcomp/ntdrivers/kbfiltr_false.i.cil.c +++ b/examples/svcomp/ntdrivers/kbfiltr_false.i.cil.c @@ -1639,7 +1639,7 @@ void errorFn(void) { { - ERROR: __SMACK_assert(0); + ERROR: assert(0); goto ERROR; } } diff --git a/examples/svcomp/ntdrivers/parport_false.i.cil.c b/examples/svcomp/ntdrivers/parport_false.i.cil.c index f07fbefcd..2026f09aa 100644 --- a/examples/svcomp/ntdrivers/parport_false.i.cil.c +++ b/examples/svcomp/ntdrivers/parport_false.i.cil.c @@ -2246,7 +2246,7 @@ void errorFn(void) { { - ERROR: __SMACK_assert(0); + ERROR: assert(0); goto ERROR; } } diff --git a/examples/svcomp/ntdrivers/parport_true.i.cil.c b/examples/svcomp/ntdrivers/parport_true.i.cil.c index caf844d5e..3e0be9724 100644 --- a/examples/svcomp/ntdrivers/parport_true.i.cil.c +++ b/examples/svcomp/ntdrivers/parport_true.i.cil.c @@ -2246,7 +2246,7 @@ void errorFn(void) { { - ERROR: __SMACK_assert(0); + ERROR: assert(0); goto ERROR; } } diff --git a/include/smack/smack.h b/include/smack/smack.h index 649361944..fb304719f 100644 --- a/include/smack/smack.h +++ b/include/smack/smack.h @@ -35,11 +35,11 @@ void __SMACK_mod(const char *fmt, ...); void __SMACK_decl(const char *fmt, ...); void __SMACK_top_decl(const char *fmt, ...); -void __SMACK_assert(bool v) { +void assert(bool v) { __SMACK_code("assert @ != 0;", v); } -void __SMACK_assume(bool v) { +void assume(bool v) { __SMACK_code("assume @ != 0;", v); } diff --git a/rise4fun/smack_server.py b/rise4fun/smack_server.py index 65c837578..dff848d50 100644 --- a/rise4fun/smack_server.py +++ b/rise4fun/smack_server.py @@ -1,3 +1,6 @@ +# +# This file is distributed under the MIT License. See LICENSE for details. +# import BaseHTTPServer import SimpleHTTPServer import json @@ -9,25 +12,25 @@ version = "1.4.4" rise_simple = """#include "smack.h" //__SMACK_nondet() : Is used to permit assigned memory to have unconstrained values -//__SMACK_assume(): Is used to enforce constraints on specified regions of memory -//__SMACK_assert(): Is used to prove some assertions on values in the program. Assertions may contain unconstrained values. +//assume(): Is used to enforce constraints on specified regions of memory +//assert(): Is used to prove some assertions on values in the program. Assertions may contain unconstrained values. int main() { int x = __SMACK_nondet(); int n = __SMACK_nondet(); - __SMACK_assume(n>0); - __SMACK_assert(x+n > x); + assume(n>0); + assert(x+n > x); return 0; }""" rise_simple_buggy = """#include "smack.h" //__SMACK_nondet() : Is used to permit assigned memory to have unconstrained values -//__SMACK_assume(): Is used to enforce constraints on specified regions of memory -//__SMACK_assert(): Is used to prove some assertions on values in the program. Assertions may contain unconstrained values +//assume(): Is used to enforce constraints on specified regions of memory +//assert(): Is used to prove some assertions on values in the program. Assertions may contain unconstrained values int main() { int x = __SMACK_nondet(); int n = __SMACK_nondet(); - __SMACK_assume(n>=0); - __SMACK_assert(x+n > x); + assume(n>=0); + assert(x+n > x); return 0; }""" @@ -52,7 +55,7 @@ } x = fp(x); - __SMACK_assert(x == old_x-1 || x == old_x+1); + assert(x == old_x-1 || x == old_x+1); return 0; }""" @@ -73,7 +76,7 @@ int i = __SMACK_nondet(); initDescArray(num,size); if(i >= 1 && i < 6) - __SMACK_assert(num[i] > num[i-1]); + assert(num[i] > num[i-1]); }""" @@ -114,7 +117,7 @@ int b; b = foo(__SMACK_nondet(), __SMACK_nondet()); - __SMACK_assert(b != 0); + assert(b != 0); return 0; }""" @@ -129,7 +132,7 @@ a = __SMACK_nondet(); b = __SMACK_nondet(); if(a>=0 && b>=0) - __SMACK_assert(z != (a*x+b*y)); + assert(z != (a*x+b*y)); return 0; }""" @@ -153,7 +156,7 @@ s1.a = 3; p2->x = 4; - __SMACK_assert(s1.a == 4); + assert(s1.a == 4); return 0; }""" @@ -163,9 +166,9 @@ The tool is open-source and integrates into the well-known LLVM compiler infrastructure.\r\n There are 3 types of annotations that SMACK allows the user to specify. They are the assert, assume and nondet statements.\r\n Assert: Allows the user to specify a predicate on the variables in scope. SMACK statically checks the assertion in this - program location. The predicate P can be specified in an assert in the syntax __SMACK_assert(P) \r\n + program location. The predicate P can be specified in an assert in the syntax assert(P) \r\n Assume: Assume statement allows the user to specify the assumptions of the program from the point of specification. If the - assumption is denoted by A, __SMACK_assume(A) is the syntax for specifying it. Eg: __SMACK_assume(n > 0) + assumption is denoted by A, assume(A) is the syntax for specifying it. Eg: assume(n > 0) Nondet: Allows the user to specify a "random" value. This is specified by __SMACK_nondet(). The statement returns a nondeterministic type safe value.""" metadata = { diff --git a/test/array1.c b/test/array1.c index c01fff04e..cdabe9cf5 100644 --- a/test/array1.c +++ b/test/array1.c @@ -10,7 +10,7 @@ int main() { a[5] = 10; - __SMACK_assert(a[5] == 10); + assert(a[5] == 10); free(a); return 0; diff --git a/test/array1_fail.c b/test/array1_fail.c index 14ca9b7e7..198d3ca8b 100644 --- a/test/array1_fail.c +++ b/test/array1_fail.c @@ -10,7 +10,7 @@ int main() { a[5] = 10; - __SMACK_assert(a[4] == 10 || a[5] == 0); + assert(a[4] == 10 || a[5] == 0); free(a); return 0; diff --git a/test/array2.c b/test/array2.c index 93e43b034..57f7e4ace 100644 --- a/test/array2.c +++ b/test/array2.c @@ -13,7 +13,7 @@ int main() { a[i] = RESET; } - __SMACK_assert(a[5] == RESET); + assert(a[5] == RESET); free(a); return 0; diff --git a/test/array2_fail.c b/test/array2_fail.c index b16e81d55..148607dd4 100644 --- a/test/array2_fail.c +++ b/test/array2_fail.c @@ -13,7 +13,7 @@ int main() { a[i] = RESET; } - __SMACK_assert(a[5] != RESET || a[9] == RESET); + assert(a[5] != RESET || a[9] == RESET); free(a); return 0; diff --git a/test/array3.c b/test/array3.c index 2722bb68e..6f40b554e 100644 --- a/test/array3.c +++ b/test/array3.c @@ -21,7 +21,7 @@ int main() { initializeArray(array); for (i = 0; i < MAXSIZE; i++) { - __SMACK_assert(array[i] == RESET); + assert(array[i] == RESET); } free(array); diff --git a/test/array3_fail.c b/test/array3_fail.c index f63cc0e6f..767cc600d 100644 --- a/test/array3_fail.c +++ b/test/array3_fail.c @@ -23,7 +23,7 @@ int main() { initializeArray(array); for (i = 0; i < MAXSIZE; i++) { - __SMACK_assert(array[i] == RESET); + assert(array[i] == RESET); } free(array); diff --git a/test/array4.c b/test/array4.c index f8f4331cc..98630e231 100644 --- a/test/array4.c +++ b/test/array4.c @@ -26,7 +26,7 @@ int main() { initializeArray(array); for (i = 0; i < MAXSIZE; i++) { - __SMACK_assert(array[i].status == RESET); + assert(array[i].status == RESET); } free(array); diff --git a/test/array4_fail.c b/test/array4_fail.c index e9315ffc4..6db543559 100644 --- a/test/array4_fail.c +++ b/test/array4_fail.c @@ -26,7 +26,7 @@ int main() { initializeArray(array); for (i = 0; i < MAXSIZE + 1; i++) { - __SMACK_assert(array[i].status == RESET); + assert(array[i].status == RESET); } free(array); diff --git a/test/array_free.c b/test/array_free.c index 7c62f010e..ff76716bf 100644 --- a/test/array_free.c +++ b/test/array_free.c @@ -19,7 +19,7 @@ void free_array() { } for (i = 0; i < MAXSIZE; i++) { - __SMACK_assert(*(a[i].f) == 1); + assert(*(a[i].f) == 1); if (a[i].f != 0) { free(a[i].f); a[i].f = 0; diff --git a/test/array_free1.c b/test/array_free1.c index aed3dbed2..071c59d7a 100644 --- a/test/array_free1.c +++ b/test/array_free1.c @@ -21,8 +21,8 @@ void free_array() { } for (i = 0; i < MAXSIZE; i++) { - __SMACK_assert(*(a[i].f) == 1); - __SMACK_assert(a[i].x == 2); + assert(*(a[i].f) == 1); + assert(a[i].x == 2); if (a[i].f != 0) { free(a[i].f); a[i].f = 0; diff --git a/test/array_free1_fail.c b/test/array_free1_fail.c index 3217a6193..f1d863156 100644 --- a/test/array_free1_fail.c +++ b/test/array_free1_fail.c @@ -21,8 +21,8 @@ void free_array() { } for (i = 0; i < MAXSIZE; i++) { - __SMACK_assert(*(a[i].f) == 1); - __SMACK_assert(a[i].x == 2); + assert(*(a[i].f) == 1); + assert(a[i].x == 2); if (a[i].f != 0) { free(a[i].f); a[i].f = 0; diff --git a/test/array_free2.c b/test/array_free2.c index 0482f2bfa..8ccc50fd4 100644 --- a/test/array_free2.c +++ b/test/array_free2.c @@ -23,9 +23,9 @@ void free_array() { } for (i = 0; i < MAXSIZE; i++) { - __SMACK_assert(*(a[i].f) == 1); - __SMACK_assert(a[i].x == 2); - __SMACK_assert(a[i].y == 3); + assert(*(a[i].f) == 1); + assert(a[i].x == 2); + assert(a[i].y == 3); if (a[i].f != 0) { free(a[i].f); a[i].f = 0; diff --git a/test/array_free2_fail.c b/test/array_free2_fail.c index 5b6de07de..2cfe78a34 100644 --- a/test/array_free2_fail.c +++ b/test/array_free2_fail.c @@ -23,9 +23,9 @@ void free_array() { } for (i = 0; i < MAXSIZE; i++) { - __SMACK_assert(*(a[i].f) == 1); - __SMACK_assert(a[i].x == 2); - __SMACK_assert(a[i].y == 3); + assert(*(a[i].f) == 1); + assert(a[i].x == 2); + assert(a[i].y == 3); if (a[i].f != 0) { free(a[i].f); a[i].f = 0; diff --git a/test/array_free_fail.c b/test/array_free_fail.c index 445d9bfa7..edd43bbe5 100644 --- a/test/array_free_fail.c +++ b/test/array_free_fail.c @@ -19,7 +19,7 @@ void free_array() { } for (i = 0; i < MAXSIZE; i++) { - __SMACK_assert(*(a[i].f) == 1); + assert(*(a[i].f) == 1); if (a[i].f != 0) { free(a[i].f); a[i].f = 0; diff --git a/test/ase_example.c b/test/ase_example.c index 39367749b..94875b47f 100644 --- a/test/ase_example.c +++ b/test/ase_example.c @@ -26,7 +26,7 @@ void init(int size) { } for (i = 0; i < size; i++) { - __SMACK_assert(a1[i].f1 == 1); + assert(a1[i].f1 == 1); } } diff --git a/test/ase_example_fail.c b/test/ase_example_fail.c index c27effcb9..f0c9499d2 100644 --- a/test/ase_example_fail.c +++ b/test/ase_example_fail.c @@ -26,7 +26,7 @@ void init(int size) { } for (i = 0; i < size; i++) { - __SMACK_assert(a1[i].f1 == 1); + assert(a1[i].f1 == 1); } } diff --git a/test/extern_mem.c b/test/extern_mem.c index cd779554a..be84434db 100644 --- a/test/extern_mem.c +++ b/test/extern_mem.c @@ -14,5 +14,5 @@ int main() { *x = 1; *y = 2; - __SMACK_assert(x != y); + assert(x != y); } \ No newline at end of file diff --git a/test/extern_mem_fail.c b/test/extern_mem_fail.c index c3c468a09..7439cbb58 100644 --- a/test/extern_mem_fail.c +++ b/test/extern_mem_fail.c @@ -14,5 +14,5 @@ int main() { *x = 1; *y = 2; - __SMACK_assert(x != y); + assert(x != y); } \ No newline at end of file diff --git a/test/extern_struct.c b/test/extern_struct.c index e0dc68c68..85b438750 100644 --- a/test/extern_struct.c +++ b/test/extern_struct.c @@ -4,7 +4,7 @@ extern const struct process *procinit[]; int main(void) { procinit[0] = 0; - __SMACK_assert(0); + assert(0); return 0; } diff --git a/test/floats_in_memory.c b/test/floats_in_memory.c index 9e43772a9..17a9e4110 100644 --- a/test/floats_in_memory.c +++ b/test/floats_in_memory.c @@ -14,7 +14,7 @@ int main() { ff1(f2); ff2(&f2,&f3); - __SMACK_assert(f2 == f3); + assert(f2 == f3); return 0; } diff --git a/test/floats_in_memory_fail.c b/test/floats_in_memory_fail.c index c04e8ea04..920aa80fb 100644 --- a/test/floats_in_memory_fail.c +++ b/test/floats_in_memory_fail.c @@ -14,7 +14,7 @@ int main() { ff1(f2); ff2(&f2,&f3); - __SMACK_assert(f2 == f3); + assert(f2 == f3); return 0; } diff --git a/test/func_ptr.c b/test/func_ptr.c index bf8e54a57..8ed7f78e7 100644 --- a/test/func_ptr.c +++ b/test/func_ptr.c @@ -19,7 +19,7 @@ int main(void) { } x = fp(x); - __SMACK_assert(x == 2); + assert(x == 2); return 0; } diff --git a/test/func_ptr1.c b/test/func_ptr1.c index e983b9b13..3d1aca628 100644 --- a/test/func_ptr1.c +++ b/test/func_ptr1.c @@ -22,7 +22,7 @@ int main(void) { } fp(x); - __SMACK_assert(*x == 2); + assert(*x == 2); return 0; } diff --git a/test/func_ptr1_fail.c b/test/func_ptr1_fail.c index c9b3ab1f5..a15b8d89f 100644 --- a/test/func_ptr1_fail.c +++ b/test/func_ptr1_fail.c @@ -22,7 +22,7 @@ int main(void) { } fp(x); - __SMACK_assert(*x == 0 || *x == 1); + assert(*x == 0 || *x == 1); return 0; } diff --git a/test/func_ptr_fail.c b/test/func_ptr_fail.c index 280578d60..54668ad81 100644 --- a/test/func_ptr_fail.c +++ b/test/func_ptr_fail.c @@ -19,7 +19,7 @@ int main(void) { } x = fp(x); - __SMACK_assert(x == 0 || x == 1); + assert(x == 0 || x == 1); return 0; } diff --git a/test/globals.c b/test/globals.c index 5456c8ea0..598bf2a62 100644 --- a/test/globals.c +++ b/test/globals.c @@ -10,6 +10,6 @@ int main(void){ g1 = 3; *x = 4; g2 = 5; - __SMACK_assert(g1 == 3 && *x == 4 && g2 == 5); + assert(g1 == 3 && *x == 4 && g2 == 5); } diff --git a/test/globals_fail.c b/test/globals_fail.c index 1583c2ab2..cc6051996 100644 --- a/test/globals_fail.c +++ b/test/globals_fail.c @@ -10,6 +10,6 @@ int main(void){ g1 = 3; *x = 4; g2 = 5; - __SMACK_assert(g1 != 3 || *x != 4 || g2 != 5); + assert(g1 != 3 || *x != 4 || g2 != 5); } diff --git a/test/lock.c b/test/lock.c index 187d444bd..f929713a0 100644 --- a/test/lock.c +++ b/test/lock.c @@ -14,12 +14,12 @@ lock main_lock; lock global_lock; void acquire_lock(lock *l) { - __SMACK_assert(l->locked == UNLOCKED); + assert(l->locked == UNLOCKED); l->locked = LOCKED; } void release_lock(lock *l) { - __SMACK_assert(l->locked == LOCKED); + assert(l->locked == LOCKED); l->locked = UNLOCKED; } diff --git a/test/lock_fail.c b/test/lock_fail.c index 649c3ba6a..26a2b3492 100644 --- a/test/lock_fail.c +++ b/test/lock_fail.c @@ -14,12 +14,12 @@ lock main_lock; lock global_lock; void acquire_lock(lock *l) { - __SMACK_assert(l->locked == UNLOCKED); + assert(l->locked == UNLOCKED); l->locked = LOCKED; } void release_lock(lock *l) { - __SMACK_assert(l->locked == LOCKED); + assert(l->locked == LOCKED); l->locked = UNLOCKED; } diff --git a/test/loop.c b/test/loop.c index 908206b87..d160c5aa8 100644 --- a/test/loop.c +++ b/test/loop.c @@ -14,7 +14,7 @@ int main() { for (i = 0; i < MAXSIZE; i++) { x = i; } - __SMACK_assert(x == MAXSIZE - 1); + assert(x == MAXSIZE - 1); return 0; } diff --git a/test/loop1.c b/test/loop1.c index 020a0014b..8a3948439 100644 --- a/test/loop1.c +++ b/test/loop1.c @@ -14,7 +14,7 @@ int main() { for (i = 0; i < MAXSIZE; i++) { j = i; } - __SMACK_assert(x == 1); + assert(x == 1); return 0; } diff --git a/test/loop1_fail.c b/test/loop1_fail.c index 12229a468..047d7d524 100644 --- a/test/loop1_fail.c +++ b/test/loop1_fail.c @@ -14,7 +14,7 @@ int main() { for (i = 0; i < MAXSIZE; i++) { j = i; } - __SMACK_assert(x != 1); + assert(x != 1); return 0; } diff --git a/test/loop_fail.c b/test/loop_fail.c index 0abacc4bc..43129d26c 100644 --- a/test/loop_fail.c +++ b/test/loop_fail.c @@ -14,7 +14,7 @@ int main() { for (i = 0; i < MAXSIZE; i++) { x = i; } - __SMACK_assert(x != MAXSIZE - 1); + assert(x != MAXSIZE - 1); return 0; } diff --git a/test/nested_struct.c b/test/nested_struct.c index 3bb1e2730..270602ccb 100644 --- a/test/nested_struct.c +++ b/test/nested_struct.c @@ -20,25 +20,25 @@ int main(void) { element elem; elem.count = 1; - __SMACK_assert(elem.count == 1); + assert(elem.count == 1); elem.count = 2; - __SMACK_assert(elem.count == 2); + assert(elem.count == 2); elem.point1.y = 100; - __SMACK_assert(elem.count == 2); - __SMACK_assert(elem.point1.y == 100); + assert(elem.count == 2); + assert(elem.point1.y == 100); elem.data = 5; - __SMACK_assert(elem.count == 2); - __SMACK_assert(elem.point1.y == 100); - __SMACK_assert(elem.data == 5); + assert(elem.count == 2); + assert(elem.point1.y == 100); + assert(elem.data == 5); elem.point2.x = 200; - __SMACK_assert(elem.count == 2); - __SMACK_assert(elem.point1.y == 100); - __SMACK_assert(elem.data == 5); - __SMACK_assert(elem.point2.x == 200); + assert(elem.count == 2); + assert(elem.point1.y == 100); + assert(elem.data == 5); + assert(elem.point2.x == 200); return 0; } diff --git a/test/nested_struct1.c b/test/nested_struct1.c index 1de16d120..89323bb69 100644 --- a/test/nested_struct1.c +++ b/test/nested_struct1.c @@ -20,36 +20,36 @@ int main(void) { point p; elem.count = 1; - __SMACK_assert(elem.count == 1); + assert(elem.count == 1); elem.count = 2; - __SMACK_assert(elem.count == 2); + assert(elem.count == 2); elem.point1.y = 100; - __SMACK_assert(elem.count == 2); - __SMACK_assert(elem.point1.y == 100); + assert(elem.count == 2); + assert(elem.point1.y == 100); elem.data = 5; - __SMACK_assert(elem.count == 2); - __SMACK_assert(elem.point1.y == 100); - __SMACK_assert(elem.data == 5); + assert(elem.count == 2); + assert(elem.point1.y == 100); + assert(elem.data == 5); elem.point2.x = 200; - __SMACK_assert(elem.count == 2); - __SMACK_assert(elem.point1.y == 100); - __SMACK_assert(elem.data == 5); - __SMACK_assert(elem.point2.x == 200); + assert(elem.count == 2); + assert(elem.point1.y == 100); + assert(elem.data == 5); + assert(elem.point2.x == 200); p.x = 1000; p.y = 2000; elem.point1 = p; - __SMACK_assert(elem.count == 2); - __SMACK_assert(elem.data == 5); - __SMACK_assert(elem.point2.x == 200); - __SMACK_assert(p.x == 1000); - __SMACK_assert(p.y == 2000); - __SMACK_assert(elem.point1.x == 1000); - __SMACK_assert(elem.point1.y == 2000); + assert(elem.count == 2); + assert(elem.data == 5); + assert(elem.point2.x == 200); + assert(p.x == 1000); + assert(p.y == 2000); + assert(elem.point1.x == 1000); + assert(elem.point1.y == 2000); return 0; } diff --git a/test/nested_struct1_fail.c b/test/nested_struct1_fail.c index 58c6cf0f5..18eea5285 100644 --- a/test/nested_struct1_fail.c +++ b/test/nested_struct1_fail.c @@ -28,7 +28,7 @@ int main(void) { p.y = 2000; elem.point1 = p; - __SMACK_assert(elem.count != 2 || elem.data != 5 || elem.point2.x != 200 || p.x != 1000 || + assert(elem.count != 2 || elem.data != 5 || elem.point2.x != 200 || p.x != 1000 || p.y != 2000 || elem.point1.x != 1000 || elem.point1.y != 2000); return 0; diff --git a/test/nested_struct2.c b/test/nested_struct2.c index 577299832..a469dc8cf 100644 --- a/test/nested_struct2.c +++ b/test/nested_struct2.c @@ -20,36 +20,36 @@ int main(void) { point p; elem.count = 1; - __SMACK_assert(elem.count == 1); + assert(elem.count == 1); elem.count = 2; - __SMACK_assert(elem.count == 2); + assert(elem.count == 2); elem.point1 = &p; elem.point1->y = 100; - __SMACK_assert(elem.count == 2); - __SMACK_assert(elem.point1->y == 100); + assert(elem.count == 2); + assert(elem.point1->y == 100); elem.data = 5; - __SMACK_assert(elem.count == 2); - __SMACK_assert(elem.point1->y == 100); - __SMACK_assert(elem.data == 5); + assert(elem.count == 2); + assert(elem.point1->y == 100); + assert(elem.data == 5); elem.point2.x = 200; - __SMACK_assert(elem.count == 2); - __SMACK_assert(elem.point1->y == 100); - __SMACK_assert(elem.data == 5); - __SMACK_assert(elem.point2.x == 200); + assert(elem.count == 2); + assert(elem.point1->y == 100); + assert(elem.data == 5); + assert(elem.point2.x == 200); p.x = 1000; p.y = 2000; - __SMACK_assert(elem.count == 2); - __SMACK_assert(elem.data == 5); - __SMACK_assert(elem.point2.x == 200); - __SMACK_assert(p.x == 1000); - __SMACK_assert(p.y == 2000); - __SMACK_assert(elem.point1->x == 1000); - __SMACK_assert(elem.point1->y == 2000); + assert(elem.count == 2); + assert(elem.data == 5); + assert(elem.point2.x == 200); + assert(p.x == 1000); + assert(p.y == 2000); + assert(elem.point1->x == 1000); + assert(elem.point1->y == 2000); return 0; } diff --git a/test/nested_struct2_fail.c b/test/nested_struct2_fail.c index a46a69990..79d526221 100644 --- a/test/nested_struct2_fail.c +++ b/test/nested_struct2_fail.c @@ -28,7 +28,7 @@ int main(void) { p.x = 1000; p.y = 2000; - __SMACK_assert(elem.count != 2 || elem.data != 5 || elem.point2.x != 200 || p.x != 1000 || + assert(elem.count != 2 || elem.data != 5 || elem.point2.x != 200 || p.x != 1000 || p.y != 2000 || elem.point1->x != 1000 || elem.point1->y != 2000); return 0; diff --git a/test/nested_struct_fail.c b/test/nested_struct_fail.c index 496d7f981..58b4febc6 100644 --- a/test/nested_struct_fail.c +++ b/test/nested_struct_fail.c @@ -25,7 +25,7 @@ int main(void) { elem.data = 5; elem.point2.x = 200; - __SMACK_assert(elem.count != 2 || elem.point1.y != 100 || elem.data != 5 || elem.point2.x != 200); + assert(elem.count != 2 || elem.point1.y != 100 || elem.data != 5 || elem.point2.x != 200); return 0; } diff --git a/test/nondet.c b/test/nondet.c index 68f6bf438..c9d863d5b 100644 --- a/test/nondet.c +++ b/test/nondet.c @@ -9,7 +9,7 @@ int main(void) { x--; } - __SMACK_assert(x == 0 || x == 2); + assert(x == 0 || x == 2); return 0; } diff --git a/test/pointers.c b/test/pointers.c index 22e3b264b..b9307d9e8 100644 --- a/test/pointers.c +++ b/test/pointers.c @@ -15,8 +15,8 @@ int main() { incr(a); incr(b); - __SMACK_assert(*a == 1); - __SMACK_assert(*b == 1); + assert(*a == 1); + assert(*b == 1); return 0; } diff --git a/test/pointers1.c b/test/pointers1.c index db61e3527..991a98697 100644 --- a/test/pointers1.c +++ b/test/pointers1.c @@ -19,8 +19,8 @@ int main() { incr(p); - __SMACK_assert(p->a == 1); - __SMACK_assert(p->b == 1); + assert(p->a == 1); + assert(p->b == 1); return 0; } diff --git a/test/pointers1_fail.c b/test/pointers1_fail.c index 9567b3fa7..ac1af5c3b 100644 --- a/test/pointers1_fail.c +++ b/test/pointers1_fail.c @@ -20,8 +20,8 @@ int main() { incr(p); - __SMACK_assert(p->a == 1); - __SMACK_assert(p->b == 1); + assert(p->a == 1); + assert(p->b == 1); return 0; } diff --git a/test/pointers2.c b/test/pointers2.c index b800d8679..50c19476d 100644 --- a/test/pointers2.c +++ b/test/pointers2.c @@ -25,8 +25,8 @@ int main() { incr(&p); decr(&p); - __SMACK_assert(p.a == 1); - __SMACK_assert(p.b == 1); + assert(p.a == 1); + assert(p.b == 1); return 0; } diff --git a/test/pointers2_fail.c b/test/pointers2_fail.c index 1fc847a82..0cc18fbb3 100644 --- a/test/pointers2_fail.c +++ b/test/pointers2_fail.c @@ -26,8 +26,8 @@ int main() { decr(&p); decr(&p); - __SMACK_assert(p.a == 1); - __SMACK_assert(p.b == 1); + assert(p.a == 1); + assert(p.b == 1); return 0; } diff --git a/test/pointers3.c b/test/pointers3.c index ba4ddcd29..923632352 100644 --- a/test/pointers3.c +++ b/test/pointers3.c @@ -26,8 +26,8 @@ void foo(void) { } void bar(void) { - __SMACK_assert(p.a == 1); - __SMACK_assert(p.b == 1); + assert(p.a == 1); + assert(p.b == 1); } int main() { diff --git a/test/pointers3_fail.c b/test/pointers3_fail.c index f6450f049..bcafc65aa 100644 --- a/test/pointers3_fail.c +++ b/test/pointers3_fail.c @@ -26,8 +26,8 @@ void foo(void) { } void bar(void) { - __SMACK_assert(p.a == 1); - __SMACK_assert(p.b == 1); + assert(p.a == 1); + assert(p.b == 1); } int main() { diff --git a/test/pointers_fail.c b/test/pointers_fail.c index 016c52792..60b0d0378 100644 --- a/test/pointers_fail.c +++ b/test/pointers_fail.c @@ -16,8 +16,8 @@ int main() { incr(b); incr(a); - __SMACK_assert(*a == 1); - __SMACK_assert(*b == 1); + assert(*a == 1); + assert(*b == 1); return 0; } diff --git a/test/simple.c b/test/simple.c index 72a903ce8..3c1b01e5a 100644 --- a/test/simple.c +++ b/test/simple.c @@ -9,7 +9,7 @@ int main(void) { a = 1; b = 2; a = -1; - __SMACK_assert(b == 3 || a == -1 || b == 0); + assert(b == 3 || a == -1 || b == 0); return a; } diff --git a/test/simple_fail.c b/test/simple_fail.c index 0b7654bf4..3652a8f53 100644 --- a/test/simple_fail.c +++ b/test/simple_fail.c @@ -7,7 +7,7 @@ int main(void) { a = 1; a = -1; - __SMACK_assert(a != -1); + assert(a != -1); return a; } diff --git a/test/simple_pre.c b/test/simple_pre.c index 08a62e3a3..8309c2ce2 100644 --- a/test/simple_pre.c +++ b/test/simple_pre.c @@ -11,7 +11,7 @@ int main(void) { a = -1; a = returnOne(); - __SMACK_assert(a == 1); + assert(a == 1); return a; } diff --git a/test/simple_pre1.c b/test/simple_pre1.c index 691f31a9c..62289a77f 100644 --- a/test/simple_pre1.c +++ b/test/simple_pre1.c @@ -11,7 +11,7 @@ int main(void) { a = -1; a = incr(a); - __SMACK_assert(a == -1); + assert(a == -1); return a; } diff --git a/test/simple_pre1_fail.c b/test/simple_pre1_fail.c index 5bbb4b089..e6a31e8f3 100644 --- a/test/simple_pre1_fail.c +++ b/test/simple_pre1_fail.c @@ -11,7 +11,7 @@ int main(void) { a = -1; a = incr(a); - __SMACK_assert(a == -1); + assert(a == -1); return a; } diff --git a/test/simple_pre2.c b/test/simple_pre2.c index f4d05d512..f6be7c203 100644 --- a/test/simple_pre2.c +++ b/test/simple_pre2.c @@ -11,7 +11,7 @@ int main(void) { a = 1; a = incr(a); - __SMACK_assert(a == 2); + assert(a == 2); return a; } diff --git a/test/simple_pre2_fail.c b/test/simple_pre2_fail.c index 05597a96b..e428e1182 100644 --- a/test/simple_pre2_fail.c +++ b/test/simple_pre2_fail.c @@ -11,7 +11,7 @@ int main(void) { a = 1; a = incr(a); - __SMACK_assert(a == 1); + assert(a == 1); return a; } diff --git a/test/simple_pre3.c b/test/simple_pre3.c index 563a9916c..56be14006 100644 --- a/test/simple_pre3.c +++ b/test/simple_pre3.c @@ -11,7 +11,7 @@ int main(void) { a = -1; a = returnOne(); - __SMACK_assert(a == 1 || a == 2); + assert(a == 1 || a == 2); return a; } diff --git a/test/simple_pre3_fail.c b/test/simple_pre3_fail.c index c422fab81..44934c260 100644 --- a/test/simple_pre3_fail.c +++ b/test/simple_pre3_fail.c @@ -11,7 +11,7 @@ int main(void) { a = -1; a = returnOne(); - __SMACK_assert(a == -1 || a == 2); + assert(a == -1 || a == 2); return a; } diff --git a/test/simple_pre_fail.c b/test/simple_pre_fail.c index 69fc05d1c..9d0846712 100644 --- a/test/simple_pre_fail.c +++ b/test/simple_pre_fail.c @@ -11,7 +11,7 @@ int main(void) { a = -1; a = returnOne(); - __SMACK_assert(a == -1); + assert(a == -1); return a; } diff --git a/test/smack_code_call.c b/test/smack_code_call.c index 149747d59..a82b514ef 100644 --- a/test/smack_code_call.c +++ b/test/smack_code_call.c @@ -13,10 +13,10 @@ int main(void) { // using a dummy unreachable call, force DSA to analyze foo so // that __SMACK_code works properly - __SMACK_assume(tmp == 0); + assume(tmp == 0); if (tmp) foo(y); __SMACK_code("call foo(@);",y); - __SMACK_assert(*y == 20); + assert(*y == 20); } diff --git a/test/smack_code_call_fail.c b/test/smack_code_call_fail.c index 4ff890217..9c535e879 100644 --- a/test/smack_code_call_fail.c +++ b/test/smack_code_call_fail.c @@ -13,10 +13,10 @@ int main(void) { // using a dummy unreachable call, force DSA to analyze foo so // that __SMACK_code works properly - __SMACK_assume(tmp == 0); + assume(tmp == 0); if (tmp) foo(y); __SMACK_code("call foo(@);",y); - __SMACK_assert(*y == 10); + assert(*y == 10); } diff --git a/test/struct_assign.c b/test/struct_assign.c index f4f1fc8c6..927ae9ab6 100644 --- a/test/struct_assign.c +++ b/test/struct_assign.c @@ -7,7 +7,7 @@ struct a { int main(void) { struct a x = {10, 20}; - __SMACK_assert(x.j == 20); + assert(x.j == 20); return 0; } diff --git a/test/struct_assign_fail.c b/test/struct_assign_fail.c index 31c7b6af3..8609470b7 100644 --- a/test/struct_assign_fail.c +++ b/test/struct_assign_fail.c @@ -7,7 +7,7 @@ struct a { int main(void) { struct a x = {10, 20}; - __SMACK_assert(x.j == 10); + assert(x.j == 10); return 0; } diff --git a/test/struct_cast.c b/test/struct_cast.c index b1fda0afc..f38836e02 100644 --- a/test/struct_cast.c +++ b/test/struct_cast.c @@ -18,7 +18,7 @@ int main(void) { s1.a = 3; p2->x = 4; - __SMACK_assert(s1.a == 4); + assert(s1.a == 4); return 0; } diff --git a/test/struct_cast1.c b/test/struct_cast1.c index edfb21164..18d211fc1 100644 --- a/test/struct_cast1.c +++ b/test/struct_cast1.c @@ -19,7 +19,7 @@ int main(void) { s2->b = 5; s1->x = 4; - __SMACK_assert(s2->a == 4); + assert(s2->a == 4); return 0; } diff --git a/test/struct_cast1_fail.c b/test/struct_cast1_fail.c index 3bfe1e06d..3a0c4b391 100644 --- a/test/struct_cast1_fail.c +++ b/test/struct_cast1_fail.c @@ -19,7 +19,7 @@ int main(void) { s2->b = 5; s1->x = 4; - __SMACK_assert(s2->a == 3); + assert(s2->a == 3); return 0; } diff --git a/test/struct_cast_fail.c b/test/struct_cast_fail.c index 60e84c975..111696830 100644 --- a/test/struct_cast_fail.c +++ b/test/struct_cast_fail.c @@ -18,7 +18,7 @@ int main(void) { s1.a = 3; p2->x = 4; - __SMACK_assert(s1.a == 3); + assert(s1.a == 3); return 0; } diff --git a/test/struct_init.c b/test/struct_init.c index 898baebf4..53bda4cdf 100644 --- a/test/struct_init.c +++ b/test/struct_init.c @@ -7,7 +7,7 @@ struct a { int main(void) { struct a x = {0,0}; - __SMACK_assert(x.i == 0 && x.j == 0); + assert(x.i == 0 && x.j == 0); return 0; } diff --git a/test/struct_init_fail.c b/test/struct_init_fail.c index 5120a9a00..4c486eae4 100644 --- a/test/struct_init_fail.c +++ b/test/struct_init_fail.c @@ -7,7 +7,7 @@ struct a { int main(void) { struct a x = {0,0}; - __SMACK_assert(x.j == 1); + assert(x.j == 1); return 0; } diff --git a/test/struct_return.c b/test/struct_return.c index 7474c1c47..91400c308 100644 --- a/test/struct_return.c +++ b/test/struct_return.c @@ -15,7 +15,7 @@ struct a foo(struct a bar) { int main(void) { struct a x; x = foo(x); - __SMACK_assert(x.j == 20); + assert(x.j == 20); return 0; } diff --git a/test/two_arrays.c b/test/two_arrays.c index 6d332e601..afa364889 100644 --- a/test/two_arrays.c +++ b/test/two_arrays.c @@ -31,16 +31,16 @@ int main() { setArray(arrayTwo); for (i = 0; i < MAXSIZE; i++) { - __SMACK_assert(arrayOne[i] == RESET); - __SMACK_assert(arrayTwo[i] == SET); + assert(arrayOne[i] == RESET); + assert(arrayTwo[i] == SET); } setArray(arrayOne); resetArray(arrayTwo); for (i = 0; i < MAXSIZE; i++) { - __SMACK_assert(arrayOne[i] == SET); - __SMACK_assert(arrayTwo[i] == RESET); + assert(arrayOne[i] == SET); + assert(arrayTwo[i] == RESET); } free(arrayOne); diff --git a/test/two_arrays1.c b/test/two_arrays1.c index 055863bd6..c144696df 100644 --- a/test/two_arrays1.c +++ b/test/two_arrays1.c @@ -46,9 +46,9 @@ int main() { initializeCount(arrayTwo); for (i = 0; i < MAXSIZE; i++) { - __SMACK_assert(arrayOne[i].status == RESET); - __SMACK_assert(arrayTwo[i].status == SET); - __SMACK_assert(arrayTwo[i].count == 0); + assert(arrayOne[i].status == RESET); + assert(arrayTwo[i].status == SET); + assert(arrayTwo[i].count == 0); } initializeCount(arrayOne); @@ -56,9 +56,9 @@ int main() { resetArray(arrayTwo); for (i = 0; i < MAXSIZE; i++) { - __SMACK_assert(arrayOne[i].count == 0); - __SMACK_assert(arrayOne[i].status == SET); - __SMACK_assert(arrayTwo[i].status == RESET); + assert(arrayOne[i].count == 0); + assert(arrayOne[i].status == SET); + assert(arrayTwo[i].status == RESET); } free(arrayOne); diff --git a/test/two_arrays2.c b/test/two_arrays2.c index d16eac761..02fbaa147 100644 --- a/test/two_arrays2.c +++ b/test/two_arrays2.c @@ -41,7 +41,7 @@ int main() { int i = 0; arraySize = __SMACK_nondet(); - __SMACK_assume(arraySize > 0); + assume(arraySize > 0); elem *arrayOne = (elem*)malloc(arraySize * sizeof(elem)); elem *arrayTwo = (elem*)malloc(arraySize * sizeof(elem)); @@ -51,9 +51,9 @@ int main() { initializeCount(arrayTwo); for (i = 0; i < arraySize; i++) { - __SMACK_assert(arrayOne[i].status == RESET); - __SMACK_assert(arrayTwo[i].status == SET); - __SMACK_assert(arrayTwo[i].count == 0); + assert(arrayOne[i].status == RESET); + assert(arrayTwo[i].status == SET); + assert(arrayTwo[i].count == 0); } initializeCount(arrayOne); @@ -61,9 +61,9 @@ int main() { resetArray(arrayTwo); for (i = 0; i < arraySize; i++) { - __SMACK_assert(arrayOne[i].count == 0); - __SMACK_assert(arrayOne[i].status == SET); - __SMACK_assert(arrayTwo[i].status == RESET); + assert(arrayOne[i].count == 0); + assert(arrayOne[i].status == SET); + assert(arrayTwo[i].status == RESET); } free(arrayOne); diff --git a/test/two_arrays3.c b/test/two_arrays3.c index d16eac761..02fbaa147 100644 --- a/test/two_arrays3.c +++ b/test/two_arrays3.c @@ -41,7 +41,7 @@ int main() { int i = 0; arraySize = __SMACK_nondet(); - __SMACK_assume(arraySize > 0); + assume(arraySize > 0); elem *arrayOne = (elem*)malloc(arraySize * sizeof(elem)); elem *arrayTwo = (elem*)malloc(arraySize * sizeof(elem)); @@ -51,9 +51,9 @@ int main() { initializeCount(arrayTwo); for (i = 0; i < arraySize; i++) { - __SMACK_assert(arrayOne[i].status == RESET); - __SMACK_assert(arrayTwo[i].status == SET); - __SMACK_assert(arrayTwo[i].count == 0); + assert(arrayOne[i].status == RESET); + assert(arrayTwo[i].status == SET); + assert(arrayTwo[i].count == 0); } initializeCount(arrayOne); @@ -61,9 +61,9 @@ int main() { resetArray(arrayTwo); for (i = 0; i < arraySize; i++) { - __SMACK_assert(arrayOne[i].count == 0); - __SMACK_assert(arrayOne[i].status == SET); - __SMACK_assert(arrayTwo[i].status == RESET); + assert(arrayOne[i].count == 0); + assert(arrayOne[i].status == SET); + assert(arrayTwo[i].status == RESET); } free(arrayOne); diff --git a/test/two_arrays4.c b/test/two_arrays4.c index d16eac761..02fbaa147 100644 --- a/test/two_arrays4.c +++ b/test/two_arrays4.c @@ -41,7 +41,7 @@ int main() { int i = 0; arraySize = __SMACK_nondet(); - __SMACK_assume(arraySize > 0); + assume(arraySize > 0); elem *arrayOne = (elem*)malloc(arraySize * sizeof(elem)); elem *arrayTwo = (elem*)malloc(arraySize * sizeof(elem)); @@ -51,9 +51,9 @@ int main() { initializeCount(arrayTwo); for (i = 0; i < arraySize; i++) { - __SMACK_assert(arrayOne[i].status == RESET); - __SMACK_assert(arrayTwo[i].status == SET); - __SMACK_assert(arrayTwo[i].count == 0); + assert(arrayOne[i].status == RESET); + assert(arrayTwo[i].status == SET); + assert(arrayTwo[i].count == 0); } initializeCount(arrayOne); @@ -61,9 +61,9 @@ int main() { resetArray(arrayTwo); for (i = 0; i < arraySize; i++) { - __SMACK_assert(arrayOne[i].count == 0); - __SMACK_assert(arrayOne[i].status == SET); - __SMACK_assert(arrayTwo[i].status == RESET); + assert(arrayOne[i].count == 0); + assert(arrayOne[i].status == SET); + assert(arrayTwo[i].status == RESET); } free(arrayOne); diff --git a/test/two_arrays5.c b/test/two_arrays5.c index f93999c6f..e11a1d48f 100644 --- a/test/two_arrays5.c +++ b/test/two_arrays5.c @@ -39,7 +39,7 @@ void initializeCount(elem *array) { int main() { arraySize = __SMACK_nondet(); - __SMACK_assume(arraySize > 0); + assume(arraySize > 0); elem *arrayOne = (elem*)malloc(arraySize * sizeof(elem)); elem *arrayTwo = (elem*)malloc(arraySize * sizeof(elem)); diff --git a/test/two_arrays6.c b/test/two_arrays6.c index 5303ee4c2..f24a70599 100644 --- a/test/two_arrays6.c +++ b/test/two_arrays6.c @@ -43,7 +43,7 @@ int main() { elem *arrayTwo; arraySize = __SMACK_nondet(); - __SMACK_assume(arraySize > 0); + assume(arraySize > 0); arrayOne = (elem*)malloc(arraySize * sizeof(elem)); arrayTwo = (elem*)malloc(arraySize * sizeof(elem)); @@ -53,9 +53,9 @@ int main() { initializeCount(arrayTwo); for (i = 0; i < arraySize; i++) { - __SMACK_assert(arrayOne[i].status == RESET); - __SMACK_assert(arrayTwo[i].status == SET); - __SMACK_assert(arrayTwo[i].count == 0); + assert(arrayOne[i].status == RESET); + assert(arrayTwo[i].status == SET); + assert(arrayTwo[i].count == 0); } initializeCount(arrayOne); @@ -63,9 +63,9 @@ int main() { resetArray(arrayTwo); for (i = arraySize - 1; i >= 0; i--) { - __SMACK_assert(arrayOne[i].count == 0); - __SMACK_assert(arrayOne[i].status == SET); - __SMACK_assert(arrayTwo[i].status == RESET); + assert(arrayOne[i].count == 0); + assert(arrayOne[i].status == SET); + assert(arrayTwo[i].status == RESET); } free(arrayOne); diff --git a/test/two_arrays6_fail.c b/test/two_arrays6_fail.c index 00de37dba..63f39ef52 100644 --- a/test/two_arrays6_fail.c +++ b/test/two_arrays6_fail.c @@ -43,7 +43,7 @@ int main() { elem *arrayTwo; arraySize = __SMACK_nondet(); - __SMACK_assume(arraySize > 0); + assume(arraySize > 0); arrayOne = (elem*)malloc(arraySize * sizeof(elem)); arrayTwo = (elem*)malloc(arraySize * sizeof(elem)); @@ -53,9 +53,9 @@ int main() { initializeCount(arrayTwo); for (i = 0; i < arraySize; i++) { - __SMACK_assert(arrayOne[i].status == RESET); - __SMACK_assert(arrayTwo[i].status == SET); - __SMACK_assert(arrayTwo[i].count == 0); + assert(arrayOne[i].status == RESET); + assert(arrayTwo[i].status == SET); + assert(arrayTwo[i].count == 0); } initializeCount(arrayOne); @@ -63,7 +63,7 @@ int main() { resetArray(arrayTwo); for (i = arraySize - 1; i >= 0; i--) { - __SMACK_assert(arrayOne[i].count != 0 || arrayOne[i].status != SET || arrayTwo[i].status != RESET); + assert(arrayOne[i].count != 0 || arrayOne[i].status != SET || arrayTwo[i].status != RESET); } free(arrayOne); From d92f1cee07c5c709d8ee863de9d6c711f7305fb7 Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Sat, 4 Oct 2014 13:11:57 -0600 Subject: [PATCH 080/140] Removed dllimport attribute from one of the svcomp benchmarks that was causing problems compiling it on cygwin with clang. --- .../svcomp/ntdrivers/floppy2_true.i.cil.c | 238 +++++++++--------- 1 file changed, 119 insertions(+), 119 deletions(-) diff --git a/examples/svcomp/ntdrivers/floppy2_true.i.cil.c b/examples/svcomp/ntdrivers/floppy2_true.i.cil.c index 13abd6784..a096ac36b 100644 --- a/examples/svcomp/ntdrivers/floppy2_true.i.cil.c +++ b/examples/svcomp/ntdrivers/floppy2_true.i.cil.c @@ -2431,32 +2431,32 @@ extern PKTHREAD ( __attribute__((__stdcall__)) KeGetCurrentThread)() ; #line 28 "C:/NTDDK/inc/poppack.h" #pragma warning(disable:4103) #line 1136 "C:/NTDDK/inc/ddk/ntddk.h" - __attribute__((__dllimport__)) NTSTATUS ( __attribute__((__stdcall__)) RtlQueryRegistryValues)(ULONG RelativeTo , +NTSTATUS ( __attribute__((__stdcall__)) RtlQueryRegistryValues)(ULONG RelativeTo , PCWSTR Path , PRTL_QUERY_REGISTRY_TABLE QueryTable , PVOID Context , PVOID Environment ) ; #line 1159 - __attribute__((__dllimport__)) NTSTATUS ( __attribute__((__stdcall__)) RtlDeleteRegistryValue)(ULONG RelativeTo , +NTSTATUS ( __attribute__((__stdcall__)) RtlDeleteRegistryValue)(ULONG RelativeTo , PCWSTR Path , PCWSTR ValueName ) ; #line 1264 - __attribute__((__dllimport__)) void ( __attribute__((__stdcall__)) RtlInitString)(PSTRING DestinationString , +void ( __attribute__((__stdcall__)) RtlInitString)(PSTRING DestinationString , PCSZ SourceString ) ; #line 1280 - __attribute__((__dllimport__)) void ( __attribute__((__stdcall__)) RtlInitUnicodeString)(PUNICODE_STRING DestinationString , +void ( __attribute__((__stdcall__)) RtlInitUnicodeString)(PUNICODE_STRING DestinationString , PCWSTR SourceString ) ; #line 1335 - __attribute__((__dllimport__)) NTSTATUS ( __attribute__((__stdcall__)) RtlAnsiStringToUnicodeString)(PUNICODE_STRING DestinationString , +NTSTATUS ( __attribute__((__stdcall__)) RtlAnsiStringToUnicodeString)(PUNICODE_STRING DestinationString , PANSI_STRING SourceString , BOOLEAN AllocateDestinationString ) ; #line 1394 - __attribute__((__dllimport__)) void ( __attribute__((__stdcall__)) RtlCopyUnicodeString)(PUNICODE_STRING DestinationString , +void ( __attribute__((__stdcall__)) RtlCopyUnicodeString)(PUNICODE_STRING DestinationString , PUNICODE_STRING SourceString ) ; #line 1429 - __attribute__((__dllimport__)) void ( __attribute__((__stdcall__)) RtlFreeUnicodeString)(PUNICODE_STRING UnicodeString ) ; +void ( __attribute__((__stdcall__)) RtlFreeUnicodeString)(PUNICODE_STRING UnicodeString ) ; #line 1516 - __attribute__((__dllimport__)) SIZE_T ( __attribute__((__stdcall__)) RtlCompareMemory)(void const *Source1 , +SIZE_T ( __attribute__((__stdcall__)) RtlCompareMemory)(void const *Source1 , void const *Source2 , SIZE_T Length ) ; #line 1718 "C:/NTDDK/inc/ddk/ntddk.h" @@ -2674,7 +2674,7 @@ __inline LUID ( __attribute__((__stdcall__)) RtlConvertUlongToLuid)(ULONG Ulong } } #line 5211 -extern __attribute__((__dllimport__)) LONG ( __attribute__((__fastcall__)) InterlockedExchange)(PLONG Target , +extern LONG ( __attribute__((__fastcall__)) InterlockedExchange)(PLONG Target , LONG Value ) ; #line 5253 #pragma warning(disable:4035) @@ -2706,62 +2706,62 @@ __inline ULONG KeGetCurrentProcessorNumber(void) #line 28 "C:/NTDDK/inc/poppack.h" #pragma warning(disable:4103) #line 9415 "C:/NTDDK/inc/ddk/ntddk.h" - __attribute__((__dllimport__)) void KeInitializeEvent(PRKEVENT Event , EVENT_TYPE Type , +void KeInitializeEvent(PRKEVENT Event , EVENT_TYPE Type , BOOLEAN State ) ; #line 9451 - __attribute__((__dllimport__)) LONG KeSetEvent(PRKEVENT Event , KPRIORITY Increment , +LONG KeSetEvent(PRKEVENT Event , KPRIORITY Increment , BOOLEAN Wait ) ; #line 9483 - __attribute__((__dllimport__)) void KeInitializeSemaphore(PRKSEMAPHORE Semaphore , +void KeInitializeSemaphore(PRKSEMAPHORE Semaphore , LONG Count , LONG Limit ) ; #line 9497 - __attribute__((__dllimport__)) LONG KeReleaseSemaphore(PRKSEMAPHORE Semaphore , KPRIORITY Increment , +LONG KeReleaseSemaphore(PRKSEMAPHORE Semaphore , KPRIORITY Increment , LONG Adjustment , BOOLEAN Wait ) ; #line 9506 - __attribute__((__dllimport__)) NTSTATUS KeDelayExecutionThread(KPROCESSOR_MODE WaitMode , +NTSTATUS KeDelayExecutionThread(KPROCESSOR_MODE WaitMode , BOOLEAN Alertable , PLARGE_INTEGER Interval ) ; #line 9527 -extern __attribute__((__dllimport__)) KPRIORITY KeSetPriorityThread(PKTHREAD Thread , +extern KPRIORITY KeSetPriorityThread(PKTHREAD Thread , KPRIORITY Priority ) ; #line 9681 - __attribute__((__dllimport__)) NTSTATUS KeWaitForSingleObject(PVOID Object , KWAIT_REASON WaitReason , +NTSTATUS KeWaitForSingleObject(PVOID Object , KWAIT_REASON WaitReason , KPROCESSOR_MODE WaitMode , BOOLEAN Alertable , PLARGE_INTEGER Timeout ) ; #line 9711 - __attribute__((__dllimport__)) void ( __attribute__((__stdcall__)) KeInitializeSpinLock)(PKSPIN_LOCK SpinLock ) ; +void ( __attribute__((__stdcall__)) KeInitializeSpinLock)(PKSPIN_LOCK SpinLock ) ; #line 9737 -extern __attribute__((__dllimport__)) KIRQL ( __attribute__((__fastcall__)) KfAcquireSpinLock)(PKSPIN_LOCK SpinLock ) ; +extern KIRQL ( __attribute__((__fastcall__)) KfAcquireSpinLock)(PKSPIN_LOCK SpinLock ) ; #line 9744 - __attribute__((__dllimport__)) void ( __attribute__((__fastcall__)) KfReleaseSpinLock)(PKSPIN_LOCK SpinLock , +void ( __attribute__((__fastcall__)) KfReleaseSpinLock)(PKSPIN_LOCK SpinLock , KIRQL NewIrql ) ; #line 10159 - __attribute__((__dllimport__)) PVOID ( __attribute__((__stdcall__)) ExAllocatePoolWithTag)(POOL_TYPE PoolType , +PVOID ( __attribute__((__stdcall__)) ExAllocatePoolWithTag)(POOL_TYPE PoolType , SIZE_T NumberOfBytes , ULONG Tag ) ; #line 10236 - __attribute__((__dllimport__)) void ( __attribute__((__stdcall__)) ExFreePool)(PVOID P ) ; +void ( __attribute__((__stdcall__)) ExFreePool)(PVOID P ) ; #line 10315 - __attribute__((__dllimport__)) void ( __attribute__((__fastcall__)) ExAcquireFastMutex)(PFAST_MUTEX FastMutex ) ; +void ( __attribute__((__fastcall__)) ExAcquireFastMutex)(PFAST_MUTEX FastMutex ) ; #line 10322 - __attribute__((__dllimport__)) void ( __attribute__((__fastcall__)) ExReleaseFastMutex)(PFAST_MUTEX FastMutex ) ; +void ( __attribute__((__fastcall__)) ExReleaseFastMutex)(PFAST_MUTEX FastMutex ) ; #line 10406 - __attribute__((__dllimport__)) PLIST_ENTRY ( __attribute__((__fastcall__)) ExfInterlockedInsertHeadList)(PLIST_ENTRY ListHead , +PLIST_ENTRY ( __attribute__((__fastcall__)) ExfInterlockedInsertHeadList)(PLIST_ENTRY ListHead , PLIST_ENTRY ListEntry , PKSPIN_LOCK Lock ) ; #line 10415 - __attribute__((__dllimport__)) PLIST_ENTRY ( __attribute__((__fastcall__)) ExfInterlockedInsertTailList)(PLIST_ENTRY ListHead , +PLIST_ENTRY ( __attribute__((__fastcall__)) ExfInterlockedInsertTailList)(PLIST_ENTRY ListHead , PLIST_ENTRY ListEntry , PKSPIN_LOCK Lock ) ; #line 10424 - __attribute__((__dllimport__)) PLIST_ENTRY ( __attribute__((__fastcall__)) ExfInterlockedRemoveHeadList)(PLIST_ENTRY ListHead , +PLIST_ENTRY ( __attribute__((__fastcall__)) ExfInterlockedRemoveHeadList)(PLIST_ENTRY ListHead , PKSPIN_LOCK Lock ) ; #line 10547 -extern __attribute__((__dllimport__)) PSINGLE_LIST_ENTRY ( __attribute__((__fastcall__)) ExInterlockedPopEntrySList)(PSLIST_HEADER ListHead , +extern PSINGLE_LIST_ENTRY ( __attribute__((__fastcall__)) ExInterlockedPopEntrySList)(PSLIST_HEADER ListHead , PKSPIN_LOCK Lock ) ; #line 10555 -extern __attribute__((__dllimport__)) PSINGLE_LIST_ENTRY ( __attribute__((__fastcall__)) ExInterlockedPushEntrySList)(PSLIST_HEADER ListHead , +extern PSINGLE_LIST_ENTRY ( __attribute__((__fastcall__)) ExInterlockedPushEntrySList)(PSLIST_HEADER ListHead , PSINGLE_LIST_ENTRY ListEntry , PKSPIN_LOCK Lock ) ; #line 10643 "C:/NTDDK/inc/ddk/ntddk.h" @@ -3083,29 +3083,29 @@ __inline void ExFreeToNPagedLookasideList(PNPAGED_LOOKASIDE_LIST Lookaside , PVO } } #line 11906 -extern __attribute__((__dllimport__)) void MmProbeAndLockPages(PMDL MemoryDescriptorList , +extern void MmProbeAndLockPages(PMDL MemoryDescriptorList , KPROCESSOR_MODE AccessMode , LOCK_OPERATION Operation ) ; #line 11915 - __attribute__((__dllimport__)) void MmUnlockPages(PMDL MemoryDescriptorList ) ; +void MmUnlockPages(PMDL MemoryDescriptorList ) ; #line 11979 - __attribute__((__dllimport__)) PVOID MmMapLockedPagesSpecifyCache(PMDL MemoryDescriptorList , +PVOID MmMapLockedPagesSpecifyCache(PMDL MemoryDescriptorList , KPROCESSOR_MODE AccessMode , MEMORY_CACHING_TYPE CacheType , PVOID BaseAddress , ULONG BugCheckOnFailure , MM_PAGE_PRIORITY Priority ) ; #line 12084 - __attribute__((__dllimport__)) PVOID MmAllocateContiguousMemory(SIZE_T NumberOfBytes , +PVOID MmAllocateContiguousMemory(SIZE_T NumberOfBytes , PHYSICAL_ADDRESS HighestAcceptableAddress ) ; #line 12101 - __attribute__((__dllimport__)) void MmFreeContiguousMemory(PVOID BaseAddress ) ; +void MmFreeContiguousMemory(PVOID BaseAddress ) ; #line 12172 - __attribute__((__dllimport__)) void MmResetDriverPaging(PVOID AddressWithinSection ) ; +void MmResetDriverPaging(PVOID AddressWithinSection ) ; #line 12179 - __attribute__((__dllimport__)) PVOID MmPageEntireDriver(PVOID AddressWithinSection ) ; +PVOID MmPageEntireDriver(PVOID AddressWithinSection ) ; #line 12552 - __attribute__((__dllimport__)) NTSTATUS PsCreateSystemThread(PHANDLE ThreadHandle , +NTSTATUS PsCreateSystemThread(PHANDLE ThreadHandle , ULONG DesiredAccess , POBJECT_ATTRIBUTES ObjectAttributes , HANDLE ProcessHandle , @@ -3113,27 +3113,27 @@ extern __attribute__((__dllimport__)) void MmProbeAndLockPages(PMDL MemoryDescr void (*StartRoutine)(PVOID StartContext ) , PVOID StartContext ) ; #line 12564 - __attribute__((__dllimport__)) NTSTATUS PsTerminateSystemThread(NTSTATUS ExitStatus ) ; +NTSTATUS PsTerminateSystemThread(NTSTATUS ExitStatus ) ; #line 25 "C:/NTDDK/inc/pshpack4.h" #pragma warning(disable:4103) #line 28 "C:/NTDDK/inc/poppack.h" #pragma warning(disable:4103) #line 14734 "C:/NTDDK/inc/ddk/ntddk.h" - __attribute__((__dllimport__)) PMDL IoAllocateMdl(PVOID VirtualAddress , ULONG Length , +PMDL IoAllocateMdl(PVOID VirtualAddress , ULONG Length , BOOLEAN SecondaryBuffer , BOOLEAN ChargeQuota , PIRP Irp ) ; #line 14807 - __attribute__((__dllimport__)) PDEVICE_OBJECT IoAttachDeviceToDeviceStack(PDEVICE_OBJECT SourceDevice , +PDEVICE_OBJECT IoAttachDeviceToDeviceStack(PDEVICE_OBJECT SourceDevice , PDEVICE_OBJECT TargetDevice ) ; #line 14814 - __attribute__((__dllimport__)) PIRP IoBuildAsynchronousFsdRequest(ULONG MajorFunction , +PIRP IoBuildAsynchronousFsdRequest(ULONG MajorFunction , PDEVICE_OBJECT DeviceObject , PVOID Buffer , ULONG Length , PLARGE_INTEGER StartingOffset , PIO_STATUS_BLOCK IoStatusBlock ) ; #line 14825 - __attribute__((__dllimport__)) PIRP IoBuildDeviceIoControlRequest(ULONG IoControlCode , +PIRP IoBuildDeviceIoControlRequest(ULONG IoControlCode , PDEVICE_OBJECT DeviceObject , PVOID InputBuffer , ULONG InputBufferLength , @@ -3143,34 +3143,34 @@ extern __attribute__((__dllimport__)) void MmProbeAndLockPages(PMDL MemoryDescr PKEVENT Event , PIO_STATUS_BLOCK IoStatusBlock ) ; #line 14875 - __attribute__((__dllimport__)) NTSTATUS ( __attribute__((__fastcall__)) IofCallDriver)(PDEVICE_OBJECT DeviceObject , +NTSTATUS ( __attribute__((__fastcall__)) IofCallDriver)(PDEVICE_OBJECT DeviceObject , PIRP Irp ) ; #line 14903 - __attribute__((__dllimport__)) void ( __attribute__((__fastcall__)) IofCompleteRequest)(PIRP Irp , +void ( __attribute__((__fastcall__)) IofCompleteRequest)(PIRP Irp , CCHAR PriorityBoost ) ; #line 14942 - __attribute__((__dllimport__)) NTSTATUS IoCreateDevice(PDRIVER_OBJECT DriverObject , +NTSTATUS IoCreateDevice(PDRIVER_OBJECT DriverObject , ULONG DeviceExtensionSize , PUNICODE_STRING DeviceName , ULONG DeviceType , ULONG DeviceCharacteristics , BOOLEAN Exclusive , PDEVICE_OBJECT *DeviceObject ) ; #line 14993 - __attribute__((__dllimport__)) NTSTATUS IoCreateSymbolicLink(PUNICODE_STRING SymbolicLinkName , +NTSTATUS IoCreateSymbolicLink(PUNICODE_STRING SymbolicLinkName , PUNICODE_STRING DeviceName ) ; #line 15057 - __attribute__((__dllimport__)) void IoDeleteDevice(PDEVICE_OBJECT DeviceObject ) ; +void IoDeleteDevice(PDEVICE_OBJECT DeviceObject ) ; #line 15063 - __attribute__((__dllimport__)) NTSTATUS IoDeleteSymbolicLink(PUNICODE_STRING SymbolicLinkName ) ; +NTSTATUS IoDeleteSymbolicLink(PUNICODE_STRING SymbolicLinkName ) ; #line 15069 - __attribute__((__dllimport__)) void IoDetachDevice(PDEVICE_OBJECT TargetDevice ) ; +void IoDetachDevice(PDEVICE_OBJECT TargetDevice ) ; #line 15092 - __attribute__((__dllimport__)) void IoFreeIrp(PIRP Irp ) ; +void IoFreeIrp(PIRP Irp ) ; #line 15098 - __attribute__((__dllimport__)) void IoFreeMdl(PMDL Mdl ) ; +void IoFreeMdl(PMDL Mdl ) ; #line 15110 - __attribute__((__dllimport__)) PCONFIGURATION_INFORMATION IoGetConfigurationInformation(void) ; +PCONFIGURATION_INFORMATION IoGetConfigurationInformation(void) ; #line 15234 -extern __attribute__((__dllimport__)) void IoGetStackLimits(PULONG_PTR LowLimit , +extern void IoGetStackLimits(PULONG_PTR LowLimit , PULONG_PTR HighLimit ) ; #line 15246 "C:/NTDDK/inc/ddk/ntddk.h" __inline ULONG_PTR IoGetRemainingStackSize(void) @@ -3198,7 +3198,7 @@ __inline ULONG_PTR IoGetRemainingStackSize(void) } } #line 15426 - __attribute__((__dllimport__)) NTSTATUS IoQueryDeviceDescription(PINTERFACE_TYPE BusType , +NTSTATUS IoQueryDeviceDescription(PINTERFACE_TYPE BusType , PULONG BusNumber , PCONFIGURATION_TYPE ControllerType , PULONG ControllerNumber , @@ -3217,37 +3217,37 @@ __inline ULONG_PTR IoGetRemainingStackSize(void) PKEY_VALUE_FULL_INFORMATION *PeripheralInformation ) , PVOID Context ) ; #line 15492 - __attribute__((__dllimport__)) void IoReleaseCancelSpinLock(KIRQL Irql ) ; +void IoReleaseCancelSpinLock(KIRQL Irql ) ; #line 15641 - __attribute__((__dllimport__)) void IoSetHardErrorOrVerifyDevice(PIRP Irp , PDEVICE_OBJECT DeviceObject ) ; +void IoSetHardErrorOrVerifyDevice(PIRP Irp , PDEVICE_OBJECT DeviceObject ) ; #line 16436 - __attribute__((__dllimport__)) NTSTATUS ( __attribute__((__stdcall__)) IoRegisterDeviceInterface)(PDEVICE_OBJECT PhysicalDeviceObject , +NTSTATUS ( __attribute__((__stdcall__)) IoRegisterDeviceInterface)(PDEVICE_OBJECT PhysicalDeviceObject , GUID const *InterfaceClassGuid , PUNICODE_STRING ReferenceString , PUNICODE_STRING SymbolicLinkName ) ; #line 16456 - __attribute__((__dllimport__)) NTSTATUS IoSetDeviceInterfaceState(PUNICODE_STRING SymbolicLinkName , +NTSTATUS IoSetDeviceInterfaceState(PUNICODE_STRING SymbolicLinkName , BOOLEAN Enable ) ; #line 17779 #pragma warning(disable:4200) #line 17785 #pragma warning(default:4200) #line 18271 - __attribute__((__dllimport__)) NTSTATUS PoCallDriver(PDEVICE_OBJECT DeviceObject , +NTSTATUS PoCallDriver(PDEVICE_OBJECT DeviceObject , PIRP Irp ) ; #line 18278 - __attribute__((__dllimport__)) void PoStartNextPowerIrp(PIRP Irp ) ; +void PoStartNextPowerIrp(PIRP Irp ) ; #line 18326 - __attribute__((__dllimport__)) NTSTATUS ObReferenceObjectByHandle(HANDLE Handle , +NTSTATUS ObReferenceObjectByHandle(HANDLE Handle , ACCESS_MASK DesiredAccess , POBJECT_TYPE ObjectType , KPROCESSOR_MODE AccessMode , PVOID *Object , POBJECT_HANDLE_INFORMATION HandleInformation ) ; #line 18359 - __attribute__((__dllimport__)) void ( __attribute__((__fastcall__)) ObfDereferenceObject)(PVOID Object ) ; +void ( __attribute__((__fastcall__)) ObfDereferenceObject)(PVOID Object ) ; #line 19155 - __attribute__((__dllimport__)) NTSTATUS ( __attribute__((__stdcall__)) ZwClose)(HANDLE Handle ) ; +NTSTATUS ( __attribute__((__stdcall__)) ZwClose)(HANDLE Handle ) ; #line 25 "C:/NTDDK/inc/pshpack1.h" #pragma warning(disable:4103) #line 28 "C:/NTDDK/inc/poppack.h" @@ -29890,7 +29890,7 @@ char *malloc(int i ) } } #line 230 - __attribute__((__dllimport__)) void ( __attribute__((__fastcall__)) ExAcquireFastMutex)(PFAST_MUTEX FastMutex ) ; +void ( __attribute__((__fastcall__)) ExAcquireFastMutex)(PFAST_MUTEX FastMutex ) ; #line 230 "../slam-kernel.c" void ( __attribute__((__fastcall__)) ExAcquireFastMutex)(PFAST_MUTEX FastMutex ) { @@ -29901,7 +29901,7 @@ void ( __attribute__((__fastcall__)) ExAcquireFastMutex)(PFAST_MUTEX FastMutex ) } } #line 240 - __attribute__((__dllimport__)) void ( __attribute__((__fastcall__)) ExReleaseFastMutex)(PFAST_MUTEX FastMutex ) ; +void ( __attribute__((__fastcall__)) ExReleaseFastMutex)(PFAST_MUTEX FastMutex ) ; #line 240 "../slam-kernel.c" void ( __attribute__((__fastcall__)) ExReleaseFastMutex)(PFAST_MUTEX FastMutex ) { @@ -29912,7 +29912,7 @@ void ( __attribute__((__fastcall__)) ExReleaseFastMutex)(PFAST_MUTEX FastMutex ) } } #line 264 - __attribute__((__dllimport__)) PVOID ( __attribute__((__stdcall__)) ExAllocatePoolWithTag)(POOL_TYPE PoolType , +PVOID ( __attribute__((__stdcall__)) ExAllocatePoolWithTag)(POOL_TYPE PoolType , SIZE_T NumberOfBytes , ULONG Tag ) ; #line 264 "../slam-kernel.c" @@ -29936,7 +29936,7 @@ PVOID ( __attribute__((__stdcall__)) ExAllocatePoolWithTag)(POOL_TYPE PoolType , } } #line 279 - __attribute__((__dllimport__)) void ( __attribute__((__stdcall__)) ExFreePool)(PVOID P ) ; +void ( __attribute__((__stdcall__)) ExFreePool)(PVOID P ) ; #line 279 "../slam-kernel.c" void ( __attribute__((__stdcall__)) ExFreePool)(PVOID P ) { @@ -29947,7 +29947,7 @@ void ( __attribute__((__stdcall__)) ExFreePool)(PVOID P ) } } #line 288 - __attribute__((__dllimport__)) PLIST_ENTRY ( __attribute__((__fastcall__)) ExfInterlockedInsertHeadList)(PLIST_ENTRY ListHead , +PLIST_ENTRY ( __attribute__((__fastcall__)) ExfInterlockedInsertHeadList)(PLIST_ENTRY ListHead , PLIST_ENTRY ListEntry , PKSPIN_LOCK Lock ) ; #line 288 "../slam-kernel.c" @@ -29966,7 +29966,7 @@ PLIST_ENTRY ( __attribute__((__fastcall__)) ExfInterlockedInsertHeadList)(PLIST_ } } #line 299 - __attribute__((__dllimport__)) PLIST_ENTRY ( __attribute__((__fastcall__)) ExfInterlockedInsertTailList)(PLIST_ENTRY ListHead , +PLIST_ENTRY ( __attribute__((__fastcall__)) ExfInterlockedInsertTailList)(PLIST_ENTRY ListHead , PLIST_ENTRY ListEntry , PKSPIN_LOCK Lock ) ; #line 299 "../slam-kernel.c" @@ -29985,7 +29985,7 @@ PLIST_ENTRY ( __attribute__((__fastcall__)) ExfInterlockedInsertTailList)(PLIST_ } } #line 311 - __attribute__((__dllimport__)) PLIST_ENTRY ( __attribute__((__fastcall__)) ExfInterlockedRemoveHeadList)(PLIST_ENTRY ListHead , +PLIST_ENTRY ( __attribute__((__fastcall__)) ExfInterlockedRemoveHeadList)(PLIST_ENTRY ListHead , PKSPIN_LOCK Lock ) ; #line 311 "../slam-kernel.c" PLIST_ENTRY ( __attribute__((__fastcall__)) ExfInterlockedRemoveHeadList)(PLIST_ENTRY ListHead , @@ -30002,7 +30002,7 @@ PLIST_ENTRY ( __attribute__((__fastcall__)) ExfInterlockedRemoveHeadList)(PLIST_ } } #line 335 - __attribute__((__dllimport__)) PMDL IoAllocateMdl(PVOID VirtualAddress , ULONG Length , +PMDL IoAllocateMdl(PVOID VirtualAddress , ULONG Length , BOOLEAN SecondaryBuffer , BOOLEAN ChargeQuota , PIRP Irp ) ; #line 335 "../slam-kernel.c" @@ -30051,7 +30051,7 @@ PMDL IoAllocateMdl(PVOID VirtualAddress , ULONG Length , BOOLEAN SecondaryBuffer } } #line 352 - __attribute__((__dllimport__)) PDEVICE_OBJECT IoAttachDeviceToDeviceStack(PDEVICE_OBJECT SourceDevice , +PDEVICE_OBJECT IoAttachDeviceToDeviceStack(PDEVICE_OBJECT SourceDevice , PDEVICE_OBJECT TargetDevice ) ; #line 352 "../slam-kernel.c" PDEVICE_OBJECT IoAttachDeviceToDeviceStack(PDEVICE_OBJECT SourceDevice , PDEVICE_OBJECT TargetDevice ) @@ -30085,7 +30085,7 @@ PDEVICE_OBJECT IoAttachDeviceToDeviceStack(PDEVICE_OBJECT SourceDevice , PDEVICE } } #line 366 - __attribute__((__dllimport__)) PIRP IoBuildAsynchronousFsdRequest(ULONG MajorFunction , +PIRP IoBuildAsynchronousFsdRequest(ULONG MajorFunction , PDEVICE_OBJECT DeviceObject , PVOID Buffer , ULONG Length , @@ -30140,7 +30140,7 @@ PIRP IoBuildAsynchronousFsdRequest(ULONG MajorFunction , PDEVICE_OBJECT DeviceOb } } #line 397 - __attribute__((__dllimport__)) PIRP IoBuildDeviceIoControlRequest(ULONG IoControlCode , +PIRP IoBuildDeviceIoControlRequest(ULONG IoControlCode , PDEVICE_OBJECT DeviceObject , PVOID InputBuffer , ULONG InputBufferLength , @@ -30199,7 +30199,7 @@ PIRP IoBuildDeviceIoControlRequest(ULONG IoControlCode , PDEVICE_OBJECT DeviceOb } } #line 420 - __attribute__((__dllimport__)) NTSTATUS IoCreateDevice(PDRIVER_OBJECT DriverObject , +NTSTATUS IoCreateDevice(PDRIVER_OBJECT DriverObject , ULONG DeviceExtensionSize , PUNICODE_STRING DeviceName , ULONG DeviceType , ULONG DeviceCharacteristics , @@ -30246,7 +30246,7 @@ NTSTATUS IoCreateDevice(PDRIVER_OBJECT DriverObject , ULONG DeviceExtensionSize } } #line 446 - __attribute__((__dllimport__)) NTSTATUS IoCreateSymbolicLink(PUNICODE_STRING SymbolicLinkName , +NTSTATUS IoCreateSymbolicLink(PUNICODE_STRING SymbolicLinkName , PUNICODE_STRING DeviceName ) ; #line 446 "../slam-kernel.c" NTSTATUS IoCreateSymbolicLink(PUNICODE_STRING SymbolicLinkName , PUNICODE_STRING DeviceName ) @@ -30275,7 +30275,7 @@ NTSTATUS IoCreateSymbolicLink(PUNICODE_STRING SymbolicLinkName , PUNICODE_STRING } } #line 460 - __attribute__((__dllimport__)) void IoDeleteDevice(PDEVICE_OBJECT DeviceObject ) ; +void IoDeleteDevice(PDEVICE_OBJECT DeviceObject ) ; #line 460 "../slam-kernel.c" void IoDeleteDevice(PDEVICE_OBJECT DeviceObject ) { @@ -30286,7 +30286,7 @@ void IoDeleteDevice(PDEVICE_OBJECT DeviceObject ) } } #line 469 - __attribute__((__dllimport__)) NTSTATUS IoDeleteSymbolicLink(PUNICODE_STRING SymbolicLinkName ) ; +NTSTATUS IoDeleteSymbolicLink(PUNICODE_STRING SymbolicLinkName ) ; #line 469 "../slam-kernel.c" NTSTATUS IoDeleteSymbolicLink(PUNICODE_STRING SymbolicLinkName ) { int __BLAST_NONDET = __VERIFIER_nondet_int() ; @@ -30314,7 +30314,7 @@ NTSTATUS IoDeleteSymbolicLink(PUNICODE_STRING SymbolicLinkName ) } } #line 482 - __attribute__((__dllimport__)) void IoDetachDevice(PDEVICE_OBJECT TargetDevice ) ; +void IoDetachDevice(PDEVICE_OBJECT TargetDevice ) ; #line 482 "../slam-kernel.c" void IoDetachDevice(PDEVICE_OBJECT TargetDevice ) { @@ -30325,7 +30325,7 @@ void IoDetachDevice(PDEVICE_OBJECT TargetDevice ) } } #line 491 - __attribute__((__dllimport__)) void IoFreeIrp(PIRP Irp ) ; +void IoFreeIrp(PIRP Irp ) ; #line 491 "../slam-kernel.c" void IoFreeIrp(PIRP Irp ) { @@ -30336,7 +30336,7 @@ void IoFreeIrp(PIRP Irp ) } } #line 500 - __attribute__((__dllimport__)) void IoFreeMdl(PMDL Mdl ) ; +void IoFreeMdl(PMDL Mdl ) ; #line 500 "../slam-kernel.c" void IoFreeMdl(PMDL Mdl ) { @@ -30347,7 +30347,7 @@ void IoFreeMdl(PMDL Mdl ) } } #line 509 - __attribute__((__dllimport__)) PCONFIGURATION_INFORMATION IoGetConfigurationInformation(void) ; +PCONFIGURATION_INFORMATION IoGetConfigurationInformation(void) ; #line 509 "../slam-kernel.c" PCONFIGURATION_INFORMATION IoGetConfigurationInformation(void) { char *tmp ; @@ -30370,7 +30370,7 @@ PCONFIGURATION_INFORMATION IoGetConfigurationInformation(void) } } #line 517 - __attribute__((__dllimport__)) NTSTATUS IoQueryDeviceDescription(PINTERFACE_TYPE BusType , +NTSTATUS IoQueryDeviceDescription(PINTERFACE_TYPE BusType , PULONG BusNumber , PCONFIGURATION_TYPE ControllerType , PULONG ControllerNumber , @@ -30428,7 +30428,7 @@ NTSTATUS IoQueryDeviceDescription(PINTERFACE_TYPE BusType , PULONG BusNumber , P } } #line 537 - __attribute__((__dllimport__)) NTSTATUS ( __attribute__((__stdcall__)) IoRegisterDeviceInterface)(PDEVICE_OBJECT PhysicalDeviceObject , +NTSTATUS ( __attribute__((__stdcall__)) IoRegisterDeviceInterface)(PDEVICE_OBJECT PhysicalDeviceObject , GUID const *InterfaceClassGuid , PUNICODE_STRING ReferenceString , PUNICODE_STRING SymbolicLinkName ) ; @@ -30462,7 +30462,7 @@ NTSTATUS ( __attribute__((__stdcall__)) IoRegisterDeviceInterface)(PDEVICE_OBJEC } } #line 554 - __attribute__((__dllimport__)) void IoReleaseCancelSpinLock(KIRQL Irql ) ; +void IoReleaseCancelSpinLock(KIRQL Irql ) ; #line 554 "../slam-kernel.c" void IoReleaseCancelSpinLock(KIRQL Irql ) { @@ -30473,7 +30473,7 @@ void IoReleaseCancelSpinLock(KIRQL Irql ) } } #line 563 - __attribute__((__dllimport__)) NTSTATUS IoSetDeviceInterfaceState(PUNICODE_STRING SymbolicLinkName , +NTSTATUS IoSetDeviceInterfaceState(PUNICODE_STRING SymbolicLinkName , BOOLEAN Enable ) ; #line 563 "../slam-kernel.c" NTSTATUS IoSetDeviceInterfaceState(PUNICODE_STRING SymbolicLinkName , BOOLEAN Enable ) @@ -30502,7 +30502,7 @@ NTSTATUS IoSetDeviceInterfaceState(PUNICODE_STRING SymbolicLinkName , BOOLEAN En } } #line 582 - __attribute__((__dllimport__)) void IoSetHardErrorOrVerifyDevice(PIRP Irp , PDEVICE_OBJECT DeviceObject ) ; +void IoSetHardErrorOrVerifyDevice(PIRP Irp , PDEVICE_OBJECT DeviceObject ) ; #line 582 "../slam-kernel.c" void IoSetHardErrorOrVerifyDevice(PIRP Irp , PDEVICE_OBJECT DeviceObject ) { @@ -30532,7 +30532,7 @@ void stubMoreProcessingRequired(void) } } #line 602 - __attribute__((__dllimport__)) NTSTATUS ( __attribute__((__fastcall__)) IofCallDriver)(PDEVICE_OBJECT DeviceObject , +NTSTATUS ( __attribute__((__fastcall__)) IofCallDriver)(PDEVICE_OBJECT DeviceObject , PIRP Irp ) ; #line 602 "../slam-kernel.c" NTSTATUS ( __attribute__((__fastcall__)) IofCallDriver)(PDEVICE_OBJECT DeviceObject , @@ -30643,7 +30643,7 @@ NTSTATUS ( __attribute__((__fastcall__)) IofCallDriver)(PDEVICE_OBJECT DeviceObj } } #line 665 - __attribute__((__dllimport__)) void ( __attribute__((__fastcall__)) IofCompleteRequest)(PIRP Irp , +void ( __attribute__((__fastcall__)) IofCompleteRequest)(PIRP Irp , CCHAR PriorityBoost ) ; #line 665 "../slam-kernel.c" void ( __attribute__((__fastcall__)) IofCompleteRequest)(PIRP Irp , CCHAR PriorityBoost ) @@ -30665,9 +30665,9 @@ void ( __attribute__((__fastcall__)) IofCompleteRequest)(PIRP Irp , CCHAR Priori } } #line 677 - __attribute__((__dllimport__)) KIRQL KeAcquireSpinLockRaiseToDpc(PKSPIN_LOCK SpinLock ) ; +KIRQL KeAcquireSpinLockRaiseToDpc(PKSPIN_LOCK SpinLock ) ; #line 677 - __attribute__((__dllimport__)) KIRQL KeAcquireSpinLockRaiseToDpc(PKSPIN_LOCK SpinLock ) ; +KIRQL KeAcquireSpinLockRaiseToDpc(PKSPIN_LOCK SpinLock ) ; #line 677 "../slam-kernel.c" KIRQL KeAcquireSpinLockRaiseToDpc(PKSPIN_LOCK SpinLock ) { @@ -30678,7 +30678,7 @@ KIRQL KeAcquireSpinLockRaiseToDpc(PKSPIN_LOCK SpinLock ) } } #line 686 - __attribute__((__dllimport__)) NTSTATUS KeDelayExecutionThread(KPROCESSOR_MODE WaitMode , +NTSTATUS KeDelayExecutionThread(KPROCESSOR_MODE WaitMode , BOOLEAN Alertable , PLARGE_INTEGER Interval ) ; #line 686 "../slam-kernel.c" @@ -30708,7 +30708,7 @@ NTSTATUS KeDelayExecutionThread(KPROCESSOR_MODE WaitMode , BOOLEAN Alertable , P } } #line 706 - __attribute__((__dllimport__)) void KeInitializeEvent(PRKEVENT Event , EVENT_TYPE Type , +void KeInitializeEvent(PRKEVENT Event , EVENT_TYPE Type , BOOLEAN State ) ; #line 706 "../slam-kernel.c" void KeInitializeEvent(PRKEVENT Event , EVENT_TYPE Type , BOOLEAN State ) @@ -30720,7 +30720,7 @@ void KeInitializeEvent(PRKEVENT Event , EVENT_TYPE Type , BOOLEAN State ) } } #line 717 - __attribute__((__dllimport__)) void KeInitializeSemaphore(PRKSEMAPHORE Semaphore , +void KeInitializeSemaphore(PRKSEMAPHORE Semaphore , LONG Count , LONG Limit ) ; #line 717 "../slam-kernel.c" void KeInitializeSemaphore(PRKSEMAPHORE Semaphore , LONG Count , LONG Limit ) @@ -30732,7 +30732,7 @@ void KeInitializeSemaphore(PRKSEMAPHORE Semaphore , LONG Count , LONG Limit ) } } #line 728 - __attribute__((__dllimport__)) void ( __attribute__((__stdcall__)) KeInitializeSpinLock)(PKSPIN_LOCK SpinLock ) ; +void ( __attribute__((__stdcall__)) KeInitializeSpinLock)(PKSPIN_LOCK SpinLock ) ; #line 728 "../slam-kernel.c" void ( __attribute__((__stdcall__)) KeInitializeSpinLock)(PKSPIN_LOCK SpinLock ) { @@ -30743,7 +30743,7 @@ void ( __attribute__((__stdcall__)) KeInitializeSpinLock)(PKSPIN_LOCK SpinLock ) } } #line 738 - __attribute__((__dllimport__)) LONG KeReleaseSemaphore(PRKSEMAPHORE Semaphore , KPRIORITY Increment , +LONG KeReleaseSemaphore(PRKSEMAPHORE Semaphore , KPRIORITY Increment , LONG Adjustment , BOOLEAN Wait ) ; #line 738 "../slam-kernel.c" LONG KeReleaseSemaphore(PRKSEMAPHORE Semaphore , KPRIORITY Increment , LONG Adjustment , @@ -30756,7 +30756,7 @@ LONG KeReleaseSemaphore(PRKSEMAPHORE Semaphore , KPRIORITY Increment , LONG Adju } } #line 751 - __attribute__((__dllimport__)) void ( __attribute__((__fastcall__)) KfReleaseSpinLock)(PKSPIN_LOCK SpinLock , +void ( __attribute__((__fastcall__)) KfReleaseSpinLock)(PKSPIN_LOCK SpinLock , KIRQL NewIrql ) ; #line 751 "../slam-kernel.c" void ( __attribute__((__fastcall__)) KfReleaseSpinLock)(PKSPIN_LOCK SpinLock , KIRQL NewIrql ) @@ -30768,7 +30768,7 @@ void ( __attribute__((__fastcall__)) KfReleaseSpinLock)(PKSPIN_LOCK SpinLock , K } } #line 762 - __attribute__((__dllimport__)) LONG KeSetEvent(PRKEVENT Event , KPRIORITY Increment , +LONG KeSetEvent(PRKEVENT Event , KPRIORITY Increment , BOOLEAN Wait ) ; #line 762 "../slam-kernel.c" LONG KeSetEvent(PRKEVENT Event , KPRIORITY Increment , BOOLEAN Wait ) @@ -30782,7 +30782,7 @@ LONG KeSetEvent(PRKEVENT Event , KPRIORITY Increment , BOOLEAN Wait ) } } #line 777 - __attribute__((__dllimport__)) NTSTATUS KeWaitForSingleObject(PVOID Object , KWAIT_REASON WaitReason , +NTSTATUS KeWaitForSingleObject(PVOID Object , KWAIT_REASON WaitReason , KPROCESSOR_MODE WaitMode , BOOLEAN Alertable , PLARGE_INTEGER Timeout ) ; @@ -30845,7 +30845,7 @@ NTSTATUS KeWaitForSingleObject(PVOID Object , KWAIT_REASON WaitReason , KPROCESS } } #line 810 - __attribute__((__dllimport__)) PVOID MmAllocateContiguousMemory(SIZE_T NumberOfBytes , +PVOID MmAllocateContiguousMemory(SIZE_T NumberOfBytes , PHYSICAL_ADDRESS HighestAcceptableAddress ) ; #line 810 "../slam-kernel.c" PVOID MmAllocateContiguousMemory(SIZE_T NumberOfBytes , PHYSICAL_ADDRESS HighestAcceptableAddress ) @@ -30886,7 +30886,7 @@ PVOID MmAllocateContiguousMemory(SIZE_T NumberOfBytes , PHYSICAL_ADDRESS Highest } } #line 823 - __attribute__((__dllimport__)) void MmFreeContiguousMemory(PVOID BaseAddress ) ; +void MmFreeContiguousMemory(PVOID BaseAddress ) ; #line 823 "../slam-kernel.c" void MmFreeContiguousMemory(PVOID BaseAddress ) { @@ -30897,7 +30897,7 @@ void MmFreeContiguousMemory(PVOID BaseAddress ) } } #line 832 - __attribute__((__dllimport__)) PVOID MmMapLockedPagesSpecifyCache(PMDL MemoryDescriptorList , +PVOID MmMapLockedPagesSpecifyCache(PMDL MemoryDescriptorList , KPROCESSOR_MODE AccessMode , MEMORY_CACHING_TYPE CacheType , PVOID BaseAddress , @@ -30915,7 +30915,7 @@ PVOID MmMapLockedPagesSpecifyCache(PMDL MemoryDescriptorList , KPROCESSOR_MODE A } } #line 846 - __attribute__((__dllimport__)) PVOID MmPageEntireDriver(PVOID AddressWithinSection ) ; +PVOID MmPageEntireDriver(PVOID AddressWithinSection ) ; #line 846 "../slam-kernel.c" PVOID MmPageEntireDriver(PVOID AddressWithinSection ) { @@ -30926,7 +30926,7 @@ PVOID MmPageEntireDriver(PVOID AddressWithinSection ) } } #line 855 - __attribute__((__dllimport__)) void MmResetDriverPaging(PVOID AddressWithinSection ) ; +void MmResetDriverPaging(PVOID AddressWithinSection ) ; #line 855 "../slam-kernel.c" void MmResetDriverPaging(PVOID AddressWithinSection ) { @@ -30937,7 +30937,7 @@ void MmResetDriverPaging(PVOID AddressWithinSection ) } } #line 865 - __attribute__((__dllimport__)) void MmUnlockPages(PMDL MemoryDescriptorList ) ; +void MmUnlockPages(PMDL MemoryDescriptorList ) ; #line 865 "../slam-kernel.c" void MmUnlockPages(PMDL MemoryDescriptorList ) { @@ -30948,7 +30948,7 @@ void MmUnlockPages(PMDL MemoryDescriptorList ) } } #line 874 - __attribute__((__dllimport__)) NTSTATUS ObReferenceObjectByHandle(HANDLE Handle , +NTSTATUS ObReferenceObjectByHandle(HANDLE Handle , ACCESS_MASK DesiredAccess , POBJECT_TYPE ObjectType , KPROCESSOR_MODE AccessMode , @@ -30982,7 +30982,7 @@ NTSTATUS ObReferenceObjectByHandle(HANDLE Handle , ACCESS_MASK DesiredAccess , P } } #line 899 - __attribute__((__dllimport__)) void ( __attribute__((__fastcall__)) ObfDereferenceObject)(PVOID Object ) ; +void ( __attribute__((__fastcall__)) ObfDereferenceObject)(PVOID Object ) ; #line 899 "../slam-kernel.c" void ( __attribute__((__fastcall__)) ObfDereferenceObject)(PVOID Object ) { @@ -30993,7 +30993,7 @@ void ( __attribute__((__fastcall__)) ObfDereferenceObject)(PVOID Object ) } } #line 909 - __attribute__((__dllimport__)) NTSTATUS PoCallDriver(PDEVICE_OBJECT DeviceObject , +NTSTATUS PoCallDriver(PDEVICE_OBJECT DeviceObject , PIRP Irp ) ; #line 909 "../slam-kernel.c" NTSTATUS PoCallDriver(PDEVICE_OBJECT DeviceObject , PIRP Irp ) @@ -31100,7 +31100,7 @@ NTSTATUS PoCallDriver(PDEVICE_OBJECT DeviceObject , PIRP Irp ) } } #line 956 - __attribute__((__dllimport__)) void PoStartNextPowerIrp(PIRP Irp ) ; +void PoStartNextPowerIrp(PIRP Irp ) ; #line 956 "../slam-kernel.c" void PoStartNextPowerIrp(PIRP Irp ) { @@ -31111,7 +31111,7 @@ void PoStartNextPowerIrp(PIRP Irp ) } } #line 965 - __attribute__((__dllimport__)) NTSTATUS PsCreateSystemThread(PHANDLE ThreadHandle , +NTSTATUS PsCreateSystemThread(PHANDLE ThreadHandle , ULONG DesiredAccess , POBJECT_ATTRIBUTES ObjectAttributes , HANDLE ProcessHandle , @@ -31147,7 +31147,7 @@ NTSTATUS PsCreateSystemThread(PHANDLE ThreadHandle , ULONG DesiredAccess , POBJE } } #line 984 - __attribute__((__dllimport__)) NTSTATUS PsTerminateSystemThread(NTSTATUS ExitStatus ) ; +NTSTATUS PsTerminateSystemThread(NTSTATUS ExitStatus ) ; #line 984 "../slam-kernel.c" NTSTATUS PsTerminateSystemThread(NTSTATUS ExitStatus ) { int __BLAST_NONDET = __VERIFIER_nondet_int() ; @@ -31175,7 +31175,7 @@ NTSTATUS PsTerminateSystemThread(NTSTATUS ExitStatus ) } } #line 998 - __attribute__((__dllimport__)) NTSTATUS ( __attribute__((__stdcall__)) RtlAnsiStringToUnicodeString)(PUNICODE_STRING DestinationString , +NTSTATUS ( __attribute__((__stdcall__)) RtlAnsiStringToUnicodeString)(PUNICODE_STRING DestinationString , PANSI_STRING SourceString , BOOLEAN AllocateDestinationString ) ; #line 998 "../slam-kernel.c" @@ -31207,7 +31207,7 @@ NTSTATUS ( __attribute__((__stdcall__)) RtlAnsiStringToUnicodeString)(PUNICODE_S } } #line 1014 - __attribute__((__dllimport__)) SIZE_T ( __attribute__((__stdcall__)) RtlCompareMemory)(void const *Source1 , +SIZE_T ( __attribute__((__stdcall__)) RtlCompareMemory)(void const *Source1 , void const *Source2 , SIZE_T Length ) ; #line 1014 "../slam-kernel.c" @@ -31221,7 +31221,7 @@ SIZE_T ( __attribute__((__stdcall__)) RtlCompareMemory)(void const *Source1 , } } #line 1027 - __attribute__((__dllimport__)) void ( __attribute__((__stdcall__)) RtlCopyUnicodeString)(PUNICODE_STRING DestinationString , +void ( __attribute__((__stdcall__)) RtlCopyUnicodeString)(PUNICODE_STRING DestinationString , PUNICODE_STRING SourceString ) ; #line 1027 "../slam-kernel.c" void ( __attribute__((__stdcall__)) RtlCopyUnicodeString)(PUNICODE_STRING DestinationString , @@ -31234,7 +31234,7 @@ void ( __attribute__((__stdcall__)) RtlCopyUnicodeString)(PUNICODE_STRING Destin } } #line 1038 - __attribute__((__dllimport__)) NTSTATUS ( __attribute__((__stdcall__)) RtlDeleteRegistryValue)(ULONG RelativeTo , +NTSTATUS ( __attribute__((__stdcall__)) RtlDeleteRegistryValue)(ULONG RelativeTo , PCWSTR Path , PCWSTR ValueName ) ; #line 1038 "../slam-kernel.c" @@ -31265,7 +31265,7 @@ NTSTATUS ( __attribute__((__stdcall__)) RtlDeleteRegistryValue)(ULONG RelativeTo } } #line 1054 - __attribute__((__dllimport__)) void ( __attribute__((__stdcall__)) RtlFreeUnicodeString)(PUNICODE_STRING UnicodeString ) ; +void ( __attribute__((__stdcall__)) RtlFreeUnicodeString)(PUNICODE_STRING UnicodeString ) ; #line 1054 "../slam-kernel.c" void ( __attribute__((__stdcall__)) RtlFreeUnicodeString)(PUNICODE_STRING UnicodeString ) { @@ -31276,7 +31276,7 @@ void ( __attribute__((__stdcall__)) RtlFreeUnicodeString)(PUNICODE_STRING Unicod } } #line 1064 - __attribute__((__dllimport__)) void ( __attribute__((__stdcall__)) RtlInitString)(PSTRING DestinationString , +void ( __attribute__((__stdcall__)) RtlInitString)(PSTRING DestinationString , PCSZ SourceString ) ; #line 1064 "../slam-kernel.c" void ( __attribute__((__stdcall__)) RtlInitString)(PSTRING DestinationString , PCSZ SourceString ) @@ -31288,7 +31288,7 @@ void ( __attribute__((__stdcall__)) RtlInitString)(PSTRING DestinationString , P } } #line 1075 - __attribute__((__dllimport__)) void ( __attribute__((__stdcall__)) RtlInitUnicodeString)(PUNICODE_STRING DestinationString , +void ( __attribute__((__stdcall__)) RtlInitUnicodeString)(PUNICODE_STRING DestinationString , PCWSTR SourceString ) ; #line 1075 "../slam-kernel.c" void ( __attribute__((__stdcall__)) RtlInitUnicodeString)(PUNICODE_STRING DestinationString , @@ -31301,7 +31301,7 @@ void ( __attribute__((__stdcall__)) RtlInitUnicodeString)(PUNICODE_STRING Destin } } #line 1087 - __attribute__((__dllimport__)) NTSTATUS ( __attribute__((__stdcall__)) RtlQueryRegistryValues)(ULONG RelativeTo , +NTSTATUS ( __attribute__((__stdcall__)) RtlQueryRegistryValues)(ULONG RelativeTo , PCWSTR Path , PRTL_QUERY_REGISTRY_TABLE QueryTable , PVOID Context , @@ -31335,7 +31335,7 @@ NTSTATUS ( __attribute__((__stdcall__)) RtlQueryRegistryValues)(ULONG RelativeTo } } #line 1109 - __attribute__((__dllimport__)) NTSTATUS ( __attribute__((__stdcall__)) ZwClose)(HANDLE Handle ) ; +NTSTATUS ( __attribute__((__stdcall__)) ZwClose)(HANDLE Handle ) ; #line 1109 "../slam-kernel.c" NTSTATUS ( __attribute__((__stdcall__)) ZwClose)(HANDLE Handle ) { int __BLAST_NONDET = __VERIFIER_nondet_int() ; From f83510e9b4cac70e968c78c12131f5e797f860d0 Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Sat, 4 Oct 2014 13:56:10 -0600 Subject: [PATCH 081/140] Added license info to build scripts. --- bin/build-cygwin-cmake.sh | 3 +++ bin/build-cygwin.sh | 3 +++ bin/build-linux-cmake.sh | 3 +++ bin/build-linux.sh | 3 +++ bin/llvm2bpl.py | 2 +- bin/smackgen.py | 2 +- bin/smackreach.py | 2 +- bin/smackverify.py | 2 +- 8 files changed, 16 insertions(+), 4 deletions(-) diff --git a/bin/build-cygwin-cmake.sh b/bin/build-cygwin-cmake.sh index 36f4149be..804990e82 100755 --- a/bin/build-cygwin-cmake.sh +++ b/bin/build-cygwin-cmake.sh @@ -1,4 +1,7 @@ #!/bin/bash +# +# This file is distributed under the MIT License. See LICENSE for details. +# ################################################################################ # diff --git a/bin/build-cygwin.sh b/bin/build-cygwin.sh index 55c713de4..96a0d0004 100755 --- a/bin/build-cygwin.sh +++ b/bin/build-cygwin.sh @@ -1,4 +1,7 @@ #!/bin/bash +# +# This file is distributed under the MIT License. See LICENSE for details. +# ################################################################################ # diff --git a/bin/build-linux-cmake.sh b/bin/build-linux-cmake.sh index dddf80fd8..fffe75210 100755 --- a/bin/build-linux-cmake.sh +++ b/bin/build-linux-cmake.sh @@ -1,4 +1,7 @@ #!/bin/bash +# +# This file is distributed under the MIT License. See LICENSE for details. +# ################################################################################ # diff --git a/bin/build-linux.sh b/bin/build-linux.sh index 462e03512..a8c4474a6 100755 --- a/bin/build-linux.sh +++ b/bin/build-linux.sh @@ -1,4 +1,7 @@ #!/bin/bash +# +# This file is distributed under the MIT License. See LICENSE for details. +# ################################################################################ # diff --git a/bin/llvm2bpl.py b/bin/llvm2bpl.py index d5adf16f6..77bca77a8 100755 --- a/bin/llvm2bpl.py +++ b/bin/llvm2bpl.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python +#!/usr/bin/env python # # This file is distributed under the MIT License. See LICENSE for details. # diff --git a/bin/smackgen.py b/bin/smackgen.py index 0f314b7d6..91ca2442d 100755 --- a/bin/smackgen.py +++ b/bin/smackgen.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python +#!/usr/bin/env python # # This file is distributed under the MIT License. See LICENSE for details. # diff --git a/bin/smackreach.py b/bin/smackreach.py index 2a9de7802..854e12aad 100755 --- a/bin/smackreach.py +++ b/bin/smackreach.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python +#!/usr/bin/env python # # This file is distributed under the MIT License. See LICENSE for details. # diff --git a/bin/smackverify.py b/bin/smackverify.py index 98e82b4ab..ba080ab23 100755 --- a/bin/smackverify.py +++ b/bin/smackverify.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python +#!/usr/bin/env python # # This file is distributed under the MIT License. See LICENSE for details. # From 15ce84e819205d0d30a4a8240b0956c69259ad70 Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Sun, 5 Oct 2014 15:00:37 -0600 Subject: [PATCH 082/140] Added Monty and Arvind into copyright. --- LICENSE | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index 29200ceb9..2baf48b9c 100644 --- a/LICENSE +++ b/LICENSE @@ -2,7 +2,9 @@ The MIT License Copyright (c) 2008-2014 Zvonimir Rakamaric (zvonimir@cs.utah.edu), Michael Emmi (michael.emmi@gmail.com) -Modified work Copyright (c) 2014 Pantazis Deligiannis +Modified work Copyright (c) 2014 Pantazis Deligiannis, + Montgomery Carter, + Arvind Haran Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From 845af861f2ad0ce62b4d52d322baa3ed9aa5b5ef Mon Sep 17 00:00:00 2001 From: Michael Emmi Date: Mon, 6 Oct 2014 10:26:10 +0200 Subject: [PATCH 083/140] Better specified type of result function. --- include/smack/smack.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/smack/smack.h b/include/smack/smack.h index 1e0a5ac31..d450997f8 100644 --- a/include/smack/smack.h +++ b/include/smack/smack.h @@ -51,7 +51,7 @@ bool forall(const char *var, bool expr); bool exists(const char *var, bool expr); int qvar(const char *var); int old(int term); -int result(); +int result(void); //// PROBLEM: in the 2D memory model, the declaration of boogie_si_record_int //// should have a type $ptr parameter, not an int. How should we do this? From 197c92c72f1f71111ceb03e8f20436e15363a3a2 Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Mon, 6 Oct 2014 10:40:37 -0600 Subject: [PATCH 084/140] Fixed makefile rules to copy only smack.h over to the install folder. --- Makefile.llvm.rules | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/Makefile.llvm.rules b/Makefile.llvm.rules index ebebc0a85..1c926dfdc 100644 --- a/Makefile.llvm.rules +++ b/Makefile.llvm.rules @@ -2053,12 +2053,7 @@ install-local:: $(Verb) if test -d "$(PROJ_SRC_ROOT)/include" ; then \ cd $(PROJ_SRC_ROOT)/include && \ for hdr in `find . -type f \ - '(' -name LICENSE.TXT \ - -o -name '*.def' \ - -o -name '*.h' \ - -o -name '*.inc' \ - -o -name '*.td' \ - ')' -print | grep -v CVS | \ + '(' -name smack.h ')' -print | grep -v CVS | \ grep -v .svn` ; do \ instdir=`dirname "$(DESTDIR)$(PROJ_includedir)/$$hdr"` ; \ if test \! -d "$$instdir" ; then \ @@ -2072,12 +2067,7 @@ ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT)) $(Verb) if test -d "$(PROJ_OBJ_ROOT)/include" ; then \ cd $(PROJ_OBJ_ROOT)/include && \ for hdr in `find . -type f \ - '(' -name LICENSE.TXT \ - -o -name '*.def' \ - -o -name '*.h' \ - -o -name '*.inc' \ - -o -name '*.td' \ - ')' -print | grep -v CVS | \ + '(' -name smack.h ')' -print | grep -v CVS | \ grep -v .svn` ; do \ instdir=`dirname "$(DESTDIR)$(PROJ_includedir)/$$hdr"` ; \ if test \! -d "$$instdir" ; then \ From 888a036ca3377b8c2a4ec6d22d963578bfd99aff Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Mon, 6 Oct 2014 11:08:38 -0600 Subject: [PATCH 085/140] Fixed cygwin environment variables. --- bin/build-cygwin-cmake.sh | 4 ++-- bin/build-cygwin.sh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/build-cygwin-cmake.sh b/bin/build-cygwin-cmake.sh index 804990e82..baa67084f 100755 --- a/bin/build-cygwin-cmake.sh +++ b/bin/build-cygwin-cmake.sh @@ -106,8 +106,8 @@ cd ${BASE_DIR} echo -e "${textcolor}*** SMACK BUILD: Installed SMACK ***${nocolor}" # Set required paths and environment variables -export BOOGIE=/cygdrive/c/Users/zvonimir/Boogie/boogie -export CORRAL=/cygdrive/c/projects/corral/corral +export BOOGIE=/cygdrive/c/projects/boogie/Binaries/boogie +export CORRAL=/cygdrive/c/projects/corral/bin/Debug/corral export PATH=${LLVM_DIR}/install/bin:$PATH export PATH=${SMACK_DIR}/install/bin:$PATH diff --git a/bin/build-cygwin.sh b/bin/build-cygwin.sh index 96a0d0004..59f09fb8c 100755 --- a/bin/build-cygwin.sh +++ b/bin/build-cygwin.sh @@ -106,8 +106,8 @@ cd ${BASE_DIR} echo -e "${textcolor}*** SMACK BUILD: Installed SMACK ***${nocolor}" # Set required paths and environment variables -export BOOGIE=/cygdrive/c/Users/zvonimir/Boogie/boogie -export CORRAL=/cygdrive/c/projects/corral/corral +export BOOGIE=/cygdrive/c/projects/boogie/Binaries/boogie +export CORRAL=/cygdrive/c/projects/corral/bin/Debug/corral export PATH=${LLVM_DIR}/install/bin:$PATH export PATH=${SMACK_DIR}/install/bin:$PATH From 0e43b47a4f5bdb6b6696d89d433afdba899fe135 Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Mon, 6 Oct 2014 13:29:48 -0600 Subject: [PATCH 086/140] Changed the signature of assert and assume procedures to take int as their argument. --- include/smack/smack.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/include/smack/smack.h b/include/smack/smack.h index fb304719f..2b4c3b1bf 100644 --- a/include/smack/smack.h +++ b/include/smack/smack.h @@ -28,18 +28,16 @@ * */ -#include - void __SMACK_code(const char *fmt, ...); void __SMACK_mod(const char *fmt, ...); void __SMACK_decl(const char *fmt, ...); void __SMACK_top_decl(const char *fmt, ...); -void assert(bool v) { +void assert(int v) { __SMACK_code("assert @ != 0;", v); } -void assume(bool v) { +void assume(int v) { __SMACK_code("assume @ != 0;", v); } @@ -55,6 +53,11 @@ int __SMACK_nondet() { return x; } +// Used for SVCOMP +void __VERIFIER_error(void) { + assert(0); +} + void __SMACK_decls() { #define D(d) __SMACK_top_decl(d) From 6d7da2fd9e83ac92b024992ad58bde4926e50b65 Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Tue, 7 Oct 2014 09:41:13 -0600 Subject: [PATCH 087/140] Cleaned up error handling in our python scripts. --- bin/llvm2bpl.py | 11 +++++------ bin/smackgen.py | 9 ++++----- bin/smackverify.py | 21 ++++++++++++--------- 3 files changed, 21 insertions(+), 20 deletions(-) diff --git a/bin/llvm2bpl.py b/bin/llvm2bpl.py index 77bca77a8..ade6e8966 100755 --- a/bin/llvm2bpl.py +++ b/bin/llvm2bpl.py @@ -42,13 +42,12 @@ def llvm2bpl(infile, outfile, debugFlag, memImpls): if debugFlag: cmd.append('-debug') if memImpls: cmd.append('-mem-mod-impls') cmd.append('-o=' + outfile) - p = subprocess.Popen(cmd, stderr=subprocess.PIPE) + p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + smackOutput = p.communicate()[0] - p.wait() - if p.returncode != 0: - print >> sys.stderr, "SMACK encountered an error:" - print >> sys.stderr, output[0:1000], "... (output truncated)" - sys.exit("SMACK returned exit status %s" % p.returncode) + if p.returncode: + print >> sys.stderr, smackOutput + sys.exit("SMACK encountered an error when invoking SMACK tool. Exiting...") with open(outfile, 'r') as outputFile: output = outputFile.read() diff --git a/bin/smackgen.py b/bin/smackgen.py index 91ca2442d..682b388f4 100755 --- a/bin/smackgen.py +++ b/bin/smackgen.py @@ -68,12 +68,11 @@ def clang(scriptPathName, inputFile, bcFileName, outputFileName, memoryModel, cl #However, this will be problematic if any callers want to differentiate # between clangs stdout and stderr. p = subprocess.Popen(clangCommand, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) - clangStdout, clangStderr = p.communicate() - clangOutput = clangStdout + clangOutput = p.communicate()[0] - if p.returncode != 0: - print clangOutput - sys.exit("SMACK encountered a clang error. Exiting...") + if p.returncode: + print >> sys.stderr, clangOutput + sys.exit("SMACK encountered an error when invoking clang. Exiting...") inputFile = open(bcFileName, 'r') return inputFile, clangOutput diff --git a/bin/smackverify.py b/bin/smackverify.py index ba080ab23..dcbec1e4c 100755 --- a/bin/smackverify.py +++ b/bin/smackverify.py @@ -126,11 +126,12 @@ def verify(verifier, bplFileName, timeLimit, unroll, debug, smackd): boogieCommand = ['boogie', bplFileName, '/nologo', '/timeLimit:' + str(timeLimit)] if unroll is not None: boogieCommand += ['/loopUnroll:' + str(unroll)] - p = subprocess.Popen(boogieCommand, stdout=subprocess.PIPE) + p = subprocess.Popen(boogieCommand, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) boogieOutput = p.communicate()[0] + if p.returncode: - return boogieOutput - sys.exit("SMACK encountered an error invoking Boogie. Exiting...") + print >> sys.stderr, boogieOutput + sys.exit("SMACK encountered an error when invoking Boogie. Exiting...") if debug: return boogieOutput sourceTrace = generateSourceErrorTrace(boogieOutput, bplFileName) @@ -143,11 +144,12 @@ def verify(verifier, bplFileName, timeLimit, unroll, debug, smackd): corralCommand = ['corral', bplFileName, '/tryCTrace'] if unroll is not None: corralCommand += ['/recursionBound:' + str(unroll)] - p = subprocess.Popen(corralCommand, stdout=subprocess.PIPE) + p = subprocess.Popen(corralCommand, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) corralOutput = p.communicate()[0] + if p.returncode: - return corralOutput - sys.exit("SMACK encountered an error invoking Corral. Exiting...") + print >> sys.stderr, corralOutput + sys.exit("SMACK encountered an error when invoking Corral. Exiting...") if smackd: smackdOutput(corralOutput) else: @@ -156,11 +158,12 @@ def verify(verifier, bplFileName, timeLimit, unroll, debug, smackd): # invoke Duality dualityCommand = ['corral', bplFileName, '/tryCTrace', '/useDuality'] dualityCommand += ['/recursionBound:10000'] # hack for providing infinite recursion bound - p = subprocess.Popen(dualityCommand, stdout=subprocess.PIPE) + p = subprocess.Popen(dualityCommand, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) dualityOutput = p.communicate()[0] + if p.returncode: - return dualityOutput - sys.exit("SMACK encountered an error invoking Duality. Exiting...") + print >> sys.stderr, dualityOutput + sys.exit("SMACK encountered an error when invoking Duality. Exiting...") if smackd: smackdOutput(dualityOutput) else: From 476777f92fc567b92fdaaa77b946a9740828f5b0 Mon Sep 17 00:00:00 2001 From: Michael Emmi Date: Wed, 8 Oct 2014 16:27:56 +0200 Subject: [PATCH 088/140] Added assertion for failing SVCOMP example. --- lib/smack/DSAAliasAnalysis.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/smack/DSAAliasAnalysis.cpp b/lib/smack/DSAAliasAnalysis.cpp index 9ddb52104..f50c25005 100644 --- a/lib/smack/DSAAliasAnalysis.cpp +++ b/lib/smack/DSAAliasAnalysis.cpp @@ -131,7 +131,10 @@ AliasAnalysis::AliasResult DSAAliasAnalysis::alias(const Location &LocA, const L const DSNode *N1 = nodeEqs->getMemberForValue(LocA.Ptr); const DSNode *N2 = nodeEqs->getMemberForValue(LocB.Ptr); - + + assert(N1 && "Expected non-null node."); + assert(N2 && "Expected non-null node."); + if ((N1->isCompleteNode() || N2->isCompleteNode()) && !(N1->isExternalNode() && N2->isExternalNode()) && !(N1->isUnknownNode() || N2->isUnknownNode())) { From 6b4e049505e8eaa95054b198f91e3b471ea49c9d Mon Sep 17 00:00:00 2001 From: Michael Emmi Date: Thu, 9 Oct 2014 15:40:07 +0200 Subject: [PATCH 089/140] Avoiding translation of dead code. --- tools/smack/smack.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/smack/smack.cpp b/tools/smack/smack.cpp index d9f270d9e..249dea2dd 100644 --- a/tools/smack/smack.cpp +++ b/tools/smack/smack.cpp @@ -100,7 +100,7 @@ int main(int argc, char **argv) { pass_manager.add(llvm::createInternalizePass()); pass_manager.add(llvm::createPromoteMemoryToRegisterPass()); - pass_manager.add(llvm::createDeadInstEliminationPass()); + pass_manager.add(llvm::createCFGSimplificationPass()); pass_manager.add(llvm::createLowerSwitchPass()); pass_manager.add(new llvm::StructRet()); pass_manager.add(new llvm::SimplifyEV()); From 14045e1011411b3d6878bcd77e33918271bce301 Mon Sep 17 00:00:00 2001 From: Michael Emmi Date: Thu, 9 Oct 2014 16:21:12 +0200 Subject: [PATCH 090/140] Reordered optimization phases. --- tools/smack/smack.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/smack/smack.cpp b/tools/smack/smack.cpp index 249dea2dd..085844777 100644 --- a/tools/smack/smack.cpp +++ b/tools/smack/smack.cpp @@ -98,9 +98,9 @@ int main(int argc, char **argv) { dl = new llvm::DataLayout(moduleDataLayout); if (dl) pass_manager.add(new llvm::DataLayoutPass(*dl)); + pass_manager.add(llvm::createCFGSimplificationPass()); pass_manager.add(llvm::createInternalizePass()); pass_manager.add(llvm::createPromoteMemoryToRegisterPass()); - pass_manager.add(llvm::createCFGSimplificationPass()); pass_manager.add(llvm::createLowerSwitchPass()); pass_manager.add(new llvm::StructRet()); pass_manager.add(new llvm::SimplifyEV()); From 3927565e0b1dc95e9d78c42b4f28076b043e4216 Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Thu, 9 Oct 2014 11:08:23 -0600 Subject: [PATCH 091/140] Updated cmake build to work with contracts implementation. --- CMakeLists.txt | 8 ++++++-- LICENSE | 6 +++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 89a5caf33..150089667 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,4 @@ # -# Copyright (c) 2013 Pantazis Deligiannis (p.deligiannis@imperial.ac.uk) # This file is distributed under the MIT License. See LICENSE for details. # @@ -142,11 +141,13 @@ add_library(dsa STATIC ) add_library(smackTranslator STATIC - include/smack/smack.h include/smack/BoogieAst.h include/smack/BplFilePrinter.h include/smack/BplPrinter.h + include/smack/Contracts.h include/smack/DSAAliasAnalysis.h + include/smack/Naming.h + include/smack/Slicing.h include/smack/SmackInstGenerator.h include/smack/SmackModuleGenerator.h include/smack/SmackOptions.h @@ -155,7 +156,10 @@ add_library(smackTranslator STATIC lib/smack/BoogieAst.cpp lib/smack/BplFilePrinter.cpp lib/smack/BplPrinter.cpp + lib/smack/Contracts.cpp lib/smack/DSAAliasAnalysis.cpp + lib/smack/Naming.cpp + lib/smack/Slicing.cpp lib/smack/SmackInstGenerator.cpp lib/smack/SmackModuleGenerator.cpp lib/smack/SmackOptions.cpp diff --git a/LICENSE b/LICENSE index 2baf48b9c..da9c3dfcc 100644 --- a/LICENSE +++ b/LICENSE @@ -2,9 +2,9 @@ The MIT License Copyright (c) 2008-2014 Zvonimir Rakamaric (zvonimir@cs.utah.edu), Michael Emmi (michael.emmi@gmail.com) -Modified work Copyright (c) 2014 Pantazis Deligiannis, - Montgomery Carter, - Arvind Haran +Modified work Copyright (c) 2013-2014 Pantazis Deligiannis, + Montgomery Carter, + Arvind Haran Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From e08e5fafffdc5db7e962f1237b2bc69b78ed79b4 Mon Sep 17 00:00:00 2001 From: Arvind Haran Date: Thu, 9 Oct 2014 14:34:52 -0600 Subject: [PATCH 092/140] Overloaded the assume and nondet function for a few types --- include/smack/smack-svcomp.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/include/smack/smack-svcomp.h b/include/smack/smack-svcomp.h index 262437666..e395c2b2d 100644 --- a/include/smack/smack-svcomp.h +++ b/include/smack/smack-svcomp.h @@ -8,4 +8,20 @@ void __VERIFIER_error(void) { assert(0); } +void __VERIFIER_assume(int v) { + assume(v); +} + +//Types to be overloaded for: {bool, char, int, float, loff_t, long, pchar, pointer, pthread_t, sector_t, short, size_t, u32, uchar, uint, ulong, unsigned, ushort} + +char __VERIFIER_nondet_char() { + return (char)__SMACK_nondet(); +} + +int __VERIFIER_nondet_int() { + return __SMACK_nondet(); +} + + + #endif From a8cf5f07def0a117f1df41f5d144eb16db25dc8b Mon Sep 17 00:00:00 2001 From: Michael Emmi Date: Fri, 10 Oct 2014 20:45:44 +0200 Subject: [PATCH 093/140] Fixed function name matching, for now. --- lib/smack/SmackInstGenerator.cpp | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/lib/smack/SmackInstGenerator.cpp b/lib/smack/SmackInstGenerator.cpp index c94beffae..013600b79 100644 --- a/lib/smack/SmackInstGenerator.cpp +++ b/lib/smack/SmackInstGenerator.cpp @@ -528,25 +528,26 @@ void SmackInstGenerator::visitCallInst(llvm::CallInst& ci) { processInstruction(ci); llvm::Function* f = ci.getCalledFunction(); + string name = f && f->hasName() ? f->getName().str() : ""; if (ci.isInlineAsm()) { WARN("unsoundly ignoring inline asm call: " + i2s(ci)); emit(Stmt::skip()); - } else if (f && naming.get(*f).find("llvm.dbg.") != string::npos) { + } else if (name.find("llvm.dbg.") != string::npos) { WARN("ignoring llvm.debug call."); emit(Stmt::skip()); - } else if (f && naming.get(*f).find("__SMACK_mod") != string::npos) { + } else if (name.find("__SMACK_mod") != string::npos) { addMod(rep.code(ci)); - } else if (f && naming.get(*f).find("__SMACK_code") != string::npos) { + } else if (name.find("__SMACK_code") != string::npos) { emit(Stmt::code(rep.code(ci))); - } else if (f && naming.get(*f).find("__SMACK_decl") != string::npos) { + } else if (name.find("__SMACK_decl") != string::npos) { addDecl(Decl::code(rep.code(ci))); - } else if (f && naming.get(*f).find("__SMACK_top_decl") != string::npos) { + } else if (name.find("__SMACK_top_decl") != string::npos) { string decl = rep.code(ci); addTopDecl(Decl::code(decl)); if (VAR_DECL.match(decl)) { @@ -554,22 +555,22 @@ void SmackInstGenerator::visitCallInst(llvm::CallInst& ci) { rep.addBplGlobal(var); } - } else if (f && naming.get(*f).find("result") != string::npos) { + } else if (name == "result") { assert(ci.getNumArgOperands() == 0 && "Unexpected operands to result."); emit(Stmt::assign(rep.expr(&ci),Expr::id(Naming::RET_VAR))); - } else if (f && naming.get(*f).find("qvar") != string::npos) { + } else if (name == "qvar") { assert(ci.getNumArgOperands() == 1 && "Unexpected operands to qvar."); emit(Stmt::assign(rep.expr(&ci),Expr::id(rep.getString(ci.getArgOperand(0))))); - } else if (f && naming.get(*f).find("old") != string::npos) { + } else if (name == "old") { assert(ci.getNumArgOperands() == 1 && "Unexpected operands to old."); llvm::LoadInst* LI = llvm::dyn_cast(ci.getArgOperand(0)); assert(LI && "Expected value from Load."); emit(Stmt::assign(rep.expr(&ci), Expr::fn("old",rep.mem(LI->getPointerOperand())) )); - } else if (f && naming.get(*f).find("forall") != string::npos) { + } else if (name == "forall") { assert(ci.getNumArgOperands() == 2 && "Unexpected operands to forall."); Value* var = ci.getArgOperand(0); Value* arg = ci.getArgOperand(1); @@ -577,7 +578,7 @@ void SmackInstGenerator::visitCallInst(llvm::CallInst& ci) { emit(Stmt::assign(rep.expr(&ci), Expr::forall(rep.getString(var), "int", S->getBoogieExpression(naming,rep)))); - } else if (f && naming.get(*f).find("exists") != string::npos) { + } else if (name == "exists") { assert(ci.getNumArgOperands() == 2 && "Unexpected operands to forall."); Value* var = ci.getArgOperand(0); Value* arg = ci.getArgOperand(1); @@ -585,7 +586,7 @@ void SmackInstGenerator::visitCallInst(llvm::CallInst& ci) { emit(Stmt::assign(rep.expr(&ci), Expr::exists(rep.getString(var), "int", S->getBoogieExpression(naming,rep)))); - } else if (f && naming.get(*f).find("invariant") != string::npos) { + } else if (name == "invariant") { assert(ci.getNumArgOperands() == 1 && "Unexpected operands to invariant."); Slice* S = getSlice(ci.getArgOperand(0)); emit(Stmt::assert_(S->getBoogieExpression(naming,rep))); From ee92616135c3344c889616f6beb0d6248f11334d Mon Sep 17 00:00:00 2001 From: Arvind Haran Date: Fri, 10 Oct 2014 16:13:05 -0600 Subject: [PATCH 094/140] Replacing tabs with spaces --- include/smack/smack-svcomp.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/include/smack/smack-svcomp.h b/include/smack/smack-svcomp.h index e395c2b2d..98ab7c80d 100644 --- a/include/smack/smack-svcomp.h +++ b/include/smack/smack-svcomp.h @@ -15,13 +15,11 @@ void __VERIFIER_assume(int v) { //Types to be overloaded for: {bool, char, int, float, loff_t, long, pchar, pointer, pthread_t, sector_t, short, size_t, u32, uchar, uint, ulong, unsigned, ushort} char __VERIFIER_nondet_char() { - return (char)__SMACK_nondet(); + return (char)__SMACK_nondet(); } int __VERIFIER_nondet_int() { - return __SMACK_nondet(); + return __SMACK_nondet(); } - - #endif From f5c388b4c47bd701d7e91202294267f09eaf2f85 Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Fri, 17 Oct 2014 13:19:34 -0700 Subject: [PATCH 095/140] Removing the inline attribute using a macro. --- include/smack/smack-svcomp.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/include/smack/smack-svcomp.h b/include/smack/smack-svcomp.h index 98ab7c80d..ac0492a26 100644 --- a/include/smack/smack-svcomp.h +++ b/include/smack/smack-svcomp.h @@ -4,6 +4,10 @@ #ifndef SMACK_SVCOMP_H_ #define SMACK_SVCOMP_H_ +#include "smack.h" + +#define __inline // This removes the inline attribute + void __VERIFIER_error(void) { assert(0); } @@ -12,7 +16,9 @@ void __VERIFIER_assume(int v) { assume(v); } -//Types to be overloaded for: {bool, char, int, float, loff_t, long, pchar, pointer, pthread_t, sector_t, short, size_t, u32, uchar, uint, ulong, unsigned, ushort} +// Types to be overloaded for: {bool, char, int, float, loff_t, long, pchar, +// pointer, pthread_t, sector_t, short, size_t, u32, uchar, uint, ulong, +// unsigned, ushort} char __VERIFIER_nondet_char() { return (char)__SMACK_nondet(); @@ -23,3 +29,4 @@ int __VERIFIER_nondet_int() { } #endif + From 2cc7314b8e648df2dd1abb716b4fc9bca44db635 Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Fri, 17 Oct 2014 14:33:58 -0700 Subject: [PATCH 096/140] Added rewrite rules for Stateful benchmarks. --- include/smack/smack-svcomp.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/smack/smack-svcomp.h b/include/smack/smack-svcomp.h index ac0492a26..e857da42b 100644 --- a/include/smack/smack-svcomp.h +++ b/include/smack/smack-svcomp.h @@ -6,7 +6,9 @@ #include "smack.h" -#define __inline // This removes the inline attribute +#define __inline // Remove the inline attribute +#define __builtin_expect __builtinx_expect // Rewrite so that clang does not complain +#define __builtin_memcpy __builtinx_memcpy // Rewrite so that clang does not complain void __VERIFIER_error(void) { assert(0); From 3cd72fdd96eb39d71b6a32744e0b770179f5971f Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Sun, 19 Oct 2014 08:08:15 -0700 Subject: [PATCH 097/140] Implemented VERIFIER_nondet_uint. --- include/smack/smack-svcomp.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/include/smack/smack-svcomp.h b/include/smack/smack-svcomp.h index e857da42b..e98c1ad41 100644 --- a/include/smack/smack-svcomp.h +++ b/include/smack/smack-svcomp.h @@ -19,7 +19,7 @@ void __VERIFIER_assume(int v) { } // Types to be overloaded for: {bool, char, int, float, loff_t, long, pchar, -// pointer, pthread_t, sector_t, short, size_t, u32, uchar, uint, ulong, +// pointer, pthread_t, sector_t, short, size_t, u32, uchar, ulong, // unsigned, ushort} char __VERIFIER_nondet_char() { @@ -30,5 +30,11 @@ int __VERIFIER_nondet_int() { return __SMACK_nondet(); } +unsigned __VERIFIER_nondet_uint() { + int x = __SMACK_nondet(); + assume(x >= 0); + return (unsigned)x; +} + #endif From beb58d800a687dcfd1abd50b4c518736c4e5a63a Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Tue, 21 Oct 2014 16:33:03 -0600 Subject: [PATCH 098/140] Fixed a minor bug: "yield" is a boogie/corral keyword. --- lib/smack/Naming.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/smack/Naming.cpp b/lib/smack/Naming.cpp index 7d731b385..37db11347 100644 --- a/lib/smack/Naming.cpp +++ b/lib/smack/Naming.cpp @@ -23,7 +23,7 @@ Regex Naming::BPL_KW( "^(bool|int|false|true|old|forall|exists|requires|modifies|ensures|invariant|free" "|unique|finite|complete|type|const|function|axiom|var|procedure" "|implementation|where|returns|assume|assert|havoc|call|return|while" - "|break|goto|if|else|div)$"); + "|break|goto|if|else|div|yield)$"); Regex Naming::SMACK_NAME(".*__SMACK_.*"); From 0fabe97bf14bfaf46c44c291b3f13a8a0ac2e954 Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Tue, 21 Oct 2014 16:59:22 -0600 Subject: [PATCH 099/140] Run lower switch pass first. --- tools/smack/smack.cpp | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/tools/smack/smack.cpp b/tools/smack/smack.cpp index 085844777..136ad38da 100644 --- a/tools/smack/smack.cpp +++ b/tools/smack/smack.cpp @@ -49,22 +49,22 @@ std::string getFileName(const std::string &str) { int main(int argc, char **argv) { llvm::llvm_shutdown_obj shutdown; // calls llvm_shutdown() on exit llvm::cl::ParseCommandLineOptions(argc, argv, "SMACK - LLVM bitcode to Boogie transformation\n"); - + llvm::sys::PrintStackTraceOnErrorSignal(); llvm::PrettyStackTraceProgram PSTP(argc, argv); llvm::EnableDebugBuffering = true; - + if (OutputFilename.empty()) { // OutputFilename = getFileName(InputFilename) + ".bpl"; OutputFilename = "a.bpl"; } - + std::string error_msg; llvm::SMDiagnostic err; llvm::LLVMContext &context = llvm::getGlobalContext(); std::unique_ptr module; std::unique_ptr output; - + module.reset(llvm::ParseIRFile(InputFilename, err, context)); if (module.get() == 0) { if (llvm::errs().has_colors()) llvm::errs().changeColor(llvm::raw_ostream::RED); @@ -72,7 +72,7 @@ int main(int argc, char **argv) { if (llvm::errs().has_colors()) llvm::errs().resetColor(); return 1; } - + output.reset(new llvm::tool_output_file(OutputFilename.c_str(), error_msg, llvm::sys::fs::F_None)); if (!error_msg.empty()) { if (llvm::errs().has_colors()) llvm::errs().changeColor(llvm::raw_ostream::RED); @@ -80,15 +80,15 @@ int main(int argc, char **argv) { if (llvm::errs().has_colors()) llvm::errs().resetColor(); return 1; } - + /////////////////////////////// // initialise and run passes // /////////////////////////////// - + llvm::PassManager pass_manager; llvm::PassRegistry &Registry = *llvm::PassRegistry::getPassRegistry(); llvm::initializeAnalysis(Registry); - + // add an appropriate DataLayout instance for the module const llvm::DataLayout *dl = 0; const std::string &moduleDataLayout = module.get()->getDataLayoutStr(); @@ -97,19 +97,20 @@ int main(int argc, char **argv) { else if (!DefaultDataLayout.empty()) dl = new llvm::DataLayout(moduleDataLayout); if (dl) pass_manager.add(new llvm::DataLayoutPass(*dl)); - + + pass_manager.add(llvm::createLowerSwitchPass()); pass_manager.add(llvm::createCFGSimplificationPass()); pass_manager.add(llvm::createInternalizePass()); pass_manager.add(llvm::createPromoteMemoryToRegisterPass()); - pass_manager.add(llvm::createLowerSwitchPass()); pass_manager.add(new llvm::StructRet()); pass_manager.add(new llvm::SimplifyEV()); pass_manager.add(new llvm::SimplifyIV()); pass_manager.add(new smack::SmackModuleGenerator()); pass_manager.add(new smack::BplFilePrinter(output->os())); pass_manager.run(*module.get()); - + output->keep(); - + return 0; } + From d7b466fb92c3e997777497cdcac93c38efef5f6d Mon Sep 17 00:00:00 2001 From: Michael Emmi Date: Wed, 22 Oct 2014 14:59:03 +0200 Subject: [PATCH 100/140] Translating un-aliased scalar globals to scalar variables. --- include/smack/DSAAliasAnalysis.h | 1 + include/smack/SmackRep.h | 39 ++++++++++++++++++++--- lib/smack/DSAAliasAnalysis.cpp | 36 ++++++++++++++++++++- lib/smack/Slicing.cpp | 8 +++-- lib/smack/SmackRep.cpp | 54 +++++++++++++++++++------------- 5 files changed, 108 insertions(+), 30 deletions(-) diff --git a/include/smack/DSAAliasAnalysis.h b/include/smack/DSAAliasAnalysis.h index 2add8c689..741592702 100644 --- a/include/smack/DSAAliasAnalysis.h +++ b/include/smack/DSAAliasAnalysis.h @@ -95,6 +95,7 @@ class DSAAliasAnalysis : public llvm::ModulePass, public llvm::AliasAnalysis { llvm::DSNode *getNode(const llvm::Value* v); bool isAlloced(const llvm::Value* v); bool isExternal(const llvm::Value* v); + bool isSingletonGlobal(const llvm::Value *V); virtual AliasResult alias(const Location &LocA, const Location &LocB); diff --git a/include/smack/SmackRep.h b/include/smack/SmackRep.h index cfde0cf15..5729c0fc1 100644 --- a/include/smack/SmackRep.h +++ b/include/smack/SmackRep.h @@ -122,7 +122,16 @@ class SmackRep { Naming& naming; Program& program; vector bplGlobals; - vector< pair > memoryRegions; + + struct Region { + const llvm::Value* representative; + bool isAllocated; + bool isSingletonGlobal; + Region(const llvm::Value* r, bool a, bool s) : + representative(r), isAllocated(a), isSingletonGlobal(s) {} + }; + + vector memoryRegions; const llvm::DataLayout* targetData; int globalsBottom; @@ -165,6 +174,7 @@ class SmackRep { unsigned getRegion(const llvm::Value* v); string memReg(unsigned i); + string memType(unsigned r); bool isExternal(const llvm::Value* v); void collectRegions(llvm::Module &M); @@ -227,10 +237,29 @@ class RegionCollector : public llvm::InstVisitor { public: RegionCollector(SmackRep& r) : rep(r) {} - void visitAllocaInst(llvm::AllocaInst& i) { rep.getRegion(&i); } - void visitCallInst(llvm::CallInst& i) { - if (i.getType()->isPointerTy()) - rep.getRegion(&i); + void visitModule(llvm::Module& M) { + for (llvm::Module::const_global_iterator + G = M.global_begin(), E = M.global_end(); G != E; ++G) + rep.getRegion(G); + } + void visitAllocaInst(llvm::AllocaInst& I) { + rep.getRegion(&I); + } + void visitLoadInst(llvm::LoadInst& I) { + rep.getRegion(I.getPointerOperand()); + } + void visitStoreInst(llvm::StoreInst& I) { + rep.getRegion(I.getPointerOperand()); + } + void visitAtomicCmpXchgInst(llvm::AtomicCmpXchgInst &I) { + rep.getRegion(I.getPointerOperand()); + } + void visitAtomicRMWInst(llvm::AtomicRMWInst &I) { + rep.getRegion(I.getPointerOperand()); + } + void visitCallInst(llvm::CallInst& I) { + if (I.getType()->isPointerTy()) + rep.getRegion(&I); } }; diff --git a/lib/smack/DSAAliasAnalysis.cpp b/lib/smack/DSAAliasAnalysis.cpp index f50c25005..cc45bfa50 100644 --- a/lib/smack/DSAAliasAnalysis.cpp +++ b/lib/smack/DSAAliasAnalysis.cpp @@ -12,6 +12,7 @@ // //===----------------------------------------------------------------------===// +#include "llvm/ADT/EquivalenceClasses.h" #include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Analysis/Passes.h" #include "llvm/IR/Constants.h" @@ -124,9 +125,41 @@ bool DSAAliasAnalysis::isExternal(const Value* v) { return N && N->isExternalNode(); } +bool DSAAliasAnalysis::isSingletonGlobal(const Value *V) { + const DSNode *N = getNode(V); + if (!N || !N->isGlobalNode() || N->numGlobals() > 1) + return false; + + // Ensure this node has a unique scalar type... (?) + DSNode::const_type_iterator TSi = N->type_begin(); + if (TSi == N->type_end()) return false; + svset::const_iterator Ti = TSi->second->begin(); + if (Ti == TSi->second->end()) return false; + const Type* T = *Ti; + while (T->isPointerTy()) T = T->getPointerElementType(); + if (!T->isSingleValueType()) return false; + ++Ti; + if (Ti != TSi->second->end()) return false; + ++TSi; + if (TSi != N->type_end()) return false; + + // Ensure this node is in its own class... (?) + const EquivalenceClasses &Cs = nodeEqs->getEquivalenceClasses(); + EquivalenceClasses::iterator C = Cs.findValue(N); + assert(C != Cs.end() && "Did not find value."); + EquivalenceClasses::member_iterator I = Cs.member_begin(C); + if (I == Cs.member_end()) + return false; + ++I; + if (I != Cs.member_end()) + return false; + + return true; +} + AliasAnalysis::AliasResult DSAAliasAnalysis::alias(const Location &LocA, const Location &LocB) { - if (LocA.Ptr == LocB.Ptr) + if (LocA.Ptr == LocB.Ptr) return MustAlias; const DSNode *N1 = nodeEqs->getMemberForValue(LocA.Ptr); @@ -138,6 +171,7 @@ AliasAnalysis::AliasResult DSAAliasAnalysis::alias(const Location &LocA, const L if ((N1->isCompleteNode() || N2->isCompleteNode()) && !(N1->isExternalNode() && N2->isExternalNode()) && !(N1->isUnknownNode() || N2->isUnknownNode())) { + if (!equivNodes(N1,N2)) return NoAlias; diff --git a/lib/smack/Slicing.cpp b/lib/smack/Slicing.cpp index 496646ce3..eae175a45 100644 --- a/lib/smack/Slicing.cpp +++ b/lib/smack/Slicing.cpp @@ -76,9 +76,11 @@ Slice* getSubslice(Instruction* I, Slices& slices) { } pair getParameter(Value* V, Naming& naming, SmackRep& rep) { - - if (GlobalVariable* G = dyn_cast(V)) - return make_pair(rep.memReg(rep.getRegion(G)), "[int] int"); + + if (GlobalVariable* G = dyn_cast(V)) { + unsigned r = rep.getRegion(G); + return make_pair(rep.memReg(r), rep.memType(r)); + } else if (ConstantDataSequential* S = dyn_cast(V)) return make_pair(S->getAsCString(), "int"); diff --git a/lib/smack/SmackRep.cpp b/lib/smack/SmackRep.cpp index e2fe43b21..798ccd6ea 100644 --- a/lib/smack/SmackRep.cpp +++ b/lib/smack/SmackRep.cpp @@ -164,45 +164,58 @@ string SmackRep::memReg(unsigned idx) { return s.str(); } +string SmackRep::memType(unsigned r) { + if (memoryRegions[r].isSingletonGlobal) + return getPtrType(); + else { + return "[int] int"; + stringstream s; + s << "[" << getPtrType() << "] " + getPtrType(); + return s.str(); + } +} + const Expr* SmackRep::mem(const llvm::Value* v) { - return mem( getRegion(v), expr(v) ); + unsigned r = getRegion(v); + if (memoryRegions[r].isSingletonGlobal) + return Expr::id(memReg(r)); + else + return Expr::sel(Expr::id(memReg(r)),expr(v)); } const Expr* SmackRep::mem(unsigned region, const Expr* addr) { - return Expr::sel( Expr::id(memReg(region)), addr ); + if (memoryRegions[region].isSingletonGlobal) + return Expr::id(memReg(region)); + else + return Expr::sel(Expr::id(memReg(region)),addr); } unsigned SmackRep::getRegion(const llvm::Value* v) { unsigned r; - + for (r=0; risNoAlias(v, memoryRegions[r].first)) + if (!aliasAnalysis->isNoAlias(v, memoryRegions[r].representative)) break; - if (r == memoryRegions.size()) - memoryRegions.push_back(make_pair(v,false)); - - memoryRegions[r].second = memoryRegions[r].second || aliasAnalysis->isAlloced(v); + if (r == memoryRegions.size()) { + llvm::Type* T = v->getType(); + while (T->isPointerTy()) T = T->getPointerElementType(); + memoryRegions.emplace_back(v,false, + aliasAnalysis->isSingletonGlobal(v) && T->isSingleValueType() + ); + } + memoryRegions[r].isAllocated = memoryRegions[r].isAllocated || aliasAnalysis->isAlloced(v); return r; } bool SmackRep::isExternal(const llvm::Value* v) { - return v->getType()->isPointerTy() && !memoryRegions[getRegion(v)].second; + return v->getType()->isPointerTy() && !memoryRegions[getRegion(v)].isAllocated; } void SmackRep::collectRegions(llvm::Module &M) { RegionCollector rc(*this); - - for (llvm::Module::iterator func = M.begin(), e = M.end(); - func != e; ++func) { - - for (llvm::Function::iterator block = func->begin(); - block != func->end(); ++block) { - - rc.visit(*block); - } - } + rc.visit(M); } const Expr* SmackRep::trunc(const llvm::Value* v, llvm::Type* t) { @@ -768,8 +781,7 @@ string SmackRep::getPrelude() { s << "// Memory region declarations"; s << ": " << memoryRegions.size() << endl; for (unsigned i=0; i Date: Wed, 22 Oct 2014 15:23:09 +0200 Subject: [PATCH 101/140] Fixed floating point comparison declarations. --- include/smack/smack.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/smack/smack.h b/include/smack/smack.h index c41f86ed4..9cae484e2 100644 --- a/include/smack/smack.h +++ b/include/smack/smack.h @@ -103,13 +103,13 @@ void __SMACK_decls() { // Floating point D("type float;"); D("function $fp(ipart:int, fpart:int, epart:int) returns (float);"); - D("const $ffalse: float;"); - D("const $ftrue: float;"); D("function $fadd(f1:float, f2:float) returns (float);"); D("function $fsub(f1:float, f2:float) returns (float);"); D("function $fmul(f1:float, f2:float) returns (float);"); D("function $fdiv(f1:float, f2:float) returns (float);"); D("function $frem(f1:float, f2:float) returns (float);"); + D("function $ffalse(f1:float, f2:float) returns (bool);"); + D("function $ftrue(f1:float, f2:float) returns (bool);"); D("function $foeq(f1:float, f2:float) returns (bool);"); D("function $foge(f1:float, f2:float) returns (bool);"); D("function $fogt(f1:float, f2:float) returns (bool);"); From a9a8c4f1a7e53e7c50068ccad5667c38ce003994 Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Wed, 22 Oct 2014 09:58:54 -0600 Subject: [PATCH 102/140] Fixed a compilation problem related to included headers. --- include/smack/DSAAliasAnalysis.h | 10 +++++----- lib/smack/DSAAliasAnalysis.cpp | 8 -------- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/include/smack/DSAAliasAnalysis.h b/include/smack/DSAAliasAnalysis.h index 741592702..218e70cb4 100644 --- a/include/smack/DSAAliasAnalysis.h +++ b/include/smack/DSAAliasAnalysis.h @@ -15,16 +15,16 @@ #ifndef LLVM_ANALYSIS_DATA_STRUCTURE_AA_H #define LLVM_ANALYSIS_DATA_STRUCTURE_AA_H -#include "llvm/IR/InstVisitor.h" +#include "assistDS/DSNodeEquivs.h" +#include "dsa/DataStructure.h" +#include "dsa/DSGraph.h" #include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Analysis/Passes.h" +#include "llvm/ADT/EquivalenceClasses.h" #include "llvm/IR/Constants.h" #include "llvm/IR/DerivedTypes.h" +#include "llvm/IR/InstVisitor.h" #include "llvm/IR/Module.h" -#include "dsa/DataStructure.h" -#include "dsa/DSGraph.h" - -#include "assistDS/DSNodeEquivs.h" namespace smack { diff --git a/lib/smack/DSAAliasAnalysis.cpp b/lib/smack/DSAAliasAnalysis.cpp index cc45bfa50..d64a3c3e6 100644 --- a/lib/smack/DSAAliasAnalysis.cpp +++ b/lib/smack/DSAAliasAnalysis.cpp @@ -12,14 +12,6 @@ // //===----------------------------------------------------------------------===// -#include "llvm/ADT/EquivalenceClasses.h" -#include "llvm/Analysis/AliasAnalysis.h" -#include "llvm/Analysis/Passes.h" -#include "llvm/IR/Constants.h" -#include "llvm/IR/DerivedTypes.h" -#include "llvm/IR/Module.h" -#include "dsa/DataStructure.h" -#include "dsa/DSGraph.h" #include "smack/DSAAliasAnalysis.h" namespace smack { From ecf071b09f679d9db77edf1e844b046607d5d21d Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Wed, 22 Oct 2014 14:37:38 -0600 Subject: [PATCH 103/140] Switched to a newer version of boogie, corral, and Z3. Corral now implements static inlining. --- bin/build-linux-cmake.sh | 6 +++--- bin/build-linux.sh | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bin/build-linux-cmake.sh b/bin/build-linux-cmake.sh index fffe75210..f21671e88 100755 --- a/bin/build-linux-cmake.sh +++ b/bin/build-linux-cmake.sh @@ -136,7 +136,7 @@ mkdir -p ${Z3_DIR}/install # Get Z3 cd ${Z3_DIR}/src/ -wget "http://download-codeplex.sec.s-msft.com/Download/SourceControlFileDownload.ashx?ProjectName=z3&changeSetId=4995ce1fdee47ffd61d4726c89ff908f468d6450" +wget "http://download-codeplex.sec.s-msft.com/Download/SourceControlFileDownload.ashx?ProjectName=z3&changeSetId=93337fedebefdb072066f2219efe69c80adc2647" unzip -o SourceControlFileDownload* rm -f SourceControlFileDownload* @@ -164,7 +164,7 @@ echo -e "${textcolor}*** SMACK BUILD: Installing Boogie ***${nocolor}" mkdir -p ${BOOGIE_DIR} # Get Boogie -hg clone -r b388523c1c71 https://hg.codeplex.com/boogie ${BOOGIE_DIR} +hg clone -r 02815f46a6f1 https://hg.codeplex.com/boogie ${BOOGIE_DIR} # Build Boogie cd ${BOOGIE_DIR}/Source @@ -190,7 +190,7 @@ mkdir -p ${CORRAL_DIR} # Get Corral git clone https://git01.codeplex.com/corral ${CORRAL_DIR} cd ${CORRAL_DIR} -git checkout e476c4252f7e +git checkout 9235ea4f8cd2 # Build Corral cd ${CORRAL_DIR}/references diff --git a/bin/build-linux.sh b/bin/build-linux.sh index a8c4474a6..e8791b323 100755 --- a/bin/build-linux.sh +++ b/bin/build-linux.sh @@ -134,7 +134,7 @@ mkdir -p ${Z3_DIR}/install # Get Z3 cd ${Z3_DIR}/src/ -wget "http://download-codeplex.sec.s-msft.com/Download/SourceControlFileDownload.ashx?ProjectName=z3&changeSetId=4995ce1fdee47ffd61d4726c89ff908f468d6450" +wget "http://download-codeplex.sec.s-msft.com/Download/SourceControlFileDownload.ashx?ProjectName=z3&changeSetId=93337fedebefdb072066f2219efe69c80adc2647" unzip -o SourceControlFileDownload* rm -f SourceControlFileDownload* @@ -162,7 +162,7 @@ echo -e "${textcolor}*** SMACK BUILD: Installing Boogie ***${nocolor}" mkdir -p ${BOOGIE_DIR} # Get Boogie -hg clone -r b388523c1c71 https://hg.codeplex.com/boogie ${BOOGIE_DIR} +hg clone -r 02815f46a6f1 https://hg.codeplex.com/boogie ${BOOGIE_DIR} # Build Boogie cd ${BOOGIE_DIR}/Source @@ -188,7 +188,7 @@ mkdir -p ${CORRAL_DIR} # Get Corral git clone https://git01.codeplex.com/corral ${CORRAL_DIR} cd ${CORRAL_DIR} -git checkout e476c4252f7e +git checkout 9235ea4f8cd2 # Build Corral cd ${CORRAL_DIR}/references From fef1cd22ae17c0aebf0aead9322462c0698eb8e3 Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Wed, 22 Oct 2014 18:22:53 -0600 Subject: [PATCH 104/140] Removed stale and unused bpl prelude file. --- include/smack/prelude-bv.bpl | 128 ----------------------------------- 1 file changed, 128 deletions(-) delete mode 100644 include/smack/prelude-bv.bpl diff --git a/include/smack/prelude-bv.bpl b/include/smack/prelude-bv.bpl deleted file mode 100644 index 1ed5fe594..000000000 --- a/include/smack/prelude-bv.bpl +++ /dev/null @@ -1,128 +0,0 @@ -// SMACK-PRELUDE-BEGIN - -// SMACK Memory Model - -type $ref; -type $ptr; - -function $ptr($ref, int) returns ($ptr); -function $static($ref) returns (bool); -function $size($ref) returns (bv32); -function $obj($ptr) returns ($ref); -function $off($ptr) returns (bv32); - -axiom(forall x:$ptr :: {$obj(x)}{$off(x)} x == $ptr($obj(x), $off(x))); -axiom(forall x_obj:$ref, x_off:bv32 :: {$ptr(x_obj, x_off)} x_obj == $obj($ptr(x_obj, x_off))); -axiom(forall x_obj:$ref, x_off:bv32 :: {$ptr(x_obj, x_off)} x_off == $off($ptr(x_obj, x_off))); - -type $name; -const unique $UNALLOCATED: $name; -const unique $ALLOCATED: $name; -var $Mem: [$ptr] $ptr; -var $Alloc: [$ref] $name; -const unique $NULL: $ref; -axiom $static($NULL); -const $UNDEF: $ptr; - -procedure $alloca(obj_size: bv32) returns (new:$ptr); -modifies $Alloc; -ensures old($Alloc)[$obj(new)] == $UNALLOCATED && $Alloc[$obj(new)] == $ALLOCATED; -ensures !$static($obj(new)); -ensures $off(new) == 0bv32; -ensures $size($obj(new)) == obj_size; -ensures (forall x_obj:$ref :: {$Alloc[x_obj]} x_obj == $obj(new) || old($Alloc)[x_obj] == $Alloc[x_obj]); - -procedure $malloc(obj_size: bv32) returns (new:$ptr); -modifies $Alloc; -ensures old($Alloc)[$obj(new)] == $UNALLOCATED && $Alloc[$obj(new)] == $ALLOCATED; -ensures !$static($obj(new)); -ensures $off(new) == 0bv32; -ensures $size($obj(new)) == obj_size; -ensures (forall x_obj:$ref :: {$Alloc[x_obj]} x_obj == $obj(new) || old($Alloc)[x_obj] == $Alloc[x_obj]); - -procedure $free(pointer: $ptr); -modifies $Alloc; -requires $Alloc[$obj(pointer)] == $ALLOCATED; -// requires !$static($obj(pointer)); -requires $off(pointer) == 0bv32; -ensures $Alloc[$obj(pointer)] != $UNALLOCATED; -ensures (forall x:$ref :: {$Alloc[x]} $obj(pointer) == x || old($Alloc)[x] == $Alloc[x]); - -// SMACK Arithmetic Predicates - -function {:bvbuiltin "bvadd"} $add(p1:bv32, p2:bv32) returns (bv32); -function {:bvbuiltin "bvsub"} $sub(p1:bv32, p2:bv32) returns (bv32); -function {:bvbuiltin "bvmul"} $mul(p1:bv32, p2:bv32) returns (bv32); -function $sdiv(p1:bv32, p2:bv32) returns (bv32); -function $udiv(p1:bv32, p2:bv32) returns (bv32); -function $srem(p1:bv32, p2:bv32) returns (bv32); -function $urem(p1:bv32, p2:bv32) returns (bv32); -function $and(p1:bv32, p2:bv32) returns (bv32); -function $or(p1:bv32, p2:bv32) returns (bv32); -function $xor(p1:bv32, p2:bv32) returns (bv32); -function $lshr(p1:bv32, p2:bv32) returns (bv32); -function $ashr(p1:bv32, p2:bv32) returns (bv32); -function $shl(p1:bv32, p2:bv32) returns (bv32); -function {:bvbuiltin "bvult"} $ult(p1:bv32, p2:bv32) returns (bool); -function {:bvbuiltin "bvugt"} $ugt(p1:bv32, p2:bv32) returns (bool); -function {:bvbuiltin "bvule"} $ule(p1:bv32, p2:bv32) returns (bool); -function {:bvbuiltin "bvuge"} $uge(p1:bv32, p2:bv32) returns (bool); -function {:bvbuiltin "bvslt"} $slt(p1:bv32, p2:bv32) returns (bool); -function {:bvbuiltin "bvsgt"} $sgt(p1:bv32, p2:bv32) returns (bool); -function {:bvbuiltin "bvsle"} $sle(p1:bv32, p2:bv32) returns (bool); -function {:bvbuiltin "bvsge"} $sge(p1:bv32, p2:bv32) returns (bool); - -function $pa(pointer: $ptr, offset: bv32, size: bv32) returns ($ptr); -function $trunc(p:$ptr) returns ($ptr); -function $p2i(p: $ptr) returns ($ptr); -function $i2p(p: $ptr) returns ($ptr); -function $p2b(p: $ptr) returns (bool); -function $b2p(b: bool) returns ($ptr); -function $i2b(i: bv32) returns (bool); -function $b2i(b: bool) returns (bv32); - -// SMACK Arithmetic Axioms - -axiom $and(0bv32,0bv32) == 0bv32; -axiom $and(0bv32,1bv32) == 0bv32; -axiom $and(1bv32,0bv32) == 0bv32; -axiom $and(1bv32,1bv32) == 1bv32; - -axiom $or(0bv32,0bv32) == 0bv32; -axiom $or(0bv32,1bv32) == 1bv32; -axiom $or(1bv32,0bv32) == 1bv32; -axiom $or(1bv32,1bv32) == 1bv32; - -axiom $xor(0bv32,0bv32) == 0bv32; -axiom $xor(0bv32,1bv32) == 1bv32; -axiom $xor(1bv32,0bv32) == 1bv32; -axiom $xor(1bv32,1bv32) == 0bv32; - -axiom (forall p:$ptr, o:bv32, s:bv32 :: {$pa(p,o,s)} $pa(p,o,s) == $ptr($obj(p), $off(p) + o * s)); -axiom (forall p:$ptr, o:bv32, s:bv32 :: {$pa(p,o,s)} $obj($pa(p,o,s)) == $obj(p)); -axiom (forall p:$ptr :: $trunc(p) == p); - -axiom $b2i(true) == 1bv32; -axiom $b2i(false) == 0bv32; -axiom $b2p(true) == $ptr($NULL,1bv32); -axiom $b2p(false) == $ptr($NULL,0bv32); - -axiom (forall i:bv32 :: $i2b(i) <==> i != 0bv32); -axiom $i2b(0bv32) == false; -axiom (forall r:$ref, i:bv32 :: $p2b($ptr(r,i)) <==> i != 0bv32); -axiom $p2b($ptr($NULL,0bv32)) == false; -axiom (forall r:$ref, i:bv32 :: $p2i($ptr(r,i)) == $ptr($NULL,i)); -axiom (forall i:bv32 :: (exists r:$ref :: $i2p($ptr($NULL,i)) == $ptr(r,i))); - -// SMACK Library Procedures - -procedure __SMACK_nondet() returns (p: $ptr); -procedure __SMACK_nondetInt() returns (p: $ptr); -ensures $obj(p) == $NULL; - -procedure boogie_si_record_int(i: bv32); -procedure boogie_si_record_obj(o: $ref); -procedure boogie_si_record_ptr(p: $ptr); - -// SMACK-PRELUDE-END - From ae70a18421739f1ce140f607649970c770409b83 Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Fri, 24 Oct 2014 15:03:51 -0600 Subject: [PATCH 105/140] Implemented more precise generation of sourceloc debug info for Corral. In particular, we have to drop debug info attached to llvm.dbg function invocations since those point to variable declaration locations and such. --- lib/smack/SmackInstGenerator.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/smack/SmackInstGenerator.cpp b/lib/smack/SmackInstGenerator.cpp index 013600b79..57e5213b5 100644 --- a/lib/smack/SmackInstGenerator.cpp +++ b/lib/smack/SmackInstGenerator.cpp @@ -58,6 +58,16 @@ void SmackInstGenerator::nameInstruction(llvm::Instruction& inst) { void SmackInstGenerator::annotate(llvm::Instruction& i, Block* b) { + // do not generate sourceloc from calls to llvm.debug since + // those point to variable declaration lines and such + if (llvm::CallInst* ci = llvm::dyn_cast(&i)) { + llvm::Function* f = ci->getCalledFunction(); + string name = f && f->hasName() ? f->getName().str() : ""; + if (name.find("llvm.dbg.") != string::npos) { + return; + } + } + if (llvm::MDNode* n = i.getMetadata("dbg")) { llvm::DILocation l(n); From 320a14d0b0d04b6f0a0e47118ae0bf68ff816b43 Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Sun, 26 Oct 2014 10:12:56 -0600 Subject: [PATCH 106/140] Switched to using the newest Z3 stable release (4.3.2). --- bin/build-linux-cmake.sh | 2 +- bin/build-linux.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/build-linux-cmake.sh b/bin/build-linux-cmake.sh index f21671e88..ee05cb3c0 100755 --- a/bin/build-linux-cmake.sh +++ b/bin/build-linux-cmake.sh @@ -136,7 +136,7 @@ mkdir -p ${Z3_DIR}/install # Get Z3 cd ${Z3_DIR}/src/ -wget "http://download-codeplex.sec.s-msft.com/Download/SourceControlFileDownload.ashx?ProjectName=z3&changeSetId=93337fedebefdb072066f2219efe69c80adc2647" +wget "http://download-codeplex.sec.s-msft.com/Download/SourceControlFileDownload.ashx?ProjectName=z3&changeSetId=cee7dd39444c9060186df79c2a2c7f8845de415b" unzip -o SourceControlFileDownload* rm -f SourceControlFileDownload* diff --git a/bin/build-linux.sh b/bin/build-linux.sh index e8791b323..72ccc1aae 100755 --- a/bin/build-linux.sh +++ b/bin/build-linux.sh @@ -134,7 +134,7 @@ mkdir -p ${Z3_DIR}/install # Get Z3 cd ${Z3_DIR}/src/ -wget "http://download-codeplex.sec.s-msft.com/Download/SourceControlFileDownload.ashx?ProjectName=z3&changeSetId=93337fedebefdb072066f2219efe69c80adc2647" +wget "http://download-codeplex.sec.s-msft.com/Download/SourceControlFileDownload.ashx?ProjectName=z3&changeSetId=cee7dd39444c9060186df79c2a2c7f8845de415b" unzip -o SourceControlFileDownload* rm -f SourceControlFileDownload* From f8c0d6ad94ef52597fca4fb241e7dd7b5eb80fee Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Sun, 26 Oct 2014 10:15:54 -0600 Subject: [PATCH 107/140] Use no-reuse-impls by default. --- bin/llvm2bpl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/llvm2bpl.py b/bin/llvm2bpl.py index ade6e8966..fa6517ec4 100755 --- a/bin/llvm2bpl.py +++ b/bin/llvm2bpl.py @@ -31,7 +31,7 @@ def llvm2bplParser(): help='output Boogie file (default: %(default)s)') parser.add_argument('-d', '--debug', dest='debug', action="store_true", default=False, help='turn on debug info') - parser.add_argument('--mem-mod', dest='memmod', choices=['no-reuse', 'no-reuse-impls', 'reuse'], default='no-reuse', + parser.add_argument('--mem-mod', dest='memmod', choices=['no-reuse', 'no-reuse-impls', 'reuse'], default='no-reuse-impls', help='set the memory model (no-reuse=never reallocate the same address, reuse=reallocate freed addresses)') return parser From 521bb4762e96ce8eceb019bc99bf2e4d444401fd Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Sun, 26 Oct 2014 10:23:04 -0600 Subject: [PATCH 108/140] Fixed contracts regressions script to use no-reuse memory model. --- test/contracts/run.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/contracts/run.py b/test/contracts/run.py index 1b4e37f8b..082711ab2 100755 --- a/test/contracts/run.py +++ b/test/contracts/run.py @@ -29,7 +29,7 @@ def expect(file): # invoke SMACK t0 = time.time() - cmd = ['smackverify.py', test, '--verifier=boogie'] + cmd = ['smackverify.py', test, '--verifier=boogie', '--mem-mod=no-reuse'] p = subprocess.Popen(cmd, stdout=subprocess.PIPE) # check SMACK output From 8b5cbd656e91f4d192d144337c98337eaf7a05d6 Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Sun, 26 Oct 2014 13:25:44 -0600 Subject: [PATCH 109/140] Include smack.h through command line by default. --- bin/smackgen.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/smackgen.py b/bin/smackgen.py index 672006c57..c6cbb24be 100755 --- a/bin/smackgen.py +++ b/bin/smackgen.py @@ -68,7 +68,8 @@ def clang(scriptPathName, inputFile, bcFileName, outputFileName, memoryModel, cl clangCommand += ['-c', '-emit-llvm', '-O0', '-g', '-gcolumn-info', '-DMEMORY_MODEL_' + memoryModel.upper().replace('-','_'), - '-I' + smackHeaders] + '-I' + smackHeaders, + '-include' + 'smack.h'] clangCommand += clangArgs.split() clangCommand += [inputFile.name, '-o', bcFileName] #Redirect stderr to stdout, then grab stdout (communicate() calls wait()) From 4fb45dba765d1d2ce6a84e074f8d028af8c7ec05 Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Sun, 26 Oct 2014 14:13:20 -0600 Subject: [PATCH 110/140] Defined division and remainder. --- include/smack/smack.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/smack/smack.h b/include/smack/smack.h index 9cae484e2..2aa482169 100644 --- a/include/smack/smack.h +++ b/include/smack/smack.h @@ -62,10 +62,10 @@ void __SMACK_decls() { D("function {:inline} $add(p1:int, p2:int) returns (int) {p1 + p2}"); D("function {:inline} $sub(p1:int, p2:int) returns (int) {p1 - p2}"); D("function {:inline} $mul(p1:int, p2:int) returns (int) {p1 * p2}"); - D("function $sdiv(p1:int, p2:int) returns (int);"); - D("function $udiv(p1:int, p2:int) returns (int);"); - D("function $srem(p1:int, p2:int) returns (int);"); - D("function $urem(p1:int, p2:int) returns (int);"); + D("function {:builtin \"div\"} $sdiv(p1:int, p2:int) returns (int);"); + D("function {:builtin \"div\"} $udiv(p1:int, p2:int) returns (int);"); + D("function {:builtin \"rem\"} $srem(p1:int, p2:int) returns (int);"); + D("function {:builtin \"rem\"} $urem(p1:int, p2:int) returns (int);"); D("function $and(p1:int, p2:int) returns (int);"); D("axiom $and(0,0) == 0;"); D("axiom $and(0,1) == 0;"); From f3ae95abd58b6313f583a8b6d7ea7e71899008dd Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Sun, 26 Oct 2014 14:23:46 -0600 Subject: [PATCH 111/140] Implemented support for static float initializers. --- include/smack/SmackRep.h | 2 +- lib/smack/SmackRep.cpp | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/include/smack/SmackRep.h b/include/smack/SmackRep.h index 5729c0fc1..4a2bafde8 100644 --- a/include/smack/SmackRep.h +++ b/include/smack/SmackRep.h @@ -167,7 +167,7 @@ class SmackRep { bool isBool(llvm::Type* t); bool isBool(const llvm::Value* v); bool isFloat(llvm::Type* t); - bool isFloat(llvm::Value* v); + bool isFloat(const llvm::Value* v); unsigned storageSize(llvm::Type* t); unsigned fieldOffset(llvm::StructType* t, unsigned fieldNo); diff --git a/lib/smack/SmackRep.cpp b/lib/smack/SmackRep.cpp index 798ccd6ea..f3154d358 100644 --- a/lib/smack/SmackRep.cpp +++ b/lib/smack/SmackRep.cpp @@ -133,7 +133,7 @@ bool SmackRep::isFloat(llvm::Type* t) { return t->isFloatingPointTy(); } -bool SmackRep::isFloat(llvm::Value* v) { +bool SmackRep::isFloat(const llvm::Value* v) { return isFloat(v->getType()); } @@ -818,7 +818,10 @@ void SmackRep::addInit(unsigned region, const Expr* addr, const llvm::Constant* if (isInt(val)) { staticInits.push_back( Stmt::assign(mem(region,addr), expr(val)) ); - + + } else if (isFloat(val)) { + staticInits.push_back( Stmt::assign(mem(region,addr), fp2si(val)) ); + } else if (isa(val->getType())) { staticInits.push_back( Stmt::assign(mem(region,addr), expr(val)) ); From 3a062d57a3e6012dccdfa5b2142116385b23ba67 Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Sun, 26 Oct 2014 16:27:44 -0600 Subject: [PATCH 112/140] Added __VERIFIER_nondet_pointer. --- include/smack/smack-svcomp.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/include/smack/smack-svcomp.h b/include/smack/smack-svcomp.h index e98c1ad41..2c880e945 100644 --- a/include/smack/smack-svcomp.h +++ b/include/smack/smack-svcomp.h @@ -19,22 +19,26 @@ void __VERIFIER_assume(int v) { } // Types to be overloaded for: {bool, char, int, float, loff_t, long, pchar, -// pointer, pthread_t, sector_t, short, size_t, u32, uchar, ulong, +// pthread_t, sector_t, short, size_t, u32, uchar, ulong, // unsigned, ushort} -char __VERIFIER_nondet_char() { +char __VERIFIER_nondet_char(void) { return (char)__SMACK_nondet(); } -int __VERIFIER_nondet_int() { +int __VERIFIER_nondet_int(void) { return __SMACK_nondet(); } -unsigned __VERIFIER_nondet_uint() { +unsigned __VERIFIER_nondet_uint(void) { int x = __SMACK_nondet(); assume(x >= 0); return (unsigned)x; } +void* __VERIFIER_nondet_pointer(void) { + return (void*)__SMACK_nondet(); +} + #endif From 1fd6f44dd1d8b1a86c8a263f25996933613384f3 Mon Sep 17 00:00:00 2001 From: Michael Emmi Date: Mon, 27 Oct 2014 22:02:47 +0100 Subject: [PATCH 113/140] Avoiding spurious contract function name matches. --- lib/smack/Contracts.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/smack/Contracts.cpp b/lib/smack/Contracts.cpp index 8096e6834..d8aa53c3d 100644 --- a/lib/smack/Contracts.cpp +++ b/lib/smack/Contracts.cpp @@ -39,34 +39,35 @@ bool looksLikeLoopHead(BasicBlock* B) { void ContractsExtractor::visitCallInst(CallInst& ci) { Function* f = ci.getCalledFunction(); + string name = f && f->hasName() ? f->getName().str() : ""; - if (f && naming.get(*f).find("forall") != string::npos) { + if (name == "forall") { assert(ci.getNumArgOperands() == 2 && "Unexpected operands to forall."); Value* arg = ci.getArgOperand(1); ci.setArgOperand(1,sliceIdx(ci.getContext())); slices.push_back(extractSlice(arg)); - } else if (f && naming.get(*f).find("exists") != string::npos) { + } else if (name == "exists") { assert(ci.getNumArgOperands() == 2 && "Unexpected operands to exists."); Value* arg = ci.getArgOperand(1); ci.setArgOperand(1,sliceIdx(ci.getContext())); slices.push_back(extractSlice(arg)); - } else if (f && naming.get(*f).find("requires") != string::npos) { + } else if (name == "requires") { assert(ci.getNumArgOperands() == 1 && "Unexpected operands to requires."); Value* V = ci.getArgOperand(0); ci.setArgOperand(0,ConstantInt::getTrue(ci.getContext())); proc.addRequires(extractSlice(V)->getBoogieExpression(naming,rep)); ci.eraseFromParent(); - } else if (f && naming.get(*f).find("ensures") != string::npos) { + } else if (name == "ensures") { assert(ci.getNumArgOperands() == 1 && "Unexpected operands to ensures."); Value* V = ci.getArgOperand(0); ci.setArgOperand(0,ConstantInt::getTrue(ci.getContext())); proc.addEnsures(extractSlice(V)->getBoogieExpression(naming,rep)); ci.eraseFromParent(); - } else if (f && naming.get(*f).find("invariant") != string::npos) { + } else if (name == "invariant") { assert(ci.getNumArgOperands() == 1 && "Unexpected operands to invariant."); BasicBlock* body = ci.getParent(); From 16046d28de384e1aea0cc37f348743c54c404365 Mon Sep 17 00:00:00 2001 From: Michael Emmi Date: Mon, 27 Oct 2014 23:14:17 +0100 Subject: [PATCH 114/140] Handling more constant expressions. --- include/smack/SmackRep.h | 12 ++--- lib/smack/SmackInstGenerator.cpp | 12 ++--- lib/smack/SmackRep.cpp | 78 +++++++++++++++++--------------- 3 files changed, 54 insertions(+), 48 deletions(-) diff --git a/include/smack/SmackRep.h b/include/smack/SmackRep.h index 4a2bafde8..e0387798f 100644 --- a/include/smack/SmackRep.h +++ b/include/smack/SmackRep.h @@ -203,12 +203,12 @@ class SmackRep { virtual const Expr* sext(const llvm::Value* v, llvm::Type* t); virtual const Expr* fptrunc(const llvm::Value* v, llvm::Type* t); virtual const Expr* fpext(const llvm::Value* v, llvm::Type* t); - virtual const Expr* fp2ui(const llvm::Value* v); - virtual const Expr* fp2si(const llvm::Value* v); - virtual const Expr* ui2fp(const llvm::Value* v); - virtual const Expr* si2fp(const llvm::Value* v); - virtual const Expr* p2i(const llvm::Value* v); - virtual const Expr* i2p(const llvm::Value* v); + virtual const Expr* fp2ui(const llvm::Value* v, llvm::Type* t); + virtual const Expr* fp2si(const llvm::Value* v, llvm::Type* t); + virtual const Expr* ui2fp(const llvm::Value* v, llvm::Type* t); + virtual const Expr* si2fp(const llvm::Value* v, llvm::Type* t); + virtual const Expr* p2i(const llvm::Value* v, llvm::Type* t); + virtual const Expr* i2p(const llvm::Value* v, llvm::Type* t); virtual const Expr* bitcast(const llvm::Value* v, llvm::Type* t); virtual const Stmt* alloca(llvm::AllocaInst& i); diff --git a/lib/smack/SmackInstGenerator.cpp b/lib/smack/SmackInstGenerator.cpp index 57e5213b5..2c14a1b82 100644 --- a/lib/smack/SmackInstGenerator.cpp +++ b/lib/smack/SmackInstGenerator.cpp @@ -465,32 +465,32 @@ void SmackInstGenerator::visitFPExtInst(llvm::FPExtInst& i) { void SmackInstGenerator::visitFPToUIInst(llvm::FPToUIInst& i) { processInstruction(i); - emit(Stmt::assign(rep.expr(&i),rep.fp2ui(i.getOperand(0)))); + emit(Stmt::assign(rep.expr(&i),rep.fp2ui(i.getOperand(0),i.getType()))); } void SmackInstGenerator::visitFPToSIInst(llvm::FPToSIInst& i) { processInstruction(i); - emit(Stmt::assign(rep.expr(&i),rep.fp2si(i.getOperand(0)))); + emit(Stmt::assign(rep.expr(&i),rep.fp2si(i.getOperand(0),i.getType()))); } void SmackInstGenerator::visitUIToFPInst(llvm::UIToFPInst& i) { processInstruction(i); - emit(Stmt::assign(rep.expr(&i),rep.ui2fp(i.getOperand(0)))); + emit(Stmt::assign(rep.expr(&i),rep.ui2fp(i.getOperand(0),i.getType()))); } void SmackInstGenerator::visitSIToFPInst(llvm::SIToFPInst& i) { processInstruction(i); - emit(Stmt::assign(rep.expr(&i),rep.si2fp(i.getOperand(0)))); + emit(Stmt::assign(rep.expr(&i),rep.si2fp(i.getOperand(0),i.getType()))); } void SmackInstGenerator::visitPtrToIntInst(llvm::PtrToIntInst& i) { processInstruction(i); - emit(Stmt::assign(rep.expr(&i),rep.p2i(i.getOperand(0)))); + emit(Stmt::assign(rep.expr(&i),rep.p2i(i.getOperand(0),i.getType()))); } void SmackInstGenerator::visitIntToPtrInst(llvm::IntToPtrInst& i) { processInstruction(i); - emit(Stmt::assign(rep.expr(&i),rep.i2p(i.getOperand(0)))); + emit(Stmt::assign(rep.expr(&i),rep.i2p(i.getOperand(0),i.getType()))); } void SmackInstGenerator::visitBitCastInst(llvm::BitCastInst& ci) { diff --git a/lib/smack/SmackRep.cpp b/lib/smack/SmackRep.cpp index f3154d358..1f38f61ab 100644 --- a/lib/smack/SmackRep.cpp +++ b/lib/smack/SmackRep.cpp @@ -238,22 +238,22 @@ const Expr* SmackRep::fptrunc(const llvm::Value* v, llvm::Type* t) { const Expr* SmackRep::fpext(const llvm::Value* v, llvm::Type* t) { return expr(v); } -const Expr* SmackRep::fp2ui(const llvm::Value* v) { +const Expr* SmackRep::fp2ui(const llvm::Value* v, llvm::Type* t) { return Expr::fn(FP2UI, expr(v)); } -const Expr* SmackRep::fp2si(const llvm::Value* v) { +const Expr* SmackRep::fp2si(const llvm::Value* v, llvm::Type* t) { return Expr::fn(FP2SI, expr(v)); } -const Expr* SmackRep::ui2fp(const llvm::Value* v) { +const Expr* SmackRep::ui2fp(const llvm::Value* v, llvm::Type* t) { return Expr::fn(UI2FP, expr(v)); } -const Expr* SmackRep::si2fp(const llvm::Value* v) { +const Expr* SmackRep::si2fp(const llvm::Value* v, llvm::Type* t) { return Expr::fn(SI2FP, expr(v)); } -const Expr* SmackRep::p2i(const llvm::Value* v) { +const Expr* SmackRep::p2i(const llvm::Value* v, llvm::Type* t) { return Expr::fn(P2I, expr(v)); } -const Expr* SmackRep::i2p(const llvm::Value* v) { +const Expr* SmackRep::i2p(const llvm::Value* v, llvm::Type* t) { return Expr::fn(I2P, expr(v)); } const Expr* SmackRep::bitcast(const llvm::Value* v, llvm::Type* t) { @@ -408,39 +408,43 @@ const Expr* SmackRep::expr(const llvm::Value* v) { else if (const Constant* constant = dyn_cast(v)) { - if (const ConstantExpr* constantExpr = dyn_cast(constant)) { + if (const ConstantExpr* CE = dyn_cast(constant)) { - if (constantExpr->getOpcode() == Instruction::GetElementPtr) { - - vector ps; - vector ts; - llvm::gep_type_iterator typeI = gep_type_begin(constantExpr); - for (unsigned i = 1; i < constantExpr->getNumOperands(); i++, ++typeI) { - ps.push_back(constantExpr->getOperand(i)); + if (CE->getOpcode() == Instruction::GetElementPtr) { + vector ps; + vector ts; + gep_type_iterator typeI = gep_type_begin(CE); + for (unsigned i = 1; i < CE->getNumOperands(); i++, ++typeI) { + ps.push_back(CE->getOperand(i)); ts.push_back(*typeI); } - return ptrArith(constantExpr->getOperand(0), ps, ts); - - } else if (constantExpr->getOpcode() == Instruction::BitCast) - - // TODO: currently this is a noop instruction - return expr(constantExpr->getOperand(0)); - - else if (constantExpr->getOpcode() == Instruction::IntToPtr) - - // TODO test this out, formerly Expr::id("$UNDEF"); - return i2p(constantExpr->getOperand(0)); - - else if (constantExpr->getOpcode() == Instruction::PtrToInt) - - // TODO test this out, formerly Expr::id("$UNDEF"); - return p2i(constantExpr->getOperand(0)); + return ptrArith(CE->getOperand(0), ps, ts); + + } else if (CE->isCast()) { + Value* v = CE->getOperand(0); + Type* t = CE->getType(); + switch (CE->getOpcode()) { + case Instruction::Trunc: return trunc(v,t); + case Instruction::ZExt: return zext(v,t); + case Instruction::SExt: return sext(v,t); + case Instruction::FPTrunc: return fptrunc(v,t); + case Instruction::FPExt: return fpext(v,t); + case Instruction::FPToUI: return fp2ui(v,t); + case Instruction::FPToSI: return fp2si(v,t); + case Instruction::UIToFP: return ui2fp(v,t); + case Instruction::SIToFP: return si2fp(v,t); + case Instruction::PtrToInt: return p2i(v,t); + case Instruction::IntToPtr: return i2p(v,t); + case Instruction::BitCast: return bitcast(v,t); + default: + assert(false && "Unexpected constant cast expression."); + } - else if (Instruction::isBinaryOp(constantExpr->getOpcode())) - return op(constantExpr); + } else if (Instruction::isBinaryOp(CE->getOpcode())) + return op(CE); - else if (constantExpr->isCompare()) - return pred(constantExpr); + else if (CE->isCompare()) + return pred(CE); else { DEBUG(errs() << "VALUE : " << *v << "\n"); @@ -711,7 +715,8 @@ ProcDecl* SmackRep::proc(llvm::Function* f, int nargs) { } const Expr* SmackRep::arg(llvm::Function* f, unsigned pos, llvm::Value* v) { - return (f && f->isVarArg() && isFloat(v)) ? fp2si(v) : expr(v); + // TODO take care with this call to fp2si + return (f && f->isVarArg() && isFloat(v)) ? fp2si(v,0) : expr(v); } const Stmt* SmackRep::call(llvm::Function* f, llvm::User& ci) { @@ -820,7 +825,8 @@ void SmackRep::addInit(unsigned region, const Expr* addr, const llvm::Constant* staticInits.push_back( Stmt::assign(mem(region,addr), expr(val)) ); } else if (isFloat(val)) { - staticInits.push_back( Stmt::assign(mem(region,addr), fp2si(val)) ); + // TODO take care with this call to fp2si + staticInits.push_back( Stmt::assign(mem(region,addr), fp2si(val,0)) ); } else if (isa(val->getType())) { staticInits.push_back( Stmt::assign(mem(region,addr), expr(val)) ); From b6fc83f40c0e0f61bd051ffff472de99aec32420 Mon Sep 17 00:00:00 2001 From: Michael Emmi Date: Mon, 27 Oct 2014 23:45:40 +0100 Subject: [PATCH 115/140] Cleaned up casting. --- include/smack/SmackRep.h | 20 ++---- lib/smack/SmackInstGenerator.cpp | 78 ++++++++++---------- lib/smack/SmackRep.cpp | 118 +++++++++++++------------------ 3 files changed, 91 insertions(+), 125 deletions(-) diff --git a/include/smack/SmackRep.h b/include/smack/SmackRep.h index e0387798f..0a2472d9a 100644 --- a/include/smack/SmackRep.h +++ b/include/smack/SmackRep.h @@ -164,9 +164,9 @@ class SmackRep { bool isIgnore(llvm::Function* f); bool isInt(const llvm::Type* t); bool isInt(const llvm::Value* v); - bool isBool(llvm::Type* t); + bool isBool(const llvm::Type* t); bool isBool(const llvm::Value* v); - bool isFloat(llvm::Type* t); + bool isFloat(const llvm::Type* t); bool isFloat(const llvm::Value* v); unsigned storageSize(llvm::Type* t); @@ -190,6 +190,9 @@ class SmackRep { vector ts); const Expr* expr(const llvm::Value* v); string getString(const llvm::Value* v); + const Expr* cast(const llvm::Instruction* I); + const Expr* cast(const llvm::ConstantExpr* CE); + const Expr* cast(unsigned opcode, const llvm::Value* v, const llvm::Type* t); const Expr* op(const llvm::User* v); const Expr* pred(const llvm::User* v); @@ -197,19 +200,6 @@ class SmackRep { const Stmt* call(llvm::Function* f, llvm::User& u); string code(llvm::CallInst& ci); ProcDecl* proc(llvm::Function* f, int n); - - virtual const Expr* trunc(const llvm::Value* v, llvm::Type* t); - virtual const Expr* zext(const llvm::Value* v, llvm::Type* t); - virtual const Expr* sext(const llvm::Value* v, llvm::Type* t); - virtual const Expr* fptrunc(const llvm::Value* v, llvm::Type* t); - virtual const Expr* fpext(const llvm::Value* v, llvm::Type* t); - virtual const Expr* fp2ui(const llvm::Value* v, llvm::Type* t); - virtual const Expr* fp2si(const llvm::Value* v, llvm::Type* t); - virtual const Expr* ui2fp(const llvm::Value* v, llvm::Type* t); - virtual const Expr* si2fp(const llvm::Value* v, llvm::Type* t); - virtual const Expr* p2i(const llvm::Value* v, llvm::Type* t); - virtual const Expr* i2p(const llvm::Value* v, llvm::Type* t); - virtual const Expr* bitcast(const llvm::Value* v, llvm::Type* t); virtual const Stmt* alloca(llvm::AllocaInst& i); virtual const Stmt* memcpy(const llvm::MemCpyInst& msi); diff --git a/lib/smack/SmackInstGenerator.cpp b/lib/smack/SmackInstGenerator.cpp index 2c14a1b82..637e43bac 100644 --- a/lib/smack/SmackInstGenerator.cpp +++ b/lib/smack/SmackInstGenerator.cpp @@ -433,70 +433,64 @@ void SmackInstGenerator::visitGetElementPtrInst(llvm::GetElementPtrInst& gepi) { /* CONVERSION OPERATIONS */ /******************************************************************************/ -void SmackInstGenerator::visitTruncInst(llvm::TruncInst& ti) { - processInstruction(ti); - emit(Stmt::assign(rep.expr(&ti), - rep.trunc(ti.getOperand(0),ti.getType()))); +void SmackInstGenerator::visitTruncInst(llvm::TruncInst& I) { + processInstruction(I); + emit(Stmt::assign(rep.expr(&I),rep.cast(&I))); } -void SmackInstGenerator::visitZExtInst(llvm::ZExtInst& ci) { - processInstruction(ci); - emit(Stmt::assign(rep.expr(&ci), - rep.zext(ci.getOperand(0),ci.getType()))); +void SmackInstGenerator::visitZExtInst(llvm::ZExtInst& I) { + processInstruction(I); + emit(Stmt::assign(rep.expr(&I),rep.cast(&I))); } -void SmackInstGenerator::visitSExtInst(llvm::SExtInst& ci) { - processInstruction(ci); - emit(Stmt::assign(rep.expr(&ci), - rep.sext(ci.getOperand(0),ci.getType()))); +void SmackInstGenerator::visitSExtInst(llvm::SExtInst& I) { + processInstruction(I); + emit(Stmt::assign(rep.expr(&I),rep.cast(&I))); } -void SmackInstGenerator::visitFPTruncInst(llvm::FPTruncInst& i) { - processInstruction(i); - emit(Stmt::assign(rep.expr(&i), - rep.fptrunc(i.getOperand(0),i.getType()))); +void SmackInstGenerator::visitFPTruncInst(llvm::FPTruncInst& I) { + processInstruction(I); + emit(Stmt::assign(rep.expr(&I),rep.cast(&I))); } -void SmackInstGenerator::visitFPExtInst(llvm::FPExtInst& i) { - processInstruction(i); - emit(Stmt::assign(rep.expr(&i), - rep.fpext(i.getOperand(0),i.getType()))); +void SmackInstGenerator::visitFPExtInst(llvm::FPExtInst& I) { + processInstruction(I); + emit(Stmt::assign(rep.expr(&I),rep.cast(&I))); } -void SmackInstGenerator::visitFPToUIInst(llvm::FPToUIInst& i) { - processInstruction(i); - emit(Stmt::assign(rep.expr(&i),rep.fp2ui(i.getOperand(0),i.getType()))); +void SmackInstGenerator::visitFPToUIInst(llvm::FPToUIInst& I) { + processInstruction(I); + emit(Stmt::assign(rep.expr(&I),rep.cast(&I))); } -void SmackInstGenerator::visitFPToSIInst(llvm::FPToSIInst& i) { - processInstruction(i); - emit(Stmt::assign(rep.expr(&i),rep.fp2si(i.getOperand(0),i.getType()))); +void SmackInstGenerator::visitFPToSIInst(llvm::FPToSIInst& I) { + processInstruction(I); + emit(Stmt::assign(rep.expr(&I),rep.cast(&I))); } -void SmackInstGenerator::visitUIToFPInst(llvm::UIToFPInst& i) { - processInstruction(i); - emit(Stmt::assign(rep.expr(&i),rep.ui2fp(i.getOperand(0),i.getType()))); +void SmackInstGenerator::visitUIToFPInst(llvm::UIToFPInst& I) { + processInstruction(I); + emit(Stmt::assign(rep.expr(&I),rep.cast(&I))); } -void SmackInstGenerator::visitSIToFPInst(llvm::SIToFPInst& i) { - processInstruction(i); - emit(Stmt::assign(rep.expr(&i),rep.si2fp(i.getOperand(0),i.getType()))); +void SmackInstGenerator::visitSIToFPInst(llvm::SIToFPInst& I) { + processInstruction(I); + emit(Stmt::assign(rep.expr(&I),rep.cast(&I))); } -void SmackInstGenerator::visitPtrToIntInst(llvm::PtrToIntInst& i) { - processInstruction(i); - emit(Stmt::assign(rep.expr(&i),rep.p2i(i.getOperand(0),i.getType()))); +void SmackInstGenerator::visitPtrToIntInst(llvm::PtrToIntInst& I) { + processInstruction(I); + emit(Stmt::assign(rep.expr(&I),rep.cast(&I))); } -void SmackInstGenerator::visitIntToPtrInst(llvm::IntToPtrInst& i) { - processInstruction(i); - emit(Stmt::assign(rep.expr(&i),rep.i2p(i.getOperand(0),i.getType()))); +void SmackInstGenerator::visitIntToPtrInst(llvm::IntToPtrInst& I) { + processInstruction(I); + emit(Stmt::assign(rep.expr(&I),rep.cast(&I))); } -void SmackInstGenerator::visitBitCastInst(llvm::BitCastInst& ci) { - processInstruction(ci); - emit(Stmt::assign(rep.expr(&ci), - rep.bitcast(ci.getOperand(0),ci.getType()))); +void SmackInstGenerator::visitBitCastInst(llvm::BitCastInst& I) { + processInstruction(I); + emit(Stmt::assign(rep.expr(&I),rep.cast(&I))); } /******************************************************************************/ diff --git a/lib/smack/SmackRep.cpp b/lib/smack/SmackRep.cpp index 1f38f61ab..203e2b17c 100644 --- a/lib/smack/SmackRep.cpp +++ b/lib/smack/SmackRep.cpp @@ -121,7 +121,7 @@ bool SmackRep::isInt(const llvm::Value* v) { return isInt(v->getType()); } -bool SmackRep::isBool(llvm::Type* t) { +bool SmackRep::isBool(const llvm::Type* t) { return t->isIntegerTy(1); } @@ -129,7 +129,7 @@ bool SmackRep::isBool(const llvm::Value* v) { return isBool(v->getType()); } -bool SmackRep::isFloat(llvm::Type* t) { +bool SmackRep::isFloat(const llvm::Type* t) { return t->isFloatingPointTy(); } @@ -218,48 +218,6 @@ void SmackRep::collectRegions(llvm::Module &M) { rc.visit(M); } -const Expr* SmackRep::trunc(const llvm::Value* v, llvm::Type* t) { - assert(t->isIntegerTy() && "TODO: implement truncate for non-integer types."); - const Expr* e = expr(v); - - return isBool(t) - ? Expr::fn(I2B,e) - : Expr::fn(TRUNC,e,lit(t->getPrimitiveSizeInBits())); -} -const Expr* SmackRep::zext(const llvm::Value* v, llvm::Type* t) { - return isBool(v->getType()) ? b2p(v) : expr(v); -} -const Expr* SmackRep::sext(const llvm::Value* v, llvm::Type* t) { - return isBool(v->getType()) ? b2p(v) : expr(v); -} -const Expr* SmackRep::fptrunc(const llvm::Value* v, llvm::Type* t) { - return expr(v); -} -const Expr* SmackRep::fpext(const llvm::Value* v, llvm::Type* t) { - return expr(v); -} -const Expr* SmackRep::fp2ui(const llvm::Value* v, llvm::Type* t) { - return Expr::fn(FP2UI, expr(v)); -} -const Expr* SmackRep::fp2si(const llvm::Value* v, llvm::Type* t) { - return Expr::fn(FP2SI, expr(v)); -} -const Expr* SmackRep::ui2fp(const llvm::Value* v, llvm::Type* t) { - return Expr::fn(UI2FP, expr(v)); -} -const Expr* SmackRep::si2fp(const llvm::Value* v, llvm::Type* t) { - return Expr::fn(SI2FP, expr(v)); -} -const Expr* SmackRep::p2i(const llvm::Value* v, llvm::Type* t) { - return Expr::fn(P2I, expr(v)); -} -const Expr* SmackRep::i2p(const llvm::Value* v, llvm::Type* t) { - return Expr::fn(I2P, expr(v)); -} -const Expr* SmackRep::bitcast(const llvm::Value* v, llvm::Type* t) { - return expr(v); -} - const Stmt* SmackRep::alloca(llvm::AllocaInst& i) { const Expr* size = Expr::fn(MUL,lit(storageSize(i.getAllocatedType())),lit(i.getArraySize())); @@ -420,27 +378,10 @@ const Expr* SmackRep::expr(const llvm::Value* v) { } return ptrArith(CE->getOperand(0), ps, ts); - } else if (CE->isCast()) { - Value* v = CE->getOperand(0); - Type* t = CE->getType(); - switch (CE->getOpcode()) { - case Instruction::Trunc: return trunc(v,t); - case Instruction::ZExt: return zext(v,t); - case Instruction::SExt: return sext(v,t); - case Instruction::FPTrunc: return fptrunc(v,t); - case Instruction::FPExt: return fpext(v,t); - case Instruction::FPToUI: return fp2ui(v,t); - case Instruction::FPToSI: return fp2si(v,t); - case Instruction::UIToFP: return ui2fp(v,t); - case Instruction::SIToFP: return si2fp(v,t); - case Instruction::PtrToInt: return p2i(v,t); - case Instruction::IntToPtr: return i2p(v,t); - case Instruction::BitCast: return bitcast(v,t); - default: - assert(false && "Unexpected constant cast expression."); - } + } else if (CE->isCast()) + return cast(CE); - } else if (Instruction::isBinaryOp(CE->getOpcode())) + else if (Instruction::isBinaryOp(CE->getOpcode())) return op(CE); else if (CE->isCompare()) @@ -483,6 +424,49 @@ string SmackRep::getString(const llvm::Value* v) { return ""; } +const Expr* SmackRep::cast(const llvm::Instruction* I) { + return cast(I->getOpcode(), I->getOperand(0), I->getType()); +} + +const Expr* SmackRep::cast(const llvm::ConstantExpr* CE) { + return cast(CE->getOpcode(), CE->getOperand(0), CE->getType()); +} + +const Expr* SmackRep::cast(unsigned opcode, const llvm::Value* v, const llvm::Type* t) { + using namespace llvm; + switch (opcode) { + case Instruction::Trunc: + assert(t->isIntegerTy() && "TODO: implement truncate for non-integer types."); + return isBool(t) + ? Expr::fn(I2B,expr(v)) + : Expr::fn(TRUNC,expr(v),lit(t->getPrimitiveSizeInBits())); + case Instruction::ZExt: + return isBool(v->getType()) ? b2p(v) : expr(v); + case Instruction::SExt: + return isBool(v->getType()) ? b2p(v) : expr(v); + case Instruction::FPTrunc: + return expr(v); + case Instruction::FPExt: + return expr(v); + case Instruction::FPToUI: + return Expr::fn(FP2UI,expr(v)); + case Instruction::FPToSI: + return Expr::fn(FP2SI,expr(v)); + case Instruction::UIToFP: + return Expr::fn(UI2FP,expr(v)); + case Instruction::SIToFP: + return Expr::fn(SI2FP,expr(v)); + case Instruction::PtrToInt: + return Expr::fn(P2I,expr(v)); + case Instruction::IntToPtr: + return Expr::fn(I2P,expr(v)); + case Instruction::BitCast: + return expr(v); + default: + assert(false && "Unexpected cast expression."); + } +} + const Expr* SmackRep::op(const llvm::User* v) { using namespace llvm; unsigned opcode; @@ -715,8 +699,7 @@ ProcDecl* SmackRep::proc(llvm::Function* f, int nargs) { } const Expr* SmackRep::arg(llvm::Function* f, unsigned pos, llvm::Value* v) { - // TODO take care with this call to fp2si - return (f && f->isVarArg() && isFloat(v)) ? fp2si(v,0) : expr(v); + return (f && f->isVarArg() && isFloat(v)) ? Expr::fn(FP2SI,expr(v)) : expr(v); } const Stmt* SmackRep::call(llvm::Function* f, llvm::User& ci) { @@ -825,8 +808,7 @@ void SmackRep::addInit(unsigned region, const Expr* addr, const llvm::Constant* staticInits.push_back( Stmt::assign(mem(region,addr), expr(val)) ); } else if (isFloat(val)) { - // TODO take care with this call to fp2si - staticInits.push_back( Stmt::assign(mem(region,addr), fp2si(val,0)) ); + staticInits.push_back( Stmt::assign(mem(region,addr), Expr::fn(FP2SI,expr(val))) ); } else if (isa(val->getType())) { staticInits.push_back( Stmt::assign(mem(region,addr), expr(val)) ); From e97f73f7443027b4c219f16a93a38555d661e8c9 Mon Sep 17 00:00:00 2001 From: Michael Emmi Date: Mon, 27 Oct 2014 23:52:46 +0100 Subject: [PATCH 116/140] Simplified instruction visitor. --- include/smack/SmackInstGenerator.h | 21 ++------- lib/smack/SmackInstGenerator.cpp | 74 +++--------------------------- 2 files changed, 11 insertions(+), 84 deletions(-) diff --git a/include/smack/SmackInstGenerator.h b/include/smack/SmackInstGenerator.h index 635e5664c..1c380a216 100644 --- a/include/smack/SmackInstGenerator.h +++ b/include/smack/SmackInstGenerator.h @@ -75,7 +75,7 @@ class SmackInstGenerator : public llvm::InstVisitor { void visitResumeInst(llvm::ResumeInst& i); void visitUnreachableInst(llvm::UnreachableInst& i); - void visitBinaryOperator(llvm::BinaryOperator& i); + void visitBinaryOperator(llvm::BinaryOperator& I); // TODO implement extractelement // TODO implement insertelement @@ -92,22 +92,9 @@ class SmackInstGenerator : public llvm::InstVisitor { void visitAtomicRMWInst(llvm::AtomicRMWInst& i); void visitGetElementPtrInst(llvm::GetElementPtrInst& i); - void visitTruncInst(llvm::TruncInst& i); - void visitZExtInst(llvm::ZExtInst& i); - void visitSExtInst(llvm::SExtInst& i); - void visitFPTruncInst(llvm::FPTruncInst& i); - void visitFPExtInst(llvm::FPExtInst& i); - void visitFPToUIInst(llvm::FPToUIInst& i); - void visitFPToSIInst(llvm::FPToSIInst& i); - void visitUIToFPInst(llvm::UIToFPInst& i); - void visitSIToFPInst(llvm::SIToFPInst& i); - void visitPtrToIntInst(llvm::PtrToIntInst& i); - void visitIntToPtrInst(llvm::IntToPtrInst& i); - void visitBitCastInst(llvm::BitCastInst& i); - // TODO implement addrspacecast - - void visitICmpInst(llvm::ICmpInst& i); - void visitFCmpInst(llvm::FCmpInst& i); + void visitCastInst(llvm::CastInst& I); + void visitCmpInst(llvm::CmpInst& I); + void visitPHINode(llvm::PHINode& i); void visitSelectInst(llvm::SelectInst& i); void visitCallInst(llvm::CallInst& i); diff --git a/lib/smack/SmackInstGenerator.cpp b/lib/smack/SmackInstGenerator.cpp index 637e43bac..e003ec697 100644 --- a/lib/smack/SmackInstGenerator.cpp +++ b/lib/smack/SmackInstGenerator.cpp @@ -254,9 +254,9 @@ void SmackInstGenerator::visitUnreachableInst(llvm::UnreachableInst& ii) { /* BINARY OPERATIONS */ /******************************************************************************/ -void SmackInstGenerator::visitBinaryOperator(llvm::BinaryOperator& bo) { - processInstruction(bo); - emit(Stmt::assign(rep.expr(&bo), rep.op(&bo))); +void SmackInstGenerator::visitBinaryOperator(llvm::BinaryOperator& I) { + processInstruction(I); + emit(Stmt::assign(rep.expr(&I),rep.op(&I))); } /******************************************************************************/ @@ -433,62 +433,7 @@ void SmackInstGenerator::visitGetElementPtrInst(llvm::GetElementPtrInst& gepi) { /* CONVERSION OPERATIONS */ /******************************************************************************/ -void SmackInstGenerator::visitTruncInst(llvm::TruncInst& I) { - processInstruction(I); - emit(Stmt::assign(rep.expr(&I),rep.cast(&I))); -} - -void SmackInstGenerator::visitZExtInst(llvm::ZExtInst& I) { - processInstruction(I); - emit(Stmt::assign(rep.expr(&I),rep.cast(&I))); -} - -void SmackInstGenerator::visitSExtInst(llvm::SExtInst& I) { - processInstruction(I); - emit(Stmt::assign(rep.expr(&I),rep.cast(&I))); -} - -void SmackInstGenerator::visitFPTruncInst(llvm::FPTruncInst& I) { - processInstruction(I); - emit(Stmt::assign(rep.expr(&I),rep.cast(&I))); -} - -void SmackInstGenerator::visitFPExtInst(llvm::FPExtInst& I) { - processInstruction(I); - emit(Stmt::assign(rep.expr(&I),rep.cast(&I))); -} - -void SmackInstGenerator::visitFPToUIInst(llvm::FPToUIInst& I) { - processInstruction(I); - emit(Stmt::assign(rep.expr(&I),rep.cast(&I))); -} - -void SmackInstGenerator::visitFPToSIInst(llvm::FPToSIInst& I) { - processInstruction(I); - emit(Stmt::assign(rep.expr(&I),rep.cast(&I))); -} - -void SmackInstGenerator::visitUIToFPInst(llvm::UIToFPInst& I) { - processInstruction(I); - emit(Stmt::assign(rep.expr(&I),rep.cast(&I))); -} - -void SmackInstGenerator::visitSIToFPInst(llvm::SIToFPInst& I) { - processInstruction(I); - emit(Stmt::assign(rep.expr(&I),rep.cast(&I))); -} - -void SmackInstGenerator::visitPtrToIntInst(llvm::PtrToIntInst& I) { - processInstruction(I); - emit(Stmt::assign(rep.expr(&I),rep.cast(&I))); -} - -void SmackInstGenerator::visitIntToPtrInst(llvm::IntToPtrInst& I) { - processInstruction(I); - emit(Stmt::assign(rep.expr(&I),rep.cast(&I))); -} - -void SmackInstGenerator::visitBitCastInst(llvm::BitCastInst& I) { +void SmackInstGenerator::visitCastInst(llvm::CastInst& I) { processInstruction(I); emit(Stmt::assign(rep.expr(&I),rep.cast(&I))); } @@ -497,14 +442,9 @@ void SmackInstGenerator::visitBitCastInst(llvm::BitCastInst& I) { /* OTHER OPERATIONS */ /******************************************************************************/ -void SmackInstGenerator::visitICmpInst(llvm::ICmpInst& ci) { - processInstruction(ci); - emit(Stmt::assign(rep.expr(&ci), rep.pred(&ci))); -} - -void SmackInstGenerator::visitFCmpInst(llvm::FCmpInst& ci) { - processInstruction(ci); - emit(Stmt::assign(rep.expr(&ci), rep.pred(&ci))); +void SmackInstGenerator::visitCmpInst(llvm::CmpInst& I) { + processInstruction(I); + emit(Stmt::assign(rep.expr(&I),rep.pred(&I))); } void SmackInstGenerator::visitPHINode(llvm::PHINode& phi) { From a892ce3ac1ace261471d792c3e714f03129da646 Mon Sep 17 00:00:00 2001 From: Michael Emmi Date: Tue, 28 Oct 2014 00:56:03 +0100 Subject: [PATCH 117/140] More SmackRep simplifications. --- include/smack/SmackRep.h | 84 ++----- lib/smack/SmackInstGenerator.cpp | 54 +---- lib/smack/SmackRep.cpp | 389 ++++++++++--------------------- 3 files changed, 145 insertions(+), 382 deletions(-) diff --git a/include/smack/SmackRep.h b/include/smack/SmackRep.h index 0a2472d9a..085f14743 100644 --- a/include/smack/SmackRep.h +++ b/include/smack/SmackRep.h @@ -36,75 +36,9 @@ class SmackRep { static const string FREE; static const string MEMCPY; - static const string BASE; - static const string PA; - - static const string FP; - - static const string TRUNC; - static const string B2P; - static const string I2P; - static const string P2I; static const string I2B; static const string B2I; - - static const string FP2SI; - static const string FP2UI; - static const string SI2FP; - static const string UI2FP; - - static const string ADD; - static const string SUB; - static const string MUL; - static const string SDIV; - static const string UDIV; - static const string SREM; - static const string UREM; - static const string AND; - static const string OR; - static const string XOR; - static const string LSHR; - static const string ASHR; - static const string SHL; - - static const string FADD; - static const string FSUB; - static const string FMUL; - static const string FDIV; - static const string FREM; - - static const string SGE; - static const string UGE; - static const string SLE; - static const string ULE; - static const string SLT; - static const string ULT; - static const string SGT; - static const string UGT; - - static const string NAND; - static const string MAX; - static const string MIN; - static const string UMAX; - static const string UMIN; - - static const string FFALSE; - static const string FOEQ; - static const string FOGE; - static const string FOGT; - static const string FOLE; - static const string FOLT; - static const string FONE; - static const string FORD; - static const string FTRUE; - static const string FUEQ; - static const string FUGE; - static const string FUGT; - static const string FULE; - static const string FULT; - static const string FUNE; - static const string FUNO; static const string MEM_OP; static const string REC_MEM_OP; @@ -190,12 +124,24 @@ class SmackRep { vector ts); const Expr* expr(const llvm::Value* v); string getString(const llvm::Value* v); + + string cast2fn(unsigned opcode); + string bop2fn(unsigned opcode); + string armwop2fn(unsigned opcode); + string pred2fn(unsigned predicate); + const Expr* cast(const llvm::Instruction* I); const Expr* cast(const llvm::ConstantExpr* CE); const Expr* cast(unsigned opcode, const llvm::Value* v, const llvm::Type* t); - const Expr* op(const llvm::User* v); - const Expr* pred(const llvm::User* v); - + + const Expr* bop(const llvm::BinaryOperator* BO); + const Expr* bop(const llvm::ConstantExpr* CE); + const Expr* bop(unsigned opcode, const llvm::Value* lhs, const llvm::Value* rhs, const llvm::Type* t); + + const Expr* cmp(const llvm::CmpInst* I); + const Expr* cmp(const llvm::ConstantExpr* CE); + const Expr* cmp(unsigned predicate, const llvm::Value* lhs, const llvm::Value* rhs); + const Expr* arg(llvm::Function* f, unsigned pos, llvm::Value* v); const Stmt* call(llvm::Function* f, llvm::User& u); string code(llvm::CallInst& ci); diff --git a/lib/smack/SmackInstGenerator.cpp b/lib/smack/SmackInstGenerator.cpp index e003ec697..eb6f9b689 100644 --- a/lib/smack/SmackInstGenerator.cpp +++ b/lib/smack/SmackInstGenerator.cpp @@ -256,7 +256,7 @@ void SmackInstGenerator::visitUnreachableInst(llvm::UnreachableInst& ii) { void SmackInstGenerator::visitBinaryOperator(llvm::BinaryOperator& I) { processInstruction(I); - emit(Stmt::assign(rep.expr(&I),rep.op(&I))); + emit(Stmt::assign(rep.expr(&I),rep.bop(&I))); } /******************************************************************************/ @@ -365,55 +365,17 @@ void SmackInstGenerator::visitAtomicCmpXchgInst(llvm::AtomicCmpXchgInst& i) { } void SmackInstGenerator::visitAtomicRMWInst(llvm::AtomicRMWInst& i) { + using llvm::AtomicRMWInst; processInstruction(i); - const Expr* res = rep.expr(&i); const Expr* mem = rep.mem(i.getPointerOperand()); const Expr* val = rep.expr(i.getValOperand()); - const Expr* op; - - switch (i.getOperation()) { - using llvm::AtomicRMWInst; - case AtomicRMWInst::Xchg: - op = val; - break; - case AtomicRMWInst::Add: - op = Expr::fn(SmackRep::ADD,mem,val); - break; - case AtomicRMWInst::Sub: - op = Expr::fn(SmackRep::SUB,mem,val); - break; - case AtomicRMWInst::And: - op = Expr::fn(SmackRep::AND,mem,val); - break; - case AtomicRMWInst::Nand: - op = Expr::fn(SmackRep::NAND,mem,val); - break; - case AtomicRMWInst::Or: - op = Expr::fn(SmackRep::OR,mem,val); - break; - case AtomicRMWInst::Xor: - op = Expr::fn(SmackRep::XOR,mem,val); - break; - case AtomicRMWInst::Max: - op = Expr::fn(SmackRep::MAX,mem,val); - break; - case AtomicRMWInst::Min: - op = Expr::fn(SmackRep::MIN,mem,val); - break; - case AtomicRMWInst::UMax: - op = Expr::fn(SmackRep::UMAX,mem,val); - break; - case AtomicRMWInst::UMin: - op = Expr::fn(SmackRep::UMIN,mem,val); - break; - default: - assert(false && "unexpected atomic operation."); - } - emit(Stmt::assign(res,mem)); - emit(Stmt::assign(mem,op)); -} + emit(Stmt::assign(mem, + i.getOperation() == AtomicRMWInst::Xchg + ? val + : Expr::fn(rep.armwop2fn(i.getOperation()),mem,val) )); + } void SmackInstGenerator::visitGetElementPtrInst(llvm::GetElementPtrInst& gepi) { processInstruction(gepi); @@ -444,7 +406,7 @@ void SmackInstGenerator::visitCastInst(llvm::CastInst& I) { void SmackInstGenerator::visitCmpInst(llvm::CmpInst& I) { processInstruction(I); - emit(Stmt::assign(rep.expr(&I),rep.pred(&I))); + emit(Stmt::assign(rep.expr(&I),rep.cmp(&I))); } void SmackInstGenerator::visitPHINode(llvm::PHINode& phi) { diff --git a/lib/smack/SmackRep.cpp b/lib/smack/SmackRep.cpp index 203e2b17c..68ac6659d 100644 --- a/lib/smack/SmackRep.cpp +++ b/lib/smack/SmackRep.cpp @@ -18,76 +18,10 @@ const string SmackRep::MALLOC = "$malloc"; const string SmackRep::FREE = "$free"; const string SmackRep::MEMCPY = "$memcpy"; -const string SmackRep::BASE = "$base"; -const string SmackRep::PA = "$pa"; - -const string SmackRep::FP = "$fp"; - -const string SmackRep::TRUNC = "$trunc"; - const string SmackRep::B2P = "$b2p"; -const string SmackRep::I2P = "$i2p"; -const string SmackRep::P2I = "$p2i"; const string SmackRep::I2B = "$i2b"; const string SmackRep::B2I = "$b2i"; -const string SmackRep::FP2SI = "$fp2si"; -const string SmackRep::FP2UI = "$fp2ui"; -const string SmackRep::SI2FP = "$si2fp"; -const string SmackRep::UI2FP = "$ui2fp"; - -const string SmackRep::ADD = "$add"; -const string SmackRep::SUB = "$sub"; -const string SmackRep::MUL = "$mul"; -const string SmackRep::SDIV = "$sdiv"; -const string SmackRep::UDIV = "$udiv"; -const string SmackRep::SREM = "$srem"; -const string SmackRep::UREM = "$urem"; -const string SmackRep::AND = "$and"; -const string SmackRep::OR = "$or"; -const string SmackRep::XOR = "$xor"; -const string SmackRep::LSHR = "$lshr"; -const string SmackRep::ASHR = "$ashr"; -const string SmackRep::SHL = "$shl"; - -const string SmackRep::NAND = "$nand"; -const string SmackRep::MAX = "$max"; -const string SmackRep::MIN = "$min"; -const string SmackRep::UMAX = "$umax"; -const string SmackRep::UMIN = "$umin"; - -const string SmackRep::FADD = "$fadd"; -const string SmackRep::FSUB = "$fsub"; -const string SmackRep::FMUL = "$fmul"; -const string SmackRep::FDIV = "$fdiv"; -const string SmackRep::FREM = "$frem"; - -const string SmackRep::SGE = "$sge"; -const string SmackRep::UGE = "$uge"; -const string SmackRep::SLE = "$sle"; -const string SmackRep::ULE = "$ule"; -const string SmackRep::SLT = "$slt"; -const string SmackRep::ULT = "$ult"; -const string SmackRep::SGT = "$sgt"; -const string SmackRep::UGT = "$ugt"; - -const string SmackRep::FFALSE = "$ffalse"; -const string SmackRep::FOEQ = "$foeq"; -const string SmackRep::FOGE = "$foge"; -const string SmackRep::FOGT = "$fogt"; -const string SmackRep::FOLE = "$fole"; -const string SmackRep::FOLT = "$folt"; -const string SmackRep::FONE = "$fone"; -const string SmackRep::FORD = "$ford"; -const string SmackRep::FTRUE = "$ftrue"; -const string SmackRep::FUEQ = "$fueq"; -const string SmackRep::FUGE = "$fuge"; -const string SmackRep::FUGT = "$fugt"; -const string SmackRep::FULE = "$fule"; -const string SmackRep::FULT = "$fult"; -const string SmackRep::FUNE = "$fune"; -const string SmackRep::FUNO = "$funo"; - // used for memory model debugging const string SmackRep::MEM_OP = "$mop"; const string SmackRep::REC_MEM_OP = "boogie_si_record_mop"; @@ -220,7 +154,7 @@ void SmackRep::collectRegions(llvm::Module &M) { const Stmt* SmackRep::alloca(llvm::AllocaInst& i) { const Expr* size = - Expr::fn(MUL,lit(storageSize(i.getAllocatedType())),lit(i.getArraySize())); + Expr::fn("$mul",lit(storageSize(i.getAllocatedType())),lit(i.getArraySize())); return Stmt::call(ALLOCA,size,naming.get(i)); } @@ -259,7 +193,7 @@ const Expr* SmackRep::pa(const Expr* base, const Expr* index, int size) { return pa(base, index, Expr::lit(size)); } const Expr* SmackRep::pa(const Expr* base, const Expr* index, const Expr* size) { - return Expr::fn(PA, base, index, size); + return Expr::fn("$pa", base, index, size); } const Expr* SmackRep::b2p(const llvm::Value* v) { return Expr::fn(B2P, expr(v)); @@ -280,7 +214,7 @@ const Expr* SmackRep::lit(const llvm::Value* v) { uint64_t val = ci->getLimitedValue(); if (width > 0 && ci->isNegative()) - return Expr::fn(SUB, Expr::lit(0, width), Expr::lit(-val, width)); + return Expr::fn("$sub", Expr::lit(0, width), Expr::lit(-val, width)); else return Expr::lit(val, width); @@ -301,7 +235,7 @@ const Expr* SmackRep::lit(const llvm::Value* v) { iss >> exponent; iss >> exponentPart; - return Expr::fn(FP, Expr::lit(integerPart), Expr::lit(fractionalPart), + return Expr::fn("$fp", Expr::lit(integerPart), Expr::lit(fractionalPart), Expr::lit(exponentPart)); } else if (llvm::isa(v)) @@ -382,10 +316,10 @@ const Expr* SmackRep::expr(const llvm::Value* v) { return cast(CE); else if (Instruction::isBinaryOp(CE->getOpcode())) - return op(CE); + return bop(CE); else if (CE->isCompare()) - return pred(CE); + return cmp(CE); else { DEBUG(errs() << "VALUE : " << *v << "\n"); @@ -438,227 +372,148 @@ const Expr* SmackRep::cast(unsigned opcode, const llvm::Value* v, const llvm::Ty case Instruction::Trunc: assert(t->isIntegerTy() && "TODO: implement truncate for non-integer types."); return isBool(t) - ? Expr::fn(I2B,expr(v)) - : Expr::fn(TRUNC,expr(v),lit(t->getPrimitiveSizeInBits())); + ? Expr::fn("$i2b",expr(v)) + : Expr::fn("$trunc",expr(v),lit(t->getPrimitiveSizeInBits())); + case Instruction::ZExt: - return isBool(v->getType()) ? b2p(v) : expr(v); case Instruction::SExt: return isBool(v->getType()) ? b2p(v) : expr(v); + case Instruction::FPTrunc: - return expr(v); case Instruction::FPExt: - return expr(v); - case Instruction::FPToUI: - return Expr::fn(FP2UI,expr(v)); - case Instruction::FPToSI: - return Expr::fn(FP2SI,expr(v)); - case Instruction::UIToFP: - return Expr::fn(UI2FP,expr(v)); - case Instruction::SIToFP: - return Expr::fn(SI2FP,expr(v)); - case Instruction::PtrToInt: - return Expr::fn(P2I,expr(v)); - case Instruction::IntToPtr: - return Expr::fn(I2P,expr(v)); case Instruction::BitCast: return expr(v); + default: - assert(false && "Unexpected cast expression."); + return Expr::fn(cast2fn(opcode), expr(v)); } } -const Expr* SmackRep::op(const llvm::User* v) { - using namespace llvm; - unsigned opcode; - string op; - - if (const BinaryOperator* bo = dyn_cast(v)) - opcode = bo->getOpcode(); - - else if (const ConstantExpr* ce = dyn_cast(v)) - opcode = ce->getOpcode(); +const Expr* SmackRep::bop(const llvm::ConstantExpr* CE) { + return bop(CE->getOpcode(), CE->getOperand(0), CE->getOperand(1), CE->getType()); +} - else assert(false && "unexpected operator value."); +const Expr* SmackRep::bop(const llvm::BinaryOperator* BO) { + return bop(BO->getOpcode(), BO->getOperand(0), BO->getOperand(1), BO->getType()); +} - switch (opcode) { - using llvm::Instruction; +const Expr* SmackRep::bop(unsigned opcode, const llvm::Value* lhs, const llvm::Value* rhs, const llvm::Type* t) { + const Expr* e = Expr::fn(bop2fn(opcode), + (isBool(lhs) ? b2i(lhs) : expr(lhs)), + (isBool(rhs) ? b2i(rhs) : expr(rhs))); - // Integer operations - case Instruction::Add: - op = ADD; - break; - case Instruction::Sub: - op = SUB; - break; - case Instruction::Mul: - op = MUL; - break; - case Instruction::SDiv: - op = SDIV; - break; - case Instruction::UDiv: - op = UDIV; - break; - case Instruction::SRem: - op = SREM; - break; - case Instruction::URem: - op = UREM; - break; - case Instruction::And: - op = AND; - break; - case Instruction::Or: - op = OR; - break; - case Instruction::Xor: - op = XOR; - break; - case Instruction::LShr: - op = LSHR; - break; - case Instruction::AShr: - op = ASHR; - break; - case Instruction::Shl: - op = SHL; - break; - - // Floating point operations - case Instruction::FAdd: - op = FADD; - break; - case Instruction::FSub: - op = FSUB; - break; - case Instruction::FMul: - op = FMUL; - break; - case Instruction::FDiv: - op = FDIV; - break; - case Instruction::FRem: - op = FREM; - break; - - default: - assert(false && "unexpected predicate."); - } - llvm::Value - *l = v->getOperand(0), - *r = v->getOperand(1); + return isBool(t) ? Expr::fn("$i2b",e) : e; +} - const Expr* e = Expr::fn(op, - (isBool(l) ? b2i(l) : expr(l)), - (isBool(r) ? b2i(r) : expr(r))); +const Expr* SmackRep::cmp(const llvm::CmpInst* I) { + return cmp(I->getPredicate(), I->getOperand(0), I->getOperand(1)); +} - return isBool(v) ? Expr::fn("$i2b",e) : e; +const Expr* SmackRep::cmp(const llvm::ConstantExpr* CE) { + return cmp(CE->getPredicate(), CE->getOperand(0), CE->getOperand(1)); } -const Expr* SmackRep::pred(const llvm::User* v) { +const Expr* SmackRep::cmp(unsigned predicate, const llvm::Value* lhs, const llvm::Value* rhs) { using namespace llvm; - const Expr* e = NULL; - string o; - unsigned predicate; - const Expr *l = expr(v->getOperand(0)), *r = expr(v->getOperand(1)); - - if (const CmpInst* ci = dyn_cast(v)) - predicate = ci->getPredicate(); + switch (predicate) { + using llvm::CmpInst; + case CmpInst::ICMP_EQ: + return Expr::eq(expr(lhs), expr(rhs)); + case CmpInst::ICMP_NE: + return Expr::neq(expr(lhs), expr(rhs)); + default: + return Expr::fn(pred2fn(predicate), expr(lhs), expr(rhs)); + } +} - else if (const ConstantExpr* ce = dyn_cast(v)) - predicate = ce->getPredicate(); +string SmackRep::cast2fn(unsigned opcode) { + using llvm::Instruction; + switch (opcode) { + case Instruction::FPToUI: return "$fp2ui"; + case Instruction::FPToSI: return "$fp2si"; + case Instruction::UIToFP: return "$ui2fp"; + case Instruction::SIToFP: return "$sitofp"; + case Instruction::PtrToInt: return "$p2i"; + case Instruction::IntToPtr: return "$i2p"; + default: + assert(false && "Unexpected cast expression."); + } +} - else assert(false && "unexpected operator value."); +string SmackRep::bop2fn(unsigned opcode) { + switch (opcode) { + using llvm::Instruction; + case Instruction::Add: return "$add"; + case Instruction::Sub: return "$sub"; + case Instruction::Mul: return "$mul"; + case Instruction::SDiv: return "$sdiv"; + case Instruction::UDiv: return "$udiv"; + case Instruction::SRem: return "$srem"; + case Instruction::URem: return "$urem"; + case Instruction::And: return "$and"; + case Instruction::Or: return "$or"; + case Instruction::Xor: return "$xor"; + case Instruction::LShr: return "$lshr"; + case Instruction::AShr: return "$ashr"; + case Instruction::Shl: return "$shl"; + case Instruction::FAdd: return "$fadd"; + case Instruction::FSub: return "$fsub"; + case Instruction::FMul: return "$fmul"; + case Instruction::FDiv: return "$fdiv"; + case Instruction::FRem: return "$frem"; + default: + assert(false && "unexpected predicate."); + } +} +string SmackRep::pred2fn(unsigned predicate) { switch (predicate) { using llvm::CmpInst; - - // integer comparison - case CmpInst::ICMP_EQ: - e = Expr::eq(l, r); - break; - case CmpInst::ICMP_NE: - e = Expr::neq(l, r); - break; - case CmpInst::ICMP_SGE: - o = SGE; - break; - case CmpInst::ICMP_UGE: - o = UGE; - break; - case CmpInst::ICMP_SLE: - o = SLE; - break; - case CmpInst::ICMP_ULE: - o = ULE; - break; - case CmpInst::ICMP_SLT: - o = SLT; - break; - case CmpInst::ICMP_ULT: - o = ULT; - break; - case CmpInst::ICMP_SGT: - o = SGT; - break; - case CmpInst::ICMP_UGT: - o = UGT; - break; - - // floating point comparison - case CmpInst::FCMP_FALSE: - o = FFALSE; - break; - case CmpInst::FCMP_OEQ: - o = FOEQ; - break; - case CmpInst::FCMP_OGE: - o = FOGE; - break; - case CmpInst::FCMP_OGT: - o = FOGT; - break; - case CmpInst::FCMP_OLE: - o = FOLE; - break; - case CmpInst::FCMP_OLT: - o = FOLT; - break; - case CmpInst::FCMP_ONE: - o = FONE; - break; - case CmpInst::FCMP_ORD: - o = FORD; - break; - case CmpInst::FCMP_TRUE: - o = FTRUE; - break; - case CmpInst::FCMP_UEQ: - o = FUEQ; - break; - case CmpInst::FCMP_UGE: - o = FUGE; - break; - case CmpInst::FCMP_UGT: - o = FUGT; - break; - case CmpInst::FCMP_ULE: - o = FULE; - break; - case CmpInst::FCMP_ULT: - o = FULT; - break; - case CmpInst::FCMP_UNE: - o = FUNE; - break; - case CmpInst::FCMP_UNO: - o = FUNO; - break; + case CmpInst::ICMP_SGE: return "$sge"; + case CmpInst::ICMP_UGE: return "$uge"; + case CmpInst::ICMP_SLE: return "$sle"; + case CmpInst::ICMP_ULE: return "$ule"; + case CmpInst::ICMP_SLT: return "$slt"; + case CmpInst::ICMP_ULT: return "$ult"; + case CmpInst::ICMP_SGT: return "$sgt"; + case CmpInst::ICMP_UGT: return "$ugt"; + case CmpInst::FCMP_FALSE: return "$ffalse"; + case CmpInst::FCMP_OEQ: return "$foeq"; + case CmpInst::FCMP_OGE: return "$foge"; + case CmpInst::FCMP_OGT: return "$fogt"; + case CmpInst::FCMP_OLE: return "$fole"; + case CmpInst::FCMP_OLT: return "$folt"; + case CmpInst::FCMP_ONE: return "$fone"; + case CmpInst::FCMP_ORD: return "$ford"; + case CmpInst::FCMP_TRUE: return "$ftrue"; + case CmpInst::FCMP_UEQ: return "$fueq"; + case CmpInst::FCMP_UGE: return "$fuge"; + case CmpInst::FCMP_UGT: return "$fugt"; + case CmpInst::FCMP_ULE: return "$fule"; + case CmpInst::FCMP_ULT: return "$fult"; + case CmpInst::FCMP_UNE: return "$fune"; + case CmpInst::FCMP_UNO: return "$funo"; default: assert(false && "unexpected predicate."); } +} - return e == NULL ? Expr::fn(o, l, r) : e; +string SmackRep::armwop2fn(unsigned opcode) { + using llvm::AtomicRMWInst; + switch (opcode) { + case AtomicRMWInst::Add: return "$add"; + case AtomicRMWInst::Sub: return "$sub"; + case AtomicRMWInst::And: return "$and"; + case AtomicRMWInst::Nand: return "$nand"; + case AtomicRMWInst::Or: return "$or"; + case AtomicRMWInst::Xor: return "$xor"; + case AtomicRMWInst::Max: return "$max"; + case AtomicRMWInst::Min: return "$min"; + case AtomicRMWInst::UMax: return "$umax"; + case AtomicRMWInst::UMin: return "$umin"; + default: + assert(false && "unexpected atomic operation."); + } } string indexedName(string name, int idx) { @@ -699,7 +554,7 @@ ProcDecl* SmackRep::proc(llvm::Function* f, int nargs) { } const Expr* SmackRep::arg(llvm::Function* f, unsigned pos, llvm::Value* v) { - return (f && f->isVarArg() && isFloat(v)) ? Expr::fn(FP2SI,expr(v)) : expr(v); + return (f && f->isVarArg() && isFloat(v)) ? Expr::fn("$fp2si",expr(v)) : expr(v); } const Stmt* SmackRep::call(llvm::Function* f, llvm::User& ci) { @@ -808,7 +663,7 @@ void SmackRep::addInit(unsigned region, const Expr* addr, const llvm::Constant* staticInits.push_back( Stmt::assign(mem(region,addr), expr(val)) ); } else if (isFloat(val)) { - staticInits.push_back( Stmt::assign(mem(region,addr), Expr::fn(FP2SI,expr(val))) ); + staticInits.push_back( Stmt::assign(mem(region,addr), Expr::fn("$fp2si",expr(val))) ); } else if (isa(val->getType())) { staticInits.push_back( Stmt::assign(mem(region,addr), expr(val)) ); From 38f3ca646b51f15c68f8094163b775311ed99481 Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Wed, 29 Oct 2014 09:01:18 -0600 Subject: [PATCH 118/140] Building Release versions of Boogie and Corral. --- bin/build-linux-cmake.sh | 12 ++++++------ bin/build-linux.sh | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/bin/build-linux-cmake.sh b/bin/build-linux-cmake.sh index ee05cb3c0..6594d170b 100755 --- a/bin/build-linux-cmake.sh +++ b/bin/build-linux-cmake.sh @@ -164,11 +164,11 @@ echo -e "${textcolor}*** SMACK BUILD: Installing Boogie ***${nocolor}" mkdir -p ${BOOGIE_DIR} # Get Boogie -hg clone -r 02815f46a6f1 https://hg.codeplex.com/boogie ${BOOGIE_DIR} +hg clone -r f801862ae9ca https://hg.codeplex.com/boogie ${BOOGIE_DIR} # Build Boogie cd ${BOOGIE_DIR}/Source -xbuild Boogie.sln +xbuild Boogie.sln /p:Configuration=Release ln -s ${Z3_DIR}/install/bin/z3 ${BOOGIE_DIR}/Binaries/z3.exe cd ${BASE_DIR} @@ -190,7 +190,7 @@ mkdir -p ${CORRAL_DIR} # Get Corral git clone https://git01.codeplex.com/corral ${CORRAL_DIR} cd ${CORRAL_DIR} -git checkout 9235ea4f8cd2 +git checkout c5528e96911d # Build Corral cd ${CORRAL_DIR}/references @@ -214,8 +214,8 @@ cp ${BOOGIE_DIR}/Binaries/Doomed.dll . cp ${BOOGIE_DIR}/Binaries/Predication.dll . cd ${CORRAL_DIR} -xbuild cba.sln -ln -s ${Z3_DIR}/install/bin/z3 ${CORRAL_DIR}/bin/Debug/z3.exe +xbuild cba.sln /p:Configuration=Release +ln -s ${Z3_DIR}/install/bin/z3 ${CORRAL_DIR}/bin/Release/z3.exe cd ${BASE_DIR} @@ -285,7 +285,7 @@ echo -e "${textcolor}*** SMACK BUILD: Installed SMACK ***${nocolor}" # Set required paths and environment variables export BOOGIE="mono ${BOOGIE_DIR}/Binaries/Boogie.exe" -export CORRAL="mono ${CORRAL_DIR}/bin/Debug/corral.exe" +export CORRAL="mono ${CORRAL_DIR}/bin/Release/corral.exe" export PATH=${LLVM_DIR}/install/bin:$PATH export PATH=${SMACK_DIR}/install/bin:$PATH diff --git a/bin/build-linux.sh b/bin/build-linux.sh index 72ccc1aae..40114d634 100755 --- a/bin/build-linux.sh +++ b/bin/build-linux.sh @@ -162,11 +162,11 @@ echo -e "${textcolor}*** SMACK BUILD: Installing Boogie ***${nocolor}" mkdir -p ${BOOGIE_DIR} # Get Boogie -hg clone -r 02815f46a6f1 https://hg.codeplex.com/boogie ${BOOGIE_DIR} +hg clone -r f801862ae9ca https://hg.codeplex.com/boogie ${BOOGIE_DIR} # Build Boogie cd ${BOOGIE_DIR}/Source -xbuild Boogie.sln +xbuild Boogie.sln /p:Configuration=Release ln -s ${Z3_DIR}/install/bin/z3 ${BOOGIE_DIR}/Binaries/z3.exe cd ${BASE_DIR} @@ -188,7 +188,7 @@ mkdir -p ${CORRAL_DIR} # Get Corral git clone https://git01.codeplex.com/corral ${CORRAL_DIR} cd ${CORRAL_DIR} -git checkout 9235ea4f8cd2 +git checkout c5528e96911d # Build Corral cd ${CORRAL_DIR}/references @@ -212,8 +212,8 @@ cp ${BOOGIE_DIR}/Binaries/Doomed.dll . cp ${BOOGIE_DIR}/Binaries/Predication.dll . cd ${CORRAL_DIR} -xbuild cba.sln -ln -s ${Z3_DIR}/install/bin/z3 ${CORRAL_DIR}/bin/Debug/z3.exe +xbuild cba.sln /p:Configuration=Release +ln -s ${Z3_DIR}/install/bin/z3 ${CORRAL_DIR}/bin/Release/z3.exe cd ${BASE_DIR} @@ -283,7 +283,7 @@ echo -e "${textcolor}*** SMACK BUILD: Installed SMACK ***${nocolor}" # Set required paths and environment variables export BOOGIE="mono ${BOOGIE_DIR}/Binaries/Boogie.exe" -export CORRAL="mono ${CORRAL_DIR}/bin/Debug/corral.exe" +export CORRAL="mono ${CORRAL_DIR}/bin/Release/corral.exe" export PATH=${LLVM_DIR}/install/bin:$PATH export PATH=${SMACK_DIR}/install/bin:$PATH From 6e98a58a0a7b0bb567c63351fd7f8ec2b1e4c7bd Mon Sep 17 00:00:00 2001 From: Michael Emmi Date: Wed, 29 Oct 2014 16:20:32 +0100 Subject: [PATCH 119/140] C expression debugging. --- include/smack/BoogieAst.h | 1 + include/smack/SmackInstGenerator.h | 1 + include/smack/SmackRep.h | 8 ++--- lib/smack/BoogieAst.cpp | 4 +++ lib/smack/SmackInstGenerator.cpp | 49 +++++++++++++++++++----------- lib/smack/SmackRep.cpp | 8 ++--- 6 files changed, 46 insertions(+), 25 deletions(-) diff --git a/include/smack/BoogieAst.h b/include/smack/BoogieAst.h index 2e7a13ffe..e6ce71cda 100644 --- a/include/smack/BoogieAst.h +++ b/include/smack/BoogieAst.h @@ -184,6 +184,7 @@ class Stmt { static const Stmt* assume(const Expr* e, const Attr* attr); static const Stmt* call(string p); static const Stmt* call(string p, const Expr* x); + static const Stmt* call(string p, const Expr* x, const Attr* attr); static const Stmt* call(string p, const Expr* x, string r); static const Stmt* call(string p, const Expr* x, const Expr* y, string r); static const Stmt* call(string p, vector ps); diff --git a/include/smack/SmackInstGenerator.h b/include/smack/SmackInstGenerator.h index 1c380a216..38a466b9b 100644 --- a/include/smack/SmackInstGenerator.h +++ b/include/smack/SmackInstGenerator.h @@ -26,6 +26,7 @@ class SmackInstGenerator : public llvm::InstVisitor { Block* currBlock; map blockMap; + map sourceNames; Block* createBlock(); Block* getBlock(llvm::BasicBlock* bb); diff --git a/include/smack/SmackRep.h b/include/smack/SmackRep.h index 085f14743..635b2005a 100644 --- a/include/smack/SmackRep.h +++ b/include/smack/SmackRep.h @@ -94,8 +94,8 @@ class SmackRep { const Expr* b2i(const llvm::Value* v); public: - bool isMallocOrFree(llvm::Function* f); - bool isIgnore(llvm::Function* f); + bool isMallocOrFree(const llvm::Function* f); + bool isIgnore(const llvm::Function* f); bool isInt(const llvm::Type* t); bool isInt(const llvm::Value* v); bool isBool(const llvm::Type* t); @@ -112,8 +112,8 @@ class SmackRep { bool isExternal(const llvm::Value* v); void collectRegions(llvm::Module &M); - virtual string type(llvm::Type* t); - virtual string type(llvm::Value* v); + virtual string type(const llvm::Type* t); + virtual string type(const llvm::Value* v); const Expr* mem(const llvm::Value* v); const Expr* mem(unsigned region, const Expr* addr); diff --git a/lib/smack/BoogieAst.cpp b/lib/smack/BoogieAst.cpp index 353a22833..0cc225533 100644 --- a/lib/smack/BoogieAst.cpp +++ b/lib/smack/BoogieAst.cpp @@ -179,6 +179,10 @@ const Stmt* Stmt::call(string p, const Expr* x) { return call(p, vector(1, x), vector()); } +const Stmt* Stmt::call(string p, const Expr* x, const Attr* attr) { + return call(p, vector(1, x), vector(), vector(1, attr)); +} + const Stmt* Stmt::call(string p, const Expr* x, string r) { return call(p, vector(1, x), vector(1, r)); } diff --git a/lib/smack/SmackInstGenerator.cpp b/lib/smack/SmackInstGenerator.cpp index eb6f9b689..072e95c6f 100644 --- a/lib/smack/SmackInstGenerator.cpp +++ b/lib/smack/SmackInstGenerator.cpp @@ -56,11 +56,11 @@ void SmackInstGenerator::nameInstruction(llvm::Instruction& inst) { addDecl(Decl::variable(naming.get(inst), rep.type(&inst))); } -void SmackInstGenerator::annotate(llvm::Instruction& i, Block* b) { +void SmackInstGenerator::annotate(llvm::Instruction& I, Block* B) { // do not generate sourceloc from calls to llvm.debug since // those point to variable declaration lines and such - if (llvm::CallInst* ci = llvm::dyn_cast(&i)) { + if (llvm::CallInst* ci = llvm::dyn_cast(&I)) { llvm::Function* f = ci->getCalledFunction(); string name = f && f->hasName() ? f->getName().str() : ""; if (name.find("llvm.dbg.") != string::npos) { @@ -68,15 +68,12 @@ void SmackInstGenerator::annotate(llvm::Instruction& i, Block* b) { } } - if (llvm::MDNode* n = i.getMetadata("dbg")) { - llvm::DILocation l(n); - + if (llvm::MDNode* M = I.getMetadata("dbg")) { + llvm::DILocation L(M); + if (SmackOptions::SourceLocSymbols) - b->addStmt(Stmt::annot( - Attr::attr("sourceloc", - l.getFilename().str(), - l.getLineNumber(), - l.getColumnNumber()))); + B->addStmt(Stmt::annot(Attr::attr("sourceloc", L.getFilename().str(), + L.getLineNumber(), L.getColumnNumber()))); } } @@ -339,18 +336,26 @@ void SmackInstGenerator::visitLoadInst(llvm::LoadInst& li) { void SmackInstGenerator::visitStoreInst(llvm::StoreInst& si) { processInstruction(si); - const Expr* rhs = rep.expr(si.getOperand(0)); + const llvm::Value* P = si.getPointerOperand(); + const llvm::Value* E = si.getOperand(0); + const Expr* rhs = rep.expr(E); + const llvm::GlobalVariable* G = llvm::dyn_cast(P); - if (rep.isFloat(si.getOperand(0))) + if (rep.isFloat(E)) rhs = Expr::fn("$fp2si", rhs); - emit(Stmt::assign(rep.mem(si.getPointerOperand()),rhs)); - + emit(Stmt::assign(rep.mem(P),rhs)); + + if (SmackOptions::SourceLocSymbols && G) { + assert(G->hasName() && "Expected named global variable."); + emit(Stmt::call("boogie_si_record_int", rhs, Attr::attr("cexpr", G->getName().str()))); + } + if (SmackOptions::MemoryModelDebug) { emit(Stmt::call(SmackRep::REC_MEM_OP, Expr::id(SmackRep::MEM_OP_VAL))); emit(Stmt::call("boogie_si_record_int", Expr::lit(1))); - emit(Stmt::call("boogie_si_record_int", rep.expr(si.getPointerOperand()))); - emit(Stmt::call("boogie_si_record_int", rep.expr(si.getOperand(0)))); + emit(Stmt::call("boogie_si_record_int", rep.expr(P))); + emit(Stmt::call("boogie_si_record_int", rep.expr(E))); } } @@ -439,7 +444,17 @@ void SmackInstGenerator::visitCallInst(llvm::CallInst& ci) { if (ci.isInlineAsm()) { WARN("unsoundly ignoring inline asm call: " + i2s(ci)); emit(Stmt::skip()); - + + } else if (name == "llvm.dbg.value" && SmackOptions::SourceLocSymbols) { + const llvm::MDNode* m1 = dyn_cast(ci.getArgOperand(0)); + const llvm::MDNode* m2 = dyn_cast(ci.getArgOperand(2)); + assert(m1 && "Expected metadata node in first argument to llvm.dbg.value."); + assert(m2 && "Expected metadata node in third argument to llvm.dbg.value."); + const llvm::MDString* m3 = dyn_cast(m2->getOperand(2)); + assert(m3 && "Expected metadata string in the third argument to metadata node."); + emit(Stmt::call("boogie_si_record_int", rep.expr(m1->getOperand(0)), + Attr::attr("cexpr", m3->getString().str()))); + } else if (name.find("llvm.dbg.") != string::npos) { WARN("ignoring llvm.debug call."); emit(Stmt::skip()); diff --git a/lib/smack/SmackRep.cpp b/lib/smack/SmackRep.cpp index 68ac6659d..857dbce14 100644 --- a/lib/smack/SmackRep.cpp +++ b/lib/smack/SmackRep.cpp @@ -39,11 +39,11 @@ Regex PROC_IGNORE("^(" "__SMACK_code|__SMACK_decl|__SMACK_top_decl" ")$"); -bool SmackRep::isMallocOrFree(llvm::Function* f) { +bool SmackRep::isMallocOrFree(const llvm::Function* f) { return PROC_MALLOC_FREE.match(naming.get(*f)); } -bool SmackRep::isIgnore(llvm::Function* f) { +bool SmackRep::isIgnore(const llvm::Function* f) { return PROC_IGNORE.match(naming.get(*f)); } @@ -71,7 +71,7 @@ bool SmackRep::isFloat(const llvm::Value* v) { return isFloat(v->getType()); } -string SmackRep::type(llvm::Type* t) { +string SmackRep::type(const llvm::Type* t) { if (isBool(t)) return BOOL_TYPE; else if (isFloat(t)) @@ -80,7 +80,7 @@ string SmackRep::type(llvm::Type* t) { return getPtrType(); } -string SmackRep::type(llvm::Value* v) { +string SmackRep::type(const llvm::Value* v) { return type(v->getType()); } From 1e43c88b0af46302f8536572dcfe4ca5635501bc Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Wed, 29 Oct 2014 10:04:39 -0600 Subject: [PATCH 120/140] Updated corral version. --- bin/build-linux-cmake.sh | 2 +- bin/build-linux.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/build-linux-cmake.sh b/bin/build-linux-cmake.sh index 6594d170b..79f01f83e 100755 --- a/bin/build-linux-cmake.sh +++ b/bin/build-linux-cmake.sh @@ -190,7 +190,7 @@ mkdir -p ${CORRAL_DIR} # Get Corral git clone https://git01.codeplex.com/corral ${CORRAL_DIR} cd ${CORRAL_DIR} -git checkout c5528e96911d +git checkout 05dc786b8a92 # Build Corral cd ${CORRAL_DIR}/references diff --git a/bin/build-linux.sh b/bin/build-linux.sh index 40114d634..5ac64a6d1 100755 --- a/bin/build-linux.sh +++ b/bin/build-linux.sh @@ -188,7 +188,7 @@ mkdir -p ${CORRAL_DIR} # Get Corral git clone https://git01.codeplex.com/corral ${CORRAL_DIR} cd ${CORRAL_DIR} -git checkout c5528e96911d +git checkout 05dc786b8a92 # Build Corral cd ${CORRAL_DIR}/references From 10320dea71f85561ab80a896142c3ac479ee81e9 Mon Sep 17 00:00:00 2001 From: Michael Emmi Date: Wed, 29 Oct 2014 17:43:11 +0100 Subject: [PATCH 121/140] Recording boolean-typed locals. --- include/smack/smack.h | 1 + lib/smack/SmackInstGenerator.cpp | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/include/smack/smack.h b/include/smack/smack.h index 2aa482169..fc5a276cf 100644 --- a/include/smack/smack.h +++ b/include/smack/smack.h @@ -152,6 +152,7 @@ void __SMACK_decls() { // Memory debugging symbols D("type $mop;"); D("procedure boogie_si_record_mop(m: $mop);"); + D("procedure boogie_si_record_bool(b: bool);"); D("procedure boogie_si_record_int(i: int);"); D("const $MOP: $mop;"); diff --git a/lib/smack/SmackInstGenerator.cpp b/lib/smack/SmackInstGenerator.cpp index 072e95c6f..400d09102 100644 --- a/lib/smack/SmackInstGenerator.cpp +++ b/lib/smack/SmackInstGenerator.cpp @@ -452,8 +452,12 @@ void SmackInstGenerator::visitCallInst(llvm::CallInst& ci) { assert(m2 && "Expected metadata node in third argument to llvm.dbg.value."); const llvm::MDString* m3 = dyn_cast(m2->getOperand(2)); assert(m3 && "Expected metadata string in the third argument to metadata node."); - emit(Stmt::call("boogie_si_record_int", rep.expr(m1->getOperand(0)), - Attr::attr("cexpr", m3->getString().str()))); + const llvm::Value* V = m1->getOperand(0); + string recordProc; + if (rep.isBool(V)) recordProc = "boogie_si_record_bool"; + else if (rep.isFloat(V)) recordProc = "boogie_si_record_float"; + else recordProc = "boogie_si_record_int"; + emit(Stmt::call(recordProc,rep.expr(V),Attr::attr("cexpr", m3->getString().str()))); } else if (name.find("llvm.dbg.") != string::npos) { WARN("ignoring llvm.debug call."); From dc63424886a3aaaa3edc684ff7fc680bf32fad51 Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Wed, 29 Oct 2014 11:49:19 -0600 Subject: [PATCH 122/140] Apparently debug info value can actually be NULL. Implemented a guard against this corner case. --- lib/smack/SmackInstGenerator.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/smack/SmackInstGenerator.cpp b/lib/smack/SmackInstGenerator.cpp index 400d09102..4c2f57238 100644 --- a/lib/smack/SmackInstGenerator.cpp +++ b/lib/smack/SmackInstGenerator.cpp @@ -452,12 +452,14 @@ void SmackInstGenerator::visitCallInst(llvm::CallInst& ci) { assert(m2 && "Expected metadata node in third argument to llvm.dbg.value."); const llvm::MDString* m3 = dyn_cast(m2->getOperand(2)); assert(m3 && "Expected metadata string in the third argument to metadata node."); - const llvm::Value* V = m1->getOperand(0); - string recordProc; - if (rep.isBool(V)) recordProc = "boogie_si_record_bool"; - else if (rep.isFloat(V)) recordProc = "boogie_si_record_float"; - else recordProc = "boogie_si_record_int"; - emit(Stmt::call(recordProc,rep.expr(V),Attr::attr("cexpr", m3->getString().str()))); + + if (const llvm::Value* V = m1->getOperand(0)) { + string recordProc; + if (rep.isBool(V)) recordProc = "boogie_si_record_bool"; + else if (rep.isFloat(V)) recordProc = "boogie_si_record_float"; + else recordProc = "boogie_si_record_int"; + emit(Stmt::call(recordProc,rep.expr(V),Attr::attr("cexpr", m3->getString().str()))); + } } else if (name.find("llvm.dbg.") != string::npos) { WARN("ignoring llvm.debug call."); From 90494427ae305cec15c4bd4df2833e305524bf73 Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Wed, 29 Oct 2014 14:27:10 -0600 Subject: [PATCH 123/140] "par" is a Boogie keyword. --- lib/smack/Naming.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/smack/Naming.cpp b/lib/smack/Naming.cpp index 37db11347..3d068e578 100644 --- a/lib/smack/Naming.cpp +++ b/lib/smack/Naming.cpp @@ -23,7 +23,7 @@ Regex Naming::BPL_KW( "^(bool|int|false|true|old|forall|exists|requires|modifies|ensures|invariant|free" "|unique|finite|complete|type|const|function|axiom|var|procedure" "|implementation|where|returns|assume|assert|havoc|call|return|while" - "|break|goto|if|else|div|yield)$"); + "|break|goto|if|else|div|yield|par)$"); Regex Naming::SMACK_NAME(".*__SMACK_.*"); From eafc092e4ec53d04dade1a0f43ef8d733f1de91a Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Wed, 29 Oct 2014 14:30:22 -0600 Subject: [PATCH 124/140] "mod" is a Boogie keyword. --- lib/smack/Naming.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/smack/Naming.cpp b/lib/smack/Naming.cpp index 3d068e578..c8d6ed366 100644 --- a/lib/smack/Naming.cpp +++ b/lib/smack/Naming.cpp @@ -23,7 +23,7 @@ Regex Naming::BPL_KW( "^(bool|int|false|true|old|forall|exists|requires|modifies|ensures|invariant|free" "|unique|finite|complete|type|const|function|axiom|var|procedure" "|implementation|where|returns|assume|assert|havoc|call|return|while" - "|break|goto|if|else|div|yield|par)$"); + "|break|goto|if|else|div|mod|yield|par)$"); Regex Naming::SMACK_NAME(".*__SMACK_.*"); From f409ea171e662d4e70bda68050831db5ced93d58 Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Wed, 29 Oct 2014 14:33:01 -0600 Subject: [PATCH 125/140] "async" is a corral keyword. --- lib/smack/Naming.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/smack/Naming.cpp b/lib/smack/Naming.cpp index c8d6ed366..65be7ea76 100644 --- a/lib/smack/Naming.cpp +++ b/lib/smack/Naming.cpp @@ -23,7 +23,7 @@ Regex Naming::BPL_KW( "^(bool|int|false|true|old|forall|exists|requires|modifies|ensures|invariant|free" "|unique|finite|complete|type|const|function|axiom|var|procedure" "|implementation|where|returns|assume|assert|havoc|call|return|while" - "|break|goto|if|else|div|mod|yield|par)$"); + "|break|goto|if|else|div|mod|yield|par|async)$"); Regex Naming::SMACK_NAME(".*__SMACK_.*"); From 00a4696286a4e2c09c47807d0f4fb826be321149 Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Wed, 29 Oct 2014 17:02:24 -0600 Subject: [PATCH 126/140] Fixed a crash related to function pointers of vararg functions. Basically, in that case we weren't generating declarations of their respective global variables representing pointers. --- lib/smack/SmackModuleGenerator.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/smack/SmackModuleGenerator.cpp b/lib/smack/SmackModuleGenerator.cpp index a98eb4343..8554119e8 100644 --- a/lib/smack/SmackModuleGenerator.cpp +++ b/lib/smack/SmackModuleGenerator.cpp @@ -39,7 +39,8 @@ void SmackModuleGenerator::generateProgram(llvm::Module& m) { continue; } - if (!func->isVarArg()) + // TODO: Implement function pointers of vararg functions properly +// if (!func->isVarArg()) program.addDecls(rep.globalDecl(func)); ProcDecl* proc = rep.proc(func,0); From ba4a0fbc537515b7e632133c6ec6dcbda540874d Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Thu, 30 Oct 2014 11:24:33 -0600 Subject: [PATCH 127/140] Bux fix: function is called si2fp and not sitofp. --- lib/smack/SmackRep.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/smack/SmackRep.cpp b/lib/smack/SmackRep.cpp index 857dbce14..68de17a17 100644 --- a/lib/smack/SmackRep.cpp +++ b/lib/smack/SmackRep.cpp @@ -432,7 +432,7 @@ string SmackRep::cast2fn(unsigned opcode) { case Instruction::FPToUI: return "$fp2ui"; case Instruction::FPToSI: return "$fp2si"; case Instruction::UIToFP: return "$ui2fp"; - case Instruction::SIToFP: return "$sitofp"; + case Instruction::SIToFP: return "$si2fp"; case Instruction::PtrToInt: return "$p2i"; case Instruction::IntToPtr: return "$i2p"; default: From 7c6263e109f1ca71621532224e7f5de8fbcb9477 Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Thu, 30 Oct 2014 11:26:07 -0600 Subject: [PATCH 128/140] Bug fix: added declaration of boogie_si_record_float. --- include/smack/smack.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/smack/smack.h b/include/smack/smack.h index fc5a276cf..ff4571766 100644 --- a/include/smack/smack.h +++ b/include/smack/smack.h @@ -154,6 +154,7 @@ void __SMACK_decls() { D("procedure boogie_si_record_mop(m: $mop);"); D("procedure boogie_si_record_bool(b: bool);"); D("procedure boogie_si_record_int(i: int);"); + D("procedure boogie_si_record_float(f: float);"); D("const $MOP: $mop;"); D("const $GLOBALS_BOTTOM: int;"); From 8268e7679e51b274c2861e2bcc54823444dfd791 Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Sat, 1 Nov 2014 21:57:59 -0600 Subject: [PATCH 129/140] Limiting Boogie to report just one error. --- bin/smackverify.py | 2 +- examples/svcomp/ntdrivers/regtest.py | 2 +- test/contracts/array_forall_fail.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/smackverify.py b/bin/smackverify.py index dcbec1e4c..dee77a817 100755 --- a/bin/smackverify.py +++ b/bin/smackverify.py @@ -123,7 +123,7 @@ def smackdOutput(corralOutput): def verify(verifier, bplFileName, timeLimit, unroll, debug, smackd): if verifier == 'boogie': # invoke Boogie - boogieCommand = ['boogie', bplFileName, '/nologo', '/timeLimit:' + str(timeLimit)] + boogieCommand = ['boogie', bplFileName, '/nologo', '/errorLimit:1', '/timeLimit:' + str(timeLimit)] if unroll is not None: boogieCommand += ['/loopUnroll:' + str(unroll)] p = subprocess.Popen(boogieCommand, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) diff --git a/examples/svcomp/ntdrivers/regtest.py b/examples/svcomp/ntdrivers/regtest.py index 3ebc3c02f..1770f9366 100755 --- a/examples/svcomp/ntdrivers/regtest.py +++ b/examples/svcomp/ntdrivers/regtest.py @@ -15,7 +15,7 @@ RegTest('diskperf_false.i.cil', r'0 verified, 1 errors?', r'This assertion can fail', r'This assertion can fail', 2), RegTest('floppy2_true.i.cil', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), RegTest('floppy_true.i.cil', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), - RegTest('floppy_false.i.cil', r'0 verified, 5 errors?', r'This assertion can fail', r'This assertion can fail', 2), + RegTest('floppy_false.i.cil', r'0 verified, 1 errors?', r'This assertion can fail', r'This assertion can fail', 2), RegTest('kbfiltr_false.i.cil', r'0 verified, 1 errors?', r'This assertion can fail', r'This assertion can fail', 2), RegTest('parport_true.i.cil', r'1 verified, 0 errors?', r'Program has no bugs', r'Program has no bugs', 2), RegTest('parport_false.i.cil', r'0 verified, 1 errors?', r'This assertion can fail', r'This assertion can fail', 2) diff --git a/test/contracts/array_forall_fail.c b/test/contracts/array_forall_fail.c index a0741baf9..a5512b4b0 100644 --- a/test/contracts/array_forall_fail.c +++ b/test/contracts/array_forall_fail.c @@ -3,7 +3,7 @@ #include #include -// @expect 0 verified, 2 errors? +// @expect 0 verified, 1 errors? #define SIZE 10 int g[SIZE]; From e1187d08ec56cf107c5c531f24f6f0fe7f570585 Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Sat, 1 Nov 2014 21:59:06 -0600 Subject: [PATCH 130/140] Corral is now our default verifier. --- bin/smackgen.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/smackgen.py b/bin/smackgen.py index c6cbb24be..d6163dcd4 100755 --- a/bin/smackgen.py +++ b/bin/smackgen.py @@ -17,7 +17,7 @@ def smackParser(): parser = argparse.ArgumentParser(add_help=False, parents=[llvm2bplParser()]) parser.add_argument('--clang', dest='clang', default='', help='pass arguments to clang (e.g., --clang="-w -g")') - parser.add_argument('--verifier', dest='verifier', choices=['boogie', 'corral', 'duality'], default='boogie', + parser.add_argument('--verifier', dest='verifier', choices=['boogie', 'corral', 'duality'], default='corral', help='set the underlying verifier format') parser.add_argument('--entry-points', metavar='PROC', dest='entryPoints', default='main', nargs='+', help='specify entry procedures') From 3cdc7e11fdda2a957f2a20f662138b9556463146 Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Sat, 1 Nov 2014 22:05:27 -0600 Subject: [PATCH 131/140] Switching to using Corral as our default verifier. --- examples/svcomp/locks/regtest.py | 2 +- examples/svcomp/ntdrivers-simplified/regtest.py | 2 +- examples/svcomp/ntdrivers/regtest.py | 2 +- test/regtest.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/svcomp/locks/regtest.py b/examples/svcomp/locks/regtest.py index 68982bdc4..ffe524ccd 100755 --- a/examples/svcomp/locks/regtest.py +++ b/examples/svcomp/locks/regtest.py @@ -62,7 +62,7 @@ def runtests(verifier): # parse command line arguments parser = argparse.ArgumentParser(description='Runs regressions in this folder.') - parser.add_argument('--verifier', dest='verifier', choices=['boogie', 'corral', 'duality'], default=['boogie'], nargs='*', + parser.add_argument('--verifier', dest='verifier', choices=['boogie', 'corral', 'duality'], default=['corral'], nargs='*', help='choose verifiers to be used') args = parser.parse_args() diff --git a/examples/svcomp/ntdrivers-simplified/regtest.py b/examples/svcomp/ntdrivers-simplified/regtest.py index bbed78085..247759502 100755 --- a/examples/svcomp/ntdrivers-simplified/regtest.py +++ b/examples/svcomp/ntdrivers-simplified/regtest.py @@ -59,7 +59,7 @@ def runtests(verifier): # parse command line arguments parser = argparse.ArgumentParser(description='Runs regressions in this folder.') - parser.add_argument('--verifier', dest='verifier', choices=['boogie', 'corral', 'duality'], default=['boogie'], nargs='*', + parser.add_argument('--verifier', dest='verifier', choices=['boogie', 'corral', 'duality'], default=['corral'], nargs='*', help='choose verifiers to be used') args = parser.parse_args() diff --git a/examples/svcomp/ntdrivers/regtest.py b/examples/svcomp/ntdrivers/regtest.py index 1770f9366..6f5a221dd 100755 --- a/examples/svcomp/ntdrivers/regtest.py +++ b/examples/svcomp/ntdrivers/regtest.py @@ -58,7 +58,7 @@ def runtests(verifier): # parse command line arguments parser = argparse.ArgumentParser(description='Runs regressions in this folder.') - parser.add_argument('--verifier', dest='verifier', choices=['boogie', 'corral', 'duality'], default=['boogie'], nargs='*', + parser.add_argument('--verifier', dest='verifier', choices=['boogie', 'corral', 'duality'], default=['corral'], nargs='*', help='choose verifiers to be used') args = parser.parse_args() diff --git a/test/regtest.py b/test/regtest.py index 990d2c056..bab337101 100755 --- a/test/regtest.py +++ b/test/regtest.py @@ -141,7 +141,7 @@ def runtests(verifier): # parse command line arguments parser = argparse.ArgumentParser(description='Runs regressions in this folder.') - parser.add_argument('--verifier', dest='verifier', choices=['boogie', 'corral', 'duality'], default=['boogie'], nargs='*', + parser.add_argument('--verifier', dest='verifier', choices=['boogie', 'corral', 'duality'], default=['corral'], nargs='*', help='choose verifiers to be used') args = parser.parse_args() From 26d0e25c4858bd76d7c1e5e9ffbc3196c7041467 Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Sun, 2 Nov 2014 10:14:04 -0700 Subject: [PATCH 132/140] Merged CDE packaging script Monty wrote. --- bin/build-smack-cde.sh | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100755 bin/build-smack-cde.sh diff --git a/bin/build-smack-cde.sh b/bin/build-smack-cde.sh new file mode 100755 index 000000000..04ad82aec --- /dev/null +++ b/bin/build-smack-cde.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +#Set up dir to export +mkdir smack-cde +cd smack-cde + +# Create file to verify +echo \#include \"smack.h\" > test.c +echo int main\(void\) \{ >> test.c +echo int a\; >> test.c +echo a = 2\; >> test.c +echo __SMACK_assert\(a == 3\)\; >> test.c +echo return 0\; >> test.c +echo \} >> test.c + +# !!!Generalize this, so we don't need to know current version number? +wget https://github.com/downloads/pgbovine/CDE/cde_2011-08-15_64bit + +# !!!Generalize this +mv cde_2011-08-15_64bit cde + +chmod u+x cde + +# Run cde +./cde smack-verify.py test.c --verifier corral +./cde smack-verify.py test.c --verifier boogie-inline + +# Clean up smack-verify junk +rm corral* a.bpl test.* cde cde.options + +# Create wrapper script +echo \#\!/bin/sh > smack-verify.sh +echo HERE=\"\$\(dirname \"\$\(readlink -f \"\$\{0\}\"\)\"\)\" >> smack-verify.sh +echo \$HERE/cde-package/cde-exec \'smack-verify.py\' \"\$\@\" >> smack-verify.sh +chmod u+x smack-verify.sh + +# tar it up +cd .. +tar -cvf smack-cde.tar smack-cde/ +gzip smack-cde.tar From cd549e0a046f00b6bf97d65ec71a769592923849 Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Sun, 2 Nov 2014 10:52:00 -0700 Subject: [PATCH 133/140] Updated packaging script. --- bin/build-smack-cde.sh | 40 ---------------------------------------- bin/package-smack.sh | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 40 deletions(-) delete mode 100755 bin/build-smack-cde.sh create mode 100755 bin/package-smack.sh diff --git a/bin/build-smack-cde.sh b/bin/build-smack-cde.sh deleted file mode 100755 index 04ad82aec..000000000 --- a/bin/build-smack-cde.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash - -#Set up dir to export -mkdir smack-cde -cd smack-cde - -# Create file to verify -echo \#include \"smack.h\" > test.c -echo int main\(void\) \{ >> test.c -echo int a\; >> test.c -echo a = 2\; >> test.c -echo __SMACK_assert\(a == 3\)\; >> test.c -echo return 0\; >> test.c -echo \} >> test.c - -# !!!Generalize this, so we don't need to know current version number? -wget https://github.com/downloads/pgbovine/CDE/cde_2011-08-15_64bit - -# !!!Generalize this -mv cde_2011-08-15_64bit cde - -chmod u+x cde - -# Run cde -./cde smack-verify.py test.c --verifier corral -./cde smack-verify.py test.c --verifier boogie-inline - -# Clean up smack-verify junk -rm corral* a.bpl test.* cde cde.options - -# Create wrapper script -echo \#\!/bin/sh > smack-verify.sh -echo HERE=\"\$\(dirname \"\$\(readlink -f \"\$\{0\}\"\)\"\)\" >> smack-verify.sh -echo \$HERE/cde-package/cde-exec \'smack-verify.py\' \"\$\@\" >> smack-verify.sh -chmod u+x smack-verify.sh - -# tar it up -cd .. -tar -cvf smack-cde.tar smack-cde/ -gzip smack-cde.tar diff --git a/bin/package-smack.sh b/bin/package-smack.sh new file mode 100755 index 000000000..50330784b --- /dev/null +++ b/bin/package-smack.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +# Note: this script requires CDE to be downloaded from +# http://www.pgbovine.net/cde.html + +VERSION=1.4.1 +PACKAGE=smack-$VERSION-64 + +# Create folder to export +mkdir $PACKAGE +cd $PACKAGE + +# Create file to verify +echo \#include \"smack.h\" > test.c +echo int main\(void\) \{ >> test.c +echo int a\; >> test.c +echo a = 2\; >> test.c +echo assert\(a == 3\)\; >> test.c +echo return 0\; >> test.c +echo \} >> test.c + +# Run SMACK with CDE +../cde_2011-08-15_64bit smackverify.py test.c --verifier boogie +../cde_2011-08-15_64bit smackverify.py test.c --verifier corral +../cde_2011-08-15_64bit smackverify.py test.c --verifier duality + +# Clean up temporary files +rm corral* a.bpl test.* cde.options + +# Create wrapper script +echo \#\!/bin/sh > smackverify.sh +echo HERE=\"\$\(dirname \"\$\(readlink -f \"\$\{0\}\"\)\"\)\" >> smackverify.sh +echo \$HERE/cde-package/cde-exec \'smackverify.py\' \"\$\@\" >> smackverify.sh +chmod u+x smackverify.sh + +# Package it up +cd .. +tar -cvzf $PACKAGE.tgz $PACKAGE + From 859528f8d4292c8cd4af8c6ce577e1b4b96205db Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Sun, 2 Nov 2014 11:02:00 -0700 Subject: [PATCH 134/140] Updated our license to include a blurb about software packaged into our binary. --- LICENSE | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/LICENSE b/LICENSE index da9c3dfcc..d039a329e 100644 --- a/LICENSE +++ b/LICENSE @@ -41,3 +41,12 @@ poolalloc include/assistDS include/dsa lib/AssistDS lib/DSA + +In addition, a binary distribution of SMACK contains at least the following +tools and packages, which come with their own licenses: +- LLVM, clang, LLVM runtime (http://llvm.org/) +- mono (http://www.mono-project.com/) +- Boogie (http://boogie.codeplex.com/) +- Corral (http://corral.codeplex.com/) +- Z3 (http://z3.codeplex.com/), Non-Commercial Use Only + From f4808698ebc918869aefd9d32d66086fc0e9ea6d Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Sun, 2 Nov 2014 11:06:15 -0700 Subject: [PATCH 135/140] Copy license file into our binary package. --- bin/package-smack.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bin/package-smack.sh b/bin/package-smack.sh index 50330784b..97c364bc5 100755 --- a/bin/package-smack.sh +++ b/bin/package-smack.sh @@ -27,6 +27,9 @@ echo \} >> test.c # Clean up temporary files rm corral* a.bpl test.* cde.options +# Copy license file +cp ../../LICENSE . + # Create wrapper script echo \#\!/bin/sh > smackverify.sh echo HERE=\"\$\(dirname \"\$\(readlink -f \"\$\{0\}\"\)\"\)\" >> smackverify.sh From f64cec9b87476bec5792f1ec8dd1d9b76183e84c Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Sun, 2 Nov 2014 11:51:52 -0700 Subject: [PATCH 136/140] Merged changes to smack-svcomp from the svcomp2015 branch. --- include/smack/smack-svcomp.h | 37 +++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/include/smack/smack-svcomp.h b/include/smack/smack-svcomp.h index 2c880e945..2596e49c5 100644 --- a/include/smack/smack-svcomp.h +++ b/include/smack/smack-svcomp.h @@ -9,6 +9,8 @@ #define __inline // Remove the inline attribute #define __builtin_expect __builtinx_expect // Rewrite so that clang does not complain #define __builtin_memcpy __builtinx_memcpy // Rewrite so that clang does not complain +#define __builtin_va_start __builtinx_va_start // Rewrite so that clang does not complain +#define __builtin_object_size __builtinx_object_size // Rewrite so that clang does not complain void __VERIFIER_error(void) { assert(0); @@ -18,24 +20,53 @@ void __VERIFIER_assume(int v) { assume(v); } -// Types to be overloaded for: {bool, char, int, float, loff_t, long, pchar, -// pthread_t, sector_t, short, size_t, u32, uchar, ulong, -// unsigned, ushort} +void exit(int x) { + assume(0); +} + +// Types to be overloaded for: {bool, float, loff_t, pchar, +// pthread_t, sector_t, size_t, u32} char __VERIFIER_nondet_char(void) { return (char)__SMACK_nondet(); } +short __VERIFIER_nondet_short(void) { + return (short)__SMACK_nondet(); +} + int __VERIFIER_nondet_int(void) { return __SMACK_nondet(); } +long __VERIFIER_nondet_long(void) { + return (long)__SMACK_nondet(); +} + +unsigned char __VERIFIER_nondet_uchar(void) { + char x = (char)__SMACK_nondet(); + assume(x >= 0); + return (unsigned char)x; +} + +unsigned short __VERIFIER_nondet_ushort(void) { + short x = (short)__SMACK_nondet(); + assume(x >= 0); + return (unsigned short)x; +} + unsigned __VERIFIER_nondet_uint(void) { int x = __SMACK_nondet(); assume(x >= 0); return (unsigned)x; } +unsigned long __VERIFIER_nondet_ulong(void) { + long x = (long)__SMACK_nondet(); + assume(x >= 0); + return (unsigned long)x; +} + void* __VERIFIER_nondet_pointer(void) { return (void*)__SMACK_nondet(); } From c1d725d7f726b4a61677c7ad2a2a3c2adf5e6594 Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Sun, 2 Nov 2014 14:59:47 -0700 Subject: [PATCH 137/140] Added a command line options for passing arguments to the backend verifier. --- bin/smackverify.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/bin/smackverify.py b/bin/smackverify.py index dee77a817..9c466d648 100755 --- a/bin/smackverify.py +++ b/bin/smackverify.py @@ -17,7 +17,8 @@ def verifyParser(): # parse command line arguments parser = argparse.ArgumentParser(add_help=False, parents=[smackParser()]) - + parser.add_argument('--verifier-options', dest='verifierOptions', default='', + help='pass arguments to the backend verifier (e.g., --verifier-options="/trackAllVars /staticInlining")') parser.add_argument('--time-limit', metavar='N', dest='timeLimit', default='1200', type=int, help='Boogie time limit in seconds') parser.add_argument('--smackd', dest='smackd', action="store_true", default=False, @@ -120,12 +121,13 @@ def smackdOutput(corralOutput): json_string = json.dumps(json_data) print json_string -def verify(verifier, bplFileName, timeLimit, unroll, debug, smackd): +def verify(verifier, bplFileName, timeLimit, unroll, debug, verifierOptions, smackd): if verifier == 'boogie': # invoke Boogie boogieCommand = ['boogie', bplFileName, '/nologo', '/errorLimit:1', '/timeLimit:' + str(timeLimit)] if unroll is not None: boogieCommand += ['/loopUnroll:' + str(unroll)] + boogieCommand += verifierOptions.split() p = subprocess.Popen(boogieCommand, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) boogieOutput = p.communicate()[0] @@ -144,6 +146,7 @@ def verify(verifier, bplFileName, timeLimit, unroll, debug, smackd): corralCommand = ['corral', bplFileName, '/tryCTrace'] if unroll is not None: corralCommand += ['/recursionBound:' + str(unroll)] + corralCommand += verifierOptions.split() p = subprocess.Popen(corralCommand, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) corralOutput = p.communicate()[0] @@ -158,6 +161,7 @@ def verify(verifier, bplFileName, timeLimit, unroll, debug, smackd): # invoke Duality dualityCommand = ['corral', bplFileName, '/tryCTrace', '/useDuality'] dualityCommand += ['/recursionBound:10000'] # hack for providing infinite recursion bound + dualityCommand += verifierOptions.split() p = subprocess.Popen(dualityCommand, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) dualityOutput = p.communicate()[0] @@ -182,6 +186,8 @@ def verify(verifier, bplFileName, timeLimit, unroll, debug, smackd): elif sysArgv[i] == '--time-limit': del sysArgv[i] del sysArgv[i] + elif sysArgv[i].startswith('--verifier-options'): + del sysArgv[i] bpl, options, clangOutput = smackGenerate(sysArgv) args = parser.parse_args(options + sys.argv[1:]) @@ -191,5 +197,6 @@ def verify(verifier, bplFileName, timeLimit, unroll, debug, smackd): outputFile.write(bpl) outputFile.close() - print(verify(args.verifier, args.outfile, args.timeLimit, args.unroll, args.debug, args.smackd)) + print(verify(args.verifier, args.outfile, args.timeLimit, args.unroll, + args.debug, args.verifierOptions, args.smackd)) From 1a25957f77dc95bc1c1ef44707a88aa77429ae50 Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Sun, 2 Nov 2014 15:41:04 -0700 Subject: [PATCH 138/140] Mentioning Corral/Duality in README. --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 92cb22e34..996ab5981 100644 --- a/README.md +++ b/README.md @@ -44,9 +44,10 @@ then translates the bitcode `simple.bc` to a program in the smackgen.py simple.bc -o simple.bpl -and finally verifies `simple.bpl` with the [Boogie Verifier](http://boogie.codeplex.com) +and finally verifies `simple.bpl` with the [Boogie](http://boogie.codeplex.com) +or [Corral/Duality](http://corral.codeplex.com) verifiers - Boogie simple.bpl + boogie simple.bpl concluding that the original program `simple.c` is verified to be correct. While SMACK is designed to be a *modular* verifier, for our convenience, this From f85c5fe675fe5110ad0e4395c24f2e4be4e27241 Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Sun, 2 Nov 2014 17:50:49 -0700 Subject: [PATCH 139/140] Added license info to our SMACK packaging script. --- bin/package-smack.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bin/package-smack.sh b/bin/package-smack.sh index 97c364bc5..95a839c74 100755 --- a/bin/package-smack.sh +++ b/bin/package-smack.sh @@ -1,4 +1,7 @@ #!/bin/bash +# +# This file is distributed under the MIT License. See LICENSE for details. +# # Note: this script requires CDE to be downloaded from # http://www.pgbovine.net/cde.html From e971575b68e4e5f1162d0c17bbaf0f154363fde9 Mon Sep 17 00:00:00 2001 From: Zvonimir Date: Sun, 2 Nov 2014 17:56:36 -0700 Subject: [PATCH 140/140] Bumped version number to 1.5.0 --- Makefile.common.in | 2 +- Makefile.llvm.config.in | 2 +- autoconf/configure.ac | 2 +- bin/llvm2bpl.py | 2 +- bin/package-smack.sh | 2 +- bin/smackgen.py | 2 +- bin/smackreach.py | 2 +- bin/smackverify.py | 2 +- configure | 18 +++++++++--------- 9 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Makefile.common.in b/Makefile.common.in index bc20923a7..6245445c4 100644 --- a/Makefile.common.in +++ b/Makefile.common.in @@ -1,6 +1,6 @@ # Set the name of the project here PROJECT_NAME := smack -PROJ_VERSION := 1.4.1 +PROJ_VERSION := 1.5.0 # Set this variable to the top of the LLVM source tree. LLVM_SRC_ROOT = @LLVM_SRC@ diff --git a/Makefile.llvm.config.in b/Makefile.llvm.config.in index 68f496fd7..57bb07eb0 100644 --- a/Makefile.llvm.config.in +++ b/Makefile.llvm.config.in @@ -59,7 +59,7 @@ PROJ_SRC_DIR := $(call realpath, $(PROJ_SRC_ROOT)/$(patsubst $(PROJ_OBJ_ROOT)%,% prefix := $(PROJ_INSTALL_ROOT) PROJ_prefix := $(prefix) ifndef PROJ_VERSION -PROJ_VERSION := 1.4.1 +PROJ_VERSION := 1.5.0 endif PROJ_bindir := $(PROJ_prefix)/bin diff --git a/autoconf/configure.ac b/autoconf/configure.ac index 7216b2ec8..df60ee341 100644 --- a/autoconf/configure.ac +++ b/autoconf/configure.ac @@ -1,7 +1,7 @@ dnl ************************************************************************** dnl * Initialize dnl ************************************************************************** -AC_INIT([[SMACK]],[[1.4.1]],[smack-dev@googlegroups.com],[smack],[http://github.com/smackers/smack]) +AC_INIT([[SMACK]],[[1.5.0]],[smack-dev@googlegroups.com],[smack],[http://github.com/smackers/smack]) dnl Identify where LLVM source tree is LLVM_SRC_ROOT="../.." diff --git a/bin/llvm2bpl.py b/bin/llvm2bpl.py index fa6517ec4..24a54a71e 100755 --- a/bin/llvm2bpl.py +++ b/bin/llvm2bpl.py @@ -10,7 +10,7 @@ import io import platform -VERSION = '1.4.1' +VERSION = '1.5.0' def is_valid_file(parser, arg): diff --git a/bin/package-smack.sh b/bin/package-smack.sh index 95a839c74..c60417803 100755 --- a/bin/package-smack.sh +++ b/bin/package-smack.sh @@ -6,7 +6,7 @@ # Note: this script requires CDE to be downloaded from # http://www.pgbovine.net/cde.html -VERSION=1.4.1 +VERSION=1.5.0 PACKAGE=smack-$VERSION-64 # Create folder to export diff --git a/bin/smackgen.py b/bin/smackgen.py index d6163dcd4..d5c3bf7cf 100755 --- a/bin/smackgen.py +++ b/bin/smackgen.py @@ -10,7 +10,7 @@ import platform from llvm2bpl import * -VERSION = '1.4.1' +VERSION = '1.5.0' def smackParser(): diff --git a/bin/smackreach.py b/bin/smackreach.py index 854e12aad..406d475b6 100755 --- a/bin/smackreach.py +++ b/bin/smackreach.py @@ -11,7 +11,7 @@ from smackgen import * from smackverify import * -VERSION = '1.4.1' +VERSION = '1.5.0' def reachParser(): parser = argparse.ArgumentParser(add_help=False, parents=[verifyParser()]) diff --git a/bin/smackverify.py b/bin/smackverify.py index 9c466d648..dbdecda7a 100755 --- a/bin/smackverify.py +++ b/bin/smackverify.py @@ -12,7 +12,7 @@ import platform from smackgen import * -VERSION = '1.4.1' +VERSION = '1.5.0' def verifyParser(): # parse command line arguments diff --git a/configure b/configure index fc30c9c93..d436cce1d 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for SMACK 1.4.1. +# Generated by GNU Autoconf 2.68 for SMACK 1.5.0. # # Report bugs to . # @@ -560,8 +560,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='SMACK' PACKAGE_TARNAME='smack' -PACKAGE_VERSION='1.4.1' -PACKAGE_STRING='SMACK 1.4.1' +PACKAGE_VERSION='1.5.0' +PACKAGE_STRING='SMACK 1.5.0' PACKAGE_BUGREPORT='smack-dev@googlegroups.com' PACKAGE_URL='http://github.com/smackers/smack' @@ -1391,7 +1391,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures SMACK 1.4.1 to adapt to many kinds of systems. +\`configure' configures SMACK 1.5.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1457,7 +1457,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of SMACK 1.4.1:";; + short | recursive ) echo "Configuration of SMACK 1.5.0:";; esac cat <<\_ACEOF @@ -1612,7 +1612,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -SMACK configure 1.4.1 +SMACK configure 1.5.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -2161,7 +2161,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by SMACK $as_me 1.4.1, which was +It was created by SMACK $as_me 1.5.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -13692,7 +13692,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by SMACK $as_me 1.4.1, which was +This file was extended by SMACK $as_me 1.5.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -13750,7 +13750,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -SMACK config.status 1.4.1 +SMACK config.status 1.5.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\"