diff options
author | SVN Migration <svn@php.net> | 1999-07-23 14:14:44 +0000 |
---|---|---|
committer | SVN Migration <svn@php.net> | 1999-07-23 14:14:44 +0000 |
commit | 5cb21cbfef2dcdf31ac914920427d3d190c6ed26 (patch) | |
tree | a6ea5826ba1eda810e9580a335798c020dfaeb9a | |
parent | b1617d8ac3bad1ace92085194e24cff8cbdbaf31 (diff) | |
download | php-git-php-4.0b1.tar.gz |
This commit was manufactured by cvs2svn to create tag 'php_4_0b1'.php-4.0b1
93 files changed, 5330 insertions, 9811 deletions
@@ -0,0 +1,11 @@ +If you think you've found a bug in PHP3, you can report it on the bug +reporting page at: + http://www.php.net/ + +Current Known Bugs: + +* split() function doesn't return regex errors nicely +* Preprocessed scripts don't work with require() and define() +* unset() doesn't actually erase the variables it just marks them as uninitialized +* Some parts in the language core prevent more than 256 arguments in function + calls from being possible
\ No newline at end of file diff --git a/CHANGES-3.0 b/CHANGES-3.0 new file mode 100644 index 0000000000..b3b9d8bea5 --- /dev/null +++ b/CHANGES-3.0 @@ -0,0 +1,624 @@ +Noticeable Changes between PHP/FI 2.0 and PHP 3.0 +================================================= + +This file was designed to be viewed with a tab size of 4 characters. + +This file is divided into 4 sections: +1. Downwards incompatible language changes. This section includes all of + the changes in the core language which may require people to modify + their scripts before using them with PHP 3.0. It does NOT list + changes made in the behavior of specific functions. +2. New language features. This section includes all of the new additions + to the core language, that may be used to enhance scripts designed for + PHP 3.0. Likewise, it does not include a listing of new functions. +3. Structural changes not directly effecting the end user. The core + of PHP 3.0 is a complete rewrite. As such, many issues effecting + PHP/FI 2.0 were addressed and vastly improved in this version, + resulting in a much more stable and efficient implementation. This + section lists these changes in design. +4. Other changes that don't fit in any of the above categories. + +Please remember that PHP 3.0's core is a complete rewrite, and thus, +there may be other undocumented incompatibilities we haven't thought +of ourselves. If you think you've found a incompatibility (or a new +feature) which is not listed here, please mail us at +php-dev@php.iquest.net. + + + + - Zeev + +------------------------------------------------------------------------------ + +Downwards incompatible language changes +======================================= + +[1] The close-PHP tag has changed from > to ?> + + This means that instead of writing: + + <?echo $title;> + + You should write: + + <?echo $title;?> + + PHP3 also includes support for a longer-form start tag that is + XML-compliant: + + <?php echo $title;?> + + The ability to use the short start tag ('<?') can be turned on and + off using the short_tags() function. Whether it is enabled or not by + default is a compile-time option (normally set to enabled by default). + + +[2] Semicolons in if/elseif/else must be replaced with colons. + + For example, the equivalent of: + + if (expr); + statements + ... + elseif (expr); + statements + ... + else; + statements + endif; + + in PHP 3.0 would be: + + if (expr): + statements + ... + elseif (expr): + statements + ... + else: + statements + endif; + + Note that the endif is followed by a semicolon and not a colon even in + PHP 3.0, which marks the end of the entire IF sentence. + + Also note that the implementation of the colon-mode and curly-braces + mode in PHP 3.0 is identical, one isn't buggier than the other (note + that I'm not saying they're not buggy, though :) + + +[3] Semicolons in while loops must also be replaced with colons. + + For example, the equivalent of: + + while (expr); + statements + ... + endwhile; + + in PHP 3.0 would be: + + while (expr): + statements + ... + endwhile; + + Note that the endwhile is followed by a semicolon and not a colon even + in PHP 3.0, which marks the end of the WHILE sentence. As with the IF + statement, the implementation of the colon-mode and curly-braces mode + in PHP 3.0 is identical, one isn't buggier than the other. + + Also note that failing to change the semicolon to a colon can result in + scripts that get stuck in the while loop because the loop-condition never + changes. + + +[4] $foo[0] is no longer identical to $foo. + + In PHP/FI 2.0, a side-effect of the implementation caused $foo[0] to be + identical to $foo. This is not the case in PHP 3.0. + + +[5] Expressions determine their types differently. + + The way expressions are evaluated has changed radically in PHP 3.0. + Expressions are no longer given the type of the left argument, but are + assigned types taking both types into account, and regardless of which + is on the left side and which is on the right side. On simple scripts + that should probably not effect you, but if you've relied on this fact + (even without realizing you do) it may change the way your scripts work. + Consider the next example: + + $a[0]=5; + $a[1]=7; + + $key = key($a); + while ("" != $key) { + echo "$key\n"; + next($a); + } + + + In PHP/FI 2.0, this would display both of $a's indices. In PHP 3.0, it + wouldn't display anything. The reason is that in PHP/FI 2.0, because the + left argument's type was string, a string comparison was made, and indeed + "" does not equal "0", and the loop went through. In PHP 3.0, when a + string is compared with an integer, an integer comparison is made (the + string is converted to an integer). This results in comparing atoi("") + which is 0, and $key which is also 0, and since 0==0, the loop doesn't + go through even once. The fix for this is simple, by replacing the + while statement with: + + while ("" != stringval($key)) { + + This would first convert the integer 0 to a string "0", and then + compare "" and "0", which are not equal, and the loop would go through + as expected. As mentioned later, casting operators are supported in + PHP 3.0 for a quicker and more readable way of changing variables' + types. For example, you could use: + + while ("" != (string)$key) { + + +[6] The structure of error messages has changed. + + Although the error messages are usually more accurate, you won't be shown + the actual line of text and actual place in which the error occured. + You'll be supplied with the line number in which the error has occured, + though. + + +[7] The format string argument to echo is no longer supported. + + Use printf(format,arg1,arg2,arg3,...) instead (unlimited arguments). + + +[8] The use of read-mode $array[] is no longer supported. + + That is, you cannot traverse an array by having a loop that does $data = + $array[]. Use current() and next() instead. Also, $array1[] = $array2 + does not append the values of $array2 to $array1, but appends $array2 + as the last entry of $array1 (see the multidimensional array support). + + +[9] Apache versions older than 1.2 are not supported anymore. + + The apache module requires apache 1.2 or later (1.3-beta is supported). + + +[10] Indirect references inside quoted strings + + PHP2-style indirect reference inside quoted strings is no longer + supported. That is, if $foo="bar", and $bar="abc", in PHP2, + "$$foo" would print out "abc". In PHP3, this would print + "$bar" (the contents of $foo is replaced with "bar"). + To use indirect reference in PHP3 inside quoted strings, you should use + the new notation: "${$foo}". The standard $$foo notation will work + outside of the quoted string. + +[11] + Some functions have changed names, are missing, or have been deprecated + by other functions + + As a whole new rewrite, written by many more people and supporting many + more APIs than it's predecessor, there's a good chance some of the functions + you're used to from PHP/FI 2 aren't available in release 3, or have changed + names. Many functions that do exist behave a bit differently, mainly + because they return different values for errors (false) but also for other + reasons. We can't list all of these functions here, simply because drawing + a full comparison between the function sets of the two versions is way too + much work. If a converted PHP/FI 2 script doesn't work for you, nothing + can replace the good old human eye going over the code, doublechecking + with the online manual that each function still does what you expected it + to do. + +[12] Other incompatibilities. + + It's not too unlikely that other documented behavior of PHP2 has changed + in this release. If you think you've found an example, please mail + us at php-dev@php.iquest.net. Even if you've found an undocumented + feature of PHP2 that stopped working in PHP3, we'd like to know about it + (although it's more than likely that it will not be supported). + + + +------------------------------------------------------------------------------ + + +New Language Features +===================== + +[1] Expressions + + PHP 3.0 includes a rich implementation of expressions, much more advanced + than this of 2.0. Just about any complex C-like or perl-like expression + would work. Support was added for assignment operators (+=, -=, *= etc), + pre and post increment/decerement (e.g. $i++, ++$i) and the questionmark + operator ( (expr?expr:expr) ). Every assignment is now an expression + with a value, which means stuff like $a = $b = $c = $d = 0; would work. + It is difficult to describe the power of expressions within a few lines + of text, but if you're familiar with them, you probably get the picture. + + +[2] for loops are now supported. + + for loops were fairly difficult to implement (in fact, we didn't find + any parallel interpreter that supports for loops anywhere (no, perl is + not an interpreter)). The bottom line is that for loops work, and are + around 5% slower than comparable while loops (that may vary), but often + they're much nicer. + + The syntax is identical to the one of C: + + for (expr; expr; expr) statement; + + or + + for (expr; expr; expr) { statements ... } + + The first expression is executed the first time the loop is encountered, + the loop is run as long as the second expression is evaluated as TRUE, + and after each iteration, the 3rd expression is evaluated. + + Colon-mode FOR loops are also supported: + for (expr; expr; expr): + statements + ... + endfor; + + +[3] do..while(expr) loops are now supported. + + Like with its C parallel, the statements inside a do..while loop are + run once the first time the loop is encountered, and then as long as + the expression evaluates as true. + + For example: + + do { + statements; + } while ($i++ < $max); + + +[4] break and continue statements are now supported inside loops. + + You can break out of loops, or continue to the next iteration of the + loop using these statements. A special feature of PHP is the ability + to specify an expression argument to break or continue, which specifies + how many loops you want to break out from or continue to. For example: + + for ($i=0; $i<10; $i++) { + for ($j=0; $j<10; $j++) { + if ($j>5) + break; + if ($i>5) + break 2; + } + } + + The first break statement would end the inner loop every time $j is + greater than 5. The second break statement would end both the inner + and outer loop when $i is greater than 5. + + Note: For this matter, switch statements are considered as loops. So + if you write "break 2;" inside a switch statement, you would be asking + to break out of the switch, and the innermost loop in which is nested. + + +[5] Switched to C-style declaration of functions. + + Here's a pretty useless function which makes a good example: + + function concat($str1,$str2) + { + return $str1.$str2; + } + + NOTE: The old style function definition is still supported, to + allow easier upgrading from PHP/FI 2.0 scripts. Simply + change 'function' to 'old_function' for these functions. + + +[6] OOP support + + Classes and inheritance are supported to a limited extent in PHP 3.0. + Here's how to declare a simple class: + + class simple_class { + var $property1,$property2; + var $property3=5; + + function display() { + printf("p1=%d, p2=%d, p3=%d\n", + $this->property1, + $this->property2, + $this->property3); + } + function init($p1,$p2) { + $this->property1 = $p1; + $this->property2 = $p2; + } + }; + + Here's how to create an object of that class: + + $obj = new simple_class; + + At this point, $obj is an object with 2 uninitialized variables, 1 + initialized variable, and 2 member functions. No protection is made on + the internals of the object, and using its properties is simple: + + $obj->property1 = 7; + + would assign 7 to $property1 inside $obj. Calling member functions is + also simple: + + $obj->display() + + would run the display() member function of $obj. Note that the + implementation of display() uses the special variable $this, which is + replaced with the object the function is called on. + + Inheritance is pretty simple too: + + class complex_class extends simple_class { + var $property4="test"; + + function display() { + printf("p1=%d, p2=%d, p3=%d, p4=%d\n", + $this->property1, + $this->property2, + $this->property3, + $this->property4); + } + } + + Basically, the class complex_class inherits everything from its parent, + simple_class, except properties or member functions which override the + ones in the parent. In this example, since we supply an alternative + display() function, it would be used with complex_class objects instead + of the display() function that was declared in simple_class. On the other + hand, since we don't supply an alternative init() function, complex_class + objects would have the same init() function as simple_class objects do. + + As with expressions, it's impossible to teach OOP in a few lines, and + personally I'm unclear as to how useful this would be in day to day + scripting. If you like this, play with this until you figure it out :) + + Objects can reside in arrays, and can contain arrays. However, + a limitation of the current implementation doesn't allow an object + to contain an array of objects (actually, this is allowed, but + there's no way to address the properties of such an object directly, + but only indirectly). For example, assuming $a[3] is an object, + $a[3]->b[2] is an object as well, you can't address the properties + of $a[3]->b[2] (i.e. you can't write $a[3]->b[2]->foo = "bar", for + instance). + + +[7] Function pointers are now supported. + + A simple illustrative example: + + $func_ptr = "time"; + $current_time = $func_ptr(); + + is identical to + + $current_time = time(); + + +[8] Indirect references are much more powerful. + + For example, one can use the dollar operator an infinite amount of times: + + $a = "b"; + $b = "c"; + $c = "d"; + $d = "e"; + $e = "Testing\n"; + + echo $$$$$a; + + Would display $e's content, which is "Testing\n". + + In addition, one can use complex expressions to generate variable names + using a perl-like notation: + + $i="123"; + ${"test".$i} = 5; + + would assign 5 to $test123. + +[9] A string concatenation operator was added, '+' no longer concatenates strings. + + A perl-like string concatenation operator was added, the '.' operator. + It converts both of its arguments to strings, and concatenates them. + For example: + + $result = "abcd".5; + + assigns "abcd5" to result. Note that under PHP 3.0, the '+' operator + no longer performs concatenation if its arguments are strings. Use + the '.' operator instead. + +[10] Supports passing function arguments by references instead of by value. + + Support for passing function arguments by reference instead of by value + has been added. This doesn't result in having to change the function + implementations in any way, but, when calling the function, you can + decide on whether the variable you supply would actually be changed by + the function, or a copy of it. + + Example: + + function inc($arg) + { + $arg++; + } + + $i=0; + inc($i); # here $i in the outer scope wouldn't change, and remain 0 + inc(&$i); # here $i is passed by reference, and would change to 1 + + +[11] Support for multidimensional arrays. + + (Or as Andi calls them, 'hyperdimensional variables'.) + + The easiest way to define this support of PHP 3.0 is inductive - + arrays can contain any type of variables, including other arrays. + A simple example: + + $a[0]=5; + $a[1]["testing"]=17; + $b["foo"]=$a; + + Ok, so it may be not so simple. Play with it, it's pretty powerful. + + +[12] Array initialization is now supported. + + For example, let's say you want to initialize a lookup table to convert + number to month names: + + $months = array("January", "February", "March", + "April", "May", "June", "July", "August", + "September", "October", "November", "December"); + + would assign $months[0] to be January, $months[1] to be February, etc. + Alternately, you may want the count to start at '1' instead of 0. + You can do so easily: + + $months = array(1=>"January", "February", "March", + "April", "May", "June", "July", "August", + "September", "October", "November", "December"); + + Also, you can specify an index for every entry, not just the first one: + + $first_names = array("Doe"=>"John", "Gates"=>"William", + "Clinton"=>"Bill" }); + + would assign $first_names["Doe"]="John", etc. + + +[13] Perl style lists now supported. + + Multiple values from arrays may now be assigned into several + variables using one assignment. For example: + + $str = "johndoe:x:555:555:Doe, John:/home/johndoe:/bin/tcsh"; + + list($username,$passwd,$uid,$gid,$realname,$homedir,$shell) = + explode(":",$str); + + Would assign 'johndoe' into $username, 'x' into $passwd, etc. + + +[14] Colons are supported in 'case' and 'default' statements. + + For example: + + switch($value) { + case 'A': + statement; + break; + case 'B': + statement; + break; + case 'C': + statement; + /* fall-through */ + default: + statement; + } + + Semicolons are still supported, but when writing new scripts, they + should be phased out in favour of colons. + + +------------------------------------------------------------------------------ + + +Non Language Related New Features +================================= + +[1] Persistent resource lists. + + In plain english this means that there's now an easy way of writing the + SQL drivers so that they don't open and close the SQL link every time, + but instead open it the first time it's required, and then use it on + every later hit. As of PHP 3.0a1, only the MySQL, mSQL and PostgresSQL + drivers have been changed (rewritten) to take advantage of this option. + To use it, use mysql_pconnect() instead of mysql_connect() (or the + equivalents for the two other databases). + + +[2] Configuration file. + + PHP now has its own configuration file, and many compile-time options + of PHP2 are now configurable at runtime. + + +[3] Syntax Highlighting. + + A syntax highlighter has been built into PHP 3.0, which means PHP 3.0 can + display your code, syntax highlighted, instead of executing it. + There are currently two ways to use the syntax highlighter. One is to + use the show_source() statement. This statement is identical to the + include() statement, except instead of executing the file, it displays + its source syntax highlighted. + The second way is possible only when running as an apache module, and is + to define a special extension for PHP 3.0 source files (e.g. .php3s) + and instruct apache to automatically syntax highlight them. + + +[4] Loadable modules. + + This would have a huge impact on the Windows version, and would probably + be used in the UNIX environment as well. One can now add PHP internal + functions in runtime by loading a dynamic module. This is known to work + under Solaris, Linux and Win32 at this time, but would be ported to any + other capable platform if an incompatability is found. + + +------------------------------------------------------------------------------ + + +Other Interesting Issues +======================== + + +[1] Improved performance. + + The performance of PHP 3.0 is much better than the one of PHP/FI 2.0. + Memory consumption has been dramatically reduced in many cases, due + to the use of an internal memory manager, instead of apache's pools. + Speedwise, PHP 3.0 is somewhere between 2 and 3 times faster than + PHP/FI 2.0. + + +[2] More reliable parser. + + After PHP 3.0 is well tested, it'll be pretty safe to say that it's + more reliable than PHP/FI 2.0 is. While PHP/FI 2.0 performed well on + simple, and fairly complex scripts, a fundamental design difference + from PHP 3.0 makes it more prone to errors. In PHP 3.0, obscure parser + problems are much less likely. + + +[3] Improved C API. + + If you're a C coder, adding functionality to PHP was never easier. + A pretty well documented API is available (apidoc.txt), and you no longer + have to touch the parser or scanner code when adding your function. + Also, it's more complicated to 'go wrong' when implementing a PHP3 + function than it was in PHP2 (no stack to maintain) - but of course, + you can mess up here too :) + + +[4] Name change. + + PHP/FI 2.0 was renamed to PHP 3.0, and the meaning has changed from + 'Personal Home Pages / Forms Interpreter' to 'PHP: Hypertext Preprocessor'. + 'Personal' home pages was an understatement for PHP/FI 2.0, and is + definitely an understatement for PHP 3.0. diff --git a/COPYING b/COPYING new file mode 100644 index 0000000000..a43ea2126f --- /dev/null +++ b/COPYING @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 675 Mass Ave, Cambridge, MA 02139, USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + Appendix: How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) 19yy <name of author> + + 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., 675 Mass Ave, Cambridge, MA 02139, USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + <signature of Ty Coon>, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. @@ -1,20 +1,860 @@ -PHP 4.0 CHANGE LOG ChangeLog +PHP 3.0 CHANGE LOG ChangeLog ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| -??? ?? 1999, Version 4.0 Beta 2 -- Removed --with-shared-apache (Sascha) -- Added patch for reverse lookup table in base64_decode (Sascha) - Submitted by bfranklin@dct.com -- Merged in php3 version of str_replace (Sascha) -- Added DBA module (Sascha) -- Added session id detection within REQUEST_URI (Sascha) -- Merged in HP-UX/ANSI compatibility switch from php3 (Sascha) -- Fixed rpath handling for utilitites built during Apache build (Sascha) -- Added missing E_ error level constants (Zeev, libzend) -- Fixed a bug in sending multiple HTTP Cookies under Apache (Zeev) -- Fixed implicit connect on the MySQL, mSQL, PostgreSQL and Sybase - modules (Zeev) - +December 24 1998, Version 3.0.6 +- Fix GetImageSize() to work with non-standard jpg images +- Add Mersenne Twister functions (mt_rand, mt_srand, etc) +- Add str_replace() function +- Add chunk_split() function +- Fixed a bug in the memory limit code, in cases where $php_errormsg was + also used. +- Add iptcparse() function +- Adobe FDF supported +- getallheaders() NULL string fix <michale@utko.fee.vutbr.cz> +- Add all configuration directives to phpinfo() page +- Functions pack() and unpack() rewritten to be binary and buffer overrun + safe and behave like the Perl functions for all implemented format codes. +- Ensured that msql_error() will not return error messages generated by + previously-run scripts. +- Add base_convert() function +- Make sprintf() and printf() output binary safe +- Made gzgetc binary safe +- Add convert_cyr_string() and quoted_printable_decode() functions +- Fix ldap_free_result() core dump bug +- Add support for current OpenLDAP-2.0-devel library +- Add php3_asp_tags directive so it can be set from Apache config files +- Added UTF-8 support in the XML extension +- Make rand(min,max) safer on older platforms where the low-order bits have + short cycles. +- Added new pdf (Portable Document Format) module +- Added an XML parsing extension using James Clark's "expat" library +- Optimized parts of the token cache code. +- Terminate on out-of-memory errors. Until now, PHP could crash in out of + memory situations (clean-up, no real effect). +- Unterminated comments in include files were being reported with the wrong line + number. Fixed. +- Added ImageCopy() and ImageColorDeallocate(). ImageCopy() is about + 20% faster than ImageCopyResized(). ImageColorDeallocate() marks + palette entries free for reuse (by <mka@satama.com>). +- In the CGI version, it was impossible to access resources (e.g. SQL links, + images) from user-defined shutdown functions. Fixed. +- Added optional third parameter to strpos() to specify the offset to + start searching from. +- Fixed a crash bug in unset() when unsetting illegal variables (rare). +- Made ImageInterlace and ImageTransparentColor parameters optional, and made + them return the current/new settings. +- Optimized GetImageSize() <thies@digicol.de>. +- Made odbc_autocommit() without args return status +- Added connect workaround for OpenLink ODBC +- Added minimal InterBase support. Tested only on 4.0 & Linux. +- Fixed some memory leaks and bogus error messages in the URL handler of + the various file open functions. Should only affect error handling + in bad URLs. + +October 5 1998 Version 3.0.5 +- mysql_field_flags now reports all MySQL flags and the result is suitable + for automatic parsing. Compatibility warning: The result format has + changed. If you have scripts parsing the result of this function, you + may need to adapt them. +- Made nl2br() binary safe (not that it's of much use). +- Fixed a bug in the API function getThis(). It affected mostly the dir + functions, if nested within objects. +- Fixed a problem in require() in conjunction with switch(), and in some other + cases. Also fixed an identical problem with the call_user_function() API + function. +- Removed -lpthread when compiling with MySQL support. It caused various + serious problems when compiled into Apache. +- Add serialize() and unserialize() functions from jkl@njet.net +- Fix in_addr_t check for systems with in_addr_t in netinet/in.h +- Add atan2() function + +September 22 1998 Version 3.0.4 +- Added uksort() - array key sort using a user defined comparison function. +- Added 'j' support to date() - generates the day of the month, without + possible leading zeros. +- Added support for multiple crypt() encryptions if the system supports it +- Added optional support for ASP-style <% %> and <%= tags +- Fixed data loss problems with very large numeric array indices on 64-bit + platforms (e.g. DEC UNIX). +- 2 cursor_type parameters for ifx_query() and ifx_prepare changed + to 1 (bitmask). Added a few constants for use in Informix module. +- Added php3.ini option ifx.charasvarchar. If set, trailing blanks + are stripped from fixed-length char columns. (Makes life easier + for people using Informix SE.) +- Static SNMP module which compiles with ucd-snmp 3.5.2 +- fixed imap_header & header_info from crashing when a header line + is > 1024 characters. +- Added patch for rfc822_parse_adr to return an array of objects instead + of a single object. +- Informix Online 7.x & SE 7.x support now fairly complete and stable +- Add dbase_get_record_with_names() function +- Added a special case for open_basedir. When open_basedir is set to "." + the directory in which the script is stored will be used as basedir. +- Include alloca.c in the distribution for platforms without alloca(). +- Improved stripping of URL passwords from error messages - the length of the + username/password isn't obvious now, and all protocols are handled properly + (most importantly, http). +- Copying objects that had member functions with static variables produced + undetermined results. Fixed. +- Added function lstat() and cleaned up the status functions, + added tests for file status functions (this may break on some plattforms) +- Fixed is_link() - it was returning always false. +- Fixed apache_note() - it was corrupting memory. +- New Function. void get_meta_tags(string filename); Parses filename until + closing head tag and turns all meta tags into variables prefixed with 'meta_'. + The below meta tag would produce $meta_test="some string here" + <meta name="test" content="some string here"> +- Generalized some internal functions in order to better support calling + user-level functions from C code. Fixes a few sporadic problems related + to constructors inside eval() and more. +- Fixed an endless loop in explode(), strstr() and strpos() in case of an + invalid empty delimiter. +- rand() now accepts two optional arguments, which denote the requested range + of the generated number. E.g., rand(3,7) would generate a random number + between 3 and 7. +- Added M_PI constant. +- Added deg2rad() and rad2deg() for converting radians<->degrees. +- ImageArc() misbehaved when given negative angles, fixed. +- Fixed a bug in ereg() that may have caused buglets under some circumstances. +- Added imap_status +- Shutdown functions, registered via register_shutdown_function(), could never + generate output in the Apache module version. Fixed. +- Brought IMAP docs into sync with acutal imap code +- imap_fetchstructure now takes in optional flags +- Fix potential core dumps in imap_append and imap_fetchtext_full +- Fix problem in SetCookie() function related to long cookies +- Add uasort() function to go along with usort (like sort() and asort()) +- Add port number to Host header as per section 14.23 of the HTTP 1.1 RFC +- Fix imap_reopen to only take 2 arguments with an optional 3rd flags arg +- Add optional 2nd argument to imap_close +- Add CL_EXPUNGE flag to imap_open() flags +- Fix 4th arg on imap_append(). It was getting converted to a long by mistake. +- Fix shutdown warning in the LDAP module +- *COMPATIBILITY WARNING* imap_fetchstructure() "parametres" object and property + name changed to "parameters" to match the documentation and to be consistent + with the rest of the API. +- Delete uploaded temporary files automatically at the end of a request +- Add upload_max_filesize and correponsing php3_upload_max_filesize directive + to control the maximum size of an uploaded file. Setting this to 0 would + completely eliminate file uploads. +- Force $PHP_SELF to PATH_INFO value when running in CGI FORCE_CGI_REDIRECT mode +- Add apache_lookup_uri() function which does an internal sub-request lookup + and returns an object containing the request_rec fields for the URI. (Yes, + you have to be a bit of a gearhead to figure this one out) +- Fix a few signed char problems causing functions like ucfirst() not to work + correctly with non-English charsets +- md5() function not binary safe - fixed + +August 15 1998 Version 3.0.3 +- Changed the name of fopen_basedir to open_basedir, to be a little more + accurate about what it does. +- Added Hyperwave module +- Added config-option (php3_)enable_dl <on/off>. This enables/disables the + dl() function. In safe-mode dl() is always disabled. +- Auto-prepended files were crashing under some circumstances - fixed. +- Win32 mail fixes provided by walton@nordicdms.com +- Comparing between arrays and/or objects now generates a warning (it always + returns false, as it used to; no comparison is made) +- Fixed a bug in the syntax highlighting code, that made ending-double-quotes + appear twice under certain circumstances. +- Fix bug in filetype() function related to symlinks +- Started integrating Informix SE support to PHP configure/makefile setup. +- gdttf roundoff fixes from ellson@lucent.com +- Added initial Informix SE support files from Danny Heijl - This code still + needs to be integrated into the PHP configure/makefile setup and the code + itself needs more work. +- return in the global scope now terminates the execution of the current file. +- Added the ability to register shutdown function(s), via + register_shutdown_function($function_name). +- Clean up const warnings +- Add write support to ftp fopen wrappers +- Add strspn() and strcspn() functions +- On systems without strerror use Apache version if compiling as Apache module +- The PHP start tag was being ignored under some circumstances - fixed. +- The db, dbase and filepro functions are now Safe-Mode aware. +- Added config-option (php3_)fopen_basedir <path>. This limits the directory- + tree scripts can open files in to <path>. +- Fixed pg_loreadall that didn't always return all the contents in a PostgreSQL + large object. Also, doesn't pass through anything if method is HEAD. +- configure fix to create target Apache module dir +- Fix core dump in imageTTFtext() function +- Added static IMAP support +- Syntax highlighting was generating additional whitespace - fixed. +- Added ucwords. Works like ucfirst, but works on all words within a string. +- Added array_walk() - apply user function to every element of an array +- Added usort() - array sort that accepts a user defined comparison function! +- Added the ability to call user-level functions and object methods on demand + from the C source using a completely generalized, slick API function. + Miracles do happen every once in a while. +- Added constructors. Don't even squeek about destructors! :) (we mean that) +- Make pg_lowrite() binary safe +- Fixed mod_charset option in ./setup +- Fixed rewinddir() and dir()::rewind() under Win32 (they didn't work before). +- Add Win32 COM support! By-name referencing is supported using the IDispatch + interface (automation). Available functions - COM_Load(), COM_Invoke(), + COM_PropGet() and COM_PropSet(). -July 19 1999, Version 4.0 Beta 1 -- First public beta of PHP 4.0 +July 20 1998 Version 3.0.2a +- Fix a quirk in the configuration file parser, the endless fountain of joy + and fun. +- Fix a bug in the API function add_method() that made dir() crash. + +July 18 1998 Version 3.0.2 +- Compile cleanups for *BSD +- Add support for the OpenLink ODBC Drivers +- Add PHP_SELF, PHP_AUTH_* and HTTP_*_VARS PHP variables to phpinfo() output +- Add workaround for broken makes +- Add Apache 1.3.1 support (some Apache header files were moved around) +- Added apache_note() function. +- Fix order of system libraries and detect libresolv correctly +- Fixed a bug in the Sybase-DB module. Several numeric field types were + getting truncated when having large values. +- Added testpages for unified odbc +- Fix php -s seg fault when filename was missing +- Made getdate() without args default to current time +- Added ImageColorResolve() and some fixes to the freetype support. +- Added strcasecmp() +- Added error_prepend_string and error_append_string .ini and .conf directives + to make it possible to configure the look of error messages displayed by PHP + to some extent +- Added E_ERROR, E_WARNING, E_NOTICE, E_PARSE and E_ALL constants, that can be + used in conjunction with error_reporting() + (e.g. error_reporting(E_ERROR|E_WARNING|E_NOTICE); +- Fixed a crash problem with classes that contained function(s) with default + values. +- Fixed a problem in the browscap module. Browscap files weren't being read + properly. +- Fix -L path in libphp4.module to make ApacheSSL compile without errors +- Fix StripSlashes so it correctly decodes a \0 to a NUL + +July 04 1998 Version 3.0.1 +- echo/print of empty strings don't trigger sending the header anymore. +- Implemented shift left and shift right operators (<< and >>) +- Compile fix for cc on HP-UX. +- Look for beta-version Solid libraries as well. +- Make GD module show more info in phpinfo(). +- Compile fix for NextStep 3.0. +- Fix for Oracle extension on OSF/1. +- Fix gd 1.3 bug in ImageColorAt(). +- pg_loread() hopefully handles binary data now. +- Turned off some warnings in dns.c +- Added ImageTTFBBox() and made ImageTTFText() return bounding box. +- Added constants for Ora_Bind()'s modes. +- Renamed all hash_*() routines to _php3_hash_*() to avoid clashes with other + libraries. +- Changed uodbc default LONG behaviour: longreadlen 4096 bytes, binmode 1. + The module now actually uses the php.ini settings. +- New PostgreSQL functions: pg_fetch_row(), pg_fetch_array() + and pg_fetch_object() +- Fix a segmentation fault when calling invalid functions in certain + circumstances +- Fix bug that caused link-related functions to not pay attention to + run-time safe mode setting (it was using whatever was set at compile time). +- Fix bug in exec() function when used in safe mode + +June 6 1998 Version 3.0 +- Add checkdnsrr function (check availability DNS records) +- Add getmxrr function (get MX hostnames and weights) +- Fixed bug in nl2br() function +- Fix for an RC5 related problem in the Sybase module, when dealing + with very long data types. +- Speed up string concatenation by roughly a factor of 2 +- Add escape-handling to date function +- Make base64 functions binary safe +- Add strrpos function to complement strpos function added in RC5 +- Add ltrim function (strips only at the start of string) +- Add rtrim as an alias to chop() for completeness sake +- Add trim function (similar to chop, except it strips at the start as well) +- Added 2 optional args to fsockopen function - errno and errstr +- Fixed bug in split() function related to leading matches +- Fixed problem in error_log() function (thanks to Jan Legenhausen) +- empty("0") was returning true - fixed +- Removed the old sybsql module. Use the new sybase_*() functions instead. +- Several fixes to the configuration file parser +- LDAP fixes - fixed return values on several functions + +May 23 1998 Version 3.0RC5 +- The BC math library functions now compile in by default. +- Fixed a bug in virtual() and other types of SSI's (e.g. <!--#exec). Under + certain circumstances, this used to result in random problems. +- Fixed a bug in virtual(). It was misbehaving if it was called before any + other output. +- Added mysql.default_port, mysql.default_host, mysql.default_user and + mysql.default_password ini-file directives. +- Improved handling of the MySQL default port. It now honors /etc/services + and $MYSQL_TCP_PORT. +- Fixed a crash in opening of broken ftp:// URLs, and improved error reporting + in opening of URLs. +- Fixed several non-critical scanner issues with syntax highlighting mode and + the <script language=php> tag. +- Fixed fseek on windows. (windows only): fseek will not return proper results + on files opened as text mode. PHP uses binary mode as the default for file + operations, but this can be overiden by fopen. Do not open files in text + mode and use fseek on them! +- Add strpos() function +- Added zlib module, requires zlib >= 1.0.9 +- Improved the module API implementation. Dynamic modules may now register + persistent resources (not that it makes much sense, but at least PHP + won't crash). The API itself remains unchanged. +- bcmod() wasn't always behaving like modulus should behave (it was behaving + exactly like GNU bc's % operator). Fixed. +- Changed the Sybase-DB module to always return strings, instead of auto-typing + result sets. This was done for consistency with the other database modules, + and in order to avoid overflows due to the platform-dependant limitations + of the numeric data types of PHP. You can turn compatability mode on using + the sybase.compatability_mode directive in the php3.ini file. +- Fixed problems with the TINYINT field in the Sybase-CT module. +- Applied some small speed optimizations to the Sybase-DB module querying code. +- Added 'numeric' and 'type' properties to the object returned by + sybase_fetch_field(). +- The 'new' operator doesn't accept all expressions anymore. Instead, it + accepts a class name, or a variable reference (scalar, array element, etc). +- Add ora_numcols() function +- Add ora_do() and ora_fetch_into() functions to Oracle driver +- Add persistent connection support to Oracle driver +- Make Oracle driver clean up open connections and open cursors automatically +- Added fread() and fwrite() that properly handle binary data. +- Add Ora_ColumnSize() to Oracle code +- The string "0" means FALSE again. This was done in order to maintain type + conversion consistency. +- Added solid_fetch_prev() for fetching the previous result row from Solid. +- Huge integers are now automatically converted to floating point numbers + (that have a wider range). +- Floating point numbers are now displayed using scientific notation when + they're extremely big or extremely small. The 'precision' php3.ini directive + no longer designates the number of decimal digits, but rather, the maximum + number of significant digits required. +- Added support for scientific notation for floating point numbers (e.g. 1E7) + throughout the entire language. +- Fixed a potential/probable memory corruption problem with HEAD request + handling. +- Using un-encapsulated strings now generates a NOTICE-level warning + (e.g. $a = foo; instead of $a = "foo";) +- Added defined("name") function to check if a certain constant is defined + or not. +- Support new Apache mechanism for setting SERVER_SUBVERSION +- Added PHP_OS and PHP_VERSION constants +- Added the ability to define constants in runtime! Constants are script-wide, + (there's no scope, once the constant is defined, it's valid everywhere). + Syntax is define("name", $value [, $case_insensitive]). 'name' can be any name + that is a valid variable name, *without* the $ prefix. 'value' can be + any *scalar* value. If the optional 'case_insensitive' parameter is 1, + then the constant is created case-insensitive (the default is case + sensitive). Note: define() is currently *NOT* supported in preprocessed + scripts. +- Added general support for constants. The Syslog constants (e.g. + LOG_ERR, LOG_CRIT, etc.) should be accessed as constants from now on (that + is, without a $ prefix). You can still set define_syslog_variables to On + in the php3.ini file if you want to define the various $ variables. The + default for this directive in the php3.ini-dist file has been changed to + Off. +- The configuration file path variable now expands . and .. into their + respective directories. You can obtain the path of the php3.ini file + that was used by printing get_cfg_var("cfg_file_path"). +- Fixed a crash-recovery parser crash ($a=7; $a[3]+=5;) +- Add gmmktime() function +- Fixed a crash with implode() and empty arrays. +- Fixed a bug that, under fairly rare circumstances, caused PHP not to + recognize if(), require() and other statements as statements, and + to complain about them as being unsupported functions. +- Beautified php3.ini-dist and added more comments to it. Also changed + the behavior of the configuration file parser to be brighter about + the various constants (TRUE/FALSE/ON/OFF etc). +- Fixed a bug in openlog() - the specified device name was being mangled. +- Memory leaks were sometimes reported erroneously - fixed. +- Improved the convertor to handle some quirks of the PHP/FI 2 parser with + comments. +- Fixed number_format() to properly handle negative numbers, and optimized it + a bit. +- Fixed static variables inside class member functions. Note that using such + static variables inside member functions usually defeats the purpose of + objects, so it is not recommended. +- Fixed a bug in fpassthru() (the file was being closed twice). +- Added strftime(). +- Add set_socket_blocking() function to control blocking on socket fd's +- The sendmail_path in php3.ini was being ignored - fixed. +- Fixed a bug with file upload, with files that contained the MIME boundary + inside them. +- Fixed a bug with form variables of type array, with spaces in their + index (e.g. name="foo[bar bar]"). +- gd-1.3 autodetect and support +- Year 2000 compliance is now togglable from the php3.ini file. Setting PHP + to be y2k compliant effects the way it creates cookies, and means it'll + NOT work with many browsers out there that are not y2k compliant! For + that reason, the default for this option is off. +- safe mode / fix from monti@vesatec.com +- Integrated the FreeType support in the GD extension. +- Added --with-gd=DIR and --without-gd options to configure + +April 18 1998 Version 3.0 Release Candidate 4 +- Auto-prepended and auto-appended files were reporting the wrong filename + in errors and in __FILE__ - fixed. +- Fix GPC problem related to mixed scalar and array vars with the same name +- Made putenv() Apache-safe. Environment variables may no longer leak in + between requests. +- The trailing semicolon is no longer required in class declarations. +- Fixed a memory leak in the (array) and (object) operators under certain + conditions. +- <script> tags weren't working unless short tags were enabled - Fixed. +- Fixed a bug in certain array indices that weren't treated as numbers + even though they looked like numbers (e.g. "10", "20"). +- Changes to support renamed API functions in Apache-1.3 +- Fixed the -p and -e command line switches +- Fix a segfault when calling command line version without parameters +- Fix for feof() when used on a socket +- Fix off-by-one error in fgets() when used on a socket +- Fix bug in ImageSetPixel() (Thanks to ecain@Phosphor.net) + +March 31 1998 Version 3.0 Release Candidate 3 +- Tiny bugfix for magic_quotes_sybase +- Fix Apache build problems introduced in RC2 +- $a["0"]==$a[0] fix +- Apache-1.3 build changes to support 100% automatic builds and shared library + module builds. See INSTALL file. + +March 30 1998 Version 3.0 Release Candidate 2 +- Changed the socket implementation under UNIX to not use FILE pointers, in + order to work around the buggy Solaris libc (and possibly buggy libc's + in other platforms). +- Fixed a bug in min() and max() with certain arrays. +- *WARNING* Move Apache 1.3 php3 file install to src/modules/php4 instead of + src/modules/extra. Make sure you change your AddModule line correctly + in your Apache Configuration file. This change is to take advantage of + new Apache-1.3 configuration mechanism which makes it easier to build an + Apache server with PHP automatically enabled. It will also help building + a shared library module version of PHP soon. +- Fixed a crash bug with auto-appended files. +- Made --enable-discard-path work on all Unix servers #!/path/php CGI scripts + should now work everywhere. I have tested on Apache, WN and Netscape 2.0 +- Made $a["123"] and $a[123] be identical. $a["0123"] is still different, + though. +- Added 'precision' ini directive, to set the number of decimal digits + displayed for floating point numbers (default - 6). +- Made integer/integer divisions evaluate to floating point numbers when + applicable (e.g., 5/2==2.5(float), but 4/2==2(int)) +- Get rid of reliance on tied streams and move all socket reads and writes + to recv/send calls +- Cleaned up head.c a bit and fixed CGI SetCookie order problem +- Changed default variable parsing order to Get-Cookie-Post (GPC) +- Fixed setup so it has all configure options and defaults. +- Added optional decimal point and thousands seperator to number_format() + e.g., number_format(1500,2,',','.') == 1.500,00 +- Fixed cgi bug in windows that prevented files from being parsed on many + systems and servers. + +March 23 1998 Version 3.0 Release Candidate +- Added support for the Raima database (ALPHA) +- Fixed a bug in persistent PostgreSQL links and the connection-string method. +- Added EXTENSION_STATUS file, that specifies the stability and status of + every module in the distribution. +- Added optional parameters to user functions with default values, variables + that are forced to be passed by reference and variables that can be + optionally passed by reference. The ini file directive + 'ignore_missing_userfunc_args' is no longer supported. +- Added fhttpd support (by Alex Belits) +- Improved performance by approximately 20-30%. +- Added mysql_error(), mysql_errno() (if available) and msql_error(). + Errors coming back from the database backend no longer issue warnings. + Instead, use these functions to retreive the error. +- Patched count(), each(), prev(), next(), reset() and end() to work around + the implementation side effects of unset(). As far as the users are + concerned, this should be transparent now (even though it's slower now, + until it's thoroughly fixed in 3.1). +- Added number_format(). number_format(2499,2)=='2,499.00'. +- error_reporting() now sets the error reporting level to the supplied + argument, without any interpretations. +- Fixed a lookahead parser bug that occured under rare circumstances. +- Change the comparison operators to compare numeric strings as numbers. If + you want to compare them as strings, you can use the new C-like strcmp() +- Fixed Ora_GetColumn() bug when fetching strings +- Added Ora_ColumnName() and Ora_ColumnType() +- Preliminary LONG and LONG RAW support in Oracle extension +- Add \123 and \xAB style octal and hex escapes to "" and `` strings +- Add "-c" command line flag for specifying path to php3.ini file +- Improved list() so that elements can be skipped, for example: + list($name,,,$realname) = explode(":",fgets($passwd_file)); +- Fixed a tiny bug in the hash initialization which caused excessive use of + memory. Report and fix by short@k332.feld.cvut.cz +- Fixed strtolower() and strtoupper() to work with 8-bit chars +- Fixed to compile and run on SunOS 4.1 +- Fixed a crash in soundex() of an empty string +- Fixed parse_str() - it wasn't always defining the right variables, + and didn't work with arrays. +- Made [m,My]SQL create/drop database functions return success status +- Fixed some memory leak/crash problems in the Adabas module +- Added each() in order to allow for easy and correct array traversing. +- Make Apache module version respect LOCALE setting +- Add support for Apache 1.3b6+ ap_config.h file +- Fixed a nasty corruption bug in eval() and show_source() that resulted in + script termination (e.g. eval("exit();"). +- Fixed a syntax highlighting problem with keywords used as variable + names. +- Fixed a possible crash and/or file descriptor leak +- Fixed line number being off by one in #! shell style execution +- Made it possible to disable auto_prepend/append with "none" filename +- Allow safe CGI calling through #!php style scripts + +March 2 1998 Version 3.0b6 +- Made [s]printf handle %ld +- Changed CGI version to only open regular files as input script +- Added ignore_missing_userfunc_args directive to suppress warnings messages + about missing arguments to user-defined functions +- Added Postgres function - pg_cmdtuples(), by Vladimir Litovka +- Disabled command line options if used as CGI +- Changed CGI version to use PATH_TRANSLATED as the script file name +- Link with solid shared library instead of static one +- Fixed a crash with functions that aren't being called correctly +- Fixed file descriptor leak in auto-prepend/append +- Imap module is usable. See README in dl/imap. + +February 24 1998 Version 3.0b5 +- Made the URL aware file functions be enabled by default +- Fixed an unlikely crash bug in the parser, with uninitialized array elements + which are refered to as objects. +- Fixed several fields that were being incorrectly read in Sybase CT. +- Fix Apache-1.3 related SIGHUP problem which was preventing php3.ini from + getting re-read on a SIGHUP +- *** WARNING *** Downwards incompatible change: The plus operator (+) is not + longer overloaded as concatenation for strings. Instead, it converts its + arguments to numbers and performs numeric addition. +- Add Stig and Tin's bdf2gdfont script to extra/gd directory +- Added join() as an alias to implode() +- Made implode() accept arguments in the order used by explode() as well +- Made $php_errormsg local in function calls +- Fixed Apache configuration directive bugs +- Added a number of .ini directives to Apache .conf directive list +- Fixed a 'memory leak' with strtok() +- echo/print now handle binary data correctly. +- NEW now accepts any expression for the class name argument. +- Add ImageDashedLine() GD function +- Add arg_separator .ini directive so the '&' GET method separator can be + changed to ';' for example. Corresponding php3_arg_separator Apache .conf + directive works as well. +- Walked around an implementation side effect of switch(). <? switch(expr) { ?> + now works. +- Added memory caching, resulting in a significant performance boost +- Added support for for(): .. endfor; loops +- Added a new predicate - empty($var). Returns true if $var is not set, + or is FALSE. Returns false otherwise. +- Added is_integer() (same as is_long()) and is_real() (same as is_double()). +- Added sizeof() as an alias to the count() function +- Added --enable-force-cgi-redirect, to prevent the CGI from working if + someone directly accesses PHP not through Apache's CGI redirect + (off by default). +- Fixed marking of deleted dBase records. Noticed by Simon Gornall + <simon@oyster.co.uk>. +- Fixed fixed "%%" bug in [s]printf +- Fixed a UMR (initialized memory read) in the Oracle code +- Potential fix for mysql-related SIGPIPE problem which caused httpd to spin +- Made PHP responsive to the Apache link status (stop executing if the link + dies). +- Fixed a crash bug with StrongHold and secure pages +- Fixed StrongHold installation +- Optimized the function call sequence a bit. +- Fixed Sybase/CT date/datetime/money fields work to correctly. +- Fixed Apache module startup problems - php3_module_startup should only be + called once. +- Fixed ord() with characters >127 +- Fixed bug in file_exists() function +- Fixed stripslashes() to remove the escaping quote (instead of backslash) + in case magic_quotes_sybase is true. +- Also make echo and print automatically remove trailing decimal zeros. +- Added htmlentities(), currently handling only ISO-8859-1 entities +- "0" is no longer considered false, the only string which is false is the + empty string "". +- Added 'true' and 'false' keywords +- Added 'xor' (logical exclusive or) +- Automatic conversion from double to string removes decimal trailing zeros. +- Added arsort() and rsort() to sort in descending order. +- Turned on "XLATOPT_NOCNV" by default for uODBC/Solid. +- Added support for a port number in the mysql_(p)connect() functions +- Fixed a file descriptor leak in the configuration parser. +- Fixed a few buglets with syntax highlighting with certain language keywords +- Added functions to control minimum severity level of Sybase messages to + display. +- Added highlight_string() - behaves like highlight_file(), only instead + of highlighting a file, it syntax highlights the contents of its + argument. +- Renamed show_source() to highlight_file(). show_source() is still + supported for downwards compatability. +- Fixed a bug in class inheritence - member functions with upper case + letters in their names couldn't be redefined. +- Made chown(), chgrp() and chmod() return TRUE/FALSE instead of 0/-1. + +February 02 1998 Version 3.0b4 +- Fixed a segfault bug in one of the unified ODBC error messages. +- Set default file modes to binary on Win32 (solved a lot of bs) +- Fixed file copy on Win32 +- MIME file uploads fixed on Win32 +- Added contributed icons by Colin Viebrock (undex extra/icons) +- Fixed the debugger enough to call it "beta code". +- Fixed some leaks in the Oracle module, tidied up the code a bit. +- Added __FILE__ and __LINE__ which evaluate to the currently parsed file + and currently parsed line respectively. +- Added ImageColorAt(), ImageColorSet(), ImageColorsForIndex(), and + ImageColorsTotal() to allow manipulating the palette of GIF images. +- Rename '--enable-url-includes' option to '--enable-url-fopen-wrapper' to + better describe what it does, and pay attention to the setting. +- Added optional parameter to the file(), readfile() and fopen() functions + to look for files located in the include path. +- Fixed bug that allowed the file() and readfile() to open files in the + include path inadvertantly. +- Fixed a (documented) bug in printf()/sprintf() with hard limited strings + and alignment (e.g. %-.20s). +- Optimized several quoted string routines. +- Added error_log ini directive to select where errors get logged when + log_errors is turned on or the error_log() function is used. +- Added the ability to direct errors to log files instead of or in addition + to the script output. Use the new display_errors and log_errors + php3.ini directives. +- Made environment variables uneraseable by POST/GET/Cookie variables. +- Fixed a bug in the elseif() construct. The expression was being evaluated + even if a previous if/elseif already evaluated to true and got executed. +- Fixed a bug in the exit code parameter of system() +- Tighten up all exec() related functions in safe mode +- Added error_log() function to log messages to the server error log, or + stderr for the CGI version. +- Added support for a general memory limit of scripts. +- Fixed a segfault bug that occured under certain circumstances with shell + escapes ($foo = `...`) +- Made keywords be valid property names of objects. +- Fixed a segfault bug when creating new objects of an unknown class. +- Fixed a problem with the maximum execution time limit, that may have + prevented this feature from working on certain platforms. +- PHP would now warn you with E_NOTICE about unknown escape characters, + e.g. "\f". It would still be considered as a backslash followed by f, + but the proper way of writing this is "\\f" or '\f'. +- Added support for ${...} inside encapsulated strings. Supported: ${foo}, + ${foo[bar]}, ${foo[0]}, ${$foo[$bar]}, ${$foo->bar} and ${$foo} +- Fixed a bug in automatic persistent link reconnect of the Sybase/DB module. + Thanks to Steve Willer for finding that 'stealth' bug! +- Fixed a crash bug in the GET/POST/Cookie parser in case of regular + and array variables with the same name. +- Added round() function. +- Can't use encapsed strings as variable names anymore, ie. $"blah blah". +- Fixed bug in gethostby*() functions that resulted in a core dump. + (Noticed by torben@coastnet.com.) +- Fixed bug in dbase_get_record that prevented number and date fields + from being properly decoded. (Thanks again to colins@infofind.com.) +- Make dbase_get_record include a 'deleted' field that indicates whether + that record had been marked for deletion. +- Fixed bug in dbase library that stomped on the deleted flag of the first + record in the file if it was set. (Thanks to colins@infofind.com.) +- Fixed putenv() to not report a memory leak and possibly prevent a bug + from that memory being freed. +- Added setlocale() +- Added pg_fieldisnull() (by Stephan Duehr) +- Changed pg_exec() to always return a result identifier on succees +- Solid linking fixes (tries to find the right library) +- Fixed a but with date() and the 'w' element. +- Tried to eliminate unimportant memory leak notifications. +- Made min() and max() backwards compatible and able to handle doubles. +- Add fgetc() function +- Fixed bug in getmyuid(), getmyinode() and getlastmod(). Thanks to + khim@sch57.msk.ru for pointing this out. +- Fixed http:// URL includes with no path specified send request for /. +- Added GetAllHeaders() (Apache-only) +- Added workaround that made the Image text functions 8-bit clean +- Made snmp internally compilable for Win32 (not the unix one though), + only adds 2k to binary size, so no reason not to have it there. +- Fixed ldap loading on Win32 +- Fixed MySQL Info function on Win32 platform +- Fixed compilation of syntax highlighting mode + +January 17 1998 Version 3.0b3 +- Added mysql support under windows ;) happy happy joy joy +- Fixed dbase.dll for Win32 to actualy load now. +- Enhanced the convertor to recognize ?> as a php-close-block as well. +- Fixed potential SetCookie() core dumps +- Changed print to be an expression instead of a statement. That means you can + now do stuff like foobar() or print("Unable to foobar!"). echo has NOT been + changed. +- Removed the flex optimization flags to reduce the size of the scanner +- Added memory leak logging into apache log files (apache module only) +- Fixed a nasty bug in one of the internal stacks. This may have caused + random crashes in several occassions. +- Fixed bug in ImageGif() making it hang sometimes +- Added ImageLoadFont(), ImageFontWidth() and ImageFontHeight() +- error_reporting() now returns the old error reporting level +- Fixed url includes/opens not working under Win32 +- Fixed errorneous handling of multipart/form-data input +- Added rawurlencode(), rawurldecode() and changed urlencode() and urldecode() + a bit too. +- Fixed a bug in [s]printf, sign was forgotten for doubles. +- Fixed a segfault bug in pg_fieldprtlen(), and made it accept field names + in addition to field offsets. +- Made the setup script a little more user-friendly. +- Added is_long(), is_double(), is_string(), is_array() and is_object() +- Fixed a bug in freeing of mSQL results. +- Improved pg_exec() to properly return true or false with queries that don't + return rows (i.e. insert, update, create, etc) +- Added get_cfg_var() to enable checking cfg file directives from within + a script. +- Fixed a bug with urlencode() and characters 0x80-0xff +- Changed the behaviour of ereg_replace to more intuitive. The + backslashes other than valid existing back references in the second + argument are no more evaluated as escape sequences. +- Fixed a bug in the configuration file loader and safe mode. +- Fixed a bug with configuration variables taken from the environment. +- Added <script language=php> </script> as PHP open/close tags, to allow + the use of editors such as Microsoft Frontpage. +- Fixed a bug in the default php3.ini directory - it wasn't defaulting to + /usr/local/lib properly. +- Added support for \r\n line endings +- Fixed a bug that may have prevented POST method variables from working + with certain scripts when using the CGI version. +- Convertor: Added support for single-quoted strings +- Fixed segfault bug in the Adabas module, with queries that don't return + rows (update, insert, etc). + +December 22 1997 Version 3.0b2 +- Changed variable type conversions that do not specify base to always use + base 10. "010" is no more 8, it is 10. Use intval ($x, 0) to get C-style + octal and hex numbers recognized. +- Fixed a possible segfault bug in several functions, when using the concat + operator and possibly other operators/functions. +- # is no longer accepted as a comment in php3.ini. Use ; instead. +- Added browscap support +- Configuration file directives are now case-sensitive +- Fixed msql_tablename() and msql_dbname() +- Added a PHP/FI 2.0 -> PHP 3.0 convertor +- Added support for shell/perl-style single quotes +- Added support for execution of external programs using backquotes ($a=`ls -l`) +- fixed mail() on windows, also fixed memory leaks in mail on windows +- added sendmail_from to handle return route on windows +- Changed the way the config file is searched. The file name is now + php3.ini (hardcoded), and it'll be looked for in: local directory, $PHPRC + and builtin path designated by ./configure under UNIX or Windows directory + under Windows. +- Fixed ereg_replace replacing empty matches and a one off buffer overflow +- Fixed File upload on windows platform +- Fixed a bug that caused 'HTTP/1.1 100 Continue' messages with + Internet Explorer 4.0 and certain scripts that receive POST variables +- Get/POST/Cookie data variables are from now *ALWAYS* strings. If you want + to use them in integer/real context, you must explicitly change their types. + This was done in order to avoid possible loss of data when doing these + conversions automatically. +- Variables named as keywords are now allowed (e.g. $function, $class, etc) +- Fixed a problem with msql() and mysql() with NULL fields +- Fixed a segfault bug with class declarations +- Fixed bugs with FOR loops and include() from within eval() +- Changed include() to be executed conditionally. PHP-3.0 efficient + unconditional include is now require() + +December 08 1997 Version 3.0b1 +- Switched to public beta test phase +- Generalized unset() and isset() to work on any type of variables, including + specific array indices or object properties (e.g., unset($a[4]) now works). +- Added support for object references inside encapsulated strings + (for example, 'echo "Username: $user->name"' now works) +- Added arbitary precision math support (basic operations with + unlimited range numbers, and support for unlimited decimal digits) +- Apache module can now handle preprocessed scripts (by using: + AddType application/x-httpd-php3-preprocessed .php3p + in the Apache configuration) +- Made settype() pass its first parameter by value. Improved it to be able + to convert to arrays and objects (originally by Steve Willer) +- Implemented CPU time limit on scripts when setitimer() is available +- Computed field names in the Sybase/CT and Sybase/DB modules are now named + computed, computed1, computed2, ... +- Added Sybase/CT client/server message handlers and updated the Sybase/DB ones +- Made the regexp function automatically take arguments by reference + when necessary +- Added builtin support for auto append and prepend in the parser level +- Improved the Sybase/CT sybase_query(). Should be more stable now, and + hopefully work with a wider range of queries. It's difficult to work + without docs, though, so it may still not be 100% right... +- Changed error messages to show error type, file and line with bold +- Added support for autoprepend and autoprepend +- Added some more warning flags if gcc is used + +December 03 1997 Version 3.0a4 +- Improved the internal functions API - no need to explicitly pass + parameters by reference to internal functions that specifically + require them, e.g. sort(), ksort(), reset(), count(), etc. + This is *STILL* downwards compatible with the previous alphas, + in the sense that you can explicitly pass the arguments by reference + if you want to. +- use srandom/random instead of srand/rand if available +- Added [m,My]sql_listfields() for downwards compatability +- -p now replaces .php3 extension with .php3p (otherwise it adds .php3p) +- Added C++ style comments (// comment) +- Fixed # commenting to terminate at a close PHP tag +- Added \0 back reference for full string match to *reg*_replace and + added backslash escaping to replace string +- Fixed a few bugs in the Sybase DB-library module. +- Added Sybase CT-library support. It should be considered experimental. + Syntax is identical to the one of the DB-library. Allows people to + connect to MS-SQL servers from Linux without having to pay for a + library! +- Beautified phpinfo() +- Add ImageColorClosest() and ImageColorExact() GD functions +- Make all .ini directives work as Apache .conf directives as well +- Added PHP2-like File() function with PHP3 URL support +- Upgraded the Sybase interface. It's practically MySQL compatible now! + Among other things, added sybase_fetch_array() and sybase_fetch_object(). +- Fixed problem in multi dimensional array handling and self modifying + operators (+=, -=, etc). +- Safe Mode file open implementation +- SVR3 portability problem fix + +November 23 1997 Version 3.0a3 +- Made the global statement behave like PHP 2 with undefined variables +- Added msql_fetch_object() and msql_fetch_array() +- Switched between the 1st and 2nd parameters to explode(), so that it acts + like split() +- Fixed passthru(), exec() and system() functions +- Implemented second optional parameter to intval() to specify conversion base + (The default is to assume you want to do a base 10 conversion.) +- Implemented SQL safe mode for MySQL +- Read UploadTmpDir from php3.ini instead of apache conf files +- Added mysql_fetch_object() and mysql_fetch_array() +- Changed function->old_function. function is now an alias to cfunction. +- Split the magic_quotes directive to get/post/data and other +- Added generic copy() function +- Added a $GLOBALS[] array, which contains all global variables +- Fix broken getimagesize() function +- Made mysql_fetch_field() and msql_fetch_field() optionally accept a 2nd argument +- Fixed mysql_data_seek() and msql_data_seek() +- Changed list assignment to list(...) and array init to array(...) +- Made <?php_track_vars?> work +- cgi when not in debug mode uses regular malloc(), free() functions now +- Added preliminary support for perl-style list assignments +- Fixed a bug in mysql_result() and msql_result() when specifying table +- renamed internal error-handling function and levels +- Added basename and dirname functions similar to sh counterparts +- Added base64_encode() and base64_decode() +- Support Basic authorization for http url includes +- Added parse_url() function to extract url components +- Made it possible to use anonymous ftp on URL includes +- Fixed url includes to handle different URLs better +- Fixed mysql_field*() functions +- Made mysql_connect() smarter, after a mysql_close() (applies to msql and pgsql too) + +November 6 1997 Version 3.0a2 +- Fixed a segfault bug caused by non-persistent connect in [m,My,Postgres]SQL modules +- Fix command line argument handling +- Made empty array list assignments work ($a=({});) +- Made '$' escaping optional when a variable name parsing isn't possible +- Added support for mysql_[p]connect(host) and mysql_[p]connect(host,user) +- New layout in phpinfo() +- Update Oracle extension to use php3_list functions +- Add includepath support +- Add #!php shell script escape support +- Change name of CGI/command line version from php3.cgi to php +- Add SNMP extension +- show_source() support +- Parsing of command-line args for CGI version +- Support for backreferences in ereg_replace +- Support for hexadecimal numbers directly at the scanner level +- Support octal numbers directly at the scanner level +- Fixed problem with huge html files (with little or no php code) +- Fix eval() empty string argument core dump +- renamed 'install' to 'setup' to be more accurate and avoid name conflict +- Fixed Oracle compilation +- Fixed mSQL 1.0 compilation +- Fixed a problem in the mSQL, MySQL and PostgresSQL drivers and NULL fields. +- Fixed the GLOBAL statement to be able to declare an array. + +October 29 1997 Version 3.0a1 +- Start with excellent new parser from Andi and Zeev diff --git a/ChangeLog.3 b/ChangeLog.3 deleted file mode 100644 index 7e87251faf..0000000000 --- a/ChangeLog.3 +++ /dev/null @@ -1,860 +0,0 @@ -PHP 3.0 CHANGE LOG ChangeLog -||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| - -December 24 1998, Version 3.0.6 -- Fix GetImageSize() to work with non-standard jpg images -- Add Mersenne Twister functions (mt_rand, mt_srand, etc) -- Add str_replace() function -- Add chunk_split() function -- Fixed a bug in the memory limit code, in cases where $php_errormsg was - also used. -- Add iptcparse() function -- Adobe FDF supported -- getallheaders() NULL string fix <michale@utko.fee.vutbr.cz> -- Add all configuration directives to phpinfo() page -- Functions pack() and unpack() rewritten to be binary and buffer overrun - safe and behave like the Perl functions for all implemented format codes. -- Ensured that msql_error() will not return error messages generated by - previously-run scripts. -- Add base_convert() function -- Make sprintf() and printf() output binary safe -- Made gzgetc binary safe -- Add convert_cyr_string() and quoted_printable_decode() functions -- Fix ldap_free_result() core dump bug -- Add support for current OpenLDAP-2.0-devel library -- Add php3_asp_tags directive so it can be set from Apache config files -- Added UTF-8 support in the XML extension -- Make rand(min,max) safer on older platforms where the low-order bits have - short cycles. -- Added new pdf (Portable Document Format) module -- Added an XML parsing extension using James Clark's "expat" library -- Optimized parts of the token cache code. -- Terminate on out-of-memory errors. Until now, PHP could crash in out of - memory situations (clean-up, no real effect). -- Unterminated comments in include files were being reported with the wrong line - number. Fixed. -- Added ImageCopy() and ImageColorDeallocate(). ImageCopy() is about - 20% faster than ImageCopyResized(). ImageColorDeallocate() marks - palette entries free for reuse (by <mka@satama.com>). -- In the CGI version, it was impossible to access resources (e.g. SQL links, - images) from user-defined shutdown functions. Fixed. -- Added optional third parameter to strpos() to specify the offset to - start searching from. -- Fixed a crash bug in unset() when unsetting illegal variables (rare). -- Made ImageInterlace and ImageTransparentColor parameters optional, and made - them return the current/new settings. -- Optimized GetImageSize() <thies@digicol.de>. -- Made odbc_autocommit() without args return status -- Added connect workaround for OpenLink ODBC -- Added minimal InterBase support. Tested only on 4.0 & Linux. -- Fixed some memory leaks and bogus error messages in the URL handler of - the various file open functions. Should only affect error handling - in bad URLs. - -October 5 1998 Version 3.0.5 -- mysql_field_flags now reports all MySQL flags and the result is suitable - for automatic parsing. Compatibility warning: The result format has - changed. If you have scripts parsing the result of this function, you - may need to adapt them. -- Made nl2br() binary safe (not that it's of much use). -- Fixed a bug in the API function getThis(). It affected mostly the dir - functions, if nested within objects. -- Fixed a problem in require() in conjunction with switch(), and in some other - cases. Also fixed an identical problem with the call_user_function() API - function. -- Removed -lpthread when compiling with MySQL support. It caused various - serious problems when compiled into Apache. -- Add serialize() and unserialize() functions from jkl@njet.net -- Fix in_addr_t check for systems with in_addr_t in netinet/in.h -- Add atan2() function - -September 22 1998 Version 3.0.4 -- Added uksort() - array key sort using a user defined comparison function. -- Added 'j' support to date() - generates the day of the month, without - possible leading zeros. -- Added support for multiple crypt() encryptions if the system supports it -- Added optional support for ASP-style <% %> and <%= tags -- Fixed data loss problems with very large numeric array indices on 64-bit - platforms (e.g. DEC UNIX). -- 2 cursor_type parameters for ifx_query() and ifx_prepare changed - to 1 (bitmask). Added a few constants for use in Informix module. -- Added php3.ini option ifx.charasvarchar. If set, trailing blanks - are stripped from fixed-length char columns. (Makes life easier - for people using Informix SE.) -- Static SNMP module which compiles with ucd-snmp 3.5.2 -- fixed imap_header & header_info from crashing when a header line - is > 1024 characters. -- Added patch for rfc822_parse_adr to return an array of objects instead - of a single object. -- Informix Online 7.x & SE 7.x support now fairly complete and stable -- Add dbase_get_record_with_names() function -- Added a special case for open_basedir. When open_basedir is set to "." - the directory in which the script is stored will be used as basedir. -- Include alloca.c in the distribution for platforms without alloca(). -- Improved stripping of URL passwords from error messages - the length of the - username/password isn't obvious now, and all protocols are handled properly - (most importantly, http). -- Copying objects that had member functions with static variables produced - undetermined results. Fixed. -- Added function lstat() and cleaned up the status functions, - added tests for file status functions (this may break on some plattforms) -- Fixed is_link() - it was returning always false. -- Fixed apache_note() - it was corrupting memory. -- New Function. void get_meta_tags(string filename); Parses filename until - closing head tag and turns all meta tags into variables prefixed with 'meta_'. - The below meta tag would produce $meta_test="some string here" - <meta name="test" content="some string here"> -- Generalized some internal functions in order to better support calling - user-level functions from C code. Fixes a few sporadic problems related - to constructors inside eval() and more. -- Fixed an endless loop in explode(), strstr() and strpos() in case of an - invalid empty delimiter. -- rand() now accepts two optional arguments, which denote the requested range - of the generated number. E.g., rand(3,7) would generate a random number - between 3 and 7. -- Added M_PI constant. -- Added deg2rad() and rad2deg() for converting radians<->degrees. -- ImageArc() misbehaved when given negative angles, fixed. -- Fixed a bug in ereg() that may have caused buglets under some circumstances. -- Added imap_status -- Shutdown functions, registered via register_shutdown_function(), could never - generate output in the Apache module version. Fixed. -- Brought IMAP docs into sync with acutal imap code -- imap_fetchstructure now takes in optional flags -- Fix potential core dumps in imap_append and imap_fetchtext_full -- Fix problem in SetCookie() function related to long cookies -- Add uasort() function to go along with usort (like sort() and asort()) -- Add port number to Host header as per section 14.23 of the HTTP 1.1 RFC -- Fix imap_reopen to only take 2 arguments with an optional 3rd flags arg -- Add optional 2nd argument to imap_close -- Add CL_EXPUNGE flag to imap_open() flags -- Fix 4th arg on imap_append(). It was getting converted to a long by mistake. -- Fix shutdown warning in the LDAP module -- *COMPATIBILITY WARNING* imap_fetchstructure() "parametres" object and property - name changed to "parameters" to match the documentation and to be consistent - with the rest of the API. -- Delete uploaded temporary files automatically at the end of a request -- Add upload_max_filesize and correponsing php3_upload_max_filesize directive - to control the maximum size of an uploaded file. Setting this to 0 would - completely eliminate file uploads. -- Force $PHP_SELF to PATH_INFO value when running in CGI FORCE_CGI_REDIRECT mode -- Add apache_lookup_uri() function which does an internal sub-request lookup - and returns an object containing the request_rec fields for the URI. (Yes, - you have to be a bit of a gearhead to figure this one out) -- Fix a few signed char problems causing functions like ucfirst() not to work - correctly with non-English charsets -- md5() function not binary safe - fixed - -August 15 1998 Version 3.0.3 -- Changed the name of fopen_basedir to open_basedir, to be a little more - accurate about what it does. -- Added Hyperwave module -- Added config-option (php3_)enable_dl <on/off>. This enables/disables the - dl() function. In safe-mode dl() is always disabled. -- Auto-prepended files were crashing under some circumstances - fixed. -- Win32 mail fixes provided by walton@nordicdms.com -- Comparing between arrays and/or objects now generates a warning (it always - returns false, as it used to; no comparison is made) -- Fixed a bug in the syntax highlighting code, that made ending-double-quotes - appear twice under certain circumstances. -- Fix bug in filetype() function related to symlinks -- Started integrating Informix SE support to PHP configure/makefile setup. -- gdttf roundoff fixes from ellson@lucent.com -- Added initial Informix SE support files from Danny Heijl - This code still - needs to be integrated into the PHP configure/makefile setup and the code - itself needs more work. -- return in the global scope now terminates the execution of the current file. -- Added the ability to register shutdown function(s), via - register_shutdown_function($function_name). -- Clean up const warnings -- Add write support to ftp fopen wrappers -- Add strspn() and strcspn() functions -- On systems without strerror use Apache version if compiling as Apache module -- The PHP start tag was being ignored under some circumstances - fixed. -- The db, dbase and filepro functions are now Safe-Mode aware. -- Added config-option (php3_)fopen_basedir <path>. This limits the directory- - tree scripts can open files in to <path>. -- Fixed pg_loreadall that didn't always return all the contents in a PostgreSQL - large object. Also, doesn't pass through anything if method is HEAD. -- configure fix to create target Apache module dir -- Fix core dump in imageTTFtext() function -- Added static IMAP support -- Syntax highlighting was generating additional whitespace - fixed. -- Added ucwords. Works like ucfirst, but works on all words within a string. -- Added array_walk() - apply user function to every element of an array -- Added usort() - array sort that accepts a user defined comparison function! -- Added the ability to call user-level functions and object methods on demand - from the C source using a completely generalized, slick API function. - Miracles do happen every once in a while. -- Added constructors. Don't even squeek about destructors! :) (we mean that) -- Make pg_lowrite() binary safe -- Fixed mod_charset option in ./setup -- Fixed rewinddir() and dir()::rewind() under Win32 (they didn't work before). -- Add Win32 COM support! By-name referencing is supported using the IDispatch - interface (automation). Available functions - COM_Load(), COM_Invoke(), - COM_PropGet() and COM_PropSet(). - -July 20 1998 Version 3.0.2a -- Fix a quirk in the configuration file parser, the endless fountain of joy - and fun. -- Fix a bug in the API function add_method() that made dir() crash. - -July 18 1998 Version 3.0.2 -- Compile cleanups for *BSD -- Add support for the OpenLink ODBC Drivers -- Add PHP_SELF, PHP_AUTH_* and HTTP_*_VARS PHP variables to phpinfo() output -- Add workaround for broken makes -- Add Apache 1.3.1 support (some Apache header files were moved around) -- Added apache_note() function. -- Fix order of system libraries and detect libresolv correctly -- Fixed a bug in the Sybase-DB module. Several numeric field types were - getting truncated when having large values. -- Added testpages for unified odbc -- Fix php -s seg fault when filename was missing -- Made getdate() without args default to current time -- Added ImageColorResolve() and some fixes to the freetype support. -- Added strcasecmp() -- Added error_prepend_string and error_append_string .ini and .conf directives - to make it possible to configure the look of error messages displayed by PHP - to some extent -- Added E_ERROR, E_WARNING, E_NOTICE, E_PARSE and E_ALL constants, that can be - used in conjunction with error_reporting() - (e.g. error_reporting(E_ERROR|E_WARNING|E_NOTICE); -- Fixed a crash problem with classes that contained function(s) with default - values. -- Fixed a problem in the browscap module. Browscap files weren't being read - properly. -- Fix -L path in libphp4.module to make ApacheSSL compile without errors -- Fix StripSlashes so it correctly decodes a \0 to a NUL - -July 04 1998 Version 3.0.1 -- echo/print of empty strings don't trigger sending the header anymore. -- Implemented shift left and shift right operators (<< and >>) -- Compile fix for cc on HP-UX. -- Look for beta-version Solid libraries as well. -- Make GD module show more info in phpinfo(). -- Compile fix for NextStep 3.0. -- Fix for Oracle extension on OSF/1. -- Fix gd 1.3 bug in ImageColorAt(). -- pg_loread() hopefully handles binary data now. -- Turned off some warnings in dns.c -- Added ImageTTFBBox() and made ImageTTFText() return bounding box. -- Added constants for Ora_Bind()'s modes. -- Renamed all hash_*() routines to _php3_hash_*() to avoid clashes with other - libraries. -- Changed uodbc default LONG behaviour: longreadlen 4096 bytes, binmode 1. - The module now actually uses the php.ini settings. -- New PostgreSQL functions: pg_fetch_row(), pg_fetch_array() - and pg_fetch_object() -- Fix a segmentation fault when calling invalid functions in certain - circumstances -- Fix bug that caused link-related functions to not pay attention to - run-time safe mode setting (it was using whatever was set at compile time). -- Fix bug in exec() function when used in safe mode - -June 6 1998 Version 3.0 -- Add checkdnsrr function (check availability DNS records) -- Add getmxrr function (get MX hostnames and weights) -- Fixed bug in nl2br() function -- Fix for an RC5 related problem in the Sybase module, when dealing - with very long data types. -- Speed up string concatenation by roughly a factor of 2 -- Add escape-handling to date function -- Make base64 functions binary safe -- Add strrpos function to complement strpos function added in RC5 -- Add ltrim function (strips only at the start of string) -- Add rtrim as an alias to chop() for completeness sake -- Add trim function (similar to chop, except it strips at the start as well) -- Added 2 optional args to fsockopen function - errno and errstr -- Fixed bug in split() function related to leading matches -- Fixed problem in error_log() function (thanks to Jan Legenhausen) -- empty("0") was returning true - fixed -- Removed the old sybsql module. Use the new sybase_*() functions instead. -- Several fixes to the configuration file parser -- LDAP fixes - fixed return values on several functions - -May 23 1998 Version 3.0RC5 -- The BC math library functions now compile in by default. -- Fixed a bug in virtual() and other types of SSI's (e.g. <!--#exec). Under - certain circumstances, this used to result in random problems. -- Fixed a bug in virtual(). It was misbehaving if it was called before any - other output. -- Added mysql.default_port, mysql.default_host, mysql.default_user and - mysql.default_password ini-file directives. -- Improved handling of the MySQL default port. It now honors /etc/services - and $MYSQL_TCP_PORT. -- Fixed a crash in opening of broken ftp:// URLs, and improved error reporting - in opening of URLs. -- Fixed several non-critical scanner issues with syntax highlighting mode and - the <script language=php> tag. -- Fixed fseek on windows. (windows only): fseek will not return proper results - on files opened as text mode. PHP uses binary mode as the default for file - operations, but this can be overiden by fopen. Do not open files in text - mode and use fseek on them! -- Add strpos() function -- Added zlib module, requires zlib >= 1.0.9 -- Improved the module API implementation. Dynamic modules may now register - persistent resources (not that it makes much sense, but at least PHP - won't crash). The API itself remains unchanged. -- bcmod() wasn't always behaving like modulus should behave (it was behaving - exactly like GNU bc's % operator). Fixed. -- Changed the Sybase-DB module to always return strings, instead of auto-typing - result sets. This was done for consistency with the other database modules, - and in order to avoid overflows due to the platform-dependant limitations - of the numeric data types of PHP. You can turn compatability mode on using - the sybase.compatability_mode directive in the php3.ini file. -- Fixed problems with the TINYINT field in the Sybase-CT module. -- Applied some small speed optimizations to the Sybase-DB module querying code. -- Added 'numeric' and 'type' properties to the object returned by - sybase_fetch_field(). -- The 'new' operator doesn't accept all expressions anymore. Instead, it - accepts a class name, or a variable reference (scalar, array element, etc). -- Add ora_numcols() function -- Add ora_do() and ora_fetch_into() functions to Oracle driver -- Add persistent connection support to Oracle driver -- Make Oracle driver clean up open connections and open cursors automatically -- Added fread() and fwrite() that properly handle binary data. -- Add Ora_ColumnSize() to Oracle code -- The string "0" means FALSE again. This was done in order to maintain type - conversion consistency. -- Added solid_fetch_prev() for fetching the previous result row from Solid. -- Huge integers are now automatically converted to floating point numbers - (that have a wider range). -- Floating point numbers are now displayed using scientific notation when - they're extremely big or extremely small. The 'precision' php3.ini directive - no longer designates the number of decimal digits, but rather, the maximum - number of significant digits required. -- Added support for scientific notation for floating point numbers (e.g. 1E7) - throughout the entire language. -- Fixed a potential/probable memory corruption problem with HEAD request - handling. -- Using un-encapsulated strings now generates a NOTICE-level warning - (e.g. $a = foo; instead of $a = "foo";) -- Added defined("name") function to check if a certain constant is defined - or not. -- Support new Apache mechanism for setting SERVER_SUBVERSION -- Added PHP_OS and PHP_VERSION constants -- Added the ability to define constants in runtime! Constants are script-wide, - (there's no scope, once the constant is defined, it's valid everywhere). - Syntax is define("name", $value [, $case_insensitive]). 'name' can be any name - that is a valid variable name, *without* the $ prefix. 'value' can be - any *scalar* value. If the optional 'case_insensitive' parameter is 1, - then the constant is created case-insensitive (the default is case - sensitive). Note: define() is currently *NOT* supported in preprocessed - scripts. -- Added general support for constants. The Syslog constants (e.g. - LOG_ERR, LOG_CRIT, etc.) should be accessed as constants from now on (that - is, without a $ prefix). You can still set define_syslog_variables to On - in the php3.ini file if you want to define the various $ variables. The - default for this directive in the php3.ini-dist file has been changed to - Off. -- The configuration file path variable now expands . and .. into their - respective directories. You can obtain the path of the php3.ini file - that was used by printing get_cfg_var("cfg_file_path"). -- Fixed a crash-recovery parser crash ($a=7; $a[3]+=5;) -- Add gmmktime() function -- Fixed a crash with implode() and empty arrays. -- Fixed a bug that, under fairly rare circumstances, caused PHP not to - recognize if(), require() and other statements as statements, and - to complain about them as being unsupported functions. -- Beautified php3.ini-dist and added more comments to it. Also changed - the behavior of the configuration file parser to be brighter about - the various constants (TRUE/FALSE/ON/OFF etc). -- Fixed a bug in openlog() - the specified device name was being mangled. -- Memory leaks were sometimes reported erroneously - fixed. -- Improved the convertor to handle some quirks of the PHP/FI 2 parser with - comments. -- Fixed number_format() to properly handle negative numbers, and optimized it - a bit. -- Fixed static variables inside class member functions. Note that using such - static variables inside member functions usually defeats the purpose of - objects, so it is not recommended. -- Fixed a bug in fpassthru() (the file was being closed twice). -- Added strftime(). -- Add set_socket_blocking() function to control blocking on socket fd's -- The sendmail_path in php3.ini was being ignored - fixed. -- Fixed a bug with file upload, with files that contained the MIME boundary - inside them. -- Fixed a bug with form variables of type array, with spaces in their - index (e.g. name="foo[bar bar]"). -- gd-1.3 autodetect and support -- Year 2000 compliance is now togglable from the php3.ini file. Setting PHP - to be y2k compliant effects the way it creates cookies, and means it'll - NOT work with many browsers out there that are not y2k compliant! For - that reason, the default for this option is off. -- safe mode / fix from monti@vesatec.com -- Integrated the FreeType support in the GD extension. -- Added --with-gd=DIR and --without-gd options to configure - -April 18 1998 Version 3.0 Release Candidate 4 -- Auto-prepended and auto-appended files were reporting the wrong filename - in errors and in __FILE__ - fixed. -- Fix GPC problem related to mixed scalar and array vars with the same name -- Made putenv() Apache-safe. Environment variables may no longer leak in - between requests. -- The trailing semicolon is no longer required in class declarations. -- Fixed a memory leak in the (array) and (object) operators under certain - conditions. -- <script> tags weren't working unless short tags were enabled - Fixed. -- Fixed a bug in certain array indices that weren't treated as numbers - even though they looked like numbers (e.g. "10", "20"). -- Changes to support renamed API functions in Apache-1.3 -- Fixed the -p and -e command line switches -- Fix a segfault when calling command line version without parameters -- Fix for feof() when used on a socket -- Fix off-by-one error in fgets() when used on a socket -- Fix bug in ImageSetPixel() (Thanks to ecain@Phosphor.net) - -March 31 1998 Version 3.0 Release Candidate 3 -- Tiny bugfix for magic_quotes_sybase -- Fix Apache build problems introduced in RC2 -- $a["0"]==$a[0] fix -- Apache-1.3 build changes to support 100% automatic builds and shared library - module builds. See INSTALL file. - -March 30 1998 Version 3.0 Release Candidate 2 -- Changed the socket implementation under UNIX to not use FILE pointers, in - order to work around the buggy Solaris libc (and possibly buggy libc's - in other platforms). -- Fixed a bug in min() and max() with certain arrays. -- *WARNING* Move Apache 1.3 php3 file install to src/modules/php4 instead of - src/modules/extra. Make sure you change your AddModule line correctly - in your Apache Configuration file. This change is to take advantage of - new Apache-1.3 configuration mechanism which makes it easier to build an - Apache server with PHP automatically enabled. It will also help building - a shared library module version of PHP soon. -- Fixed a crash bug with auto-appended files. -- Made --enable-discard-path work on all Unix servers #!/path/php CGI scripts - should now work everywhere. I have tested on Apache, WN and Netscape 2.0 -- Made $a["123"] and $a[123] be identical. $a["0123"] is still different, - though. -- Added 'precision' ini directive, to set the number of decimal digits - displayed for floating point numbers (default - 6). -- Made integer/integer divisions evaluate to floating point numbers when - applicable (e.g., 5/2==2.5(float), but 4/2==2(int)) -- Get rid of reliance on tied streams and move all socket reads and writes - to recv/send calls -- Cleaned up head.c a bit and fixed CGI SetCookie order problem -- Changed default variable parsing order to Get-Cookie-Post (GPC) -- Fixed setup so it has all configure options and defaults. -- Added optional decimal point and thousands seperator to number_format() - e.g., number_format(1500,2,',','.') == 1.500,00 -- Fixed cgi bug in windows that prevented files from being parsed on many - systems and servers. - -March 23 1998 Version 3.0 Release Candidate -- Added support for the Raima database (ALPHA) -- Fixed a bug in persistent PostgreSQL links and the connection-string method. -- Added EXTENSION_STATUS file, that specifies the stability and status of - every module in the distribution. -- Added optional parameters to user functions with default values, variables - that are forced to be passed by reference and variables that can be - optionally passed by reference. The ini file directive - 'ignore_missing_userfunc_args' is no longer supported. -- Added fhttpd support (by Alex Belits) -- Improved performance by approximately 20-30%. -- Added mysql_error(), mysql_errno() (if available) and msql_error(). - Errors coming back from the database backend no longer issue warnings. - Instead, use these functions to retreive the error. -- Patched count(), each(), prev(), next(), reset() and end() to work around - the implementation side effects of unset(). As far as the users are - concerned, this should be transparent now (even though it's slower now, - until it's thoroughly fixed in 3.1). -- Added number_format(). number_format(2499,2)=='2,499.00'. -- error_reporting() now sets the error reporting level to the supplied - argument, without any interpretations. -- Fixed a lookahead parser bug that occured under rare circumstances. -- Change the comparison operators to compare numeric strings as numbers. If - you want to compare them as strings, you can use the new C-like strcmp() -- Fixed Ora_GetColumn() bug when fetching strings -- Added Ora_ColumnName() and Ora_ColumnType() -- Preliminary LONG and LONG RAW support in Oracle extension -- Add \123 and \xAB style octal and hex escapes to "" and `` strings -- Add "-c" command line flag for specifying path to php3.ini file -- Improved list() so that elements can be skipped, for example: - list($name,,,$realname) = explode(":",fgets($passwd_file)); -- Fixed a tiny bug in the hash initialization which caused excessive use of - memory. Report and fix by short@k332.feld.cvut.cz -- Fixed strtolower() and strtoupper() to work with 8-bit chars -- Fixed to compile and run on SunOS 4.1 -- Fixed a crash in soundex() of an empty string -- Fixed parse_str() - it wasn't always defining the right variables, - and didn't work with arrays. -- Made [m,My]SQL create/drop database functions return success status -- Fixed some memory leak/crash problems in the Adabas module -- Added each() in order to allow for easy and correct array traversing. -- Make Apache module version respect LOCALE setting -- Add support for Apache 1.3b6+ ap_config.h file -- Fixed a nasty corruption bug in eval() and show_source() that resulted in - script termination (e.g. eval("exit();"). -- Fixed a syntax highlighting problem with keywords used as variable - names. -- Fixed a possible crash and/or file descriptor leak -- Fixed line number being off by one in #! shell style execution -- Made it possible to disable auto_prepend/append with "none" filename -- Allow safe CGI calling through #!php style scripts - -March 2 1998 Version 3.0b6 -- Made [s]printf handle %ld -- Changed CGI version to only open regular files as input script -- Added ignore_missing_userfunc_args directive to suppress warnings messages - about missing arguments to user-defined functions -- Added Postgres function - pg_cmdtuples(), by Vladimir Litovka -- Disabled command line options if used as CGI -- Changed CGI version to use PATH_TRANSLATED as the script file name -- Link with solid shared library instead of static one -- Fixed a crash with functions that aren't being called correctly -- Fixed file descriptor leak in auto-prepend/append -- Imap module is usable. See README in dl/imap. - -February 24 1998 Version 3.0b5 -- Made the URL aware file functions be enabled by default -- Fixed an unlikely crash bug in the parser, with uninitialized array elements - which are refered to as objects. -- Fixed several fields that were being incorrectly read in Sybase CT. -- Fix Apache-1.3 related SIGHUP problem which was preventing php3.ini from - getting re-read on a SIGHUP -- *** WARNING *** Downwards incompatible change: The plus operator (+) is not - longer overloaded as concatenation for strings. Instead, it converts its - arguments to numbers and performs numeric addition. -- Add Stig and Tin's bdf2gdfont script to extra/gd directory -- Added join() as an alias to implode() -- Made implode() accept arguments in the order used by explode() as well -- Made $php_errormsg local in function calls -- Fixed Apache configuration directive bugs -- Added a number of .ini directives to Apache .conf directive list -- Fixed a 'memory leak' with strtok() -- echo/print now handle binary data correctly. -- NEW now accepts any expression for the class name argument. -- Add ImageDashedLine() GD function -- Add arg_separator .ini directive so the '&' GET method separator can be - changed to ';' for example. Corresponding php3_arg_separator Apache .conf - directive works as well. -- Walked around an implementation side effect of switch(). <? switch(expr) { ?> - now works. -- Added memory caching, resulting in a significant performance boost -- Added support for for(): .. endfor; loops -- Added a new predicate - empty($var). Returns true if $var is not set, - or is FALSE. Returns false otherwise. -- Added is_integer() (same as is_long()) and is_real() (same as is_double()). -- Added sizeof() as an alias to the count() function -- Added --enable-force-cgi-redirect, to prevent the CGI from working if - someone directly accesses PHP not through Apache's CGI redirect - (off by default). -- Fixed marking of deleted dBase records. Noticed by Simon Gornall - <simon@oyster.co.uk>. -- Fixed fixed "%%" bug in [s]printf -- Fixed a UMR (initialized memory read) in the Oracle code -- Potential fix for mysql-related SIGPIPE problem which caused httpd to spin -- Made PHP responsive to the Apache link status (stop executing if the link - dies). -- Fixed a crash bug with StrongHold and secure pages -- Fixed StrongHold installation -- Optimized the function call sequence a bit. -- Fixed Sybase/CT date/datetime/money fields work to correctly. -- Fixed Apache module startup problems - php3_module_startup should only be - called once. -- Fixed ord() with characters >127 -- Fixed bug in file_exists() function -- Fixed stripslashes() to remove the escaping quote (instead of backslash) - in case magic_quotes_sybase is true. -- Also make echo and print automatically remove trailing decimal zeros. -- Added htmlentities(), currently handling only ISO-8859-1 entities -- "0" is no longer considered false, the only string which is false is the - empty string "". -- Added 'true' and 'false' keywords -- Added 'xor' (logical exclusive or) -- Automatic conversion from double to string removes decimal trailing zeros. -- Added arsort() and rsort() to sort in descending order. -- Turned on "XLATOPT_NOCNV" by default for uODBC/Solid. -- Added support for a port number in the mysql_(p)connect() functions -- Fixed a file descriptor leak in the configuration parser. -- Fixed a few buglets with syntax highlighting with certain language keywords -- Added functions to control minimum severity level of Sybase messages to - display. -- Added highlight_string() - behaves like highlight_file(), only instead - of highlighting a file, it syntax highlights the contents of its - argument. -- Renamed show_source() to highlight_file(). show_source() is still - supported for downwards compatability. -- Fixed a bug in class inheritence - member functions with upper case - letters in their names couldn't be redefined. -- Made chown(), chgrp() and chmod() return TRUE/FALSE instead of 0/-1. - -February 02 1998 Version 3.0b4 -- Fixed a segfault bug in one of the unified ODBC error messages. -- Set default file modes to binary on Win32 (solved a lot of bs) -- Fixed file copy on Win32 -- MIME file uploads fixed on Win32 -- Added contributed icons by Colin Viebrock (undex extra/icons) -- Fixed the debugger enough to call it "beta code". -- Fixed some leaks in the Oracle module, tidied up the code a bit. -- Added __FILE__ and __LINE__ which evaluate to the currently parsed file - and currently parsed line respectively. -- Added ImageColorAt(), ImageColorSet(), ImageColorsForIndex(), and - ImageColorsTotal() to allow manipulating the palette of GIF images. -- Rename '--enable-url-includes' option to '--enable-url-fopen-wrapper' to - better describe what it does, and pay attention to the setting. -- Added optional parameter to the file(), readfile() and fopen() functions - to look for files located in the include path. -- Fixed bug that allowed the file() and readfile() to open files in the - include path inadvertantly. -- Fixed a (documented) bug in printf()/sprintf() with hard limited strings - and alignment (e.g. %-.20s). -- Optimized several quoted string routines. -- Added error_log ini directive to select where errors get logged when - log_errors is turned on or the error_log() function is used. -- Added the ability to direct errors to log files instead of or in addition - to the script output. Use the new display_errors and log_errors - php3.ini directives. -- Made environment variables uneraseable by POST/GET/Cookie variables. -- Fixed a bug in the elseif() construct. The expression was being evaluated - even if a previous if/elseif already evaluated to true and got executed. -- Fixed a bug in the exit code parameter of system() -- Tighten up all exec() related functions in safe mode -- Added error_log() function to log messages to the server error log, or - stderr for the CGI version. -- Added support for a general memory limit of scripts. -- Fixed a segfault bug that occured under certain circumstances with shell - escapes ($foo = `...`) -- Made keywords be valid property names of objects. -- Fixed a segfault bug when creating new objects of an unknown class. -- Fixed a problem with the maximum execution time limit, that may have - prevented this feature from working on certain platforms. -- PHP would now warn you with E_NOTICE about unknown escape characters, - e.g. "\f". It would still be considered as a backslash followed by f, - but the proper way of writing this is "\\f" or '\f'. -- Added support for ${...} inside encapsulated strings. Supported: ${foo}, - ${foo[bar]}, ${foo[0]}, ${$foo[$bar]}, ${$foo->bar} and ${$foo} -- Fixed a bug in automatic persistent link reconnect of the Sybase/DB module. - Thanks to Steve Willer for finding that 'stealth' bug! -- Fixed a crash bug in the GET/POST/Cookie parser in case of regular - and array variables with the same name. -- Added round() function. -- Can't use encapsed strings as variable names anymore, ie. $"blah blah". -- Fixed bug in gethostby*() functions that resulted in a core dump. - (Noticed by torben@coastnet.com.) -- Fixed bug in dbase_get_record that prevented number and date fields - from being properly decoded. (Thanks again to colins@infofind.com.) -- Make dbase_get_record include a 'deleted' field that indicates whether - that record had been marked for deletion. -- Fixed bug in dbase library that stomped on the deleted flag of the first - record in the file if it was set. (Thanks to colins@infofind.com.) -- Fixed putenv() to not report a memory leak and possibly prevent a bug - from that memory being freed. -- Added setlocale() -- Added pg_fieldisnull() (by Stephan Duehr) -- Changed pg_exec() to always return a result identifier on succees -- Solid linking fixes (tries to find the right library) -- Fixed a but with date() and the 'w' element. -- Tried to eliminate unimportant memory leak notifications. -- Made min() and max() backwards compatible and able to handle doubles. -- Add fgetc() function -- Fixed bug in getmyuid(), getmyinode() and getlastmod(). Thanks to - khim@sch57.msk.ru for pointing this out. -- Fixed http:// URL includes with no path specified send request for /. -- Added GetAllHeaders() (Apache-only) -- Added workaround that made the Image text functions 8-bit clean -- Made snmp internally compilable for Win32 (not the unix one though), - only adds 2k to binary size, so no reason not to have it there. -- Fixed ldap loading on Win32 -- Fixed MySQL Info function on Win32 platform -- Fixed compilation of syntax highlighting mode - -January 17 1998 Version 3.0b3 -- Added mysql support under windows ;) happy happy joy joy -- Fixed dbase.dll for Win32 to actualy load now. -- Enhanced the convertor to recognize ?> as a php-close-block as well. -- Fixed potential SetCookie() core dumps -- Changed print to be an expression instead of a statement. That means you can - now do stuff like foobar() or print("Unable to foobar!"). echo has NOT been - changed. -- Removed the flex optimization flags to reduce the size of the scanner -- Added memory leak logging into apache log files (apache module only) -- Fixed a nasty bug in one of the internal stacks. This may have caused - random crashes in several occassions. -- Fixed bug in ImageGif() making it hang sometimes -- Added ImageLoadFont(), ImageFontWidth() and ImageFontHeight() -- error_reporting() now returns the old error reporting level -- Fixed url includes/opens not working under Win32 -- Fixed errorneous handling of multipart/form-data input -- Added rawurlencode(), rawurldecode() and changed urlencode() and urldecode() - a bit too. -- Fixed a bug in [s]printf, sign was forgotten for doubles. -- Fixed a segfault bug in pg_fieldprtlen(), and made it accept field names - in addition to field offsets. -- Made the setup script a little more user-friendly. -- Added is_long(), is_double(), is_string(), is_array() and is_object() -- Fixed a bug in freeing of mSQL results. -- Improved pg_exec() to properly return true or false with queries that don't - return rows (i.e. insert, update, create, etc) -- Added get_cfg_var() to enable checking cfg file directives from within - a script. -- Fixed a bug with urlencode() and characters 0x80-0xff -- Changed the behaviour of ereg_replace to more intuitive. The - backslashes other than valid existing back references in the second - argument are no more evaluated as escape sequences. -- Fixed a bug in the configuration file loader and safe mode. -- Fixed a bug with configuration variables taken from the environment. -- Added <script language=php> </script> as PHP open/close tags, to allow - the use of editors such as Microsoft Frontpage. -- Fixed a bug in the default php3.ini directory - it wasn't defaulting to - /usr/local/lib properly. -- Added support for \r\n line endings -- Fixed a bug that may have prevented POST method variables from working - with certain scripts when using the CGI version. -- Convertor: Added support for single-quoted strings -- Fixed segfault bug in the Adabas module, with queries that don't return - rows (update, insert, etc). - -December 22 1997 Version 3.0b2 -- Changed variable type conversions that do not specify base to always use - base 10. "010" is no more 8, it is 10. Use intval ($x, 0) to get C-style - octal and hex numbers recognized. -- Fixed a possible segfault bug in several functions, when using the concat - operator and possibly other operators/functions. -- # is no longer accepted as a comment in php3.ini. Use ; instead. -- Added browscap support -- Configuration file directives are now case-sensitive -- Fixed msql_tablename() and msql_dbname() -- Added a PHP/FI 2.0 -> PHP 3.0 convertor -- Added support for shell/perl-style single quotes -- Added support for execution of external programs using backquotes ($a=`ls -l`) -- fixed mail() on windows, also fixed memory leaks in mail on windows -- added sendmail_from to handle return route on windows -- Changed the way the config file is searched. The file name is now - php3.ini (hardcoded), and it'll be looked for in: local directory, $PHPRC - and builtin path designated by ./configure under UNIX or Windows directory - under Windows. -- Fixed ereg_replace replacing empty matches and a one off buffer overflow -- Fixed File upload on windows platform -- Fixed a bug that caused 'HTTP/1.1 100 Continue' messages with - Internet Explorer 4.0 and certain scripts that receive POST variables -- Get/POST/Cookie data variables are from now *ALWAYS* strings. If you want - to use them in integer/real context, you must explicitly change their types. - This was done in order to avoid possible loss of data when doing these - conversions automatically. -- Variables named as keywords are now allowed (e.g. $function, $class, etc) -- Fixed a problem with msql() and mysql() with NULL fields -- Fixed a segfault bug with class declarations -- Fixed bugs with FOR loops and include() from within eval() -- Changed include() to be executed conditionally. PHP-3.0 efficient - unconditional include is now require() - -December 08 1997 Version 3.0b1 -- Switched to public beta test phase -- Generalized unset() and isset() to work on any type of variables, including - specific array indices or object properties (e.g., unset($a[4]) now works). -- Added support for object references inside encapsulated strings - (for example, 'echo "Username: $user->name"' now works) -- Added arbitary precision math support (basic operations with - unlimited range numbers, and support for unlimited decimal digits) -- Apache module can now handle preprocessed scripts (by using: - AddType application/x-httpd-php3-preprocessed .php3p - in the Apache configuration) -- Made settype() pass its first parameter by value. Improved it to be able - to convert to arrays and objects (originally by Steve Willer) -- Implemented CPU time limit on scripts when setitimer() is available -- Computed field names in the Sybase/CT and Sybase/DB modules are now named - computed, computed1, computed2, ... -- Added Sybase/CT client/server message handlers and updated the Sybase/DB ones -- Made the regexp function automatically take arguments by reference - when necessary -- Added builtin support for auto append and prepend in the parser level -- Improved the Sybase/CT sybase_query(). Should be more stable now, and - hopefully work with a wider range of queries. It's difficult to work - without docs, though, so it may still not be 100% right... -- Changed error messages to show error type, file and line with bold -- Added support for autoprepend and autoprepend -- Added some more warning flags if gcc is used - -December 03 1997 Version 3.0a4 -- Improved the internal functions API - no need to explicitly pass - parameters by reference to internal functions that specifically - require them, e.g. sort(), ksort(), reset(), count(), etc. - This is *STILL* downwards compatible with the previous alphas, - in the sense that you can explicitly pass the arguments by reference - if you want to. -- use srandom/random instead of srand/rand if available -- Added [m,My]sql_listfields() for downwards compatability -- -p now replaces .php3 extension with .php3p (otherwise it adds .php3p) -- Added C++ style comments (// comment) -- Fixed # commenting to terminate at a close PHP tag -- Added \0 back reference for full string match to *reg*_replace and - added backslash escaping to replace string -- Fixed a few bugs in the Sybase DB-library module. -- Added Sybase CT-library support. It should be considered experimental. - Syntax is identical to the one of the DB-library. Allows people to - connect to MS-SQL servers from Linux without having to pay for a - library! -- Beautified phpinfo() -- Add ImageColorClosest() and ImageColorExact() GD functions -- Make all .ini directives work as Apache .conf directives as well -- Added PHP2-like File() function with PHP3 URL support -- Upgraded the Sybase interface. It's practically MySQL compatible now! - Among other things, added sybase_fetch_array() and sybase_fetch_object(). -- Fixed problem in multi dimensional array handling and self modifying - operators (+=, -=, etc). -- Safe Mode file open implementation -- SVR3 portability problem fix - -November 23 1997 Version 3.0a3 -- Made the global statement behave like PHP 2 with undefined variables -- Added msql_fetch_object() and msql_fetch_array() -- Switched between the 1st and 2nd parameters to explode(), so that it acts - like split() -- Fixed passthru(), exec() and system() functions -- Implemented second optional parameter to intval() to specify conversion base - (The default is to assume you want to do a base 10 conversion.) -- Implemented SQL safe mode for MySQL -- Read UploadTmpDir from php3.ini instead of apache conf files -- Added mysql_fetch_object() and mysql_fetch_array() -- Changed function->old_function. function is now an alias to cfunction. -- Split the magic_quotes directive to get/post/data and other -- Added generic copy() function -- Added a $GLOBALS[] array, which contains all global variables -- Fix broken getimagesize() function -- Made mysql_fetch_field() and msql_fetch_field() optionally accept a 2nd argument -- Fixed mysql_data_seek() and msql_data_seek() -- Changed list assignment to list(...) and array init to array(...) -- Made <?php_track_vars?> work -- cgi when not in debug mode uses regular malloc(), free() functions now -- Added preliminary support for perl-style list assignments -- Fixed a bug in mysql_result() and msql_result() when specifying table -- renamed internal error-handling function and levels -- Added basename and dirname functions similar to sh counterparts -- Added base64_encode() and base64_decode() -- Support Basic authorization for http url includes -- Added parse_url() function to extract url components -- Made it possible to use anonymous ftp on URL includes -- Fixed url includes to handle different URLs better -- Fixed mysql_field*() functions -- Made mysql_connect() smarter, after a mysql_close() (applies to msql and pgsql too) - -November 6 1997 Version 3.0a2 -- Fixed a segfault bug caused by non-persistent connect in [m,My,Postgres]SQL modules -- Fix command line argument handling -- Made empty array list assignments work ($a=({});) -- Made '$' escaping optional when a variable name parsing isn't possible -- Added support for mysql_[p]connect(host) and mysql_[p]connect(host,user) -- New layout in phpinfo() -- Update Oracle extension to use php3_list functions -- Add includepath support -- Add #!php shell script escape support -- Change name of CGI/command line version from php3.cgi to php -- Add SNMP extension -- show_source() support -- Parsing of command-line args for CGI version -- Support for backreferences in ereg_replace -- Support for hexadecimal numbers directly at the scanner level -- Support octal numbers directly at the scanner level -- Fixed problem with huge html files (with little or no php code) -- Fix eval() empty string argument core dump -- renamed 'install' to 'setup' to be more accurate and avoid name conflict -- Fixed Oracle compilation -- Fixed mSQL 1.0 compilation -- Fixed a problem in the mSQL, MySQL and PostgresSQL drivers and NULL fields. -- Fixed the GLOBAL statement to be able to declare an array. - -October 29 1997 Version 3.0a1 -- Start with excellent new parser from Andi and Zeev diff --git a/ChangeLog.TODO b/ChangeLog.TODO index 413b1ff765..864375cb54 100644 --- a/ChangeLog.TODO +++ b/ChangeLog.TODO @@ -15,6 +15,10 @@ over to PHP4. - PUT method support (mlemos@acm.org) - Fix parameter count problem in odbc_setoption() - Really fix implode() this time. The fix in 3.0.7 was bogus +- Added more option to the date() function: (Colin Viebrock) + 'g' - hour, 12-hour format, no leading zeros + 'G' - hour, 24-hour format, no leading zeros + 'n' - month, numeric, no leading zeros - Make fgetss() slightly smarter - Add strip_tags() which uses the fgetss state-machine but acts on a string diff --git a/EXTENSION_STATUS b/EXTENSION_STATUS new file mode 100644 index 0000000000..48be544e2d --- /dev/null +++ b/EXTENSION_STATUS @@ -0,0 +1,54 @@ +The core of PHP 3.0 is considered to be stable at this time. However, some of +the modules that are bundled with it are still undergoing development, or +contain known bugs. The purpose of this file is to document the status of +each module (extension). Patches to unstable modules will be available through +the CVS, and through periodic maintenance releases. + +Stability scale: +Rock solid - We believe it's safe to base a production site on it. +Stable - It should be safe to base a production site on it. + Isn't rated as rock-solid because it contained problems + in the not-so-far past, or doesn't have enough users + to test it to know it's rock solid. +Beta - This module probably contains bugs, sometimes even known + bugs. You can give it a try and there's a good chance + it'll work fine, but it might not be a good idea to base + a production site on it. +Alpha - This module is in initial development steps. Don't trust + it, play with it at your own risk. +Deprecated - This module is only available for downwards compatability, + and will not be supported in any way. The code quality + is usually around the Beta status. + +The standard disclaimers apply, that is, if a rock-solid module blows up on +you and ruins your site, nobody in the PHP development team is responsible. +We'll probably try to help, though. + + +Extension Name Status Comments +----------------------------------------------------------------------------- +DBM Rock Solid That relies on a working DBM library. + The flatfile support is probably not + as stable. +MySQL Rock Solid +mSQL Rock Solid +Sybase DB Stable +Sybase CT Stable +BC Math Rock Solid Arbitary precision math library +Postgres SQL Stable Postgres 6.2 and earlier is stable, + but problems were reported with 6.3 +Debugger Beta +Unified ODBC Beta +Solid Deprecated Replaced by Unified ODBC +iODBC Deprecated Replaced by Unified ODBC +Adabas Deprecated Replaced by Unified ODBC +LDAP Stable Lightweight Directory Access Protocol. +dBase +FilePro +Oracle Beta Not tested thoroughly enough. +IMAP Beta Bundled in the dl/ directory +SNMP Stable Very solid, but also very limited. + Only supports GET and WALK requests. +Raima Velocis Beta If use with Unified ODBC, replaced + by Unified ODBC +Raima Velocis Alpha If use without Unified ODBC diff --git a/MODULES_STATUS b/MODULES_STATUS index 619e9884ec..e9873366f8 100644 --- a/MODULES_STATUS +++ b/MODULES_STATUS @@ -1,17 +1,16 @@ -Module Status ------- ------ -MySQL Working -COM Working -WDDX Working -PCRE Working -DBA Working -mcrypt Working -mhash Working -dbase Working -aspell Working -imap Working -ldap Working -oci8 Working (but no blob-support yet) -oracle Working -iptc Working -informix Working +Module Status +------ ------ +MySQL Working +COM Working +WDDX Not yet ported +PCRE Working +DBA Not yet ported +mcrypt Working +mhash Working +dbase Working +aspell Working +imap Working +ldap Working +oci8 Working (but no blob-support yet) +oracle Working +iptc Working diff --git a/Makefile.in b/Makefile.in index 79c7711b3b..8b5da2c8f7 100644 --- a/Makefile.in +++ b/Makefile.in @@ -65,7 +65,6 @@ APXS_LDFLAGS = $(EXTRA_LIBS) $(LIBS) APXS_EXP = @APXS_EXP@ WARNING_LEVEL = @WARNING_LEVEL@ LEX_CFLAGS = -w$(WARNING_LEVEL) @LEX_CFLAGS@ -EXT_SHARED = @EXT_SHARED@ SOURCE = main.c internal_functions.c snprintf.c php3_sprintf.c \ configuration-parser.c configuration-scanner.c request_info.c \ @@ -171,6 +170,7 @@ distdir: flex -Pcfg -oconfiguration-scanner.c -i configuration-scanner.l ;\ bison -p cfg -v -d configuration-parser.y -o configuration-parser.c find $(distdir) -name CVS -o -name .cvsignore | xargs rm -rf + maintainer-clean-depend: maintainer-clean-depend-recursive @@ -203,16 +203,9 @@ php_config.h.in: @MAINT@ stamp-h.in stamp-h.in: configure.in aclocal.m4 acconfig.h cd ${srcdir} && autoheader && touch ${srcdir}/stamp-h.in -install: install-recursive $(BINNAME) +install: $(BINNAME) $(INSTALL_IT) -install-recursive: - if test "$(EXT_SHARED)" != ""; then \ - for dir in X $(EXT_SHARED); do \ - test -d ext/$$dir && (cd ext/$$dir; $(MAKE) install); \ - done; \ - fi - indent: clean indent -v -kr -cli4 -ts4 \ -T pval -T HashTable -T Bucket -T Token -T TokenCache -T TokenCacheManager \ @@ -0,0 +1,100 @@ +$Id$ + ++---- +| * -- to be done +| ? -- to be done sometime if possible +| P -- in progress (name should appear in parentheses after task) +| D -- delayed until later date (specify in parentheses after task) +| U -- done, untested +| V -- done ++---- + +Configuration Issues +-------------------- +* properly detect dbm routines when they're in libc +* add the appropriate #define magic for memmove and friends (see + GNU autoconf info pages for details) +* make it possible to disable support for some extensions (gd, dbm) +* make it possible to build selected extensions so they are + dynamically-loadable + +Core Language Issues +-------------------- +* go through PHP2's php.h and see how each special #define might be + applied/supported in PHP3 +* move Treatdata() to language-scanner.lex where hash_environment() + is called including a decision about priority of variables and moving + Treatdata() to use hash_add() instead of hash_update() for insertions + to the symbol table. +* go through FIXME and XXX lines (egrep 'FIXME|XXX' *.[ch]) +* make lexer and parser thread-safe +* verify that binary strings are handled correctly +V don't evaluate truth expressions more than once +V make unset() work on arrays (tricky) + +Core Functions +-------------- +* go through all file functions and make sure they are opened in binary + mode in win32 if needed (ie copy) +* go through all functions and look at PHP_SAFE_MODE issues +* have a look at return codes of fsockopen() function - we should + probably RETURN_FALSE and then set an error code somewhere (Rasmus) +* go through FIXME and XXX lines (egrep 'FIXME|XXX' functions/*.[ch]) +* add user-level flock() implementation to let people lock and unlock files +* add "'" modifier to sprintf to group thousands by comma +* Add an improved eval() that doesn't "leak" +? sorting of objects with a user-defined comparison function (like Perl) + (this shouldn't be expected before 3.1, if at all). + + +Extensions +---------- +* add version strings for all extensions +* Oracle persistent connections +U gd support for windows +* Illustra support (APIS) +? CQL++ support (http://www.cql.com/) +? GNU SQL support (does anybody actually use this?) +? DB2 support (http://www.sleepycat.com/) +? Shore support (http://www.cs.wisc.edu/shore/) +? PGP Interface (use PGPlib?) +? more Perl-like regex handling? + +Server Support +-------------- +P ISAPI (Shane) + * process cookies + * blocking functions + * make sure it's Microsoft-clean so it can be used with other ISAPI + implementations +* WSAPI +* NSAPI + * process cookies + * check POST method handling code + * use Netscape memory allocation inside emalloc() and company +* FastCGI support - see http://fastcgi.idle.com/ + +Win32 Specific +-------------- +* implement some kind of syslog->file log support for win95. +* change all file open/read/write functions from c library to win32 + api file functions. The win32 api functions handle both disk files + and network files. This will allow include and require to use http + or ftp files as the unix version does, and do away with my + workaround to support this. (3.1?) +* implement symlinks via windows shell links (shortcuts). This will + work only at the script level and is not a c language level port. + +Testing +------- +* truss/strace a typical PHP request and see if there are some system + calls that could be optimized out +* verify that regression tests exist for all core functions + +Miscellaneous +------------- +* remove hard-coded compilation options +? locale issues - funny things happen in PHP2 when the locale is set to + use , instead of . as the decimal seperator. ie. 1.5+1.5 = 1 +? SSI->PHP3 conversion script +? SQL-based access logging (start with examples/log-*.php3) diff --git a/TSRM/Makefile.am b/TSRM/Makefile.am new file mode 100644 index 0000000000..6bea4e8cc6 --- /dev/null +++ b/TSRM/Makefile.am @@ -0,0 +1,4 @@ +## process this file with automake to produce Makefile.am +AUTOMAKE_OPTIONS=foreign +lib_LIBRARIES=libtsrm.a +libtsrm_a_SOURCES = TSRM.c diff --git a/TSRM/TSRM.c b/TSRM/TSRM.c new file mode 100644 index 0000000000..a7e9e640aa --- /dev/null +++ b/TSRM/TSRM.c @@ -0,0 +1,392 @@ +/* + +----------------------------------------------------------------------+ + | Thread Safe Resource Manager | + +----------------------------------------------------------------------+ + | Copyright (c) 1998, 1999 Zeev Suraski | + +----------------------------------------------------------------------+ + | This source file is subject to the Zend license, that is bundled | + | with this package in the file LICENSE. If you did not receive a | + | copy of the Zend license, please mail us at zend@zend.com so we can | + | send you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Zeev Suraski <zeev@zend.com> | + +----------------------------------------------------------------------+ +*/ + + +#include "TSRM.h" +#include <stdio.h> +#include <stdlib.h> + +#if HAVE_STDARG_H +#include <stdarg.h> +#endif + +typedef struct _tsrm_tls_entry tsrm_tls_entry; + +struct _tsrm_tls_entry { + void **storage; + int count; + THREAD_T thread_id; + tsrm_tls_entry *next; +}; + + +typedef struct { + size_t size; + void (*ctor)(void *resource); + void (*dtor)(void *resource); +} tsrm_resource_type; + + +/* The memory manager table */ +static tsrm_tls_entry **tsrm_tls_table; +static int tsrm_tls_table_size; +static ts_rsrc_id id_count; + +/* The resource sizes table */ +static tsrm_resource_type *resource_types_table; +static int resource_types_table_size; + + +static MUTEX_T tsmm_mutex; /* thread-safe memory manager mutex */ + +/* Debug support */ +static int tsrm_debug(const char *format, ...); +static int tsrm_debug_status; + + +/* Startup TSRM (call once for the entire process) */ +TSRM_FUNC int tsrm_startup(int expected_threads, int expected_resources, int debug_status) +{ + tsrm_tls_table_size = expected_threads; + tsrm_tls_table = (tsrm_tls_entry **) calloc(tsrm_tls_table_size, sizeof(tsrm_tls_entry *)); + if (!tsrm_tls_table) { + return 0; + } + id_count=0; + + resource_types_table_size = expected_resources; + resource_types_table = (tsrm_resource_type *) calloc(resource_types_table_size, sizeof(tsrm_resource_type)); + if (!resource_types_table) { + free(tsrm_tls_table); + return 0; + } + + tsmm_mutex = tsrm_mutex_alloc(); + + tsrm_debug_status = debug_status; + + tsrm_debug("Started up TSRM, %d expected threads, %d expected resources\n", expected_threads, expected_resources); + return 1; +} + + +/* Shutdown TSRM (call once for the entire process) */ +TSRM_FUNC void tsrm_shutdown() +{ + int i; + + if (tsrm_tls_table) { + for (i=0; i<tsrm_tls_table_size; i++) { + tsrm_tls_entry *p = tsrm_tls_table[i], *next_p; + + while (p) { + int j; + + next_p = p->next; + for (j=0; j<id_count; j++) { + free(p->storage[j]); + } + free(p->storage); + free(p); + p = next_p; + } + } + free(tsrm_tls_table); + } + if (resource_types_table) { + free(resource_types_table); + } + tsrm_mutex_free(tsmm_mutex); + tsrm_debug("Shutdown TSRM\n"); +} + + +/* allocates a new thread-safe-resource id */ +TSRM_FUNC ts_rsrc_id ts_allocate_id(size_t size, void (*ctor)(void *resource), void (*dtor)(void *resource)) +{ + ts_rsrc_id new_id; + int i; + + tsrm_debug("Obtaining a new resource id, %d bytes\n", size); + + tsrm_mutex_lock(tsmm_mutex); + + /* obtain a resource id */ + new_id = id_count++; + tsrm_debug("Obtained resource id %d\n", new_id); + + /* store the new resource type in the resource sizes table */ + if (resource_types_table_size < id_count) { + resource_types_table = (tsrm_resource_type *) realloc(resource_types_table, sizeof(tsrm_resource_type)*id_count); + if (!resource_types_table) { + return -1; + } + resource_types_table_size = id_count; + } + resource_types_table[new_id].size = size; + resource_types_table[new_id].ctor = ctor; + resource_types_table[new_id].dtor = dtor; + + /* enlarge the arrays for the already active threads */ + for (i=0; i<tsrm_tls_table_size; i++) { + tsrm_tls_entry *p = tsrm_tls_table[i]; + + while (p) { + if (p->count < id_count) { + int j; + + p->storage = (void *) realloc(p->storage, sizeof(void *)*id_count); + for (j=p->count; j<id_count; j++) { + p->storage[j] = (void *) malloc(resource_types_table[j].size); + if (resource_types_table[j].ctor) { + resource_types_table[j].ctor(p->storage[j]); + } + } + p->count = id_count; + } + p = p->next; + } + } + tsrm_mutex_unlock(tsmm_mutex); + + tsrm_debug("Successfully allocated new resource id %d\n", new_id); + return new_id; +} + + +static void allocate_new_resource(tsrm_tls_entry **thread_resources_ptr, THREAD_T thread_id) +{ + int i; + + (*thread_resources_ptr) = (tsrm_tls_entry *) malloc(sizeof(tsrm_tls_entry)); + (*thread_resources_ptr)->storage = (void **) malloc(sizeof(void *)*id_count); + (*thread_resources_ptr)->count = id_count; + (*thread_resources_ptr)->thread_id = thread_id; + (*thread_resources_ptr)->next = NULL; + for (i=0; i<id_count; i++) { + (*thread_resources_ptr)->storage[i] = (void *) malloc(resource_types_table[i].size); + if (resource_types_table[i].ctor) { + resource_types_table[i].ctor((*thread_resources_ptr)->storage[i]); + } + } +} + + +/* fetches the requested resource for the current thread */ +void *ts_resource(ts_rsrc_id id) +{ + THREAD_T thread_id = tsrm_thread_id(); + int hash_value; + tsrm_tls_entry *thread_resources; + void *resource; + + tsrm_debug("Fetching resource id %d for thread %ld\n", id, (long) thread_id); + tsrm_mutex_lock(tsmm_mutex); + + hash_value = THREAD_HASH_OF(thread_id, tsrm_tls_table_size); + thread_resources = tsrm_tls_table[hash_value]; + + if (!thread_resources) { + allocate_new_resource(&tsrm_tls_table[hash_value], thread_id); + thread_resources = tsrm_tls_table[hash_value]; + } else { + do { + if (thread_resources->thread_id == thread_id) { + break; + } + if (thread_resources->next) { + thread_resources = thread_resources->next; + } else { + allocate_new_resource(&thread_resources->next, thread_id); + thread_resources = thread_resources->next; + break; + } + } while (thread_resources); + } + + resource = thread_resources->storage[id]; + + tsrm_mutex_unlock(tsmm_mutex); + + tsrm_debug("Successfully fetched resource id %d for thread id %ld - %x\n", id, (long) thread_id, (long) resource); + return resource; +} + + +/* frees all resources allocated for the current thread */ +void ts_free_thread() +{ + THREAD_T thread_id = tsrm_thread_id(); + int hash_value; + tsrm_tls_entry *thread_resources; + tsrm_tls_entry *last=NULL; + + tsrm_mutex_lock(tsmm_mutex); + hash_value = THREAD_HASH_OF(thread_id, tsrm_tls_table_size); + thread_resources = tsrm_tls_table[hash_value]; + + while (thread_resources) { + if (thread_resources->thread_id == thread_id) { + int i; + + for (i=0; i<thread_resources->count; i++) { + if (resource_types_table[i].dtor) { + resource_types_table[i].dtor(thread_resources->storage[i]); + } + free(thread_resources->storage[i]); + } + free(thread_resources->storage); + if (last) { + last->next = thread_resources->next; + } else { + tsrm_tls_table[hash_value]=NULL; + } + free(thread_resources); + break; + } + if (thread_resources->next) { + last = thread_resources; + } + thread_resources = thread_resources->next; + } + tsrm_mutex_unlock(tsmm_mutex); +} + + +/* deallocates all occurrences of a given id */ +void ts_free_id(ts_rsrc_id id) +{ +} + + + + +/* + * Utility Functions + */ + +/* Obtain the current thread id */ +TSRM_FUNC THREAD_T tsrm_thread_id(void) +{ +#ifdef WIN32 + return GetCurrentThreadId(); +#elif defined(PTHREADS) + return pthread_self(); +#elif defined(NSAPI) + return systhread_current(); +#elif defined(PI3WEB) + return PIThread_getCurrent(); +#endif +} + + +/* Allocate a mutex */ +TSRM_FUNC MUTEX_T tsrm_mutex_alloc( void ) +{ + MUTEX_T mutexp; + +#ifdef WIN32 + mutexp = CreateMutex(NULL,FALSE,NULL); +#elif defined(PTHREADS) + mutexp = (pthread_mutex_t *)malloc(sizeof(pthread_mutex_t)); + pthread_mutex_init(mutexp,NULL); +#elif defined(NSAPI) + mutexp = crit_init(); +#elif defined(PI3WEB) + mutexp = PIPlatform_allocLocalMutex(); +#endif +#ifdef THR_DEBUG + printf("Mutex created thread: %d\n",mythreadid()); +#endif + return( mutexp ); +} + + +/* Free a mutex */ +TSRM_FUNC void tsrm_mutex_free( MUTEX_T mutexp ) +{ + if (mutexp) { +#ifdef WIN32 + CloseHandle(mutexp); +#elif defined(PTHREADS) + free(mutexp); +#elif defined(NSAPI) + crit_terminate(mutexp); +#elif defined(PI3WEB) + PISync_delete(mutexp) +#endif + } +#ifdef THR_DEBUG + printf("Mutex freed thread: %d\n",mythreadid()); +#endif +} + + +/* Lock a mutex */ +TSRM_FUNC int tsrm_mutex_lock( MUTEX_T mutexp ) +{ + //tsrm_debug("Mutex locked thread: %ld\n",tsrm_thread_id()); +#ifdef WIN32 + return WaitForSingleObject(mutexp,1000); +#elif defined(PTHREADS) + return pthread_mutex_lock(mutexp); +#elif defined(NSAPI) + return crit_enter(mutexp); +#elif defined(PI3WEB) + return PISync_lock(mutexp); +#endif +} + + +/* Unlock a mutex */ +TSRM_FUNC int tsrm_mutex_unlock( MUTEX_T mutexp ) +{ + //tsrm_debug("Mutex unlocked thread: %ld\n",tsrm_thread_id()); +#ifdef WIN32 + return ReleaseMutex(mutexp); +#elif defined(PTHREADS) + return pthread_mutex_unlock(mutexp); +#elif defined(NSAPI) + return crit_exit(mutexp); +#elif defined(PI3WEB) + return PISync_unlock(mutexp); +#endif +} + + +/* + * Debug support + */ + +static int tsrm_debug(const char *format, ...) +{ + if (tsrm_debug_status) { + va_list args; + int size; + + va_start(args, format); + size = vprintf(format, args); + va_end(args); + return size; + } else { + return 0; + } +} + + +void tsrm_debug_set(int status) +{ + tsrm_debug_status = status; +} diff --git a/TSRM/TSRM.dsp b/TSRM/TSRM.dsp new file mode 100644 index 0000000000..7b284ab3eb --- /dev/null +++ b/TSRM/TSRM.dsp @@ -0,0 +1,100 @@ +# Microsoft Developer Studio Project File - Name="TSRM" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Static Library" 0x0104 + +CFG=TSRM - Win32 Debug_TS +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "TSRM.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "TSRM.mak" CFG="TSRM - Win32 Debug_TS" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "TSRM - Win32 Debug_TS" (based on "Win32 (x86) Static Library") +!MESSAGE "TSRM - Win32 Release_TS" (based on "Win32 (x86) Static Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "TSRM - Win32 Debug_TS" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "TSRM___Win32_Debug_TS" +# PROP BASE Intermediate_Dir "TSRM___Win32_Debug_TS" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug_TS" +# PROP Intermediate_Dir "Debug_TS" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /I "C:\Projects\TSRM" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /D "_DEBUG" /D "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c +# ADD BASE RSC /l 0x40d /d "_DEBUG" +# ADD RSC /l 0x40d /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ELSEIF "$(CFG)" == "TSRM - Win32 Release_TS" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "TSRM___Win32_Release_TS" +# PROP BASE Intermediate_Dir "TSRM___Win32_Release_TS" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release_TS" +# PROP Intermediate_Dir "Release_TS" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "TSRM_EXPORTS" /YX /FD /c +# ADD BASE RSC /l 0x40d /d "NDEBUG" +# ADD RSC /l 0x40d /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ENDIF + +# Begin Target + +# Name "TSRM - Win32 Debug_TS" +# Name "TSRM - Win32 Release_TS" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\TSRM.c +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\TSRM.h +# End Source File +# End Group +# End Target +# End Project diff --git a/TSRM/TSRM.h b/TSRM/TSRM.h new file mode 100644 index 0000000000..8674a5d027 --- /dev/null +++ b/TSRM/TSRM.h @@ -0,0 +1,97 @@ +/* + +----------------------------------------------------------------------+ + | Thread Safe Resource Manager | + +----------------------------------------------------------------------+ + | Copyright (c) 1998, 1999 Zeev Suraski | + +----------------------------------------------------------------------+ + | This source file is subject to the Zend license, that is bundled | + | with this package in the file LICENSE. If you did not receive a | + | copy of the Zend license, please mail us at zend@zend.com so we can | + | send you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Zeev Suraski <zeev@zend.com> | + +----------------------------------------------------------------------+ +*/ + + +#ifndef _TSRM_H +#define _TSRM_H + +#ifdef HAVE_CONFIG_H +# include "tsrm_config.h" +#endif + +#if WIN32||WINNT +# include <windows.h> +#elif defined(PTHREADS) +# include <pthread.h> +#endif + +typedef int ts_rsrc_id; + +#if WIN32||WINNT +# ifdef TSRM_EXPORTS +# define TSRM_API __declspec(dllexport) +# else +# define TSRM_API __declspec(dllimport) +# endif +#else +# define TSRM_API +#endif + + +/* Define TSRM_FUNC */ +#ifdef __cplusplus +#define TSRM_FUNC extern "C" TSRM_API +#else +#define TSRM_FUNC TSRM_API +#endif + + +/* Define THREAD_T and MUTEX_T */ +#if defined(WIN32) +# define THREAD_T DWORD +# define MUTEX_T void * +#elif defined(PTHREADS) +# define THREAD_T pthread_t +# define MUTEX_T pthread_mutex_t * +#elif defined(NSAPI) +# define THREAD_T SYS_THREAD +# define MUTEX_T CRITICAL +#elif defined(PI3WEB) +# define THREAD_T PIThread * +# define MUTEX_T PISync * +#endif + + +#define THREAD_HASH_OF(thr,ts) thr%ts + + +/* startup/shutdown */ +TSRM_FUNC int tsrm_startup(int expected_threads, int expected_resources, int debug_status); +TSRM_FUNC void tsrm_shutdown(); + +/* allocates a new thread-safe-resource id */ +TSRM_FUNC ts_rsrc_id ts_allocate_id(size_t size, void (*ctor)(void *resource), void (*dtor)(void *resource)); + +/* fetches the requested resource for the current thread */ +TSRM_FUNC void *ts_resource(ts_rsrc_id id); + +/* frees all resources allocated for the current thread */ +TSRM_FUNC void ts_free_thread(); + +/* deallocates all occurrences of a given id */ +TSRM_FUNC void ts_free_id(ts_rsrc_id id); + + +/* Debug support */ +TSRM_FUNC void tsrm_debug_set(int status); + +/* utility functions */ +TSRM_FUNC THREAD_T tsrm_thread_id(void); +TSRM_FUNC MUTEX_T tsrm_mutex_alloc(void); +TSRM_FUNC void tsrm_mutex_free(MUTEX_T mutexp); +TSRM_FUNC int tsrm_mutex_lock(MUTEX_T mutexp); +TSRM_FUNC int tsrm_mutex_unlock(MUTEX_T mutexp); + +#endif /* _TSRM_H */ diff --git a/TSRM/acconfig.h b/TSRM/acconfig.h new file mode 100644 index 0000000000..10666626c7 --- /dev/null +++ b/TSRM/acconfig.h @@ -0,0 +1,7 @@ +#undef PTHREADS + +#ifdef DEFINE_TSRM_VERSION +# undef PACKAGE +# undef VERSION +#endif + diff --git a/TSRM/buildconf b/TSRM/buildconf new file mode 100755 index 0000000000..3a896bcb1a --- /dev/null +++ b/TSRM/buildconf @@ -0,0 +1,24 @@ +#!/bin/sh + +mv aclocal.m4 aclocal.m4.old 2>/dev/null +aclocal +if cmp aclocal.m4.old aclocal.m4 > /dev/null 2>&1; then + echo keeping ${1}aclocal.m4 + mv aclocal.m4.old aclocal.m4 +else + echo created or modified ${1}aclocal.m4 +fi + +autoheader + +automake --add-missing --include-deps + +mv configure configure.old 2>/dev/null +autoconf +if cmp configure.old configure > /dev/null 2>&1; then + echo keeping ${1}configure + mv configure.old configure +else + echo created or modified ${1}configure +fi + diff --git a/TSRM/configure.in b/TSRM/configure.in new file mode 100644 index 0000000000..4d4bd2e298 --- /dev/null +++ b/TSRM/configure.in @@ -0,0 +1,24 @@ +dnl $Id$ +dnl +dnl Minimalistic configure.in for TSRM. +dnl + +AC_INIT(TSRM.c) +AM_INIT_AUTOMAKE(TSRM, 1.0) +AM_CONFIG_HEADER(tsrm_config.h) + +AC_PROG_CC +AC_PROG_CC_C_O +AC_PROG_RANLIB + +AC_CHECK_LIB(pthread, pthread_create, [ + AC_DEFINE(PTHREADS) + LIBS="$LIBS -lpthread" +],[ + AC_MSG_ERROR(You need pthreads to build TSRM.) +]) + +AC_CHECK_HEADERS(stdarg.h) + +AC_OUTPUT(Makefile) + diff --git a/WISHLIST b/WISHLIST new file mode 100644 index 0000000000..99d3876a00 --- /dev/null +++ b/WISHLIST @@ -0,0 +1,17 @@ +- Persistant per-process scripting + + Apache 1.3 has added things that makes this much easier than before. + The module structure now contains a child_init hook and a child_exit + hook where you can register functions to be called when an httpd + process starts up and when one shuts down (due to MaxRequestsPerChild + or a Kill). The only real trick now is to come up with some sort of + syntax for specifying what to do from the child_init call and the + child_exit call. + + One idea is to be able to add a <PHP>...</PHP> block to the Apache + httpd.conf file which would somehow define a series of PHP statements + to be executed from the child_* calls. One for startup and another + block for shutdown. These blocks would work with the per-process + memory pool, so any variables initialized here would have a lifespan + equal to that of the httpd process. Basically request-spanning + global variables. diff --git a/WISHLIST-3.1 b/WISHLIST-3.1 new file mode 100644 index 0000000000..1320f71907 --- /dev/null +++ b/WISHLIST-3.1 @@ -0,0 +1,55 @@ +V Do yystype_ptr and hash pointers the right way - use the hash + pointer and the bucket pointer, instead of a pointer to the data. + Allows for a real unset() among other things. +V Improve performance of simple variable lookups +* Improve string performance by using smarter memory allocation methods +- Improve preprocessor (handle require() efficiently), possibly handle + automatic preprocessing for sites based on timestamp +V Use a reference count mechanism to prevent unnecessary duplication of data. +* Write and stabilize a complete persistent data API. Feature wishlist: + - memory manager using shared memory + - process-global symbol table + - make api inter-thread capable for win32 and some far off future where unix + version will be multithreaded +V Handle out of memory (inside emalloc()?) +* Try to figure out a way to declare *real* global variables +* Improve the reading of configuration variables into php3_ini (generalize) + Make it possible to implement config_get("configuration_variable") and + config_set("configuration_variable","value") that'll work with *php3_ini*, + not the configuration hash! +* Bundle some nice classes (like Bjørn's graphing class) +* Bundle some database abstraction classes +* Distribute binaries +* Clean up API and modules to make .so modules portable across CGI and server + binaries +* dbm cleanup (don't arbitrarily pick, and support multiple concurrent formats) +* start system defines so that we can move away from the standard c lib on + windows to the win32 lib. (file functions primarily) +* COM implementation so php can be used as an asp language (cant find any docs + on how this is done though) +* Clean up the file structure so the top-level directory isn't such a mess. +* Bring the module concept to maturity: use libtool and make it + possible to decide at compile time whether you want to compile a + module statically or dynamically. Remove the distinction between + the stuff currently in dl/ and functions/. +* a way of letting each module specify its options, so ini file options and + Apache directives can be set up from the same specification. +V Make it possible to declare smarter user functions: (done in 3.0) + - Optional parameters + - Parameters that are forced/prefered by reference +* Make object parsing more general, and allow nested arrays/objects with + unlimited levels. +V Make it possible to copy references of variables. +* data tainting (like perl -T) +* multi-dimensional array support in GET/POST/COOKIE handling code +* Persistent functions and classes +* odbc_fetch_assoc +* Add env handling to gpc_order +* Populate track_vars regardless of gpc_order +* a real exec() function +* Support passing arguments to functions by name (e.g. foo(arg1 => "bar", arg2 => "foobar")) +* Add an optional setting to destroy persistent resources if a PHP script terminates + abnormally +V COM automation support for Win32 +? Add a setting for making function names case sensitive +* stat() files before feeding them to flex - it doesn't handle special files very well diff --git a/Zend/buildconf b/Zend/buildconf index deb6aedb79..3a896bcb1a 100755 --- a/Zend/buildconf +++ b/Zend/buildconf @@ -3,10 +3,10 @@ mv aclocal.m4 aclocal.m4.old 2>/dev/null aclocal if cmp aclocal.m4.old aclocal.m4 > /dev/null 2>&1; then - echo "buildconf: keeping ${1}aclocal.m4" + echo keeping ${1}aclocal.m4 mv aclocal.m4.old aclocal.m4 else - echo "buildconf: created or modified ${1}aclocal.m4" + echo created or modified ${1}aclocal.m4 fi autoheader @@ -16,9 +16,9 @@ automake --add-missing --include-deps mv configure configure.old 2>/dev/null autoconf if cmp configure.old configure > /dev/null 2>&1; then - echo "buildconf: keeping ${1}configure" + echo keeping ${1}configure mv configure.old configure else - echo "buildconf: created or modified ${1}configure" + echo created or modified ${1}configure fi diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 5a224a8b7e..452763fe11 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -933,6 +933,7 @@ void do_early_binding(CLS_D) opline->opcode = ZEND_NOP; SET_UNUSED(opline->op1); SET_UNUSED(opline->op2); + //CG(active_op_array)->last--; } diff --git a/Zend/zend_constants.c b/Zend/zend_constants.c index 0dab84dab4..0718aa6ea7 100644 --- a/Zend/zend_constants.c +++ b/Zend/zend_constants.c @@ -121,13 +121,8 @@ void zend_register_standard_constants(ELS_D) #endif REGISTER_MAIN_LONG_CONSTANT("E_ERROR", E_ERROR, CONST_PERSISTENT | CONST_CS); REGISTER_MAIN_LONG_CONSTANT("E_WARNING", E_WARNING, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_LONG_CONSTANT("E_PARSE", E_PARSE, CONST_PERSISTENT | CONST_CS); REGISTER_MAIN_LONG_CONSTANT("E_NOTICE", E_NOTICE, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_LONG_CONSTANT("E_CORE_ERROR", E_CORE_ERROR, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_LONG_CONSTANT("E_CORE_WARNING", E_CORE_WARNING, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_LONG_CONSTANT("E_COMPILE_ERROR", E_COMPILE_ERROR, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_LONG_CONSTANT("E_COMPILE_WARNING", E_COMPILE_WARNING, CONST_PERSISTENT | CONST_CS); - + REGISTER_MAIN_LONG_CONSTANT("E_PARSE", E_PARSE, CONST_PERSISTENT | CONST_CS); REGISTER_MAIN_LONG_CONSTANT("E_ALL", E_ALL, CONST_PERSISTENT | CONST_CS); /* true/false constants */ diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index ca8a7303bc..0faca55e89 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -21,10 +21,6 @@ #include <stdio.h> #include <signal.h> -#if (HAVE_ALLOCA && HAVE_ALLOCA_H) -#include <alloca.h> -#endif - #include "zend.h" #include "zend_compile.h" #include "zend_execute.h" diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index a5b94889c9..d5f7c111ea 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -313,6 +313,7 @@ int call_user_function(HashTable *function_table, zval *object, zval *function_n *param = *(params[i]); INIT_PZVAL(param); zval_copy_ctor(param); + //zend_hash_next_index_insert_ptr(function_state.function_symbol_table, param, sizeof(zval *), NULL); zend_ptr_stack_push(&EG(argument_stack), param); } diff --git a/Zend/zend_list.c b/Zend/zend_list.c index 44992abd3e..3f1d01327e 100644 --- a/Zend/zend_list.c +++ b/Zend/zend_list.c @@ -48,7 +48,7 @@ static inline int zend_list_do_delete(HashTable *list,int id) ELS_FETCH(); if (zend_hash_index_find(&EG(regular_list), id, (void **) &le)==SUCCESS) { -/* printf("del(%d): %d->%d\n", id, le->refcount, le->refcount-1); */ +// printf("del(%d): %d->%d\n", id, le->refcount, le->refcount-1); if (--le->refcount<=0) { return zend_hash_index_del(&EG(regular_list), id); } else { @@ -96,7 +96,7 @@ ZEND_API int zend_list_addref(int id) ELS_FETCH(); if (zend_hash_index_find(&EG(regular_list), id, (void **) &le)==SUCCESS) { -/* printf("add(%d): %d->%d\n", id, le->refcount, le->refcount+1); */ +// printf("add(%d): %d->%d\n", id, le->refcount, le->refcount+1); le->refcount++; return SUCCESS; } else { diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index d73feecd83..8e202f255b 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -936,6 +936,7 @@ ZEND_API int is_not_equal_function(zval *result, zval *op1, zval *op2) ZEND_API int is_smaller_function(zval *result, zval *op1, zval *op2) { + //printf("Comparing %d and %d\n", op1->value.lval, op2->value.lval); if (compare_function(result, op1, op2) == FAILURE) { return FAILURE; } diff --git a/acinclude.m4 b/acinclude.m4 index 544192f97b..7d728a7cef 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -38,8 +38,9 @@ AC_DEFUN(AC_ADD_LIBPATH,[ AC_EXPAND_PATH($1, ai_p) AC_PHP_ONCE(LIBPATH, $ai_p, [ EXTRA_LIBS="$EXTRA_LIBS -L$ai_p" - RAW_RPATHS="$RAW_RPATHS ${raw_runpath_switch}$ai_p" - if test -n "$APXS" ; then + if test -n "$rpath_raw" ; then + RPATHS="$RPATHS ${raw_runpath_switch}$ai_p" + elif test -n "$APXS" ; then RPATHS="$RPATHS ${apxs_runpath_switch}$ai_p'" else RPATHS="$RPATHS ${ld_runpath_switch}$ai_p" @@ -138,22 +139,15 @@ dnl to make dynamic libraries as well. dnl AC_DEFUN(PHP_EXTENSION,[ EXT_SUBDIRS="$EXT_SUBDIRS $1" - if test "$2" != "shared" -a "$2" != "yes"; then - _extlib="libphpext_$1.a" - EXT_LIBS="$EXT_LIBS $1/$_extlib" - EXTINFO_DEPS="$EXTINFO_DEPS ../ext/$1/extinfo.c.stub" - EXT_STATIC="$EXT_STATIC $1" - else - EXT_SHARED="$EXT_SHARED $1" - fi + _extlib="libphpext_$1.a" + EXT_LIBS="$EXT_LIBS $1/$_extlib" + EXTINFO_DEPS="$EXTINFO_DEPS ../ext/$1/extinfo.c.stub" dnl EXT_INCLUDE_CODE="\#include \"ext/$1/php3_$1.h\"\\n$EXT_INCLUDE_CODE" dnl EXT_MODULE_PTRS="phpext_$1_ptr, $EXT_MODULE_PTRS" dnl " ]) AC_SUBST(EXT_SUBDIRS) -AC_SUBST(EXT_STATIC) -AC_SUBST(EXT_SHARED) AC_SUBST(EXT_LIBS) AC_SUBST(EXTINFO_DEPS) dnl AC_SUBST(EXT_INCLUDE_CODE) @@ -1,85 +1,21 @@ #!/bin/sh -# do some version checking for the tools we use -if test "$1" = "--force"; then - shift -else - echo "buildconf: checking installation..." - - # autoconf 2.13 or newer - ac_version=`autoconf --version 2>/dev/null|head -1|sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'` - if test "$ac_version" = ""; then - echo "buildconf: autoconf not found." - echo " You need autoconf version 2.13 or newer installed" - echo " to build PHP from CVS." - exit 1 - fi - IFS=.; set $ac_version; IFS=' ' - if test "$1" = "2" -a "$2" -lt "13" || test "$1" -lt "2"; then - echo "buildconf: autoconf version $ac_version found." - echo " You need autoconf version 2.13 or newer installed" - echo " to build PHP from CVS." - exit 1 - else - echo "buildconf: autoconf version $ac_version (ok)" - fi - - # automake 1.4 or newer - am_version=`automake --version 2>/dev/null|head -1|sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'` - if test "$am_version" = ""; then - echo "buildconf: automake not found." - echo " You need automake version 1.4 or newer installed" - echo " to build PHP from CVS." - exit 1 - fi - IFS=.; set $am_version; IFS=' ' - if test "$1" = "1" -a "$2" -lt "4" || test "$1" -lt "1"; then - echo "buildconf: automake version $am_version found." - echo " You need automake version 1.4 or newer installed" - echo " to build PHP from CVS." - exit 1 - else - echo "buildconf: automake version $am_version (ok)" - fi - - # The stuff from libtool we need is in CVS right now, so it is - # not required to run buildconf. -fi - if test "$1" = "--copy"; then - automake_flags=--copy + automake_flags=--copy fi -if ! test -d libzend; then - if test -d ../libzend; then - echo "buildconf: linking ../libzend to ./libzend" - ln -s ../libzend . - else - echo "buildconf: can not find libzend" - echo " libzend should be installed in . or .." - exit 1 - fi -fi -if ! test -d TSRM; then - if test -d ../TSRM; then - echo "buildconf: linking ../TSRM to ./TSRM" - ln -s ../TSRM . - else - echo "buildconf: can not find TSRM" - echo " TSRM should be installed in . or .." - exit 1 - fi -fi +test -d libzend || ln -s ../libzend . +test -d TSRM || ln -s ../TSRM . ./scripts/preconfig mv aclocal.m4 aclocal.m4.old 2>/dev/null aclocal if cmp aclocal.m4.old aclocal.m4 > /dev/null 2>&1; then - echo "buildconf: keeping aclocal.m4" + echo keeping aclocal.m4 mv aclocal.m4.old aclocal.m4 else - echo "buildconf: created or modified aclocal.m4" + echo created or modified aclocal.m4 fi autoheader @@ -89,10 +25,10 @@ automake --add-missing --include-deps $automake_flags mv configure configure.old 2>/dev/null autoconf if cmp configure.old configure > /dev/null 2>&1; then - echo "buildconf: keeping configure" + echo keeping configure mv configure.old configure else - echo "buildconf: created or modified configure" + echo created or modified configure fi (cd libzend; ./buildconf libzend/) diff --git a/config.guess b/config.guess index 1d27287d5b..b3dffc8bf9 100644 --- a/config.guess +++ b/config.guess @@ -1,6 +1,6 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright (C) 1992, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc. +# Copyright (C) 1992, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. # # 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 @@ -23,7 +23,6 @@ # Written by Per Bothner <bothner@cygnus.com>. # The master version of this file is at the FSF in /home/gd/gnu/lib. -# Please send patches to the Autoconf mailing list <autoconf@gnu.org>. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and @@ -47,60 +46,17 @@ 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 -dummy=dummy-$$ -trap 'rm -f $dummy.c $dummy.o $dummy; exit 1' 1 2 15 +trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15 # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in alpha:OSF1:*:*) - if test $UNAME_RELEASE = "V4.0"; then - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` - fi # 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. - cat <<EOF >$dummy.s - .globl main - .ent main -main: - .frame \$30,0,\$26,0 - .prologue 0 - .long 0x47e03d80 # implver $0 - lda \$2,259 - .long 0x47e20c21 # amask $2,$1 - srl \$1,8,\$2 - sll \$2,2,\$2 - sll \$0,3,\$0 - addl \$1,\$0,\$0 - addl \$2,\$0,\$0 - ret \$31,(\$26),1 - .end main -EOF - ${CC-cc} $dummy.s -o $dummy 2>/dev/null - if test "$?" = 0 ; then - ./$dummy - case "$?" in - 7) - UNAME_MACHINE="alpha" - ;; - 15) - UNAME_MACHINE="alphaev5" - ;; - 14) - UNAME_MACHINE="alphaev56" - ;; - 10) - UNAME_MACHINE="alphapca56" - ;; - 16) - UNAME_MACHINE="alphaev6" - ;; - esac - fi - rm -f $dummy.s $dummy - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr [[A-Z]] [[a-z]]` + echo alpha-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//'` exit 0 ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 @@ -114,9 +70,6 @@ EOF amiga:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; - *:[Aa]miga[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-amigaos - exit 0 ;; arc64:OpenBSD:*:*) echo mips64el-unknown-openbsd${UNAME_RELEASE} exit 0 ;; @@ -138,13 +91,10 @@ EOF arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit 0;; - arm32:NetBSD:*:*) - echo arm-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - exit 0 ;; SR2?01:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit 0;; - Pyramid*:OSx*:*:*|MIS*:OSx*:*:*|MIS*:SMP_DC-OSx*:*:*) + Pyramid*:OSx*:*:*|MIS*: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 @@ -152,12 +102,9 @@ EOF echo pyramid-pyramid-bsd fi exit 0 ;; - NILE*:*:*:dcosx) + NILE:*:*:dcosx) echo pyramid-pyramid-svr4 exit 0 ;; - sun4H:SunOS:5.*:*) - echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; @@ -182,18 +129,6 @@ EOF sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit 0 ;; - sun*:*:4.2BSD:*) - UNAME_RELEASE=`(head -1 /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 0 ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit 0 ;; @@ -224,9 +159,6 @@ EOF powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit 0 ;; - macppc:NetBSD:*:*) - echo powerpc-apple-netbsd${UNAME_RELEASE} - exit 0 ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit 0 ;; @@ -240,12 +172,8 @@ EOF echo clipper-intergraph-clix${UNAME_RELEASE} exit 0 ;; mips:*:*:UMIPS | mips:*:*:RISCos) - sed 's/^ //' << EOF >$dummy.c -#ifdef __cplusplus - int main (int argc, char *argv[]) { -#else - int main (argc, argv) int argc; char *argv[]; { -#endif + sed 's/^ //' << EOF >dummy.c + int main (argc, argv) int argc; char **argv; { #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); @@ -260,10 +188,10 @@ EOF exit (-1); } EOF - ${CC-cc} $dummy.c -o $dummy \ - && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ - && rm $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy + ${CC-cc} dummy.c -o dummy \ + && ./dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ + && rm dummy.c dummy && exit 0 + rm -f dummy.c dummy echo mips-mips-riscos${UNAME_RELEASE} exit 0 ;; Night_Hawk:Power_UNIX:*:*) @@ -315,7 +243,7 @@ EOF exit 0 ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - sed 's/^ //' << EOF >$dummy.c + sed 's/^ //' << EOF >dummy.c #include <sys/systemcfg.h> main() @@ -326,8 +254,8 @@ EOF exit(0); } EOF - ${CC-cc} $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy + ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0 + rm -f dummy.c dummy echo rs6000-ibm-aix3.2.5 elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 @@ -336,8 +264,7 @@ EOF fi exit 0 ;; *:AIX:*:4) - IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'` - if /usr/sbin/lsattr -EHl ${IBM_CPU_ID} | grep POWER >/dev/null 2>&1; then + if /usr/sbin/lsattr -EHl proc0 | grep POWER >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc @@ -370,50 +297,18 @@ EOF hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit 0 ;; - 9000/[34678]??:HP-UX:*:*) + 9000/[3478]??:HP-UX:*:*) case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; - 9000/6?? | 9000/7?? | 9000/80[024] | 9000/8?[136790] | 9000/892 ) - sed 's/^ //' << EOF >$dummy.c - #include <stdlib.h> - #include <unistd.h> - - 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 - (${CC-cc} $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy` - rm -f $dummy.c $dummy + 9000/7?? | 9000/8?[1679] ) HP_ARCH=hppa1.1 ;; + 9000/8?? ) HP_ARCH=hppa1.0 ;; esac HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit 0 ;; 3050*:HI-UX:*:*) - sed 's/^ //' << EOF >$dummy.c + sed 's/^ //' << EOF >dummy.c #include <unistd.h> int main () @@ -438,8 +333,8 @@ EOF exit (0); } EOF - ${CC-cc} $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy + ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0 + rm -f dummy.c dummy echo unknown-hitachi-hiuxwe2 exit 0 ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) @@ -448,12 +343,6 @@ EOF 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit 0 ;; - *9??*:MPE*:*:*) - echo hppa1.0-hp-mpeix - exit 0 ;; - *9??*:MPE*:*:*) - echo hppa1.0-hp-mpeix - exit 0 ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit 0 ;; @@ -502,9 +391,6 @@ EOF CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} exit 0 ;; - CRAY*T3E:*:*:*) - echo t3e-cray-unicosmk${UNAME_RELEASE} - exit 0 ;; CRAY-2:*:*:*) echo cray2-cray-unicos exit 0 ;; @@ -522,22 +408,10 @@ EOF hp300:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; - sparc*:BSD/OS:*:*) - echo sparc-unknown-bsdi${UNAME_RELEASE} - exit 0 ;; - i?86:BSD/386:*:* | i?86:BSD/OS:*:*) + i?86:BSD/386:*:* | *:BSD/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit 0 ;; - *:BSD/OS:*:*) - echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} - exit 0 ;; *:FreeBSD:*:*) - if test -x /usr/bin/objformat; then - if test "elf" = "`/usr/bin/objformat`"; then - echo ${UNAME_MACHINE}-unknown-freebsdelf`echo ${UNAME_RELEASE}|sed -e 's/[-_].*//'` - exit 0 - fi - fi echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit 0 ;; *:NetBSD:*:*) @@ -547,13 +421,10 @@ EOF echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` exit 0 ;; i*:CYGWIN*:*) - echo ${UNAME_MACHINE}-pc-cygwin - exit 0 ;; - i*:MINGW*:*) - echo ${UNAME_MACHINE}-pc-mingw32 + echo i386-pc-cygwin32 exit 0 ;; p*:CYGWIN*:*) - echo powerpcle-unknown-cygwin + echo powerpcle-unknown-cygwin32 exit 0 ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` @@ -562,87 +433,31 @@ EOF echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit 0 ;; *:Linux:*:*) -# # uname on the ARM produces all sorts of strangeness, and we need to -# # filter it out. -# case "$UNAME_MACHINE" in -# armv*) UNAME_MACHINE=$UNAME_MACHINE ;; -# arm* | sa110*) UNAME_MACHINE="arm" ;; -# esac - # The BFD linker knows what the default object file format is, so # first see if it will tell us. ld_help_string=`ld --help 2>&1` - ld_supported_emulations=`echo $ld_help_string \ - | sed -ne '/supported emulations:/!d - s/[ ][ ]*/ /g - s/.*supported emulations: *// - s/ .*// - p'` - case "$ld_supported_emulations" in - i?86linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" ; exit 0 ;; - i?86coff) echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0 ;; - sparclinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; - armlinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; - m68klinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; - elf32arm) echo "${UNAME_MACHINE}-unknown-linux-gnu" ; exit 0 ;; - elf32ppc) echo "powerpc-unknown-linux-gnu" ; exit 0 ;; - esac - - if test "${UNAME_MACHINE}" = "alpha" ; then - sed 's/^ //' <<EOF >$dummy.s - .globl main - .ent main - main: - .frame \$30,0,\$26,0 - .prologue 0 - .long 0x47e03d80 # implver $0 - lda \$2,259 - .long 0x47e20c21 # amask $2,$1 - srl \$1,8,\$2 - sll \$2,2,\$2 - sll \$0,3,\$0 - addl \$1,\$0,\$0 - addl \$2,\$0,\$0 - ret \$31,(\$26),1 - .end main -EOF - LIBC="" - ${CC-cc} $dummy.s -o $dummy 2>/dev/null - if test "$?" = 0 ; then - ./$dummy - case "$?" in - 7) - UNAME_MACHINE="alpha" - ;; - 15) - UNAME_MACHINE="alphaev5" - ;; - 14) - UNAME_MACHINE="alphaev56" - ;; - 10) - UNAME_MACHINE="alphapca56" - ;; - 16) - UNAME_MACHINE="alphaev6" - ;; - esac - - objdump --private-headers $dummy | \ - grep ld.so.1 > /dev/null - if test "$?" = 0 ; then - LIBC="libc1" - fi - fi - rm -f $dummy.s $dummy - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0 + if echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: elf_i.86"; then + echo "${UNAME_MACHINE}-pc-linux-gnu" ; exit 0 + elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: i.86linux"; then + echo "${UNAME_MACHINE}-pc-linux-gnuaout" ; exit 0 + elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: i.86coff"; then + echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0 + elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: m68kelf"; then + echo "${UNAME_MACHINE}-unknown-linux-gnu" ; exit 0 + elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: m68klinux"; then + echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 + elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: elf32ppc"; then + echo "powerpc-unknown-linux-gnu" ; exit 0 + elif test "${UNAME_MACHINE}" = "alpha" ; then + echo alpha-unknown-linux-gnu ; exit 0 + elif test "${UNAME_MACHINE}" = "sparc" ; then + echo sparc-unknown-linux-gnu ; exit 0 elif test "${UNAME_MACHINE}" = "mips" ; then - cat >$dummy.c <<EOF -#ifdef __cplusplus - int main (int argc, char *argv[]) { -#else - int main (argc, argv) int argc; char *argv[]; { -#endif + cat >dummy.c <<EOF +main(argc, argv) +int argc; +char *argv[]; +{ #ifdef __MIPSEB__ printf ("%s-unknown-linux-gnu\n", argv[1]); #endif @@ -652,65 +467,35 @@ EOF return 0; } EOF - ${CC-cc} $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy + ${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0 + rm -f dummy.c dummy else - # Either a pre-BFD a.out linker (linux-gnuoldld) - # or one that does not give us useful --help. - # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout. - # If ld does not provide *any* "supported emulations:" - # that means it is gnuoldld. - echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations:" - test $? != 0 && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0 - - case "${UNAME_MACHINE}" in - i?86) - VENDOR=pc; - ;; - *) - VENDOR=unknown; - ;; - esac + # Either a pre-BFD a.out linker (linux-gnuoldld) or one that does not give us + # useful --help. Gcc wants to distinguish between linux-gnuoldld and linux-gnuaout. + test ! -d /usr/lib/ldscripts/. \ + && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0 # Determine whether the default compiler is a.out or elf - cat >$dummy.c <<EOF -#include <features.h> -#ifdef __cplusplus - int main (int argc, char *argv[]) { -#else - int main (argc, argv) int argc; char *argv[]; { -#endif + cat >dummy.c <<EOF +main(argc, argv) +int argc; +char *argv[]; +{ #ifdef __ELF__ -# ifdef __GLIBC__ -# if __GLIBC__ >= 2 - printf ("%s-${VENDOR}-linux-gnu\n", argv[1]); -# else - printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); -# endif -# else - printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); -# endif + printf ("%s-pc-linux-gnu\n", argv[1]); #else - printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]); + printf ("%s-pc-linux-gnuaout\n", argv[1]); #endif return 0; } EOF - ${CC-cc} $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy + ${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0 + rm -f dummy.c dummy fi ;; # 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. i?86:DYNIX/ptx:4*:*) echo i386-sequent-sysv4 exit 0 ;; - 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 0 ;; i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*) if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE} @@ -732,18 +517,6 @@ EOF echo ${UNAME_MACHINE}-pc-sysv32 fi exit 0 ;; - i?86:UnixWare:*:*) - if /bin/uname -X 2>/dev/null >/dev/null ; then - (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ - && UNAME_MACHINE=i586 - fi - echo ${UNAME_MACHINE}-unixware-${UNAME_RELEASE}-${UNAME_VERSION} - exit 0 ;; - pc:*:*:*) - # uname -m prints for DJGPP always 'pc', but it prints nothing about - # the processor, so we play safe by assuming i386. - echo i386-pc-msdosdjgpp - exit 0 ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit 0 ;; @@ -780,7 +553,7 @@ EOF mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit 0 ;; - i?86:LynxOS:2.*:* | i?86:LynxOS:3.[01]*:*) + i?86:LynxOS:2.*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit 0 ;; TSUNAMI:LynxOS:2.*:*) @@ -792,9 +565,6 @@ EOF SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit 0 ;; - RM*:ReliantUNIX-*:*:*) - echo mips-sni-sysv4 - exit 0 ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit 0 ;; @@ -806,6 +576,9 @@ EOF echo ns32k-sni-sysv fi exit 0 ;; + BS2000:POSIX-BC:*:*) # EBCDIC based mainframe with POSIX subsystem + echo bs2000-siemens-sysv4 + exit 0 ;; PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says <Richard.M.Bartel@ccMail.Census.GOV> echo i586-unisys-sysv4 @@ -822,43 +595,19 @@ EOF mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit 0 ;; - news*:NEWS-OS:*:6*) - echo mips-sony-newsos6 - exit 0 ;; - R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R4000:UNIX_SV:*:*) + R3000:*System_V*:*:* | R4000:UNIX_SYSV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit 0 ;; - BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. - echo powerpc-be-beos - exit 0 ;; - BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. - echo powerpc-apple-beos - exit 0 ;; - BePC:BeOS:*:*) # BeOS running on Intel PC compatible. - echo i586-pc-beos - exit 0 ;; - SX-4:SUPER-UX:*:*) - echo sx4-nec-superux${UNAME_RELEASE} - exit 0 ;; - SX-5:SUPER-UX:*:*) - echo sx5-nec-superux${UNAME_RELEASE} - exit 0 ;; - Power*:Rhapsody:*:*) - echo powerpc-apple-rhapsody${UNAME_RELEASE} - exit 0 ;; - *:Rhapsody:*:*) - echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} - exit 0 ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 -cat >$dummy.c <<EOF +cat >dummy.c <<EOF #ifdef _SEQUENT_ # include <sys/types.h> # include <sys/utsname.h> @@ -896,10 +645,7 @@ main () #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); + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); exit (0); #endif @@ -959,8 +705,8 @@ main () } EOF -${CC-cc} $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm $dummy.c $dummy && exit 0 -rm -f $dummy.c $dummy +${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy && rm dummy.c dummy && exit 0 +rm -f dummy.c dummy # Apollos put the system type in the environment. diff --git a/config.sub b/config.sub index ecf770cea1..0131946b93 100644 --- a/config.sub +++ b/config.sub @@ -1,6 +1,6 @@ #! /bin/sh # Configuration validation subroutine script, version 1.1. -# Copyright (C) 1991, 92-97, 1998 Free Software Foundation, Inc. +# Copyright (C) 1991, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. # 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. @@ -149,21 +149,19 @@ esac case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. - tahoe | i860 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \ - | arme[lb] | pyramid | mn10200 | mn10300 | tron | a29k \ - | 580 | i960 | h8300 | hppa | hppa1.0 | hppa1.1 | hppa2.0 \ - | hppa2.0w \ - | alpha | alphaev5 | alphaev56 | we32k | ns16k | clipper \ - | i370 | sh | powerpc | powerpcle | 1750a | dsp16xx | pdp11 \ - | mips64 | mipsel | mips64el | mips64orion | mips64orionel \ - | mipstx39 | mipstx39el | armv[34][lb] \ - | sparc | sparclet | sparclite | sparc64 | v850) + tahoe | i860 | m32r | m68k | m68000 | m88k | ns32k | arm \ + | arme[lb] | pyramid | mn10300 \ + | tron | a29k | 580 | i960 | h8300 | hppa | hppa1.0 | hppa1.1 \ + | alpha | we32k | ns16k | clipper | i370 | sh \ + | powerpc | powerpcle | 1750a | dsp16xx | mips64 | mipsel \ + | pdp11 | mips64el | mips64orion | mips64orionel \ + | sparc | sparclet | sparclite | sparc64) basic_machine=$basic_machine-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[34567]86) + i[3456]86) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. @@ -172,19 +170,14 @@ case $basic_machine in exit 1 ;; # Recognize the basic CPU types with company name. - vax-* | tahoe-* | i[34567]86-* | i860-* | m32r-* | m68k-* | m68000-* \ - | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \ - | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \ - | power-* | none-* | 580-* | cray2-* | h8300-* | i960-* \ - | xmp-* | ymp-* | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* \ - | hppa2.0w-* \ - | alpha-* | alphaev5-* | alphaev56-* | we32k-* | cydra-* \ - | ns16k-* | pn-* | np1-* | xps100-* | clipper-* | orion-* \ - | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \ - | sparc64-* | mips64-* | mipsel-* | armv[34][lb]-*\ - | mips64el-* | mips64orion-* | mips64orionel-* \ - | mipstx39-* | mipstx39el-* \ - | f301-* | armv*-*) + vax-* | tahoe-* | i[3456]86-* | i860-* | m32r-* | m68k-* | m68000-* \ + | m88k-* | sparc-* | ns32k-* | fx80-* | arm-* | c[123]* \ + | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* | power-* \ + | none-* | 580-* | cray2-* | h8300-* | i960-* | xmp-* | ymp-* \ + | hppa-* | hppa1.0-* | hppa1.1-* | alpha-* | we32k-* | cydra-* | ns16k-* \ + | pn-* | np1-* | xps100-* | clipper-* | orion-* | sparclite-* \ + | pdp11-* | sh-* | powerpc-* | powerpcle-* | sparc64-* | mips64-* | mipsel-* \ + | mips64el-* | mips64orion-* | mips64orionel-* | f301-*) ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. @@ -211,9 +204,9 @@ case $basic_machine in amiga | amiga-*) basic_machine=m68k-cbm ;; - amigaos | amigados) + amigados) basic_machine=m68k-cbm - os=-amigaos + os=-amigados ;; amigaunix | amix) basic_machine=m68k-cbm @@ -347,32 +340,24 @@ case $basic_machine in hppa-next) os=-nextstep3 ;; - hp3k9[0-9][0-9] | hp9[0-9][0-9]) - basic_machine=hppa1.0-hp - os=-mpeix - ;; - hp3k9[0-9][0-9] | hp9[0-9][0-9]) - basic_machine=hppa1.0-hp - os=-mpeix - ;; i370-ibm* | ibm*) basic_machine=i370-ibm os=-mvs ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? - i[34567]86v32) + i[3456]86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; - i[34567]86v4*) + i[3456]86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; - i[34567]86v) + i[3456]86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; - i[34567]86sol2) + i[3456]86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; @@ -406,11 +391,11 @@ case $basic_machine in ;; mipsel*-linux*) basic_machine=mipsel-unknown - os=-linux-gnu + os=-linux ;; mips*-linux*) basic_machine=mips-unknown - os=-linux-gnu + os=-linux ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` @@ -422,10 +407,6 @@ case $basic_machine in basic_machine=i486-ncr os=-sysv4 ;; - netwinder) - basic_machine=armv4l-corel - os=-linux - ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos @@ -483,23 +464,25 @@ case $basic_machine in pc532 | pc532-*) basic_machine=ns32k-pc532 ;; - pentium | p5 | k5 | nexen) - basic_machine=i586-pc + pentium | p5) + basic_machine=i586-intel ;; - pentiumpro | p6 | k6 | 6x86) - basic_machine=i686-pc + pentiumpro | p6) + basic_machine=i686-intel ;; - pentiumii | pentium2) - basic_machine=i786-pc - ;; - pentium-* | p5-* | k5-* | nexen-*) + pentium-* | p5-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; - pentiumpro-* | p6-* | k6-* | 6x86-*) + pentiumpro-* | p6-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; - pentiumii-* | pentium2-*) - basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + k5) + # We don't have specific support for AMD's K5 yet, so just call it a Pentium + basic_machine=i586-amd + ;; + nexen) + # We don't have specific support for Nexgen yet, so just call it a Pentium + basic_machine=i586-nexgen ;; pn) basic_machine=pn-gould @@ -583,12 +566,6 @@ case $basic_machine in basic_machine=i386-sequent os=-dynix ;; - tx39) - basic_machine=mipstx39-unknown - ;; - tx39el) - basic_machine=mipstx39el-unknown - ;; tower | tower-32) basic_machine=m68k-ncr ;; @@ -608,7 +585,7 @@ case $basic_machine in basic_machine=vax-dec os=-vms ;; - vpp*|vx|vx-*) + vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) @@ -638,7 +615,7 @@ case $basic_machine in # 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. mips) - if [ x$os = x-linux-gnu ]; then + if [ x$os = x-linux ]; then basic_machine=mips-unknown else basic_machine=mips-mips @@ -703,12 +680,9 @@ case $os in -solaris) os=-solaris2 ;; - -svr4*) + -unixware* | svr4*) os=-sysv4 ;; - -unixware*) - os=-sysv4.2uw - ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; @@ -719,17 +693,15 @@ case $os in -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ - | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* \ + | -amigados* | -msdos* | -newsos* | -unicos* | -aof* | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -rhapsody* \ - | -openstep* | -mpeix* | -oskit*) + | -cygwin32* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -linux-gnu* | -uxpv*) # Remember, each alternative MUST END IN *, to match a version number. ;; -linux*) @@ -815,9 +787,6 @@ case $basic_machine in *-acorn) os=-riscix1.2 ;; - arm*-corel) - os=-linux - ;; arm*-semi) os=-aout ;; @@ -845,9 +814,6 @@ case $basic_machine in sparc-* | *-sun) os=-sunos4.1.1 ;; - *-be) - os=-beos - ;; *-ibm) os=-aix ;; @@ -861,7 +827,7 @@ case $basic_machine in os=-sysv ;; *-cbm) - os=-amigaos + os=-amigados ;; *-dg) os=-dgux @@ -938,12 +904,6 @@ case $basic_machine in -hpux*) vendor=hp ;; - -mpeix*) - vendor=hp - ;; - -mpeix*) - vendor=hp - ;; -hiux*) vendor=hitachi ;; diff --git a/configure.in.in b/configure.in.in index c1a9293861..1369c8783a 100644 --- a/configure.in.in +++ b/configure.in.in @@ -1,6 +1,8 @@ dnl $Id$ -*- sh -*- dnl Process this file with autoconf to produce a configure script. + + divert(0) AC_INIT(main.c) recurse=yes @@ -14,25 +16,14 @@ for arg in $@; do esac done -if test "$with_shared_apache" != "no" && test -n "$with_shared_apache" ; then - echo "" - echo "ERROR: --with-shared-apache is not supported." - echo " Please read INSTALL.DSO for instructions on using APXS." - exit 1 -fi - -cwd=`pwd` -cachefile=$cwd/config.cache - if test "$recurse" = "yes"; then - (set -x; test -d libzend || mkdir libzend ; cd libzend; $cwd/$srcdir/libzend/configure --cache-file=$cachefile $@) + cwd=`pwd` + (set -x; test -d libzend || mkdir libzend ; cd libzend; $cwd/$srcdir/libzend/configure --cache-file=$cwd/config.cache $@) if test "$threadsafe" = "yes"; then - (set -x; test -d TSRM || mkdir TSRM; cd TSRM; $cwd/$srcdir/TSRM/configure --cache-file=$cachefile $@) + (set -x; test -d TSRM || mkdir TSRM; cd TSRM; $cwd/$srcdir/TSRM/configure --cache-file=$cwd/config.cache $@) fi fi -(set -x; cd $srcdir; ./ltconfig --disable-static --enable-dlopen --cache-file=$cachefile ltmain.sh) - dnl ## Diversion 1 is the initial checking of OS features, programs, dnl ## libraries and so on. @@ -51,14 +42,12 @@ dnl ## Diversion 4 is the last one. Here we generate files and clean up. divert(1) dnl ## This is where the version number is changed from now on! -AM_INIT_AUTOMAKE(php, 4.0b2-dev) +AM_INIT_AUTOMAKE(php, 4.0B1) PHP_VERSION=$VERSION -echo "/* automatically generated by configure */" > php_version.h.new -echo "/* edit configure.in.in to change version number */" >> php_version.h.new -echo "#define PHP_VERSION \"$PHP_VERSION\"" >> php_version.h.new +echo "#define PHP_VERSION \"$PHP_VERSION\"" > php_version.h.new cmp php_version.h.new php_version.h >/dev/null 2>&1 if test $? -ne 0 ; then rm -f php_version.h && mv php_version.h.new php_version.h && \ @@ -74,13 +63,7 @@ AM_MAINTAINER_MODE dnl We want this one before the checks, so the checks can modify CFLAGS. test -z "$CFLAGS" && auto_cflags=1 -dnl If we're using cc on HP-UX, add the -Ae to CFLAGS -if test -n "$auto_cflags" && test "`uname -s 2>/dev/null`" = "HP-UX"; then - test -n "$GCC" || CFLAGS="-Ae $CFLAGS -D_HPUX_SOURCE" -fi - dnl Checks for programs. -AM_PROG_LIBTOOL AC_PROG_YACC if test "$YACC" != "bison -y"; then AC_MSG_WARN(You will need bison if you want to regenerate the PHP parsers.) @@ -314,9 +297,7 @@ AC_CHECK_FUNCS(memcpy memmove strdup strerror strcasecmp strstr flock lockf pute AC_FUNC_UTIME_NULL AC_FUNC_ALLOCA dnl## OLDLIBS=$LIBS; LIBS="" -dnl This is also defined/used in libzend. To avoid a redefinition -dnl we use that version -dnl AC_BROKEN_SPRINTF +AC_BROKEN_SPRINTF dnl## LIBS=$OLDLIBS AC_REPLACE_FUNCS(getopt) @@ -384,6 +365,64 @@ AC_ARG_WITH(apxs, APACHE_INSTALL_FILES="$srcdir/mod_php4.* libphp4.module" +AC_MSG_CHECKING(for Apache module support via DSO through APACI) +AC_ARG_WITH(shared-apache, +[ --with-shared-apache[=DIR] Build shared Apache module. DIR is the top-level + Apache build directory, defaults to /usr/local/etc/httpd. + (This option needs Perl installed)], +[ + if test "$withval" = "yes"; then + # Apache's default directory + withval=/usr/local/etc/httpd + fi + if test "$withval" != "no"; then + rpath_raw=yes + if test -f $withval/src/include/httpd.h; then + AC_EXPAND_PATH($withval, withval) + APACHE_INCLUDE="-I$withval/src/include -I$withval/src/os/unix" + APACHE_TARGET=$withval/src/modules/php4 + if test ! -d $APACHE_TARGET; then + mkdir $APACHE_TARGET + fi + CFLAGS_SHLIB=`perl -V:cccdlflags | cut -d\' -f2` + LDFLAGS_SHLIB=`perl -V:lddlflags | cut -d\' -f2` + LDFLAGS_SHLIB_EXPORT=`perl -V:ccdlflags | cut -d\' -f2` + PHP_LIBS= + BINNAME=libmodphp4-so.a + INSTALL_IT="mkdir -p $APACHE_TARGET; cp $BINNAME $APACHE_INSTALL_FILES $APACHE_TARGET; cp apMakefile.tmpl $APACHE_TARGET/Makefile.tmpl; cp apMakefile.libdir $APACHE_TARGET/Makefile.libdir" + AC_DEFINE(APACHE) + AC_MSG_RESULT(yes - Shared Apache 1.3.x) + STRONGHOLD= + if test -f $withval/src/include/ap_config.h; then + AC_DEFINE(HAVE_AP_CONFIG_H) + fi + if test -f $withval/src/include/ap_compat.h; then + AC_DEFINE(HAVE_AP_COMPAT_H) + if test ! -f $withval/src/include/ap_config_auto.h; then + AC_MSG_ERROR(Please run Apache's configure or src/Configure program once and try again) + fi + else + if test -f $withval/src/include/compat.h; then + AC_DEFINE(HAVE_OLD_COMPAT_H) + fi + fi + else + AC_MSG_RESULT(no) + AC_MSG_ERROR(Invalid Apache directory - unable to find httpd.h under $withval/src/include) + fi + fi + INCLUDES="$INCLUDES $APACHE_INCLUDE" + AC_SUBST(APACHE_INCLUDE) + AC_SUBST(APACHE_TARGET) + AC_SUBST(INSTALL_IT) + AC_SUBST(BINNAME) + AC_SUBST(PHP_LIBS) +],[ + AC_MSG_RESULT(no) +]) + + + if test "$BINNAME" != "libmodphp4-so.a"; then if test "$BINNAME" != "libphp4.so"; then AC_MSG_CHECKING(for Apache module support) @@ -877,8 +916,7 @@ AC_SUBST(CFLAGS_SHLIB) AC_SUBST(LDFLAGS_SHLIB) AC_SUBST(LDFLAGS_SHLIB_EXPORT) AC_SUBST(RPATHS) -AC_SUBST(RAW_RPATHS) - + PHP_BUILD_DATE=`date '+%Y-%m-%d'` AC_SUBST(PHP_BUILD_DATE) AC_DEFINE_UNQUOTED(PHP_BUILD_DATE,"$PHP_BUILD_DATE") @@ -899,48 +937,45 @@ if test ! -f $srcdir/ext/bcmath/number.c; then echo "/* Dummy File */" > $srcdir/ext/bcmath/number.h fi -if test "" = ""; then - - chmod +x scripts/mkextlib - # Hacking while airborne considered harmful. - # - echo "creating internal_functions.c" - extensions=\`grep '^s.@EXT_STATIC@' \$0|sed -e 's/^.*@% *//' -e 's/%.*$//'\` - mv -f internal_functions.c internal_functions.c.old 2>/dev/null - sh $srcdir/genif.sh $srcdir/internal_functions.c.in $srcdir \$extensions > internal_functions.c - if cmp internal_functions.c.old internal_functions.c > /dev/null 2>&1; then - echo "internal_functions.c is unchanged" - mv internal_functions.c.old internal_functions.c - else - rm -f internal_functions.c.old - fi - - # Warn about CGI version with no extra security options. - if test "$BINNAME" = "php"; then - if test "$REDIRECT" = "0"; then - if test "$DISCARD_PATH" = "0"; then - echo "+--------------------------------------------------------------------+" - echo "| Warning: |" - echo "| You will be compiling the CGI version of PHP without any |" - echo "| redirection checking. By putting this cgi binary somewhere in |" - echo "| your web space, users may be able to circumvent existing .htaccess |" - echo "| security by loading files directly through the parser. See |" - echo "| http://www.php.net/manual/config-security.php3 for more details. |" - fi - fi - fi +chmod +x scripts/mkextlib +# Hacking while airborne considered harmful. +# +echo "creating internal_functions.c" +extensions=\`grep '^s.@EXT_SUBDIRS@' \$0|sed -e 's/^.*@% *//' -e 's/%.*$//'\` +mv -f internal_functions.c internal_functions.c.old 2>/dev/null +sh $srcdir/genif.sh $srcdir/internal_functions.c.in $srcdir \$extensions > internal_functions.c +if cmp internal_functions.c.old internal_functions.c > /dev/null 2>&1; then + echo "internal_functions.c is unchanged" + mv internal_functions.c.old internal_functions.c +else + rm -f internal_functions.c.old +fi - echo "+--------------------------------------------------------------------+" - echo "| License: |" - echo "| This software is subject to the PHP License, available in this |" - echo "| distribution in the file LICENSE. By continuing this installation |" - echo "| process, you are bound by the terms of this license agreement. |" - echo "| If you do not agree with the terms of this license, you must abort |" - echo "| the installation process at this point. |" - echo "+--------------------------------------------------------------------+" +dnl Warn about CGI version with no extra security options. +if test "$BINNAME" = "php"; then + if test "$REDIRECT" = "0"; then + if test "$DISCARD_PATH" = "0"; then + echo "+--------------------------------------------------------------------+" + echo "| Warning: |" + echo "| You will be compiling the CGI version of PHP without any |" + echo "| redirection checking. By putting this cgi binary somewhere in |" + echo "| your web space, users may be able to circumvent existing .htaccess |" + echo "| security by loading files directly through the parser. See |" + echo "| http://www.php.net/manual/config-security.php3 for more details. |" + fi + fi fi +echo "+--------------------------------------------------------------------+" +echo "| License: |" +echo "| This software is subject to the PHP License, available in this |" +echo "| distribution in the file LICENSE. By continuing this installation |" +echo "| process, you are bound by the terms of this license agreement. |" +echo "| If you do not agree with the terms of this license, you must abort |" +echo "| the installation process at this point. |" +echo "+--------------------------------------------------------------------+" + ]) divert diff --git a/cvsusers b/cvsusers new file mode 100644 index 0000000000..9763c24bc3 --- /dev/null +++ b/cvsusers @@ -0,0 +1,62 @@ +CVS login Name Email Works on +andi Andi Gutmans andi@php.net Core + API +jim Jim Winstead jimw@php.net Everything +rasmus Rasmus Lerdorf rasmus@php.net Everything +shane Shane Caraveo shane@php.net WIN32 + API +ssb Stig Bakken stig@php.net Everything +zeev Zeev Suraski zeev@php.net Everything +jaakko Jaakko Hyvatti jaakko@hyvatti.iki.fi Everything +veebert Rex Logan veebert@dimensional.com IMAP +chad Chad Robinson chadr@brttech.com Documentation +myddryn PostgreSQL +wojtek +mitch Mitch Golden Oracle +brian +lr Lachlan Roche lr@www.wwi.com.au MD5 +damian +ian +jah Jouni Ahto jah@cultnet.fi Postgres, Informix +adam +amitay Amitay Isaacs amitay@w-o-i.com LDAP +dizzy +mark +guy +jeffhu Jeffrey Hulten jeffh@premier1.net WIN32 + modules(?) +eschmid Egon Schmid eschmid@delos.lf.net Documentation +cslawi Torben Wilson torben@netmill.com Documentation +bwk +eric +tcobb Troy Cobb www +gareth www +willer Steve Willer willer@interlog.com pack +cmv Colin Viebrock cmv@privateworld.com www +soderman +tin +musone Mark Musone musone@afterfive.com IMAP +abelits Alex Belits abelits@phobos.illtel.denver.co.us fhttpd module +ars Ariel Shkedi ars@ziplink.net setup +mag Nikolay P. Romanyuk mag@redcom.ru Raima DB +rse Ralf S. Engelschall rse@engelschall.com Apache configuration +sr Stefan Roehrich sr@linux.de zlib module +owl Igor Kovalenko owl@infomarket.ru QNX support +pcurtis Paul Curtis pcurtis@netscape.com NSAPI work (??) +lynch Richard Lynch lynch@lscorp.com Documentation +steffann Sander Steffann steffann@nederland.net Safe Mode +wdiestel Wolfram Diestel wdiestel@debis.com Oracle WebServer cartridge +fmk Frank M. Kromann fmk@businessnet.dk Direct MS-SQL, NaVision, Lotus Notes +steinm Uwe Steinmann Uwe.Steinmann@fernuni-hagen.de Hyperwave Module +danny Danny Heijl Danny.Heijl@cevi.be Informix +kara Andreas Karajannis Andreas.Karajannis@gmd.de ODBC, Oracle +nyenyon Christian Cartus chc@idgruppe.de Informix +kk Kristian Köhntopp kk@shonline.de Documentation +ted Ted Rolle ted.rolle@usa.net Documentation +holger Holger Zimmermann zimpel@t-online.de Pi3Web support +sgk Shigeru Kanemoto sgk@happysize.co.jp Japanese language support +jimjag Jim Jagielski jim@jaguNET.com Misc scraps +martin Martin Kraemer Martin.Kraemer@Mch.SNI.De EBCDIC (BS2000 mainframe port) +kwazy Landon Bradshaw landon@bradshaw.org Documentation +thies Thies C. Arntzen thies@digicol.de implement IPTC reader, maybe some oracle stuff +cschneid Christian Schneider cschneid@relog.ch gzip run-time encoding of output stream +tommay Tom May tom@go2net.com Sybase-CT +swilliam Steve Williams swilliam@empress.com Empress support in unified ODBC +sas Sascha Schumann sas@schell.de Various tweaks diff --git a/ext/Makefile.am b/ext/Makefile.am index 12f02bafc4..0903c2c82b 100644 --- a/ext/Makefile.am +++ b/ext/Makefile.am @@ -1,10 +1,9 @@ ## Process this file with automake to produce Makefile.in SUBDIRS = @EXT_SUBDIRS@ -EXT_STATIC = @EXT_STATIC@ noinst_LIBRARIES=libphpext.a libphpext.a: @EXT_LIBS@ - top_srcdir=$(top_srcdir) $(top_builddir)/scripts/mkextlib $@ $(EXT_STATIC) + top_srcdir=$(top_srcdir) $(top_builddir)/scripts/mkextlib $@ $(SUBDIRS) -@test "`uname -s`" = "Rhapsody" && $(RANLIB) $@ diff --git a/ext/dba/Makefile.am b/ext/dba/Makefile.am deleted file mode 100644 index b609be3bf3..0000000000 --- a/ext/dba/Makefile.am +++ /dev/null @@ -1,7 +0,0 @@ -# $Id$ - -INCLUDES=@INCLUDES@ -I@top_srcdir@ -I@top_srcdir@/libzend -noinst_LIBRARIES=libphpext_dba.a -libphpext_dba_a_SOURCES=dba.c dba_cdb.c dba_db2.c dba_dbm.c dba_gdbm.c \ - dba_ndbm.c - diff --git a/ext/dba/config.h.stub b/ext/dba/config.h.stub deleted file mode 100644 index f65ae9b7fa..0000000000 --- a/ext/dba/config.h.stub +++ /dev/null @@ -1,17 +0,0 @@ -/* define if you want to use the dba extension */ - -#define NDBM_DB1_NDBM_H 0 -#define NDBM_NDBM_H 0 -#define DB2_DB2_DB_H 0 -#define DB2_DB_DB2_H 0 -#define DB2_DB_H 0 -#define DB2_DB2_H 0 -#define HAVE_DBA 0 -#define DBA_GDBM 0 -#define DBA_NDBM 0 -#define DBA_DBOPEN 0 -#define DBA_DB2 0 -#define DBA_DBM 0 -#define DBA_CDB 0 - - diff --git a/ext/dba/config.m4 b/ext/dba/config.m4 deleted file mode 100644 index c3e9b60aa0..0000000000 --- a/ext/dba/config.m4 +++ /dev/null @@ -1,210 +0,0 @@ -dnl $Id$ -dnl config.m4 for extension dba -dnl don't forget to call PHP_EXTENSION(dba) - -AC_DEFUN(AC_TEMP_LDFLAGS,[ - old_LDFLAGS="$LDFLAGS" - LDFLAGS="$1 $LDFLAGS" - $2 - LDFLAGS="$old_LDFLAGS" -]) - - -dnl Assign INCLUDE/LFLAGS from PREFIX -AC_DEFUN(AC_DBA_STD_ASSIGN,[ - if test "$THIS_PREFIX" != "" -a "$THIS_PREFIX" != "/usr"; then - THIS_INCLUDE="$THIS_PREFIX/include" - THIS_LFLAGS="$THIS_PREFIX/lib" - fi -]) - -dnl Standard check -AC_DEFUN(AC_DBA_STD_CHECK,[ - THIS_RESULT="yes" - if test "$THIS_PREFIX" != "/usr"; then - if test "$THIS_INCLUDE" = "" ; then - AC_MSG_ERROR(cannot find necessary header file(s)) - elif test "$THIS_LIBS" = "" ; then - AC_MSG_ERROR(cannot find necessary library) - fi - fi -]) - -dnl Attach THIS_x to DBA_x -AC_DEFUN(AC_DBA_STD_ATTACH,[ - AC_ADD_INCLUDE($THIS_INCLUDE) - AC_ADD_LIBRARY_WITH_PATH($THIS_LIBS, $THIS_LFLAGS) - - THIS_INCLUDE="" - THIS_LIBS="" - THIS_LFLAGS="" - THIS_PREFIX="" -]) - -dnl Print the result message -AC_DEFUN(AC_DBA_STD_RESULT,[ - if test "$THIS_RESULT" = "yes"; then - HAVE_DBA=1 - AC_MSG_RESULT(yes) - else - AC_MSG_RESULT(no) - fi - THIS_RESULT="" -]) - - - -AC_ARG_WITH(gdbm, -[ --with-gdbm[=DIR] Include GDBM support],[ - if test "$withval" != "no"; then - for i in /usr/local /usr $withval; do - if test -f "$i/include/gdbm.h"; then - THIS_PREFIX="$i" - fi - done - - unset ac_cv_lib_gdbm_gdbm_open - AC_TEMP_LDFLAGS(-L$THIS_PREFIX/lib,[ - AC_CHECK_LIB(gdbm, gdbm_open, [AC_DEFINE(DBA_GDBM, 1) THIS_LIBS="gdbm"]) - ]) - - AC_DBA_STD_ASSIGN - AC_DBA_STD_CHECK - AC_DBA_STD_ATTACH - fi -]) -AC_MSG_CHECKING(for GDBM support) -AC_DBA_STD_RESULT - -AC_ARG_WITH(ndbm, -[ --with-ndbm[=DIR] Include NDBM support],[ - if test "$withval" != "no"; then - for i in /usr/local /usr $withval; do - if test -f "$i/include/db1/ndbm.h" ; then - THIS_PREFIX="$i" - NDBM_EXTRA="NDBM_DB1_NDBM_H" - elif test -f "$i/include/ndbm.h" ; then - THIS_PREFIX="$i" - NDBM_EXTRA="NDBM_NDBM_H" - fi - done - - if test "$NDBM_EXTRA" != ""; then - eval "AC_DEFINE($NDBM_EXTRA, 1)" - fi - - for LIB in db1 ndbm c; do - AC_TEMP_LDFLAGS(-L$THIS_PREFIX/lib,[ - AC_CHECK_LIB($LIB, dbm_open, [AC_DEFINE(DBA_NDBM,1) THIS_LIBS="$LIB"]) - ]) - done - - AC_DBA_STD_ASSIGN - AC_DBA_STD_CHECK - AC_DBA_STD_ATTACH - fi -]) -AC_MSG_CHECKING(for NDBM support) -AC_DBA_STD_RESULT - -AC_ARG_WITH(db2, -[ --with-db2[=DIR] Include DB2 support],[ - if test "$withval" != "no"; then - for i in /usr/local /usr /usr/BerkeleyDB $withval; do - if test -f "$i/db2/db.h"; then - THIS_PREFIX="$i" - DB2_EXTRA="db2" - elif test -f "$i/include/db2/db.h"; then - THIS_PREFIX="$i" - DB2_EXTRA="DB2_DB2_DB_H" - elif test -f "$i/include/db/db2.h"; then - THIS_PREFIX="$i" - DB2_EXTRA="DB2_DB_DB2_H" - elif test -f "$i/include/db2.h"; then - THIS_PREFIX="$i" - DB2_EXTRA="DB2_DB2_H" - elif test -f "$i/include/db.h" ; then - THIS_PREFIX="$i" - DB2_EXTRA="DB2_DB_H" - fi - done - - if test "$DB2_EXTRA" = "db2" ; then - DBA_INCLUDE="$DBA_INCLUDE -I$THIS_PREFIX/db2" - DB2_EXTRA="DB2_DB_H" - fi - - if test "$DB2_EXTRA" != ""; then - eval "AC_DEFINE($DB2_EXTRA, 1)" - fi - - for LIB in db db2 c; do - AC_TEMP_LDFLAGS(-L$THIS_PREFIX/lib,[ - AC_CHECK_LIB($LIB, db_appinit, [AC_DEFINE(DBA_DB2,1) THIS_LIBS="$LIB"]) - ]) - done - - AC_DBA_STD_ASSIGN - AC_DBA_STD_CHECK - AC_DBA_STD_ATTACH - fi -]) -AC_MSG_CHECKING(for DB2 support) -AC_DBA_STD_RESULT - -AC_ARG_WITH(dbm, -[ --with-dbm[=DIR] Include DBM support],[ - if test "$withval" != "no"; then - for i in /usr/local /usr $withval; do - if test -f "$i/include/dbm.h" ; then - THIS_PREFIX="$i" - fi - done - - for LIB in db1 dbm c; do - AC_TEMP_LDFLAGS(-L$THIS_PREFIX/lib,[ - AC_CHECK_LIB($LIB, dbminit, [AC_DEFINE(DBA_DBM,1) THIS_LIBS="$LIB"]) - ]) - done - - AC_DBA_STD_ASSIGN - AC_DBA_STD_CHECK - AC_DBA_STD_ATTACH - fi -]) -AC_MSG_CHECKING(for DBM support) -AC_DBA_STD_RESULT - -AC_ARG_WITH(cdb, -[ --with-cdb[=DIR] Include CDB support],[ - if test "$withval" != "no"; then - for i in /usr/local /usr $withval; do - if test -f "$i/include/cdb.h" ; then - THIS_PREFIX="$i" - fi - done - - for LIB in cdb c; do - AC_TEMP_LDFLAGS(-L$THIS_PREFIX/lib,[ - AC_CHECK_LIB($LIB, cdb_bread, [AC_DEFINE(DBA_CDB,1) THIS_LIBS="$LIB"]) - ]) - done - - AC_DBA_STD_ASSIGN - AC_DBA_STD_CHECK - AC_DBA_STD_ATTACH - fi -]) -AC_MSG_CHECKING(for CDB support) -AC_DBA_STD_RESULT - -AC_MSG_CHECKING(whether to enable DBA interface) -if test "$HAVE_DBA" = "1"; then - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_DBA, 1) - PHP_EXTENSION(dba) -else - AC_MSG_RESULT(no) - AC_DEFINE(HAVE_DBA, 0) -fi - diff --git a/ext/dba/dba.c b/ext/dba/dba.c deleted file mode 100644 index 7024673d21..0000000000 --- a/ext/dba/dba.c +++ /dev/null @@ -1,476 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP HTML Embedded Scripting Language Version 3.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1999 PHP Development Team (See Credits file) | - +----------------------------------------------------------------------+ - | This program is free software; you can redistribute it and/or modify | - | it under the terms of one of the following licenses: | - | | - | A) 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. | - | | - | B) the PHP License as published by the PHP Development Team and | - | included in the distribution in the file: LICENSE | - | | - | 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 both licenses referred to here. | - | If you did not, or have any questions about PHP licensing, please | - | contact core@php.net. | - +----------------------------------------------------------------------+ - | Authors: Sascha Schumann <sas@schell.de> | - +----------------------------------------------------------------------+ - */ - -/* $Id$ */ - -#include "php.h" - -#if HAVE_DBA - -#include "php3_dba.h" - -#include "php3_gdbm.h" -#include "php3_ndbm.h" -#include "php3_dbm.h" -#include "php3_cdb.h" -#include "php3_db2.h" - -function_entry dba_functions[] = { - PHP_FE(dba_open, NULL) - PHP_FE(dba_popen, NULL) - PHP_FE(dba_close, NULL) - PHP_FE(dba_delete, NULL) - PHP_FE(dba_exists, NULL) - PHP_FE(dba_fetch, NULL) - PHP_FE(dba_insert, NULL) - PHP_FE(dba_replace, NULL) - PHP_FE(dba_firstkey, NULL) - PHP_FE(dba_nextkey, NULL) - PHP_FE(dba_optimize, NULL) - PHP_FE(dba_sync, NULL) - {NULL,NULL,NULL} -}; - -static int php3_minit_dba(INIT_FUNC_ARGS); -static int php3_mshutdown_dba(SHUTDOWN_FUNC_ARGS); -static void php3_info_dba(ZEND_MODULES_INFO_FUNC_ARGS); - -php3_module_entry dba_module_entry = { - "DataBase API", dba_functions, - php3_minit_dba, - php3_mshutdown_dba, - NULL, NULL, - php3_info_dba, - STANDARD_MODULE_PROPERTIES -}; - -typedef struct dba_handler { - char *name; - int (*open)(dba_info *); - void (*close)(dba_info *); - char* (*fetch)(dba_info *, char *, int, int *); - int (*update)(dba_info *, char *, int, char *, int, int); - int (*exists)(dba_info *, char *, int); - int (*delete)(dba_info *, char *, int); - char* (*firstkey)(dba_info *, int *); - char* (*nextkey)(dba_info *, int *); - int (*optimize)(dba_info *); - int (*sync)(dba_info *); -} dba_handler; - -/* {{{ macromania */ - -#define DBA_ID_PARS pval *id; dba_info *info = NULL; int type, ac = ARG_COUNT(ht) - -/* these are used to get the standard arguments */ - -#define DBA_GET1 \ - if(ac != 1 || getParameters(ht, ac, &id) != SUCCESS) { \ - WRONG_PARAM_COUNT; \ - } - -#define DBA_GET2 \ - pval *key; \ - if(ac != 2 || getParameters(ht, ac, &key, &id) != SUCCESS) { \ - WRONG_PARAM_COUNT; \ - } \ - convert_to_string(key) - -#define DBA_IF_NOT_CORRECT_TYPE(link_id) \ - info = php3_list_find(link_id, &type); \ - if(!info || (type != GLOBAL(le_db) && type != GLOBAL(le_pdb))) - -#define DBA_ID_GET \ - convert_to_long(id); \ - DBA_IF_NOT_CORRECT_TYPE(id->value.lval) { \ - php3_error(E_WARNING, "Unable to find DBA identifier %d", id->value.lval); \ - RETURN_FALSE; \ - } - -#define DBA_ID_GET1 DBA_ID_PARS; DBA_GET1; DBA_ID_GET -#define DBA_ID_GET2 DBA_ID_PARS; DBA_GET2; DBA_ID_GET - -/* a DBA handler must have specific routines */ - -#define DBA_HND(x) \ -{\ - #x, dba_open_##x, dba_close_##x, dba_fetch_##x, dba_update_##x, \ - dba_exists_##x, dba_delete_##x, dba_firstkey_##x, dba_nextkey_##x, \ - dba_optimize_##x, dba_sync_##x \ -}, - -/* check whether the user has write access */ -#define DBA_WRITE_CHECK \ - if(info->mode != DBA_WRITER && info->mode != DBA_TRUNC && info->mode != DBA_CREAT) { \ - php3_error(E_WARNING, "you cannot perform a modification to a database without proper access"); \ - RETURN_FALSE; \ - } - -#define GLOBAL(a) a - -/* }}} */ - -/* {{{ globals */ - -static dba_handler handler[] = { -#if DBA_GDBM - DBA_HND(gdbm) -#endif -#if DBA_DBM - DBA_HND(dbm) -#endif -#if DBA_NDBM - DBA_HND(ndbm) -#endif -#if DBA_CDB - DBA_HND(cdb) -#endif -#if DBA_DB2 - DBA_HND(db2) -#endif - { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL } -}; - -static int le_db; -static int le_pdb; -static HashTable ht_keys; -/* }}} */ - -/* {{{ helper routines */ - /* {{{ dba_close */ - -static void dba_close(dba_info *info) -{ - if(info->hnd) info->hnd->close(info); - if(info->path) free(info->path); - free(info); -} -/* }}} */ - /* {{{ php3_minit_dba */ - -static int php3_minit_dba(INIT_FUNC_ARGS) -{ - _php3_hash_init(&ht_keys, 0, NULL, NULL, 1); - GLOBAL(le_db) = register_list_destructors(dba_close, NULL); - GLOBAL(le_pdb) = register_list_destructors(NULL, dba_close); - return SUCCESS; -} -/* }}} */ - /* {{{ php3_mshutdown_dba */ - -static int php3_mshutdown_dba(SHUTDOWN_FUNC_ARGS) -{ - _php3_hash_destroy(&ht_keys); - return SUCCESS; -} -/* }}} */ - /* {{{ php3_info_dba */ - -static void php3_info_dba(ZEND_MODULE_INFO_FUNC_ARGS) -{ - dba_handler *hptr; - - PUTS("V1 ($Id$)"); - for(hptr = handler; hptr->name; hptr++) { - PUTS(" "); - PUTS(hptr->name); - } -} -/* }}} */ - /* {{{ _php3_dba_update */ - -static void _php3_dba_update(INTERNAL_FUNCTION_PARAMETERS, int mode) -{ - DBA_ID_PARS; - pval *val, *key; - - if(ac != 3 || getParameters(ht, ac, &key, &val, &id) != SUCCESS) { - WRONG_PARAM_COUNT; - } - convert_to_string(key); - convert_to_string(val); - DBA_ID_GET; - - DBA_WRITE_CHECK; - - if(info->hnd->update(info, VALLEN(key), VALLEN(val), mode) == SUCCESS) - RETURN_TRUE; - RETURN_FALSE; -} -/* }}} */ - /* {{{ _php3_dba_open */ - -#define FREENOW if(args) efree(args); if(key) efree(key) - -static void _php3_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent) -{ - pval **args = (pval **) NULL; - int ac = ARG_COUNT(ht); - dba_mode_t modenr; - dba_info *info; - dba_handler *hptr; - char *key = NULL; - int keylen = 0; - int listid; - int i; - - if(ac < 3) { - WRONG_PARAM_COUNT; - } - - /* we pass additional args to the respective handler */ - args = emalloc(ac * sizeof(pval *)); - if(getParametersArray(ht, ac, args) != SUCCESS) { - FREENOW; - WRONG_PARAM_COUNT; - } - - /* we only take string arguments */ - for(i = 0; i < ac; i++) { - convert_to_string(args[i]); - keylen += args[i]->value.str.len; - } - - if(persistent) { - /* calculate hash */ - key = emalloc(keylen); - keylen = 0; - - for(i = 0; i < ac; i++) { - memcpy(key+keylen,args[i]->value.str.val,args[i]->value.str.len); - keylen += args[i]->value.str.len; - } - - if(_php3_hash_find(&ht_keys, key, keylen, (void **) &info) == SUCCESS) { - FREENOW; - RETURN_LONG(php3_list_insert(info, GLOBAL(le_pdb))); - } - } - - /* this is O(n) and could be improved */ - for(hptr = handler; hptr->name && - strcasecmp(hptr->name, args[2]->value.str.val); hptr++); - - if(!hptr->name) { - php3_error(E_WARNING, "no such handler: %s", args[2]->value.str.val); - FREENOW; - RETURN_FALSE; - } - - switch(args[1]->value.str.val[0]) { - case 'c': - modenr = DBA_CREAT; - break; - case 'w': - modenr = DBA_WRITER; - break; - case 'r': - modenr = DBA_READER; - break; - case 'n': - modenr = DBA_TRUNC; - break; - default: - php3_error(E_WARNING,"illegal DBA mode: %s",args[1]->value.str.val); - FREENOW; - RETURN_FALSE; - } - - info = malloc(sizeof(*info)); - memset(info, 0, sizeof(info)); - info->path = strdup(args[0]->value.str.val); - info->mode = modenr; - info->argc = ac - 3; - info->argv = args + 3; - info->hnd = NULL; - - if(hptr->open(info) != SUCCESS) { - dba_close(info); - php3_error(E_WARNING, "driver initialization failed"); - FREENOW; - RETURN_FALSE; - } - info->hnd = hptr; - info->argc = 0; - info->argv = NULL; - - listid = php3_list_insert(info, persistent?GLOBAL(le_pdb):GLOBAL(le_db)); - if(persistent) { - _php3_hash_update(&ht_keys, key, keylen, info, sizeof(*info), NULL); - } - - FREENOW; - RETURN_LONG(listid); -} -#undef FREENOW -/* }}} */ -/* }}} */ - -/* {{{ proto int dba_popen(string path, string mode, string handlername[, ...]) - opens path using the specified handler in mode persistently */ -PHP_FUNCTION(dba_popen) -{ - _php3_dba_open(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); -} -/* }}} */ - -/* {{{ proto int dba_open(string path, string mode, string handlername[, ...]) - opens path using the specified handler in mode*/ -PHP_FUNCTION(dba_open) -{ - _php3_dba_open(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); -} -/* }}} */ - -/* {{{ proto void dba_close(int handle) - closes database */ -PHP_FUNCTION(dba_close) -{ - DBA_ID_GET1; - - php3_list_delete(id->value.lval); -} -/* }}} */ - -/* {{{ proto bool dba_exists(string key, int handle) - checks, if the specified key exists */ -PHP_FUNCTION(dba_exists) -{ - DBA_ID_GET2; - - if(info->hnd->exists(info, VALLEN(key)) == SUCCESS) { - RETURN_TRUE; - } - RETURN_FALSE; -} -/* }}} */ - -/* {{{ proto string dba_fetch(string key, int handle) - fetches the data associated with key */ -PHP_FUNCTION(dba_fetch) -{ - char *val; - int len = 0; - DBA_ID_GET2; - - if((val = info->hnd->fetch(info, VALLEN(key), &len)) != NULL) { - RETURN_STRINGL(val, len, 0); - } - RETURN_FALSE; -} -/* }}} */ - -/* {{{ proto string dba_firstkey(int handle) - resets the internal key pointer and returns the first key */ -PHP_FUNCTION(dba_firstkey) -{ - char *fkey; - int len; - DBA_ID_GET1; - - fkey = info->hnd->firstkey(info, &len); - if(fkey) - RETURN_STRINGL(fkey, len, 0); - RETURN_FALSE; -} -/* }}} */ - -/* {{{ proto string dba_nextkey(int handle) - returns the next key */ -PHP_FUNCTION(dba_nextkey) -{ - char *nkey; - int len; - DBA_ID_GET1; - - nkey = info->hnd->nextkey(info, &len); - if(nkey) - RETURN_STRINGL(nkey, len, 0); - RETURN_FALSE; -} -/* }}} */ - -/* {{{ proto bool dba_delete(string key, int handle) - deletes the entry associated with key */ -PHP_FUNCTION(dba_delete) -{ - DBA_ID_GET2; - - DBA_WRITE_CHECK; - - if(info->hnd->delete(info, VALLEN(key)) == SUCCESS) - RETURN_TRUE; - RETURN_FALSE; -} -/* }}} */ - -/* {{{ proto bool dba_insert(string key, string value, int handle) - inserts value as key, returns false, if key exists already */ -PHP_FUNCTION(dba_insert) -{ - _php3_dba_update(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); -} -/* }}} */ - -/* {{{ proto bool dba_replace(string key, string value, int handle) - inserts value as key, replaces key, if key exists already */ -PHP_FUNCTION(dba_replace) -{ - _php3_dba_update(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); -} -/* }}} */ - -/* {{{ proto bool dba_optimize(int handle) - optimizes (e.g. clean up, vacuum) database */ -PHP_FUNCTION(dba_optimize) -{ - DBA_ID_GET1; - - DBA_WRITE_CHECK; - if(info->hnd->optimize(info) == SUCCESS) { - RETURN_TRUE; - } - RETURN_FALSE; -} -/* }}} */ - -/* {{{ proto bool dba_sync(int handle) - synchronizes database */ -PHP_FUNCTION(dba_sync) -{ - DBA_ID_GET1; - - if(info->hnd->sync(info) == SUCCESS) { - RETURN_TRUE; - } - RETURN_FALSE; -} -/* }}} */ - -#endif diff --git a/ext/dba/dba_cdb.c b/ext/dba/dba_cdb.c deleted file mode 100644 index 55683590c5..0000000000 --- a/ext/dba/dba_cdb.c +++ /dev/null @@ -1,220 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP HTML Embedded Scripting Language Version 3.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1999 PHP Development Team (See Credits file) | - +----------------------------------------------------------------------+ - | This program is free software; you can redistribute it and/or modify | - | it under the terms of one of the following licenses: | - | | - | A) 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. | - | | - | B) the PHP License as published by the PHP Development Team and | - | included in the distribution in the file: LICENSE | - | | - | 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 both licenses referred to here. | - | If you did not, or have any questions about PHP licensing, please | - | contact core@php.net. | - +----------------------------------------------------------------------+ - | Authors: Sascha Schumann <sas@schell.de> | - +----------------------------------------------------------------------+ - */ - -/* $Id$ */ - -#include "php.h" - -#if DBA_CDB -#include "php3_cdb.h" - -#include <sys/types.h> -#include <unistd.h> -#include <fcntl.h> - -#include <cdb.h> -#include <cdbmake.h> - -#define CDB_INFO \ - dba_cdb *cdb = (dba_cdb *) info->dbf - -typedef struct { - int fd; - uint32 eod; /* size of constant database */ - uint32 pos; /* current position for traversing */ -} dba_cdb; - -DBA_OPEN_FUNC(cdb) -{ - int gmode = 0; - dba_cdb *cdb; - dba_info *pinfo = (dba_info *) info; - - switch(info->mode) { - case DBA_READER: - gmode = O_RDONLY; break; - /* currently not supported: */ -#if 0 - case DBA_WRITER: - gmode = O_RDWR; break; -#endif - default: - return FAILURE; - } - - cdb = malloc(sizeof *cdb); - memset(cdb, 0, sizeof *cdb); - - cdb->fd = open(info->path, gmode); - if(cdb->fd < 0) { - free(cdb); - return FAILURE; - } - - pinfo->dbf = cdb; - return SUCCESS; -} - -DBA_CLOSE_FUNC(cdb) -{ - CDB_INFO; - - close(cdb->fd); - free(cdb); -} - -DBA_FETCH_FUNC(cdb) -{ - CDB_INFO; - int len; - char *new = NULL; - - if(cdb_seek(cdb->fd, key, keylen, &len) == 1) { - new = emalloc(len); - read(cdb->fd, new, len); - if(newlen) *newlen = len; - } - - return new; -} - -DBA_UPDATE_FUNC(cdb) -{ - /* if anyone figures out cdbmake.c, let me know */ - return FAILURE; -} - -DBA_EXISTS_FUNC(cdb) -{ - CDB_INFO; - int len; - - if(cdb_seek(cdb->fd, key, keylen, &len) == 1) - return SUCCESS; - return FAILURE; -} - -DBA_DELETE_FUNC(cdb) -{ - return FAILURE; -} - - -#define CREAD(n) if(read(cdb->fd, buf, n) < n) return NULL -#define CSEEK(n) \ - if(n >= cdb->eod) return NULL; \ - if(lseek(cdb->fd, (off_t)n, SEEK_SET) != (off_t) n) return NULL - -DBA_FIRSTKEY_FUNC(cdb) -{ - CDB_INFO; - uint32 len; - char buf[8]; - char *key; - - cdb->eod = -1; - CSEEK(0); - CREAD(4); - cdb->eod = cdb_unpack(buf); - - CSEEK(2048); - CREAD(8); - len = cdb_unpack(buf); - - key = emalloc(len + 1); - if(read(cdb->fd, key, len) < len) { - efree(key); - key = NULL; - } else - key[len] = '\0'; - /* header + klenlen + dlenlen + klen + dlen */ - cdb->pos = 2048 + 4 + 4 + len + cdb_unpack(buf + 4); - - return key; -} - -DBA_NEXTKEY_FUNC(cdb) -{ - CDB_INFO; - uint32 len; - char buf[8]; - char *nkey; - - CSEEK(cdb->pos); - CREAD(8); - len = cdb_unpack(buf); - - nkey = emalloc(len + 1); - if(read(cdb->fd, nkey, len) < len) { - efree(nkey); - return NULL; - } - nkey[len] = '\0'; - if(newlen) *newlen = len; - - cdb->pos += 8 + len + cdb_unpack(buf + 4); - - return nkey; -#if 0 - /* this code cdb_seeks and is thus slower than directly seeking - in the file */ - CDB_INFO; - char *nkey = NULL; - uint32 len; - char buf[8]; - - if(cdb_seek(cdb->fd, key, keylen, &len) == 1) { - if(lseek(cdb->fd, (off_t) len, SEEK_CUR) >= (off_t) cdb->eod) - return NULL; - CREAD(8); - len = cdb_unpack(buf); - - nkey = emalloc(len + 1); - if(read(cdb->fd, nkey, len) < len) { - efree(nkey); - nkey = NULL; - } else - nkey[len] = '\0'; - } - return nkey; -#endif -} - -DBA_OPTIMIZE_FUNC(cdb) -{ - return SUCCESS; -} - -DBA_SYNC_FUNC(cdb) -{ - /* this is read-only */ - return SUCCESS; -} - -#endif diff --git a/ext/dba/dba_db2.c b/ext/dba/dba_db2.c deleted file mode 100644 index c522ef7c2d..0000000000 --- a/ext/dba/dba_db2.c +++ /dev/null @@ -1,207 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP HTML Embedded Scripting Language Version 3.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1999 PHP Development Team (See Credits file) | - +----------------------------------------------------------------------+ - | This program is free software; you can redistribute it and/or modify | - | it under the terms of one of the following licenses: | - | | - | A) 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. | - | | - | B) the PHP License as published by the PHP Development Team and | - | included in the distribution in the file: LICENSE | - | | - | 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 both licenses referred to here. | - | If you did not, or have any questions about PHP licensing, please | - | contact core@php.net. | - +----------------------------------------------------------------------+ - | Authors: Sascha Schumann <sas@schell.de> | - +----------------------------------------------------------------------+ - */ - -/* $Id$ */ - -#include "php.h" - -#if DBA_DB2 -#include "php3_db2.h" -#include <sys/stat.h> - -#include <string.h> -#if DB2_DB2_DB_H -#include <db2/db.h> -#elif DB2_DB_DB2_H -#include <db/db2.h> -#elif DB2_DB2_H -#include <db2.h> -#elif DB2_DB_H -#include <db.h> -#endif - -#define DB2_DATA dba_db2_data *dba = info->dbf -#define DB2_GKEY \ - DBT gkey; \ - memset(&gkey, 0, sizeof(gkey)); \ - gkey.data = (char *) key; gkey.size = keylen - -typedef struct { - DB *dbp; - DBC *cursor; -} dba_db2_data; - -DBA_OPEN_FUNC(db2) -{ - DB *dbp; - DBTYPE type; - int gmode = 0; - int filemode = 0644; - struct stat check_stat; - - type = info->mode == DBA_READER ? DB_UNKNOWN : - info->mode == DBA_TRUNC ? DB_BTREE : - stat(info->path, &check_stat) ? DB_BTREE : DB_UNKNOWN; - - gmode = info->mode == DBA_READER ? DB_RDONLY : - info->mode == DBA_CREAT ? DB_CREATE : - info->mode == DBA_WRITER ? 0 : - info->mode == DBA_TRUNC ? DB_CREATE | DB_TRUNCATE : -1; - - if(gmode == -1) - return FAILURE; - - if(info->argc > 0) { - convert_to_long(info->argv[0]); - filemode = info->argv[0]->value.lval; - } - - if(!db_open(info->path, type, gmode, filemode, NULL, NULL, &dbp)) { - info->dbf = malloc(sizeof(dba_db2_data)); - memset(info->dbf, 0, sizeof(dba_db2_data)); - ((dba_db2_data *) info->dbf)->dbp = dbp; - return SUCCESS; - } - return FAILURE; -} - -DBA_CLOSE_FUNC(db2) -{ - DB2_DATA; - - if(dba->cursor) dba->cursor->c_close(dba->cursor); - dba->dbp->close(dba->dbp, DB_NOSYNC); - free(dba); -} - -DBA_FETCH_FUNC(db2) -{ - DBT gval; - char *new = NULL; - DB2_DATA; - DB2_GKEY; - - memset(&gval, 0, sizeof(gval)); - if(!dba->dbp->get(dba->dbp, NULL, &gkey, &gval, 0)) { - if(newlen) *newlen = gval.size; - new = estrndup(gval.data, gval.size); - } - return new; -} - -DBA_UPDATE_FUNC(db2) -{ - DBT gval; - DB2_DATA; - DB2_GKEY; - - memset(&gval, 0, sizeof(gval)); - gval.data = (char *) val; - gval.size = vallen; - - if(!dba->dbp->put(dba->dbp, NULL, &gkey, &gval, - mode == 1 ? DB_NOOVERWRITE : 0)) { - return SUCCESS; - } - return FAILURE; -} - -DBA_EXISTS_FUNC(db2) -{ - DBT gval; - DB2_DATA; - DB2_GKEY; - - memset(&gval, 0, sizeof(gval)); - if(!dba->dbp->get(dba->dbp, NULL, &gkey, &gval, 0)) { - return SUCCESS; - } - return FAILURE; -} - -DBA_DELETE_FUNC(db2) -{ - DB2_DATA; - DB2_GKEY; - - return dba->dbp->del(dba->dbp, NULL, &gkey, 0) ? FAILURE : SUCCESS; -} - -DBA_FIRSTKEY_FUNC(db2) -{ - DB2_DATA; - - if(dba->cursor) { - dba->cursor->c_close(dba->cursor); - } - - dba->cursor = NULL; -#if (DB_VERSION_MAJOR > 2) || (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR > 6) || (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 6 && DB_VERSION_PATCH >= 4) - if(dba->dbp->cursor(dba->dbp, NULL, &dba->cursor, 0)) { -#else - if(dba->dbp->cursor(dba->dbp, NULL, &dba->cursor)) { -#endif - return NULL; - } - - /* we should introduce something like PARAM_PASSTHRU... */ - return dba_nextkey_db2(info, newlen); -} - -DBA_NEXTKEY_FUNC(db2) -{ - DB2_DATA; - DBT gkey, gval; - char *nkey = NULL; - - memset(&gkey, 0, sizeof(gkey)); - memset(&gval, 0, sizeof(gval)); - - if(!dba->cursor->c_get(dba->cursor, &gkey, &gval, DB_NEXT)) { - if(gkey.data) { - nkey = estrndup(gkey.data, gkey.size); - if(newlen) *newlen = gkey.size; - } - } - return nkey; -} - -DBA_OPTIMIZE_FUNC(db2) -{ - return SUCCESS; -} - -DBA_SYNC_FUNC(db2) -{ - DB2_DATA; - - return dba->dbp->sync(dba->dbp, 0) ? FAILURE : SUCCESS; -} - -#endif diff --git a/ext/dba/dba_dbm.c b/ext/dba/dba_dbm.c deleted file mode 100644 index 5858e8e610..0000000000 --- a/ext/dba/dba_dbm.c +++ /dev/null @@ -1,190 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP HTML Embedded Scripting Language Version 3.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1999 PHP Development Team (See Credits file) | - +----------------------------------------------------------------------+ - | This program is free software; you can redistribute it and/or modify | - | it under the terms of one of the following licenses: | - | | - | A) 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. | - | | - | B) the PHP License as published by the PHP Development Team and | - | included in the distribution in the file: LICENSE | - | | - | 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 both licenses referred to here. | - | If you did not, or have any questions about PHP licensing, please | - | contact core@php.net. | - +----------------------------------------------------------------------+ - | Authors: Sascha Schumann <sas@schell.de> | - +----------------------------------------------------------------------+ - */ - -/* $Id$ */ - -#include "php.h" - -#if DBA_DBM -#include "php3_dbm.h" - -#include <dbm.h> - -#include <unistd.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> - -#define DBM_DATA dba_dbm_data *dba = info->dbf -#define DBM_GKEY datum gkey; gkey.dptr = (char *) key; gkey.dsize = keylen - -#ifndef PATH_MAX -#define PATH_MAX 255 -#endif - -#define TRUNC_IT(extension, mode) \ - snprintf(buf, PATH_MAX, "%s" extension, info->path); \ - buf[PATH_MAX] = '\0'; \ - if((fd = open(buf, O_CREAT | mode | O_WRONLY, filemode)) == -1) \ - return FAILURE; \ - close(fd); - - -typedef struct { - datum nextkey; -} dba_dbm_data; - -DBA_OPEN_FUNC(dbm) -{ - int fd; - int filemode = 0644; - - if(info->argc > 0) { - convert_to_long(info->argv[0]); - filemode = info->argv[0]->value.lval; - } - - if(info->mode == DBA_TRUNC) { - char buf[PATH_MAX + 1]; - - /* dbm/ndbm original */ - TRUNC_IT(".pag", O_TRUNC); - TRUNC_IT(".dir", O_TRUNC); - } - - if(info->mode == DBA_CREAT) { - char buf[PATH_MAX + 1]; - - TRUNC_IT(".pag", 0); - TRUNC_IT(".dir", 0); - } - - if(dbminit((char *) info->path) == -1) { - return FAILURE; - } - - info->dbf = calloc(sizeof(dba_dbm_data), 1); - return SUCCESS; -} - -DBA_CLOSE_FUNC(dbm) -{ - free(info->dbf); - dbmclose(); -} - -DBA_FETCH_FUNC(dbm) -{ - datum gval; - char *new = NULL; - - DBM_GKEY; - gval = fetch(gkey); - if(gval.dptr) { - if(newlen) *newlen = gval.dsize; - new = estrndup(gval.dptr, gval.dsize); - } - return new; -} - -DBA_UPDATE_FUNC(dbm) -{ - datum gval; - - DBM_GKEY; - gval.dptr = (char *) val; - gval.dsize = vallen; - - return (store(gkey, gval) == -1 ? FAILURE : SUCCESS); -} - -DBA_EXISTS_FUNC(dbm) -{ - datum gval; - DBM_GKEY; - - gval = fetch(gkey); - if(gval.dptr) { - return SUCCESS; - } - return FAILURE; -} - -DBA_DELETE_FUNC(dbm) -{ - DBM_GKEY; - return(delete(gkey) == -1 ? FAILURE : SUCCESS); -} - -DBA_FIRSTKEY_FUNC(dbm) -{ - DBM_DATA; - datum gkey; - char *key = NULL; - - gkey = firstkey(); - if(gkey.dptr) { - if(newlen) *newlen = gkey.dsize; - key = estrndup(gkey.dptr, gkey.dsize); - dba->nextkey = gkey; - } else - dba->nextkey.dptr = NULL; - return key; -} - -DBA_NEXTKEY_FUNC(dbm) -{ - DBM_DATA; - datum gkey; - char *nkey = NULL; - - if(!dba->nextkey.dptr) return NULL; - - gkey = nextkey(dba->nextkey); - if(gkey.dptr) { - if(newlen) *newlen = gkey.dsize; - nkey = estrndup(gkey.dptr, gkey.dsize); - dba->nextkey = gkey; - } else - dba->nextkey.dptr = NULL; - return nkey; -} - -DBA_OPTIMIZE_FUNC(dbm) -{ - /* dummy */ - return SUCCESS; -} - -DBA_SYNC_FUNC(dbm) -{ - return SUCCESS; -} - -#endif diff --git a/ext/dba/dba_gdbm.c b/ext/dba/dba_gdbm.c deleted file mode 100644 index 0e5f1450f2..0000000000 --- a/ext/dba/dba_gdbm.c +++ /dev/null @@ -1,189 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP HTML Embedded Scripting Language Version 3.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1999 PHP Development Team (See Credits file) | - +----------------------------------------------------------------------+ - | This program is free software; you can redistribute it and/or modify | - | it under the terms of one of the following licenses: | - | | - | A) 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. | - | | - | B) the PHP License as published by the PHP Development Team and | - | included in the distribution in the file: LICENSE | - | | - | 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 both licenses referred to here. | - | If you did not, or have any questions about PHP licensing, please | - | contact core@php.net. | - +----------------------------------------------------------------------+ - | Authors: Sascha Schumann <sas@schell.de> | - +----------------------------------------------------------------------+ - */ - -/* $Id$ */ - -#include "php.h" - -#if DBA_GDBM -#include "php3_gdbm.h" - -#include <gdbm.h> - -#define GDBM_DATA dba_gdbm_data *dba = info->dbf -#define GDBM_GKEY datum gkey; gkey.dptr = (char *) key; gkey.dsize = keylen - -typedef struct { - GDBM_FILE dbf; - datum nextkey; -} dba_gdbm_data; - -DBA_OPEN_FUNC(gdbm) -{ - GDBM_FILE dbf; - int gmode = 0; - int filemode = 0644; - - gmode = info->mode == DBA_READER ? GDBM_READER : - info->mode == DBA_WRITER ? GDBM_WRITER : - info->mode == DBA_CREAT ? GDBM_WRCREAT : - info->mode == DBA_TRUNC ? GDBM_NEWDB : -1; - - if(gmode == -1) - return FAILURE; - - if(info->argc > 0) { - convert_to_long(info->argv[0]); - filemode = info->argv[0]->value.lval; - } - - dbf = gdbm_open(info->path, 0, gmode, filemode, NULL); - - if(dbf) { - info->dbf = malloc(sizeof(dba_gdbm_data)); - memset(info->dbf, 0, sizeof(dba_gdbm_data)); - ((dba_gdbm_data *) info->dbf)->dbf = dbf; - return SUCCESS; - } - return FAILURE; -} - -DBA_CLOSE_FUNC(gdbm) -{ - GDBM_DATA; - - if(dba->nextkey.dptr) free(dba->nextkey.dptr); - gdbm_close(dba->dbf); - free(dba); -} - -DBA_FETCH_FUNC(gdbm) -{ - GDBM_DATA; - datum gval; - char *new = NULL; - - GDBM_GKEY; - gval = gdbm_fetch(dba->dbf, gkey); - if(gval.dptr) { - if(newlen) *newlen = gval.dsize; - new = estrndup(gval.dptr, gval.dsize); - free(gval.dptr); - } - return new; -} - -DBA_UPDATE_FUNC(gdbm) -{ - datum gval; - GDBM_DATA; - - GDBM_GKEY; - gval.dptr = (char *) val; - gval.dsize = vallen; - - if(gdbm_store(dba->dbf, gkey, gval, - mode == 1 ? GDBM_INSERT : GDBM_REPLACE) == 0) - return SUCCESS; - printf("XXX %s\n", gdbm_strerror(gdbm_errno)); - return FAILURE; -} - -DBA_EXISTS_FUNC(gdbm) -{ - GDBM_DATA; - GDBM_GKEY; - - return gdbm_exists(dba->dbf, gkey) ? SUCCESS : FAILURE; -} - -DBA_DELETE_FUNC(gdbm) -{ - GDBM_DATA; - GDBM_GKEY; - - return gdbm_delete(dba->dbf, gkey) == -1 ? FAILURE : SUCCESS; -} - -DBA_FIRSTKEY_FUNC(gdbm) -{ - GDBM_DATA; - datum gkey; - char *key = NULL; - - if(dba->nextkey.dptr) { - free(dba->nextkey.dptr); - } - - gkey = gdbm_firstkey(dba->dbf); - if(gkey.dptr) { - key = estrndup(gkey.dptr, gkey.dsize); - if(newlen) *newlen = gkey.dsize; - dba->nextkey = gkey; - } else { - dba->nextkey.dptr = NULL; - } - return key; -} - -DBA_NEXTKEY_FUNC(gdbm) -{ - GDBM_DATA; - char *nkey = NULL; - datum gkey; - - if(!dba->nextkey.dptr) return NULL; - - gkey = gdbm_nextkey(dba->dbf, dba->nextkey); - free(dba->nextkey.dptr); - if(gkey.dptr) { - nkey = estrndup(gkey.dptr, gkey.dsize); - if(newlen) *newlen = gkey.dsize; - dba->nextkey = gkey; - } else { - dba->nextkey.dptr = NULL; - } - return nkey; -} - -DBA_OPTIMIZE_FUNC(gdbm) -{ - GDBM_DATA; - gdbm_reorganize(dba->dbf); - return SUCCESS; -} - -DBA_SYNC_FUNC(gdbm) -{ - GDBM_DATA; - - gdbm_sync(dba->dbf); - return SUCCESS; -} -#endif diff --git a/ext/dba/dba_ndbm.c b/ext/dba/dba_ndbm.c deleted file mode 100644 index 0c6e2cd077..0000000000 --- a/ext/dba/dba_ndbm.c +++ /dev/null @@ -1,169 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP HTML Embedded Scripting Language Version 3.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1999 PHP Development Team (See Credits file) | - +----------------------------------------------------------------------+ - | This program is free software; you can redistribute it and/or modify | - | it under the terms of one of the following licenses: | - | | - | A) 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. | - | | - | B) the PHP License as published by the PHP Development Team and | - | included in the distribution in the file: LICENSE | - | | - | 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 both licenses referred to here. | - | If you did not, or have any questions about PHP licensing, please | - | contact core@php.net. | - +----------------------------------------------------------------------+ - | Authors: Sascha Schumann <sas@schell.de> | - +----------------------------------------------------------------------+ - */ - -/* $Id$ */ - -#include "php.h" - -#if DBA_NDBM -#include "php3_ndbm.h" - -#include <fcntl.h> - -#if NDBM_DB1_NDBM_H -#include <db1/ndbm.h> -#elif NDBM_NDBM_H -#include <ndbm.h> -#endif - -#define NDBM_GKEY datum gkey; gkey.dptr = (char *) key; gkey.dsize = keylen - -DBA_OPEN_FUNC(ndbm) -{ - DBM *dbf; - int gmode = 0; - int filemode = 0644; - dba_info *pinfo = (dba_info *) info; - - switch(info->mode) { - case DBA_READER: - gmode = O_RDONLY; - break; - case DBA_WRITER: - gmode = O_RDWR; - break; - case DBA_CREAT: - gmode = O_RDWR | O_CREAT; - break; - case DBA_TRUNC: - gmode = O_RDWR | O_CREAT | O_TRUNC; - break; - default: - return FAILURE; - } - - if(info->argc > 0) { - convert_to_long(info->argv[0]); - filemode = info->argv[0]->value.lval; - } - - dbf = dbm_open(info->path, gmode, filemode); - - if(dbf) { - pinfo->dbf = dbf; - return SUCCESS; - } - return FAILURE; -} - -DBA_CLOSE_FUNC(ndbm) -{ - dbm_close(info->dbf); -} - -DBA_FETCH_FUNC(ndbm) -{ - datum gval; - char *new = NULL; - - NDBM_GKEY; - gval = dbm_fetch(info->dbf, gkey); - if(gval.dptr) { - if(newlen) *newlen = gval.dsize; - new = estrndup(gval.dptr, gval.dsize); - } - return new; -} - -DBA_UPDATE_FUNC(ndbm) -{ - datum gval; - - NDBM_GKEY; - gval.dptr = (char *) val; - gval.dsize = vallen; - - if(!dbm_store(info->dbf, gkey, gval, mode == 1 ? DBM_INSERT : DBM_REPLACE)) - return SUCCESS; - return FAILURE; -} - -DBA_EXISTS_FUNC(ndbm) -{ - datum gval; - NDBM_GKEY; - gval = dbm_fetch(info->dbf, gkey); - if(gval.dptr) { - return SUCCESS; - } - return FAILURE; -} - -DBA_DELETE_FUNC(ndbm) -{ - NDBM_GKEY; - return(dbm_delete(info->dbf, gkey) == -1 ? FAILURE : SUCCESS); -} - -DBA_FIRSTKEY_FUNC(ndbm) -{ - datum gkey; - char *key = NULL; - - gkey = dbm_firstkey(info->dbf); - if(gkey.dptr) { - if(newlen) *newlen = gkey.dsize; - key = estrndup(gkey.dptr, gkey.dsize); - } - return key; -} - -DBA_NEXTKEY_FUNC(ndbm) -{ - datum gkey; - char *nkey = NULL; - - gkey = dbm_nextkey(info->dbf); - if(gkey.dptr) { - if(newlen) *newlen = gkey.dsize; - nkey = estrndup(gkey.dptr, gkey.dsize); - } - return nkey; -} - -DBA_OPTIMIZE_FUNC(ndbm) -{ - return SUCCESS; -} - -DBA_SYNC_FUNC(ndbm) -{ - return SUCCESS; -} -#endif diff --git a/ext/dba/php3_cdb.h b/ext/dba/php3_cdb.h deleted file mode 100644 index 162fa8bdb2..0000000000 --- a/ext/dba/php3_cdb.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef _PHP3_CDB_H -#define _PHP3_CDB_H - -#if DBA_CDB - -#include "php3_dba.h" - -DBA_FUNCS(cdb); - -#endif - -#endif diff --git a/ext/dba/php3_db2.h b/ext/dba/php3_db2.h deleted file mode 100644 index 0f8c458db9..0000000000 --- a/ext/dba/php3_db2.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef _PHP3_DB2_H -#define _PHP3_DB2_H - -#if DBA_DB2 - -#include "php3_dba.h" - -DBA_FUNCS(db2); - -#endif - -#endif diff --git a/ext/dba/php3_dba.h b/ext/dba/php3_dba.h deleted file mode 100644 index caa7bfed05..0000000000 --- a/ext/dba/php3_dba.h +++ /dev/null @@ -1,115 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP HTML Embedded Scripting Language Version 3.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-1999 PHP Development Team (See Credits file) | - +----------------------------------------------------------------------+ - | This program is free software; you can redistribute it and/or modify | - | it under the terms of one of the following licenses: | - | | - | A) 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. | - | | - | B) the PHP License as published by the PHP Development Team and | - | included in the distribution in the file: LICENSE | - | | - | 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 both licenses referred to here. | - | If you did not, or have any questions about PHP licensing, please | - | contact core@php.net. | - +----------------------------------------------------------------------+ - | Authors: Sascha Schumann <sas@schell.de> | - +----------------------------------------------------------------------+ - */ - -/* $Id$ */ - -#ifndef _DBA_H -#define _DBA_H - -#if HAVE_DBA - -typedef enum { - DBA_READER = 1, - DBA_WRITER, - DBA_TRUNC, - DBA_CREAT -} dba_mode_t; - -typedef struct dba_info { - /* public */ - void *dbf; /* ptr to private data or whatever */ - char *path; - dba_mode_t mode; - /* arg[cv] are only available when the dba_open handler is called! */ - int argc; - pval **argv; - /* private */ - struct dba_handler *hnd; -} dba_info; - -extern php3_module_entry dba_module_entry; -#define dba_module_ptr &dba_module_entry - -/* common prototypes which must be supplied by modules */ - -#define DBA_OPEN_FUNC(x) \ - int dba_open_##x(dba_info *info) -#define DBA_CLOSE_FUNC(x) \ - void dba_close_##x(dba_info *info) -#define DBA_FETCH_FUNC(x) \ - char *dba_fetch_##x(dba_info *info, char *key, int keylen, int *newlen) -#define DBA_UPDATE_FUNC(x) \ - int dba_update_##x(dba_info *info, char *key, int keylen, char *val, int vallen, int mode) -#define DBA_EXISTS_FUNC(x) \ - int dba_exists_##x(dba_info *info, char *key, int keylen) -#define DBA_DELETE_FUNC(x) \ - int dba_delete_##x(dba_info *info, char *key, int keylen) -#define DBA_FIRSTKEY_FUNC(x) \ - char *dba_firstkey_##x(dba_info *info, int *newlen) -#define DBA_NEXTKEY_FUNC(x) \ - char *dba_nextkey_##x(dba_info *info, int *newlen) -#define DBA_OPTIMIZE_FUNC(x) \ - int dba_optimize_##x(dba_info *info) -#define DBA_SYNC_FUNC(x) \ - int dba_sync_##x(dba_info *info) - -#define DBA_FUNCS(x) \ - DBA_OPEN_FUNC(x); \ - DBA_CLOSE_FUNC(x); \ - DBA_FETCH_FUNC(x); \ - DBA_UPDATE_FUNC(x); \ - DBA_DELETE_FUNC(x); \ - DBA_EXISTS_FUNC(x); \ - DBA_FIRSTKEY_FUNC(x); \ - DBA_NEXTKEY_FUNC(x); \ - DBA_OPTIMIZE_FUNC(x); \ - DBA_SYNC_FUNC(x) - -#define VALLEN(p) (p)->value.str.val, (p)->value.str.len - -PHP_FUNCTION(dba_open); -PHP_FUNCTION(dba_popen); -PHP_FUNCTION(dba_close); -PHP_FUNCTION(dba_firstkey); -PHP_FUNCTION(dba_nextkey); -PHP_FUNCTION(dba_replace); -PHP_FUNCTION(dba_insert); -PHP_FUNCTION(dba_delete); -PHP_FUNCTION(dba_exists); -PHP_FUNCTION(dba_fetch); -PHP_FUNCTION(dba_optimize); -PHP_FUNCTION(dba_sync); - -#else -#define dba_module_ptr NULL -#endif - -#define phpext_dba_ptr dba_module_ptr - -#endif diff --git a/ext/dba/php3_dbm.h b/ext/dba/php3_dbm.h deleted file mode 100644 index 5007c84b3e..0000000000 --- a/ext/dba/php3_dbm.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef _PHP3_DBM_H -#define _PHP3_DBM_H - -#if DBA_DBM - -#include "php3_dba.h" - -DBA_FUNCS(dbm); - -#endif - -#endif diff --git a/ext/dba/php3_gdbm.h b/ext/dba/php3_gdbm.h deleted file mode 100644 index 9a18b531d4..0000000000 --- a/ext/dba/php3_gdbm.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef _PHP3_GDBM_H -#define _PHP3_GDBM_H - -#if DBA_GDBM - -#include "php3_dba.h" - -DBA_FUNCS(gdbm); - -#endif - -#endif diff --git a/ext/dba/php3_ndbm.h b/ext/dba/php3_ndbm.h deleted file mode 100644 index 398b8e39a1..0000000000 --- a/ext/dba/php3_ndbm.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef _PHP3_NDBM_H -#define _PHP3_NDBM_H - -#if DBA_NDBM - -#include "php3_dba.h" - -DBA_FUNCS(ndbm); - -#endif - -#endif diff --git a/ext/dba/setup.stub b/ext/dba/setup.stub deleted file mode 100644 index 0df17de7d1..0000000000 --- a/ext/dba/setup.stub +++ /dev/null @@ -1,6 +0,0 @@ -# $Source$ -# $Id$ - -define_option with-dba 'dba support?' yesnodir no \ -' Whether to build the dba extension.' - diff --git a/ext/fdf/fdf.c b/ext/fdf/fdf.c index bc7568ebb9..eac48ba413 100644 --- a/ext/fdf/fdf.c +++ b/ext/fdf/fdf.c @@ -28,7 +28,7 @@ #endif #include "php.h" -#include "ext/standard/head.h" +#include "head.h" #include <math.h> #include "php3_fdf.h" diff --git a/ext/hyperwave/DList.h b/ext/hyperwave/DList.h new file mode 100644 index 0000000000..e574638e18 --- /dev/null +++ b/ext/hyperwave/DList.h @@ -0,0 +1,128 @@ +/**************************************************************************** +* +* Copyright (C) 1991 Kendall Bennett. +* All rights reserved. +* +* Filename: $RCSfile$ +* Version: $Revision$ +* +* Language: ANSI C +* Environment: any +* +* Description: Header file for doubly linked list routines. +* +* $Id$ +* +* Revision History: +* ----------------- +* +* $Log$ +* Revision 1.1.1.1 1999/04/07 21:03:20 zeev +* PHP 4.0 +* +* Revision 1.1.1.1 1999/03/17 04:29:11 andi +* PHP4 +* +* Revision 1.1.1.1 1998/12/21 07:56:22 andi +* Trying to start the zend CVS tree +* +* Revision 1.2 1998/08/14 15:51:12 shane +* Some work on getting hyperwave to work on windows. hg_comm needs a lot of work. +* +* Mainly, signals, fnctl, bzero, bcopy, etc are not portable functions. Most of this +* will have to be rewriten for windows. +* +* Revision 1.1 1998/08/12 09:29:16 steinm +* First version of Hyperwave module. +* +* Revision 1.5 91/12/31 19:40:54 kjb +* +* Modified include files directories. +* +* Revision 1.4 91/09/27 03:10:41 kjb +* Added compatibility with C++. +* +* Revision 1.3 91/09/26 10:07:16 kjb +* Took out extern references +* +* Revision 1.2 91/09/01 19:37:20 ROOT_DOS +* Changed DLST_TAIL macro so that it returns a pointer to the REAL last +* node of the list, not the dummy last node (l->z). +* +* Revision 1.1 91/09/01 18:38:23 ROOT_DOS +* Initial revision +* +****************************************************************************/ + +#ifndef __DLIST_H +#define __DLIST_H + +#ifndef __DEBUG_H +/*#include "debug.h"*/ +#endif + +/*---------------------- Macros and type definitions ----------------------*/ + +typedef struct DLST_BUCKET { + struct DLST_BUCKET *next; + struct DLST_BUCKET *prev; + } DLST_BUCKET; + +typedef struct { + int count; /* Number of elements currently in list */ + DLST_BUCKET *head; /* Pointer to head element of list */ + DLST_BUCKET *z; /* Pointer to last node of list */ + DLST_BUCKET hz[2]; /* Space for head and z nodes */ + } DLIST; + +/* Return a pointer to the user space given the address of the header of + * a node. + */ + +#define DLST_USERSPACE(h) ((void*)((DLST_BUCKET*)(h) + 1)) + +/* Return a pointer to the header of a node, given the address of the + * user space. + */ + +#define DLST_HEADER(n) ((DLST_BUCKET*)(n) - 1) + +/* Return a pointer to the user space of the list's head node. This user + * space does not actually exist, but it is useful to be able to address + * it to enable insertion at the start of the list. + */ + +#define DLST_HEAD(l) DLST_USERSPACE((l)->head) + +/* Return a pointer to the user space of the last node in list. */ + +#define DLST_TAIL(l) DLST_USERSPACE((l)->z->prev) + +/* Determine if a list is empty + */ + +#define DLST_EMPTY(l) ((l)->count == 0) + +/*-------------------------- Function Prototypes --------------------------*/ + +#ifdef __cplusplus +extern "C" { +#endif + +void *dlst_newnode(int size); +void dlst_freenode(void *node); +DLIST *dlst_init(void); +void dlst_kill(DLIST *l,void (*freeNode)(void *node)); +void dlst_insertafter(DLIST *l,void *node,void *after); +void *dlst_deletenext(DLIST *l,void *node); +void *dlst_first(DLIST *l); +void *dlst_last(DLIST *l); +void *dlst_next(void *prev); +void *dlst_prev(void *next); +void dlst_mergesort(DLIST *l,int (*cmp_func)(void*,void*)); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/ext/hyperwave/dlist.c b/ext/hyperwave/dlist.c new file mode 100644 index 0000000000..94dd6edf7b --- /dev/null +++ b/ext/hyperwave/dlist.c @@ -0,0 +1,413 @@ +/**************************************************************************** +* +* Copyright (C) 1991 Kendall Bennett. +* All rights reserved. +* +* Filename: $RCSfile$ +* Version: $Revision$ +* +* Language: ANSI C +* Environment: any +* +* Description: Module to implement doubly linked lists. Includes a routine +* to peform a mergesort on the doubly linked list. +* +* $Id$ +* +* Revision History: +* ----------------- +* +* $Log$ +* Revision 1.1 1999/04/21 23:11:20 ssb +* moved apache, com and hyperwave into ext/ +* +* Revision 1.1.1.1 1999/04/07 21:03:31 zeev +* PHP 4.0 +* +* Revision 1.1.1.1 1999/03/17 04:29:11 andi +* PHP4 +* +* Revision 1.1.1.1 1998/12/21 07:56:22 andi +* Trying to start the zend CVS tree +* +* Revision 1.1 1998/08/12 09:29:16 steinm +* First version of Hyperwave module. +* +* Revision 1.5 91/12/31 19:39:49 kjb +* Modified include file directories. +* +* Revision 1.4 91/10/28 03:16:39 kjb +* Ported to the Iris. +* +* Revision 1.3 91/09/27 03:09:18 kjb +* Cosmetic change. +* +* Revision 1.2 91/09/03 18:27:42 ROOT_DOS +* Ported to UNIX. +* +* Revision 1.1 91/09/01 18:35:23 ROOT_DOS +* Initial revision +* +****************************************************************************/ + +#ifndef MSVC5 +#include "php_config.h" +#endif + +#if HYPERWAVE + +#include <stdio.h> +#include <malloc.h> +#include <signal.h> +#include "debug.h" +#include "DList.h" + +PUBLIC void *dlst_newnode(int size) +/**************************************************************************** +* +* Function: dlst_newnode +* Parameters: size - Amount of memory to allocate for node +* Returns: Pointer to the allocated node's user space. +* +* Description: Allocates the memory required for a node, adding a small +* header at the start of the node. We return a reference to +* the user space of the node, as if it had been allocated via +* malloc(). +* +****************************************************************************/ +{ + DLST_BUCKET *node; + + if ( !(node = (DLST_BUCKET*)malloc(size + sizeof(DLST_BUCKET))) ) { + fprintf(stderr,"Not enough memory to allocate list node.\n"); +/* raise(SIGABRT);*/ + return NULL; + } + + return DLST_USERSPACE(node); /* Return pointer to user space */ +} + +PUBLIC void dlst_freenode(void *node) +/**************************************************************************** +* +* Function: dlst_freenode +* Parameters: node - Node to free. +* +* Description: Frees a node previously allocated with lst_newnode(). +* +****************************************************************************/ +{ + free(DLST_HEADER(node)); +} + +PUBLIC DLIST *dlst_init(void) +/**************************************************************************** +* +* Function: dlst_init +* Returns: Pointer to a newly created list. +* +* Description: Initialises a list and returns a pointer to it. +* +****************************************************************************/ +{ + DLIST *l; + + if ((l = (DLIST*)malloc(sizeof(DLIST))) != NULL) { + l->count = 0; + l->head = &(l->hz[0]); + l->z = &(l->hz[1]); + l->head->next = l->z->next = l->z; + l->z->prev = l->head->prev = l->head; + } + else { + fprintf(stderr,"Insufficient memory to allocate list\n"); + /*raise(SIGABRT);*/ + return NULL; + } + + return l; +} + +PUBLIC void dlst_kill(DLIST *l,void (*freeNode)(void *node)) +/**************************************************************************** +* +* Function: dlst_kill +* Parameters: l - List to kill +* freeNode - Pointer to user routine to free a node +* +* Description: Kills the list l, by deleting all of the elements contained +* within the list one by one and then deleting the list +* itself. Note that we call the user supplied routine +* (*freeNode)() to free each list node. This allows the user +* program to perform any extra processing needed to kill each +* node (if each node contains pointers to other items on the +* heap for example). If no extra processing is required, just +* pass the address of dlst_freenode(), ie: +* +* dlst_kill(myList,dlst_freenode); +* +****************************************************************************/ +{ + DLST_BUCKET *n,*p; + + n = l->head->next; + while (n != l->z) { /* Free all nodes in list */ + p = n; + n = n->next; + (*freeNode)(DLST_USERSPACE(p)); + } + free(l); /* Free the list itself */ +} + +PUBLIC void dlst_insertafter(DLIST *l,void *node,void *after) +/**************************************************************************** +* +* Function: lst_insertafter +* Parameters: l - List to insert node into +* node - Pointer to user space of node to insert +* after - Pointer to user space of node to insert node after +* +* Description: Inserts a new node into the list after the node 'after'. To +* insert a new node at the beginning of the list, user the +* macro DLST_HEAD in place of 'after'. ie: +* +* dlst_insertafter(mylist,node,DLST_HEAD(mylist)); +* +****************************************************************************/ +{ + DLST_BUCKET *n = DLST_HEADER(node),*a = DLST_HEADER(after); + + n->next = a->next; + a->next = n; + n->prev = a; + n->next->prev = n; + l->count++; +} + +PUBLIC void *dlst_deletenext(DLIST *l,void *node) +/**************************************************************************** +* +* Function: lst_deletenext +* Parameters: l - List to delete node from. +* node - Node to delete the next node from +* Returns: Pointer to the deleted node's userspace. +* +* Description: Removes the node AFTER 'node' from the list l. +* +****************************************************************************/ +{ + DLST_BUCKET *n = DLST_HEADER(node); + + node = DLST_USERSPACE(n->next); + n->next->next->prev = n; + n->next = n->next->next; + l->count--; + return node; +} + +PUBLIC void *dlst_first(DLIST *l) +/**************************************************************************** +* +* Function: dlst_first +* Parameters: l - List to obtain first node from +* Returns: Pointer to first node in list, NULL if list is empty. +* +* Description: Returns a pointer to the user space of the first node in +* the list. If the list is empty, we return NULL. +* +****************************************************************************/ +{ + DLST_BUCKET *n; + + n = l->head->next; + return (n == l->z ? NULL : DLST_USERSPACE(n)); +} + +PUBLIC void *dlst_last(DLIST *l) +/**************************************************************************** +* +* Function: dlst_last +* Parameters: l - List to obtain last node from +* Returns: Pointer to last node in list, NULL if list is empty. +* +* Description: Returns a pointer to the user space of the last node in +* the list. If the list is empty, we return NULL. +* +****************************************************************************/ +{ + DLST_BUCKET *n; + + n = l->z->prev; + return (n == l->head ? NULL : DLST_USERSPACE(n)); +} + +PUBLIC void *dlst_next(void *prev) +/**************************************************************************** +* +* Function: dlst_next +* Parameters: prev - Previous node in list to obtain next node from +* Returns: Pointer to the next node in the list, NULL at end of list. +* +* Description: Returns a pointer to the user space of the next node in the +* list given a pointer to the user space of the previous node. +* If we have reached the end of the list, we return NULL. The +* end of the list is detected when the next pointer of a node +* points back to itself, as does the dummy last node's next +* pointer. This enables us to detect the end of the list +* without needed access to the list data structure itself. +* +* NOTE: We do no checking to ensure that 'prev' is NOT a +* NULL pointer. +* +****************************************************************************/ +{ + DLST_BUCKET *n = DLST_HEADER(prev); + + n = n->next; + return (n == n->next ? NULL : DLST_USERSPACE(n)); +} + +PUBLIC void *dlst_prev(void *next) +/**************************************************************************** +* +* Function: dlst_prev +* Parameters: next - Next node in list to obtain previous node from +* Returns: Pointer to the previous node in the list, NULL at start list. +* +* Description: Returns a pointer to the user space of the prev node in the +* list given a pointer to the user space of the next node. +* If we have reached the start of the list, we return NULL. The +* start of the list is detected when the prev pointer of a node +* points back to itself, as does the dummy head node's prev +* pointer. This enables us to detect the start of the list +* without needed access to the list data structure itself. +* +* NOTE: We do no checking to ensure that 'next' is NOT a +* NULL pointer. +* +****************************************************************************/ +{ + DLST_BUCKET *n = DLST_HEADER(next); + + n = n->prev; + return (n == n->prev ? NULL : DLST_USERSPACE(n)); +} + +/* Static globals required by merge() */ + +static DLST_BUCKET *z; +static int (*cmp)(void*,void*); + +PRIVATE DLST_BUCKET *merge(DLST_BUCKET *a,DLST_BUCKET *b,DLST_BUCKET **end) +/**************************************************************************** +* +* Function: merge +* Parameters: a,b - Sublist's to merge +* Returns: Pointer to the merged sublists. +* +* Description: Merges two sorted lists of nodes together into a single +* sorted list. +* +****************************************************************************/ +{ + DLST_BUCKET *c; + + /* Go through the lists, merging them together in sorted order */ + + c = z; + while (a != z && b != z) { + if ((*cmp)(DLST_USERSPACE(a),DLST_USERSPACE(b)) <= 0) { + c->next = a; c = a; a = a->next; + } + else { + c->next = b; c = b; b = b->next; + } + }; + + /* If one of the lists is not exhausted, then re-attach it to the end + * of the newly merged list + */ + + if (a != z) c->next = a; + if (b != z) c->next = b; + + /* Set *end to point to the end of the newly merged list */ + + while (c->next != z) c = c->next; + *end = c; + + /* Determine the start of the merged lists, and reset z to point to + * itself + */ + + c = z->next; z->next = z; + return c; +} + +PUBLIC void dlst_mergesort(DLIST *l,int (*cmp_func)(void*,void*)) +/**************************************************************************** +* +* Function: dlst_mergesort +* Parameters: l - List to merge sort +* cmp_func - Function to compare two user spaces +* +* Description: Mergesort's all the nodes in the list. 'cmp' must point to +* a comparison function that can compare the user spaces of +* two different nodes. 'cmp' should work the same as +* strcmp(), in terms of the values it returns. Rather than +* waste processing time keeping the previous pointers up to +* date while performing the mergesort, we simply run through +* the list at the end of the sort to fix the previous pointers. +* +****************************************************************************/ +{ + int i,N; + DLST_BUCKET *a,*b; /* Pointers to sublists to merge */ + DLST_BUCKET *c; /* Pointer to end of sorted sublists */ + DLST_BUCKET *head; /* Pointer to dummy head node for list */ + DLST_BUCKET *todo; /* Pointer to sublists yet to be sorted */ + DLST_BUCKET *t; /* Temporary */ + + /* Set up globals required by merge() and pointer to head */ + + z = l->z; cmp = cmp_func; head = l->head; + + for (N = 1,a = z; a != head->next; N = N + N) { + todo = head->next; c = head; + while (todo != z) { + + /* Build first sublist to be merged, and splice from main list + */ + + a = t = todo; + for (i = 1; i < N; i++) t = t->next; + b = t->next; t->next = z; t = b; + + /* Build second sublist to be merged and splice from main list + */ + + for (i = 1; i < N; i++) t = t->next; + todo = t->next; t->next = z; + + /* Merge the two sublists created, and set 'c' to point to the + * end of the newly merged sublists. + */ + + c->next = merge(a,b,&t); c = t; + } + } + + /* Fix the previous pointers for the list */ + + a = b = l->head; + b = b->next; + while (1) { + b->prev = a; + if (b == z) + break; + a = a->next; + b = b->next; + } +} + +#endif diff --git a/ext/imap/config.m4 b/ext/imap/config.m4 index 36697bfc18..06ceb6ce9b 100644 --- a/ext/imap/config.m4 +++ b/ext/imap/config.m4 @@ -11,16 +11,12 @@ AC_ARG_WITH(imap, withval=/usr elif test -f /usr/include/imap/mail.h; then withval=/usr - elif test -f /usr/include/c-client/mail.h; then - withval=/usr fi fi if test "$withval" != "no" && test "$withval" != "yes"; then IMAP_DIR=$withval if test -f $IMAP_DIR/include/imap/mail.h; then IMAP_INC_DIR=$IMAP_DIR/include/imap - elif test -f $IMAP_DIR/include/c-client/mail.h; then - IMAP_INC_DIR=$IMAP_DIR/include/c-client else IMAP_INC_DIR=$withval/include fi diff --git a/ext/informix/ifx.ec b/ext/informix/ifx.ec index df60a38921..c0586d37a3 100644 --- a/ext/informix/ifx.ec +++ b/ext/informix/ifx.ec @@ -13,7 +13,6 @@ | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: Danny Heijl <Danny.Heijl@cevi.be> : initial cut (ODS 7.2x) | - | PHP4 port | | Christian Cartus <chc@idgruppe.de> : blobs, and IUS 9 | | Jouni Ahto <jah@mork.net> : configuration stuff | | Based on the MySQL code by: Zeev Suraski <zeev@php.net> | @@ -26,28 +25,109 @@ * you a very short one * ------------------------------------------------------------------- */ +/* + * I started with the mysql-driver, removed all stuff I did not need, + * and changed all mysql-specific stuff to Informix-ESQL/C. + * I used the X-open way of using ESQL/C (using an SQL descriptor and + * not the Informix-specific way). It is perhaps a little bit slower, + * but more verbose and less prone to coding errors. + * This is the first time in my life I coded ESQL/C, so do not look too + * closely and do not hesitate to point out errors/omissions etc... + * Aug. 8, 1998 + * Danny Heijl, Danny.Heijl@cevi.be + */ /* TODO: * * ? Safe mode implementation + * + * Jouni Ahto promised help and already did the configuration stuff + * (Jouni Ahto <jah@mork.net>). + * */ +/* +Changes: 23.8.1998 (chc@idgruppe.de) +- full blobsupport (TEXT and BYTE) +- new functions: ifx_create_blob, ifx_copy_blob, ifx_free_blob, + ifx_update_blob, ifx_get_blob, ifx_blobinfile_mode +- file and memory-support of blobs +- load TEXT and BYTE in memory by default + (controllable by "ifx.blobinfile" in php3.ini-file) +- update all functions to support blobs (ifx_query, ifx_prepare, + ifx_do, ifx_htmltbl_result, ifx_fetch_row) +- minor bug-fixes +- Test-Page (informix_blob.php3) which tests the blob-support + + +Changes: 11.9.1998 (chc@idgruppe.de) +- ifx_query and ifx_prepare: blob-paramters now as array +- new funtions: ifx_textasvarchar, ifx_byteasvarchar, ifx_nullformat +- new php.ini-variables: ifx.textasvarchar, ifx.byteasvarchar, ifx.nullformat +- update all functions to support blobarray and new functions + (ifx_query, ifx_prepare, ifx_do, ifx_htmltbl_result, ifx_fetch_row) +- minor bug-fixes +- Test-Page (informix_blob.php3) updated +- begin with coding of slob-support + (still deactivated, not yet complete: #undef HAVE_IFX_IUS in php3_ifx.h) +- ifx_fetch_row returns always a blob-id (contains "NULL"-flag or content from db) + (except ifx_textasvarchar, ifx_byteasvarchar set to 1) + +Changes 14.9.1998 (chc@idgruppe.de) +- supports now IUS- serial8,int8,boolean, nchar, nvchar, lvarchar +- still incomplete slob-support + +Changes 25.9.1998 (danny.heijl@cevi.be) +- cursory and non-cursory stored procedures + +Changes 24.10.1998 (chc@idgruppe.de) +- changes the internal structure of IFX_BLOB and IFX_SLOB into one structure. + it is now prepared for general-id-usage. +- fixed a lvarchar-bug (i hate esql/c) + +Changes 12.11.1998 (danny.heijl@cevi.be) +- added proto comments + +Changes 04/03/1999 (danny.heijl@cevi.be) +- added "SET CONNECTION" statement to ifx_fetch_row() so that you can now + fetch rows from different databases simultaneously + (ifx_query() & ifx_prepare() were already OK). + +Changes 05/03/1999 (danny.heijl@cevi.be) +- made all sqlerrd[] fields of sqlca structure available + with ifx_getsqlca($query_id) in a pseudo-row after a + prepare (select statements) or insert/update (non-select statements). + gives access to affected rows and serial insert values +- made all internal functions static + + +Changes 09/03/1999 (danny.heijl@cevi.be) +- suppressed ESQL/C BLOB memory leak fix for ESQL/C 7.24 and higher + this is the same fix as in Perl DBD::Informix +- really free an Ifx_Result now, do not wait for script termination +- code cleanup + +*/ + + #if defined(COMPILE_DL) #include "dl/phpdl.h" #endif - -#include "php.h" -#include "php_globals.h" -#include "ext/standard/php3_standard.h" -#include "php_informix.h" -#include "php_globals.h" - +// +// php 3.0 +//#if defined(THREAD_SAFE) +//#include "tls.h" +//DWORD InformixTls; +//static int numthreads=0; +//void *ifx_mutex; +//#endif #if WIN32|WINNT #include <winsock.h> #else +#include "config.h" #include "build-defs.h" #if HAVE_SYS_TYPES_H @@ -57,7 +137,10 @@ #include <netinet/in.h> #endif -#include "php_ini.h" +#include "php.h" +#include "php3_string.h" +#include "build-defs.h" +#include "php_informix.h" #if HAVE_IFX @@ -111,6 +194,8 @@ EXEC SQL include sqlstype; typedef char IFX[128]; +#include "php3_list.h" + #define SAFE_STRING(s) ((s)?(s):"") function_entry ifx_functions[] = { @@ -172,7 +257,7 @@ php3_module_entry ifx_module_entry = { STANDARD_MODULE_PROPERTIES }; -#ifdef COMPILE_DL +#if COMPILE_DL DLEXPORT php3_module_entry *get_module(void) { return &ifx_module_entry; } #if 0 BOOL WINAPI DllMain(HANDLE hModule, @@ -184,13 +269,24 @@ BOOL WINAPI DllMain(HANDLE hModule, #endif #endif -#ifdef ZTS -int ifx_globals_id; + +#if defined(THREAD_SAFE) +typedef struct ifx_global_struct{ + ifx_module php3_ifx_module; +}ifx_global_struct; + +#define Informix_GLOBAL(a) ifx_globals->a + +#define Informix_TLS_VARS \ + ifx_global_struct *ifx_globals; \ + ifx_globals=TlsGetValue(InformixTls); + #else -PHP_IFX_API php_ifx_globals ifx_globals; +#define Informix_GLOBAL(a) a +#define Informix_TLS_VARS +ifx_module php3_ifx_module; #endif - #define CHECK_LINK(link) { \ if (link==0) { \ php3_error(E_WARNING, \ @@ -241,12 +337,10 @@ static char *ifx_error(ifx) char c; int errorcode; - IFXLS_FETCH(); - - if (IFXG(sv_sqlcode) == 0) + if (Informix_GLOBAL(php3_ifx_module).sv_sqlcode == 0) errorcode = SQLCODE; else - errorcode = IFXG(sv_sqlcode); + errorcode = Informix_GLOBAL(php3_ifx_module).sv_sqlcode; switch (ifx_check()) { case IFX_SUCCESS: @@ -285,12 +379,12 @@ static void _close_ifx_link(link) EXEC SQL END DECLARE SECTION; { - IFXLS_FETCH(); + Informix_TLS_VARS; EXEC SQL SET CONNECTION :link; EXEC SQL DISCONNECT CURRENT; efree(link); - IFXG(num_links)--; + Informix_GLOBAL(php3_ifx_module).num_links--; } static void _close_ifx_plink(link) @@ -299,14 +393,14 @@ EXEC SQL BEGIN DECLARE SECTION; EXEC SQL END DECLARE SECTION; { - IFXLS_FETCH(); + Informix_TLS_VARS; EXEC SQL SET CONNECTION :link; EXEC SQL DISCONNECT CURRENT; free(link); - IFXG(num_persistent)--; - IFXG(num_links)--; + Informix_GLOBAL(php3_ifx_module).num_persistent--; + Informix_GLOBAL(php3_ifx_module).num_links--; } static void ifx_free_result(a_result_id) @@ -315,62 +409,100 @@ char *a_result_id; return; } - -PHP_INI_BEGIN() - STD_PHP_INI_ENTRY("ifx.allow_persistent", "1", PHP_INI_SYSTEM, - OnUpdateInt, allow_persistent, php_ifx_globals, ifx_globals) - STD_PHP_INI_ENTRY("ifx.max_persistent", "0", PHP_INI_SYSTEM, - OnUpdateInt, max_persistent, php_ifx_globals, ifx_globals) - STD_PHP_INI_ENTRY("ifx.max_links", "0", PHP_INI_SYSTEM, - OnUpdateInt, max_links, php_ifx_globals, ifx_globals) - STD_PHP_INI_ENTRY("ifx.default_host", NULL, PHP_INI_SYSTEM, - OnUpdateString, default_host, php_ifx_globals, ifx_globals) - STD_PHP_INI_ENTRY("ifx.default_user", NULL, PHP_INI_SYSTEM, - OnUpdateString, default_user, php_ifx_globals, ifx_globals) - STD_PHP_INI_ENTRY("ifx.default_password", NULL, PHP_INI_SYSTEM, - OnUpdateString, default_password, php_ifx_globals, ifx_globals) - STD_PHP_INI_ENTRY("ifx.blobinfile", "1", PHP_INI_ALL, - OnUpdateInt, blobinfile, php_ifx_globals, ifx_globals) - STD_PHP_INI_ENTRY("ifx.textasvarchar", "0", PHP_INI_ALL, - OnUpdateInt, textasvarchar, php_ifx_globals, ifx_globals) - STD_PHP_INI_ENTRY("ifx.byteasvarchar", "0", PHP_INI_ALL, - OnUpdateInt, byteasvarchar, php_ifx_globals, ifx_globals) - STD_PHP_INI_ENTRY("ifx.charasvarchar", "0", PHP_INI_ALL, - OnUpdateInt, charasvarchar, php_ifx_globals, ifx_globals) - STD_PHP_INI_ENTRY("ifx.nullformat", "0", PHP_INI_ALL, - OnUpdateInt, nullformat, php_ifx_globals, ifx_globals) -PHP_INI_END() - int php3_minit_ifx(INIT_FUNC_ARGS) { -#ifdef ZTS - ifx_globals_id = ts_allocate_id(sizeof(php_ifx_globals), php_ifx_init_globals, NULL); -#else - IFXG(num_persistent)=0; +#if defined(THREAD_SAFE) + ifx_global_struct *ifx_globals; + CREATE_MUTEX(ifx_mutex,"Informix_TLS"); + SET_MUTEX(ifx_mutex); + numthreads++; + if (numthreads==1){ + if ((InformixTls=TlsAlloc())==0xFFFFFFFF){ + FREE_MUTEX(ifx_mutex); + return 0; + } + } + FREE_MUTEX(ifx_mutex); + ifx_globals = (ifx_global_struct *) + LocalAlloc(LPTR, sizeof(ifx_global_struct)); + TlsSetValue(InformixTls, (void *) ifx_globals); #endif - REGISTER_INI_ENTRIES(); - - IFXG(nullvalue) = malloc(1); - IFXG(nullvalue)[0] = 0; - IFXG(nullstring) = malloc(5); - strcpy(IFXG(nullstring), "NULL"); + if (cfg_get_long("ifx.blobinfile", + &Informix_GLOBAL(php3_ifx_module).blobinfile)==FAILURE) { + Informix_GLOBAL(php3_ifx_module).blobinfile=BLOBINFILE; + } - IFXG(num_persistent)=0; - IFXG(sv_sqlcode)=0; + if (cfg_get_long("ifx.textasvarchar", + &Informix_GLOBAL(php3_ifx_module).textasvarchar)==FAILURE) { + Informix_GLOBAL(php3_ifx_module).textasvarchar=0; + } - IFXG(le_result) = register_list_destructors(ifx_free_result,NULL); - IFXG(le_idresult) = register_list_destructors(ifx_free_result,NULL); - IFXG(le_link) = register_list_destructors(_close_ifx_link,NULL); - IFXG(le_plink) = register_list_destructors(NULL,_close_ifx_plink); + + if (cfg_get_long("ifx.byteasvarchar", + &Informix_GLOBAL(php3_ifx_module).byteasvarchar)==FAILURE) { + Informix_GLOBAL(php3_ifx_module).byteasvarchar=0; + } + + if (cfg_get_long("ifx.charasvarchar", + &Informix_GLOBAL(php3_ifx_module).charasvarchar)==FAILURE) { + Informix_GLOBAL(php3_ifx_module).charasvarchar=0; + } + + if (cfg_get_long("ifx.nullformat", + &Informix_GLOBAL(php3_ifx_module).nullformat)==FAILURE) { + Informix_GLOBAL(php3_ifx_module).nullformat=0; + } + + Informix_GLOBAL(php3_ifx_module).nullvalue = malloc(1); + Informix_GLOBAL(php3_ifx_module).nullvalue[0] = 0; + Informix_GLOBAL(php3_ifx_module).nullstring = malloc(5); + strcpy(Informix_GLOBAL(php3_ifx_module).nullstring, "NULL"); + + if (cfg_get_long("ifx.allow_persistent", + &Informix_GLOBAL(php3_ifx_module).allow_persistent)==FAILURE) { + Informix_GLOBAL(php3_ifx_module).allow_persistent=1; + } + if (cfg_get_long("ifx.max_persistent", + &Informix_GLOBAL(php3_ifx_module).max_persistent)==FAILURE) { + Informix_GLOBAL(php3_ifx_module).max_persistent=-1; + } + if (cfg_get_long("ifx.max_links", + &Informix_GLOBAL(php3_ifx_module).max_links)==FAILURE) { + Informix_GLOBAL(php3_ifx_module).max_links=-1; + } + if (cfg_get_string("ifx.default_host", + &Informix_GLOBAL(php3_ifx_module).default_host)==FAILURE + || Informix_GLOBAL(php3_ifx_module).default_host[0]==0) { + Informix_GLOBAL(php3_ifx_module).default_host=NULL; + } + if (cfg_get_string("ifx.default_user", + &Informix_GLOBAL(php3_ifx_module).default_user)==FAILURE + || Informix_GLOBAL(php3_ifx_module).default_user[0]==0) { + Informix_GLOBAL(php3_ifx_module).default_user=NULL; + } + if (cfg_get_string("ifx.default_password", + &Informix_GLOBAL(php3_ifx_module).default_password)==FAILURE + || Informix_GLOBAL(php3_ifx_module).default_password[0]==0) { + Informix_GLOBAL(php3_ifx_module).default_password=NULL; + } + Informix_GLOBAL(php3_ifx_module).num_persistent=0; + Informix_GLOBAL(php3_ifx_module).sv_sqlcode=0; + Informix_GLOBAL(php3_ifx_module).le_result = + register_list_destructors(ifx_free_result,NULL); + Informix_GLOBAL(php3_ifx_module).le_idresult = + register_list_destructors(ifx_free_result,NULL); + Informix_GLOBAL(php3_ifx_module).le_link = + register_list_destructors(_close_ifx_link,NULL); + Informix_GLOBAL(php3_ifx_module).le_plink = + register_list_destructors(NULL,_close_ifx_plink); #if 0 printf("Registered: %d,%d,%d\n", - IFXG(le_result), - IFXG(le_link), - IFXG(le_plink)); + Informix_GLOBAL(php3_ifx_module).le_result, + Informix_GLOBAL(php3_ifx_module).le_link, + Informix_GLOBAL(php3_ifx_module).le_plink); #endif - ifx_module_entry.type = type; REGISTER_LONG_CONSTANT("IFX_SCROLL", IFX_SCROLL, CONST_CS | CONST_PERSISTENT); @@ -388,39 +520,50 @@ $endif; } -int php3_mshutdown_ifx(SHUTDOWN_FUNC_ARGS){ - - UNREGISTER_INI_ENTRIES(); +int php3_mshutdown_ifx(void){ +#if defined(THREAD_SAFE) + Informix_TLS_VARS; + if (ifx_globals != 0) + LocalFree((HLOCAL) ifx_globals); + SET_MUTEX(ifx_mutex); + numthreads--; + if (!numthreads){ + if (!TlsFree(InformixTls)){ + FREE_MUTEX(ifx_mutex); + return 0; + } + } + FREE_MUTEX(ifx_mutex); +#endif return SUCCESS; - } int php3_rinit_ifx(INIT_FUNC_ARGS) { - IFXLS_FETCH(); + Informix_TLS_VARS; - IFXG(default_link)=-1; - IFXG(num_links) = - IFXG(num_persistent); + Informix_GLOBAL(php3_ifx_module).default_link=-1; + Informix_GLOBAL(php3_ifx_module).num_links = + Informix_GLOBAL(php3_ifx_module).num_persistent; return SUCCESS; } -void php3_info_ifx(ZEND_MODULE_INFO_FUNC_ARGS) +void php3_info_ifx(void) { char maxp[16],maxl[16]; - IFXLS_FETCH(); + Informix_TLS_VARS; - if (IFXG(max_persistent)==-1) { + if (Informix_GLOBAL(php3_ifx_module).max_persistent==-1) { strcpy(maxp,"Unlimited"); } else { - snprintf(maxp,15,"%ld",IFXG(max_persistent)); + snprintf(maxp,15,"%ld",Informix_GLOBAL(php3_ifx_module).max_persistent); maxp[15]=0; } - if (IFXG(max_links)==-1) { + if (Informix_GLOBAL(php3_ifx_module).max_links==-1) { strcpy(maxl,"Unlimited"); } else { - snprintf(maxl,15,"%ld",IFXG(max_links)); + snprintf(maxl,15,"%ld",Informix_GLOBAL(php3_ifx_module).max_links); maxl[15]=0; } php3_printf("<table cellpadding=5>" @@ -428,11 +571,22 @@ void php3_info_ifx(ZEND_MODULE_INFO_FUNC_ARGS) "<tr><td>Persistent links:</td><td>%d/%s</td></tr>\n" "<tr><td>Total links:</td><td>%d/%s</td></tr>\n" "<tr><td>Client API version:</td><td>%02.2f</td></tr>\n" +#if !(WIN32|WINNT) + "<tr><td valign=\"top\">Compilation definitions:</td><td>" + "<tt>IFX_INCLUDE=%s<br>\n" + "IFX_LFLAGS=%s<br>\n" + "IFX_LIBS=%s<br></tt></td></tr>" +#endif "</table>\n", - (IFXG(allow_persistent)?"Yes":"No"), - IFXG(num_persistent),maxp, - IFXG(num_links),maxl, + (Informix_GLOBAL(php3_ifx_module).allow_persistent?"Yes":"No"), + Informix_GLOBAL(php3_ifx_module).num_persistent,maxp, + Informix_GLOBAL(php3_ifx_module).num_links,maxl, (double)(CLIENT_SQLI_VER/100.0) +#if !(WIN32|WINNT) + ,PHP_IFX_INCLUDE, + PHP_IFX_LFLAGS, + PHP_IFX_LIBS +#endif ); } @@ -455,11 +609,9 @@ static void php3_ifx_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent) char *hashed_details; int hashed_details_length; - IFXLS_FETCH(); + Informix_TLS_VARS; - PLS_FETCH(); - - if (PG(sql_safe_mode)) { + if (php3_ini.sql_safe_mode) { if (ARG_COUNT(ht)>0) { php3_error(E_NOTICE, "SQL safe mode in effect - ignoring host/user/password information"); @@ -470,9 +622,9 @@ static void php3_ifx_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent) hashed_details = (char *) emalloc(hashed_details_length+1); sprintf(hashed_details,"ifx__%s_",user); } else { - host = IFXG(default_host); - user = IFXG(default_user); - passwd = IFXG(default_password); + host = Informix_GLOBAL(php3_ifx_module).default_host; + user = Informix_GLOBAL(php3_ifx_module).default_user; + passwd = Informix_GLOBAL(php3_ifx_module).default_password; switch(ARG_COUNT(ht)) { case 0: /* defaults */ @@ -529,9 +681,9 @@ static void php3_ifx_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent) } - IFXG(sv_sqlcode) = 0; + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = 0; - if (!IFXG(allow_persistent)) { + if (!Informix_GLOBAL(php3_ifx_module).allow_persistent) { persistent=0; } if (persistent) { @@ -542,37 +694,37 @@ static void php3_ifx_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent) (void **) &le)==FAILURE) { /* we don't */ list_entry new_le; - if (IFXG(max_links)!=-1 && - IFXG(num_links) >= - IFXG(max_links)) { + if (Informix_GLOBAL(php3_ifx_module).max_links!=-1 && + Informix_GLOBAL(php3_ifx_module).num_links >= + Informix_GLOBAL(php3_ifx_module).max_links) { php3_error(E_WARNING, "Informix: Too many open links (%d)", - IFXG(num_links)); + Informix_GLOBAL(php3_ifx_module).num_links); efree(hashed_details); RETURN_FALSE; } - if (IFXG(max_persistent)!=-1 && - IFXG(num_persistent) >= - IFXG(max_persistent)) { + if (Informix_GLOBAL(php3_ifx_module).max_persistent!=-1 && + Informix_GLOBAL(php3_ifx_module).num_persistent >= + Informix_GLOBAL(php3_ifx_module).max_persistent) { php3_error(E_WARNING, "Informix: Too many open persistent links (%d)", - IFXG(num_persistent)); + Informix_GLOBAL(php3_ifx_module).num_persistent); efree(hashed_details); RETURN_FALSE; } /* create the link */ ifx = (char *)malloc(sizeof(IFX)); - IFXG(connectionid)++; + Informix_GLOBAL(php3_ifx_module).connectionid++; sprintf(ifx,"%s%x", user, - IFXG(connectionid)); + Informix_GLOBAL(php3_ifx_module).connectionid); EXEC SQL CONNECT TO :host AS :ifx USER :user USING :passwd WITH CONCURRENT TRANSACTION; if (ifx_check() == IFX_ERROR) { - IFXG(sv_sqlcode) = SQLCODE; + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = SQLCODE; php3_error(E_WARNING,ifx_error(ifx)); free(ifx); efree(hashed_details); @@ -580,7 +732,7 @@ static void php3_ifx_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent) } /* hash it up */ - new_le.type = IFXG(le_plink); + new_le.type = Informix_GLOBAL(php3_ifx_module).le_plink; new_le.ptr = ifx; if (_php3_hash_update(plist, hashed_details, hashed_details_length+1, @@ -589,10 +741,10 @@ static void php3_ifx_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent) efree(hashed_details); RETURN_FALSE; } - IFXG(num_persistent)++; - IFXG(num_links)++; + Informix_GLOBAL(php3_ifx_module).num_persistent++; + Informix_GLOBAL(php3_ifx_module).num_links++; } else { /* we do */ - if (le->type != IFXG(le_plink)) { + if (le->type != Informix_GLOBAL(php3_ifx_module).le_plink) { RETURN_FALSE; } /* ensure that the link did not die */ @@ -606,7 +758,7 @@ static void php3_ifx_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent) WITH CONCURRENT TRANSACTION; if (ifx_check() == IFX_ERROR) { - IFXG(sv_sqlcode) = SQLCODE; + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = SQLCODE; php3_error(E_WARNING, "Informix: Link to server lost, unable to reconnect (%s)", ifx_error(ifx)); @@ -618,7 +770,8 @@ static void php3_ifx_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent) } ifx = le->ptr; } - return_value->value.lval = php3_list_insert(ifx, IFXG(le_plink)); + return_value->value.lval = php3_list_insert(ifx, + Informix_GLOBAL(php3_ifx_module).le_plink); return_value->type = IS_LONG; } else { /* non persistent */ list_entry *index_ptr,new_index_ptr; @@ -632,44 +785,43 @@ static void php3_ifx_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent) (void **) &index_ptr) == SUCCESS) { int type,link; void *ptr; -#ifdef THREAD_SAFE - if (index_ptr->type != _php3_le_index_ptr()) { -#else + if (index_ptr->type != le_index_ptr) { -#endif RETURN_FALSE; } link = (int) index_ptr->ptr; ptr = php3_list_find(link,&type); /* check if the link is still there */ - if (ptr && (type==IFXG(le_link) || type==IFXG(le_plink))) { - zend_list_addref(link); - return_value->value.lval = IFXG(default_link) = link; - return_value->type = IS_RESOURCE; + if (ptr && (type==Informix_GLOBAL(php3_ifx_module).le_link || + type==Informix_GLOBAL(php3_ifx_module).le_plink)) { + return_value->value.lval = + Informix_GLOBAL(php3_ifx_module).default_link = + link; + return_value->type = IS_LONG; efree(hashed_details); return; } else { _php3_hash_del(list,hashed_details,hashed_details_length+1); } } - if (IFXG(max_links) != -1 && - IFXG(num_links) >= - IFXG(max_links)) { + if (Informix_GLOBAL(php3_ifx_module).max_links != -1 && + Informix_GLOBAL(php3_ifx_module).num_links >= + Informix_GLOBAL(php3_ifx_module).max_links) { php3_error(E_WARNING, "Informix: Too many open links (%d)", - IFXG(num_links)); + Informix_GLOBAL(php3_ifx_module).num_links); efree(hashed_details); RETURN_FALSE; } ifx = (char *) emalloc(sizeof(IFX)); - IFXG(connectionid)++; + Informix_GLOBAL(php3_ifx_module).connectionid++; sprintf(ifx,"connec%x", - IFXG(connectionid)); + Informix_GLOBAL(php3_ifx_module).connectionid); EXEC SQL CONNECT TO :host AS :ifx USER :user USING :passwd WITH CONCURRENT TRANSACTION; if (ifx_check() == IFX_ERROR) { - IFXG(sv_sqlcode) = SQLCODE; + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = SQLCODE; php3_error(E_WARNING,"ifx_pconnect : %s", ifx_error(ifx)); efree(hashed_details); efree(ifx); @@ -677,16 +829,13 @@ static void php3_ifx_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent) } /* add it to the list */ - return_value->value.lval = php3_list_insert(ifx,IFXG(le_link)); - return_value->type = IS_RESOURCE; + return_value->value.lval = + php3_list_insert(ifx,Informix_GLOBAL(php3_ifx_module).le_link); + return_value->type = IS_LONG; /* add it to the hash */ new_index_ptr.ptr = (void *) return_value->value.lval; -#ifdef THREAD_SAFE - new_index_ptr.type = _php3_le_index_ptr(); -#else new_index_ptr.type = le_index_ptr; -#endif if (_php3_hash_update(list, hashed_details, hashed_details_length+1, @@ -695,10 +844,10 @@ static void php3_ifx_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent) efree(hashed_details); RETURN_FALSE; } - IFXG(num_links)++; + Informix_GLOBAL(php3_ifx_module).num_links++; } efree(hashed_details); - IFXG(default_link)=return_value->value.lval; + Informix_GLOBAL(php3_ifx_module).default_link=return_value->value.lval; } @@ -720,16 +869,16 @@ PHP_FUNCTION(ifx_pconnect) static int php3_ifx_get_default_link(INTERNAL_FUNCTION_PARAMETERS) { - IFXLS_FETCH(); + Informix_TLS_VARS; - if (IFXG(default_link)==-1) { /* no link opened yet, implicitly open one */ + if (Informix_GLOBAL(php3_ifx_module).default_link==-1) { /* no link opened yet, implicitly open one */ HashTable tmp; _php3_hash_init(&tmp,0,NULL,NULL,0); - php3_ifx_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU,0); + php3_ifx_do_connect(&tmp,return_value,list,plist,0); _php3_hash_destroy(&tmp); } - return IFXG(default_link); + return Informix_GLOBAL(php3_ifx_module).default_link; } /* ---------------------------------------------------------------------- @@ -751,13 +900,13 @@ EXEC SQL BEGIN DECLARE SECTION; char *ifx; EXEC SQL END DECLARE SECTION; - IFXLS_FETCH(); + Informix_TLS_VARS; switch (ARG_COUNT(ht)) { case 0: - id = IFXG(default_link); + id = Informix_GLOBAL(php3_ifx_module).default_link; break; case 1: if (getParameters(ht, 1, &ifx_link)==FAILURE) { @@ -771,11 +920,11 @@ EXEC SQL END DECLARE SECTION; break; } - IFXG(sv_sqlcode) = 0; + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = 0; ifx = (char *) php3_list_find(id,&type); - if (type!=IFXG(le_link) && - type!=IFXG(le_plink)) { + if (type!=Informix_GLOBAL(php3_ifx_module).le_link && + type!=Informix_GLOBAL(php3_ifx_module).le_plink) { php3_error(E_WARNING, "ifx_close : %d (type %d) is not an Informix link index", id, @@ -853,37 +1002,24 @@ EXEC SQL END DECLARE SECTION; int query_type; int cursoryproc; - IFXLS_FETCH(); + Informix_TLS_VARS; if(ARG_COUNT(ht)<2) { WRONG_PARAM_COUNT; } - IFXG(sv_sqlcode) = 0; + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = 0; - /* get the first 2 parameters, - php4 insists on the correct number of arguments */ - switch(ARG_COUNT(ht)) { - case 2: - if (getParameters(ht, 2, &query, &ifx_link)==FAILURE) - RETURN_FALSE; - break; - case 3: - if (getParameters(ht, 3, &query, &ifx_link, &dummy)==FAILURE) - RETURN_FALSE; - break; - case 4: - if (getParameters(ht, 4, &query, &ifx_link, &dummy, &dummy)==FAILURE) - RETURN_FALSE; - break; + /* get the first 2 parameters */ + if (getParameters(ht, 2, &query, &ifx_link)==FAILURE) { + RETURN_FALSE; } - convert_to_long(ifx_link); id = ifx_link->value.lval; ifx = (char *) php3_list_find(id,&type); - if (type != IFXG(le_link) && - type!=IFXG(le_plink)) { + if (type != Informix_GLOBAL(php3_ifx_module).le_link && + type!=Informix_GLOBAL(php3_ifx_module).le_plink) { php3_error(E_WARNING, "ifx_query : %d (type %d) is not a Informix link index", id, @@ -896,14 +1032,14 @@ EXEC SQL END DECLARE SECTION; convert_to_string(query); statement = query->value.str.val; - IFXG(cursorid)++; - sprintf(statemid, "statem%x", IFXG(cursorid)); - sprintf(cursorid, "cursor%x", IFXG(cursorid)); - sprintf(descrpid, "descrp%x", IFXG(cursorid)); + Informix_GLOBAL(php3_ifx_module).cursorid++; + sprintf(statemid, "statem%x", Informix_GLOBAL(php3_ifx_module).cursorid); + sprintf(cursorid, "cursor%x", Informix_GLOBAL(php3_ifx_module).cursorid); + sprintf(descrpid, "descrp%x", Informix_GLOBAL(php3_ifx_module).cursorid); EXEC SQL set connection :ifx; if (ifx_check() < 0) { - IFXG(sv_sqlcode) = SQLCODE; + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = SQLCODE; php3_error(E_WARNING,"Set connection %s fails (%s)", ifx, ifx_error(ifx)); @@ -911,7 +1047,7 @@ EXEC SQL END DECLARE SECTION; } EXEC SQL PREPARE :statemid FROM :statement; if (ifx_check() < 0) { - IFXG(sv_sqlcode) = SQLCODE; + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = SQLCODE; php3_error(E_WARNING,"Prepare fails (%s)", ifx_error(ifx)); RETURN_FALSE; @@ -922,7 +1058,7 @@ EXEC SQL END DECLARE SECTION; EXEC SQL ALLOCATE DESCRIPTOR :descrpid WITH MAX 256; if (ifx_check() < 0) { - IFXG(sv_sqlcode) = SQLCODE; + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = SQLCODE; php3_error(E_WARNING,"Allocate desciptor <%s> fails (%s)", descrpid, ifx_error(ifx)); @@ -931,7 +1067,7 @@ EXEC SQL END DECLARE SECTION; } EXEC SQL DESCRIBE :statemid USING SQL DESCRIPTOR :descrpid; if (ifx_check() < 0) { - IFXG(sv_sqlcode) = SQLCODE; + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = SQLCODE; php3_error(E_WARNING,"Describe fails (%s)", ifx_error(ifx)); EXEC SQL DEALLOCATE DESCRIPTOR :descrpid; @@ -973,7 +1109,7 @@ EXEC SQL END DECLARE SECTION; ## NONSELECT-STATEMENT ## */ - pval *pblobidarr, **tmp; + pval *pblobidarr, *tmp; Ifx_Result->iscursory = 0; @@ -986,13 +1122,7 @@ EXEC SQL END DECLARE SECTION; } if(ARG_COUNT(ht)==3) { - if (getParameters(ht, 3, &dummy, &dummy, &pblobidarr) == FAILURE) { - php3_error(E_WARNING,"Can't get blob array param"); - EXEC SQL DEALLOCATE DESCRIPTOR :descrpid; - EXEC SQL free :statemid; - efree(Ifx_Result); - RETURN_FALSE; - } + getParameters(ht, ARG_COUNT(ht), &dummy,&dummy,&pblobidarr); if (pblobidarr->type != IS_ARRAY) { php3_error(E_WARNING,"blob-parameter not an array"); EXEC SQL DEALLOCATE DESCRIPTOR :descrpid; @@ -1005,16 +1135,16 @@ EXEC SQL END DECLARE SECTION; i=1; while (_php3_hash_get_current_data(pblobidarr->value.ht, (void **) &tmp) == SUCCESS) { - convert_to_long(*tmp); + convert_to_long(tmp); if ((query_type == SQ_UPDATE) || (query_type == SQ_UPDALL)) { EXEC SQL SET DESCRIPTOR :descrpid COUNT = :i; } /* TEXT/BYTE */ - if(php3_intifx_getType((int)(*tmp)->value.lval,list)==TYPE_BLTEXT || php3_intifx_getType((int)(*tmp)->value.lval,list)==TYPE_BLBYTE) { - locator=php3_intifx_get_blobloc((int)((*tmp)->value.lval),list); + if(php3_intifx_getType((int)tmp->value.lval,list)==TYPE_BLTEXT || php3_intifx_getType((int)tmp->value.lval,list)==TYPE_BLBYTE) { + locator=php3_intifx_get_blobloc((int)tmp->value.lval,list); if(locator==NULL) { php3_error(E_WARNING,"%d is not a Informix blob-result index", - (int)((*tmp)->value.lval)); + (int)tmp->value.lval); EXEC SQL DEALLOCATE DESCRIPTOR :descrpid; EXEC SQL free :statemid; efree(Ifx_Result); @@ -1029,8 +1159,8 @@ EXEC SQL END DECLARE SECTION; } /* CHAR */ - if(php3_intifx_getType((int)(*tmp)->value.lval,list)==TYPE_CHAR) { - len=php3_intifx_get_char((int)((*tmp)->value.lval),list,&char_tmp); + if(php3_intifx_getType((int)tmp->value.lval,list)==TYPE_CHAR) { + len=php3_intifx_get_char((int)tmp->value.lval,list,&char_tmp); indicator=0; if(char_tmp==NULL || len<0) indicator=-1; @@ -1052,7 +1182,7 @@ EXEC SQL END DECLARE SECTION; EXEC SQL EXECUTE :statemid; } if (ifx_check() < 0) { - IFXG(sv_sqlcode) = SQLCODE; + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = SQLCODE; php3_error(E_WARNING,"Execute immediate fails : %s (%s)", statement, ifx_error(ifx)); @@ -1096,7 +1226,7 @@ EXEC SQL END DECLARE SECTION; EXEC SQL GET DESCRIPTOR :descrpid :fieldcount = COUNT; if (ifx_check() < 0) { - IFXG(sv_sqlcode) = SQLCODE; + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = SQLCODE; php3_error(E_WARNING,"Can not get descriptor %s (%s)", descrpid, ifx_error(ifx)); @@ -1125,7 +1255,7 @@ EXEC SQL END DECLARE SECTION; EXEC SQL DECLARE :cursorid CURSOR FOR :statemid; if (ifx_check() < 0) { - IFXG(sv_sqlcode) = SQLCODE; + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = SQLCODE; php3_error(E_WARNING,"Declare cursor fails (%s)", ifx_error(ifx)); efree(Ifx_Result); EXEC SQL DEALLOCATE DESCRIPTOR :descrpid; @@ -1134,7 +1264,7 @@ EXEC SQL END DECLARE SECTION; } EXEC SQL OPEN :cursorid; if (ifx_check() < 0) { - IFXG(sv_sqlcode) = SQLCODE; + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = SQLCODE; php3_error(E_WARNING,"Open cursor fails (%s)", ifx_error(ifx)); efree(Ifx_Result); EXEC SQL DEALLOCATE DESCRIPTOR :descrpid; @@ -1166,7 +1296,7 @@ $endif; EXEC SQL SET DESCRIPTOR :descrpid VALUE :i DATA = :*locator; } if(fieldtype==SQLBYTES) { - if(IFXG(blobinfile)==0) { + if(Informix_GLOBAL(php3_ifx_module).blobinfile==0) { bid=php3_intifx_create_blob(TYPE_BLBYTE,BLMODE_INMEM,"",-1,list); locator=php3_intifx_get_blobloc(bid,list); } else { @@ -1194,7 +1324,7 @@ $endif; } - RETURN_LONG(php3_list_insert(Ifx_Result,IFXG(le_result))); + RETURN_LONG(php3_list_insert(Ifx_Result,Informix_GLOBAL(php3_ifx_module).le_result)); } /* }}} */ @@ -1254,37 +1384,24 @@ EXEC SQL END DECLARE SECTION; int query_type; int cursoryproc; - IFXLS_FETCH(); + Informix_TLS_VARS; if(ARG_COUNT(ht)<2) { WRONG_PARAM_COUNT; } - IFXG(sv_sqlcode) = 0; + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = 0; - /* get the first 2 parameters, - php4 insists on the correct number of arguments */ - switch(ARG_COUNT(ht)) { - case 2: - if (getParameters(ht, 2, &query, &ifx_link)==FAILURE) - RETURN_FALSE; - break; - case 3: - if (getParameters(ht, 3, &query, &ifx_link, &dummy)==FAILURE) - RETURN_FALSE; - break; - case 4: - if (getParameters(ht, 4, &query, &ifx_link, &dummy, &dummy)==FAILURE) - RETURN_FALSE; - break; + /* get the first 2 parameters */ + if (getParameters(ht, 2, &query, &ifx_link)==FAILURE) { + RETURN_FALSE; } - convert_to_long(ifx_link); id = ifx_link->value.lval; ifx = (char *) php3_list_find(id,&type); - if (type != IFXG(le_link) && - type!=IFXG(le_plink)) { + if (type != Informix_GLOBAL(php3_ifx_module).le_link && + type!=Informix_GLOBAL(php3_ifx_module).le_plink) { php3_error(E_WARNING, "ifx_query : %d (type %d) is not a Informix link index", id, @@ -1298,14 +1415,14 @@ EXEC SQL END DECLARE SECTION; convert_to_string(query); statement = query->value.str.val; - IFXG(cursorid)++; - sprintf(statemid, "statem%x", IFXG(cursorid)); - sprintf(cursorid, "cursor%x", IFXG(cursorid)); - sprintf(descrpid, "descrp%x", IFXG(cursorid)); + Informix_GLOBAL(php3_ifx_module).cursorid++; + sprintf(statemid, "statem%x", Informix_GLOBAL(php3_ifx_module).cursorid); + sprintf(cursorid, "cursor%x", Informix_GLOBAL(php3_ifx_module).cursorid); + sprintf(descrpid, "descrp%x", Informix_GLOBAL(php3_ifx_module).cursorid); EXEC SQL set connection :ifx; if (ifx_check() < 0) { - IFXG(sv_sqlcode) = SQLCODE; + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = SQLCODE; php3_error(E_WARNING,"Set connection %s fails (%s)", ifx, ifx_error(ifx)); @@ -1313,7 +1430,7 @@ EXEC SQL END DECLARE SECTION; } EXEC SQL PREPARE :statemid FROM :statement; if (ifx_check() < 0) { - IFXG(sv_sqlcode) = SQLCODE; + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = SQLCODE; php3_error(E_WARNING,"Prepare fails (%s)", ifx_error(ifx)); RETURN_FALSE; @@ -1322,7 +1439,7 @@ EXEC SQL END DECLARE SECTION; for (e = 0; e < 6; e++) sqlerrd[e] = sqlca.sqlerrd[e]; EXEC SQL ALLOCATE DESCRIPTOR :descrpid WITH MAX 256; if (ifx_check() < 0) { - IFXG(sv_sqlcode) = SQLCODE; + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = SQLCODE; php3_error(E_WARNING,"Allocate desciptor <%s> fails (%s)", descrpid, ifx_error(ifx)); @@ -1331,7 +1448,7 @@ EXEC SQL END DECLARE SECTION; } EXEC SQL DESCRIBE :statemid USING SQL DESCRIPTOR :descrpid; if (ifx_check() < 0) { - IFXG(sv_sqlcode) = SQLCODE; + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = SQLCODE; php3_error(E_WARNING,"Describe fails (%s)", ifx_error(ifx)); EXEC SQL DEALLOCATE DESCRIPTOR :descrpid; @@ -1343,7 +1460,7 @@ EXEC SQL END DECLARE SECTION; Ifx_Result = (IFX_RES *)emalloc(sizeof(IFX_RES)); if (Ifx_Result == NULL) { - IFXG(sv_sqlcode) = SQLCODE; + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = SQLCODE; php3_error(E_WARNING,"Out of memory allocating IFX_RES"); EXEC SQL DEALLOCATE DESCRIPTOR :descrpid; EXEC SQL free :statemid; @@ -1375,7 +1492,7 @@ EXEC SQL END DECLARE SECTION; ## NONSELECT-STATEMENT ## */ - pval *pblobidarr, **tmp; + pval *pblobidarr, *tmp; Ifx_Result->iscursory = 0; @@ -1389,13 +1506,7 @@ EXEC SQL END DECLARE SECTION; } if(ARG_COUNT(ht)==3) { Ifx_Result->paramquery=1; - if (getParameters(ht, 3, &dummy, &dummy,&pblobidarr) == FAILURE) { - php3_error(E_WARNING,"Can't get blob array param"); - EXEC SQL DEALLOCATE DESCRIPTOR :descrpid; - EXEC SQL free :statemid; - efree(Ifx_Result); - RETURN_FALSE; - } + getParameters(ht, ARG_COUNT(ht), &dummy,&dummy,&pblobidarr); if(pblobidarr->type != IS_ARRAY) { php3_error(E_WARNING,"blob-parameter not an array"); EXEC SQL DEALLOCATE DESCRIPTOR :descrpid; @@ -1407,16 +1518,16 @@ EXEC SQL END DECLARE SECTION; i=1; while (_php3_hash_get_current_data(pblobidarr->value.ht, (void **) &tmp) == SUCCESS) { - convert_to_long(*tmp); + convert_to_long(tmp); if ((query_type == SQ_UPDATE) || (query_type == SQ_UPDALL)) { EXEC SQL SET DESCRIPTOR :descrpid COUNT = :i; } /* TEXT/BYTE */ - if(php3_intifx_getType((int)((*tmp)->value.lval),list)==TYPE_BLTEXT || php3_intifx_getType((int)((*tmp)->value.lval),list)==TYPE_BLBYTE) { - locator=php3_intifx_get_blobloc((int)((*tmp)->value.lval),list); + if(php3_intifx_getType((int)tmp->value.lval,list)==TYPE_BLTEXT || php3_intifx_getType((int)tmp->value.lval,list)==TYPE_BLBYTE) { + locator=php3_intifx_get_blobloc((int)tmp->value.lval,list); if(locator==NULL) { php3_error(E_WARNING,"%d is not a Informix blob-result index", - (int)((*tmp)->value.lval)); + (int)tmp->value.lval); EXEC SQL DEALLOCATE DESCRIPTOR :descrpid; EXEC SQL free :statemid; efree(Ifx_Result); @@ -1430,8 +1541,8 @@ EXEC SQL END DECLARE SECTION; TYPE=:loc_t_type; } /* CHAR */ - if(php3_intifx_getType((int)((*tmp)->value.lval),list)==TYPE_CHAR) { - len=php3_intifx_get_char((int)((*tmp)->value.lval),list,&char_tmp); + if(php3_intifx_getType((int)tmp->value.lval,list)==TYPE_CHAR) { + len=php3_intifx_get_char((int)tmp->value.lval,list,&char_tmp); indicator=0; if(char_tmp==NULL || len<0) indicator=-1; @@ -1481,7 +1592,7 @@ EXEC SQL END DECLARE SECTION; for (e = 0; e < 6; e++) Ifx_Result->sqlerrd[e] = sqlerrd[e]; EXEC SQL GET DESCRIPTOR :descrpid :fieldcount = COUNT; if (ifx_check() < 0) { - IFXG(sv_sqlcode) = SQLCODE; + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = SQLCODE; php3_error(E_WARNING,"Can not get descriptor %s (%s)", descrpid, ifx_error(ifx)); @@ -1500,7 +1611,7 @@ EXEC SQL END DECLARE SECTION; } /* if select */ - RETURN_LONG(php3_list_insert(Ifx_Result,IFXG(le_result))); + RETURN_LONG(php3_list_insert(Ifx_Result,Informix_GLOBAL(php3_ifx_module).le_result)); } /* }}} */ @@ -1546,7 +1657,7 @@ EXEC SQL END DECLARE SECTION; int locind; char *blobfilename; - IFXLS_FETCH(); + Informix_TLS_VARS; switch(ARG_COUNT(ht)) { case 0: @@ -1564,9 +1675,9 @@ EXEC SQL END DECLARE SECTION; break; } - IFXG(sv_sqlcode) = 0; + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = 0; - if (type!=IFXG(le_result)) { + if (type!=Informix_GLOBAL(php3_ifx_module).le_result) { php3_error(E_WARNING,"%d is not an Informix result index", result->value.lval); RETURN_FALSE; @@ -1580,7 +1691,7 @@ EXEC SQL END DECLARE SECTION; EXEC SQL set connection :ifx; if (ifx_check() < 0) { - IFXG(sv_sqlcode) = SQLCODE; + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = SQLCODE; php3_error(E_WARNING,"Set connection %s fails (%s)", ifx, ifx_error(ifx)); @@ -1599,7 +1710,7 @@ EXEC SQL END DECLARE SECTION; EXEC SQL EXECUTE :statemid; } if (ifx_check() < 0) { - IFXG(sv_sqlcode) = SQLCODE; + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = SQLCODE; php3_error(E_WARNING,"Execute immediate fails : %s ", ifx_error(ifx)); RETURN_FALSE; @@ -1619,13 +1730,13 @@ EXEC SQL END DECLARE SECTION; EXEC SQL DECLARE :cursorid CURSOR FOR :statemid; if (ifx_check() < 0) { - IFXG(sv_sqlcode) = SQLCODE; + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = SQLCODE; php3_error(E_WARNING,"Declare cursor fails (%s)", ifx_error(ifx)); RETURN_FALSE; } EXEC SQL OPEN :cursorid; if (ifx_check() < 0) { - IFXG(sv_sqlcode) = SQLCODE; + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = SQLCODE; php3_error(E_WARNING,"Open cursor fails (%s)", ifx_error(ifx)); RETURN_FALSE; } @@ -1650,7 +1761,7 @@ $endif; EXEC SQL SET DESCRIPTOR :descrpid VALUE :i DATA = :*locator; } if(fieldtype==SQLBYTES) { - if(IFXG(blobinfile)==0) { + if(Informix_GLOBAL(php3_ifx_module).blobinfile==0) { bid=php3_intifx_create_blob(TYPE_BLBYTE,BLMODE_INMEM,"",-1,list); locator=php3_intifx_get_blobloc(bid,list); } else { @@ -1700,12 +1811,12 @@ PHP_FUNCTION(ifx_error) { pval *ifx_link; int id; - IFXLS_FETCH(); + Informix_TLS_VARS; switch(ARG_COUNT(ht)) { case 0: - id = IFXG(default_link); + id = Informix_GLOBAL(php3_ifx_module).default_link; break; case 1: if (getParameters(ht, 1, &ifx_link)==FAILURE) { @@ -1744,14 +1855,14 @@ PHP_FUNCTION(ifx_errormsg) char *ifx_errmsg; char * returnmsg; - IFXLS_FETCH(); + Informix_TLS_VARS; switch(ARG_COUNT(ht)) { case 0: - if (IFXG(sv_sqlcode) == 0) + if (Informix_GLOBAL(php3_ifx_module).sv_sqlcode == 0) ifx_errorcode = SQLCODE; else - ifx_errorcode = IFXG(sv_sqlcode); + ifx_errorcode = Informix_GLOBAL(php3_ifx_module).sv_sqlcode; break; case 1: if (getParameters(ht, 1, &errcode)==FAILURE) { @@ -1805,7 +1916,7 @@ PHP_FUNCTION(ifx_affected_rows) int type; IFX_RES *Ifx_Result; - IFXLS_FETCH(); + Informix_TLS_VARS; switch(ARG_COUNT(ht)) { case 0: @@ -1823,9 +1934,9 @@ PHP_FUNCTION(ifx_affected_rows) break; } - IFXG(sv_sqlcode )= 0; + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = 0; - if (type!=IFXG(le_result)) { + if (type!=Informix_GLOBAL(php3_ifx_module).le_result) { php3_error(E_WARNING,"%d is not an Informix result index", result->value.lval); RETURN_FALSE; @@ -1905,7 +2016,7 @@ EXEC SQL END DECLARE SECTION; char *nullstr; - IFXLS_FETCH(); + Informix_TLS_VARS; switch(ARG_COUNT(ht)) { case 0: @@ -1941,9 +2052,9 @@ EXEC SQL END DECLARE SECTION; nullstr=php3_intifx_null(); - IFXG(sv_sqlcode) = 0; + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = 0; - if (type!=IFXG(le_result)) { + if (type!=Informix_GLOBAL(php3_ifx_module).le_result) { php3_error(E_WARNING,"%d is not an Informix result index", result->value.lval); RETURN_FALSE; @@ -1961,7 +2072,7 @@ EXEC SQL END DECLARE SECTION; EXEC SQL set connection :ifx; if (ifx_check() < 0) { - IFXG(sv_sqlcode) = SQLCODE; + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = SQLCODE; php3_error(E_WARNING,"Set connection %s fails (%s)", ifx, ifx_error(ifx)); @@ -2002,7 +2113,7 @@ EXEC SQL END DECLARE SECTION; if(SQLCODE!=-451) { switch (ifx_check()) { case IFX_ERROR: - IFXG(sv_sqlcode) = SQLCODE; + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = SQLCODE; php3_error(E_WARNING, "Can not fetch row on cursor %s (%s)", ifx_error(ifx), @@ -2030,7 +2141,7 @@ EXEC SQL END DECLARE SECTION; :fieldleng = LENGTH, :indicator = INDICATOR; if (ifx_check() < 0) { - IFXG(sv_sqlcode) = SQLCODE; + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = SQLCODE; php3_error(E_WARNING,"Get descriptor (field # %d) fails (%s)", i, ifx_error(ifx)); @@ -2045,9 +2156,9 @@ EXEC SQL END DECLARE SECTION; sprintf(fieldname, "[Expr_%d]", i); if (indicator == -1) { /* NULL */ - if((IFXG(textasvarchar)==0 + if((Informix_GLOBAL(php3_ifx_module).textasvarchar==0 && fieldtype==SQLTEXT) - || (IFXG(byteasvarchar)==0 + || (Informix_GLOBAL(php3_ifx_module).byteasvarchar==0 && fieldtype==SQLBYTES)) { bid_b=Ifx_Result->res_id[locind]; @@ -2149,7 +2260,7 @@ $endif; RETURN_FALSE; } EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :char_data = DATA; - if (IFXG(charasvarchar) != 0 + if (Informix_GLOBAL(php3_ifx_module).charasvarchar != 0 && (fieldtype == SQLCHAR || fieldtype == SQLNCHAR)) { ldchar(char_data, fieldleng, char_data); } @@ -2198,9 +2309,9 @@ $endif; /* note that in case of "blobinfile" */ /* you get the file name */ /* a new one for every row ! */ - if((IFXG(textasvarchar)!=0 + if((Informix_GLOBAL(php3_ifx_module).textasvarchar!=0 && fieldtype==SQLTEXT) - || (IFXG(byteasvarchar)!=0 + || (Informix_GLOBAL(php3_ifx_module).byteasvarchar!=0 && fieldtype==SQLBYTES)) { char *content; long lg; @@ -2295,7 +2406,7 @@ EXEC SQL END DECLARE SECTION; char *table_options; int moredata; - IFXLS_FETCH(); + Informix_TLS_VARS; switch (ARG_COUNT(ht)) { case 1: @@ -2315,12 +2426,12 @@ EXEC SQL END DECLARE SECTION; break; } - IFXG(sv_sqlcode) = 0; + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = 0; convert_to_long(result); Ifx_Result = (IFX_RES *) php3_list_find(result->value.lval,&type); - if (type!=IFXG(le_result)) { + if (type!=Informix_GLOBAL(php3_ifx_module).le_result) { php3_error(E_WARNING, "%d is not a Informix result index",result->value.lval); RETURN_FALSE; @@ -2339,7 +2450,7 @@ EXEC SQL END DECLARE SECTION; EXEC SQL set connection :ifx; if (ifx_check() < 0) { - IFXG(sv_sqlcode) = SQLCODE; + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = SQLCODE; php3_error(E_WARNING,"Set connection %s fails (%s)", ifx, ifx_error(ifx)); @@ -2351,7 +2462,7 @@ EXEC SQL END DECLARE SECTION; EXEC SQL FETCH :cursorid USING SQL DESCRIPTOR :descrpid; switch (ifx_check()) { case IFX_ERROR: - IFXG(sv_sqlcode) = SQLCODE; + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = SQLCODE; php3_error(E_WARNING, "Can not fetch next row on cursor %s (%s)", ifx_error(ifx), @@ -2383,7 +2494,7 @@ EXEC SQL END DECLARE SECTION; for (i = 1; i <= num_fields; i++) { EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :fieldname = NAME; if (ifx_check() < 0) { - IFXG(sv_sqlcode) = SQLCODE; + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = SQLCODE; php3_error(E_WARNING,"Get descriptor (field # %d) fails (%s)", i, ifx_error(ifx)); @@ -2410,7 +2521,7 @@ EXEC SQL END DECLARE SECTION; :fieldleng = LENGTH, :indicator = INDICATOR; if (ifx_check() < 0) { - IFXG(sv_sqlcode) = SQLCODE; + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = SQLCODE; php3_error(E_WARNING,"Get descriptor (field # %d) fails (%s)", i, ifx_error(ifx)); @@ -2505,7 +2616,7 @@ $endif; RETURN_FALSE; } EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :char_data = DATA; - if (IFXG(charasvarchar) != 0 + if (Informix_GLOBAL(php3_ifx_module).charasvarchar != 0 && (fieldtype == SQLCHAR || fieldtype == SQLNCHAR)) { ldchar(char_data, fieldleng, char_data); } @@ -2569,7 +2680,7 @@ $endif; EXEC SQL FETCH :cursorid USING SQL DESCRIPTOR :descrpid; switch (ifx_check()) { case IFX_ERROR: - IFXG(sv_sqlcode) = SQLCODE; + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = SQLCODE; php3_error(E_WARNING, "Can not fetch next row on cursor %s (%s)", ifx_error(ifx), @@ -2629,7 +2740,7 @@ EXEC SQL END DECLARE SECTION; char *p; char *table_options; - IFXLS_FETCH(); + Informix_TLS_VARS; switch (ARG_COUNT(ht)) { case 1: @@ -2649,12 +2760,12 @@ EXEC SQL END DECLARE SECTION; break; } - IFXG(sv_sqlcode) = 0; + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = 0; convert_to_long(result); Ifx_Result = (IFX_RES *) php3_list_find(result->value.lval,&type); - if (type!=IFXG(le_result)) { + if (type!=Informix_GLOBAL(php3_ifx_module).le_result) { php3_error(E_WARNING, "%d is not a Informix result index",result->value.lval); RETURN_FALSE; @@ -2673,7 +2784,7 @@ EXEC SQL END DECLARE SECTION; EXEC SQL set connection :ifx; if (ifx_check() < 0) { - IFXG(sv_sqlcode) = SQLCODE; + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = SQLCODE; php3_error(E_WARNING,"Set connection %s fails (%s)", ifx, ifx_error(ifx)); @@ -2688,7 +2799,7 @@ EXEC SQL END DECLARE SECTION; EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :fieldname = NAME, :fieldtype = TYPE; if (ifx_check() < 0) { - IFXG(sv_sqlcode) = SQLCODE; + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = SQLCODE; php3_error(E_WARNING,"Get descriptor (field # %d) fails (%s)", i, ifx_error(ifx)); @@ -2824,7 +2935,7 @@ EXEC SQL END DECLARE SECTION; char *p; char *table_options; - IFXLS_FETCH(); + Informix_TLS_VARS; switch (ARG_COUNT(ht)) { case 1: @@ -2844,12 +2955,12 @@ EXEC SQL END DECLARE SECTION; break; } - IFXG(sv_sqlcode) = 0; + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = 0; convert_to_long(result); Ifx_Result = (IFX_RES *) php3_list_find(result->value.lval,&type); - if (type!=IFXG(le_result)) { + if (type!=Informix_GLOBAL(php3_ifx_module).le_result) { php3_error(E_WARNING, "%d is not a Informix result index",result->value.lval); RETURN_FALSE; @@ -2868,7 +2979,7 @@ EXEC SQL END DECLARE SECTION; EXEC SQL set connection :ifx; if (ifx_check() < 0) { - IFXG(sv_sqlcode) = SQLCODE; + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = SQLCODE; php3_error(E_WARNING,"Set connection %s fails (%s)", ifx, ifx_error(ifx)); @@ -2888,7 +2999,7 @@ EXEC SQL END DECLARE SECTION; :scale = SCALE, :isnullable = NULLABLE; if (ifx_check() < 0) { - IFXG(sv_sqlcode) = SQLCODE; + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = SQLCODE; php3_error(E_WARNING,"Get descriptor (field # %d) fails (%s)", i, ifx_error(ifx)); @@ -3002,18 +3113,18 @@ PHP_FUNCTION(ifx_num_rows) pval *result; IFX_RES *Ifx_Result; int type; - IFXLS_FETCH(); + Informix_TLS_VARS; if (ARG_COUNT(ht)!=1 || getParameters(ht, 1, &result)==FAILURE) { WRONG_PARAM_COUNT; } - IFXG(sv_sqlcode) = 0; + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = 0; convert_to_long(result); Ifx_Result = (IFX_RES *) php3_list_find(result->value.lval,&type); - if (type!=IFXG(le_result)) { + if (type!=Informix_GLOBAL(php3_ifx_module).le_result) { php3_error(E_WARNING,"%d is not a Informix result index", result->value.lval); RETURN_FALSE; @@ -3045,18 +3156,18 @@ PHP_FUNCTION(ifx_getsqlca) char fieldname[16]; int e; - IFXLS_FETCH(); + Informix_TLS_VARS; if (ARG_COUNT(ht)!=1 || getParameters(ht, 1, &result)==FAILURE) { WRONG_PARAM_COUNT; } - IFXG(sv_sqlcode) = 0; + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = 0; convert_to_long(result); Ifx_Result = (IFX_RES *) php3_list_find(result->value.lval,&type); - if (type!=IFXG(le_result)) { + if (type!=Informix_GLOBAL(php3_ifx_module).le_result) { php3_error(E_WARNING,"%d is not a Informix result index", result->value.lval); RETURN_FALSE; @@ -3093,18 +3204,18 @@ PHP_FUNCTION(ifx_num_fields) pval *result; IFX_RES *Ifx_Result; int type; - IFXLS_FETCH(); + Informix_TLS_VARS; if (ARG_COUNT(ht)!=1 || getParameters(ht, 1, &result)==FAILURE) { WRONG_PARAM_COUNT; } - IFXG(sv_sqlcode) = 0; + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = 0; convert_to_long(result); Ifx_Result = (IFX_RES *) php3_list_find(result->value.lval,&type); - if (type!=IFXG(le_result)) { + if (type!=Informix_GLOBAL(php3_ifx_module).le_result) { php3_error(E_WARNING,"%d is not a Informix result index", result->value.lval); RETURN_FALSE; @@ -3145,7 +3256,7 @@ EXEC SQL END DECLARE SECTION; int i, locind; - IFXLS_FETCH(); + Informix_TLS_VARS; if (ARG_COUNT(ht)!=1 || getParameters(ht, 1, &result)==FAILURE) { @@ -3159,13 +3270,13 @@ EXEC SQL END DECLARE SECTION; Ifx_Result = (IFX_RES *) php3_list_find(result->value.lval,&type); - if (type!=IFXG(le_result)) { + if (type!=Informix_GLOBAL(php3_ifx_module).le_result) { php3_error(E_WARNING,"%d is not a Informix result index", result->value.lval); RETURN_FALSE; } - IFXG(sv_sqlcode = 0); + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = 0; for (i = 0; i < MAX_RESID; ++i) { @@ -3182,7 +3293,7 @@ EXEC SQL END DECLARE SECTION; EXEC SQL set connection :ifx; if (ifx_check() < 0) { - IFXG(sv_sqlcode) = SQLCODE; + Informix_GLOBAL(php3_ifx_module).sv_sqlcode = SQLCODE; php3_error(E_WARNING,"Set connection %s fails (%s)", ifx, ifx_error(ifx)); @@ -3226,7 +3337,7 @@ static long php3_intifx_getType(long id, HashTable *list) { int type; Ifx_res = (IFX_IDRES *) php3_list_find(id,&type); - if (type!=IFXG(le_idresult)) { + if (type!=Informix_GLOBAL(php3_ifx_module).le_idresult) { php3_error(E_WARNING,"%d is not a Informix id-result index", id); return -1; @@ -3346,7 +3457,7 @@ static long php3_intifx_create_blob(long type, long mode, char* param, long len, Ifx_blob->BLOB.blob_data.loc_oflags=LOC_WONLY; Ifx_blob->BLOB.blob_data.loc_size=-1; } - return php3_list_insert(Ifx_blob,IFXG(le_idresult)); + return php3_list_insert(Ifx_blob,Informix_GLOBAL(php3_ifx_module).le_idresult); } @@ -3401,7 +3512,7 @@ static long php3_intifx_copy_blob(long bid, HashTable *list) { int type; Ifx_blob_orig = (IFX_IDRES *) php3_list_find(bid,&type); - if (type!=IFXG(le_idresult) || !(Ifx_blob_orig->type==TYPE_BLBYTE || Ifx_blob_orig->type==TYPE_BLTEXT)) { + if (type!=Informix_GLOBAL(php3_ifx_module).le_idresult || !(Ifx_blob_orig->type==TYPE_BLBYTE || Ifx_blob_orig->type==TYPE_BLTEXT)) { php3_error(E_WARNING,"%d is not a Informix blob-result index", bid); return -1; @@ -3453,7 +3564,7 @@ static long php3_intifx_copy_blob(long bid, HashTable *list) { locator->loc_oflags=locator_orig->loc_oflags; } - return php3_list_insert(Ifx_blob,IFXG(le_idresult)); + return php3_list_insert(Ifx_blob,Informix_GLOBAL(php3_ifx_module).le_idresult); } @@ -3503,7 +3614,7 @@ static long php3_intifx_free_blob(long bid, HashTable *list) { int type; Ifx_blob = (IFX_IDRES *) php3_list_find(bid,&type); - if (type!=IFXG(le_idresult) && !(Ifx_blob->type==TYPE_BLTEXT || Ifx_blob->type==TYPE_BLBYTE)) { + if (type!=Informix_GLOBAL(php3_ifx_module).le_idresult && !(Ifx_blob->type==TYPE_BLTEXT || Ifx_blob->type==TYPE_BLBYTE)) { php3_error(E_WARNING,"%d is not a Informix blob-result index", bid); return -1; @@ -3545,7 +3656,7 @@ static long php3_intifx2_free_blob(long bid, HashTable *list) { int type; Ifx_blob = (IFX_IDRES *) php3_list_find(bid,&type); - if (type!=IFXG(le_idresult) && !(Ifx_blob->type==TYPE_BLTEXT || Ifx_blob->type==TYPE_BLBYTE)) { + if (type!=Informix_GLOBAL(php3_ifx_module).le_idresult && !(Ifx_blob->type==TYPE_BLTEXT || Ifx_blob->type==TYPE_BLBYTE)) { php3_error(E_WARNING,"%d is not a Informix blob-result index", bid); return -1; @@ -3620,7 +3731,7 @@ static long php3_intifx_get_blob(long bid, HashTable *list, char** content) { int type; Ifx_blob = (IFX_IDRES *) php3_list_find(bid,&type); - if (type!=IFXG(le_idresult) && !(Ifx_blob->type==TYPE_BLTEXT || Ifx_blob->type==TYPE_BLBYTE)) { + if (type!=Informix_GLOBAL(php3_ifx_module).le_idresult && !(Ifx_blob->type==TYPE_BLTEXT || Ifx_blob->type==TYPE_BLBYTE)) { php3_error(E_WARNING,"%d is not a Informix blob-result index", bid); return -1; @@ -3650,7 +3761,7 @@ static loc_t *php3_intifx_get_blobloc(long bid, HashTable *list) { int type; Ifx_blob = (IFX_IDRES *) php3_list_find(bid,&type); - if (type!=IFXG(le_idresult) && !(Ifx_blob->type==TYPE_BLTEXT || Ifx_blob->type==TYPE_BLBYTE)) { + if (type!=Informix_GLOBAL(php3_ifx_module).le_idresult && !(Ifx_blob->type==TYPE_BLTEXT || Ifx_blob->type==TYPE_BLBYTE)) { php3_error(E_WARNING,"%d is not a Informix blob-result index", bid); return NULL; @@ -3713,7 +3824,7 @@ static long php3_intifx_update_blob(long bid, char* param, long len, HashTable * int type; Ifx_blob = (IFX_IDRES *) php3_list_find(bid,&type); - if (type!=IFXG(le_idresult) && !(Ifx_blob->type==TYPE_BLTEXT || Ifx_blob->type==TYPE_BLBYTE)) { + if (type!=Informix_GLOBAL(php3_ifx_module).le_idresult && !(Ifx_blob->type==TYPE_BLTEXT || Ifx_blob->type==TYPE_BLBYTE)) { php3_error(E_WARNING,"%d is not a Informix blob-result index", bid); return -1; @@ -3812,7 +3923,7 @@ PHP_FUNCTION(ifx_blobinfile_mode) { } convert_to_long(pmode); - IFXG(blobinfile)=pmode->value.lval; + Informix_GLOBAL(php3_ifx_module).blobinfile=pmode->value.lval; RETURN_TRUE; } /* }}} */ @@ -3840,7 +3951,7 @@ PHP_FUNCTION(ifx_textasvarchar) { } convert_to_long(pmode); - IFXG(textasvarchar)=pmode->value.lval; + Informix_GLOBAL(php3_ifx_module).textasvarchar=pmode->value.lval; RETURN_TRUE; } /* }}} */ @@ -3867,7 +3978,7 @@ PHP_FUNCTION(ifx_byteasvarchar) { } convert_to_long(pmode); - IFXG(byteasvarchar)=pmode->value.lval; + Informix_GLOBAL(php3_ifx_module).byteasvarchar=pmode->value.lval; RETURN_TRUE; } @@ -3894,7 +4005,7 @@ PHP_FUNCTION(ifx_nullformat) { } convert_to_long(pmode); - IFXG(nullformat)=pmode->value.lval; + Informix_GLOBAL(php3_ifx_module).nullformat=pmode->value.lval; RETURN_TRUE; } /* }}} */ @@ -3910,10 +4021,10 @@ PHP_FUNCTION(ifx_nullformat) { static char* php3_intifx_null() { char* tmp; - if(IFXG(nullformat)==0) { - tmp=IFXG(nullvalue); + if(Informix_GLOBAL(php3_ifx_module).nullformat==0) { + tmp=Informix_GLOBAL(php3_ifx_module).nullvalue; } else { - tmp=IFXG(nullstring); + tmp=Informix_GLOBAL(php3_ifx_module).nullstring; } return tmp; } @@ -3996,7 +4107,7 @@ static long php3_intifx_create_char(char* param, long len, HashTable *list) { Ifx_char->CHAR.char_data[len]=0; Ifx_char->CHAR.len=len; } - return php3_list_insert(Ifx_char,IFXG(le_idresult)); + return php3_list_insert(Ifx_char,Informix_GLOBAL(php3_ifx_module).le_idresult); } /* ---------------------------------------------------------------------- @@ -4047,7 +4158,7 @@ static long php3_intifx_get_char(long bid, HashTable *list, char** content) { int type; Ifx_char = (IFX_IDRES *) php3_list_find(bid,&type); - if (type!=IFXG(le_idresult) && !(Ifx_char->type==TYPE_CHAR)) { + if (type!=Informix_GLOBAL(php3_ifx_module).le_idresult && !(Ifx_char->type==TYPE_CHAR)) { php3_error(E_WARNING,"%d is not a Informix char-result index", bid); return -1; @@ -4101,7 +4212,7 @@ static long php3_intifx_free_char(long bid, HashTable *list) { int type; Ifx_char = (IFX_IDRES *) php3_list_find(bid,&type); - if (type!=IFXG(le_idresult) && !(Ifx_char->type==TYPE_CHAR)) { + if (type!=Informix_GLOBAL(php3_ifx_module).le_idresult && !(Ifx_char->type==TYPE_CHAR)) { php3_error(E_WARNING,"%d is not a Informix char-result index", bid); return -1; @@ -4168,7 +4279,7 @@ static long php3_intifx_update_char(long bid, char* param, long len, HashTable * int type; Ifx_char = (IFX_IDRES *) php3_list_find(bid,&type); - if (type!=IFXG(le_idresult) && !(Ifx_char->type==TYPE_CHAR)) { + if (type!=Informix_GLOBAL(php3_ifx_module).le_idresult && !(Ifx_char->type==TYPE_CHAR)) { php3_error(E_WARNING,"%d is not a Informix char-result index", bid); return -1; @@ -4313,7 +4424,7 @@ static long php3_intifxus_create_slob(long create_mode, HashTable *list) { return -1; } - return php3_list_insert(Ifx_slob,IFXG(le_idresult)); + return php3_list_insert(Ifx_slob,Informix_GLOBAL(php3_ifx_module).le_idresult); } @@ -4362,7 +4473,7 @@ static long php3_intifxus_free_slob(long bid, HashTable *list) { int type; Ifx_slob = (IFX_IDRES *) php3_list_find(bid,&type); - if (type!=IFXG(le_idresult) || Ifx_slob->type!=TYPE_SLOB) { + if (type!=Informix_GLOBAL(php3_ifx_module).le_idresult || Ifx_slob->type!=TYPE_SLOB) { php3_error(E_WARNING,"%d is not a Informix slob-result index", bid); return -1; @@ -4428,7 +4539,7 @@ static long php3_intifxus_close_slob(long bid, HashTable *list) { int type; Ifx_slob = (IFX_IDRES *) php3_list_find(bid,&type); - if (type!=IFXG(le_idresult) || Ifx_slob->type!=TYPE_SLOB) { + if (type!=Informix_GLOBAL(php3_ifx_module).le_idresult || Ifx_slob->type!=TYPE_SLOB) { php3_error(E_WARNING,"%d is not a Informix slob-result index", bid); return -1; @@ -4513,7 +4624,7 @@ static long php3_intifxus_open_slob(long bid, long create_mode, HashTable *list) Ifx_slob = (IFX_IDRES *) php3_list_find(bid,&type); - if (type!=IFXG(le_idresult) || Ifx_slob->type!=TYPE_SLOB) { + if (type!=Informix_GLOBAL(php3_ifx_module).le_idresult || Ifx_slob->type!=TYPE_SLOB) { php3_error(E_WARNING,"%d is not a Informix slob-result index", bid); return -1; @@ -4562,7 +4673,7 @@ static long php3_intifxus_new_slob(HashTable *list) { Ifx_slob->type=TYPE_SLOB; Ifx_slob->SLOB.lofd=-1; Ifx_slob->SLOB.createspec=NULL; - return php3_list_insert(Ifx_slob,IFXG(le_idresult)); + return php3_list_insert(Ifx_slob,Informix_GLOBAL(php3_ifx_module).le_idresult); } @@ -4581,7 +4692,7 @@ static ifx_lo_t *php3_intifxus_get_slobloc(long bid, HashTable *list) { int errcode, type; Ifx_slob = (IFX_IDRES *) php3_list_find(bid,&type); - if (type!=IFXG(le_idresult) || Ifx_slob->type!=TYPE_SLOB) { + if (type!=Informix_GLOBAL(php3_ifx_module).le_idresult || Ifx_slob->type!=TYPE_SLOB) { php3_error(E_WARNING,"%d is not a Informix slob-result index", bid); return NULL; @@ -4621,7 +4732,7 @@ PHP_FUNCTION(ifxus_tell_slob) { convert_to_long(pbid); bid=pbid->value.lval; Ifx_slob = (IFX_IDRES *) php3_list_find(bid,&type); - if (type!=IFXG(le_idresult) || Ifx_slob->type!=TYPE_SLOB) { + if (type!=Informix_GLOBAL(php3_ifx_module).le_idresult || Ifx_slob->type!=TYPE_SLOB) { php3_error(E_WARNING,"%d is not a Informix slob-result index", bid); RETURN_FALSE; @@ -4671,7 +4782,7 @@ PHP_FUNCTION(ifxus_seek_slob) { bid=pbid->value.lval; Ifx_slob = (IFX_IDRES *) php3_list_find(bid,&type); - if (type!=IFXG(le_idresult) || Ifx_slob->type!=TYPE_SLOB) { + if (type!=Informix_GLOBAL(php3_ifx_module).le_idresult || Ifx_slob->type!=TYPE_SLOB) { php3_error(E_WARNING,"%d is not a Informix slob-result index", bid); RETURN_FALSE; @@ -4730,7 +4841,7 @@ PHP_FUNCTION(ifxus_read_slob) { bid=pbid->value.lval; Ifx_slob = (IFX_IDRES *) php3_list_find(bid,&type); - if (type!=IFXG(le_idresult) || Ifx_slob->type!=TYPE_SLOB) { + if (type!=Informix_GLOBAL(php3_ifx_module).le_idresult || Ifx_slob->type!=TYPE_SLOB) { php3_error(E_WARNING,"%d is not a Informix slob-result index", bid); RETURN_FALSE; @@ -4781,7 +4892,7 @@ PHP_FUNCTION(ifxus_write_slob) { bid=pbid->value.lval; Ifx_slob = (IFX_IDRES *) php3_list_find(bid,&type); - if (type!=IFXG(le_idresult) || Ifx_slob->type!=TYPE_SLOB) { + if (type!=Informix_GLOBAL(php3_ifx_module).le_idresult || Ifx_slob->type!=TYPE_SLOB) { php3_error(E_WARNING,"%d is not a Informix slob-result index", bid); RETURN_FALSE; diff --git a/ext/informix/php_informix.h b/ext/informix/php_informix.h index 264e362623..ae409bb4f9 100644 --- a/ext/informix/php_informix.h +++ b/ext/informix/php_informix.h @@ -40,36 +40,22 @@ #define HAVE_IFX 1 #endif -#if WIN32||WINNT -#define PHP_IFX_API __declspec(dllexport) -#else -#define PHP_IFX_API -#endif - - -#if HAVE_IFX /* with Informix */ - +#if HAVE_IFX #ifndef DLEXPORT #define DLEXPORT #endif -#ifdef ZTS -#include "TSRM.h" -#endif +#include "locator.h" +#include "sqltypes.h" + extern php3_module_entry ifx_module_entry; #define ifx_module_ptr &ifx_module_entry - -#include "locator.h" -#include "sqltypes.h" - -/* user functions */ extern int php3_minit_ifx(INIT_FUNC_ARGS); extern int php3_rinit_ifx(INIT_FUNC_ARGS); extern int php3_mshutdown_ifx(SHUTDOWN_FUNC_ARGS); void php3_info_ifx(ZEND_MODULE_INFO_FUNC_ARGS); -/* functions common to all Informix versions */ PHP_FUNCTION(ifx_connect); PHP_FUNCTION(ifx_pconnect); PHP_FUNCTION(ifx_close); @@ -87,7 +73,7 @@ PHP_FUNCTION(ifx_htmltbl_result); PHP_FUNCTION(ifx_fieldtypes); PHP_FUNCTION(ifx_fieldproperties); PHP_FUNCTION(ifx_getsqlca); -/* BLOB related stuff, IDS & IUS only */ + PHP_FUNCTION(ifx_create_blob); PHP_FUNCTION(ifx_free_blob) ; PHP_FUNCTION(ifx_get_blob); @@ -97,12 +83,13 @@ PHP_FUNCTION(ifx_copy_blob); PHP_FUNCTION(ifx_textasvarchar); PHP_FUNCTION(ifx_byteasvarchar); PHP_FUNCTION(ifx_nullformat); + PHP_FUNCTION(ifx_create_char); PHP_FUNCTION(ifx_free_char) ; PHP_FUNCTION(ifx_update_char); PHP_FUNCTION(ifx_get_char); -/* SLOB, CLOB : IUS only functions */ + #if HAVE_IFX_IUS PHP_FUNCTION(ifxus_create_slob); PHP_FUNCTION(ifxus_free_slob) ; @@ -131,36 +118,11 @@ typedef struct { long nullformat; /* 0=NULL as "", 1= NULL as "NULL" */ char *nullvalue; /* "" */ char *nullstring; /* "NULL" */ -} php_ifx_globals; /* formerly "ifx_module" in the php3 version */ - -#ifndef ZTS -extern php_ifx_globals ifx_globals; -#endif - -#ifdef ZTS -# define IFXLS_D php_ifx_globals *ifx_globals -# define IFXLS_DC , IFXLS_D -# define IFXLS_C ifx_globals -# define IFXLS_CC , IFXLS_C -# define IFXG(v) (ifx_globals->v) -# define IFXLS_FETCH() php_ifx_globals *ifx_globals = ts_resource(ifx_globals_id) -# define IFX_TLS_VARS char *globals; IFXLS_FETCH(); globals = (char *)ifx_globals; -#else -# define IFXLS_D -# define IFXLS_DC -# define IFXLS_C -# define IFXLS_CC -# define IFXG(v) (ifx_globals.v) -# define IFXLS_FETCH() -# define IFX_TLS_VARS char *globals = (char *)&ifx_globals -extern ZEND_API php_ifx_globals ifx_globals; -#endif - +} ifx_module; #define MAX_RESID 64 #define BLOBINFILE 0 /* 0=in memory, 1=in file */ -/* query result set data */ typedef struct ifx_res { char connecid[16]; char cursorid[16]; @@ -212,12 +174,18 @@ typedef struct _IFX_IDRES { #endif -#else /* not HAVE_IFX */ -#define ifx_module_ptr NULL + + +#ifndef THREAD_SAFE +extern ifx_module php3_ifx_module; #endif -#define phpext_informix_ptr ifx_module_ptr +#else + +#define ifx_module_ptr NULL + +#endif #endif /* _PHP3_IFX_H */ diff --git a/ext/msql/config.m4 b/ext/msql/config.m4 index 3ed38f3e46..25694d1b09 100644 --- a/ext/msql/config.m4 +++ b/ext/msql/config.m4 @@ -6,7 +6,7 @@ dnl AC_DEFUN(AC_MSQL_VERSION,[ AC_MSG_CHECKING([mSQL version]) ac_php_oldcflags=$CFLAGS - CFLAGS="$INCLUDES $CFLAGS" + CFLAGS="$INCLUDES $CFLAGS"; AC_TRY_COMPILE([#include <sys/types.h> #include "msql.h"],[int i = IDX_TYPE],[ AC_DEFINE(MSQL1,0) diff --git a/ext/msql/msql.c b/ext/msql/msql.c index 466df9ee15..aab491ef36 100644 --- a/ext/msql/msql.c +++ b/ext/msql/msql.c @@ -450,8 +450,7 @@ static int php3_msql_get_default_link(INTERNAL_FUNCTION_PARAMETERS) { MSQL_TLS_VARS; if (MSQL_GLOBAL(php3_msql_module).default_link==-1) { /* no link opened yet, implicitly open one */ - ht = 0; - php3_msql_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); + php3_msql_do_connect(0, return_value, list, plist, this_ptr,0); } return MSQL_GLOBAL(php3_msql_module).default_link; } diff --git a/ext/mysql/mysql.c b/ext/mysql/mysql.c index 319addc54e..6f0f1fec27 100644 --- a/ext/mysql/mysql.c +++ b/ext/mysql/mysql.c @@ -587,7 +587,6 @@ static void php3_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent) static int php3_mysql_get_default_link(INTERNAL_FUNCTION_PARAMETERS MySLS_DC) { if (MySG(default_link)==-1) { /* no link opened yet, implicitly open one */ - ht = 0; php3_mysql_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); } return MySG(default_link); @@ -1473,7 +1472,7 @@ PHP_FUNCTION(mysql_fetch_row) /* }}} */ -/* {{{ proto object mysql_fetch_object(int result [, int result_type]) +/* {{{ proto object mysql_fetch_object(int result) Fetch a result row as an object */ PHP_FUNCTION(mysql_fetch_object) { @@ -1487,7 +1486,7 @@ PHP_FUNCTION(mysql_fetch_object) /* }}} */ -/* {{{ proto array mysql_fetch_array(int result [, int result_type]) +/* {{{ proto array mysql_fetch_array(int result) Fetch a result row as an associative array */ PHP_FUNCTION(mysql_fetch_array) { diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index 6ca165694c..0e4c0e8f61 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -77,9 +77,6 @@ static int _php_free_pcre_cache(void *data) { pcre_cache_entry *pce = (pcre_cache_entry *) data; pefree(pce->re, 1); -#if HAVE_SETLOCALE - pefree((void*)pce->tables, 1); -#endif return 1; } @@ -166,10 +163,6 @@ static pcre* _pcre_get_compiled_regex(char *regex, pcre_extra *extra, int *preg_ int regex_len; int do_study = 0; int poptions = 0; - unsigned const char *tables = NULL; -#if HAVE_SETLOCALE - char *locale = setlocale(LC_CTYPE, NULL); -#endif pcre_cache_entry *pce; pcre_cache_entry new_entry; PCRE_LS_FETCH(); @@ -178,15 +171,9 @@ static pcre* _pcre_get_compiled_regex(char *regex, pcre_extra *extra, int *preg_ back the compiled pattern, otherwise go on and compile it. */ regex_len = strlen(regex); if (zend_hash_find(&PCRE_G(pcre_cache), regex, regex_len+1, (void **)&pce) == SUCCESS) { -#if HAVE_SETLOCALE - if (!strcmp(pce->locale, locale)) { -#endif - extra = pce->extra; - *preg_options = pce->preg_options; - return pce->re; -#if HAVE_SETLOCALE - } -#endif + extra = pce->extra; + *preg_options = pce->preg_options; + return pce->re; } p = regex; @@ -231,7 +218,7 @@ static pcre* _pcre_get_compiled_regex(char *regex, pcre_extra *extra, int *preg_ *preg_options = 0; /* Parse through the options, setting appropriate flags. Display - a warning if we encounter an unknown modifier. */ + a warning if we encounter an unknown option. */ while (*pp != 0) { switch (*pp++) { /* Perl compatible options */ @@ -255,23 +242,18 @@ static pcre* _pcre_get_compiled_regex(char *regex, pcre_extra *extra, int *preg_ break; default: - zend_error(E_WARNING, "Unknown modifier '%c'", pp[-1]); + zend_error(E_WARNING, "Unknown option '%c'", pp[-1]); efree(pattern); return NULL; } } - -#if HAVE_SETLOCALE - if (strcmp(locale, "C")) - tables = pcre_maketables(); -#endif /* Compile pattern and display a warning if compilation failed. */ re = pcre_compile(pattern, coptions, &error, &erroffset, - tables); + NULL); if (re == NULL) { zend_error(E_WARNING, "Compilation failed: %s at offset %d\n", error, erroffset); @@ -296,10 +278,6 @@ static pcre* _pcre_get_compiled_regex(char *regex, pcre_extra *extra, int *preg_ new_entry.re = re; new_entry.extra = extra; new_entry.preg_options = poptions; -#if HAVE_SETLOCALE - new_entry.locale = locale; - new_entry.tables = tables; -#endif zend_hash_update(&PCRE_G(pcre_cache), regex, regex_len+1, (void *)&new_entry, sizeof(pcre_cache_entry), NULL); diff --git a/ext/pcre/php_pcre.h b/ext/pcre/php_pcre.h index c7f9043b05..a367da3bd4 100644 --- a/ext/pcre/php_pcre.h +++ b/ext/pcre/php_pcre.h @@ -35,9 +35,6 @@ #if HAVE_PCRE #include "pcrelib/pcre.h" -#if HAVE_LOCALE_H -#include <locale.h> -#endif extern void php_info_pcre(ZEND_MODULE_INFO_FUNC_ARGS); extern int php_minit_pcre(INIT_FUNC_ARGS); @@ -58,10 +55,6 @@ typedef struct { pcre *re; pcre_extra *extra; int preg_options; -#if HAVE_SETLOCALE - char *locale; - unsigned const char *tables; -#endif } pcre_cache_entry; typedef struct { diff --git a/ext/pgsql/config.m4 b/ext/pgsql/config.m4 index c40840cc3c..bd83c2794e 100644 --- a/ext/pgsql/config.m4 +++ b/ext/pgsql/config.m4 @@ -12,7 +12,6 @@ AC_ARG_WITH(pgsql, else PGSQL_INCDIR=$withval/include test -d $withval/include/pgsql && PGSQL_INCDIR=$withval/include/pgsql - test -d $withval/include/postgresql && PGSQL_INCDIR=$withval/include/postgresql PGSQL_LIBDIR=$withval/lib test -d $withval/lib/pgsql && PGSQL_LIBDIR=$withval/lib/pgsql fi diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c index 4738a21a93..2e4412c3fd 100644 --- a/ext/pgsql/pgsql.c +++ b/ext/pgsql/pgsql.c @@ -351,13 +351,15 @@ void php3_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent) int php3_pgsql_get_default_link(INTERNAL_FUNCTION_PARAMETERS) { if (php3_pgsql_module.default_link==-1) { /* no link opened yet, implicitly open one */ - ht = 0; + HashTable tmp; + + _php3_hash_init(&tmp,0,NULL,NULL,0); php3_pgsql_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU,0); + _php3_hash_destroy(&tmp); } return php3_pgsql_module.default_link; } - /* {{{ proto int pg_connect([string connection_string] | [string host, string port, [string options, [string tty,]] string database) Open a PostgreSQL connection */ PHP_FUNCTION(pgsql_connect) @@ -953,7 +955,7 @@ PHP_FUNCTION(pgsql_fetch_row) /* }}} */ /* ?? This is a rather odd function - why not just point pg_fetcharray() directly at fetch_hash ? -RL */ -/* {{{ proto array pg_fetch_array(int result, int row [, int result_type]) +/* {{{ proto array pg_fetch_array(int result, int row) Fetch a row as an array */ PHP_FUNCTION(pgsql_fetch_array) { @@ -961,7 +963,7 @@ PHP_FUNCTION(pgsql_fetch_array) } /* }}} */ -/* {{{ proto object pg_fetch_object(int result, int row [, int result_type]) +/* {{{ proto object pg_fetch_object(int result, int row) Fetch a row as an object */ PHP_FUNCTION(pgsql_fetch_object) { diff --git a/ext/session/session.c b/ext/session/session.c index f6614da409..eb5fd00023 100644 --- a/ext/session/session.c +++ b/ext/session/session.c @@ -13,7 +13,6 @@ | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: Sascha Schumann <ss@2ns.de> | - | Andrey Zmievski <andrey@ispi.net> | +----------------------------------------------------------------------+ */ @@ -327,21 +326,17 @@ static void _php_session_start(PSLS_D) { pval **ppid; pval **data; - char *p; int send_cookie = 1; int define_sid = 1; int module_number = PS(module_number); int nrand; - int lensess; ELS_FETCH(); if (PS(nr_open_sessions) > 0) return; - lensess = strlen(PS(session_name)); - if(!PS(id) && zend_hash_find(&EG(symbol_table), PS(session_name), - lensess + 1, (void **) &ppid) == SUCCESS) { + strlen(PS(session_name)) + 1, (void **) &ppid) == SUCCESS) { convert_to_string((*ppid)); PS(id) = estrndup((*ppid)->value.str.val, (*ppid)->value.str.len); send_cookie = 0; @@ -352,22 +347,9 @@ static void _php_session_start(PSLS_D) sizeof("HTTP_COOKIE_VARS"), (void **) &data) == SUCCESS && (*data)->type == IS_ARRAY && zend_hash_find((*data)->value.ht, PS(session_name), - lensess + 1, (void **) &ppid) == SUCCESS) { + strlen(PS(session_name)) + 1, (void **) &ppid) == SUCCESS) { define_sid = 0; } - - if(!PS(id) && - zend_hash_find(&EG(symbol_table), "REQUEST_URI", - sizeof("REQUEST_URI"), (void **) &data) == SUCCESS && - (*data)->type == IS_STRING && - (p = strstr((*data)->value.str.val, PS(session_name))) && - p[lensess] == '=') { - char *q; - - p += lensess + 1; - if((q = strpbrk(p, "/?\\"))) - PS(id) = estrndup(p, q - p); - } if(!PS(id)) { PS(id) = _php_create_id(NULL); diff --git a/ext/snmp/config.m4 b/ext/snmp/config.m4 index 1608331b56..c39d77908e 100644 --- a/ext/snmp/config.m4 +++ b/ext/snmp/config.m4 @@ -12,7 +12,6 @@ AC_ARG_WITH(snmp, SNMP_LIBDIR=/usr/local/lib test -d /usr/local/include/ucd-snmp && SNMP_INCDIR=/usr/local/include/ucd-snmp test -d /usr/include/ucd-snmp && SNMP_INCDIR=/usr/include/ucd-snmp - test -d /usr/include/snmp && SNMP_INCDIR=/usr/include/snmp test -f /usr/lib/libsnmp.a && SNMP_LIBDIR=/usr/lib else SNMP_INCDIR=$withval/include diff --git a/ext/standard/base64.c b/ext/standard/base64.c index d0a565fde4..70675d14e3 100644 --- a/ext/standard/base64.c +++ b/ext/standard/base64.c @@ -71,24 +71,8 @@ unsigned char *_php3_base64_encode(const unsigned char *string, int length, int unsigned char *_php3_base64_decode(const unsigned char *string, int length, int *ret_length) { const unsigned char *current = string; int ch, i = 0, j = 0, k; - /* this sucks for threaded environments */ - static short reverse_table[256]; - static int table_built; - unsigned char *result; - - if (++table_built == 1) { - char *chp; - for(ch = 0; ch < 256; ch++) { - chp = strchr(base64_table, ch); - if(chp) { - reverse_table[ch] = chp - base64_table; - } else { - reverse_table[ch] = -1; - } - } - } - result = (unsigned char *)emalloc((length / 4 * 3 + 1) * sizeof(char)); + unsigned char *result = (unsigned char *)emalloc((length / 4 * 3 + 1) * sizeof(char)); if (result == NULL) { return NULL; } @@ -96,8 +80,9 @@ unsigned char *_php3_base64_decode(const unsigned char *string, int length, int /* run through the whole string, converting as we go */ while ((ch = *current++) != '\0') { if (ch == base64_pad) break; - ch = reverse_table[ch]; - if (ch < 0) continue; + ch = (int)strchr(base64_table, ch); + if (ch == 0) continue; + ch -= (int)base64_table; switch(i % 4) { case 0: diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 3f445804a0..4ff386f0cd 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -284,7 +284,6 @@ function_entry basic_functions[] = { PHP_FE(print_r, NULL) {"setcookie", php3_SetCookie, NULL}, {"header", php3_Header, NULL}, - PHP_FE(headers_sent, NULL) PHP_FE(function_exists, NULL) PHP_FE(in_array, NULL) PHP_FE(extract, NULL) @@ -1414,7 +1413,7 @@ static int _php3_array_walk(const void *a) pval retval; CLS_FETCH(); - args[0] = *((pval **)a); + args[0] = (pval *)a; call_user_function(CG(function_table), NULL, php3_array_walk_func_name, &retval, 1, args); return 0; diff --git a/ext/standard/datetime.c b/ext/standard/datetime.c index 99038e0bd5..9be3bc80ae 100644 --- a/ext/standard/datetime.c +++ b/ext/standard/datetime.c @@ -60,8 +60,6 @@ static int phpday_tab[2][12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31} }; -#define isleap(year) (((year%4) == 0 && (year%100)!=0) || (year%400)==0) - PHP_FUNCTION(time) { return_value->value.lval = (long) time(NULL); @@ -144,7 +142,7 @@ _php3_date(INTERNAL_FUNCTION_PARAMETERS, int gm) pval *format, *timestamp; time_t the_time; struct tm *ta; - int i, size = 0, length, h, beat; + int i, size = 0, length, h; char tmp_buff[16]; switch(ARG_COUNT(ht)) { @@ -183,45 +181,33 @@ _php3_date(INTERNAL_FUNCTION_PARAMETERS, int gm) break; case 'F': /* month, textual, full */ case 'l': /* day (of the week), textual */ - case 'T': /* timezone name */ size += 9; break; - case 'Z': /* timezone offset in seconds */ - size += 6; - break; case 'Y': /* year, numeric, 4 digits */ size += 4; break; case 'M': /* month, textual, 3 letters */ case 'D': /* day, textual, 3 letters */ - case 'z': /* day of the year, 1 to 366 */ + case 'z': /* day of the year */ size += 3; break; case 'y': /* year, numeric, 2 digits */ case 'm': /* month, numeric */ - case 'n': /* month, numeric, no leading zeroes */ case 'd': /* day of the month, numeric */ case 'j': /* day of the month, numeric, no leading zeros */ case 'H': /* hour, numeric, 24 hour format */ case 'h': /* hour, numeric, 12 hour format */ - case 'G': /* hour, numeric, 24 hour format, no leading zeroes */ - case 'g': /* hour, numeric, 12 hour format, no leading zeroes */ case 'i': /* minutes, numeric */ case 's': /* seconds, numeric */ case 'A': /* AM/PM */ case 'a': /* am/pm */ case 'S': /* standard english suffix for the day of the month (e.g. 3rd, 2nd, etc) */ - case 't': /* days in current month */ size += 2; break; case '\\': if(i < format->value.str.len-1) { i++; } - case 'L': /* boolean for leap year */ - case 'B': /* Swatch Beat, 3 digits */ - size += 3; - break; case 'w': /* day of the week, numeric */ default: size++; @@ -275,10 +261,6 @@ _php3_date(INTERNAL_FUNCTION_PARAMETERS, int gm) sprintf(tmp_buff, "%02d", ta->tm_mon + 1); /* SAFE */ strcat(return_value->value.str.val, tmp_buff); break; - case 'n': /* month, numeric, no leading zeros */ - sprintf(tmp_buff, "%d", ta->tm_mon + 1); /* SAFE */ - strcat(return_value->value.str.val, tmp_buff); - break; case 'd': /* day of the month, numeric */ sprintf(tmp_buff, "%02d", ta->tm_mday); /* SAFE */ strcat(return_value->value.str.val, tmp_buff); @@ -296,15 +278,6 @@ _php3_date(INTERNAL_FUNCTION_PARAMETERS, int gm) sprintf(tmp_buff, "%02d", h); /* SAFE */ strcat(return_value->value.str.val, tmp_buff); break; - case 'G': /* hour, numeric, 24 hour format, no leading zeros */ - sprintf(tmp_buff, "%d", ta->tm_hour); /* SAFE */ - strcat(return_value->value.str.val, tmp_buff); - break; - case 'g': /* hour, numeric, 12 hour format, no leading zeros */ - h = ta->tm_hour % 12; if (h==0) h = 12; - sprintf(tmp_buff, "%d", h); /* SAFE */ - strcat(return_value->value.str.val, tmp_buff); - break; case 'i': /* minutes, numeric */ sprintf(tmp_buff, "%02d", ta->tm_min); /* SAFE */ strcat(return_value->value.str.val, tmp_buff); @@ -339,40 +312,10 @@ _php3_date(INTERNAL_FUNCTION_PARAMETERS, int gm) } } break; - case 't': /* days in current month */ - sprintf(tmp_buff, "%2d", phpday_tab[isleap((ta->tm_year+1900))][ta->tm_mon] ); - strcat(return_value->value.str.val, tmp_buff); - break; case 'w': /* day of the week, numeric EXTENSION */ sprintf(tmp_buff, "%01d", ta->tm_wday); /* SAFE */ strcat(return_value->value.str.val, tmp_buff); break; - case 'Z': /* timezone offset in seconds */ -#if HAVE_TM_GMTOFF - sprintf(tmp_buff, "%ld", ta->tm_gmtoff ); -#else - sprintf(tmp_buff, "%ld", timezone); -#endif - strcat(return_value->value.str.val, tmp_buff); - break; - case 'L': /* boolean for leapyear */ - sprintf(tmp_buff, "%d", (isleap((ta->tm_year+1900)) ? 1 : 0 ) ); - strcat(return_value->value.str.val, tmp_buff); - break; - case 'T': /* timezone name */ -#if HAVE_TM_ZONE - strcat(return_value->value.str.val, ta->tm_zone); -#else - strcat(return_value->value.str.val, tzname[0]); -#endif - break; - case 'B': /* Swatch Beat a.k.a. Internet Time */ - beat = (((((long)the_time)-(((long)the_time) - - ((((long)the_time) % 86400) + 3600))) * 10) / 864); - if (beat > 999) beat = 0; - sprintf(tmp_buff, "%03d", beat); /* SAFE */ - strcat(return_value->value.str.val, tmp_buff); - break; default: length = strlen(return_value->value.str.val); return_value->value.str.val[length] = format->value.str.val[i]; diff --git a/ext/standard/exec.c b/ext/standard/exec.c index 87eaddadbf..c1bcb609ed 100644 --- a/ext/standard/exec.c +++ b/ext/standard/exec.c @@ -41,20 +41,12 @@ static int _Exec(int type, char *cmd, pval *array, pval *return_value) { FILE *fp; - char *buf, *tmp=NULL; - int buflen = 0; + char buf[EXEC_INPUT_BUF], *tmp=NULL; int t, l, ret, output=1; int overflow_limit, lcmd, ldir; char *b, *c, *d=NULL; PLS_FETCH(); - buf = (char*) emalloc(EXEC_INPUT_BUF); - if (!buf) { - php3_error(E_WARNING, "Unable to emalloc %d bytes for exec buffer", EXEC_INPUT_BUF); - return -1; - } - buflen = EXEC_INPUT_BUF; - if (PG(safe_mode)) { lcmd = strlen(cmd); ldir = strlen(PG(safe_mode_exec_dir)); @@ -64,7 +56,6 @@ static int _Exec(int type, char *cmd, pval *array, pval *return_value) if (c) *c = '\0'; if (strstr(cmd, "..")) { php3_error(E_WARNING, "No '..' components allowed in path"); - efree(buf); return -1; } d = emalloc(l); @@ -94,7 +85,6 @@ static int _Exec(int type, char *cmd, pval *array, pval *return_value) if (!fp) { php3_error(E_WARNING, "Unable to fork [%s]", d); efree(d); - efree(buf); return -1; } } else { /* not safe_mode */ @@ -105,7 +95,6 @@ static int _Exec(int type, char *cmd, pval *array, pval *return_value) #endif if (!fp) { php3_error(E_WARNING, "Unable to fork [%s]", cmd); - efree(buf); return -1; } } @@ -117,33 +106,7 @@ static int _Exec(int type, char *cmd, pval *array, pval *return_value) } } if (type != 3) { - l=0; - while ( !feof(fp) || l != 0 ) { - l = 0; - /* Read a line or fill the buffer, whichever comes first */ - do { - if ( buflen <= (l+1) ) { - buf = erealloc(buf, buflen + EXEC_INPUT_BUF); - if ( buf == NULL ) { - php3_error(E_WARNING, "Unable to erealloc %d bytes for exec buffer", - buflen + EXEC_INPUT_BUF); - return -1; - } - buflen += EXEC_INPUT_BUF; - } - - if ( fgets(&(buf[l]), buflen - l, fp) == NULL ) { - /* eof */ - break; - } - l += strlen(&(buf[l])); - } while ( (l > 0) && (buf[l-1] != '\n') ); - - if ( feof(fp) && (l == 0) ) { - break; - } - - + while (fgets(buf, EXEC_INPUT_BUF - 1, fp)) { if (type == 1) { SLS_FETCH(); @@ -169,7 +132,7 @@ static int _Exec(int type, char *cmd, pval *array, pval *return_value) /* strip trailing whitespaces */ l = strlen(buf); t = l; - while (l-- && isspace((int)buf[l])); + while (l && isspace((int)buf[--l])); if (l < t) { buf[l + 1] = '\0'; } @@ -210,7 +173,6 @@ static int _Exec(int type, char *cmd, pval *array, pval *return_value) #endif if (d) efree(d); - efree(buf); return ret; } diff --git a/ext/standard/fsock.c b/ext/standard/fsock.c index cc000f42b4..ab19214dec 100644 --- a/ext/standard/fsock.c +++ b/ext/standard/fsock.c @@ -20,7 +20,6 @@ /* $Id$ */ /* Synced with php3 revision 1.121 1999-06-18 [ssb] */ -/* Synced with php3 revision 1.133 1999-07-21 [sas] */ #include "php.h" #include "php_globals.h" @@ -71,9 +70,6 @@ extern int le_fp; #define FREE_SOCK if(socketd >= 0) close(socketd); efree(sock); if (key) efree(key) -#define SEARCHCR \ - p = memchr(READPTR(sock), '\n', MIN(TOREAD(sock), maxlen - 1)); - #if WIN32|WINNT #define EWOULDBLOCK WSAEWOULDBLOCK #else @@ -237,7 +233,6 @@ static void _php3_fsockopen(INTERNAL_FUNCTION_PARAMETERS, int persistent) { int socketd = -1; struct timeval timeout = { 60, 0 }; unsigned short portno; - unsigned long conv; char *key = NULL; PLS_FETCH(); @@ -247,10 +242,8 @@ static void _php3_fsockopen(INTERNAL_FUNCTION_PARAMETERS, int persistent) { } switch(arg_count) { case 5: - convert_to_double(args[4]); - conv = args[4]->value.dval * 1000000.0; - timeout.tv_sec = conv / 1000000; - timeout.tv_usec = conv % 1000000; + convert_to_long(args[4]); + timeout.tv_sec = args[4]->value.lval; /* fall-through */ case 4: if(!ParameterPassedByReference(ht,4)) { @@ -278,7 +271,7 @@ static void _php3_fsockopen(INTERNAL_FUNCTION_PARAMETERS, int persistent) { if (persistent && _php3_hash_find(&PG(ht_fsock_keys), key, strlen(key) + 1, (void *) &sockp) == SUCCESS) { - FREE_SOCK; + efree(key); *sock = *sockp; RETURN_LONG(php3_list_insert(sock, wsa_fp)); } @@ -362,14 +355,14 @@ static void _php3_fsockopen(INTERNAL_FUNCTION_PARAMETERS, int persistent) { } /* }}} */ -/* {{{ proto int fsockopen(string hostname, int port [, int errno [, string errstr [, double timeout]]]) +/* {{{ proto int fsockopen(string hostname, int port [, int errno [, string errstr]]) Open Internet or Unix domain socket connection */ PHP_FUNCTION(fsockopen) { _php3_fsockopen(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); } /* }}} */ -/* {{{ proto int pfsockopen(string hostname, int port [, int errno [, string errstr [, double timeout]]]) +/* {{{ proto int pfsockopen(string hostname, int port [, int errno [, string errstr]]) Open persistent Internet or Unix domain socket connection */ PHP_FUNCTION(pfsockopen) { @@ -377,7 +370,40 @@ PHP_FUNCTION(pfsockopen) } /* }}} */ -#define CHUNK_SIZE 8192 +/* Known issues with the socket buffering code: + * - does not work reliably with persistent sockets yet + * (buffered data is not persistent) + * - php3_fopen_url_wrapper() is still doing single-byte lookahead/read + */ + +static php3i_sockbuf *_php3_sock_findsock(int socket) +{ + /* FIXME: O(n) could be improved */ + + php3i_sockbuf *buf = NULL, *tmp; + + for(tmp = phpsockbuf; tmp; tmp = tmp->next) + if(tmp->socket == socket) { + buf = tmp; + break; + } + + return buf; +} + +int _php3_sock_eof(int socket) +{ + php3i_sockbuf *sockbuf; + int ret = 0; + + sockbuf = _php3_sock_findsock(socket); + if(sockbuf) { + ret = (sockbuf->writepos - sockbuf->readpos) == 0 ? 1 : 0; + } + return ret; +} + +#define CHUNK_SIZE 2048 #define SOCK_DESTROY(sock) \ if(sock->readbuf) pefree(sock->readbuf, sock->persistent); \ if(sock->prev) sock->prev->next = sock->next; \ @@ -412,12 +438,12 @@ static php3i_sockbuf *_php3_sock_find(int socket) { php3i_sockbuf *buf = NULL, *tmp; - for(tmp = phpsockbuf; tmp; tmp = tmp->next) - if(tmp->socket == socket) { + for (tmp = phpsockbuf; tmp; tmp = tmp->next) { + if (tmp->socket == socket) { buf = tmp; break; } - + } return buf; } @@ -428,8 +454,9 @@ static php3i_sockbuf *_php3_sock_create(int socket) sock = pecalloc(sizeof(*sock), 1, persistent); sock->socket = socket; - if((sock->next = phpsockbuf)) + if ((sock->next = phpsockbuf)) { phpsockbuf->prev = sock; + } sock->persistent = persistent; sock->is_blocked = 1; sock->chunk_size = def_chunk_size; @@ -444,8 +471,9 @@ size_t _php3_sock_set_def_chunk_size(size_t size) old = def_chunk_size; - if(size <= CHUNK_SIZE || size > 0) + if (size <= CHUNK_SIZE || size > 0) { def_chunk_size = size; + } return old; } @@ -456,7 +484,7 @@ int _php3_sock_destroy(int socket) php3i_sockbuf *sock; sock = _php3_sock_find(socket); - if(sock) { + if (sock) { ret = 1; SOCK_DESTROY(sock); } @@ -464,31 +492,24 @@ int _php3_sock_destroy(int socket) return ret; } -#if !defined(WIN32) && !defined(WINNT) -#undef closesocket -#define closesocket close -#endif - -#ifndef HAVE_SHUTDOWN -#undef shutdown -#define shutdown -#endif - -#define SOCK_CLOSE(s) shutdown(s, 0); closesocket(s) - int _php3_sock_close(int socket) { int ret = 0; php3i_sockbuf *sock; sock = _php3_sock_find(socket); - if(sock) { - if(!sock->persistent) { - SOCK_CLOSE(sock->socket); + if (sock) { + if (!sock->persistent) { +#if HAVE_SHUTDOWN + shutdown(sock->socket, 0); +#endif +#if WIN32||WINNT + closesocket(sock->socket); +#else + close(sock->socket); +#endif SOCK_DESTROY(sock); } - } else { - SOCK_CLOSE(socket); } return ret; @@ -503,64 +524,52 @@ static void _php3_sock_wait_for_data(php3i_sockbuf *sock) FD_ZERO(&fdr); FD_SET(sock->socket, &fdr); - while(1) { + while (1) { tfdr = fdr; - if(select(sock->socket + 1, &tfdr, NULL, NULL, NULL) == 1) + if(select(sock->socket + 1, &tfdr, NULL, NULL, NULL) == 1) { break; + } } } -static size_t _php3_sock_read_internal(php3i_sockbuf *sock) +static size_t _php3_sock_read_limited(php3i_sockbuf *sock, int maxread) { char buf[CHUNK_SIZE]; int nr_bytes; size_t nr_read = 0; - - /* For blocking sockets, we wait until there is some - data to read (real data or EOF) - - Otherwise, recv() may time out and return 0 and - therefore sock->eof would be set errornously. - */ - - if(sock->is_blocked) { + if (sock->eof || TOREAD(sock) >= maxread) { + return 0; + } + if (sock->is_blocked) { _php3_sock_wait_for_data(sock); } - /* read at a maximum sock->chunk_size */ nr_bytes = recv(sock->socket, buf, sock->chunk_size, 0); - if(nr_bytes > 0) { - if(sock->writepos + nr_bytes > sock->readbuflen) { + if (nr_bytes > 0) { + if (sock->writepos + nr_bytes > sock->readbuflen) { sock->readbuflen += sock->chunk_size; sock->readbuf = perealloc(sock->readbuf, sock->readbuflen, - sock->persistent); + sock->persistent); } memcpy(WRITEPTR(sock), buf, nr_bytes); sock->writepos += nr_bytes; nr_read = nr_bytes; - } else if(nr_bytes == 0 || (nr_bytes < 0 && errno != EWOULDBLOCK)) { + } else if (nr_bytes == 0 || (nr_bytes < 0 && errno != EWOULDBLOCK)) { sock->eof = 1; } return nr_read; } -static void _php3_sock_read_total(php3i_sockbuf *sock, size_t maxread) -{ - while(!sock->eof && TOREAD(sock) < maxread) { - _php3_sock_read_internal(sock); - } -} - static size_t _php3_sock_read(php3i_sockbuf *sock) { size_t nr_bytes; size_t nr_read = 0; int i; - - for(i = 0; !sock->eof && i < MAX_CHUNKS_PER_READ; i++) { - nr_bytes = _php3_sock_read_internal(sock); + + for (i = 0; !sock->eof && i < MAX_CHUNKS_PER_READ; i++) { + nr_bytes = _php3_sock_read_limited(sock, CHUNK_SIZE); if(nr_bytes == 0) break; nr_read += nr_bytes; } @@ -574,60 +583,64 @@ int _php3_sock_set_blocking(int socket, int mode) SOCK_FIND(sock, socket); old = sock->is_blocked; - + sock->is_blocked = mode; - + return old; } #define SOCK_FIND_AND_READ_MAX(max) \ - SOCK_FIND(sock, socket); \ - if(sock->is_blocked) _php3_sock_read_total(sock, max); else _php3_sock_read(sock) + SOCK_FIND(sock, socket); \ + if(sock->is_blocked) _php3_sock_read_limited(sock, max); else _php3_sock_read(sock) /* {{{ _php3_sock_fgets() */ /* - * FIXME: fgets depends on '\n' as line delimiter + * FIXME: fgets depends on '\n' as line delimiters */ char *_php3_sock_fgets(char *buf, size_t maxlen, int socket) { char *p = NULL; char *ret = NULL; size_t amount = 0; + size_t nr_read; + size_t nr_toread; SOCK_FIND(sock, socket); - SEARCHCR; + if (maxlen < 0) { + return ret; + } - if(!p) { - if(sock->is_blocked) { - while(!p && !sock->eof && TOREAD(sock) < maxlen - 1) { - _php3_sock_read_internal(sock); - SEARCHCR; + if (sock->is_blocked) { + nr_toread = 0; + for (nr_read = 1; !sock->eof && nr_read < maxlen; ) { + nr_read += _php3_sock_read_limited(sock, nr_toread); + if ((p = memchr(READPTR(sock), '\n', TOREAD(sock))) != NULL) { + break; } - } else { - _php3_sock_read(sock); - SEARCHCR; + nr_toread = 512; } + } else { + _php3_sock_read(sock); + p = memchr(READPTR(sock), '\n', MIN(TOREAD(sock), maxlen - 1)); } - - if(p) { + if (p) { amount = (ptrdiff_t) p - (ptrdiff_t) READPTR(sock) + 1; } else { - amount = TOREAD(sock); + amount = MIN(TOREAD(sock), maxlen - 1); } - - amount = MIN(amount, maxlen - 1); - if(amount > 0) { + if (amount > 0) { memcpy(buf, READPTR(sock), amount); sock->readpos += amount; } buf[amount] = '\0'; - - /* signal error only, if we don't return data from this call and + + /* signal error only, if we don't return data from this call and if there is no data to read and if the eof flag is set */ - if(amount || TOREAD(sock) || !sock->eof) + if (amount || TOREAD(sock) || !sock->eof) { ret = buf; + } return ret; } @@ -646,7 +659,7 @@ int _php3_sock_fgetc(int socket) int ret = EOF; SOCK_FIND_AND_READ_MAX(1); - if(TOREAD(sock) > 0) { + if (TOREAD(sock) > 0) { ret = *READPTR(sock); sock->readpos++; } @@ -659,11 +672,9 @@ int _php3_sock_feof(int socket) int ret = 0; SOCK_FIND(sock, socket); - if(!sock->is_blocked) - _php3_sock_read(sock); - - if(!TOREAD(sock) && sock->eof) + if (!TOREAD(sock) && sock->eof) { ret = 1; + } return ret; } @@ -675,11 +686,12 @@ size_t _php3_sock_fread(char *ptr, size_t size, int socket) size_t ret = 0; SOCK_FIND_AND_READ_MAX(size); - if(size < 0) + if (size < 0) { return ret; + } ret = MIN(TOREAD(sock), size); - if(ret) { + if (ret) { memcpy(ptr, READPTR(sock), ret); sock->readpos += ret; } diff --git a/ext/standard/head.c b/ext/standard/head.c index cfc6930f7d..f1bd0dcdc8 100644 --- a/ext/standard/head.c +++ b/ext/standard/head.c @@ -24,7 +24,6 @@ #include "main.h" #include "head.h" #include "post.h" -#include "SAPI.h" #ifdef TM_IN_SYS_TIME #include <sys/time.h> #else @@ -557,16 +556,6 @@ int php3_headers_unsent(void) } } -PHP_FUNCTION(headers_sent) -{ - SLS_FETCH(); - - if (SG(headers_sent)) { - RETURN_TRUE; - } else { - RETURN_FALSE; - } -} function_entry php3_header_functions[] = { {NULL, NULL, NULL} diff --git a/ext/standard/head.h b/ext/standard/head.h index a8096ecaca..977fc83345 100644 --- a/ext/standard/head.h +++ b/ext/standard/head.h @@ -55,7 +55,6 @@ extern php3_module_entry php3_header_module_entry; extern int php3_init_head(INIT_FUNC_ARGS); PHP_FUNCTION(Header); PHP_FUNCTION(SetCookie); -PHP_FUNCTION(headers_sent); void php4i_add_header_information(char *header_information, uint header_length); diff --git a/ext/standard/info.c b/ext/standard/info.c index eb87281301..fe4e55120e 100644 --- a/ext/standard/info.c +++ b/ext/standard/info.c @@ -310,7 +310,6 @@ void php_print_credits(int flag) CREDIT_LINE("Sybase", "Zeev Suraski"); CREDIT_LINE("System V Shared Memory", "Christian Cartus"); CREDIT_LINE("System V Semaphores", "Tom May"); - CREDIT_LINE("WDDX", "Andrey Zmievski"); CREDIT_LINE("XML", "Stig Bakken"); CREDIT_LINE("Yellow Pages", "Stephanie Wehner"); CREDIT_LINE("Zlib", "Rasmus Lerdorf, Stefan Ruhrich"); diff --git a/ext/standard/string.c b/ext/standard/string.c index 1836e2a4d6..e645cda6f6 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -1344,6 +1344,11 @@ PHPAPI void _php3_char_to_str(char *str,uint len,char from,char *to,int to_len,p *target = 0; } +#if 0 +/* + * this is a binary safe equivalent to strnstr + * note that we don't check for the end in str_to_str but here + */ static inline char * _php3_memnstr(char *haystack, char *needle, int needle_len, char *end) @@ -1409,6 +1414,55 @@ finish: return new; } +#else + +static char *_php3_memstr(char *s, char *c, size_t n, size_t m) +{ + char *p; + + for(p = s; (p - s) < n; p++) + if(memcmp(p, c, m) == 0) + return p; + return NULL; +} + +#define ATTCHSTR(st, sz) \ + nl += sz; \ + n = erealloc(n, nl + 1); \ + memcpy(n + no, st, sz); \ + no += sz + + +PHPAPI char *_php3_str_to_str(char *a, int al, char *b, int bl, char *c, int cl, + int *newlen) +{ + char *n = NULL, *p, *q; + int nl = 0; + int no = 0; + + /* run through all occurences of b in a */ + for(p = q = a; (p = _php3_memstr(p, b, al - (p - a), bl)); q = p) { + /* attach everything between the previous occ. and this one */ + ATTCHSTR(q, p - q); + /* attach the replacement string c */ + ATTCHSTR(c, cl); + /* jump over string b in a */ + p += bl; + } + + /* anything left over ? */ + if((al - (q - a)) > 0) { + ATTCHSTR(q, al - (q - a)); + } + + if(newlen) *newlen = nl; + n[nl] = '\0'; + + return n; +} + +#undef ATTCHSTR +#endif /* {{{ proto string str_replace(string needle, string str, string haystack) Replace all occurrences of needle in haystack with str */ diff --git a/ext/sybase/sybase-ct.c b/ext/sybase/sybase-ct.c index aa1d992dae..cf50de9f29 100644 --- a/ext/sybase/sybase-ct.c +++ b/ext/sybase/sybase-ct.c @@ -20,6 +20,9 @@ /* $Id$ */ +#ifndef MSVC5 +#include "php_config.h" +#endif #include "php.h" #include "php3_sybase-ct.h" #include "ext/standard/php3_standard.h" @@ -602,8 +605,11 @@ static void php3_sybct_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent) static int php3_sybct_get_default_link(INTERNAL_FUNCTION_PARAMETERS) { if (php3_sybct_module.default_link==-1) { /* no link opened yet, implicitly open one */ - ht = 0; - php3_sybct_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); + HashTable dummy; + + _php3_hash_init(&dummy,0,NULL,NULL,0); + php3_sybct_do_connect(&dummy,return_value,list,plist,0); + _php3_hash_destroy(&dummy); } return php3_sybct_module.default_link; } @@ -1309,7 +1315,7 @@ static PHP_FUNCTION(sybct_fetch_hash) tmp->value.str.val = _php3_addslashes(tmp->value.str.val,tmp->value.str.len,&tmp->value.str.len,1); } _php3_hash_index_update(return_value->value.ht, i, (void *) &tmp, sizeof(pval *), NULL); - _php3_hash_update(return_value->value.ht, result->fields[i].name, strlen(result->fields[i].name)+1, (void *) &tmp, sizeof(pval *), NULL); + _php3_hash_update(return_value->value.ht, result->fields[i].name, strlen(result->fields[i].name)+1, (void *) &tmp, sizeof(pval *) NULL); } result->cur_row++; } diff --git a/ext/sybase/sybase.c b/ext/sybase/sybase.c index 0b50958ee8..760335d21e 100644 --- a/ext/sybase/sybase.c +++ b/ext/sybase/sybase.c @@ -473,7 +473,8 @@ static void php3_sybase_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent) static int php3_sybase_get_default_link(INTERNAL_FUNCTION_PARAMETERS) { if (php3_sybase_module.default_link==-1) { /* no link opened yet, implicitly open one */ - ht = 0; + int ht; + php3_sybase_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU,0); } return php3_sybase_module.default_link; diff --git a/ext/wddx/Makefile.am b/ext/wddx/Makefile.am deleted file mode 100644 index 435d1604b1..0000000000 --- a/ext/wddx/Makefile.am +++ /dev/null @@ -1,6 +0,0 @@ -# $Id$ - -INCLUDES=@INCLUDES@ -I@top_srcdir@ -I@top_srcdir@/libzend -noinst_LIBRARIES=libphpext_wddx.a -libphpext_wddx_a_SOURCES=wddx.c - diff --git a/ext/wddx/config.h.stub b/ext/wddx/config.h.stub deleted file mode 100644 index 9dedf15dff..0000000000 --- a/ext/wddx/config.h.stub +++ /dev/null @@ -1,2 +0,0 @@ -/* define if you want to use the wddx extension */ -#define HAVE_WDDX 0 diff --git a/ext/wddx/config.m4 b/ext/wddx/config.m4 deleted file mode 100644 index 2b8078f596..0000000000 --- a/ext/wddx/config.m4 +++ /dev/null @@ -1,20 +0,0 @@ -dnl $Id$ -dnl config.m4 for extension wddx - -AC_MSG_CHECKING(whether to include WDDX support) -AC_ARG_WITH(wddx, -[ --with-wddx Include WDDX support],[ - if test "$withval" = "yes"; then - if test "${with_xml+set}" != "set" -o "$with_xml" = "no"; then - AC_MSG_ERROR(WDDX requires --with-xml) - else - AC_DEFINE(HAVE_WDDX, 1) - AC_MSG_RESULT(yes) - PHP_EXTENSION(wddx) - fi - else - AC_MSG_RESULT(no) - fi -],[ - AC_MSG_RESULT(no) -]) diff --git a/ext/wddx/php_wddx.h b/ext/wddx/php_wddx.h deleted file mode 100644 index efc19ef349..0000000000 --- a/ext/wddx/php_wddx.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP HTML Embedded Scripting Language Version 3.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-1999 PHP Development Team (See Credits file) | - +----------------------------------------------------------------------+ - | This program is free software; you can redistribute it and/or modify | - | it under the terms of one of the following licenses: | - | | - | A) 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. | - | | - | B) the PHP License as published by the PHP Development Team and | - | included in the distribution in the file: LICENSE | - | | - | 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 both licenses referred to here. | - | If you did not, or have any questions about PHP licensing, please | - | contact core@php.net. | - +----------------------------------------------------------------------+ - | Authors: Andrey Zmievski <andrey@ispi.net> | - +----------------------------------------------------------------------+ - */ - -/* $Id$ */ - -#ifndef _WDDX_H -#define _WDDX_H - -#if HAVE_WDDX - -#include "xml/xmlparse.h" - -extern int php_minit_wddx(INIT_FUNC_ARGS); - -extern zend_module_entry wddx_module_entry; -#define wddx_module_ptr &wddx_module_entry - -PHP_FUNCTION(wddx_serialize_value); -PHP_FUNCTION(wddx_serialize_vars); -PHP_FUNCTION(wddx_packet_start); -PHP_FUNCTION(wddx_packet_end); -PHP_FUNCTION(wddx_add_vars); -PHP_FUNCTION(wddx_deserialize); - -#else - -#define wddx_module_ptr NULL - -#endif /* HAVE_WDDX */ - -#define phpext_wddx_ptr wddx_module_ptr - -#endif /* !_WDDX_H */ diff --git a/ext/wddx/setup.stub b/ext/wddx/setup.stub deleted file mode 100644 index 30500bf406..0000000000 --- a/ext/wddx/setup.stub +++ /dev/null @@ -1,6 +0,0 @@ -# $Source$ -# $Id$ - -define_option with-wddx 'wddx support?' yesnodir no \ -' Whether to build the wddx extension.' - diff --git a/ext/wddx/wddx.c b/ext/wddx/wddx.c deleted file mode 100644 index 3fbc211bbb..0000000000 --- a/ext/wddx/wddx.c +++ /dev/null @@ -1,842 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP HTML Embedded Scripting Language Version 3.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-1999 PHP Development Team (See Credits file) | - +----------------------------------------------------------------------+ - | This program is free software; you can redistribute it and/or modify | - | it under the terms of one of the following licenses: | - | | - | A) 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. | - | | - | B) the PHP License as published by the PHP Development Team and | - | included in the distribution in the file: LICENSE | - | | - | 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 both licenses referred to here. | - | If you did not, or have any questions about PHP licensing, please | - | contact core@php.net. | - +----------------------------------------------------------------------+ - | Authors: Andrey Zmievski <andrey@ispi.net> | - +----------------------------------------------------------------------+ - */ - -/* $Id$ */ - -#include "php.h" -#include "php_wddx.h" - -#if HAVE_WDDX -#include "dlist.h" - -#define WDDX_PACKET_S "<wddxPacket version='0.9'>" -#define WDDX_PACKET_E "</wddxPacket>" -#define WDDX_HEADER "<header/>" -#define WDDX_HEADER_COMMENT "<header comment='%s'/>" -#define WDDX_DATA_S "<data>" -#define WDDX_DATA_E "</data>" -#define WDDX_STRING_S "<string>" -#define WDDX_STRING_E "</string>" -#define WDDX_CHAR "<char code='%02X'/>" -#define WDDX_NUMBER "<number>%s</number>" -#define WDDX_ARRAY_S "<array length='%d'>" -#define WDDX_ARRAY_E "</array>" -#define WDDX_VAR_S "<var name='%s'>" -#define WDDX_VAR_E "</var>" -#define WDDX_STRUCT_S "<struct>" -#define WDDX_STRUCT_E "</struct>" - -#define WDDX_BUF_LEN 256 - -#define EL_STRING "string" -#define EL_CHAR "char" -#define EL_CHAR_CODE "code" -#define EL_NUMBER "number" -#define EL_ARRAY "array" -#define EL_STRUCT "struct" -#define EL_VAR "var" -#define EL_VAR_NAME "name" -#define EL_PACKET "wddxPacket" -#define EL_VERSION "version" - - -static int le_wddx; - -typedef struct { - DLIST *packet_head; - int packet_length; -} wddx_packet; - -typedef struct { - zval *data; - enum { - ST_STRING, - ST_NUMBER, - ST_ARRAY, - ST_STRUCT - } type; - char *varname; -} st_entry; - -typedef struct { - int top, max; - char *varname; - void **elements; -} wddx_stack; - - -/* {{{ function prototypes */ -static void _php_wddx_serialize_var(wddx_packet *packet, zval *var, char *name); -static void _php_wddx_process_data(void *user_data, const char *s, int len); -/* }}} */ - - -/* {{{ module definition structures */ - -function_entry wddx_functions[] = { - PHP_FE(wddx_serialize_value, NULL) - PHP_FE(wddx_serialize_vars, NULL) - PHP_FE(wddx_packet_start, NULL) - PHP_FE(wddx_packet_end, NULL) - PHP_FE(wddx_add_vars, NULL) - PHP_FE(wddx_deserialize, NULL) - {NULL, NULL, NULL} -}; - -zend_module_entry wddx_module_entry = { - "WDDX_A", wddx_functions, php_minit_wddx, NULL, NULL, NULL, NULL, STANDARD_MODULE_PROPERTIES -}; - -/* }}} */ - - -/* {{{ int wddx_stack_init(wddx_stack *stack) */ -static int wddx_stack_init(wddx_stack *stack) -{ - stack->top = 0; - stack->elements = (void **) emalloc(sizeof(void **) * STACK_BLOCK_SIZE); - if (!stack->elements) { - return FAILURE; - } else { - stack->max = STACK_BLOCK_SIZE; - stack->varname = NULL; - return SUCCESS; - } -} -/* }}} */ - - -/* {{{ int wddx_stack_push(wddx_stack *stack, void *element, int size) */ -static int wddx_stack_push(wddx_stack *stack, void *element, int size) -{ - if (stack->top >= stack->max) { /* we need to allocate more memory */ - stack->elements = (void **) erealloc(stack->elements, - (sizeof(void **) * (stack->max += STACK_BLOCK_SIZE))); - if (!stack->elements) { - return FAILURE; - } - } - stack->elements[stack->top] = (void *) emalloc(size); - memcpy(stack->elements[stack->top], element, size); - return stack->top++; -} -/* }}} */ - - -/* {{{ int wddx_stack_top(wddx_stack *stack, void **element) */ -static int wddx_stack_top(wddx_stack *stack, void **element) -{ - if (stack->top > 0) { - *element = stack->elements[stack->top - 1]; - return SUCCESS; - } else { - *element = NULL; - return FAILURE; - } -} -/* }}} */ - - -/* {{{ int wddx_stack_is_empty(wddx_stack *stack) */ -static int wddx_stack_is_empty(wddx_stack *stack) -{ - if (stack->top == 0) { - return 1; - } else { - return 0; - } -} -/* }}} */ - - -/* {{{ int wddx_stack_destroy(wddx_stack *stack) */ -static int wddx_stack_destroy(wddx_stack *stack) -{ - register int i; - - if (stack->elements) { - for (i = 0; i < stack->top; i++) { - if (((st_entry *)stack->elements[i])->data) - { - zval_dtor(((st_entry *)stack->elements[i])->data); - efree(((st_entry *)stack->elements[i])->data); - } - efree(stack->elements[i]); - } - efree(stack->elements); - } - return SUCCESS; -} -/* }}} */ - - -/* {{{ _php_free_packet_chunk */ -static void _php_free_packet_chunk(char **chunk_ptr) -{ - if ((*chunk_ptr)) - efree((*chunk_ptr)); -} -/* }}} */ - - -/* {{{ _php_wddx_destructor */ -static void _php_wddx_destructor(wddx_packet *packet) -{ - dlst_kill(packet->packet_head, (void (*)(void *))_php_free_packet_chunk); - efree(packet); -} -/* }}} */ - - -/* {{{ php_minit_wddx */ -int php_minit_wddx(INIT_FUNC_ARGS) -{ - le_wddx = register_list_destructors(_php_wddx_destructor, NULL); - - return SUCCESS; -} -/* }}} */ - - -/* {{{ _php_wddx_add_chunk */ -static void _php_wddx_add_chunk(wddx_packet *packet, char *str) -{ - char **chunk_ptr; - - chunk_ptr = (char**)dlst_newnode(sizeof(char *)); - (*chunk_ptr) = estrdup(str); - dlst_insertafter(packet->packet_head, chunk_ptr, PHP_DLST_TAIL(packet->packet_head)); - packet->packet_length += strlen(str); -} -/* }}} */ - - -/* {{{ _php_wddx_gather */ -static char* _php_wddx_gather(wddx_packet *packet) -{ - char **chunk; - char *buf; - - buf = (char *)emalloc(packet->packet_length+1); - buf[0] = '\0'; - for(chunk=dlst_first(packet->packet_head); - chunk!=NULL; - chunk = dlst_next(chunk)) { - strcat(buf, *chunk); - } - - return buf; -} -/* }}} */ - - -/* {{{ void _php_wddx_packet_start */ -static void _php_wddx_packet_start(wddx_packet *packet, char *comment) -{ - char tmp_buf[WDDX_BUF_LEN]; - - _php_wddx_add_chunk(packet, WDDX_PACKET_S); - if (comment) - { - sprintf(tmp_buf, WDDX_HEADER_COMMENT, comment); - _php_wddx_add_chunk(packet, tmp_buf); - } - else - _php_wddx_add_chunk(packet, WDDX_HEADER); - _php_wddx_add_chunk(packet, WDDX_DATA_S); -} -/* }}} */ - - -/* {{{ int _php_wddx_packet_end */ -static void _php_wddx_packet_end(wddx_packet *packet) -{ - _php_wddx_add_chunk(packet, WDDX_DATA_E); - _php_wddx_add_chunk(packet, WDDX_PACKET_E); -} -/* }}} */ - - -/* {{{ void _php_wddx_serialize_var(wddx_packet *packet, zval *var) */ -static void _php_wddx_serialize_string(wddx_packet *packet, zval *var) -{ - char *buf, - *c, - control_buf[WDDX_BUF_LEN]; - int i; - - _php_wddx_add_chunk(packet, WDDX_STRING_S); - - i = 0; - buf = (char *)emalloc(var->value.str.len); - for(c=var->value.str.val; *c!='\0'; c++) - { - if (iscntrl((int)*c)) - { - if (*buf) - { - buf[i] = '\0'; - _php_wddx_add_chunk(packet, buf); - i = 0; - buf[i] = '\0'; - } - sprintf(control_buf, WDDX_CHAR, *c); - _php_wddx_add_chunk(packet, control_buf); - } - else - buf[i++] = *c; - } - buf[i] = '\0'; - if (*buf) - _php_wddx_add_chunk(packet, buf); - efree(buf); - - _php_wddx_add_chunk(packet, WDDX_STRING_E); -} -/* }}} */ - - -/* {{{ void _php_wddx_serialize_number(wddx_packet *packet, zval *var) */ -static void _php_wddx_serialize_number(wddx_packet *packet, zval *var) -{ - char tmp_buf[WDDX_BUF_LEN]; - - convert_to_string(var); - sprintf(tmp_buf, WDDX_NUMBER, var->value.str.val); - _php_wddx_add_chunk(packet, tmp_buf); -} -/* }}} */ - - -/* {{{ void _php_wddx_serialize_hash(wddx_packet *packet, zval *var) */ -static void _php_wddx_serialize_hash(wddx_packet *packet, zval *var) -{ - zval **ent; - char *key; - int hash_type, ent_type; - ulong idx; - char tmp_buf[WDDX_BUF_LEN]; - - zend_hash_internal_pointer_reset(var->value.ht); - - hash_type = zend_hash_get_current_key(var->value.ht, &key, &idx); - - if (hash_type == HASH_KEY_IS_STRING) { - _php_wddx_add_chunk(packet, WDDX_STRUCT_S); - efree(key); - } else { - sprintf(tmp_buf, WDDX_ARRAY_S, zend_hash_num_elements(var->value.ht)); - _php_wddx_add_chunk(packet, tmp_buf); - } - - while(zend_hash_get_current_data(var->value.ht, (void**)&ent) == SUCCESS) { - if (hash_type == HASH_KEY_IS_STRING) { - ent_type = zend_hash_get_current_key(var->value.ht, &key, &idx); - - if (ent_type == HASH_KEY_IS_STRING) { - _php_wddx_serialize_var(packet, *ent, key); - efree(key); - } else { - sprintf(tmp_buf, "%ld", idx); - _php_wddx_serialize_var(packet, *ent, tmp_buf); - } - } else - _php_wddx_serialize_var(packet, *ent, NULL); - - zend_hash_move_forward(var->value.ht); - } - - if (hash_type == HASH_KEY_IS_STRING) - _php_wddx_add_chunk(packet, WDDX_STRUCT_E); - else - _php_wddx_add_chunk(packet, WDDX_ARRAY_E); -} -/* }}} */ - - -/* {{{ void _php_wddx_serialize_var(wddx_packet *packet, zval *var, char *name) */ -static void _php_wddx_serialize_var(wddx_packet *packet, zval *var, char *name) -{ - char tmp_buf[WDDX_BUF_LEN]; - - if (name) { - sprintf(tmp_buf, WDDX_VAR_S, name); - _php_wddx_add_chunk(packet, tmp_buf); - } - - switch(var->type) { - case IS_STRING: - _php_wddx_serialize_string(packet, var); - break; - - case IS_LONG: - case IS_DOUBLE: - _php_wddx_serialize_number(packet, var); - break; - - case IS_ARRAY: - case IS_OBJECT: - _php_wddx_serialize_hash(packet, var); - break; - } - - if (name) { - _php_wddx_add_chunk(packet, WDDX_VAR_E); - } -} -/* }}} */ - - -/* {{{ void _php_wddx_add_var(wddx_packet *packet, zval *name_var) */ -static void _php_wddx_add_var(wddx_packet *packet, zval *name_var) -{ - zval **val; - ELS_FETCH(); - - if (name_var->type & IS_STRING) - { - if (zend_hash_find(EG(active_symbol_table), name_var->value.str.val, - name_var->value.str.len+1, (void**)&val) != FAILURE) { - _php_wddx_serialize_var(packet, *val, name_var->value.str.val); - } - } - else if (name_var->type & IS_ARRAY) - { - zend_hash_internal_pointer_reset(name_var->value.ht); - - while(zend_hash_get_current_data(name_var->value.ht, (void**)&val) == SUCCESS) { - _php_wddx_add_var(packet, *val); - - zend_hash_move_forward(name_var->value.ht); - } - } -} -/* }}} */ - - -/* {{{ void _php_wddx_push_element(void *user_data, const char *name, const char **atts) */ -static void _php_wddx_push_element(void *user_data, const char *name, const char **atts) -{ - st_entry ent; - wddx_stack *stack = (wddx_stack *)user_data; - - if (!strcmp(name, EL_PACKET)) { - int i; - - for (i=0; atts[i]; i++) { - if (!strcmp(atts[i], EL_VERSION)) { - } - } - } else if (!strcmp(name, EL_STRING)) { - ent.type = ST_STRING; - if (stack->varname) { - ent.varname = estrdup(stack->varname); - efree(stack->varname); - stack->varname = NULL; - } else - ent.varname = NULL; - - ent.data = (zval *)emalloc(sizeof(zval)); - ent.data->value.str.len = 0; - INIT_PZVAL(ent.data); - wddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry)); - } else if (!strcmp(name, EL_CHAR)) { - int i; - char tmp_buf[2]; - - for (i=0; atts[i]; i++) { - if (!strcmp(atts[i], EL_CHAR_CODE) && atts[i+1]) { - sprintf(tmp_buf, "%c", (char)strtol(atts[i+1], NULL, 16)); - _php_wddx_process_data(user_data, tmp_buf, strlen(tmp_buf)); - } - } - } else if (!strcmp(name, EL_NUMBER)) { - ent.type = ST_NUMBER; - if (stack->varname) { - ent.varname = estrdup(stack->varname); - efree(stack->varname); - stack->varname = NULL; - } else - ent.varname = NULL; - - ent.data = (zval *)emalloc(sizeof(zval)); - INIT_PZVAL(ent.data); - wddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry)); - } else if (!strcmp(name, EL_ARRAY)) { - ent.type = ST_ARRAY; - if (stack->varname) { - ent.varname = estrdup(stack->varname); - efree(stack->varname); - stack->varname = NULL; - } else - ent.varname = NULL; - - ent.data = (zval *)emalloc(sizeof(zval)); - array_init(ent.data); - INIT_PZVAL(ent.data); - wddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry)); - } else if (!strcmp(name, EL_STRUCT)) { - ent.type = ST_STRUCT; - if (stack->varname) { - ent.varname = estrdup(stack->varname); - efree(stack->varname); - stack->varname = NULL; - } else - ent.varname = NULL; - - ent.data = (zval *)emalloc(sizeof(zval)); - array_init(ent.data); - INIT_PZVAL(ent.data); - wddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry)); - } else if (!strcmp(name, EL_VAR)) { - int i; - - for (i=0; atts[i]; i++) { - if (!strcmp(atts[i], EL_VAR_NAME) && atts[i+1]) { - stack->varname = estrdup(atts[i+1]); - } - } - } - -} -/* }}} */ - - -/* {{{ void _php_wddx_pop_element(void *user_data, const char *name) */ -static void _php_wddx_pop_element(void *user_data, const char *name) -{ - st_entry *ent1, *ent2; - wddx_stack *stack = (wddx_stack *)user_data; - - if (!strcmp(name, EL_STRING) || !strcmp(name, EL_NUMBER) || - !strcmp(name, EL_ARRAY) || !strcmp(name, EL_STRUCT)) { - if (stack->top > 1) { - wddx_stack_top(stack, (void**)&ent1); - stack->top--; - wddx_stack_top(stack, (void**)&ent2); - if (ent2->data->type == IS_ARRAY) { - if (ent1->varname) { - zend_hash_update(ent2->data->value.ht, - ent1->varname, strlen(ent1->varname)+1, - &ent1->data, sizeof(zval *), NULL); - efree(ent1->varname); - } else { - zend_hash_next_index_insert(ent2->data->value.ht, - &ent1->data, - sizeof(zval *), NULL); - } - } - efree(ent1); - } - } -} -/* }}} */ - - -/* {{{ void _php_wddx_process_data(void *user_data, const char *s, int len) */ -static void _php_wddx_process_data(void *user_data, const char *s, int len) -{ - st_entry *ent; - wddx_stack *stack = (wddx_stack *)user_data; - - if (!wddx_stack_is_empty(stack)) { - wddx_stack_top(stack, (void**)&ent); - switch (ent->type) { - case ST_STRING: - ent->data->type = IS_STRING; - if (ent->data->value.str.len == 0) { - ent->data->value.str.val = estrndup(s, len); - ent->data->value.str.len = len; - } else { - ent->data->value.str.val = erealloc(ent->data->value.str.val, - ent->data->value.str.len + len + 1); - strncpy(ent->data->value.str.val+ent->data->value.str.len, s, len); - ent->data->value.str.len += len; - ent->data->value.str.val[ent->data->value.str.len] = '\0'; - } - break; - - case ST_NUMBER: - ent->data->type = IS_STRING; - ent->data->value.str.len = len; - ent->data->value.str.val = estrndup(s, len); - convert_scalar_to_number(ent->data); - break; - - default: - break; - } - } -} -/* }}} */ - - -/* {{{ void _php_wddx_deserialize(zval *packet, zval *return_value) */ -static void _php_wddx_deserialize(zval *packet, zval *return_value) -{ - wddx_stack stack; - XML_Parser parser; - st_entry *ent; - - wddx_stack_init(&stack); - parser = XML_ParserCreate(NULL); - - XML_SetUserData(parser, &stack); - XML_SetElementHandler(parser, _php_wddx_push_element, _php_wddx_pop_element); - XML_SetCharacterDataHandler(parser, _php_wddx_process_data); - - XML_Parse(parser, packet->value.str.val, packet->value.str.len, 1); - - XML_ParserFree(parser); - - wddx_stack_top(&stack, (void**)&ent); - *return_value = *(ent->data); - zval_copy_ctor(return_value); - - wddx_stack_destroy(&stack); -} -/* }}} */ - - -/* {{{ proto string wddx_serialize_value(mixed var [, string comment ]) - Creates a new packet and serializes the given value */ -PHP_FUNCTION(wddx_serialize_value) -{ - int argc; - zval *var, - *comment; - wddx_packet *packet; - char *buf; - - argc = ARG_COUNT(ht); - if(argc < 1 || argc > 2 || getParameters(ht, argc, &var, &comment) == FAILURE) { - WRONG_PARAM_COUNT; - } - - packet = emalloc(sizeof(wddx_packet)); - if (!packet) { - zend_error(E_WARNING, "Unable to allocate memory in php_wddx_packet_start"); - RETURN_FALSE; - } - - packet->packet_head = dlst_init(); - packet->packet_length = 0; - - if (argc == 2) - { - convert_to_string(comment); - _php_wddx_packet_start(packet, comment->value.str.val); - } - else - _php_wddx_packet_start(packet, NULL); - - _php_wddx_serialize_var(packet, var, NULL); - _php_wddx_packet_end(packet); - buf = _php_wddx_gather(packet); - _php_wddx_destructor(packet); - - RETURN_STRING(buf, 0); -} -/* }}} */ - - -/* {{{ proto string wddx_serialize_vars(. . .) - Creates a new packet and serializes given variables into a struct */ -PHP_FUNCTION(wddx_serialize_vars) -{ - int argc, i; - wddx_packet *packet; - zval **args; - char *buf; - - argc = ARG_COUNT(ht); - /* Allocate arguments array and get the arguments, checking for errors. */ - args = (zval **)emalloc(argc * sizeof(zval *)); - if (getParametersArray(ht, argc, args) == FAILURE) { - efree(args); - WRONG_PARAM_COUNT; - } - - packet = emalloc(sizeof(wddx_packet)); - if (!packet) { - zend_error(E_WARNING, "Unable to allocate memory in php_wddx_packet_start"); - RETURN_FALSE; - } - - packet->packet_head = dlst_init(); - packet->packet_length = 0; - - _php_wddx_packet_start(packet, NULL); - _php_wddx_add_chunk(packet, WDDX_STRUCT_S); - - for (i=0; i<argc; i++) { - _php_wddx_add_var(packet, args[i]); - } - - _php_wddx_add_chunk(packet, WDDX_STRUCT_E); - _php_wddx_packet_end(packet); - buf = _php_wddx_gather(packet); - _php_wddx_destructor(packet); - - efree(args); - - RETURN_STRING(buf, 0); -} -/* }}} */ - - -/* {{{ proto int wddx_packet_start([ string comment ]) - Starts a WDDX packet with optional comment and returns the packet id */ -PHP_FUNCTION(wddx_packet_start) -{ - int argc; - zval *comment; - wddx_packet *packet; - - comment = NULL; - argc = ARG_COUNT(ht); - - if (argc>1 || (argc==1 && getParameters(ht, 1, &comment)==FAILURE)) { - WRONG_PARAM_COUNT; - } - - packet = emalloc(sizeof(wddx_packet)); - if (!packet) { - zend_error(E_WARNING, "Unable to allocate memory in php_wddx_packet_start"); - RETURN_FALSE; - } - - packet->packet_head = dlst_init(); - packet->packet_length = 0; - - if (argc == 1) { - convert_to_string(comment); - _php_wddx_packet_start(packet, comment->value.str.val); - } - else - _php_wddx_packet_start(packet, NULL); - - _php_wddx_add_chunk(packet, WDDX_STRUCT_S); - - RETURN_LONG(zend_list_insert(packet, le_wddx)); -} -/* }}} */ - - -/* {{{ proto string wddx_packet_end(int packet_id) - Ends specified WDDX packet and returns the string containing the packet */ -PHP_FUNCTION(wddx_packet_end) -{ - zval *packet_id; - char *buf; - wddx_packet *packet; - int type, id; - - if (ARG_COUNT(ht)!=1 || getParameters(ht, 1, &packet_id)==FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(packet_id); - id = packet_id->value.lval; - packet = zend_list_find(id, &type); - if (type!=le_wddx) { - zend_error(E_WARNING, "%d is not a valid WDDX packet id", id); - RETURN_FALSE; - } - - _php_wddx_add_chunk(packet, WDDX_STRUCT_E); - - _php_wddx_packet_end(packet); - - buf = _php_wddx_gather(packet); - - zend_list_delete(id); - - RETURN_STRING(buf, 0); -} -/* }}} */ - - -/* {{{ proto int wddx_add_vars(int packet_id, . . .) - Serializes given variables and adds them to packet given by packet_id */ -PHP_FUNCTION(wddx_add_vars) -{ - int argc, type, id, i; - zval **args; - zval *packet_id; - wddx_packet *packet; - - argc = ARG_COUNT(ht); - if (argc < 2) { - WRONG_PARAM_COUNT; - } - - /* Allocate arguments array and get the arguments, checking for errors. */ - args = (zval **)emalloc(argc * sizeof(zval *)); - if (getParametersArray(ht, argc, args) == FAILURE) { - efree(args); - WRONG_PARAM_COUNT; - } - - packet_id = args[0]; - - convert_to_long(packet_id); - id = packet_id->value.lval; - packet = zend_list_find(id, &type); - if (type!=le_wddx) { - zend_error(E_WARNING, "%d is not a valid WDDX packet id", id); - RETURN_FALSE; - } - - for (i=1; i<argc; i++) { - _php_wddx_add_var(packet, args[i]); - } - - efree(args); - RETURN_TRUE; -} -/* }}} */ - - -/* {{{ proto mixed wddx_deserialized(string packet) - Deserializes given packet and returns a PHP value */ -PHP_FUNCTION(wddx_deserialize) -{ - zval *packet; - - if (ARG_COUNT(ht)!=1 || getParameters(ht, 1, &packet) == FAILURE) { - WRONG_PARAM_COUNT; - } - - _php_wddx_deserialize(packet, return_value); -} -/* }}} */ - - -#endif /* HAVE_LIBEXPAT */ diff --git a/ext/xml/Makefile.am b/ext/xml/Makefile.am index 9b6e9cdec4..c4f9f526f3 100644 --- a/ext/xml/Makefile.am +++ b/ext/xml/Makefile.am @@ -1,12 +1,6 @@ # $Id$ -phplibdir=$(libdir)/php - -SRC=xml.c -INCLUDES=@INCLUDES@ @XML_INCLUDE@ -I@top_srcdir@ -I@top_srcdir@/libzend +INCLUDES=@INCLUDES@ -I@top_srcdir@ -I@top_srcdir@/libzend noinst_LIBRARIES=libphpext_xml.a -phplib_LTLIBRARIES=libphpext_xml.la -libphpext_xml_a_SOURCES=$(SRC) -libphpext_xml_la_SOURCES=$(SRC) -libphpext_xml_la_LIBADD=@XML_LIBS@ -EXTRA_LIBS= +libphpext_xml_a_SOURCES=xml.c + diff --git a/ext/xml/config.m4 b/ext/xml/config.m4 index 787ee3465d..c4b871107d 100644 --- a/ext/xml/config.m4 +++ b/ext/xml/config.m4 @@ -1,51 +1,24 @@ -# $Source$ -# $Id$ +dnl $Id$ AC_MSG_CHECKING(for XML support) AC_ARG_WITH(xml, [ --with-xml Include XML support],[ - case $withval in - shared) - shared=yes - withval=yes - ;; - shared,*) - shared=yes - withval=`echo $withval | sed -e 's/^shared,//'` - ;; - *) - shared=no - ;; - esac if test "$withval" != "no"; then - if test "$shared" = "yes"; then - AC_MSG_RESULT([yes (shared)]) - else - AC_MSG_RESULT([yes (static)]) - fi if test "$withval" = "yes"; then - test -d /usr/include/xmltok && XML_INCLUDE="-I/usr/include/xmltok" - test -d /usr/include/xml && XML_INCLUDE="-I/usr/include/xml" - test -d /usr/local/include/xml && XML_INCLUDE="-I/usr/local/include/xml" - AC_CHECK_LIB(expat, main, XML_LIBS="-lexpat", XML_LIBS="-lxmlparse -lxmltok") + XML_LIBS="-lexpat" + XML_INCLUDE="" else XML_LIBS="-L$withval/lib -lexpat" - if test -d $withval/include/xml; then - XML_INCLUDE="-I$withval/include/xml" - else - XML_INCLUDE="-I$withval/include" - fi + XML_INCLUDE="-I$withval/include" fi AC_DEFINE(HAVE_LIBEXPAT, 1) - PHP_EXTENSION(xml, $shared) - if test "$shared" != "yes"; then - EXTRA_LIBS="$EXTRA_LIBS $XML_LIBS" - fi + AC_MSG_RESULT(yes) + PHP_EXTENSION(xml) + EXTRA_LIBS="$EXTRA_LIBS $XML_LIBS" + INCLUDES="$INCLUDES $XML_INCLUDE" else AC_MSG_RESULT(no) fi ],[ AC_MSG_RESULT(no) ]) -AC_SUBST(XML_LIBS) -AC_SUBST(XML_INCLUDE) diff --git a/ext/xml/php3_xml.h b/ext/xml/php3_xml.h index 5016848c8e..0c4c706d9d 100644 --- a/ext/xml/php3_xml.h +++ b/ext/xml/php3_xml.h @@ -29,13 +29,13 @@ /* $Id$ */ -#ifndef _PHP_XML_H -# define _PHP_XML_H +#if HAVE_LIBEXPAT +# ifndef _PHP_XML_H +# define _PHP_XML_H +# endif -# if HAVE_LIBEXPAT - -#include <xmltok.h> -#include <xmlparse.h> +#include <xml/xmltok.h> +#include <xml/xmlparse.h> #ifdef XML_UNICODE # error "UTF-16 Unicode support not implemented!" @@ -129,8 +129,6 @@ PHP_FUNCTION(xml_parse_into_struct); #define phpext_xml_ptr xml_module_ptr -# endif /* _PHP_XML_H */ - /* * Local variables: * tab-width: 4 diff --git a/ext/xml/xml.c b/ext/xml/xml.c index b270adc1ea..acfe5ccb05 100644 --- a/ext/xml/xml.c +++ b/ext/xml/xml.c @@ -18,12 +18,6 @@ /* $Id$ */ #define IS_EXT_MODULE - -/* boldly assume that if PIC is defined, we are being compiled dynamically */ -#ifdef PIC -# define COMPILE_DL 1 -#endif - #if COMPILE_DL # if PHP_31 # include "../phpdl.h" @@ -98,44 +92,27 @@ DLEXPORT php3_module_entry *get_module() { return &xml_module_entry; }; #if PHP_API_VERSION >= 19990421 #define php3tls_pval_destructor(a) zval_dtor(a) #endif - /* {{{ php3i_long_pval() */ - -PHPAPI pval *php3i_long_pval(long value) +static pval *php3i_long_pval(long value) { - pval *ret = emalloc(sizeof(pval)); - - ret->type = IS_LONG; - ret->value.lval = value; - return ret; + pval *ret = emalloc(sizeof(pval)); + + ret->type = IS_LONG; + ret->value.lval = value; + INIT_PZVAL(ret); + return ret; } -/* }}} */ - /* {{{ php3i_double_pval() */ - -PHPAPI pval *php3i_double_pval(double value) +static pval *php3i_string_pval(const char *str) { - pval *ret = emalloc(sizeof(pval)); - - ret->type = IS_DOUBLE; - ret->value.dval = value; - return ret; -} - -/* }}} */ - /* {{{ php3i_string_pval() */ - -PHPAPI pval *php3i_string_pval(const char *str) -{ - pval *ret = emalloc(sizeof(pval)); - int len = strlen(str); - - ret->type = IS_STRING; - ret->value.str.len = len; - ret->value.str.val = estrndup(str, len); - return ret; -} - -/* }}} */ + pval *ret = emalloc(sizeof(pval)); + int len = strlen(str); + + ret->type = IS_STRING; + ret->value.str.len = len; + INIT_PZVAL(ret); + ret->value.str.val = estrndup(str, len); + return ret; +} /* end of UGLY HACK!!! */ @@ -641,21 +618,7 @@ static int php3i_xmlcharlen(const XML_Char *s) } /* }}} */ - /* {{{ php3i_pval_strdup() */ - -PHPAPI char *php3i_pval_strdup(pval *val) -{ - if (val->type == IS_STRING) { - char *buf = emalloc(val->value.str.len + 1); - memcpy(buf, val->value.str.val, val->value.str.len); - buf[val->value.str.len] = '\0'; - return buf; - } - return NULL; -} - -/* }}} */ - /* {{{ php3i_add_to_info */ +/* {{{ php3i_add_to_info */ static void php3i_add_to_info(xml_parser *parser,char *name) { pval **element, *values; @@ -682,7 +645,7 @@ static void php3i_add_to_info(xml_parser *parser,char *name) } /* }}} */ - /* {{{ php3i_xml_startElementHandler() */ +/* {{{ php3i_xml_startElementHandler() */ void php3i_xml_startElementHandler(void *userData, const char *name, const char **attributes) diff --git a/libphp4.module.in b/libphp4.module.in index 8735976fbf..cdc3c75677 100644 --- a/libphp4.module.in +++ b/libphp4.module.in @@ -1,8 +1,8 @@ Name: php4_module ConfigStart RULE_WANTHSREGEX=@HSREGEX@ - LDFLAGS_SHLIB="@RAW_RPATHS@ $LDFLAGS_SHLIB" - LIBS="@RPATHS@ @PHP_LIBS@ @EXTRA_LIBS@ @LIBS@ @RDYNAMIC_LFLAGS@ $LIBS" + LDFLAGS_SHLIB="@RPATHS@ $LDFLAGS_SHLIB" + LIBS="@PHP_LIBS@ @EXTRA_LIBS@ @LIBS@ @RDYNAMIC_LFLAGS@ $LIBS" RULE_HIDE=yes CFLAGS="$CFLAGS -I@abs_srcdir@ -I@abs_srcdir@/libzend -I@abs_builddir@/libzend -I@abs_builddir@" ConfigEnd @@ -1,7 +1,9 @@ #! /bin/sh # ltconfig - Create a system-specific libtool. -# Copyright (C) 1996-1999 Free Software Foundation, Inc. +# When updating this script, search for LINENUM and fix line number refs. +# Generated automatically from ltconfig.in by configure. +# Copyright (C) 1996, 1997, Free Software Foundation, Inc. # Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 # # This file is free software; you can redistribute it and/or modify it @@ -25,160 +27,23 @@ # A lot of this script is taken from autoconf-2.10. -# Check that we are running under the correct shell. -SHELL=${CONFIG_SHELL-/bin/sh} -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 - # used as fallback echo - shift - cat <<EOF -$* -EOF - exit 0 -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 - -# Find the correct PATH separator. Usually this is `:', but -# DJGPP uses `;' like DOS. -if test "X${PATH_SEPARATOR+set}" != "Xset"; then - UNAME=${UNAME-`uname 2>/dev/null`} - case X$UNAME in - *-DOS) PATH_SEPARATOR=';' ;; - *) PATH_SEPARATOR=':' ;; - esac -fi - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -if test "${CDPATH+set}" = set; then CDPATH=; export CDPATH; fi - -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' || - test "X`($echo "$echo_test_string") 2>/dev/null`" != X"$echo_test_string"; then - # 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. - - IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" - for dir in $PATH /usr/ucb; do - if test -f $dir/echo && - test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && - test "X`($dir/echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then - echo="$dir/echo" - break - fi - done - IFS="$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' && - test "X`(print -r "$echo_test_string") 2>/dev/null`" = 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 "X$CONFIG_SHELL" != X/bin/ksh; then - # If we have ksh, try running ltconfig 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' && - test "X`($echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then - # Cool, printf works - : - elif test "X`("$ORIGINAL_CONFIG_SHELL" "$0" --fallback-echo '\t') 2>/dev/null`" = 'X\t' && - test "X`("$ORIGINAL_CONFIG_SHELL" "$0" --fallback-echo "$echo_test_string") 2>/dev/null`" = 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 test "X`("$CONFIG_SHELL" "$0" --fallback-echo '\t') 2>/dev/null`" = 'X\t' && - test "X`("$CONFIG_SHELL" "$0" --fallback-echo "$echo_test_string") 2>/dev/null`" = 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}" "$0" ${1+"$@"} - else - # Oops. We lost completely, so just stick with echo. - echo=echo - fi - fi - fi - fi -fi - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed='sed -e s/^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' - # The name of this program. -progname=`$echo "X$0" | $Xsed -e 's%^.*/%%'` +progname=`echo "$0" | sed 's%^.*/%%'` # Constants: PROGRAM=ltconfig PACKAGE=libtool -VERSION=1.2f -TIMESTAMP=" (1.385 1999/03/15 17:24:54)" +VERSION=1.0 ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.c 1>&5' -ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.c $LIBS 1>&5' rm="rm -f" help="Try \`$progname --help' for more information." # Global variables: -default_ofile=libtool can_build_shared=yes enable_shared=yes # All known linkers require a `.a' archive for static linking. enable_static=yes -enable_fast_install=yes -enable_dlopen=unknown ltmain= silent= srcdir= @@ -186,15 +51,9 @@ ac_config_guess= ac_config_sub= host= nonopt= -ofile="$default_ofile" verify_host=yes with_gcc=no with_gnu_ld=no -need_locks=yes -ac_ext=c -objext=o -libext=a -cache_file= old_AR="$AR" old_CC="$CC" @@ -202,10 +61,9 @@ old_CFLAGS="$CFLAGS" old_CPPFLAGS="$CPPFLAGS" old_LD="$LD" old_LN_S="$LN_S" -old_NM="$NM" old_RANLIB="$RANLIB" -old_DLLTOOL="$DLLTOOL" -old_AS="$AS" + +test -z "$AR" && AR=ar # Parse the command line options. args= @@ -226,49 +84,33 @@ do case "$option" in --help) cat <<EOM -Usage: $progname [OPTION]... [HOST [LTMAIN]] +Usage: $progname [OPTION]... LTMAIN [HOST] Generate a system-specific libtool script. - --debug enable verbose shell tracing --disable-shared do not build shared libraries --disable-static do not build static libraries - --disable-fast-install do not optimize for fast installation - --enable-dlopen enable dlopen support - --enable-dlopen-self enable support for dlopening programs --help display this help and exit --no-verify do not verify that HOST is a valid host type --o, --output=FILE specify the output file [default=$default_ofile] --quiet same as \`--silent' - --silent do not print informational messages + --silent don't print informational messages --srcdir=DIR find \`config.guess' in DIR --version output version information and exit --with-gcc assume that the GNU C compiler will be used --with-gnu-ld assume that the C compiler uses the GNU linker - --disable-lock disable file locking - --cache-file=FILE configure cache file -LTMAIN is the \`ltmain.sh' shell script fragment or \`ltmain.c' program -that provides basic libtool functionality. +LTMAIN is the \`ltmain.sh' shell script fragment that provides basic libtool +functionality. HOST is the canonical host system name [default=guessed]. EOM exit 0 ;; - --debug) - echo "$progname: enabling shell trace mode" - set -x - ;; - --disable-shared) enable_shared=no ;; --disable-static) enable_static=no ;; - --disable-fast-install) enable_fast_install=no ;; - - --enable-dlopen) enable_dlopen=yes ;; - --quiet | --silent) silent=yes ;; --srcdir) prev=srcdir ;; @@ -276,18 +118,11 @@ EOM --no-verify) verify_host=no ;; - --output | -o) prev=ofile ;; - --output=*) ofile="$optarg" ;; - - --version) echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"; exit 0 ;; + --version) echo "$PROGRAM (GNU $PACKAGE) $VERSION"; exit 0 ;; --with-gcc) with_gcc=yes ;; --with-gnu-ld) with_gnu_ld=yes ;; - --disable-lock) need_locks=no ;; - - --cache-file=*) cache_file="$optarg" ;; - -*) echo "$progname: unrecognized option \`$option'" 1>&2 echo "$help" 1>&2 @@ -298,7 +133,7 @@ EOM if test -z "$ltmain"; then ltmain="$option" elif test -z "$host"; then -# This generates an unnecessary warning for sparc-sun-solaris4.1.3_U1 +# FIXME This generates an unnecessary warning for sparc-sun-solaris4.1.3_U1 # if test -n "`echo $option| sed 's/[-a-z0-9.]//g'`"; then # echo "$progname: warning \`$option' is not a valid host type" 1>&2 # fi @@ -317,10 +152,9 @@ if test -z "$ltmain"; then exit 1 fi -if test ! -f "$ltmain"; then - echo "$progname: \`$ltmain' does not exist" 1>&2 - echo "$help" 1>&2 - exit 1 +if test -f "$ltmain"; then : +else + echo "$progname: warning: \`$ltmain' does not exist" 1>&2 fi # Quote any args containing shell metacharacters. @@ -358,11 +192,6 @@ exec 5>>./config.log if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi if test "${LANG+set}" = set; then LANG=C; export LANG; fi -if test -n "$cache_file" && test -r "$cache_file"; then - echo "loading cache $cache_file within ltconfig" - . $cache_file -fi - if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then @@ -376,12 +205,11 @@ else fi if test -z "$srcdir"; then - # Assume the source directory is the same one as the path to LTMAIN. - srcdir=`$echo "X$ltmain" | $Xsed -e 's%/[^/]*$%%'` + # Assume the source directory is the same one as the path to ltmain.sh. + srcdir=`echo "$ltmain" | sed 's%/[^/]*$%%'` test "$srcdir" = "$ltmain" && srcdir=. fi -trap "$rm conftest*; exit 1" 1 2 15 if test "$verify_host" = yes; then # Check for config.guess and config.sub. ac_aux_dir= @@ -400,7 +228,7 @@ if test "$verify_host" = yes; then ac_config_sub=$ac_aux_dir/config.sub # Make sure we can run config.sub. - if $SHELL $ac_config_sub sun4 >/dev/null 2>&1; then : + if $ac_config_sub sun4 >/dev/null 2>&1; then : else echo "$progname: cannot run $ac_config_sub" 1>&2 echo "$help" 1>&2 @@ -412,18 +240,15 @@ if test "$verify_host" = yes; then host_alias=$host case "$host_alias" in "") - if host_alias=`$SHELL $ac_config_guess`; then : + if host_alias=`$ac_config_guess`; then : else echo "$progname: cannot guess host type; you must specify one" 1>&2 echo "$help" 1>&2 exit 1 fi ;; esac - host=`$SHELL $ac_config_sub $host_alias` - echo "$ac_t$host" 1>&6 - - # Make sure the host verified. - test -z "$host" && exit 1 + host=`$ac_config_sub $host_alias` + echo "$ac_t""$host" 1>&6 elif test -z "$host"; then echo "$progname: you must specify a host type if you use \`--no-verify'" 1>&2 @@ -433,42 +258,26 @@ else host_alias=$host fi -# Transform linux* to *-*-linux-gnu*, to support old configure scripts. -case "$host_os" in -linux-gnu*) ;; -linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` +# Transform *-*-linux* to *-*-linux-gnu*, to support old configure scripts. +case "$host" in +*-*-linux-gnu*) ;; +*-*-linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` esac host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -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 "${COLLECT_NAMES+set}" != set; then - COLLECT_NAMES= - export COLLECT_NAMES - fi - ;; -esac - # Determine commands to create old-style static archives. old_archive_cmds='$AR cru $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' -old_postuninstall_cmds= - -# Set a sane default for `AR'. -test -z "$AR" && AR=ar # If RANLIB is not set, then run the test. if test "${RANLIB+set}" != "set"; then result=no echo $ac_n "checking for ranlib... $ac_c" 1>&6 - IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" + IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:" for dir in $PATH; do test -z "$dir" && dir=. if test -f $dir/ranlib; then @@ -479,24 +288,20 @@ if test "${RANLIB+set}" != "set"; then done IFS="$save_ifs" - echo "$ac_t$result" 1>&6 + echo $ac_t "$result" 1>&6 fi if test -n "$RANLIB"; then - old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" - old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" + old_archive_cmds="$old_archive_cmds;\$RANLIB \$oldlib" + old_postinstall_cmds="$old_postinstall_cmds;\$RANLIB \$oldlib" fi -# Set sane defaults for `DLLTOOL' and `AS', used on cygwin. -test -z "$DLLTOOL" && DLLTOOL=dlltool -test -z "$AS" && AS=as - # Check to see if we are using GCC. if test "$with_gcc" != yes || test -z "$CC"; then # If CC is not set, then try to find GCC or a usable CC. if test -z "$CC"; then echo $ac_n "checking for gcc... $ac_c" 1>&6 - IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" + IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:" for dir in $PATH; do IFS="$save_ifs" test -z "$dir" && dir=. @@ -508,16 +313,16 @@ if test "$with_gcc" != yes || test -z "$CC"; then IFS="$save_ifs" if test -n "$CC"; then - echo "$ac_t$CC" 1>&6 + echo "$ac_t""$CC" 1>&6 else - echo "$ac_t"no 1>&6 + echo "$ac_t""no" 1>&6 fi fi # Not "gcc", so try "cc", rejecting "/usr/ucb/cc". if test -z "$CC"; then echo $ac_n "checking for cc... $ac_c" 1>&6 - IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" + IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:" cc_rejected=no for dir in $PATH; do test -z "$dir" && dir=. @@ -547,9 +352,9 @@ if test "$with_gcc" != yes || test -z "$CC"; then fi if test -n "$CC"; then - echo "$ac_t$CC" 1>&6 + echo "$ac_t""$CC" 1>&6 else - echo "$ac_t"no 1>&6 + echo "$ac_t""no" 1>&6 fi if test -z "$CC"; then @@ -561,96 +366,51 @@ if test "$with_gcc" != yes || test -z "$CC"; then # Now see if the compiler is really GCC. with_gcc=no echo $ac_n "checking whether we are using GNU C... $ac_c" 1>&6 - echo "$progname:564: checking whether we are using GNU C" >&5 + trap "$rm conftest.c; exit 1" 1 2 15 $rm conftest.c cat > conftest.c <<EOF #ifdef __GNUC__ yes; #endif EOF - if { ac_try='${CC-cc} -E conftest.c'; { (eval echo $progname:572: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + # LINENUM + if { ac_try='${CC-cc} -E conftest.c'; { (eval echo $progname:378: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then with_gcc=yes fi $rm conftest.c - echo "$ac_t$with_gcc" 1>&6 + echo $ac_t "$with_gcc" 1>&6 fi # Allow CC to be a program name with arguments. set dummy $CC compiler="$2" -echo $ac_n "checking for object suffix... $ac_c" 1>&6 -$rm conftest* -echo 'int i = 1;' > conftest.c -echo "$progname:586: checking for object suffix" >& 5 -if { (eval echo $progname:587: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; }; then - # Append any warnings to the config.log. - cat conftest.err 1>&5 - - for ac_file in conftest.*; do - case $ac_file in - *.c) ;; - *) objext=`echo $ac_file | sed -e s/conftest.//` ;; - esac - done -else - cat conftest.err 1>&5 - echo "$progname: failed program was:" >&5 - cat conftest.c >&5 -fi -$rm conftest* -echo "$ac_t$objext" 1>&6 - echo $ac_n "checking for $compiler option to produce PIC... $ac_c" 1>&6 pic_flag= +profile_flag_pattern= special_shlib_compile_flags= wl= link_static_flag= -no_builtin_flag= if test "$with_gcc" = yes; then + pic_flag='-fPIC' + profile_flag_pattern='-pg?' wl='-Wl,' link_static_flag='-static' - - case "$host_os" in - beos* | irix5* | irix6* | osf3* | osf4*) - # PIC is the default for these OSes. - ;; - aix*) - # Below there is a dirty hack to force normal static linking with -ldl - # The problem is because libdl dynamically linked with both libc and - # libC (AIX C++ library), which obviously doesn't included in libraries - # list by gcc. This cause undefined symbols with -static flags. - # This hack allows C programs to be linked with "-static -ldl", but - # we not sure about C++ programs. - link_static_flag="$link_static_flag ${wl}-lC" - ;; - cygwin* | mingw* | os2*) - # We can build DLLs from non-PIC. - ;; - 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'. - pic_flag='-m68020 -resident32 -malways-restore-a4' - ;; - *) - pic_flag='-fPIC' - ;; - esac else # PORTME Check for PIC flags for the system compiler. case "$host_os" in aix3* | aix4*) - # All AIX code is PIC. + # FIXME All rs/6000 code is PIC, but is there any non-rs/6000 AIX platform? + pic_flag= link_static_flag='-bnso -bI:/lib/syscalls.exp' ;; - hpux9* | hpux10* | hpux11*) - # Is there a better link_static_flag that works with the bundled CC? + hpux9* | hpux10*) + # FIXME is there a better link_static_flag that works with the bundled CC? wl='-Wl,' - link_static_flag="${wl}-a ${wl}archive" + link_static_flag='${wl}-a ${wl}archive' pic_flag='+Z' ;; @@ -658,14 +418,11 @@ else wl='-Wl,' link_static_flag='-non_shared' # PIC (with -KPIC) is the default. - ;; - - cygwin* | mingw* | os2*) - # We can build DLLs from non-PIC. + pic_flag= ;; osf3* | osf4*) - # All OSF/1 code is PIC. + # FIXME - pic_flag is probably required for hppa*-osf* and i860-osf* wl='-Wl,' link_static_flag='-non_shared' ;; @@ -676,7 +433,7 @@ else special_shlib_compile_flags='-belf' ;; - solaris*) + solaris2*) pic_flag='-KPIC' link_static_flag='-Bstatic' wl='-Wl,' @@ -688,182 +445,24 @@ else wl='-Qoption ld ' ;; - sysv4.2uw2* | sysv4.3* | sysv5*) - pic_flag='-KPIC' - link_static_flag='-Bstatic' - wl='-Wl,' - ;; - - uts4*) - pic_flag='-pic' - link_static_flag='-Bstatic' - ;; - *) can_build_shared=no ;; esac fi -if test -n "$pic_flag"; then - echo "$ac_t$pic_flag" 1>&6 - - # Check to make sure the pic_flag actually works. - echo $ac_n "checking if $compiler PIC flag $pic_flag works... $ac_c" 1>&6 - $rm conftest* - echo "int some_variable = 0;" > conftest.c - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $pic_flag -DPIC" - echo "$progname:717: checking if $compiler PIC flag $pic_flag works" >&5 - if { (eval echo $progname:718: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.$objext; then - # Append any warnings to the config.log. - cat conftest.err 1>&5 - - case "$host_os" in - hpux9* | hpux10* | hpux11*) - # On HP-UX, both CC and GCC only warn that PIC is supported... then they - # create non-PIC objects. So, if there were any warnings, we assume that - # PIC is not supported. - if test -s conftest.err; then - echo "$ac_t"no 1>&6 - can_build_shared=no - pic_flag= - else - echo "$ac_t"yes 1>&6 - pic_flag=" $pic_flag" - fi - ;; - *) - echo "$ac_t"yes 1>&6 - pic_flag=" $pic_flag" - ;; - esac - else - # Append any errors to the config.log. - cat conftest.err 1>&5 - can_build_shared=no - pic_flag= - echo "$ac_t"no 1>&6 - fi - CFLAGS="$save_CFLAGS" - $rm conftest* -else - echo "$ac_t"none 1>&6 -fi - -# Check to see if options -o and -c are simultaneously supported by compiler -echo $ac_n "checking if $compiler supports -c -o file.o... $ac_c" 1>&6 -$rm conftest* -echo "int some_variable = 0;" > conftest.c -save_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -c -o conftest2.o" -echo "$progname:760: checking if $compiler supports -c -o file.o" >&5 -if { (eval echo $progname:761: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest2.o; then - - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - echo "$ac_t"no 1>&6 - compiler_c_o=no - else - echo "$ac_t"yes 1>&6 - compiler_c_o=yes - fi -else - # Append any errors to the config.log. - cat conftest.err 1>&5 - compiler_c_o=no - echo "$ac_t"no 1>&6 -fi -CFLAGS="$save_CFLAGS" -$rm conftest* - -if test x"$compiler_c_o" = x"yes"; then - # Check to see if we can write to a .lo - echo $ac_n "checking if $compiler supports -c -o file.lo... $ac_c" 1>&6 - $rm conftest* - echo "int some_variable = 0;" > conftest.c - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -c -o conftest.lo" - echo "$progname:788: checking if $compiler supports -c -o file.lo" >&5 -if { (eval echo $progname:789: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.lo; then - - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - echo "$ac_t"no 1>&6 - compiler_o_lo=no - else - echo "$ac_t"yes 1>&6 - compiler_o_lo=yes - fi - else - # Append any errors to the config.log. - cat conftest.err 1>&5 - compiler_o_lo=no - echo "$ac_t"no 1>&6 - fi - CFLAGS="$save_CFLAGS" - $rm conftest* -else - compiler_o_lo=no -fi +case "$host_cpu" in +rs6000 | powerpc | powerpcle) + # Yippee! All RS/6000 and PowerPC code is position-independent. + pic_flag= + ;; +esac -# Check to see if we can do hard links to lock some files if needed -hard_links="nottested" -if test "$compiler_c_o" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - echo $ac_n "checking if we can lock with hard links... $ac_c" 1>&6 - 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 - echo "$ac_t$hard_links" 1>&6 - $rm conftest* - if test "$hard_links" = no; then - echo "*** WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2 - need_locks=warn - fi +if test -n "$pic_flag"; then + echo $ac_t "$pic_flag" 1>&6 + pic_flag=" $pic_flag" else - need_locks=no -fi - -if test "$with_gcc" = yes; then - # Check to see if options -fno-rtti -fno-exceptions are supported by compiler - echo $ac_n "checking if $compiler supports -fno-rtti -fno-exceptions ... $ac_c" 1>&6 - $rm conftest* - echo "int some_variable = 0;" > conftest.c - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.c" - echo "$progname:840: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 - if { (eval echo $progname:841: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.o; then - - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - echo "$ac_t"no 1>&6 - compiler_rtti_exceptions=no - else - echo "$ac_t"yes 1>&6 - compiler_rtti_exceptions=yes - fi - else - # Append any errors to the config.log. - cat conftest.err 1>&5 - compiler_rtti_exceptions=no - echo "$ac_t"no 1>&6 - fi - CFLAGS="$save_CFLAGS" - $rm conftest* - - if test "$compiler_rtti_exceptions" = "yes"; then - no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions' - else - no_builtin_flag=' -fno-builtin' - fi - + echo $ac_t none 1>&6 fi # Check for any special shared library compilation flags. @@ -876,27 +475,36 @@ if test -n "$special_shlib_compile_flags"; then fi fi -echo $ac_n "checking if $compiler static flag $link_static_flag works... $ac_c" 1>&6 -$rm conftest* -echo 'main(){return(0);}' > conftest.c -save_LDFLAGS="$LDFLAGS" -LDFLAGS="$LDFLAGS $link_static_flag" -echo "$progname:884: checking if $compiler static flag $link_static_flag works" >&5 -if { (eval echo $progname:885: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then - echo "$ac_t$link_static_flag" 1>&6 +# See if we are using a broken GCC collect2 program. +if test "$with_gcc" = yes; then + echo $ac_n "checking for broken GCC collect2... $ac_c" 1>&6 + + # FIXME: Run a test here, instead of relying on the canonical system name. + case "$host_os" in + aix3*) + can_build_shared=no + echo $ac_t yes 1>&6 + echo "$progname: to build shared libraries, set the CC env variable to \`xlc' and reconfigure" 1>&2 + ;; + *) + echo $ac_t no 1>&6 + ;; + esac +fi + +echo $ac_n "checking for $compiler option to statically link programs... $ac_c" 1>&6 +if test -n "$link_static_flag"; then + echo $ac_t "$link_static_flag" 1>&6 else - echo "$ac_t"none 1>&6 - link_static_flag= + echo $ac_t none 1>&6 fi -LDFLAGS="$save_LDFLAGS" -$rm conftest* if test -z "$LN_S"; then # Check to see if we can use ln -s, or we need hard links. echo $ac_n "checking whether ln -s works... $ac_c" 1>&6 - $rm conftestdata + rm -f conftestdata if ln -s X conftestdata 2>/dev/null; then - $rm conftestdata + rm -f conftestdata LN_S="ln -s" else LN_S=ln @@ -908,209 +516,81 @@ if test -z "$LN_S"; then fi fi -# Make sure LD is an absolute path. -if test -z "$LD"; then - ac_prog=ld - if test "$with_gcc" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - echo $ac_n "checking for ld used by GCC... $ac_c" 1>&6 - echo "$progname:917: checking for ld used by GCC" >&5 - ac_prog=`($CC -print-prog-name=ld) 2>&5` - case "$ac_prog" in - # Accept absolute paths. - /* | [A-Za-z]:[\\/]*) - re_direlt='/[^/][^/]*/\.\./' - # Canonicalize the path 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 are not 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 - echo $ac_n "checking for GNU ld... $ac_c" 1>&6 - echo "$progname:941: checking for GNU ld" >&5 - else - echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6 - echo "$progname:944: checking for non-GNU ld" >&5 - fi - +if test "$with_gnu_ld" != yes || test -z "$LD"; then if test -z "$LD"; then - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" + if test "$with_gnu_ld" = yes; then + echo $ac_n "checking for GNU ld... $ac_c" 1>&6 + else + echo $ac_n "checking for non-GNU ld... $ac_c" 1>&6 + fi + + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" for ac_dir in $PATH; do test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog"; then - LD="$ac_dir/$ac_prog" + if test -f "$ac_dir/ld"; then + LD="$ac_dir/ld" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some GNU ld's only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. - if "$LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then - test "$with_gnu_ld" != no && break + if "$LD" -v 2>&1 < /dev/null | egrep '(GNU ld|with BFD)' > /dev/null; then + test "$with_gnu_ld" = yes && break else test "$with_gnu_ld" != yes && break fi fi done IFS="$ac_save_ifs" - fi - if test -n "$LD"; then - echo "$ac_t$LD" 1>&6 - else - echo "$ac_t"no 1>&6 - fi + if test -n "$LD"; then + echo "$ac_t""$LD" 1>&6 + else + echo "$ac_t""no" 1>&6 + fi - if test -z "$LD"; then - echo "$progname: error: no acceptable ld found in \$PATH" 1>&2 - exit 1 + if test -z "$LD"; then + echo "$progname: error: no acceptable ld found in \$PATH" 1>&2 + exit 1 + fi fi -fi -# Check to see if it really is or is not GNU ld. -echo $ac_n "checking if the linker ($LD) is GNU ld... $ac_c" 1>&6 -# I'd rather use --version here, but apparently some GNU ld's only accept -v. -if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then - with_gnu_ld=yes -else - with_gnu_ld=no + echo $ac_n "checking whether we are using GNU ld... $ac_c" 1>&6 + # I'd rather use --version here, but apparently some GNU ld's only accept -v. + if $LD -v 2>&1 </dev/null | egrep '(GNU ld|with BFD)' > /dev/null; then + with_gnu_ld=yes + fi + echo $ac_t "$with_gnu_ld" 1>&6 fi -echo "$ac_t$with_gnu_ld" 1>&6 # See if the linker supports building shared libraries. echo $ac_n "checking whether the linker ($LD) supports shared libraries... $ac_c" 1>&6 allow_undefined_flag= -no_undefined_flag= -need_lib_prefix=unknown -need_version=unknown -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments archive_cmds= -archive_expsym_cmds= -old_archive_from_new_cmds= -export_dynamic_flag_spec= -whole_archive_flag_spec= -thread_safe_flag_spec= +export_dynamic_flag= hardcode_libdir_flag_spec= hardcode_libdir_separator= hardcode_direct=no hardcode_minus_L=no +hardcode_runpath_var=no hardcode_shlibpath_var=unsupported runpath_var= -always_export_symbols=no -export_symbols_cmds='$NM $libobjs | $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 -include_expsyms= -# exclude_expsyms can be an egrep regular expression 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'. -exclude_expsyms= - -case "$host_os" in -cygwin* | mingw*) - # 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 "$with_gcc" != yes; then - with_gnu_ld=no - fi - ;; - -freebsd2* | sunos4*) - exclude_expsyms="_GLOBAL_OFFSET_TABLE_" - ;; - -esac ld_shlibs=yes if test "$with_gnu_ld" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - # See if GNU ld supports shared libraries. - case "$host_os" in - aix3* | aix4*) - # On AIX, the GNU linker is very broken - ld_shlibs=no - cat <<EOF 1>&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 - ;; - - amigaos*) - archive_cmds='$rm $objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $objdir/a2ixlibrary.data~$AR cru $lib $libobjs~$RANLIB $lib~(cd $objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - ;; + case "$host_os" in sunos4*) - archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linkopts' - wlarc= + ld_shlibs=yes hardcode_direct=yes - hardcode_minus_L=yes hardcode_shlibpath_var=no ;; - beos*) - if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -nostart $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' - else - ld_shlibs=no - fi - ;; - - cygwin* | mingw*) - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec='-L$libdir' - allow_undefined_flag=unsupported - always_export_symbols=yes - - # Extract the symbol export list from an `--export-all' def file, - # then regenerate the def file from the symbol export list, so that - # the compiled dll only exports the symbol export list. - export_symbols_cmds='rm -f $objdir/$soname-ltdll.c~ - sed -e "/^# \/\* ltdll.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $objdir/$soname-ltdll.c~ - (cd $objdir && $CC -c $soname-ltdll.c)~ - $DLLTOOL --export-all --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --output-def $objdir/$soname-def $objdir/$soname-ltdll.$objext $libobjs~ - sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]* ; *//" < $objdir/$soname-def > $export_symbols' - - archive_expsym_cmds='echo EXPORTS > $objdir/$soname-def~ - _lt_hint=1; - for symbol in `cat $export_symbols`; do - echo " \$symbol @ \$_lt_hint ; " >> $objdir/$soname-def; - _lt_hint=`expr 1 + \$_lt_hint`; - done~ - $CC -Wl,--base-file,$objdir/$soname-base -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts~ - $DLLTOOL --as=$AS --dllname $soname --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --def $objdir/$soname-def --base-file $objdir/$soname-base --output-exp $objdir/$soname-exp~ - $CC -Wl,--base-file,$objdir/$soname-base $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts~ - $DLLTOOL --as=$AS --dllname $soname --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --def $objdir/$soname-def --base-file $objdir/$soname-base --output-exp $objdir/$soname-exp~ - $CC $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts' - - old_archive_from_new_cmds='$DLLTOOL --as=$AS --dllname $soname --def $objdir/$soname-def --output-lib $objdir/$libname.a' - ;; - *) if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs=yes else ld_shlibs=no fi @@ -1118,428 +598,121 @@ EOF esac if test "$ld_shlibs" = yes; then - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec='${wl}--export-dynamic' - whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + archive_cmds='$cc -shared ${wl}-soname $wl$soname -o $lib$libobjs$deplibs' + hardcode_libdir_flag_spec='${wl}-rpath $wl$libdir' + export_dynamic_flag='${wl}-export-dynamic' fi else # PORTME fill in a description of your system's linker (not GNU ld) case "$host_os" in aix3*) allow_undefined_flag=unsupported - always_export_symbols=yes - archive_expsym_cmds='$LD -o $objdir/$soname $libobjs $deplibs $linkopts -bE:$export_symbols -T512 -H512 -bM:SRE~$AR cru $lib $objdir/$soname' + archive_cmds='/usr/ucb/nm$libobjs | egrep \" [BD] \" | sed \"s/^.* //\" > $lib.exp;$LD -o $objdir/$soname$libobjs -bE:$lib.exp -T512 -H512 -bM:SRE -lc$deplibs;$AR cru $lib $objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes - if test "$with_gcc" = yes && test -z "$link_static_flag"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - hardcode_direct=unsupported - fi ;; aix4*) - allow_undefined_flag= - if test "$with_gcc" = yes; then - if strings `${CC} -print-prog-name=collect2` | \ - grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - hardcode_direct=yes - else - # We have old collect2 - hardcode_direct=unsupported - fi - archive_cmds='$CC -shared ${wl}-bnoentry -o $objdir/$soname $libobjs $deplibs $linkopts' - else - always_export_symbols=yes - archive_expsym_cmds='$CC -o $objdir/$soname $libobjs $deplibs $linkopts ${wl}-bE:$export_symbols ${wl}-bM:SRE ${wl}-bnoentry' - hardcode_direct=yes - fi - hardcode_minus_L=yes - # Though LIBPATH variable hardcodes shlibpath into executable, - # it doesn't affect searching for -l* libraries; this confuses - # tests in mdemo. - hardcode_shlibpath_var=unsupported - hardcode_libdir_flag_spec='-L$libdir' - ;; - - amigaos*) - archive_cmds='$rm $objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $objdir/a2ixlibrary.data~$AR cru $lib $libobjs~$RANLIB $lib~(cd $objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - ;; - - cygwin* | mingw*) - # 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. - hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # FIXME: Setting linknames here is a bad hack. - archive_cmds='$CC -o $lib $libobjs $linkopts `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - old_archive_from_new_cmds='true' - # FIXME: Should let the user specify the lib program. - old_archive_cmds='lib /OUT:$oldlib$oldobjs' - fix_srcfile_path='`cygpath -w $srcfile`' - ;; - - freebsd1*) - ld_shlibs=no - can_build_shared=no + archive_cmds='/bin/nm -B$libobjs | egrep \" [BD] \" | sed \"s/^.* //\" > $lib.exp;$cc -o $objdir/$soname$libobjs ${wl}-bE:$lib.exp ${wl}-bM:SRE ${wl}-bnoentry$deplibs;$AR cru $lib $objdir/$soname' + hardcode_direct=yes + hardcode_minus_L=yes ;; # 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 + # doesn't break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts /usr/lib/c++rt0.o' - hardcode_libdir_flag_spec='-R$libdir' + archive_cmds='$LD -Bshareable -o $lib$libobjs$deplibs /usr/lib/c++rt0.o' hardcode_direct=yes - hardcode_minus_L=no # verified on 2.2.6 + hardcode_minus_L=yes hardcode_shlibpath_var=no ;; - # Unfortunately, older versions of FreeBSD 2 do not have this feature. + # Unfortunately, older versions of FreeBSD 2 don't have this feature. freebsd2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts' + archive_cmds='$LD -Bshareable -o $lib$libobjs$deplibs' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd*) - archive_cmds='$CC -shared -o $lib $libobjs $deplibs $linkopts' - hardcode_libdir_flag_spec='-R$libdir' + # FreeBSD 3, at last, uses gcc -shared to do shared libraries. + freebsd3*) + archive_cmds='$CC -shared -o $lib$libobjs$deplibs' hardcode_direct=yes - hardcode_minus_L=no + hardcode_minusL=yes hardcode_shlibpath_var=no ;; hpux9*) - archive_cmds='$rm $objdir/$soname~$LD -b +s +b $install_libdir -o $objdir/$soname $libobjs $deplibs $linkopts~test $objdir/$soname = $lib || mv $objdir/$soname $lib' + archive_cmds='$rm $objdir/$soname;$LD -b +s +b $install_libdir -o $objdir/$soname$libobjs$deplibs;mv $objdir/$soname $lib' hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_direct=yes hardcode_minus_L=yes - export_dynamic_flag_spec='${wl}-E' ;; - hpux10* | hpux11*) - archive_cmds='$LD -b +h $soname +s +b $install_libdir -o $lib $libobjs $deplibs $linkopts' + hpux10*) + archive_cmds='$LD -b +h $soname +s +b $install_libdir -o $lib$libobjs$deplibs' hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_direct=yes hardcode_minus_L=yes - export_dynamic_flag_spec='${wl}-E' ;; irix5* | irix6*) - if test "$with_gcc" = yes; then - archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' - else - archive_cmds='$LD -shared $libobjs $deplibs $linkopts -soname $soname `test -n "$verstring" && echo -set_version $verstring` -o $lib' - fi + archive_cmds='$LD -shared -o $lib -soname $soname -set_version $verstring$libobjs -lc$deplibs' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts' # a.out - else - archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linkopts' # ELF - fi - hardcode_libdir_flag_spec='${wl}-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no ;; - openbsd*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts' + netbsd* | openbsd*) + # Tested with NetBSD 1.2 ld + archive_cmds='$LD -Bshareable -o $lib$libobjs$deplibs' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; - os2*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - allow_undefined_flag=unsupported - archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $objdir/$libname.def~$echo DATA >> $objdir/$libname.def~$echo " SINGLE NONSHARED" >> $objdir/$libname.def~$echo EXPORTS >> $objdir/$libname.def~emxexp $libobjs >> $objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $linkopts $objdir/$libname.def' - old_archive_from_new_cmds='emximp -o $objdir/$libname.a $objdir/$libname.def' - ;; - osf3* | osf4*) - if test "$with_gcc" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $linkopts ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linkopts -soname $soname `test -n "$verstring" && echo -set_version $verstring` -o $lib' - fi + allow_undefined_flag=' -expect_unresolved' + archive_cmds='$LD -shared${allow_undefined_flag} -o $lib -soname $soname -set_version $verstring$libobjs -lc$deplibs' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; sco3.2v5*) - archive_cmds='$LD -G -o $lib $libobjs $deplibs $linkopts' + archive_cmds='$LD -G -o $lib$libobjs$deplibs' hardcode_direct=yes ;; - solaris*) - no_undefined_flag=' -z text' - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linkopts' - archive_expsym_cmds='$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 $linkopts~$rm $lib.exp' + solaris2*) + archive_cmds='$LD -G -z text -h $soname -o $lib$libobjs$deplibs' hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=no ;; sunos4*) - # Why do we need -Bstatic? To avoid inter-library dependencies, maybe... - if test "$with_gcc" = yes; then - # Use -fPIC here because libgcc is multilibbed - archive_cmds='$CC -shared ${wl}-Bstatic -fPIC -o $lib $libobjs $deplibs $linkopts' - else - archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linkopts' - fi + archive_cmds='$LD -assert pure-text -Bstatic -o $lib$libobjs' hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; - sysv4.3*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' - hardcode_direct=no - hardcode_minus_L=no - hardcode_shlibpath_var=no - export_dynamic_flag_spec='-Bexport' - ;; - - uts4*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_direct=no - hardcode_minus_L=no - hardcode_shlibpath_var=no - ;; - - dgux*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_direct=no - hardcode_minus_L=no - hardcode_shlibpath_var=no - ;; - *) ld_shlibs=no can_build_shared=no ;; esac fi -echo "$ac_t$ld_shlibs" 1>&6 - -if test -z "$NM"; then - echo $ac_n "checking for BSD-compatible nm... $ac_c" 1>&6 - case "$NM" in - /* | [A-Za-z]:[/\\]*) ;; # Let the user override the test with a path. - *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" - for ac_dir in $PATH /usr/ucb /usr/ccs/bin /bin; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/nm; 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 - if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then - NM="$ac_dir/nm -B" - break - elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then - NM="$ac_dir/nm -p" - break - else - NM=${NM="$ac_dir/nm"} # keep the first match, but - continue # so that we can try to find one that supports BSD flags - fi - fi - done - IFS="$ac_save_ifs" - test -z "$NM" && NM=nm - ;; - esac - echo "$ac_t$NM" 1>&6 -fi - -# Check for command to grab the raw symbol name followed by C symbol from nm. -echo $ac_n "checking command to parse $NM output... $ac_c" 1>&6 - -# 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 the above into a raw symbol and a C symbol. -symxfrm='\1 \2\3 \3' - -# Transform an extracted symbol line into a proper C declaration -global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'" - -# Define system-specific variables. -case "$host_os" in -aix*) - symcode='[BCDT]' - ;; -cygwin* | mingw*) - symcode='[ABCDGISTW]' - ;; -hpux*) # Its linker distinguishes data from code symbols - global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^. .* \(.*\)$/extern char \1;/p'" - ;; -irix*) - symcode='[BCDEGRST]' - ;; -solaris*) - symcode='[BDT]' - ;; -esac - -# If we're using GNU nm, then use its standard symbol codes. -if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then - symcode='[ABCDGISTW]' -fi - -# Try without a prefix undercore, then with it. -for ac_symprfx in "" "_"; do - - # Write the raw and C identifiers. - global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode\)[ ][ ]*\($ac_symprfx\)$sympat$/$symxfrm/p'" - - # Check to see that the pipe works correctly. - pipe_works=no - $rm conftest* - cat > conftest.c <<EOF -#ifdef __cplusplus -extern "C" { -#endif -char nm_test_var; -void nm_test_func(){} -#ifdef __cplusplus -} -#endif -main(){nm_test_var='a';nm_test_func();return(0);} -EOF - - echo "$progname:1447: checking if global_symbol_pipe works" >&5 - if { (eval echo $progname:1448: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; } && test -s conftest.$objext; then - # Now try to grab the symbols. - nlist=conftest.nm - if { echo "$progname:1451: eval \"$NM conftest.$objext | $global_symbol_pipe > $nlist\"" >&5; eval "$NM conftest.$objext | $global_symbol_pipe > $nlist 2>&5"; } && 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 egrep ' nm_test_var$' "$nlist" >/dev/null; then - if egrep ' nm_test_func$' "$nlist" >/dev/null; then - cat <<EOF > conftest.c -#ifdef __cplusplus -extern "C" { -#endif - -EOF - # Now generate the symbol file. - eval "$global_symbol_to_cdecl"' < "$nlist" >> conftest.c' - - cat <<EOF >> conftest.c -#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/^. \(.*\) \(.*\)$/ {"\2", (lt_ptr_t) \&\2},/' < "$nlist" >> conftest.c - cat <<\EOF >> conftest.c - {0, (lt_ptr_t) 0} -}; - -#ifdef __cplusplus -} -#endif -EOF - # Now try linking the two files. - mv conftest.$objext conftestm.$objext - save_LIBS="$LIBS" - save_CFLAGS="$CFLAGS" - LIBS="conftestm.$objext" - CFLAGS="$CFLAGS$no_builtin_flag" - if { (eval echo $progname:1503: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then - pipe_works=yes - else - echo "$progname: failed program was:" >&5 - cat conftest.c >&5 - fi - LIBS="$save_LIBS" - else - echo "cannot find nm_test_func in $nlist" >&5 - fi - else - echo "cannot find nm_test_var in $nlist" >&5 - fi - else - echo "cannot run $global_symbol_pipe" >&5 - fi - else - echo "$progname: failed program was:" >&5 - cat conftest.c >&5 - fi - $rm conftest* - - # Do not use the global_symbol_pipe unless it works. - if test "$pipe_works" = yes; then - break - else - global_symbol_pipe= - fi -done -echo "$ac_t$pipe_works" 1>&6 - -if test -z "$global_symbol_pipe"; then - global_symbol_to_cdecl= -fi +echo $ac_t "$ld_shlibs" 1>&6 # Check hardcoding attributes. echo $ac_n "checking how to hardcode library paths into programs... $ac_c" 1>&6 hardcode_action= if test -n "$hardcode_libdir_flag_spec" || \ - test -n "$runpath_var"; then + test "$hardcode_runpath_var" = yes; then # We can hardcode non-existant directories. if test "$hardcode_direct" != no && \ @@ -1552,195 +725,77 @@ if test -n "$hardcode_libdir_flag_spec" || \ # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action=immediate fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. +elif test "$hardcode_direct" != yes && \ + test "$hardcode_minus_L" != yes && \ + test "$hardcode_shlibpath_var" != yes; then + # We can't hardcode anything. hardcode_action=unsupported +else + # We can only hardcode existing directories. + hardcode_action=relink fi -echo "$ac_t$hardcode_action" 1>&6 +echo $ac_t "$hardcode_action" 1>&6 +test "$hardcode_action" = unsupported && can_build_shared=no reload_flag= reload_cmds='$LD$reload_flag -o $output$reload_objs' echo $ac_n "checking for $LD option to reload object files... $ac_c" 1>&6 -# PORTME Some linkers may need a different reload flag. +# PORTME Some linker may need a different reload flag. reload_flag='-r' -echo "$ac_t$reload_flag" 1>&6 +echo $ac_t "$reload_flag" test -n "$reload_flag" && reload_flag=" $reload_flag" # PORTME Fill in your ld.so characteristics library_names_spec= -libname_spec='lib$name' soname_spec= 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" -sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -file_magic_cmd= -file_magic_test_file= -deplibs_check_method='unknown' -# Need to set the preceding variable on all platforms that support -# interlibrary dependencies. -# 'none' -- dependencies not supported. -# `unknown' -- same as none, but documents that we really don't know. -# 'pass_all' -- all dependencies passed with no checks. -# 'test_compile' -- check by making test program. -# 'file_magic [regex]' -- check by looking for files in library path -# which responds to the $file_magic_cmd with a given egrep regex. -# If you have `file' or equivalent on your system and you're not sure -# whether `pass_all' will *always* work, you probably want this one. + echo $ac_n "checking dynamic linker characteristics... $ac_c" 1>&6 case "$host_os" in -aix3*) +aix3* | aix4*) version_type=linux - library_names_spec='${libname}${release}.so$versuffix $libname.a' + library_names_spec='$libname.so.$versuffix $libname.a' shlibpath_var=LIBPATH # AIX has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}.so$major' - ;; - -aix4*) - version_type=linux - # AIX 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. - # We preserve .a as extension for shared libraries though AIX4.2 - # and later linker supports .so - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.a' - shlibpath_var=LIBPATH - deplibs_check_method=pass_all - ;; - -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' + soname_spec='$libname.so.$major' ;; -beos*) - library_names_spec='${libname}.so' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi4*) - version_type=linux - library_names_spec='${libname}.so$major ${libname}.so' - soname_spec='${libname}.so' - finish_cmds='PATH="$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - deplibs_check_method='file_magic ELF 32-bit LSB shared object' - file_magic_cmd=/usr/bin/file - file_magic_test_file=/shlib/libc.so - 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*) - version_type=windows - if test "$with_gcc" = yes; then - library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.a' - else - library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.lib' - fi - dynamic_linker='Win32 ld.exe' - deplibs_check_method='file_magic file format pei*-i386.*architecture: i386' - file_magic_cmd='objdump -f' - need_lib_prefix=no - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -freebsd1*) - dynamic_linker=no - ;; - -freebsd*) - objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` - version_type=freebsd-$objformat - case "$version_type" in - freebsd-elf*) - deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object' - file_magic_cmd=/usr/bin/file - file_magic_test_file=`echo /usr/lib/libc.so*` - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - deplibs_check_method=unknown - library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix' - need_version=yes - ;; - esac - finish_cmds='PATH="$PATH:/sbin" OBJFORMAT="'"$objformat"'" ldconfig -m $libdir' +freebsd2* | freebsd3*) + version_type=sunos + library_names_spec='$libname.so.$versuffix $libname.so' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH ;; gnu*) - version_type=linux - library_names_spec='${libname}${release}.so$versuffix ${libname}.so' + version_type=sunos + library_names_spec='$libname.so.$versuffix' shlibpath_var=LD_LIBRARY_PATH ;; -hpux9* | hpux10* | hpux11*) +hpux9* | hpux10*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. dynamic_linker="$host_os dld.sl" version_type=sunos - need_lib_prefix=no - need_version=no shlibpath_var=SHLIB_PATH - library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl' - soname_spec='${libname}${release}.sl$major' + library_names_spec='$libname.sl.$versuffix $libname.sl.$major $libname.sl' + soname_spec='$libname.sl.$major' # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; -irix5*) - version_type=irix - soname_spec='${libname}${release}.so' - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' +irix5* | irix6*) + version_type=osf + soname_spec='$libname.so' + library_names_spec='$libname.so.$versuffix $libname.so' shlibpath_var=LD_LIBRARY_PATH - deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" # or should it be pass_all? - file_magic_cmd=/usr/bin/file - file_magic_test_file=`echo /lib/libc.so*` - shlibpath_overrides_runpath=no - ;; - -irix6*) - version_type=irix - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}.so' - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' - case "$LD" in # libtool.m4 will add one of these switches to LD - *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - # even though /usr/local/lib is always searched, the man-page says - # shared libraries should not be installed there if they use an ABI - # different from -32, so we'd better not search for shared libraries - # there either - sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}" - deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1" # or should it be pass_all? - file_magic_cmd=/usr/bin/file - file_magic_test_file=`echo /lib${libsuff}/libc.so*` ;; # No shared lib support for Linux oldld, aout, or coff. @@ -1751,16 +806,10 @@ linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*) # This must be Linux ELF. linux-gnu*) version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' - finish_cmds='PATH="$PATH:/sbin" ldconfig -n $libdir' + library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so' + soname_spec='$libname.so.$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' - file_magic_cmd=/usr/bin/file - file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` if test -f /lib/ld.so.1; then dynamic_linker='GNU ld.so' @@ -1773,910 +822,184 @@ linux-gnu*) fi ;; -netbsd*) - version_type=sunos - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' - finish_cmds='PATH="$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so' - soname_spec='${libname}${release}.so$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - ;; - -openbsd*) +netbsd* | openbsd*) version_type=sunos - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - need_version=no - fi - library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + library_names_spec='$libname.so.$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH ;; -os2*) - libname_spec='$name' - need_lib_prefix=no - library_names_spec='$libname.dll $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - osf3* | osf4*) version_type=osf - soname_spec='${libname}${release}.so' - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' + soname_spec='$libname.so' + library_names_spec='$libname.so.$versuffix $libname.so' shlibpath_var=LD_LIBRARY_PATH - # deplibs_check_method='pass_all' - # Although pass_all appears to work, it copies symbols from static libraries - # into shared ones and exports them. So, when a program is linked with two - # or more libraries that have got copies of the same symbols, link fails - # This was only tested on osf4: - deplibs_check_method='file_magic COFF format alpha shared library' - file_magic_cmd=/usr/bin/file - file_magic_test_file=/shlib/libc.so - 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" ;; sco3.2v5*) version_type=osf - soname_spec='${libname}${release}.so$major' - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='$libname.so.$major' + library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so' shlibpath_var=LD_LIBRARY_PATH ;; -solaris*) +solaris2*) version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' + library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so' + soname_spec='$libname.so.$major' shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - deplibs_check_method="file_magic ELF [0-9][0-9]-bit [LM]SB dynamic lib" - file_magic_cmd=/usr/bin/file - file_magic_test_file=/lib/libc.so ;; sunos4*) version_type=sunos - library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + library_names_spec='$libname.so.$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.2uw2* | sysv4.3* | sysv5*) - version_type=linux - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' - shlibpath_var=LD_LIBRARY_PATH - case "$host_vendor" in - ncr) - deplibs_check_method='pass_all' - ;; - esac - ;; - -uts4*) - version_type=linux - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' - shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac -echo "$ac_t$dynamic_linker" 1>&6 +echo "$ac_t""$dynamic_linker" test "$dynamic_linker" = no && can_build_shared=no -# Report the final consequences. -echo "checking if libtool supports shared libraries... $can_build_shared" 1>&6 +# FIXME need to add library stripping features +# strip -x works for most platforms, though not for static libraries on NetBSD +# HP-UX requires "-r" for library stripping +striplib= +old_striplib= -if test -n "$file_magic_test_file" && test -n "$file_magic_cmd"; then - case "$deplibs_check_method" in - "file_magic "*) - file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - egrep "$file_magic_regex" > /dev/null; then - : - else - cat <<EOF 1>&2 +#echo $ac_n "checking for static library strip program... $ac_c" 1>&6 +#if test -n "$old_striplib"; then +# echo $ac_t "$old_striplib" 1>&6 +#else +# echo $ac_t none 1>&6 +#fi -*** 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 +#if test "$can_build_shared" = yes; then +# echo $ac_n "checking for shared library strip program... $ac_c" 1>&6 +# +# if test -n "$striplib"; then +# echo $ac_t "$striplib" 1>&6 +# else +# echo $ac_t none 1>&6 +# fi +#fi -EOF - fi ;; - esac -fi +# Report the consequences. +echo "checking if libtool supports shared libraries... $can_build_shared" 1>&6 echo $ac_n "checking whether to build shared libraries... $ac_c" 1>&6 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. +# On AIX, shared libraries and static libraries use the same namespace. case "$host_os" in -aix3*) +aix*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" + archive_cmds="$archive_cmds;\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; - -aix4*) - test "$enable_shared" = yes && enable_static=no - ;; esac -echo "$ac_t$enable_shared" 1>&6 +echo "$ac_t""$enable_shared" 1>&6 # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes echo "checking whether to build static libraries... $enable_static" 1>&6 -if test "$hardcode_action" = 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 - -echo $ac_n "checking for objdir... $ac_c" 1>&6 -rm -f .libs 2>/dev/null -mkdir .libs 2>/dev/null -if test -d .libs; then - objdir=.libs -else - # MS-DOS does not allow filenames that begin with a dot. - objdir=_libs -fi -rmdir .libs 2>/dev/null -echo "$ac_t$objdir" 1>&6 - -if test "x$enable_dlopen" != xyes; then - enable_dlopen=unknown - enable_dlopen_self=unknown - enable_dlopen_self_static=unknown -else -if eval "test \"`echo '$''{'lt_cv_dlopen'+set}'`\" != set"; then - lt_cv_dlopen=no lt_cv_dlopen_libs= -echo $ac_n "checking for dlopen""... $ac_c" 1>&6 -echo "$progname:1977: checking for dlopen" >&5 -if eval "test \"`echo '$''{'ac_cv_func_dlopen'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 1982 "ltconfig" -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char dlopen(); below. */ -#include <assert.h> -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char dlopen(); - -int main() { - -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_dlopen) || defined (__stub___dlopen) -choke me -#else -dlopen(); -#endif - -; return 0; } -EOF -if { (eval echo $progname:2004: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_dlopen=yes" -else - echo "$progname: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_dlopen=no" -fi -rm -f conftest* -fi - -if eval "test \"`echo '$ac_cv_func_'dlopen`\" = yes"; then - echo "$ac_t""yes" 1>&6 - lt_cv_dlopen="dlopen" -else - echo "$ac_t""no" 1>&6 -echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6 -echo "$progname:2022: checking for dlopen in -ldl" >&5 -ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_save_LIBS="$LIBS" -LIBS="-ldl $LIBS" -cat > conftest.$ac_ext <<EOF -#line 2030 "ltconfig" -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char dlopen(); - -int main() { -dlopen() -; return 0; } -EOF -if { (eval echo $progname:2040: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "$progname: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" - -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - echo "$ac_t""no" 1>&6 -echo $ac_n "checking for dld_link in -ldld""... $ac_c" 1>&6 -echo "$progname:2059: checking for dld_link in -ldld" >&5 -ac_lib_var=`echo dld'_'dld_link | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_save_LIBS="$LIBS" -LIBS="-ldld $LIBS" -cat > conftest.$ac_ext <<EOF -#line 2067 "ltconfig" -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char dld_link(); - -int main() { -dld_link() -; return 0; } -EOF -if { (eval echo $progname:2077: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "$progname: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" - -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" -else - echo "$ac_t""no" 1>&6 -echo $ac_n "checking for shl_load""... $ac_c" 1>&6 -echo "$progname:2096: checking for shl_load" >&5 -if eval "test \"`echo '$''{'ac_cv_func_shl_load'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 2101 "ltconfig" -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char shl_load(); below. */ -#include <assert.h> -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char shl_load(); - -int main() { - -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_shl_load) || defined (__stub___shl_load) -choke me -#else -shl_load(); -#endif - -; return 0; } -EOF -if { (eval echo $progname:2123: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_shl_load=yes" -else - echo "$progname: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_shl_load=no" -fi -rm -f conftest* -fi - -if eval "test \"`echo '$ac_cv_func_'shl_load`\" = yes"; then - echo "$ac_t""yes" 1>&6 - lt_cv_dlopen="shl_load" -else - echo "$ac_t""no" 1>&6 -echo $ac_n "checking for LoadLibrary""... $ac_c" 1>&6 -echo "$progname:2141: checking for LoadLibrary" >&5 -if eval "test \"`echo '$''{'ac_cv_func_LoadLibrary'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 2146 "ltconfig" -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char LoadLibrary(); below. */ -#include <assert.h> -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char LoadLibrary(); - -int main() { - -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_LoadLibrary) || defined (__stub___LoadLibrary) -choke me -#else -LoadLibrary(); -#endif - -; return 0; } -EOF -if { (eval echo $progname:2168: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_LoadLibrary=yes" -else - echo "$progname: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_LoadLibrary=no" -fi -rm -f conftest* -fi - -if eval "test \"`echo '$ac_cv_func_'LoadLibrary`\" = yes"; then - echo "$ac_t""yes" 1>&6 - lt_cv_dlopen="LoadLibrary" -else - echo "$ac_t""no" 1>&6 -fi - - -fi - - -fi - - -fi - - -fi - -fi - - if test "x$lt_cv_dlopen" != xno; then - enable_dlopen=yes - fi - - case "$lt_cv_dlopen" in - dlopen) -for ac_hdr in dlfcn.h; do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "$progname:2210: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 2215 "ltconfig" -#include <$ac_hdr> -int fnord = 0; -EOF -ac_try="$ac_compile conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo $progname:2220: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "$progname: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi -done - - if test "x$ac_cv_header_dlfcn_h" = xyes; then - CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" - fi - eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" - LIBS="$lt_cv_dlopen_libs $LIBS" - - echo $ac_n "checking whether a program can dlopen itself""... $ac_c" 1>&6 -echo "$progname:2248: checking whether a program can dlopen itself" >&5 -if test "${lt_cv_dlopen_self+set}" = set; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test "$cross_compiling" = yes; then - lt_cv_dlopen_self=cross - else - cat > conftest.c <<EOF -#line 2256 "ltconfig" - -#if HAVE_DLFCN_H -#include <dlfcn.h> -#endif - -#include <stdio.h> - -#ifdef RTLD_GLOBAL -# define LTDL_GLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LTDL_GLOBAL DL_GLOBAL -# else -# define LTDL_GLOBAL 0 -# endif -#endif - -/* We may have to define LTDL_LAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LTDL_LAZY_OR_NOW -# ifdef RTLD_LAZY -# define LTDL_LAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LTDL_LAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LTDL_LAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LTDL_LAZY_OR_NOW DL_NOW -# else -# define LTDL_LAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -fnord() { int i=42;} -main() { void *self, *ptr1, *ptr2; self=dlopen(0,LTDL_GLOBAL|LTDL_LAZY_OR_NOW); - if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord"); - if(ptr1 || ptr2) exit(0); } exit(1); } - -EOF -if { (eval echo $progname:2302: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null -then - lt_cv_dlopen_self=yes -else - echo "$progname: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - lt_cv_dlopen_self=no -fi -rm -fr conftest* -fi - -fi - -echo "$ac_t""$lt_cv_dlopen_self" 1>&6 - - if test "$lt_cv_dlopen_self" = yes; then - LDFLAGS="$LDFLAGS $link_static_flag" - echo $ac_n "checking whether a statically linked program can dlopen itself""... $ac_c" 1>&6 -echo "$progname:2321: checking whether a statically linked program can dlopen itself" >&5 -if test "${lt_cv_dlopen_self_static+set}" = set; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test "$cross_compiling" = yes; then - lt_cv_dlopen_self_static=cross - else - cat > conftest.c <<EOF -#line 2329 "ltconfig" - -#if HAVE_DLFCN_H -#include <dlfcn.h> -#endif - -#include <stdio.h> - -#ifdef RTLD_GLOBAL -# define LTDL_GLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LTDL_GLOBAL DL_GLOBAL -# else -# define LTDL_GLOBAL 0 -# endif -#endif - -/* We may have to define LTDL_LAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LTDL_LAZY_OR_NOW -# ifdef RTLD_LAZY -# define LTDL_LAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LTDL_LAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LTDL_LAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LTDL_LAZY_OR_NOW DL_NOW -# else -# define LTDL_LAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -fnord() { int i=42;} -main() { void *self, *ptr1, *ptr2; self=dlopen(0,LTDL_GLOBAL|LTDL_LAZY_OR_NOW); - if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord"); - if(ptr1 || ptr2) exit(0); } exit(1); } - -EOF -if { (eval echo $progname:2375: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null -then - lt_cv_dlopen_self_static=yes -else - echo "$progname: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - lt_cv_dlopen_self_static=no -fi -rm -fr conftest* -fi - -fi - -echo "$ac_t""$lt_cv_dlopen_self_static" 1>&6 -fi - ;; - 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 - -# Copy echo and quote the copy, instead of the original, because it is -# used later. -ltecho="$echo" -if test "X$ltecho" = "X$CONFIG_SHELL $0 --fallback-echo"; then - ltecho="$CONFIG_SHELL \$0 --fallback-echo" -fi -LTSHELL="$SHELL" - -LTCONFIG_VERSION="$VERSION" - -# Only quote variables if we're using ltmain.sh. -case "$ltmain" in -*.sh) - # Now quote all the things that may contain metacharacters. - for var in ltecho old_CC old_CFLAGS old_CPPFLAGS old_LD old_NM old_RANLIB \ - old_LN_S old_DLLTOOL old_AS AR CC LD LN_S NM LTSHELL LTCONFIG_VERSION \ - reload_flag reload_cmds wl \ - pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \ - thread_safe_flag_spec whole_archive_flag_spec libname_spec \ - library_names_spec soname_spec \ - RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \ - old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds postuninstall_cmds \ - file_magic_cmd export_symbols_cmds deplibs_check_method allow_undefined_flag no_undefined_flag \ - finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \ - hardcode_libdir_flag_spec hardcode_libdir_separator \ - sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ - compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do - - case "$var" in - reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \ - old_postinstall_cmds | old_postuninstall_cmds | \ - export_symbols_cmds | archive_cmds | archive_expsym_cmds | \ - postinstall_cmds | postuninstall_cmds | \ - finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) - # Double-quote double-evaled strings. - eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" - ;; - *) - eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" - ;; - esac - done - - case "$ltecho" in - *'\$0 --fallback-echo"') - ltecho=`$echo "X$ltecho" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` - ;; - esac - - trap "$rm \"$ofile\"; exit 1" 1 2 15 - echo "creating $ofile" - $rm "$ofile" - cat <<EOF > "$ofile" -#! $SHELL +ofile=libtool +trap "$rm $ofile; exit 1" 1 2 15 +echo creating $ofile +rm -fr $ofile +cat <<EOF > $ofile +#! /bin/sh -# `$echo "$ofile" | 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 ltconfig or ltmain.sh. -# -# Copyright (C) 1996-1999 Free Software Foundation, Inc. -# Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 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. +# libtool - Provide generalized library-building support services. # -# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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. - -# Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="sed -e s/^X//" - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -if test "\${CDPATH+set}" = set; then CDPATH=; export CDPATH; fi - -### BEGIN LIBTOOL CONFIG -EOF - cfgfile="$ofile" - ;; - -*) - # Double-quote the variables that need it (for aesthetics). - for var in old_CC old_CFLAGS old_CPPFLAGS old_LD old_NM old_RANLIB \ - old_LN_S old_DLLTOOL old_AS; do - eval "$var=\\\"\$var\\\"" - done - - # Just create a config file. - cfgfile="$ofile.cfg" - trap "$rm \"$cfgfile\"; exit 1" 1 2 15 - echo "creating $cfgfile" - $rm "$cfgfile" - cat <<EOF > "$cfgfile" -# `$echo "$cfgfile" | sed 's%^.*/%%'` - Libtool configuration file. -# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) -EOF - ;; -esac - -cat <<EOF >> "$cfgfile" -# Libtool was configured as follows, on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# Generated automatically by $PROGRAM - GNU $PACKAGE $VERSION +# This program was configured as follows, +# on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # -# CC=$old_CC CFLAGS=$old_CFLAGS CPPFLAGS=$old_CPPFLAGS \\ -# LD=$old_LD NM=$old_NM RANLIB=$old_RANLIB LN_S=$old_LN_S \\ -# DLLTOOL="$old_DLLTOOL" AS="$old_AS" \\ +# CC="$old_CC" CFLAGS="$old_CFLAGS" CPPFLAGS="$old_CPPFLAGS" \\ +# LD="$old_LD" RANLIB="$old_RANLIB" LN_S="$old_LN_S" \\ # $0$ltconfig_args # # Compiler and other test output produced by $progname, useful for # debugging $progname, is in ./config.log if it exists. # The version of $progname that generated this script. -LTCONFIG_VERSION=$LTCONFIG_VERSION - -# Shell to use when invoking shell scripts. -SHELL=$LTSHELL +LTCONFIG_VERSION="$VERSION" -# Whether or not to build shared libraries. +# Whether or not to build libtool libraries. build_libtool_libs=$enable_shared -# Whether or not to build static libraries. +# Whether or not to build old-style libraries. build_old_libs=$enable_static -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install - # The host system. -host_alias=$host_alias -host=$host - -# An echo program that does not interpret backslashes. -echo=$ltecho +host_alias="$host_alias" +host="$host" # The archiver. -AR=$AR - -# The default C compiler. -CC=$CC +AR='$AR' # The linker used to build libraries. -LD=$LD +LD='$LD' # Whether we need hard or soft links. -LN_S=$LN_S - -# A BSD-compatible nm program. -NM=$NM - -# Used on cygwin: DLL creation program. -DLLTOOL="$DLLTOOL" - -# Used on cygwin: assembler. -AS="$AS" - -# The name of the directory that contains temporary libtool files. -objdir=$objdir +LN_S='$LN_S' # How to create reloadable object files. -reload_flag=$reload_flag -reload_cmds=$reload_cmds +reload_flag='$reload_flag' +reload_cmds='$reload_cmds' # How to pass a linker flag through the compiler. -wl=$wl - -# Object file suffix (normally "o"). -objext="$objext" - -# Old archive suffix (normally "a"). -libext="$libext" +wl='$wl' # Additional compiler flags for building library objects. -pic_flag=$pic_flag - -# Does compiler simultaneously support -c and -o options -compiler_c_o=$compiler_c_o - -# Can we write directly to a .lo ? -compiler_o_lo=$compiler_o_lo - -# Must we lock files when doing compilation ? -need_locks=$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=$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 +pic_flag='$pic_flag' # Compiler flag to prevent dynamic linking. -link_static_flag=$link_static_flag - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$no_builtin_flag +link_static_flag='$link_static_flag' # Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$export_dynamic_flag_spec - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$whole_archive_flag_spec +export_dynamic_flag='$export_dynamic_flag' -# Compiler flag to generate thread-safe objects. -thread_safe_flag_spec=$thread_safe_flag_spec +# Pattern to match compiler flags for creating libNAME_p libraries: +profile_flag_pattern='$profile_flag_pattern' # Library versioning type. version_type=$version_type -# Format of library name prefix. -libname_spec=$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=$library_names_spec +library_names_spec='$library_names_spec' # The coded name of the library, if different from the real name. -soname_spec=$soname_spec +soname_spec='$soname_spec' # Commands used to build and install an old-style archive. -RANLIB=$RANLIB -old_archive_cmds=$old_archive_cmds -old_postinstall_cmds=$old_postinstall_cmds -old_postuninstall_cmds=$old_postuninstall_cmds - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$old_archive_from_new_cmds +RANLIB='$RANLIB' +old_archive_cmds='$old_archive_cmds' +old_postinstall_cmds='$old_postinstall_cmds' # Commands used to build and install a shared archive. -archive_cmds=$archive_cmds -archive_expsym_cmds=$archive_expsym_cmds -postinstall_cmds=$postinstall_cmds -postuninstall_cmds=$postuninstall_cmds - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method=$deplibs_check_method - -# Command to use when deplibs_check_method == file_magic -file_magic_cmd=$file_magic_cmd +archive_cmds='$archive_cmds' +postinstall_cmds='$postinstall_cmds' # Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$allow_undefined_flag - -# Flag that forces no undefined symbols. -no_undefined_flag=$no_undefined_flag +allow_undefined_flag='$allow_undefined_flag' # Commands used to finish a libtool library installation in a directory. -finish_cmds=$finish_cmds - -# Same as above, but a single script fragment to be evaled but not shown. -finish_eval=$finish_eval - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$global_symbol_pipe +finish_cmds='$finish_cmds' -# Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$global_symbol_to_cdecl +# How to strip a library file. +striplib='$striplib' +old_striplib='$old_striplib' # This is the shared library runtime path variable. runpath_var=$runpath_var @@ -2684,18 +1007,15 @@ 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=$hardcode_action # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec=$hardcode_libdir_flag_spec +hardcode_libdir_flag_spec='$hardcode_libdir_flag_spec' # Whether we need a single -rpath flag with a separated argument. -hardcode_libdir_separator=$hardcode_libdir_separator +hardcode_libdir_separator='$hardcode_libdir_separator' # Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the # resulting binary. @@ -2705,115 +1025,37 @@ hardcode_direct=$hardcode_direct # resulting binary. hardcode_minus_L=$hardcode_minus_L +# Set to yes if using RUNPATH_VAR=DIR during linking hardcodes DIR into the +# resulting binary. +hardcode_runpath_var=$hardcode_runpath_var + # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into # the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var -# Compile-time system search path for libraries -sys_lib_search_path_spec=$sys_lib_search_path_spec - -# Run-time system search path for libraries -sys_lib_dlsearch_path_spec=$sys_lib_dlsearch_path_spec - -# Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$fix_srcfile_path" - -# Set to yes if exported symbols are required -always_export_symbols=$always_export_symbols - -# The command to extract exported symbols -export_symbols_cmds=$export_symbols_cmds - -# Symbols that should not be listed in the preloaded symbols -exclude_expsyms=$exclude_expsyms - -# Symbols that must always be exported -include_expsyms=$include_expsyms - EOF +# Detect if we are using a relative or absolute path to ltmain.sh. case "$ltmain" in -*.sh) - echo '### END LIBTOOL CONFIG' >> "$ofile" - echo >> "$ofile" - case "$host_os" in - aix3*) - cat <<\EOF >> "$ofile" - -# 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 "${COLLECT_NAMES+set}" != set; then - COLLECT_NAMES= - export COLLECT_NAMES -fi -EOF - ;; - esac - - # Append the ltmain.sh script. - cat "$ltmain" >> "$ofile" || (rm -f "$ofile"; exit 1) - - chmod +x "$ofile" +/*) cat <<EOF2 >> $ofile +# Execute the libtool backend. +. $ltmain +EOF2 ;; - -*) - # Compile the libtool program. - echo "FIXME: would compile $ltmain" +*) cat <<EOF3 >> $ofile +# Find the path to this script. +thisdir=\`echo "\$0" | sed -e 's%/[^/]*\$%%'\` +test "X\$0" = "X\$thisdir" && thisdir=. + +# Execute the libtool backend. +. \$thisdir/$ltmain +EOF3 ;; esac -test -n "$cache_file" || exit 0 - -# AC_CACHE_SAVE -trap '' 1 2 15 -cat > confcache <<\EOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs. It is not useful on other systems. -# If it contains results you don't want to keep, you may remove or edit it. -# -# By default, configure uses ./config.cache as the cache file, -# creating it if it does not exist already. You can give configure -# the --cache-file=FILE option to use a different cache file; that is -# what configure does when it calls configure scripts in -# subdirectories, so they share the cache. -# Giving --cache-file=/dev/null disables caching, for debugging configure. -# config.status only pays attention to the cache file if you give it the -# --recheck option to rerun configure. -# -EOF -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, don't put newlines in cache variables' values. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -(set) 2>&1 | - case `(ac_space=' '; set | grep ac_space) 2>&1` in - *ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote substitution - # turns \\\\ into \\, and sed turns \\ into \). - sed -n \ - -e "s/'/'\\\\''/g" \ - -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" - ;; - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' - ;; - esac >> confcache -if cmp -s $cache_file confcache; then - : -else - if test -w $cache_file; then - echo "updating cache $cache_file" - cat confcache > $cache_file - else - echo "not updating unwritable cache $cache_file" - fi -fi -rm -f confcache +echo 'exit 1' >> $ofile +chmod +x $ofile exit 0 # Local Variables: @@ -1,7 +1,6 @@ # ltmain.sh - Provide generalized library-building support services. -# NOTE: Changing this file will not affect anything until you rerun ltconfig. -# -# Copyright (C) 1996-1999 Free Software Foundation, Inc. +# Generated automatically from ltmain.sh.in by configure. +# Copyright (C) 1996, 1997 Free Software Foundation, Inc. # Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 # # This program is free software; you can redistribute it and/or modify @@ -23,69 +22,31 @@ # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. -# 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 - # used as fallback echo - shift - cat <<EOF -$* -EOF - exit 0 -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 - # The name of this program. -progname=`$echo "$0" | sed 's%^.*/%%'` -modename="$progname" +progname=`echo "$0" | sed 's%^.*/%%'` # Constants. PROGRAM=ltmain.sh PACKAGE=libtool -VERSION=1.2f -TIMESTAMP=" (1.385 1999/03/15 17:24:54)" +VERSION=1.0 default_mode= help="Try \`$progname --help' for more information." magic="%%%MAGIC variable%%%" mkdir="mkdir" mv="mv -f" +objdir=.libs rm="rm -f" -# 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' -SP2NL='tr \040 \012' -NL2SP='tr \012 \040' - -# NLS nuisances. -# Only set LANG and LC_ALL to C if already set. -# These must not be set unconditionally because not all systems understand -# e.g. LANG=C (notably SCO). -# We save the old values to restore during execute mode. -if test "${LC_ALL+set}" = set; then - save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL -fi -if test "${LANG+set}" = set; then - save_LANG="$LANG"; LANG=C; export LANG -fi - if test "$LTCONFIG_VERSION" != "$VERSION"; then - echo "$modename: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2 + echo "$progname: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 exit 1 fi +# if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then - echo "$modename: not configured to build any kind of library" 1>&2 + echo "$progname: not configured to build any kind of library" 1>&2 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 exit 1 fi @@ -96,10 +57,8 @@ nonopt= prev= prevopt= run= -show="$echo" +show=echo show_help= -execute_dlfiles= -lo2o="s/\\.lo\$/.${objext}/" # Parse our command line options once, thoroughly. while test $# -gt 0 @@ -108,21 +67,13 @@ do shift case "$arg" in - -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; + -*=*) optarg=`echo "$arg" | sed '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) - eval "$prev=\"\$$prev \$arg\"" - ;; - *) - eval "$prev=\$arg" - ;; - esac - + eval "$prev=\$arg" prev= prevopt= continue @@ -135,20 +86,10 @@ do ;; --version) - echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" + echo "$PROGRAM (GNU $PACKAGE) $VERSION" exit 0 ;; - --config) - sed -e '1,/^### BEGIN LIBTOOL CONFIG/d' -e '/^### END LIBTOOL CONFIG/,$d' $0 - exit 0 - ;; - - --debug) - echo "$progname: enabling shell trace mode" - set -x - ;; - --dry-run | -n) run=: ;; @@ -173,18 +114,9 @@ do --mode) prevopt="--mode" prev=mode ;; --mode=*) mode="$optarg" ;; - --quiet | --silent) - show=: - ;; - - -dlopen) - prevopt="-dlopen" - prev=execute_dlfiles - ;; - -*) - $echo "$modename: unrecognized option \`$arg'" 1>&2 - $echo "$help" 1>&2 + echo "$progname: unrecognized option \`$arg'" 1>&2 + echo "$help" 1>&2 exit 1 ;; @@ -195,408 +127,157 @@ do esac done + if test -n "$prevopt"; then - $echo "$modename: option \`$prevopt' requires an argument" 1>&2 - $echo "$help" 1>&2 + echo "$progname: option \`$prevopt' requires an argument" 1>&2 + echo "$help" 1>&2 exit 1 fi + if test -z "$show_help"; then # Infer the operation mode. if test -z "$mode"; then case "$nonopt" in - *cc | *++ | gcc* | *-gcc*) + *cc) mode=link for arg do - case "$arg" in - -c) - mode=compile - break - ;; - esac + case "$arg" in + -c) + mode=compile + break + ;; + esac done ;; - *db | *dbx | *strace | *truss) - mode=execute - ;; - *install*|cp|mv) + *install*|cp) mode=install ;; *rm) mode=uninstall ;; + *.la) + mode=dlname + ;; *) - # 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 + echo "$progname: warning: cannot infer operation mode from \`$nonopt'" 1>&2 else - $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 + echo "$progname: 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 1 - fi - # Change the help message to a mode-specific one. generic_help="$help" - help="Try \`$modename --help --mode=$mode' for more information." + help="Try \`$progname --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" + progname="$progname: compile" # Get the compilation command and the source file. - base_compile= + base_compile="$nonopt" lastarg= - srcfile="$nonopt" - suppress_output= + srcfile= - user_target=no for arg do - # Accept any command-line options. + # Quote any args containing shell metacharacters. case "$arg" in - -o) - if test "$user_target" != "no"; then - $echo "$modename: you cannot specify \`-o' more than once" 1>&2 - exit 1 - fi - user_target=next - ;; - - -static) - build_old_libs=yes - continue - ;; - esac - - case "$user_target" in - next) - # The next one is the -o target name - user_target=yes - continue - ;; - yes) - # We got the output file - user_target=set - libobj="$arg" - continue - ;; - esac - - # Accept the current argument as the source file. - lastarg="$srcfile" - srcfile="$arg" - - # Aesthetically quote the previous argument. - - # Backslashify any backslashes, double quotes, and dollar signs. - # These are the only characters that are still specially - # interpreted inside of double-quoted scrings. - lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` - - # Double-quote args containing other shell metacharacters. - # Many Bourne shells cannot handle close brackets correctly in scan - # sets, so we specify it separately. - case "$lastarg" in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) - lastarg="\"$lastarg\"" - ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*|*\"*) + quote_arg="'$arg'" ;; + *) quote_arg="$arg" ;; esac - # Add the previous argument to base_compile. - if test -z "$base_compile"; then - base_compile="$lastarg" - else - base_compile="$base_compile $lastarg" - fi + base_compile="$base_compile$lastarg" + srcfile="$quote_arg" + lastarg=" $srcfile" done - case "$user_target" in - set) - ;; - no) - # Get the name of the library object. - libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` - ;; - *) - $echo "$modename: you must specify a target with \`-o'" 1>&2 - exit 1 - ;; - esac + # Get the name of the library object. + libobj=`echo "$srcfile" | sed -e 's%^.*/%%'` # Recognize several different file suffixes. - # If the user specifies -o file.o, it is replaced with file.lo - xform='[cCFSfmso]' + xform='[cCFSf]' case "$libobj" in - *.ada) xform=ada ;; - *.adb) xform=adb ;; - *.ads) xform=ads ;; - *.asm) xform=asm ;; - *.c++) xform=c++ ;; + *.c++) xform='c++' ;; *.cc) xform=cc ;; *.cpp) xform=cpp ;; *.cxx) xform=cxx ;; *.f90) xform=f90 ;; - *.for) xform=for ;; + *.for) xform='for' ;; esac - libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` + libobj=`echo "$libobj" | sed -e "s/\.$xform$/.lo/"` case "$libobj" in - *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; + *.lo) obj=`echo "$libobj" | sed -e 's/\.lo$/.o/'` ;; *) - $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 + echo "$progname: cannot determine name of library object from \`$srcfile'" 1>&2 exit 1 ;; esac if test -z "$base_compile"; then - $echo "$modename: you must specify a compilation command" 1>&2 - $echo "$help" 1>&2 + echo "$progname: you must specify a compilation command" 1>&2 + echo "$help" 1>&2 exit 1 fi # Delete any leftover library objects. if test "$build_old_libs" = yes; then - removelist="$obj $libobj" - else - removelist="$libobj" - fi - - $run $rm $removelist - trap "$run $rm $removelist; exit 1" 1 2 15 - - # 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 1" 1 2 15 + $run $rm $obj $libobj + trap "$run $rm $obj $libobj; exit 1" 1 2 15 else - 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 ln "$0" "$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 1 - fi - echo $srcfile > "$lockfile" - fi - - if test -n "$fix_srcfile_path"; then - eval srcfile=\"$fix_srcfile_path\" + $run $rm $libobj + trap "$run $rm $libobj; exit 1" 1 2 15 fi # Only build a PIC object if we are building libtool libraries. if test "$build_libtool_libs" = yes; then - # Without this assignment, base_compile gets emptied. - fbsd_hideous_sh_bug=$base_compile - # All platforms use -DPIC, to notify preprocessed assembler code. - command="$base_compile $pic_flag -DPIC $srcfile" - if test "$build_old_libs" = yes; then - lo_libobj="$libobj" - dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` - if test "X$dir" = "X$libobj"; then - dir="$objdir" - else - dir="$dir/$objdir" - fi - libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'` - - if test -d "$dir"; then - $show "$rm $libobj" - $run $rm $libobj - else - $show "$mkdir $dir" - $run $mkdir $dir - status=$? - if test $status -ne 0 && test ! -d $dir; then - exit $status - fi - fi - fi - if test "$compiler_o_lo" = yes; then - output_obj="$libobj" - command="$command -o $output_obj" - elif test "$compiler_c_o" = yes; then - output_obj="$obj" - command="$command -o $output_obj" - fi - - $show "$command" - if $run eval "$command"; then : + $show "$base_compile$pic_flag -DPIC $srcfile" + if $run eval "$base_compile$pic_flag -DPIC $srcfile"; then : else - test -n "$output_obj" && $run $rm $removelist - exit 1 - fi - - if test "$need_locks" = warn && - test x"`cat $lockfile 2>/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 + test -n "$obj" && $run $rm $obj exit 1 fi - # Just move the object if needed, then go on to compile the next one - if test x"$output_obj" != x"$libobj"; then - $show "$mv $output_obj $libobj" - if $run $mv $output_obj $libobj; then : - else - error=$? - $run $rm $removelist - exit $error - fi - fi - # If we have no pic_flag, then copy the object into place and finish. - if test -z "$pic_flag" && test "$build_old_libs" = yes; then - # Rename the .lo from within objdir to obj - if test -f $obj; then - $show $rm $obj - $run $rm $obj - fi - - $show "$mv $libobj $obj" - if $run $mv $libobj $obj; then : - else - error=$? - $run $rm $removelist - exit $error - fi - - # Now arrange that obj and lo_libobj become the same file - $show "$LN_S $obj $lo_libobj" - if $run $LN_S $obj $lo_libobj; then - exit 0 - else - error=$? - $run $rm $removelist - exit $error - fi + if test -z "$pic_flag"; then + $show "$LN_S $obj $libobj" + $run $LN_S $obj $libobj + exit $? fi - # Allow error messages only from the first compilation. - suppress_output=' >/dev/null 2>&1' + # Just move the object, then go on to compile the next one + $show "$mv $obj $libobj" + $run $mv $obj $libobj || exit 1 fi # Only build a position-dependent object if we build old libraries. if test "$build_old_libs" = yes; then - command="$base_compile $srcfile" - if test "$compiler_c_o" = yes; then - command="$command -o $obj" - output_obj="$obj" - fi - - # Suppress compiler output if we already did a PIC compilation. - command="$command$suppress_output" - $show "$command" - if $run eval "$command"; then : + $show "$base_compile $srcfile" + if $run eval "$base_compile $srcfile"; then : else - $run $rm $removelist - exit 1 - fi - - if test "$need_locks" = warn && - test x"`cat $lockfile 2>/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 1 - fi - - # Just move the object if needed - if 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 - - # Create an invalid libtool object if no PIC, so that we do not - # accidentally link it into a program. - if test "$build_libtool_libs" != yes; then - $show "echo timestamp > $libobj" - $run eval "echo timestamp > \$libobj" || exit $? - else - # Move the .lo from within objdir - $show "$mv $libobj $lo_libobj" - if $run $mv $libobj $lo_libobj; then : - else - error=$? - $run $rm $removelist - exit $error - fi + $run $rm $obj $libobj + exit 1 fi fi - # Unlock the critical section if it was locked - if test "$need_locks" != no; then - $rm "$lockfile" + # Create an invalid libtool object if no PIC, so that we don't accidentally + # link it into a program. + if test "$build_libtool_libs" != yes; then + $show "echo timestamp > $libobj" + $run eval "echo timestamp > $libobj" || exit $? fi exit 0 @@ -604,466 +285,105 @@ compiler." # libtool link mode link) - modename="$modename: link" - C_compiler="$CC" # save it, to compile generated C sources - CC="$nonopt" - case "$host" in - *-*-cygwin* | *-*-mingw* | *-*-os2*) - # It is impossible to link a dll without this setting, and - # we shouldn't force the makefile maintainer to figure out - # which system we are compiling for in order to pass an extra - # flag for every libtool invokation. - # allow_undefined=no - - # FIXME: Unfortunately, there are problems with the above when trying - # to make a dll which has undefined symbols, in which case not - # even a static library is built. For now, we need to specify - # -no-undefined on the libtool link line when we can be certain - # that all symbols are satisfied, otherwise we get a static library. - allow_undefined=yes - - # This is a source program that is used to create dlls on Windows - # Don't remove nor modify the starting and closing comments -# /* ltdll.c starts here */ -# #define WIN32_LEAN_AND_MEAN -# #include <windows.h> -# #undef WIN32_LEAN_AND_MEAN -# #include <stdio.h> -# -# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); -# -# #include <cygwin/cygwin_dll.h> -# DECLARE_CYGWIN_DLL( DllMain ); -# HINSTANCE __hDllInstance_base; -# -# BOOL APIENTRY -# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) -# { -# __hDllInstance_base = hInst; -# return TRUE; -# } -# /* ltdll.c ends here */ - # This is a source program that is used to create import libraries - # on Windows for dlls which lack them. Don't remove nor modify the - # starting and closing comments -# /* impgen.c starts here */ -# /* Copyright (C) 1999 Free Software Foundation, Inc. -# -# This file is part of GNU libtool. -# -# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# */ -# -# #include <stdio.h> /* for printf() */ -# #include <unistd.h> /* for open(), lseek(), read() */ -# #include <fcntl.h> /* for O_RDONLY, O_BINARY */ -# #include <string.h> /* for strdup() */ -# -# static unsigned int -# pe_get16 (fd, offset) -# int fd; -# int offset; -# { -# unsigned char b[2]; -# lseek (fd, offset, SEEK_SET); -# read (fd, b, 2); -# return b[0] + (b[1]<<8); -# } -# -# static unsigned int -# pe_get32 (fd, offset) -# int fd; -# int offset; -# { -# unsigned char b[4]; -# lseek (fd, offset, SEEK_SET); -# read (fd, b, 4); -# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); -# } -# -# static unsigned int -# pe_as32 (ptr) -# void *ptr; -# { -# unsigned char *b = ptr; -# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); -# } -# -# int -# main (argc, argv) -# int argc; -# char *argv[]; -# { -# int dll; -# unsigned long pe_header_offset, opthdr_ofs, num_entries, i; -# unsigned long export_rva, export_size, nsections, secptr, expptr; -# unsigned long name_rvas, nexp; -# unsigned char *expdata, *erva; -# char *filename, *dll_name; -# -# filename = argv[1]; -# -# dll = open(filename, O_RDONLY|O_BINARY); -# if (!dll) -# return 1; -# -# dll_name = filename; -# -# for (i=0; filename[i]; i++) -# if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':') -# dll_name = filename + i +1; -# -# pe_header_offset = pe_get32 (dll, 0x3c); -# opthdr_ofs = pe_header_offset + 4 + 20; -# num_entries = pe_get32 (dll, opthdr_ofs + 92); -# -# if (num_entries < 1) /* no exports */ -# return 1; -# -# export_rva = pe_get32 (dll, opthdr_ofs + 96); -# export_size = pe_get32 (dll, opthdr_ofs + 100); -# nsections = pe_get16 (dll, pe_header_offset + 4 +2); -# secptr = (pe_header_offset + 4 + 20 + -# pe_get16 (dll, pe_header_offset + 4 + 16)); -# -# expptr = 0; -# for (i = 0; i < nsections; i++) -# { -# char sname[8]; -# unsigned long secptr1 = secptr + 40 * i; -# unsigned long vaddr = pe_get32 (dll, secptr1 + 12); -# unsigned long vsize = pe_get32 (dll, secptr1 + 16); -# unsigned long fptr = pe_get32 (dll, secptr1 + 20); -# lseek(dll, secptr1, SEEK_SET); -# read(dll, sname, 8); -# if (vaddr <= export_rva && vaddr+vsize > export_rva) -# { -# expptr = fptr + (export_rva - vaddr); -# if (export_rva + export_size > vaddr + vsize) -# export_size = vsize - (export_rva - vaddr); -# break; -# } -# } -# -# expdata = (unsigned char*)malloc(export_size); -# lseek (dll, expptr, SEEK_SET); -# read (dll, expdata, export_size); -# erva = expdata - export_rva; -# -# nexp = pe_as32 (expdata+24); -# name_rvas = pe_as32 (expdata+32); -# -# printf ("EXPORTS\n"); -# for (i = 0; i<nexp; i++) -# { -# unsigned long name_rva = pe_as32 (erva+name_rvas+i*4); -# printf ("\t%s @ %ld ;\n", erva+name_rva, 1+ i); -# } -# -# return 0; -# } -# /* impgen.c ends here */ - ;; - *) - allow_undefined=yes - ;; - esac - compile_command="$CC" - finalize_command="$CC" - - compile_rpath= - finalize_rpath= + progname="$progname: link" + # Go through the arguments, transforming them on the way. + cc="$nonopt" + args="$cc" + allow_undefined=no + compile_command="$cc" + finalize_command="$cc" compile_shlibpath= finalize_shlibpath= - convenience= - old_convenience= deplibs= - linkopts= - - if test -n "$shlibpath_var"; then - # get the directories listed in $shlibpath_var - eval lib_search_path=\`\$echo \"X \${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` - else - lib_search_path= - fi - # now prepend the system-specific ones - eval lib_search_path=\"$sys_lib_search_path_spec\$lib_search_path\" - eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" - - avoid_version=no - dlfiles= - dlprefiles= - dlself=no export_dynamic=no - export_symbols= - export_symbols_regex= - generated= + hardcode_libdirs= + install_libdir= libobjs= link_against_libtool_libs= + link_static= ltlibs= - module=no objs= - preload=no prev= prevarg= - release= - rpath= - xrpath= perm_rpath= temp_rpath= - thread_safe=no vinfo= # We need to know -static, to get the right output filenames. for arg do case "$arg" in - -all-static | -static) - if test "X$arg" = "X-all-static" && test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then - $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2 - fi - build_libtool_libs=no - build_old_libs=yes - break - ;; + -static) + 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 - + for arg + do # 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@" + args="$args $arg" ;; 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. - self) - if test "$prev" = dlprefiles; then - dlself=yes - elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then - dlself=yes - fi - prev= - continue - ;; - *) - dlprefiles="$dlprefiles $arg" - test "$prev" = dlfiles && dlfiles="$dlfiles $arg" - prev= - ;; - esac - ;; - expsyms) - export_symbols="$arg" - if test ! -f "$arg"; then - $echo "$modename: symbol file \`$arg' does not exist" - exit 1 - fi - prev= - continue - ;; - expsyms_regex) - export_symbols_regex="$arg" - prev= - continue - ;; - release) - release="-$arg" - prev= - continue - ;; - rpath) - rpath="$rpath $arg" - prev= - continue - ;; - xrpath) - xrpath="$xrpath $arg" - prev= - continue - ;; - *) - eval "$prev=\"\$arg\"" - prev= - continue - ;; - esac + eval "$prev=\$arg" + prev= + + continue fi + args="$args $arg" 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" - dlopen_self=$dlopen_self_static - 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 - ;; + -allow-undefined) allow_undefined=yes ;; -export-dynamic) - if test "$export_dynamic" != yes; then - export_dynamic=yes - if test -n "$export_dynamic_flag_spec"; then - eval arg=\"$export_dynamic_flag_spec\" - else - arg= - fi - fi - ;; - - -export-symbols | -export-symbols-regex) - if test -n "$export_symbols" || test -n "$export_symbols_regex"; then - $echo "$modename: cannot have more than one -exported-symbols" - exit 1 - fi - if test "$arg" = "-export-symbols"; then - prev=expsyms - else - prev=expsyms_regex - fi + export_dynamic=yes + compile_command="$compile_command $export_dynamic_flag" + finalize_command="$finalize_command $export_dynamic_flag" continue ;; -L*) - dir=`$echo "X$arg" | $Xsed -e 's%^-L\(.*\)$%\1%'` + dir=`echo "$arg" | sed 's%^-L\(.*\)$%\1%'` case "$dir" in - /* | [A-Za-z]:[/\\]*) - # Add the corresponding hardcode_libdir_flag, if it is not identical. + /*) ;; *) - $echo "$modename: \`-L$dir' cannot specify a relative directory" 1>&2 + echo "$progname: \`-L$dir' cannot specify a relative directory" 1>&2 exit 1 ;; esac - case " $deplibs " in - *" $arg "*) ;; - *) deplibs="$deplibs $arg";; - esac - case " $lib_search_path " in - *" $dir "*) ;; - *) lib_search_path="$lib_search_path $dir";; - esac - case "$host" in - *-*-cygwin* | *-*-mingw* | *-*-os2*) - dllsearchdir=`cd "$dir" && pwd || echo "$dir"` - case ":$dllsearchpath:" in - ::) dllsearchpath="$dllsearchdir";; - *":$dllsearchdir:"*) ;; - *) dllsearchpath="$dllsearchpath:$dllsearchdir";; - esac - ;; - esac - ;; - - -l*) deplibs="$deplibs $arg" ;; - -module) - if test "$module" != yes; then - module=yes - if test -n "$export_dynamic_flag_spec"; then - eval arg=\"$export_dynamic_flag_spec\" - else - arg= - fi - fi - ;; - - -no-undefined) - allow_undefined=no - continue - ;; + -l*) deplibs="$deplibs $arg" ;; -o) prev=output ;; - -release) - prev=release - continue - ;; - -rpath) - prev=rpath - continue - ;; - - -R) - prev=xrpath - continue - ;; - - -R*) - xrpath="$xrpath "`$echo "X$arg" | $Xsed -e 's/^-R//'` + prev=install_libdir continue ;; -static) - # If we have no pic_flag, then this is the same as -all-static. - if test -z "$pic_flag" && test -n "$link_static_flag"; then - compile_command="$compile_command $link_static_flag" - finalize_command="$finalize_command $link_static_flag" - dlopen_self=$dlopen_self_static - fi + link_static="`eval echo \"$link_static_flag\"`" + compile_command="$compile_command $link_static" continue ;; - -thread-safe) - thread_safe=yes - continue + -version-file) + echo "$progname: \`-version-file' has been replaced by \`-version-info'" 1>&2 + echo "$help" 1>&2 + exit 1 ;; -version-info) @@ -1071,69 +391,53 @@ compiler." 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 - ;; + -*) cc="$cc $arg" ;; # Some other compiler flag. - *.o | *.obj | *.a | *.lib) + *.o) # A standard object. objs="$objs $arg" ;; + *.a) + # Find the relevant object directory and library name. + file=`echo "$arg" | sed 's%^.*/%%'` + dir=`echo "$arg" | sed 's%/[^/]*$%/%'` + test "$dir" = "$arg" && dir= + + # Standard archive. + objs="$objs $arg" + ;; + *.lo) # A library object. - if test "$prev" = dlfiles; then - dlfiles="$dlfiles $arg" - if test "$build_libtool_libs" = yes && test "$dlopen" = yes; then - prev= - continue - else - # If libtool objects are unsupported, then we need to preload. - prev=dlprefiles - fi - fi - - if test "$prev" = dlprefiles; then - # Preload the old-style object. - dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"` - prev= - fi libobjs="$libobjs $arg" ;; *.la) # A libtool-controlled library. - dlname= libdir= library_names= old_library= # Check to see that this really is a libtool archive. - if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + if egrep "^# Generated by $PROGRAM" $arg >/dev/null 2>&1; then : else - $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2 + echo "$progname: \`$arg' is not a valid libtool archive" 1>&2 exit 1 fi - # If the library was installed with an old release of libtool, - # it will not redefine variable installed. - installed=yes - # If there is no directory component, then add one. case "$arg" in - */* | *\\*) . $arg ;; + */*) . $arg ;; *) . ./$arg ;; esac + if test -z "$libdir"; then + echo "$progname: \`$arg' contains no -rpath information" 1>&2 + exit 1 + fi + # Get the name of the library we link against. linklib= for l in $old_library $library_names; do @@ -1141,81 +445,17 @@ compiler." done if test -z "$linklib"; then - $echo "$modename: cannot find name of link library for \`$arg'" 1>&2 + echo "$progname: cannot find name of link library for \`$arg'" 1>&2 exit 1 fi # Find the relevant object directory and library name. - name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'` - - if test "X$installed" = Xyes; then - dir="$libdir" + name=`echo "$arg" | sed 's%^.*/%%; s/\.la$//; s/^lib//'` + dir=`echo "$arg" | sed 's%/[^/]*$%%'` + if test "$dir" = "$arg"; then + dir="$objdir" else - dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` - if test "X$dir" = "X$arg"; then - dir="$objdir" - else - dir="$dir/$objdir" - fi - fi - - if test -n "$dependency_libs"; then - # Extract -R from dependency_libs - temp_deplibs= - for deplib in $dependency_libs; do - case "$deplib" in - -R*) temp_xrpath=`$echo "X$deplib" | $Xsed -e 's/^-R//'` - case " $rpath $xrpath " in - *" $temp_xrpath "*) ;; - *) xrpath="$xrpath $temp_xrpath";; - esac;; - -L*) case "$compile_command $temp_deplibs " in - *" $deplib "*) ;; - *) temp_deplibs="$temp_deplibs $deplib";; - esac;; - *) temp_deplibs="$temp_deplibs $deplib";; - esac - done - dependency_libs="$temp_deplibs" - fi - - if test -z "$libdir"; then - # It is a libtool convenience library, so add in its objects. - convenience="$convenience $dir/$old_library" - old_convenience="$old_convenience $dir/$old_library" - deplibs="$deplibs$dependency_libs" - compile_command="$compile_command $dir/$old_library$dependency_libs" - finalize_command="$finalize_command $dir/$old_library$dependency_libs" - continue - fi - - # This library was specified with -dlopen. - if test "$prev" = dlfiles; then - dlfiles="$dlfiles $arg" - if test -z "$dlname" || test "$dlopen" != yes || test "$build_libtool_libs" = no; then - # If there is no dlname, no dlopen support or we're linking statically, - # we need to preload. - prev=dlprefiles - else - # We should not create a dependency on this library, but we - # may need any libraries it requires. - compile_command="$compile_command$dependency_libs" - finalize_command="$finalize_command$dependency_libs" - prev= - continue - fi - fi - - # The library was specified with -dlpreopen. - if test "$prev" = dlprefiles; then - # Prefer using a static library (so that no silly _DYNAMIC symbols - # are required to link). - if test -n "$old_library"; then - dlprefiles="$dlprefiles $dir/$old_library" - else - dlprefiles="$dlprefiles $dir/$linklib" - fi - prev= + dir="$dir/$objdir" fi if test "$build_libtool_libs" = yes && test -n "$library_names"; then @@ -1223,815 +463,306 @@ compiler." if test -n "$shlibpath_var"; then # Make sure the rpath contains only unique directories. case "$temp_rpath " in - *" $dir "*) ;; + "* $dir *") ;; *) temp_rpath="$temp_rpath $dir" ;; esac fi - # We need an absolute path. - case "$dir" in - /* | [A-Za-z]:[/\\]*) absdir="$dir" ;; - *) - absdir=`cd "$dir" && pwd` - if test -z "$absdir"; then - $echo "$modename: cannot determine absolute directory name of \`$libdir'" 1>&2 - exit 1 + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + # Put the magic libdir with the hardcode flag. + hardcode_libdirs="$libdir" + libdir="@HARDCODE_LIBDIRS@" + else + # Just accumulate the libdirs. + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + libdir= + fi fi - ;; - esac - - # This is the magic to use -rpath. - # Skip directories that are in the system default run-time - # search path, unless they have been requested with -R. - 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" + if test -n "$libdir"; then + hardcode_libdir_flag=`eval echo \"$hardcode_libdir_flag_spec\"` + compile_command="$compile_command $hardcode_libdir_flag" + finalize_command="$finalize_command $hardcode_libdir_flag" + fi + elif test "$hardcode_runpath_var" = yes; then + # Do the same for the permanent run path. + case "$perm_rpath " in + "* $libdir *") ;; + *) perm_rpath="$perm_rpath $libdir" ;; esac - ;; - esac + fi + - lib_linked=yes case "$hardcode_action" in - immediate | unsupported) + immediate) if test "$hardcode_direct" = no; then compile_command="$compile_command $dir/$linklib" - deplibs="$deplibs $dir/$linklib" - case "$host" in - *-*-cygwin* | *-*-mingw* | *-*-os2*) - dllsearchdir=`cd "$dir" && pwd || echo "$dir"` - if test -n "$dllsearchpath"; then - dllsearchpath="$dllsearchpath:$dllsearchdir" - else - dllsearchpath="$dllsearchdir" - fi - ;; - esac elif test "$hardcode_minus_L" = no; then - case "$host" in - *-*-sunos*) - compile_shlibpath="$compile_shlibpath$dir:" - ;; - esac - case "$compile_command " in - *" -L$dir "*) ;; - *) compile_command="$compile_command -L$dir";; - esac - compile_command="$compile_command -l$name" - deplibs="$deplibs -L$dir -l$name" + compile_command="$compile_command -L$dir -l$name" elif test "$hardcode_shlibpath_var" = no; then - case ":$compile_shlibpath:" in - *":$dir:"*) ;; - *) compile_shlibpath="$compile_shlibpath$dir:";; - esac + compile_shlibpath="$compile_shlibpath$dir:" compile_command="$compile_command -l$name" - deplibs="$deplibs -l$name" - else - lib_linked=no fi ;; relink) + # We need an absolute path. + case "$dir" in + /*) ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + echo "$progname: cannot determine absolute directory name of \`$dir'" 1>&2 + exit 1 + fi + dir="$absdir" + ;; + esac + if test "$hardcode_direct" = yes; then - compile_command="$compile_command $absdir/$linklib" - deplibs="$deplibs $absdir/$linklib" + compile_command="$compile_command $dir/$linklib" elif test "$hardcode_minus_L" = yes; then - case "$compile_command " in - *" -L$absdir "*) ;; - *) compile_command="$compile_command -L$absdir";; - esac - compile_command="$compile_command -l$name" - deplibs="$deplibs -L$absdir -l$name" + compile_command="$compile_command -L$dir -l$name" elif test "$hardcode_shlibpath_var" = yes; then - case ":$compile_shlibpath:" in - *":$absdir:"*) ;; - *) compile_shlibpath="$compile_shlibpath$absdir:";; - esac + compile_shlibpath="$compile_shlibpath$dir:" compile_command="$compile_command -l$name" - deplibs="$deplibs -l$name" - else - lib_linked=no fi ;; *) - lib_linked=no + echo "$progname: \`$hardcode_action' is an unknown hardcode action" 1>&2 + exit 1 ;; esac - if test "$lib_linked" != yes; then - $echo "$modename: configuration error: unsupported hardcode properties" - exit 1 - fi - # Finalize command for both is simple: just hardcode it. if test "$hardcode_direct" = yes; then finalize_command="$finalize_command $libdir/$linklib" elif test "$hardcode_minus_L" = yes; then - case "$finalize_command " in - *" -L$libdir "*) ;; - *) finalize_command="$finalize_command -L$libdir";; - esac - finalize_command="$finalize_command -l$name" + finalize_command="$finalize_command -L$libdir -l$name" elif test "$hardcode_shlibpath_var" = yes; then - case ":$finalize_shlibpath:" in - *":$libdir:"*) ;; - *) finalize_shlibpath="$finalize_shlibpath$libdir:";; - esac - finalize_command="$finalize_command -l$name" - else - # We cannot seem to hardcode it, guess we'll fake it. - case "$finalize_command " in - *" -L$dir "*) ;; - *) finalize_command="$finalize_command -L$libdir";; - esac + finalize_shlibpath="$finalize_shlibpath$libdir:" finalize_command="$finalize_command -l$name" + else + # We can't seem to hardcode it, guess we'll fake it. + finalize_command="$finalize_command -L$libdir -l$name" fi - else - # Transform directly to old archives if we don't build new libraries. - if test -n "$pic_flag" && test -z "$old_library"; then - $echo "$modename: cannot find static library for \`$arg'" 1>&2 + else + # Transform directly to old archives if we don't build new libraries. + if test -n "$pic_flag" && test -z "$old_library"; then + echo "$progname: cannot find static library for \`$arg'" 1>&2 exit 1 fi - - # 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_command="$compile_command $dir/$linklib" - finalize_command="$finalize_command $dir/$linklib" - else - case "$compile_command " in - *" -L$dir "*) ;; - *) compile_command="$compile_command -L$dir";; - esac - compile_command="$compile_command -l$name" - case "$finalize_command " in - *" -L$dir "*) ;; - *) finalize_command="$finalize_command -L$dir";; - esac - finalize_command="$finalize_command -l$name" - fi - fi - - # Add in any libraries that this one depends upon. - compile_command="$compile_command$dependency_libs" - finalize_command="$finalize_command$dependency_libs" + test -n "$old_library" && linklib="$old_library" + compile_command="$compile_command $dir/$linklib" + finalize_command="$finalize_command $dir/$linklib" + 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 + echo "$progname: unknown file suffix for \`$arg'" 1>&2 + echo "$help" 1>&2 + exit 1 ;; esac - # Now actually substitute the argument into the commands. - if test -n "$arg"; then - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" - fi + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" done if test -n "$prev"; then - $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 - $echo "$help" 1>&2 + echo "$progname: the \`$prevarg' option requires an argument" 1>&2 + echo "$help" 1>&2 exit 1 fi - oldlibs= - # calculate the name of the file, without its directory - outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` - libobjs_save="$libobjs" + # Substitute the hardcoded libdirs into the compile commands. + if test "$hardcode_libdir_colon_separated" = yes; then + compile_command=`echo "$compile_command" | sed "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"` + finalize_command=`echo "$finalize_command" | sed "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"` + fi + oldlib= + oldobjs= case "$output" in "") - $echo "$modename: you must specify an output file" 1>&2 - $echo "$help" 1>&2 + echo "$progname: you must specify an output file" 1>&2 + echo "$help" 1>&2 exit 1 ;; - *.a | *.lib) - if test -n "$link_against_libtool_libs"; then - $echo "$modename: error: cannot link libtool libraries into archives" 1>&2 - exit 1 - fi - - if test -n "$deplibs"; then - $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 - fi - - if test -n "$dlfiles$dlprefiles"; 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' 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"; 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" + */*) + echo "$progname: output file \`$output' must have no directory components" 1>&2 + exit 1 ;; *.la) - # 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 libname=\"$libname_spec\" - ;; - *) - if test "$module" = no; then - $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 - $echo "$help" 1>&2 - exit 1 - 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 libname=\"$libname_spec\" - else - libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` - fi - ;; - esac - - 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 + libname=`echo "$output" | sed 's/\.la$//'` # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= + current=0 + revision=0 + age=0 if test -n "$objs"; then - $echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1 + echo "$progname: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1 exit 1 fi # How the heck are we supposed to write a wrapper for a shared library? if test -n "$link_against_libtool_libs"; then - $echo "$modename: error: cannot link shared libraries into libtool libraries" 1>&2 - exit 1 - fi - - if test -n "$dlfiles$dlprefiles"; then - $echo "$modename: warning: \`-dlopen' is ignored for libtool libraries" 1>&2 + echo "$progname: libtool library \`$output' may not depend on uninstalled libraries:$link_against_libtool_libs" 1>&2 + exit 1 fi - set dummy $rpath - if test $# -gt 2; then - $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 + if test -z "$install_libdir"; then + echo "$progname: you must specify an installation directory with \`-rpath'" 1>&2 + exit 1 fi - install_libdir="$2" - - oldlibs= - if test -z "$rpath"; then - if test "$build_libtool_libs" = yes; then - # Building a libtool convenience library. - libext=al - oldlibs="$output_objdir/$libname.$libext $oldlibs" - build_libtool_libs=convenience - build_old_libs=yes - fi - dependency_libs="$deplibs" - - if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info' 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. - IFS="${IFS= }"; 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 1 - fi - - current="$2" - revision="$3" - age="$4" - - # Check that each of the things are valid numbers. - case "$current" in - 0 | [1-9] | [1-9][0-9]*) ;; - *) - $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit 1 - ;; - esac - - case "$revision" in - 0 | [1-9] | [1-9][0-9]*) ;; - *) - $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit 1 - ;; - esac - - case "$age" in - 0 | [1-9] | [1-9][0-9]*) ;; - *) - $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit 1 - ;; - 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 1 - fi + # Parse the version information argument. + IFS="${IFS= }"; save_ifs="$IFS"; IFS=':' + set dummy $vinfo + IFS="$save_ifs" - # Calculate the version variables. - major= - versuffix= - verstring= - case "$version_type" in - none) ;; - - irix) - major=`expr $current - $age + 1` - versuffix="$major.$revision" - verstring="sgi$major.$revision" - - # Add in all the interfaces that we are compatible with. - loop=$revision - while test $loop != 0; do - iface=`expr $revision - $loop` - loop=`expr $loop - 1` - verstring="sgi$major.$iface:$verstring" - done - ;; + if test -n "$5"; then + echo "$progname: too many parameters to \`-version-info'" 1>&2 + echo "$help" 1>&2 + exit 1 + fi - linux) - major=.`expr $current - $age` - versuffix="$major.$age.$revision" - ;; + test -n "$2" && current="$2" + test -n "$3" && revision="$3" + test -n "$4" && age="$4" - 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 != 0; do - iface=`expr $current - $loop` - loop=`expr $loop - 1` - verstring="$verstring:${iface}.0" - done + # Check that each of the things are valid numbers. + case "$current" in + 0 | [1-9] | [1-9][0-9]*) ;; + *) + echo "$progname: CURRENT \`$current' is not a nonnegative integer" 1>&2 + echo "$progname: \`$vinfo' is not valid version information" 1>&2 + exit 1 + ;; + esac - # Make executables depend on our current version. - verstring="$verstring:${current}.0" - ;; + case "$revision" in + 0 | [1-9] | [1-9][0-9]*) ;; + *) + echo "$progname: REVISION \`$revision' is not a nonnegative integer" 1>&2 + echo "$progname: \`$vinfo' is not valid version information" 1>&2 + exit 1 + ;; + esac - sunos) - major=".$current" - versuffix=".$current.$revision" - ;; + case "$age" in + 0 | [1-9] | [1-9][0-9]*) ;; + *) + echo "$progname: AGE \`$age' is not a nonnegative integer" 1>&2 + echo "$progname: \`$vinfo' is not valid version information" 1>&2 + exit 1 + ;; + esac - freebsd-aout) - major=".$current" - versuffix=".$current.$revision"; - ;; + if test $age -gt $current; then + echo "$progname: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 + echo "$progname: \`$vinfo' is not valid version information" 1>&2 + exit 1 + fi - freebsd-elf) - major=".$current" - versuffix=".$current"; - ;; + # Calculate the version variables. + version_vars="version_type current age revision" + case "$version_type" in + none) ;; - windows) - # Like Linux, but with '-' rather than '.', since we only - # want one extension on Windows 95. - major=`expr $current - $age` - versuffix="-$major-$age-$revision" - ;; + linux) + version_vars="$version_vars major versuffix" + major=`expr $current - $age` + versuffix="$major.$age.$revision" + ;; - *) - $echo "$modename: unknown library version type \`$version_type'" 1>&2 - echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 - exit 1 - ;; - esac + osf) + version_vars="$version_vars versuffix verstring" + major=`expr $current - $age` + versuffix="$current.$age.$revision" + verstring="$versuffix" + + # Add in all the interfaces that we are compatible with. + loop=$age + while test $loop != 0; do + iface=`expr $current - $loop` + loop=`expr $loop - 1` + verstring="$verstring:${iface}.0" + done - # Clear the version info if we defaulted, and they specified a release. - if test -z "$vinfo" && test -n "$release"; then - major= - verstring="0.0" - if test "$need_version" = no; then - versuffix= - else - versuffix=".0.0" - fi - fi + # Make executables depend on our current version. + verstring="$verstring:${current}.0" + ;; - # 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 + sunos) + version_vars="$version_vars major versuffix" + major="$current" + versuffix="$current.$revision" + ;; - dependency_libs="$deplibs" - case "$host" in - *-*-cygwin* | *-*-mingw* | *-*-os2*) - # these systems don't actually have a c library (as such)! - ;; - *) - # Add libc to deplibs on all other systems. - deplibs="$deplibs -lc" - ;; - esac - fi + *) + echo "$progname: unknown library version type \`$version_type'" 1>&2 + echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit 1 + ;; + esac # Create the output directory, or remove our outputs if we need to. - if test -d $output_objdir; then - $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*" - $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.* + if test -d $objdir; then + $show "$rm $objdir/$libname.*" + $run $rm $objdir/$libname.* else - $show "$mkdir $output_objdir" - $run $mkdir $output_objdir - status=$? - if test $status -ne 0 && test ! -d $output_objdir; then - exit $status - fi + $show "$mkdir $objdir" + $run $mkdir $objdir || exit $? 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 - - if test "$build_libtool_libs" = yes; then - # 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) - newdeplibs=$deplibs - ;; # 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 behaviour. - 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 <<EOF - int main() { return 0; } -EOF - $rm conftest - $C_compiler -o conftest conftest.c $deplibs - if test $? -eq 0 ; then - ldd_output=`ldd conftest` - for i in $deplibs; do - name="`expr $i : '-l\(.*\)'`" - # If $name is empty we are operating on a -L argument. - if test "$name" != "" ; then - libname=`eval \\$echo \"$libname_spec\"` - deplib_matches=`eval \\$echo \"$library_names_spec\"` - set dummy $deplib_matches - deplib_match=$2 - if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then - newdeplibs="$newdeplibs $i" - else - droppeddeps=yes - echo - echo "*** Warning: This library needs some functionality provided by $i." - 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." - fi - else - newdeplibs="$newdeplibs $i" - fi - done - else - # Error occured in the first compile. Let's try to salvage the situation: - # Compile a seperate program for each library. - for i in $deplibs; do - name="`expr $i : '-l\(.*\)'`" - # If $name is empty we are operating on a -L argument. - if test "$name" != "" ; then - $rm conftest - $C_compiler -o conftest conftest.c $i - # Did it work? - if test $? -eq 0 ; then - ldd_output=`ldd conftest` - libname=`eval \\$echo \"$libname_spec\"` - deplib_matches=`eval \\$echo \"$library_names_spec\"` - set dummy $deplib_matches - deplib_match=$2 - if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then - newdeplibs="$newdeplibs $i" - else - droppeddeps=yes - echo - echo "*** Warning: This library needs some functionality provided by $i." - 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." - fi - else - droppeddeps=yes - echo - echo "*** Warning! Library $i is needed by this library but I was not able to" - echo "*** make it link in! You will probably need to install it or some" - echo "*** library that it depends on before this library will be fully" - echo "*** functional. Installing it before continuing would be even better." - fi - else - newdeplibs="$newdeplibs $i" - fi - done - fi - deplibs=$newdeplibs - ;; - file_magic*) - set dummy $deplibs_check_method - file_magic_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 "$name" != "" ; then - libname=`eval \\$echo \"$libname_spec\"` - for i in $lib_search_path; do - potential_libs=`ls $i/$libname[.-]* 2>/dev/null` - for potent_lib in $potential_libs; do - # Follow soft links. - if ls -lLd "$potlib" 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 - /*) potlib="$potliblink";; - *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; - esac - done - if eval $file_magic_cmd \"\$potlib\" \ - | sed 10q \ - | egrep "$file_magic_regex" > /dev/null; then - newdeplibs="$newdeplibs $a_deplib" - a_deplib="" - break 2 - fi - done - done - if test -n "$a_deplib" ; then - droppeddeps=yes - echo - echo "*** Warning: This library needs some functionality provided by $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." - fi - else - # Add a -L argument. - newdeplibs="$newdeplibs $a_deplib" - fi - done # Gone through all deplibs. - ;; - none | unknown | *) newdeplibs="" - if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ - -e 's/ -[LR][^ ]*//g' -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 - - 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 - dlname= - library_names= - 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." - 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 "$progname: warning: undefined symbols not allowed in $host shared libraries" 1>&2 + build_libtool_libs=no fi + else + # Clear the flag. + allow_undefined_flag= fi - # test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then - deplibs=$newdeplibs - # Done checking deplibs! - # Get the real and link names of the library. - eval library_names=\"$library_names_spec\" + library_names=`eval echo \"$library_names_spec\"` set dummy $library_names realname="$2" shift; shift if test -n "$soname_spec"; then - eval soname=\"$soname_spec\" + soname=`eval echo \"$soname_spec\"` else soname="$realname" fi - lib="$output_objdir/$realname" + lib="$objdir/$realname" + linknames= for link do linknames="$linknames $link" done - # Ensure that we have .o objects for linkers which dislike .lo - # (e.g. aix) incase we are running --disable-static - for obj in $libobjs; do - oldobj=`$echo "X$obj" | $Xsed -e "$lo2o"` - test -f $oldobj || ${LN_S} $obj $oldobj - done - - # Use standard objects if they are pic - test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` - - if test -n "$whole_archive_flag_spec"; then - if test -n "$convenience"; then - eval libobjs=\"\$libobjs $whole_archive_flag_spec\" - fi - else - for xlib in $convenience; do - # Extract the objects. - xdir="$xlib"x - generated="$generated $xdir" - xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` - - $show "${rm}r $xdir" - $run ${rm}r "$xdir" - $show "mkdir $xdir" - $run mkdir "$xdir" - status=$? - if test $status -ne 0 && test ! -d "$xdir"; then - exit $status - fi - $show "(cd $xdir && $AR x ../$xlib)" - $run eval "(cd \$xdir && $AR x ../\$xlib)" || exit $? - - libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` - done - fi - - if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then - eval flag=\"$thread_safe_flag_spec\" - - linkopts="$linkopts $flag" - fi - - # 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="$objdir/$libname.exp" - $run $rm $export_symbols - eval cmds=\"$export_symbols_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - 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 + # Use standard objects if they are PIC. + test -z "$pic_flag" && libobjs=`echo "$libobjs " | sed 's/\.lo /.o /g; s/ $//g'` # Do each of the archive commands. - if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then - eval cmds=\"$archive_expsym_cmds\" - else - eval cmds=\"$archive_cmds\" - fi - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + cmds=`eval echo \"$archive_cmds\"` + IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" @@ -2040,62 +771,48 @@ EOF IFS="$save_ifs" # 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 + for link in $linknames; do + $show "(cd $objdir && $LN_S $realname $link)" + $run eval "(cd $objdir && $LN_S $realname $link)" || exit $? done - # If -module or -export-dynamic was specified, set the dlname. - if test "$module" = yes || test "$export_dynamic" = yes; then + # If -export-dynamic was specified, set the dlname. + if test "$export_dynamic" = yes; then # On all known operating systems, these are identical. dlname="$soname" fi fi ;; - *.lo | *.o | *.obj) + *.lo | *.o) if test -n "$link_against_libtool_libs"; then - $echo "$modename: error: cannot link libtool libraries into objects" 1>&2 + echo "$progname: error: cannot link libtool libraries into reloadable objects" 1>&2 exit 1 fi if test -n "$deplibs"; then - $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 - fi - - if test -n "$dlfiles$dlprefiles"; then - $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 + echo "$progname: warning: \`-l' and \`-L' are ignored while creating 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 + if test -n "$install_libdir"; then + echo "$progname: warning: \`-rpath' is ignored while creating 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 + echo "$progname: warning: \`-version-info' is ignored while creating objects" 1>&2 fi case "$output" in *.lo) if test -n "$objs"; then - $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 + echo "$progname: cannot build library object \`$output' from non-libtool objects" 1>&2 exit 1 fi libobj="$output" - obj=`$echo "X$output" | $Xsed -e "$lo2o"` + obj=`echo "$output" | sed 's/\.lo$/.o/'` ;; *) - libobj= + libobj= obj="$output" ;; esac @@ -2104,14 +821,14 @@ EOF $run $rm $obj $libobj # Create the old-style object. - reload_objs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP` + reload_objs="$objs"`echo "$libobjs " | sed 's/[^ ]*\.a //g; s/\.lo /.o /g; s/ $//g'` output="$obj" - eval cmds=\"$reload_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + cmds=`eval echo \"$reload_cmds\"` + IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" + IFS="$save_ifs" + $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" @@ -2120,8 +837,8 @@ EOF test -z "$libobj" && exit 0 if test "$build_libtool_libs" != yes; then - # Create an invalid libtool object if no PIC, so that we don't - # accidentally link it into a program. + # 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 0 @@ -2131,354 +848,76 @@ EOF # Only do commands if we really have different PIC objects. reload_objs="$libobjs" output="$libobj" - eval cmds=\"$reload_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" + cmds=`eval echo \"$reload_cmds\"` + IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" else - # Just create a symlink. - $show $rm $libobj - $run $rm $libobj - $show "$LN_S $obj $libobj" - $run $LN_S $obj $libobj || exit $? + # Just create a symlink. + $show "$LN_S $obj $libobj" + $run $LN_S $obj $libobj || exit 1 fi exit 0 ;; - # Anything else should be a program. *) - 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" = 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 - - if test "$dlself" = yes && test "$export_dynamic" = no; then - $echo "$modename: error: \`-dlopen self' requires \`-export-dynamic'" 1>&2 - exit 1 + if test -n "$install_libdir"; then + echo "$progname: warning: \`-rpath' is ignored while linking programs" 1>&2 fi - 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 "$compile_rpath " in - *" $libdir "*) ;; - *) compile_rpath="$compile_rpath $libdir" ;; - esac - 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 - 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\" + if test -n "$vinfo"; then + echo "$progname: warning: \`-version-info' is ignored while linking programs" 1>&2 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\" + if test -n "$libobjs"; then + # Transform all the library objects into standard objects. + compile_command=`echo "$compile_command " | sed 's/\.lo /.o /g; s/ $//'` + finalize_command=`echo "$finalize_command " | sed 's/\.lo /.o /g; s/ $//'` fi - finalize_rpath="$rpath" - 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 + if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then + # Replace the output file specification. + compile_command=`echo "$compile_command" | sed 's%@OUTPUT@%'"$output"'%g'` + finalize_command=`echo "$finalize_command" | sed 's%@OUTPUT@%'"$output"'%g'` - 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 + # We have no uninstalled library dependencies, so finalize right now. + $show "$compile_command" + $run $compile_command + status=$? - dlsyms= - if test -n "$dlfiles$dlprefiles" || test "$dlself" = yes; 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 + # If we failed to link statically, then try again. + if test $status -ne 0 && test -n "$link_static"; then + echo "$progname: cannot link \`$output' statically; retrying semi-dynamically" 1>&2 + compile_command=`echo "$compile_command " | sed "s% $link_static % %;s/ $//"` + $show "$finalize_command" + $run $finalize_command + status=$? fi + exit $status fi - if test -n "$dlsyms"; then - case "$dlsyms" in - "") ;; - *.c) - # Discover the nlist of each of the dlfiles. - nlist="$objdir/${output}.nm" - - if test -d $objdir; then - $show "$rm $nlist ${nlist}S ${nlist}T" - $run $rm "$nlist" "${nlist}S" "${nlist}T" - else - $show "$mkdir $objdir" - $run $mkdir $objdir - status=$? - if test $status -ne 0 && test ! -d $objdir; then - exit $status - fi - fi - - # Parse the name list into a source file. - $show "creating $objdir/$dlsyms" - - $echo > "$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'" - - echo ': @PROGRAM@ ' > "$nlist" - - # Add our own program objects to the symbol list. - progfiles=`$echo "X$objs" | $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="$objdir/$output.exp" - $run $rm $export_symbols - $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' - else - $run $rm $export_symbols - $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$objdir/$output.exp"' - $run eval 'grep -f "$objdir/$output.exp" < "$nlist" > "$nlist"T' - $run eval 'mv "$nlist"T "$nlist"' - 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" | sort +2 | 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_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[] = -{\ -" - - sed -n -e 's/^: \([^ ]*\) $/ {\"\1\", (lt_ptr_t) 0},/p' \ - -e 's/^. \([^ ]*\) \([^ ]*\)$/ {"\2", (lt_ptr_t) \&\2},/p' \ - < "$nlist" >> "$output_objdir/$dlsyms" - - $echo >> "$output_objdir/$dlsyms" "\ - {0, (lt_ptr_t) 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*) - case "$compile_command " in - *" -static "*) ;; - *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";; - esac - esac - - # Now compile the dynamic symbol file. - $show "(cd $objdir && $C_compiler -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" - $run eval '(cd $objdir && $C_compiler -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? + # Replace the output file specification. + compile_command=`echo "$compile_command" | sed 's%@OUTPUT@%'"$objdir/$output"'%g'` + finalize_command=`echo "$finalize_command" | sed 's%@OUTPUT@%'"$objdir/$output"'T%g'` - # Transform the symbol file into the correct name. - compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$objdir/${output}S.${objext}%"` - finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$objdir/${output}S.${objext}%"` - ;; - *) - $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 - exit 1 - ;; - esac + # Create the binary in the object directory, then wrap it. + if test -d $objdir; then : 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 -z "$link_against_libtool_libs" || 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 $? + $show "$mkdir $objdir" + $run $mkdir $objdir || exit $? fi if test -n "$shlibpath_var"; then - # We should set the shlibpath_var + # We should set the shlibpath_var rpath= for dir in $temp_rpath; do case "$dir" in - /* | [A-Za-z]:[/\\]*) + /*) # Absolute path. rpath="$rpath$dir:" ;; @@ -2491,363 +930,164 @@ static const void *lt_preloaded_setup() { temp_rpath="$rpath" fi - if test -n "$compile_shlibpath$finalize_shlibpath"; then - compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" + # Delete the old output file. + $run $rm $output + + if test -n "$compile_shlibpath"; then + compile_command="$shlibpath_var=\"$compile_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 + if test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + rpath="$rpath$dir:" + done + compile_command="$runpath_var=\"$rpath\$$runpath_var\" $compile_command" + finalize_command="$runpath_var=\"$rpath\$$runpath_var\" $finalize_command" 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" - + case "$hardcode_action" in + relink) # AGH! Flame the AIX and HP-UX people for me, will ya? - $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'` - - # Create the binary in the object directory, then wrap it. - if test ! -d $output_objdir; then - $show "$mkdir $output_objdir" - $run $mkdir $output_objdir - status=$? - if test $status -ne 0 && test ! -d $objdir; then - exit $status - fi - fi - - # Delete the old output file. - $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname + echo "$progname: warning: using a buggy system linker" 1>&2 + echo "$progname: relinking will be required before \`$output' can be installed" 1>&2 + ;; + esac - $show "$link_command" - $run eval "$link_command" || exit $? + $show "$compile_command" + $run eval "$compile_command" || exit $? # Now create the wrapper script. - $show "creating $output" - - # Quote the relink command for shipping. - if test -n "$relink_command"; then - relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` - fi - - # Quote $echo for shipping. - if test "X$echo" = "X$SHELL $0 --fallback-echo"; then - case "$0" in - /* | [A-Za-z]:[/\\]*) qecho="$SHELL $0 --fallback-echo";; - *) qecho="$SHELL `pwd`/$0 --fallback-echo";; - esac - qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` - else - qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` - fi + echo "creating $output" # 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 $rm $output trap "$rm $output; exit 1" 1 2 15 - $echo > $output "\ -#! $SHELL + cat > $output <<EOF +#! /bin/sh -# $output - temporary wrapper script for $objdir/$outputname -# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP +# $output - temporary wrapper script for $objdir/$output +# Generated by $PROGRAM - GNU $PACKAGE $VERSION # # 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. +# This wrapper script should never be moved out of \``pwd`'. # 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. -if test \"\${CDPATH+set}\" = set; then CDPATH=; export CDPATH; fi - -relink_command=\"$relink_command\" - # This environment variable determines our operation mode. -if test \"\$libtool_install_magic\" = \"$magic\"; then - # install mode needs the following variable: +if test "\$libtool_install_magic" = "$magic"; then + # install mode needs the following variables: link_against_libtool_libs='$link_against_libtool_libs' + finalize_command='$finalize_command' 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 + thisdir=\`echo \$0 | sed 's%/[^/]*$%%'\` + test "x\$thisdir" = "x\$0" && thisdir=. # 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' - 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" + absdir=\`cd "\$thisdir" && pwd\` + test -n "\$absdir" && thisdir="\$absdir" - echo >> $output "\ - - # relink executable if necessary - if test -n \"\$relink_command\"; then - if (cd \"\$thisdir\" && eval \$relink_command); then : - else - $rm \"\$progdir/\$file\" - exit 1 - fi - fi + progdir="\$thisdir/$objdir" + program="$output" - $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 + # Run the actual program with our arguments. + args= + for arg + do + # Quote arguments (to preserve shell metacharacters). + args="\$args '\$arg'" + done - if test -f \"\$progdir/\$program\"; then" + # Export the path to the program. + PATH="\$progdir:\$PATH" + export PATH +EOF # 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 "\ + if test -n "$shlibpath_var" && test -n "$temp_rpath"; then + cat >> $output <<EOF + # Add our own library path to $shlibpath_var - $shlibpath_var=\"$temp_rpath\$$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/::*\$//'\` + $shlibpath_var=\`echo \$$shlibpath_var | sed -e 's/:*\$//'\` export $shlibpath_var -" +EOF 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 + cat >> $output <<EOF - $echo >> $output "\ - if test \"\$libtool_execute_magic\" != \"$magic\"; then - # Run the actual program with our arguments. -" - case $host in - *-*-cygwin* | *-*-mingw | *-*-os2*) - # win32 systems need to use the prog path for dll - # lookup to work - $echo >> $output "\ - exec \$progdir\\\\\$program \${1+\"\$@\"} -" - ;; - *) - $echo >> $output "\ - # Export the path to the program. - PATH=\"\$progdir:\$PATH\" - export PATH + eval "exec \$program \$args" - exec \$program \${1+\"\$@\"} -" - ;; - esac - $echo >> $output "\ - \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" - exit 1 - fi + echo "\$0: cannot exec \$program \$args" + exit 1 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 + 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 1 fi -fi\ -" +fi +EOF chmod +x $output fi exit 0 ;; esac + # See if we need to build an old-fashioned archive. - for oldlib in $oldlibs; do + if test "$build_old_libs" = "yes"; then + # Now set the variables for building old libraries. + oldlib="$objdir/$libname.a" + + # Transform .lo files to .o files. + oldobjs="$objs"`echo "$libobjs " | sed 's/[^ ]*\.a //g; s/\.lo /.o /g; s/ $//g'` - if test "$build_libtool_libs" = convenience; then - oldobjs="$libobjs_save" - addlibs="$convenience" - build_libtool_libs=no + if test -d "$objdir"; then + $show "$rm $oldlib" + $run $rm $oldlib else - if test "$build_libtool_libs" = module; then - oldobjs="$libobjs_save" - build_libtool_libs=no - else - oldobjs="$objs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP` - fi - addlibs="$old_convenience" + $show "$mkdir $objdir" + $run $mkdir $objdir fi - # Add in members from convenience archives. - for xlib in $addlibs; do - # Extract the objects. - xdir="$xlib"x - generated="$generated $xdir" - xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` - - $show "${rm}r $xdir" - $run ${rm}r "$xdir" - $show "mkdir $xdir" - $run mkdir "$xdir" - status=$? - if test $status -ne 0 && test ! -d "$xdir"; then - exit $status - fi - $show "(cd $xdir && $AR x ../$xlib)" - $run eval "(cd \$xdir && $AR x ../\$xlib)" || exit $? - - oldobjs="$oldobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` - done - # Do each command in the archive commands. - if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then - eval cmds=\"$old_archive_from_new_cmds\" - else - eval cmds=\"$old_archive_cmds\" - fi - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + cmds=`eval echo \"$old_archive_cmds\"` + IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' for cmd in $cmds; do - IFS="$save_ifs" - $show "$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" + test "$build_old_libs" = yes && old_library="$libname.a" - if test -n "$xrpath"; then - temp_xrpath= - for libdir in $xrpath; do - temp_xrpath="$temp_xrpath -R$libdir" - done - dependency_libs="$temp_xrpath $dependency_libs" - fi + echo "creating $output" # Only create the output if not a dry run. if test -z "$run"; then - $echo > $output "\ + cat > $output <<EOF # $output - a libtool library file -# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP +# Generated by $PROGRAM - GNU $PACKAGE $VERSION # The name that we can dlopen(3). dlname='$dlname' @@ -2858,30 +1098,20 @@ 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=no - # Directory that this library needs to be installed in: -libdir='$install_libdir'\ -" - - $rm "$output_objdir/$outputname"i - sed 's/^installed=no$/installed=yes/' \ - < "$output" > "$output_objdir/$outputname"i || exit 1 +libdir='$install_libdir' +EOF 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 $? + $show "(cd $objdir && $LN_S ../$output $output)" + $run eval "(cd $objdir && $LN_S ../$output $output)" || exit 1 ;; esac exit 0 @@ -2889,35 +1119,10 @@ libdir='$install_libdir'\ # libtool install mode install) - modename="$modename: install" + progname="$progname: 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; 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" + # The first argument is the name of the installation program. + install_prog="$nonopt" # We need to accept at least all the BSD install flags. dest= @@ -2925,12 +1130,12 @@ libdir='$install_libdir'\ opts= prev= install_type= - isdir=no + isdir= stripme= for arg do if test -n "$dest"; then - files="$files $dest" + files="$files $dest" dest="$arg" continue fi @@ -2955,71 +1160,63 @@ libdir='$install_libdir'\ 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 + echo "$progname: you must specify an install program" 1>&2 + echo "$help" 1>&2 exit 1 fi if test -n "$prev"; then - $echo "$modename: the \`$prev' option requires an argument" 1>&2 - $echo "$help" 1>&2 + echo "$progname: the \`$prev' option requires an argument" 1>&2 + echo "$help" 1>&2 exit 1 fi if test -z "$files"; then if test -z "$dest"; then - $echo "$modename: no file or destination specified" 1>&2 + echo "$progname: no file or destination specified" 1>&2 else - $echo "$modename: you must specify a destination" 1>&2 + echo "$progname: you must specify a destination" 1>&2 fi - $echo "$help" 1>&2 + echo "$help" 1>&2 exit 1 fi # Strip any trailing slash from the destination. - dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` + dest=`echo "$dest" | sed 's%/$%%'` # Check to see that the destination is a directory. test -d "$dest" && isdir=yes - if test "$isdir" = yes; then + if test -n "$isdir"; 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%^.*/%%'` + destdir=`echo "$dest" | sed 's%/[^/]*$%%'` + test "$destdir" = "$dest" && destdir=. + destname=`echo "$dest" | sed '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 + echo "$progname: \`$dest' is not a directory" 1>&2 + echo "$help" 1>&2 exit 1 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 + echo "$progname: \`$destdir' must be an absolute directory name" 1>&2 + echo "$help" 1>&2 exit 1 ;; esac @@ -3027,10 +1224,6 @@ libdir='$install_libdir'\ ;; esac - # This variable tells wrapper scripts just to set variables rather - # than running their programs. - libtool_install_magic="$magic" - staticlibs= future_libdirs= current_libdirs= @@ -3038,17 +1231,17 @@ libdir='$install_libdir'\ # Do each installation. case "$file" in - *.a | *.lib) + *.a) # Do the static libraries later. staticlibs="$staticlibs $file" ;; *.la) # Check to see that this really is a libtool archive. - if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + if egrep "^# Generated by $PROGRAM" $file >/dev/null 2>&1; then : else - $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 - $echo "$help" 1>&2 + echo "$progname: \`$file' is not a valid libtool archive" 1>&2 + echo "$help" 1>&2 exit 1 fi @@ -3056,26 +1249,26 @@ libdir='$install_libdir'\ old_library= # If there is no directory component, then add one. case "$file" in - */* | *\\*) . $file ;; + */*) . $file ;; *) . ./$file ;; esac # Add the libdir to current_libdirs if it is the destination. - if test "X$destdir" = "X$libdir"; then + if test "$destdir" = "$libdir"; then case "$current_libdirs " in - *" $libdir "*) ;; + "* $libdir *") ;; *) current_libdirs="$current_libdirs $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in - *" $libdir "*) ;; + "* $libdir *") ;; *) future_libdirs="$future_libdirs $libdir" ;; esac fi - dir="`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/" - test "X$dir" = "X$file/" && dir= + dir="`echo "$file" | sed 's%/[^/]*$%%'`/" + test "$dir" = "$file/" && dir= dir="$dir$objdir" # See the names of the shared library. @@ -3090,15 +1283,32 @@ libdir='$install_libdir'\ $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $? test "X$dlname" = "X$realname" && dlname= + # Support stripping libraries. + if test -n "$stripme"; then + if test -n "$striplib"; then + $show "$striplib $destdir/$realname" + $run $striplib $destdir/$realname || exit $? + else + echo "$progname: warning: no library stripping program" 1>&2 + fi + fi + if test $# -gt 0; then - # Delete the old symlinks, and create new ones. + # Delete the old symlinks. + rmcmd="$rm" + for linkname + do + rmcmd="$rmcmd $destdir/$linkname" + done + $show "$rmcmd" + $run $rmcmd + + # ... and create new ones. for linkname do test "X$dlname" = "X$linkname" && dlname= - if test "$linkname" != "$realname"; then - $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" - $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" - fi + $show "(cd $destdir && $LN_S $realname $linkname)" + $run eval "(cd $destdir && $LN_S $realname $linkname)" done fi @@ -3110,8 +1320,8 @@ libdir='$install_libdir'\ # Do each command in the postinstall commands. lib="$destdir/$realname" - eval cmds=\"$postinstall_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + cmds=`eval echo \"$postinstall_cmds\"` + IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" @@ -3121,88 +1331,76 @@ libdir='$install_libdir'\ fi # Install the pseudo-library for information purposes. - name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - instname="$dir/$name"i - if test ! -f "$instname"; then - # Just in case it was removed... - $show "Creating $instname" - $rm "$instname" - sed 's/^installed=no$/installed=yes/' "$file" > "$instname" - fi - $show "$install_prog $instname $destdir/$name" - $run eval "$install_prog $instname $destdir/$name" || exit $? + name=`echo "$file" | sed 's%^.*/%%'` + $show "$install_prog $file $destdir/$name" + $run $install_prog $file $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. + # Install (i.e. copy) a libtool object. - # Figure out destination file name, if it wasn't already specified. - if test -n "$destname"; then + # 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=`echo "$file" | sed 's%^.*/%%;'` destfile="$destdir/$destfile" - fi + fi # Deduce the name of the destination old-style object file. case "$destfile" in *.lo) - staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` + staticdest=`echo "$destfile" | sed 's/\.lo$/\.o/;'` ;; - *.o | *.obj) + *.o) staticdest="$destfile" destfile= ;; *) - $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 - $echo "$help" 1>&2 + echo "$progname: cannot copy a libtool object to \`$destfile'" 1>&2 + echo "$help" 1>&2 exit 1 - ;; + ;; esac # Install the libtool object if requested. if test -n "$destfile"; then $show "$install_prog $file $destfile" - $run eval "$install_prog $file $destfile" || exit $? + $run $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"` + staticobj=`echo "$file" | sed 's/\.lo$/\.o/;'` $show "$install_prog $staticobj $staticdest" - $run eval "$install_prog \$staticobj \$staticdest" || exit $? + $run $install_prog $staticobj $staticdest || exit $? fi exit 0 ;; *) - # 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 - # Do a test to see if this is really a libtool program. - if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + if egrep "^# Generated by $PROGRAM" $file >/dev/null 2>&1; then + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" link_against_libtool_libs= - relink_command= + finalize_command= # If there is no directory component, then add one. case "$file" in - */* | *\\*) . $file ;; + */*) . $file ;; *) . ./$file ;; esac # Check the variables that should have been set. - if test -z "$link_against_libtool_libs"; then - $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2 + if test -z "$link_against_libtool_libs" || test -z "$finalize_command"; then + echo "$progname: invalid libtool wrapper script \`$file'" 1>&2 exit 1 fi @@ -3213,297 +1411,181 @@ libdir='$install_libdir'\ if test -f "$lib"; then # If there is no directory component, then add one. case "$lib" in - */* | *\\*) . $lib ;; + */*) . $lib ;; *) . ./$lib ;; esac fi - libfile="$libdir/`$echo "X$lib" | $Xsed -e 's%^.*/%%g'`" - if test -n "$libdir" && test ! -f "$libfile"; then - $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 + libfile="$libdir/`echo "$lib" | sed 's%^.*/%%g'`" + if test -z "$libdir"; then + echo "$progname: warning: \`$lib' contains no -rpath information" 1>&2 + elif test -f "$libfile"; then : + else + echo "$progname: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 finalize=no fi done - outputname= - if test "$fast_install" = no && test -n "$relink_command"; then + if test "$hardcode_action" = relink; then if test "$finalize" = yes; then - outputname="/tmp/$$-$file" - # Replace the output file specification. - relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` - - $echo "$modename: warning: relinking \`$file' on behalf of your buggy system linker" 1>&2 - $show "$relink_command" - if $run eval "$relink_command"; then : + echo "$progname: warning: relinking \`$file' on behalf of your buggy system linker" 1>&2 + $show "$finalize_command" + if $run $finalize_command; then : else - $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 + echo "$progname: error: relink \`$file' with the above command before installing it" 1>&2 continue fi - file="$outputname" + file="$objdir/$file"T else - $echo "$modename: warning: cannot relink \`$file' on behalf of your buggy system linker" 1>&2 + echo "$progname: warning: cannot relink \`$file' on behalf of your buggy system linker" 1>&2 fi else # Install the binary that we compiled earlier. - file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` + dir=`echo "$file" | sed 's%/[^/]*$%%'` + if test "$file" = "$dir"; then + file="$objdir/$file" + else + file="$dir/$objdir/`echo "$file" | sed 's%^.*/%%'`" + fi fi fi - $show "$install_prog$stripme $file $destfile" - $run eval "$install_prog\$stripme \$file \$destfile" || exit $? - test -n "$outputname" && $rm $outputname + $show "$install_prog$stripme $file $dest" + $run $install_prog$stripme $file $dest || exit $? ;; esac done for file in $staticlibs; do - name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + name=`echo "$file" | sed 's%^.*/%%'` # Set up the ranlib parameters. oldlib="$destdir/$name" $show "$install_prog $file $oldlib" - $run eval "$install_prog \$file \$oldlib" || exit $? + $run $install_prog $file $oldlib || exit $? + + # Support stripping libraries. + if test -n "$stripme"; then + if test -n "$old_striplib"; then + $show "$old_striplib $oldlib" + $run $old_striplib $oldlib || exit $? + else + echo "$progname: warning: no static library stripping program" 1>&2 + fi + fi # Do each command in the postinstall commands. - eval cmds=\"$old_postinstall_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + cmds=`eval echo \"$old_postinstall_cmds\"` + IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? + IFS="$save_ifs" + $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 + echo "$progname: 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 $SHELL $0 --finish$current_libdirs + exec $0 --finish$current_libdirs exit 1 fi exit 0 ;; - # 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. - eval cmds=\"$finish_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $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 0 - - echo "----------------------------------------------------------------------" - echo "Libraries have been installed in:" - for libdir in $libdirs; do - echo " $libdir" + # libtool dlname mode + dlname) + progname="$progname: dlname" + ltlibs="$nonopt" + for lib + do + ltlibs="$ltlibs $lib" 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 \`-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 "----------------------------------------------------------------------" - exit 0 - ;; - - # 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" + if test -z "$ltlibs"; then + echo "$progname: you must specify at least one LTLIBRARY" 1>&2 + echo "$help" 1>&2 exit 1 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 1 - fi - - dir= - case "$file" in - *.la) - # Check to see that this really is a libtool archive. - if (sed -e '2q' $file | egrep "^# 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 1 - 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 1 - fi - ;; - - *.lo) - # Just add the directory containing the .lo file. - dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` - test "X$dir" = "X$file" && dir=. - ;; + # Now check to make sure each one is a valid libtool library. + status=0 + for lib in $ltlibs; do + dlname= + libdir= + library_names= - *) - $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 + # Check to see that this really is a libtool archive. + if egrep "^# Generated by $PROGRAM" $arg >/dev/null 2>&1; then : + else + echo "$progname: \`$arg' is not a valid libtool archive" 1>&2 + status=1 continue - ;; - esac + fi - # Get the absolute pathname. - absdir=`cd "$dir" && pwd` - test -n "$absdir" && dir="$absdir" + # If there is no directory component, then add one. + case "$arg" in + */*) . $arg ;; + *) . ./$arg ;; + esac - # Now add the directory to shlibpath_var. - if eval "test -z \"\$$shlibpath_var\""; then - eval "$shlibpath_var=\"\$dir\"" + if test -z "$libdir"; then + echo "$progname: \`$arg' contains no -rpath information" 1>&2 + status=1 + elif test -n "$dlname"; then + echo "$libdir/$dlname" + elif test -z "$library_names"; then + echo "$progname: \`$arg' is not a shared library" 1>&2 + status=1 else - eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" + echo "$progname: \`$arg' was not linked with \`-export-dynamic'" 1>&2 + status=1 fi done + exit $status + ;; - # 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 | egrep "^# 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 - # Export the shlibpath_var. - eval "export $shlibpath_var" + # libtool finish mode + finish) + progname="$progname: finish" + libdirs="$nonopt" - # Restore saved enviroment 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 + if test -n "$finish_cmds" && test -n "$libdirs"; then + for dir + do + libdirs="$libdirs $dir" + done - # Now actually exec the command. - eval "exec \$cmd$args" + for libdir in $libdirs; do + # Do each command in the postinstall commands. + cmds=`eval echo \"$finish_cmds\"` + IFS="${IFS= }"; save_ifs="$IFS"; IFS=';' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" + done + IFS="$save_ifs" + done + fi - $echo "$modename: cannot exec \$cmd$args" - exit 1 - else - # Display what would be done. - eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" - $echo "export $shlibpath_var" - $echo "$cmd$args" - exit 0 + echo "To link against installed libraries in LIBDIR, users may have to:" + if test -n "$shlibpath_var"; then + echo " - add LIBDIR to their \`$shlibpath_var' environment variable" fi + echo " - use the \`-LLIBDIR' linker flag" + exit 0 ;; # libtool uninstall mode uninstall) - modename="$modename: uninstall" + progname="$progname: uninstall" rm="$nonopt" files= @@ -3516,22 +1598,22 @@ libdir='$install_libdir'\ done if test -z "$rm"; then - $echo "$modename: you must specify an RM program" 1>&2 - $echo "$help" 1>&2 + echo "$progname: you must specify an RM program" 1>&2 + echo "$help" 1>&2 exit 1 fi for file in $files; do - dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` - test "X$dir" = "X$file" && dir=. - name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + dir=`echo "$file" | sed -e 's%/[^/]*$%%'` + test "$dir" = "$file" && dir=. + name=`echo "$file" | sed -e 's%^.*/%%'` rmfiles="$file" case "$name" in *.la) # Possibly a libtool archive, so verify it. - if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + if egrep "^# Generated by $PROGRAM" $file >/dev/null 2>&1; then . $dir/$name # Delete the libtool libraries and symlinks. @@ -3542,153 +1624,108 @@ libdir='$install_libdir'\ test -n "$dlname" && rmfiles="$rmfiles $dir/$dlname" test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library" - $show "$rm $rmfiles" - $run $rm $rmfiles - - if test -n "$library_names"; then - # Do each command in the postuninstall commands. - eval cmds=\"$postuninstall_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" - done - IFS="$save_ifs" - fi - - if test -n "$old_library"; then - # Do each command in the old_postuninstall commands. - eval cmds=\"$old_postuninstall_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" - done - IFS="$save_ifs" - fi - # FIXME: should reinstall the best remaining shared library. fi ;; *.lo) if test "$build_old_libs" = yes; then - oldobj=`$echo "X$name" | $Xsed -e "$lo2o"` + oldobj=`echo "$name" | sed 's/\.lo$/\.o/'` rmfiles="$rmfiles $dir/$oldobj" fi - $show "$rm $rmfiles" - $run $rm $rmfiles - ;; - - *) - $show "$rm $rmfiles" - $run $rm $rmfiles - ;; + ;; esac + + $show "$rm $rmfiles" + $run $rm $rmfiles done exit 0 ;; - "") - $echo "$modename: you must specify a MODE" 1>&2 - $echo "$generic_help" 1>&2 + NONE) + echo "$progname: you must specify a MODE" 1>&2 + echo "$generic_help" 1>&2 exit 1 ;; esac - $echo "$modename: invalid operation mode \`$mode'" 1>&2 - $echo "$generic_help" 1>&2 + echo "$progname: invalid operation mode \`$mode'" 1>&2 + echo "$generic_help" 1>&2 exit 1 fi # test -z "$show_help" # We need to display help for each of the modes. case "$mode" in -"") $echo \ -"Usage: $modename [OPTION]... [MODE-ARG]... +NONE) cat <<EOF +Usage: $progname [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 + --features display 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 --version print version information MODE must be one of the following: compile compile a source file into a libtool object - execute automatically set library path, then run a program + dlname print filenames to use to \`dlopen' libtool libraries 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." - exit 0 +MODE-ARGS vary depending on the MODE. Try \`$progname --help --mode=MODE' for +a more detailed description of MODE. +EOF ;; compile) - $echo \ -"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE + cat <<EOF +Usage: $progname [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 - -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'." +library object suffix, \`.lo'. +EOF ;; -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 +dlname) + cat <<EOF +Usage: $progname [OPTION]... --mode=dlname LTLIBRARY... -This mode sets the library path environment variable according to \`-dlopen' -flags. +Print filenames to use to \`dlopen' libtool libraries. -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. +Each LTLIBRARY is the name of a dynamically loadable libtool library (one that +was linked using the \`-export-dynamic' option). -Then, COMMAND is executed, with ARGS as arguments." +The names to use are printed to standard output, one per line. +EOF ;; finish) - $echo \ -"Usage: $modename [OPTION]... --mode=finish [LIBDIR]... + cat <<EOF +Usage: $progname [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." +the \`--dry-run' option if you just want to see what would be executed. +EOF ;; install) - $echo \ -"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... + cat <<EOF +Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. @@ -3696,12 +1733,13 @@ 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)." +BSD-compatible install options are recognized). +EOF ;; link) - $echo \ -"Usage: $modename [OPTION]... --mode=link LINK-COMMAND... + cat <<EOF +Usage: $progname [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. @@ -3711,22 +1749,13 @@ 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 + -allow-undefined allow a libtool library to reference undefined 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 -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME - -module build a library that can dlopened - -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects - -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 + -static do not do any dynamic linking or shared library creation -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] @@ -3736,20 +1765,20 @@ 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 the OUTPUT-FILE ends in \`.la', then a libtool library is created, only +library objects (\`.lo' files) may be specified, and \`-rpath' is required. -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 \`.a', then a standard library is created using \`ar' +and \`ranlib'. -If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file -is created, otherwise an executable program is created." +If OUTPUT-FILE ends in \`.lo' or \`.o', then a reloadable object file is +created, otherwise an executable program is created. +EOF ;; uninstall) - $echo -"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... + cat <<EOF +Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. @@ -3758,18 +1787,23 @@ RM is the name of the program to use to delete files associated with each FILE to RM. If FILE is a libtool library, all the files associated with it are deleted. -Otherwise, only FILE itself is deleted using RM." +Otherwise, only FILE itself is deleted using RM. +EOF ;; *) - $echo "$modename: invalid operation mode \`$mode'" 1>&2 - $echo "$help" 1>&2 + echo "$progname: invalid operation mode \`$mode'" 1>&2 + echo "$help" 1>&2 exit 1 ;; esac -echo -$echo "Try \`$modename --help' for more information about other modes." +case "$mode" in +archive|compile) + echo + echo "Try \`$progname --help' for more information about other modes." + ;; +esac exit 0 diff --git a/main/config.w32.h b/main/config.w32.h index 1c08814065..5cba103bef 100644 --- a/main/config.w32.h +++ b/main/config.w32.h @@ -204,7 +204,7 @@ /* Define if you have the setlocale function. */ #define HAVE_SETLOCALE 1 -#define HAVE_LOCALE_H 1 +#define HAVE_LOCALE_H /* Define if you have the setvbuf function. */ #ifndef HAVE_BINDLIB diff --git a/main/main.c b/main/main.c index 59d1a54b37..6e801350d0 100644 --- a/main/main.c +++ b/main/main.c @@ -426,20 +426,18 @@ PHPAPI void php3_error(int type, const char *format,...) } } if (PG(track_errors)) { - pval *tmp; + pval tmp; va_start(args, format); size = vsnprintf(buffer, sizeof(buffer) - 1, format, args); va_end(args); buffer[sizeof(buffer) - 1] = 0; - tmp = (pval *)emalloc(sizeof(pval)); - INIT_PZVAL(tmp); - tmp->value.str.val = (char *) estrndup(buffer, size); - tmp->value.str.len = size; - tmp->type = IS_STRING; + tmp.value.str.val = (char *) estrndup(buffer, size); + tmp.value.str.len = size; + tmp.type = IS_STRING; - _php3_hash_update(EG(active_symbol_table), "php_errormsg", sizeof("php_errormsg"), (void **) & tmp, sizeof(pval *), NULL); + _php3_hash_update(EG(active_symbol_table), "php_errormsg", sizeof("php_errormsg"), (void *) & tmp, sizeof(pval), NULL); } switch (type) { diff --git a/mod_php4.c b/mod_php4.c index acfe531f20..8b481e3fd8 100644 --- a/mod_php4.c +++ b/mod_php4.c @@ -149,8 +149,6 @@ int sapi_apache_header_handler(sapi_header_struct *sapi_header, sapi_headers_str if (!strcasecmp(header_name, "Content-Type")) { r->content_type = pstrdup(r->pool, header_content); - } else if (!strcasecmp(header_name, "Set-Cookie")) { - table_add(r->headers_out, header_name, header_content); } else { table_set(r->headers_out, header_name, header_content); } diff --git a/objects b/objects new file mode 100644 index 0000000000..0f03da1fe0 --- /dev/null +++ b/objects @@ -0,0 +1,7 @@ +<? + +$a->foo[4][32]["bar"] = 9; + +print "------------------------------\n"; + +$a->foo[4][32]["bar"]; diff --git a/press-release-3.0.txt b/press-release-3.0.txt new file mode 100644 index 0000000000..afef4b0cb4 --- /dev/null +++ b/press-release-3.0.txt @@ -0,0 +1,47 @@ + + FOR IMMEDIATE RELEASE + + PHP 3.0 RELEASED + +June 6, 1998 -- The PHP Development Team announced the release of +PHP 3.0, the latest release of the server-side scripting solution already +in use on over 70,000 World Wide Web sites. + +This all-new version of the popular scripting language includes support +for all major operating systems (Windows 95/NT, most versions of Unix, +and Macintosh) and web servers (including Apache, Netscape servers, +WebSite Pro, and Microsoft Internet Information Server). + +PHP 3.0 also supports a wide range of databases, including Oracle, Sybase, +Solid, MySQ, mSQL, and PostgreSQL, as well as ODBC data sources. + +New features include persistent database connections, support for the +SNMP and IMAP protocols, and a revamped C API for extending the language +with new features. + +"PHP is a very programmer-friendly scripting language suitable for +people with little or no programming experience as well as the +seasoned web developer who needs to get things done quickly. The +best thing about PHP is that you get results quickly," said +Rasmus Lerdorf, one of the developers of the language. + +"Version 3 provides a much more powerful, reliable and efficient +implementation of the language, while maintaining the ease of use and +rapid development that were the key to PHP's success in the past", +added Andi Gutmans, one of the implementors of the new language core. + +"At Circle Net we have found PHP to be the most robust platform for +rapid web-based application development available today," said Troy +Cobb, Chief Technology Officer at Circle Net, Inc. "Our use of PHP +has cut our development time in half, and more than doubled our client +satisfaction. PHP has enabled us to provide database-driven dynamic +solutions which perform at phenomenal speeds." + +PHP 3.0 is available for free download in source form and binaries for +several platforms at http://www.php.net/. + +The PHP Development Team is an international group of programmers who +lead the open development of PHP and related projects. + +For more information, the PHP Development Team can be contacted at +core@php.net. |