[pure-lang-svn] SF.net SVN: pure-lang: [436] pure/trunk
Status: Beta
Brought to you by:
agraef
From: <ag...@us...> - 2008-07-12 23:16:32
|
Revision: 436 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=436&view=rev Author: agraef Date: 2008-07-12 16:16:41 -0700 (Sat, 12 Jul 2008) Log Message: ----------- LLVM 2.3 requires that we add the default shared library extension manually. Modified Paths: -------------- pure/trunk/ChangeLog pure/trunk/config.h.in pure/trunk/configure pure/trunk/configure.ac pure/trunk/interpreter.cc Modified: pure/trunk/ChangeLog =================================================================== --- pure/trunk/ChangeLog 2008-07-11 21:28:39 UTC (rev 435) +++ pure/trunk/ChangeLog 2008-07-12 23:16:41 UTC (rev 436) @@ -1,3 +1,8 @@ +2008-07-13 Albert Graef <Dr....@t-...> + + * interpreter.cc (run): LLVM 2.3 requires that we add the default + shared library extension manually. + 2008-07-11 Albert Graef <Dr....@t-...> * interpreter.cc/h: Apply Rooslan S. Khayrov's patches to make the Modified: pure/trunk/config.h.in =================================================================== --- pure/trunk/config.h.in 2008-07-11 21:28:39 UTC (rev 435) +++ pure/trunk/config.h.in 2008-07-12 23:16:41 UTC (rev 436) @@ -8,6 +8,9 @@ /* Define to 1 if using `alloca.c'. */ #undef C_ALLOCA +/* Define to the filename extension for shared libraries. */ +#undef DLLEXT + /* Define to 1 if you have `alloca', as a function or macro. */ #undef HAVE_ALLOCA Modified: pure/trunk/configure =================================================================== --- pure/trunk/configure 2008-07-11 21:28:39 UTC (rev 435) +++ pure/trunk/configure 2008-07-12 23:16:41 UTC (rev 436) @@ -1866,6 +1866,11 @@ + +cat >>confdefs.h <<_ACEOF +#define DLLEXT "${DLLEXT}" +_ACEOF + # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: Modified: pure/trunk/configure.ac =================================================================== --- pure/trunk/configure.ac 2008-07-11 21:28:39 UTC (rev 435) +++ pure/trunk/configure.ac 2008-07-12 23:16:41 UTC (rev 436) @@ -34,6 +34,7 @@ AC_SUBST(PIC) AC_SUBST(DLLEXT) AC_SUBST(AUXLIBS) +AC_DEFINE_UNQUOTED(DLLEXT, "${DLLEXT}", [Define to the filename extension for shared libraries.]) dnl Check for programs. AC_PROG_INSTALL AC_PROG_CXX Modified: pure/trunk/interpreter.cc =================================================================== --- pure/trunk/interpreter.cc 2008-07-11 21:28:39 UTC (rev 435) +++ pure/trunk/interpreter.cc 2008-07-12 23:16:41 UTC (rev 436) @@ -379,15 +379,28 @@ // Run the interpreter on a source file, collection of source files, or on // string data. +#ifndef DLLEXT +#define DLLEXT ".so" +#endif + pure_expr* interpreter::run(const string &s, bool check) { // check for library modules size_t p = s.find(":"); if (p != string::npos && s.substr(0, p) == "lib") { if (p+1 >= s.size()) throw err("empty lib name"); - string name = s.substr(p+1), msg; - if (llvm::sys::DynamicLibrary::LoadLibraryPermanently(name.c_str(), &msg)) + string msg, name = s.substr(p+1), dllname = name; + // See whether we need to add the DLLEXT suffix. + if (name.substr(name.size()-strlen(DLLEXT)) != DLLEXT) + dllname += DLLEXT; + // First try to open the library under the given name. + if (!llvm::sys::DynamicLibrary::LoadLibraryPermanently(name.c_str(), &msg)) + return 0; + else if (dllname == name) throw err(msg); + // Now try the name with DLLEXT added. + else if (llvm::sys::DynamicLibrary::LoadLibraryPermanently(dllname.c_str(), &msg)) + throw err(msg); return 0; } // ordinary source file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |