├── .gitignore
├── LICENSE
├── README.md
├── regexp.xml
└── regexp
├── AUTHORS
├── COPYING
├── ChangeLog
├── INSTALL
├── Makefile.am
├── Makefile.in
├── NEWS
├── README
├── acinclude.m4
├── aclocal.m4
├── ax_compare_version.m4
├── compile
├── config.guess
├── config.h.in
├── config.sub
├── configure
├── configure.in
├── depcomp
├── install-sh
├── ltmain.sh
├── manual.xml
├── missing
├── mysql.m4
├── regexp.c
├── tests
├── create_functions.inc
├── drop_functions.inc
├── r
│ ├── regexp_instr.result
│ ├── regexp_like.result
│ ├── regexp_replace.result
│ └── regexp_substr.result
├── t
│ ├── regexp_instr.test
│ ├── regexp_like.test
│ ├── regexp_replace.test
│ └── regexp_substr.test
└── test.sh
└── udf_regexp.h
/.gitignore:
--------------------------------------------------------------------------------
1 | # http://www.gnu.org/software/automake
2 |
3 | Makefile.in
4 |
5 | # http://www.gnu.org/software/autoconf
6 |
7 | /autom4te.cache
8 | /aclocal.m4
9 | /compile
10 | /configure
11 | /depcomp
12 | /install-sh
13 | /missing
14 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 2, June 1991
3 |
4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6 | Everyone is permitted to copy and distribute verbatim copies
7 | of this license document, but changing it is not allowed.
8 |
9 | Preamble
10 |
11 | The licenses for most software are designed to take away your
12 | freedom to share and change it. By contrast, the GNU General Public
13 | License is intended to guarantee your freedom to share and change free
14 | software--to make sure the software is free for all its users. This
15 | General Public License applies to most of the Free Software
16 | Foundation's software and to any other program whose authors commit to
17 | using it. (Some other Free Software Foundation software is covered by
18 | the GNU Lesser General Public License instead.) You can apply it to
19 | your programs, too.
20 |
21 | When we speak of free software, we are referring to freedom, not
22 | price. Our General Public Licenses are designed to make sure that you
23 | have the freedom to distribute copies of free software (and charge for
24 | this service if you wish), that you receive source code or can get it
25 | if you want it, that you can change the software or use pieces of it
26 | in new free programs; and that you know you can do these things.
27 |
28 | To protect your rights, we need to make restrictions that forbid
29 | anyone to deny you these rights or to ask you to surrender the rights.
30 | These restrictions translate to certain responsibilities for you if you
31 | distribute copies of the software, or if you modify it.
32 |
33 | For example, if you distribute copies of such a program, whether
34 | gratis or for a fee, you must give the recipients all the rights that
35 | you have. You must make sure that they, too, receive or can get the
36 | source code. And you must show them these terms so they know their
37 | rights.
38 |
39 | We protect your rights with two steps: (1) copyright the software, and
40 | (2) offer you this license which gives you legal permission to copy,
41 | distribute and/or modify the software.
42 |
43 | Also, for each author's protection and ours, we want to make certain
44 | that everyone understands that there is no warranty for this free
45 | software. If the software is modified by someone else and passed on, we
46 | want its recipients to know that what they have is not the original, so
47 | that any problems introduced by others will not reflect on the original
48 | authors' reputations.
49 |
50 | Finally, any free program is threatened constantly by software
51 | patents. We wish to avoid the danger that redistributors of a free
52 | program will individually obtain patent licenses, in effect making the
53 | program proprietary. To prevent this, we have made it clear that any
54 | patent must be licensed for everyone's free use or not licensed at all.
55 |
56 | The precise terms and conditions for copying, distribution and
57 | modification follow.
58 |
59 | GNU GENERAL PUBLIC LICENSE
60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61 |
62 | 0. This License applies to any program or other work which contains
63 | a notice placed by the copyright holder saying it may be distributed
64 | under the terms of this General Public License. The "Program", below,
65 | refers to any such program or work, and a "work based on the Program"
66 | means either the Program or any derivative work under copyright law:
67 | that is to say, a work containing the Program or a portion of it,
68 | either verbatim or with modifications and/or translated into another
69 | language. (Hereinafter, translation is included without limitation in
70 | the term "modification".) Each licensee is addressed as "you".
71 |
72 | Activities other than copying, distribution and modification are not
73 | covered by this License; they are outside its scope. The act of
74 | running the Program is not restricted, and the output from the Program
75 | is covered only if its contents constitute a work based on the
76 | Program (independent of having been made by running the Program).
77 | Whether that is true depends on what the Program does.
78 |
79 | 1. You may copy and distribute verbatim copies of the Program's
80 | source code as you receive it, in any medium, provided that you
81 | conspicuously and appropriately publish on each copy an appropriate
82 | copyright notice and disclaimer of warranty; keep intact all the
83 | notices that refer to this License and to the absence of any warranty;
84 | and give any other recipients of the Program a copy of this License
85 | along with the Program.
86 |
87 | You may charge a fee for the physical act of transferring a copy, and
88 | you may at your option offer warranty protection in exchange for a fee.
89 |
90 | 2. You may modify your copy or copies of the Program or any portion
91 | of it, thus forming a work based on the Program, and copy and
92 | distribute such modifications or work under the terms of Section 1
93 | above, provided that you also meet all of these conditions:
94 |
95 | a) You must cause the modified files to carry prominent notices
96 | stating that you changed the files and the date of any change.
97 |
98 | b) You must cause any work that you distribute or publish, that in
99 | whole or in part contains or is derived from the Program or any
100 | part thereof, to be licensed as a whole at no charge to all third
101 | parties under the terms of this License.
102 |
103 | c) If the modified program normally reads commands interactively
104 | when run, you must cause it, when started running for such
105 | interactive use in the most ordinary way, to print or display an
106 | announcement including an appropriate copyright notice and a
107 | notice that there is no warranty (or else, saying that you provide
108 | a warranty) and that users may redistribute the program under
109 | these conditions, and telling the user how to view a copy of this
110 | License. (Exception: if the Program itself is interactive but
111 | does not normally print such an announcement, your work based on
112 | the Program is not required to print an announcement.)
113 |
114 | These requirements apply to the modified work as a whole. If
115 | identifiable sections of that work are not derived from the Program,
116 | and can be reasonably considered independent and separate works in
117 | themselves, then this License, and its terms, do not apply to those
118 | sections when you distribute them as separate works. But when you
119 | distribute the same sections as part of a whole which is a work based
120 | on the Program, the distribution of the whole must be on the terms of
121 | this License, whose permissions for other licensees extend to the
122 | entire whole, and thus to each and every part regardless of who wrote it.
123 |
124 | Thus, it is not the intent of this section to claim rights or contest
125 | your rights to work written entirely by you; rather, the intent is to
126 | exercise the right to control the distribution of derivative or
127 | collective works based on the Program.
128 |
129 | In addition, mere aggregation of another work not based on the Program
130 | with the Program (or with a work based on the Program) on a volume of
131 | a storage or distribution medium does not bring the other work under
132 | the scope of this License.
133 |
134 | 3. You may copy and distribute the Program (or a work based on it,
135 | under Section 2) in object code or executable form under the terms of
136 | Sections 1 and 2 above provided that you also do one of the following:
137 |
138 | a) Accompany it with the complete corresponding machine-readable
139 | source code, which must be distributed under the terms of Sections
140 | 1 and 2 above on a medium customarily used for software interchange; or,
141 |
142 | b) Accompany it with a written offer, valid for at least three
143 | years, to give any third party, for a charge no more than your
144 | cost of physically performing source distribution, a complete
145 | machine-readable copy of the corresponding source code, to be
146 | distributed under the terms of Sections 1 and 2 above on a medium
147 | customarily used for software interchange; or,
148 |
149 | c) Accompany it with the information you received as to the offer
150 | to distribute corresponding source code. (This alternative is
151 | allowed only for noncommercial distribution and only if you
152 | received the program in object code or executable form with such
153 | an offer, in accord with Subsection b above.)
154 |
155 | The source code for a work means the preferred form of the work for
156 | making modifications to it. For an executable work, complete source
157 | code means all the source code for all modules it contains, plus any
158 | associated interface definition files, plus the scripts used to
159 | control compilation and installation of the executable. However, as a
160 | special exception, the source code distributed need not include
161 | anything that is normally distributed (in either source or binary
162 | form) with the major components (compiler, kernel, and so on) of the
163 | operating system on which the executable runs, unless that component
164 | itself accompanies the executable.
165 |
166 | If distribution of executable or object code is made by offering
167 | access to copy from a designated place, then offering equivalent
168 | access to copy the source code from the same place counts as
169 | distribution of the source code, even though third parties are not
170 | compelled to copy the source along with the object code.
171 |
172 | 4. You may not copy, modify, sublicense, or distribute the Program
173 | except as expressly provided under this License. Any attempt
174 | otherwise to copy, modify, sublicense or distribute the Program is
175 | void, and will automatically terminate your rights under this License.
176 | However, parties who have received copies, or rights, from you under
177 | this License will not have their licenses terminated so long as such
178 | parties remain in full compliance.
179 |
180 | 5. You are not required to accept this License, since you have not
181 | signed it. However, nothing else grants you permission to modify or
182 | distribute the Program or its derivative works. These actions are
183 | prohibited by law if you do not accept this License. Therefore, by
184 | modifying or distributing the Program (or any work based on the
185 | Program), you indicate your acceptance of this License to do so, and
186 | all its terms and conditions for copying, distributing or modifying
187 | the Program or works based on it.
188 |
189 | 6. Each time you redistribute the Program (or any work based on the
190 | Program), the recipient automatically receives a license from the
191 | original licensor to copy, distribute or modify the Program subject to
192 | these terms and conditions. You may not impose any further
193 | restrictions on the recipients' exercise of the rights granted herein.
194 | You are not responsible for enforcing compliance by third parties to
195 | this License.
196 |
197 | 7. If, as a consequence of a court judgment or allegation of patent
198 | infringement or for any other reason (not limited to patent issues),
199 | conditions are imposed on you (whether by court order, agreement or
200 | otherwise) that contradict the conditions of this License, they do not
201 | excuse you from the conditions of this License. If you cannot
202 | distribute so as to satisfy simultaneously your obligations under this
203 | License and any other pertinent obligations, then as a consequence you
204 | may not distribute the Program at all. For example, if a patent
205 | license would not permit royalty-free redistribution of the Program by
206 | all those who receive copies directly or indirectly through you, then
207 | the only way you could satisfy both it and this License would be to
208 | refrain entirely from distribution of the Program.
209 |
210 | If any portion of this section is held invalid or unenforceable under
211 | any particular circumstance, the balance of the section is intended to
212 | apply and the section as a whole is intended to apply in other
213 | circumstances.
214 |
215 | It is not the purpose of this section to induce you to infringe any
216 | patents or other property right claims or to contest validity of any
217 | such claims; this section has the sole purpose of protecting the
218 | integrity of the free software distribution system, which is
219 | implemented by public license practices. Many people have made
220 | generous contributions to the wide range of software distributed
221 | through that system in reliance on consistent application of that
222 | system; it is up to the author/donor to decide if he or she is willing
223 | to distribute software through any other system and a licensee cannot
224 | impose that choice.
225 |
226 | This section is intended to make thoroughly clear what is believed to
227 | be a consequence of the rest of this License.
228 |
229 | 8. If the distribution and/or use of the Program is restricted in
230 | certain countries either by patents or by copyrighted interfaces, the
231 | original copyright holder who places the Program under this License
232 | may add an explicit geographical distribution limitation excluding
233 | those countries, so that distribution is permitted only in or among
234 | countries not thus excluded. In such case, this License incorporates
235 | the limitation as if written in the body of this License.
236 |
237 | 9. The Free Software Foundation may publish revised and/or new versions
238 | of the General Public License from time to time. Such new versions will
239 | be similar in spirit to the present version, but may differ in detail to
240 | address new problems or concerns.
241 |
242 | Each version is given a distinguishing version number. If the Program
243 | specifies a version number of this License which applies to it and "any
244 | later version", you have the option of following the terms and conditions
245 | either of that version or of any later version published by the Free
246 | Software Foundation. If the Program does not specify a version number of
247 | this License, you may choose any version ever published by the Free Software
248 | Foundation.
249 |
250 | 10. If you wish to incorporate parts of the Program into other free
251 | programs whose distribution conditions are different, write to the author
252 | to ask for permission. For software which is copyrighted by the Free
253 | Software Foundation, write to the Free Software Foundation; we sometimes
254 | make exceptions for this. Our decision will be guided by the two goals
255 | of preserving the free status of all derivatives of our free software and
256 | of promoting the sharing and reuse of software generally.
257 |
258 | NO WARRANTY
259 |
260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268 | REPAIR OR CORRECTION.
269 |
270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278 | POSSIBILITY OF SUCH DAMAGES.
279 |
280 | END OF TERMS AND CONDITIONS
281 |
282 | How to Apply These Terms to Your New Programs
283 |
284 | If you develop a new program, and you want it to be of the greatest
285 | possible use to the public, the best way to achieve this is to make it
286 | free software which everyone can redistribute and change under these terms.
287 |
288 | To do so, attach the following notices to the program. It is safest
289 | to attach them to the start of each source file to most effectively
290 | convey the exclusion of warranty; and each file should have at least
291 | the "copyright" line and a pointer to where the full notice is found.
292 |
293 | {description}
294 | Copyright (C) {year} {fullname}
295 |
296 | This program is free software; you can redistribute it and/or modify
297 | it under the terms of the GNU General Public License as published by
298 | the Free Software Foundation; either version 2 of the License, or
299 | (at your option) any later version.
300 |
301 | This program is distributed in the hope that it will be useful,
302 | but WITHOUT ANY WARRANTY; without even the implied warranty of
303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304 | GNU General Public License for more details.
305 |
306 | You should have received a copy of the GNU General Public License along
307 | with this program; if not, write to the Free Software Foundation, Inc.,
308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
309 |
310 | Also add information on how to contact you by electronic and paper mail.
311 |
312 | If the program is interactive, make it output a short notice like this
313 | when it starts in an interactive mode:
314 |
315 | Gnomovision version 69, Copyright (C) year name of author
316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
317 | This is free software, and you are welcome to redistribute it
318 | under certain conditions; type `show c' for details.
319 |
320 | The hypothetical commands `show w' and `show c' should show the appropriate
321 | parts of the General Public License. Of course, the commands you use may
322 | be called something other than `show w' and `show c'; they could even be
323 | mouse-clicks or menu items--whatever suits your program.
324 |
325 | You should also get your employer (if you work as a programmer) or your
326 | school, if any, to sign a "copyright disclaimer" for the program, if
327 | necessary. Here is a sample; alter the names:
328 |
329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program
330 | `Gnomovision' (which makes passes at compilers) written by James Hacker.
331 |
332 | {signature of Ty Coon}, 1 April 1989
333 | Ty Coon, President of Vice
334 |
335 | This General Public License does not permit incorporating your program into
336 | proprietary programs. If your program is a subroutine library, you may
337 | consider it more useful to permit linking proprietary applications with the
338 | library. If this is what you want to do, use the GNU Lesser General
339 | Public License instead of this License.
340 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | mysql-udf-regexp
2 | ================
3 |
4 | This package impelemnts regular expression functions as MySQL User Defined Functions (UDFs).
5 |
6 | The functions implemented by this package are:
7 |
8 | REGEXP_LIKE(text, pattern [, mode])
9 | REGEXP_SUBSTR(text, pattern [,position [,occurence [,mode]]])
10 | REGEXP_INSTR?(text, pattern [,position [,occurence [,return_end [,mode]]]])
11 | REGEXP_REPLACE?(text, pattern, replace [,position [,occurence [,return_end [,mode]]])
12 |
13 | The functions support the same regular expression syntax as the MySQL REGEXP operator as documented in the Regular Expressions appendix of the MySQL manual.
14 |
15 | These functions are very similar to the Oracle SQL functions by the same name. They are not 100% compatible but should be good enough to act as replacements in most common use cases.
16 |
--------------------------------------------------------------------------------
/regexp.xml:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hholzgra/mysql-udf-regexp/096bbc9406e272ab8bf75c6eafe6980c2981a010/regexp.xml
--------------------------------------------------------------------------------
/regexp/AUTHORS:
--------------------------------------------------------------------------------
1 | regexp
2 | Hartmut Holzgraefe
3 |
--------------------------------------------------------------------------------
/regexp/COPYING:
--------------------------------------------------------------------------------
1 | GNU General Public License
2 | **************************
3 |
4 | Version 2, June 1991
5 |
6 | Copyright (C) 1989, 1991 Free Software Foundation, Inc.
7 | 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
8 |
9 | Everyone is permitted to copy and distribute verbatim copies
10 | of this license document, but changing it is not allowed.
11 |
12 | Preamble
13 | ========
14 |
15 | The licenses for most software are designed to take away your freedom
16 | to share and change it. By contrast, the GNU General Public License is
17 | intended to guarantee your freedom to share and change free
18 | software--to make sure the software is free for all its users. This
19 | General Public License applies to most of the Free Software
20 | Foundation's software and to any other program whose authors commit to
21 | using it. (Some other Free Software Foundation software is covered by
22 | the GNU Library General Public License instead.) You can apply it to
23 | your programs, too.
24 |
25 | When we speak of free software, we are referring to freedom, not price.
26 | Our General Public Licenses are designed to make sure that you have
27 | the freedom to distribute copies of free software (and charge for this
28 | service if you wish), that you receive source code or can get it if you
29 | want it, that you can change the software or use pieces of it in new
30 | free programs; and that you know you can do these things.
31 |
32 | To protect your rights, we need to make restrictions that forbid anyone
33 | to deny you these rights or to ask you to surrender the rights. These
34 | restrictions translate to certain responsibilities for you if you
35 | distribute copies of the software, or if you modify it.
36 |
37 | For example, if you distribute copies of such a program, whether gratis
38 | or for a fee, you must give the recipients all the rights that you
39 | have. You must make sure that they, too, receive or can get the source
40 | code. And you must show them these terms so they know their rights.
41 |
42 | We protect your rights with two steps: (1) copyright the software, and
43 | (2) offer you this license which gives you legal permission to copy,
44 | distribute and/or modify the software.
45 |
46 | Also, for each author's protection and ours, we want to make certain
47 | that everyone understands that there is no warranty for this free
48 | software. If the software is modified by someone else and passed on, we
49 | want its recipients to know that what they have is not the original, so
50 | that any problems introduced by others will not reflect on the original
51 | authors' reputations.
52 |
53 | Finally, any free program is threatened constantly by software patents.
54 | We wish to avoid the danger that redistributors of a free program will
55 | individually obtain patent licenses, in effect making the program
56 | proprietary. To prevent this, we have made it clear that any patent
57 | must be licensed for everyone's free use or not licensed at all.
58 |
59 | The precise terms and conditions for copying, distribution and
60 | modification follow.
61 |
62 | GNU GENERAL PUBLIC LICENSE
63 |
64 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
65 |
66 | 0. This License applies to any program or other work which contains a
67 | notice placed by the copyright holder saying it may be distributed
68 | under the terms of this General Public License. The "Program",
69 | below, refers to any such program or work, and a "work based on
70 | the Program" means either the Program or any derivative work under
71 | copyright law: that is to say, a work containing the Program or a
72 | portion of it, either verbatim or with modifications and/or
73 | translated into another language. (Hereinafter, translation is
74 | included without limitation in the term "modification".) Each
75 | licensee is addressed as "you".
76 |
77 | Activities other than copying, distribution and modification are
78 | not covered by this License; they are outside its scope. The act
79 | of running the Program is not restricted, and the output from the
80 | Program is covered only if its contents constitute a work based on
81 | the Program (independent of having been made by running the
82 | Program). Whether that is true depends on what the Program does.
83 |
84 | 1. You may copy and distribute verbatim copies of the Program's
85 | source code as you receive it, in any medium, provided that you
86 | conspicuously and appropriately publish on each copy an appropriate
87 | copyright notice and disclaimer of warranty; keep intact all the
88 | notices that refer to this License and to the absence of any
89 | warranty; and give any other recipients of the Program a copy of
90 | this License along with the Program.
91 |
92 | You may charge a fee for the physical act of transferring a copy,
93 | and you may at your option offer warranty protection in exchange
94 | for a fee.
95 |
96 | 2. You may modify your copy or copies of the Program or any portion
97 | of it, thus forming a work based on the Program, and copy and
98 | distribute such modifications or work under the terms of Section 1
99 | above, provided that you also meet all of these conditions:
100 |
101 | a. You must cause the modified files to carry prominent notices
102 | stating that you changed the files and the date of any change.
103 |
104 | b. You must cause any work that you distribute or publish, that
105 | in whole or in part contains or is derived from the Program
106 | or any part thereof, to be licensed as a whole at no charge
107 | to all third parties under the terms of this License.
108 |
109 | c. If the modified program normally reads commands interactively
110 | when run, you must cause it, when started running for such
111 | interactive use in the most ordinary way, to print or display
112 | an announcement including an appropriate copyright notice and
113 | a notice that there is no warranty (or else, saying that you
114 | provide a warranty) and that users may redistribute the
115 | program under these conditions, and telling the user how to
116 | view a copy of this License. (Exception: if the Program
117 | itself is interactive but does not normally print such an
118 | announcement, your work based on the Program is not required
119 | to print an announcement.)
120 |
121 | These requirements apply to the modified work as a whole. If
122 | identifiable sections of that work are not derived from the
123 | Program, and can be reasonably considered independent and separate
124 | works in themselves, then this License, and its terms, do not
125 | apply to those sections when you distribute them as separate
126 | works. But when you distribute the same sections as part of a
127 | whole which is a work based on the Program, the distribution of
128 | the whole must be on the terms of this License, whose permissions
129 | for other licensees extend to the entire whole, and thus to each
130 | and every part regardless of who wrote it.
131 |
132 | Thus, it is not the intent of this section to claim rights or
133 | contest your rights to work written entirely by you; rather, the
134 | intent is to exercise the right to control the distribution of
135 | derivative or collective works based on the Program.
136 |
137 | In addition, mere aggregation of another work not based on the
138 | Program with the Program (or with a work based on the Program) on
139 | a volume of a storage or distribution medium does not bring the
140 | other work under the scope of this License.
141 |
142 | 3. You may copy and distribute the Program (or a work based on it,
143 | under Section 2) in object code or executable form under the terms
144 | of Sections 1 and 2 above provided that you also do one of the
145 | following:
146 |
147 | a. Accompany it with the complete corresponding machine-readable
148 | source code, which must be distributed under the terms of
149 | Sections 1 and 2 above on a medium customarily used for
150 | software interchange; or,
151 |
152 | b. Accompany it with a written offer, valid for at least three
153 | years, to give any third-party, for a charge no more than your
154 | cost of physically performing source distribution, a complete
155 | machine-readable copy of the corresponding source code, to be
156 | distributed under the terms of Sections 1 and 2 above on a
157 | medium customarily used for software interchange; or,
158 |
159 | c. Accompany it with the information you received as to the offer
160 | to distribute corresponding source code. (This alternative is
161 | allowed only for noncommercial distribution and only if you
162 | received the program in object code or executable form with
163 | such an offer, in accord with Subsection b above.)
164 |
165 | The source code for a work means the preferred form of the work for
166 | making modifications to it. For an executable work, complete
167 | source code means all the source code for all modules it contains,
168 | plus any associated interface definition files, plus the scripts
169 | used to control compilation and installation of the executable.
170 | However, as a special exception, the source code distributed need
171 | not include anything that is normally distributed (in either
172 | source or binary form) with the major components (compiler,
173 | kernel, and so on) of the operating system on which the executable
174 | runs, unless that component itself accompanies the executable.
175 |
176 | If distribution of executable or object code is made by offering
177 | access to copy from a designated place, then offering equivalent
178 | access to copy the source code from the same place counts as
179 | distribution of the source code, even though third parties are not
180 | compelled to copy the source along with the object code.
181 |
182 | 4. You may not copy, modify, sublicense, or distribute the Program
183 | except as expressly provided under this License. Any attempt
184 | otherwise to copy, modify, sublicense or distribute the Program is
185 | void, and will automatically terminate your rights under this
186 | License. However, parties who have received copies, or rights,
187 | from you under this License will not have their licenses
188 | terminated so long as such parties remain in full compliance.
189 |
190 | 5. You are not required to accept this License, since you have not
191 | signed it. However, nothing else grants you permission to modify
192 | or distribute the Program or its derivative works. These actions
193 | are prohibited by law if you do not accept this License.
194 | Therefore, by modifying or distributing the Program (or any work
195 | based on the Program), you indicate your acceptance of this
196 | License to do so, and all its terms and conditions for copying,
197 | distributing or modifying the Program or works based on it.
198 |
199 | 6. Each time you redistribute the Program (or any work based on the
200 | Program), the recipient automatically receives a license from the
201 | original licensor to copy, distribute or modify the Program
202 | subject to these terms and conditions. You may not impose any
203 | further restrictions on the recipients' exercise of the rights
204 | granted herein. You are not responsible for enforcing compliance
205 | by third parties to this License.
206 |
207 | 7. If, as a consequence of a court judgment or allegation of patent
208 | infringement or for any other reason (not limited to patent
209 | issues), conditions are imposed on you (whether by court order,
210 | agreement or otherwise) that contradict the conditions of this
211 | License, they do not excuse you from the conditions of this
212 | License. If you cannot distribute so as to satisfy simultaneously
213 | your obligations under this License and any other pertinent
214 | obligations, then as a consequence you may not distribute the
215 | Program at all. For example, if a patent license would not permit
216 | royalty-free redistribution of the Program by all those who
217 | receive copies directly or indirectly through you, then the only
218 | way you could satisfy both it and this License would be to refrain
219 | entirely from distribution of the Program.
220 |
221 | If any portion of this section is held invalid or unenforceable
222 | under any particular circumstance, the balance of the section is
223 | intended to apply and the section as a whole is intended to apply
224 | in other circumstances.
225 |
226 | It is not the purpose of this section to induce you to infringe any
227 | patents or other property right claims or to contest validity of
228 | any such claims; this section has the sole purpose of protecting
229 | the integrity of the free software distribution system, which is
230 | implemented by public license practices. Many people have made
231 | generous contributions to the wide range of software distributed
232 | through that system in reliance on consistent application of that
233 | system; it is up to the author/donor to decide if he or she is
234 | willing to distribute software through any other system and a
235 | licensee cannot impose that choice.
236 |
237 | This section is intended to make thoroughly clear what is believed
238 | to be a consequence of the rest of this License.
239 |
240 | 8. If the distribution and/or use of the Program is restricted in
241 | certain countries either by patents or by copyrighted interfaces,
242 | the original copyright holder who places the Program under this
243 | License may add an explicit geographical distribution limitation
244 | excluding those countries, so that distribution is permitted only
245 | in or among countries not thus excluded. In such case, this
246 | License incorporates the limitation as if written in the body of
247 | this License.
248 |
249 | 9. The Free Software Foundation may publish revised and/or new
250 | versions of the General Public License from time to time. Such
251 | new versions will be similar in spirit to the present version, but
252 | may differ in detail to address new problems or concerns.
253 |
254 | Each version is given a distinguishing version number. If the
255 | Program specifies a version number of this License which applies
256 | to it and "any later version", you have the option of following
257 | the terms and conditions either of that version or of any later
258 | version published by the Free Software Foundation. If the Program
259 | does not specify a version number of this License, you may choose
260 | any version ever published by the Free Software Foundation.
261 |
262 | 10. If you wish to incorporate parts of the Program into other free
263 | programs whose distribution conditions are different, write to the
264 | author to ask for permission. For software which is copyrighted
265 | by the Free Software Foundation, write to the Free Software
266 | Foundation; we sometimes make exceptions for this. Our decision
267 | will be guided by the two goals of preserving the free status of
268 | all derivatives of our free software and of promoting the sharing
269 | and reuse of software generally.
270 |
271 | NO WARRANTY
272 |
273 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO
274 | WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE
275 | LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
276 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT
277 | WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT
278 | NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
279 | FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE
280 | QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
281 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY
282 | SERVICING, REPAIR OR CORRECTION.
283 |
284 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
285 | WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY
286 | MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE
287 | LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL,
288 | INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR
289 | INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
290 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU
291 | OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY
292 | OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN
293 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
294 |
295 | END OF TERMS AND CONDITIONS
296 |
--------------------------------------------------------------------------------
/regexp/ChangeLog:
--------------------------------------------------------------------------------
1 | This is a source project generated by CodeGen_MySQL_UDF_Extension 0.9.8
2 | ...
3 |
--------------------------------------------------------------------------------
/regexp/INSTALL:
--------------------------------------------------------------------------------
1 | UDF-regexp 1.0
2 | ==============
3 |
4 | == Configuration ==
5 |
6 | This user defined function module relies on information only
7 | available in the MySQL source code, it can't be compiled if
8 | you've only installed MySQL binary packages.
9 |
10 | To compile this package you need to first tell configure
11 | where to find the MySQL source directory you want to compile
12 | against using the --with-mysql-src configure option, e.g:
13 |
14 | configure --with-mysql-src=/home/username/src/mysql-5.0.37
15 |
16 |
17 | For a full list of configure options see
18 |
19 | configure --help
20 |
21 | By default the UDF library created by this package will install
22 | into /usr/local/lib. The mysql server may not be able to load
23 | it from there though as this directory may not be in its
24 | library search path.
25 |
26 | You may solve this by:
27 |
28 | - adding /usr/local/lib to the LD_LIBRARY_PATH before
29 | invoking the mysql server
30 |
31 | - changing the UDF install prefix by using either the
32 | --prefix or --libdir configure option so that the
33 | UDF library gets installed into a directory that is
34 | in the servers load path
35 |
36 | - or both of the above
37 |
38 | == Compilation ==
39 |
40 | Once you have successfully configured the package
41 | you should be able to compile it by simply typing
42 |
43 | make
44 |
45 | == Testing ==
46 |
47 | This package includes test cases that can be invoked using
48 |
49 | mysql test
50 |
51 | This relies on the following mysql binaries being available
52 | in your environments search $PATH to function as the tests
53 | rely on the mysql server test framework:
54 |
55 | * mysql - the mysql command line client
56 | * mysqld - the mysql server
57 | * mysqladmin - the mysql administration command line tool
58 | * mysql_install_db - the database server initialisation tool
59 | * mysqltest - the actual test framework tool
60 |
61 | == Installing the library ==
62 |
63 | To install the generated UDF library you simply need to invoke
64 |
65 | make install
66 |
67 | Depending on the target directories user permissions you might
68 | need to do this as superuser though, eg. by using "sudo":
69 |
70 | sudo make install
71 |
72 | Remember that the mysql server will only be able to load the
73 | library if it is installed in a directory in its library load
74 | path, you may modify this search path by invoking the server
75 | with the $LD_LIBRARY_PATH environment variable set appropriately
76 | before starting.
77 |
78 | == Installing the actual functions ==
79 |
80 | To actually enable the functions provided by this UDF module
81 | you need to make them known to the MySQL server using
82 | "CREATE FUNCTION" SQL commands:
83 |
84 | Register the functions provided by this UDF module using
85 | CREATE FUNCTION regexp_like RETURNS INTEGER SONAME "regexp.so";
86 | CREATE FUNCTION regexp_substr RETURNS STRING SONAME "regexp.so";
87 | CREATE FUNCTION regexp_instr RETURNS INTEGER SONAME "regexp.so";
88 | CREATE FUNCTION regexp_replace RETURNS STRING SONAME "regexp.so";
89 |
90 | Unregister the functions provided by this UDF module using
91 | DROP FUNCTION regexp_like;
92 | DROP FUNCTION regexp_substr;
93 | DROP FUNCTION regexp_instr;
94 | DROP FUNCTION regexp_replace;
95 |
96 | == Changing the source ==
97 |
98 | Changes applied to any of the files in this project may be
99 | overwritten by further invocations of the udf-gen tool so
100 | you should always try to apply all necessary changes to the
101 | XML specification file the project was generated from instead
102 | and then regenerate the project from the spec file instead.
103 |
104 | The udf-gen tool will only overwrite files that actually
105 | changed, so preserving file system time stamps of unmodified
106 | files, to play nice with "make" and to avoid unnecessary
107 | recompilation of source files.
108 |
109 |
--------------------------------------------------------------------------------
/regexp/Makefile.am:
--------------------------------------------------------------------------------
1 | lib_LTLIBRARIES = regexp.la
2 |
3 | regexp_la_SOURCES = regexp.c
4 |
5 | EXTRA_DIST = udf_regexp.h
6 | noinst_HEADERS = udf_regexp.h
7 |
8 |
9 | regexp_la_CFLAGS = @MYSQL_CFLAGS@
10 | regexp_la_CXXFLAGS = @MYSQL_CXXFLAGS@
11 | regexp_la_LDFLAGS = -module -avoid-version -no-undefined
12 |
13 | test: all
14 | cd tests; ./test.sh
15 |
16 |
17 | pdf: manual.pdf
18 |
19 | manual.pdf: manual.xml
20 | docbook2pdf manual.xml
21 |
22 | html: manual.html
23 |
24 | manual.html: manual.xml
25 | docbook2html -u manual.xml
26 |
27 |
--------------------------------------------------------------------------------
/regexp/Makefile.in:
--------------------------------------------------------------------------------
1 | # Makefile.in generated by automake 1.9.6 from Makefile.am.
2 | # @configure_input@
3 |
4 | # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
5 | # 2003, 2004, 2005 Free Software Foundation, Inc.
6 | # This Makefile.in is free software; the Free Software Foundation
7 | # gives unlimited permission to copy and/or distribute it,
8 | # with or without modifications, as long as this notice is preserved.
9 |
10 | # This program is distributed in the hope that it will be useful,
11 | # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
12 | # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
13 | # PARTICULAR PURPOSE.
14 |
15 | @SET_MAKE@
16 |
17 |
18 | srcdir = @srcdir@
19 | top_srcdir = @top_srcdir@
20 | VPATH = @srcdir@
21 | pkgdatadir = $(datadir)/@PACKAGE@
22 | pkglibdir = $(libdir)/@PACKAGE@
23 | pkgincludedir = $(includedir)/@PACKAGE@
24 | top_builddir = .
25 | am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
26 | INSTALL = @INSTALL@
27 | install_sh_DATA = $(install_sh) -c -m 644
28 | install_sh_PROGRAM = $(install_sh) -c
29 | install_sh_SCRIPT = $(install_sh) -c
30 | INSTALL_HEADER = $(INSTALL_DATA)
31 | transform = $(program_transform_name)
32 | NORMAL_INSTALL = :
33 | PRE_INSTALL = :
34 | POST_INSTALL = :
35 | NORMAL_UNINSTALL = :
36 | PRE_UNINSTALL = :
37 | POST_UNINSTALL = :
38 | build_triplet = @build@
39 | host_triplet = @host@
40 | DIST_COMMON = README $(am__configure_deps) $(noinst_HEADERS) \
41 | $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
42 | $(srcdir)/config.h.in $(top_srcdir)/configure AUTHORS COPYING \
43 | ChangeLog INSTALL NEWS compile config.guess config.sub depcomp \
44 | install-sh ltmain.sh missing
45 | subdir = .
46 | ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
47 | am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
48 | $(top_srcdir)/mysql.m4 $(top_srcdir)/ax_compare_version.m4 \
49 | $(top_srcdir)/configure.in
50 | am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
51 | $(ACLOCAL_M4)
52 | am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
53 | configure.lineno configure.status.lineno
54 | mkinstalldirs = $(install_sh) -d
55 | CONFIG_HEADER = config.h
56 | CONFIG_CLEAN_FILES =
57 | am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
58 | am__vpath_adj = case $$p in \
59 | $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
60 | *) f=$$p;; \
61 | esac;
62 | am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
63 | am__installdirs = "$(DESTDIR)$(libdir)"
64 | libLTLIBRARIES_INSTALL = $(INSTALL)
65 | LTLIBRARIES = $(lib_LTLIBRARIES)
66 | regexp_la_LIBADD =
67 | am_regexp_la_OBJECTS = regexp_la-regexp.lo
68 | regexp_la_OBJECTS = $(am_regexp_la_OBJECTS)
69 | DEFAULT_INCLUDES = -I. -I$(srcdir) -I.
70 | depcomp = $(SHELL) $(top_srcdir)/depcomp
71 | am__depfiles_maybe = depfiles
72 | COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
73 | $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
74 | LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
75 | $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
76 | $(AM_CFLAGS) $(CFLAGS)
77 | CCLD = $(CC)
78 | LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
79 | $(AM_LDFLAGS) $(LDFLAGS) -o $@
80 | SOURCES = $(regexp_la_SOURCES)
81 | DIST_SOURCES = $(regexp_la_SOURCES)
82 | HEADERS = $(noinst_HEADERS)
83 | ETAGS = etags
84 | CTAGS = ctags
85 | DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
86 | distdir = $(PACKAGE)-$(VERSION)
87 | top_distdir = $(distdir)
88 | am__remove_distdir = \
89 | { test ! -d $(distdir) \
90 | || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
91 | && rm -fr $(distdir); }; }
92 | DIST_ARCHIVES = $(distdir).tar.gz
93 | GZIP_ENV = --best
94 | distuninstallcheck_listfiles = find . -type f -print
95 | distcleancheck_listfiles = find . -type f -print
96 | ACLOCAL = @ACLOCAL@
97 | AMDEP_FALSE = @AMDEP_FALSE@
98 | AMDEP_TRUE = @AMDEP_TRUE@
99 | AMTAR = @AMTAR@
100 | AR = @AR@
101 | AUTOCONF = @AUTOCONF@
102 | AUTOHEADER = @AUTOHEADER@
103 | AUTOMAKE = @AUTOMAKE@
104 | AWK = @AWK@
105 | CC = @CC@
106 | CCDEPMODE = @CCDEPMODE@
107 | CFLAGS = @CFLAGS@
108 | CPP = @CPP@
109 | CPPFLAGS = @CPPFLAGS@
110 | CXX = @CXX@
111 | CXXCPP = @CXXCPP@
112 | CXXDEPMODE = @CXXDEPMODE@
113 | CXXFLAGS = @CXXFLAGS@
114 | CYGPATH_W = @CYGPATH_W@
115 | DEFS = @DEFS@
116 | DEPDIR = @DEPDIR@
117 | ECHO = @ECHO@
118 | ECHO_C = @ECHO_C@
119 | ECHO_N = @ECHO_N@
120 | ECHO_T = @ECHO_T@
121 | EGREP = @EGREP@
122 | EXEEXT = @EXEEXT@
123 | F77 = @F77@
124 | FFLAGS = @FFLAGS@
125 | INSTALL_DATA = @INSTALL_DATA@
126 | INSTALL_PROGRAM = @INSTALL_PROGRAM@
127 | INSTALL_SCRIPT = @INSTALL_SCRIPT@
128 | INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
129 | LDFLAGS = @LDFLAGS@
130 | LIBOBJS = @LIBOBJS@
131 | LIBS = @LIBS@
132 | LIBTOOL = @LIBTOOL@
133 | LN_S = @LN_S@
134 | LTLIBOBJS = @LTLIBOBJS@
135 | MAKEINFO = @MAKEINFO@
136 | MYSQL_CFLAGS = @MYSQL_CFLAGS@
137 | MYSQL_CXXFLAGS = @MYSQL_CXXFLAGS@
138 | MYSQL_LDFLAGS = @MYSQL_LDFLAGS@
139 | MYSQL_LIBS = @MYSQL_LIBS@
140 | MYSQL_VERSION = @MYSQL_VERSION@
141 | OBJEXT = @OBJEXT@
142 | PACKAGE = @PACKAGE@
143 | PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
144 | PACKAGE_NAME = @PACKAGE_NAME@
145 | PACKAGE_STRING = @PACKAGE_STRING@
146 | PACKAGE_TARNAME = @PACKAGE_TARNAME@
147 | PACKAGE_VERSION = @PACKAGE_VERSION@
148 | PATH_SEPARATOR = @PATH_SEPARATOR@
149 | RANLIB = @RANLIB@
150 | SET_MAKE = @SET_MAKE@
151 | SHELL = @SHELL@
152 | STRIP = @STRIP@
153 | VERSION = @VERSION@
154 | ac_ct_AR = @ac_ct_AR@
155 | ac_ct_CC = @ac_ct_CC@
156 | ac_ct_CXX = @ac_ct_CXX@
157 | ac_ct_F77 = @ac_ct_F77@
158 | ac_ct_RANLIB = @ac_ct_RANLIB@
159 | ac_ct_STRIP = @ac_ct_STRIP@
160 | am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
161 | am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
162 | am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
163 | am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
164 | am__include = @am__include@
165 | am__leading_dot = @am__leading_dot@
166 | am__quote = @am__quote@
167 | am__tar = @am__tar@
168 | am__untar = @am__untar@
169 | bindir = @bindir@
170 | build = @build@
171 | build_alias = @build_alias@
172 | build_cpu = @build_cpu@
173 | build_os = @build_os@
174 | build_vendor = @build_vendor@
175 | datadir = @datadir@
176 | exec_prefix = @exec_prefix@
177 | host = @host@
178 | host_alias = @host_alias@
179 | host_cpu = @host_cpu@
180 | host_os = @host_os@
181 | host_vendor = @host_vendor@
182 | includedir = @includedir@
183 | infodir = @infodir@
184 | install_sh = @install_sh@
185 | libdir = @libdir@
186 | libexecdir = @libexecdir@
187 | localstatedir = @localstatedir@
188 | mandir = @mandir@
189 | mkdir_p = @mkdir_p@
190 | oldincludedir = @oldincludedir@
191 | prefix = @prefix@
192 | program_transform_name = @program_transform_name@
193 | sbindir = @sbindir@
194 | sharedstatedir = @sharedstatedir@
195 | sysconfdir = @sysconfdir@
196 | target_alias = @target_alias@
197 | lib_LTLIBRARIES = regexp.la
198 | regexp_la_SOURCES = regexp.c
199 | EXTRA_DIST = udf_regexp.h
200 | noinst_HEADERS = udf_regexp.h
201 | regexp_la_CFLAGS = @MYSQL_CFLAGS@
202 | regexp_la_CXXFLAGS = @MYSQL_CXXFLAGS@
203 | regexp_la_LDFLAGS = -module -avoid-version -no-undefined
204 | all: config.h
205 | $(MAKE) $(AM_MAKEFLAGS) all-am
206 |
207 | .SUFFIXES:
208 | .SUFFIXES: .c .lo .o .obj
209 | am--refresh:
210 | @:
211 | $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
212 | @for dep in $?; do \
213 | case '$(am__configure_deps)' in \
214 | *$$dep*) \
215 | echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \
216 | cd $(srcdir) && $(AUTOMAKE) --gnu \
217 | && exit 0; \
218 | exit 1;; \
219 | esac; \
220 | done; \
221 | echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
222 | cd $(top_srcdir) && \
223 | $(AUTOMAKE) --gnu Makefile
224 | .PRECIOUS: Makefile
225 | Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
226 | @case '$?' in \
227 | *config.status*) \
228 | echo ' $(SHELL) ./config.status'; \
229 | $(SHELL) ./config.status;; \
230 | *) \
231 | echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
232 | cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
233 | esac;
234 |
235 | $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
236 | $(SHELL) ./config.status --recheck
237 |
238 | $(top_srcdir)/configure: $(am__configure_deps)
239 | cd $(srcdir) && $(AUTOCONF)
240 | $(ACLOCAL_M4): $(am__aclocal_m4_deps)
241 | cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
242 |
243 | config.h: stamp-h1
244 | @if test ! -f $@; then \
245 | rm -f stamp-h1; \
246 | $(MAKE) stamp-h1; \
247 | else :; fi
248 |
249 | stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
250 | @rm -f stamp-h1
251 | cd $(top_builddir) && $(SHELL) ./config.status config.h
252 | $(srcdir)/config.h.in: $(am__configure_deps)
253 | cd $(top_srcdir) && $(AUTOHEADER)
254 | rm -f stamp-h1
255 | touch $@
256 |
257 | distclean-hdr:
258 | -rm -f config.h stamp-h1
259 | install-libLTLIBRARIES: $(lib_LTLIBRARIES)
260 | @$(NORMAL_INSTALL)
261 | test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)"
262 | @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
263 | if test -f $$p; then \
264 | f=$(am__strip_dir) \
265 | echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
266 | $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
267 | else :; fi; \
268 | done
269 |
270 | uninstall-libLTLIBRARIES:
271 | @$(NORMAL_UNINSTALL)
272 | @set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \
273 | p=$(am__strip_dir) \
274 | echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
275 | $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
276 | done
277 |
278 | clean-libLTLIBRARIES:
279 | -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
280 | @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
281 | dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
282 | test "$$dir" != "$$p" || dir=.; \
283 | echo "rm -f \"$${dir}/so_locations\""; \
284 | rm -f "$${dir}/so_locations"; \
285 | done
286 | regexp.la: $(regexp_la_OBJECTS) $(regexp_la_DEPENDENCIES)
287 | $(LINK) -rpath $(libdir) $(regexp_la_LDFLAGS) $(regexp_la_OBJECTS) $(regexp_la_LIBADD) $(LIBS)
288 |
289 | mostlyclean-compile:
290 | -rm -f *.$(OBJEXT)
291 |
292 | distclean-compile:
293 | -rm -f *.tab.c
294 |
295 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/regexp_la-regexp.Plo@am__quote@
296 |
297 | .c.o:
298 | @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
299 | @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
300 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
301 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
302 | @am__fastdepCC_FALSE@ $(COMPILE) -c $<
303 |
304 | .c.obj:
305 | @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
306 | @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
307 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
308 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
309 | @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
310 |
311 | .c.lo:
312 | @am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
313 | @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
314 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
315 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
316 | @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
317 |
318 | regexp_la-regexp.lo: regexp.c
319 | @am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(regexp_la_CFLAGS) $(CFLAGS) -MT regexp_la-regexp.lo -MD -MP -MF "$(DEPDIR)/regexp_la-regexp.Tpo" -c -o regexp_la-regexp.lo `test -f 'regexp.c' || echo '$(srcdir)/'`regexp.c; \
320 | @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/regexp_la-regexp.Tpo" "$(DEPDIR)/regexp_la-regexp.Plo"; else rm -f "$(DEPDIR)/regexp_la-regexp.Tpo"; exit 1; fi
321 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='regexp.c' object='regexp_la-regexp.lo' libtool=yes @AMDEPBACKSLASH@
322 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
323 | @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(regexp_la_CFLAGS) $(CFLAGS) -c -o regexp_la-regexp.lo `test -f 'regexp.c' || echo '$(srcdir)/'`regexp.c
324 |
325 | mostlyclean-libtool:
326 | -rm -f *.lo
327 |
328 | clean-libtool:
329 | -rm -rf .libs _libs
330 |
331 | distclean-libtool:
332 | -rm -f libtool
333 | uninstall-info-am:
334 |
335 | ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
336 | list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
337 | unique=`for i in $$list; do \
338 | if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
339 | done | \
340 | $(AWK) ' { files[$$0] = 1; } \
341 | END { for (i in files) print i; }'`; \
342 | mkid -fID $$unique
343 | tags: TAGS
344 |
345 | TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
346 | $(TAGS_FILES) $(LISP)
347 | tags=; \
348 | here=`pwd`; \
349 | list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
350 | unique=`for i in $$list; do \
351 | if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
352 | done | \
353 | $(AWK) ' { files[$$0] = 1; } \
354 | END { for (i in files) print i; }'`; \
355 | if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
356 | test -n "$$unique" || unique=$$empty_fix; \
357 | $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
358 | $$tags $$unique; \
359 | fi
360 | ctags: CTAGS
361 | CTAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
362 | $(TAGS_FILES) $(LISP)
363 | tags=; \
364 | here=`pwd`; \
365 | list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
366 | unique=`for i in $$list; do \
367 | if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
368 | done | \
369 | $(AWK) ' { files[$$0] = 1; } \
370 | END { for (i in files) print i; }'`; \
371 | test -z "$(CTAGS_ARGS)$$tags$$unique" \
372 | || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
373 | $$tags $$unique
374 |
375 | GTAGS:
376 | here=`$(am__cd) $(top_builddir) && pwd` \
377 | && cd $(top_srcdir) \
378 | && gtags -i $(GTAGS_ARGS) $$here
379 |
380 | distclean-tags:
381 | -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
382 |
383 | distdir: $(DISTFILES)
384 | $(am__remove_distdir)
385 | mkdir $(distdir)
386 | @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
387 | topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
388 | list='$(DISTFILES)'; for file in $$list; do \
389 | case $$file in \
390 | $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
391 | $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
392 | esac; \
393 | if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
394 | dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
395 | if test "$$dir" != "$$file" && test "$$dir" != "."; then \
396 | dir="/$$dir"; \
397 | $(mkdir_p) "$(distdir)$$dir"; \
398 | else \
399 | dir=''; \
400 | fi; \
401 | if test -d $$d/$$file; then \
402 | if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
403 | cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
404 | fi; \
405 | cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
406 | else \
407 | test -f $(distdir)/$$file \
408 | || cp -p $$d/$$file $(distdir)/$$file \
409 | || exit 1; \
410 | fi; \
411 | done
412 | -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
413 | ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
414 | ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
415 | ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
416 | || chmod -R a+r $(distdir)
417 | dist-gzip: distdir
418 | tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
419 | $(am__remove_distdir)
420 |
421 | dist-bzip2: distdir
422 | tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
423 | $(am__remove_distdir)
424 |
425 | dist-tarZ: distdir
426 | tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
427 | $(am__remove_distdir)
428 |
429 | dist-shar: distdir
430 | shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
431 | $(am__remove_distdir)
432 |
433 | dist-zip: distdir
434 | -rm -f $(distdir).zip
435 | zip -rq $(distdir).zip $(distdir)
436 | $(am__remove_distdir)
437 |
438 | dist dist-all: distdir
439 | tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
440 | $(am__remove_distdir)
441 |
442 | # This target untars the dist file and tries a VPATH configuration. Then
443 | # it guarantees that the distribution is self-contained by making another
444 | # tarfile.
445 | distcheck: dist
446 | case '$(DIST_ARCHIVES)' in \
447 | *.tar.gz*) \
448 | GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
449 | *.tar.bz2*) \
450 | bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
451 | *.tar.Z*) \
452 | uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
453 | *.shar.gz*) \
454 | GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
455 | *.zip*) \
456 | unzip $(distdir).zip ;;\
457 | esac
458 | chmod -R a-w $(distdir); chmod a+w $(distdir)
459 | mkdir $(distdir)/_build
460 | mkdir $(distdir)/_inst
461 | chmod a-w $(distdir)
462 | dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
463 | && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
464 | && cd $(distdir)/_build \
465 | && ../configure --srcdir=.. --prefix="$$dc_install_base" \
466 | $(DISTCHECK_CONFIGURE_FLAGS) \
467 | && $(MAKE) $(AM_MAKEFLAGS) \
468 | && $(MAKE) $(AM_MAKEFLAGS) dvi \
469 | && $(MAKE) $(AM_MAKEFLAGS) check \
470 | && $(MAKE) $(AM_MAKEFLAGS) install \
471 | && $(MAKE) $(AM_MAKEFLAGS) installcheck \
472 | && $(MAKE) $(AM_MAKEFLAGS) uninstall \
473 | && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
474 | distuninstallcheck \
475 | && chmod -R a-w "$$dc_install_base" \
476 | && ({ \
477 | (cd ../.. && umask 077 && mkdir "$$dc_destdir") \
478 | && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
479 | && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
480 | && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
481 | distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
482 | } || { rm -rf "$$dc_destdir"; exit 1; }) \
483 | && rm -rf "$$dc_destdir" \
484 | && $(MAKE) $(AM_MAKEFLAGS) dist \
485 | && rm -rf $(DIST_ARCHIVES) \
486 | && $(MAKE) $(AM_MAKEFLAGS) distcleancheck
487 | $(am__remove_distdir)
488 | @(echo "$(distdir) archives ready for distribution: "; \
489 | list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
490 | sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}'
491 | distuninstallcheck:
492 | @cd $(distuninstallcheck_dir) \
493 | && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
494 | || { echo "ERROR: files left after uninstall:" ; \
495 | if test -n "$(DESTDIR)"; then \
496 | echo " (check DESTDIR support)"; \
497 | fi ; \
498 | $(distuninstallcheck_listfiles) ; \
499 | exit 1; } >&2
500 | distcleancheck: distclean
501 | @if test '$(srcdir)' = . ; then \
502 | echo "ERROR: distcleancheck can only run from a VPATH build" ; \
503 | exit 1 ; \
504 | fi
505 | @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
506 | || { echo "ERROR: files left in build directory after distclean:" ; \
507 | $(distcleancheck_listfiles) ; \
508 | exit 1; } >&2
509 | check-am: all-am
510 | check: check-am
511 | all-am: Makefile $(LTLIBRARIES) $(HEADERS) config.h
512 | installdirs:
513 | for dir in "$(DESTDIR)$(libdir)"; do \
514 | test -z "$$dir" || $(mkdir_p) "$$dir"; \
515 | done
516 | install: install-am
517 | install-exec: install-exec-am
518 | install-data: install-data-am
519 | uninstall: uninstall-am
520 |
521 | install-am: all-am
522 | @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
523 |
524 | installcheck: installcheck-am
525 | install-strip:
526 | $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
527 | install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
528 | `test -z '$(STRIP)' || \
529 | echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
530 | mostlyclean-generic:
531 |
532 | clean-generic:
533 |
534 | distclean-generic:
535 | -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
536 |
537 | maintainer-clean-generic:
538 | @echo "This command is intended for maintainers to use"
539 | @echo "it deletes files that may require special tools to rebuild."
540 | clean: clean-am
541 |
542 | clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
543 | mostlyclean-am
544 |
545 | distclean: distclean-am
546 | -rm -f $(am__CONFIG_DISTCLEAN_FILES)
547 | -rm -rf ./$(DEPDIR)
548 | -rm -f Makefile
549 | distclean-am: clean-am distclean-compile distclean-generic \
550 | distclean-hdr distclean-libtool distclean-tags
551 |
552 | dvi: dvi-am
553 |
554 | dvi-am:
555 |
556 | info: info-am
557 |
558 | info-am:
559 |
560 | install-data-am:
561 |
562 | install-exec-am: install-libLTLIBRARIES
563 |
564 | install-info: install-info-am
565 |
566 | install-man:
567 |
568 | installcheck-am:
569 |
570 | maintainer-clean: maintainer-clean-am
571 | -rm -f $(am__CONFIG_DISTCLEAN_FILES)
572 | -rm -rf $(top_srcdir)/autom4te.cache
573 | -rm -rf ./$(DEPDIR)
574 | -rm -f Makefile
575 | maintainer-clean-am: distclean-am maintainer-clean-generic
576 |
577 | mostlyclean: mostlyclean-am
578 |
579 | mostlyclean-am: mostlyclean-compile mostlyclean-generic \
580 | mostlyclean-libtool
581 |
582 | pdf-am:
583 |
584 | ps: ps-am
585 |
586 | ps-am:
587 |
588 | uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES
589 |
590 | .PHONY: CTAGS GTAGS all all-am am--refresh check check-am clean \
591 | clean-generic clean-libLTLIBRARIES clean-libtool ctags dist \
592 | dist-all dist-bzip2 dist-gzip dist-shar dist-tarZ dist-zip \
593 | distcheck distclean distclean-compile distclean-generic \
594 | distclean-hdr distclean-libtool distclean-tags distcleancheck \
595 | distdir distuninstallcheck dvi dvi-am html html-am info \
596 | info-am install install-am install-data install-data-am \
597 | install-exec install-exec-am install-info install-info-am \
598 | install-libLTLIBRARIES install-man install-strip installcheck \
599 | installcheck-am installdirs maintainer-clean \
600 | maintainer-clean-generic mostlyclean mostlyclean-compile \
601 | mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
602 | tags uninstall uninstall-am uninstall-info-am \
603 | uninstall-libLTLIBRARIES
604 |
605 |
606 | test: all
607 | cd tests; ./test.sh
608 |
609 | pdf: manual.pdf
610 |
611 | manual.pdf: manual.xml
612 | docbook2pdf manual.xml
613 |
614 | html: manual.html
615 |
616 | manual.html: manual.xml
617 | docbook2html -u manual.xml
618 | # Tell versions [3.59,3.63) of GNU make to not export all variables.
619 | # Otherwise a system limit (for SysV at least) may be exceeded.
620 | .NOEXPORT:
621 |
--------------------------------------------------------------------------------
/regexp/NEWS:
--------------------------------------------------------------------------------
1 | This is a source project generated by CodeGen_MySQL_UDF_Extension 0.9.8
2 | ...
3 |
--------------------------------------------------------------------------------
/regexp/README:
--------------------------------------------------------------------------------
1 | UDF-regexp 1.0
2 | ==============
3 |
4 | MySQL functions emulating a subset of the Oracle REGEXP functions
5 |
6 | The functions provided by this package provide a subset of the functionality
7 | provided by the Oracle regular expression functions.
8 |
9 |
10 | See the INSTALL file for installation instruction
11 |
12 | --
13 | This UDF extension was created using CodeGen_Mysql_UDF 0.9.8
14 |
15 | http://codegenerators.php-baustelle.de/trac/wiki/CodeGen_MySQL_UDF\N
--------------------------------------------------------------------------------
/regexp/acinclude.m4:
--------------------------------------------------------------------------------
1 | m4_include([mysql.m4])
2 |
--------------------------------------------------------------------------------
/regexp/ax_compare_version.m4:
--------------------------------------------------------------------------------
1 | dnl (from http://autoconf-archive.cryp.to/ax_compare_version.m4 )
2 | dnl
3 | dnl @synopsis AX_COMPARE_VERSION(VERSION_A, OP, VERSION_B, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
4 | dnl
5 | dnl This macro compares two version strings. It is used heavily in the
6 | dnl macro _AX_PATH_BDB for library checking. Due to the various number
7 | dnl of minor-version numbers that can exist, and the fact that string
8 | dnl comparisons are not compatible with numeric comparisons, this is
9 | dnl not necessarily trivial to do in a autoconf script. This macro
10 | dnl makes doing these comparisons easy.
11 | dnl
12 | dnl The six basic comparisons are available, as well as checking
13 | dnl equality limited to a certain number of minor-version levels.
14 | dnl
15 | dnl The operator OP determines what type of comparison to do, and can
16 | dnl be one of:
17 | dnl
18 | dnl eq - equal (test A == B)
19 | dnl ne - not equal (test A != B)
20 | dnl le - less than or equal (test A <= B)
21 | dnl ge - greater than or equal (test A >= B)
22 | dnl lt - less than (test A < B)
23 | dnl gt - greater than (test A > B)
24 | dnl
25 | dnl Additionally, the eq and ne operator can have a number after it to
26 | dnl limit the test to that number of minor versions.
27 | dnl
28 | dnl eq0 - equal up to the length of the shorter version
29 | dnl ne0 - not equal up to the length of the shorter version
30 | dnl eqN - equal up to N sub-version levels
31 | dnl neN - not equal up to N sub-version levels
32 | dnl
33 | dnl When the condition is true, shell commands ACTION-IF-TRUE are run,
34 | dnl otherwise shell commands ACTION-IF-FALSE are run. The environment
35 | dnl variable 'ax_compare_version' is always set to either 'true' or
36 | dnl 'false' as well.
37 | dnl
38 | dnl Examples:
39 | dnl
40 | dnl AX_COMPARE_VERSION([3.15.7],[lt],[3.15.8])
41 | dnl AX_COMPARE_VERSION([3.15],[lt],[3.15.8])
42 | dnl
43 | dnl would both be true.
44 | dnl
45 | dnl AX_COMPARE_VERSION([3.15.7],[eq],[3.15.8])
46 | dnl AX_COMPARE_VERSION([3.15],[gt],[3.15.8])
47 | dnl
48 | dnl would both be false.
49 | dnl
50 | dnl AX_COMPARE_VERSION([3.15.7],[eq2],[3.15.8])
51 | dnl
52 | dnl would be true because it is only comparing two minor versions.
53 | dnl
54 | dnl AX_COMPARE_VERSION([3.15.7],[eq0],[3.15])
55 | dnl
56 | dnl would be true because it is only comparing the lesser number of
57 | dnl minor versions of the two values.
58 | dnl
59 | dnl Note: The characters that separate the version numbers do not
60 | dnl matter. An empty string is the same as version 0. OP is evaluated
61 | dnl by autoconf, not configure, so must be a string, not a variable.
62 | dnl
63 | dnl The author would like to acknowledge Guido Draheim whose advice
64 | dnl about the m4_case and m4_ifvaln functions make this macro only
65 | dnl include the portions necessary to perform the specific comparison
66 | dnl specified by the OP argument in the final configure script.
67 | dnl
68 | dnl @category Misc
69 | dnl @author Tim Toolan
70 | dnl @version 2004-03-01
71 | dnl @license GPLWithACException
72 |
73 | dnl #########################################################################
74 | AC_DEFUN([AX_COMPARE_VERSION], [
75 | # Used to indicate true or false condition
76 | ax_compare_version=false
77 |
78 | # Convert the two version strings to be compared into a format that
79 | # allows a simple string comparison. The end result is that a version
80 | # string of the form 1.12.5-r617 will be converted to the form
81 | # 0001001200050617. In other words, each number is zero padded to four
82 | # digits, and non digits are removed.
83 | AS_VAR_PUSHDEF([A],[ax_compare_version_A])
84 | A=`echo "$1" | sed -e 's/\([[0-9]]*\)/Z\1Z/g' \
85 | -e 's/Z\([[0-9]]\)Z/Z0\1Z/g' \
86 | -e 's/Z\([[0-9]][[0-9]]\)Z/Z0\1Z/g' \
87 | -e 's/Z\([[0-9]][[0-9]][[0-9]]\)Z/Z0\1Z/g' \
88 | -e 's/[[^0-9]]//g'`
89 |
90 | AS_VAR_PUSHDEF([B],[ax_compare_version_B])
91 | B=`echo "$3" | sed -e 's/\([[0-9]]*\)/Z\1Z/g' \
92 | -e 's/Z\([[0-9]]\)Z/Z0\1Z/g' \
93 | -e 's/Z\([[0-9]][[0-9]]\)Z/Z0\1Z/g' \
94 | -e 's/Z\([[0-9]][[0-9]][[0-9]]\)Z/Z0\1Z/g' \
95 | -e 's/[[^0-9]]//g'`
96 |
97 | dnl # In the case of le, ge, lt, and gt, the strings are sorted as necessary
98 | dnl # then the first line is used to determine if the condition is true.
99 | dnl # The sed right after the echo is to remove any indented white space.
100 | m4_case(m4_tolower($2),
101 | [lt],[
102 | ax_compare_version=`echo "x$A
103 | x$B" | sed 's/^ *//' | sort -r | sed "s/x${A}/false/;s/x${B}/true/;1q"`
104 | ],
105 | [gt],[
106 | ax_compare_version=`echo "x$A
107 | x$B" | sed 's/^ *//' | sort | sed "s/x${A}/false/;s/x${B}/true/;1q"`
108 | ],
109 | [le],[
110 | ax_compare_version=`echo "x$A
111 | x$B" | sed 's/^ *//' | sort | sed "s/x${A}/true/;s/x${B}/false/;1q"`
112 | ],
113 | [ge],[
114 | ax_compare_version=`echo "x$A
115 | x$B" | sed 's/^ *//' | sort -r | sed "s/x${A}/true/;s/x${B}/false/;1q"`
116 | ],[
117 | dnl Split the operator from the subversion count if present.
118 | m4_bmatch(m4_substr($2,2),
119 | [0],[
120 | # A count of zero means use the length of the shorter version.
121 | # Determine the number of characters in A and B.
122 | ax_compare_version_len_A=`echo "$A" | awk '{print(length)}'`
123 | ax_compare_version_len_B=`echo "$B" | awk '{print(length)}'`
124 |
125 | # Set A to no more than B's length and B to no more than A's length.
126 | A=`echo "$A" | sed "s/\(.\{$ax_compare_version_len_B\}\).*/\1/"`
127 | B=`echo "$B" | sed "s/\(.\{$ax_compare_version_len_A\}\).*/\1/"`
128 | ],
129 | [[0-9]+],[
130 | # A count greater than zero means use only that many subversions
131 | A=`echo "$A" | sed "s/\(\([[0-9]]\{4\}\)\{m4_substr($2,2)\}\).*/\1/"`
132 | B=`echo "$B" | sed "s/\(\([[0-9]]\{4\}\)\{m4_substr($2,2)\}\).*/\1/"`
133 | ],
134 | [.+],[
135 | AC_WARNING(
136 | [illegal OP numeric parameter: $2])
137 | ],[])
138 |
139 | # Pad zeros at end of numbers to make same length.
140 | ax_compare_version_tmp_A="$A`echo $B | sed 's/./0/g'`"
141 | B="$B`echo $A | sed 's/./0/g'`"
142 | A="$ax_compare_version_tmp_A"
143 |
144 | # Check for equality or inequality as necessary.
145 | m4_case(m4_tolower(m4_substr($2,0,2)),
146 | [eq],[
147 | test "x$A" = "x$B" && ax_compare_version=true
148 | ],
149 | [ne],[
150 | test "x$A" != "x$B" && ax_compare_version=true
151 | ],[
152 | AC_WARNING([illegal OP parameter: $2])
153 | ])
154 | ])
155 |
156 | AS_VAR_POPDEF([A])dnl
157 | AS_VAR_POPDEF([B])dnl
158 |
159 | dnl # Execute ACTION-IF-TRUE / ACTION-IF-FALSE.
160 | if test "$ax_compare_version" = "true" ; then
161 | m4_ifvaln([$4],[$4],[:])dnl
162 | m4_ifvaln([$5],[else $5])dnl
163 | fi
164 | ]) dnl AX_COMPARE_VERSION
165 |
--------------------------------------------------------------------------------
/regexp/compile:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 | # Wrapper for compilers which do not understand `-c -o'.
3 |
4 | scriptversion=2005-05-14.22
5 |
6 | # Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
7 | # Written by Tom Tromey .
8 | #
9 | # This program is free software; you can redistribute it and/or modify
10 | # it under the terms of the GNU General Public License as published by
11 | # the Free Software Foundation; either version 2, or (at your option)
12 | # any later version.
13 | #
14 | # This program is distributed in the hope that it will be useful,
15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | # GNU General Public License for more details.
18 | #
19 | # You should have received a copy of the GNU General Public License
20 | # along with this program; if not, write to the Free Software
21 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 |
23 | # As a special exception to the GNU General Public License, if you
24 | # distribute this file as part of a program that contains a
25 | # configuration script generated by Autoconf, you may include it under
26 | # the same distribution terms that you use for the rest of that program.
27 |
28 | # This file is maintained in Automake, please report
29 | # bugs to or send patches to
30 | # .
31 |
32 | case $1 in
33 | '')
34 | echo "$0: No command. Try \`$0 --help' for more information." 1>&2
35 | exit 1;
36 | ;;
37 | -h | --h*)
38 | cat <<\EOF
39 | Usage: compile [--help] [--version] PROGRAM [ARGS]
40 |
41 | Wrapper for compilers which do not understand `-c -o'.
42 | Remove `-o dest.o' from ARGS, run PROGRAM with the remaining
43 | arguments, and rename the output as expected.
44 |
45 | If you are trying to build a whole package this is not the
46 | right script to run: please start by reading the file `INSTALL'.
47 |
48 | Report bugs to .
49 | EOF
50 | exit $?
51 | ;;
52 | -v | --v*)
53 | echo "compile $scriptversion"
54 | exit $?
55 | ;;
56 | esac
57 |
58 | ofile=
59 | cfile=
60 | eat=
61 |
62 | for arg
63 | do
64 | if test -n "$eat"; then
65 | eat=
66 | else
67 | case $1 in
68 | -o)
69 | # configure might choose to run compile as `compile cc -o foo foo.c'.
70 | # So we strip `-o arg' only if arg is an object.
71 | eat=1
72 | case $2 in
73 | *.o | *.obj)
74 | ofile=$2
75 | ;;
76 | *)
77 | set x "$@" -o "$2"
78 | shift
79 | ;;
80 | esac
81 | ;;
82 | *.c)
83 | cfile=$1
84 | set x "$@" "$1"
85 | shift
86 | ;;
87 | *)
88 | set x "$@" "$1"
89 | shift
90 | ;;
91 | esac
92 | fi
93 | shift
94 | done
95 |
96 | if test -z "$ofile" || test -z "$cfile"; then
97 | # If no `-o' option was seen then we might have been invoked from a
98 | # pattern rule where we don't need one. That is ok -- this is a
99 | # normal compilation that the losing compiler can handle. If no
100 | # `.c' file was seen then we are probably linking. That is also
101 | # ok.
102 | exec "$@"
103 | fi
104 |
105 | # Name of file we expect compiler to create.
106 | cofile=`echo "$cfile" | sed -e 's|^.*/||' -e 's/\.c$/.o/'`
107 |
108 | # Create the lock directory.
109 | # Note: use `[/.-]' here to ensure that we don't use the same name
110 | # that we are using for the .o file. Also, base the name on the expected
111 | # object file name, since that is what matters with a parallel build.
112 | lockdir=`echo "$cofile" | sed -e 's|[/.-]|_|g'`.d
113 | while true; do
114 | if mkdir "$lockdir" >/dev/null 2>&1; then
115 | break
116 | fi
117 | sleep 1
118 | done
119 | # FIXME: race condition here if user kills between mkdir and trap.
120 | trap "rmdir '$lockdir'; exit 1" 1 2 15
121 |
122 | # Run the compile.
123 | "$@"
124 | ret=$?
125 |
126 | if test -f "$cofile"; then
127 | mv "$cofile" "$ofile"
128 | elif test -f "${cofile}bj"; then
129 | mv "${cofile}bj" "$ofile"
130 | fi
131 |
132 | rmdir "$lockdir"
133 | exit $ret
134 |
135 | # Local Variables:
136 | # mode: shell-script
137 | # sh-indentation: 2
138 | # eval: (add-hook 'write-file-hooks 'time-stamp)
139 | # time-stamp-start: "scriptversion="
140 | # time-stamp-format: "%:y-%02m-%02d.%02H"
141 | # time-stamp-end: "$"
142 | # End:
143 |
--------------------------------------------------------------------------------
/regexp/config.h.in:
--------------------------------------------------------------------------------
1 | /* config.h.in. Generated from configure.in by autoheader. */
2 |
3 | /* Don't use libdbug */
4 | #undef DBUG_OFF
5 |
6 | /* Use libdbug */
7 | #undef DBUG_ON
8 |
9 | /* Define to 1 if you have the header file. */
10 | #undef HAVE_DLFCN_H
11 |
12 | /* Define to 1 if you have the header file. */
13 | #undef HAVE_INTTYPES_H
14 |
15 | /* Define to 1 if you have the header file. */
16 | #undef HAVE_MEMORY_H
17 |
18 | /* Define to 1 if you have the header file. */
19 | #undef HAVE_STDINT_H
20 |
21 | /* Define to 1 if you have the header file. */
22 | #undef HAVE_STDLIB_H
23 |
24 | /* Define to 1 if you have the header file. */
25 | #undef HAVE_STRINGS_H
26 |
27 | /* Define to 1 if you have the header file. */
28 | #undef HAVE_STRING_H
29 |
30 | /* Define to 1 if you have the header file. */
31 | #undef HAVE_SYS_STAT_H
32 |
33 | /* Define to 1 if you have the header file. */
34 | #undef HAVE_SYS_TYPES_H
35 |
36 | /* Define to 1 if you have the header file. */
37 | #undef HAVE_UNISTD_H
38 |
39 | /* Name of package */
40 | #undef PACKAGE
41 |
42 | /* Define to the address where bug reports for this package should be sent. */
43 | #undef PACKAGE_BUGREPORT
44 |
45 | /* Define to the full name of this package. */
46 | #undef PACKAGE_NAME
47 |
48 | /* Define to the full name and version of this package. */
49 | #undef PACKAGE_STRING
50 |
51 | /* Define to the one symbol short name of this package. */
52 | #undef PACKAGE_TARNAME
53 |
54 | /* Define to the version of this package. */
55 | #undef PACKAGE_VERSION
56 |
57 | /* Define to 1 if you have the ANSI C header files. */
58 | #undef STDC_HEADERS
59 |
60 | /* Version number of package */
61 | #undef VERSION
62 |
--------------------------------------------------------------------------------
/regexp/config.sub:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 | # Configuration validation subroutine script.
3 | # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
4 | # 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
5 |
6 | timestamp='2005-07-08'
7 |
8 | # This file is (in principle) common to ALL GNU software.
9 | # The presence of a machine in this file suggests that SOME GNU software
10 | # can handle that machine. It does not imply ALL GNU software can.
11 | #
12 | # This file is free software; you can redistribute it and/or modify
13 | # it under the terms of the GNU General Public License as published by
14 | # the Free Software Foundation; either version 2 of the License, or
15 | # (at your option) any later version.
16 | #
17 | # This program is distributed in the hope that it will be useful,
18 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
19 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 | # GNU General Public License for more details.
21 | #
22 | # You should have received a copy of the GNU General Public License
23 | # along with this program; if not, write to the Free Software
24 | # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
25 | # 02110-1301, USA.
26 | #
27 | # As a special exception to the GNU General Public License, if you
28 | # distribute this file as part of a program that contains a
29 | # configuration script generated by Autoconf, you may include it under
30 | # the same distribution terms that you use for the rest of that program.
31 |
32 |
33 | # Please send patches to . Submit a context
34 | # diff and a properly formatted ChangeLog entry.
35 | #
36 | # Configuration subroutine to validate and canonicalize a configuration type.
37 | # Supply the specified configuration type as an argument.
38 | # If it is invalid, we print an error message on stderr and exit with code 1.
39 | # Otherwise, we print the canonical config type on stdout and succeed.
40 |
41 | # This file is supposed to be the same for all GNU packages
42 | # and recognize all the CPU types, system types and aliases
43 | # that are meaningful with *any* GNU software.
44 | # Each package is responsible for reporting which valid configurations
45 | # it does not support. The user should be able to distinguish
46 | # a failure to support a valid configuration from a meaningless
47 | # configuration.
48 |
49 | # The goal of this file is to map all the various variations of a given
50 | # machine specification into a single specification in the form:
51 | # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
52 | # or in some cases, the newer four-part form:
53 | # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
54 | # It is wrong to echo any other type of specification.
55 |
56 | me=`echo "$0" | sed -e 's,.*/,,'`
57 |
58 | usage="\
59 | Usage: $0 [OPTION] CPU-MFR-OPSYS
60 | $0 [OPTION] ALIAS
61 |
62 | Canonicalize a configuration name.
63 |
64 | Operation modes:
65 | -h, --help print this help, then exit
66 | -t, --time-stamp print date of last modification, then exit
67 | -v, --version print version number, then exit
68 |
69 | Report bugs and patches to ."
70 |
71 | version="\
72 | GNU config.sub ($timestamp)
73 |
74 | Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
75 | Free Software Foundation, Inc.
76 |
77 | This is free software; see the source for copying conditions. There is NO
78 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
79 |
80 | help="
81 | Try \`$me --help' for more information."
82 |
83 | # Parse command line
84 | while test $# -gt 0 ; do
85 | case $1 in
86 | --time-stamp | --time* | -t )
87 | echo "$timestamp" ; exit ;;
88 | --version | -v )
89 | echo "$version" ; exit ;;
90 | --help | --h* | -h )
91 | echo "$usage"; exit ;;
92 | -- ) # Stop option processing
93 | shift; break ;;
94 | - ) # Use stdin as input.
95 | break ;;
96 | -* )
97 | echo "$me: invalid option $1$help"
98 | exit 1 ;;
99 |
100 | *local*)
101 | # First pass through any local machine types.
102 | echo $1
103 | exit ;;
104 |
105 | * )
106 | break ;;
107 | esac
108 | done
109 |
110 | case $# in
111 | 0) echo "$me: missing argument$help" >&2
112 | exit 1;;
113 | 1) ;;
114 | *) echo "$me: too many arguments$help" >&2
115 | exit 1;;
116 | esac
117 |
118 | # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
119 | # Here we must recognize all the valid KERNEL-OS combinations.
120 | maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
121 | case $maybe_os in
122 | nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \
123 | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
124 | os=-$maybe_os
125 | basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
126 | ;;
127 | *)
128 | basic_machine=`echo $1 | sed 's/-[^-]*$//'`
129 | if [ $basic_machine != $1 ]
130 | then os=`echo $1 | sed 's/.*-/-/'`
131 | else os=; fi
132 | ;;
133 | esac
134 |
135 | ### Let's recognize common machines as not being operating systems so
136 | ### that things like config.sub decstation-3100 work. We also
137 | ### recognize some manufacturers as not being operating systems, so we
138 | ### can provide default operating systems below.
139 | case $os in
140 | -sun*os*)
141 | # Prevent following clause from handling this invalid input.
142 | ;;
143 | -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
144 | -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
145 | -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
146 | -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
147 | -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
148 | -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
149 | -apple | -axis | -knuth | -cray)
150 | os=
151 | basic_machine=$1
152 | ;;
153 | -sim | -cisco | -oki | -wec | -winbond)
154 | os=
155 | basic_machine=$1
156 | ;;
157 | -scout)
158 | ;;
159 | -wrs)
160 | os=-vxworks
161 | basic_machine=$1
162 | ;;
163 | -chorusos*)
164 | os=-chorusos
165 | basic_machine=$1
166 | ;;
167 | -chorusrdb)
168 | os=-chorusrdb
169 | basic_machine=$1
170 | ;;
171 | -hiux*)
172 | os=-hiuxwe2
173 | ;;
174 | -sco5)
175 | os=-sco3.2v5
176 | basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
177 | ;;
178 | -sco4)
179 | os=-sco3.2v4
180 | basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
181 | ;;
182 | -sco3.2.[4-9]*)
183 | os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
184 | basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
185 | ;;
186 | -sco3.2v[4-9]*)
187 | # Don't forget version if it is 3.2v4 or newer.
188 | basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
189 | ;;
190 | -sco*)
191 | os=-sco3.2v2
192 | basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
193 | ;;
194 | -udk*)
195 | basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
196 | ;;
197 | -isc)
198 | os=-isc2.2
199 | basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
200 | ;;
201 | -clix*)
202 | basic_machine=clipper-intergraph
203 | ;;
204 | -isc*)
205 | basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
206 | ;;
207 | -lynx*)
208 | os=-lynxos
209 | ;;
210 | -ptx*)
211 | basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
212 | ;;
213 | -windowsnt*)
214 | os=`echo $os | sed -e 's/windowsnt/winnt/'`
215 | ;;
216 | -psos*)
217 | os=-psos
218 | ;;
219 | -mint | -mint[0-9]*)
220 | basic_machine=m68k-atari
221 | os=-mint
222 | ;;
223 | esac
224 |
225 | # Decode aliases for certain CPU-COMPANY combinations.
226 | case $basic_machine in
227 | # Recognize the basic CPU types without company name.
228 | # Some are omitted here because they have special meanings below.
229 | 1750a | 580 \
230 | | a29k \
231 | | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
232 | | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
233 | | am33_2.0 \
234 | | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
235 | | bfin \
236 | | c4x | clipper \
237 | | d10v | d30v | dlx | dsp16xx \
238 | | fr30 | frv \
239 | | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
240 | | i370 | i860 | i960 | ia64 \
241 | | ip2k | iq2000 \
242 | | m32r | m32rle | m68000 | m68k | m88k | maxq | mcore \
243 | | mips | mipsbe | mipseb | mipsel | mipsle \
244 | | mips16 \
245 | | mips64 | mips64el \
246 | | mips64vr | mips64vrel \
247 | | mips64orion | mips64orionel \
248 | | mips64vr4100 | mips64vr4100el \
249 | | mips64vr4300 | mips64vr4300el \
250 | | mips64vr5000 | mips64vr5000el \
251 | | mips64vr5900 | mips64vr5900el \
252 | | mipsisa32 | mipsisa32el \
253 | | mipsisa32r2 | mipsisa32r2el \
254 | | mipsisa64 | mipsisa64el \
255 | | mipsisa64r2 | mipsisa64r2el \
256 | | mipsisa64sb1 | mipsisa64sb1el \
257 | | mipsisa64sr71k | mipsisa64sr71kel \
258 | | mipstx39 | mipstx39el \
259 | | mn10200 | mn10300 \
260 | | ms1 \
261 | | msp430 \
262 | | ns16k | ns32k \
263 | | or32 \
264 | | pdp10 | pdp11 | pj | pjl \
265 | | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
266 | | pyramid \
267 | | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
268 | | sh64 | sh64le \
269 | | sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \
270 | | sparcv8 | sparcv9 | sparcv9b \
271 | | strongarm \
272 | | tahoe | thumb | tic4x | tic80 | tron \
273 | | v850 | v850e \
274 | | we32k \
275 | | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \
276 | | z8k)
277 | basic_machine=$basic_machine-unknown
278 | ;;
279 | m32c)
280 | basic_machine=$basic_machine-unknown
281 | ;;
282 | m6811 | m68hc11 | m6812 | m68hc12)
283 | # Motorola 68HC11/12.
284 | basic_machine=$basic_machine-unknown
285 | os=-none
286 | ;;
287 | m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
288 | ;;
289 |
290 | # We use `pc' rather than `unknown'
291 | # because (1) that's what they normally are, and
292 | # (2) the word "unknown" tends to confuse beginning users.
293 | i*86 | x86_64)
294 | basic_machine=$basic_machine-pc
295 | ;;
296 | # Object if more than one company name word.
297 | *-*-*)
298 | echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
299 | exit 1
300 | ;;
301 | # Recognize the basic CPU types with company name.
302 | 580-* \
303 | | a29k-* \
304 | | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
305 | | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
306 | | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
307 | | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
308 | | avr-* \
309 | | bfin-* | bs2000-* \
310 | | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
311 | | clipper-* | craynv-* | cydra-* \
312 | | d10v-* | d30v-* | dlx-* \
313 | | elxsi-* \
314 | | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
315 | | h8300-* | h8500-* \
316 | | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
317 | | i*86-* | i860-* | i960-* | ia64-* \
318 | | ip2k-* | iq2000-* \
319 | | m32r-* | m32rle-* \
320 | | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
321 | | m88110-* | m88k-* | maxq-* | mcore-* \
322 | | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
323 | | mips16-* \
324 | | mips64-* | mips64el-* \
325 | | mips64vr-* | mips64vrel-* \
326 | | mips64orion-* | mips64orionel-* \
327 | | mips64vr4100-* | mips64vr4100el-* \
328 | | mips64vr4300-* | mips64vr4300el-* \
329 | | mips64vr5000-* | mips64vr5000el-* \
330 | | mips64vr5900-* | mips64vr5900el-* \
331 | | mipsisa32-* | mipsisa32el-* \
332 | | mipsisa32r2-* | mipsisa32r2el-* \
333 | | mipsisa64-* | mipsisa64el-* \
334 | | mipsisa64r2-* | mipsisa64r2el-* \
335 | | mipsisa64sb1-* | mipsisa64sb1el-* \
336 | | mipsisa64sr71k-* | mipsisa64sr71kel-* \
337 | | mipstx39-* | mipstx39el-* \
338 | | mmix-* \
339 | | ms1-* \
340 | | msp430-* \
341 | | none-* | np1-* | ns16k-* | ns32k-* \
342 | | orion-* \
343 | | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
344 | | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
345 | | pyramid-* \
346 | | romp-* | rs6000-* \
347 | | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | shbe-* \
348 | | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
349 | | sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \
350 | | sparclite-* \
351 | | sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
352 | | tahoe-* | thumb-* \
353 | | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
354 | | tron-* \
355 | | v850-* | v850e-* | vax-* \
356 | | we32k-* \
357 | | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \
358 | | xstormy16-* | xtensa-* \
359 | | ymp-* \
360 | | z8k-*)
361 | ;;
362 | m32c-*)
363 | ;;
364 | # Recognize the various machine names and aliases which stand
365 | # for a CPU type and a company and sometimes even an OS.
366 | 386bsd)
367 | basic_machine=i386-unknown
368 | os=-bsd
369 | ;;
370 | 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
371 | basic_machine=m68000-att
372 | ;;
373 | 3b*)
374 | basic_machine=we32k-att
375 | ;;
376 | a29khif)
377 | basic_machine=a29k-amd
378 | os=-udi
379 | ;;
380 | abacus)
381 | basic_machine=abacus-unknown
382 | ;;
383 | adobe68k)
384 | basic_machine=m68010-adobe
385 | os=-scout
386 | ;;
387 | alliant | fx80)
388 | basic_machine=fx80-alliant
389 | ;;
390 | altos | altos3068)
391 | basic_machine=m68k-altos
392 | ;;
393 | am29k)
394 | basic_machine=a29k-none
395 | os=-bsd
396 | ;;
397 | amd64)
398 | basic_machine=x86_64-pc
399 | ;;
400 | amd64-*)
401 | basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
402 | ;;
403 | amdahl)
404 | basic_machine=580-amdahl
405 | os=-sysv
406 | ;;
407 | amiga | amiga-*)
408 | basic_machine=m68k-unknown
409 | ;;
410 | amigaos | amigados)
411 | basic_machine=m68k-unknown
412 | os=-amigaos
413 | ;;
414 | amigaunix | amix)
415 | basic_machine=m68k-unknown
416 | os=-sysv4
417 | ;;
418 | apollo68)
419 | basic_machine=m68k-apollo
420 | os=-sysv
421 | ;;
422 | apollo68bsd)
423 | basic_machine=m68k-apollo
424 | os=-bsd
425 | ;;
426 | aux)
427 | basic_machine=m68k-apple
428 | os=-aux
429 | ;;
430 | balance)
431 | basic_machine=ns32k-sequent
432 | os=-dynix
433 | ;;
434 | c90)
435 | basic_machine=c90-cray
436 | os=-unicos
437 | ;;
438 | convex-c1)
439 | basic_machine=c1-convex
440 | os=-bsd
441 | ;;
442 | convex-c2)
443 | basic_machine=c2-convex
444 | os=-bsd
445 | ;;
446 | convex-c32)
447 | basic_machine=c32-convex
448 | os=-bsd
449 | ;;
450 | convex-c34)
451 | basic_machine=c34-convex
452 | os=-bsd
453 | ;;
454 | convex-c38)
455 | basic_machine=c38-convex
456 | os=-bsd
457 | ;;
458 | cray | j90)
459 | basic_machine=j90-cray
460 | os=-unicos
461 | ;;
462 | craynv)
463 | basic_machine=craynv-cray
464 | os=-unicosmp
465 | ;;
466 | cr16c)
467 | basic_machine=cr16c-unknown
468 | os=-elf
469 | ;;
470 | crds | unos)
471 | basic_machine=m68k-crds
472 | ;;
473 | crisv32 | crisv32-* | etraxfs*)
474 | basic_machine=crisv32-axis
475 | ;;
476 | cris | cris-* | etrax*)
477 | basic_machine=cris-axis
478 | ;;
479 | crx)
480 | basic_machine=crx-unknown
481 | os=-elf
482 | ;;
483 | da30 | da30-*)
484 | basic_machine=m68k-da30
485 | ;;
486 | decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
487 | basic_machine=mips-dec
488 | ;;
489 | decsystem10* | dec10*)
490 | basic_machine=pdp10-dec
491 | os=-tops10
492 | ;;
493 | decsystem20* | dec20*)
494 | basic_machine=pdp10-dec
495 | os=-tops20
496 | ;;
497 | delta | 3300 | motorola-3300 | motorola-delta \
498 | | 3300-motorola | delta-motorola)
499 | basic_machine=m68k-motorola
500 | ;;
501 | delta88)
502 | basic_machine=m88k-motorola
503 | os=-sysv3
504 | ;;
505 | djgpp)
506 | basic_machine=i586-pc
507 | os=-msdosdjgpp
508 | ;;
509 | dpx20 | dpx20-*)
510 | basic_machine=rs6000-bull
511 | os=-bosx
512 | ;;
513 | dpx2* | dpx2*-bull)
514 | basic_machine=m68k-bull
515 | os=-sysv3
516 | ;;
517 | ebmon29k)
518 | basic_machine=a29k-amd
519 | os=-ebmon
520 | ;;
521 | elxsi)
522 | basic_machine=elxsi-elxsi
523 | os=-bsd
524 | ;;
525 | encore | umax | mmax)
526 | basic_machine=ns32k-encore
527 | ;;
528 | es1800 | OSE68k | ose68k | ose | OSE)
529 | basic_machine=m68k-ericsson
530 | os=-ose
531 | ;;
532 | fx2800)
533 | basic_machine=i860-alliant
534 | ;;
535 | genix)
536 | basic_machine=ns32k-ns
537 | ;;
538 | gmicro)
539 | basic_machine=tron-gmicro
540 | os=-sysv
541 | ;;
542 | go32)
543 | basic_machine=i386-pc
544 | os=-go32
545 | ;;
546 | h3050r* | hiux*)
547 | basic_machine=hppa1.1-hitachi
548 | os=-hiuxwe2
549 | ;;
550 | h8300hms)
551 | basic_machine=h8300-hitachi
552 | os=-hms
553 | ;;
554 | h8300xray)
555 | basic_machine=h8300-hitachi
556 | os=-xray
557 | ;;
558 | h8500hms)
559 | basic_machine=h8500-hitachi
560 | os=-hms
561 | ;;
562 | harris)
563 | basic_machine=m88k-harris
564 | os=-sysv3
565 | ;;
566 | hp300-*)
567 | basic_machine=m68k-hp
568 | ;;
569 | hp300bsd)
570 | basic_machine=m68k-hp
571 | os=-bsd
572 | ;;
573 | hp300hpux)
574 | basic_machine=m68k-hp
575 | os=-hpux
576 | ;;
577 | hp3k9[0-9][0-9] | hp9[0-9][0-9])
578 | basic_machine=hppa1.0-hp
579 | ;;
580 | hp9k2[0-9][0-9] | hp9k31[0-9])
581 | basic_machine=m68000-hp
582 | ;;
583 | hp9k3[2-9][0-9])
584 | basic_machine=m68k-hp
585 | ;;
586 | hp9k6[0-9][0-9] | hp6[0-9][0-9])
587 | basic_machine=hppa1.0-hp
588 | ;;
589 | hp9k7[0-79][0-9] | hp7[0-79][0-9])
590 | basic_machine=hppa1.1-hp
591 | ;;
592 | hp9k78[0-9] | hp78[0-9])
593 | # FIXME: really hppa2.0-hp
594 | basic_machine=hppa1.1-hp
595 | ;;
596 | hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
597 | # FIXME: really hppa2.0-hp
598 | basic_machine=hppa1.1-hp
599 | ;;
600 | hp9k8[0-9][13679] | hp8[0-9][13679])
601 | basic_machine=hppa1.1-hp
602 | ;;
603 | hp9k8[0-9][0-9] | hp8[0-9][0-9])
604 | basic_machine=hppa1.0-hp
605 | ;;
606 | hppa-next)
607 | os=-nextstep3
608 | ;;
609 | hppaosf)
610 | basic_machine=hppa1.1-hp
611 | os=-osf
612 | ;;
613 | hppro)
614 | basic_machine=hppa1.1-hp
615 | os=-proelf
616 | ;;
617 | i370-ibm* | ibm*)
618 | basic_machine=i370-ibm
619 | ;;
620 | # I'm not sure what "Sysv32" means. Should this be sysv3.2?
621 | i*86v32)
622 | basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
623 | os=-sysv32
624 | ;;
625 | i*86v4*)
626 | basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
627 | os=-sysv4
628 | ;;
629 | i*86v)
630 | basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
631 | os=-sysv
632 | ;;
633 | i*86sol2)
634 | basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
635 | os=-solaris2
636 | ;;
637 | i386mach)
638 | basic_machine=i386-mach
639 | os=-mach
640 | ;;
641 | i386-vsta | vsta)
642 | basic_machine=i386-unknown
643 | os=-vsta
644 | ;;
645 | iris | iris4d)
646 | basic_machine=mips-sgi
647 | case $os in
648 | -irix*)
649 | ;;
650 | *)
651 | os=-irix4
652 | ;;
653 | esac
654 | ;;
655 | isi68 | isi)
656 | basic_machine=m68k-isi
657 | os=-sysv
658 | ;;
659 | m88k-omron*)
660 | basic_machine=m88k-omron
661 | ;;
662 | magnum | m3230)
663 | basic_machine=mips-mips
664 | os=-sysv
665 | ;;
666 | merlin)
667 | basic_machine=ns32k-utek
668 | os=-sysv
669 | ;;
670 | mingw32)
671 | basic_machine=i386-pc
672 | os=-mingw32
673 | ;;
674 | miniframe)
675 | basic_machine=m68000-convergent
676 | ;;
677 | *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
678 | basic_machine=m68k-atari
679 | os=-mint
680 | ;;
681 | mips3*-*)
682 | basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
683 | ;;
684 | mips3*)
685 | basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
686 | ;;
687 | monitor)
688 | basic_machine=m68k-rom68k
689 | os=-coff
690 | ;;
691 | morphos)
692 | basic_machine=powerpc-unknown
693 | os=-morphos
694 | ;;
695 | msdos)
696 | basic_machine=i386-pc
697 | os=-msdos
698 | ;;
699 | mvs)
700 | basic_machine=i370-ibm
701 | os=-mvs
702 | ;;
703 | ncr3000)
704 | basic_machine=i486-ncr
705 | os=-sysv4
706 | ;;
707 | netbsd386)
708 | basic_machine=i386-unknown
709 | os=-netbsd
710 | ;;
711 | netwinder)
712 | basic_machine=armv4l-rebel
713 | os=-linux
714 | ;;
715 | news | news700 | news800 | news900)
716 | basic_machine=m68k-sony
717 | os=-newsos
718 | ;;
719 | news1000)
720 | basic_machine=m68030-sony
721 | os=-newsos
722 | ;;
723 | news-3600 | risc-news)
724 | basic_machine=mips-sony
725 | os=-newsos
726 | ;;
727 | necv70)
728 | basic_machine=v70-nec
729 | os=-sysv
730 | ;;
731 | next | m*-next )
732 | basic_machine=m68k-next
733 | case $os in
734 | -nextstep* )
735 | ;;
736 | -ns2*)
737 | os=-nextstep2
738 | ;;
739 | *)
740 | os=-nextstep3
741 | ;;
742 | esac
743 | ;;
744 | nh3000)
745 | basic_machine=m68k-harris
746 | os=-cxux
747 | ;;
748 | nh[45]000)
749 | basic_machine=m88k-harris
750 | os=-cxux
751 | ;;
752 | nindy960)
753 | basic_machine=i960-intel
754 | os=-nindy
755 | ;;
756 | mon960)
757 | basic_machine=i960-intel
758 | os=-mon960
759 | ;;
760 | nonstopux)
761 | basic_machine=mips-compaq
762 | os=-nonstopux
763 | ;;
764 | np1)
765 | basic_machine=np1-gould
766 | ;;
767 | nsr-tandem)
768 | basic_machine=nsr-tandem
769 | ;;
770 | op50n-* | op60c-*)
771 | basic_machine=hppa1.1-oki
772 | os=-proelf
773 | ;;
774 | openrisc | openrisc-*)
775 | basic_machine=or32-unknown
776 | ;;
777 | os400)
778 | basic_machine=powerpc-ibm
779 | os=-os400
780 | ;;
781 | OSE68000 | ose68000)
782 | basic_machine=m68000-ericsson
783 | os=-ose
784 | ;;
785 | os68k)
786 | basic_machine=m68k-none
787 | os=-os68k
788 | ;;
789 | pa-hitachi)
790 | basic_machine=hppa1.1-hitachi
791 | os=-hiuxwe2
792 | ;;
793 | paragon)
794 | basic_machine=i860-intel
795 | os=-osf
796 | ;;
797 | pbd)
798 | basic_machine=sparc-tti
799 | ;;
800 | pbb)
801 | basic_machine=m68k-tti
802 | ;;
803 | pc532 | pc532-*)
804 | basic_machine=ns32k-pc532
805 | ;;
806 | pentium | p5 | k5 | k6 | nexgen | viac3)
807 | basic_machine=i586-pc
808 | ;;
809 | pentiumpro | p6 | 6x86 | athlon | athlon_*)
810 | basic_machine=i686-pc
811 | ;;
812 | pentiumii | pentium2 | pentiumiii | pentium3)
813 | basic_machine=i686-pc
814 | ;;
815 | pentium4)
816 | basic_machine=i786-pc
817 | ;;
818 | pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
819 | basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
820 | ;;
821 | pentiumpro-* | p6-* | 6x86-* | athlon-*)
822 | basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
823 | ;;
824 | pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
825 | basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
826 | ;;
827 | pentium4-*)
828 | basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
829 | ;;
830 | pn)
831 | basic_machine=pn-gould
832 | ;;
833 | power) basic_machine=power-ibm
834 | ;;
835 | ppc) basic_machine=powerpc-unknown
836 | ;;
837 | ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
838 | ;;
839 | ppcle | powerpclittle | ppc-le | powerpc-little)
840 | basic_machine=powerpcle-unknown
841 | ;;
842 | ppcle-* | powerpclittle-*)
843 | basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
844 | ;;
845 | ppc64) basic_machine=powerpc64-unknown
846 | ;;
847 | ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
848 | ;;
849 | ppc64le | powerpc64little | ppc64-le | powerpc64-little)
850 | basic_machine=powerpc64le-unknown
851 | ;;
852 | ppc64le-* | powerpc64little-*)
853 | basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
854 | ;;
855 | ps2)
856 | basic_machine=i386-ibm
857 | ;;
858 | pw32)
859 | basic_machine=i586-unknown
860 | os=-pw32
861 | ;;
862 | rom68k)
863 | basic_machine=m68k-rom68k
864 | os=-coff
865 | ;;
866 | rm[46]00)
867 | basic_machine=mips-siemens
868 | ;;
869 | rtpc | rtpc-*)
870 | basic_machine=romp-ibm
871 | ;;
872 | s390 | s390-*)
873 | basic_machine=s390-ibm
874 | ;;
875 | s390x | s390x-*)
876 | basic_machine=s390x-ibm
877 | ;;
878 | sa29200)
879 | basic_machine=a29k-amd
880 | os=-udi
881 | ;;
882 | sb1)
883 | basic_machine=mipsisa64sb1-unknown
884 | ;;
885 | sb1el)
886 | basic_machine=mipsisa64sb1el-unknown
887 | ;;
888 | sei)
889 | basic_machine=mips-sei
890 | os=-seiux
891 | ;;
892 | sequent)
893 | basic_machine=i386-sequent
894 | ;;
895 | sh)
896 | basic_machine=sh-hitachi
897 | os=-hms
898 | ;;
899 | sh64)
900 | basic_machine=sh64-unknown
901 | ;;
902 | sparclite-wrs | simso-wrs)
903 | basic_machine=sparclite-wrs
904 | os=-vxworks
905 | ;;
906 | sps7)
907 | basic_machine=m68k-bull
908 | os=-sysv2
909 | ;;
910 | spur)
911 | basic_machine=spur-unknown
912 | ;;
913 | st2000)
914 | basic_machine=m68k-tandem
915 | ;;
916 | stratus)
917 | basic_machine=i860-stratus
918 | os=-sysv4
919 | ;;
920 | sun2)
921 | basic_machine=m68000-sun
922 | ;;
923 | sun2os3)
924 | basic_machine=m68000-sun
925 | os=-sunos3
926 | ;;
927 | sun2os4)
928 | basic_machine=m68000-sun
929 | os=-sunos4
930 | ;;
931 | sun3os3)
932 | basic_machine=m68k-sun
933 | os=-sunos3
934 | ;;
935 | sun3os4)
936 | basic_machine=m68k-sun
937 | os=-sunos4
938 | ;;
939 | sun4os3)
940 | basic_machine=sparc-sun
941 | os=-sunos3
942 | ;;
943 | sun4os4)
944 | basic_machine=sparc-sun
945 | os=-sunos4
946 | ;;
947 | sun4sol2)
948 | basic_machine=sparc-sun
949 | os=-solaris2
950 | ;;
951 | sun3 | sun3-*)
952 | basic_machine=m68k-sun
953 | ;;
954 | sun4)
955 | basic_machine=sparc-sun
956 | ;;
957 | sun386 | sun386i | roadrunner)
958 | basic_machine=i386-sun
959 | ;;
960 | sv1)
961 | basic_machine=sv1-cray
962 | os=-unicos
963 | ;;
964 | symmetry)
965 | basic_machine=i386-sequent
966 | os=-dynix
967 | ;;
968 | t3e)
969 | basic_machine=alphaev5-cray
970 | os=-unicos
971 | ;;
972 | t90)
973 | basic_machine=t90-cray
974 | os=-unicos
975 | ;;
976 | tic54x | c54x*)
977 | basic_machine=tic54x-unknown
978 | os=-coff
979 | ;;
980 | tic55x | c55x*)
981 | basic_machine=tic55x-unknown
982 | os=-coff
983 | ;;
984 | tic6x | c6x*)
985 | basic_machine=tic6x-unknown
986 | os=-coff
987 | ;;
988 | tx39)
989 | basic_machine=mipstx39-unknown
990 | ;;
991 | tx39el)
992 | basic_machine=mipstx39el-unknown
993 | ;;
994 | toad1)
995 | basic_machine=pdp10-xkl
996 | os=-tops20
997 | ;;
998 | tower | tower-32)
999 | basic_machine=m68k-ncr
1000 | ;;
1001 | tpf)
1002 | basic_machine=s390x-ibm
1003 | os=-tpf
1004 | ;;
1005 | udi29k)
1006 | basic_machine=a29k-amd
1007 | os=-udi
1008 | ;;
1009 | ultra3)
1010 | basic_machine=a29k-nyu
1011 | os=-sym1
1012 | ;;
1013 | v810 | necv810)
1014 | basic_machine=v810-nec
1015 | os=-none
1016 | ;;
1017 | vaxv)
1018 | basic_machine=vax-dec
1019 | os=-sysv
1020 | ;;
1021 | vms)
1022 | basic_machine=vax-dec
1023 | os=-vms
1024 | ;;
1025 | vpp*|vx|vx-*)
1026 | basic_machine=f301-fujitsu
1027 | ;;
1028 | vxworks960)
1029 | basic_machine=i960-wrs
1030 | os=-vxworks
1031 | ;;
1032 | vxworks68)
1033 | basic_machine=m68k-wrs
1034 | os=-vxworks
1035 | ;;
1036 | vxworks29k)
1037 | basic_machine=a29k-wrs
1038 | os=-vxworks
1039 | ;;
1040 | w65*)
1041 | basic_machine=w65-wdc
1042 | os=-none
1043 | ;;
1044 | w89k-*)
1045 | basic_machine=hppa1.1-winbond
1046 | os=-proelf
1047 | ;;
1048 | xbox)
1049 | basic_machine=i686-pc
1050 | os=-mingw32
1051 | ;;
1052 | xps | xps100)
1053 | basic_machine=xps100-honeywell
1054 | ;;
1055 | ymp)
1056 | basic_machine=ymp-cray
1057 | os=-unicos
1058 | ;;
1059 | z8k-*-coff)
1060 | basic_machine=z8k-unknown
1061 | os=-sim
1062 | ;;
1063 | none)
1064 | basic_machine=none-none
1065 | os=-none
1066 | ;;
1067 |
1068 | # Here we handle the default manufacturer of certain CPU types. It is in
1069 | # some cases the only manufacturer, in others, it is the most popular.
1070 | w89k)
1071 | basic_machine=hppa1.1-winbond
1072 | ;;
1073 | op50n)
1074 | basic_machine=hppa1.1-oki
1075 | ;;
1076 | op60c)
1077 | basic_machine=hppa1.1-oki
1078 | ;;
1079 | romp)
1080 | basic_machine=romp-ibm
1081 | ;;
1082 | mmix)
1083 | basic_machine=mmix-knuth
1084 | ;;
1085 | rs6000)
1086 | basic_machine=rs6000-ibm
1087 | ;;
1088 | vax)
1089 | basic_machine=vax-dec
1090 | ;;
1091 | pdp10)
1092 | # there are many clones, so DEC is not a safe bet
1093 | basic_machine=pdp10-unknown
1094 | ;;
1095 | pdp11)
1096 | basic_machine=pdp11-dec
1097 | ;;
1098 | we32k)
1099 | basic_machine=we32k-att
1100 | ;;
1101 | sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
1102 | basic_machine=sh-unknown
1103 | ;;
1104 | sparc | sparcv8 | sparcv9 | sparcv9b)
1105 | basic_machine=sparc-sun
1106 | ;;
1107 | cydra)
1108 | basic_machine=cydra-cydrome
1109 | ;;
1110 | orion)
1111 | basic_machine=orion-highlevel
1112 | ;;
1113 | orion105)
1114 | basic_machine=clipper-highlevel
1115 | ;;
1116 | mac | mpw | mac-mpw)
1117 | basic_machine=m68k-apple
1118 | ;;
1119 | pmac | pmac-mpw)
1120 | basic_machine=powerpc-apple
1121 | ;;
1122 | *-unknown)
1123 | # Make sure to match an already-canonicalized machine name.
1124 | ;;
1125 | *)
1126 | echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
1127 | exit 1
1128 | ;;
1129 | esac
1130 |
1131 | # Here we canonicalize certain aliases for manufacturers.
1132 | case $basic_machine in
1133 | *-digital*)
1134 | basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
1135 | ;;
1136 | *-commodore*)
1137 | basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
1138 | ;;
1139 | *)
1140 | ;;
1141 | esac
1142 |
1143 | # Decode manufacturer-specific aliases for certain operating systems.
1144 |
1145 | if [ x"$os" != x"" ]
1146 | then
1147 | case $os in
1148 | # First match some system type aliases
1149 | # that might get confused with valid system types.
1150 | # -solaris* is a basic system type, with this one exception.
1151 | -solaris1 | -solaris1.*)
1152 | os=`echo $os | sed -e 's|solaris1|sunos4|'`
1153 | ;;
1154 | -solaris)
1155 | os=-solaris2
1156 | ;;
1157 | -svr4*)
1158 | os=-sysv4
1159 | ;;
1160 | -unixware*)
1161 | os=-sysv4.2uw
1162 | ;;
1163 | -gnu/linux*)
1164 | os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
1165 | ;;
1166 | # First accept the basic system types.
1167 | # The portable systems comes first.
1168 | # Each alternative MUST END IN A *, to match a version number.
1169 | # -sysv* is not here because it comes later, after sysvr4.
1170 | -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
1171 | | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
1172 | | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
1173 | | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
1174 | | -aos* \
1175 | | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
1176 | | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
1177 | | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \
1178 | | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
1179 | | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
1180 | | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
1181 | | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
1182 | | -chorusos* | -chorusrdb* \
1183 | | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
1184 | | -mingw32* | -linux* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \
1185 | | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
1186 | | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
1187 | | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
1188 | | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
1189 | | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
1190 | | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
1191 | | -skyos* | -haiku*)
1192 | # Remember, each alternative MUST END IN *, to match a version number.
1193 | ;;
1194 | -qnx*)
1195 | case $basic_machine in
1196 | x86-* | i*86-*)
1197 | ;;
1198 | *)
1199 | os=-nto$os
1200 | ;;
1201 | esac
1202 | ;;
1203 | -nto-qnx*)
1204 | ;;
1205 | -nto*)
1206 | os=`echo $os | sed -e 's|nto|nto-qnx|'`
1207 | ;;
1208 | -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
1209 | | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
1210 | | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
1211 | ;;
1212 | -mac*)
1213 | os=`echo $os | sed -e 's|mac|macos|'`
1214 | ;;
1215 | -linux-dietlibc)
1216 | os=-linux-dietlibc
1217 | ;;
1218 | -sunos5*)
1219 | os=`echo $os | sed -e 's|sunos5|solaris2|'`
1220 | ;;
1221 | -sunos6*)
1222 | os=`echo $os | sed -e 's|sunos6|solaris3|'`
1223 | ;;
1224 | -opened*)
1225 | os=-openedition
1226 | ;;
1227 | -os400*)
1228 | os=-os400
1229 | ;;
1230 | -wince*)
1231 | os=-wince
1232 | ;;
1233 | -osfrose*)
1234 | os=-osfrose
1235 | ;;
1236 | -osf*)
1237 | os=-osf
1238 | ;;
1239 | -utek*)
1240 | os=-bsd
1241 | ;;
1242 | -dynix*)
1243 | os=-bsd
1244 | ;;
1245 | -acis*)
1246 | os=-aos
1247 | ;;
1248 | -atheos*)
1249 | os=-atheos
1250 | ;;
1251 | -syllable*)
1252 | os=-syllable
1253 | ;;
1254 | -386bsd)
1255 | os=-bsd
1256 | ;;
1257 | -ctix* | -uts*)
1258 | os=-sysv
1259 | ;;
1260 | -nova*)
1261 | os=-rtmk-nova
1262 | ;;
1263 | -ns2 )
1264 | os=-nextstep2
1265 | ;;
1266 | -nsk*)
1267 | os=-nsk
1268 | ;;
1269 | # Preserve the version number of sinix5.
1270 | -sinix5.*)
1271 | os=`echo $os | sed -e 's|sinix|sysv|'`
1272 | ;;
1273 | -sinix*)
1274 | os=-sysv4
1275 | ;;
1276 | -tpf*)
1277 | os=-tpf
1278 | ;;
1279 | -triton*)
1280 | os=-sysv3
1281 | ;;
1282 | -oss*)
1283 | os=-sysv3
1284 | ;;
1285 | -svr4)
1286 | os=-sysv4
1287 | ;;
1288 | -svr3)
1289 | os=-sysv3
1290 | ;;
1291 | -sysvr4)
1292 | os=-sysv4
1293 | ;;
1294 | # This must come after -sysvr4.
1295 | -sysv*)
1296 | ;;
1297 | -ose*)
1298 | os=-ose
1299 | ;;
1300 | -es1800*)
1301 | os=-ose
1302 | ;;
1303 | -xenix)
1304 | os=-xenix
1305 | ;;
1306 | -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
1307 | os=-mint
1308 | ;;
1309 | -aros*)
1310 | os=-aros
1311 | ;;
1312 | -kaos*)
1313 | os=-kaos
1314 | ;;
1315 | -zvmoe)
1316 | os=-zvmoe
1317 | ;;
1318 | -none)
1319 | ;;
1320 | *)
1321 | # Get rid of the `-' at the beginning of $os.
1322 | os=`echo $os | sed 's/[^-]*-//'`
1323 | echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
1324 | exit 1
1325 | ;;
1326 | esac
1327 | else
1328 |
1329 | # Here we handle the default operating systems that come with various machines.
1330 | # The value should be what the vendor currently ships out the door with their
1331 | # machine or put another way, the most popular os provided with the machine.
1332 |
1333 | # Note that if you're going to try to match "-MANUFACTURER" here (say,
1334 | # "-sun"), then you have to tell the case statement up towards the top
1335 | # that MANUFACTURER isn't an operating system. Otherwise, code above
1336 | # will signal an error saying that MANUFACTURER isn't an operating
1337 | # system, and we'll never get to this point.
1338 |
1339 | case $basic_machine in
1340 | *-acorn)
1341 | os=-riscix1.2
1342 | ;;
1343 | arm*-rebel)
1344 | os=-linux
1345 | ;;
1346 | arm*-semi)
1347 | os=-aout
1348 | ;;
1349 | c4x-* | tic4x-*)
1350 | os=-coff
1351 | ;;
1352 | # This must come before the *-dec entry.
1353 | pdp10-*)
1354 | os=-tops20
1355 | ;;
1356 | pdp11-*)
1357 | os=-none
1358 | ;;
1359 | *-dec | vax-*)
1360 | os=-ultrix4.2
1361 | ;;
1362 | m68*-apollo)
1363 | os=-domain
1364 | ;;
1365 | i386-sun)
1366 | os=-sunos4.0.2
1367 | ;;
1368 | m68000-sun)
1369 | os=-sunos3
1370 | # This also exists in the configure program, but was not the
1371 | # default.
1372 | # os=-sunos4
1373 | ;;
1374 | m68*-cisco)
1375 | os=-aout
1376 | ;;
1377 | mips*-cisco)
1378 | os=-elf
1379 | ;;
1380 | mips*-*)
1381 | os=-elf
1382 | ;;
1383 | or32-*)
1384 | os=-coff
1385 | ;;
1386 | *-tti) # must be before sparc entry or we get the wrong os.
1387 | os=-sysv3
1388 | ;;
1389 | sparc-* | *-sun)
1390 | os=-sunos4.1.1
1391 | ;;
1392 | *-be)
1393 | os=-beos
1394 | ;;
1395 | *-haiku)
1396 | os=-haiku
1397 | ;;
1398 | *-ibm)
1399 | os=-aix
1400 | ;;
1401 | *-knuth)
1402 | os=-mmixware
1403 | ;;
1404 | *-wec)
1405 | os=-proelf
1406 | ;;
1407 | *-winbond)
1408 | os=-proelf
1409 | ;;
1410 | *-oki)
1411 | os=-proelf
1412 | ;;
1413 | *-hp)
1414 | os=-hpux
1415 | ;;
1416 | *-hitachi)
1417 | os=-hiux
1418 | ;;
1419 | i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
1420 | os=-sysv
1421 | ;;
1422 | *-cbm)
1423 | os=-amigaos
1424 | ;;
1425 | *-dg)
1426 | os=-dgux
1427 | ;;
1428 | *-dolphin)
1429 | os=-sysv3
1430 | ;;
1431 | m68k-ccur)
1432 | os=-rtu
1433 | ;;
1434 | m88k-omron*)
1435 | os=-luna
1436 | ;;
1437 | *-next )
1438 | os=-nextstep
1439 | ;;
1440 | *-sequent)
1441 | os=-ptx
1442 | ;;
1443 | *-crds)
1444 | os=-unos
1445 | ;;
1446 | *-ns)
1447 | os=-genix
1448 | ;;
1449 | i370-*)
1450 | os=-mvs
1451 | ;;
1452 | *-next)
1453 | os=-nextstep3
1454 | ;;
1455 | *-gould)
1456 | os=-sysv
1457 | ;;
1458 | *-highlevel)
1459 | os=-bsd
1460 | ;;
1461 | *-encore)
1462 | os=-bsd
1463 | ;;
1464 | *-sgi)
1465 | os=-irix
1466 | ;;
1467 | *-siemens)
1468 | os=-sysv4
1469 | ;;
1470 | *-masscomp)
1471 | os=-rtu
1472 | ;;
1473 | f30[01]-fujitsu | f700-fujitsu)
1474 | os=-uxpv
1475 | ;;
1476 | *-rom68k)
1477 | os=-coff
1478 | ;;
1479 | *-*bug)
1480 | os=-coff
1481 | ;;
1482 | *-apple)
1483 | os=-macos
1484 | ;;
1485 | *-atari*)
1486 | os=-mint
1487 | ;;
1488 | *)
1489 | os=-none
1490 | ;;
1491 | esac
1492 | fi
1493 |
1494 | # Here we handle the case where we know the os, and the CPU type, but not the
1495 | # manufacturer. We pick the logical manufacturer.
1496 | vendor=unknown
1497 | case $basic_machine in
1498 | *-unknown)
1499 | case $os in
1500 | -riscix*)
1501 | vendor=acorn
1502 | ;;
1503 | -sunos*)
1504 | vendor=sun
1505 | ;;
1506 | -aix*)
1507 | vendor=ibm
1508 | ;;
1509 | -beos*)
1510 | vendor=be
1511 | ;;
1512 | -hpux*)
1513 | vendor=hp
1514 | ;;
1515 | -mpeix*)
1516 | vendor=hp
1517 | ;;
1518 | -hiux*)
1519 | vendor=hitachi
1520 | ;;
1521 | -unos*)
1522 | vendor=crds
1523 | ;;
1524 | -dgux*)
1525 | vendor=dg
1526 | ;;
1527 | -luna*)
1528 | vendor=omron
1529 | ;;
1530 | -genix*)
1531 | vendor=ns
1532 | ;;
1533 | -mvs* | -opened*)
1534 | vendor=ibm
1535 | ;;
1536 | -os400*)
1537 | vendor=ibm
1538 | ;;
1539 | -ptx*)
1540 | vendor=sequent
1541 | ;;
1542 | -tpf*)
1543 | vendor=ibm
1544 | ;;
1545 | -vxsim* | -vxworks* | -windiss*)
1546 | vendor=wrs
1547 | ;;
1548 | -aux*)
1549 | vendor=apple
1550 | ;;
1551 | -hms*)
1552 | vendor=hitachi
1553 | ;;
1554 | -mpw* | -macos*)
1555 | vendor=apple
1556 | ;;
1557 | -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
1558 | vendor=atari
1559 | ;;
1560 | -vos*)
1561 | vendor=stratus
1562 | ;;
1563 | esac
1564 | basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
1565 | ;;
1566 | esac
1567 |
1568 | echo $basic_machine$os
1569 | exit
1570 |
1571 | # Local variables:
1572 | # eval: (add-hook 'write-file-hooks 'time-stamp)
1573 | # time-stamp-start: "timestamp='"
1574 | # time-stamp-format: "%:y-%02m-%02d"
1575 | # time-stamp-end: "'"
1576 | # End:
1577 |
--------------------------------------------------------------------------------
/regexp/configure.in:
--------------------------------------------------------------------------------
1 | AC_INIT(regexp.c)
2 | AM_INIT_AUTOMAKE(UDF-regexp, 1.0)
3 |
4 | AC_PROG_LIBTOOL
5 | AC_PROG_CC
6 | WITH_MYSQL_SRC()
7 | MYSQL_USE_UDF_API()
8 | MYSQL_SUBST()
9 |
10 | AM_CONFIG_HEADER(config.h)
11 |
12 | AC_OUTPUT(Makefile)
13 |
--------------------------------------------------------------------------------
/regexp/depcomp:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 | # depcomp - compile a program generating dependencies as side-effects
3 |
4 | scriptversion=2005-07-09.11
5 |
6 | # Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
7 |
8 | # This program is free software; you can redistribute it and/or modify
9 | # it under the terms of the GNU General Public License as published by
10 | # the Free Software Foundation; either version 2, or (at your option)
11 | # any later version.
12 |
13 | # This program is distributed in the hope that it will be useful,
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | # GNU General Public License for more details.
17 |
18 | # You should have received a copy of the GNU General Public License
19 | # along with this program; if not, write to the Free Software
20 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 | # 02110-1301, USA.
22 |
23 | # As a special exception to the GNU General Public License, if you
24 | # distribute this file as part of a program that contains a
25 | # configuration script generated by Autoconf, you may include it under
26 | # the same distribution terms that you use for the rest of that program.
27 |
28 | # Originally written by Alexandre Oliva .
29 |
30 | case $1 in
31 | '')
32 | echo "$0: No command. Try \`$0 --help' for more information." 1>&2
33 | exit 1;
34 | ;;
35 | -h | --h*)
36 | cat <<\EOF
37 | Usage: depcomp [--help] [--version] PROGRAM [ARGS]
38 |
39 | Run PROGRAMS ARGS to compile a file, generating dependencies
40 | as side-effects.
41 |
42 | Environment variables:
43 | depmode Dependency tracking mode.
44 | source Source file read by `PROGRAMS ARGS'.
45 | object Object file output by `PROGRAMS ARGS'.
46 | DEPDIR directory where to store dependencies.
47 | depfile Dependency file to output.
48 | tmpdepfile Temporary file to use when outputing dependencies.
49 | libtool Whether libtool is used (yes/no).
50 |
51 | Report bugs to .
52 | EOF
53 | exit $?
54 | ;;
55 | -v | --v*)
56 | echo "depcomp $scriptversion"
57 | exit $?
58 | ;;
59 | esac
60 |
61 | if test -z "$depmode" || test -z "$source" || test -z "$object"; then
62 | echo "depcomp: Variables source, object and depmode must be set" 1>&2
63 | exit 1
64 | fi
65 |
66 | # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
67 | depfile=${depfile-`echo "$object" |
68 | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
69 | tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
70 |
71 | rm -f "$tmpdepfile"
72 |
73 | # Some modes work just like other modes, but use different flags. We
74 | # parameterize here, but still list the modes in the big case below,
75 | # to make depend.m4 easier to write. Note that we *cannot* use a case
76 | # here, because this file can only contain one case statement.
77 | if test "$depmode" = hp; then
78 | # HP compiler uses -M and no extra arg.
79 | gccflag=-M
80 | depmode=gcc
81 | fi
82 |
83 | if test "$depmode" = dashXmstdout; then
84 | # This is just like dashmstdout with a different argument.
85 | dashmflag=-xM
86 | depmode=dashmstdout
87 | fi
88 |
89 | case "$depmode" in
90 | gcc3)
91 | ## gcc 3 implements dependency tracking that does exactly what
92 | ## we want. Yay! Note: for some reason libtool 1.4 doesn't like
93 | ## it if -MD -MP comes after the -MF stuff. Hmm.
94 | "$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
95 | stat=$?
96 | if test $stat -eq 0; then :
97 | else
98 | rm -f "$tmpdepfile"
99 | exit $stat
100 | fi
101 | mv "$tmpdepfile" "$depfile"
102 | ;;
103 |
104 | gcc)
105 | ## There are various ways to get dependency output from gcc. Here's
106 | ## why we pick this rather obscure method:
107 | ## - Don't want to use -MD because we'd like the dependencies to end
108 | ## up in a subdir. Having to rename by hand is ugly.
109 | ## (We might end up doing this anyway to support other compilers.)
110 | ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
111 | ## -MM, not -M (despite what the docs say).
112 | ## - Using -M directly means running the compiler twice (even worse
113 | ## than renaming).
114 | if test -z "$gccflag"; then
115 | gccflag=-MD,
116 | fi
117 | "$@" -Wp,"$gccflag$tmpdepfile"
118 | stat=$?
119 | if test $stat -eq 0; then :
120 | else
121 | rm -f "$tmpdepfile"
122 | exit $stat
123 | fi
124 | rm -f "$depfile"
125 | echo "$object : \\" > "$depfile"
126 | alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
127 | ## The second -e expression handles DOS-style file names with drive letters.
128 | sed -e 's/^[^:]*: / /' \
129 | -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
130 | ## This next piece of magic avoids the `deleted header file' problem.
131 | ## The problem is that when a header file which appears in a .P file
132 | ## is deleted, the dependency causes make to die (because there is
133 | ## typically no way to rebuild the header). We avoid this by adding
134 | ## dummy dependencies for each header file. Too bad gcc doesn't do
135 | ## this for us directly.
136 | tr ' ' '
137 | ' < "$tmpdepfile" |
138 | ## Some versions of gcc put a space before the `:'. On the theory
139 | ## that the space means something, we add a space to the output as
140 | ## well.
141 | ## Some versions of the HPUX 10.20 sed can't process this invocation
142 | ## correctly. Breaking it into two sed invocations is a workaround.
143 | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
144 | rm -f "$tmpdepfile"
145 | ;;
146 |
147 | hp)
148 | # This case exists only to let depend.m4 do its work. It works by
149 | # looking at the text of this script. This case will never be run,
150 | # since it is checked for above.
151 | exit 1
152 | ;;
153 |
154 | sgi)
155 | if test "$libtool" = yes; then
156 | "$@" "-Wp,-MDupdate,$tmpdepfile"
157 | else
158 | "$@" -MDupdate "$tmpdepfile"
159 | fi
160 | stat=$?
161 | if test $stat -eq 0; then :
162 | else
163 | rm -f "$tmpdepfile"
164 | exit $stat
165 | fi
166 | rm -f "$depfile"
167 |
168 | if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
169 | echo "$object : \\" > "$depfile"
170 |
171 | # Clip off the initial element (the dependent). Don't try to be
172 | # clever and replace this with sed code, as IRIX sed won't handle
173 | # lines with more than a fixed number of characters (4096 in
174 | # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
175 | # the IRIX cc adds comments like `#:fec' to the end of the
176 | # dependency line.
177 | tr ' ' '
178 | ' < "$tmpdepfile" \
179 | | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
180 | tr '
181 | ' ' ' >> $depfile
182 | echo >> $depfile
183 |
184 | # The second pass generates a dummy entry for each header file.
185 | tr ' ' '
186 | ' < "$tmpdepfile" \
187 | | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
188 | >> $depfile
189 | else
190 | # The sourcefile does not contain any dependencies, so just
191 | # store a dummy comment line, to avoid errors with the Makefile
192 | # "include basename.Plo" scheme.
193 | echo "#dummy" > "$depfile"
194 | fi
195 | rm -f "$tmpdepfile"
196 | ;;
197 |
198 | aix)
199 | # The C for AIX Compiler uses -M and outputs the dependencies
200 | # in a .u file. In older versions, this file always lives in the
201 | # current directory. Also, the AIX compiler puts `$object:' at the
202 | # start of each line; $object doesn't have directory information.
203 | # Version 6 uses the directory in both cases.
204 | stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
205 | tmpdepfile="$stripped.u"
206 | if test "$libtool" = yes; then
207 | "$@" -Wc,-M
208 | else
209 | "$@" -M
210 | fi
211 | stat=$?
212 |
213 | if test -f "$tmpdepfile"; then :
214 | else
215 | stripped=`echo "$stripped" | sed 's,^.*/,,'`
216 | tmpdepfile="$stripped.u"
217 | fi
218 |
219 | if test $stat -eq 0; then :
220 | else
221 | rm -f "$tmpdepfile"
222 | exit $stat
223 | fi
224 |
225 | if test -f "$tmpdepfile"; then
226 | outname="$stripped.o"
227 | # Each line is of the form `foo.o: dependent.h'.
228 | # Do two passes, one to just change these to
229 | # `$object: dependent.h' and one to simply `dependent.h:'.
230 | sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
231 | sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
232 | else
233 | # The sourcefile does not contain any dependencies, so just
234 | # store a dummy comment line, to avoid errors with the Makefile
235 | # "include basename.Plo" scheme.
236 | echo "#dummy" > "$depfile"
237 | fi
238 | rm -f "$tmpdepfile"
239 | ;;
240 |
241 | icc)
242 | # Intel's C compiler understands `-MD -MF file'. However on
243 | # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
244 | # ICC 7.0 will fill foo.d with something like
245 | # foo.o: sub/foo.c
246 | # foo.o: sub/foo.h
247 | # which is wrong. We want:
248 | # sub/foo.o: sub/foo.c
249 | # sub/foo.o: sub/foo.h
250 | # sub/foo.c:
251 | # sub/foo.h:
252 | # ICC 7.1 will output
253 | # foo.o: sub/foo.c sub/foo.h
254 | # and will wrap long lines using \ :
255 | # foo.o: sub/foo.c ... \
256 | # sub/foo.h ... \
257 | # ...
258 |
259 | "$@" -MD -MF "$tmpdepfile"
260 | stat=$?
261 | if test $stat -eq 0; then :
262 | else
263 | rm -f "$tmpdepfile"
264 | exit $stat
265 | fi
266 | rm -f "$depfile"
267 | # Each line is of the form `foo.o: dependent.h',
268 | # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
269 | # Do two passes, one to just change these to
270 | # `$object: dependent.h' and one to simply `dependent.h:'.
271 | sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
272 | # Some versions of the HPUX 10.20 sed can't process this invocation
273 | # correctly. Breaking it into two sed invocations is a workaround.
274 | sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
275 | sed -e 's/$/ :/' >> "$depfile"
276 | rm -f "$tmpdepfile"
277 | ;;
278 |
279 | tru64)
280 | # The Tru64 compiler uses -MD to generate dependencies as a side
281 | # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
282 | # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
283 | # dependencies in `foo.d' instead, so we check for that too.
284 | # Subdirectories are respected.
285 | dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
286 | test "x$dir" = "x$object" && dir=
287 | base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
288 |
289 | if test "$libtool" = yes; then
290 | # With Tru64 cc, shared objects can also be used to make a
291 | # static library. This mecanism is used in libtool 1.4 series to
292 | # handle both shared and static libraries in a single compilation.
293 | # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
294 | #
295 | # With libtool 1.5 this exception was removed, and libtool now
296 | # generates 2 separate objects for the 2 libraries. These two
297 | # compilations output dependencies in in $dir.libs/$base.o.d and
298 | # in $dir$base.o.d. We have to check for both files, because
299 | # one of the two compilations can be disabled. We should prefer
300 | # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
301 | # automatically cleaned when .libs/ is deleted, while ignoring
302 | # the former would cause a distcleancheck panic.
303 | tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
304 | tmpdepfile2=$dir$base.o.d # libtool 1.5
305 | tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
306 | tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
307 | "$@" -Wc,-MD
308 | else
309 | tmpdepfile1=$dir$base.o.d
310 | tmpdepfile2=$dir$base.d
311 | tmpdepfile3=$dir$base.d
312 | tmpdepfile4=$dir$base.d
313 | "$@" -MD
314 | fi
315 |
316 | stat=$?
317 | if test $stat -eq 0; then :
318 | else
319 | rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
320 | exit $stat
321 | fi
322 |
323 | for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
324 | do
325 | test -f "$tmpdepfile" && break
326 | done
327 | if test -f "$tmpdepfile"; then
328 | sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
329 | # That's a tab and a space in the [].
330 | sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
331 | else
332 | echo "#dummy" > "$depfile"
333 | fi
334 | rm -f "$tmpdepfile"
335 | ;;
336 |
337 | #nosideeffect)
338 | # This comment above is used by automake to tell side-effect
339 | # dependency tracking mechanisms from slower ones.
340 |
341 | dashmstdout)
342 | # Important note: in order to support this mode, a compiler *must*
343 | # always write the preprocessed file to stdout, regardless of -o.
344 | "$@" || exit $?
345 |
346 | # Remove the call to Libtool.
347 | if test "$libtool" = yes; then
348 | while test $1 != '--mode=compile'; do
349 | shift
350 | done
351 | shift
352 | fi
353 |
354 | # Remove `-o $object'.
355 | IFS=" "
356 | for arg
357 | do
358 | case $arg in
359 | -o)
360 | shift
361 | ;;
362 | $object)
363 | shift
364 | ;;
365 | *)
366 | set fnord "$@" "$arg"
367 | shift # fnord
368 | shift # $arg
369 | ;;
370 | esac
371 | done
372 |
373 | test -z "$dashmflag" && dashmflag=-M
374 | # Require at least two characters before searching for `:'
375 | # in the target name. This is to cope with DOS-style filenames:
376 | # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
377 | "$@" $dashmflag |
378 | sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
379 | rm -f "$depfile"
380 | cat < "$tmpdepfile" > "$depfile"
381 | tr ' ' '
382 | ' < "$tmpdepfile" | \
383 | ## Some versions of the HPUX 10.20 sed can't process this invocation
384 | ## correctly. Breaking it into two sed invocations is a workaround.
385 | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
386 | rm -f "$tmpdepfile"
387 | ;;
388 |
389 | dashXmstdout)
390 | # This case only exists to satisfy depend.m4. It is never actually
391 | # run, as this mode is specially recognized in the preamble.
392 | exit 1
393 | ;;
394 |
395 | makedepend)
396 | "$@" || exit $?
397 | # Remove any Libtool call
398 | if test "$libtool" = yes; then
399 | while test $1 != '--mode=compile'; do
400 | shift
401 | done
402 | shift
403 | fi
404 | # X makedepend
405 | shift
406 | cleared=no
407 | for arg in "$@"; do
408 | case $cleared in
409 | no)
410 | set ""; shift
411 | cleared=yes ;;
412 | esac
413 | case "$arg" in
414 | -D*|-I*)
415 | set fnord "$@" "$arg"; shift ;;
416 | # Strip any option that makedepend may not understand. Remove
417 | # the object too, otherwise makedepend will parse it as a source file.
418 | -*|$object)
419 | ;;
420 | *)
421 | set fnord "$@" "$arg"; shift ;;
422 | esac
423 | done
424 | obj_suffix="`echo $object | sed 's/^.*\././'`"
425 | touch "$tmpdepfile"
426 | ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
427 | rm -f "$depfile"
428 | cat < "$tmpdepfile" > "$depfile"
429 | sed '1,2d' "$tmpdepfile" | tr ' ' '
430 | ' | \
431 | ## Some versions of the HPUX 10.20 sed can't process this invocation
432 | ## correctly. Breaking it into two sed invocations is a workaround.
433 | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
434 | rm -f "$tmpdepfile" "$tmpdepfile".bak
435 | ;;
436 |
437 | cpp)
438 | # Important note: in order to support this mode, a compiler *must*
439 | # always write the preprocessed file to stdout.
440 | "$@" || exit $?
441 |
442 | # Remove the call to Libtool.
443 | if test "$libtool" = yes; then
444 | while test $1 != '--mode=compile'; do
445 | shift
446 | done
447 | shift
448 | fi
449 |
450 | # Remove `-o $object'.
451 | IFS=" "
452 | for arg
453 | do
454 | case $arg in
455 | -o)
456 | shift
457 | ;;
458 | $object)
459 | shift
460 | ;;
461 | *)
462 | set fnord "$@" "$arg"
463 | shift # fnord
464 | shift # $arg
465 | ;;
466 | esac
467 | done
468 |
469 | "$@" -E |
470 | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
471 | -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
472 | sed '$ s: \\$::' > "$tmpdepfile"
473 | rm -f "$depfile"
474 | echo "$object : \\" > "$depfile"
475 | cat < "$tmpdepfile" >> "$depfile"
476 | sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
477 | rm -f "$tmpdepfile"
478 | ;;
479 |
480 | msvisualcpp)
481 | # Important note: in order to support this mode, a compiler *must*
482 | # always write the preprocessed file to stdout, regardless of -o,
483 | # because we must use -o when running libtool.
484 | "$@" || exit $?
485 | IFS=" "
486 | for arg
487 | do
488 | case "$arg" in
489 | "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
490 | set fnord "$@"
491 | shift
492 | shift
493 | ;;
494 | *)
495 | set fnord "$@" "$arg"
496 | shift
497 | shift
498 | ;;
499 | esac
500 | done
501 | "$@" -E |
502 | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
503 | rm -f "$depfile"
504 | echo "$object : \\" > "$depfile"
505 | . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
506 | echo " " >> "$depfile"
507 | . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
508 | rm -f "$tmpdepfile"
509 | ;;
510 |
511 | none)
512 | exec "$@"
513 | ;;
514 |
515 | *)
516 | echo "Unknown depmode $depmode" 1>&2
517 | exit 1
518 | ;;
519 | esac
520 |
521 | exit 0
522 |
523 | # Local Variables:
524 | # mode: shell-script
525 | # sh-indentation: 2
526 | # eval: (add-hook 'write-file-hooks 'time-stamp)
527 | # time-stamp-start: "scriptversion="
528 | # time-stamp-format: "%:y-%02m-%02d.%02H"
529 | # time-stamp-end: "$"
530 | # End:
531 |
--------------------------------------------------------------------------------
/regexp/install-sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # install - install a program, script, or datafile
3 |
4 | scriptversion=2005-05-14.22
5 |
6 | # This originates from X11R5 (mit/util/scripts/install.sh), which was
7 | # later released in X11R6 (xc/config/util/install.sh) with the
8 | # following copyright and license.
9 | #
10 | # Copyright (C) 1994 X Consortium
11 | #
12 | # Permission is hereby granted, free of charge, to any person obtaining a copy
13 | # of this software and associated documentation files (the "Software"), to
14 | # deal in the Software without restriction, including without limitation the
15 | # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
16 | # sell copies of the Software, and to permit persons to whom the Software is
17 | # furnished to do so, subject to the following conditions:
18 | #
19 | # The above copyright notice and this permission notice shall be included in
20 | # all copies or substantial portions of the Software.
21 | #
22 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25 | # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
26 | # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
27 | # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28 | #
29 | # Except as contained in this notice, the name of the X Consortium shall not
30 | # be used in advertising or otherwise to promote the sale, use or other deal-
31 | # ings in this Software without prior written authorization from the X Consor-
32 | # tium.
33 | #
34 | #
35 | # FSF changes to this file are in the public domain.
36 | #
37 | # Calling this script install-sh is preferred over install.sh, to prevent
38 | # `make' implicit rules from creating a file called install from it
39 | # when there is no Makefile.
40 | #
41 | # This script is compatible with the BSD install script, but was written
42 | # from scratch. It can only install one file at a time, a restriction
43 | # shared with many OS's install programs.
44 |
45 | # set DOITPROG to echo to test this script
46 |
47 | # Don't use :- since 4.3BSD and earlier shells don't like it.
48 | doit="${DOITPROG-}"
49 |
50 | # put in absolute paths if you don't have them in your path; or use env. vars.
51 |
52 | mvprog="${MVPROG-mv}"
53 | cpprog="${CPPROG-cp}"
54 | chmodprog="${CHMODPROG-chmod}"
55 | chownprog="${CHOWNPROG-chown}"
56 | chgrpprog="${CHGRPPROG-chgrp}"
57 | stripprog="${STRIPPROG-strip}"
58 | rmprog="${RMPROG-rm}"
59 | mkdirprog="${MKDIRPROG-mkdir}"
60 |
61 | chmodcmd="$chmodprog 0755"
62 | chowncmd=
63 | chgrpcmd=
64 | stripcmd=
65 | rmcmd="$rmprog -f"
66 | mvcmd="$mvprog"
67 | src=
68 | dst=
69 | dir_arg=
70 | dstarg=
71 | no_target_directory=
72 |
73 | usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
74 | or: $0 [OPTION]... SRCFILES... DIRECTORY
75 | or: $0 [OPTION]... -t DIRECTORY SRCFILES...
76 | or: $0 [OPTION]... -d DIRECTORIES...
77 |
78 | In the 1st form, copy SRCFILE to DSTFILE.
79 | In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
80 | In the 4th, create DIRECTORIES.
81 |
82 | Options:
83 | -c (ignored)
84 | -d create directories instead of installing files.
85 | -g GROUP $chgrpprog installed files to GROUP.
86 | -m MODE $chmodprog installed files to MODE.
87 | -o USER $chownprog installed files to USER.
88 | -s $stripprog installed files.
89 | -t DIRECTORY install into DIRECTORY.
90 | -T report an error if DSTFILE is a directory.
91 | --help display this help and exit.
92 | --version display version info and exit.
93 |
94 | Environment variables override the default commands:
95 | CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
96 | "
97 |
98 | while test -n "$1"; do
99 | case $1 in
100 | -c) shift
101 | continue;;
102 |
103 | -d) dir_arg=true
104 | shift
105 | continue;;
106 |
107 | -g) chgrpcmd="$chgrpprog $2"
108 | shift
109 | shift
110 | continue;;
111 |
112 | --help) echo "$usage"; exit $?;;
113 |
114 | -m) chmodcmd="$chmodprog $2"
115 | shift
116 | shift
117 | continue;;
118 |
119 | -o) chowncmd="$chownprog $2"
120 | shift
121 | shift
122 | continue;;
123 |
124 | -s) stripcmd=$stripprog
125 | shift
126 | continue;;
127 |
128 | -t) dstarg=$2
129 | shift
130 | shift
131 | continue;;
132 |
133 | -T) no_target_directory=true
134 | shift
135 | continue;;
136 |
137 | --version) echo "$0 $scriptversion"; exit $?;;
138 |
139 | *) # When -d is used, all remaining arguments are directories to create.
140 | # When -t is used, the destination is already specified.
141 | test -n "$dir_arg$dstarg" && break
142 | # Otherwise, the last argument is the destination. Remove it from $@.
143 | for arg
144 | do
145 | if test -n "$dstarg"; then
146 | # $@ is not empty: it contains at least $arg.
147 | set fnord "$@" "$dstarg"
148 | shift # fnord
149 | fi
150 | shift # arg
151 | dstarg=$arg
152 | done
153 | break;;
154 | esac
155 | done
156 |
157 | if test -z "$1"; then
158 | if test -z "$dir_arg"; then
159 | echo "$0: no input file specified." >&2
160 | exit 1
161 | fi
162 | # It's OK to call `install-sh -d' without argument.
163 | # This can happen when creating conditional directories.
164 | exit 0
165 | fi
166 |
167 | for src
168 | do
169 | # Protect names starting with `-'.
170 | case $src in
171 | -*) src=./$src ;;
172 | esac
173 |
174 | if test -n "$dir_arg"; then
175 | dst=$src
176 | src=
177 |
178 | if test -d "$dst"; then
179 | mkdircmd=:
180 | chmodcmd=
181 | else
182 | mkdircmd=$mkdirprog
183 | fi
184 | else
185 | # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
186 | # might cause directories to be created, which would be especially bad
187 | # if $src (and thus $dsttmp) contains '*'.
188 | if test ! -f "$src" && test ! -d "$src"; then
189 | echo "$0: $src does not exist." >&2
190 | exit 1
191 | fi
192 |
193 | if test -z "$dstarg"; then
194 | echo "$0: no destination specified." >&2
195 | exit 1
196 | fi
197 |
198 | dst=$dstarg
199 | # Protect names starting with `-'.
200 | case $dst in
201 | -*) dst=./$dst ;;
202 | esac
203 |
204 | # If destination is a directory, append the input filename; won't work
205 | # if double slashes aren't ignored.
206 | if test -d "$dst"; then
207 | if test -n "$no_target_directory"; then
208 | echo "$0: $dstarg: Is a directory" >&2
209 | exit 1
210 | fi
211 | dst=$dst/`basename "$src"`
212 | fi
213 | fi
214 |
215 | # This sed command emulates the dirname command.
216 | dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'`
217 |
218 | # Make sure that the destination directory exists.
219 |
220 | # Skip lots of stat calls in the usual case.
221 | if test ! -d "$dstdir"; then
222 | defaultIFS='
223 | '
224 | IFS="${IFS-$defaultIFS}"
225 |
226 | oIFS=$IFS
227 | # Some sh's can't handle IFS=/ for some reason.
228 | IFS='%'
229 | set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
230 | shift
231 | IFS=$oIFS
232 |
233 | pathcomp=
234 |
235 | while test $# -ne 0 ; do
236 | pathcomp=$pathcomp$1
237 | shift
238 | if test ! -d "$pathcomp"; then
239 | $mkdirprog "$pathcomp"
240 | # mkdir can fail with a `File exist' error in case several
241 | # install-sh are creating the directory concurrently. This
242 | # is OK.
243 | test -d "$pathcomp" || exit
244 | fi
245 | pathcomp=$pathcomp/
246 | done
247 | fi
248 |
249 | if test -n "$dir_arg"; then
250 | $doit $mkdircmd "$dst" \
251 | && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
252 | && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
253 | && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
254 | && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
255 |
256 | else
257 | dstfile=`basename "$dst"`
258 |
259 | # Make a couple of temp file names in the proper directory.
260 | dsttmp=$dstdir/_inst.$$_
261 | rmtmp=$dstdir/_rm.$$_
262 |
263 | # Trap to clean up those temp files at exit.
264 | trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
265 | trap '(exit $?); exit' 1 2 13 15
266 |
267 | # Copy the file name to the temp name.
268 | $doit $cpprog "$src" "$dsttmp" &&
269 |
270 | # and set any options; do chmod last to preserve setuid bits.
271 | #
272 | # If any of these fail, we abort the whole thing. If we want to
273 | # ignore errors from any of these, just make sure not to ignore
274 | # errors from the above "$doit $cpprog $src $dsttmp" command.
275 | #
276 | { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
277 | && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
278 | && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
279 | && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&
280 |
281 | # Now rename the file to the real destination.
282 | { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \
283 | || {
284 | # The rename failed, perhaps because mv can't rename something else
285 | # to itself, or perhaps because mv is so ancient that it does not
286 | # support -f.
287 |
288 | # Now remove or move aside any old file at destination location.
289 | # We try this two ways since rm can't unlink itself on some
290 | # systems and the destination file might be busy for other
291 | # reasons. In this case, the final cleanup might fail but the new
292 | # file should still install successfully.
293 | {
294 | if test -f "$dstdir/$dstfile"; then
295 | $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
296 | || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
297 | || {
298 | echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
299 | (exit 1); exit 1
300 | }
301 | else
302 | :
303 | fi
304 | } &&
305 |
306 | # Now rename the file to the real destination.
307 | $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
308 | }
309 | }
310 | fi || { (exit 1); exit 1; }
311 | done
312 |
313 | # The final little trick to "correctly" pass the exit status to the exit trap.
314 | {
315 | (exit 0); exit 0
316 | }
317 |
318 | # Local variables:
319 | # eval: (add-hook 'write-file-hooks 'time-stamp)
320 | # time-stamp-start: "scriptversion="
321 | # time-stamp-format: "%:y-%02m-%02d.%02H"
322 | # time-stamp-end: "$"
323 | # End:
324 |
--------------------------------------------------------------------------------
/regexp/manual.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 | UDF-regexp 1.0 - MySQL functions emulating a subset of the Oracle REGEXP functions
8 |
9 | Introduction
10 |
11 | The functions provided by this package provide a subset of the functionality
12 | provided by the Oracle regular expression functions.
13 |
14 |
15 |
16 |
17 | Installation
18 |
19 | Configuration
20 |
21 | This user defined function module relies on information only
22 | available in the MySQL source code, it can't be compiled if
23 | you've only installed MySQL binary packages.
24 |
25 |
26 | To compile this package you need to first tell configure
27 | where to find the MySQL source directory you want to compile
28 | against using the configure
29 | option, e.g:
30 |
31 |
32 |
33 | configure --with-mysql-src=/home/username/src/mysql-5.0.37
34 |
35 |
36 |
37 | For a full list of configure options see
38 |
39 |
40 |
41 | configure --help
42 |
43 |
44 |
45 |
46 | By default the UDF library created by this package will install
47 | into /usr/local/lib. The mysql server may
48 | not be able to load it from there though as this directory may
49 | not be in its library search path.
50 |
51 |
52 | You may solve this by:
53 |
54 |
55 |
56 | adding /usr/local/lib to the
57 | LD_LIBRARY_PATH before invoking the mysql
58 | server
59 |
60 |
61 |
62 |
63 | changing the UDF install prefix by using either the
64 | or
65 | configure option so that the UDF library gets installed
66 | into a directory that is in the servers load path
67 |
68 |
69 |
70 |
71 | or both of the above
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 | Compilation
80 |
81 | Once you have successfully configured the package
82 | you should be able to compile it by simply typing
83 |
84 |
85 |
86 | make
87 |
88 |
89 |
90 |
91 | Testing
92 |
93 | This package includes test cases that can be invoked using
94 |
95 |
96 | make test
97 |
98 |
99 |
100 |
101 | This relies on the following mysql binaries being available
102 | in your environments search $PATH to function
103 | as the tests rely on the mysql server test framework:
104 |
105 | mysql - the mysql command line client
106 | mysqld - the mysql server
107 | mysqladmin - the mysql administration command line tool
108 | mysql_install_db - the database server initialisation tool
109 | mysqltest - the actual test framework tool
110 |
111 |
112 |
113 |
114 | Installing the library
115 |
116 | To install the generated UDF library you simply need to invoke
117 |
118 |
119 | make install
120 |
121 |
122 |
123 |
124 | Depending on the target directories user permissions you might
125 | need to do this as superuser though, eg. by using sudo:
126 |
127 |
128 | sudo make install
129 |
130 |
131 |
132 |
133 |
134 | Remember that the mysql server will only be able to load the
135 | library if it is installed in a directory in its library load
136 | path, you may modify this search path by invoking the server
137 | with the $LD_LIBRARY_PATH environment variable
138 | set appropriately before starting.
139 |
140 |
141 |
142 |
143 | Installing the actual functions
144 |
145 | To actually enable the functions provided by this UDF module
146 | you need to make them known to the MySQL server using
147 | CREATE FUNCTION SQL commands:
148 |
149 |
150 | Register the functions provided by this UDF module using
151 |
152 |
153 | CREATE FUNCTION regexp_like RETURNS INTEGER SONAME "regexp.so";
154 | CREATE FUNCTION regexp_substr RETURNS STRING SONAME "regexp.so";
155 | CREATE FUNCTION regexp_instr RETURNS INTEGER SONAME "regexp.so";
156 | CREATE FUNCTION regexp_replace RETURNS STRING SONAME "regexp.so";
157 |
158 |
159 |
160 |
161 | Unregister the functions provided by this UDF module using
162 |
163 |
164 | DROP FUNCTION regexp_like;
165 | DROP FUNCTION regexp_substr;
166 | DROP FUNCTION regexp_instr;
167 | DROP FUNCTION regexp_replace;
168 |
169 |
170 |
171 |
172 |
173 | Changing the source
174 |
175 | Changes applied to any of the files in this project may be
176 | overwritten by further invocations of the udf-gen
177 | tool so you should always try to apply all necessary changes to the
178 | XML specification file the project was generated from instead
179 | and then regenerate the project from the spec file instead.
180 |
181 |
182 | The udf-gen tool will only overwrite files that actually
183 | changed, so preserving file system time stamps of unmodified
184 | files, to play nice with make and to avoid
185 | unnecessary recompilation of source files.
186 |
187 |
188 |
189 |
190 | Functions provided by this UDF module
191 |
192 |
193 |
194 | regexp_like
195 | Compare strings against a regular expression pattern
196 |
197 |
198 | Signature
199 |
200 | intregexp_like
201 | stringtext
202 | stringpattern
203 | stringmode
204 |
205 |
206 |
207 | Description
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 | regexp_substr
218 |
219 |
220 |
221 | Signature
222 |
223 | stringregexp_substr
224 | stringtext
225 | stringpattern
226 | intposition = 1
227 | intoccurence = 1
228 | stringmode = c
229 |
230 |
231 |
232 | Description
233 |
234 |
235 |
236 |
237 |
238 |
239 |
240 |
241 |
242 | regexp_instr
243 |
244 |
245 |
246 | Signature
247 |
248 | intregexp_instr
249 | stringtext
250 | stringpattern
251 | intposition = 1
252 | intoccurrence = 1
253 | intreturn_end = 0
254 | stringmode = c
255 |
256 |
257 |
258 | Description
259 |
260 |
261 |
262 |
263 |
264 |
265 |
266 |
267 |
268 | regexp_replace
269 |
270 |
271 |
272 | Signature
273 |
274 | stringregexp_replace
275 | stringtext
276 | stringpattern
277 | stringreplace
278 | intposition = 1
279 | intoccurence = 0
280 | stringmode = c
281 |
282 |
283 |
284 | Description
285 |
286 |
287 |
288 |
289 |
290 |
291 |
292 |
293 |
--------------------------------------------------------------------------------
/regexp/missing:
--------------------------------------------------------------------------------
1 | #! /bin/sh
2 | # Common stub for a few missing GNU programs while installing.
3 |
4 | scriptversion=2005-06-08.21
5 |
6 | # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005
7 | # Free Software Foundation, Inc.
8 | # Originally by Fran,cois Pinard , 1996.
9 |
10 | # This program is free software; you can redistribute it and/or modify
11 | # it under the terms of the GNU General Public License as published by
12 | # the Free Software Foundation; either version 2, or (at your option)
13 | # any later version.
14 |
15 | # This program is distributed in the hope that it will be useful,
16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | # GNU General Public License for more details.
19 |
20 | # You should have received a copy of the GNU General Public License
21 | # along with this program; if not, write to the Free Software
22 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23 | # 02110-1301, USA.
24 |
25 | # As a special exception to the GNU General Public License, if you
26 | # distribute this file as part of a program that contains a
27 | # configuration script generated by Autoconf, you may include it under
28 | # the same distribution terms that you use for the rest of that program.
29 |
30 | if test $# -eq 0; then
31 | echo 1>&2 "Try \`$0 --help' for more information"
32 | exit 1
33 | fi
34 |
35 | run=:
36 |
37 | # In the cases where this matters, `missing' is being run in the
38 | # srcdir already.
39 | if test -f configure.ac; then
40 | configure_ac=configure.ac
41 | else
42 | configure_ac=configure.in
43 | fi
44 |
45 | msg="missing on your system"
46 |
47 | case "$1" in
48 | --run)
49 | # Try to run requested program, and just exit if it succeeds.
50 | run=
51 | shift
52 | "$@" && exit 0
53 | # Exit code 63 means version mismatch. This often happens
54 | # when the user try to use an ancient version of a tool on
55 | # a file that requires a minimum version. In this case we
56 | # we should proceed has if the program had been absent, or
57 | # if --run hadn't been passed.
58 | if test $? = 63; then
59 | run=:
60 | msg="probably too old"
61 | fi
62 | ;;
63 |
64 | -h|--h|--he|--hel|--help)
65 | echo "\
66 | $0 [OPTION]... PROGRAM [ARGUMENT]...
67 |
68 | Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
69 | error status if there is no known handling for PROGRAM.
70 |
71 | Options:
72 | -h, --help display this help and exit
73 | -v, --version output version information and exit
74 | --run try to run the given command, and emulate it if it fails
75 |
76 | Supported PROGRAM values:
77 | aclocal touch file \`aclocal.m4'
78 | autoconf touch file \`configure'
79 | autoheader touch file \`config.h.in'
80 | automake touch all \`Makefile.in' files
81 | bison create \`y.tab.[ch]', if possible, from existing .[ch]
82 | flex create \`lex.yy.c', if possible, from existing .c
83 | help2man touch the output file
84 | lex create \`lex.yy.c', if possible, from existing .c
85 | makeinfo touch the output file
86 | tar try tar, gnutar, gtar, then tar without non-portable flags
87 | yacc create \`y.tab.[ch]', if possible, from existing .[ch]
88 |
89 | Send bug reports to ."
90 | exit $?
91 | ;;
92 |
93 | -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
94 | echo "missing $scriptversion (GNU Automake)"
95 | exit $?
96 | ;;
97 |
98 | -*)
99 | echo 1>&2 "$0: Unknown \`$1' option"
100 | echo 1>&2 "Try \`$0 --help' for more information"
101 | exit 1
102 | ;;
103 |
104 | esac
105 |
106 | # Now exit if we have it, but it failed. Also exit now if we
107 | # don't have it and --version was passed (most likely to detect
108 | # the program).
109 | case "$1" in
110 | lex|yacc)
111 | # Not GNU programs, they don't have --version.
112 | ;;
113 |
114 | tar)
115 | if test -n "$run"; then
116 | echo 1>&2 "ERROR: \`tar' requires --run"
117 | exit 1
118 | elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
119 | exit 1
120 | fi
121 | ;;
122 |
123 | *)
124 | if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
125 | # We have it, but it failed.
126 | exit 1
127 | elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
128 | # Could not run --version or --help. This is probably someone
129 | # running `$TOOL --version' or `$TOOL --help' to check whether
130 | # $TOOL exists and not knowing $TOOL uses missing.
131 | exit 1
132 | fi
133 | ;;
134 | esac
135 |
136 | # If it does not exist, or fails to run (possibly an outdated version),
137 | # try to emulate it.
138 | case "$1" in
139 | aclocal*)
140 | echo 1>&2 "\
141 | WARNING: \`$1' is $msg. You should only need it if
142 | you modified \`acinclude.m4' or \`${configure_ac}'. You might want
143 | to install the \`Automake' and \`Perl' packages. Grab them from
144 | any GNU archive site."
145 | touch aclocal.m4
146 | ;;
147 |
148 | autoconf)
149 | echo 1>&2 "\
150 | WARNING: \`$1' is $msg. You should only need it if
151 | you modified \`${configure_ac}'. You might want to install the
152 | \`Autoconf' and \`GNU m4' packages. Grab them from any GNU
153 | archive site."
154 | touch configure
155 | ;;
156 |
157 | autoheader)
158 | echo 1>&2 "\
159 | WARNING: \`$1' is $msg. You should only need it if
160 | you modified \`acconfig.h' or \`${configure_ac}'. You might want
161 | to install the \`Autoconf' and \`GNU m4' packages. Grab them
162 | from any GNU archive site."
163 | files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
164 | test -z "$files" && files="config.h"
165 | touch_files=
166 | for f in $files; do
167 | case "$f" in
168 | *:*) touch_files="$touch_files "`echo "$f" |
169 | sed -e 's/^[^:]*://' -e 's/:.*//'`;;
170 | *) touch_files="$touch_files $f.in";;
171 | esac
172 | done
173 | touch $touch_files
174 | ;;
175 |
176 | automake*)
177 | echo 1>&2 "\
178 | WARNING: \`$1' is $msg. You should only need it if
179 | you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
180 | You might want to install the \`Automake' and \`Perl' packages.
181 | Grab them from any GNU archive site."
182 | find . -type f -name Makefile.am -print |
183 | sed 's/\.am$/.in/' |
184 | while read f; do touch "$f"; done
185 | ;;
186 |
187 | autom4te)
188 | echo 1>&2 "\
189 | WARNING: \`$1' is needed, but is $msg.
190 | You might have modified some files without having the
191 | proper tools for further handling them.
192 | You can get \`$1' as part of \`Autoconf' from any GNU
193 | archive site."
194 |
195 | file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
196 | test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
197 | if test -f "$file"; then
198 | touch $file
199 | else
200 | test -z "$file" || exec >$file
201 | echo "#! /bin/sh"
202 | echo "# Created by GNU Automake missing as a replacement of"
203 | echo "# $ $@"
204 | echo "exit 0"
205 | chmod +x $file
206 | exit 1
207 | fi
208 | ;;
209 |
210 | bison|yacc)
211 | echo 1>&2 "\
212 | WARNING: \`$1' $msg. You should only need it if
213 | you modified a \`.y' file. You may need the \`Bison' package
214 | in order for those modifications to take effect. You can get
215 | \`Bison' from any GNU archive site."
216 | rm -f y.tab.c y.tab.h
217 | if [ $# -ne 1 ]; then
218 | eval LASTARG="\${$#}"
219 | case "$LASTARG" in
220 | *.y)
221 | SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
222 | if [ -f "$SRCFILE" ]; then
223 | cp "$SRCFILE" y.tab.c
224 | fi
225 | SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
226 | if [ -f "$SRCFILE" ]; then
227 | cp "$SRCFILE" y.tab.h
228 | fi
229 | ;;
230 | esac
231 | fi
232 | if [ ! -f y.tab.h ]; then
233 | echo >y.tab.h
234 | fi
235 | if [ ! -f y.tab.c ]; then
236 | echo 'main() { return 0; }' >y.tab.c
237 | fi
238 | ;;
239 |
240 | lex|flex)
241 | echo 1>&2 "\
242 | WARNING: \`$1' is $msg. You should only need it if
243 | you modified a \`.l' file. You may need the \`Flex' package
244 | in order for those modifications to take effect. You can get
245 | \`Flex' from any GNU archive site."
246 | rm -f lex.yy.c
247 | if [ $# -ne 1 ]; then
248 | eval LASTARG="\${$#}"
249 | case "$LASTARG" in
250 | *.l)
251 | SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
252 | if [ -f "$SRCFILE" ]; then
253 | cp "$SRCFILE" lex.yy.c
254 | fi
255 | ;;
256 | esac
257 | fi
258 | if [ ! -f lex.yy.c ]; then
259 | echo 'main() { return 0; }' >lex.yy.c
260 | fi
261 | ;;
262 |
263 | help2man)
264 | echo 1>&2 "\
265 | WARNING: \`$1' is $msg. You should only need it if
266 | you modified a dependency of a manual page. You may need the
267 | \`Help2man' package in order for those modifications to take
268 | effect. You can get \`Help2man' from any GNU archive site."
269 |
270 | file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
271 | if test -z "$file"; then
272 | file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
273 | fi
274 | if [ -f "$file" ]; then
275 | touch $file
276 | else
277 | test -z "$file" || exec >$file
278 | echo ".ab help2man is required to generate this page"
279 | exit 1
280 | fi
281 | ;;
282 |
283 | makeinfo)
284 | echo 1>&2 "\
285 | WARNING: \`$1' is $msg. You should only need it if
286 | you modified a \`.texi' or \`.texinfo' file, or any other file
287 | indirectly affecting the aspect of the manual. The spurious
288 | call might also be the consequence of using a buggy \`make' (AIX,
289 | DU, IRIX). You might want to install the \`Texinfo' package or
290 | the \`GNU make' package. Grab either from any GNU archive site."
291 | # The file to touch is that specified with -o ...
292 | file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
293 | if test -z "$file"; then
294 | # ... or it is the one specified with @setfilename ...
295 | infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
296 | file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile`
297 | # ... or it is derived from the source name (dir/f.texi becomes f.info)
298 | test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
299 | fi
300 | # If the file does not exist, the user really needs makeinfo;
301 | # let's fail without touching anything.
302 | test -f $file || exit 1
303 | touch $file
304 | ;;
305 |
306 | tar)
307 | shift
308 |
309 | # We have already tried tar in the generic part.
310 | # Look for gnutar/gtar before invocation to avoid ugly error
311 | # messages.
312 | if (gnutar --version > /dev/null 2>&1); then
313 | gnutar "$@" && exit 0
314 | fi
315 | if (gtar --version > /dev/null 2>&1); then
316 | gtar "$@" && exit 0
317 | fi
318 | firstarg="$1"
319 | if shift; then
320 | case "$firstarg" in
321 | *o*)
322 | firstarg=`echo "$firstarg" | sed s/o//`
323 | tar "$firstarg" "$@" && exit 0
324 | ;;
325 | esac
326 | case "$firstarg" in
327 | *h*)
328 | firstarg=`echo "$firstarg" | sed s/h//`
329 | tar "$firstarg" "$@" && exit 0
330 | ;;
331 | esac
332 | fi
333 |
334 | echo 1>&2 "\
335 | WARNING: I can't seem to be able to run \`tar' with the given arguments.
336 | You may want to install GNU tar or Free paxutils, or check the
337 | command line arguments."
338 | exit 1
339 | ;;
340 |
341 | *)
342 | echo 1>&2 "\
343 | WARNING: \`$1' is needed, and is $msg.
344 | You might have modified some files without having the
345 | proper tools for further handling them. Check the \`README' file,
346 | it often tells you about the needed prerequisites for installing
347 | this package. You may also peek at any GNU archive site, in case
348 | some other package would contain this missing \`$1' program."
349 | exit 1
350 | ;;
351 | esac
352 |
353 | exit 0
354 |
355 | # Local variables:
356 | # eval: (add-hook 'write-file-hooks 'time-stamp)
357 | # time-stamp-start: "scriptversion="
358 | # time-stamp-format: "%:y-%02m-%02d.%02H"
359 | # time-stamp-end: "$"
360 | # End:
361 |
--------------------------------------------------------------------------------
/regexp/mysql.m4:
--------------------------------------------------------------------------------
1 | dnl
2 | dnl configure.in helper macros
3 | dnl
4 |
5 | dnl TODO: fix "mutual exclusive" stuff
6 |
7 | dnl 3rd party macro for version number comparisons
8 | m4_include([ax_compare_version.m4])
9 |
10 | MYSQL_VERSION=none
11 |
12 | dnl check for a --with-mysql configure option and set up
13 | dnl MYSQL_CONFIG and MYSLQ_VERSION variables for further use
14 | dnl this must always be called before any other macro from this file
15 | dnl
16 | dnl WITH_MYSQL()
17 | dnl
18 | AC_DEFUN([WITH_MYSQL], [
19 | AC_MSG_CHECKING(for mysql_config executable)
20 |
21 | # try to find the mysql_config script,
22 | # --with-mysql will either accept its path directly
23 | # or will treat it as the mysql install prefix and will
24 | # search for the script in there
25 | # if no path is given at all we look for the script in
26 | # /usr/bin and /usr/local/mysql/bin
27 | AC_ARG_WITH(mysql, [ --with-mysql=PATH path to mysql_config binary or mysql prefix dir], [
28 | if test $withval = "no"
29 | then
30 | MYSQL_CONFIG="no"
31 | else
32 | if test -x $withval -a -f $withval
33 | then
34 | MYSQL_CONFIG=$withval
35 | MYSQL_PREFIX=`dirname \`dirname $withval\``
36 | elif test -x $withval/bin/mysql_config -a -f $withval/bin/mysql_config
37 | then
38 | MYSQL_CONFIG=$withval/bin/mysql_config
39 | MYSQL_PREFIX=$withval
40 | fi
41 | fi
42 | ], [
43 | # implicit "yes", check in $PATH and in known default prefix,
44 | # but only if source not already configured
45 | if test "x$MYSQL_SRCDIR" != "x"
46 | then
47 | MYSQL_CONFIG="no"
48 | elif MYSQL_CONFIG=`which mysql_config`
49 | then
50 | MYSQL_PREFIX=`dirname \`dirname $MYSQL_CONFIG\``
51 | elif test -x /usr/local/mysql/bin/mysql_config -a -f /usr/local/mysql/bin/mysql_config
52 | then
53 | MYSQL_CONFIG=/usr/local/mysql/bin/mysql_config
54 | MYSQL_PREFIX=/usr/local/mysql
55 | fi
56 | ])
57 |
58 | if test "x$MYSQL_CONFIG" = "x"
59 | then
60 | AC_MSG_ERROR([not found])
61 | elif test "$MYSQL_CONFIG" = "no"
62 | then
63 | MYSQL_CONFIG=""
64 | MYSQL_PREFIX=""
65 | AC_MSG_RESULT([no])
66 | else
67 | if test "x$MYSQL_SRCDIR" != "x"
68 | then
69 | AC_MSG_ERROR("--with-mysql can't be used together with --with-mysql-src")
70 | else
71 | # get installed version
72 | MYSQL_VERSION=`$MYSQL_CONFIG --version`
73 |
74 | MYSQL_CONFIG_INCLUDE=`$MYSQL_CONFIG --include`
75 | MYSQL_CONFIG_LIBS_R=`$MYSQL_CONFIG --libs_r`
76 |
77 | MYSQL_CLIENT=`dirname $MYSQL_CONFIG`/mysql
78 |
79 | AC_MSG_RESULT($MYSQL_CONFIG)
80 | fi
81 | fi
82 | ])
83 |
84 |
85 |
86 | dnl check for a --with-mysql-src configure option and set up
87 | dnl MYSQL_CONFIG and MYSLQ_VERSION variables for further use
88 | dnl this must always be called before any other macro from this file
89 | dnl
90 | dnl if you use this together with WITH_MYSQL you have to put this in front of it
91 | dnl
92 | dnl WITH_MYSQL_SRC()
93 | dnl
94 | AC_DEFUN([WITH_MYSQL_SRC], [
95 | AC_MSG_CHECKING(for mysql source directory)
96 |
97 | AC_ARG_WITH(mysql-src, [ --with-mysql-src=PATH path to mysql sourcecode], [
98 | if test "x$MYSQL_CONFIG" != "x"
99 | then
100 | AC_MSG_ERROR([--with-mysql-src can't be used together with --with-mysql])
101 | fi
102 |
103 | if test -f $withval/include/mysql_version.h.in
104 | then
105 | if test -f $withval/include/mysql_version.h
106 | then
107 | AC_MSG_RESULT(ok)
108 | MYSQL_SRCDIR=$withval
109 | MYSQL_VERSION=`grep MYSQL_SERVER_VERSION $MYSQL_SRCDIR/include/mysql_version.h | sed -e's/"$//g' -e's/.*"//g'`
110 | else
111 | AC_MSG_ERROR([not configured yet])
112 | fi
113 | else
114 | AC_MSG_ERROR([$withval doesn't look like a mysql source dir])
115 | fi
116 | ], [
117 | AC_MSG_RESULT(no)
118 | ])
119 |
120 | if test "x$MYSQL_SRCDIR" != "x"
121 | then
122 | MYSQL_CONFIG_INCLUDE="-I$MYSQL_SRCDIR/include -I$MYSQL_SRCDIR -I$MYSQL_SRCDIR/sql "
123 | MYSQL_CONFIG_LIBS_R="-L$MYSQL_SRCDIR/libmysql_r/.libs -lmysqlclient_r -lz -lm"
124 | fi
125 | ])
126 |
127 |
128 | dnl
129 | dnl check for successfull mysql detection
130 | dnl and register AC_SUBST variables
131 | dnl
132 | dnl MYSQL_SUBST()
133 | dnl
134 | AC_DEFUN([MYSQL_SUBST], [
135 | if test "$MYSQL_VERSION" = "none"
136 | then
137 | AC_MSG_ERROR([MySQL required but not found])
138 | fi
139 |
140 | # register replacement vars, these will be filled
141 | # with contant by the other macros
142 | AC_SUBST([MYSQL_CFLAGS])
143 | AC_SUBST([MYSQL_CXXFLAGS])
144 | AC_SUBST([MYSQL_LDFLAGS])
145 | AC_SUBST([MYSQL_LIBS])
146 | AC_SUBST([MYSQL_VERSION])
147 | ])
148 |
149 |
150 | dnl check if current MySQL version meets a version requirement
151 | dnl and act accordingly
152 | dnl
153 | dnl MYSQL_CHECK_VERSION([requested_version],[yes_action],[no_action])
154 | dnl
155 | AC_DEFUN([MYSQL_CHECK_VERSION], [
156 | AX_COMPARE_VERSION([$MYSQL_VERSION], [GE], [$1], [$2], [$3])
157 | ])
158 |
159 |
160 |
161 | dnl check if current MySQL version meets a version requirement
162 | dnl and bail out with an error message if not
163 | dnl
164 | dnl MYSQL_NEED_VERSION([need_version])
165 | dnl
166 | AC_DEFUN([MYSQL_NEED_VERSION], [
167 | AC_MSG_CHECKING([mysql version >= $1])
168 | MYSQL_CHECK_VERSION([$1],
169 | [AC_MSG_RESULT([yes ($MYSQL_VERSION)])],
170 | [AC_MSG_ERROR([no ($MYSQL_VERSION)])])
171 | ])
172 |
173 |
174 |
175 | dnl check whether the installed server was compiled with libdbug
176 | dnl
177 | dnl TODO we also need to figure out whether we need to define
178 | dnl SAFEMALLOC, maybe PEDANTIC_SAFEMALLOC and SAFE_MUTEX, too
179 | dnl else we may run into errors like
180 | dnl
181 | dnl Can't open shared library '...'
182 | dnl (errno: 22 undefined symbol: my_no_flags_free)
183 | dnl
184 | dnl on loading plugins
185 | dnl
186 | dnl MYSQL_DEBUG_SERVER()
187 | dnl
188 | AC_DEFUN([MYSQL_DEBUG_SERVER], [
189 | AC_MSG_CHECKING(for mysqld debug version)
190 |
191 | MYSQL_DBUG=unknown
192 |
193 | OLD_CFLAGS=$CFLAGS
194 | CFLAGS="$CFLAGS $MYSQL_CONFIG_INCLUDE"
195 | OLD_CXXFLAGS=$CXXFLAGS
196 | CXXFLAGS="$CXXFLAGS $MYSQL_CONFIG_INCLUDE"
197 | # check for DBUG_ON/OFF being defined in my_config.h
198 | AC_TRY_COMPILE(,[
199 | #include "my_config.h"
200 | #ifdef DBUG_ON
201 | int ok;
202 | #else
203 | # ifdef DBUG_OFF
204 | int ok;
205 | # else
206 | choke me
207 | # endif
208 | #endif
209 | ],AS_VAR_SET(MYSQL_DBUG, ["defined by header file"]),AS_VAR_SET(MYSQL_DBUG, unknown))
210 | CFLAGS=$OLD_CFLAGS
211 | CXXFLAGS=$OLD_CXXFLAGS
212 |
213 |
214 | if test "$MYSQL_DBUG" = "unknown"
215 | then
216 | # fallback: need to check mysqld binary itself
217 | # check $prefix/libexec, $prefix/sbin, $prefix/bin in that order
218 | for dir in libexec sbin bin
219 | do
220 | MYSQLD=$MYSQL_PREFIX/$dir/mysqld
221 | if test -f $MYSQLD -a -x $MYSQLD
222 | then
223 | if ($MYSQLD --help --verbose | grep -q -- "--debug")
224 | then
225 | AC_DEFINE([DBUG_ON], [1], [Use libdbug])
226 | MYSQL_DBUG=yes
227 | else
228 | AC_DEFINE([DBUG_OFF], [1], [Don't use libdbug])
229 | MYSQL_DBUG=no
230 | fi
231 | break;
232 | fi
233 | done
234 | fi
235 |
236 | if test "$MYSQL_DBUG" = "unknown"
237 | then
238 | # still unknown? make sure not to use it then
239 | AC_DEFINE([DBUG_OFF], [1], [Don't use libdbug])
240 | MYSQL_DBUG="unknown, assuming no"
241 | fi
242 |
243 | AC_MSG_RESULT($MYSQL_DBUG)
244 | #
245 | ])
246 |
247 |
248 |
249 | dnl set up variables for compilation of regular C API applications
250 | dnl with optional embedded server
251 | dnl
252 | dnl MYSQL_USE_CLIENT_API()
253 | dnl
254 | AC_DEFUN([MYSQL_USE_CLIENT_API], [
255 | # add regular MySQL C flags
256 | ADDFLAGS=$MYSQL_CONFIG_INCLUDE
257 |
258 | MYSQL_CFLAGS="$MYSQL_CFLAGS $ADDFLAGS"
259 | MYSQL_CXXFLAGS="$MYSQL_CXXFLAGS $ADDFLAGS"
260 |
261 | # add linker flags for client lib
262 | AC_ARG_ENABLE([embedded-mysql], [ --enable-embedded-mysql enable the MySQL embedded server feature],
263 | [MYSQL_EMBEDDED_LDFLAGS()],
264 | [MYSQL_LDFLAGS="$MYSQL_LDFLAGS $MYSQL_CONFIG_LIBS_R"])
265 | ])
266 |
267 |
268 |
269 | dnl set up variables for compilation of regular C API applications
270 | dnl with mandatory embedded server
271 | dnl
272 | dnl MYSQL_USE_EMBEDDED_API()
273 | dnl
274 | AC_DEFUN([MYSQL_USE_EMBEDDED_API], [
275 | # add regular MySQL C flags
276 | ADDFLAGS=$MYSQL_CONFIG_INCLUDE
277 |
278 | MYSQL_CFLAGS="$MYSQL_CFLAGS $ADDFLAGS"
279 | MYSQL_CXXFLAGS="$MYSQL_CXXFLAGS $ADDFLAGS"
280 |
281 | MYSQL_EMBEDDED_LDFLAGS()
282 | ])
283 |
284 |
285 | dnl
286 | AC_DEFUN([MYSQL_EMBEDDED_LDFLAGS], [
287 | MYSQL_LDFLAGS="$MYSQL_LDFLAGS "`$MYSQL_CONFIG --libmysqld-libs`
288 |
289 | AC_MSG_CHECKING([for missing libs])
290 | OLD_CFLAGS=$CFLAGS
291 | OLD_LIBS=$LIBS
292 | CFLAGS="$CFLAGS $MYSQL_CFLAGS"
293 | for MISSING_LIBS in " " "-lz" "-lssl" "-lz -lssl"
294 | do
295 | LIBS="$OLD_LIBS $MYSQL_LDFLAGS $MISSING_LIBS"
296 | AC_TRY_LINK([
297 | #include
298 | #include
299 | ],[
300 | mysql_server_init(0, NULL, NULL);
301 | ], [
302 | LINK_OK=yes
303 | ], [
304 | LINK_OK=no
305 | ])
306 | if test $LINK_OK = "yes"
307 | then
308 | MYSQL_LDFLAGS="$MYSQL_LDFLAGS $MISSING_LIBS"
309 | AC_MSG_RESULT([$MISSING_LIBS])
310 | break;
311 | fi
312 | done
313 | if test $LINK_OK = "no"
314 | then
315 | AC_MSG_ERROR([linking still fails])
316 | fi
317 |
318 | LIBS=$OLD_LIBS
319 | CFLAGS=$OLD_CFLAGS
320 | ])
321 |
322 |
323 |
324 |
325 | dnl set up variables for compilation of NDBAPI applications
326 | dnl
327 | dnl MYSQL_USE_NDB_API()
328 | dnl
329 | AC_DEFUN([MYSQL_USE_NDB_API], [
330 | MYSQL_USE_CLIENT_API()
331 | AC_PROG_CXX
332 | MYSQL_CHECK_VERSION([5.0.0],[
333 |
334 | # mysql_config results need some post processing for now
335 |
336 | # the include pathes changed in 5.1.x due
337 | # to the pluggable storage engine clenups,
338 | # it also dependes on whether we build against
339 | # mysql source or installed headers
340 | if test "x$MYSQL_SRCDIR" = "x"
341 | then
342 | IBASE=$MYSQL_CONFIG_INCLUDE
343 | else
344 | IBASE=$MYSQL_SRCDIR
345 | fi
346 | MYSQL_CHECK_VERSION([5.1.0], [
347 | IBASE="$IBASE/storage/ndb"
348 | ],[
349 | IBASE="$IBASE/ndb"
350 | ])
351 | if test "x$MYSQL_SRCDIR" != "x"
352 | then
353 | IBASE="$MYSQL_SRCDIR/include"
354 | fi
355 |
356 | # add the ndbapi specifc include dirs
357 | ADDFLAGS="$ADDFLAGS $IBASE"
358 | ADDFLAGS="$ADDFLAGS $IBASE/ndbapi"
359 | ADDFLAGS="$ADDFLAGS $IBASE/mgmapi"
360 |
361 | MYSQL_CFLAGS="$MYSQL_CFLAGS $ADDFLAGS"
362 | MYSQL_CXXFLAGS="$MYSQL_CXXFLAGS $ADDFLAGS"
363 |
364 | # check for ndbapi header file NdbApi.hpp
365 | AC_LANG_PUSH(C++)
366 | OLD_CXXFLAGS=$CXXFLAGS
367 | CXXFLAGS="$CXXFLAGS $MYSQL_CXXFLAGS"
368 | AC_CHECK_HEADER([NdbApi.hpp],,[AC_ERROR(["Can't find NdbApi header files"])])
369 | CXXFLAGS=$OLD_CXXFLAGS
370 | AC_LANG_POP()
371 |
372 | # check for the ndbapi client library
373 | AC_LANG_PUSH(C++)
374 | OLD_LIBS=$LIBS
375 | LIBS="$LIBS $MYSQL_LIBS -lmysys -lmystrings"
376 | OLD_LDFLAGS=$LDFLAGS
377 | LDFLAGS="$LDFLAGS $MYSQL_LDFLAGS"
378 | AC_CHECK_LIB([ndbclient],[ndb_init],,[AC_ERROR(["Can't find NdbApi client lib"])])
379 | LIBS=$OLD_LIBS
380 | LDFLAGS=$OLD_LDFLAGS
381 | AC_LANG_POP()
382 |
383 | # add the ndbapi specific static libs
384 | MYSQL_LIBS="$MYSQL_LIBS -lndbclient -lmysys -lmystrings "
385 |
386 | ],[
387 | AC_ERROR(["NdbApi needs at lest MySQL 5.0"])
388 | ])
389 | ])
390 |
391 |
392 |
393 | dnl set up variables for compilation of UDF extensions
394 | dnl
395 | dnl MYSQL_USE_UDF_API()
396 | dnl
397 | AC_DEFUN([MYSQL_USE_UDF_API], [
398 | # add regular MySQL C flags
399 | ADDFLAGS=$MYSQL_CONFIG_INCLUDE
400 |
401 | MYSQL_CFLAGS="$MYSQL_CFLAGS $ADDFLAGS"
402 | MYSQL_CXXFLAGS="$MYSQL_CXXFLAGS $ADDFLAGS"
403 |
404 | MYSQL_DEBUG_SERVER()
405 | ])
406 |
407 |
408 |
409 | dnl set up variables for compilation of plugins
410 | dnl
411 | dnl MYSQL_USE_PLUGIN_API()
412 | dnl
413 | AC_DEFUN([MYSQL_USE_PLUGIN_API], [
414 | # plugin interface is only availabe starting with MySQL 5.1
415 | MYSQL_NEED_VERSION([5.1.0])
416 |
417 | # for plugins the recommended way to include plugin.h
418 | # is , not , so we have to
419 | # strip thetrailing /mysql from the include paht
420 | # reported by mysql_config
421 | ADDFLAGS=`echo $MYSQL_CONFIG_INCLUDE | sed -e"s/\/mysql\$//g"`
422 |
423 | MYSQL_CFLAGS="$ADDFLAGS $MYSQL_CONFIG_INCLUDE $MYSQL_CFLAGS -DMYSQL_DYNAMIC_PLUGIN"
424 |
425 | MYSQL_CXXFLAGS="$ADDFLAGS $MYSQL_CONFIG_INCLUDE $MYSQL_CXXFLAGS -DMYSQL_DYNAMIC_PLUGIN"
426 | MYSQL_CXXFLAGS="$MYSQL_CXXFLAGS -fno-implicit-templates -fno-exceptions -fno-rtti"
427 |
428 | MYSQL_DEBUG_SERVER()
429 | ])
430 |
431 |
432 |
--------------------------------------------------------------------------------
/regexp/regexp.c:
--------------------------------------------------------------------------------
1 | /*
2 | +----------------------------------------------------------------------+
3 | | This program is free software; you can redistribute it and/or |
4 | | modify it under the terms of the GNU General Public License |
5 | | as published by the Free Software Foundation; either version 2 |
6 | | of the License, or (at your option) any later version. |
7 | | |
8 | | This program is distributed in the hope that it will be useful, |
9 | | but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
11 | | GNU General Public License for more details. |
12 | | |
13 | | You should have received a copy of the GNU General General Public |
14 | | License in the file LICENSE along with this library; |
15 | | if not, write to the |
16 | | |
17 | | Free Software Foundation, Inc., |
18 | | 59 Temple Place, Suite 330, |
19 | | Boston, MA 02111-1307 USA |
20 | +----------------------------------------------------------------------+
21 | | Authors: Hartmut Holzgraefe |
22 | +----------------------------------------------------------------------+
23 | */
24 |
25 | /* $ Id: $ */
26 |
27 | // {{{ CREATE and DROP statements for this UDF
28 |
29 | /*
30 | register the functions provided by this UDF module using
31 | CREATE FUNCTION regexp_like RETURNS INTEGER SONAME "regexp.so";
32 | CREATE FUNCTION regexp_substr RETURNS STRING SONAME "regexp.so";
33 | CREATE FUNCTION regexp_instr RETURNS INTEGER SONAME "regexp.so";
34 | CREATE FUNCTION regexp_replace RETURNS STRING SONAME "regexp.so";
35 |
36 | unregister the functions provided by this UDF module using
37 | DROP FUNCTION regexp_like;
38 | DROP FUNCTION regexp_substr;
39 | DROP FUNCTION regexp_instr;
40 | DROP FUNCTION regexp_replace;
41 | */
42 | // }}}
43 |
44 | // {{{ standard header stuff
45 | #ifdef STANDARD
46 | #include
47 | #include
48 | #ifdef __WIN__
49 | typedef unsigned __int64 ulonglong; /* Microsofts 64 bit types */
50 | typedef __int64 longlong;
51 | #else
52 | typedef unsigned long long ulonglong;
53 | typedef long long longlong;
54 | #endif /*__WIN__*/
55 | #else
56 | #include
57 | #include
58 | #endif
59 | #include
60 | #include
61 | #include // To get strmov()
62 |
63 | // }}}
64 |
65 | #ifdef HAVE_DLOPEN
66 |
67 | #include "udf_regexp.h"
68 |
69 | // {{{ prototypes
70 |
71 | #ifdef __cplusplus
72 | extern "C" {
73 | #endif
74 | /* FUNCTION regexp_like */
75 | my_bool regexp_like_init(UDF_INIT *initid, UDF_ARGS *args, char *message);
76 | long long regexp_like(UDF_INIT *initid, UDF_ARGS *args, char *is_null, char *error);
77 | void regexp_like_deinit(UDF_INIT *initid);
78 |
79 | /* FUNCTION regexp_substr */
80 | my_bool regexp_substr_init(UDF_INIT *initid, UDF_ARGS *args, char *message);
81 | char * regexp_substr(UDF_INIT *initid, UDF_ARGS *args, char *result, unsigned long *length, char *is_null, char *error);
82 | void regexp_substr_deinit(UDF_INIT *initid);
83 |
84 | /* FUNCTION regexp_instr */
85 | my_bool regexp_instr_init(UDF_INIT *initid, UDF_ARGS *args, char *message);
86 | long long regexp_instr(UDF_INIT *initid, UDF_ARGS *args, char *is_null, char *error);
87 | void regexp_instr_deinit(UDF_INIT *initid);
88 |
89 | /* FUNCTION regexp_replace */
90 | my_bool regexp_replace_init(UDF_INIT *initid, UDF_ARGS *args, char *message);
91 | char * regexp_replace(UDF_INIT *initid, UDF_ARGS *args, char *result, unsigned long *length, char *is_null, char *error);
92 | void regexp_replace_deinit(UDF_INIT *initid);
93 |
94 | #ifdef __cplusplus
95 | }
96 | #endif
97 | // }}}
98 |
99 | // {{{ UDF functions
100 |
101 | // {{{ FUNCTION regexp_like RETURNS INTEGER
102 | struct regexp_like_t {
103 | my_regex_t expr;
104 | int dynamic;
105 | };
106 |
107 | /* regexp_like init function */
108 | my_bool regexp_like_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
109 | {
110 | DBUG_ENTER("regexp::regexp_like_init");
111 | struct regexp_like_t *data = (struct regexp_like_t *)calloc(sizeof(struct regexp_like_t), 1);
112 |
113 | char *text = NULL;
114 | long long text_len = 0;
115 | int text_is_null = 1;
116 | char *pattern = NULL;
117 | long long pattern_len = 0;
118 | int pattern_is_null = 1;
119 | char *mode = NULL;
120 | long long mode_len = 0;
121 | int mode_is_null = 1;
122 |
123 | text_is_null = (args->args[0]==NULL);
124 | text = (char *)args->args[0];
125 | text_len = (args->args[0] == NULL) ? 0 : args->lengths[0];
126 | pattern_is_null = (args->args[1]==NULL);
127 | pattern = (char *)args->args[1];
128 | pattern_len = (args->args[1] == NULL) ? 0 : args->lengths[1];
129 | if (args->arg_count > 2) {
130 | mode_is_null = (args->args[2]==NULL);
131 | mode = (char *)args->args[2];
132 | mode_len = (args->args[2] == NULL) ? 0 : args->lengths[2];
133 | }
134 | if (!data) {
135 | strcpy(message, "out of memory in regexp_like()");
136 | DBUG_RETURN(1);
137 | }
138 |
139 | initid->ptr = (char *)data;
140 |
141 | initid->maybe_null = 1;
142 |
143 | if ((args->arg_count < 2) || (args->arg_count > 3)) {
144 | strcpy(message,"wrong number of parameters for regexp_like()");
145 | DBUG_RETURN(1);
146 | }
147 | args->arg_type[0] = STRING_RESULT;
148 | args->arg_type[1] = STRING_RESULT;
149 | if (args->arg_count > 2) args->arg_type[2] = STRING_RESULT;
150 |
151 | do {
152 | if (pattern) {
153 | // static regex pattern -> we can compile it once and reuse it
154 | int stat;
155 | char *copy;
156 |
157 | // we have to make sure we have a NUL terminated C string
158 | // as argument for my_regcomp
159 | copy = strndup(pattern, pattern_len);
160 | stat = my_regcomp(&data->expr, copy, parse_mode(mode, mode_len), &my_charset_latin1);
161 | free(copy);
162 |
163 | if (stat) {
164 | sprintf(message, "regcomp failed (error: %d)", stat);
165 | return 1;
166 | }
167 |
168 | data->dynamic = 0;
169 | } else {
170 | data->dynamic = 1;
171 | }
172 | } while (0);
173 |
174 | DBUG_RETURN(0);
175 | }
176 |
177 | /* regexp_like deinit function */
178 | void regexp_like_deinit(UDF_INIT *initid)
179 | {
180 | DBUG_ENTER("regexp::regexp_like_deinit");
181 | struct regexp_like_t *data = (struct regexp_like_t *)(initid->ptr);
182 |
183 | if (!data->dynamic) {
184 | // free static compiler pattern
185 | my_regfree(&data->expr);
186 | }
187 |
188 | if (initid->ptr) {
189 | free(initid->ptr);
190 | }
191 | DBUG_VOID_RETURN;
192 | }
193 |
194 | /* regexp_like actual processing function */
195 | long long regexp_like(UDF_INIT *initid, UDF_ARGS *args, char *is_null, char *error)
196 | {
197 | DBUG_ENTER("regexp::regexp_like");
198 | struct regexp_like_t *data = (struct regexp_like_t *)initid->ptr;
199 |
200 | char *text = NULL;
201 | long long text_len = 0;
202 | int text_is_null = 1;
203 | char *pattern = NULL;
204 | long long pattern_len = 0;
205 | int pattern_is_null = 1;
206 | char *mode = NULL;
207 | long long mode_len = 0;
208 | int mode_is_null = 1;
209 |
210 | text_is_null = (args->args[0]==NULL);
211 | text = (char *)args->args[0];
212 | text_len = (args->args[0] == NULL) ? 0 : args->lengths[0];
213 | pattern_is_null = (args->args[1]==NULL);
214 | pattern = (char *)args->args[1];
215 | pattern_len = (args->args[1] == NULL) ? 0 : args->lengths[1];
216 | if (args->arg_count > 2) {
217 | mode_is_null = (args->args[2]==NULL);
218 | mode = (char *)args->args[2];
219 | mode_len = (args->args[2] == NULL) ? 0 : args->lengths[2];
220 | }
221 | do {
222 | my_regmatch_t match;
223 | int stat;
224 | char *copy;
225 |
226 | if (data->dynamic) {
227 | copy = strndup(pattern, pattern_len);
228 | stat = my_regcomp(&data->expr, copy, parse_mode(mode, mode_len), &my_charset_latin1);
229 | free(copy);
230 | if (stat) {
231 | // TODO: need ERROR() and WARNING() macro
232 | RETURN_NULL;
233 | }
234 | }
235 |
236 | copy = strndup(text, text_len);
237 | stat = my_regexec(&data->expr, copy, 1, &match, 0);
238 | free(copy);
239 |
240 | if (data->dynamic) {
241 | my_regfree(&data->expr);
242 | }
243 |
244 | if (stat && (stat != REG_NOMATCH)) {
245 | fprintf(stderr, "regexec error %d '%s' '%s'\n", stat, pattern, text);
246 | RETURN_NULL;
247 | }
248 |
249 | RETURN_INT(stat == REG_NOMATCH ? 0 : 1);
250 | } while (0);
251 | }
252 |
253 | // }}}
254 |
255 | // {{{ FUNCTION regexp_substr RETURNS STRING
256 | struct regexp_substr_t {
257 | char * _resultbuf;
258 | unsigned long _resultbuf_len;
259 | my_regex_t expr;
260 | int dynamic;
261 | };
262 |
263 | /* regexp_substr init function */
264 | my_bool regexp_substr_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
265 | {
266 | DBUG_ENTER("regexp::regexp_substr_init");
267 | struct regexp_substr_t *data = (struct regexp_substr_t *)calloc(sizeof(struct regexp_substr_t), 1);
268 |
269 | char *text = NULL;
270 | long long text_len = 0;
271 | int text_is_null = 1;
272 | char *pattern = NULL;
273 | long long pattern_len = 0;
274 | int pattern_is_null = 1;
275 | long long position = 1;
276 | int position_is_null = 0;
277 | long long occurence = 1;
278 | int occurence_is_null = 0;
279 | char *mode = "c";
280 | long long mode_len = 1;
281 | int mode_is_null = 0;
282 |
283 | text_is_null = (args->args[0]==NULL);
284 | text = (char *)args->args[0];
285 | text_len = (args->args[0] == NULL) ? 0 : args->lengths[0];
286 | pattern_is_null = (args->args[1]==NULL);
287 | pattern = (char *)args->args[1];
288 | pattern_len = (args->args[1] == NULL) ? 0 : args->lengths[1];
289 | if (args->arg_count > 2) {
290 | position_is_null = (args->args[2]==NULL);
291 | position = (args->args[2] == NULL) ? 0 : *((long long *)args->args[2]);
292 | }
293 | if (args->arg_count > 3) {
294 | occurence_is_null = (args->args[3]==NULL);
295 | occurence = (args->args[3] == NULL) ? 0 : *((long long *)args->args[3]);
296 | }
297 | if (args->arg_count > 4) {
298 | mode_is_null = (args->args[4]==NULL);
299 | mode = (char *)args->args[4];
300 | mode_len = (args->args[4] == NULL) ? 0 : args->lengths[4];
301 | }
302 | if (!data) {
303 | strcpy(message, "out of memory in regexp_substr()");
304 | DBUG_RETURN(1);
305 | }
306 |
307 | data->_resultbuf = NULL;
308 | data->_resultbuf_len = 0L;
309 | initid->ptr = (char *)data;
310 |
311 | initid->maybe_null = 1;
312 | initid->max_length = 255;
313 |
314 | if ((args->arg_count < 2) || (args->arg_count > 5)) {
315 | strcpy(message,"wrong number of parameters for regexp_substr()");
316 | DBUG_RETURN(1);
317 | }
318 | args->arg_type[0] = STRING_RESULT;
319 | args->arg_type[1] = STRING_RESULT;
320 | if (args->arg_count > 2) args->arg_type[2] = INT_RESULT;
321 | if (args->arg_count > 3) args->arg_type[3] = INT_RESULT;
322 | if (args->arg_count > 4) args->arg_type[4] = STRING_RESULT;
323 |
324 | do {
325 | if (pattern) {
326 | // static regex pattern -> we can compile it once and reuse it
327 | int stat;
328 | char *copy;
329 |
330 | // we have to make sure we have a NUL terminated C string
331 | // as argument for my_regcomp
332 | copy = strndup(pattern, pattern_len);
333 | stat = my_regcomp(&data->expr, copy, parse_mode(mode, mode_len), &my_charset_latin1);
334 | free(copy);
335 |
336 | if (stat) {
337 | sprintf(message, "regcomp failed (error: %d)", stat);
338 | return 1;
339 | }
340 |
341 | data->dynamic = 0;
342 | } else {
343 | data->dynamic = 1;
344 | }
345 | } while (0);
346 |
347 | DBUG_RETURN(0);
348 | }
349 |
350 | /* regexp_substr deinit function */
351 | void regexp_substr_deinit(UDF_INIT *initid)
352 | {
353 | DBUG_ENTER("regexp::regexp_substr_deinit");
354 | struct regexp_substr_t *data = (struct regexp_substr_t *)(initid->ptr);
355 |
356 | if (!data->dynamic) {
357 | // free static compiler pattern
358 | my_regfree(&data->expr);
359 | }
360 |
361 | if (initid->ptr) {
362 | free(initid->ptr);
363 | }
364 | DBUG_VOID_RETURN;
365 | }
366 |
367 | /* regexp_substr actual processing function */
368 | char * regexp_substr(UDF_INIT *initid, UDF_ARGS *args, char *result, unsigned long *length, char *is_null, char *error)
369 | {
370 | DBUG_ENTER("regexp::regexp_substr");
371 | struct regexp_substr_t *data = (struct regexp_substr_t *)initid->ptr;
372 |
373 | char *text = NULL;
374 | long long text_len = 0;
375 | int text_is_null = 1;
376 | char *pattern = NULL;
377 | long long pattern_len = 0;
378 | int pattern_is_null = 1;
379 | long long position = 1;
380 | int position_is_null = 0;
381 | long long occurence = 1;
382 | int occurence_is_null = 0;
383 | char *mode = "c";
384 | long long mode_len = 1;
385 | int mode_is_null = 0;
386 |
387 | text_is_null = (args->args[0]==NULL);
388 | text = (char *)args->args[0];
389 | text_len = (args->args[0] == NULL) ? 0 : args->lengths[0];
390 | pattern_is_null = (args->args[1]==NULL);
391 | pattern = (char *)args->args[1];
392 | pattern_len = (args->args[1] == NULL) ? 0 : args->lengths[1];
393 | if (args->arg_count > 2) {
394 | position_is_null = (args->args[2]==NULL);
395 | position = (args->args[2] == NULL) ? 0 : *((long long *)args->args[2]);
396 | }
397 | if (args->arg_count > 3) {
398 | occurence_is_null = (args->args[3]==NULL);
399 | occurence = (args->args[3] == NULL) ? 0 : *((long long *)args->args[3]);
400 | }
401 | if (args->arg_count > 4) {
402 | mode_is_null = (args->args[4]==NULL);
403 | mode = (char *)args->args[4];
404 | mode_len = (args->args[4] == NULL) ? 0 : args->lengths[4];
405 | }
406 | do {
407 | my_regmatch_t match;
408 | int stat = 0;
409 | char *copy;
410 |
411 | if (occurence < 1) {
412 | RETURN_NULL;
413 | }
414 |
415 | if (position) {
416 | position -= 1; /* oracle offsets start at 1, not 0 */
417 | if (position >= text_len) {
418 | RETURN_NULL;
419 | }
420 | }
421 |
422 | if (data->dynamic) {
423 | copy = strndup(pattern, pattern_len);
424 | stat = my_regcomp(&data->expr, copy, parse_mode(mode, mode_len), &my_charset_latin1);
425 | free(copy);
426 | if (stat) {
427 | // TODO: need ERROR() and WARNING() macro
428 | RETURN_NULL;
429 | }
430 | }
431 |
432 | copy = strndup(text, text_len);
433 |
434 | while (occurence > 0) {
435 | stat = my_regexec(&data->expr, copy + position, 1, &match, 0);
436 | if (stat) {
437 | break;
438 | }
439 | if (--occurence) {
440 | position += match.rm_eo;
441 | }
442 | }
443 |
444 | free(copy);
445 |
446 | if (data->dynamic) {
447 | my_regfree(&data->expr);
448 | }
449 |
450 | if (stat) {
451 | if (stat != REG_NOMATCH) {
452 | fprintf(stderr, "regexec error %d '%s' '%s'\n", stat, pattern, text);
453 | }
454 | RETURN_NULL;
455 | }
456 |
457 | RETURN_STRINGL(text + position + match.rm_so, match.rm_eo - match.rm_so);
458 | } while (0);
459 | }
460 |
461 | // }}}
462 |
463 | // {{{ FUNCTION regexp_instr RETURNS INTEGER
464 | struct regexp_instr_t {
465 | my_regex_t expr;
466 | int dynamic;
467 | };
468 |
469 | /* regexp_instr init function */
470 | my_bool regexp_instr_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
471 | {
472 | DBUG_ENTER("regexp::regexp_instr_init");
473 | struct regexp_instr_t *data = (struct regexp_instr_t *)calloc(sizeof(struct regexp_instr_t), 1);
474 |
475 | char *text = NULL;
476 | long long text_len = 0;
477 | int text_is_null = 1;
478 | char *pattern = NULL;
479 | long long pattern_len = 0;
480 | int pattern_is_null = 1;
481 | long long position = 1;
482 | int position_is_null = 0;
483 | long long occurrence = 1;
484 | int occurrence_is_null = 0;
485 | long long return_end = 0;
486 | int return_end_is_null = 0;
487 | char *mode = "c";
488 | long long mode_len = 1;
489 | int mode_is_null = 0;
490 |
491 | text_is_null = (args->args[0]==NULL);
492 | text = (char *)args->args[0];
493 | text_len = (args->args[0] == NULL) ? 0 : args->lengths[0];
494 | pattern_is_null = (args->args[1]==NULL);
495 | pattern = (char *)args->args[1];
496 | pattern_len = (args->args[1] == NULL) ? 0 : args->lengths[1];
497 | if (args->arg_count > 2) {
498 | position_is_null = (args->args[2]==NULL);
499 | position = (args->args[2] == NULL) ? 0 : *((long long *)args->args[2]);
500 | }
501 | if (args->arg_count > 3) {
502 | occurrence_is_null = (args->args[3]==NULL);
503 | occurrence = (args->args[3] == NULL) ? 0 : *((long long *)args->args[3]);
504 | }
505 | if (args->arg_count > 4) {
506 | return_end_is_null = (args->args[4]==NULL);
507 | return_end = (args->args[4] == NULL) ? 0 : *((long long *)args->args[4]);
508 | }
509 | if (args->arg_count > 5) {
510 | mode_is_null = (args->args[5]==NULL);
511 | mode = (char *)args->args[5];
512 | mode_len = (args->args[5] == NULL) ? 0 : args->lengths[5];
513 | }
514 | if (!data) {
515 | strcpy(message, "out of memory in regexp_instr()");
516 | DBUG_RETURN(1);
517 | }
518 |
519 | initid->ptr = (char *)data;
520 |
521 | initid->maybe_null = 1;
522 |
523 | if ((args->arg_count < 2) || (args->arg_count > 6)) {
524 | strcpy(message,"wrong number of parameters for regexp_instr()");
525 | DBUG_RETURN(1);
526 | }
527 | args->arg_type[0] = STRING_RESULT;
528 | args->arg_type[1] = STRING_RESULT;
529 | if (args->arg_count > 2) args->arg_type[2] = INT_RESULT;
530 | if (args->arg_count > 3) args->arg_type[3] = INT_RESULT;
531 | if (args->arg_count > 4) args->arg_type[4] = INT_RESULT;
532 | if (args->arg_count > 5) args->arg_type[5] = STRING_RESULT;
533 |
534 | do {
535 | if (pattern) {
536 | // static regex pattern -> we can compile it once and reuse it
537 | int stat;
538 | char *copy;
539 |
540 | // we have to make sure we have a NUL terminated C string
541 | // as argument for my_regcomp
542 | copy = strndup(pattern, pattern_len);
543 | stat = my_regcomp(&data->expr, copy, parse_mode(mode, mode_len), &my_charset_latin1);
544 | free(copy);
545 |
546 | if (stat) {
547 | sprintf(message, "regcomp failed (error: %d)", stat);
548 | return 1;
549 | }
550 |
551 | data->dynamic = 0;
552 | } else {
553 | data->dynamic = 1;
554 | }
555 | } while (0);
556 |
557 | DBUG_RETURN(0);
558 | }
559 |
560 | /* regexp_instr deinit function */
561 | void regexp_instr_deinit(UDF_INIT *initid)
562 | {
563 | DBUG_ENTER("regexp::regexp_instr_deinit");
564 | struct regexp_instr_t *data = (struct regexp_instr_t *)(initid->ptr);
565 |
566 | if (!data->dynamic) {
567 | // free static compiler pattern
568 | my_regfree(&data->expr);
569 | }
570 |
571 | if (initid->ptr) {
572 | free(initid->ptr);
573 | }
574 | DBUG_VOID_RETURN;
575 | }
576 |
577 | /* regexp_instr actual processing function */
578 | long long regexp_instr(UDF_INIT *initid, UDF_ARGS *args, char *is_null, char *error)
579 | {
580 | DBUG_ENTER("regexp::regexp_instr");
581 | struct regexp_instr_t *data = (struct regexp_instr_t *)initid->ptr;
582 |
583 | char *text = NULL;
584 | long long text_len = 0;
585 | int text_is_null = 1;
586 | char *pattern = NULL;
587 | long long pattern_len = 0;
588 | int pattern_is_null = 1;
589 | long long position = 1;
590 | int position_is_null = 0;
591 | long long occurrence = 1;
592 | int occurrence_is_null = 0;
593 | long long return_end = 0;
594 | int return_end_is_null = 0;
595 | char *mode = "c";
596 | long long mode_len = 1;
597 | int mode_is_null = 0;
598 |
599 | text_is_null = (args->args[0]==NULL);
600 | text = (char *)args->args[0];
601 | text_len = (args->args[0] == NULL) ? 0 : args->lengths[0];
602 | pattern_is_null = (args->args[1]==NULL);
603 | pattern = (char *)args->args[1];
604 | pattern_len = (args->args[1] == NULL) ? 0 : args->lengths[1];
605 | if (args->arg_count > 2) {
606 | position_is_null = (args->args[2]==NULL);
607 | position = (args->args[2] == NULL) ? 0 : *((long long *)args->args[2]);
608 | }
609 | if (args->arg_count > 3) {
610 | occurrence_is_null = (args->args[3]==NULL);
611 | occurrence = (args->args[3] == NULL) ? 0 : *((long long *)args->args[3]);
612 | }
613 | if (args->arg_count > 4) {
614 | return_end_is_null = (args->args[4]==NULL);
615 | return_end = (args->args[4] == NULL) ? 0 : *((long long *)args->args[4]);
616 | }
617 | if (args->arg_count > 5) {
618 | mode_is_null = (args->args[5]==NULL);
619 | mode = (char *)args->args[5];
620 | mode_len = (args->args[5] == NULL) ? 0 : args->lengths[5];
621 | }
622 | do {
623 | my_regmatch_t match;
624 | int stat;
625 | char *copy;
626 |
627 | if (position) {
628 | position -= 1; /* oracle offsets start at 1, not 0 */
629 | if (position >= text_len) {
630 | RETURN_NULL;
631 | }
632 | }
633 |
634 | if (data->dynamic) {
635 | copy = strndup(pattern, pattern_len);
636 | stat = my_regcomp(&data->expr, copy, parse_mode(mode, mode_len), &my_charset_latin1);
637 | free(copy);
638 | if (stat) {
639 | // TODO: need ERROR() and WARNING() macro
640 | RETURN_NULL;
641 | }
642 | }
643 |
644 | copy = strndup(text, text_len);
645 | match.rm_eo = 0;
646 | do {
647 | position += match.rm_eo;
648 | stat = my_regexec(&data->expr, copy + (size_t)position, 1, &match, 0);
649 | } while ((stat == 0) && --occurrence > 0);
650 |
651 | free(copy);
652 |
653 | if (data->dynamic) {
654 | my_regfree(&data->expr);
655 | }
656 |
657 | if (stat) {
658 | fprintf(stderr, "regexec error %d '%s' '%s'\n", stat, pattern, text);
659 | RETURN_NULL;
660 | }
661 |
662 | RETURN_INT(position + (return_end ? match.rm_eo : match.rm_so + 1));
663 | } while (0);
664 | }
665 |
666 | // }}}
667 |
668 | // {{{ FUNCTION regexp_replace RETURNS STRING
669 | struct regexp_replace_t {
670 | char * _resultbuf;
671 | unsigned long _resultbuf_len;
672 | };
673 |
674 | /* regexp_replace init function */
675 | my_bool regexp_replace_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
676 | {
677 | DBUG_ENTER("regexp::regexp_replace_init");
678 | struct regexp_replace_t *data = (struct regexp_replace_t *)calloc(sizeof(struct regexp_replace_t), 1);
679 |
680 | char *text = NULL;
681 | long long text_len = 0;
682 | int text_is_null = 1;
683 | char *pattern = NULL;
684 | long long pattern_len = 0;
685 | int pattern_is_null = 1;
686 | char *replace = NULL;
687 | long long replace_len = 0;
688 | int replace_is_null = 1;
689 | long long position = 1;
690 | int position_is_null = 0;
691 | long long occurence = 0;
692 | int occurence_is_null = 0;
693 | char *mode = "c";
694 | long long mode_len = 1;
695 | int mode_is_null = 0;
696 |
697 | text_is_null = (args->args[0]==NULL);
698 | text = (char *)args->args[0];
699 | text_len = (args->args[0] == NULL) ? 0 : args->lengths[0];
700 | pattern_is_null = (args->args[1]==NULL);
701 | pattern = (char *)args->args[1];
702 | pattern_len = (args->args[1] == NULL) ? 0 : args->lengths[1];
703 | replace_is_null = (args->args[2]==NULL);
704 | replace = (char *)args->args[2];
705 | replace_len = (args->args[2] == NULL) ? 0 : args->lengths[2];
706 | if (args->arg_count > 3) {
707 | position_is_null = (args->args[3]==NULL);
708 | position = (args->args[3] == NULL) ? 0 : *((long long *)args->args[3]);
709 | }
710 | if (args->arg_count > 4) {
711 | occurence_is_null = (args->args[4]==NULL);
712 | occurence = (args->args[4] == NULL) ? 0 : *((long long *)args->args[4]);
713 | }
714 | if (args->arg_count > 5) {
715 | mode_is_null = (args->args[5]==NULL);
716 | mode = (char *)args->args[5];
717 | mode_len = (args->args[5] == NULL) ? 0 : args->lengths[5];
718 | }
719 | if (!data) {
720 | strcpy(message, "out of memory in regexp_replace()");
721 | DBUG_RETURN(1);
722 | }
723 |
724 | data->_resultbuf = NULL;
725 | data->_resultbuf_len = 0L;
726 | initid->ptr = (char *)data;
727 |
728 | initid->maybe_null = 1;
729 | initid->max_length = 255;
730 |
731 | if ((args->arg_count < 3) || (args->arg_count > 6)) {
732 | strcpy(message,"wrong number of parameters for regexp_replace()");
733 | DBUG_RETURN(1);
734 | }
735 | args->arg_type[0] = STRING_RESULT;
736 | args->arg_type[1] = STRING_RESULT;
737 | args->arg_type[2] = STRING_RESULT;
738 | if (args->arg_count > 3) args->arg_type[3] = INT_RESULT;
739 | if (args->arg_count > 4) args->arg_type[4] = INT_RESULT;
740 | if (args->arg_count > 5) args->arg_type[5] = STRING_RESULT;
741 |
742 | DBUG_RETURN(0);
743 | }
744 |
745 | /* regexp_replace deinit function */
746 | void regexp_replace_deinit(UDF_INIT *initid)
747 | {
748 | DBUG_ENTER("regexp::regexp_replace_deinit");
749 | struct regexp_replace_t *data = (struct regexp_replace_t *)(initid->ptr);
750 |
751 | if (initid->ptr) {
752 | free(initid->ptr);
753 | }
754 | DBUG_VOID_RETURN;
755 | }
756 |
757 | /* regexp_replace actual processing function */
758 | char * regexp_replace(UDF_INIT *initid, UDF_ARGS *args, char *result, unsigned long *length, char *is_null, char *error)
759 | {
760 | DBUG_ENTER("regexp::regexp_replace");
761 | struct regexp_replace_t *data = (struct regexp_replace_t *)initid->ptr;
762 |
763 | char *text = NULL;
764 | long long text_len = 0;
765 | int text_is_null = 1;
766 | char *pattern = NULL;
767 | long long pattern_len = 0;
768 | int pattern_is_null = 1;
769 | char *replace = NULL;
770 | long long replace_len = 0;
771 | int replace_is_null = 1;
772 | long long position = 1;
773 | int position_is_null = 0;
774 | long long occurence = 0;
775 | int occurence_is_null = 0;
776 | char *mode = "c";
777 | long long mode_len = 1;
778 | int mode_is_null = 0;
779 |
780 | text_is_null = (args->args[0]==NULL);
781 | text = (char *)args->args[0];
782 | text_len = (args->args[0] == NULL) ? 0 : args->lengths[0];
783 | pattern_is_null = (args->args[1]==NULL);
784 | pattern = (char *)args->args[1];
785 | pattern_len = (args->args[1] == NULL) ? 0 : args->lengths[1];
786 | replace_is_null = (args->args[2]==NULL);
787 | replace = (char *)args->args[2];
788 | replace_len = (args->args[2] == NULL) ? 0 : args->lengths[2];
789 | if (args->arg_count > 3) {
790 | position_is_null = (args->args[3]==NULL);
791 | position = (args->args[3] == NULL) ? 0 : *((long long *)args->args[3]);
792 | }
793 | if (args->arg_count > 4) {
794 | occurence_is_null = (args->args[4]==NULL);
795 | occurence = (args->args[4] == NULL) ? 0 : *((long long *)args->args[4]);
796 | }
797 | if (args->arg_count > 5) {
798 | mode_is_null = (args->args[5]==NULL);
799 | mode = (char *)args->args[5];
800 | mode_len = (args->args[5] == NULL) ? 0 : args->lengths[5];
801 | }
802 | do {
803 | char *c_pattern, *c_replace, *c_text;
804 | char *result;
805 |
806 | if (position) {
807 | position -= 1; /* oracle offsets start at 1, not 0 */
808 | if (position >= text_len) {
809 | RETURN_NULL;
810 | }
811 | }
812 |
813 | c_pattern = strndup(pattern, pattern_len);
814 | c_replace = strndup(replace, replace_len);
815 | c_text = strndup(text, text_len);
816 |
817 | result = my_regex_replace(c_pattern, c_replace, c_text, position, occurence, parse_mode(mode, mode_len));
818 |
819 | free(c_pattern);
820 | free(c_replace);
821 | free(c_text);
822 |
823 | if (result) {
824 | RETURN_STRING(result);
825 | } else {
826 | RETURN_NULL;
827 | }
828 | } while (0);
829 | }
830 |
831 | // }}}
832 |
833 | // }}}
834 |
835 | #else
836 | #error your installation does not support loading UDFs
837 | #endif /* HAVE_DLOPEN */
838 |
839 | /*
840 | * Local variables:
841 | * tab-width: 4
842 | * c-basic-offset: 4
843 | * End:
844 | * vim600: noet sw=4 ts=4 fdm=marker
845 | * vim<600: noet sw=4 ts=4
846 | */
847 |
--------------------------------------------------------------------------------
/regexp/tests/create_functions.inc:
--------------------------------------------------------------------------------
1 | -- disable_warnings
2 | --error 0, 1128, 1305
3 | DROP FUNCTION regexp_like;
4 | CREATE FUNCTION regexp_like RETURNS INTEGER SONAME "regexp.so";
5 | --error 0, 1128, 1305
6 | DROP FUNCTION regexp_substr;
7 | CREATE FUNCTION regexp_substr RETURNS STRING SONAME "regexp.so";
8 | --error 0, 1128, 1305
9 | DROP FUNCTION regexp_instr;
10 | CREATE FUNCTION regexp_instr RETURNS INTEGER SONAME "regexp.so";
11 | --error 0, 1128, 1305
12 | DROP FUNCTION regexp_replace;
13 | CREATE FUNCTION regexp_replace RETURNS STRING SONAME "regexp.so";
14 | -- enable_warnings
15 |
--------------------------------------------------------------------------------
/regexp/tests/drop_functions.inc:
--------------------------------------------------------------------------------
1 | DROP FUNCTION regexp_like;
2 | DROP FUNCTION regexp_substr;
3 | DROP FUNCTION regexp_instr;
4 | DROP FUNCTION regexp_replace;
5 |
--------------------------------------------------------------------------------
/regexp/tests/r/regexp_instr.result:
--------------------------------------------------------------------------------
1 | r1
2 | 17
3 | r1
4 | 6
5 | r2
6 | 6
7 | r3
8 | 15
9 | r1
10 | 6
11 | r2
12 | 15
13 | r3
14 | 24
15 | r4
16 | NULL
17 | r1
18 | 17
19 | r2
20 | 19
21 | r3
22 | 19
23 |
--------------------------------------------------------------------------------
/regexp/tests/r/regexp_like.result:
--------------------------------------------------------------------------------
1 | r1
2 | 1
3 | r2
4 | 0
5 | r3
6 | 0
7 | r4
8 | 1
9 | r1
10 | 1
11 | r2
12 | 0
13 | r3
14 | 1
15 |
--------------------------------------------------------------------------------
/regexp/tests/r/regexp_replace.result:
--------------------------------------------------------------------------------
1 | r1
2 | lala bar lala
3 | r2
4 | lala bar lala bar lalala
5 | r3
6 | lala bar lala bar lalala
7 | r4
8 | lala foo lala bar lalala
9 | r5
10 | lala bar lala bar lalala
11 | r6
12 | lala bar lala foo lalala
13 | r7
14 | lala foo lala bar lalala
15 |
--------------------------------------------------------------------------------
/regexp/tests/r/regexp_substr.result:
--------------------------------------------------------------------------------
1 | r1
2 | 123
3 | r2
4 | 123
5 | r3
6 | 23
7 | r4
8 | NULL
9 | r5
10 | 123
11 | r6
12 | 456
13 | r7
14 | abc
15 | r8
16 | ABC
17 | r9
18 | abc
19 | r10
20 | ABC
21 | r11
22 | abc
23 | r12
24 | NULL
25 | r13
26 | NULL
27 | r14
28 | ABC
29 |
--------------------------------------------------------------------------------
/regexp/tests/t/regexp_instr.test:
--------------------------------------------------------------------------------
1 | # Package: regexp Test: regexp_instr
2 | #
3 | #
4 |
5 | -- disable_query_log
6 | -- disable_metadata
7 |
8 | -- source create_functions.inc
9 |
10 | -- simple match
11 | SELECT REGEXP_INSTR("the quick brown fox jumps ...", "fox") AS r1;
12 | -- checking position parameter
13 | SELECT REGEXP_INSTR("lala abc lala abc lala", "abc") AS r1;
14 | SELECT REGEXP_INSTR("lala abc lala abc lala", "abc", 6) AS r2;
15 | SELECT REGEXP_INSTR("lala abc lala abc lala", "abc", 7) AS r3;
16 | -- checking occurence parameter
17 | SELECT REGEXP_INSTR("lala abc lala abc lala abc lala", "abc", 1, 1) AS r1;
18 | SELECT REGEXP_INSTR("lala abc lala abc lala abc lala", "abc", 1, 2) AS r2;
19 | SELECT REGEXP_INSTR("lala abc lala abc lala abc lala", "abc", 1, 3) AS r3;
20 | SELECT REGEXP_INSTR("lala abc lala abc lala abc lala", "abc", 1, 4) AS r4;
21 | -- get character position of match start
22 | SELECT REGEXP_INSTR("the quick brown fox jumps ...", "fox", 1, 1, 0) AS r1;
23 | -- get character position of match end
24 | SELECT REGEXP_INSTR("the quick brown fox jumps ...", "fox", 1, 1, 1) AS r2;
25 | -- get character position of match end, use defauts for unused parameters
26 | SELECT REGEXP_INSTR("the quick brown fox jumps ...", "fox", NULL, NULL, 1) AS r3;
27 |
28 | -- source drop_functions.inc
29 |
--------------------------------------------------------------------------------
/regexp/tests/t/regexp_like.test:
--------------------------------------------------------------------------------
1 | # Package: regexp Test: regexp_like
2 | #
3 | #
4 |
5 | -- disable_query_log
6 | -- disable_metadata
7 |
8 | -- source create_functions.inc
9 |
10 | -- testing simple cases
11 | SELECT REGEXP_LIKE("xxxabcxxx", ".*abc.*") AS r1;
12 | SELECT REGEXP_LIKE("xxxabdxxx", ".*abc.*") AS r2;
13 | -- testing case sensitivity
14 | SELECT REGEXP_LIKE("xxxABCxxx", ".*abc.*") AS r3;
15 | SELECT REGEXP_LIKE("xxxABCxxx", ".*abc.*", "i") AS r4;
16 | -- testing POSIX character classes
17 | SELECT REGEXP_LIKE("abcdef", "^[[:alpha:]]+$") AS r1;
18 | SELECT REGEXP_LIKE("123456", "^[[:alpha:]]+$") AS r2;
19 | SELECT REGEXP_LIKE("123abcdef", "^[[:xdigit:]]+$") AS r3;
20 |
21 | -- source drop_functions.inc
22 |
--------------------------------------------------------------------------------
/regexp/tests/t/regexp_replace.test:
--------------------------------------------------------------------------------
1 | # Package: regexp Test: regexp_replace
2 | #
3 | #
4 |
5 | -- disable_query_log
6 | -- disable_metadata
7 |
8 | -- source create_functions.inc
9 |
10 | -- simple check
11 | SELECT REGEXP_REPLACE("lala foo lala", "foo", "bar") AS r1;
12 | -- multiple match check
13 | SELECT REGEXP_REPLACE("lala foo lala foo lalala", "foo", "bar") AS r2;
14 | -- position parameter check
15 | SELECT REGEXP_REPLACE("lala foo lala foo lalala", "foo", "bar", 1) AS r3;
16 | SELECT REGEXP_REPLACE("lala foo lala foo lalala", "foo", "bar", 10) AS r4;
17 | -- occurence parameter check
18 | SELECT REGEXP_REPLACE("lala foo lala foo lalala", "foo", "bar", NULL, 0) AS r5;
19 | SELECT REGEXP_REPLACE("lala foo lala foo lalala", "foo", "bar", NULL, 1) AS r6;
20 | SELECT REGEXP_REPLACE("lala foo lala foo lalala", "foo", "bar", NULL, 2) AS r7;
21 |
22 | -- source drop_functions.inc
23 |
--------------------------------------------------------------------------------
/regexp/tests/t/regexp_substr.test:
--------------------------------------------------------------------------------
1 | # Package: regexp Test: regexp_substr
2 | #
3 | #
4 |
5 | -- disable_query_log
6 | -- disable_metadata
7 |
8 | -- source create_functions.inc
9 |
10 | -- checking simple case
11 | SELECT REGEXP_SUBSTR("abc 123 def", "[[:digit:]]+") AS r1;
12 | -- checking position offsets
13 | SELECT REGEXP_SUBSTR("abc 123 def", "[[:digit:]]+", 5) AS r2;
14 | SELECT REGEXP_SUBSTR("abc 123 def", "[[:digit:]]+", 6) AS r3;
15 | SELECT REGEXP_SUBSTR("abc 123 def", "[[:digit:]]+", 10) AS r4;
16 | -- checking occurence
17 | SELECT REGEXP_SUBSTR("abc 123 def 456 ghi", "[[:digit:]]+", 1, 1) AS r5;
18 | SELECT REGEXP_SUBSTR("abc 123 def 456 ghi", "[[:digit:]]+", 1, 2) AS r6;
19 | -- checking the 'i' flag
20 | SELECT REGEXP_SUBSTR("xxx abc xxx", "abc", 1, 1, 'i') AS r7;
21 | SELECT REGEXP_SUBSTR("xxx ABC xxx", "abc", 1, 1, 'i') AS r8;
22 | SELECT REGEXP_SUBSTR("xxx abc xxx", "ABC", 1, 1, 'i') AS r9;
23 | SELECT REGEXP_SUBSTR("xxx ABC xxx", "ABC", 1, 1, 'i') AS r10;
24 | -- checking the 'c' flag
25 | SELECT REGEXP_SUBSTR("xxx abc xxx", "abc", 1, 1, 'c') AS r11;
26 | SELECT REGEXP_SUBSTR("xxx ABC xxx", "abc", 1, 1, 'c') AS r12;
27 | SELECT REGEXP_SUBSTR("xxx abc xxx", "ABC", 1, 1, 'c') AS r13;
28 | SELECT REGEXP_SUBSTR("xxx ABC xxx", "ABC", 1, 1, 'c') AS r14;
29 |
30 | -- source drop_functions.inc
31 |
--------------------------------------------------------------------------------
/regexp/tests/test.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | #
4 | # this is a *very* simple re-implementation of mysql-test-run
5 | #
6 | # we need to have this as none of the mysql-test-run variants
7 | # is installed by "make install" or part of our distribution
8 | # packages
9 | #
10 | # currently we simply rely on all needed binaries to be in PATH
11 | # although this is not necessarily the case or the ones found
12 | # in PATH are not from the version the source was configured
13 | # against
14 | #
15 |
16 | HERE=`pwd`
17 | DATA=$HERE/var
18 | SOCK=$DATA/sock
19 |
20 | for a in mysql mysqld mysqladmin mysql_install_db mysqltest
21 | do
22 | if ! which $a
23 | then
24 | echo no '$a' binary in PATH
25 | exit 3
26 | fi
27 | done
28 |
29 | echo
30 | echo "*** testing ***"
31 | echo
32 | export LD_LIBRARY_PATH=../../.libs/:$LD_LIBRARY_PATH
33 |
34 | rm -rf $DATA
35 | mkdir $DATA
36 |
37 | mysql_install_db --datadir=$DATA > $DATA/test.err
38 |
39 | mysqld --skip-networking --skip-innodb \
40 | --datadir=$DATA --socket=$SOCK \
41 | 2>> $DATA/test.err &
42 |
43 | sleep 5
44 |
45 | mysql --socket=$SOCK -e "CREATE DATABASE IF NOT EXISTS test;"
46 |
47 | for test in t/*.test
48 | do
49 | name=`basename $test .test`
50 | echo -n "[$name] "
51 | result=r/$name.result
52 | mysqltest --socket=$SOCK --database test --test-file=$test --result-file=$result
53 | done
54 | echo
55 |
56 | mysqladmin -u root --socket=$SOCK shutdown
57 |
--------------------------------------------------------------------------------
/regexp/udf_regexp.h:
--------------------------------------------------------------------------------
1 | /*
2 | +----------------------------------------------------------------------+
3 | | This program is free software; you can redistribute it and/or |
4 | | modify it under the terms of the GNU General Public License |
5 | | as published by the Free Software Foundation; either version 2 |
6 | | of the License, or (at your option) any later version. |
7 | | |
8 | | This program is distributed in the hope that it will be useful, |
9 | | but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
11 | | GNU General Public License for more details. |
12 | | |
13 | | You should have received a copy of the GNU General General Public |
14 | | License in the file LICENSE along with this library; |
15 | | if not, write to the |
16 | | |
17 | | Free Software Foundation, Inc., |
18 | | 59 Temple Place, Suite 330, |
19 | | Boston, MA 02111-1307 USA |
20 | +----------------------------------------------------------------------+
21 | | Authors: Hartmut Holzgraefe |
22 | +----------------------------------------------------------------------+
23 | */
24 |
25 | /* $ Id: $ */
26 |
27 | #ifndef UDF_REGEXP_H
28 | #define UDF_REGEXP_H
29 |
30 | // {{{ user defined header code
31 |
32 | #include
33 |
34 | #include
35 |
36 | // helper function borrowed from PHP, slightly modified
37 | static char *my_regex_replace(const char *pattern,
38 | const char *replace,
39 | const char *string,
40 | int position,
41 | int occurence,
42 | int mode)
43 | {
44 | my_regex_t re;
45 | my_regmatch_t *subs;
46 |
47 | char *buf, /* buf is where we build the replaced string */
48 | *nbuf, /* nbuf is used when we grow the buffer */
49 | *walkbuf; /* used to walk buf when replacing backrefs */
50 | const char *walk; /* used to walk replacement string for backrefs */
51 | int buf_len;
52 | int pos, tmp, string_len, new_l;
53 | int err;
54 | int match_no;
55 |
56 | string_len = strlen(string);
57 |
58 | err = my_regcomp(&re, pattern, mode, &my_charset_latin1);
59 | if (err) {
60 | return NULL;
61 | }
62 |
63 | /* allocate storage for (sub-)expression-matches */
64 | subs = (my_regmatch_t *)calloc(sizeof(my_regmatch_t),re.re_nsub+1);
65 |
66 | /* start with a buffer that is twice the size of the stringo
67 | we're doing replacements in */
68 | buf_len = 2 * string_len + 1;
69 | buf = calloc(buf_len, sizeof(char));
70 |
71 | err = 0;
72 | match_no = 0;
73 |
74 | if (position) {
75 | // obey request to skip string start
76 | pos = position;
77 | strncpy(buf, string, pos);
78 | } else {
79 | pos = 0;
80 | buf[0] = '\0';
81 | }
82 |
83 | while (!err) {
84 | err = my_regexec(&re, &string[pos], re.re_nsub+1, subs, mode | (pos ? REG_NOTBOL : 0));
85 |
86 | if (err && err != REG_NOMATCH) {
87 | free(subs);
88 | free(buf);
89 | my_regfree(&re);
90 | return NULL;
91 | }
92 |
93 | match_no++;
94 |
95 | if ((occurence > 0)) {
96 | if (match_no < occurence) {
97 | // append pattern up to the match end
98 | // no need to recalculate the buffer size here
99 | // as no replaces have occured yet
100 | strncat(buf, &string[pos], subs[0].rm_eo);
101 | pos += subs[0].rm_eo;
102 | continue;
103 | } else if (match_no > occurence) {
104 | err = REG_NOMATCH;
105 | }
106 | }
107 |
108 |
109 | if (!err) {
110 | /* backref replacement is done in two passes:
111 | 1) find out how long the string will be, and allocate buf
112 | 2) copy the part before match, replacement and backrefs to buf
113 |
114 | Jaakko Hyvätti
115 | */
116 |
117 | new_l = strlen(buf) + subs[0].rm_so; /* part before the match */
118 | walk = replace;
119 | while (*walk) {
120 | if ('\\' == *walk && isdigit((unsigned char)walk[1]) && ((unsigned char)walk[1]) - '0' <= re.re_nsub) {
121 | if (subs[walk[1] - '0'].rm_so > -1 && subs[walk[1] - '0'].rm_eo > -1) {
122 | new_l += subs[walk[1] - '0'].rm_eo - subs[walk[1] - '0'].rm_so;
123 | }
124 | walk += 2;
125 | } else {
126 | new_l++;
127 | walk++;
128 | }
129 | }
130 | if (new_l + 1 > buf_len) {
131 | buf_len = 1 + buf_len + 2 * new_l;
132 | nbuf = malloc(buf_len);
133 | strcpy(nbuf, buf);
134 | free(buf);
135 | buf = nbuf;
136 | }
137 | tmp = strlen(buf);
138 | /* copy the part of the string before the match */
139 | strncat(buf, &string[pos], subs[0].rm_so);
140 |
141 | /* copy replacement and backrefs */
142 | walkbuf = &buf[tmp + subs[0].rm_so];
143 | walk = replace;
144 | while (*walk) {
145 | if ('\\' == *walk && isdigit(walk[1]) && walk[1] - '0' <= (int)re.re_nsub) {
146 | if (subs[walk[1] - '0'].rm_so > -1 && subs[walk[1] - '0'].rm_eo > -1
147 | /* this next case shouldn't happen. it does. */
148 | && subs[walk[1] - '0'].rm_so <= subs[walk[1] - '0'].rm_eo) {
149 |
150 | tmp = subs[walk[1] - '0'].rm_eo - subs[walk[1] - '0'].rm_so;
151 | memcpy (walkbuf, &string[pos + subs[walk[1] - '0'].rm_so], tmp);
152 | walkbuf += tmp;
153 | }
154 | walk += 2;
155 | } else {
156 | *walkbuf++ = *walk++;
157 | }
158 | }
159 | *walkbuf = '\0';
160 |
161 | /* and get ready to keep looking for replacements */
162 | if (subs[0].rm_so == subs[0].rm_eo) {
163 | if (subs[0].rm_so + pos >= string_len) {
164 | break;
165 | }
166 | new_l = strlen (buf) + 1;
167 | if (new_l + 1 > buf_len) {
168 | buf_len = 1 + buf_len + 2 * new_l;
169 | nbuf = calloc(buf_len, sizeof(char));
170 | strcpy(nbuf, buf);
171 | free(buf);
172 | buf = nbuf;
173 | }
174 | pos += subs[0].rm_eo + 1;
175 | buf [new_l-1] = string [pos-1];
176 | buf [new_l] = '\0';
177 | } else {
178 | pos += subs[0].rm_eo;
179 | }
180 | } else { /* REG_NOMATCH */
181 | new_l = strlen(buf) + strlen(&string[pos]);
182 | if (new_l + 1 > buf_len) {
183 | buf_len = new_l + 1; /* now we know exactly how long it is */
184 | nbuf = calloc(buf_len, sizeof(char));
185 | strcpy(nbuf, buf);
186 | free(buf);
187 | buf = nbuf;
188 | }
189 | /* stick that last bit of string on our output */
190 | strcat(buf, &string[pos]);
191 | }
192 | }
193 |
194 | /* don't want to leak memory .. */
195 | free(subs);
196 | my_regfree(&re);
197 |
198 | /* whew. */
199 | return (buf);
200 | }
201 |
202 | static int parse_mode(const char *mode, int len)
203 | {
204 | int flags = REG_EXTENDED | REG_NEWLINE;
205 |
206 | if (mode) {
207 | while (len-- > 0) {
208 | switch (*mode++) {
209 | case 'i': flags |= REG_ICASE; break; /* case insensitive */
210 | case 'c': flags &= ~REG_ICASE; break; /* case sensitive */
211 | case 'n': break; /* . matches newline */
212 | case 'm': break; /* multiple lines */
213 | case 'x': break; /* ignore whitespace */
214 | default: break;
215 | }
216 | }
217 | }
218 |
219 | return flags;
220 | }
221 | // }}}
222 |
223 |
224 |
225 | #define RETURN_NULL { *is_null = 1; DBUG_RETURN(0); }
226 |
227 | #define RETURN_INT(x) { *is_null = 0; DBUG_RETURN(x); }
228 |
229 | #define RETURN_REAL(x) { *is_null = 0; DBUG_RETURN(x); }
230 |
231 | #define RETURN_STRINGL(s, l) { \
232 | if (s == NULL) { \
233 | *is_null = 1; \
234 | DBUG_RETURN(NULL); \
235 | } \
236 | *is_null = 0; \
237 | *length = l; \
238 | if (l < 255) { \
239 | memcpy(result, s, l); \
240 | DBUG_RETURN(result); \
241 | } \
242 | if (l > data->_resultbuf_len) { \
243 | data->_resultbuf = realloc(data->_resultbuf, l); \
244 | if (!data->_resultbuf) { \
245 | *error = 1; \
246 | DBUG_RETURN(NULL); \
247 | } \
248 | data->_resultbuf_len = l; \
249 | } \
250 | memcpy(data->_resultbuf, s, l); \
251 | DBUG_RETURN(data->_resultbuf); \
252 | }
253 |
254 | #define RETURN_STRING(s) { \
255 | if (s == NULL) { \
256 | *is_null = 1; \
257 | DBUG_RETURN(NULL); \
258 | } \
259 | RETURN_STRINGL(s, strlen(s)); \
260 | }
261 |
262 | #define RETURN_DATETIME(d) { *length = my_datetime_to_str(d, result); *is_null = 0; DBUG_RETURN(result); }
263 |
264 |
265 | #endif /* UDF_REGEXP_H */
266 |
267 |
--------------------------------------------------------------------------------