Import Upstream version 2.2.8
This commit is contained in:
commit
bfd4cfd47d
|
@ -0,0 +1,12 @@
|
|||
Dom Lachowicz <cinamod@hotmail.com>
|
||||
Hannu Väisänen
|
||||
Hubert Figuière
|
||||
Reuben Thomas <rrt@sc3d.org>
|
||||
Rui M. Silva Seabra
|
||||
J M Maurer
|
||||
Fabiano Fidencio
|
||||
Eric Albright <eric_albright@sil.org>
|
||||
Jonathan Springer
|
||||
Heiko Becker
|
||||
Raphael Finkel
|
||||
Sander van Geloven (Nuspell provider)
|
|
@ -0,0 +1,504 @@
|
|||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
For more recent changes, see git history.
|
||||
|
||||
2007-01-14 Hubert Figuiere <hub@figuiere.net>
|
||||
|
||||
* src/Makefile.am (libenchant_includedir): removed trailing '/'
|
||||
that breaks on MacOS X.
|
||||
|
||||
2006-10-22 Dom Lachowicz <domlachowicz@gmail.com>
|
||||
|
||||
* Added Voikko spell checker backend (AbiWord bug 10450), for better
|
||||
Finnish support. Credit goes to Harri Pitknen and Anssi Hannula.
|
||||
|
||||
* Added Zemberek spell checker backend, for better Turkish support.
|
||||
Credit goes to Baris Metin.
|
||||
|
||||
2006-07-22 Jose Da Silva <Digital@JoesCat.com>
|
||||
|
||||
* doc/enchant.1: enchant.1 page more similar to other man/info pages
|
||||
(bug 10375)
|
||||
|
||||
2006-07-22 Dom Lachowicz <cinamod@hotmail.com>
|
||||
|
||||
* src/*/Makefile.am: add '-module' to LDFLAGS so that things get
|
||||
built correctly on Mac OSX (bug 10398)
|
||||
* src/enchant.c: Fix C99-ism (bug 10387)
|
||||
* configure.in: Grab the value of `aspell config prefix` and
|
||||
use that if available (bug 10308)
|
||||
|
||||
2006-05-06 Dom Lachowicz <cinamod@hotmail.com>
|
||||
|
||||
* configure.in: Bump version number to indicate an unstable series
|
||||
* src/pwl.[ch]: New personal wordlist implementation, based on Trie.
|
||||
Thanks to Ryan Kelly <ryan-bugs@rfk.id.au> (bug 10212).
|
||||
* src/enchant.c: Ditto
|
||||
|
||||
2006-04-23 Dom Lachowicz <cinamod@hotmail.com>
|
||||
|
||||
* configure.in: --with-aspell-prefix didn't work
|
||||
|
||||
2006-03-20 Dom Lachowicz <cinamod@hotmail.com>
|
||||
|
||||
* configure.in: relocatable_library undefined command in configure;
|
||||
Bug 10134, from Pierre Joye <pierre.php@gmail.com>
|
||||
|
||||
* configure.in: configure does not check if aspell/pspell headers exist;
|
||||
Bug 10135, based on a patch from Pierre Joye
|
||||
|
||||
2003-07-13 Dom Lachowicz <cinamod@hotmail.com>
|
||||
* Initial import
|
|
@ -0,0 +1,130 @@
|
|||
* Don't commit directly, instead make a pull request on GitHub.
|
||||
|
||||
|
||||
Building from git
|
||||
-----------------
|
||||
|
||||
To build from git, or without relying on the generated files in a source
|
||||
release, automake, autoconf, libtool, pkg-config and git must be installed.
|
||||
|
||||
(Note, the exact packages needed for certain distros may be found in
|
||||
.travis.yml and appveyor.yml.)
|
||||
|
||||
Run
|
||||
|
||||
./bootstrap && ./configure --enable-relocatable
|
||||
|
||||
to set up and configure the source tree; optional configure arguments can be
|
||||
supplied as normal.
|
||||
|
||||
See INSTALL (which is created by bootstrap) for instructions from this point
|
||||
on.
|
||||
|
||||
|
||||
Working in libenchant
|
||||
---------------------
|
||||
|
||||
When writing libenchant our priorities are
|
||||
|
||||
1) Portable
|
||||
2) Maintainable & Documented
|
||||
3) Modular and well designed
|
||||
|
||||
When you submit code for inclusion in libenchant, please keep those
|
||||
things in mind. While performance is important please note that
|
||||
well-designed algorithms and data structures are fertile areas for
|
||||
development; obfuscated code to make a loop 3% faster is not. Specifically,
|
||||
this means:
|
||||
|
||||
- Clarity of design and function are paramount
|
||||
- Make sure your code does not generate warnings
|
||||
- Please follow the formatting style
|
||||
|
||||
|
||||
Formatting style
|
||||
----------------
|
||||
|
||||
The formatting style of libenchant is a mix of various styles. Please
|
||||
familiarise yourself with the GNU coding standards (shipped with most
|
||||
GNU/Linux systems as the standards.info file), then read the Linux
|
||||
kernel coding standards and ignore Linus's jokes. Then look at the
|
||||
Gtk+ header files to get acquainted with how to write nice header files
|
||||
that are almost self documenting.
|
||||
|
||||
Emacs users should use the supplied .dir-locals.el.
|
||||
|
||||
Remember: Use tabs for indentation: that will keep your
|
||||
code honest as you will be forced to split your routines into more
|
||||
modular chunks (as detailed by Linus).
|
||||
|
||||
On top of that, please:
|
||||
|
||||
- Follow the Gtk+ cleanliness conventions for function
|
||||
prototypes.
|
||||
|
||||
- Follow the Gtk+ namespace convention for function names:
|
||||
module_submodule_operation
|
||||
|
||||
- Every entry point to a public routine should use the
|
||||
g_return_if_fail and g_return_val_if_fail macros to verify
|
||||
that the parameters passed are valid.
|
||||
|
||||
- Under no circumstances use magic variables. Use typedef
|
||||
enum { ... } type; to create enumerations. Do not use
|
||||
integers to hold enumeration values: the compiler can help
|
||||
catch various errors.
|
||||
|
||||
- Use g_warning to mark spots that need to be reviewed or are
|
||||
not finished.
|
||||
|
||||
- Do not submit code that is just a temporary workaround for a
|
||||
full fledged feature. We do not want to maintain limited
|
||||
features. It is better to submit an implementation designed
|
||||
to be expanded and enhanced, even if it is not completely
|
||||
finished.
|
||||
|
||||
- Follow the libenchant commenting style, which is not the Gtk
|
||||
style;
|
||||
/* ie. use this for
|
||||
* multi-line comments
|
||||
*/
|
||||
|
||||
All of this is to ensure the libenchant code will be kept within
|
||||
reasonable margins of maintainability for the future: Remember, in two years
|
||||
you will probably be far too busy to maintain your own contributions, and they
|
||||
might become a burden to the program maintainers.
|
||||
|
||||
libenchant is intended to be a foundation for a various document-centric
|
||||
projects.
|
||||
|
||||
Cleaning code in libenchant is more important than trying not to break
|
||||
existing code. Code clean-ups are always welcome.
|
||||
|
||||
|
||||
API documentation
|
||||
-----------------
|
||||
|
||||
To generate API documentation, simply run
|
||||
|
||||
doxygen
|
||||
|
||||
and see doxygen/html/index.html in a web browser.
|
||||
|
||||
|
||||
Making a release
|
||||
----------------
|
||||
|
||||
To make a release, you'll need woger:
|
||||
|
||||
https://github.com/rrthomas/woger
|
||||
|
||||
and github-release, suitably configured:
|
||||
|
||||
https://github.com/aktau/github-release
|
||||
|
||||
Having tested and pushed all the changes, update the version number in
|
||||
configure.ac and write the NEWS entry and push those too.
|
||||
|
||||
Then execute:
|
||||
|
||||
make release
|
|
@ -0,0 +1,417 @@
|
|||
Building and installing libenchant
|
||||
**********************************
|
||||
|
||||
For standard GNU autotools installation instructions, see below. There
|
||||
follow some enchant-specific notes.
|
||||
|
||||
The usual GNU autotools package instructions apply, except that Enchant must
|
||||
be built with --enable-relocatable for the tests to run successfully.
|
||||
|
||||
Note that for Enchant to find system-installed dictionaries, you may need
|
||||
the relevant --with-foo-dir option (see ./configure --help).
|
||||
|
||||
|
||||
Building from git
|
||||
=================
|
||||
|
||||
See HACKING.
|
||||
|
||||
|
||||
Parallel installation
|
||||
=====================
|
||||
|
||||
Enchant mostly installs in versioned directories, so that different major
|
||||
versions can be installed in parallel. The one exception is the data files
|
||||
(under pkgdatadir), as these are compatible between different major
|
||||
versions. To change e.g. /usr/share/enchant to /usr/share/enchant-2, set
|
||||
pkgdatadir when running make, e.g.:
|
||||
|
||||
make pkgdatadir=/usr/share/enchant-2
|
||||
|
||||
|
||||
Relocation
|
||||
==========
|
||||
|
||||
If Enchant is installed in a fixed location, and on Windows and Linux
|
||||
systems, no further configuration should be needed to make it relocatable;
|
||||
that is, work when copied from its original installation directory to
|
||||
another location.
|
||||
|
||||
Otherwise, and in code intended to be portable to other systems, your code
|
||||
should call enchant_set_prefix_dir (see enchant.h) before any other Enchant
|
||||
function.
|
||||
|
||||
For more details of how the relocation support works, including how you can
|
||||
use it in your own program, see doc/relocatable.texi and
|
||||
gnulib/doc/relocatable-maint.texi.
|
||||
|
||||
|
||||
|
||||
Installation Instructions
|
||||
*************************
|
||||
|
||||
Copyright (C) 1994-1996, 1999-2002, 2004-2016 Free Software
|
||||
Foundation, Inc.
|
||||
|
||||
Copying and distribution of this file, with or without modification,
|
||||
are permitted in any medium without royalty provided the copyright
|
||||
notice and this notice are preserved. This file is offered as-is,
|
||||
without warranty of any kind.
|
||||
|
||||
Basic Installation
|
||||
==================
|
||||
|
||||
Briefly, the shell command './configure && make && make install'
|
||||
should configure, build, and install this package. The following
|
||||
more-detailed instructions are generic; see the 'README' file for
|
||||
instructions specific to this package. Some packages provide this
|
||||
'INSTALL' file but do not implement all of the features documented
|
||||
below. The lack of an optional feature in a given package is not
|
||||
necessarily a bug. More recommendations for GNU packages can be found
|
||||
in *note Makefile Conventions: (standards)Makefile Conventions.
|
||||
|
||||
The 'configure' shell script attempts to guess correct values for
|
||||
various system-dependent variables used during compilation. It uses
|
||||
those values to create a 'Makefile' in each directory of the package.
|
||||
It may also create one or more '.h' files containing system-dependent
|
||||
definitions. Finally, it creates a shell script 'config.status' that
|
||||
you can run in the future to recreate the current configuration, and a
|
||||
file 'config.log' containing compiler output (useful mainly for
|
||||
debugging 'configure').
|
||||
|
||||
It can also use an optional file (typically called 'config.cache' and
|
||||
enabled with '--cache-file=config.cache' or simply '-C') that saves the
|
||||
results of its tests to speed up reconfiguring. Caching is disabled by
|
||||
default to prevent problems with accidental use of stale cache files.
|
||||
|
||||
If you need to do unusual things to compile the package, please try
|
||||
to figure out how 'configure' could check whether to do them, and mail
|
||||
diffs or instructions to the address given in the 'README' so they can
|
||||
be considered for the next release. If you are using the cache, and at
|
||||
some point 'config.cache' contains results you don't want to keep, you
|
||||
may remove or edit it.
|
||||
|
||||
The file 'configure.ac' (or 'configure.in') is used to create
|
||||
'configure' by a program called 'autoconf'. You need 'configure.ac' if
|
||||
you want to change it or regenerate 'configure' using a newer version of
|
||||
'autoconf'.
|
||||
|
||||
The simplest way to compile this package is:
|
||||
|
||||
1. 'cd' to the directory containing the package's source code and type
|
||||
'./configure' to configure the package for your system.
|
||||
|
||||
Running 'configure' might take a while. While running, it prints
|
||||
some messages telling which features it is checking for.
|
||||
|
||||
2. Type 'make' to compile the package.
|
||||
|
||||
3. Optionally, type 'make check' to run any self-tests that come with
|
||||
the package, generally using the just-built uninstalled binaries.
|
||||
|
||||
4. Type 'make install' to install the programs and any data files and
|
||||
documentation. When installing into a prefix owned by root, it is
|
||||
recommended that the package be configured and built as a regular
|
||||
user, and only the 'make install' phase executed with root
|
||||
privileges.
|
||||
|
||||
5. Optionally, type 'make installcheck' to repeat any self-tests, but
|
||||
this time using the binaries in their final installed location.
|
||||
This target does not install anything. Running this target as a
|
||||
regular user, particularly if the prior 'make install' required
|
||||
root privileges, verifies that the installation completed
|
||||
correctly.
|
||||
|
||||
6. You can remove the program binaries and object files from the
|
||||
source code directory by typing 'make clean'. To also remove the
|
||||
files that 'configure' created (so you can compile the package for
|
||||
a different kind of computer), type 'make distclean'. There is
|
||||
also a 'make maintainer-clean' target, but that is intended mainly
|
||||
for the package's developers. If you use it, you may have to get
|
||||
all sorts of other programs in order to regenerate files that came
|
||||
with the distribution.
|
||||
|
||||
7. Often, you can also type 'make uninstall' to remove the installed
|
||||
files again. In practice, not all packages have tested that
|
||||
uninstallation works correctly, even though it is required by the
|
||||
GNU Coding Standards.
|
||||
|
||||
8. Some packages, particularly those that use Automake, provide 'make
|
||||
distcheck', which can by used by developers to test that all other
|
||||
targets like 'make install' and 'make uninstall' work correctly.
|
||||
This target is generally not run by end users.
|
||||
|
||||
Compilers and Options
|
||||
=====================
|
||||
|
||||
Some systems require unusual options for compilation or linking that
|
||||
the 'configure' script does not know about. Run './configure --help'
|
||||
for details on some of the pertinent environment variables.
|
||||
|
||||
You can give 'configure' initial values for configuration parameters
|
||||
by setting variables in the command line or in the environment. Here is
|
||||
an example:
|
||||
|
||||
./configure CC=c99 CFLAGS=-g LIBS=-lposix
|
||||
|
||||
*Note Defining Variables::, for more details.
|
||||
|
||||
Compiling For Multiple Architectures
|
||||
====================================
|
||||
|
||||
You can compile the package for more than one kind of computer at the
|
||||
same time, by placing the object files for each architecture in their
|
||||
own directory. To do this, you can use GNU 'make'. 'cd' to the
|
||||
directory where you want the object files and executables to go and run
|
||||
the 'configure' script. 'configure' automatically checks for the source
|
||||
code in the directory that 'configure' is in and in '..'. This is known
|
||||
as a "VPATH" build.
|
||||
|
||||
With a non-GNU 'make', it is safer to compile the package for one
|
||||
architecture at a time in the source code directory. After you have
|
||||
installed the package for one architecture, use 'make distclean' before
|
||||
reconfiguring for another architecture.
|
||||
|
||||
On MacOS X 10.5 and later systems, you can create libraries and
|
||||
executables that work on multiple system types--known as "fat" or
|
||||
"universal" binaries--by specifying multiple '-arch' options to the
|
||||
compiler but only a single '-arch' option to the preprocessor. Like
|
||||
this:
|
||||
|
||||
./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
|
||||
CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
|
||||
CPP="gcc -E" CXXCPP="g++ -E"
|
||||
|
||||
This is not guaranteed to produce working output in all cases, you
|
||||
may have to build one architecture at a time and combine the results
|
||||
using the 'lipo' tool if you have problems.
|
||||
|
||||
Installation Names
|
||||
==================
|
||||
|
||||
By default, 'make install' installs the package's commands under
|
||||
'/usr/local/bin', include files under '/usr/local/include', etc. You
|
||||
can specify an installation prefix other than '/usr/local' by giving
|
||||
'configure' the option '--prefix=PREFIX', where PREFIX must be an
|
||||
absolute file name.
|
||||
|
||||
You can specify separate installation prefixes for
|
||||
architecture-specific files and architecture-independent files. If you
|
||||
pass the option '--exec-prefix=PREFIX' to 'configure', the package uses
|
||||
PREFIX as the prefix for installing programs and libraries.
|
||||
Documentation and other data files still use the regular prefix.
|
||||
|
||||
In addition, if you use an unusual directory layout you can give
|
||||
options like '--bindir=DIR' to specify different values for particular
|
||||
kinds of files. Run 'configure --help' for a list of the directories
|
||||
you can set and what kinds of files go in them. In general, the default
|
||||
for these options is expressed in terms of '${prefix}', so that
|
||||
specifying just '--prefix' will affect all of the other directory
|
||||
specifications that were not explicitly provided.
|
||||
|
||||
The most portable way to affect installation locations is to pass the
|
||||
correct locations to 'configure'; however, many packages provide one or
|
||||
both of the following shortcuts of passing variable assignments to the
|
||||
'make install' command line to change installation locations without
|
||||
having to reconfigure or recompile.
|
||||
|
||||
The first method involves providing an override variable for each
|
||||
affected directory. For example, 'make install
|
||||
prefix=/alternate/directory' will choose an alternate location for all
|
||||
directory configuration variables that were expressed in terms of
|
||||
'${prefix}'. Any directories that were specified during 'configure',
|
||||
but not in terms of '${prefix}', must each be overridden at install time
|
||||
for the entire installation to be relocated. The approach of makefile
|
||||
variable overrides for each directory variable is required by the GNU
|
||||
Coding Standards, and ideally causes no recompilation. However, some
|
||||
platforms have known limitations with the semantics of shared libraries
|
||||
that end up requiring recompilation when using this method, particularly
|
||||
noticeable in packages that use GNU Libtool.
|
||||
|
||||
The second method involves providing the 'DESTDIR' variable. For
|
||||
example, 'make install DESTDIR=/alternate/directory' will prepend
|
||||
'/alternate/directory' before all installation names. The approach of
|
||||
'DESTDIR' overrides is not required by the GNU Coding Standards, and
|
||||
does not work on platforms that have drive letters. On the other hand,
|
||||
it does better at avoiding recompilation issues, and works well even
|
||||
when some directory options were not specified in terms of '${prefix}'
|
||||
at 'configure' time.
|
||||
|
||||
Optional Features
|
||||
=================
|
||||
|
||||
If the package supports it, you can cause programs to be installed
|
||||
with an extra prefix or suffix on their names by giving 'configure' the
|
||||
option '--program-prefix=PREFIX' or '--program-suffix=SUFFIX'.
|
||||
|
||||
Some packages pay attention to '--enable-FEATURE' options to
|
||||
'configure', where FEATURE indicates an optional part of the package.
|
||||
They may also pay attention to '--with-PACKAGE' options, where PACKAGE
|
||||
is something like 'gnu-as' or 'x' (for the X Window System). The
|
||||
'README' should mention any '--enable-' and '--with-' options that the
|
||||
package recognizes.
|
||||
|
||||
For packages that use the X Window System, 'configure' can usually
|
||||
find the X include and library files automatically, but if it doesn't,
|
||||
you can use the 'configure' options '--x-includes=DIR' and
|
||||
'--x-libraries=DIR' to specify their locations.
|
||||
|
||||
Some packages offer the ability to configure how verbose the
|
||||
execution of 'make' will be. For these packages, running './configure
|
||||
--enable-silent-rules' sets the default to minimal output, which can be
|
||||
overridden with 'make V=1'; while running './configure
|
||||
--disable-silent-rules' sets the default to verbose, which can be
|
||||
overridden with 'make V=0'.
|
||||
|
||||
Particular systems
|
||||
==================
|
||||
|
||||
On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC
|
||||
is not installed, it is recommended to use the following options in
|
||||
order to use an ANSI C compiler:
|
||||
|
||||
./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
|
||||
|
||||
and if that doesn't work, install pre-built binaries of GCC for HP-UX.
|
||||
|
||||
HP-UX 'make' updates targets which have the same time stamps as their
|
||||
prerequisites, which makes it generally unusable when shipped generated
|
||||
files such as 'configure' are involved. Use GNU 'make' instead.
|
||||
|
||||
On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
|
||||
parse its '<wchar.h>' header file. The option '-nodtk' can be used as a
|
||||
workaround. If GNU CC is not installed, it is therefore recommended to
|
||||
try
|
||||
|
||||
./configure CC="cc"
|
||||
|
||||
and if that doesn't work, try
|
||||
|
||||
./configure CC="cc -nodtk"
|
||||
|
||||
On Solaris, don't put '/usr/ucb' early in your 'PATH'. This
|
||||
directory contains several dysfunctional programs; working variants of
|
||||
these programs are available in '/usr/bin'. So, if you need '/usr/ucb'
|
||||
in your 'PATH', put it _after_ '/usr/bin'.
|
||||
|
||||
On Haiku, software installed for all users goes in '/boot/common',
|
||||
not '/usr/local'. It is recommended to use the following options:
|
||||
|
||||
./configure --prefix=/boot/common
|
||||
|
||||
Specifying the System Type
|
||||
==========================
|
||||
|
||||
There may be some features 'configure' cannot figure out
|
||||
automatically, but needs to determine by the type of machine the package
|
||||
will run on. Usually, assuming the package is built to be run on the
|
||||
_same_ architectures, 'configure' can figure that out, but if it prints
|
||||
a message saying it cannot guess the machine type, give it the
|
||||
'--build=TYPE' option. TYPE can either be a short name for the system
|
||||
type, such as 'sun4', or a canonical name which has the form:
|
||||
|
||||
CPU-COMPANY-SYSTEM
|
||||
|
||||
where SYSTEM can have one of these forms:
|
||||
|
||||
OS
|
||||
KERNEL-OS
|
||||
|
||||
See the file 'config.sub' for the possible values of each field. If
|
||||
'config.sub' isn't included in this package, then this package doesn't
|
||||
need to know the machine type.
|
||||
|
||||
If you are _building_ compiler tools for cross-compiling, you should
|
||||
use the option '--target=TYPE' to select the type of system they will
|
||||
produce code for.
|
||||
|
||||
If you want to _use_ a cross compiler, that generates code for a
|
||||
platform different from the build platform, you should specify the
|
||||
"host" platform (i.e., that on which the generated programs will
|
||||
eventually be run) with '--host=TYPE'.
|
||||
|
||||
Sharing Defaults
|
||||
================
|
||||
|
||||
If you want to set default values for 'configure' scripts to share,
|
||||
you can create a site shell script called 'config.site' that gives
|
||||
default values for variables like 'CC', 'cache_file', and 'prefix'.
|
||||
'configure' looks for 'PREFIX/share/config.site' if it exists, then
|
||||
'PREFIX/etc/config.site' if it exists. Or, you can set the
|
||||
'CONFIG_SITE' environment variable to the location of the site script.
|
||||
A warning: not all 'configure' scripts look for a site script.
|
||||
|
||||
Defining Variables
|
||||
==================
|
||||
|
||||
Variables not defined in a site shell script can be set in the
|
||||
environment passed to 'configure'. However, some packages may run
|
||||
configure again during the build, and the customized values of these
|
||||
variables may be lost. In order to avoid this problem, you should set
|
||||
them in the 'configure' command line, using 'VAR=value'. For example:
|
||||
|
||||
./configure CC=/usr/local2/bin/gcc
|
||||
|
||||
causes the specified 'gcc' to be used as the C compiler (unless it is
|
||||
overridden in the site shell script).
|
||||
|
||||
Unfortunately, this technique does not work for 'CONFIG_SHELL' due to an
|
||||
Autoconf limitation. Until the limitation is lifted, you can use this
|
||||
workaround:
|
||||
|
||||
CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash
|
||||
|
||||
'configure' Invocation
|
||||
======================
|
||||
|
||||
'configure' recognizes the following options to control how it
|
||||
operates.
|
||||
|
||||
'--help'
|
||||
'-h'
|
||||
Print a summary of all of the options to 'configure', and exit.
|
||||
|
||||
'--help=short'
|
||||
'--help=recursive'
|
||||
Print a summary of the options unique to this package's
|
||||
'configure', and exit. The 'short' variant lists options used only
|
||||
in the top level, while the 'recursive' variant lists options also
|
||||
present in any nested packages.
|
||||
|
||||
'--version'
|
||||
'-V'
|
||||
Print the version of Autoconf used to generate the 'configure'
|
||||
script, and exit.
|
||||
|
||||
'--cache-file=FILE'
|
||||
Enable the cache: use and save the results of the tests in FILE,
|
||||
traditionally 'config.cache'. FILE defaults to '/dev/null' to
|
||||
disable caching.
|
||||
|
||||
'--config-cache'
|
||||
'-C'
|
||||
Alias for '--cache-file=config.cache'.
|
||||
|
||||
'--quiet'
|
||||
'--silent'
|
||||
'-q'
|
||||
Do not print messages saying which checks are being made. To
|
||||
suppress all normal output, redirect it to '/dev/null' (any error
|
||||
messages will still be shown).
|
||||
|
||||
'--srcdir=DIR'
|
||||
Look for the package's source code in directory DIR. Usually
|
||||
'configure' can determine that directory automatically.
|
||||
|
||||
'--prefix=DIR'
|
||||
Use DIR as the installation prefix. *note Installation Names:: for
|
||||
more details, including other options available for fine-tuning the
|
||||
installation locations.
|
||||
|
||||
'--no-create'
|
||||
'-n'
|
||||
Run the configure checks, but stop before creating any output
|
||||
files.
|
||||
|
||||
'configure' also accepts some other, not widely useful, options. Run
|
||||
'configure --help' for more details.
|
|
@ -0,0 +1,44 @@
|
|||
ACLOCAL_AMFLAGS = -I m4
|
||||
AM_DISTCHECK_CONFIGURE_FLAGS = --enable-relocatable
|
||||
|
||||
SUBDIRS = lib src providers tests
|
||||
|
||||
# Note that the template file is called library.pc.in, but generates a
|
||||
# versioned .pc file using some magic in AC_CONFIG_FILES.
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = enchant-$(ENCHANT_MAJOR_VERSION).pc
|
||||
|
||||
DISTCLEANFILES = $(pkgconfig_DATA)
|
||||
EXTRA_DIST = \
|
||||
enchant.pc.in \
|
||||
README \
|
||||
HACKING \
|
||||
NEWS \
|
||||
ChangeLog \
|
||||
AUTHORS \
|
||||
COPYING.LIB \
|
||||
m4/gnulib-cache.m4
|
||||
|
||||
ALL_SOURCE_FILES = \
|
||||
bootstrap.conf \
|
||||
configure.ac \
|
||||
Makefile.am \
|
||||
src/Makefile.am \
|
||||
src/*.[chi] \
|
||||
providers/Makefile.am \
|
||||
providers/*.[ch] \
|
||||
providers/*.cpp \
|
||||
providers/*.mm
|
||||
|
||||
loc:
|
||||
cloc --force-lang="Bourne Shell",conf $(ALL_SOURCE_FILES)
|
||||
|
||||
release: distcheck
|
||||
git diff --exit-code && \
|
||||
git tag -a -m "Release tag" "v$(VERSION)" && \
|
||||
git push && git push --tags && \
|
||||
woger github \
|
||||
github_user=AbiWord \
|
||||
package=$(PACKAGE) \
|
||||
version=$(VERSION) \
|
||||
dist_type=tar.gz
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,237 @@
|
|||
2.2.8 (February 27, 2020)
|
||||
-------------------------
|
||||
|
||||
Add a provider back-end for Nuspell (thanks, Sander van Geloven). Nuspell is
|
||||
a new spell-checker whose development has been supported by the Mozilla
|
||||
foundation. It is backwards-compatible with Hunspell and Myspell
|
||||
dictionaries, while supporting a wider range of language peculiarities,
|
||||
improved suggestions, and easier maintainability of the code-base.
|
||||
|
||||
Doxygen documentation generation is now supported for Enchant (thanks,
|
||||
Sander van Geloven).
|
||||
|
||||
The command-line parsing of the “enchant” program has been made more
|
||||
friendly and reliable. The -L flag (show line numbers), which had not been
|
||||
working for some time, has been fixed.
|
||||
|
||||
A buffer overflow in personal wordlist handling has been fixed.
|
||||
|
||||
Minor improvements were made to the tests (thanks, Sander van Geloven).
|
||||
|
||||
|
||||
2.2.7 (September 9, 2019)
|
||||
-------------------------
|
||||
|
||||
Fix some memory leaks in the hunspell and aspell providers, thanks to an
|
||||
improvement to the build system to use ASAN for the tests.
|
||||
|
||||
|
||||
2.2.6 (September 5, 2019)
|
||||
-------------------------
|
||||
|
||||
Treat PWL as text, not binary.
|
||||
|
||||
|
||||
2.2.5 (June 30, 2019)
|
||||
---------------------
|
||||
|
||||
Fix a memory leak in the hunspell provider.
|
||||
|
||||
|
||||
2.2.4 (June 17, 2019)
|
||||
---------------------
|
||||
|
||||
Fix a bug in the enchant program, where words ending in non-ASCII characters
|
||||
were truncated during tokenization.
|
||||
|
||||
|
||||
2.2.3 (February 4, 2018)
|
||||
------------------------
|
||||
|
||||
Fix the previous release’s fix. Sigh.
|
||||
|
||||
|
||||
2.2.2 (February 3, 2018)
|
||||
------------------------
|
||||
|
||||
Fix a bug in the build system where the test harness would try to delete
|
||||
files under root, typically the system libraries.
|
||||
|
||||
|
||||
2.2.1 (January 3, 2018)
|
||||
-----------------------
|
||||
|
||||
This release fixes a crash on invalid input with the hspell backend, removes
|
||||
some bashisms from the build system, updates the Free Software Foundation’s
|
||||
street address, and stops running some tests that fail on recent macOS
|
||||
(pending a fix).
|
||||
|
||||
|
||||
2.2.0 (December 11, 2017)
|
||||
-------------------------
|
||||
|
||||
This release improves support for parallel installation with other major
|
||||
versions of Enchant (specifically for man pages), fixes relocation support,
|
||||
which only partly worked (thanks to Sandro Mani), and makes minor
|
||||
documentation improvements and fixes a potential crash in the hspell
|
||||
back-end.
|
||||
|
||||
|
||||
2.1.3 (November 26, 2017)
|
||||
--------------------------
|
||||
|
||||
This release adds support for parallel installation with other major
|
||||
versions of Enchant, and fixes a crash in the Voikko provider when it has no
|
||||
supported languages.
|
||||
|
||||
|
||||
2.1.2 (September 28, 2017)
|
||||
--------------------------
|
||||
|
||||
This release adds support for languages other than Finnish to the voikko
|
||||
provider, from Børre Gaup.
|
||||
|
||||
|
||||
2.1.1 (September 8, 2017)
|
||||
-------------------------
|
||||
|
||||
This release changes no code, but makes the soname of libenchant match the
|
||||
version number more obviously, as well as changing the way it is calculated
|
||||
to better match libtool’s versioning rules.
|
||||
|
||||
|
||||
2.1.0 (August 7, 2017)
|
||||
----------------------
|
||||
|
||||
This is a minor feature release. It adds the -word-chars flag to
|
||||
enchant-lsmod, for a convenient way for other programs to get the extra word
|
||||
characters for a particular dictionary.
|
||||
|
||||
A man page for enchant-lsmod is also now provided.
|
||||
|
||||
A little more code cleanup has been done, in particular by upstreaming
|
||||
gnulib patches.
|
||||
|
||||
|
||||
2.0.0 (August 4, 2017)
|
||||
----------------------
|
||||
|
||||
The major version number has been incremented owing to API/ABI changes, but
|
||||
in practice upgrading from 1.6.x should be easy.
|
||||
|
||||
Previously-deprecated APIs have been removed.
|
||||
|
||||
The little-used enchant_broker_get/set_param calls have been removed.
|
||||
|
||||
Some trivial API changes have been made to fix otherwise-unavoidable
|
||||
compilation warnings both in libenchant and in application code. This is
|
||||
strictly an ABI change (although the ABI may not actually have changed,
|
||||
depending on the platform).
|
||||
|
||||
The provider API has been changed slightly: enchant_get_user_language is now
|
||||
a documented public API (before it was marked private, but it has in fact
|
||||
been exported for some years). enchant_get_user_config_dirs is now
|
||||
enchant_get_user_config_dir, and returns only a single directory.
|
||||
|
||||
The plethora of configuration options previously available has been
|
||||
rationalised and documented. In particular, support for relocation (so that
|
||||
Enchant, or an application of which it is part, can be installed anywhere in
|
||||
a filing system) has been rewritten and documented (see INSTALL).
|
||||
|
||||
The Myspell backend has been renamed to Hunspell to match the upstream
|
||||
project. Users with their own enchant.ordering files will need to change
|
||||
“myspell” to “hunspell”.
|
||||
|
||||
|
||||
1.6.1 (February 6, 2017)
|
||||
------------------------
|
||||
|
||||
Improvements to the enchant-ispell front-end, which is now a working ispell replacement.
|
||||
Unit tests run on all platforms.
|
||||
Various bug fixes and code clean-up.
|
||||
|
||||
|
||||
1.6.0 (April 1, 2010)
|
||||
---------------------
|
||||
|
||||
Fix bug 12567: the ispell sources aren't licensed under the LGPL
|
||||
Add a function to get enchant's version (enchant_get_version)
|
||||
Disable zemberek plugin by default, as it's known to cause issues/crashes with WebKit
|
||||
Fix bug 12472: Win32 DLL dependency not found popup occurs when module has unmet dependencies
|
||||
Possibly fix Ubuntu bug 474062
|
||||
Fix bug 12409: Registry handle not closed in enchant_get_registry_value_ex
|
||||
Fix bug 12406: Leak in _enchant_get_user_home_dirs() on Windows
|
||||
Fix bug 12007: Update FSF address
|
||||
Fix bug 12305: Zemberek module lists a Turkish dictionary even without Zemberek installed
|
||||
Don't assert if passed a null string list
|
||||
Fix bug 12350: enchant_pwl_init_with_file truncates pwl file
|
||||
Fix a double-free memory corruption bug
|
||||
Fix bug 12173: fix some small memory leaks
|
||||
Fix bug 12174: mis-acceptence of dictionaries which start with a partial match of the lang id
|
||||
Fix bug 12160: enchant 1.5.0 always looks in "lib" dir for plugins
|
||||
Fix the build with the MSVC compiler
|
||||
Add a --with-system-myspell option
|
||||
Package missing compile-resource file
|
||||
Compare paths ignoring case sensitivity on windows
|
||||
|
||||
|
||||
1.5.0 (May 23, 2009)
|
||||
--------------------
|
||||
|
||||
(News missing!)
|
||||
|
||||
|
||||
1.4.2 (May 5, 2008)
|
||||
-------------------
|
||||
|
||||
Voikko (Finnish) language support
|
||||
Zemberek (Turkish) language support
|
||||
Better support for Unicode in the personal dictionaries
|
||||
Personal dictionaries offer better suggestions
|
||||
Use OpenOffice's dictionaries on Windows
|
||||
Aspell works on Windows
|
||||
Can use a system-wide Hunspell/Myspell installation on Unix-like platforms
|
||||
Require Hunspell 1.2.1
|
||||
.NET bindings
|
||||
More lax language matching rules (eg. if you request a "pl" dictionary, but
|
||||
only have a "pl_PL" myspell dictionary installed, it will do the right
|
||||
thing)
|
||||
Use XDG's data-dirs spec for locating dictionaries (eg. ~/.config/enchant/myspell/)
|
||||
Lots of unit tests
|
||||
Lots of bug fixes
|
||||
|
||||
|
||||
0.4.0
|
||||
-------------------
|
||||
Ispell-like command line interface
|
||||
|
||||
|
||||
0.3.0
|
||||
-------------------
|
||||
Better Aspell detection
|
||||
Aspell backend sync's dictionary lists to disk
|
||||
Ispell crash fixes
|
||||
Myspell crash fixes
|
||||
Refined C++ API/ABI
|
||||
Refined C ABI
|
||||
Implemented some new APIs
|
||||
Better implemented some internals
|
||||
|
||||
|
||||
0.2.0
|
||||
-------------------
|
||||
Myspell support
|
||||
Better Uspell support
|
||||
Ability to enumerate providers
|
||||
Win32 support
|
||||
|
||||
|
||||
0.1.0
|
||||
-------------------
|
||||
Initial Release
|
||||
Aspell/Pspell support
|
||||
Ispell support
|
||||
Uspell support
|
||||
Ability to order dictionaries/providers
|
||||
|
||||
|
|
@ -0,0 +1,91 @@
|
|||
libenchant -- Generic spell checking library
|
||||
Original author: Dom Lachowicz
|
||||
|
||||
libenchant is licensed under the terms of the GNU LGPL (see the file
|
||||
COPYING.LIB), with a special exception allowing the use of proprietary
|
||||
spell-checking systems.
|
||||
|
||||
Enchant aims to provide a simple but comprehensive abstraction for dealing
|
||||
with different spell checking libraries in a consistent way. A client, such
|
||||
as a text editor or word processor, need not know anything about a specific
|
||||
spell-checker, and since all back-ends are plugins, new spell-checkers can
|
||||
be added without needing any change to the program using Enchant.
|
||||
|
||||
Enchant can be configured by the user, who can even add spell-checker
|
||||
plugins if desired.
|
||||
|
||||
Enchant currently works with the following spell-checkers:
|
||||
|
||||
* Hunspell (formerly Myspell)
|
||||
* Nuspell
|
||||
* GNU Aspell
|
||||
* Hspell
|
||||
* Voikko
|
||||
* Apple Spell (macOS only)
|
||||
* Zemberek
|
||||
|
||||
Enchant is written in C and C++, and its only external dependency is glib.
|
||||
|
||||
Enchant bindings are supplied for C and C++; there are third-party bindings
|
||||
for:
|
||||
|
||||
Python: https://github.com/rfk/pyenchant/
|
||||
Ruby: https://github.com/pennyapp/ruby-enchant
|
||||
Go: https://github.com/hermanschaaf/enchant
|
||||
Common Lisp: https://github.com/tlikonen/cl-enchant
|
||||
|
||||
|
||||
Sharing personal word lists between spell-checkers
|
||||
--------------------------------------------------
|
||||
|
||||
It is possible, and usually safe, to share Enchant’s personal word lists
|
||||
with other spelling checkers that use the same format (a simple plain text
|
||||
file with one word per line). The spell-checkers known to be compatible are
|
||||
Hunspell, Nuspell and Ispell. (Although Enchant does not support Ispell as a
|
||||
back-end, it’s still fine to share word lists with it.) Other spell-checkers
|
||||
supported by Enchant are either incompatible, or have no personal word list
|
||||
mechanism. There may well be yet other spell-checkers, unknown to Enchant,
|
||||
that use the same format.
|
||||
|
||||
Some applications use Hunspell or Nuspell, but store the personal word list
|
||||
under another name or in another location. Firefox is one example. Firefox
|
||||
also seems to reorder its word list when updating it; again, this is OK, as
|
||||
the result is still in the same format. Anonther example is Thunderbird.
|
||||
|
||||
To share word lists with Enchant, find the other spelling checker’s word
|
||||
list file, e.g. ~/.hunspell_fr_FR or ~/.config/nuspell/fr_FR, and merge it
|
||||
with the corresponding Enchant file, in this case ~/.config/enchant/fr_FR.dic
|
||||
(on a GNU or BSD system). Use the following command, replacing ENCHANT-DICT
|
||||
and OTHER-DICT with the corresponding dictionary file names:
|
||||
|
||||
cat ENCHANT-DICT OTHER-DICT | sort -u > merged.txt
|
||||
|
||||
Take a look at merged.txt to check the merge has worked, then
|
||||
|
||||
mv merged.txt ENCHANT-DICT
|
||||
rm OTHER-DICT
|
||||
ln -s OTHER-DICT ENCHANT-DICT
|
||||
|
||||
to replace the other dictionary file with a link to the Enchant dictionary,
|
||||
again filling in the name of the dictionary files.
|
||||
|
||||
|
||||
Bug reports and development
|
||||
---------------------------
|
||||
|
||||
To report libenchant bugs or request features, please visit
|
||||
https://github.com/AbiWord/enchant
|
||||
|
||||
If you can't use GitHub, you can use the (low-traffic) AbiWord-devel list.
|
||||
To subscribe send a mail to:
|
||||
|
||||
abiword-dev-request@abisource.com
|
||||
|
||||
and in the body of the message write "subscribe"
|
||||
|
||||
An archive of the mailing lists is available at:
|
||||
|
||||
http://www.abisource.com/mailinglists/abiword-dev/
|
||||
|
||||
|
||||
Enchant has taken insight from GNU Aspell: http://aspell.net
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,270 @@
|
|||
#! /bin/sh
|
||||
# Wrapper for Microsoft lib.exe
|
||||
|
||||
me=ar-lib
|
||||
scriptversion=2012-03-01.08; # UTC
|
||||
|
||||
# Copyright (C) 2010-2017 Free Software Foundation, Inc.
|
||||
# Written by Peter Rosin <peda@lysator.liu.se>.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# This file is maintained in Automake, please report
|
||||
# bugs to <bug-automake@gnu.org> or send patches to
|
||||
# <automake-patches@gnu.org>.
|
||||
|
||||
|
||||
# func_error message
|
||||
func_error ()
|
||||
{
|
||||
echo "$me: $1" 1>&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
file_conv=
|
||||
|
||||
# func_file_conv build_file
|
||||
# Convert a $build file to $host form and store it in $file
|
||||
# Currently only supports Windows hosts.
|
||||
func_file_conv ()
|
||||
{
|
||||
file=$1
|
||||
case $file in
|
||||
/ | /[!/]*) # absolute file, and not a UNC file
|
||||
if test -z "$file_conv"; then
|
||||
# lazily determine how to convert abs files
|
||||
case `uname -s` in
|
||||
MINGW*)
|
||||
file_conv=mingw
|
||||
;;
|
||||
CYGWIN*)
|
||||
file_conv=cygwin
|
||||
;;
|
||||
*)
|
||||
file_conv=wine
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
case $file_conv in
|
||||
mingw)
|
||||
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
|
||||
;;
|
||||
cygwin)
|
||||
file=`cygpath -m "$file" || echo "$file"`
|
||||
;;
|
||||
wine)
|
||||
file=`winepath -w "$file" || echo "$file"`
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# func_at_file at_file operation archive
|
||||
# Iterate over all members in AT_FILE performing OPERATION on ARCHIVE
|
||||
# for each of them.
|
||||
# When interpreting the content of the @FILE, do NOT use func_file_conv,
|
||||
# since the user would need to supply preconverted file names to
|
||||
# binutils ar, at least for MinGW.
|
||||
func_at_file ()
|
||||
{
|
||||
operation=$2
|
||||
archive=$3
|
||||
at_file_contents=`cat "$1"`
|
||||
eval set x "$at_file_contents"
|
||||
shift
|
||||
|
||||
for member
|
||||
do
|
||||
$AR -NOLOGO $operation:"$member" "$archive" || exit $?
|
||||
done
|
||||
}
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
func_error "no command. Try '$0 --help' for more information."
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<EOF
|
||||
Usage: $me [--help] [--version] PROGRAM ACTION ARCHIVE [MEMBER...]
|
||||
|
||||
Members may be specified in a file named with @FILE.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "$me, version $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
esac
|
||||
|
||||
if test $# -lt 3; then
|
||||
func_error "you must specify a program, an action and an archive"
|
||||
fi
|
||||
|
||||
AR=$1
|
||||
shift
|
||||
while :
|
||||
do
|
||||
if test $# -lt 2; then
|
||||
func_error "you must specify a program, an action and an archive"
|
||||
fi
|
||||
case $1 in
|
||||
-lib | -LIB \
|
||||
| -ltcg | -LTCG \
|
||||
| -machine* | -MACHINE* \
|
||||
| -subsystem* | -SUBSYSTEM* \
|
||||
| -verbose | -VERBOSE \
|
||||
| -wx* | -WX* )
|
||||
AR="$AR $1"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
action=$1
|
||||
shift
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
orig_archive=$1
|
||||
shift
|
||||
func_file_conv "$orig_archive"
|
||||
archive=$file
|
||||
|
||||
# strip leading dash in $action
|
||||
action=${action#-}
|
||||
|
||||
delete=
|
||||
extract=
|
||||
list=
|
||||
quick=
|
||||
replace=
|
||||
index=
|
||||
create=
|
||||
|
||||
while test -n "$action"
|
||||
do
|
||||
case $action in
|
||||
d*) delete=yes ;;
|
||||
x*) extract=yes ;;
|
||||
t*) list=yes ;;
|
||||
q*) quick=yes ;;
|
||||
r*) replace=yes ;;
|
||||
s*) index=yes ;;
|
||||
S*) ;; # the index is always updated implicitly
|
||||
c*) create=yes ;;
|
||||
u*) ;; # TODO: don't ignore the update modifier
|
||||
v*) ;; # TODO: don't ignore the verbose modifier
|
||||
*)
|
||||
func_error "unknown action specified"
|
||||
;;
|
||||
esac
|
||||
action=${action#?}
|
||||
done
|
||||
|
||||
case $delete$extract$list$quick$replace,$index in
|
||||
yes,* | ,yes)
|
||||
;;
|
||||
yesyes*)
|
||||
func_error "more than one action specified"
|
||||
;;
|
||||
*)
|
||||
func_error "no action specified"
|
||||
;;
|
||||
esac
|
||||
|
||||
if test -n "$delete"; then
|
||||
if test ! -f "$orig_archive"; then
|
||||
func_error "archive not found"
|
||||
fi
|
||||
for member
|
||||
do
|
||||
case $1 in
|
||||
@*)
|
||||
func_at_file "${1#@}" -REMOVE "$archive"
|
||||
;;
|
||||
*)
|
||||
func_file_conv "$1"
|
||||
$AR -NOLOGO -REMOVE:"$file" "$archive" || exit $?
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
elif test -n "$extract"; then
|
||||
if test ! -f "$orig_archive"; then
|
||||
func_error "archive not found"
|
||||
fi
|
||||
if test $# -gt 0; then
|
||||
for member
|
||||
do
|
||||
case $1 in
|
||||
@*)
|
||||
func_at_file "${1#@}" -EXTRACT "$archive"
|
||||
;;
|
||||
*)
|
||||
func_file_conv "$1"
|
||||
$AR -NOLOGO -EXTRACT:"$file" "$archive" || exit $?
|
||||
;;
|
||||
esac
|
||||
done
|
||||
else
|
||||
$AR -NOLOGO -LIST "$archive" | sed -e 's/\\/\\\\/g' | while read member
|
||||
do
|
||||
$AR -NOLOGO -EXTRACT:"$member" "$archive" || exit $?
|
||||
done
|
||||
fi
|
||||
|
||||
elif test -n "$quick$replace"; then
|
||||
if test ! -f "$orig_archive"; then
|
||||
if test -z "$create"; then
|
||||
echo "$me: creating $orig_archive"
|
||||
fi
|
||||
orig_archive=
|
||||
else
|
||||
orig_archive=$archive
|
||||
fi
|
||||
|
||||
for member
|
||||
do
|
||||
case $1 in
|
||||
@*)
|
||||
func_file_conv "${1#@}"
|
||||
set x "$@" "@$file"
|
||||
;;
|
||||
*)
|
||||
func_file_conv "$1"
|
||||
set x "$@" "$file"
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
shift
|
||||
done
|
||||
|
||||
if test -n "$orig_archive"; then
|
||||
$AR -NOLOGO -OUT:"$archive" "$orig_archive" "$@" || exit $?
|
||||
else
|
||||
$AR -NOLOGO -OUT:"$archive" "$@" || exit $?
|
||||
fi
|
||||
|
||||
elif test -n "$list"; then
|
||||
if test ! -f "$orig_archive"; then
|
||||
func_error "archive not found"
|
||||
fi
|
||||
$AR -NOLOGO -LIST "$archive" || exit $?
|
||||
fi
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,348 @@
|
|||
#! /bin/sh
|
||||
# Wrapper for compilers which do not understand '-c -o'.
|
||||
|
||||
scriptversion=2018-03-07.03; # UTC
|
||||
|
||||
# Copyright (C) 1999-2018 Free Software Foundation, Inc.
|
||||
# Written by Tom Tromey <tromey@cygnus.com>.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# This file is maintained in Automake, please report
|
||||
# bugs to <bug-automake@gnu.org> or send patches to
|
||||
# <automake-patches@gnu.org>.
|
||||
|
||||
nl='
|
||||
'
|
||||
|
||||
# We need space, tab and new line, in precisely that order. Quoting is
|
||||
# there to prevent tools from complaining about whitespace usage.
|
||||
IFS=" "" $nl"
|
||||
|
||||
file_conv=
|
||||
|
||||
# func_file_conv build_file lazy
|
||||
# Convert a $build file to $host form and store it in $file
|
||||
# Currently only supports Windows hosts. If the determined conversion
|
||||
# type is listed in (the comma separated) LAZY, no conversion will
|
||||
# take place.
|
||||
func_file_conv ()
|
||||
{
|
||||
file=$1
|
||||
case $file in
|
||||
/ | /[!/]*) # absolute file, and not a UNC file
|
||||
if test -z "$file_conv"; then
|
||||
# lazily determine how to convert abs files
|
||||
case `uname -s` in
|
||||
MINGW*)
|
||||
file_conv=mingw
|
||||
;;
|
||||
CYGWIN*)
|
||||
file_conv=cygwin
|
||||
;;
|
||||
*)
|
||||
file_conv=wine
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
case $file_conv/,$2, in
|
||||
*,$file_conv,*)
|
||||
;;
|
||||
mingw/*)
|
||||
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
|
||||
;;
|
||||
cygwin/*)
|
||||
file=`cygpath -m "$file" || echo "$file"`
|
||||
;;
|
||||
wine/*)
|
||||
file=`winepath -w "$file" || echo "$file"`
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# func_cl_dashL linkdir
|
||||
# Make cl look for libraries in LINKDIR
|
||||
func_cl_dashL ()
|
||||
{
|
||||
func_file_conv "$1"
|
||||
if test -z "$lib_path"; then
|
||||
lib_path=$file
|
||||
else
|
||||
lib_path="$lib_path;$file"
|
||||
fi
|
||||
linker_opts="$linker_opts -LIBPATH:$file"
|
||||
}
|
||||
|
||||
# func_cl_dashl library
|
||||
# Do a library search-path lookup for cl
|
||||
func_cl_dashl ()
|
||||
{
|
||||
lib=$1
|
||||
found=no
|
||||
save_IFS=$IFS
|
||||
IFS=';'
|
||||
for dir in $lib_path $LIB
|
||||
do
|
||||
IFS=$save_IFS
|
||||
if $shared && test -f "$dir/$lib.dll.lib"; then
|
||||
found=yes
|
||||
lib=$dir/$lib.dll.lib
|
||||
break
|
||||
fi
|
||||
if test -f "$dir/$lib.lib"; then
|
||||
found=yes
|
||||
lib=$dir/$lib.lib
|
||||
break
|
||||
fi
|
||||
if test -f "$dir/lib$lib.a"; then
|
||||
found=yes
|
||||
lib=$dir/lib$lib.a
|
||||
break
|
||||
fi
|
||||
done
|
||||
IFS=$save_IFS
|
||||
|
||||
if test "$found" != yes; then
|
||||
lib=$lib.lib
|
||||
fi
|
||||
}
|
||||
|
||||
# func_cl_wrapper cl arg...
|
||||
# Adjust compile command to suit cl
|
||||
func_cl_wrapper ()
|
||||
{
|
||||
# Assume a capable shell
|
||||
lib_path=
|
||||
shared=:
|
||||
linker_opts=
|
||||
for arg
|
||||
do
|
||||
if test -n "$eat"; then
|
||||
eat=
|
||||
else
|
||||
case $1 in
|
||||
-o)
|
||||
# configure might choose to run compile as 'compile cc -o foo foo.c'.
|
||||
eat=1
|
||||
case $2 in
|
||||
*.o | *.[oO][bB][jJ])
|
||||
func_file_conv "$2"
|
||||
set x "$@" -Fo"$file"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
func_file_conv "$2"
|
||||
set x "$@" -Fe"$file"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
-I)
|
||||
eat=1
|
||||
func_file_conv "$2" mingw
|
||||
set x "$@" -I"$file"
|
||||
shift
|
||||
;;
|
||||
-I*)
|
||||
func_file_conv "${1#-I}" mingw
|
||||
set x "$@" -I"$file"
|
||||
shift
|
||||
;;
|
||||
-l)
|
||||
eat=1
|
||||
func_cl_dashl "$2"
|
||||
set x "$@" "$lib"
|
||||
shift
|
||||
;;
|
||||
-l*)
|
||||
func_cl_dashl "${1#-l}"
|
||||
set x "$@" "$lib"
|
||||
shift
|
||||
;;
|
||||
-L)
|
||||
eat=1
|
||||
func_cl_dashL "$2"
|
||||
;;
|
||||
-L*)
|
||||
func_cl_dashL "${1#-L}"
|
||||
;;
|
||||
-static)
|
||||
shared=false
|
||||
;;
|
||||
-Wl,*)
|
||||
arg=${1#-Wl,}
|
||||
save_ifs="$IFS"; IFS=','
|
||||
for flag in $arg; do
|
||||
IFS="$save_ifs"
|
||||
linker_opts="$linker_opts $flag"
|
||||
done
|
||||
IFS="$save_ifs"
|
||||
;;
|
||||
-Xlinker)
|
||||
eat=1
|
||||
linker_opts="$linker_opts $2"
|
||||
;;
|
||||
-*)
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
*.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
|
||||
func_file_conv "$1"
|
||||
set x "$@" -Tp"$file"
|
||||
shift
|
||||
;;
|
||||
*.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
|
||||
func_file_conv "$1" mingw
|
||||
set x "$@" "$file"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
shift
|
||||
done
|
||||
if test -n "$linker_opts"; then
|
||||
linker_opts="-link$linker_opts"
|
||||
fi
|
||||
exec "$@" $linker_opts
|
||||
exit 1
|
||||
}
|
||||
|
||||
eat=
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
echo "$0: No command. Try '$0 --help' for more information." 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<\EOF
|
||||
Usage: compile [--help] [--version] PROGRAM [ARGS]
|
||||
|
||||
Wrapper for compilers which do not understand '-c -o'.
|
||||
Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
|
||||
arguments, and rename the output as expected.
|
||||
|
||||
If you are trying to build a whole package this is not the
|
||||
right script to run: please start by reading the file 'INSTALL'.
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "compile $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \
|
||||
icl | *[/\\]icl | icl.exe | *[/\\]icl.exe )
|
||||
func_cl_wrapper "$@" # Doesn't return...
|
||||
;;
|
||||
esac
|
||||
|
||||
ofile=
|
||||
cfile=
|
||||
|
||||
for arg
|
||||
do
|
||||
if test -n "$eat"; then
|
||||
eat=
|
||||
else
|
||||
case $1 in
|
||||
-o)
|
||||
# configure might choose to run compile as 'compile cc -o foo foo.c'.
|
||||
# So we strip '-o arg' only if arg is an object.
|
||||
eat=1
|
||||
case $2 in
|
||||
*.o | *.obj)
|
||||
ofile=$2
|
||||
;;
|
||||
*)
|
||||
set x "$@" -o "$2"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*.c)
|
||||
cfile=$1
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
shift
|
||||
done
|
||||
|
||||
if test -z "$ofile" || test -z "$cfile"; then
|
||||
# If no '-o' option was seen then we might have been invoked from a
|
||||
# pattern rule where we don't need one. That is ok -- this is a
|
||||
# normal compilation that the losing compiler can handle. If no
|
||||
# '.c' file was seen then we are probably linking. That is also
|
||||
# ok.
|
||||
exec "$@"
|
||||
fi
|
||||
|
||||
# Name of file we expect compiler to create.
|
||||
cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
|
||||
|
||||
# Create the lock directory.
|
||||
# Note: use '[/\\:.-]' here to ensure that we don't use the same name
|
||||
# that we are using for the .o file. Also, base the name on the expected
|
||||
# object file name, since that is what matters with a parallel build.
|
||||
lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
|
||||
while true; do
|
||||
if mkdir "$lockdir" >/dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
# FIXME: race condition here if user kills between mkdir and trap.
|
||||
trap "rmdir '$lockdir'; exit 1" 1 2 15
|
||||
|
||||
# Run the compile.
|
||||
"$@"
|
||||
ret=$?
|
||||
|
||||
if test -f "$cofile"; then
|
||||
test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
|
||||
elif test -f "${cofile}bj"; then
|
||||
test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
|
||||
fi
|
||||
|
||||
rmdir "$lockdir"
|
||||
exit $ret
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,791 @@
|
|||
#! /bin/sh
|
||||
# depcomp - compile a program generating dependencies as side-effects
|
||||
|
||||
scriptversion=2018-03-07.03; # UTC
|
||||
|
||||
# Copyright (C) 1999-2018 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
echo "$0: No command. Try '$0 --help' for more information." 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<\EOF
|
||||
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
|
||||
|
||||
Run PROGRAMS ARGS to compile a file, generating dependencies
|
||||
as side-effects.
|
||||
|
||||
Environment variables:
|
||||
depmode Dependency tracking mode.
|
||||
source Source file read by 'PROGRAMS ARGS'.
|
||||
object Object file output by 'PROGRAMS ARGS'.
|
||||
DEPDIR directory where to store dependencies.
|
||||
depfile Dependency file to output.
|
||||
tmpdepfile Temporary file to use when outputting dependencies.
|
||||
libtool Whether libtool is used (yes/no).
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "depcomp $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
esac
|
||||
|
||||
# Get the directory component of the given path, and save it in the
|
||||
# global variables '$dir'. Note that this directory component will
|
||||
# be either empty or ending with a '/' character. This is deliberate.
|
||||
set_dir_from ()
|
||||
{
|
||||
case $1 in
|
||||
*/*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;;
|
||||
*) dir=;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Get the suffix-stripped basename of the given path, and save it the
|
||||
# global variable '$base'.
|
||||
set_base_from ()
|
||||
{
|
||||
base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'`
|
||||
}
|
||||
|
||||
# If no dependency file was actually created by the compiler invocation,
|
||||
# we still have to create a dummy depfile, to avoid errors with the
|
||||
# Makefile "include basename.Plo" scheme.
|
||||
make_dummy_depfile ()
|
||||
{
|
||||
echo "#dummy" > "$depfile"
|
||||
}
|
||||
|
||||
# Factor out some common post-processing of the generated depfile.
|
||||
# Requires the auxiliary global variable '$tmpdepfile' to be set.
|
||||
aix_post_process_depfile ()
|
||||
{
|
||||
# If the compiler actually managed to produce a dependency file,
|
||||
# post-process it.
|
||||
if test -f "$tmpdepfile"; then
|
||||
# Each line is of the form 'foo.o: dependency.h'.
|
||||
# Do two passes, one to just change these to
|
||||
# $object: dependency.h
|
||||
# and one to simply output
|
||||
# dependency.h:
|
||||
# which is needed to avoid the deleted-header problem.
|
||||
{ sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile"
|
||||
sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile"
|
||||
} > "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
else
|
||||
make_dummy_depfile
|
||||
fi
|
||||
}
|
||||
|
||||
# A tabulation character.
|
||||
tab=' '
|
||||
# A newline character.
|
||||
nl='
|
||||
'
|
||||
# Character ranges might be problematic outside the C locale.
|
||||
# These definitions help.
|
||||
upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ
|
||||
lower=abcdefghijklmnopqrstuvwxyz
|
||||
digits=0123456789
|
||||
alpha=${upper}${lower}
|
||||
|
||||
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
|
||||
echo "depcomp: Variables source, object and depmode must be set" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
|
||||
depfile=${depfile-`echo "$object" |
|
||||
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
|
||||
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
|
||||
|
||||
rm -f "$tmpdepfile"
|
||||
|
||||
# Avoid interferences from the environment.
|
||||
gccflag= dashmflag=
|
||||
|
||||
# Some modes work just like other modes, but use different flags. We
|
||||
# parameterize here, but still list the modes in the big case below,
|
||||
# to make depend.m4 easier to write. Note that we *cannot* use a case
|
||||
# here, because this file can only contain one case statement.
|
||||
if test "$depmode" = hp; then
|
||||
# HP compiler uses -M and no extra arg.
|
||||
gccflag=-M
|
||||
depmode=gcc
|
||||
fi
|
||||
|
||||
if test "$depmode" = dashXmstdout; then
|
||||
# This is just like dashmstdout with a different argument.
|
||||
dashmflag=-xM
|
||||
depmode=dashmstdout
|
||||
fi
|
||||
|
||||
cygpath_u="cygpath -u -f -"
|
||||
if test "$depmode" = msvcmsys; then
|
||||
# This is just like msvisualcpp but w/o cygpath translation.
|
||||
# Just convert the backslash-escaped backslashes to single forward
|
||||
# slashes to satisfy depend.m4
|
||||
cygpath_u='sed s,\\\\,/,g'
|
||||
depmode=msvisualcpp
|
||||
fi
|
||||
|
||||
if test "$depmode" = msvc7msys; then
|
||||
# This is just like msvc7 but w/o cygpath translation.
|
||||
# Just convert the backslash-escaped backslashes to single forward
|
||||
# slashes to satisfy depend.m4
|
||||
cygpath_u='sed s,\\\\,/,g'
|
||||
depmode=msvc7
|
||||
fi
|
||||
|
||||
if test "$depmode" = xlc; then
|
||||
# IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information.
|
||||
gccflag=-qmakedep=gcc,-MF
|
||||
depmode=gcc
|
||||
fi
|
||||
|
||||
case "$depmode" in
|
||||
gcc3)
|
||||
## gcc 3 implements dependency tracking that does exactly what
|
||||
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
|
||||
## it if -MD -MP comes after the -MF stuff. Hmm.
|
||||
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
|
||||
## the command line argument order; so add the flags where they
|
||||
## appear in depend2.am. Note that the slowdown incurred here
|
||||
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
|
||||
*) set fnord "$@" "$arg" ;;
|
||||
esac
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
done
|
||||
"$@"
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
mv "$tmpdepfile" "$depfile"
|
||||
;;
|
||||
|
||||
gcc)
|
||||
## Note that this doesn't just cater to obsosete pre-3.x GCC compilers.
|
||||
## but also to in-use compilers like IMB xlc/xlC and the HP C compiler.
|
||||
## (see the conditional assignment to $gccflag above).
|
||||
## There are various ways to get dependency output from gcc. Here's
|
||||
## why we pick this rather obscure method:
|
||||
## - Don't want to use -MD because we'd like the dependencies to end
|
||||
## up in a subdir. Having to rename by hand is ugly.
|
||||
## (We might end up doing this anyway to support other compilers.)
|
||||
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
|
||||
## -MM, not -M (despite what the docs say). Also, it might not be
|
||||
## supported by the other compilers which use the 'gcc' depmode.
|
||||
## - Using -M directly means running the compiler twice (even worse
|
||||
## than renaming).
|
||||
if test -z "$gccflag"; then
|
||||
gccflag=-MD,
|
||||
fi
|
||||
"$@" -Wp,"$gccflag$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
# The second -e expression handles DOS-style file names with drive
|
||||
# letters.
|
||||
sed -e 's/^[^:]*: / /' \
|
||||
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
|
||||
## This next piece of magic avoids the "deleted header file" problem.
|
||||
## The problem is that when a header file which appears in a .P file
|
||||
## is deleted, the dependency causes make to die (because there is
|
||||
## typically no way to rebuild the header). We avoid this by adding
|
||||
## dummy dependencies for each header file. Too bad gcc doesn't do
|
||||
## this for us directly.
|
||||
## Some versions of gcc put a space before the ':'. On the theory
|
||||
## that the space means something, we add a space to the output as
|
||||
## well. hp depmode also adds that space, but also prefixes the VPATH
|
||||
## to the object. Take care to not repeat it in the output.
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
tr ' ' "$nl" < "$tmpdepfile" \
|
||||
| sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
|
||||
| sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
hp)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
sgi)
|
||||
if test "$libtool" = yes; then
|
||||
"$@" "-Wp,-MDupdate,$tmpdepfile"
|
||||
else
|
||||
"$@" -MDupdate "$tmpdepfile"
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
|
||||
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
|
||||
echo "$object : \\" > "$depfile"
|
||||
# Clip off the initial element (the dependent). Don't try to be
|
||||
# clever and replace this with sed code, as IRIX sed won't handle
|
||||
# lines with more than a fixed number of characters (4096 in
|
||||
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
|
||||
# the IRIX cc adds comments like '#:fec' to the end of the
|
||||
# dependency line.
|
||||
tr ' ' "$nl" < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \
|
||||
| tr "$nl" ' ' >> "$depfile"
|
||||
echo >> "$depfile"
|
||||
# The second pass generates a dummy entry for each header file.
|
||||
tr ' ' "$nl" < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
|
||||
>> "$depfile"
|
||||
else
|
||||
make_dummy_depfile
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
xlc)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
aix)
|
||||
# The C for AIX Compiler uses -M and outputs the dependencies
|
||||
# in a .u file. In older versions, this file always lives in the
|
||||
# current directory. Also, the AIX compiler puts '$object:' at the
|
||||
# start of each line; $object doesn't have directory information.
|
||||
# Version 6 uses the directory in both cases.
|
||||
set_dir_from "$object"
|
||||
set_base_from "$object"
|
||||
if test "$libtool" = yes; then
|
||||
tmpdepfile1=$dir$base.u
|
||||
tmpdepfile2=$base.u
|
||||
tmpdepfile3=$dir.libs/$base.u
|
||||
"$@" -Wc,-M
|
||||
else
|
||||
tmpdepfile1=$dir$base.u
|
||||
tmpdepfile2=$dir$base.u
|
||||
tmpdepfile3=$dir$base.u
|
||||
"$@" -M
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
aix_post_process_depfile
|
||||
;;
|
||||
|
||||
tcc)
|
||||
# tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26
|
||||
# FIXME: That version still under development at the moment of writing.
|
||||
# Make that this statement remains true also for stable, released
|
||||
# versions.
|
||||
# It will wrap lines (doesn't matter whether long or short) with a
|
||||
# trailing '\', as in:
|
||||
#
|
||||
# foo.o : \
|
||||
# foo.c \
|
||||
# foo.h \
|
||||
#
|
||||
# It will put a trailing '\' even on the last line, and will use leading
|
||||
# spaces rather than leading tabs (at least since its commit 0394caf7
|
||||
# "Emit spaces for -MD").
|
||||
"$@" -MD -MF "$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
# Each non-empty line is of the form 'foo.o : \' or ' dep.h \'.
|
||||
# We have to change lines of the first kind to '$object: \'.
|
||||
sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile"
|
||||
# And for each line of the second kind, we have to emit a 'dep.h:'
|
||||
# dummy dependency, to avoid the deleted-header problem.
|
||||
sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
## The order of this option in the case statement is important, since the
|
||||
## shell code in configure will try each of these formats in the order
|
||||
## listed in this file. A plain '-MD' option would be understood by many
|
||||
## compilers, so we must ensure this comes after the gcc and icc options.
|
||||
pgcc)
|
||||
# Portland's C compiler understands '-MD'.
|
||||
# Will always output deps to 'file.d' where file is the root name of the
|
||||
# source file under compilation, even if file resides in a subdirectory.
|
||||
# The object file name does not affect the name of the '.d' file.
|
||||
# pgcc 10.2 will output
|
||||
# foo.o: sub/foo.c sub/foo.h
|
||||
# and will wrap long lines using '\' :
|
||||
# foo.o: sub/foo.c ... \
|
||||
# sub/foo.h ... \
|
||||
# ...
|
||||
set_dir_from "$object"
|
||||
# Use the source, not the object, to determine the base name, since
|
||||
# that's sadly what pgcc will do too.
|
||||
set_base_from "$source"
|
||||
tmpdepfile=$base.d
|
||||
|
||||
# For projects that build the same source file twice into different object
|
||||
# files, the pgcc approach of using the *source* file root name can cause
|
||||
# problems in parallel builds. Use a locking strategy to avoid stomping on
|
||||
# the same $tmpdepfile.
|
||||
lockdir=$base.d-lock
|
||||
trap "
|
||||
echo '$0: caught signal, cleaning up...' >&2
|
||||
rmdir '$lockdir'
|
||||
exit 1
|
||||
" 1 2 13 15
|
||||
numtries=100
|
||||
i=$numtries
|
||||
while test $i -gt 0; do
|
||||
# mkdir is a portable test-and-set.
|
||||
if mkdir "$lockdir" 2>/dev/null; then
|
||||
# This process acquired the lock.
|
||||
"$@" -MD
|
||||
stat=$?
|
||||
# Release the lock.
|
||||
rmdir "$lockdir"
|
||||
break
|
||||
else
|
||||
# If the lock is being held by a different process, wait
|
||||
# until the winning process is done or we timeout.
|
||||
while test -d "$lockdir" && test $i -gt 0; do
|
||||
sleep 1
|
||||
i=`expr $i - 1`
|
||||
done
|
||||
fi
|
||||
i=`expr $i - 1`
|
||||
done
|
||||
trap - 1 2 13 15
|
||||
if test $i -le 0; then
|
||||
echo "$0: failed to acquire lock after $numtries attempts" >&2
|
||||
echo "$0: check lockdir '$lockdir'" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
# Each line is of the form `foo.o: dependent.h',
|
||||
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
|
||||
# Do two passes, one to just change these to
|
||||
# `$object: dependent.h' and one to simply `dependent.h:'.
|
||||
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
|
||||
# Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
# correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \
|
||||
| sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
hp2)
|
||||
# The "hp" stanza above does not work with aCC (C++) and HP's ia64
|
||||
# compilers, which have integrated preprocessors. The correct option
|
||||
# to use with these is +Maked; it writes dependencies to a file named
|
||||
# 'foo.d', which lands next to the object file, wherever that
|
||||
# happens to be.
|
||||
# Much of this is similar to the tru64 case; see comments there.
|
||||
set_dir_from "$object"
|
||||
set_base_from "$object"
|
||||
if test "$libtool" = yes; then
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir.libs/$base.d
|
||||
"$@" -Wc,+Maked
|
||||
else
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir$base.d
|
||||
"$@" +Maked
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
if test -f "$tmpdepfile"; then
|
||||
sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile"
|
||||
# Add 'dependent.h:' lines.
|
||||
sed -ne '2,${
|
||||
s/^ *//
|
||||
s/ \\*$//
|
||||
s/$/:/
|
||||
p
|
||||
}' "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
make_dummy_depfile
|
||||
fi
|
||||
rm -f "$tmpdepfile" "$tmpdepfile2"
|
||||
;;
|
||||
|
||||
tru64)
|
||||
# The Tru64 compiler uses -MD to generate dependencies as a side
|
||||
# effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
|
||||
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
|
||||
# dependencies in 'foo.d' instead, so we check for that too.
|
||||
# Subdirectories are respected.
|
||||
set_dir_from "$object"
|
||||
set_base_from "$object"
|
||||
|
||||
if test "$libtool" = yes; then
|
||||
# Libtool generates 2 separate objects for the 2 libraries. These
|
||||
# two compilations output dependencies in $dir.libs/$base.o.d and
|
||||
# in $dir$base.o.d. We have to check for both files, because
|
||||
# one of the two compilations can be disabled. We should prefer
|
||||
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
|
||||
# automatically cleaned when .libs/ is deleted, while ignoring
|
||||
# the former would cause a distcleancheck panic.
|
||||
tmpdepfile1=$dir$base.o.d # libtool 1.5
|
||||
tmpdepfile2=$dir.libs/$base.o.d # Likewise.
|
||||
tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504
|
||||
"$@" -Wc,-MD
|
||||
else
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir$base.d
|
||||
tmpdepfile3=$dir$base.d
|
||||
"$@" -MD
|
||||
fi
|
||||
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
# Same post-processing that is required for AIX mode.
|
||||
aix_post_process_depfile
|
||||
;;
|
||||
|
||||
msvc7)
|
||||
if test "$libtool" = yes; then
|
||||
showIncludes=-Wc,-showIncludes
|
||||
else
|
||||
showIncludes=-showIncludes
|
||||
fi
|
||||
"$@" $showIncludes > "$tmpdepfile"
|
||||
stat=$?
|
||||
grep -v '^Note: including file: ' "$tmpdepfile"
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
# The first sed program below extracts the file names and escapes
|
||||
# backslashes for cygpath. The second sed program outputs the file
|
||||
# name when reading, but also accumulates all include files in the
|
||||
# hold buffer in order to output them again at the end. This only
|
||||
# works with sed implementations that can handle large buffers.
|
||||
sed < "$tmpdepfile" -n '
|
||||
/^Note: including file: *\(.*\)/ {
|
||||
s//\1/
|
||||
s/\\/\\\\/g
|
||||
p
|
||||
}' | $cygpath_u | sort -u | sed -n '
|
||||
s/ /\\ /g
|
||||
s/\(.*\)/'"$tab"'\1 \\/p
|
||||
s/.\(.*\) \\/\1:/
|
||||
H
|
||||
$ {
|
||||
s/.*/'"$tab"'/
|
||||
G
|
||||
p
|
||||
}' >> "$depfile"
|
||||
echo >> "$depfile" # make sure the fragment doesn't end with a backslash
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvc7msys)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
#nosideeffect)
|
||||
# This comment above is used by automake to tell side-effect
|
||||
# dependency tracking mechanisms from slower ones.
|
||||
|
||||
dashmstdout)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout, regardless of -o.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove '-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
test -z "$dashmflag" && dashmflag=-M
|
||||
# Require at least two characters before searching for ':'
|
||||
# in the target name. This is to cope with DOS-style filenames:
|
||||
# a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
|
||||
"$@" $dashmflag |
|
||||
sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
cat < "$tmpdepfile" > "$depfile"
|
||||
# Some versions of the HPUX 10.20 sed can't process this sed invocation
|
||||
# correctly. Breaking it into two sed invocations is a workaround.
|
||||
tr ' ' "$nl" < "$tmpdepfile" \
|
||||
| sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
|
||||
| sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
dashXmstdout)
|
||||
# This case only exists to satisfy depend.m4. It is never actually
|
||||
# run, as this mode is specially recognized in the preamble.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
makedepend)
|
||||
"$@" || exit $?
|
||||
# Remove any Libtool call
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
# X makedepend
|
||||
shift
|
||||
cleared=no eat=no
|
||||
for arg
|
||||
do
|
||||
case $cleared in
|
||||
no)
|
||||
set ""; shift
|
||||
cleared=yes ;;
|
||||
esac
|
||||
if test $eat = yes; then
|
||||
eat=no
|
||||
continue
|
||||
fi
|
||||
case "$arg" in
|
||||
-D*|-I*)
|
||||
set fnord "$@" "$arg"; shift ;;
|
||||
# Strip any option that makedepend may not understand. Remove
|
||||
# the object too, otherwise makedepend will parse it as a source file.
|
||||
-arch)
|
||||
eat=yes ;;
|
||||
-*|$object)
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"; shift ;;
|
||||
esac
|
||||
done
|
||||
obj_suffix=`echo "$object" | sed 's/^.*\././'`
|
||||
touch "$tmpdepfile"
|
||||
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
|
||||
rm -f "$depfile"
|
||||
# makedepend may prepend the VPATH from the source file name to the object.
|
||||
# No need to regex-escape $object, excess matching of '.' is harmless.
|
||||
sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
|
||||
# Some versions of the HPUX 10.20 sed can't process the last invocation
|
||||
# correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed '1,2d' "$tmpdepfile" \
|
||||
| tr ' ' "$nl" \
|
||||
| sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
|
||||
| sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile" "$tmpdepfile".bak
|
||||
;;
|
||||
|
||||
cpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove '-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
"$@" -E \
|
||||
| sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
|
||||
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
|
||||
| sed '$ s: \\$::' > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
cat < "$tmpdepfile" >> "$depfile"
|
||||
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvisualcpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case "$arg" in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
|
||||
set fnord "$@"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
"$@" -E 2>/dev/null |
|
||||
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile"
|
||||
echo "$tab" >> "$depfile"
|
||||
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvcmsys)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
none)
|
||||
exec "$@"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Unknown depmode $depmode" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
|
@ -0,0 +1,486 @@
|
|||
#! /bin/sh
|
||||
|
||||
# Extract macro arguments from autotools input with GNU M4.
|
||||
# Written by Gary V. Vaughan, 2010
|
||||
#
|
||||
# This is free software. There is NO warranty; not even for
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
#
|
||||
# Copyright (C) 2010-2019 Bootstrap Authors
|
||||
#
|
||||
# This file is dual licensed under the terms of the MIT license
|
||||
# <https://opensource.org/license/MIT>, and GPL version 3 or later
|
||||
# <http://www.gnu.org/licenses/gpl-2.0.html>. You must apply one of
|
||||
# these licenses when using or redistributing this software or any of
|
||||
# the files within it. See the URLs above, or the file `LICENSE`
|
||||
# included in the Bootstrap distribution for the full license texts.
|
||||
|
||||
# Please report bugs or propose patches to:
|
||||
# <https://github.com/gnulib-modules/bootstrap/issues>
|
||||
|
||||
# Make sure we've evaluated scripts we depend on.
|
||||
test -z "$progpath" && . `echo "$0" |${SED-sed} 's|[^/]*$||'`/funclib.sh
|
||||
test extract-trace = "$progname" && . `echo "$0" |${SED-sed} 's|[^/]*$||'`/options-parser
|
||||
|
||||
# Set a version string.
|
||||
scriptversion=2019-02-19.15; # UTC
|
||||
|
||||
|
||||
## ------ ##
|
||||
## Usage. ##
|
||||
## ------ ##
|
||||
|
||||
# Run './extract-trace --help' for help with using this script from the
|
||||
# command line.
|
||||
#
|
||||
# Or source first 'options-parser' and then this file into your own
|
||||
# scripts in order to make use of the function and variable framework
|
||||
# they define, and also to avoid the overhead of forking to run this
|
||||
# script in its own process on every call.
|
||||
|
||||
|
||||
|
||||
## ----------------- ##
|
||||
## Helper functions. ##
|
||||
## ----------------- ##
|
||||
|
||||
# This section contains the helper functions used by the rest of
|
||||
# 'extract-trace'.
|
||||
|
||||
|
||||
# func_autoconf_configure MAYBE-CONFIGURE-FILE
|
||||
# --------------------------------------------
|
||||
# Ensure that MAYBE-CONFIGURE-FILE is the name of a file in the current
|
||||
# directory that contains an uncommented call to AC_INIT.
|
||||
func_autoconf_configure ()
|
||||
{
|
||||
$debug_cmd
|
||||
|
||||
_G_sed_no_comment='
|
||||
s|#.*$||
|
||||
s|^dnl .*$||
|
||||
s| dnl .*$||'
|
||||
_G_ac_init=
|
||||
|
||||
# If we were passed a genuine file, make sure it calls AC_INIT.
|
||||
test -f "$1" \
|
||||
&& _G_ac_init=`$SED "$_G_sed_no_comment" "$1" |$GREP AC_INIT`
|
||||
|
||||
# Otherwise it is not a genuine Autoconf input file.
|
||||
test -n "$_G_ac_init"
|
||||
_G_status=$?
|
||||
|
||||
test 0 -ne "$_G_status" \
|
||||
&& func_verbose "'$1' not using Autoconf"
|
||||
|
||||
(exit $_G_status)
|
||||
}
|
||||
|
||||
|
||||
# func_tool_version_output CMD [FATAL-ERROR-MSG]
|
||||
# ----------------------------------------------
|
||||
# Attempt to run 'CMD --version', discarding errors. The output can be
|
||||
# ignored by redirecting stdout, and this function used simply to test
|
||||
# whether the command exists and exits normally when passed a
|
||||
# '--version' argument.
|
||||
# When FATAL-ERROR-MSG is given, then this function will display the
|
||||
# message and exit if running 'CMD --version' returns a non-zero exit
|
||||
# status.
|
||||
func_tool_version_output ()
|
||||
{
|
||||
$debug_cmd
|
||||
|
||||
_G_cmd=$1
|
||||
_G_fatal_error_msg=$2
|
||||
|
||||
# Some tools, like 'git2cl' produce thousands of lines of output
|
||||
# unless stdin is /dev/null - in that case we want to return
|
||||
# successfully without saving all of that output. Other tools,
|
||||
# such as 'help2man' exit with a non-zero status when stdin comes
|
||||
# from /dev/null, so we re-execute without /dev/null if that
|
||||
# happens. This means that occasionally, the output from both calls
|
||||
# ends up in the result, but the alternative would be to discard the
|
||||
# output from one call, and hope the other produces something useful.
|
||||
{ $_G_cmd --version </dev/null || $_G_cmd --version; } 2>/dev/null
|
||||
_G_status=$?
|
||||
|
||||
test 0 -ne "$_G_status" && test -n "$_G_fatal_error_msg" \
|
||||
&& func_fatal_error "$_G_fatal_error_msg"
|
||||
|
||||
(exit $_G_status)
|
||||
}
|
||||
|
||||
|
||||
# func_tool_version_number CMD [FATAL-ERROR-MSG]
|
||||
# ----------------------------------------------
|
||||
# Pass arguments to func_tool_version_output, but set
|
||||
# $func_tool_version_number_result to the last dot delimited digit string
|
||||
# on the first line of output.
|
||||
func_tool_version_number ()
|
||||
{
|
||||
$debug_cmd
|
||||
|
||||
_G_verout=`func_tool_version_output "$@"`
|
||||
_G_status=$?
|
||||
|
||||
# A version number starts with a digit following a space on the first
|
||||
# line of output from `--version`.
|
||||
_G_verout=`echo "$_G_verout" |sed 1q`
|
||||
if test -n "$_G_verout"; then
|
||||
_G_vernum=`expr "$_G_verout" : '.* \([0-9][^ ]*\)'`
|
||||
fi
|
||||
|
||||
if test -n "$_G_vernum"; then
|
||||
printf '%s\n' "$_G_vernum"
|
||||
else
|
||||
printf '%s\n' "$_G_verout"
|
||||
fi
|
||||
|
||||
(exit $_G_status)
|
||||
}
|
||||
|
||||
|
||||
# func_find_tool ENVVAR NAMES...
|
||||
# ------------------------------
|
||||
# Search for a required program. Use the value of ENVVAR, if set,
|
||||
# otherwise find the first of the NAMES that can be run (i.e.,
|
||||
# supports --version). If found, set ENVVAR to the program name,
|
||||
# die otherwise.
|
||||
func_find_tool ()
|
||||
{
|
||||
$debug_cmd
|
||||
|
||||
_G_find_tool_envvar=$1
|
||||
shift
|
||||
_G_find_tool_names=$@
|
||||
eval "_G_find_tool_res=\$$_G_find_tool_envvar"
|
||||
if test -n "$_G_find_tool_res"; then
|
||||
_G_find_tool_error_prefix="\$$find_tool_envvar: "
|
||||
else
|
||||
_G_find_tool_res=
|
||||
_G_bestver=
|
||||
for _G_prog
|
||||
do
|
||||
_G_find_tool_save_IFS=$IFS
|
||||
IFS=${PATH_SEPARATOR-:}
|
||||
for _G_dir in $PATH; do
|
||||
IFS=$_G_find_tool_save_IFS
|
||||
_G_progpath=$_G_dir/$_G_prog
|
||||
test -r "$_G_progpath" && {
|
||||
_G_curver=`func_tool_version_number $_G_progpath`
|
||||
case $_G_bestver,$_G_curver in
|
||||
,)
|
||||
# first non--version responsive prog sticks!
|
||||
test -n "$_G_progpath" || _G_find_tool_res=$_G_progpath
|
||||
;;
|
||||
,*)
|
||||
# first --version responsive prog beats non--version responsive!
|
||||
_G_find_tool_res=$_G_progpath
|
||||
_G_bestver=$_G_curver
|
||||
;;
|
||||
*,*)
|
||||
# another --version responsive prog must be newer to beat previous one!
|
||||
test "x$_G_curver" = "x$_G_bestver" \
|
||||
|| func_lt_ver "$_G_curver" "$_G_bestver" \
|
||||
|| {
|
||||
_G_find_tool_res=$_G_progpath
|
||||
_G_bestver=$_G_curver
|
||||
}
|
||||
;;
|
||||
esac
|
||||
}
|
||||
done
|
||||
IFS=$_G_find_tool_save_IFS
|
||||
done
|
||||
fi
|
||||
if test -n "$_G_find_tool_res"; then
|
||||
func_tool_version_number >/dev/null $_G_find_tool_res "\
|
||||
${_G_find_tool_error_prefix}Cannot run '$_G_find_tool_res --version'"
|
||||
|
||||
# Make sure the result is exported to the environment for children
|
||||
# to use.
|
||||
eval "$_G_find_tool_envvar=\$_G_find_tool_res"
|
||||
eval "export $_G_find_tool_envvar"
|
||||
else
|
||||
func_error "\
|
||||
One of these is required:
|
||||
$_G_find_tool_names"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
|
||||
## -------------------- ##
|
||||
## Resource management. ##
|
||||
## -------------------- ##
|
||||
|
||||
# This section contains definitions for functions that each ensure a
|
||||
# particular resource (a file, or a non-empty configuration variable for
|
||||
# example) is available, and if appropriate to extract default values
|
||||
# from pertinent package files. Where a variable already has a non-
|
||||
# empty value (as set by the package's 'bootstrap.conf'), that value is
|
||||
# used in preference to deriving the default. Call them using their
|
||||
# associated 'require_*' variable to ensure that they are executed, at
|
||||
# most, once.
|
||||
#
|
||||
# It's entirely deliberate that calling these functions can set
|
||||
# variables that don't obey the namespace limitations obeyed by the rest
|
||||
# of this file, in order that that they be as useful as possible to
|
||||
# callers.
|
||||
|
||||
|
||||
# require_configure_ac
|
||||
# --------------------
|
||||
# Ensure that there is a 'configure.ac' or 'configure.in' file in the
|
||||
# current directory that contains an uncommented call to AC_INIT, and
|
||||
# that '$configure_ac' contains its name.
|
||||
require_configure_ac=func_require_configure_ac
|
||||
func_require_configure_ac ()
|
||||
{
|
||||
$debug_cmd
|
||||
|
||||
test -z "$configure_ac" \
|
||||
&& func_autoconf_configure configure.ac && configure_ac=configure.ac
|
||||
test -z "$configure_ac" \
|
||||
&& func_autoconf_configure configure.in && configure_ac=configure.in
|
||||
test -z "$configure_ac" \
|
||||
|| func_verbose "found '$configure_ac'"
|
||||
|
||||
require_configure_ac=:
|
||||
}
|
||||
|
||||
|
||||
# require_gnu_m4
|
||||
# --------------
|
||||
# Search for GNU M4, and export it in $M4.
|
||||
require_gnu_m4=func_require_gnu_m4
|
||||
func_require_gnu_m4 ()
|
||||
{
|
||||
$debug_cmd
|
||||
|
||||
test -n "$M4" || {
|
||||
# Find the first m4 binary that responds to --version.
|
||||
func_find_tool M4 gm4 gnum4 m4
|
||||
}
|
||||
|
||||
test -n "$M4" || func_fatal_error "\
|
||||
Please install GNU M4, or 'export M4=/path/to/gnu/m4'."
|
||||
|
||||
func_verbose "export M4='$M4'"
|
||||
|
||||
# Make sure the search result is visible to subshells
|
||||
export M4
|
||||
|
||||
require_gnu_m4=:
|
||||
}
|
||||
|
||||
|
||||
## --------------- ##
|
||||
## Core functions. ##
|
||||
## --------------- ##
|
||||
|
||||
# This section contains the high level functions used when calling this
|
||||
# file as a script. 'func_extract_trace' is probably the only one that you
|
||||
# won't want to replace if you source this file into your own script.
|
||||
|
||||
|
||||
# func_extract_trace MACRO_NAMES [FILENAME]...
|
||||
# --------------------------------------------
|
||||
# set '$func_extract_trace_result' to a colon delimited list of arguments
|
||||
# to any of the comma separated list of MACRO_NAMES in FILENAME. If no
|
||||
# FILENAME is given, then '$configure_ac' is assumed.
|
||||
func_extract_trace ()
|
||||
{
|
||||
$debug_cmd
|
||||
|
||||
$require_configure_ac
|
||||
$require_gnu_m4
|
||||
|
||||
_G_m4_traces=`$ECHO "--trace=$1" |$SED 's%,% --trace=%g'`
|
||||
_G_re_macros=`$ECHO "($1)" |$SED 's%,%|%g'`
|
||||
_G_macros="$1"; shift
|
||||
test $# -gt 0 || {
|
||||
set dummy $configure_ac
|
||||
shift
|
||||
}
|
||||
|
||||
# Generate an error if the first file is missing
|
||||
<"$1"
|
||||
|
||||
# Sadly, we can't use 'autom4te' tracing to extract macro arguments,
|
||||
# because it complains about things we want to ignore at bootstrap
|
||||
# time - like missing m4_include files; AC_PREREQ being newer than
|
||||
# the installed autoconf; and returns nothing when tracing
|
||||
# 'AM_INIT_AUTOMAKE' when aclocal hasn't been generated yet.
|
||||
#
|
||||
# The following tries to emulate a less persnickety version of (and
|
||||
# due to not having to wait for Perl startup on every invocation,
|
||||
# it's probably faster too):
|
||||
#
|
||||
# autom4te --language=Autoconf --trace=$my_macro:\$% "$@"
|
||||
#
|
||||
# First we give a minimal set of macro declarations to M4 to prime
|
||||
# it for reading Autoconf macros, while still providing some of the
|
||||
# functionality generally used at m4-time to supply dynamic
|
||||
# arguments to Autocof functions, but without following
|
||||
# 'm4_s?include' files.
|
||||
_G_mini='
|
||||
dnl Initialisation.
|
||||
m4_changequote([,])
|
||||
m4_define([m4_copy], [m4_define([$2], m4_defn([$1]))])
|
||||
m4_define([m4_rename], [m4_copy([$1], [$2])m4_undefine([$1])])
|
||||
|
||||
dnl Replace macros which may abort m4 with a no-op variant.
|
||||
m4_pushdef([m4_assert])
|
||||
m4_pushdef([m4_exit])
|
||||
m4_pushdef([m4_fatal])
|
||||
m4_pushdef([m4_m4exit])
|
||||
|
||||
dnl Replace macros that might break stderr of m4.
|
||||
m4_pushdef([m4_errprint])
|
||||
m4_pushdef([m4_errprintn])
|
||||
m4_pushdef([m4_include])
|
||||
m4_pushdef([m4_warn])
|
||||
|
||||
dnl Avoid side-effects of tracing by extract-trace.
|
||||
m4_pushdef([m4_maketemp])
|
||||
m4_pushdef([m4_mkstemp])
|
||||
|
||||
dnl TODO: reasons for this
|
||||
m4_pushdef([m4_dnl])
|
||||
m4_pushdef([m4_m4wrap])
|
||||
|
||||
dnl Copy and rename macros not handled by "m4 --prefix".
|
||||
m4_define([dnl], [m4_builtin([dnl])])
|
||||
m4_copy([m4_define], [m4_defun])
|
||||
m4_rename([m4_ifelse], [m4_if])
|
||||
m4_rename([m4_patsubst], [m4_bpatsubst])
|
||||
m4_rename([m4_regexp], [m4_bregexp])
|
||||
|
||||
dnl "m4sugar.mini" - useful m4-time macros for dynamic arguments.
|
||||
dnl If we discover packages that need more m4 macros defined in
|
||||
dnl order to bootstrap correctly, add them here:
|
||||
m4_define([m4_bmatch],
|
||||
[m4_if([$#], 0, [], [$#], 1, [], [$#], 2, [$2],
|
||||
[m4_if(m4_bregexp([$1], [$2]), -1,
|
||||
[$0([$1], m4_shift3($@))], [$3])])])
|
||||
m4_define([m4_ifndef], [m4_ifdef([$1], [$3], [$2])])
|
||||
m4_define([m4_ifset],
|
||||
[m4_ifdef([$1], [m4_ifval(m4_defn([$1]), [$2], [$3])], [$3])])
|
||||
m4_define([m4_require], [$1])
|
||||
m4_define([m4_shift3], [m4_shift(m4shift(m4shift($@)))])
|
||||
|
||||
dnl "autoconf.mini" - things from autoconf macros we care about.
|
||||
m4_copy([m4_defun], [AC_DEFUN])
|
||||
|
||||
dnl Dummy definitions for the macros we want to trace.
|
||||
dnl AM_INIT_AUTOMAKE at least produces no trace without this.
|
||||
'
|
||||
|
||||
_G_save=$IFS
|
||||
IFS=,
|
||||
for _G_macro in $_G_macros; do
|
||||
IFS=$_G_save
|
||||
func_append _G_mini "AC_DEFUN([$_G_macro])$nl"
|
||||
done
|
||||
IFS=$_G_save
|
||||
|
||||
# We discard M4's stdout, but the M4 trace output from reading our
|
||||
# "autoconf.mini" followed by any other files passed to this
|
||||
# function is then scanned by sed to transform it into a colon
|
||||
# delimited argument list assigned to a shell variable.
|
||||
_G_transform='s|#.*$||; s|^dnl .*$||; s| dnl .*$||;'
|
||||
|
||||
# Unfortunately, alternation in regexp addresses doesn't work in at
|
||||
# least BSD (and hence Mac OS X) sed, so we have to append a capture
|
||||
# and print block for each traced macro to the sed transform script.
|
||||
_G_save=$IFS
|
||||
IFS=,
|
||||
for _G_macro in $_G_macros; do
|
||||
IFS=$_G_save
|
||||
func_append _G_transform '
|
||||
/^m4trace: -1- '"$_G_macro"'/ {
|
||||
s|^m4trace: -1- '"$_G_macro"'[([]*||
|
||||
s|], [[]|:|g
|
||||
s|[])]*$|:|
|
||||
s|\(.\):$|\1|
|
||||
p
|
||||
}'
|
||||
done
|
||||
IFS=$_G_save
|
||||
|
||||
# Save the command pipeline results for further use by callers of
|
||||
# this function.
|
||||
func_extract_trace_result=`$ECHO "$_G_mini" \
|
||||
|$M4 -daq --prefix $_G_m4_traces - "$@" 2>&1 1>/dev/null \
|
||||
|$SED -n -e "$_G_transform"`
|
||||
}
|
||||
|
||||
|
||||
# func_extract_trace_first MACRO_NAMES [FILENAME]...
|
||||
# --------------------------------------------------
|
||||
# Exactly like func_extract_trace, except that only the first argument
|
||||
# to the first invocation of one of the comma separated MACRO_NAMES is
|
||||
# returned in '$func_extract_trace_first_result'.
|
||||
func_extract_trace_first ()
|
||||
{
|
||||
$debug_cmd
|
||||
|
||||
func_extract_trace ${1+"$@"}
|
||||
func_extract_trace_first_result=`$ECHO "$func_extract_trace_result" \
|
||||
|$SED -e 's|:.*$||g' -e 1q`
|
||||
}
|
||||
|
||||
|
||||
# func_main [ARG]...
|
||||
# ------------------
|
||||
func_main ()
|
||||
{
|
||||
$debug_cmd
|
||||
|
||||
# Configuration.
|
||||
usage='$progname MACRO_NAME FILE [...]'
|
||||
|
||||
long_help_message='
|
||||
The first argument to this program is the name of an autotools macro
|
||||
whose arguments you want to extract by examining the files listed in the
|
||||
remaining arguments using the same tool that Autoconf and Automake use,
|
||||
GNU M4.
|
||||
|
||||
The arguments are returned separated by colons, with each traced call
|
||||
on a separate line.'
|
||||
|
||||
# Option processing.
|
||||
func_options "$@"
|
||||
eval set dummy "$func_options_result"; shift
|
||||
|
||||
# Validate remaining non-option arguments.
|
||||
test $# -gt 1 \
|
||||
|| func_fatal_help "not enough arguments"
|
||||
|
||||
# Pass non-option arguments to extraction function.
|
||||
func_extract_trace "$@"
|
||||
|
||||
# Display results.
|
||||
test -n "$func_extract_trace_result" \
|
||||
&& $ECHO "$func_extract_trace_result"
|
||||
|
||||
# The End.
|
||||
exit $EXIT_SUCCESS
|
||||
}
|
||||
|
||||
|
||||
## --------------------------- ##
|
||||
## Actually perform the trace. ##
|
||||
## --------------------------- ##
|
||||
|
||||
# Only call 'func_main' if this script was called directly.
|
||||
test extract-trace = "$progname" && func_main "$@"
|
||||
|
||||
# Local variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
# time-stamp-pattern: "50/scriptversion=%:y-%02m-%02d.%02H; # UTC"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# End:
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,159 @@
|
|||
#! /bin/sh
|
||||
|
||||
# Output the contents of a shell script with sourced files inlined.
|
||||
# Written by Gary V. Vaughan, 2012
|
||||
|
||||
# This is free software. There is NO warranty; not even for
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
#
|
||||
# Copyright (C) 2012-2019 Bootstrap Authors
|
||||
#
|
||||
# This file is dual licensed under the terms of the MIT license
|
||||
# <https://opensource.org/license/MIT>, and GPL version 3 or later
|
||||
# <http://www.gnu.org/licenses/gpl-2.0.html>. You must apply one of
|
||||
# these licenses when using or redistributing this software or any of
|
||||
# the files within it. See the URLs above, or the file `LICENSE`
|
||||
# included in the Bootstrap distribution for the full license texts.
|
||||
|
||||
# Please report bugs or propose patches to:
|
||||
# <https://github.com/gnulib-modules/bootstrap/issues>
|
||||
|
||||
# Source required external libraries:
|
||||
. `echo "$0" |${SED-sed} 's|[^/]*$||'`"funclib.sh"
|
||||
. `echo "$0" |${SED-sed} 's|[^/]*$||'`"options-parser"
|
||||
|
||||
# Set a version string for *this* script.
|
||||
scriptversion=2019-02-19.15; # UTC
|
||||
|
||||
|
||||
## ------ ##
|
||||
## Usage. ##
|
||||
## ------ ##
|
||||
|
||||
# Run 'build-aux/inline-source --help' for help with using this script
|
||||
# from the command line.
|
||||
|
||||
# Recursively scan through a FILE passed on the command line, replacing
|
||||
# either of the following:
|
||||
# . "relative/file"
|
||||
# . `echo "$0" |edit`"relative/file"
|
||||
# with the contents of the referenced files.
|
||||
|
||||
|
||||
## ---------------- ##
|
||||
## Options parsing. ##
|
||||
## ---------------- ##
|
||||
|
||||
usage='$progpath [OPTION]... FILE'
|
||||
|
||||
# Short help message in response to '-h'.
|
||||
usage_message='Options:
|
||||
--debug enable verbose shell tracing
|
||||
--version print version information and exit
|
||||
-h, --help print help message and exit
|
||||
'
|
||||
|
||||
long_help_message="\
|
||||
Report bugs to <bug-libtool@gnu.org>
|
||||
General help using GNU software: <http://www.gnu.org/gethelp/>."
|
||||
|
||||
func_options ${1+"$@"}
|
||||
eval set dummy "$func_options_result"; shift
|
||||
|
||||
|
||||
## -------------------- ##
|
||||
## Resource management. ##
|
||||
## -------------------- ##
|
||||
|
||||
# require_AWK
|
||||
# -----------
|
||||
# Search for a "not hopeless" awk.
|
||||
require_AWK=func_require_AWK
|
||||
func_require_AWK ()
|
||||
{
|
||||
$debug_cmd
|
||||
|
||||
test -n "$AWK" || {
|
||||
# Find the first executable in the list.
|
||||
for _G_prog in gawk mawk nawk awk
|
||||
do
|
||||
require_AWK_IFS=$IFS
|
||||
IFS=${PATH_SEPARATOR-:}
|
||||
for _G_dir in $PATH
|
||||
do
|
||||
IFS=$require_AWK_IFS
|
||||
if test -f "$_G_dir/$_G_prog" && test -x "$_G_dir/$_G_prog"
|
||||
then
|
||||
AWK=$_G_dir/$_G_prog
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
IFS=$require_AWK_IFS
|
||||
done
|
||||
}
|
||||
|
||||
test -n "$AWK" || func_fatal_error "\
|
||||
Please install GNU Awk, or 'export AWK=/path/to/gnu/awk'."
|
||||
|
||||
func_verbose "found '$AWK'."
|
||||
|
||||
require_AWK=:
|
||||
}
|
||||
|
||||
|
||||
## --------------- ##
|
||||
## Core functions. ##
|
||||
## --------------- ##
|
||||
|
||||
# func_include LINE
|
||||
# -----------------
|
||||
# Output the contents of file included by LINE.
|
||||
func_include ()
|
||||
{
|
||||
$require_AWK
|
||||
|
||||
test -f "$1" \
|
||||
|| func_fatal_error "file '$1' not found"
|
||||
|
||||
_G_scriptdir=`echo "$1" |$SED 's|[^/]*$||'`
|
||||
test -n "$_G_scriptdir" || _G_scriptdir="./"
|
||||
|
||||
$AWK '
|
||||
BEGIN { magic = '${_RECURSE_MAGIC-0}'; }
|
||||
|
||||
/^#!/ && magic == 0 {
|
||||
print $0;
|
||||
print "## DO NOT EDIT - This file generated from '$1'";
|
||||
print "## by '$progname' v'$scriptversion'";
|
||||
magic++;
|
||||
next;
|
||||
}
|
||||
|
||||
/^\. ['\''"].*['\''"]$/ {
|
||||
file = substr ($2, 2, length ($2) -2);
|
||||
system (sprintf ("env _RECURSE_MAGIC=%d '$progpath' %s", magic, file));
|
||||
next;
|
||||
}
|
||||
|
||||
/^\. `echo [^`]*`['\''"][^'\''"]*['\''"]$/ {
|
||||
tail = substr ($0, match ($0, /`['\''"]/));
|
||||
file = substr (tail, 3, length (tail) -3);
|
||||
system (sprintf ("env _RECURSE_MAGIC=%d '$progpath' '"$_G_scriptdir"'%s", magic, file));
|
||||
next;
|
||||
}
|
||||
|
||||
{ print; }
|
||||
' < "$1"
|
||||
}
|
||||
|
||||
func_include "$1"
|
||||
|
||||
exit 0
|
||||
|
||||
# Local variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
# time-stamp-pattern: "30/scriptversion=%:y-%02m-%02d.%02H; # UTC"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# End:
|
|
@ -0,0 +1,518 @@
|
|||
#!/bin/sh
|
||||
# install - install a program, script, or datafile
|
||||
|
||||
scriptversion=2018-03-11.20; # UTC
|
||||
|
||||
# This originates from X11R5 (mit/util/scripts/install.sh), which was
|
||||
# later released in X11R6 (xc/config/util/install.sh) with the
|
||||
# following copyright and license.
|
||||
#
|
||||
# Copyright (C) 1994 X Consortium
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to
|
||||
# deal in the Software without restriction, including without limitation the
|
||||
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
# sell copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
|
||||
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
# Except as contained in this notice, the name of the X Consortium shall not
|
||||
# be used in advertising or otherwise to promote the sale, use or other deal-
|
||||
# ings in this Software without prior written authorization from the X Consor-
|
||||
# tium.
|
||||
#
|
||||
#
|
||||
# FSF changes to this file are in the public domain.
|
||||
#
|
||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||
# 'make' implicit rules from creating a file called install from it
|
||||
# when there is no Makefile.
|
||||
#
|
||||
# This script is compatible with the BSD install script, but was written
|
||||
# from scratch.
|
||||
|
||||
tab=' '
|
||||
nl='
|
||||
'
|
||||
IFS=" $tab$nl"
|
||||
|
||||
# Set DOITPROG to "echo" to test this script.
|
||||
|
||||
doit=${DOITPROG-}
|
||||
doit_exec=${doit:-exec}
|
||||
|
||||
# Put in absolute file names if you don't have them in your path;
|
||||
# or use environment vars.
|
||||
|
||||
chgrpprog=${CHGRPPROG-chgrp}
|
||||
chmodprog=${CHMODPROG-chmod}
|
||||
chownprog=${CHOWNPROG-chown}
|
||||
cmpprog=${CMPPROG-cmp}
|
||||
cpprog=${CPPROG-cp}
|
||||
mkdirprog=${MKDIRPROG-mkdir}
|
||||
mvprog=${MVPROG-mv}
|
||||
rmprog=${RMPROG-rm}
|
||||
stripprog=${STRIPPROG-strip}
|
||||
|
||||
posix_mkdir=
|
||||
|
||||
# Desired mode of installed file.
|
||||
mode=0755
|
||||
|
||||
chgrpcmd=
|
||||
chmodcmd=$chmodprog
|
||||
chowncmd=
|
||||
mvcmd=$mvprog
|
||||
rmcmd="$rmprog -f"
|
||||
stripcmd=
|
||||
|
||||
src=
|
||||
dst=
|
||||
dir_arg=
|
||||
dst_arg=
|
||||
|
||||
copy_on_change=false
|
||||
is_target_a_directory=possibly
|
||||
|
||||
usage="\
|
||||
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
|
||||
or: $0 [OPTION]... SRCFILES... DIRECTORY
|
||||
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
|
||||
or: $0 [OPTION]... -d DIRECTORIES...
|
||||
|
||||
In the 1st form, copy SRCFILE to DSTFILE.
|
||||
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
|
||||
In the 4th, create DIRECTORIES.
|
||||
|
||||
Options:
|
||||
--help display this help and exit.
|
||||
--version display version info and exit.
|
||||
|
||||
-c (ignored)
|
||||
-C install only if different (preserve the last data modification time)
|
||||
-d create directories instead of installing files.
|
||||
-g GROUP $chgrpprog installed files to GROUP.
|
||||
-m MODE $chmodprog installed files to MODE.
|
||||
-o USER $chownprog installed files to USER.
|
||||
-s $stripprog installed files.
|
||||
-t DIRECTORY install into DIRECTORY.
|
||||
-T report an error if DSTFILE is a directory.
|
||||
|
||||
Environment variables override the default commands:
|
||||
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
|
||||
RMPROG STRIPPROG
|
||||
"
|
||||
|
||||
while test $# -ne 0; do
|
||||
case $1 in
|
||||
-c) ;;
|
||||
|
||||
-C) copy_on_change=true;;
|
||||
|
||||
-d) dir_arg=true;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift;;
|
||||
|
||||
--help) echo "$usage"; exit $?;;
|
||||
|
||||
-m) mode=$2
|
||||
case $mode in
|
||||
*' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
|
||||
echo "$0: invalid mode: $mode" >&2
|
||||
exit 1;;
|
||||
esac
|
||||
shift;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift;;
|
||||
|
||||
-s) stripcmd=$stripprog;;
|
||||
|
||||
-t)
|
||||
is_target_a_directory=always
|
||||
dst_arg=$2
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $dst_arg in
|
||||
-* | [=\(\)!]) dst_arg=./$dst_arg;;
|
||||
esac
|
||||
shift;;
|
||||
|
||||
-T) is_target_a_directory=never;;
|
||||
|
||||
--version) echo "$0 $scriptversion"; exit $?;;
|
||||
|
||||
--) shift
|
||||
break;;
|
||||
|
||||
-*) echo "$0: invalid option: $1" >&2
|
||||
exit 1;;
|
||||
|
||||
*) break;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
# We allow the use of options -d and -T together, by making -d
|
||||
# take the precedence; this is for compatibility with GNU install.
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
if test -n "$dst_arg"; then
|
||||
echo "$0: target directory not allowed when installing a directory." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
|
||||
# When -d is used, all remaining arguments are directories to create.
|
||||
# When -t is used, the destination is already specified.
|
||||
# Otherwise, the last argument is the destination. Remove it from $@.
|
||||
for arg
|
||||
do
|
||||
if test -n "$dst_arg"; then
|
||||
# $@ is not empty: it contains at least $arg.
|
||||
set fnord "$@" "$dst_arg"
|
||||
shift # fnord
|
||||
fi
|
||||
shift # arg
|
||||
dst_arg=$arg
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $dst_arg in
|
||||
-* | [=\(\)!]) dst_arg=./$dst_arg;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
|
||||
if test $# -eq 0; then
|
||||
if test -z "$dir_arg"; then
|
||||
echo "$0: no input file specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
# It's OK to call 'install-sh -d' without argument.
|
||||
# This can happen when creating conditional directories.
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if test -z "$dir_arg"; then
|
||||
if test $# -gt 1 || test "$is_target_a_directory" = always; then
|
||||
if test ! -d "$dst_arg"; then
|
||||
echo "$0: $dst_arg: Is not a directory." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -z "$dir_arg"; then
|
||||
do_exit='(exit $ret); exit $ret'
|
||||
trap "ret=129; $do_exit" 1
|
||||
trap "ret=130; $do_exit" 2
|
||||
trap "ret=141; $do_exit" 13
|
||||
trap "ret=143; $do_exit" 15
|
||||
|
||||
# Set umask so as not to create temps with too-generous modes.
|
||||
# However, 'strip' requires both read and write access to temps.
|
||||
case $mode in
|
||||
# Optimize common cases.
|
||||
*644) cp_umask=133;;
|
||||
*755) cp_umask=22;;
|
||||
|
||||
*[0-7])
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw='% 200'
|
||||
fi
|
||||
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
|
||||
*)
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw=,u+rw
|
||||
fi
|
||||
cp_umask=$mode$u_plus_rw;;
|
||||
esac
|
||||
fi
|
||||
|
||||
for src
|
||||
do
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $src in
|
||||
-* | [=\(\)!]) src=./$src;;
|
||||
esac
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
dst=$src
|
||||
dstdir=$dst
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
else
|
||||
|
||||
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
if test ! -f "$src" && test ! -d "$src"; then
|
||||
echo "$0: $src does not exist." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test -z "$dst_arg"; then
|
||||
echo "$0: no destination specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
dst=$dst_arg
|
||||
|
||||
# If destination is a directory, append the input filename.
|
||||
if test -d "$dst"; then
|
||||
if test "$is_target_a_directory" = never; then
|
||||
echo "$0: $dst_arg: Is a directory" >&2
|
||||
exit 1
|
||||
fi
|
||||
dstdir=$dst
|
||||
dstbase=`basename "$src"`
|
||||
case $dst in
|
||||
*/) dst=$dst$dstbase;;
|
||||
*) dst=$dst/$dstbase;;
|
||||
esac
|
||||
dstdir_status=0
|
||||
else
|
||||
dstdir=`dirname "$dst"`
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
fi
|
||||
fi
|
||||
|
||||
case $dstdir in
|
||||
*/) dstdirslash=$dstdir;;
|
||||
*) dstdirslash=$dstdir/;;
|
||||
esac
|
||||
|
||||
obsolete_mkdir_used=false
|
||||
|
||||
if test $dstdir_status != 0; then
|
||||
case $posix_mkdir in
|
||||
'')
|
||||
# Create intermediate dirs using mode 755 as modified by the umask.
|
||||
# This is like FreeBSD 'install' as of 1997-10-28.
|
||||
umask=`umask`
|
||||
case $stripcmd.$umask in
|
||||
# Optimize common cases.
|
||||
*[2367][2367]) mkdir_umask=$umask;;
|
||||
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
|
||||
|
||||
*[0-7])
|
||||
mkdir_umask=`expr $umask + 22 \
|
||||
- $umask % 100 % 40 + $umask % 20 \
|
||||
- $umask % 10 % 4 + $umask % 2
|
||||
`;;
|
||||
*) mkdir_umask=$umask,go-w;;
|
||||
esac
|
||||
|
||||
# With -d, create the new directory with the user-specified mode.
|
||||
# Otherwise, rely on $mkdir_umask.
|
||||
if test -n "$dir_arg"; then
|
||||
mkdir_mode=-m$mode
|
||||
else
|
||||
mkdir_mode=
|
||||
fi
|
||||
|
||||
posix_mkdir=false
|
||||
case $umask in
|
||||
*[123567][0-7][0-7])
|
||||
# POSIX mkdir -p sets u+wx bits regardless of umask, which
|
||||
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
|
||||
;;
|
||||
*)
|
||||
# Note that $RANDOM variable is not portable (e.g. dash); Use it
|
||||
# here however when possible just to lower collision chance.
|
||||
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
|
||||
|
||||
trap 'ret=$?; rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null; exit $ret' 0
|
||||
|
||||
# Because "mkdir -p" follows existing symlinks and we likely work
|
||||
# directly in world-writeable /tmp, make sure that the '$tmpdir'
|
||||
# directory is successfully created first before we actually test
|
||||
# 'mkdir -p' feature.
|
||||
if (umask $mkdir_umask &&
|
||||
$mkdirprog $mkdir_mode "$tmpdir" &&
|
||||
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1
|
||||
then
|
||||
if test -z "$dir_arg" || {
|
||||
# Check for POSIX incompatibilities with -m.
|
||||
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
|
||||
# other-writable bit of parent directory when it shouldn't.
|
||||
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
|
||||
test_tmpdir="$tmpdir/a"
|
||||
ls_ld_tmpdir=`ls -ld "$test_tmpdir"`
|
||||
case $ls_ld_tmpdir in
|
||||
d????-?r-*) different_mode=700;;
|
||||
d????-?--*) different_mode=755;;
|
||||
*) false;;
|
||||
esac &&
|
||||
$mkdirprog -m$different_mode -p -- "$test_tmpdir" && {
|
||||
ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"`
|
||||
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
|
||||
}
|
||||
}
|
||||
then posix_mkdir=:
|
||||
fi
|
||||
rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir"
|
||||
else
|
||||
# Remove any dirs left behind by ancient mkdir implementations.
|
||||
rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null
|
||||
fi
|
||||
trap '' 0;;
|
||||
esac;;
|
||||
esac
|
||||
|
||||
if
|
||||
$posix_mkdir && (
|
||||
umask $mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
|
||||
)
|
||||
then :
|
||||
else
|
||||
|
||||
# The umask is ridiculous, or mkdir does not conform to POSIX,
|
||||
# or it failed possibly due to a race condition. Create the
|
||||
# directory the slow way, step by step, checking for races as we go.
|
||||
|
||||
case $dstdir in
|
||||
/*) prefix='/';;
|
||||
[-=\(\)!]*) prefix='./';;
|
||||
*) prefix='';;
|
||||
esac
|
||||
|
||||
oIFS=$IFS
|
||||
IFS=/
|
||||
set -f
|
||||
set fnord $dstdir
|
||||
shift
|
||||
set +f
|
||||
IFS=$oIFS
|
||||
|
||||
prefixes=
|
||||
|
||||
for d
|
||||
do
|
||||
test X"$d" = X && continue
|
||||
|
||||
prefix=$prefix$d
|
||||
if test -d "$prefix"; then
|
||||
prefixes=
|
||||
else
|
||||
if $posix_mkdir; then
|
||||
(umask=$mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
|
||||
# Don't fail if two instances are running concurrently.
|
||||
test -d "$prefix" || exit 1
|
||||
else
|
||||
case $prefix in
|
||||
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
|
||||
*) qprefix=$prefix;;
|
||||
esac
|
||||
prefixes="$prefixes '$qprefix'"
|
||||
fi
|
||||
fi
|
||||
prefix=$prefix/
|
||||
done
|
||||
|
||||
if test -n "$prefixes"; then
|
||||
# Don't fail if two instances are running concurrently.
|
||||
(umask $mkdir_umask &&
|
||||
eval "\$doit_exec \$mkdirprog $prefixes") ||
|
||||
test -d "$dstdir" || exit 1
|
||||
obsolete_mkdir_used=true
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
|
||||
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
|
||||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
|
||||
else
|
||||
|
||||
# Make a couple of temp file names in the proper directory.
|
||||
dsttmp=${dstdirslash}_inst.$$_
|
||||
rmtmp=${dstdirslash}_rm.$$_
|
||||
|
||||
# Trap to clean up those temp files at exit.
|
||||
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
|
||||
|
||||
# Copy the file name to the temp name.
|
||||
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits.
|
||||
#
|
||||
# If any of these fail, we abort the whole thing. If we want to
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $cpprog $src $dsttmp" command.
|
||||
#
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
|
||||
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
|
||||
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
|
||||
|
||||
# If -C, don't bother to copy if it wouldn't change the file.
|
||||
if $copy_on_change &&
|
||||
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
|
||||
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
|
||||
set -f &&
|
||||
set X $old && old=:$2:$4:$5:$6 &&
|
||||
set X $new && new=:$2:$4:$5:$6 &&
|
||||
set +f &&
|
||||
test "$old" = "$new" &&
|
||||
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
|
||||
then
|
||||
rm -f "$dsttmp"
|
||||
else
|
||||
# Rename the file to the real destination.
|
||||
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
|
||||
|
||||
# The rename failed, perhaps because mv can't rename something else
|
||||
# to itself, or perhaps because mv is so ancient that it does not
|
||||
# support -f.
|
||||
{
|
||||
# Now remove or move aside any old file at destination location.
|
||||
# We try this two ways since rm can't unlink itself on some
|
||||
# systems and the destination file might be busy for other
|
||||
# reasons. In this case, the final cleanup might fail but the new
|
||||
# file should still install successfully.
|
||||
{
|
||||
test ! -f "$dst" ||
|
||||
$doit $rmcmd -f "$dst" 2>/dev/null ||
|
||||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
|
||||
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
|
||||
} ||
|
||||
{ echo "$0: cannot unlink or rename $dst" >&2
|
||||
(exit 1); exit 1
|
||||
}
|
||||
} &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
$doit $mvcmd "$dsttmp" "$dst"
|
||||
}
|
||||
fi || exit 1
|
||||
|
||||
trap '' 0
|
||||
fi
|
||||
done
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,228 @@
|
|||
#!/bin/sh
|
||||
# Get modification time of a file or directory and pretty-print it.
|
||||
|
||||
scriptversion=2018-03-07.03; # UTC
|
||||
|
||||
# Copyright (C) 1995-2018 Free Software Foundation, Inc.
|
||||
# written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, June 1995
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# This file is maintained in Automake, please report
|
||||
# bugs to <bug-automake@gnu.org> or send patches to
|
||||
# <automake-patches@gnu.org>.
|
||||
|
||||
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
|
||||
emulate sh
|
||||
NULLCMD=:
|
||||
# Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
|
||||
# is contrary to our usage. Disable this feature.
|
||||
alias -g '${1+"$@"}'='"$@"'
|
||||
setopt NO_GLOB_SUBST
|
||||
fi
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
echo "$0: No file. Try '$0 --help' for more information." 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<\EOF
|
||||
Usage: mdate-sh [--help] [--version] FILE
|
||||
|
||||
Pretty-print the modification day of FILE, in the format:
|
||||
1 January 1970
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "mdate-sh $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
esac
|
||||
|
||||
error ()
|
||||
{
|
||||
echo "$0: $1" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
||||
# Prevent date giving response in another language.
|
||||
LANG=C
|
||||
export LANG
|
||||
LC_ALL=C
|
||||
export LC_ALL
|
||||
LC_TIME=C
|
||||
export LC_TIME
|
||||
|
||||
# Use UTC to get reproducible result.
|
||||
TZ=UTC0
|
||||
export TZ
|
||||
|
||||
# GNU ls changes its time format in response to the TIME_STYLE
|
||||
# variable. Since we cannot assume 'unset' works, revert this
|
||||
# variable to its documented default.
|
||||
if test "${TIME_STYLE+set}" = set; then
|
||||
TIME_STYLE=posix-long-iso
|
||||
export TIME_STYLE
|
||||
fi
|
||||
|
||||
save_arg1=$1
|
||||
|
||||
# Find out how to get the extended ls output of a file or directory.
|
||||
if ls -L /dev/null 1>/dev/null 2>&1; then
|
||||
ls_command='ls -L -l -d'
|
||||
else
|
||||
ls_command='ls -l -d'
|
||||
fi
|
||||
# Avoid user/group names that might have spaces, when possible.
|
||||
if ls -n /dev/null 1>/dev/null 2>&1; then
|
||||
ls_command="$ls_command -n"
|
||||
fi
|
||||
|
||||
# A 'ls -l' line looks as follows on OS/2.
|
||||
# drwxrwx--- 0 Aug 11 2001 foo
|
||||
# This differs from Unix, which adds ownership information.
|
||||
# drwxrwx--- 2 root root 4096 Aug 11 2001 foo
|
||||
#
|
||||
# To find the date, we split the line on spaces and iterate on words
|
||||
# until we find a month. This cannot work with files whose owner is a
|
||||
# user named "Jan", or "Feb", etc. However, it's unlikely that '/'
|
||||
# will be owned by a user whose name is a month. So we first look at
|
||||
# the extended ls output of the root directory to decide how many
|
||||
# words should be skipped to get the date.
|
||||
|
||||
# On HPUX /bin/sh, "set" interprets "-rw-r--r--" as options, so the "x" below.
|
||||
set x`$ls_command /`
|
||||
|
||||
# Find which argument is the month.
|
||||
month=
|
||||
command=
|
||||
until test $month
|
||||
do
|
||||
test $# -gt 0 || error "failed parsing '$ls_command /' output"
|
||||
shift
|
||||
# Add another shift to the command.
|
||||
command="$command shift;"
|
||||
case $1 in
|
||||
Jan) month=January; nummonth=1;;
|
||||
Feb) month=February; nummonth=2;;
|
||||
Mar) month=March; nummonth=3;;
|
||||
Apr) month=April; nummonth=4;;
|
||||
May) month=May; nummonth=5;;
|
||||
Jun) month=June; nummonth=6;;
|
||||
Jul) month=July; nummonth=7;;
|
||||
Aug) month=August; nummonth=8;;
|
||||
Sep) month=September; nummonth=9;;
|
||||
Oct) month=October; nummonth=10;;
|
||||
Nov) month=November; nummonth=11;;
|
||||
Dec) month=December; nummonth=12;;
|
||||
esac
|
||||
done
|
||||
|
||||
test -n "$month" || error "failed parsing '$ls_command /' output"
|
||||
|
||||
# Get the extended ls output of the file or directory.
|
||||
set dummy x`eval "$ls_command \"\\\$save_arg1\""`
|
||||
|
||||
# Remove all preceding arguments
|
||||
eval $command
|
||||
|
||||
# Because of the dummy argument above, month is in $2.
|
||||
#
|
||||
# On a POSIX system, we should have
|
||||
#
|
||||
# $# = 5
|
||||
# $1 = file size
|
||||
# $2 = month
|
||||
# $3 = day
|
||||
# $4 = year or time
|
||||
# $5 = filename
|
||||
#
|
||||
# On Darwin 7.7.0 and 7.6.0, we have
|
||||
#
|
||||
# $# = 4
|
||||
# $1 = day
|
||||
# $2 = month
|
||||
# $3 = year or time
|
||||
# $4 = filename
|
||||
|
||||
# Get the month.
|
||||
case $2 in
|
||||
Jan) month=January; nummonth=1;;
|
||||
Feb) month=February; nummonth=2;;
|
||||
Mar) month=March; nummonth=3;;
|
||||
Apr) month=April; nummonth=4;;
|
||||
May) month=May; nummonth=5;;
|
||||
Jun) month=June; nummonth=6;;
|
||||
Jul) month=July; nummonth=7;;
|
||||
Aug) month=August; nummonth=8;;
|
||||
Sep) month=September; nummonth=9;;
|
||||
Oct) month=October; nummonth=10;;
|
||||
Nov) month=November; nummonth=11;;
|
||||
Dec) month=December; nummonth=12;;
|
||||
esac
|
||||
|
||||
case $3 in
|
||||
???*) day=$1;;
|
||||
*) day=$3; shift;;
|
||||
esac
|
||||
|
||||
# Here we have to deal with the problem that the ls output gives either
|
||||
# the time of day or the year.
|
||||
case $3 in
|
||||
*:*) set `date`; eval year=\$$#
|
||||
case $2 in
|
||||
Jan) nummonthtod=1;;
|
||||
Feb) nummonthtod=2;;
|
||||
Mar) nummonthtod=3;;
|
||||
Apr) nummonthtod=4;;
|
||||
May) nummonthtod=5;;
|
||||
Jun) nummonthtod=6;;
|
||||
Jul) nummonthtod=7;;
|
||||
Aug) nummonthtod=8;;
|
||||
Sep) nummonthtod=9;;
|
||||
Oct) nummonthtod=10;;
|
||||
Nov) nummonthtod=11;;
|
||||
Dec) nummonthtod=12;;
|
||||
esac
|
||||
# For the first six month of the year the time notation can also
|
||||
# be used for files modified in the last year.
|
||||
if (expr $nummonth \> $nummonthtod) > /dev/null;
|
||||
then
|
||||
year=`expr $year - 1`
|
||||
fi;;
|
||||
*) year=$3;;
|
||||
esac
|
||||
|
||||
# The result.
|
||||
echo $day $month $year
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
|
@ -0,0 +1,215 @@
|
|||
#! /bin/sh
|
||||
# Common wrapper for a few potentially missing GNU programs.
|
||||
|
||||
scriptversion=2013-10-28.13; # UTC
|
||||
|
||||
# Copyright (C) 1996-2014 Free Software Foundation, Inc.
|
||||
# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
if test $# -eq 0; then
|
||||
echo 1>&2 "Try '$0 --help' for more information"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case $1 in
|
||||
|
||||
--is-lightweight)
|
||||
# Used by our autoconf macros to check whether the available missing
|
||||
# script is modern enough.
|
||||
exit 0
|
||||
;;
|
||||
|
||||
--run)
|
||||
# Back-compat with the calling convention used by older automake.
|
||||
shift
|
||||
;;
|
||||
|
||||
-h|--h|--he|--hel|--help)
|
||||
echo "\
|
||||
$0 [OPTION]... PROGRAM [ARGUMENT]...
|
||||
|
||||
Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
|
||||
to PROGRAM being missing or too old.
|
||||
|
||||
Options:
|
||||
-h, --help display this help and exit
|
||||
-v, --version output version information and exit
|
||||
|
||||
Supported PROGRAM values:
|
||||
aclocal autoconf autoheader autom4te automake makeinfo
|
||||
bison yacc flex lex help2man
|
||||
|
||||
Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
|
||||
'g' are ignored when checking the name.
|
||||
|
||||
Send bug reports to <bug-automake@gnu.org>."
|
||||
exit $?
|
||||
;;
|
||||
|
||||
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
|
||||
echo "missing $scriptversion (GNU Automake)"
|
||||
exit $?
|
||||
;;
|
||||
|
||||
-*)
|
||||
echo 1>&2 "$0: unknown '$1' option"
|
||||
echo 1>&2 "Try '$0 --help' for more information"
|
||||
exit 1
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
# Run the given program, remember its exit status.
|
||||
"$@"; st=$?
|
||||
|
||||
# If it succeeded, we are done.
|
||||
test $st -eq 0 && exit 0
|
||||
|
||||
# Also exit now if we it failed (or wasn't found), and '--version' was
|
||||
# passed; such an option is passed most likely to detect whether the
|
||||
# program is present and works.
|
||||
case $2 in --version|--help) exit $st;; esac
|
||||
|
||||
# Exit code 63 means version mismatch. This often happens when the user
|
||||
# tries to use an ancient version of a tool on a file that requires a
|
||||
# minimum version.
|
||||
if test $st -eq 63; then
|
||||
msg="probably too old"
|
||||
elif test $st -eq 127; then
|
||||
# Program was missing.
|
||||
msg="missing on your system"
|
||||
else
|
||||
# Program was found and executed, but failed. Give up.
|
||||
exit $st
|
||||
fi
|
||||
|
||||
perl_URL=http://www.perl.org/
|
||||
flex_URL=http://flex.sourceforge.net/
|
||||
gnu_software_URL=http://www.gnu.org/software
|
||||
|
||||
program_details ()
|
||||
{
|
||||
case $1 in
|
||||
aclocal|automake)
|
||||
echo "The '$1' program is part of the GNU Automake package:"
|
||||
echo "<$gnu_software_URL/automake>"
|
||||
echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
|
||||
echo "<$gnu_software_URL/autoconf>"
|
||||
echo "<$gnu_software_URL/m4/>"
|
||||
echo "<$perl_URL>"
|
||||
;;
|
||||
autoconf|autom4te|autoheader)
|
||||
echo "The '$1' program is part of the GNU Autoconf package:"
|
||||
echo "<$gnu_software_URL/autoconf/>"
|
||||
echo "It also requires GNU m4 and Perl in order to run:"
|
||||
echo "<$gnu_software_URL/m4/>"
|
||||
echo "<$perl_URL>"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
give_advice ()
|
||||
{
|
||||
# Normalize program name to check for.
|
||||
normalized_program=`echo "$1" | sed '
|
||||
s/^gnu-//; t
|
||||
s/^gnu//; t
|
||||
s/^g//; t'`
|
||||
|
||||
printf '%s\n' "'$1' is $msg."
|
||||
|
||||
configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
|
||||
case $normalized_program in
|
||||
autoconf*)
|
||||
echo "You should only need it if you modified 'configure.ac',"
|
||||
echo "or m4 files included by it."
|
||||
program_details 'autoconf'
|
||||
;;
|
||||
autoheader*)
|
||||
echo "You should only need it if you modified 'acconfig.h' or"
|
||||
echo "$configure_deps."
|
||||
program_details 'autoheader'
|
||||
;;
|
||||
automake*)
|
||||
echo "You should only need it if you modified 'Makefile.am' or"
|
||||
echo "$configure_deps."
|
||||
program_details 'automake'
|
||||
;;
|
||||
aclocal*)
|
||||
echo "You should only need it if you modified 'acinclude.m4' or"
|
||||
echo "$configure_deps."
|
||||
program_details 'aclocal'
|
||||
;;
|
||||
autom4te*)
|
||||
echo "You might have modified some maintainer files that require"
|
||||
echo "the 'autom4te' program to be rebuilt."
|
||||
program_details 'autom4te'
|
||||
;;
|
||||
bison*|yacc*)
|
||||
echo "You should only need it if you modified a '.y' file."
|
||||
echo "You may want to install the GNU Bison package:"
|
||||
echo "<$gnu_software_URL/bison/>"
|
||||
;;
|
||||
lex*|flex*)
|
||||
echo "You should only need it if you modified a '.l' file."
|
||||
echo "You may want to install the Fast Lexical Analyzer package:"
|
||||
echo "<$flex_URL>"
|
||||
;;
|
||||
help2man*)
|
||||
echo "You should only need it if you modified a dependency" \
|
||||
"of a man page."
|
||||
echo "You may want to install the GNU Help2man package:"
|
||||
echo "<$gnu_software_URL/help2man/>"
|
||||
;;
|
||||
makeinfo*)
|
||||
echo "You should only need it if you modified a '.texi' file, or"
|
||||
echo "any other file indirectly affecting the aspect of the manual."
|
||||
echo "You might want to install the Texinfo package:"
|
||||
echo "<$gnu_software_URL/texinfo/>"
|
||||
echo "The spurious makeinfo call might also be the consequence of"
|
||||
echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might"
|
||||
echo "want to install GNU make:"
|
||||
echo "<$gnu_software_URL/make/>"
|
||||
;;
|
||||
*)
|
||||
echo "You might have modified some files without having the proper"
|
||||
echo "tools for further handling them. Check the 'README' file, it"
|
||||
echo "often tells you about the needed prerequisites for installing"
|
||||
echo "this package. You may also peek at any GNU archive site, in"
|
||||
echo "case some other package contains this missing '$1' program."
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
give_advice "$1" | sed -e '1s/^/WARNING: /' \
|
||||
-e '2,$s/^/ /' >&2
|
||||
|
||||
# Propagate the correct exit status (expected to be 127 for a program
|
||||
# not found, 63 for a program that failed due to version mismatch).
|
||||
exit $st
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
|
@ -0,0 +1,685 @@
|
|||
#! /bin/sh
|
||||
|
||||
# A portable, pluggable option parser for Bourne shell.
|
||||
# Written by Gary V. Vaughan, 2010
|
||||
|
||||
# This is free software. There is NO warranty; not even for
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
#
|
||||
# Copyright (C) 2010-2019 Bootstrap Authors
|
||||
#
|
||||
# This file is dual licensed under the terms of the MIT license
|
||||
# <https://opensource.org/license/MIT>, and GPL version 3 or later
|
||||
# <http://www.gnu.org/licenses/gpl-2.0.html>. You must apply one of
|
||||
# these licenses when using or redistributing this software or any of
|
||||
# the files within it. See the URLs above, or the file `LICENSE`
|
||||
# included in the Bootstrap distribution for the full license texts.
|
||||
|
||||
# Please report bugs or propose patches to:
|
||||
# <https://github.com/gnulib-modules/bootstrap/issues>
|
||||
|
||||
# Set a version string for this script.
|
||||
scriptversion=2019-02-19.15; # UTC
|
||||
|
||||
|
||||
## ------ ##
|
||||
## Usage. ##
|
||||
## ------ ##
|
||||
|
||||
# This file is a library for parsing options in your shell scripts along
|
||||
# with assorted other useful supporting features that you can make use
|
||||
# of too.
|
||||
#
|
||||
# For the simplest scripts you might need only:
|
||||
#
|
||||
# #!/bin/sh
|
||||
# . relative/path/to/funclib.sh
|
||||
# . relative/path/to/options-parser
|
||||
# scriptversion=1.0
|
||||
# func_options ${1+"$@"}
|
||||
# eval set dummy "$func_options_result"; shift
|
||||
# ...rest of your script...
|
||||
#
|
||||
# In order for the '--version' option to work, you will need to have a
|
||||
# suitably formatted comment like the one at the top of this file
|
||||
# starting with '# Written by ' and ending with '# Copyright'.
|
||||
#
|
||||
# For '-h' and '--help' to work, you will also need a one line
|
||||
# description of your script's purpose in a comment directly above the
|
||||
# '# Written by ' line, like the one at the top of this file.
|
||||
#
|
||||
# The default options also support '--debug', which will turn on shell
|
||||
# execution tracing (see the comment above debug_cmd below for another
|
||||
# use), and '--verbose' and the func_verbose function to allow your script
|
||||
# to display verbose messages only when your user has specified
|
||||
# '--verbose'.
|
||||
#
|
||||
# After sourcing this file, you can plug in processing for additional
|
||||
# options by amending the variables from the 'Configuration' section
|
||||
# below, and following the instructions in the 'Option parsing'
|
||||
# section further down.
|
||||
|
||||
## -------------- ##
|
||||
## Configuration. ##
|
||||
## -------------- ##
|
||||
|
||||
# You should override these variables in your script after sourcing this
|
||||
# file so that they reflect the customisations you have added to the
|
||||
# option parser.
|
||||
|
||||
# The usage line for option parsing errors and the start of '-h' and
|
||||
# '--help' output messages. You can embed shell variables for delayed
|
||||
# expansion at the time the message is displayed, but you will need to
|
||||
# quote other shell meta-characters carefully to prevent them being
|
||||
# expanded when the contents are evaled.
|
||||
usage='$progpath [OPTION]...'
|
||||
|
||||
# Short help message in response to '-h' and '--help'. Add to this or
|
||||
# override it after sourcing this library to reflect the full set of
|
||||
# options your script accepts.
|
||||
usage_message="\
|
||||
--debug enable verbose shell tracing
|
||||
-W, --warnings=CATEGORY
|
||||
report the warnings falling in CATEGORY [all]
|
||||
-v, --verbose verbosely report processing
|
||||
--version print version information and exit
|
||||
-h, --help print short or long help message and exit
|
||||
"
|
||||
|
||||
# Additional text appended to 'usage_message' in response to '--help'.
|
||||
long_help_message="
|
||||
Warning categories include:
|
||||
'all' show all warnings
|
||||
'none' turn off all the warnings
|
||||
'error' warnings are treated as fatal errors"
|
||||
|
||||
# Help message printed before fatal option parsing errors.
|
||||
fatal_help="Try '\$progname --help' for more information."
|
||||
|
||||
|
||||
|
||||
## ------------------------- ##
|
||||
## Hook function management. ##
|
||||
## ------------------------- ##
|
||||
|
||||
# This section contains functions for adding, removing, and running hooks
|
||||
# in the main code. A hook is just a list of function names that can be
|
||||
# run in order later on.
|
||||
|
||||
# func_hookable FUNC_NAME
|
||||
# -----------------------
|
||||
# Declare that FUNC_NAME will run hooks added with
|
||||
# 'func_add_hook FUNC_NAME ...'.
|
||||
func_hookable ()
|
||||
{
|
||||
$debug_cmd
|
||||
|
||||
func_append hookable_fns " $1"
|
||||
}
|
||||
|
||||
|
||||
# func_add_hook FUNC_NAME HOOK_FUNC
|
||||
# ---------------------------------
|
||||
# Request that FUNC_NAME call HOOK_FUNC before it returns. FUNC_NAME must
|
||||
# first have been declared "hookable" by a call to 'func_hookable'.
|
||||
func_add_hook ()
|
||||
{
|
||||
$debug_cmd
|
||||
|
||||
case " $hookable_fns " in
|
||||
*" $1 "*) ;;
|
||||
*) func_fatal_error "'$1' does not accept hook functions." ;;
|
||||
esac
|
||||
|
||||
eval func_append ${1}_hooks '" $2"'
|
||||
}
|
||||
|
||||
|
||||
# func_remove_hook FUNC_NAME HOOK_FUNC
|
||||
# ------------------------------------
|
||||
# Remove HOOK_FUNC from the list of hook functions to be called by
|
||||
# FUNC_NAME.
|
||||
func_remove_hook ()
|
||||
{
|
||||
$debug_cmd
|
||||
|
||||
eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`'
|
||||
}
|
||||
|
||||
|
||||
# func_propagate_result FUNC_NAME_A FUNC_NAME_B
|
||||
# ---------------------------------------------
|
||||
# If the *_result variable of FUNC_NAME_A _is set_, assign its value to
|
||||
# *_result variable of FUNC_NAME_B.
|
||||
func_propagate_result ()
|
||||
{
|
||||
$debug_cmd
|
||||
|
||||
func_propagate_result_result=:
|
||||
if eval "test \"\${${1}_result+set}\" = set"
|
||||
then
|
||||
eval "${2}_result=\$${1}_result"
|
||||
else
|
||||
func_propagate_result_result=false
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# func_run_hooks FUNC_NAME [ARG]...
|
||||
# ---------------------------------
|
||||
# Run all hook functions registered to FUNC_NAME.
|
||||
# It's assumed that the list of hook functions contains nothing more
|
||||
# than a whitespace-delimited list of legal shell function names, and
|
||||
# no effort is wasted trying to catch shell meta-characters or preserve
|
||||
# whitespace.
|
||||
func_run_hooks ()
|
||||
{
|
||||
$debug_cmd
|
||||
|
||||
case " $hookable_fns " in
|
||||
*" $1 "*) ;;
|
||||
*) func_fatal_error "'$1' does not support hook functions." ;;
|
||||
esac
|
||||
|
||||
eval _G_hook_fns=\$$1_hooks; shift
|
||||
|
||||
for _G_hook in $_G_hook_fns; do
|
||||
func_unset "${_G_hook}_result"
|
||||
eval $_G_hook '${1+"$@"}'
|
||||
func_propagate_result $_G_hook func_run_hooks
|
||||
if $func_propagate_result_result; then
|
||||
eval set dummy "$func_run_hooks_result"; shift
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
|
||||
## --------------- ##
|
||||
## Option parsing. ##
|
||||
## --------------- ##
|
||||
|
||||
# In order to add your own option parsing hooks, you must accept the
|
||||
# full positional parameter list from your hook function. You may remove
|
||||
# or edit any options that you action, and then pass back the remaining
|
||||
# unprocessed options in '<hooked_function_name>_result', escaped
|
||||
# suitably for 'eval'.
|
||||
#
|
||||
# The '<hooked_function_name>_result' variable is automatically unset
|
||||
# before your hook gets called; for best performance, only set the
|
||||
# *_result variable when necessary (i.e. don't call the 'func_quote'
|
||||
# function unnecessarily because it can be an expensive operation on some
|
||||
# machines).
|
||||
#
|
||||
# Like this:
|
||||
#
|
||||
# my_options_prep ()
|
||||
# {
|
||||
# $debug_cmd
|
||||
#
|
||||
# # Extend the existing usage message.
|
||||
# usage_message=$usage_message'
|
||||
# -s, --silent don'\''t print informational messages
|
||||
# '
|
||||
# # No change in '$@' (ignored completely by this hook). Leave
|
||||
# # my_options_prep_result variable intact.
|
||||
# }
|
||||
# func_add_hook func_options_prep my_options_prep
|
||||
#
|
||||
#
|
||||
# my_silent_option ()
|
||||
# {
|
||||
# $debug_cmd
|
||||
#
|
||||
# args_changed=false
|
||||
#
|
||||
# # Note that, for efficiency, we parse as many options as we can
|
||||
# # recognise in a loop before passing the remainder back to the
|
||||
# # caller on the first unrecognised argument we encounter.
|
||||
# while test $# -gt 0; do
|
||||
# opt=$1; shift
|
||||
# case $opt in
|
||||
# --silent|-s) opt_silent=:
|
||||
# args_changed=:
|
||||
# ;;
|
||||
# # Separate non-argument short options:
|
||||
# -s*) func_split_short_opt "$_G_opt"
|
||||
# set dummy "$func_split_short_opt_name" \
|
||||
# "-$func_split_short_opt_arg" ${1+"$@"}
|
||||
# shift
|
||||
# args_changed=:
|
||||
# ;;
|
||||
# *) # Make sure the first unrecognised option "$_G_opt"
|
||||
# # is added back to "$@" in case we need it later,
|
||||
# # if $args_changed was set to 'true'.
|
||||
# set dummy "$_G_opt" ${1+"$@"}; shift; break ;;
|
||||
# esac
|
||||
# done
|
||||
#
|
||||
# # Only call 'func_quote' here if we processed at least one argument.
|
||||
# if $args_changed; then
|
||||
# func_quote eval ${1+"$@"}
|
||||
# my_silent_option_result=$func_quote_result
|
||||
# fi
|
||||
# }
|
||||
# func_add_hook func_parse_options my_silent_option
|
||||
#
|
||||
#
|
||||
# my_option_validation ()
|
||||
# {
|
||||
# $debug_cmd
|
||||
#
|
||||
# $opt_silent && $opt_verbose && func_fatal_help "\
|
||||
# '--silent' and '--verbose' options are mutually exclusive."
|
||||
# }
|
||||
# func_add_hook func_validate_options my_option_validation
|
||||
#
|
||||
# You'll also need to manually amend $usage_message to reflect the extra
|
||||
# options you parse. It's preferable to append if you can, so that
|
||||
# multiple option parsing hooks can be added safely.
|
||||
|
||||
|
||||
# func_options_finish [ARG]...
|
||||
# ----------------------------
|
||||
# Finishing the option parse loop (call 'func_options' hooks ATM).
|
||||
func_options_finish ()
|
||||
{
|
||||
$debug_cmd
|
||||
|
||||
func_run_hooks func_options ${1+"$@"}
|
||||
func_propagate_result func_run_hooks func_options_finish
|
||||
}
|
||||
|
||||
|
||||
# func_options [ARG]...
|
||||
# ---------------------
|
||||
# All the functions called inside func_options are hookable. See the
|
||||
# individual implementations for details.
|
||||
func_hookable func_options
|
||||
func_options ()
|
||||
{
|
||||
$debug_cmd
|
||||
|
||||
_G_options_quoted=false
|
||||
|
||||
for my_func in options_prep parse_options validate_options options_finish
|
||||
do
|
||||
func_unset func_${my_func}_result
|
||||
func_unset func_run_hooks_result
|
||||
eval func_$my_func '${1+"$@"}'
|
||||
func_propagate_result func_$my_func func_options
|
||||
if $func_propagate_result_result; then
|
||||
eval set dummy "$func_options_result"; shift
|
||||
_G_options_quoted=:
|
||||
fi
|
||||
done
|
||||
|
||||
$_G_options_quoted || {
|
||||
# As we (func_options) are top-level options-parser function and
|
||||
# nobody quoted "$@" for us yet, we need to do it explicitly for
|
||||
# caller.
|
||||
func_quote eval ${1+"$@"}
|
||||
func_options_result=$func_quote_result
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# func_options_prep [ARG]...
|
||||
# --------------------------
|
||||
# All initialisations required before starting the option parse loop.
|
||||
# Note that when calling hook functions, we pass through the list of
|
||||
# positional parameters. If a hook function modifies that list, and
|
||||
# needs to propagate that back to rest of this script, then the complete
|
||||
# modified list must be put in 'func_run_hooks_result' before returning.
|
||||
func_hookable func_options_prep
|
||||
func_options_prep ()
|
||||
{
|
||||
$debug_cmd
|
||||
|
||||
# Option defaults:
|
||||
opt_verbose=false
|
||||
opt_warning_types=
|
||||
|
||||
func_run_hooks func_options_prep ${1+"$@"}
|
||||
func_propagate_result func_run_hooks func_options_prep
|
||||
}
|
||||
|
||||
|
||||
# func_parse_options [ARG]...
|
||||
# ---------------------------
|
||||
# The main option parsing loop.
|
||||
func_hookable func_parse_options
|
||||
func_parse_options ()
|
||||
{
|
||||
$debug_cmd
|
||||
|
||||
_G_parse_options_requote=false
|
||||
# this just eases exit handling
|
||||
while test $# -gt 0; do
|
||||
# Defer to hook functions for initial option parsing, so they
|
||||
# get priority in the event of reusing an option name.
|
||||
func_run_hooks func_parse_options ${1+"$@"}
|
||||
func_propagate_result func_run_hooks func_parse_options
|
||||
if $func_propagate_result_result; then
|
||||
eval set dummy "$func_parse_options_result"; shift
|
||||
# Even though we may have changed "$@", we passed the "$@" array
|
||||
# down into the hook and it quoted it for us (because we are in
|
||||
# this if-branch). No need to quote it again.
|
||||
_G_parse_options_requote=false
|
||||
fi
|
||||
|
||||
# Break out of the loop if we already parsed every option.
|
||||
test $# -gt 0 || break
|
||||
|
||||
# We expect that one of the options parsed in this function matches
|
||||
# and thus we remove _G_opt from "$@" and need to re-quote.
|
||||
_G_match_parse_options=:
|
||||
_G_opt=$1
|
||||
shift
|
||||
case $_G_opt in
|
||||
--debug|-x) debug_cmd='set -x'
|
||||
func_echo "enabling shell trace mode" >&2
|
||||
$debug_cmd
|
||||
;;
|
||||
|
||||
--no-warnings|--no-warning|--no-warn)
|
||||
set dummy --warnings none ${1+"$@"}
|
||||
shift
|
||||
;;
|
||||
|
||||
--warnings|--warning|-W)
|
||||
if test $# = 0 && func_missing_arg $_G_opt; then
|
||||
_G_parse_options_requote=:
|
||||
break
|
||||
fi
|
||||
case " $warning_categories $1" in
|
||||
*" $1 "*)
|
||||
# trailing space prevents matching last $1 above
|
||||
func_append_uniq opt_warning_types " $1"
|
||||
;;
|
||||
*all)
|
||||
opt_warning_types=$warning_categories
|
||||
;;
|
||||
*none)
|
||||
opt_warning_types=none
|
||||
warning_func=:
|
||||
;;
|
||||
*error)
|
||||
opt_warning_types=$warning_categories
|
||||
warning_func=func_fatal_error
|
||||
;;
|
||||
*)
|
||||
func_fatal_error \
|
||||
"unsupported warning category: '$1'"
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
;;
|
||||
|
||||
--verbose|-v) opt_verbose=: ;;
|
||||
--version) func_version ;;
|
||||
-\?|-h) func_usage ;;
|
||||
--help) func_help ;;
|
||||
|
||||
# Separate optargs to long options (plugins may need this):
|
||||
--*=*) func_split_equals "$_G_opt"
|
||||
set dummy "$func_split_equals_lhs" \
|
||||
"$func_split_equals_rhs" ${1+"$@"}
|
||||
shift
|
||||
;;
|
||||
|
||||
# Separate optargs to short options:
|
||||
-W*)
|
||||
func_split_short_opt "$_G_opt"
|
||||
set dummy "$func_split_short_opt_name" \
|
||||
"$func_split_short_opt_arg" ${1+"$@"}
|
||||
shift
|
||||
;;
|
||||
|
||||
# Separate non-argument short options:
|
||||
-\?*|-h*|-v*|-x*)
|
||||
func_split_short_opt "$_G_opt"
|
||||
set dummy "$func_split_short_opt_name" \
|
||||
"-$func_split_short_opt_arg" ${1+"$@"}
|
||||
shift
|
||||
;;
|
||||
|
||||
--) _G_parse_options_requote=: ; break ;;
|
||||
-*) func_fatal_help "unrecognised option: '$_G_opt'" ;;
|
||||
*) set dummy "$_G_opt" ${1+"$@"}; shift
|
||||
_G_match_parse_options=false
|
||||
break
|
||||
;;
|
||||
esac
|
||||
|
||||
if $_G_match_parse_options; then
|
||||
_G_parse_options_requote=:
|
||||
fi
|
||||
done
|
||||
|
||||
if $_G_parse_options_requote; then
|
||||
# save modified positional parameters for caller
|
||||
func_quote eval ${1+"$@"}
|
||||
func_parse_options_result=$func_quote_result
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# func_validate_options [ARG]...
|
||||
# ------------------------------
|
||||
# Perform any sanity checks on option settings and/or unconsumed
|
||||
# arguments.
|
||||
func_hookable func_validate_options
|
||||
func_validate_options ()
|
||||
{
|
||||
$debug_cmd
|
||||
|
||||
# Display all warnings if -W was not given.
|
||||
test -n "$opt_warning_types" || opt_warning_types=" $warning_categories"
|
||||
|
||||
func_run_hooks func_validate_options ${1+"$@"}
|
||||
func_propagate_result func_run_hooks func_validate_options
|
||||
|
||||
# Bail if the options were screwed!
|
||||
$exit_cmd $EXIT_FAILURE
|
||||
}
|
||||
|
||||
|
||||
|
||||
## ----------------- ##
|
||||
## Helper functions. ##
|
||||
## ----------------- ##
|
||||
|
||||
# This section contains the helper functions used by the rest of the
|
||||
# hookable option parser framework in ascii-betical order.
|
||||
|
||||
|
||||
# func_fatal_help ARG...
|
||||
# ----------------------
|
||||
# Echo program name prefixed message to standard error, followed by
|
||||
# a help hint, and exit.
|
||||
func_fatal_help ()
|
||||
{
|
||||
$debug_cmd
|
||||
|
||||
eval \$ECHO \""Usage: $usage"\"
|
||||
eval \$ECHO \""$fatal_help"\"
|
||||
func_error ${1+"$@"}
|
||||
exit $EXIT_FAILURE
|
||||
}
|
||||
|
||||
|
||||
# func_help
|
||||
# ---------
|
||||
# Echo long help message to standard output and exit.
|
||||
func_help ()
|
||||
{
|
||||
$debug_cmd
|
||||
|
||||
func_usage_message
|
||||
$ECHO "$long_help_message"
|
||||
exit 0
|
||||
}
|
||||
|
||||
|
||||
# func_missing_arg ARGNAME
|
||||
# ------------------------
|
||||
# Echo program name prefixed message to standard error and set global
|
||||
# exit_cmd.
|
||||
func_missing_arg ()
|
||||
{
|
||||
$debug_cmd
|
||||
|
||||
func_error "Missing argument for '$1'."
|
||||
exit_cmd=exit
|
||||
}
|
||||
|
||||
|
||||
# func_split_equals STRING
|
||||
# ------------------------
|
||||
# Set func_split_equals_lhs and func_split_equals_rhs shell variables
|
||||
# after splitting STRING at the '=' sign.
|
||||
test -z "$_G_HAVE_XSI_OPS" \
|
||||
&& (eval 'x=a/b/c;
|
||||
test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
|
||||
&& _G_HAVE_XSI_OPS=yes
|
||||
|
||||
if test yes = "$_G_HAVE_XSI_OPS"
|
||||
then
|
||||
# This is an XSI compatible shell, allowing a faster implementation...
|
||||
eval 'func_split_equals ()
|
||||
{
|
||||
$debug_cmd
|
||||
|
||||
func_split_equals_lhs=${1%%=*}
|
||||
func_split_equals_rhs=${1#*=}
|
||||
if test "x$func_split_equals_lhs" = "x$1"; then
|
||||
func_split_equals_rhs=
|
||||
fi
|
||||
}'
|
||||
else
|
||||
# ...otherwise fall back to using expr, which is often a shell builtin.
|
||||
func_split_equals ()
|
||||
{
|
||||
$debug_cmd
|
||||
|
||||
func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'`
|
||||
func_split_equals_rhs=
|
||||
test "x$func_split_equals_lhs" = "x$1" \
|
||||
|| func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'`
|
||||
}
|
||||
fi #func_split_equals
|
||||
|
||||
|
||||
# func_split_short_opt SHORTOPT
|
||||
# -----------------------------
|
||||
# Set func_split_short_opt_name and func_split_short_opt_arg shell
|
||||
# variables after splitting SHORTOPT after the 2nd character.
|
||||
if test yes = "$_G_HAVE_XSI_OPS"
|
||||
then
|
||||
# This is an XSI compatible shell, allowing a faster implementation...
|
||||
eval 'func_split_short_opt ()
|
||||
{
|
||||
$debug_cmd
|
||||
|
||||
func_split_short_opt_arg=${1#??}
|
||||
func_split_short_opt_name=${1%"$func_split_short_opt_arg"}
|
||||
}'
|
||||
else
|
||||
# ...otherwise fall back to using expr, which is often a shell builtin.
|
||||
func_split_short_opt ()
|
||||
{
|
||||
$debug_cmd
|
||||
|
||||
func_split_short_opt_name=`expr "x$1" : 'x-\(.\)'`
|
||||
func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'`
|
||||
}
|
||||
fi #func_split_short_opt
|
||||
|
||||
|
||||
# func_usage
|
||||
# ----------
|
||||
# Echo short help message to standard output and exit.
|
||||
func_usage ()
|
||||
{
|
||||
$debug_cmd
|
||||
|
||||
func_usage_message
|
||||
$ECHO "Run '$progname --help |${PAGER-more}' for full usage"
|
||||
exit 0
|
||||
}
|
||||
|
||||
|
||||
# func_usage_message
|
||||
# ------------------
|
||||
# Echo short help message to standard output.
|
||||
func_usage_message ()
|
||||
{
|
||||
$debug_cmd
|
||||
|
||||
eval \$ECHO \""Usage: $usage"\"
|
||||
echo
|
||||
$SED -n 's|^# ||
|
||||
/^Written by/{
|
||||
x;p;x
|
||||
}
|
||||
h
|
||||
/^Written by/q' < "$progpath"
|
||||
echo
|
||||
eval \$ECHO \""$usage_message"\"
|
||||
}
|
||||
|
||||
|
||||
# func_version
|
||||
# ------------
|
||||
# Echo version message to standard output and exit.
|
||||
# The version message is extracted from the calling file's header
|
||||
# comments, with leading '# ' stripped:
|
||||
# 1. First display the progname and version
|
||||
# 2. Followed by the header comment line matching /^# Written by /
|
||||
# 3. Then a blank line followed by the first following line matching
|
||||
# /^# Copyright /
|
||||
# 4. Immediately followed by any lines between the previous matches,
|
||||
# except lines preceding the intervening completely blank line.
|
||||
# For example, see the header comments of this file.
|
||||
func_version ()
|
||||
{
|
||||
$debug_cmd
|
||||
|
||||
printf '%s\n' "$progname $scriptversion"
|
||||
$SED -n '
|
||||
/^# Written by /!b
|
||||
s|^# ||; p; n
|
||||
|
||||
:fwd2blnk
|
||||
/./ {
|
||||
n
|
||||
b fwd2blnk
|
||||
}
|
||||
p; n
|
||||
|
||||
:holdwrnt
|
||||
s|^# ||
|
||||
s|^# *$||
|
||||
/^Copyright /!{
|
||||
/./H
|
||||
n
|
||||
b holdwrnt
|
||||
}
|
||||
|
||||
s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2|
|
||||
G
|
||||
s|\(\n\)\n*|\1|g
|
||||
p; q' < "$progpath"
|
||||
|
||||
exit $?
|
||||
}
|
||||
|
||||
|
||||
# Local variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
# time-stamp-pattern: "30/scriptversion=%:y-%02m-%02d.%02H; # UTC"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# End:
|
|
@ -0,0 +1,148 @@
|
|||
#! /bin/sh
|
||||
# test-driver - basic testsuite driver script.
|
||||
|
||||
scriptversion=2013-07-13.22; # UTC
|
||||
|
||||
# Copyright (C) 2011-2014 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# This file is maintained in Automake, please report
|
||||
# bugs to <bug-automake@gnu.org> or send patches to
|
||||
# <automake-patches@gnu.org>.
|
||||
|
||||
# Make unconditional expansion of undefined variables an error. This
|
||||
# helps a lot in preventing typo-related bugs.
|
||||
set -u
|
||||
|
||||
usage_error ()
|
||||
{
|
||||
echo "$0: $*" >&2
|
||||
print_usage >&2
|
||||
exit 2
|
||||
}
|
||||
|
||||
print_usage ()
|
||||
{
|
||||
cat <<END
|
||||
Usage:
|
||||
test-driver --test-name=NAME --log-file=PATH --trs-file=PATH
|
||||
[--expect-failure={yes|no}] [--color-tests={yes|no}]
|
||||
[--enable-hard-errors={yes|no}] [--]
|
||||
TEST-SCRIPT [TEST-SCRIPT-ARGUMENTS]
|
||||
The '--test-name', '--log-file' and '--trs-file' options are mandatory.
|
||||
END
|
||||
}
|
||||
|
||||
test_name= # Used for reporting.
|
||||
log_file= # Where to save the output of the test script.
|
||||
trs_file= # Where to save the metadata of the test run.
|
||||
expect_failure=no
|
||||
color_tests=no
|
||||
enable_hard_errors=yes
|
||||
while test $# -gt 0; do
|
||||
case $1 in
|
||||
--help) print_usage; exit $?;;
|
||||
--version) echo "test-driver $scriptversion"; exit $?;;
|
||||
--test-name) test_name=$2; shift;;
|
||||
--log-file) log_file=$2; shift;;
|
||||
--trs-file) trs_file=$2; shift;;
|
||||
--color-tests) color_tests=$2; shift;;
|
||||
--expect-failure) expect_failure=$2; shift;;
|
||||
--enable-hard-errors) enable_hard_errors=$2; shift;;
|
||||
--) shift; break;;
|
||||
-*) usage_error "invalid option: '$1'";;
|
||||
*) break;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
missing_opts=
|
||||
test x"$test_name" = x && missing_opts="$missing_opts --test-name"
|
||||
test x"$log_file" = x && missing_opts="$missing_opts --log-file"
|
||||
test x"$trs_file" = x && missing_opts="$missing_opts --trs-file"
|
||||
if test x"$missing_opts" != x; then
|
||||
usage_error "the following mandatory options are missing:$missing_opts"
|
||||
fi
|
||||
|
||||
if test $# -eq 0; then
|
||||
usage_error "missing argument"
|
||||
fi
|
||||
|
||||
if test $color_tests = yes; then
|
||||
# Keep this in sync with 'lib/am/check.am:$(am__tty_colors)'.
|
||||
red='[0;31m' # Red.
|
||||
grn='[0;32m' # Green.
|
||||
lgn='[1;32m' # Light green.
|
||||
blu='[1;34m' # Blue.
|
||||
mgn='[0;35m' # Magenta.
|
||||
std='[m' # No color.
|
||||
else
|
||||
red= grn= lgn= blu= mgn= std=
|
||||
fi
|
||||
|
||||
do_exit='rm -f $log_file $trs_file; (exit $st); exit $st'
|
||||
trap "st=129; $do_exit" 1
|
||||
trap "st=130; $do_exit" 2
|
||||
trap "st=141; $do_exit" 13
|
||||
trap "st=143; $do_exit" 15
|
||||
|
||||
# Test script is run here.
|
||||
"$@" >$log_file 2>&1
|
||||
estatus=$?
|
||||
|
||||
if test $enable_hard_errors = no && test $estatus -eq 99; then
|
||||
tweaked_estatus=1
|
||||
else
|
||||
tweaked_estatus=$estatus
|
||||
fi
|
||||
|
||||
case $tweaked_estatus:$expect_failure in
|
||||
0:yes) col=$red res=XPASS recheck=yes gcopy=yes;;
|
||||
0:*) col=$grn res=PASS recheck=no gcopy=no;;
|
||||
77:*) col=$blu res=SKIP recheck=no gcopy=yes;;
|
||||
99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;;
|
||||
*:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;;
|
||||
*:*) col=$red res=FAIL recheck=yes gcopy=yes;;
|
||||
esac
|
||||
|
||||
# Report the test outcome and exit status in the logs, so that one can
|
||||
# know whether the test passed or failed simply by looking at the '.log'
|
||||
# file, without the need of also peaking into the corresponding '.trs'
|
||||
# file (automake bug#11814).
|
||||
echo "$res $test_name (exit status: $estatus)" >>$log_file
|
||||
|
||||
# Report outcome to console.
|
||||
echo "${col}${res}${std}: $test_name"
|
||||
|
||||
# Register the test result, and other relevant metadata.
|
||||
echo ":test-result: $res" > $trs_file
|
||||
echo ":global-test-result: $res" >> $trs_file
|
||||
echo ":recheck: $recheck" >> $trs_file
|
||||
echo ":copy-in-global-log: $gcopy" >> $trs_file
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,347 @@
|
|||
#! /bin/sh
|
||||
# Wrapper for compilers which do not understand '-c -o'.
|
||||
|
||||
scriptversion=2012-10-14.11; # UTC
|
||||
|
||||
# Copyright (C) 1999-2014 Free Software Foundation, Inc.
|
||||
# Written by Tom Tromey <tromey@cygnus.com>.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# This file is maintained in Automake, please report
|
||||
# bugs to <bug-automake@gnu.org> or send patches to
|
||||
# <automake-patches@gnu.org>.
|
||||
|
||||
nl='
|
||||
'
|
||||
|
||||
# We need space, tab and new line, in precisely that order. Quoting is
|
||||
# there to prevent tools from complaining about whitespace usage.
|
||||
IFS=" "" $nl"
|
||||
|
||||
file_conv=
|
||||
|
||||
# func_file_conv build_file lazy
|
||||
# Convert a $build file to $host form and store it in $file
|
||||
# Currently only supports Windows hosts. If the determined conversion
|
||||
# type is listed in (the comma separated) LAZY, no conversion will
|
||||
# take place.
|
||||
func_file_conv ()
|
||||
{
|
||||
file=$1
|
||||
case $file in
|
||||
/ | /[!/]*) # absolute file, and not a UNC file
|
||||
if test -z "$file_conv"; then
|
||||
# lazily determine how to convert abs files
|
||||
case `uname -s` in
|
||||
MINGW*)
|
||||
file_conv=mingw
|
||||
;;
|
||||
CYGWIN*)
|
||||
file_conv=cygwin
|
||||
;;
|
||||
*)
|
||||
file_conv=wine
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
case $file_conv/,$2, in
|
||||
*,$file_conv,*)
|
||||
;;
|
||||
mingw/*)
|
||||
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
|
||||
;;
|
||||
cygwin/*)
|
||||
file=`cygpath -m "$file" || echo "$file"`
|
||||
;;
|
||||
wine/*)
|
||||
file=`winepath -w "$file" || echo "$file"`
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# func_cl_dashL linkdir
|
||||
# Make cl look for libraries in LINKDIR
|
||||
func_cl_dashL ()
|
||||
{
|
||||
func_file_conv "$1"
|
||||
if test -z "$lib_path"; then
|
||||
lib_path=$file
|
||||
else
|
||||
lib_path="$lib_path;$file"
|
||||
fi
|
||||
linker_opts="$linker_opts -LIBPATH:$file"
|
||||
}
|
||||
|
||||
# func_cl_dashl library
|
||||
# Do a library search-path lookup for cl
|
||||
func_cl_dashl ()
|
||||
{
|
||||
lib=$1
|
||||
found=no
|
||||
save_IFS=$IFS
|
||||
IFS=';'
|
||||
for dir in $lib_path $LIB
|
||||
do
|
||||
IFS=$save_IFS
|
||||
if $shared && test -f "$dir/$lib.dll.lib"; then
|
||||
found=yes
|
||||
lib=$dir/$lib.dll.lib
|
||||
break
|
||||
fi
|
||||
if test -f "$dir/$lib.lib"; then
|
||||
found=yes
|
||||
lib=$dir/$lib.lib
|
||||
break
|
||||
fi
|
||||
if test -f "$dir/lib$lib.a"; then
|
||||
found=yes
|
||||
lib=$dir/lib$lib.a
|
||||
break
|
||||
fi
|
||||
done
|
||||
IFS=$save_IFS
|
||||
|
||||
if test "$found" != yes; then
|
||||
lib=$lib.lib
|
||||
fi
|
||||
}
|
||||
|
||||
# func_cl_wrapper cl arg...
|
||||
# Adjust compile command to suit cl
|
||||
func_cl_wrapper ()
|
||||
{
|
||||
# Assume a capable shell
|
||||
lib_path=
|
||||
shared=:
|
||||
linker_opts=
|
||||
for arg
|
||||
do
|
||||
if test -n "$eat"; then
|
||||
eat=
|
||||
else
|
||||
case $1 in
|
||||
-o)
|
||||
# configure might choose to run compile as 'compile cc -o foo foo.c'.
|
||||
eat=1
|
||||
case $2 in
|
||||
*.o | *.[oO][bB][jJ])
|
||||
func_file_conv "$2"
|
||||
set x "$@" -Fo"$file"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
func_file_conv "$2"
|
||||
set x "$@" -Fe"$file"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
-I)
|
||||
eat=1
|
||||
func_file_conv "$2" mingw
|
||||
set x "$@" -I"$file"
|
||||
shift
|
||||
;;
|
||||
-I*)
|
||||
func_file_conv "${1#-I}" mingw
|
||||
set x "$@" -I"$file"
|
||||
shift
|
||||
;;
|
||||
-l)
|
||||
eat=1
|
||||
func_cl_dashl "$2"
|
||||
set x "$@" "$lib"
|
||||
shift
|
||||
;;
|
||||
-l*)
|
||||
func_cl_dashl "${1#-l}"
|
||||
set x "$@" "$lib"
|
||||
shift
|
||||
;;
|
||||
-L)
|
||||
eat=1
|
||||
func_cl_dashL "$2"
|
||||
;;
|
||||
-L*)
|
||||
func_cl_dashL "${1#-L}"
|
||||
;;
|
||||
-static)
|
||||
shared=false
|
||||
;;
|
||||
-Wl,*)
|
||||
arg=${1#-Wl,}
|
||||
save_ifs="$IFS"; IFS=','
|
||||
for flag in $arg; do
|
||||
IFS="$save_ifs"
|
||||
linker_opts="$linker_opts $flag"
|
||||
done
|
||||
IFS="$save_ifs"
|
||||
;;
|
||||
-Xlinker)
|
||||
eat=1
|
||||
linker_opts="$linker_opts $2"
|
||||
;;
|
||||
-*)
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
*.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
|
||||
func_file_conv "$1"
|
||||
set x "$@" -Tp"$file"
|
||||
shift
|
||||
;;
|
||||
*.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
|
||||
func_file_conv "$1" mingw
|
||||
set x "$@" "$file"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
shift
|
||||
done
|
||||
if test -n "$linker_opts"; then
|
||||
linker_opts="-link$linker_opts"
|
||||
fi
|
||||
exec "$@" $linker_opts
|
||||
exit 1
|
||||
}
|
||||
|
||||
eat=
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
echo "$0: No command. Try '$0 --help' for more information." 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<\EOF
|
||||
Usage: compile [--help] [--version] PROGRAM [ARGS]
|
||||
|
||||
Wrapper for compilers which do not understand '-c -o'.
|
||||
Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
|
||||
arguments, and rename the output as expected.
|
||||
|
||||
If you are trying to build a whole package this is not the
|
||||
right script to run: please start by reading the file 'INSTALL'.
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "compile $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe )
|
||||
func_cl_wrapper "$@" # Doesn't return...
|
||||
;;
|
||||
esac
|
||||
|
||||
ofile=
|
||||
cfile=
|
||||
|
||||
for arg
|
||||
do
|
||||
if test -n "$eat"; then
|
||||
eat=
|
||||
else
|
||||
case $1 in
|
||||
-o)
|
||||
# configure might choose to run compile as 'compile cc -o foo foo.c'.
|
||||
# So we strip '-o arg' only if arg is an object.
|
||||
eat=1
|
||||
case $2 in
|
||||
*.o | *.obj)
|
||||
ofile=$2
|
||||
;;
|
||||
*)
|
||||
set x "$@" -o "$2"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*.c)
|
||||
cfile=$1
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
shift
|
||||
done
|
||||
|
||||
if test -z "$ofile" || test -z "$cfile"; then
|
||||
# If no '-o' option was seen then we might have been invoked from a
|
||||
# pattern rule where we don't need one. That is ok -- this is a
|
||||
# normal compilation that the losing compiler can handle. If no
|
||||
# '.c' file was seen then we are probably linking. That is also
|
||||
# ok.
|
||||
exec "$@"
|
||||
fi
|
||||
|
||||
# Name of file we expect compiler to create.
|
||||
cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
|
||||
|
||||
# Create the lock directory.
|
||||
# Note: use '[/\\:.-]' here to ensure that we don't use the same name
|
||||
# that we are using for the .o file. Also, base the name on the expected
|
||||
# object file name, since that is what matters with a parallel build.
|
||||
lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
|
||||
while true; do
|
||||
if mkdir "$lockdir" >/dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
# FIXME: race condition here if user kills between mkdir and trap.
|
||||
trap "rmdir '$lockdir'; exit 1" 1 2 15
|
||||
|
||||
# Run the compile.
|
||||
"$@"
|
||||
ret=$?
|
||||
|
||||
if test -f "$cofile"; then
|
||||
test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
|
||||
elif test -f "${cofile}bj"; then
|
||||
test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
|
||||
fi
|
||||
|
||||
rmdir "$lockdir"
|
||||
exit $ret
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,445 @@
|
|||
/* config.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* Define to 1 if the package shall run at any location in the file system. */
|
||||
#undef ENABLE_RELOCATABLE
|
||||
|
||||
/* Define to a C preprocessor expression that evaluates to 1 or 0, depending
|
||||
whether the gnulib module msvc-nothrow shall be considered present. */
|
||||
#undef GNULIB_MSVC_NOTHROW
|
||||
|
||||
/* Define to 1 when the gnulib module malloc-posix should be tested. */
|
||||
#undef GNULIB_TEST_MALLOC_POSIX
|
||||
|
||||
/* Define to 1 when the gnulib module rawmemchr should be tested. */
|
||||
#undef GNULIB_TEST_RAWMEMCHR
|
||||
|
||||
/* Define to 1 when the gnulib module strchrnul should be tested. */
|
||||
#undef GNULIB_TEST_STRCHRNUL
|
||||
|
||||
/* Define to 1 when the gnulib module strdup should be tested. */
|
||||
#undef GNULIB_TEST_STRDUP
|
||||
|
||||
/* define if the compiler supports basic C++11 syntax */
|
||||
#undef HAVE_CXX11
|
||||
|
||||
/* Define to 1 if you have the declaration of `strdup', and to 0 if you don't.
|
||||
*/
|
||||
#undef HAVE_DECL_STRDUP
|
||||
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
#undef HAVE_DLFCN_H
|
||||
|
||||
/* Define to 1 if you have the `fcntl' function. */
|
||||
#undef HAVE_FCNTL
|
||||
|
||||
/* Define to 1 if you have the `flock' function. */
|
||||
#undef HAVE_FLOCK
|
||||
|
||||
/* Define to 1 if you have the <getopt.h> header file. */
|
||||
#undef HAVE_GETOPT_H
|
||||
|
||||
/* Define to 1 if you have the `getopt_long_only' function. */
|
||||
#undef HAVE_GETOPT_LONG_ONLY
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
/* Define if your <locale.h> file defines LC_MESSAGES. */
|
||||
#undef HAVE_LC_MESSAGES
|
||||
|
||||
/* Define to 1 if you have the `applespell' library (-lapplespell). */
|
||||
#undef HAVE_LIBAPPLESPELL
|
||||
|
||||
/* Define to 1 if you have the `aspell' library (-laspell). */
|
||||
#undef HAVE_LIBASPELL
|
||||
|
||||
/* Define to 1 if you have the `hspell' library (-lhspell). */
|
||||
#undef HAVE_LIBHSPELL
|
||||
|
||||
/* Define to 1 if you have the <locale.h> header file. */
|
||||
#undef HAVE_LOCALE_H
|
||||
|
||||
/* Define if the 'malloc' function is POSIX compliant. */
|
||||
#undef HAVE_MALLOC_POSIX
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
/* Define to 1 on MSVC platforms that have the "invalid parameter handler"
|
||||
concept. */
|
||||
#undef HAVE_MSVC_INVALID_PARAMETER_HANDLER
|
||||
|
||||
/* Define to 1 if you have the `rawmemchr' function. */
|
||||
#undef HAVE_RAWMEMCHR
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#undef HAVE_STDINT_H
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#undef HAVE_STDLIB_H
|
||||
|
||||
/* Define to 1 if you have the `strchrnul' function. */
|
||||
#undef HAVE_STRCHRNUL
|
||||
|
||||
/* Define to 1 if you have the `strdup' function. */
|
||||
#undef HAVE_STRDUP
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#undef HAVE_STRINGS_H
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#undef HAVE_STRING_H
|
||||
|
||||
/* Define to 1 if `l_type' is a member of `struct flock'. */
|
||||
#undef HAVE_STRUCT_FLOCK_L_TYPE
|
||||
|
||||
/* Define to 1 if you have the <sys/cdefs.h> header file. */
|
||||
#undef HAVE_SYS_CDEFS_H
|
||||
|
||||
/* Define to 1 if you have the <sys/file.h> header file. */
|
||||
#undef HAVE_SYS_FILE_H
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#undef HAVE_SYS_STAT_H
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#undef HAVE_SYS_TYPES_H
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Define if you have the 'wchar_t' type. */
|
||||
#undef HAVE_WCHAR_T
|
||||
|
||||
/* Define to 1 if you have the `_set_invalid_parameter_handler' function. */
|
||||
#undef HAVE__SET_INVALID_PARAMETER_HANDLER
|
||||
|
||||
/* Define to the value of ${prefix}, as a string. */
|
||||
#undef INSTALLPREFIX
|
||||
|
||||
/* Define to the extension used for runtime loadable modules, say, ".so". */
|
||||
#undef LT_MODULE_EXT
|
||||
|
||||
/* Define to the sub-directory where libtool stores uninstalled libraries. */
|
||||
#undef LT_OBJDIR
|
||||
|
||||
/* Define to the shared library suffix, say, ".dylib". */
|
||||
#undef LT_SHARED_EXT
|
||||
|
||||
/* Define to the shared archive member specification, say "(shr.o)". */
|
||||
#undef LT_SHARED_LIB_MEMBER
|
||||
|
||||
/* Name of package */
|
||||
#undef PACKAGE
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#undef PACKAGE_BUGREPORT
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#undef PACKAGE_NAME
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#undef PACKAGE_STRING
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#undef PACKAGE_TARNAME
|
||||
|
||||
/* Define to the home page for this package. */
|
||||
#undef PACKAGE_URL
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* Enable extensions on AIX 3, Interix. */
|
||||
#ifndef _ALL_SOURCE
|
||||
# undef _ALL_SOURCE
|
||||
#endif
|
||||
/* Enable general extensions on macOS. */
|
||||
#ifndef _DARWIN_C_SOURCE
|
||||
# undef _DARWIN_C_SOURCE
|
||||
#endif
|
||||
/* Enable GNU extensions on systems that have them. */
|
||||
#ifndef _GNU_SOURCE
|
||||
# undef _GNU_SOURCE
|
||||
#endif
|
||||
/* Enable NetBSD extensions on NetBSD. */
|
||||
#ifndef _NETBSD_SOURCE
|
||||
# undef _NETBSD_SOURCE
|
||||
#endif
|
||||
/* Enable OpenBSD extensions on NetBSD. */
|
||||
#ifndef _OPENBSD_SOURCE
|
||||
# undef _OPENBSD_SOURCE
|
||||
#endif
|
||||
/* Enable threading extensions on Solaris. */
|
||||
#ifndef _POSIX_PTHREAD_SEMANTICS
|
||||
# undef _POSIX_PTHREAD_SEMANTICS
|
||||
#endif
|
||||
/* Enable extensions specified by ISO/IEC TS 18661-5:2014. */
|
||||
#ifndef __STDC_WANT_IEC_60559_ATTRIBS_EXT__
|
||||
# undef __STDC_WANT_IEC_60559_ATTRIBS_EXT__
|
||||
#endif
|
||||
/* Enable extensions specified by ISO/IEC TS 18661-1:2014. */
|
||||
#ifndef __STDC_WANT_IEC_60559_BFP_EXT__
|
||||
# undef __STDC_WANT_IEC_60559_BFP_EXT__
|
||||
#endif
|
||||
/* Enable extensions specified by ISO/IEC TS 18661-2:2015. */
|
||||
#ifndef __STDC_WANT_IEC_60559_DFP_EXT__
|
||||
# undef __STDC_WANT_IEC_60559_DFP_EXT__
|
||||
#endif
|
||||
/* Enable extensions specified by ISO/IEC TS 18661-4:2015. */
|
||||
#ifndef __STDC_WANT_IEC_60559_FUNCS_EXT__
|
||||
# undef __STDC_WANT_IEC_60559_FUNCS_EXT__
|
||||
#endif
|
||||
/* Enable extensions specified by ISO/IEC TS 18661-3:2015. */
|
||||
#ifndef __STDC_WANT_IEC_60559_TYPES_EXT__
|
||||
# undef __STDC_WANT_IEC_60559_TYPES_EXT__
|
||||
#endif
|
||||
/* Enable extensions specified by ISO/IEC TR 24731-2:2010. */
|
||||
#ifndef __STDC_WANT_LIB_EXT2__
|
||||
# undef __STDC_WANT_LIB_EXT2__
|
||||
#endif
|
||||
/* Enable extensions specified by ISO/IEC 24747:2009. */
|
||||
#ifndef __STDC_WANT_MATH_SPEC_FUNCS__
|
||||
# undef __STDC_WANT_MATH_SPEC_FUNCS__
|
||||
#endif
|
||||
/* Enable extensions on HP NonStop. */
|
||||
#ifndef _TANDEM_SOURCE
|
||||
# undef _TANDEM_SOURCE
|
||||
#endif
|
||||
/* Enable X/Open extensions if necessary. HP-UX 11.11 defines
|
||||
mbstate_t only if _XOPEN_SOURCE is defined to 500, regardless of
|
||||
whether compiling with -Ae or -D_HPUX_SOURCE=1. */
|
||||
#ifndef _XOPEN_SOURCE
|
||||
# undef _XOPEN_SOURCE
|
||||
#endif
|
||||
/* Enable X/Open compliant socket functions that do not require linking
|
||||
with -lxnet on HP-UX 11.11. */
|
||||
#ifndef _HPUX_ALT_XOPEN_SOCKET_API
|
||||
# undef _HPUX_ALT_XOPEN_SOCKET_API
|
||||
#endif
|
||||
/* Enable general extensions on Solaris. */
|
||||
#ifndef __EXTENSIONS__
|
||||
# undef __EXTENSIONS__
|
||||
#endif
|
||||
|
||||
|
||||
/* Version number of package */
|
||||
#undef VERSION
|
||||
|
||||
/* Define to 1 if on MINIX. */
|
||||
#undef _MINIX
|
||||
|
||||
/* Define to 1 to make NetBSD features available. MINIX 3 needs this. */
|
||||
#undef _NETBSD_SOURCE
|
||||
|
||||
/* The _Noreturn keyword of C11. */
|
||||
#if ! (defined _Noreturn \
|
||||
|| (defined __STDC_VERSION__ && 201112 <= __STDC_VERSION__))
|
||||
# if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__) \
|
||||
|| 0x5110 <= __SUNPRO_C)
|
||||
# define _Noreturn __attribute__ ((__noreturn__))
|
||||
# elif defined _MSC_VER && 1200 <= _MSC_VER
|
||||
# define _Noreturn __declspec (noreturn)
|
||||
# else
|
||||
# define _Noreturn
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
/* Define to 2 if the system does not provide POSIX.1 features except with
|
||||
this defined. */
|
||||
#undef _POSIX_1_SOURCE
|
||||
|
||||
/* Define to 1 if you need to in order for 'stat' and other things to work. */
|
||||
#undef _POSIX_SOURCE
|
||||
|
||||
/* For standard stat data types on VMS. */
|
||||
#undef _USE_STD_STAT
|
||||
|
||||
/* Define to rpl_ if the getopt replacement functions and variables should be
|
||||
used. */
|
||||
#undef __GETOPT_PREFIX
|
||||
|
||||
/* Please see the Gnulib manual for how to use these macros.
|
||||
|
||||
Suppress extern inline with HP-UX cc, as it appears to be broken; see
|
||||
<https://lists.gnu.org/r/bug-texinfo/2013-02/msg00030.html>.
|
||||
|
||||
Suppress extern inline with Sun C in standards-conformance mode, as it
|
||||
mishandles inline functions that call each other. E.g., for 'inline void f
|
||||
(void) { } inline void g (void) { f (); }', c99 incorrectly complains
|
||||
'reference to static identifier "f" in extern inline function'.
|
||||
This bug was observed with Sun C 5.12 SunOS_i386 2011/11/16.
|
||||
|
||||
Suppress extern inline (with or without __attribute__ ((__gnu_inline__)))
|
||||
on configurations that mistakenly use 'static inline' to implement
|
||||
functions or macros in standard C headers like <ctype.h>. For example,
|
||||
if isdigit is mistakenly implemented via a static inline function,
|
||||
a program containing an extern inline function that calls isdigit
|
||||
may not work since the C standard prohibits extern inline functions
|
||||
from calling static functions (ISO C 99 section 6.7.4.(3).
|
||||
This bug is known to occur on:
|
||||
|
||||
OS X 10.8 and earlier; see:
|
||||
https://lists.gnu.org/r/bug-gnulib/2012-12/msg00023.html
|
||||
|
||||
DragonFly; see
|
||||
http://muscles.dragonflybsd.org/bulk/bleeding-edge-potential/latest-per-pkg/ah-tty-0.3.12.log
|
||||
|
||||
FreeBSD; see:
|
||||
https://lists.gnu.org/r/bug-gnulib/2014-07/msg00104.html
|
||||
|
||||
OS X 10.9 has a macro __header_inline indicating the bug is fixed for C and
|
||||
for clang but remains for g++; see <https://trac.macports.org/ticket/41033>.
|
||||
Assume DragonFly and FreeBSD will be similar.
|
||||
|
||||
GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99
|
||||
inline semantics, unless -fgnu89-inline is used. It defines a macro
|
||||
__GNUC_STDC_INLINE__ to indicate this situation or a macro
|
||||
__GNUC_GNU_INLINE__ to indicate the opposite situation.
|
||||
GCC 4.2 with -std=c99 or -std=gnu99 implements the GNU C inline
|
||||
semantics but warns, unless -fgnu89-inline is used:
|
||||
warning: C99 inline functions are not supported; using GNU89
|
||||
warning: to disable this warning use -fgnu89-inline or the gnu_inline function attribute
|
||||
It defines a macro __GNUC_GNU_INLINE__ to indicate this situation.
|
||||
*/
|
||||
#if (((defined __APPLE__ && defined __MACH__) \
|
||||
|| defined __DragonFly__ || defined __FreeBSD__) \
|
||||
&& (defined __header_inline \
|
||||
? (defined __cplusplus && defined __GNUC_STDC_INLINE__ \
|
||||
&& ! defined __clang__) \
|
||||
: ((! defined _DONT_USE_CTYPE_INLINE_ \
|
||||
&& (defined __GNUC__ || defined __cplusplus)) \
|
||||
|| (defined _FORTIFY_SOURCE && 0 < _FORTIFY_SOURCE \
|
||||
&& defined __GNUC__ && ! defined __cplusplus))))
|
||||
# define _GL_EXTERN_INLINE_STDHEADER_BUG
|
||||
#endif
|
||||
#if ((__GNUC__ \
|
||||
? defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ \
|
||||
: (199901L <= __STDC_VERSION__ \
|
||||
&& !defined __HP_cc \
|
||||
&& !defined __PGI \
|
||||
&& !(defined __SUNPRO_C && __STDC__))) \
|
||||
&& !defined _GL_EXTERN_INLINE_STDHEADER_BUG)
|
||||
# define _GL_INLINE inline
|
||||
# define _GL_EXTERN_INLINE extern inline
|
||||
# define _GL_EXTERN_INLINE_IN_USE
|
||||
#elif (2 < __GNUC__ + (7 <= __GNUC_MINOR__) && !defined __STRICT_ANSI__ \
|
||||
&& !defined _GL_EXTERN_INLINE_STDHEADER_BUG)
|
||||
# if defined __GNUC_GNU_INLINE__ && __GNUC_GNU_INLINE__
|
||||
/* __gnu_inline__ suppresses a GCC 4.2 diagnostic. */
|
||||
# define _GL_INLINE extern inline __attribute__ ((__gnu_inline__))
|
||||
# else
|
||||
# define _GL_INLINE extern inline
|
||||
# endif
|
||||
# define _GL_EXTERN_INLINE extern
|
||||
# define _GL_EXTERN_INLINE_IN_USE
|
||||
#else
|
||||
# define _GL_INLINE static _GL_UNUSED
|
||||
# define _GL_EXTERN_INLINE static _GL_UNUSED
|
||||
#endif
|
||||
|
||||
/* In GCC 4.6 (inclusive) to 5.1 (exclusive),
|
||||
suppress bogus "no previous prototype for 'FOO'"
|
||||
and "no previous declaration for 'FOO'" diagnostics,
|
||||
when FOO is an inline function in the header; see
|
||||
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54113> and
|
||||
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63877>. */
|
||||
#if __GNUC__ == 4 && 6 <= __GNUC_MINOR__
|
||||
# if defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__
|
||||
# define _GL_INLINE_HEADER_CONST_PRAGMA
|
||||
# else
|
||||
# define _GL_INLINE_HEADER_CONST_PRAGMA \
|
||||
_Pragma ("GCC diagnostic ignored \"-Wsuggest-attribute=const\"")
|
||||
# endif
|
||||
# define _GL_INLINE_HEADER_BEGIN \
|
||||
_Pragma ("GCC diagnostic push") \
|
||||
_Pragma ("GCC diagnostic ignored \"-Wmissing-prototypes\"") \
|
||||
_Pragma ("GCC diagnostic ignored \"-Wmissing-declarations\"") \
|
||||
_GL_INLINE_HEADER_CONST_PRAGMA
|
||||
# define _GL_INLINE_HEADER_END \
|
||||
_Pragma ("GCC diagnostic pop")
|
||||
#else
|
||||
# define _GL_INLINE_HEADER_BEGIN
|
||||
# define _GL_INLINE_HEADER_END
|
||||
#endif
|
||||
|
||||
/* Work around a bug in Apple GCC 4.0.1 build 5465: In C99 mode, it supports
|
||||
the ISO C 99 semantics of 'extern inline' (unlike the GNU C semantics of
|
||||
earlier versions), but does not display it by setting __GNUC_STDC_INLINE__.
|
||||
__APPLE__ && __MACH__ test for Mac OS X.
|
||||
__APPLE_CC__ tests for the Apple compiler and its version.
|
||||
__STDC_VERSION__ tests for the C99 mode. */
|
||||
#if defined __APPLE__ && defined __MACH__ && __APPLE_CC__ >= 5465 && !defined __cplusplus && __STDC_VERSION__ >= 199901L && !defined __GNUC_STDC_INLINE__
|
||||
# define __GNUC_STDC_INLINE__ 1
|
||||
#endif
|
||||
|
||||
/* Define to `int' if <sys/types.h> does not define. */
|
||||
#undef mode_t
|
||||
|
||||
/* Define to `int' if <sys/types.h> does not define. */
|
||||
#undef pid_t
|
||||
|
||||
/* Define to the equivalent of the C99 'restrict' keyword, or to
|
||||
nothing if this is not supported. Do not define if restrict is
|
||||
supported directly. */
|
||||
#undef restrict
|
||||
/* Work around a bug in Sun C++: it does not support _Restrict or
|
||||
__restrict__, even though the corresponding Sun C compiler ends up with
|
||||
"#define restrict _Restrict" or "#define restrict __restrict__" in the
|
||||
previous line. Perhaps some future version of Sun C++ will work with
|
||||
restrict; if so, hopefully it defines __RESTRICT like Sun C does. */
|
||||
#if defined __SUNPRO_CC && !defined __RESTRICT
|
||||
# define _Restrict
|
||||
# define __restrict__
|
||||
#endif
|
||||
|
||||
/* Define as a signed type of the same size as size_t. */
|
||||
#undef ssize_t
|
||||
|
||||
/* Define as a marker that can be attached to declarations that might not
|
||||
be used. This helps to reduce warnings, such as from
|
||||
GCC -Wunused-parameter. */
|
||||
#if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
|
||||
# define _GL_UNUSED __attribute__ ((__unused__))
|
||||
#else
|
||||
# define _GL_UNUSED
|
||||
#endif
|
||||
/* The name _UNUSED_PARAMETER_ is an earlier spelling, although the name
|
||||
is a misnomer outside of parameter lists. */
|
||||
#define _UNUSED_PARAMETER_ _GL_UNUSED
|
||||
|
||||
/* gcc supports the "unused" attribute on possibly unused labels, and
|
||||
g++ has since version 4.5. Note to support C++ as well as C,
|
||||
_GL_UNUSED_LABEL should be used with a trailing ; */
|
||||
#if !defined __cplusplus || __GNUC__ > 4 \
|
||||
|| (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
|
||||
# define _GL_UNUSED_LABEL _GL_UNUSED
|
||||
#else
|
||||
# define _GL_UNUSED_LABEL
|
||||
#endif
|
||||
|
||||
/* The __pure__ attribute was added in gcc 2.96. */
|
||||
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
|
||||
# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
|
||||
#else
|
||||
# define _GL_ATTRIBUTE_PURE /* empty */
|
||||
#endif
|
||||
|
||||
/* The __const__ attribute was added in gcc 2.95. */
|
||||
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
|
||||
# define _GL_ATTRIBUTE_CONST __attribute__ ((__const__))
|
||||
#else
|
||||
# define _GL_ATTRIBUTE_CONST /* empty */
|
||||
#endif
|
||||
|
||||
/* The __malloc__ attribute was added in gcc 3. */
|
||||
#if 3 <= __GNUC__
|
||||
# define _GL_ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
|
||||
#else
|
||||
# define _GL_ATTRIBUTE_MALLOC /* empty */
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,263 @@
|
|||
AC_INIT([enchant],[2.2.8])
|
||||
AC_CONFIG_SRCDIR(src/enchant.h)
|
||||
AC_CONFIG_AUX_DIR([build-aux])
|
||||
AM_INIT_AUTOMAKE([subdir-objects])
|
||||
AC_CANONICAL_HOST
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
|
||||
dnl Release number rules:
|
||||
dnl This is derived from "Versioning" chapter of info libtool documentation.
|
||||
dnl Format is MAJOR:MINOR:MICRO
|
||||
dnl 4a) Increment major when removing or changing interfaces.
|
||||
dnl 4a) 5) Increment minor when adding interfaces.
|
||||
dnl 6) Set minor to zero when removing or changing interfaces.
|
||||
dnl 3) Increment micro when interfaces not changed at all,
|
||||
dnl only bug fixes or internal changes made.
|
||||
dnl 4b) Set micro to zero when adding, removing or changing interfaces.
|
||||
|
||||
dnl First extract pieces from the version number string
|
||||
ENCHANT_MAJOR_VERSION=`echo $VERSION | awk -F. '{print $1}'`
|
||||
ENCHANT_MINOR_VERSION=`echo $VERSION | awk -F. '{print $2}'`
|
||||
ENCHANT_MICRO_VERSION=`echo $VERSION | awk -F. '{print $3}'`
|
||||
ENCHANT_VERSION=$ENCHANT_MAJOR_VERSION.$ENCHANT_MINOR_VERSION.$ENCHANT_MICRO_VERSION$ENCHANT_MICRO_VERSION_SUFFIX
|
||||
ENCHANT_VERSION_NUMBER=`expr $ENCHANT_MAJOR_VERSION \* 1000000 + $ENCHANT_MINOR_VERSION \* 1000 + $ENCHANT_MICRO_VERSION`
|
||||
|
||||
ENCHANT_SONUM=$ENCHANT_MAJOR_VERSION
|
||||
AGE=$ENCHANT_MINOR_VERSION
|
||||
REVISION=$ENCHANT_MICRO_VERSION
|
||||
CURRENT=`expr $ENCHANT_SONUM + $AGE`
|
||||
|
||||
dnl Version info for libraries = CURRENT:REVISION:AGE
|
||||
VERSION_INFO=$CURRENT:$REVISION:$AGE
|
||||
|
||||
AC_SUBST(VERSION_INFO)
|
||||
AC_SUBST(ENCHANT_MAJOR_VERSION)
|
||||
AC_SUBST(ENCHANT_MINOR_VERSION)
|
||||
AC_SUBST(ENCHANT_MICRO_VERSION)
|
||||
|
||||
dnl Checks for programs.
|
||||
AC_PROG_CC
|
||||
gl_EARLY
|
||||
AC_PROG_CXX
|
||||
AX_CXX_COMPILE_STDCXX(11)
|
||||
AC_PROG_OBJCXX
|
||||
AC_PROG_INSTALL
|
||||
AC_PROG_LN_S
|
||||
AC_PROG_MKDIR_P
|
||||
AC_HEADER_STDC
|
||||
LT_INIT([win32-dll])
|
||||
LT_LANG([Windows Resource])
|
||||
gl_INIT
|
||||
AC_SUBST([objdir])
|
||||
LT_SYS_MODULE_EXT
|
||||
AC_SUBST([shlibext], [$libltdl_cv_shlibext])
|
||||
AC_CONFIG_LIBOBJ_DIR([lib])
|
||||
|
||||
|
||||
PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.6 gmodule-2.0])
|
||||
|
||||
dnl Extra warnings with GCC and compatible compilers
|
||||
AC_ARG_ENABLE([gcc-warnings],
|
||||
[AS_HELP_STRING([--disable-gcc-warnings],
|
||||
[turn off lots of GCC warnings])],
|
||||
[case $enableval in
|
||||
yes|no) ;;
|
||||
*) AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;;
|
||||
esac
|
||||
gl_gcc_warnings=$enableval],
|
||||
[gl_gcc_warnings=yes]
|
||||
)
|
||||
if test "$gl_gcc_warnings" = yes; then
|
||||
dnl Set up the list of undesired warnings.
|
||||
nw=
|
||||
nw="$nw -Wsystem-headers" # Don’t let system headers trigger warnings
|
||||
nw="$nw -Wundef" # All compiler preprocessors support #if UNDEF
|
||||
nw="$nw -Wtraditional" # All compilers nowadays support ANSI C
|
||||
nw="$nw -Wdeclaration-after-statement" # We require C99.
|
||||
nw="$nw -Wstrict-overflow" # Use a lower level (see below).
|
||||
nw="$nw -Wconversion" # These warnings usually don’t point to mistakes.
|
||||
nw="$nw -Wsign-conversion" # Likewise.
|
||||
nw="$nw -Wimplicit-fallthrough=5" # We want to allow "fallthrough" comments.
|
||||
|
||||
gl_MANYWARN_ALL_GCC([warnings])
|
||||
|
||||
dnl Enable all GCC warnings not in this list.
|
||||
gl_MANYWARN_COMPLEMENT([warnings], [$warnings], [$nw])
|
||||
for w in $warnings; do
|
||||
gl_WARN_ADD([$w])
|
||||
done
|
||||
|
||||
AC_LANG_PUSH([C++])
|
||||
gl_MANYWARN_ALL_GCC([cxx_warnings])
|
||||
|
||||
dnl Enable all G++ warnings not in this list.
|
||||
gl_MANYWARN_COMPLEMENT([cxx_warnings], [$cxx_warnings], [$nw])
|
||||
for w in $cxx_warnings; do
|
||||
gl_WARN_ADD([$w])
|
||||
done
|
||||
AC_LANG_POP
|
||||
|
||||
dnl Add an extra warning
|
||||
gl_WARN_ADD([-Wstrict-overflow=1])
|
||||
dnl Add some more safety measures
|
||||
gl_WARN_ADD([-D_FORTIFY_SOURCE=2])
|
||||
dnl Remove a warning being promoted to error: we trigger this and can't turn it off with pragmas.
|
||||
gl_WARN_ADD([-Wno-error=format-security])
|
||||
|
||||
# When compiling with GCC, prefer -isystem to -I when including system
|
||||
# include files, to avoid generating useless diagnostics for the files.
|
||||
ISYSTEM='-isystem '
|
||||
else
|
||||
ISYSTEM='-I'
|
||||
fi
|
||||
AC_SUBST([ISYSTEM])
|
||||
|
||||
# FIXME: Use just GLIB_CFLAGS, GLIB_LIBS
|
||||
ENCHANT_CFLAGS=$GLIB_CFLAGS
|
||||
ENCHANT_LIBS=$GLIB_LIBS
|
||||
|
||||
AC_SUBST(ENCHANT_CFLAGS)
|
||||
AC_SUBST(ENCHANT_LIBS)
|
||||
|
||||
AC_MSG_CHECKING([for native Win32])
|
||||
native_win32=no
|
||||
case "$host" in
|
||||
*-*-mingw*)
|
||||
native_win32=yes
|
||||
;;
|
||||
esac
|
||||
AC_MSG_RESULT([$native_win32])
|
||||
AM_CONDITIONAL(OS_WIN32, test "x$native_win32" = "xyes")
|
||||
|
||||
AM_CONDITIONAL([SHLIBS_IN_BINDIR], [case "$host_os" in mingw* | cygwin*) true;; *) false;; esac])
|
||||
|
||||
dnl ===========================================================================
|
||||
|
||||
m4_copy([AC_DEFUN],[glib_DEFUN])
|
||||
glib_DEFUN([GLIB_LC_MESSAGES],
|
||||
[AC_CHECK_HEADERS([locale.h])
|
||||
if test $ac_cv_header_locale_h = yes; then
|
||||
AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
|
||||
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <locale.h>]], [[return LC_MESSAGES]])],[am_cv_val_LC_MESSAGES=yes],[am_cv_val_LC_MESSAGES=no])])
|
||||
if test $am_cv_val_LC_MESSAGES = yes; then
|
||||
AC_DEFINE(HAVE_LC_MESSAGES, 1,
|
||||
[Define if your <locale.h> file defines LC_MESSAGES.])
|
||||
fi
|
||||
fi])
|
||||
|
||||
GLIB_LC_MESSAGES
|
||||
|
||||
AC_LANG_PUSH([C++])
|
||||
PKG_CHECK_EXISTS([UnitTest++],
|
||||
[PKG_CHECK_MODULES(UNITTESTPP, [UnitTest++])])
|
||||
AC_SUBST(UNITTESTPP_CFLAGS)
|
||||
AC_SUBST(UNITTESTPP_LIBS)
|
||||
AC_LANG_POP([C++])
|
||||
|
||||
|
||||
dnl Provider detection
|
||||
AC_DEFUN([ENCHANT_CHECK_PROVIDER_SETUP],
|
||||
[m4_define([provider_check], [m4_default([$2],[check])])
|
||||
AC_ARG_WITH([$1],
|
||||
AS_HELP_STRING([--with-[]$1],
|
||||
[enable the $1 provider @<:@default=provider_check@:>@]),
|
||||
[with_[]$1=$withval],
|
||||
[with_[]$1=provider_check])
|
||||
$1[]_dir=${datadir}/$1
|
||||
AC_ARG_WITH([$1[]-dir],
|
||||
AS_HELP_STRING([--with-[]$1-dir=PATH],
|
||||
[path to installed $1 dicts]))
|
||||
AS_IF([test "x$with_[]$1_dir" != "x"],
|
||||
[$1[]_dir=$with_[]$1_dir])])
|
||||
|
||||
AC_DEFUN([ENCHANT_CHECK_PKG_CONFIG_PROVIDER],
|
||||
[ENCHANT_CHECK_PROVIDER_SETUP([$1], [$4])
|
||||
AS_IF([test "x$with_[]$1" != xno],
|
||||
[PKG_CHECK_MODULES([$2], [m4_default([$3], [$1])],
|
||||
[$2[]_CFLAGS="$[]$2[]_CFLAGS -DENCHANT_[]$2[]_DICT_DIR='\"$[]$1_dir\"'"
|
||||
with_$1=yes
|
||||
build_providers="$build_providers $1"],
|
||||
[if test "x$with_$1" != xcheck; then
|
||||
AC_MSG_FAILURE([--with-[]$1 was given, but test(s) for $1 failed])
|
||||
fi
|
||||
with_$1=no])])
|
||||
AM_CONDITIONAL(WITH_[]$2, test "x$with_[]$1" = xyes)])
|
||||
|
||||
AC_DEFUN([ENCHANT_CHECK_LIB_PROVIDER],
|
||||
[ENCHANT_CHECK_PROVIDER_SETUP([$1], [$4])
|
||||
AS_IF([test "x$with_[]$1" != xno],
|
||||
[_enchant_header=m4_default([$6], [$1[].h])
|
||||
AC_CHECK_HEADERS([$_enchant_header], [_header_found=yes], [_header_found=no], [])
|
||||
if test "$3" != NOLIB; then
|
||||
AC_CHECK_LIB([$1], [$3],,, [$5])
|
||||
else
|
||||
ac_cv_lib_[]$1[]_[]$3=yes
|
||||
fi
|
||||
if test "x$_header_found" != xyes -o "x$ac_cv_lib_[]$1[]_[]$3" != xyes; then
|
||||
if test "x$with_[]$1" != xcheck; then
|
||||
AC_MSG_FAILURE([--with-[]$1 was given, but tests for $1 failed])
|
||||
fi
|
||||
with_[]$1=no
|
||||
else
|
||||
with_[]$1=yes
|
||||
build_providers="$build_providers $1"
|
||||
LIBS="$LIBS $5"
|
||||
fi])
|
||||
AM_CONDITIONAL(WITH_[]$2, test "x$with_[]$1" = xyes)])
|
||||
|
||||
|
||||
dnl Check for providers
|
||||
build_providers=
|
||||
|
||||
dnl Standard providers
|
||||
ENCHANT_CHECK_PKG_CONFIG_PROVIDER([hunspell], [HUNSPELL])
|
||||
ENCHANT_CHECK_PKG_CONFIG_PROVIDER([nuspell], [NUSPELL])
|
||||
ENCHANT_CHECK_LIB_PROVIDER([aspell], [ASPELL], [get_aspell_dict_info_list])
|
||||
ENCHANT_CHECK_LIB_PROVIDER([hspell], [HSPELL], [hspell_get_dictionary_path],, [-lz])
|
||||
ENCHANT_CHECK_PKG_CONFIG_PROVIDER([voikko], [VOIKKO], [libvoikko])
|
||||
dnl FIXME: The test below assumes GCC(-compatible) ObjC++ compiler, but
|
||||
dnl OBJCXX is set even if no compiler is found.
|
||||
if test "$ac_cv_objcxx_compiler_gnu" = "yes"; then
|
||||
AC_LANG_PUSH([Objective C++])
|
||||
ENCHANT_CHECK_LIB_PROVIDER([applespell], [APPLESPELL], [NOLIB],, [-framework Cocoa], [Cocoa/Cocoa.h])
|
||||
AC_LANG_POP([Objective C++])
|
||||
fi
|
||||
dnl Must call AM_CONDITIONAL outside conditional
|
||||
AM_CONDITIONAL(WITH_APPLESPELL, test "x$with_applespell" = xyes)
|
||||
|
||||
dnl Experimental/deprecated providers
|
||||
ENCHANT_CHECK_PKG_CONFIG_PROVIDER([zemberek], [ZEMBEREK], [dbus-glib-1 >= 0.62], [no])
|
||||
|
||||
dnl =======================================================================================
|
||||
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
AC_CONFIG_FILES([
|
||||
Makefile
|
||||
enchant-$ENCHANT_MAJOR_VERSION.pc:enchant.pc.in
|
||||
lib/Makefile
|
||||
src/libenchant.rc
|
||||
src/Makefile
|
||||
src/enchant.1
|
||||
src/enchant-lsmod.1
|
||||
providers/Makefile
|
||||
tests/Makefile
|
||||
tests/enchant_providers/Makefile
|
||||
], [],
|
||||
[ENCHANT_MAJOR_VERSION="$ENCHANT_MAJOR_VERSION"])
|
||||
AC_OUTPUT
|
||||
|
||||
dnl ===========================================================================================
|
||||
|
||||
echo "Providers to build:${build_providers}"
|
||||
if test "x$build_providers" = "x"; then
|
||||
AC_MSG_WARN([No spell-checking provider selected!])
|
||||
fi
|
||||
|
||||
if test "x$with_zemberek" = "xyes"; then
|
||||
echo "
|
||||
The Zemberek Turkish spell-checking plugin is enabled. It is known
|
||||
to cause crashes with WebKit. Use at your own discretion."
|
||||
fi
|
||||
if test $RELOCATABLE != yes; then
|
||||
AC_MSG_WARN([Building without --enable-relocatable: the tests will not work!])
|
||||
fi
|
|
@ -0,0 +1,791 @@
|
|||
#! /bin/sh
|
||||
# depcomp - compile a program generating dependencies as side-effects
|
||||
|
||||
scriptversion=2013-05-30.07; # UTC
|
||||
|
||||
# Copyright (C) 1999-2014 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
echo "$0: No command. Try '$0 --help' for more information." 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<\EOF
|
||||
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
|
||||
|
||||
Run PROGRAMS ARGS to compile a file, generating dependencies
|
||||
as side-effects.
|
||||
|
||||
Environment variables:
|
||||
depmode Dependency tracking mode.
|
||||
source Source file read by 'PROGRAMS ARGS'.
|
||||
object Object file output by 'PROGRAMS ARGS'.
|
||||
DEPDIR directory where to store dependencies.
|
||||
depfile Dependency file to output.
|
||||
tmpdepfile Temporary file to use when outputting dependencies.
|
||||
libtool Whether libtool is used (yes/no).
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "depcomp $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
esac
|
||||
|
||||
# Get the directory component of the given path, and save it in the
|
||||
# global variables '$dir'. Note that this directory component will
|
||||
# be either empty or ending with a '/' character. This is deliberate.
|
||||
set_dir_from ()
|
||||
{
|
||||
case $1 in
|
||||
*/*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;;
|
||||
*) dir=;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Get the suffix-stripped basename of the given path, and save it the
|
||||
# global variable '$base'.
|
||||
set_base_from ()
|
||||
{
|
||||
base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'`
|
||||
}
|
||||
|
||||
# If no dependency file was actually created by the compiler invocation,
|
||||
# we still have to create a dummy depfile, to avoid errors with the
|
||||
# Makefile "include basename.Plo" scheme.
|
||||
make_dummy_depfile ()
|
||||
{
|
||||
echo "#dummy" > "$depfile"
|
||||
}
|
||||
|
||||
# Factor out some common post-processing of the generated depfile.
|
||||
# Requires the auxiliary global variable '$tmpdepfile' to be set.
|
||||
aix_post_process_depfile ()
|
||||
{
|
||||
# If the compiler actually managed to produce a dependency file,
|
||||
# post-process it.
|
||||
if test -f "$tmpdepfile"; then
|
||||
# Each line is of the form 'foo.o: dependency.h'.
|
||||
# Do two passes, one to just change these to
|
||||
# $object: dependency.h
|
||||
# and one to simply output
|
||||
# dependency.h:
|
||||
# which is needed to avoid the deleted-header problem.
|
||||
{ sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile"
|
||||
sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile"
|
||||
} > "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
else
|
||||
make_dummy_depfile
|
||||
fi
|
||||
}
|
||||
|
||||
# A tabulation character.
|
||||
tab=' '
|
||||
# A newline character.
|
||||
nl='
|
||||
'
|
||||
# Character ranges might be problematic outside the C locale.
|
||||
# These definitions help.
|
||||
upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ
|
||||
lower=abcdefghijklmnopqrstuvwxyz
|
||||
digits=0123456789
|
||||
alpha=${upper}${lower}
|
||||
|
||||
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
|
||||
echo "depcomp: Variables source, object and depmode must be set" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
|
||||
depfile=${depfile-`echo "$object" |
|
||||
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
|
||||
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
|
||||
|
||||
rm -f "$tmpdepfile"
|
||||
|
||||
# Avoid interferences from the environment.
|
||||
gccflag= dashmflag=
|
||||
|
||||
# Some modes work just like other modes, but use different flags. We
|
||||
# parameterize here, but still list the modes in the big case below,
|
||||
# to make depend.m4 easier to write. Note that we *cannot* use a case
|
||||
# here, because this file can only contain one case statement.
|
||||
if test "$depmode" = hp; then
|
||||
# HP compiler uses -M and no extra arg.
|
||||
gccflag=-M
|
||||
depmode=gcc
|
||||
fi
|
||||
|
||||
if test "$depmode" = dashXmstdout; then
|
||||
# This is just like dashmstdout with a different argument.
|
||||
dashmflag=-xM
|
||||
depmode=dashmstdout
|
||||
fi
|
||||
|
||||
cygpath_u="cygpath -u -f -"
|
||||
if test "$depmode" = msvcmsys; then
|
||||
# This is just like msvisualcpp but w/o cygpath translation.
|
||||
# Just convert the backslash-escaped backslashes to single forward
|
||||
# slashes to satisfy depend.m4
|
||||
cygpath_u='sed s,\\\\,/,g'
|
||||
depmode=msvisualcpp
|
||||
fi
|
||||
|
||||
if test "$depmode" = msvc7msys; then
|
||||
# This is just like msvc7 but w/o cygpath translation.
|
||||
# Just convert the backslash-escaped backslashes to single forward
|
||||
# slashes to satisfy depend.m4
|
||||
cygpath_u='sed s,\\\\,/,g'
|
||||
depmode=msvc7
|
||||
fi
|
||||
|
||||
if test "$depmode" = xlc; then
|
||||
# IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information.
|
||||
gccflag=-qmakedep=gcc,-MF
|
||||
depmode=gcc
|
||||
fi
|
||||
|
||||
case "$depmode" in
|
||||
gcc3)
|
||||
## gcc 3 implements dependency tracking that does exactly what
|
||||
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
|
||||
## it if -MD -MP comes after the -MF stuff. Hmm.
|
||||
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
|
||||
## the command line argument order; so add the flags where they
|
||||
## appear in depend2.am. Note that the slowdown incurred here
|
||||
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
|
||||
*) set fnord "$@" "$arg" ;;
|
||||
esac
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
done
|
||||
"$@"
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
mv "$tmpdepfile" "$depfile"
|
||||
;;
|
||||
|
||||
gcc)
|
||||
## Note that this doesn't just cater to obsosete pre-3.x GCC compilers.
|
||||
## but also to in-use compilers like IMB xlc/xlC and the HP C compiler.
|
||||
## (see the conditional assignment to $gccflag above).
|
||||
## There are various ways to get dependency output from gcc. Here's
|
||||
## why we pick this rather obscure method:
|
||||
## - Don't want to use -MD because we'd like the dependencies to end
|
||||
## up in a subdir. Having to rename by hand is ugly.
|
||||
## (We might end up doing this anyway to support other compilers.)
|
||||
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
|
||||
## -MM, not -M (despite what the docs say). Also, it might not be
|
||||
## supported by the other compilers which use the 'gcc' depmode.
|
||||
## - Using -M directly means running the compiler twice (even worse
|
||||
## than renaming).
|
||||
if test -z "$gccflag"; then
|
||||
gccflag=-MD,
|
||||
fi
|
||||
"$@" -Wp,"$gccflag$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
# The second -e expression handles DOS-style file names with drive
|
||||
# letters.
|
||||
sed -e 's/^[^:]*: / /' \
|
||||
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
|
||||
## This next piece of magic avoids the "deleted header file" problem.
|
||||
## The problem is that when a header file which appears in a .P file
|
||||
## is deleted, the dependency causes make to die (because there is
|
||||
## typically no way to rebuild the header). We avoid this by adding
|
||||
## dummy dependencies for each header file. Too bad gcc doesn't do
|
||||
## this for us directly.
|
||||
## Some versions of gcc put a space before the ':'. On the theory
|
||||
## that the space means something, we add a space to the output as
|
||||
## well. hp depmode also adds that space, but also prefixes the VPATH
|
||||
## to the object. Take care to not repeat it in the output.
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
tr ' ' "$nl" < "$tmpdepfile" \
|
||||
| sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
|
||||
| sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
hp)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
sgi)
|
||||
if test "$libtool" = yes; then
|
||||
"$@" "-Wp,-MDupdate,$tmpdepfile"
|
||||
else
|
||||
"$@" -MDupdate "$tmpdepfile"
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
|
||||
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
|
||||
echo "$object : \\" > "$depfile"
|
||||
# Clip off the initial element (the dependent). Don't try to be
|
||||
# clever and replace this with sed code, as IRIX sed won't handle
|
||||
# lines with more than a fixed number of characters (4096 in
|
||||
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
|
||||
# the IRIX cc adds comments like '#:fec' to the end of the
|
||||
# dependency line.
|
||||
tr ' ' "$nl" < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \
|
||||
| tr "$nl" ' ' >> "$depfile"
|
||||
echo >> "$depfile"
|
||||
# The second pass generates a dummy entry for each header file.
|
||||
tr ' ' "$nl" < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
|
||||
>> "$depfile"
|
||||
else
|
||||
make_dummy_depfile
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
xlc)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
aix)
|
||||
# The C for AIX Compiler uses -M and outputs the dependencies
|
||||
# in a .u file. In older versions, this file always lives in the
|
||||
# current directory. Also, the AIX compiler puts '$object:' at the
|
||||
# start of each line; $object doesn't have directory information.
|
||||
# Version 6 uses the directory in both cases.
|
||||
set_dir_from "$object"
|
||||
set_base_from "$object"
|
||||
if test "$libtool" = yes; then
|
||||
tmpdepfile1=$dir$base.u
|
||||
tmpdepfile2=$base.u
|
||||
tmpdepfile3=$dir.libs/$base.u
|
||||
"$@" -Wc,-M
|
||||
else
|
||||
tmpdepfile1=$dir$base.u
|
||||
tmpdepfile2=$dir$base.u
|
||||
tmpdepfile3=$dir$base.u
|
||||
"$@" -M
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
aix_post_process_depfile
|
||||
;;
|
||||
|
||||
tcc)
|
||||
# tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26
|
||||
# FIXME: That version still under development at the moment of writing.
|
||||
# Make that this statement remains true also for stable, released
|
||||
# versions.
|
||||
# It will wrap lines (doesn't matter whether long or short) with a
|
||||
# trailing '\', as in:
|
||||
#
|
||||
# foo.o : \
|
||||
# foo.c \
|
||||
# foo.h \
|
||||
#
|
||||
# It will put a trailing '\' even on the last line, and will use leading
|
||||
# spaces rather than leading tabs (at least since its commit 0394caf7
|
||||
# "Emit spaces for -MD").
|
||||
"$@" -MD -MF "$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
# Each non-empty line is of the form 'foo.o : \' or ' dep.h \'.
|
||||
# We have to change lines of the first kind to '$object: \'.
|
||||
sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile"
|
||||
# And for each line of the second kind, we have to emit a 'dep.h:'
|
||||
# dummy dependency, to avoid the deleted-header problem.
|
||||
sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
## The order of this option in the case statement is important, since the
|
||||
## shell code in configure will try each of these formats in the order
|
||||
## listed in this file. A plain '-MD' option would be understood by many
|
||||
## compilers, so we must ensure this comes after the gcc and icc options.
|
||||
pgcc)
|
||||
# Portland's C compiler understands '-MD'.
|
||||
# Will always output deps to 'file.d' where file is the root name of the
|
||||
# source file under compilation, even if file resides in a subdirectory.
|
||||
# The object file name does not affect the name of the '.d' file.
|
||||
# pgcc 10.2 will output
|
||||
# foo.o: sub/foo.c sub/foo.h
|
||||
# and will wrap long lines using '\' :
|
||||
# foo.o: sub/foo.c ... \
|
||||
# sub/foo.h ... \
|
||||
# ...
|
||||
set_dir_from "$object"
|
||||
# Use the source, not the object, to determine the base name, since
|
||||
# that's sadly what pgcc will do too.
|
||||
set_base_from "$source"
|
||||
tmpdepfile=$base.d
|
||||
|
||||
# For projects that build the same source file twice into different object
|
||||
# files, the pgcc approach of using the *source* file root name can cause
|
||||
# problems in parallel builds. Use a locking strategy to avoid stomping on
|
||||
# the same $tmpdepfile.
|
||||
lockdir=$base.d-lock
|
||||
trap "
|
||||
echo '$0: caught signal, cleaning up...' >&2
|
||||
rmdir '$lockdir'
|
||||
exit 1
|
||||
" 1 2 13 15
|
||||
numtries=100
|
||||
i=$numtries
|
||||
while test $i -gt 0; do
|
||||
# mkdir is a portable test-and-set.
|
||||
if mkdir "$lockdir" 2>/dev/null; then
|
||||
# This process acquired the lock.
|
||||
"$@" -MD
|
||||
stat=$?
|
||||
# Release the lock.
|
||||
rmdir "$lockdir"
|
||||
break
|
||||
else
|
||||
# If the lock is being held by a different process, wait
|
||||
# until the winning process is done or we timeout.
|
||||
while test -d "$lockdir" && test $i -gt 0; do
|
||||
sleep 1
|
||||
i=`expr $i - 1`
|
||||
done
|
||||
fi
|
||||
i=`expr $i - 1`
|
||||
done
|
||||
trap - 1 2 13 15
|
||||
if test $i -le 0; then
|
||||
echo "$0: failed to acquire lock after $numtries attempts" >&2
|
||||
echo "$0: check lockdir '$lockdir'" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
# Each line is of the form `foo.o: dependent.h',
|
||||
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
|
||||
# Do two passes, one to just change these to
|
||||
# `$object: dependent.h' and one to simply `dependent.h:'.
|
||||
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
|
||||
# Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
# correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \
|
||||
| sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
hp2)
|
||||
# The "hp" stanza above does not work with aCC (C++) and HP's ia64
|
||||
# compilers, which have integrated preprocessors. The correct option
|
||||
# to use with these is +Maked; it writes dependencies to a file named
|
||||
# 'foo.d', which lands next to the object file, wherever that
|
||||
# happens to be.
|
||||
# Much of this is similar to the tru64 case; see comments there.
|
||||
set_dir_from "$object"
|
||||
set_base_from "$object"
|
||||
if test "$libtool" = yes; then
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir.libs/$base.d
|
||||
"$@" -Wc,+Maked
|
||||
else
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir$base.d
|
||||
"$@" +Maked
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
if test -f "$tmpdepfile"; then
|
||||
sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile"
|
||||
# Add 'dependent.h:' lines.
|
||||
sed -ne '2,${
|
||||
s/^ *//
|
||||
s/ \\*$//
|
||||
s/$/:/
|
||||
p
|
||||
}' "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
make_dummy_depfile
|
||||
fi
|
||||
rm -f "$tmpdepfile" "$tmpdepfile2"
|
||||
;;
|
||||
|
||||
tru64)
|
||||
# The Tru64 compiler uses -MD to generate dependencies as a side
|
||||
# effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
|
||||
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
|
||||
# dependencies in 'foo.d' instead, so we check for that too.
|
||||
# Subdirectories are respected.
|
||||
set_dir_from "$object"
|
||||
set_base_from "$object"
|
||||
|
||||
if test "$libtool" = yes; then
|
||||
# Libtool generates 2 separate objects for the 2 libraries. These
|
||||
# two compilations output dependencies in $dir.libs/$base.o.d and
|
||||
# in $dir$base.o.d. We have to check for both files, because
|
||||
# one of the two compilations can be disabled. We should prefer
|
||||
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
|
||||
# automatically cleaned when .libs/ is deleted, while ignoring
|
||||
# the former would cause a distcleancheck panic.
|
||||
tmpdepfile1=$dir$base.o.d # libtool 1.5
|
||||
tmpdepfile2=$dir.libs/$base.o.d # Likewise.
|
||||
tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504
|
||||
"$@" -Wc,-MD
|
||||
else
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir$base.d
|
||||
tmpdepfile3=$dir$base.d
|
||||
"$@" -MD
|
||||
fi
|
||||
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
# Same post-processing that is required for AIX mode.
|
||||
aix_post_process_depfile
|
||||
;;
|
||||
|
||||
msvc7)
|
||||
if test "$libtool" = yes; then
|
||||
showIncludes=-Wc,-showIncludes
|
||||
else
|
||||
showIncludes=-showIncludes
|
||||
fi
|
||||
"$@" $showIncludes > "$tmpdepfile"
|
||||
stat=$?
|
||||
grep -v '^Note: including file: ' "$tmpdepfile"
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
# The first sed program below extracts the file names and escapes
|
||||
# backslashes for cygpath. The second sed program outputs the file
|
||||
# name when reading, but also accumulates all include files in the
|
||||
# hold buffer in order to output them again at the end. This only
|
||||
# works with sed implementations that can handle large buffers.
|
||||
sed < "$tmpdepfile" -n '
|
||||
/^Note: including file: *\(.*\)/ {
|
||||
s//\1/
|
||||
s/\\/\\\\/g
|
||||
p
|
||||
}' | $cygpath_u | sort -u | sed -n '
|
||||
s/ /\\ /g
|
||||
s/\(.*\)/'"$tab"'\1 \\/p
|
||||
s/.\(.*\) \\/\1:/
|
||||
H
|
||||
$ {
|
||||
s/.*/'"$tab"'/
|
||||
G
|
||||
p
|
||||
}' >> "$depfile"
|
||||
echo >> "$depfile" # make sure the fragment doesn't end with a backslash
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvc7msys)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
#nosideeffect)
|
||||
# This comment above is used by automake to tell side-effect
|
||||
# dependency tracking mechanisms from slower ones.
|
||||
|
||||
dashmstdout)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout, regardless of -o.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove '-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
test -z "$dashmflag" && dashmflag=-M
|
||||
# Require at least two characters before searching for ':'
|
||||
# in the target name. This is to cope with DOS-style filenames:
|
||||
# a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
|
||||
"$@" $dashmflag |
|
||||
sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
cat < "$tmpdepfile" > "$depfile"
|
||||
# Some versions of the HPUX 10.20 sed can't process this sed invocation
|
||||
# correctly. Breaking it into two sed invocations is a workaround.
|
||||
tr ' ' "$nl" < "$tmpdepfile" \
|
||||
| sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
|
||||
| sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
dashXmstdout)
|
||||
# This case only exists to satisfy depend.m4. It is never actually
|
||||
# run, as this mode is specially recognized in the preamble.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
makedepend)
|
||||
"$@" || exit $?
|
||||
# Remove any Libtool call
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
# X makedepend
|
||||
shift
|
||||
cleared=no eat=no
|
||||
for arg
|
||||
do
|
||||
case $cleared in
|
||||
no)
|
||||
set ""; shift
|
||||
cleared=yes ;;
|
||||
esac
|
||||
if test $eat = yes; then
|
||||
eat=no
|
||||
continue
|
||||
fi
|
||||
case "$arg" in
|
||||
-D*|-I*)
|
||||
set fnord "$@" "$arg"; shift ;;
|
||||
# Strip any option that makedepend may not understand. Remove
|
||||
# the object too, otherwise makedepend will parse it as a source file.
|
||||
-arch)
|
||||
eat=yes ;;
|
||||
-*|$object)
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"; shift ;;
|
||||
esac
|
||||
done
|
||||
obj_suffix=`echo "$object" | sed 's/^.*\././'`
|
||||
touch "$tmpdepfile"
|
||||
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
|
||||
rm -f "$depfile"
|
||||
# makedepend may prepend the VPATH from the source file name to the object.
|
||||
# No need to regex-escape $object, excess matching of '.' is harmless.
|
||||
sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
|
||||
# Some versions of the HPUX 10.20 sed can't process the last invocation
|
||||
# correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed '1,2d' "$tmpdepfile" \
|
||||
| tr ' ' "$nl" \
|
||||
| sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
|
||||
| sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile" "$tmpdepfile".bak
|
||||
;;
|
||||
|
||||
cpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove '-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
"$@" -E \
|
||||
| sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
|
||||
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
|
||||
| sed '$ s: \\$::' > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
cat < "$tmpdepfile" >> "$depfile"
|
||||
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvisualcpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case "$arg" in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
|
||||
set fnord "$@"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
"$@" -E 2>/dev/null |
|
||||
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile"
|
||||
echo "$tab" >> "$depfile"
|
||||
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvcmsys)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
none)
|
||||
exec "$@"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Unknown depmode $depmode" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
|
@ -0,0 +1,11 @@
|
|||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@
|
||||
includedir=@includedir@
|
||||
|
||||
Name: libenchant
|
||||
Description: A spell checking library
|
||||
Version: @VERSION@
|
||||
Requires.private: glib-2.0 gmodule-no-export-2.0
|
||||
Libs: -L${libdir} -lenchant-@ENCHANT_MAJOR_VERSION@
|
||||
Cflags: -I${includedir}/enchant-@ENCHANT_MAJOR_VERSION@
|
|
@ -0,0 +1,508 @@
|
|||
#!/bin/sh
|
||||
# install - install a program, script, or datafile
|
||||
|
||||
scriptversion=2014-09-12.12; # UTC
|
||||
|
||||
# This originates from X11R5 (mit/util/scripts/install.sh), which was
|
||||
# later released in X11R6 (xc/config/util/install.sh) with the
|
||||
# following copyright and license.
|
||||
#
|
||||
# Copyright (C) 1994 X Consortium
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to
|
||||
# deal in the Software without restriction, including without limitation the
|
||||
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
# sell copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
|
||||
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
# Except as contained in this notice, the name of the X Consortium shall not
|
||||
# be used in advertising or otherwise to promote the sale, use or other deal-
|
||||
# ings in this Software without prior written authorization from the X Consor-
|
||||
# tium.
|
||||
#
|
||||
#
|
||||
# FSF changes to this file are in the public domain.
|
||||
#
|
||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||
# 'make' implicit rules from creating a file called install from it
|
||||
# when there is no Makefile.
|
||||
#
|
||||
# This script is compatible with the BSD install script, but was written
|
||||
# from scratch.
|
||||
|
||||
tab=' '
|
||||
nl='
|
||||
'
|
||||
IFS=" $tab$nl"
|
||||
|
||||
# Set DOITPROG to "echo" to test this script.
|
||||
|
||||
doit=${DOITPROG-}
|
||||
doit_exec=${doit:-exec}
|
||||
|
||||
# Put in absolute file names if you don't have them in your path;
|
||||
# or use environment vars.
|
||||
|
||||
chgrpprog=${CHGRPPROG-chgrp}
|
||||
chmodprog=${CHMODPROG-chmod}
|
||||
chownprog=${CHOWNPROG-chown}
|
||||
cmpprog=${CMPPROG-cmp}
|
||||
cpprog=${CPPROG-cp}
|
||||
mkdirprog=${MKDIRPROG-mkdir}
|
||||
mvprog=${MVPROG-mv}
|
||||
rmprog=${RMPROG-rm}
|
||||
stripprog=${STRIPPROG-strip}
|
||||
|
||||
posix_mkdir=
|
||||
|
||||
# Desired mode of installed file.
|
||||
mode=0755
|
||||
|
||||
chgrpcmd=
|
||||
chmodcmd=$chmodprog
|
||||
chowncmd=
|
||||
mvcmd=$mvprog
|
||||
rmcmd="$rmprog -f"
|
||||
stripcmd=
|
||||
|
||||
src=
|
||||
dst=
|
||||
dir_arg=
|
||||
dst_arg=
|
||||
|
||||
copy_on_change=false
|
||||
is_target_a_directory=possibly
|
||||
|
||||
usage="\
|
||||
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
|
||||
or: $0 [OPTION]... SRCFILES... DIRECTORY
|
||||
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
|
||||
or: $0 [OPTION]... -d DIRECTORIES...
|
||||
|
||||
In the 1st form, copy SRCFILE to DSTFILE.
|
||||
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
|
||||
In the 4th, create DIRECTORIES.
|
||||
|
||||
Options:
|
||||
--help display this help and exit.
|
||||
--version display version info and exit.
|
||||
|
||||
-c (ignored)
|
||||
-C install only if different (preserve the last data modification time)
|
||||
-d create directories instead of installing files.
|
||||
-g GROUP $chgrpprog installed files to GROUP.
|
||||
-m MODE $chmodprog installed files to MODE.
|
||||
-o USER $chownprog installed files to USER.
|
||||
-s $stripprog installed files.
|
||||
-t DIRECTORY install into DIRECTORY.
|
||||
-T report an error if DSTFILE is a directory.
|
||||
|
||||
Environment variables override the default commands:
|
||||
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
|
||||
RMPROG STRIPPROG
|
||||
"
|
||||
|
||||
while test $# -ne 0; do
|
||||
case $1 in
|
||||
-c) ;;
|
||||
|
||||
-C) copy_on_change=true;;
|
||||
|
||||
-d) dir_arg=true;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift;;
|
||||
|
||||
--help) echo "$usage"; exit $?;;
|
||||
|
||||
-m) mode=$2
|
||||
case $mode in
|
||||
*' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
|
||||
echo "$0: invalid mode: $mode" >&2
|
||||
exit 1;;
|
||||
esac
|
||||
shift;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift;;
|
||||
|
||||
-s) stripcmd=$stripprog;;
|
||||
|
||||
-t)
|
||||
is_target_a_directory=always
|
||||
dst_arg=$2
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $dst_arg in
|
||||
-* | [=\(\)!]) dst_arg=./$dst_arg;;
|
||||
esac
|
||||
shift;;
|
||||
|
||||
-T) is_target_a_directory=never;;
|
||||
|
||||
--version) echo "$0 $scriptversion"; exit $?;;
|
||||
|
||||
--) shift
|
||||
break;;
|
||||
|
||||
-*) echo "$0: invalid option: $1" >&2
|
||||
exit 1;;
|
||||
|
||||
*) break;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
# We allow the use of options -d and -T together, by making -d
|
||||
# take the precedence; this is for compatibility with GNU install.
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
if test -n "$dst_arg"; then
|
||||
echo "$0: target directory not allowed when installing a directory." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
|
||||
# When -d is used, all remaining arguments are directories to create.
|
||||
# When -t is used, the destination is already specified.
|
||||
# Otherwise, the last argument is the destination. Remove it from $@.
|
||||
for arg
|
||||
do
|
||||
if test -n "$dst_arg"; then
|
||||
# $@ is not empty: it contains at least $arg.
|
||||
set fnord "$@" "$dst_arg"
|
||||
shift # fnord
|
||||
fi
|
||||
shift # arg
|
||||
dst_arg=$arg
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $dst_arg in
|
||||
-* | [=\(\)!]) dst_arg=./$dst_arg;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
|
||||
if test $# -eq 0; then
|
||||
if test -z "$dir_arg"; then
|
||||
echo "$0: no input file specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
# It's OK to call 'install-sh -d' without argument.
|
||||
# This can happen when creating conditional directories.
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if test -z "$dir_arg"; then
|
||||
if test $# -gt 1 || test "$is_target_a_directory" = always; then
|
||||
if test ! -d "$dst_arg"; then
|
||||
echo "$0: $dst_arg: Is not a directory." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -z "$dir_arg"; then
|
||||
do_exit='(exit $ret); exit $ret'
|
||||
trap "ret=129; $do_exit" 1
|
||||
trap "ret=130; $do_exit" 2
|
||||
trap "ret=141; $do_exit" 13
|
||||
trap "ret=143; $do_exit" 15
|
||||
|
||||
# Set umask so as not to create temps with too-generous modes.
|
||||
# However, 'strip' requires both read and write access to temps.
|
||||
case $mode in
|
||||
# Optimize common cases.
|
||||
*644) cp_umask=133;;
|
||||
*755) cp_umask=22;;
|
||||
|
||||
*[0-7])
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw='% 200'
|
||||
fi
|
||||
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
|
||||
*)
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw=,u+rw
|
||||
fi
|
||||
cp_umask=$mode$u_plus_rw;;
|
||||
esac
|
||||
fi
|
||||
|
||||
for src
|
||||
do
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $src in
|
||||
-* | [=\(\)!]) src=./$src;;
|
||||
esac
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
dst=$src
|
||||
dstdir=$dst
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
else
|
||||
|
||||
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
if test ! -f "$src" && test ! -d "$src"; then
|
||||
echo "$0: $src does not exist." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test -z "$dst_arg"; then
|
||||
echo "$0: no destination specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
dst=$dst_arg
|
||||
|
||||
# If destination is a directory, append the input filename; won't work
|
||||
# if double slashes aren't ignored.
|
||||
if test -d "$dst"; then
|
||||
if test "$is_target_a_directory" = never; then
|
||||
echo "$0: $dst_arg: Is a directory" >&2
|
||||
exit 1
|
||||
fi
|
||||
dstdir=$dst
|
||||
dst=$dstdir/`basename "$src"`
|
||||
dstdir_status=0
|
||||
else
|
||||
dstdir=`dirname "$dst"`
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
fi
|
||||
fi
|
||||
|
||||
obsolete_mkdir_used=false
|
||||
|
||||
if test $dstdir_status != 0; then
|
||||
case $posix_mkdir in
|
||||
'')
|
||||
# Create intermediate dirs using mode 755 as modified by the umask.
|
||||
# This is like FreeBSD 'install' as of 1997-10-28.
|
||||
umask=`umask`
|
||||
case $stripcmd.$umask in
|
||||
# Optimize common cases.
|
||||
*[2367][2367]) mkdir_umask=$umask;;
|
||||
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
|
||||
|
||||
*[0-7])
|
||||
mkdir_umask=`expr $umask + 22 \
|
||||
- $umask % 100 % 40 + $umask % 20 \
|
||||
- $umask % 10 % 4 + $umask % 2
|
||||
`;;
|
||||
*) mkdir_umask=$umask,go-w;;
|
||||
esac
|
||||
|
||||
# With -d, create the new directory with the user-specified mode.
|
||||
# Otherwise, rely on $mkdir_umask.
|
||||
if test -n "$dir_arg"; then
|
||||
mkdir_mode=-m$mode
|
||||
else
|
||||
mkdir_mode=
|
||||
fi
|
||||
|
||||
posix_mkdir=false
|
||||
case $umask in
|
||||
*[123567][0-7][0-7])
|
||||
# POSIX mkdir -p sets u+wx bits regardless of umask, which
|
||||
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
|
||||
;;
|
||||
*)
|
||||
# $RANDOM is not portable (e.g. dash); use it when possible to
|
||||
# lower collision chance
|
||||
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
|
||||
trap 'ret=$?; rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null; exit $ret' 0
|
||||
|
||||
# As "mkdir -p" follows symlinks and we work in /tmp possibly; so
|
||||
# create the $tmpdir first (and fail if unsuccessful) to make sure
|
||||
# that nobody tries to guess the $tmpdir name.
|
||||
if (umask $mkdir_umask &&
|
||||
$mkdirprog $mkdir_mode "$tmpdir" &&
|
||||
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1
|
||||
then
|
||||
if test -z "$dir_arg" || {
|
||||
# Check for POSIX incompatibilities with -m.
|
||||
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
|
||||
# other-writable bit of parent directory when it shouldn't.
|
||||
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
|
||||
test_tmpdir="$tmpdir/a"
|
||||
ls_ld_tmpdir=`ls -ld "$test_tmpdir"`
|
||||
case $ls_ld_tmpdir in
|
||||
d????-?r-*) different_mode=700;;
|
||||
d????-?--*) different_mode=755;;
|
||||
*) false;;
|
||||
esac &&
|
||||
$mkdirprog -m$different_mode -p -- "$test_tmpdir" && {
|
||||
ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"`
|
||||
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
|
||||
}
|
||||
}
|
||||
then posix_mkdir=:
|
||||
fi
|
||||
rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir"
|
||||
else
|
||||
# Remove any dirs left behind by ancient mkdir implementations.
|
||||
rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null
|
||||
fi
|
||||
trap '' 0;;
|
||||
esac;;
|
||||
esac
|
||||
|
||||
if
|
||||
$posix_mkdir && (
|
||||
umask $mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
|
||||
)
|
||||
then :
|
||||
else
|
||||
|
||||
# The umask is ridiculous, or mkdir does not conform to POSIX,
|
||||
# or it failed possibly due to a race condition. Create the
|
||||
# directory the slow way, step by step, checking for races as we go.
|
||||
|
||||
case $dstdir in
|
||||
/*) prefix='/';;
|
||||
[-=\(\)!]*) prefix='./';;
|
||||
*) prefix='';;
|
||||
esac
|
||||
|
||||
oIFS=$IFS
|
||||
IFS=/
|
||||
set -f
|
||||
set fnord $dstdir
|
||||
shift
|
||||
set +f
|
||||
IFS=$oIFS
|
||||
|
||||
prefixes=
|
||||
|
||||
for d
|
||||
do
|
||||
test X"$d" = X && continue
|
||||
|
||||
prefix=$prefix$d
|
||||
if test -d "$prefix"; then
|
||||
prefixes=
|
||||
else
|
||||
if $posix_mkdir; then
|
||||
(umask=$mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
|
||||
# Don't fail if two instances are running concurrently.
|
||||
test -d "$prefix" || exit 1
|
||||
else
|
||||
case $prefix in
|
||||
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
|
||||
*) qprefix=$prefix;;
|
||||
esac
|
||||
prefixes="$prefixes '$qprefix'"
|
||||
fi
|
||||
fi
|
||||
prefix=$prefix/
|
||||
done
|
||||
|
||||
if test -n "$prefixes"; then
|
||||
# Don't fail if two instances are running concurrently.
|
||||
(umask $mkdir_umask &&
|
||||
eval "\$doit_exec \$mkdirprog $prefixes") ||
|
||||
test -d "$dstdir" || exit 1
|
||||
obsolete_mkdir_used=true
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
|
||||
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
|
||||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
|
||||
else
|
||||
|
||||
# Make a couple of temp file names in the proper directory.
|
||||
dsttmp=$dstdir/_inst.$$_
|
||||
rmtmp=$dstdir/_rm.$$_
|
||||
|
||||
# Trap to clean up those temp files at exit.
|
||||
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
|
||||
|
||||
# Copy the file name to the temp name.
|
||||
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits.
|
||||
#
|
||||
# If any of these fail, we abort the whole thing. If we want to
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $cpprog $src $dsttmp" command.
|
||||
#
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
|
||||
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
|
||||
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
|
||||
|
||||
# If -C, don't bother to copy if it wouldn't change the file.
|
||||
if $copy_on_change &&
|
||||
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
|
||||
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
|
||||
set -f &&
|
||||
set X $old && old=:$2:$4:$5:$6 &&
|
||||
set X $new && new=:$2:$4:$5:$6 &&
|
||||
set +f &&
|
||||
test "$old" = "$new" &&
|
||||
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
|
||||
then
|
||||
rm -f "$dsttmp"
|
||||
else
|
||||
# Rename the file to the real destination.
|
||||
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
|
||||
|
||||
# The rename failed, perhaps because mv can't rename something else
|
||||
# to itself, or perhaps because mv is so ancient that it does not
|
||||
# support -f.
|
||||
{
|
||||
# Now remove or move aside any old file at destination location.
|
||||
# We try this two ways since rm can't unlink itself on some
|
||||
# systems and the destination file might be busy for other
|
||||
# reasons. In this case, the final cleanup might fail but the new
|
||||
# file should still install successfully.
|
||||
{
|
||||
test ! -f "$dst" ||
|
||||
$doit $rmcmd -f "$dst" 2>/dev/null ||
|
||||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
|
||||
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
|
||||
} ||
|
||||
{ echo "$0: cannot unlink or rename $dst" >&2
|
||||
(exit 1); exit 1
|
||||
}
|
||||
} &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
$doit $mvcmd "$dsttmp" "$dst"
|
||||
}
|
||||
fi || exit 1
|
||||
|
||||
trap '' 0
|
||||
fi
|
||||
done
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
|
@ -0,0 +1,21 @@
|
|||
## Makefile for the lib subdirectory of Enchant
|
||||
|
||||
# Initialize variables that will be added to by Makefile.gnulib
|
||||
EXTRA_DIST =
|
||||
BUILT_SOURCES =
|
||||
MOSTLYCLEANFILES =
|
||||
MOSTLYCLEANDIRS =
|
||||
CLEANFILES =
|
||||
noinst_LTLIBRARIES =
|
||||
|
||||
# Set compilation flags needed for relocatable.c used by relocatable-lib-lgpl
|
||||
AM_CPPFLAGS = -DIN_LIBRARY -DENABLE_COSTLY_RELOCATABLE
|
||||
|
||||
if SHLIBS_IN_BINDIR
|
||||
AM_CPPFLAGS += -DINSTALLDIR=\"$(bindir)\"
|
||||
else
|
||||
AM_CPPFLAGS += -DINSTALLDIR=\"$(libdir)\"
|
||||
endif
|
||||
|
||||
# Include auto-generated makefile
|
||||
include Makefile.gnulib
|
|
@ -0,0 +1,807 @@
|
|||
## DO NOT EDIT! GENERATED AUTOMATICALLY!
|
||||
## Process this file with automake to produce Makefile.in.
|
||||
# Copyright (C) 2002-2018 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This file is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this file. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
# As a special exception to the GNU General Public License,
|
||||
# this file may be distributed as part of a program that
|
||||
# contains a configuration script generated by Autoconf, under
|
||||
# the same distribution terms as the rest of that program.
|
||||
#
|
||||
# Generated by gnulib-tool.
|
||||
# Reproduce by:
|
||||
# gnulib-tool --import --local-dir=gl --local-dir=gl-mod/bootstrap \
|
||||
# --lib=libgnu \
|
||||
# --source-base=lib \
|
||||
# --m4-base=m4 \
|
||||
# --doc-base=doc \
|
||||
# --tests-base=tests \
|
||||
# --aux-dir=build-aux \
|
||||
# --lgpl \
|
||||
# --makefile-name=Makefile.gnulib \
|
||||
# --no-conditional-dependencies \
|
||||
# --libtool \
|
||||
# --macro-prefix=gl \
|
||||
# bootstrap \
|
||||
# c99 \
|
||||
# configmake \
|
||||
# flock \
|
||||
# getopt-posix \
|
||||
# gnu-make \
|
||||
# manywarnings \
|
||||
# relocatable-lib-lgpl \
|
||||
# snippet/unused-parameter \
|
||||
# ssize_t \
|
||||
# strchrnul \
|
||||
# strdup-posix
|
||||
|
||||
|
||||
MOSTLYCLEANFILES += core *.stackdump
|
||||
# No GNU Make output.
|
||||
|
||||
noinst_LTLIBRARIES += libgnu.la
|
||||
|
||||
libgnu_la_SOURCES =
|
||||
libgnu_la_LIBADD = $(gl_LTLIBOBJS)
|
||||
libgnu_la_DEPENDENCIES = $(gl_LTLIBOBJS)
|
||||
EXTRA_libgnu_la_SOURCES =
|
||||
libgnu_la_LDFLAGS = $(AM_LDFLAGS)
|
||||
libgnu_la_LDFLAGS += -no-undefined
|
||||
libgnu_la_LDFLAGS += $(LTLIBINTL)
|
||||
|
||||
## begin gnulib module absolute-header
|
||||
|
||||
# Use this preprocessor expression to decide whether #include_next works.
|
||||
# Do not rely on a 'configure'-time test for this, since the expression
|
||||
# might appear in an installed header, which is used by some other compiler.
|
||||
HAVE_INCLUDE_NEXT = (__GNUC__ || 60000000 <= __DECC_VER)
|
||||
|
||||
## end gnulib module absolute-header
|
||||
|
||||
## begin gnulib module bootstrap
|
||||
|
||||
|
||||
EXTRA_DIST += $(top_srcdir)/build-aux/bootstrap.in
|
||||
|
||||
## end gnulib module bootstrap
|
||||
|
||||
## begin gnulib module configmake
|
||||
|
||||
# Listed in the same order as the GNU makefile conventions, and
|
||||
# provided by autoconf 2.59c+ or 2.70.
|
||||
# The Automake-defined pkg* macros are appended, in the order
|
||||
# listed in the Automake 1.10a+ documentation.
|
||||
configmake.h: Makefile
|
||||
$(AM_V_GEN)rm -f $@-t && \
|
||||
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
|
||||
echo '#define PREFIX "$(prefix)"'; \
|
||||
echo '#define EXEC_PREFIX "$(exec_prefix)"'; \
|
||||
echo '#define BINDIR "$(bindir)"'; \
|
||||
echo '#define SBINDIR "$(sbindir)"'; \
|
||||
echo '#define LIBEXECDIR "$(libexecdir)"'; \
|
||||
echo '#define DATAROOTDIR "$(datarootdir)"'; \
|
||||
echo '#define DATADIR "$(datadir)"'; \
|
||||
echo '#define SYSCONFDIR "$(sysconfdir)"'; \
|
||||
echo '#define SHAREDSTATEDIR "$(sharedstatedir)"'; \
|
||||
echo '#define LOCALSTATEDIR "$(localstatedir)"'; \
|
||||
echo '#define RUNSTATEDIR "$(runstatedir)"'; \
|
||||
echo '#define INCLUDEDIR "$(includedir)"'; \
|
||||
echo '#define OLDINCLUDEDIR "$(oldincludedir)"'; \
|
||||
echo '#define DOCDIR "$(docdir)"'; \
|
||||
echo '#define INFODIR "$(infodir)"'; \
|
||||
echo '#define HTMLDIR "$(htmldir)"'; \
|
||||
echo '#define DVIDIR "$(dvidir)"'; \
|
||||
echo '#define PDFDIR "$(pdfdir)"'; \
|
||||
echo '#define PSDIR "$(psdir)"'; \
|
||||
echo '#define LIBDIR "$(libdir)"'; \
|
||||
echo '#define LISPDIR "$(lispdir)"'; \
|
||||
echo '#define LOCALEDIR "$(localedir)"'; \
|
||||
echo '#define MANDIR "$(mandir)"'; \
|
||||
echo '#define MANEXT "$(manext)"'; \
|
||||
echo '#define PKGDATADIR "$(pkgdatadir)"'; \
|
||||
echo '#define PKGINCLUDEDIR "$(pkgincludedir)"'; \
|
||||
echo '#define PKGLIBDIR "$(pkglibdir)"'; \
|
||||
echo '#define PKGLIBEXECDIR "$(pkglibexecdir)"'; \
|
||||
} | sed '/""/d' > $@-t && \
|
||||
mv -f $@-t $@
|
||||
|
||||
BUILT_SOURCES += configmake.h
|
||||
CLEANFILES += configmake.h configmake.h-t
|
||||
|
||||
## end gnulib module configmake
|
||||
|
||||
## begin gnulib module extract-trace
|
||||
|
||||
|
||||
EXTRA_DIST += $(top_srcdir)/build-aux/extract-trace
|
||||
|
||||
## end gnulib module extract-trace
|
||||
|
||||
## begin gnulib module flock
|
||||
|
||||
|
||||
EXTRA_DIST += flock.c
|
||||
|
||||
EXTRA_libgnu_la_SOURCES += flock.c
|
||||
|
||||
## end gnulib module flock
|
||||
|
||||
## begin gnulib module funclib.sh
|
||||
|
||||
|
||||
EXTRA_DIST += $(top_srcdir)/build-aux/funclib.sh
|
||||
|
||||
## end gnulib module funclib.sh
|
||||
|
||||
## begin gnulib module getopt-posix
|
||||
|
||||
BUILT_SOURCES += $(GETOPT_H) $(GETOPT_CDEFS_H)
|
||||
|
||||
# We need the following in order to create <getopt.h> when the system
|
||||
# doesn't have one that works with the given compiler.
|
||||
getopt.h: getopt.in.h $(top_builddir)/config.status $(ARG_NONNULL_H)
|
||||
$(AM_V_GEN)rm -f $@-t $@ && \
|
||||
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
|
||||
sed -e 's|@''GUARD_PREFIX''@|GL|g' \
|
||||
-e 's|@''HAVE_GETOPT_H''@|$(HAVE_GETOPT_H)|g' \
|
||||
-e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
|
||||
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
|
||||
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
|
||||
-e 's|@''NEXT_GETOPT_H''@|$(NEXT_GETOPT_H)|g' \
|
||||
-e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
|
||||
< $(srcdir)/getopt.in.h; \
|
||||
} > $@-t && \
|
||||
mv -f $@-t $@
|
||||
|
||||
getopt-cdefs.h: getopt-cdefs.in.h $(top_builddir)/config.status
|
||||
$(AM_V_GEN)rm -f $@-t $@ && \
|
||||
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
|
||||
sed -e 's|@''HAVE_SYS_CDEFS_H''@|$(HAVE_SYS_CDEFS_H)|g' \
|
||||
< $(srcdir)/getopt-cdefs.in.h; \
|
||||
} > $@-t && \
|
||||
mv -f $@-t $@
|
||||
|
||||
MOSTLYCLEANFILES += getopt.h getopt.h-t getopt-cdefs.h getopt-cdefs.h-t
|
||||
|
||||
EXTRA_DIST += getopt-cdefs.in.h getopt-core.h getopt-ext.h getopt-pfx-core.h getopt-pfx-ext.h getopt.c getopt.in.h getopt1.c getopt_int.h
|
||||
|
||||
EXTRA_libgnu_la_SOURCES += getopt.c getopt1.c
|
||||
|
||||
## end gnulib module getopt-posix
|
||||
|
||||
## begin gnulib module gettext-h
|
||||
|
||||
libgnu_la_SOURCES += gettext.h
|
||||
|
||||
## end gnulib module gettext-h
|
||||
|
||||
## begin gnulib module gnu-make
|
||||
|
||||
##Sample usage of gnu-make module:
|
||||
#if GNU_MAKE
|
||||
# [nicer features that work only with GNU Make]
|
||||
#else
|
||||
# [fallback features that work in any 'make' implementation; see
|
||||
# http://www.opengroup.org/susv3/utilities/make.html
|
||||
# for the 2004 POSIX specification]
|
||||
#endif
|
||||
|
||||
## end gnulib module gnu-make
|
||||
|
||||
## begin gnulib module inline-source
|
||||
|
||||
|
||||
EXTRA_DIST += $(top_srcdir)/build-aux/inline-source
|
||||
|
||||
## end gnulib module inline-source
|
||||
|
||||
## begin gnulib module malloc-posix
|
||||
|
||||
|
||||
EXTRA_DIST += malloc.c
|
||||
|
||||
EXTRA_libgnu_la_SOURCES += malloc.c
|
||||
|
||||
## end gnulib module malloc-posix
|
||||
|
||||
## begin gnulib module msvc-inval
|
||||
|
||||
|
||||
EXTRA_DIST += msvc-inval.c msvc-inval.h
|
||||
|
||||
EXTRA_libgnu_la_SOURCES += msvc-inval.c
|
||||
|
||||
## end gnulib module msvc-inval
|
||||
|
||||
## begin gnulib module msvc-nothrow
|
||||
|
||||
|
||||
EXTRA_DIST += msvc-nothrow.c msvc-nothrow.h
|
||||
|
||||
EXTRA_libgnu_la_SOURCES += msvc-nothrow.c
|
||||
|
||||
## end gnulib module msvc-nothrow
|
||||
|
||||
## begin gnulib module options-parser
|
||||
|
||||
|
||||
EXTRA_DIST += $(top_srcdir)/build-aux/options-parser
|
||||
|
||||
## end gnulib module options-parser
|
||||
|
||||
## begin gnulib module rawmemchr
|
||||
|
||||
|
||||
EXTRA_DIST += rawmemchr.c rawmemchr.valgrind
|
||||
|
||||
EXTRA_libgnu_la_SOURCES += rawmemchr.c
|
||||
|
||||
## end gnulib module rawmemchr
|
||||
|
||||
## begin gnulib module relocatable-lib-lgpl
|
||||
|
||||
DEFS += -DNO_XMALLOC
|
||||
|
||||
EXTRA_DIST += relocatable.c relocatable.h relocatable.valgrind
|
||||
|
||||
EXTRA_libgnu_la_SOURCES += relocatable.c
|
||||
|
||||
## end gnulib module relocatable-lib-lgpl
|
||||
|
||||
## begin gnulib module snippet/_Noreturn
|
||||
|
||||
# Because this Makefile snippet defines a variable used by other
|
||||
# gnulib Makefile snippets, it must be present in all makefiles that
|
||||
# need it. This is ensured by the applicability 'all' defined above.
|
||||
|
||||
_NORETURN_H=$(srcdir)/_Noreturn.h
|
||||
|
||||
EXTRA_DIST += _Noreturn.h
|
||||
|
||||
## end gnulib module snippet/_Noreturn
|
||||
|
||||
## begin gnulib module snippet/arg-nonnull
|
||||
|
||||
# Because this Makefile snippet defines a variable used by other
|
||||
# gnulib Makefile snippets, it must be present in all makefiles that
|
||||
# need it. This is ensured by the applicability 'all' defined above.
|
||||
|
||||
ARG_NONNULL_H=$(srcdir)/arg-nonnull.h
|
||||
|
||||
EXTRA_DIST += arg-nonnull.h
|
||||
|
||||
## end gnulib module snippet/arg-nonnull
|
||||
|
||||
## begin gnulib module snippet/c++defs
|
||||
|
||||
# Because this Makefile snippet defines a variable used by other
|
||||
# gnulib Makefile snippets, it must be present in all makefiles that
|
||||
# need it. This is ensured by the applicability 'all' defined above.
|
||||
|
||||
CXXDEFS_H=$(srcdir)/c++defs.h
|
||||
|
||||
EXTRA_DIST += c++defs.h
|
||||
|
||||
## end gnulib module snippet/c++defs
|
||||
|
||||
## begin gnulib module snippet/unused-parameter
|
||||
|
||||
# Because this Makefile snippet defines a variable used by other
|
||||
# gnulib Makefile snippets, it must be present in all makefiles that
|
||||
# need it. This is ensured by the applicability 'all' defined above.
|
||||
|
||||
UNUSED_PARAMETER_H=$(srcdir)/unused-parameter.h
|
||||
|
||||
EXTRA_DIST += unused-parameter.h
|
||||
|
||||
## end gnulib module snippet/unused-parameter
|
||||
|
||||
## begin gnulib module snippet/warn-on-use
|
||||
|
||||
# Because this Makefile snippet defines a variable used by other
|
||||
# gnulib Makefile snippets, it must be present in all makefiles that
|
||||
# need it. This is ensured by the applicability 'all' defined above.
|
||||
|
||||
WARN_ON_USE_H=$(srcdir)/warn-on-use.h
|
||||
|
||||
EXTRA_DIST += warn-on-use.h
|
||||
|
||||
## end gnulib module snippet/warn-on-use
|
||||
|
||||
## begin gnulib module stddef
|
||||
|
||||
BUILT_SOURCES += $(STDDEF_H)
|
||||
|
||||
# We need the following in order to create <stddef.h> when the system
|
||||
# doesn't have one that works with the given compiler.
|
||||
if GL_GENERATE_STDDEF_H
|
||||
stddef.h: stddef.in.h $(top_builddir)/config.status
|
||||
$(AM_V_GEN)rm -f $@-t $@ && \
|
||||
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
|
||||
sed -e 's|@''GUARD_PREFIX''@|GL|g' \
|
||||
-e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
|
||||
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
|
||||
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
|
||||
-e 's|@''NEXT_STDDEF_H''@|$(NEXT_STDDEF_H)|g' \
|
||||
-e 's|@''HAVE_MAX_ALIGN_T''@|$(HAVE_MAX_ALIGN_T)|g' \
|
||||
-e 's|@''HAVE_WCHAR_T''@|$(HAVE_WCHAR_T)|g' \
|
||||
-e 's|@''REPLACE_NULL''@|$(REPLACE_NULL)|g' \
|
||||
< $(srcdir)/stddef.in.h; \
|
||||
} > $@-t && \
|
||||
mv $@-t $@
|
||||
else
|
||||
stddef.h: $(top_builddir)/config.status
|
||||
rm -f $@
|
||||
endif
|
||||
MOSTLYCLEANFILES += stddef.h stddef.h-t
|
||||
|
||||
EXTRA_DIST += stddef.in.h
|
||||
|
||||
## end gnulib module stddef
|
||||
|
||||
## begin gnulib module stdlib
|
||||
|
||||
BUILT_SOURCES += stdlib.h
|
||||
|
||||
# We need the following in order to create <stdlib.h> when the system
|
||||
# doesn't have one that works with the given compiler.
|
||||
stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
|
||||
$(_NORETURN_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
|
||||
$(AM_V_GEN)rm -f $@-t $@ && \
|
||||
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
|
||||
sed -e 's|@''GUARD_PREFIX''@|GL|g' \
|
||||
-e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
|
||||
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
|
||||
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
|
||||
-e 's|@''NEXT_STDLIB_H''@|$(NEXT_STDLIB_H)|g' \
|
||||
-e 's/@''GNULIB__EXIT''@/$(GNULIB__EXIT)/g' \
|
||||
-e 's/@''GNULIB_ATOLL''@/$(GNULIB_ATOLL)/g' \
|
||||
-e 's/@''GNULIB_CALLOC_POSIX''@/$(GNULIB_CALLOC_POSIX)/g' \
|
||||
-e 's/@''GNULIB_CANONICALIZE_FILE_NAME''@/$(GNULIB_CANONICALIZE_FILE_NAME)/g' \
|
||||
-e 's/@''GNULIB_GETLOADAVG''@/$(GNULIB_GETLOADAVG)/g' \
|
||||
-e 's/@''GNULIB_GETSUBOPT''@/$(GNULIB_GETSUBOPT)/g' \
|
||||
-e 's/@''GNULIB_GRANTPT''@/$(GNULIB_GRANTPT)/g' \
|
||||
-e 's/@''GNULIB_MALLOC_POSIX''@/$(GNULIB_MALLOC_POSIX)/g' \
|
||||
-e 's/@''GNULIB_MBTOWC''@/$(GNULIB_MBTOWC)/g' \
|
||||
-e 's/@''GNULIB_MKDTEMP''@/$(GNULIB_MKDTEMP)/g' \
|
||||
-e 's/@''GNULIB_MKOSTEMP''@/$(GNULIB_MKOSTEMP)/g' \
|
||||
-e 's/@''GNULIB_MKOSTEMPS''@/$(GNULIB_MKOSTEMPS)/g' \
|
||||
-e 's/@''GNULIB_MKSTEMP''@/$(GNULIB_MKSTEMP)/g' \
|
||||
-e 's/@''GNULIB_MKSTEMPS''@/$(GNULIB_MKSTEMPS)/g' \
|
||||
-e 's/@''GNULIB_POSIX_OPENPT''@/$(GNULIB_POSIX_OPENPT)/g' \
|
||||
-e 's/@''GNULIB_PTSNAME''@/$(GNULIB_PTSNAME)/g' \
|
||||
-e 's/@''GNULIB_PTSNAME_R''@/$(GNULIB_PTSNAME_R)/g' \
|
||||
-e 's/@''GNULIB_PUTENV''@/$(GNULIB_PUTENV)/g' \
|
||||
-e 's/@''GNULIB_QSORT_R''@/$(GNULIB_QSORT_R)/g' \
|
||||
-e 's/@''GNULIB_RANDOM''@/$(GNULIB_RANDOM)/g' \
|
||||
-e 's/@''GNULIB_RANDOM_R''@/$(GNULIB_RANDOM_R)/g' \
|
||||
-e 's/@''GNULIB_REALLOC_POSIX''@/$(GNULIB_REALLOC_POSIX)/g' \
|
||||
-e 's/@''GNULIB_REALLOCARRAY''@/$(GNULIB_REALLOCARRAY)/g' \
|
||||
-e 's/@''GNULIB_REALPATH''@/$(GNULIB_REALPATH)/g' \
|
||||
-e 's/@''GNULIB_RPMATCH''@/$(GNULIB_RPMATCH)/g' \
|
||||
-e 's/@''GNULIB_SECURE_GETENV''@/$(GNULIB_SECURE_GETENV)/g' \
|
||||
-e 's/@''GNULIB_SETENV''@/$(GNULIB_SETENV)/g' \
|
||||
-e 's/@''GNULIB_STRTOD''@/$(GNULIB_STRTOD)/g' \
|
||||
-e 's/@''GNULIB_STRTOLL''@/$(GNULIB_STRTOLL)/g' \
|
||||
-e 's/@''GNULIB_STRTOULL''@/$(GNULIB_STRTOULL)/g' \
|
||||
-e 's/@''GNULIB_SYSTEM_POSIX''@/$(GNULIB_SYSTEM_POSIX)/g' \
|
||||
-e 's/@''GNULIB_UNLOCKPT''@/$(GNULIB_UNLOCKPT)/g' \
|
||||
-e 's/@''GNULIB_UNSETENV''@/$(GNULIB_UNSETENV)/g' \
|
||||
-e 's/@''GNULIB_WCTOMB''@/$(GNULIB_WCTOMB)/g' \
|
||||
< $(srcdir)/stdlib.in.h | \
|
||||
sed -e 's|@''HAVE__EXIT''@|$(HAVE__EXIT)|g' \
|
||||
-e 's|@''HAVE_ATOLL''@|$(HAVE_ATOLL)|g' \
|
||||
-e 's|@''HAVE_CANONICALIZE_FILE_NAME''@|$(HAVE_CANONICALIZE_FILE_NAME)|g' \
|
||||
-e 's|@''HAVE_DECL_GETLOADAVG''@|$(HAVE_DECL_GETLOADAVG)|g' \
|
||||
-e 's|@''HAVE_GETSUBOPT''@|$(HAVE_GETSUBOPT)|g' \
|
||||
-e 's|@''HAVE_GRANTPT''@|$(HAVE_GRANTPT)|g' \
|
||||
-e 's|@''HAVE_DECL_INITSTATE''@|$(HAVE_DECL_INITSTATE)|g' \
|
||||
-e 's|@''HAVE_MKDTEMP''@|$(HAVE_MKDTEMP)|g' \
|
||||
-e 's|@''HAVE_MKOSTEMP''@|$(HAVE_MKOSTEMP)|g' \
|
||||
-e 's|@''HAVE_MKOSTEMPS''@|$(HAVE_MKOSTEMPS)|g' \
|
||||
-e 's|@''HAVE_MKSTEMP''@|$(HAVE_MKSTEMP)|g' \
|
||||
-e 's|@''HAVE_MKSTEMPS''@|$(HAVE_MKSTEMPS)|g' \
|
||||
-e 's|@''HAVE_POSIX_OPENPT''@|$(HAVE_POSIX_OPENPT)|g' \
|
||||
-e 's|@''HAVE_PTSNAME''@|$(HAVE_PTSNAME)|g' \
|
||||
-e 's|@''HAVE_PTSNAME_R''@|$(HAVE_PTSNAME_R)|g' \
|
||||
-e 's|@''HAVE_QSORT_R''@|$(HAVE_QSORT_R)|g' \
|
||||
-e 's|@''HAVE_RANDOM''@|$(HAVE_RANDOM)|g' \
|
||||
-e 's|@''HAVE_RANDOM_H''@|$(HAVE_RANDOM_H)|g' \
|
||||
-e 's|@''HAVE_RANDOM_R''@|$(HAVE_RANDOM_R)|g' \
|
||||
-e 's|@''HAVE_REALLOCARRAY''@|$(HAVE_REALLOCARRAY)|g' \
|
||||
-e 's|@''HAVE_REALPATH''@|$(HAVE_REALPATH)|g' \
|
||||
-e 's|@''HAVE_RPMATCH''@|$(HAVE_RPMATCH)|g' \
|
||||
-e 's|@''HAVE_SECURE_GETENV''@|$(HAVE_SECURE_GETENV)|g' \
|
||||
-e 's|@''HAVE_DECL_SETENV''@|$(HAVE_DECL_SETENV)|g' \
|
||||
-e 's|@''HAVE_DECL_SETSTATE''@|$(HAVE_DECL_SETSTATE)|g' \
|
||||
-e 's|@''HAVE_STRTOD''@|$(HAVE_STRTOD)|g' \
|
||||
-e 's|@''HAVE_STRTOLL''@|$(HAVE_STRTOLL)|g' \
|
||||
-e 's|@''HAVE_STRTOULL''@|$(HAVE_STRTOULL)|g' \
|
||||
-e 's|@''HAVE_STRUCT_RANDOM_DATA''@|$(HAVE_STRUCT_RANDOM_DATA)|g' \
|
||||
-e 's|@''HAVE_SYS_LOADAVG_H''@|$(HAVE_SYS_LOADAVG_H)|g' \
|
||||
-e 's|@''HAVE_UNLOCKPT''@|$(HAVE_UNLOCKPT)|g' \
|
||||
-e 's|@''HAVE_DECL_UNSETENV''@|$(HAVE_DECL_UNSETENV)|g' \
|
||||
-e 's|@''REPLACE_CALLOC''@|$(REPLACE_CALLOC)|g' \
|
||||
-e 's|@''REPLACE_CANONICALIZE_FILE_NAME''@|$(REPLACE_CANONICALIZE_FILE_NAME)|g' \
|
||||
-e 's|@''REPLACE_MALLOC''@|$(REPLACE_MALLOC)|g' \
|
||||
-e 's|@''REPLACE_MBTOWC''@|$(REPLACE_MBTOWC)|g' \
|
||||
-e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \
|
||||
-e 's|@''REPLACE_PTSNAME''@|$(REPLACE_PTSNAME)|g' \
|
||||
-e 's|@''REPLACE_PTSNAME_R''@|$(REPLACE_PTSNAME_R)|g' \
|
||||
-e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \
|
||||
-e 's|@''REPLACE_QSORT_R''@|$(REPLACE_QSORT_R)|g' \
|
||||
-e 's|@''REPLACE_RANDOM_R''@|$(REPLACE_RANDOM_R)|g' \
|
||||
-e 's|@''REPLACE_REALLOC''@|$(REPLACE_REALLOC)|g' \
|
||||
-e 's|@''REPLACE_REALPATH''@|$(REPLACE_REALPATH)|g' \
|
||||
-e 's|@''REPLACE_SETENV''@|$(REPLACE_SETENV)|g' \
|
||||
-e 's|@''REPLACE_STRTOD''@|$(REPLACE_STRTOD)|g' \
|
||||
-e 's|@''REPLACE_UNSETENV''@|$(REPLACE_UNSETENV)|g' \
|
||||
-e 's|@''REPLACE_WCTOMB''@|$(REPLACE_WCTOMB)|g' \
|
||||
-e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
|
||||
-e '/definition of _Noreturn/r $(_NORETURN_H)' \
|
||||
-e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
|
||||
-e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \
|
||||
} > $@-t && \
|
||||
mv $@-t $@
|
||||
MOSTLYCLEANFILES += stdlib.h stdlib.h-t
|
||||
|
||||
EXTRA_DIST += stdlib.in.h
|
||||
|
||||
## end gnulib module stdlib
|
||||
|
||||
## begin gnulib module strchrnul
|
||||
|
||||
|
||||
EXTRA_DIST += strchrnul.c strchrnul.valgrind
|
||||
|
||||
EXTRA_libgnu_la_SOURCES += strchrnul.c
|
||||
|
||||
## end gnulib module strchrnul
|
||||
|
||||
## begin gnulib module strdup-posix
|
||||
|
||||
|
||||
EXTRA_DIST += strdup.c
|
||||
|
||||
EXTRA_libgnu_la_SOURCES += strdup.c
|
||||
|
||||
## end gnulib module strdup-posix
|
||||
|
||||
## begin gnulib module string
|
||||
|
||||
BUILT_SOURCES += string.h
|
||||
|
||||
# We need the following in order to create <string.h> when the system
|
||||
# doesn't have one that works with the given compiler.
|
||||
string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
|
||||
$(AM_V_GEN)rm -f $@-t $@ && \
|
||||
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
|
||||
sed -e 's|@''GUARD_PREFIX''@|GL|g' \
|
||||
-e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
|
||||
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
|
||||
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
|
||||
-e 's|@''NEXT_STRING_H''@|$(NEXT_STRING_H)|g' \
|
||||
-e 's/@''GNULIB_EXPLICIT_BZERO''@/$(GNULIB_EXPLICIT_BZERO)/g' \
|
||||
-e 's/@''GNULIB_FFSL''@/$(GNULIB_FFSL)/g' \
|
||||
-e 's/@''GNULIB_FFSLL''@/$(GNULIB_FFSLL)/g' \
|
||||
-e 's/@''GNULIB_MBSLEN''@/$(GNULIB_MBSLEN)/g' \
|
||||
-e 's/@''GNULIB_MBSNLEN''@/$(GNULIB_MBSNLEN)/g' \
|
||||
-e 's/@''GNULIB_MBSCHR''@/$(GNULIB_MBSCHR)/g' \
|
||||
-e 's/@''GNULIB_MBSRCHR''@/$(GNULIB_MBSRCHR)/g' \
|
||||
-e 's/@''GNULIB_MBSSTR''@/$(GNULIB_MBSSTR)/g' \
|
||||
-e 's/@''GNULIB_MBSCASECMP''@/$(GNULIB_MBSCASECMP)/g' \
|
||||
-e 's/@''GNULIB_MBSNCASECMP''@/$(GNULIB_MBSNCASECMP)/g' \
|
||||
-e 's/@''GNULIB_MBSPCASECMP''@/$(GNULIB_MBSPCASECMP)/g' \
|
||||
-e 's/@''GNULIB_MBSCASESTR''@/$(GNULIB_MBSCASESTR)/g' \
|
||||
-e 's/@''GNULIB_MBSCSPN''@/$(GNULIB_MBSCSPN)/g' \
|
||||
-e 's/@''GNULIB_MBSPBRK''@/$(GNULIB_MBSPBRK)/g' \
|
||||
-e 's/@''GNULIB_MBSSPN''@/$(GNULIB_MBSSPN)/g' \
|
||||
-e 's/@''GNULIB_MBSSEP''@/$(GNULIB_MBSSEP)/g' \
|
||||
-e 's/@''GNULIB_MBSTOK_R''@/$(GNULIB_MBSTOK_R)/g' \
|
||||
-e 's/@''GNULIB_MEMCHR''@/$(GNULIB_MEMCHR)/g' \
|
||||
-e 's/@''GNULIB_MEMMEM''@/$(GNULIB_MEMMEM)/g' \
|
||||
-e 's/@''GNULIB_MEMPCPY''@/$(GNULIB_MEMPCPY)/g' \
|
||||
-e 's/@''GNULIB_MEMRCHR''@/$(GNULIB_MEMRCHR)/g' \
|
||||
-e 's/@''GNULIB_RAWMEMCHR''@/$(GNULIB_RAWMEMCHR)/g' \
|
||||
-e 's/@''GNULIB_STPCPY''@/$(GNULIB_STPCPY)/g' \
|
||||
-e 's/@''GNULIB_STPNCPY''@/$(GNULIB_STPNCPY)/g' \
|
||||
-e 's/@''GNULIB_STRCHRNUL''@/$(GNULIB_STRCHRNUL)/g' \
|
||||
-e 's/@''GNULIB_STRDUP''@/$(GNULIB_STRDUP)/g' \
|
||||
-e 's/@''GNULIB_STRNCAT''@/$(GNULIB_STRNCAT)/g' \
|
||||
-e 's/@''GNULIB_STRNDUP''@/$(GNULIB_STRNDUP)/g' \
|
||||
-e 's/@''GNULIB_STRNLEN''@/$(GNULIB_STRNLEN)/g' \
|
||||
-e 's/@''GNULIB_STRPBRK''@/$(GNULIB_STRPBRK)/g' \
|
||||
-e 's/@''GNULIB_STRSEP''@/$(GNULIB_STRSEP)/g' \
|
||||
-e 's/@''GNULIB_STRSTR''@/$(GNULIB_STRSTR)/g' \
|
||||
-e 's/@''GNULIB_STRCASESTR''@/$(GNULIB_STRCASESTR)/g' \
|
||||
-e 's/@''GNULIB_STRTOK_R''@/$(GNULIB_STRTOK_R)/g' \
|
||||
-e 's/@''GNULIB_STRERROR''@/$(GNULIB_STRERROR)/g' \
|
||||
-e 's/@''GNULIB_STRERROR_R''@/$(GNULIB_STRERROR_R)/g' \
|
||||
-e 's/@''GNULIB_STRSIGNAL''@/$(GNULIB_STRSIGNAL)/g' \
|
||||
-e 's/@''GNULIB_STRVERSCMP''@/$(GNULIB_STRVERSCMP)/g' \
|
||||
< $(srcdir)/string.in.h | \
|
||||
sed -e 's|@''HAVE_EXPLICIT_BZERO''@|$(HAVE_EXPLICIT_BZERO)|g' \
|
||||
-e 's|@''HAVE_FFSL''@|$(HAVE_FFSL)|g' \
|
||||
-e 's|@''HAVE_FFSLL''@|$(HAVE_FFSLL)|g' \
|
||||
-e 's|@''HAVE_MBSLEN''@|$(HAVE_MBSLEN)|g' \
|
||||
-e 's|@''HAVE_MEMCHR''@|$(HAVE_MEMCHR)|g' \
|
||||
-e 's|@''HAVE_DECL_MEMMEM''@|$(HAVE_DECL_MEMMEM)|g' \
|
||||
-e 's|@''HAVE_MEMPCPY''@|$(HAVE_MEMPCPY)|g' \
|
||||
-e 's|@''HAVE_DECL_MEMRCHR''@|$(HAVE_DECL_MEMRCHR)|g' \
|
||||
-e 's|@''HAVE_RAWMEMCHR''@|$(HAVE_RAWMEMCHR)|g' \
|
||||
-e 's|@''HAVE_STPCPY''@|$(HAVE_STPCPY)|g' \
|
||||
-e 's|@''HAVE_STPNCPY''@|$(HAVE_STPNCPY)|g' \
|
||||
-e 's|@''HAVE_STRCHRNUL''@|$(HAVE_STRCHRNUL)|g' \
|
||||
-e 's|@''HAVE_DECL_STRDUP''@|$(HAVE_DECL_STRDUP)|g' \
|
||||
-e 's|@''HAVE_DECL_STRNDUP''@|$(HAVE_DECL_STRNDUP)|g' \
|
||||
-e 's|@''HAVE_DECL_STRNLEN''@|$(HAVE_DECL_STRNLEN)|g' \
|
||||
-e 's|@''HAVE_STRPBRK''@|$(HAVE_STRPBRK)|g' \
|
||||
-e 's|@''HAVE_STRSEP''@|$(HAVE_STRSEP)|g' \
|
||||
-e 's|@''HAVE_STRCASESTR''@|$(HAVE_STRCASESTR)|g' \
|
||||
-e 's|@''HAVE_DECL_STRTOK_R''@|$(HAVE_DECL_STRTOK_R)|g' \
|
||||
-e 's|@''HAVE_DECL_STRERROR_R''@|$(HAVE_DECL_STRERROR_R)|g' \
|
||||
-e 's|@''HAVE_DECL_STRSIGNAL''@|$(HAVE_DECL_STRSIGNAL)|g' \
|
||||
-e 's|@''HAVE_STRVERSCMP''@|$(HAVE_STRVERSCMP)|g' \
|
||||
-e 's|@''REPLACE_MEMCHR''@|$(REPLACE_MEMCHR)|g' \
|
||||
-e 's|@''REPLACE_MEMMEM''@|$(REPLACE_MEMMEM)|g' \
|
||||
-e 's|@''REPLACE_STPNCPY''@|$(REPLACE_STPNCPY)|g' \
|
||||
-e 's|@''REPLACE_STRCHRNUL''@|$(REPLACE_STRCHRNUL)|g' \
|
||||
-e 's|@''REPLACE_STRDUP''@|$(REPLACE_STRDUP)|g' \
|
||||
-e 's|@''REPLACE_STRNCAT''@|$(REPLACE_STRNCAT)|g' \
|
||||
-e 's|@''REPLACE_STRNDUP''@|$(REPLACE_STRNDUP)|g' \
|
||||
-e 's|@''REPLACE_STRNLEN''@|$(REPLACE_STRNLEN)|g' \
|
||||
-e 's|@''REPLACE_STRSTR''@|$(REPLACE_STRSTR)|g' \
|
||||
-e 's|@''REPLACE_STRCASESTR''@|$(REPLACE_STRCASESTR)|g' \
|
||||
-e 's|@''REPLACE_STRTOK_R''@|$(REPLACE_STRTOK_R)|g' \
|
||||
-e 's|@''REPLACE_STRERROR''@|$(REPLACE_STRERROR)|g' \
|
||||
-e 's|@''REPLACE_STRERROR_R''@|$(REPLACE_STRERROR_R)|g' \
|
||||
-e 's|@''REPLACE_STRSIGNAL''@|$(REPLACE_STRSIGNAL)|g' \
|
||||
-e 's|@''UNDEFINE_STRTOK_R''@|$(UNDEFINE_STRTOK_R)|g' \
|
||||
-e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
|
||||
-e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
|
||||
-e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \
|
||||
< $(srcdir)/string.in.h; \
|
||||
} > $@-t && \
|
||||
mv $@-t $@
|
||||
MOSTLYCLEANFILES += string.h string.h-t
|
||||
|
||||
EXTRA_DIST += string.in.h
|
||||
|
||||
## end gnulib module string
|
||||
|
||||
## begin gnulib module sys_file
|
||||
|
||||
BUILT_SOURCES += sys/file.h
|
||||
|
||||
# We need the following in order to create <sys/file.h> when the system
|
||||
# has one that is incomplete.
|
||||
sys/file.h: sys_file.in.h $(top_builddir)/config.status $(WARN_ON_USE_H)
|
||||
$(AM_V_at)$(MKDIR_P) sys
|
||||
$(AM_V_GEN)rm -f $@-t $@ && \
|
||||
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
|
||||
sed -e 's|@''GUARD_PREFIX''@|GL|g' \
|
||||
-e 's/@''HAVE_SYS_FILE_H''@/$(HAVE_SYS_FILE_H)/g' \
|
||||
-e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
|
||||
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
|
||||
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
|
||||
-e 's|@''NEXT_SYS_FILE_H''@|$(NEXT_SYS_FILE_H)|g' \
|
||||
-e 's/@''HAVE_FLOCK''@/$(HAVE_FLOCK)/g' \
|
||||
-e 's/@''GNULIB_FLOCK''@/$(GNULIB_FLOCK)/g' \
|
||||
-e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
|
||||
< $(srcdir)/sys_file.in.h; \
|
||||
} > $@-t && \
|
||||
mv $@-t $@
|
||||
MOSTLYCLEANFILES += sys/file.h sys/file.h-t
|
||||
MOSTLYCLEANDIRS += sys
|
||||
|
||||
EXTRA_DIST += sys_file.in.h
|
||||
|
||||
## end gnulib module sys_file
|
||||
|
||||
## begin gnulib module sys_types
|
||||
|
||||
BUILT_SOURCES += sys/types.h
|
||||
|
||||
# We need the following in order to create <sys/types.h> when the system
|
||||
# doesn't have one that works with the given compiler.
|
||||
sys/types.h: sys_types.in.h $(top_builddir)/config.status
|
||||
$(AM_V_at)$(MKDIR_P) sys
|
||||
$(AM_V_GEN)rm -f $@-t $@ && \
|
||||
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
|
||||
sed -e 's|@''GUARD_PREFIX''@|GL|g' \
|
||||
-e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
|
||||
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
|
||||
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
|
||||
-e 's|@''NEXT_SYS_TYPES_H''@|$(NEXT_SYS_TYPES_H)|g' \
|
||||
-e 's|@''WINDOWS_64_BIT_OFF_T''@|$(WINDOWS_64_BIT_OFF_T)|g' \
|
||||
-e 's|@''WINDOWS_STAT_INODES''@|$(WINDOWS_STAT_INODES)|g' \
|
||||
< $(srcdir)/sys_types.in.h; \
|
||||
} > $@-t && \
|
||||
mv $@-t $@
|
||||
MOSTLYCLEANFILES += sys/types.h sys/types.h-t
|
||||
|
||||
EXTRA_DIST += sys_types.in.h
|
||||
|
||||
## end gnulib module sys_types
|
||||
|
||||
## begin gnulib module unistd
|
||||
|
||||
BUILT_SOURCES += unistd.h
|
||||
libgnu_la_SOURCES += unistd.c
|
||||
|
||||
# We need the following in order to create an empty placeholder for
|
||||
# <unistd.h> when the system doesn't have one.
|
||||
unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
|
||||
$(AM_V_GEN)rm -f $@-t $@ && \
|
||||
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
|
||||
sed -e 's|@''GUARD_PREFIX''@|GL|g' \
|
||||
-e 's|@''HAVE_UNISTD_H''@|$(HAVE_UNISTD_H)|g' \
|
||||
-e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
|
||||
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
|
||||
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
|
||||
-e 's|@''NEXT_UNISTD_H''@|$(NEXT_UNISTD_H)|g' \
|
||||
-e 's|@''WINDOWS_64_BIT_OFF_T''@|$(WINDOWS_64_BIT_OFF_T)|g' \
|
||||
-e 's/@''GNULIB_CHDIR''@/$(GNULIB_CHDIR)/g' \
|
||||
-e 's/@''GNULIB_CHOWN''@/$(GNULIB_CHOWN)/g' \
|
||||
-e 's/@''GNULIB_CLOSE''@/$(GNULIB_CLOSE)/g' \
|
||||
-e 's/@''GNULIB_DUP''@/$(GNULIB_DUP)/g' \
|
||||
-e 's/@''GNULIB_DUP2''@/$(GNULIB_DUP2)/g' \
|
||||
-e 's/@''GNULIB_DUP3''@/$(GNULIB_DUP3)/g' \
|
||||
-e 's/@''GNULIB_ENVIRON''@/$(GNULIB_ENVIRON)/g' \
|
||||
-e 's/@''GNULIB_EUIDACCESS''@/$(GNULIB_EUIDACCESS)/g' \
|
||||
-e 's/@''GNULIB_FACCESSAT''@/$(GNULIB_FACCESSAT)/g' \
|
||||
-e 's/@''GNULIB_FCHDIR''@/$(GNULIB_FCHDIR)/g' \
|
||||
-e 's/@''GNULIB_FCHOWNAT''@/$(GNULIB_FCHOWNAT)/g' \
|
||||
-e 's/@''GNULIB_FDATASYNC''@/$(GNULIB_FDATASYNC)/g' \
|
||||
-e 's/@''GNULIB_FSYNC''@/$(GNULIB_FSYNC)/g' \
|
||||
-e 's/@''GNULIB_FTRUNCATE''@/$(GNULIB_FTRUNCATE)/g' \
|
||||
-e 's/@''GNULIB_GETCWD''@/$(GNULIB_GETCWD)/g' \
|
||||
-e 's/@''GNULIB_GETDOMAINNAME''@/$(GNULIB_GETDOMAINNAME)/g' \
|
||||
-e 's/@''GNULIB_GETDTABLESIZE''@/$(GNULIB_GETDTABLESIZE)/g' \
|
||||
-e 's/@''GNULIB_GETGROUPS''@/$(GNULIB_GETGROUPS)/g' \
|
||||
-e 's/@''GNULIB_GETHOSTNAME''@/$(GNULIB_GETHOSTNAME)/g' \
|
||||
-e 's/@''GNULIB_GETLOGIN''@/$(GNULIB_GETLOGIN)/g' \
|
||||
-e 's/@''GNULIB_GETLOGIN_R''@/$(GNULIB_GETLOGIN_R)/g' \
|
||||
-e 's/@''GNULIB_GETPAGESIZE''@/$(GNULIB_GETPAGESIZE)/g' \
|
||||
-e 's/@''GNULIB_GETPASS''@/$(GNULIB_GETPASS)/g' \
|
||||
-e 's/@''GNULIB_GETUSERSHELL''@/$(GNULIB_GETUSERSHELL)/g' \
|
||||
-e 's/@''GNULIB_GROUP_MEMBER''@/$(GNULIB_GROUP_MEMBER)/g' \
|
||||
-e 's/@''GNULIB_ISATTY''@/$(GNULIB_ISATTY)/g' \
|
||||
-e 's/@''GNULIB_LCHOWN''@/$(GNULIB_LCHOWN)/g' \
|
||||
-e 's/@''GNULIB_LINK''@/$(GNULIB_LINK)/g' \
|
||||
-e 's/@''GNULIB_LINKAT''@/$(GNULIB_LINKAT)/g' \
|
||||
-e 's/@''GNULIB_LSEEK''@/$(GNULIB_LSEEK)/g' \
|
||||
-e 's/@''GNULIB_PIPE''@/$(GNULIB_PIPE)/g' \
|
||||
-e 's/@''GNULIB_PIPE2''@/$(GNULIB_PIPE2)/g' \
|
||||
-e 's/@''GNULIB_PREAD''@/$(GNULIB_PREAD)/g' \
|
||||
-e 's/@''GNULIB_PWRITE''@/$(GNULIB_PWRITE)/g' \
|
||||
-e 's/@''GNULIB_READ''@/$(GNULIB_READ)/g' \
|
||||
-e 's/@''GNULIB_READLINK''@/$(GNULIB_READLINK)/g' \
|
||||
-e 's/@''GNULIB_READLINKAT''@/$(GNULIB_READLINKAT)/g' \
|
||||
-e 's/@''GNULIB_RMDIR''@/$(GNULIB_RMDIR)/g' \
|
||||
-e 's/@''GNULIB_SETHOSTNAME''@/$(GNULIB_SETHOSTNAME)/g' \
|
||||
-e 's/@''GNULIB_SLEEP''@/$(GNULIB_SLEEP)/g' \
|
||||
-e 's/@''GNULIB_SYMLINK''@/$(GNULIB_SYMLINK)/g' \
|
||||
-e 's/@''GNULIB_SYMLINKAT''@/$(GNULIB_SYMLINKAT)/g' \
|
||||
-e 's/@''GNULIB_TRUNCATE''@/$(GNULIB_TRUNCATE)/g' \
|
||||
-e 's/@''GNULIB_TTYNAME_R''@/$(GNULIB_TTYNAME_R)/g' \
|
||||
-e 's/@''GNULIB_UNISTD_H_GETOPT''@/0$(GNULIB_GL_UNISTD_H_GETOPT)/g' \
|
||||
-e 's/@''GNULIB_UNISTD_H_NONBLOCKING''@/$(GNULIB_UNISTD_H_NONBLOCKING)/g' \
|
||||
-e 's/@''GNULIB_UNISTD_H_SIGPIPE''@/$(GNULIB_UNISTD_H_SIGPIPE)/g' \
|
||||
-e 's/@''GNULIB_UNLINK''@/$(GNULIB_UNLINK)/g' \
|
||||
-e 's/@''GNULIB_UNLINKAT''@/$(GNULIB_UNLINKAT)/g' \
|
||||
-e 's/@''GNULIB_USLEEP''@/$(GNULIB_USLEEP)/g' \
|
||||
-e 's/@''GNULIB_WRITE''@/$(GNULIB_WRITE)/g' \
|
||||
< $(srcdir)/unistd.in.h | \
|
||||
sed -e 's|@''HAVE_CHOWN''@|$(HAVE_CHOWN)|g' \
|
||||
-e 's|@''HAVE_DUP2''@|$(HAVE_DUP2)|g' \
|
||||
-e 's|@''HAVE_DUP3''@|$(HAVE_DUP3)|g' \
|
||||
-e 's|@''HAVE_EUIDACCESS''@|$(HAVE_EUIDACCESS)|g' \
|
||||
-e 's|@''HAVE_FACCESSAT''@|$(HAVE_FACCESSAT)|g' \
|
||||
-e 's|@''HAVE_FCHDIR''@|$(HAVE_FCHDIR)|g' \
|
||||
-e 's|@''HAVE_FCHOWNAT''@|$(HAVE_FCHOWNAT)|g' \
|
||||
-e 's|@''HAVE_FDATASYNC''@|$(HAVE_FDATASYNC)|g' \
|
||||
-e 's|@''HAVE_FSYNC''@|$(HAVE_FSYNC)|g' \
|
||||
-e 's|@''HAVE_FTRUNCATE''@|$(HAVE_FTRUNCATE)|g' \
|
||||
-e 's|@''HAVE_GETDTABLESIZE''@|$(HAVE_GETDTABLESIZE)|g' \
|
||||
-e 's|@''HAVE_GETGROUPS''@|$(HAVE_GETGROUPS)|g' \
|
||||
-e 's|@''HAVE_GETHOSTNAME''@|$(HAVE_GETHOSTNAME)|g' \
|
||||
-e 's|@''HAVE_GETPAGESIZE''@|$(HAVE_GETPAGESIZE)|g' \
|
||||
-e 's|@''HAVE_GETPASS''@|$(HAVE_GETPASS)|g' \
|
||||
-e 's|@''HAVE_GROUP_MEMBER''@|$(HAVE_GROUP_MEMBER)|g' \
|
||||
-e 's|@''HAVE_LCHOWN''@|$(HAVE_LCHOWN)|g' \
|
||||
-e 's|@''HAVE_LINK''@|$(HAVE_LINK)|g' \
|
||||
-e 's|@''HAVE_LINKAT''@|$(HAVE_LINKAT)|g' \
|
||||
-e 's|@''HAVE_PIPE''@|$(HAVE_PIPE)|g' \
|
||||
-e 's|@''HAVE_PIPE2''@|$(HAVE_PIPE2)|g' \
|
||||
-e 's|@''HAVE_PREAD''@|$(HAVE_PREAD)|g' \
|
||||
-e 's|@''HAVE_PWRITE''@|$(HAVE_PWRITE)|g' \
|
||||
-e 's|@''HAVE_READLINK''@|$(HAVE_READLINK)|g' \
|
||||
-e 's|@''HAVE_READLINKAT''@|$(HAVE_READLINKAT)|g' \
|
||||
-e 's|@''HAVE_SETHOSTNAME''@|$(HAVE_SETHOSTNAME)|g' \
|
||||
-e 's|@''HAVE_SLEEP''@|$(HAVE_SLEEP)|g' \
|
||||
-e 's|@''HAVE_SYMLINK''@|$(HAVE_SYMLINK)|g' \
|
||||
-e 's|@''HAVE_SYMLINKAT''@|$(HAVE_SYMLINKAT)|g' \
|
||||
-e 's|@''HAVE_UNLINKAT''@|$(HAVE_UNLINKAT)|g' \
|
||||
-e 's|@''HAVE_USLEEP''@|$(HAVE_USLEEP)|g' \
|
||||
-e 's|@''HAVE_DECL_ENVIRON''@|$(HAVE_DECL_ENVIRON)|g' \
|
||||
-e 's|@''HAVE_DECL_FCHDIR''@|$(HAVE_DECL_FCHDIR)|g' \
|
||||
-e 's|@''HAVE_DECL_FDATASYNC''@|$(HAVE_DECL_FDATASYNC)|g' \
|
||||
-e 's|@''HAVE_DECL_GETDOMAINNAME''@|$(HAVE_DECL_GETDOMAINNAME)|g' \
|
||||
-e 's|@''HAVE_DECL_GETLOGIN''@|$(HAVE_DECL_GETLOGIN)|g' \
|
||||
-e 's|@''HAVE_DECL_GETLOGIN_R''@|$(HAVE_DECL_GETLOGIN_R)|g' \
|
||||
-e 's|@''HAVE_DECL_GETPAGESIZE''@|$(HAVE_DECL_GETPAGESIZE)|g' \
|
||||
-e 's|@''HAVE_DECL_GETUSERSHELL''@|$(HAVE_DECL_GETUSERSHELL)|g' \
|
||||
-e 's|@''HAVE_DECL_SETHOSTNAME''@|$(HAVE_DECL_SETHOSTNAME)|g' \
|
||||
-e 's|@''HAVE_DECL_TRUNCATE''@|$(HAVE_DECL_TRUNCATE)|g' \
|
||||
-e 's|@''HAVE_DECL_TTYNAME_R''@|$(HAVE_DECL_TTYNAME_R)|g' \
|
||||
-e 's|@''HAVE_OS_H''@|$(HAVE_OS_H)|g' \
|
||||
-e 's|@''HAVE_SYS_PARAM_H''@|$(HAVE_SYS_PARAM_H)|g' \
|
||||
| \
|
||||
sed -e 's|@''REPLACE_CHOWN''@|$(REPLACE_CHOWN)|g' \
|
||||
-e 's|@''REPLACE_CLOSE''@|$(REPLACE_CLOSE)|g' \
|
||||
-e 's|@''REPLACE_DUP''@|$(REPLACE_DUP)|g' \
|
||||
-e 's|@''REPLACE_DUP2''@|$(REPLACE_DUP2)|g' \
|
||||
-e 's|@''REPLACE_FACCESSAT''@|$(REPLACE_FACCESSAT)|g' \
|
||||
-e 's|@''REPLACE_FCHOWNAT''@|$(REPLACE_FCHOWNAT)|g' \
|
||||
-e 's|@''REPLACE_FTRUNCATE''@|$(REPLACE_FTRUNCATE)|g' \
|
||||
-e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \
|
||||
-e 's|@''REPLACE_GETDOMAINNAME''@|$(REPLACE_GETDOMAINNAME)|g' \
|
||||
-e 's|@''REPLACE_GETDTABLESIZE''@|$(REPLACE_GETDTABLESIZE)|g' \
|
||||
-e 's|@''REPLACE_GETLOGIN_R''@|$(REPLACE_GETLOGIN_R)|g' \
|
||||
-e 's|@''REPLACE_GETGROUPS''@|$(REPLACE_GETGROUPS)|g' \
|
||||
-e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \
|
||||
-e 's|@''REPLACE_GETPASS''@|$(REPLACE_GETPASS)|g' \
|
||||
-e 's|@''REPLACE_ISATTY''@|$(REPLACE_ISATTY)|g' \
|
||||
-e 's|@''REPLACE_LCHOWN''@|$(REPLACE_LCHOWN)|g' \
|
||||
-e 's|@''REPLACE_LINK''@|$(REPLACE_LINK)|g' \
|
||||
-e 's|@''REPLACE_LINKAT''@|$(REPLACE_LINKAT)|g' \
|
||||
-e 's|@''REPLACE_LSEEK''@|$(REPLACE_LSEEK)|g' \
|
||||
-e 's|@''REPLACE_PREAD''@|$(REPLACE_PREAD)|g' \
|
||||
-e 's|@''REPLACE_PWRITE''@|$(REPLACE_PWRITE)|g' \
|
||||
-e 's|@''REPLACE_READ''@|$(REPLACE_READ)|g' \
|
||||
-e 's|@''REPLACE_READLINK''@|$(REPLACE_READLINK)|g' \
|
||||
-e 's|@''REPLACE_READLINKAT''@|$(REPLACE_READLINKAT)|g' \
|
||||
-e 's|@''REPLACE_RMDIR''@|$(REPLACE_RMDIR)|g' \
|
||||
-e 's|@''REPLACE_SLEEP''@|$(REPLACE_SLEEP)|g' \
|
||||
-e 's|@''REPLACE_SYMLINK''@|$(REPLACE_SYMLINK)|g' \
|
||||
-e 's|@''REPLACE_SYMLINKAT''@|$(REPLACE_SYMLINKAT)|g' \
|
||||
-e 's|@''REPLACE_TRUNCATE''@|$(REPLACE_TRUNCATE)|g' \
|
||||
-e 's|@''REPLACE_TTYNAME_R''@|$(REPLACE_TTYNAME_R)|g' \
|
||||
-e 's|@''REPLACE_UNLINK''@|$(REPLACE_UNLINK)|g' \
|
||||
-e 's|@''REPLACE_UNLINKAT''@|$(REPLACE_UNLINKAT)|g' \
|
||||
-e 's|@''REPLACE_USLEEP''@|$(REPLACE_USLEEP)|g' \
|
||||
-e 's|@''REPLACE_WRITE''@|$(REPLACE_WRITE)|g' \
|
||||
-e 's|@''UNISTD_H_HAVE_WINSOCK2_H''@|$(UNISTD_H_HAVE_WINSOCK2_H)|g' \
|
||||
-e 's|@''UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS''@|$(UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS)|g' \
|
||||
-e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
|
||||
-e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
|
||||
-e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \
|
||||
} > $@-t && \
|
||||
mv $@-t $@
|
||||
MOSTLYCLEANFILES += unistd.h unistd.h-t
|
||||
|
||||
EXTRA_DIST += unistd.in.h
|
||||
|
||||
## end gnulib module unistd
|
||||
|
||||
|
||||
mostlyclean-local: mostlyclean-generic
|
||||
@for dir in '' $(MOSTLYCLEANDIRS); do \
|
||||
if test -n "$$dir" && test -d $$dir; then \
|
||||
echo "rmdir $$dir"; rmdir $$dir; \
|
||||
fi; \
|
||||
done; \
|
||||
:
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,10 @@
|
|||
#if !defined _Noreturn && __STDC_VERSION__ < 201112
|
||||
# if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__) \
|
||||
|| 0x5110 <= __SUNPRO_C)
|
||||
# define _Noreturn __attribute__ ((__noreturn__))
|
||||
# elif 1200 <= _MSC_VER
|
||||
# define _Noreturn __declspec (noreturn)
|
||||
# else
|
||||
# define _Noreturn
|
||||
# endif
|
||||
#endif
|
|
@ -0,0 +1,26 @@
|
|||
/* A C macro for declaring that specific arguments must not be NULL.
|
||||
Copyright (C) 2009-2018 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU Lesser General Public License as published
|
||||
by the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
/* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools
|
||||
that the values passed as arguments n, ..., m must be non-NULL pointers.
|
||||
n = 1 stands for the first argument, n = 2 for the second argument etc. */
|
||||
#ifndef _GL_ARG_NONNULL
|
||||
# if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3
|
||||
# define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params))
|
||||
# else
|
||||
# define _GL_ARG_NONNULL(params)
|
||||
# endif
|
||||
#endif
|
|
@ -0,0 +1,316 @@
|
|||
/* C++ compatible function declaration macros.
|
||||
Copyright (C) 2010-2018 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU Lesser General Public License as published
|
||||
by the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _GL_CXXDEFS_H
|
||||
#define _GL_CXXDEFS_H
|
||||
|
||||
/* Begin/end the GNULIB_NAMESPACE namespace. */
|
||||
#if defined __cplusplus && defined GNULIB_NAMESPACE
|
||||
# define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE {
|
||||
# define _GL_END_NAMESPACE }
|
||||
#else
|
||||
# define _GL_BEGIN_NAMESPACE
|
||||
# define _GL_END_NAMESPACE
|
||||
#endif
|
||||
|
||||
/* The three most frequent use cases of these macros are:
|
||||
|
||||
* For providing a substitute for a function that is missing on some
|
||||
platforms, but is declared and works fine on the platforms on which
|
||||
it exists:
|
||||
|
||||
#if @GNULIB_FOO@
|
||||
# if !@HAVE_FOO@
|
||||
_GL_FUNCDECL_SYS (foo, ...);
|
||||
# endif
|
||||
_GL_CXXALIAS_SYS (foo, ...);
|
||||
_GL_CXXALIASWARN (foo);
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
...
|
||||
#endif
|
||||
|
||||
* For providing a replacement for a function that exists on all platforms,
|
||||
but is broken/insufficient and needs to be replaced on some platforms:
|
||||
|
||||
#if @GNULIB_FOO@
|
||||
# if @REPLACE_FOO@
|
||||
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
||||
# undef foo
|
||||
# define foo rpl_foo
|
||||
# endif
|
||||
_GL_FUNCDECL_RPL (foo, ...);
|
||||
_GL_CXXALIAS_RPL (foo, ...);
|
||||
# else
|
||||
_GL_CXXALIAS_SYS (foo, ...);
|
||||
# endif
|
||||
_GL_CXXALIASWARN (foo);
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
...
|
||||
#endif
|
||||
|
||||
* For providing a replacement for a function that exists on some platforms
|
||||
but is broken/insufficient and needs to be replaced on some of them and
|
||||
is additionally either missing or undeclared on some other platforms:
|
||||
|
||||
#if @GNULIB_FOO@
|
||||
# if @REPLACE_FOO@
|
||||
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
||||
# undef foo
|
||||
# define foo rpl_foo
|
||||
# endif
|
||||
_GL_FUNCDECL_RPL (foo, ...);
|
||||
_GL_CXXALIAS_RPL (foo, ...);
|
||||
# else
|
||||
# if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@
|
||||
_GL_FUNCDECL_SYS (foo, ...);
|
||||
# endif
|
||||
_GL_CXXALIAS_SYS (foo, ...);
|
||||
# endif
|
||||
_GL_CXXALIASWARN (foo);
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
...
|
||||
#endif
|
||||
*/
|
||||
|
||||
/* _GL_EXTERN_C declaration;
|
||||
performs the declaration with C linkage. */
|
||||
#if defined __cplusplus
|
||||
# define _GL_EXTERN_C extern "C"
|
||||
#else
|
||||
# define _GL_EXTERN_C extern
|
||||
#endif
|
||||
|
||||
/* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes);
|
||||
declares a replacement function, named rpl_func, with the given prototype,
|
||||
consisting of return type, parameters, and attributes.
|
||||
Example:
|
||||
_GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
|
||||
_GL_ARG_NONNULL ((1)));
|
||||
*/
|
||||
#define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \
|
||||
_GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes)
|
||||
#define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \
|
||||
_GL_EXTERN_C rettype rpl_func parameters_and_attributes
|
||||
|
||||
/* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes);
|
||||
declares the system function, named func, with the given prototype,
|
||||
consisting of return type, parameters, and attributes.
|
||||
Example:
|
||||
_GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...)
|
||||
_GL_ARG_NONNULL ((1)));
|
||||
*/
|
||||
#define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \
|
||||
_GL_EXTERN_C rettype func parameters_and_attributes
|
||||
|
||||
/* _GL_CXXALIAS_RPL (func, rettype, parameters);
|
||||
declares a C++ alias called GNULIB_NAMESPACE::func
|
||||
that redirects to rpl_func, if GNULIB_NAMESPACE is defined.
|
||||
Example:
|
||||
_GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
|
||||
|
||||
Wrapping rpl_func in an object with an inline conversion operator
|
||||
avoids a reference to rpl_func unless GNULIB_NAMESPACE::func is
|
||||
actually used in the program. */
|
||||
#define _GL_CXXALIAS_RPL(func,rettype,parameters) \
|
||||
_GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters)
|
||||
#if defined __cplusplus && defined GNULIB_NAMESPACE
|
||||
# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
|
||||
namespace GNULIB_NAMESPACE \
|
||||
{ \
|
||||
static const struct _gl_ ## func ## _wrapper \
|
||||
{ \
|
||||
typedef rettype (*type) parameters; \
|
||||
\
|
||||
inline operator type () const \
|
||||
{ \
|
||||
return ::rpl_func; \
|
||||
} \
|
||||
} func = {}; \
|
||||
} \
|
||||
_GL_EXTERN_C int _gl_cxxalias_dummy
|
||||
#else
|
||||
# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
|
||||
_GL_EXTERN_C int _gl_cxxalias_dummy
|
||||
#endif
|
||||
|
||||
/* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters);
|
||||
is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters);
|
||||
except that the C function rpl_func may have a slightly different
|
||||
declaration. A cast is used to silence the "invalid conversion" error
|
||||
that would otherwise occur. */
|
||||
#if defined __cplusplus && defined GNULIB_NAMESPACE
|
||||
# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
|
||||
namespace GNULIB_NAMESPACE \
|
||||
{ \
|
||||
static const struct _gl_ ## func ## _wrapper \
|
||||
{ \
|
||||
typedef rettype (*type) parameters; \
|
||||
\
|
||||
inline operator type () const \
|
||||
{ \
|
||||
return reinterpret_cast<type>(::rpl_func); \
|
||||
} \
|
||||
} func = {}; \
|
||||
} \
|
||||
_GL_EXTERN_C int _gl_cxxalias_dummy
|
||||
#else
|
||||
# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
|
||||
_GL_EXTERN_C int _gl_cxxalias_dummy
|
||||
#endif
|
||||
|
||||
/* _GL_CXXALIAS_SYS (func, rettype, parameters);
|
||||
declares a C++ alias called GNULIB_NAMESPACE::func
|
||||
that redirects to the system provided function func, if GNULIB_NAMESPACE
|
||||
is defined.
|
||||
Example:
|
||||
_GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
|
||||
|
||||
Wrapping func in an object with an inline conversion operator
|
||||
avoids a reference to func unless GNULIB_NAMESPACE::func is
|
||||
actually used in the program. */
|
||||
#if defined __cplusplus && defined GNULIB_NAMESPACE
|
||||
# define _GL_CXXALIAS_SYS(func,rettype,parameters) \
|
||||
namespace GNULIB_NAMESPACE \
|
||||
{ \
|
||||
static const struct _gl_ ## func ## _wrapper \
|
||||
{ \
|
||||
typedef rettype (*type) parameters; \
|
||||
\
|
||||
inline operator type () const \
|
||||
{ \
|
||||
return ::func; \
|
||||
} \
|
||||
} func = {}; \
|
||||
} \
|
||||
_GL_EXTERN_C int _gl_cxxalias_dummy
|
||||
#else
|
||||
# define _GL_CXXALIAS_SYS(func,rettype,parameters) \
|
||||
_GL_EXTERN_C int _gl_cxxalias_dummy
|
||||
#endif
|
||||
|
||||
/* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters);
|
||||
is like _GL_CXXALIAS_SYS (func, rettype, parameters);
|
||||
except that the C function func may have a slightly different declaration.
|
||||
A cast is used to silence the "invalid conversion" error that would
|
||||
otherwise occur. */
|
||||
#if defined __cplusplus && defined GNULIB_NAMESPACE
|
||||
# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
|
||||
namespace GNULIB_NAMESPACE \
|
||||
{ \
|
||||
static const struct _gl_ ## func ## _wrapper \
|
||||
{ \
|
||||
typedef rettype (*type) parameters; \
|
||||
\
|
||||
inline operator type () const \
|
||||
{ \
|
||||
return reinterpret_cast<type>(::func); \
|
||||
} \
|
||||
} func = {}; \
|
||||
} \
|
||||
_GL_EXTERN_C int _gl_cxxalias_dummy
|
||||
#else
|
||||
# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
|
||||
_GL_EXTERN_C int _gl_cxxalias_dummy
|
||||
#endif
|
||||
|
||||
/* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2);
|
||||
is like _GL_CXXALIAS_SYS (func, rettype, parameters);
|
||||
except that the C function is picked among a set of overloaded functions,
|
||||
namely the one with rettype2 and parameters2. Two consecutive casts
|
||||
are used to silence the "cannot find a match" and "invalid conversion"
|
||||
errors that would otherwise occur. */
|
||||
#if defined __cplusplus && defined GNULIB_NAMESPACE
|
||||
/* The outer cast must be a reinterpret_cast.
|
||||
The inner cast: When the function is defined as a set of overloaded
|
||||
functions, it works as a static_cast<>, choosing the designated variant.
|
||||
When the function is defined as a single variant, it works as a
|
||||
reinterpret_cast<>. The parenthesized cast syntax works both ways. */
|
||||
# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
|
||||
namespace GNULIB_NAMESPACE \
|
||||
{ \
|
||||
static const struct _gl_ ## func ## _wrapper \
|
||||
{ \
|
||||
typedef rettype (*type) parameters; \
|
||||
\
|
||||
inline operator type () const \
|
||||
{ \
|
||||
return reinterpret_cast<type>((rettype2 (*) parameters2)(::func)); \
|
||||
} \
|
||||
} func = {}; \
|
||||
} \
|
||||
_GL_EXTERN_C int _gl_cxxalias_dummy
|
||||
#else
|
||||
# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
|
||||
_GL_EXTERN_C int _gl_cxxalias_dummy
|
||||
#endif
|
||||
|
||||
/* _GL_CXXALIASWARN (func);
|
||||
causes a warning to be emitted when ::func is used but not when
|
||||
GNULIB_NAMESPACE::func is used. func must be defined without overloaded
|
||||
variants. */
|
||||
#if defined __cplusplus && defined GNULIB_NAMESPACE
|
||||
# define _GL_CXXALIASWARN(func) \
|
||||
_GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
|
||||
# define _GL_CXXALIASWARN_1(func,namespace) \
|
||||
_GL_CXXALIASWARN_2 (func, namespace)
|
||||
/* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
|
||||
we enable the warning only when not optimizing. */
|
||||
# if !__OPTIMIZE__
|
||||
# define _GL_CXXALIASWARN_2(func,namespace) \
|
||||
_GL_WARN_ON_USE (func, \
|
||||
"The symbol ::" #func " refers to the system function. " \
|
||||
"Use " #namespace "::" #func " instead.")
|
||||
# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
|
||||
# define _GL_CXXALIASWARN_2(func,namespace) \
|
||||
extern __typeof__ (func) func
|
||||
# else
|
||||
# define _GL_CXXALIASWARN_2(func,namespace) \
|
||||
_GL_EXTERN_C int _gl_cxxalias_dummy
|
||||
# endif
|
||||
#else
|
||||
# define _GL_CXXALIASWARN(func) \
|
||||
_GL_EXTERN_C int _gl_cxxalias_dummy
|
||||
#endif
|
||||
|
||||
/* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes);
|
||||
causes a warning to be emitted when the given overloaded variant of ::func
|
||||
is used but not when GNULIB_NAMESPACE::func is used. */
|
||||
#if defined __cplusplus && defined GNULIB_NAMESPACE
|
||||
# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
|
||||
_GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \
|
||||
GNULIB_NAMESPACE)
|
||||
# define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \
|
||||
_GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
|
||||
/* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
|
||||
we enable the warning only when not optimizing. */
|
||||
# if !__OPTIMIZE__
|
||||
# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
|
||||
_GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \
|
||||
"The symbol ::" #func " refers to the system function. " \
|
||||
"Use " #namespace "::" #func " instead.")
|
||||
# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
|
||||
# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
|
||||
extern __typeof__ (func) func
|
||||
# else
|
||||
# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
|
||||
_GL_EXTERN_C int _gl_cxxalias_dummy
|
||||
# endif
|
||||
#else
|
||||
# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
|
||||
_GL_EXTERN_C int _gl_cxxalias_dummy
|
||||
#endif
|
||||
|
||||
#endif /* _GL_CXXDEFS_H */
|
|
@ -0,0 +1,224 @@
|
|||
/* Emulate flock on platforms that lack it, primarily Windows and MinGW.
|
||||
|
||||
This is derived from sqlite3 sources.
|
||||
https://www.sqlite.org/src/finfo?name=src/os_win.c
|
||||
https://www.sqlite.org/copyright.html
|
||||
|
||||
Written by Richard W.M. Jones <rjones.at.redhat.com>
|
||||
|
||||
Copyright (C) 2008-2018 Free Software Foundation, Inc.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <config.h>
|
||||
#include <sys/file.h>
|
||||
|
||||
#if defined _WIN32 && ! defined __CYGWIN__
|
||||
|
||||
/* LockFileEx */
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# include <windows.h>
|
||||
|
||||
# include <errno.h>
|
||||
|
||||
/* _get_osfhandle */
|
||||
# if GNULIB_MSVC_NOTHROW
|
||||
# include "msvc-nothrow.h"
|
||||
# else
|
||||
# include <io.h>
|
||||
# endif
|
||||
|
||||
/* Determine the current size of a file. Because the other braindead
|
||||
* APIs we'll call need lower/upper 32 bit pairs, keep the file size
|
||||
* like that too.
|
||||
*/
|
||||
static BOOL
|
||||
file_size (HANDLE h, DWORD * lower, DWORD * upper)
|
||||
{
|
||||
*lower = GetFileSize (h, upper);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* LOCKFILE_FAIL_IMMEDIATELY is undefined on some Windows systems. */
|
||||
# ifndef LOCKFILE_FAIL_IMMEDIATELY
|
||||
# define LOCKFILE_FAIL_IMMEDIATELY 1
|
||||
# endif
|
||||
|
||||
/* Acquire a lock. */
|
||||
static BOOL
|
||||
do_lock (HANDLE h, int non_blocking, int exclusive)
|
||||
{
|
||||
BOOL res;
|
||||
DWORD size_lower, size_upper;
|
||||
OVERLAPPED ovlp;
|
||||
int flags = 0;
|
||||
|
||||
/* We're going to lock the whole file, so get the file size. */
|
||||
res = file_size (h, &size_lower, &size_upper);
|
||||
if (!res)
|
||||
return 0;
|
||||
|
||||
/* Start offset is 0, and also zero the remaining members of this struct. */
|
||||
memset (&ovlp, 0, sizeof ovlp);
|
||||
|
||||
if (non_blocking)
|
||||
flags |= LOCKFILE_FAIL_IMMEDIATELY;
|
||||
if (exclusive)
|
||||
flags |= LOCKFILE_EXCLUSIVE_LOCK;
|
||||
|
||||
return LockFileEx (h, flags, 0, size_lower, size_upper, &ovlp);
|
||||
}
|
||||
|
||||
/* Unlock reader or exclusive lock. */
|
||||
static BOOL
|
||||
do_unlock (HANDLE h)
|
||||
{
|
||||
int res;
|
||||
DWORD size_lower, size_upper;
|
||||
|
||||
res = file_size (h, &size_lower, &size_upper);
|
||||
if (!res)
|
||||
return 0;
|
||||
|
||||
return UnlockFile (h, 0, 0, size_lower, size_upper);
|
||||
}
|
||||
|
||||
/* Now our BSD-like flock operation. */
|
||||
int
|
||||
flock (int fd, int operation)
|
||||
{
|
||||
HANDLE h = (HANDLE) _get_osfhandle (fd);
|
||||
DWORD res;
|
||||
int non_blocking;
|
||||
|
||||
if (h == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
errno = EBADF;
|
||||
return -1;
|
||||
}
|
||||
|
||||
non_blocking = operation & LOCK_NB;
|
||||
operation &= ~LOCK_NB;
|
||||
|
||||
switch (operation)
|
||||
{
|
||||
case LOCK_SH:
|
||||
res = do_lock (h, non_blocking, 0);
|
||||
break;
|
||||
case LOCK_EX:
|
||||
res = do_lock (h, non_blocking, 1);
|
||||
break;
|
||||
case LOCK_UN:
|
||||
res = do_unlock (h);
|
||||
break;
|
||||
default:
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Map Windows errors into Unix errnos. As usual MSDN fails to
|
||||
* document the permissible error codes.
|
||||
*/
|
||||
if (!res)
|
||||
{
|
||||
DWORD err = GetLastError ();
|
||||
switch (err)
|
||||
{
|
||||
/* This means someone else is holding a lock. */
|
||||
case ERROR_LOCK_VIOLATION:
|
||||
errno = EAGAIN;
|
||||
break;
|
||||
|
||||
/* Out of memory. */
|
||||
case ERROR_NOT_ENOUGH_MEMORY:
|
||||
errno = ENOMEM;
|
||||
break;
|
||||
|
||||
case ERROR_BAD_COMMAND:
|
||||
errno = EINVAL;
|
||||
break;
|
||||
|
||||
/* Unlikely to be other errors, but at least don't lose the
|
||||
* error code.
|
||||
*/
|
||||
default:
|
||||
errno = err;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else /* !Windows */
|
||||
|
||||
# ifdef HAVE_STRUCT_FLOCK_L_TYPE
|
||||
/* We know how to implement flock in terms of fcntl. */
|
||||
|
||||
# include <fcntl.h>
|
||||
|
||||
# ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
# endif
|
||||
|
||||
# include <errno.h>
|
||||
# include <string.h>
|
||||
|
||||
int
|
||||
flock (int fd, int operation)
|
||||
{
|
||||
int cmd, r;
|
||||
struct flock fl;
|
||||
|
||||
if (operation & LOCK_NB)
|
||||
cmd = F_SETLK;
|
||||
else
|
||||
cmd = F_SETLKW;
|
||||
operation &= ~LOCK_NB;
|
||||
|
||||
memset (&fl, 0, sizeof fl);
|
||||
fl.l_whence = SEEK_SET;
|
||||
/* l_start & l_len are 0, which as a special case means "whole file". */
|
||||
|
||||
switch (operation)
|
||||
{
|
||||
case LOCK_SH:
|
||||
fl.l_type = F_RDLCK;
|
||||
break;
|
||||
case LOCK_EX:
|
||||
fl.l_type = F_WRLCK;
|
||||
break;
|
||||
case LOCK_UN:
|
||||
fl.l_type = F_UNLCK;
|
||||
break;
|
||||
default:
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
r = fcntl (fd, cmd, &fl);
|
||||
if (r == -1 && errno == EACCES)
|
||||
errno = EAGAIN;
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
# else /* !HAVE_STRUCT_FLOCK_L_TYPE */
|
||||
|
||||
# error "This platform lacks flock function, and Gnulib doesn't provide a replacement. This is a bug in Gnulib."
|
||||
|
||||
# endif /* !HAVE_STRUCT_FLOCK_L_TYPE */
|
||||
|
||||
#endif /* !Windows */
|
|
@ -0,0 +1,67 @@
|
|||
/* getopt-on-non-glibc compatibility macros.
|
||||
Copyright (C) 1989-2018 Free Software Foundation, Inc.
|
||||
This file is part of gnulib.
|
||||
Unlike most of the getopt implementation, it is NOT shared
|
||||
with the GNU C Library.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Lesser General Public License as
|
||||
published by the Free Software Foundation; either version 2.1 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
This file is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with gnulib; if not, see
|
||||
<https://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _GETOPT_CDEFS_H
|
||||
#define _GETOPT_CDEFS_H 1
|
||||
|
||||
/* This header should not be used directly; include getopt.h or
|
||||
unistd.h instead. It does not have a protective #error, because
|
||||
the guard macro for getopt.h in gnulib is not fixed. */
|
||||
|
||||
/* getopt-core.h and getopt-ext.h are shared with GNU libc, and expect
|
||||
a number of the internal macros supplied to GNU libc's headers by
|
||||
sys/cdefs.h. Provide fallback definitions for all of them. */
|
||||
#if @HAVE_SYS_CDEFS_H@
|
||||
# include <sys/cdefs.h>
|
||||
#endif
|
||||
|
||||
#ifndef __BEGIN_DECLS
|
||||
# ifdef __cplusplus
|
||||
# define __BEGIN_DECLS extern "C" {
|
||||
# else
|
||||
# define __BEGIN_DECLS /* nothing */
|
||||
# endif
|
||||
#endif
|
||||
#ifndef __END_DECLS
|
||||
# ifdef __cplusplus
|
||||
# define __END_DECLS }
|
||||
# else
|
||||
# define __END_DECLS /* nothing */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef __GNUC_PREREQ
|
||||
# if defined __GNUC__ && defined __GNUC_VERSION__
|
||||
# define __GNUC_PREREQ(maj, min) \
|
||||
((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
|
||||
# else
|
||||
# define __GNUC_PREREQ(maj, min) 0
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef __THROW
|
||||
# if defined __cplusplus && __GNUC_PREREQ (2,8)
|
||||
# define __THROW throw ()
|
||||
# else
|
||||
# define __THROW
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif /* _GETOPT_CDEFS_H */
|
|
@ -0,0 +1,96 @@
|
|||
/* Declarations for getopt (basic, portable features only).
|
||||
Copyright (C) 1989-2018 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library and is also part of gnulib.
|
||||
Patches to this file should be submitted to both projects.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, see
|
||||
<https://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _GETOPT_CORE_H
|
||||
#define _GETOPT_CORE_H 1
|
||||
|
||||
/* This header should not be used directly; include getopt.h or
|
||||
unistd.h instead. Unlike most bits headers, it does not have
|
||||
a protective #error, because the guard macro for getopt.h in
|
||||
gnulib is not fixed. */
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/* For communication from 'getopt' to the caller.
|
||||
When 'getopt' finds an option that takes an argument,
|
||||
the argument value is returned here.
|
||||
Also, when 'ordering' is RETURN_IN_ORDER,
|
||||
each non-option ARGV-element is returned here. */
|
||||
|
||||
extern char *optarg;
|
||||
|
||||
/* Index in ARGV of the next element to be scanned.
|
||||
This is used for communication to and from the caller
|
||||
and for communication between successive calls to 'getopt'.
|
||||
|
||||
On entry to 'getopt', zero means this is the first call; initialize.
|
||||
|
||||
When 'getopt' returns -1, this is the index of the first of the
|
||||
non-option elements that the caller should itself scan.
|
||||
|
||||
Otherwise, 'optind' communicates from one call to the next
|
||||
how much of ARGV has been scanned so far. */
|
||||
|
||||
extern int optind;
|
||||
|
||||
/* Callers store zero here to inhibit the error message 'getopt' prints
|
||||
for unrecognized options. */
|
||||
|
||||
extern int opterr;
|
||||
|
||||
/* Set to an option character which was unrecognized. */
|
||||
|
||||
extern int optopt;
|
||||
|
||||
/* Get definitions and prototypes for functions to process the
|
||||
arguments in ARGV (ARGC of them, minus the program name) for
|
||||
options given in OPTS.
|
||||
|
||||
Return the option character from OPTS just read. Return -1 when
|
||||
there are no more options. For unrecognized options, or options
|
||||
missing arguments, 'optopt' is set to the option letter, and '?' is
|
||||
returned.
|
||||
|
||||
The OPTS string is a list of characters which are recognized option
|
||||
letters, optionally followed by colons, specifying that that letter
|
||||
takes an argument, to be placed in 'optarg'.
|
||||
|
||||
If a letter in OPTS is followed by two colons, its argument is
|
||||
optional. This behavior is specific to the GNU 'getopt'.
|
||||
|
||||
The argument '--' causes premature termination of argument
|
||||
scanning, explicitly telling 'getopt' that there are no more
|
||||
options.
|
||||
|
||||
If OPTS begins with '-', then non-option arguments are treated as
|
||||
arguments to the option '\1'. This behavior is specific to the GNU
|
||||
'getopt'. If OPTS begins with '+', or POSIXLY_CORRECT is set in
|
||||
the environment, then do not permute arguments.
|
||||
|
||||
For standards compliance, the 'argv' argument has the type
|
||||
char *const *, but this is inaccurate; if argument permutation is
|
||||
enabled, the argv array (not the strings it points to) must be
|
||||
writable. */
|
||||
|
||||
extern int getopt (int ___argc, char *const *___argv, const char *__shortopts)
|
||||
__THROW _GL_ARG_NONNULL ((2, 3));
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* _GETOPT_CORE_H */
|
|
@ -0,0 +1,77 @@
|
|||
/* Declarations for getopt (GNU extensions).
|
||||
Copyright (C) 1989-2018 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library and is also part of gnulib.
|
||||
Patches to this file should be submitted to both projects.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, see
|
||||
<https://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _GETOPT_EXT_H
|
||||
#define _GETOPT_EXT_H 1
|
||||
|
||||
/* This header should not be used directly; include getopt.h instead.
|
||||
Unlike most bits headers, it does not have a protective #error,
|
||||
because the guard macro for getopt.h in gnulib is not fixed. */
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/* Describe the long-named options requested by the application.
|
||||
The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
|
||||
of 'struct option' terminated by an element containing a name which is
|
||||
zero.
|
||||
|
||||
The field 'has_arg' is:
|
||||
no_argument (or 0) if the option does not take an argument,
|
||||
required_argument (or 1) if the option requires an argument,
|
||||
optional_argument (or 2) if the option takes an optional argument.
|
||||
|
||||
If the field 'flag' is not NULL, it points to a variable that is set
|
||||
to the value given in the field 'val' when the option is found, but
|
||||
left unchanged if the option is not found.
|
||||
|
||||
To have a long-named option do something other than set an 'int' to
|
||||
a compiled-in constant, such as set a value from 'optarg', set the
|
||||
option's 'flag' field to zero and its 'val' field to a nonzero
|
||||
value (the equivalent single-letter option character, if there is
|
||||
one). For long options that have a zero 'flag' field, 'getopt'
|
||||
returns the contents of the 'val' field. */
|
||||
|
||||
struct option
|
||||
{
|
||||
const char *name;
|
||||
/* has_arg can't be an enum because some compilers complain about
|
||||
type mismatches in all the code that assumes it is an int. */
|
||||
int has_arg;
|
||||
int *flag;
|
||||
int val;
|
||||
};
|
||||
|
||||
/* Names for the values of the 'has_arg' field of 'struct option'. */
|
||||
|
||||
#define no_argument 0
|
||||
#define required_argument 1
|
||||
#define optional_argument 2
|
||||
|
||||
extern int getopt_long (int ___argc, char *__getopt_argv_const *___argv,
|
||||
const char *__shortopts,
|
||||
const struct option *__longopts, int *__longind)
|
||||
__THROW _GL_ARG_NONNULL ((2, 3));
|
||||
extern int getopt_long_only (int ___argc, char *__getopt_argv_const *___argv,
|
||||
const char *__shortopts,
|
||||
const struct option *__longopts, int *__longind)
|
||||
__THROW _GL_ARG_NONNULL ((2, 3));
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* _GETOPT_EXT_H */
|
|
@ -0,0 +1,59 @@
|
|||
/* getopt (basic, portable features) gnulib wrapper header.
|
||||
Copyright (C) 1989-2018 Free Software Foundation, Inc.
|
||||
This file is part of gnulib.
|
||||
Unlike most of the getopt implementation, it is NOT shared
|
||||
with the GNU C Library.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Lesser General Public License as
|
||||
published by the Free Software Foundation; either version 2.1 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
This file is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with gnulib; if not, see
|
||||
<https://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _GETOPT_PFX_CORE_H
|
||||
#define _GETOPT_PFX_CORE_H 1
|
||||
|
||||
/* This header should not be used directly; include getopt.h or
|
||||
unistd.h instead. It does not have a protective #error, because
|
||||
the guard macro for getopt.h in gnulib is not fixed. */
|
||||
|
||||
/* Standalone applications should #define __GETOPT_PREFIX to an
|
||||
identifier that prefixes the external functions and variables
|
||||
defined in getopt-core.h and getopt-ext.h. Systematically
|
||||
rename identifiers so that they do not collide with the system
|
||||
functions and variables. Renaming avoids problems with some
|
||||
compilers and linkers. */
|
||||
#ifdef __GETOPT_PREFIX
|
||||
# ifndef __GETOPT_ID
|
||||
# define __GETOPT_CONCAT(x, y) x ## y
|
||||
# define __GETOPT_XCONCAT(x, y) __GETOPT_CONCAT (x, y)
|
||||
# define __GETOPT_ID(y) __GETOPT_XCONCAT (__GETOPT_PREFIX, y)
|
||||
# endif
|
||||
# undef getopt
|
||||
# undef optarg
|
||||
# undef opterr
|
||||
# undef optind
|
||||
# undef optopt
|
||||
# define getopt __GETOPT_ID (getopt)
|
||||
# define optarg __GETOPT_ID (optarg)
|
||||
# define opterr __GETOPT_ID (opterr)
|
||||
# define optind __GETOPT_ID (optind)
|
||||
# define optopt __GETOPT_ID (optopt)
|
||||
|
||||
/* The system's getopt.h may have already included getopt-core.h to
|
||||
declare the unprefixed identifiers. Undef _GETOPT_CORE_H so that
|
||||
getopt-core.h declares them with prefixes. */
|
||||
# undef _GETOPT_CORE_H
|
||||
#endif
|
||||
|
||||
#include <getopt-core.h>
|
||||
|
||||
#endif /* _GETOPT_PFX_CORE_H */
|
|
@ -0,0 +1,71 @@
|
|||
/* getopt (GNU extensions) gnulib wrapper header.
|
||||
Copyright (C) 1989-2018 Free Software Foundation, Inc.
|
||||
This file is part of gnulib.
|
||||
Unlike most of the getopt implementation, it is NOT shared
|
||||
with the GNU C Library.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Lesser General Public License as
|
||||
published by the Free Software Foundation; either version 2.1 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
This file is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with gnulib; if not, see
|
||||
<https://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _GETOPT_PFX_EXT_H
|
||||
#define _GETOPT_PFX_EXT_H 1
|
||||
|
||||
/* This header should not be used directly; include getopt.h instead.
|
||||
It does not have a protective #error, because the guard macro for
|
||||
getopt.h in gnulib is not fixed. */
|
||||
|
||||
/* Standalone applications should #define __GETOPT_PREFIX to an
|
||||
identifier that prefixes the external functions and variables
|
||||
defined in getopt-core.h and getopt-ext.h. Systematically
|
||||
rename identifiers so that they do not collide with the system
|
||||
functions and variables. Renaming avoids problems with some
|
||||
compilers and linkers. */
|
||||
#ifdef __GETOPT_PREFIX
|
||||
# ifndef __GETOPT_ID
|
||||
# define __GETOPT_CONCAT(x, y) x ## y
|
||||
# define __GETOPT_XCONCAT(x, y) __GETOPT_CONCAT (x, y)
|
||||
# define __GETOPT_ID(y) __GETOPT_XCONCAT (__GETOPT_PREFIX, y)
|
||||
# endif
|
||||
# undef getopt_long
|
||||
# undef getopt_long_only
|
||||
# undef option
|
||||
# undef _getopt_internal
|
||||
# define getopt_long __GETOPT_ID (getopt_long)
|
||||
# define getopt_long_only __GETOPT_ID (getopt_long_only)
|
||||
# define option __GETOPT_ID (option)
|
||||
# define _getopt_internal __GETOPT_ID (getopt_internal)
|
||||
|
||||
/* The system's getopt.h may have already included getopt-ext.h to
|
||||
declare the unprefixed identifiers. Undef _GETOPT_EXT_H so that
|
||||
getopt-ext.h declares them with prefixes. */
|
||||
# undef _GETOPT_EXT_H
|
||||
#endif
|
||||
|
||||
/* Standalone applications get correct prototypes for getopt_long and
|
||||
getopt_long_only; they declare "char **argv". For backward
|
||||
compatibility with old applications, if __GETOPT_PREFIX is not
|
||||
defined, we supply GNU-libc-compatible, but incorrect, prototypes
|
||||
using "char *const *argv". (GNU libc is stuck with the incorrect
|
||||
prototypes, as they are baked into older versions of LSB.) */
|
||||
#ifndef __getopt_argv_const
|
||||
# if defined __GETOPT_PREFIX
|
||||
# define __getopt_argv_const /* empty */
|
||||
# else
|
||||
# define __getopt_argv_const const
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include <getopt-ext.h>
|
||||
|
||||
#endif /* _GETOPT_PFX_EXT_H */
|
|
@ -0,0 +1,811 @@
|
|||
/* Getopt for GNU.
|
||||
Copyright (C) 1987-2018 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library and is also part of gnulib.
|
||||
Patches to this file should be submitted to both projects.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, see
|
||||
<https://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _LIBC
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "getopt.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifdef _LIBC
|
||||
/* When used as part of glibc, error printing must be done differently
|
||||
for standards compliance. getopt is not a cancellation point, so
|
||||
it must not call functions that are, and it is specified by an
|
||||
older standard than stdio locking, so it must not refer to
|
||||
functions in the "user namespace" related to stdio locking.
|
||||
Finally, it must use glibc's internal message translation so that
|
||||
the messages are looked up in the proper text domain. */
|
||||
# include <libintl.h>
|
||||
# define fprintf __fxprintf_nocancel
|
||||
# define flockfile(fp) _IO_flockfile (fp)
|
||||
# define funlockfile(fp) _IO_funlockfile (fp)
|
||||
#else
|
||||
# include "gettext.h"
|
||||
# define _(msgid) gettext (msgid)
|
||||
/* When used standalone, flockfile and funlockfile might not be
|
||||
available. */
|
||||
# if (!defined _POSIX_THREAD_SAFE_FUNCTIONS \
|
||||
|| (defined _WIN32 && ! defined __CYGWIN__))
|
||||
# define flockfile(fp) /* nop */
|
||||
# define funlockfile(fp) /* nop */
|
||||
# endif
|
||||
/* When used standalone, do not attempt to use alloca. */
|
||||
# define __libc_use_alloca(size) 0
|
||||
# undef alloca
|
||||
# define alloca(size) (abort (), (void *)0)
|
||||
#endif
|
||||
|
||||
/* This implementation of 'getopt' has three modes for handling
|
||||
options interspersed with non-option arguments. It can stop
|
||||
scanning for options at the first non-option argument encountered,
|
||||
as POSIX specifies. It can continue scanning for options after the
|
||||
first non-option argument, but permute 'argv' as it goes so that,
|
||||
after 'getopt' is done, all the options precede all the non-option
|
||||
arguments and 'optind' points to the first non-option argument.
|
||||
Or, it can report non-option arguments as if they were arguments to
|
||||
the option character '\x01'.
|
||||
|
||||
The default behavior of 'getopt_long' is to permute the argument list.
|
||||
When this implementation is used standalone, the default behavior of
|
||||
'getopt' is to stop at the first non-option argument, but when it is
|
||||
used as part of GNU libc it also permutes the argument list. In both
|
||||
cases, setting the environment variable POSIXLY_CORRECT to any value
|
||||
disables permutation.
|
||||
|
||||
If the first character of the OPTSTRING argument to 'getopt' or
|
||||
'getopt_long' is '+', both functions will stop at the first
|
||||
non-option argument. If it is '-', both functions will report
|
||||
non-option arguments as arguments to the option character '\x01'. */
|
||||
|
||||
#include "getopt_int.h"
|
||||
|
||||
/* For communication from 'getopt' to the caller.
|
||||
When 'getopt' finds an option that takes an argument,
|
||||
the argument value is returned here.
|
||||
Also, when 'ordering' is RETURN_IN_ORDER,
|
||||
each non-option ARGV-element is returned here. */
|
||||
|
||||
char *optarg;
|
||||
|
||||
/* Index in ARGV of the next element to be scanned.
|
||||
This is used for communication to and from the caller
|
||||
and for communication between successive calls to 'getopt'.
|
||||
|
||||
On entry to 'getopt', zero means this is the first call; initialize.
|
||||
|
||||
When 'getopt' returns -1, this is the index of the first of the
|
||||
non-option elements that the caller should itself scan.
|
||||
|
||||
Otherwise, 'optind' communicates from one call to the next
|
||||
how much of ARGV has been scanned so far. */
|
||||
|
||||
/* 1003.2 says this must be 1 before any call. */
|
||||
int optind = 1;
|
||||
|
||||
/* Callers store zero here to inhibit the error message
|
||||
for unrecognized options. */
|
||||
|
||||
int opterr = 1;
|
||||
|
||||
/* Set to an option character which was unrecognized.
|
||||
This must be initialized on some systems to avoid linking in the
|
||||
system's own getopt implementation. */
|
||||
|
||||
int optopt = '?';
|
||||
|
||||
/* Keep a global copy of all internal members of getopt_data. */
|
||||
|
||||
static struct _getopt_data getopt_data;
|
||||
|
||||
/* Exchange two adjacent subsequences of ARGV.
|
||||
One subsequence is elements [first_nonopt,last_nonopt)
|
||||
which contains all the non-options that have been skipped so far.
|
||||
The other is elements [last_nonopt,optind), which contains all
|
||||
the options processed since those non-options were skipped.
|
||||
|
||||
'first_nonopt' and 'last_nonopt' are relocated so that they describe
|
||||
the new indices of the non-options in ARGV after they are moved. */
|
||||
|
||||
static void
|
||||
exchange (char **argv, struct _getopt_data *d)
|
||||
{
|
||||
int bottom = d->__first_nonopt;
|
||||
int middle = d->__last_nonopt;
|
||||
int top = d->optind;
|
||||
char *tem;
|
||||
|
||||
/* Exchange the shorter segment with the far end of the longer segment.
|
||||
That puts the shorter segment into the right place.
|
||||
It leaves the longer segment in the right place overall,
|
||||
but it consists of two parts that need to be swapped next. */
|
||||
|
||||
while (top > middle && middle > bottom)
|
||||
{
|
||||
if (top - middle > middle - bottom)
|
||||
{
|
||||
/* Bottom segment is the short one. */
|
||||
int len = middle - bottom;
|
||||
int i;
|
||||
|
||||
/* Swap it with the top part of the top segment. */
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
tem = argv[bottom + i];
|
||||
argv[bottom + i] = argv[top - (middle - bottom) + i];
|
||||
argv[top - (middle - bottom) + i] = tem;
|
||||
}
|
||||
/* Exclude the moved bottom segment from further swapping. */
|
||||
top -= len;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Top segment is the short one. */
|
||||
int len = top - middle;
|
||||
int i;
|
||||
|
||||
/* Swap it with the bottom part of the bottom segment. */
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
tem = argv[bottom + i];
|
||||
argv[bottom + i] = argv[middle + i];
|
||||
argv[middle + i] = tem;
|
||||
}
|
||||
/* Exclude the moved top segment from further swapping. */
|
||||
bottom += len;
|
||||
}
|
||||
}
|
||||
|
||||
/* Update records for the slots the non-options now occupy. */
|
||||
|
||||
d->__first_nonopt += (d->optind - d->__last_nonopt);
|
||||
d->__last_nonopt = d->optind;
|
||||
}
|
||||
|
||||
/* Process the argument starting with d->__nextchar as a long option.
|
||||
d->optind should *not* have been advanced over this argument.
|
||||
|
||||
If the value returned is -1, it was not actually a long option, the
|
||||
state is unchanged, and the argument should be processed as a set
|
||||
of short options (this can only happen when long_only is true).
|
||||
Otherwise, the option (and its argument, if any) have been consumed
|
||||
and the return value is the value to return from _getopt_internal_r. */
|
||||
static int
|
||||
process_long_option (int argc, char **argv, const char *optstring,
|
||||
const struct option *longopts, int *longind,
|
||||
int long_only, struct _getopt_data *d,
|
||||
int print_errors, const char *prefix)
|
||||
{
|
||||
char *nameend;
|
||||
size_t namelen;
|
||||
const struct option *p;
|
||||
const struct option *pfound = NULL;
|
||||
int n_options;
|
||||
int option_index;
|
||||
|
||||
for (nameend = d->__nextchar; *nameend && *nameend != '='; nameend++)
|
||||
/* Do nothing. */ ;
|
||||
namelen = nameend - d->__nextchar;
|
||||
|
||||
/* First look for an exact match, counting the options as a side
|
||||
effect. */
|
||||
for (p = longopts, n_options = 0; p->name; p++, n_options++)
|
||||
if (!strncmp (p->name, d->__nextchar, namelen)
|
||||
&& namelen == strlen (p->name))
|
||||
{
|
||||
/* Exact match found. */
|
||||
pfound = p;
|
||||
option_index = n_options;
|
||||
break;
|
||||
}
|
||||
|
||||
if (pfound == NULL)
|
||||
{
|
||||
/* Didn't find an exact match, so look for abbreviations. */
|
||||
unsigned char *ambig_set = NULL;
|
||||
int ambig_malloced = 0;
|
||||
int ambig_fallback = 0;
|
||||
int indfound = -1;
|
||||
|
||||
for (p = longopts, option_index = 0; p->name; p++, option_index++)
|
||||
if (!strncmp (p->name, d->__nextchar, namelen))
|
||||
{
|
||||
if (pfound == NULL)
|
||||
{
|
||||
/* First nonexact match found. */
|
||||
pfound = p;
|
||||
indfound = option_index;
|
||||
}
|
||||
else if (long_only
|
||||
|| pfound->has_arg != p->has_arg
|
||||
|| pfound->flag != p->flag
|
||||
|| pfound->val != p->val)
|
||||
{
|
||||
/* Second or later nonexact match found. */
|
||||
if (!ambig_fallback)
|
||||
{
|
||||
if (!print_errors)
|
||||
/* Don't waste effort tracking the ambig set if
|
||||
we're not going to print it anyway. */
|
||||
ambig_fallback = 1;
|
||||
else if (!ambig_set)
|
||||
{
|
||||
if (__libc_use_alloca (n_options))
|
||||
ambig_set = alloca (n_options);
|
||||
else if ((ambig_set = malloc (n_options)) == NULL)
|
||||
/* Fall back to simpler error message. */
|
||||
ambig_fallback = 1;
|
||||
else
|
||||
ambig_malloced = 1;
|
||||
|
||||
if (ambig_set)
|
||||
{
|
||||
memset (ambig_set, 0, n_options);
|
||||
ambig_set[indfound] = 1;
|
||||
}
|
||||
}
|
||||
if (ambig_set)
|
||||
ambig_set[option_index] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ambig_set || ambig_fallback)
|
||||
{
|
||||
if (print_errors)
|
||||
{
|
||||
if (ambig_fallback)
|
||||
fprintf (stderr, _("%s: option '%s%s' is ambiguous\n"),
|
||||
argv[0], prefix, d->__nextchar);
|
||||
else
|
||||
{
|
||||
flockfile (stderr);
|
||||
fprintf (stderr,
|
||||
_("%s: option '%s%s' is ambiguous; possibilities:"),
|
||||
argv[0], prefix, d->__nextchar);
|
||||
|
||||
for (option_index = 0; option_index < n_options; option_index++)
|
||||
if (ambig_set[option_index])
|
||||
fprintf (stderr, " '%s%s'",
|
||||
prefix, longopts[option_index].name);
|
||||
|
||||
/* This must use 'fprintf' even though it's only
|
||||
printing a single character, so that it goes through
|
||||
__fxprintf_nocancel when compiled as part of glibc. */
|
||||
fprintf (stderr, "\n");
|
||||
funlockfile (stderr);
|
||||
}
|
||||
}
|
||||
if (ambig_malloced)
|
||||
free (ambig_set);
|
||||
d->__nextchar += strlen (d->__nextchar);
|
||||
d->optind++;
|
||||
d->optopt = 0;
|
||||
return '?';
|
||||
}
|
||||
|
||||
option_index = indfound;
|
||||
}
|
||||
|
||||
if (pfound == NULL)
|
||||
{
|
||||
/* Can't find it as a long option. If this is not getopt_long_only,
|
||||
or the option starts with '--' or is not a valid short option,
|
||||
then it's an error. */
|
||||
if (!long_only || argv[d->optind][1] == '-'
|
||||
|| strchr (optstring, *d->__nextchar) == NULL)
|
||||
{
|
||||
if (print_errors)
|
||||
fprintf (stderr, _("%s: unrecognized option '%s%s'\n"),
|
||||
argv[0], prefix, d->__nextchar);
|
||||
|
||||
d->__nextchar = NULL;
|
||||
d->optind++;
|
||||
d->optopt = 0;
|
||||
return '?';
|
||||
}
|
||||
|
||||
/* Otherwise interpret it as a short option. */
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* We have found a matching long option. Consume it. */
|
||||
d->optind++;
|
||||
d->__nextchar = NULL;
|
||||
if (*nameend)
|
||||
{
|
||||
/* Don't test has_arg with >, because some C compilers don't
|
||||
allow it to be used on enums. */
|
||||
if (pfound->has_arg)
|
||||
d->optarg = nameend + 1;
|
||||
else
|
||||
{
|
||||
if (print_errors)
|
||||
fprintf (stderr,
|
||||
_("%s: option '%s%s' doesn't allow an argument\n"),
|
||||
argv[0], prefix, pfound->name);
|
||||
|
||||
d->optopt = pfound->val;
|
||||
return '?';
|
||||
}
|
||||
}
|
||||
else if (pfound->has_arg == 1)
|
||||
{
|
||||
if (d->optind < argc)
|
||||
d->optarg = argv[d->optind++];
|
||||
else
|
||||
{
|
||||
if (print_errors)
|
||||
fprintf (stderr,
|
||||
_("%s: option '%s%s' requires an argument\n"),
|
||||
argv[0], prefix, pfound->name);
|
||||
|
||||
d->optopt = pfound->val;
|
||||
return optstring[0] == ':' ? ':' : '?';
|
||||
}
|
||||
}
|
||||
|
||||
if (longind != NULL)
|
||||
*longind = option_index;
|
||||
if (pfound->flag)
|
||||
{
|
||||
*(pfound->flag) = pfound->val;
|
||||
return 0;
|
||||
}
|
||||
return pfound->val;
|
||||
}
|
||||
|
||||
/* Initialize internal data upon the first call to getopt. */
|
||||
|
||||
static const char *
|
||||
_getopt_initialize (int argc _GL_UNUSED,
|
||||
char **argv _GL_UNUSED, const char *optstring,
|
||||
struct _getopt_data *d, int posixly_correct)
|
||||
{
|
||||
/* Start processing options with ARGV-element 1 (since ARGV-element 0
|
||||
is the program name); the sequence of previously skipped
|
||||
non-option ARGV-elements is empty. */
|
||||
if (d->optind == 0)
|
||||
d->optind = 1;
|
||||
|
||||
d->__first_nonopt = d->__last_nonopt = d->optind;
|
||||
d->__nextchar = NULL;
|
||||
|
||||
/* Determine how to handle the ordering of options and nonoptions. */
|
||||
if (optstring[0] == '-')
|
||||
{
|
||||
d->__ordering = RETURN_IN_ORDER;
|
||||
++optstring;
|
||||
}
|
||||
else if (optstring[0] == '+')
|
||||
{
|
||||
d->__ordering = REQUIRE_ORDER;
|
||||
++optstring;
|
||||
}
|
||||
else if (posixly_correct || !!getenv ("POSIXLY_CORRECT"))
|
||||
d->__ordering = REQUIRE_ORDER;
|
||||
else
|
||||
d->__ordering = PERMUTE;
|
||||
|
||||
d->__initialized = 1;
|
||||
return optstring;
|
||||
}
|
||||
|
||||
/* Scan elements of ARGV (whose length is ARGC) for option characters
|
||||
given in OPTSTRING.
|
||||
|
||||
If an element of ARGV starts with '-', and is not exactly "-" or "--",
|
||||
then it is an option element. The characters of this element
|
||||
(aside from the initial '-') are option characters. If 'getopt'
|
||||
is called repeatedly, it returns successively each of the option characters
|
||||
from each of the option elements.
|
||||
|
||||
If 'getopt' finds another option character, it returns that character,
|
||||
updating 'optind' and 'nextchar' so that the next call to 'getopt' can
|
||||
resume the scan with the following option character or ARGV-element.
|
||||
|
||||
If there are no more option characters, 'getopt' returns -1.
|
||||
Then 'optind' is the index in ARGV of the first ARGV-element
|
||||
that is not an option. (The ARGV-elements have been permuted
|
||||
so that those that are not options now come last.)
|
||||
|
||||
OPTSTRING is a string containing the legitimate option characters.
|
||||
If an option character is seen that is not listed in OPTSTRING,
|
||||
return '?' after printing an error message. If you set 'opterr' to
|
||||
zero, the error message is suppressed but we still return '?'.
|
||||
|
||||
If a char in OPTSTRING is followed by a colon, that means it wants an arg,
|
||||
so the following text in the same ARGV-element, or the text of the following
|
||||
ARGV-element, is returned in 'optarg'. Two colons mean an option that
|
||||
wants an optional arg; if there is text in the current ARGV-element,
|
||||
it is returned in 'optarg', otherwise 'optarg' is set to zero.
|
||||
|
||||
If OPTSTRING starts with '-' or '+', it requests different methods of
|
||||
handling the non-option ARGV-elements.
|
||||
See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above.
|
||||
|
||||
Long-named options begin with '--' instead of '-'.
|
||||
Their names may be abbreviated as long as the abbreviation is unique
|
||||
or is an exact match for some defined option. If they have an
|
||||
argument, it follows the option name in the same ARGV-element, separated
|
||||
from the option name by a '=', or else the in next ARGV-element.
|
||||
When 'getopt' finds a long-named option, it returns 0 if that option's
|
||||
'flag' field is nonzero, the value of the option's 'val' field
|
||||
if the 'flag' field is zero.
|
||||
|
||||
The elements of ARGV aren't really const, because we permute them.
|
||||
But we pretend they're const in the prototype to be compatible
|
||||
with other systems.
|
||||
|
||||
LONGOPTS is a vector of 'struct option' terminated by an
|
||||
element containing a name which is zero.
|
||||
|
||||
LONGIND returns the index in LONGOPT of the long-named option found.
|
||||
It is only valid when a long-named option has been found by the most
|
||||
recent call.
|
||||
|
||||
If LONG_ONLY is nonzero, '-' as well as '--' can introduce
|
||||
long-named options. */
|
||||
|
||||
int
|
||||
_getopt_internal_r (int argc, char **argv, const char *optstring,
|
||||
const struct option *longopts, int *longind,
|
||||
int long_only, struct _getopt_data *d, int posixly_correct)
|
||||
{
|
||||
int print_errors = d->opterr;
|
||||
|
||||
if (argc < 1)
|
||||
return -1;
|
||||
|
||||
d->optarg = NULL;
|
||||
|
||||
if (d->optind == 0 || !d->__initialized)
|
||||
optstring = _getopt_initialize (argc, argv, optstring, d, posixly_correct);
|
||||
else if (optstring[0] == '-' || optstring[0] == '+')
|
||||
optstring++;
|
||||
|
||||
if (optstring[0] == ':')
|
||||
print_errors = 0;
|
||||
|
||||
/* Test whether ARGV[optind] points to a non-option argument. */
|
||||
#define NONOPTION_P (argv[d->optind][0] != '-' || argv[d->optind][1] == '\0')
|
||||
|
||||
if (d->__nextchar == NULL || *d->__nextchar == '\0')
|
||||
{
|
||||
/* Advance to the next ARGV-element. */
|
||||
|
||||
/* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been
|
||||
moved back by the user (who may also have changed the arguments). */
|
||||
if (d->__last_nonopt > d->optind)
|
||||
d->__last_nonopt = d->optind;
|
||||
if (d->__first_nonopt > d->optind)
|
||||
d->__first_nonopt = d->optind;
|
||||
|
||||
if (d->__ordering == PERMUTE)
|
||||
{
|
||||
/* If we have just processed some options following some non-options,
|
||||
exchange them so that the options come first. */
|
||||
|
||||
if (d->__first_nonopt != d->__last_nonopt
|
||||
&& d->__last_nonopt != d->optind)
|
||||
exchange (argv, d);
|
||||
else if (d->__last_nonopt != d->optind)
|
||||
d->__first_nonopt = d->optind;
|
||||
|
||||
/* Skip any additional non-options
|
||||
and extend the range of non-options previously skipped. */
|
||||
|
||||
while (d->optind < argc && NONOPTION_P)
|
||||
d->optind++;
|
||||
d->__last_nonopt = d->optind;
|
||||
}
|
||||
|
||||
/* The special ARGV-element '--' means premature end of options.
|
||||
Skip it like a null option,
|
||||
then exchange with previous non-options as if it were an option,
|
||||
then skip everything else like a non-option. */
|
||||
|
||||
if (d->optind != argc && !strcmp (argv[d->optind], "--"))
|
||||
{
|
||||
d->optind++;
|
||||
|
||||
if (d->__first_nonopt != d->__last_nonopt
|
||||
&& d->__last_nonopt != d->optind)
|
||||
exchange (argv, d);
|
||||
else if (d->__first_nonopt == d->__last_nonopt)
|
||||
d->__first_nonopt = d->optind;
|
||||
d->__last_nonopt = argc;
|
||||
|
||||
d->optind = argc;
|
||||
}
|
||||
|
||||
/* If we have done all the ARGV-elements, stop the scan
|
||||
and back over any non-options that we skipped and permuted. */
|
||||
|
||||
if (d->optind == argc)
|
||||
{
|
||||
/* Set the next-arg-index to point at the non-options
|
||||
that we previously skipped, so the caller will digest them. */
|
||||
if (d->__first_nonopt != d->__last_nonopt)
|
||||
d->optind = d->__first_nonopt;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* If we have come to a non-option and did not permute it,
|
||||
either stop the scan or describe it to the caller and pass it by. */
|
||||
|
||||
if (NONOPTION_P)
|
||||
{
|
||||
if (d->__ordering == REQUIRE_ORDER)
|
||||
return -1;
|
||||
d->optarg = argv[d->optind++];
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* We have found another option-ARGV-element.
|
||||
Check whether it might be a long option. */
|
||||
if (longopts)
|
||||
{
|
||||
if (argv[d->optind][1] == '-')
|
||||
{
|
||||
/* "--foo" is always a long option. The special option
|
||||
"--" was handled above. */
|
||||
d->__nextchar = argv[d->optind] + 2;
|
||||
return process_long_option (argc, argv, optstring, longopts,
|
||||
longind, long_only, d,
|
||||
print_errors, "--");
|
||||
}
|
||||
|
||||
/* If long_only and the ARGV-element has the form "-f",
|
||||
where f is a valid short option, don't consider it an
|
||||
abbreviated form of a long option that starts with f.
|
||||
Otherwise there would be no way to give the -f short
|
||||
option.
|
||||
|
||||
On the other hand, if there's a long option "fubar" and
|
||||
the ARGV-element is "-fu", do consider that an
|
||||
abbreviation of the long option, just like "--fu", and
|
||||
not "-f" with arg "u".
|
||||
|
||||
This distinction seems to be the most useful approach. */
|
||||
if (long_only && (argv[d->optind][2]
|
||||
|| !strchr (optstring, argv[d->optind][1])))
|
||||
{
|
||||
int code;
|
||||
d->__nextchar = argv[d->optind] + 1;
|
||||
code = process_long_option (argc, argv, optstring, longopts,
|
||||
longind, long_only, d,
|
||||
print_errors, "-");
|
||||
if (code != -1)
|
||||
return code;
|
||||
}
|
||||
}
|
||||
|
||||
/* It is not a long option. Skip the initial punctuation. */
|
||||
d->__nextchar = argv[d->optind] + 1;
|
||||
}
|
||||
|
||||
/* Look at and handle the next short option-character. */
|
||||
|
||||
{
|
||||
char c = *d->__nextchar++;
|
||||
const char *temp = strchr (optstring, c);
|
||||
|
||||
/* Increment 'optind' when we start to process its last character. */
|
||||
if (*d->__nextchar == '\0')
|
||||
++d->optind;
|
||||
|
||||
if (temp == NULL || c == ':' || c == ';')
|
||||
{
|
||||
if (print_errors)
|
||||
fprintf (stderr, _("%s: invalid option -- '%c'\n"), argv[0], c);
|
||||
d->optopt = c;
|
||||
return '?';
|
||||
}
|
||||
|
||||
/* Convenience. Treat POSIX -W foo same as long option --foo */
|
||||
if (temp[0] == 'W' && temp[1] == ';' && longopts != NULL)
|
||||
{
|
||||
/* This is an option that requires an argument. */
|
||||
if (*d->__nextchar != '\0')
|
||||
d->optarg = d->__nextchar;
|
||||
else if (d->optind == argc)
|
||||
{
|
||||
if (print_errors)
|
||||
fprintf (stderr,
|
||||
_("%s: option requires an argument -- '%c'\n"),
|
||||
argv[0], c);
|
||||
|
||||
d->optopt = c;
|
||||
if (optstring[0] == ':')
|
||||
c = ':';
|
||||
else
|
||||
c = '?';
|
||||
return c;
|
||||
}
|
||||
else
|
||||
d->optarg = argv[d->optind];
|
||||
|
||||
d->__nextchar = d->optarg;
|
||||
d->optarg = NULL;
|
||||
return process_long_option (argc, argv, optstring, longopts, longind,
|
||||
0 /* long_only */, d, print_errors, "-W ");
|
||||
}
|
||||
if (temp[1] == ':')
|
||||
{
|
||||
if (temp[2] == ':')
|
||||
{
|
||||
/* This is an option that accepts an argument optionally. */
|
||||
if (*d->__nextchar != '\0')
|
||||
{
|
||||
d->optarg = d->__nextchar;
|
||||
d->optind++;
|
||||
}
|
||||
else
|
||||
d->optarg = NULL;
|
||||
d->__nextchar = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* This is an option that requires an argument. */
|
||||
if (*d->__nextchar != '\0')
|
||||
{
|
||||
d->optarg = d->__nextchar;
|
||||
/* If we end this ARGV-element by taking the rest as an arg,
|
||||
we must advance to the next element now. */
|
||||
d->optind++;
|
||||
}
|
||||
else if (d->optind == argc)
|
||||
{
|
||||
if (print_errors)
|
||||
fprintf (stderr,
|
||||
_("%s: option requires an argument -- '%c'\n"),
|
||||
argv[0], c);
|
||||
|
||||
d->optopt = c;
|
||||
if (optstring[0] == ':')
|
||||
c = ':';
|
||||
else
|
||||
c = '?';
|
||||
}
|
||||
else
|
||||
/* We already incremented 'optind' once;
|
||||
increment it again when taking next ARGV-elt as argument. */
|
||||
d->optarg = argv[d->optind++];
|
||||
d->__nextchar = NULL;
|
||||
}
|
||||
}
|
||||
return c;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
_getopt_internal (int argc, char **argv, const char *optstring,
|
||||
const struct option *longopts, int *longind, int long_only,
|
||||
int posixly_correct)
|
||||
{
|
||||
int result;
|
||||
|
||||
getopt_data.optind = optind;
|
||||
getopt_data.opterr = opterr;
|
||||
|
||||
result = _getopt_internal_r (argc, argv, optstring, longopts,
|
||||
longind, long_only, &getopt_data,
|
||||
posixly_correct);
|
||||
|
||||
optind = getopt_data.optind;
|
||||
optarg = getopt_data.optarg;
|
||||
optopt = getopt_data.optopt;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/* glibc gets a LSB-compliant getopt and a POSIX-complaint __posix_getopt.
|
||||
Standalone applications just get a POSIX-compliant getopt.
|
||||
POSIX and LSB both require these functions to take 'char *const *argv'
|
||||
even though this is incorrect (because of the permutation). */
|
||||
#define GETOPT_ENTRY(NAME, POSIXLY_CORRECT) \
|
||||
int \
|
||||
NAME (int argc, char *const *argv, const char *optstring) \
|
||||
{ \
|
||||
return _getopt_internal (argc, (char **)argv, optstring, \
|
||||
0, 0, 0, POSIXLY_CORRECT); \
|
||||
}
|
||||
|
||||
#ifdef _LIBC
|
||||
GETOPT_ENTRY(getopt, 0)
|
||||
GETOPT_ENTRY(__posix_getopt, 1)
|
||||
#else
|
||||
GETOPT_ENTRY(getopt, 1)
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef TEST
|
||||
|
||||
/* Compile with -DTEST to make an executable for use in testing
|
||||
the above definition of 'getopt'. */
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int c;
|
||||
int digit_optind = 0;
|
||||
|
||||
while (1)
|
||||
{
|
||||
int this_option_optind = optind ? optind : 1;
|
||||
|
||||
c = getopt (argc, argv, "abc:d:0123456789");
|
||||
if (c == -1)
|
||||
break;
|
||||
|
||||
switch (c)
|
||||
{
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
case '7':
|
||||
case '8':
|
||||
case '9':
|
||||
if (digit_optind != 0 && digit_optind != this_option_optind)
|
||||
printf ("digits occur in two different argv-elements.\n");
|
||||
digit_optind = this_option_optind;
|
||||
printf ("option %c\n", c);
|
||||
break;
|
||||
|
||||
case 'a':
|
||||
printf ("option a\n");
|
||||
break;
|
||||
|
||||
case 'b':
|
||||
printf ("option b\n");
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
printf ("option c with value '%s'\n", optarg);
|
||||
break;
|
||||
|
||||
case '?':
|
||||
break;
|
||||
|
||||
default:
|
||||
printf ("?? getopt returned character code 0%o ??\n", c);
|
||||
}
|
||||
}
|
||||
|
||||
if (optind < argc)
|
||||
{
|
||||
printf ("non-option ARGV-elements: ");
|
||||
while (optind < argc)
|
||||
printf ("%s ", argv[optind++]);
|
||||
printf ("\n");
|
||||
}
|
||||
|
||||
exit (0);
|
||||
}
|
||||
|
||||
#endif /* TEST */
|
|
@ -0,0 +1,61 @@
|
|||
/* Declarations for getopt.
|
||||
Copyright (C) 1989-2018 Free Software Foundation, Inc.
|
||||
This file is part of gnulib.
|
||||
Unlike most of the getopt implementation, it is NOT shared
|
||||
with the GNU C Library, which supplies a different version of
|
||||
this file.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Lesser General Public License as
|
||||
published by the Free Software Foundation; either version 2.1 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
This file is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with gnulib; if not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _@GUARD_PREFIX@_GETOPT_H
|
||||
|
||||
#if __GNUC__ >= 3
|
||||
@PRAGMA_SYSTEM_HEADER@
|
||||
#endif
|
||||
@PRAGMA_COLUMNS@
|
||||
|
||||
/* The include_next requires a split double-inclusion guard. We must
|
||||
also inform the replacement unistd.h to not recursively use
|
||||
<getopt.h>; our definitions will be present soon enough. */
|
||||
#if @HAVE_GETOPT_H@
|
||||
# define _GL_SYSTEM_GETOPT
|
||||
# @INCLUDE_NEXT@ @NEXT_GETOPT_H@
|
||||
# undef _GL_SYSTEM_GETOPT
|
||||
#endif
|
||||
|
||||
#define _@GUARD_PREFIX@_GETOPT_H 1
|
||||
|
||||
/* Standalone applications should #define __GETOPT_PREFIX to an
|
||||
identifier that prefixes the external functions and variables
|
||||
defined in getopt-core.h and getopt-ext.h. When this happens,
|
||||
include the headers that might declare getopt so that they will not
|
||||
cause confusion if included after this file (if the system had
|
||||
<getopt.h>, we have already included it). */
|
||||
#if defined __GETOPT_PREFIX
|
||||
# if !@HAVE_GETOPT_H@
|
||||
# define __need_system_stdlib_h
|
||||
# include <stdlib.h>
|
||||
# undef __need_system_stdlib_h
|
||||
# include <stdio.h>
|
||||
# include <unistd.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* The definition of _GL_ARG_NONNULL is copied here. */
|
||||
|
||||
#include <getopt-cdefs.h>
|
||||
#include <getopt-pfx-core.h>
|
||||
#include <getopt-pfx-ext.h>
|
||||
|
||||
#endif /* _@GUARD_PREFIX@_GETOPT_H */
|
|
@ -0,0 +1,159 @@
|
|||
/* getopt_long and getopt_long_only entry points for GNU getopt.
|
||||
Copyright (C) 1987-2018 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library and is also part of gnulib.
|
||||
Patches to this file should be submitted to both projects.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, see
|
||||
<https://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _LIBC
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "getopt.h"
|
||||
#include "getopt_int.h"
|
||||
|
||||
int
|
||||
getopt_long (int argc, char *__getopt_argv_const *argv, const char *options,
|
||||
const struct option *long_options, int *opt_index)
|
||||
{
|
||||
return _getopt_internal (argc, (char **) argv, options, long_options,
|
||||
opt_index, 0, 0);
|
||||
}
|
||||
|
||||
int
|
||||
_getopt_long_r (int argc, char **argv, const char *options,
|
||||
const struct option *long_options, int *opt_index,
|
||||
struct _getopt_data *d)
|
||||
{
|
||||
return _getopt_internal_r (argc, argv, options, long_options, opt_index,
|
||||
0, d, 0);
|
||||
}
|
||||
|
||||
/* Like getopt_long, but '-' as well as '--' can indicate a long option.
|
||||
If an option that starts with '-' (not '--') doesn't match a long option,
|
||||
but does match a short option, it is parsed as a short option
|
||||
instead. */
|
||||
|
||||
int
|
||||
getopt_long_only (int argc, char *__getopt_argv_const *argv,
|
||||
const char *options,
|
||||
const struct option *long_options, int *opt_index)
|
||||
{
|
||||
return _getopt_internal (argc, (char **) argv, options, long_options,
|
||||
opt_index, 1, 0);
|
||||
}
|
||||
|
||||
int
|
||||
_getopt_long_only_r (int argc, char **argv, const char *options,
|
||||
const struct option *long_options, int *opt_index,
|
||||
struct _getopt_data *d)
|
||||
{
|
||||
return _getopt_internal_r (argc, argv, options, long_options, opt_index,
|
||||
1, d, 0);
|
||||
}
|
||||
|
||||
|
||||
#ifdef TEST
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int c;
|
||||
int digit_optind = 0;
|
||||
|
||||
while (1)
|
||||
{
|
||||
int this_option_optind = optind ? optind : 1;
|
||||
int option_index = 0;
|
||||
static const struct option long_options[] =
|
||||
{
|
||||
{"add", 1, 0, 0},
|
||||
{"append", 0, 0, 0},
|
||||
{"delete", 1, 0, 0},
|
||||
{"verbose", 0, 0, 0},
|
||||
{"create", 0, 0, 0},
|
||||
{"file", 1, 0, 0},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
c = getopt_long (argc, argv, "abc:d:0123456789",
|
||||
long_options, &option_index);
|
||||
if (c == -1)
|
||||
break;
|
||||
|
||||
switch (c)
|
||||
{
|
||||
case 0:
|
||||
printf ("option %s", long_options[option_index].name);
|
||||
if (optarg)
|
||||
printf (" with arg %s", optarg);
|
||||
printf ("\n");
|
||||
break;
|
||||
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
case '7':
|
||||
case '8':
|
||||
case '9':
|
||||
if (digit_optind != 0 && digit_optind != this_option_optind)
|
||||
printf ("digits occur in two different argv-elements.\n");
|
||||
digit_optind = this_option_optind;
|
||||
printf ("option %c\n", c);
|
||||
break;
|
||||
|
||||
case 'a':
|
||||
printf ("option a\n");
|
||||
break;
|
||||
|
||||
case 'b':
|
||||
printf ("option b\n");
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
printf ("option c with value '%s'\n", optarg);
|
||||
break;
|
||||
|
||||
case 'd':
|
||||
printf ("option d with value '%s'\n", optarg);
|
||||
break;
|
||||
|
||||
case '?':
|
||||
break;
|
||||
|
||||
default:
|
||||
printf ("?? getopt returned character code 0%o ??\n", c);
|
||||
}
|
||||
}
|
||||
|
||||
if (optind < argc)
|
||||
{
|
||||
printf ("non-option ARGV-elements: ");
|
||||
while (optind < argc)
|
||||
printf ("%s ", argv[optind++]);
|
||||
printf ("\n");
|
||||
}
|
||||
|
||||
exit (0);
|
||||
}
|
||||
|
||||
#endif /* TEST */
|
|
@ -0,0 +1,118 @@
|
|||
/* Internal declarations for getopt.
|
||||
Copyright (C) 1989-2018 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library and is also part of gnulib.
|
||||
Patches to this file should be submitted to both projects.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, see
|
||||
<https://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _GETOPT_INT_H
|
||||
#define _GETOPT_INT_H 1
|
||||
|
||||
#include <getopt.h>
|
||||
|
||||
extern int _getopt_internal (int ___argc, char **___argv,
|
||||
const char *__shortopts,
|
||||
const struct option *__longopts, int *__longind,
|
||||
int __long_only, int __posixly_correct);
|
||||
|
||||
|
||||
/* Reentrant versions which can handle parsing multiple argument
|
||||
vectors at the same time. */
|
||||
|
||||
/* Describe how to deal with options that follow non-option ARGV-elements.
|
||||
|
||||
REQUIRE_ORDER means don't recognize them as options; stop option
|
||||
processing when the first non-option is seen. This is what POSIX
|
||||
specifies should happen.
|
||||
|
||||
PERMUTE means permute the contents of ARGV as we scan, so that
|
||||
eventually all the non-options are at the end. This allows options
|
||||
to be given in any order, even with programs that were not written
|
||||
to expect this.
|
||||
|
||||
RETURN_IN_ORDER is an option available to programs that were
|
||||
written to expect options and other ARGV-elements in any order
|
||||
and that care about the ordering of the two. We describe each
|
||||
non-option ARGV-element as if it were the argument of an option
|
||||
with character code 1.
|
||||
|
||||
The special argument '--' forces an end of option-scanning regardless
|
||||
of the value of 'ordering'. In the case of RETURN_IN_ORDER, only
|
||||
'--' can cause 'getopt' to return -1 with 'optind' != ARGC. */
|
||||
|
||||
enum __ord
|
||||
{
|
||||
REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
|
||||
};
|
||||
|
||||
/* Data type for reentrant functions. */
|
||||
struct _getopt_data
|
||||
{
|
||||
/* These have exactly the same meaning as the corresponding global
|
||||
variables, except that they are used for the reentrant
|
||||
versions of getopt. */
|
||||
int optind;
|
||||
int opterr;
|
||||
int optopt;
|
||||
char *optarg;
|
||||
|
||||
/* Internal members. */
|
||||
|
||||
/* True if the internal members have been initialized. */
|
||||
int __initialized;
|
||||
|
||||
/* The next char to be scanned in the option-element
|
||||
in which the last option character we returned was found.
|
||||
This allows us to pick up the scan where we left off.
|
||||
|
||||
If this is zero, or a null string, it means resume the scan
|
||||
by advancing to the next ARGV-element. */
|
||||
char *__nextchar;
|
||||
|
||||
/* See __ord above. */
|
||||
enum __ord __ordering;
|
||||
|
||||
/* Handle permutation of arguments. */
|
||||
|
||||
/* Describe the part of ARGV that contains non-options that have
|
||||
been skipped. 'first_nonopt' is the index in ARGV of the first
|
||||
of them; 'last_nonopt' is the index after the last of them. */
|
||||
|
||||
int __first_nonopt;
|
||||
int __last_nonopt;
|
||||
};
|
||||
|
||||
/* The initializer is necessary to set OPTIND and OPTERR to their
|
||||
default values and to clear the initialization flag. */
|
||||
#define _GETOPT_DATA_INITIALIZER { 1, 1 }
|
||||
|
||||
extern int _getopt_internal_r (int ___argc, char **___argv,
|
||||
const char *__shortopts,
|
||||
const struct option *__longopts, int *__longind,
|
||||
int __long_only, struct _getopt_data *__data,
|
||||
int __posixly_correct);
|
||||
|
||||
extern int _getopt_long_r (int ___argc, char **___argv,
|
||||
const char *__shortopts,
|
||||
const struct option *__longopts, int *__longind,
|
||||
struct _getopt_data *__data);
|
||||
|
||||
extern int _getopt_long_only_r (int ___argc, char **___argv,
|
||||
const char *__shortopts,
|
||||
const struct option *__longopts,
|
||||
int *__longind,
|
||||
struct _getopt_data *__data);
|
||||
|
||||
#endif /* getopt_int.h */
|
|
@ -0,0 +1,294 @@
|
|||
/* Convenience header for conditional use of GNU <libintl.h>.
|
||||
Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2018 Free Software
|
||||
Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License along
|
||||
with this program; if not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _LIBGETTEXT_H
|
||||
#define _LIBGETTEXT_H 1
|
||||
|
||||
/* NLS can be disabled through the configure --disable-nls option
|
||||
or through "#define ENABLE NLS 0" before including this file. */
|
||||
#if defined ENABLE_NLS && ENABLE_NLS
|
||||
|
||||
/* Get declarations of GNU message catalog functions. */
|
||||
# include <libintl.h>
|
||||
|
||||
/* You can set the DEFAULT_TEXT_DOMAIN macro to specify the domain used by
|
||||
the gettext() and ngettext() macros. This is an alternative to calling
|
||||
textdomain(), and is useful for libraries. */
|
||||
# ifdef DEFAULT_TEXT_DOMAIN
|
||||
# undef gettext
|
||||
# define gettext(Msgid) \
|
||||
dgettext (DEFAULT_TEXT_DOMAIN, Msgid)
|
||||
# undef ngettext
|
||||
# define ngettext(Msgid1, Msgid2, N) \
|
||||
dngettext (DEFAULT_TEXT_DOMAIN, Msgid1, Msgid2, N)
|
||||
# endif
|
||||
|
||||
#else
|
||||
|
||||
/* Solaris /usr/include/locale.h includes /usr/include/libintl.h, which
|
||||
chokes if dcgettext is defined as a macro. So include it now, to make
|
||||
later inclusions of <locale.h> a NOP. We don't include <libintl.h>
|
||||
as well because people using "gettext.h" will not include <libintl.h>,
|
||||
and also including <libintl.h> would fail on SunOS 4, whereas <locale.h>
|
||||
is OK. */
|
||||
#if defined(__sun)
|
||||
# include <locale.h>
|
||||
#endif
|
||||
|
||||
/* Many header files from the libstdc++ coming with g++ 3.3 or newer include
|
||||
<libintl.h>, which chokes if dcgettext is defined as a macro. So include
|
||||
it now, to make later inclusions of <libintl.h> a NOP. */
|
||||
#if defined(__cplusplus) && defined(__GNUG__) && (__GNUC__ >= 3)
|
||||
# include <cstdlib>
|
||||
# if (__GLIBC__ >= 2 && !defined __UCLIBC__) || _GLIBCXX_HAVE_LIBINTL_H
|
||||
# include <libintl.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Disabled NLS.
|
||||
The casts to 'const char *' serve the purpose of producing warnings
|
||||
for invalid uses of the value returned from these functions.
|
||||
On pre-ANSI systems without 'const', the config.h file is supposed to
|
||||
contain "#define const". */
|
||||
# undef gettext
|
||||
# define gettext(Msgid) ((const char *) (Msgid))
|
||||
# undef dgettext
|
||||
# define dgettext(Domainname, Msgid) ((void) (Domainname), gettext (Msgid))
|
||||
# undef dcgettext
|
||||
# define dcgettext(Domainname, Msgid, Category) \
|
||||
((void) (Category), dgettext (Domainname, Msgid))
|
||||
# undef ngettext
|
||||
# define ngettext(Msgid1, Msgid2, N) \
|
||||
((N) == 1 \
|
||||
? ((void) (Msgid2), (const char *) (Msgid1)) \
|
||||
: ((void) (Msgid1), (const char *) (Msgid2)))
|
||||
# undef dngettext
|
||||
# define dngettext(Domainname, Msgid1, Msgid2, N) \
|
||||
((void) (Domainname), ngettext (Msgid1, Msgid2, N))
|
||||
# undef dcngettext
|
||||
# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \
|
||||
((void) (Category), dngettext (Domainname, Msgid1, Msgid2, N))
|
||||
# undef textdomain
|
||||
# define textdomain(Domainname) ((const char *) (Domainname))
|
||||
# undef bindtextdomain
|
||||
# define bindtextdomain(Domainname, Dirname) \
|
||||
((void) (Domainname), (const char *) (Dirname))
|
||||
# undef bind_textdomain_codeset
|
||||
# define bind_textdomain_codeset(Domainname, Codeset) \
|
||||
((void) (Domainname), (const char *) (Codeset))
|
||||
|
||||
#endif
|
||||
|
||||
/* Prefer gnulib's setlocale override over libintl's setlocale override. */
|
||||
#ifdef GNULIB_defined_setlocale
|
||||
# undef setlocale
|
||||
# define setlocale rpl_setlocale
|
||||
#endif
|
||||
|
||||
/* A pseudo function call that serves as a marker for the automated
|
||||
extraction of messages, but does not call gettext(). The run-time
|
||||
translation is done at a different place in the code.
|
||||
The argument, String, should be a literal string. Concatenated strings
|
||||
and other string expressions won't work.
|
||||
The macro's expansion is not parenthesized, so that it is suitable as
|
||||
initializer for static 'char[]' or 'const char[]' variables. */
|
||||
#define gettext_noop(String) String
|
||||
|
||||
/* The separator between msgctxt and msgid in a .mo file. */
|
||||
#define GETTEXT_CONTEXT_GLUE "\004"
|
||||
|
||||
/* Pseudo function calls, taking a MSGCTXT and a MSGID instead of just a
|
||||
MSGID. MSGCTXT and MSGID must be string literals. MSGCTXT should be
|
||||
short and rarely need to change.
|
||||
The letter 'p' stands for 'particular' or 'special'. */
|
||||
#ifdef DEFAULT_TEXT_DOMAIN
|
||||
# define pgettext(Msgctxt, Msgid) \
|
||||
pgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES)
|
||||
#else
|
||||
# define pgettext(Msgctxt, Msgid) \
|
||||
pgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES)
|
||||
#endif
|
||||
#define dpgettext(Domainname, Msgctxt, Msgid) \
|
||||
pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES)
|
||||
#define dcpgettext(Domainname, Msgctxt, Msgid, Category) \
|
||||
pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, Category)
|
||||
#ifdef DEFAULT_TEXT_DOMAIN
|
||||
# define npgettext(Msgctxt, Msgid, MsgidPlural, N) \
|
||||
npgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES)
|
||||
#else
|
||||
# define npgettext(Msgctxt, Msgid, MsgidPlural, N) \
|
||||
npgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES)
|
||||
#endif
|
||||
#define dnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N) \
|
||||
npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES)
|
||||
#define dcnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N, Category) \
|
||||
npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, Category)
|
||||
|
||||
#ifdef __GNUC__
|
||||
__inline
|
||||
#else
|
||||
#ifdef __cplusplus
|
||||
inline
|
||||
#endif
|
||||
#endif
|
||||
static const char *
|
||||
pgettext_aux (const char *domain,
|
||||
const char *msg_ctxt_id, const char *msgid,
|
||||
int category)
|
||||
{
|
||||
const char *translation = dcgettext (domain, msg_ctxt_id, category);
|
||||
if (translation == msg_ctxt_id)
|
||||
return msgid;
|
||||
else
|
||||
return translation;
|
||||
}
|
||||
|
||||
#ifdef __GNUC__
|
||||
__inline
|
||||
#else
|
||||
#ifdef __cplusplus
|
||||
inline
|
||||
#endif
|
||||
#endif
|
||||
static const char *
|
||||
npgettext_aux (const char *domain,
|
||||
const char *msg_ctxt_id, const char *msgid,
|
||||
const char *msgid_plural, unsigned long int n,
|
||||
int category)
|
||||
{
|
||||
const char *translation =
|
||||
dcngettext (domain, msg_ctxt_id, msgid_plural, n, category);
|
||||
if (translation == msg_ctxt_id || translation == msgid_plural)
|
||||
return (n == 1 ? msgid : msgid_plural);
|
||||
else
|
||||
return translation;
|
||||
}
|
||||
|
||||
/* The same thing extended for non-constant arguments. Here MSGCTXT and MSGID
|
||||
can be arbitrary expressions. But for string literals these macros are
|
||||
less efficient than those above. */
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#if (((__GNUC__ >= 3 || __GNUG__ >= 2) && !defined __STRICT_ANSI__) \
|
||||
/* || __STDC_VERSION__ == 199901L
|
||||
|| (__STDC_VERSION__ >= 201112L && !defined __STDC_NO_VLA__) */ )
|
||||
# define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 1
|
||||
#else
|
||||
# define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 0
|
||||
#endif
|
||||
|
||||
#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#define pgettext_expr(Msgctxt, Msgid) \
|
||||
dcpgettext_expr (NULL, Msgctxt, Msgid, LC_MESSAGES)
|
||||
#define dpgettext_expr(Domainname, Msgctxt, Msgid) \
|
||||
dcpgettext_expr (Domainname, Msgctxt, Msgid, LC_MESSAGES)
|
||||
|
||||
#ifdef __GNUC__
|
||||
__inline
|
||||
#else
|
||||
#ifdef __cplusplus
|
||||
inline
|
||||
#endif
|
||||
#endif
|
||||
static const char *
|
||||
dcpgettext_expr (const char *domain,
|
||||
const char *msgctxt, const char *msgid,
|
||||
int category)
|
||||
{
|
||||
size_t msgctxt_len = strlen (msgctxt) + 1;
|
||||
size_t msgid_len = strlen (msgid) + 1;
|
||||
const char *translation;
|
||||
#if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
|
||||
char msg_ctxt_id[msgctxt_len + msgid_len];
|
||||
#else
|
||||
char buf[1024];
|
||||
char *msg_ctxt_id =
|
||||
(msgctxt_len + msgid_len <= sizeof (buf)
|
||||
? buf
|
||||
: (char *) malloc (msgctxt_len + msgid_len));
|
||||
if (msg_ctxt_id != NULL)
|
||||
#endif
|
||||
{
|
||||
int found_translation;
|
||||
memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1);
|
||||
msg_ctxt_id[msgctxt_len - 1] = '\004';
|
||||
memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len);
|
||||
translation = dcgettext (domain, msg_ctxt_id, category);
|
||||
found_translation = (translation != msg_ctxt_id);
|
||||
#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
|
||||
if (msg_ctxt_id != buf)
|
||||
free (msg_ctxt_id);
|
||||
#endif
|
||||
if (found_translation)
|
||||
return translation;
|
||||
}
|
||||
return msgid;
|
||||
}
|
||||
|
||||
#define npgettext_expr(Msgctxt, Msgid, MsgidPlural, N) \
|
||||
dcnpgettext_expr (NULL, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES)
|
||||
#define dnpgettext_expr(Domainname, Msgctxt, Msgid, MsgidPlural, N) \
|
||||
dcnpgettext_expr (Domainname, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES)
|
||||
|
||||
#ifdef __GNUC__
|
||||
__inline
|
||||
#else
|
||||
#ifdef __cplusplus
|
||||
inline
|
||||
#endif
|
||||
#endif
|
||||
static const char *
|
||||
dcnpgettext_expr (const char *domain,
|
||||
const char *msgctxt, const char *msgid,
|
||||
const char *msgid_plural, unsigned long int n,
|
||||
int category)
|
||||
{
|
||||
size_t msgctxt_len = strlen (msgctxt) + 1;
|
||||
size_t msgid_len = strlen (msgid) + 1;
|
||||
const char *translation;
|
||||
#if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
|
||||
char msg_ctxt_id[msgctxt_len + msgid_len];
|
||||
#else
|
||||
char buf[1024];
|
||||
char *msg_ctxt_id =
|
||||
(msgctxt_len + msgid_len <= sizeof (buf)
|
||||
? buf
|
||||
: (char *) malloc (msgctxt_len + msgid_len));
|
||||
if (msg_ctxt_id != NULL)
|
||||
#endif
|
||||
{
|
||||
int found_translation;
|
||||
memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1);
|
||||
msg_ctxt_id[msgctxt_len - 1] = '\004';
|
||||
memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len);
|
||||
translation = dcngettext (domain, msg_ctxt_id, msgid_plural, n, category);
|
||||
found_translation = !(translation == msg_ctxt_id || translation == msgid_plural);
|
||||
#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
|
||||
if (msg_ctxt_id != buf)
|
||||
free (msg_ctxt_id);
|
||||
#endif
|
||||
if (found_translation)
|
||||
return translation;
|
||||
}
|
||||
return (n == 1 ? msgid : msgid_plural);
|
||||
}
|
||||
|
||||
#endif /* _LIBGETTEXT_H */
|
|
@ -0,0 +1,56 @@
|
|||
/* malloc() function that is glibc compatible.
|
||||
|
||||
Copyright (C) 1997-1998, 2006-2007, 2009-2018 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program; if not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
/* written by Jim Meyering and Bruno Haible */
|
||||
|
||||
#define _GL_USE_STDLIB_ALLOC 1
|
||||
#include <config.h>
|
||||
/* Only the AC_FUNC_MALLOC macro defines 'malloc' already in config.h. */
|
||||
#ifdef malloc
|
||||
# define NEED_MALLOC_GNU 1
|
||||
# undef malloc
|
||||
/* Whereas the gnulib module 'malloc-gnu' defines HAVE_MALLOC_GNU. */
|
||||
#elif GNULIB_MALLOC_GNU && !HAVE_MALLOC_GNU
|
||||
# define NEED_MALLOC_GNU 1
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
/* Allocate an N-byte block of memory from the heap.
|
||||
If N is zero, allocate a 1-byte block. */
|
||||
|
||||
void *
|
||||
rpl_malloc (size_t n)
|
||||
{
|
||||
void *result;
|
||||
|
||||
#if NEED_MALLOC_GNU
|
||||
if (n == 0)
|
||||
n = 1;
|
||||
#endif
|
||||
|
||||
result = malloc (n);
|
||||
|
||||
#if !HAVE_MALLOC_POSIX
|
||||
if (result == NULL)
|
||||
errno = ENOMEM;
|
||||
#endif
|
||||
|
||||
return result;
|
||||
}
|
|
@ -0,0 +1,129 @@
|
|||
/* Invalid parameter handler for MSVC runtime libraries.
|
||||
Copyright (C) 2011-2018 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License along
|
||||
with this program; if not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
/* Specification. */
|
||||
#include "msvc-inval.h"
|
||||
|
||||
#if HAVE_MSVC_INVALID_PARAMETER_HANDLER \
|
||||
&& !(MSVC_INVALID_PARAMETER_HANDLING == SANE_LIBRARY_HANDLING)
|
||||
|
||||
/* Get _invalid_parameter_handler type and _set_invalid_parameter_handler
|
||||
declaration. */
|
||||
# include <stdlib.h>
|
||||
|
||||
# if MSVC_INVALID_PARAMETER_HANDLING == DEFAULT_HANDLING
|
||||
|
||||
static void __cdecl
|
||||
gl_msvc_invalid_parameter_handler (const wchar_t *expression,
|
||||
const wchar_t *function,
|
||||
const wchar_t *file,
|
||||
unsigned int line,
|
||||
uintptr_t dummy)
|
||||
{
|
||||
}
|
||||
|
||||
# else
|
||||
|
||||
/* Get declarations of the native Windows API functions. */
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# include <windows.h>
|
||||
|
||||
# if defined _MSC_VER
|
||||
|
||||
static void __cdecl
|
||||
gl_msvc_invalid_parameter_handler (const wchar_t *expression,
|
||||
const wchar_t *function,
|
||||
const wchar_t *file,
|
||||
unsigned int line,
|
||||
uintptr_t dummy)
|
||||
{
|
||||
RaiseException (STATUS_GNULIB_INVALID_PARAMETER, 0, 0, NULL);
|
||||
}
|
||||
|
||||
# else
|
||||
|
||||
/* An index to thread-local storage. */
|
||||
static DWORD tls_index;
|
||||
static int tls_initialized /* = 0 */;
|
||||
|
||||
/* Used as a fallback only. */
|
||||
static struct gl_msvc_inval_per_thread not_per_thread;
|
||||
|
||||
struct gl_msvc_inval_per_thread *
|
||||
gl_msvc_inval_current (void)
|
||||
{
|
||||
if (!tls_initialized)
|
||||
{
|
||||
tls_index = TlsAlloc ();
|
||||
tls_initialized = 1;
|
||||
}
|
||||
if (tls_index == TLS_OUT_OF_INDEXES)
|
||||
/* TlsAlloc had failed. */
|
||||
return ¬_per_thread;
|
||||
else
|
||||
{
|
||||
struct gl_msvc_inval_per_thread *pointer =
|
||||
(struct gl_msvc_inval_per_thread *) TlsGetValue (tls_index);
|
||||
if (pointer == NULL)
|
||||
{
|
||||
/* First call. Allocate a new 'struct gl_msvc_inval_per_thread'. */
|
||||
pointer =
|
||||
(struct gl_msvc_inval_per_thread *)
|
||||
malloc (sizeof (struct gl_msvc_inval_per_thread));
|
||||
if (pointer == NULL)
|
||||
/* Could not allocate memory. Use the global storage. */
|
||||
pointer = ¬_per_thread;
|
||||
TlsSetValue (tls_index, pointer);
|
||||
}
|
||||
return pointer;
|
||||
}
|
||||
}
|
||||
|
||||
static void __cdecl
|
||||
gl_msvc_invalid_parameter_handler (const wchar_t *expression,
|
||||
const wchar_t *function,
|
||||
const wchar_t *file,
|
||||
unsigned int line,
|
||||
uintptr_t dummy)
|
||||
{
|
||||
struct gl_msvc_inval_per_thread *current = gl_msvc_inval_current ();
|
||||
if (current->restart_valid)
|
||||
longjmp (current->restart, 1);
|
||||
else
|
||||
/* An invalid parameter notification from outside the gnulib code.
|
||||
Give the caller a chance to intervene. */
|
||||
RaiseException (STATUS_GNULIB_INVALID_PARAMETER, 0, 0, NULL);
|
||||
}
|
||||
|
||||
# endif
|
||||
|
||||
# endif
|
||||
|
||||
static int gl_msvc_inval_initialized /* = 0 */;
|
||||
|
||||
void
|
||||
gl_msvc_inval_ensure_handler (void)
|
||||
{
|
||||
if (gl_msvc_inval_initialized == 0)
|
||||
{
|
||||
_set_invalid_parameter_handler (gl_msvc_invalid_parameter_handler);
|
||||
gl_msvc_inval_initialized = 1;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
|
@ -0,0 +1,222 @@
|
|||
/* Invalid parameter handler for MSVC runtime libraries.
|
||||
Copyright (C) 2011-2018 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License along
|
||||
with this program; if not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _MSVC_INVAL_H
|
||||
#define _MSVC_INVAL_H
|
||||
|
||||
/* With MSVC runtime libraries with the "invalid parameter handler" concept,
|
||||
functions like fprintf(), dup2(), or close() crash when the caller passes
|
||||
an invalid argument. But POSIX wants error codes (such as EINVAL or EBADF)
|
||||
instead.
|
||||
This file defines macros that turn such an invalid parameter notification
|
||||
into a non-local exit. An error code can then be produced at the target
|
||||
of this exit. You can thus write code like
|
||||
|
||||
TRY_MSVC_INVAL
|
||||
{
|
||||
<Code that can trigger an invalid parameter notification
|
||||
but does not do 'return', 'break', 'continue', nor 'goto'.>
|
||||
}
|
||||
CATCH_MSVC_INVAL
|
||||
{
|
||||
<Code that handles an invalid parameter notification
|
||||
but does not do 'return', 'break', 'continue', nor 'goto'.>
|
||||
}
|
||||
DONE_MSVC_INVAL;
|
||||
|
||||
This entire block expands to a single statement.
|
||||
|
||||
The handling of invalid parameters can be done in three ways:
|
||||
|
||||
* The default way, which is reasonable for programs (not libraries):
|
||||
AC_DEFINE([MSVC_INVALID_PARAMETER_HANDLING], [DEFAULT_HANDLING])
|
||||
|
||||
* The way for libraries that make "hairy" calls (like close(-1), or
|
||||
fclose(fp) where fileno(fp) is closed, or simply getdtablesize()):
|
||||
AC_DEFINE([MSVC_INVALID_PARAMETER_HANDLING], [HAIRY_LIBRARY_HANDLING])
|
||||
|
||||
* The way for libraries that make no "hairy" calls:
|
||||
AC_DEFINE([MSVC_INVALID_PARAMETER_HANDLING], [SANE_LIBRARY_HANDLING])
|
||||
*/
|
||||
|
||||
#define DEFAULT_HANDLING 0
|
||||
#define HAIRY_LIBRARY_HANDLING 1
|
||||
#define SANE_LIBRARY_HANDLING 2
|
||||
|
||||
#if HAVE_MSVC_INVALID_PARAMETER_HANDLER \
|
||||
&& !(MSVC_INVALID_PARAMETER_HANDLING == SANE_LIBRARY_HANDLING)
|
||||
/* A native Windows platform with the "invalid parameter handler" concept,
|
||||
and either DEFAULT_HANDLING or HAIRY_LIBRARY_HANDLING. */
|
||||
|
||||
# if MSVC_INVALID_PARAMETER_HANDLING == DEFAULT_HANDLING
|
||||
/* Default handling. */
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
|
||||
/* Ensure that the invalid parameter handler in installed that just returns.
|
||||
Because we assume no other part of the program installs a different
|
||||
invalid parameter handler, this solution is multithread-safe. */
|
||||
extern void gl_msvc_inval_ensure_handler (void);
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
|
||||
# define TRY_MSVC_INVAL \
|
||||
do \
|
||||
{ \
|
||||
gl_msvc_inval_ensure_handler (); \
|
||||
if (1)
|
||||
# define CATCH_MSVC_INVAL \
|
||||
else
|
||||
# define DONE_MSVC_INVAL \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
# else
|
||||
/* Handling for hairy libraries. */
|
||||
|
||||
# include <excpt.h>
|
||||
|
||||
/* Gnulib can define its own status codes, as described in the page
|
||||
"Raising Software Exceptions" on microsoft.com
|
||||
<https://msdn.microsoft.com/en-us/library/het71c37.aspx>.
|
||||
Our status codes are composed of
|
||||
- 0xE0000000, mandatory for all user-defined status codes,
|
||||
- 0x474E550, a API identifier ("GNU"),
|
||||
- 0, 1, 2, ..., used to distinguish different status codes from the
|
||||
same API. */
|
||||
# define STATUS_GNULIB_INVALID_PARAMETER (0xE0000000 + 0x474E550 + 0)
|
||||
|
||||
# if defined _MSC_VER
|
||||
/* A compiler that supports __try/__except, as described in the page
|
||||
"try-except statement" on microsoft.com
|
||||
<https://msdn.microsoft.com/en-us/library/s58ftw19.aspx>.
|
||||
With __try/__except, we can use the multithread-safe exception handling. */
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
|
||||
/* Ensure that the invalid parameter handler in installed that raises a
|
||||
software exception with code STATUS_GNULIB_INVALID_PARAMETER.
|
||||
Because we assume no other part of the program installs a different
|
||||
invalid parameter handler, this solution is multithread-safe. */
|
||||
extern void gl_msvc_inval_ensure_handler (void);
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
|
||||
# define TRY_MSVC_INVAL \
|
||||
do \
|
||||
{ \
|
||||
gl_msvc_inval_ensure_handler (); \
|
||||
__try
|
||||
# define CATCH_MSVC_INVAL \
|
||||
__except (GetExceptionCode () == STATUS_GNULIB_INVALID_PARAMETER \
|
||||
? EXCEPTION_EXECUTE_HANDLER \
|
||||
: EXCEPTION_CONTINUE_SEARCH)
|
||||
# define DONE_MSVC_INVAL \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
# else
|
||||
/* Any compiler.
|
||||
We can only use setjmp/longjmp. */
|
||||
|
||||
# include <setjmp.h>
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
|
||||
struct gl_msvc_inval_per_thread
|
||||
{
|
||||
/* The restart that will resume execution at the code between
|
||||
CATCH_MSVC_INVAL and DONE_MSVC_INVAL. It is enabled only between
|
||||
TRY_MSVC_INVAL and CATCH_MSVC_INVAL. */
|
||||
jmp_buf restart;
|
||||
|
||||
/* Tells whether the contents of restart is valid. */
|
||||
int restart_valid;
|
||||
};
|
||||
|
||||
/* Ensure that the invalid parameter handler in installed that passes
|
||||
control to the gl_msvc_inval_restart if it is valid, or raises a
|
||||
software exception with code STATUS_GNULIB_INVALID_PARAMETER otherwise.
|
||||
Because we assume no other part of the program installs a different
|
||||
invalid parameter handler, this solution is multithread-safe. */
|
||||
extern void gl_msvc_inval_ensure_handler (void);
|
||||
|
||||
/* Return a pointer to the per-thread data for the current thread. */
|
||||
extern struct gl_msvc_inval_per_thread *gl_msvc_inval_current (void);
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
|
||||
# define TRY_MSVC_INVAL \
|
||||
do \
|
||||
{ \
|
||||
struct gl_msvc_inval_per_thread *msvc_inval_current; \
|
||||
gl_msvc_inval_ensure_handler (); \
|
||||
msvc_inval_current = gl_msvc_inval_current (); \
|
||||
/* First, initialize gl_msvc_inval_restart. */ \
|
||||
if (setjmp (msvc_inval_current->restart) == 0) \
|
||||
{ \
|
||||
/* Then, mark it as valid. */ \
|
||||
msvc_inval_current->restart_valid = 1;
|
||||
# define CATCH_MSVC_INVAL \
|
||||
/* Execution completed. \
|
||||
Mark gl_msvc_inval_restart as invalid. */ \
|
||||
msvc_inval_current->restart_valid = 0; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
/* Execution triggered an invalid parameter notification. \
|
||||
Mark gl_msvc_inval_restart as invalid. */ \
|
||||
msvc_inval_current->restart_valid = 0;
|
||||
# define DONE_MSVC_INVAL \
|
||||
} \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
# endif
|
||||
|
||||
# endif
|
||||
|
||||
#else
|
||||
/* A platform that does not need to the invalid parameter handler,
|
||||
or when SANE_LIBRARY_HANDLING is desired. */
|
||||
|
||||
/* The braces here avoid GCC warnings like
|
||||
"warning: suggest explicit braces to avoid ambiguous 'else'". */
|
||||
# define TRY_MSVC_INVAL \
|
||||
do \
|
||||
{ \
|
||||
if (1)
|
||||
# define CATCH_MSVC_INVAL \
|
||||
else
|
||||
# define DONE_MSVC_INVAL \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* _MSVC_INVAL_H */
|
|
@ -0,0 +1,51 @@
|
|||
/* Wrappers that don't throw invalid parameter notifications
|
||||
with MSVC runtime libraries.
|
||||
Copyright (C) 2011-2018 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License along
|
||||
with this program; if not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
/* Specification. */
|
||||
#include "msvc-nothrow.h"
|
||||
|
||||
/* Get declarations of the native Windows API functions. */
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
|
||||
#if HAVE_MSVC_INVALID_PARAMETER_HANDLER
|
||||
# include "msvc-inval.h"
|
||||
#endif
|
||||
|
||||
#undef _get_osfhandle
|
||||
|
||||
#if HAVE_MSVC_INVALID_PARAMETER_HANDLER
|
||||
intptr_t
|
||||
_gl_nothrow_get_osfhandle (int fd)
|
||||
{
|
||||
intptr_t result;
|
||||
|
||||
TRY_MSVC_INVAL
|
||||
{
|
||||
result = _get_osfhandle (fd);
|
||||
}
|
||||
CATCH_MSVC_INVAL
|
||||
{
|
||||
result = (intptr_t) INVALID_HANDLE_VALUE;
|
||||
}
|
||||
DONE_MSVC_INVAL;
|
||||
|
||||
return result;
|
||||
}
|
||||
#endif
|
|
@ -0,0 +1,43 @@
|
|||
/* Wrappers that don't throw invalid parameter notifications
|
||||
with MSVC runtime libraries.
|
||||
Copyright (C) 2011-2018 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License along
|
||||
with this program; if not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _MSVC_NOTHROW_H
|
||||
#define _MSVC_NOTHROW_H
|
||||
|
||||
/* With MSVC runtime libraries with the "invalid parameter handler" concept,
|
||||
functions like fprintf(), dup2(), or close() crash when the caller passes
|
||||
an invalid argument. But POSIX wants error codes (such as EINVAL or EBADF)
|
||||
instead.
|
||||
This file defines wrappers that turn such an invalid parameter notification
|
||||
into an error code. */
|
||||
|
||||
#if defined _WIN32 && ! defined __CYGWIN__
|
||||
|
||||
/* Get original declaration of _get_osfhandle. */
|
||||
# include <io.h>
|
||||
|
||||
# if HAVE_MSVC_INVALID_PARAMETER_HANDLER
|
||||
|
||||
/* Override _get_osfhandle. */
|
||||
extern intptr_t _gl_nothrow_get_osfhandle (int fd);
|
||||
# define _get_osfhandle _gl_nothrow_get_osfhandle
|
||||
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* _MSVC_NOTHROW_H */
|
|
@ -0,0 +1,136 @@
|
|||
/* Searching in a string.
|
||||
Copyright (C) 2008-2018 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
/* Specification. */
|
||||
#include <string.h>
|
||||
|
||||
/* Find the first occurrence of C in S. */
|
||||
void *
|
||||
rawmemchr (const void *s, int c_in)
|
||||
{
|
||||
/* On 32-bit hardware, choosing longword to be a 32-bit unsigned
|
||||
long instead of a 64-bit uintmax_t tends to give better
|
||||
performance. On 64-bit hardware, unsigned long is generally 64
|
||||
bits already. Change this typedef to experiment with
|
||||
performance. */
|
||||
typedef unsigned long int longword;
|
||||
|
||||
const unsigned char *char_ptr;
|
||||
const longword *longword_ptr;
|
||||
longword repeated_one;
|
||||
longword repeated_c;
|
||||
unsigned char c;
|
||||
|
||||
c = (unsigned char) c_in;
|
||||
|
||||
/* Handle the first few bytes by reading one byte at a time.
|
||||
Do this until CHAR_PTR is aligned on a longword boundary. */
|
||||
for (char_ptr = (const unsigned char *) s;
|
||||
(size_t) char_ptr % sizeof (longword) != 0;
|
||||
++char_ptr)
|
||||
if (*char_ptr == c)
|
||||
return (void *) char_ptr;
|
||||
|
||||
longword_ptr = (const longword *) char_ptr;
|
||||
|
||||
/* All these elucidatory comments refer to 4-byte longwords,
|
||||
but the theory applies equally well to any size longwords. */
|
||||
|
||||
/* Compute auxiliary longword values:
|
||||
repeated_one is a value which has a 1 in every byte.
|
||||
repeated_c has c in every byte. */
|
||||
repeated_one = 0x01010101;
|
||||
repeated_c = c | (c << 8);
|
||||
repeated_c |= repeated_c << 16;
|
||||
if (0xffffffffU < (longword) -1)
|
||||
{
|
||||
repeated_one |= repeated_one << 31 << 1;
|
||||
repeated_c |= repeated_c << 31 << 1;
|
||||
if (8 < sizeof (longword))
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 64; i < sizeof (longword) * 8; i *= 2)
|
||||
{
|
||||
repeated_one |= repeated_one << i;
|
||||
repeated_c |= repeated_c << i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Instead of the traditional loop which tests each byte, we will
|
||||
test a longword at a time. The tricky part is testing if *any of
|
||||
the four* bytes in the longword in question are equal to NUL or
|
||||
c. We first use an xor with repeated_c. This reduces the task
|
||||
to testing whether *any of the four* bytes in longword1 is zero.
|
||||
|
||||
We compute tmp =
|
||||
((longword1 - repeated_one) & ~longword1) & (repeated_one << 7).
|
||||
That is, we perform the following operations:
|
||||
1. Subtract repeated_one.
|
||||
2. & ~longword1.
|
||||
3. & a mask consisting of 0x80 in every byte.
|
||||
Consider what happens in each byte:
|
||||
- If a byte of longword1 is zero, step 1 and 2 transform it into 0xff,
|
||||
and step 3 transforms it into 0x80. A carry can also be propagated
|
||||
to more significant bytes.
|
||||
- If a byte of longword1 is nonzero, let its lowest 1 bit be at
|
||||
position k (0 <= k <= 7); so the lowest k bits are 0. After step 1,
|
||||
the byte ends in a single bit of value 0 and k bits of value 1.
|
||||
After step 2, the result is just k bits of value 1: 2^k - 1. After
|
||||
step 3, the result is 0. And no carry is produced.
|
||||
So, if longword1 has only non-zero bytes, tmp is zero.
|
||||
Whereas if longword1 has a zero byte, call j the position of the least
|
||||
significant zero byte. Then the result has a zero at positions 0, ...,
|
||||
j-1 and a 0x80 at position j. We cannot predict the result at the more
|
||||
significant bytes (positions j+1..3), but it does not matter since we
|
||||
already have a non-zero bit at position 8*j+7.
|
||||
|
||||
The test whether any byte in longword1 is zero is equivalent
|
||||
to testing whether tmp is nonzero.
|
||||
|
||||
This test can read beyond the end of a string, depending on where
|
||||
C_IN is encountered. However, this is considered safe since the
|
||||
initialization phase ensured that the read will be aligned,
|
||||
therefore, the read will not cross page boundaries and will not
|
||||
cause a fault. */
|
||||
|
||||
while (1)
|
||||
{
|
||||
longword longword1 = *longword_ptr ^ repeated_c;
|
||||
|
||||
if ((((longword1 - repeated_one) & ~longword1)
|
||||
& (repeated_one << 7)) != 0)
|
||||
break;
|
||||
longword_ptr++;
|
||||
}
|
||||
|
||||
char_ptr = (const unsigned char *) longword_ptr;
|
||||
|
||||
/* At this point, we know that one of the sizeof (longword) bytes
|
||||
starting at char_ptr is == c. On little-endian machines, we
|
||||
could determine the first such byte without any further memory
|
||||
accesses, just by looking at the tmp result from the last loop
|
||||
iteration. But this does not work on big-endian machines.
|
||||
Choose code that works in both cases. */
|
||||
|
||||
char_ptr = (unsigned char *) longword_ptr;
|
||||
while (*char_ptr != c)
|
||||
char_ptr++;
|
||||
return (void *) char_ptr;
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
# Suppress a valgrind message about use of uninitialized memory in rawmemchr().
|
||||
# This use is OK because it provides only a speedup.
|
||||
{
|
||||
rawmemchr-value4
|
||||
Memcheck:Value4
|
||||
fun:rawmemchr
|
||||
}
|
||||
{
|
||||
rawmemchr-value8
|
||||
Memcheck:Value8
|
||||
fun:rawmemchr
|
||||
}
|
|
@ -0,0 +1,588 @@
|
|||
/* Provide relocatable packages.
|
||||
Copyright (C) 2003-2006, 2008-2018 Free Software Foundation, Inc.
|
||||
Written by Bruno Haible <bruno@clisp.org>, 2003.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
|
||||
/* Tell glibc's <stdio.h> to provide a prototype for getline().
|
||||
This must come before <config.h> because <config.h> may include
|
||||
<features.h>, and once <features.h> has been included, it's too late. */
|
||||
#ifndef _GNU_SOURCE
|
||||
# define _GNU_SOURCE 1
|
||||
#endif
|
||||
|
||||
#define _GL_USE_STDLIB_ALLOC 1
|
||||
#include <config.h>
|
||||
|
||||
/* Specification. */
|
||||
#include "relocatable.h"
|
||||
|
||||
#if ENABLE_RELOCATABLE
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef NO_XMALLOC
|
||||
# define xmalloc malloc
|
||||
#else
|
||||
# include "xalloc.h"
|
||||
#endif
|
||||
|
||||
#if defined _WIN32 && !defined __CYGWIN__
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
#ifdef __EMX__
|
||||
# define INCL_DOS
|
||||
# include <os2.h>
|
||||
|
||||
# define strcmp stricmp
|
||||
# define strncmp strnicmp
|
||||
#endif
|
||||
|
||||
#if DEPENDS_ON_LIBCHARSET
|
||||
# include <libcharset.h>
|
||||
#endif
|
||||
#if DEPENDS_ON_LIBICONV && HAVE_ICONV
|
||||
# include <iconv.h>
|
||||
#endif
|
||||
#if DEPENDS_ON_LIBINTL && ENABLE_NLS
|
||||
# include <libintl.h>
|
||||
#endif
|
||||
|
||||
/* Faked cheap 'bool'. */
|
||||
#undef bool
|
||||
#undef false
|
||||
#undef true
|
||||
#define bool int
|
||||
#define false 0
|
||||
#define true 1
|
||||
|
||||
/* Pathname support.
|
||||
ISSLASH(C) tests whether C is a directory separator character.
|
||||
IS_PATH_WITH_DIR(P) tests whether P contains a directory specification.
|
||||
*/
|
||||
#if (defined _WIN32 && !defined __CYGWIN__) || defined __EMX__ || defined __DJGPP__
|
||||
/* Native Windows, OS/2, DOS */
|
||||
# define ISSLASH(C) ((C) == '/' || (C) == '\\')
|
||||
# define HAS_DEVICE(P) \
|
||||
((((P)[0] >= 'A' && (P)[0] <= 'Z') || ((P)[0] >= 'a' && (P)[0] <= 'z')) \
|
||||
&& (P)[1] == ':')
|
||||
# define IS_PATH_WITH_DIR(P) \
|
||||
(strchr (P, '/') != NULL || strchr (P, '\\') != NULL || HAS_DEVICE (P))
|
||||
# define FILE_SYSTEM_PREFIX_LEN(P) (HAS_DEVICE (P) ? 2 : 0)
|
||||
#else
|
||||
/* Unix */
|
||||
# define ISSLASH(C) ((C) == '/')
|
||||
# define IS_PATH_WITH_DIR(P) (strchr (P, '/') != NULL)
|
||||
# define FILE_SYSTEM_PREFIX_LEN(P) 0
|
||||
#endif
|
||||
|
||||
/* Whether to enable the more costly support for relocatable libraries.
|
||||
It allows libraries to be have been installed with a different original
|
||||
prefix than the program. But it is quite costly, especially on Cygwin
|
||||
platforms, see below. Therefore we enable it by default only on native
|
||||
Windows platforms. */
|
||||
#ifndef ENABLE_COSTLY_RELOCATABLE
|
||||
# if defined _WIN32 && !defined __CYGWIN__
|
||||
# define ENABLE_COSTLY_RELOCATABLE 1
|
||||
# else
|
||||
# define ENABLE_COSTLY_RELOCATABLE 0
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Original installation prefix. */
|
||||
static char *orig_prefix;
|
||||
static size_t orig_prefix_len;
|
||||
/* Current installation prefix. */
|
||||
static char *curr_prefix;
|
||||
static size_t curr_prefix_len;
|
||||
/* These prefixes do not end in a slash. Anything that will be concatenated
|
||||
to them must start with a slash. */
|
||||
|
||||
/* Sets the original and the current installation prefix of this module.
|
||||
Relocation simply replaces a pathname starting with the original prefix
|
||||
by the corresponding pathname with the current prefix instead. Both
|
||||
prefixes should be directory names without trailing slash (i.e. use ""
|
||||
instead of "/"). */
|
||||
static void
|
||||
set_this_relocation_prefix (const char *orig_prefix_arg,
|
||||
const char *curr_prefix_arg)
|
||||
{
|
||||
if (orig_prefix_arg != NULL && curr_prefix_arg != NULL
|
||||
/* Optimization: if orig_prefix and curr_prefix are equal, the
|
||||
relocation is a nop. */
|
||||
&& strcmp (orig_prefix_arg, curr_prefix_arg) != 0)
|
||||
{
|
||||
/* Duplicate the argument strings. */
|
||||
char *memory;
|
||||
|
||||
orig_prefix_len = strlen (orig_prefix_arg);
|
||||
curr_prefix_len = strlen (curr_prefix_arg);
|
||||
memory = (char *) xmalloc (orig_prefix_len + 1 + curr_prefix_len + 1);
|
||||
#ifdef NO_XMALLOC
|
||||
if (memory != NULL)
|
||||
#endif
|
||||
{
|
||||
memcpy (memory, orig_prefix_arg, orig_prefix_len + 1);
|
||||
orig_prefix = memory;
|
||||
memory += orig_prefix_len + 1;
|
||||
memcpy (memory, curr_prefix_arg, curr_prefix_len + 1);
|
||||
curr_prefix = memory;
|
||||
return;
|
||||
}
|
||||
}
|
||||
orig_prefix = NULL;
|
||||
curr_prefix = NULL;
|
||||
/* Don't worry about wasted memory here - this function is usually only
|
||||
called once. */
|
||||
}
|
||||
|
||||
/* Sets the original and the current installation prefix of the package.
|
||||
Relocation simply replaces a pathname starting with the original prefix
|
||||
by the corresponding pathname with the current prefix instead. Both
|
||||
prefixes should be directory names without trailing slash (i.e. use ""
|
||||
instead of "/"). */
|
||||
void
|
||||
set_relocation_prefix (const char *orig_prefix_arg, const char *curr_prefix_arg)
|
||||
{
|
||||
set_this_relocation_prefix (orig_prefix_arg, curr_prefix_arg);
|
||||
|
||||
/* Now notify all dependent libraries. */
|
||||
#if DEPENDS_ON_LIBCHARSET
|
||||
libcharset_set_relocation_prefix (orig_prefix_arg, curr_prefix_arg);
|
||||
#endif
|
||||
#if DEPENDS_ON_LIBICONV && HAVE_ICONV && _LIBICONV_VERSION >= 0x0109
|
||||
libiconv_set_relocation_prefix (orig_prefix_arg, curr_prefix_arg);
|
||||
#endif
|
||||
#if DEPENDS_ON_LIBINTL && ENABLE_NLS && defined libintl_set_relocation_prefix
|
||||
libintl_set_relocation_prefix (orig_prefix_arg, curr_prefix_arg);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !defined IN_LIBRARY || (defined PIC && defined INSTALLDIR && ENABLE_COSTLY_RELOCATABLE)
|
||||
|
||||
/* Convenience function:
|
||||
Computes the current installation prefix, based on the original
|
||||
installation prefix, the original installation directory of a particular
|
||||
file, and the current pathname of this file.
|
||||
Returns it, freshly allocated. Returns NULL upon failure. */
|
||||
#ifdef IN_LIBRARY
|
||||
#define compute_curr_prefix local_compute_curr_prefix
|
||||
static
|
||||
#endif
|
||||
char *
|
||||
compute_curr_prefix (const char *orig_installprefix,
|
||||
const char *orig_installdir,
|
||||
const char *curr_pathname)
|
||||
{
|
||||
char *curr_installdir;
|
||||
const char *rel_installdir;
|
||||
|
||||
if (curr_pathname == NULL)
|
||||
return NULL;
|
||||
|
||||
/* Determine the relative installation directory, relative to the prefix.
|
||||
This is simply the difference between orig_installprefix and
|
||||
orig_installdir. */
|
||||
if (strncmp (orig_installprefix, orig_installdir, strlen (orig_installprefix))
|
||||
!= 0)
|
||||
/* Shouldn't happen - nothing should be installed outside $(prefix). */
|
||||
return NULL;
|
||||
rel_installdir = orig_installdir + strlen (orig_installprefix);
|
||||
|
||||
/* Determine the current installation directory. */
|
||||
{
|
||||
const char *p_base = curr_pathname + FILE_SYSTEM_PREFIX_LEN (curr_pathname);
|
||||
const char *p = curr_pathname + strlen (curr_pathname);
|
||||
char *q;
|
||||
|
||||
while (p > p_base)
|
||||
{
|
||||
p--;
|
||||
if (ISSLASH (*p))
|
||||
break;
|
||||
}
|
||||
|
||||
q = (char *) xmalloc (p - curr_pathname + 1);
|
||||
#ifdef NO_XMALLOC
|
||||
if (q == NULL)
|
||||
return NULL;
|
||||
#endif
|
||||
memcpy (q, curr_pathname, p - curr_pathname);
|
||||
q[p - curr_pathname] = '\0';
|
||||
curr_installdir = q;
|
||||
}
|
||||
|
||||
/* Compute the current installation prefix by removing the trailing
|
||||
rel_installdir from it. */
|
||||
{
|
||||
const char *rp = rel_installdir + strlen (rel_installdir);
|
||||
const char *cp = curr_installdir + strlen (curr_installdir);
|
||||
const char *cp_base =
|
||||
curr_installdir + FILE_SYSTEM_PREFIX_LEN (curr_installdir);
|
||||
|
||||
while (rp > rel_installdir && cp > cp_base)
|
||||
{
|
||||
bool same = false;
|
||||
const char *rpi = rp;
|
||||
const char *cpi = cp;
|
||||
|
||||
while (rpi > rel_installdir && cpi > cp_base)
|
||||
{
|
||||
rpi--;
|
||||
cpi--;
|
||||
if (ISSLASH (*rpi) || ISSLASH (*cpi))
|
||||
{
|
||||
if (ISSLASH (*rpi) && ISSLASH (*cpi))
|
||||
same = true;
|
||||
break;
|
||||
}
|
||||
/* Do case-insensitive comparison if the file system is always or
|
||||
often case-insensitive. It's better to accept the comparison
|
||||
if the difference is only in case, rather than to fail. */
|
||||
#if defined _WIN32 || defined __CYGWIN__ || defined __EMX__ || defined __DJGPP__
|
||||
/* Native Windows, Cygwin, OS/2, DOS - case insignificant file system */
|
||||
if ((*rpi >= 'a' && *rpi <= 'z' ? *rpi - 'a' + 'A' : *rpi)
|
||||
!= (*cpi >= 'a' && *cpi <= 'z' ? *cpi - 'a' + 'A' : *cpi))
|
||||
break;
|
||||
#else
|
||||
if (*rpi != *cpi)
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
if (!same)
|
||||
break;
|
||||
/* The last pathname component was the same. opi and cpi now point
|
||||
to the slash before it. */
|
||||
rp = rpi;
|
||||
cp = cpi;
|
||||
}
|
||||
|
||||
if (rp > rel_installdir)
|
||||
{
|
||||
/* Unexpected: The curr_installdir does not end with rel_installdir. */
|
||||
free (curr_installdir);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
{
|
||||
size_t curr_prefix_len = cp - curr_installdir;
|
||||
char *curr_prefix;
|
||||
|
||||
curr_prefix = (char *) xmalloc (curr_prefix_len + 1);
|
||||
#ifdef NO_XMALLOC
|
||||
if (curr_prefix == NULL)
|
||||
{
|
||||
free (curr_installdir);
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
memcpy (curr_prefix, curr_installdir, curr_prefix_len);
|
||||
curr_prefix[curr_prefix_len] = '\0';
|
||||
|
||||
free (curr_installdir);
|
||||
|
||||
return curr_prefix;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* !IN_LIBRARY || PIC */
|
||||
|
||||
#if defined PIC && defined INSTALLDIR && ENABLE_COSTLY_RELOCATABLE
|
||||
|
||||
/* Full pathname of shared library, or NULL. */
|
||||
static char *shared_library_fullname;
|
||||
|
||||
#if defined _WIN32 && !defined __CYGWIN__
|
||||
/* Native Windows only.
|
||||
On Cygwin, it is better to use the Cygwin provided /proc interface, than
|
||||
to use native Windows API and cygwin_conv_to_posix_path, because it
|
||||
supports longer file names
|
||||
(see <https://cygwin.com/ml/cygwin/2011-01/msg00410.html>). */
|
||||
|
||||
/* Determine the full pathname of the shared library when it is loaded. */
|
||||
|
||||
BOOL WINAPI
|
||||
DllMain (HINSTANCE module_handle, DWORD event, LPVOID reserved)
|
||||
{
|
||||
(void) reserved;
|
||||
|
||||
if (event == DLL_PROCESS_ATTACH)
|
||||
{
|
||||
/* The DLL is being loaded into an application's address range. */
|
||||
static char location[MAX_PATH];
|
||||
|
||||
if (!GetModuleFileName (module_handle, location, sizeof (location)))
|
||||
/* Shouldn't happen. */
|
||||
return FALSE;
|
||||
|
||||
if (!IS_PATH_WITH_DIR (location))
|
||||
/* Shouldn't happen. */
|
||||
return FALSE;
|
||||
|
||||
shared_library_fullname = strdup (location);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#elif defined __EMX__
|
||||
|
||||
extern int _CRT_init (void);
|
||||
extern void _CRT_term (void);
|
||||
extern void __ctordtorInit (void);
|
||||
extern void __ctordtorTerm (void);
|
||||
|
||||
unsigned long _System
|
||||
_DLL_InitTerm (unsigned long hModule, unsigned long ulFlag)
|
||||
{
|
||||
static char location[CCHMAXPATH];
|
||||
|
||||
switch (ulFlag)
|
||||
{
|
||||
case 0:
|
||||
if (_CRT_init () == -1)
|
||||
return 0;
|
||||
|
||||
__ctordtorInit();
|
||||
|
||||
/* See http://cyberkinetica.homeunix.net/os2tk45/cp1/1247_L2H_DosQueryModuleNameSy.html
|
||||
for specification of DosQueryModuleName(). */
|
||||
if (DosQueryModuleName (hModule, sizeof (location), location))
|
||||
return 0;
|
||||
|
||||
_fnslashify (location);
|
||||
shared_library_fullname = strdup (location);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
__ctordtorTerm();
|
||||
|
||||
_CRT_term ();
|
||||
break;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
#else /* Unix */
|
||||
|
||||
static void
|
||||
find_shared_library_fullname ()
|
||||
{
|
||||
#if (defined __linux__ && (__GLIBC__ >= 2 || defined __UCLIBC__)) || defined __CYGWIN__
|
||||
/* Linux has /proc/self/maps. glibc 2 and uClibc have the getline()
|
||||
function.
|
||||
Cygwin >= 1.5 has /proc/self/maps and the getline() function too.
|
||||
But it is costly: ca. 0.3 ms on Linux, 3 ms on Cygwin 1.5, and 5 ms on
|
||||
Cygwin 1.7. */
|
||||
FILE *fp;
|
||||
|
||||
/* Open the current process' maps file. It describes one VMA per line. */
|
||||
fp = fopen ("/proc/self/maps", "r");
|
||||
if (fp)
|
||||
{
|
||||
unsigned long address = (unsigned long) &find_shared_library_fullname;
|
||||
for (;;)
|
||||
{
|
||||
unsigned long start, end;
|
||||
int c;
|
||||
|
||||
if (fscanf (fp, "%lx-%lx", &start, &end) != 2)
|
||||
break;
|
||||
if (address >= start && address <= end - 1)
|
||||
{
|
||||
/* Found it. Now see if this line contains a filename. */
|
||||
while (c = getc (fp), c != EOF && c != '\n' && c != '/')
|
||||
continue;
|
||||
if (c == '/')
|
||||
{
|
||||
size_t size;
|
||||
int len;
|
||||
|
||||
ungetc (c, fp);
|
||||
shared_library_fullname = NULL; size = 0;
|
||||
len = getline (&shared_library_fullname, &size, fp);
|
||||
if (len >= 0)
|
||||
{
|
||||
/* Success: filled shared_library_fullname. */
|
||||
if (len > 0 && shared_library_fullname[len - 1] == '\n')
|
||||
shared_library_fullname[len - 1] = '\0';
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
while (c = getc (fp), c != EOF && c != '\n')
|
||||
continue;
|
||||
}
|
||||
fclose (fp);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* Native Windows / EMX / Unix */
|
||||
|
||||
/* Return the full pathname of the current shared library.
|
||||
Return NULL if unknown.
|
||||
Guaranteed to work only on Linux, EMX, Cygwin, and native Windows. */
|
||||
static char *
|
||||
get_shared_library_fullname ()
|
||||
{
|
||||
#if !(defined _WIN32 && !defined __CYGWIN__) && !defined __EMX__
|
||||
static bool tried_find_shared_library_fullname;
|
||||
if (!tried_find_shared_library_fullname)
|
||||
{
|
||||
find_shared_library_fullname ();
|
||||
tried_find_shared_library_fullname = true;
|
||||
}
|
||||
#endif
|
||||
return shared_library_fullname;
|
||||
}
|
||||
|
||||
#endif /* PIC */
|
||||
|
||||
/* Returns the pathname, relocated according to the current installation
|
||||
directory.
|
||||
The returned string is either PATHNAME unmodified or a freshly allocated
|
||||
string that you can free with free() after casting it to 'char *'. */
|
||||
const char *
|
||||
relocate (const char *pathname)
|
||||
{
|
||||
#if defined PIC && defined INSTALLDIR && ENABLE_COSTLY_RELOCATABLE
|
||||
static int initialized;
|
||||
|
||||
/* Initialization code for a shared library. */
|
||||
if (!initialized)
|
||||
{
|
||||
/* At this point, orig_prefix and curr_prefix likely have already been
|
||||
set through the main program's set_program_name_and_installdir
|
||||
function. This is sufficient in the case that the library has
|
||||
initially been installed in the same orig_prefix. But we can do
|
||||
better, to also cover the cases that 1. it has been installed
|
||||
in a different prefix before being moved to orig_prefix and (later)
|
||||
to curr_prefix, 2. unlike the program, it has not moved away from
|
||||
orig_prefix. */
|
||||
const char *orig_installprefix = INSTALLPREFIX;
|
||||
const char *orig_installdir = INSTALLDIR;
|
||||
char *curr_prefix_better;
|
||||
|
||||
curr_prefix_better =
|
||||
compute_curr_prefix (orig_installprefix, orig_installdir,
|
||||
get_shared_library_fullname ());
|
||||
|
||||
set_relocation_prefix (orig_installprefix,
|
||||
curr_prefix_better != NULL
|
||||
? curr_prefix_better
|
||||
: curr_prefix);
|
||||
|
||||
if (curr_prefix_better != NULL)
|
||||
free (curr_prefix_better);
|
||||
|
||||
initialized = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Note: It is not necessary to perform case insensitive comparison here,
|
||||
even for DOS-like file systems, because the pathname argument was
|
||||
typically created from the same Makefile variable as orig_prefix came
|
||||
from. */
|
||||
if (orig_prefix != NULL && curr_prefix != NULL
|
||||
&& strncmp (pathname, orig_prefix, orig_prefix_len) == 0)
|
||||
{
|
||||
if (pathname[orig_prefix_len] == '\0')
|
||||
{
|
||||
/* pathname equals orig_prefix. */
|
||||
char *result = (char *) xmalloc (strlen (curr_prefix) + 1);
|
||||
|
||||
#ifdef NO_XMALLOC
|
||||
if (result != NULL)
|
||||
#endif
|
||||
{
|
||||
strcpy (result, curr_prefix);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
else if (ISSLASH (pathname[orig_prefix_len]))
|
||||
{
|
||||
/* pathname starts with orig_prefix. */
|
||||
const char *pathname_tail = &pathname[orig_prefix_len];
|
||||
char *result =
|
||||
(char *) xmalloc (curr_prefix_len + strlen (pathname_tail) + 1);
|
||||
|
||||
#ifdef NO_XMALLOC
|
||||
if (result != NULL)
|
||||
#endif
|
||||
{
|
||||
memcpy (result, curr_prefix, curr_prefix_len);
|
||||
strcpy (result + curr_prefix_len, pathname_tail);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __EMX__
|
||||
# ifdef __KLIBC__
|
||||
# undef strncmp
|
||||
|
||||
if (strncmp (pathname, "/@unixroot", 10) == 0
|
||||
&& (pathname[10] == '\0' || ISSLASH (pathname[10])))
|
||||
{
|
||||
/* kLIBC itself processes /@unixroot prefix */
|
||||
return pathname;
|
||||
}
|
||||
else
|
||||
# endif
|
||||
if (ISSLASH (pathname[0]))
|
||||
{
|
||||
const char *unixroot = getenv ("UNIXROOT");
|
||||
|
||||
if (unixroot && HAS_DEVICE (unixroot) && unixroot[2] == '\0')
|
||||
{
|
||||
char *result = (char *) xmalloc (2 + strlen (pathname) + 1);
|
||||
#ifdef NO_XMALLOC
|
||||
if (result != NULL)
|
||||
#endif
|
||||
{
|
||||
memcpy (result, unixroot, 2);
|
||||
strcpy (result + 2, pathname);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Nothing to relocate. */
|
||||
return pathname;
|
||||
}
|
||||
|
||||
/* Returns the pathname, relocated according to the current installation
|
||||
directory.
|
||||
This function sets *ALLOCATEDP to the allocated memory, or to NULL if
|
||||
no memory allocation occurs. So that, after you're done with the return
|
||||
value, to reclaim allocated memory, you can do: free (*ALLOCATEDP). */
|
||||
const char *
|
||||
relocate2 (const char *pathname, char **allocatedp)
|
||||
{
|
||||
const char *result = relocate (pathname);
|
||||
*allocatedp = (result != pathname ? (char *) result : NULL);
|
||||
return result;
|
||||
}
|
||||
|
||||
#endif
|
|
@ -0,0 +1,101 @@
|
|||
/* Provide relocatable packages.
|
||||
Copyright (C) 2003, 2005, 2008-2018 Free Software Foundation, Inc.
|
||||
Written by Bruno Haible <bruno@clisp.org>, 2003.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _RELOCATABLE_H
|
||||
#define _RELOCATABLE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* This can be enabled through the configure --enable-relocatable option. */
|
||||
#if ENABLE_RELOCATABLE
|
||||
|
||||
/* When building a DLL, we must export some functions. Note that because
|
||||
this is a private .h file, we don't need to use __declspec(dllimport)
|
||||
in any case. */
|
||||
#if HAVE_VISIBILITY && BUILDING_DLL
|
||||
# define RELOCATABLE_DLL_EXPORTED __attribute__((__visibility__("default")))
|
||||
#elif defined _MSC_VER && BUILDING_DLL
|
||||
# define RELOCATABLE_DLL_EXPORTED __declspec(dllexport)
|
||||
#else
|
||||
# define RELOCATABLE_DLL_EXPORTED
|
||||
#endif
|
||||
|
||||
/* Sets the original and the current installation prefix of the package.
|
||||
Relocation simply replaces a pathname starting with the original prefix
|
||||
by the corresponding pathname with the current prefix instead. Both
|
||||
prefixes should be directory names without trailing slash (i.e. use ""
|
||||
instead of "/"). */
|
||||
extern RELOCATABLE_DLL_EXPORTED void
|
||||
set_relocation_prefix (const char *orig_prefix,
|
||||
const char *curr_prefix);
|
||||
|
||||
/* Returns the pathname, relocated according to the current installation
|
||||
directory.
|
||||
The returned string is either PATHNAME unmodified or a freshly allocated
|
||||
string that you can free with free() after casting it to 'char *'. */
|
||||
extern const char * relocate (const char *pathname);
|
||||
|
||||
/* Returns the pathname, relocated according to the current installation
|
||||
directory.
|
||||
This function sets *ALLOCATEDP to the allocated memory, or to NULL if
|
||||
no memory allocation occurs. So that, after you're done with the return
|
||||
value, to reclaim allocated memory, you can do: free (*ALLOCATEDP). */
|
||||
extern const char * relocate2 (const char *pathname, char **allocatedp);
|
||||
|
||||
/* Memory management: relocate() potentially allocates memory, because it has
|
||||
to construct a fresh pathname. If this is a problem because your program
|
||||
calls relocate() frequently or because you want to fix all potential memory
|
||||
leaks anyway, you have three options:
|
||||
1) Use this idiom:
|
||||
const char *pathname = ...;
|
||||
const char *rel_pathname = relocate (pathname);
|
||||
...
|
||||
if (rel_pathname != pathname)
|
||||
free ((char *) rel_pathname);
|
||||
2) Use this idiom:
|
||||
char *allocated;
|
||||
const char *rel_pathname = relocate2 (..., &allocated);
|
||||
...
|
||||
free (allocated);
|
||||
3) Think about caching the result. */
|
||||
|
||||
/* Convenience function:
|
||||
Computes the current installation prefix, based on the original
|
||||
installation prefix, the original installation directory of a particular
|
||||
file, and the current pathname of this file.
|
||||
Returns it, freshly allocated. Returns NULL upon failure. */
|
||||
extern char * compute_curr_prefix (const char *orig_installprefix,
|
||||
const char *orig_installdir,
|
||||
const char *curr_pathname);
|
||||
|
||||
#else
|
||||
|
||||
/* By default, we use the hardwired pathnames. */
|
||||
#define relocate(pathname) (pathname)
|
||||
#define relocate2(pathname,allocatedp) (*(allocatedp) = NULL, (pathname))
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _RELOCATABLE_H */
|
|
@ -0,0 +1,8 @@
|
|||
# set_this_relocation_prefix leaks intentionally
|
||||
{
|
||||
relocatable/set_this_relocation_prefix
|
||||
Memcheck:Leak
|
||||
fun:malloc
|
||||
fun:set_this_relocation_prefix
|
||||
fun:set_relocation_prefix
|
||||
}
|
|
@ -0,0 +1,114 @@
|
|||
/* A substitute for POSIX 2008 <stddef.h>, for platforms that have issues.
|
||||
|
||||
Copyright (C) 2009-2018 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program; if not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Written by Eric Blake. */
|
||||
|
||||
/*
|
||||
* POSIX 2008 <stddef.h> for platforms that have issues.
|
||||
* <http://www.opengroup.org/susv3xbd/stddef.h.html>
|
||||
*/
|
||||
|
||||
#if __GNUC__ >= 3
|
||||
@PRAGMA_SYSTEM_HEADER@
|
||||
#endif
|
||||
@PRAGMA_COLUMNS@
|
||||
|
||||
#if defined __need_wchar_t || defined __need_size_t \
|
||||
|| defined __need_ptrdiff_t || defined __need_NULL \
|
||||
|| defined __need_wint_t
|
||||
/* Special invocation convention inside gcc header files. In
|
||||
particular, gcc provides a version of <stddef.h> that blindly
|
||||
redefines NULL even when __need_wint_t was defined, even though
|
||||
wint_t is not normally provided by <stddef.h>. Hence, we must
|
||||
remember if special invocation has ever been used to obtain wint_t,
|
||||
in which case we need to clean up NULL yet again. */
|
||||
|
||||
# if !(defined _@GUARD_PREFIX@_STDDEF_H && defined _GL_STDDEF_WINT_T)
|
||||
# ifdef __need_wint_t
|
||||
# define _GL_STDDEF_WINT_T
|
||||
# endif
|
||||
# @INCLUDE_NEXT@ @NEXT_STDDEF_H@
|
||||
# endif
|
||||
|
||||
#else
|
||||
/* Normal invocation convention. */
|
||||
|
||||
# ifndef _@GUARD_PREFIX@_STDDEF_H
|
||||
|
||||
/* The include_next requires a split double-inclusion guard. */
|
||||
|
||||
# @INCLUDE_NEXT@ @NEXT_STDDEF_H@
|
||||
|
||||
/* On NetBSD 5.0, the definition of NULL lacks proper parentheses. */
|
||||
# if (@REPLACE_NULL@ \
|
||||
&& (!defined _@GUARD_PREFIX@_STDDEF_H || defined _GL_STDDEF_WINT_T))
|
||||
# undef NULL
|
||||
# ifdef __cplusplus
|
||||
/* ISO C++ says that the macro NULL must expand to an integer constant
|
||||
expression, hence '((void *) 0)' is not allowed in C++. */
|
||||
# if __GNUG__ >= 3
|
||||
/* GNU C++ has a __null macro that behaves like an integer ('int' or
|
||||
'long') but has the same size as a pointer. Use that, to avoid
|
||||
warnings. */
|
||||
# define NULL __null
|
||||
# else
|
||||
# define NULL 0L
|
||||
# endif
|
||||
# else
|
||||
# define NULL ((void *) 0)
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# ifndef _@GUARD_PREFIX@_STDDEF_H
|
||||
# define _@GUARD_PREFIX@_STDDEF_H
|
||||
|
||||
/* Some platforms lack wchar_t. */
|
||||
#if !@HAVE_WCHAR_T@
|
||||
# define wchar_t int
|
||||
#endif
|
||||
|
||||
/* Some platforms lack max_align_t. The check for _GCC_MAX_ALIGN_T is
|
||||
a hack in case the configure-time test was done with g++ even though
|
||||
we are currently compiling with gcc. */
|
||||
#if ! (@HAVE_MAX_ALIGN_T@ || defined _GCC_MAX_ALIGN_T)
|
||||
# if !GNULIB_defined_max_align_t
|
||||
/* On the x86, the maximum storage alignment of double, long, etc. is 4,
|
||||
but GCC's C11 ABI for x86 says that max_align_t has an alignment of 8,
|
||||
and the C11 standard allows this. Work around this problem by
|
||||
using __alignof__ (which returns 8 for double) rather than _Alignof
|
||||
(which returns 4), and align each union member accordingly. */
|
||||
# ifdef __GNUC__
|
||||
# define _GL_STDDEF_ALIGNAS(type) \
|
||||
__attribute__ ((__aligned__ (__alignof__ (type))))
|
||||
# else
|
||||
# define _GL_STDDEF_ALIGNAS(type) /* */
|
||||
# endif
|
||||
typedef union
|
||||
{
|
||||
char *__p _GL_STDDEF_ALIGNAS (char *);
|
||||
double __d _GL_STDDEF_ALIGNAS (double);
|
||||
long double __ld _GL_STDDEF_ALIGNAS (long double);
|
||||
long int __i _GL_STDDEF_ALIGNAS (long int);
|
||||
} rpl_max_align_t;
|
||||
# define max_align_t rpl_max_align_t
|
||||
# define GNULIB_defined_max_align_t 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
# endif /* _@GUARD_PREFIX@_STDDEF_H */
|
||||
# endif /* _@GUARD_PREFIX@_STDDEF_H */
|
||||
#endif /* __need_XXX */
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,142 @@
|
|||
/* Searching in a string.
|
||||
Copyright (C) 2003, 2007-2018 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
/* Specification. */
|
||||
#include <string.h>
|
||||
|
||||
/* Find the first occurrence of C in S or the final NUL byte. */
|
||||
char *
|
||||
strchrnul (const char *s, int c_in)
|
||||
{
|
||||
/* On 32-bit hardware, choosing longword to be a 32-bit unsigned
|
||||
long instead of a 64-bit uintmax_t tends to give better
|
||||
performance. On 64-bit hardware, unsigned long is generally 64
|
||||
bits already. Change this typedef to experiment with
|
||||
performance. */
|
||||
typedef unsigned long int longword;
|
||||
|
||||
const unsigned char *char_ptr;
|
||||
const longword *longword_ptr;
|
||||
longword repeated_one;
|
||||
longword repeated_c;
|
||||
unsigned char c;
|
||||
|
||||
c = (unsigned char) c_in;
|
||||
if (!c)
|
||||
return rawmemchr (s, 0);
|
||||
|
||||
/* Handle the first few bytes by reading one byte at a time.
|
||||
Do this until CHAR_PTR is aligned on a longword boundary. */
|
||||
for (char_ptr = (const unsigned char *) s;
|
||||
(size_t) char_ptr % sizeof (longword) != 0;
|
||||
++char_ptr)
|
||||
if (!*char_ptr || *char_ptr == c)
|
||||
return (char *) char_ptr;
|
||||
|
||||
longword_ptr = (const longword *) char_ptr;
|
||||
|
||||
/* All these elucidatory comments refer to 4-byte longwords,
|
||||
but the theory applies equally well to any size longwords. */
|
||||
|
||||
/* Compute auxiliary longword values:
|
||||
repeated_one is a value which has a 1 in every byte.
|
||||
repeated_c has c in every byte. */
|
||||
repeated_one = 0x01010101;
|
||||
repeated_c = c | (c << 8);
|
||||
repeated_c |= repeated_c << 16;
|
||||
if (0xffffffffU < (longword) -1)
|
||||
{
|
||||
repeated_one |= repeated_one << 31 << 1;
|
||||
repeated_c |= repeated_c << 31 << 1;
|
||||
if (8 < sizeof (longword))
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 64; i < sizeof (longword) * 8; i *= 2)
|
||||
{
|
||||
repeated_one |= repeated_one << i;
|
||||
repeated_c |= repeated_c << i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Instead of the traditional loop which tests each byte, we will
|
||||
test a longword at a time. The tricky part is testing if *any of
|
||||
the four* bytes in the longword in question are equal to NUL or
|
||||
c. We first use an xor with repeated_c. This reduces the task
|
||||
to testing whether *any of the four* bytes in longword1 or
|
||||
longword2 is zero.
|
||||
|
||||
Let's consider longword1. We compute tmp =
|
||||
((longword1 - repeated_one) & ~longword1) & (repeated_one << 7).
|
||||
That is, we perform the following operations:
|
||||
1. Subtract repeated_one.
|
||||
2. & ~longword1.
|
||||
3. & a mask consisting of 0x80 in every byte.
|
||||
Consider what happens in each byte:
|
||||
- If a byte of longword1 is zero, step 1 and 2 transform it into 0xff,
|
||||
and step 3 transforms it into 0x80. A carry can also be propagated
|
||||
to more significant bytes.
|
||||
- If a byte of longword1 is nonzero, let its lowest 1 bit be at
|
||||
position k (0 <= k <= 7); so the lowest k bits are 0. After step 1,
|
||||
the byte ends in a single bit of value 0 and k bits of value 1.
|
||||
After step 2, the result is just k bits of value 1: 2^k - 1. After
|
||||
step 3, the result is 0. And no carry is produced.
|
||||
So, if longword1 has only non-zero bytes, tmp is zero.
|
||||
Whereas if longword1 has a zero byte, call j the position of the least
|
||||
significant zero byte. Then the result has a zero at positions 0, ...,
|
||||
j-1 and a 0x80 at position j. We cannot predict the result at the more
|
||||
significant bytes (positions j+1..3), but it does not matter since we
|
||||
already have a non-zero bit at position 8*j+7.
|
||||
|
||||
The test whether any byte in longword1 or longword2 is zero is equivalent
|
||||
to testing whether tmp1 is nonzero or tmp2 is nonzero. We can combine
|
||||
this into a single test, whether (tmp1 | tmp2) is nonzero.
|
||||
|
||||
This test can read more than one byte beyond the end of a string,
|
||||
depending on where the terminating NUL is encountered. However,
|
||||
this is considered safe since the initialization phase ensured
|
||||
that the read will be aligned, therefore, the read will not cross
|
||||
page boundaries and will not cause a fault. */
|
||||
|
||||
while (1)
|
||||
{
|
||||
longword longword1 = *longword_ptr ^ repeated_c;
|
||||
longword longword2 = *longword_ptr;
|
||||
|
||||
if (((((longword1 - repeated_one) & ~longword1)
|
||||
| ((longword2 - repeated_one) & ~longword2))
|
||||
& (repeated_one << 7)) != 0)
|
||||
break;
|
||||
longword_ptr++;
|
||||
}
|
||||
|
||||
char_ptr = (const unsigned char *) longword_ptr;
|
||||
|
||||
/* At this point, we know that one of the sizeof (longword) bytes
|
||||
starting at char_ptr is == 0 or == c. On little-endian machines,
|
||||
we could determine the first such byte without any further memory
|
||||
accesses, just by looking at the tmp result from the last loop
|
||||
iteration. But this does not work on big-endian machines.
|
||||
Choose code that works in both cases. */
|
||||
|
||||
char_ptr = (unsigned char *) longword_ptr;
|
||||
while (*char_ptr && (*char_ptr != c))
|
||||
char_ptr++;
|
||||
return (char *) char_ptr;
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
# Suppress a valgrind message about use of uninitialized memory in strchrnul().
|
||||
# This use is OK because it provides only a speedup.
|
||||
{
|
||||
strchrnul-value4
|
||||
Memcheck:Value4
|
||||
fun:strchrnul
|
||||
}
|
||||
{
|
||||
strchrnul-value8
|
||||
Memcheck:Value8
|
||||
fun:strchrnul
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
/* Copyright (C) 1991, 1996-1998, 2002-2004, 2006-2007, 2009-2018 Free Software
|
||||
Foundation, Inc.
|
||||
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License along
|
||||
with this program; if not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _LIBC
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
/* Get specification. */
|
||||
#include <string.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#undef __strdup
|
||||
#ifdef _LIBC
|
||||
# undef strdup
|
||||
#endif
|
||||
|
||||
#ifndef weak_alias
|
||||
# define __strdup strdup
|
||||
#endif
|
||||
|
||||
/* Duplicate S, returning an identical malloc'd string. */
|
||||
char *
|
||||
__strdup (const char *s)
|
||||
{
|
||||
size_t len = strlen (s) + 1;
|
||||
void *new = malloc (len);
|
||||
|
||||
if (new == NULL)
|
||||
return NULL;
|
||||
|
||||
return (char *) memcpy (new, s, len);
|
||||
}
|
||||
#ifdef libc_hidden_def
|
||||
libc_hidden_def (__strdup)
|
||||
#endif
|
||||
#ifdef weak_alias
|
||||
weak_alias (__strdup, strdup)
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,63 @@
|
|||
/* Provide a more complete sys/file.h.
|
||||
|
||||
Copyright (C) 2007-2018 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program; if not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Written by Richard W.M. Jones. */
|
||||
|
||||
#ifndef _@GUARD_PREFIX@_SYS_FILE_H
|
||||
|
||||
#if __GNUC__ >= 3
|
||||
@PRAGMA_SYSTEM_HEADER@
|
||||
#endif
|
||||
@PRAGMA_COLUMNS@
|
||||
|
||||
/* The include_next requires a split double-inclusion guard. */
|
||||
#if @HAVE_SYS_FILE_H@
|
||||
# @INCLUDE_NEXT@ @NEXT_SYS_FILE_H@
|
||||
#endif
|
||||
|
||||
#ifndef _@GUARD_PREFIX@_SYS_FILE_H
|
||||
#define _@GUARD_PREFIX@_SYS_FILE_H
|
||||
|
||||
#ifndef LOCK_SH
|
||||
/* Operations for the 'flock' call (same as Linux kernel constants). */
|
||||
# define LOCK_SH 1 /* Shared lock. */
|
||||
# define LOCK_EX 2 /* Exclusive lock. */
|
||||
# define LOCK_UN 8 /* Unlock. */
|
||||
|
||||
/* Can be OR'd in to one of the above. */
|
||||
# define LOCK_NB 4 /* Don't block when locking. */
|
||||
#endif
|
||||
|
||||
/* The definition of _GL_WARN_ON_USE is copied here. */
|
||||
|
||||
#if @GNULIB_FLOCK@
|
||||
/* Apply or remove advisory locks on an open file.
|
||||
Return 0 if successful, otherwise -1 and errno set. */
|
||||
# if !@HAVE_FLOCK@
|
||||
extern int flock (int fd, int operation);
|
||||
# endif
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef flock
|
||||
# if HAVE_RAW_DECL_FLOCK
|
||||
_GL_WARN_ON_USE (flock, "flock is unportable - "
|
||||
"use gnulib module flock for portability");
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* _@GUARD_PREFIX@_SYS_FILE_H */
|
||||
#endif /* _@GUARD_PREFIX@_SYS_FILE_H */
|
|
@ -0,0 +1,106 @@
|
|||
/* Provide a more complete sys/types.h.
|
||||
|
||||
Copyright (C) 2011-2018 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program; if not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
#if __GNUC__ >= 3
|
||||
@PRAGMA_SYSTEM_HEADER@
|
||||
#endif
|
||||
@PRAGMA_COLUMNS@
|
||||
|
||||
#if defined _WIN32 && !defined __CYGWIN__ \
|
||||
&& (defined __need_off_t || defined __need___off64_t \
|
||||
|| defined __need_ssize_t || defined __need_time_t)
|
||||
|
||||
/* Special invocation convention inside mingw header files. */
|
||||
|
||||
#@INCLUDE_NEXT@ @NEXT_SYS_TYPES_H@
|
||||
|
||||
#else
|
||||
/* Normal invocation convention. */
|
||||
|
||||
#ifndef _@GUARD_PREFIX@_SYS_TYPES_H
|
||||
|
||||
/* The include_next requires a split double-inclusion guard. */
|
||||
# define _GL_INCLUDING_SYS_TYPES_H
|
||||
#@INCLUDE_NEXT@ @NEXT_SYS_TYPES_H@
|
||||
# undef _GL_INCLUDING_SYS_TYPES_H
|
||||
|
||||
#ifndef _@GUARD_PREFIX@_SYS_TYPES_H
|
||||
#define _@GUARD_PREFIX@_SYS_TYPES_H
|
||||
|
||||
/* Override off_t if Large File Support is requested on native Windows. */
|
||||
#if @WINDOWS_64_BIT_OFF_T@
|
||||
/* Same as int64_t in <stdint.h>. */
|
||||
# if defined _MSC_VER
|
||||
# define off_t __int64
|
||||
# else
|
||||
# define off_t long long int
|
||||
# endif
|
||||
/* Indicator, for gnulib internal purposes. */
|
||||
# define _GL_WINDOWS_64_BIT_OFF_T 1
|
||||
#endif
|
||||
|
||||
/* Override dev_t and ino_t if distinguishable inodes support is requested
|
||||
on native Windows. */
|
||||
#if @WINDOWS_STAT_INODES@
|
||||
|
||||
# if @WINDOWS_STAT_INODES@ == 2
|
||||
/* Experimental, not useful in Windows 10. */
|
||||
|
||||
/* Define dev_t to a 64-bit type. */
|
||||
# if !defined GNULIB_defined_dev_t
|
||||
typedef unsigned long long int rpl_dev_t;
|
||||
# undef dev_t
|
||||
# define dev_t rpl_dev_t
|
||||
# define GNULIB_defined_dev_t 1
|
||||
# endif
|
||||
|
||||
/* Define ino_t to a 128-bit type. */
|
||||
# if !defined GNULIB_defined_ino_t
|
||||
/* MSVC does not have a 128-bit integer type.
|
||||
GCC has a 128-bit integer type __int128, but only on 64-bit targets. */
|
||||
typedef struct { unsigned long long int _gl_ino[2]; } rpl_ino_t;
|
||||
# undef ino_t
|
||||
# define ino_t rpl_ino_t
|
||||
# define GNULIB_defined_ino_t 1
|
||||
# endif
|
||||
|
||||
# else /* @WINDOWS_STAT_INODES@ == 1 */
|
||||
|
||||
/* Define ino_t to a 64-bit type. */
|
||||
# if !defined GNULIB_defined_ino_t
|
||||
typedef unsigned long long int rpl_ino_t;
|
||||
# undef ino_t
|
||||
# define ino_t rpl_ino_t
|
||||
# define GNULIB_defined_ino_t 1
|
||||
# endif
|
||||
|
||||
# endif
|
||||
|
||||
/* Indicator, for gnulib internal purposes. */
|
||||
# define _GL_WINDOWS_STAT_INODES @WINDOWS_STAT_INODES@
|
||||
|
||||
#endif
|
||||
|
||||
/* MSVC 9 defines size_t in <stddef.h>, not in <sys/types.h>. */
|
||||
/* But avoid namespace pollution on glibc systems. */
|
||||
#if (defined _WIN32 && ! defined __CYGWIN__) && ! defined __GLIBC__
|
||||
# include <stddef.h>
|
||||
#endif
|
||||
|
||||
#endif /* _@GUARD_PREFIX@_SYS_TYPES_H */
|
||||
#endif /* _@GUARD_PREFIX@_SYS_TYPES_H */
|
||||
#endif /* __need_XXX */
|
|
@ -0,0 +1,4 @@
|
|||
#include <config.h>
|
||||
#define _GL_UNISTD_INLINE _GL_EXTERN_INLINE
|
||||
#include "unistd.h"
|
||||
typedef int dummy;
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,36 @@
|
|||
/* A C macro for declaring that specific function parameters are not used.
|
||||
Copyright (C) 2008-2018 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU Lesser General Public License as published
|
||||
by the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
/* _GL_UNUSED_PARAMETER is a marker that can be appended to function parameter
|
||||
declarations for parameters that are not used. This helps to reduce
|
||||
warnings, such as from GCC -Wunused-parameter. The syntax is as follows:
|
||||
type param _GL_UNUSED_PARAMETER
|
||||
or more generally
|
||||
param_decl _GL_UNUSED_PARAMETER
|
||||
For example:
|
||||
int param _GL_UNUSED_PARAMETER
|
||||
int *(*param)(void) _GL_UNUSED_PARAMETER
|
||||
Other possible, but obscure and discouraged syntaxes:
|
||||
int _GL_UNUSED_PARAMETER *(*param)(void)
|
||||
_GL_UNUSED_PARAMETER int *(*param)(void)
|
||||
*/
|
||||
#ifndef _GL_UNUSED_PARAMETER
|
||||
# if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
|
||||
# define _GL_UNUSED_PARAMETER __attribute__ ((__unused__))
|
||||
# else
|
||||
# define _GL_UNUSED_PARAMETER
|
||||
# endif
|
||||
#endif
|
|
@ -0,0 +1,131 @@
|
|||
/* A C macro for emitting warnings if a function is used.
|
||||
Copyright (C) 2010-2018 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU Lesser General Public License as published
|
||||
by the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
/* _GL_WARN_ON_USE (function, "literal string") issues a declaration
|
||||
for FUNCTION which will then trigger a compiler warning containing
|
||||
the text of "literal string" anywhere that function is called, if
|
||||
supported by the compiler. If the compiler does not support this
|
||||
feature, the macro expands to an unused extern declaration.
|
||||
|
||||
_GL_WARN_ON_USE_ATTRIBUTE ("literal string") expands to the
|
||||
attribute used in _GL_WARN_ON_USE. If the compiler does not support
|
||||
this feature, it expands to empty.
|
||||
|
||||
These macros are useful for marking a function as a potential
|
||||
portability trap, with the intent that "literal string" include
|
||||
instructions on the replacement function that should be used
|
||||
instead.
|
||||
_GL_WARN_ON_USE is for functions with 'extern' linkage.
|
||||
_GL_WARN_ON_USE_ATTRIBUTE is for functions with 'static' or 'inline'
|
||||
linkage.
|
||||
|
||||
However, one of the reasons that a function is a portability trap is
|
||||
if it has the wrong signature. Declaring FUNCTION with a different
|
||||
signature in C is a compilation error, so this macro must use the
|
||||
same type as any existing declaration so that programs that avoid
|
||||
the problematic FUNCTION do not fail to compile merely because they
|
||||
included a header that poisoned the function. But this implies that
|
||||
_GL_WARN_ON_USE is only safe to use if FUNCTION is known to already
|
||||
have a declaration. Use of this macro implies that there must not
|
||||
be any other macro hiding the declaration of FUNCTION; but
|
||||
undefining FUNCTION first is part of the poisoning process anyway
|
||||
(although for symbols that are provided only via a macro, the result
|
||||
is a compilation error rather than a warning containing
|
||||
"literal string"). Also note that in C++, it is only safe to use if
|
||||
FUNCTION has no overloads.
|
||||
|
||||
For an example, it is possible to poison 'getline' by:
|
||||
- adding a call to gl_WARN_ON_USE_PREPARE([[#include <stdio.h>]],
|
||||
[getline]) in configure.ac, which potentially defines
|
||||
HAVE_RAW_DECL_GETLINE
|
||||
- adding this code to a header that wraps the system <stdio.h>:
|
||||
#undef getline
|
||||
#if HAVE_RAW_DECL_GETLINE
|
||||
_GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but"
|
||||
"not universally present; use the gnulib module getline");
|
||||
#endif
|
||||
|
||||
It is not possible to directly poison global variables. But it is
|
||||
possible to write a wrapper accessor function, and poison that
|
||||
(less common usage, like &environ, will cause a compilation error
|
||||
rather than issue the nice warning, but the end result of informing
|
||||
the developer about their portability problem is still achieved):
|
||||
#if HAVE_RAW_DECL_ENVIRON
|
||||
static char ***
|
||||
rpl_environ (void) { return &environ; }
|
||||
_GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared");
|
||||
# undef environ
|
||||
# define environ (*rpl_environ ())
|
||||
#endif
|
||||
or better (avoiding contradictory use of 'static' and 'extern'):
|
||||
#if HAVE_RAW_DECL_ENVIRON
|
||||
static char ***
|
||||
_GL_WARN_ON_USE_ATTRIBUTE ("environ is not always properly declared")
|
||||
rpl_environ (void) { return &environ; }
|
||||
# undef environ
|
||||
# define environ (*rpl_environ ())
|
||||
#endif
|
||||
*/
|
||||
#ifndef _GL_WARN_ON_USE
|
||||
|
||||
# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
|
||||
/* A compiler attribute is available in gcc versions 4.3.0 and later. */
|
||||
# define _GL_WARN_ON_USE(function, message) \
|
||||
extern __typeof__ (function) function __attribute__ ((__warning__ (message)))
|
||||
# define _GL_WARN_ON_USE_ATTRIBUTE(message) \
|
||||
__attribute__ ((__warning__ (message)))
|
||||
# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
|
||||
/* Verify the existence of the function. */
|
||||
# define _GL_WARN_ON_USE(function, message) \
|
||||
extern __typeof__ (function) function
|
||||
# define _GL_WARN_ON_USE_ATTRIBUTE(message)
|
||||
# else /* Unsupported. */
|
||||
# define _GL_WARN_ON_USE(function, message) \
|
||||
_GL_WARN_EXTERN_C int _gl_warn_on_use
|
||||
# define _GL_WARN_ON_USE_ATTRIBUTE(message)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string")
|
||||
is like _GL_WARN_ON_USE (function, "string"), except that the function is
|
||||
declared with the given prototype, consisting of return type, parameters,
|
||||
and attributes.
|
||||
This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does
|
||||
not work in this case. */
|
||||
#ifndef _GL_WARN_ON_USE_CXX
|
||||
# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
|
||||
# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
|
||||
extern rettype function parameters_and_attributes \
|
||||
__attribute__ ((__warning__ (msg)))
|
||||
# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
|
||||
/* Verify the existence of the function. */
|
||||
# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
|
||||
extern rettype function parameters_and_attributes
|
||||
# else /* Unsupported. */
|
||||
# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
|
||||
_GL_WARN_EXTERN_C int _gl_warn_on_use
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* _GL_WARN_EXTERN_C declaration;
|
||||
performs the declaration with C linkage. */
|
||||
#ifndef _GL_WARN_EXTERN_C
|
||||
# if defined __cplusplus
|
||||
# define _GL_WARN_EXTERN_C extern "C"
|
||||
# else
|
||||
# define _GL_WARN_EXTERN_C extern
|
||||
# endif
|
||||
#endif
|
|
@ -0,0 +1,46 @@
|
|||
# 00gnulib.m4 serial 3
|
||||
dnl Copyright (C) 2009-2018 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
dnl This file must be named something that sorts before all other
|
||||
dnl gnulib-provided .m4 files. It is needed until such time as we can
|
||||
dnl assume Autoconf 2.64, with its improved AC_DEFUN_ONCE and
|
||||
dnl m4_divert semantics.
|
||||
|
||||
# Until autoconf 2.63, handling of the diversion stack required m4_init
|
||||
# to be called first; but this does not happen with aclocal. Wrapping
|
||||
# the entire execution in another layer of the diversion stack fixes this.
|
||||
# Worse, prior to autoconf 2.62, m4_wrap depended on the underlying m4
|
||||
# for whether it was FIFO or LIFO; in order to properly balance with
|
||||
# m4_init, we need to undo our push just before anything wrapped within
|
||||
# the m4_init body. The way to ensure this is to wrap both sides of
|
||||
# m4_init with a one-shot macro that does the pop at the right time.
|
||||
m4_ifndef([_m4_divert_diversion],
|
||||
[m4_divert_push([KILL])
|
||||
m4_define([gl_divert_fixup], [m4_divert_pop()m4_define([$0])])
|
||||
m4_define([m4_init],
|
||||
[gl_divert_fixup()]m4_defn([m4_init])[gl_divert_fixup()])])
|
||||
|
||||
|
||||
# AC_DEFUN_ONCE([NAME], VALUE)
|
||||
# ----------------------------
|
||||
# Define NAME to expand to VALUE on the first use (whether by direct
|
||||
# expansion, or by AC_REQUIRE), and to nothing on all subsequent uses.
|
||||
# Avoid bugs in AC_REQUIRE in Autoconf 2.63 and earlier. This
|
||||
# definition is slower than the version in Autoconf 2.64, because it
|
||||
# can only use interfaces that existed since 2.59; but it achieves the
|
||||
# same effect. Quoting is necessary to avoid confusing Automake.
|
||||
m4_version_prereq([2.63.263], [],
|
||||
[m4_define([AC][_DEFUN_ONCE],
|
||||
[AC][_DEFUN([$1],
|
||||
[AC_REQUIRE([_gl_DEFUN_ONCE([$1])],
|
||||
[m4_indir([_gl_DEFUN_ONCE([$1])])])])]dnl
|
||||
[AC][_DEFUN([_gl_DEFUN_ONCE([$1])], [$2])])])
|
||||
|
||||
# gl_00GNULIB
|
||||
# -----------
|
||||
# Witness macro that this file has been included. Needed to force
|
||||
# Automake to include this file prior to all other gnulib .m4 files.
|
||||
AC_DEFUN([gl_00GNULIB])
|
|
@ -0,0 +1,102 @@
|
|||
# absolute-header.m4 serial 16
|
||||
dnl Copyright (C) 2006-2018 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
dnl From Derek Price.
|
||||
|
||||
# gl_ABSOLUTE_HEADER(HEADER1 HEADER2 ...)
|
||||
# ---------------------------------------
|
||||
# Find the absolute name of a header file, testing first if the header exists.
|
||||
# If the header were sys/inttypes.h, this macro would define
|
||||
# ABSOLUTE_SYS_INTTYPES_H to the '""' quoted absolute name of sys/inttypes.h
|
||||
# in config.h
|
||||
# (e.g. '#define ABSOLUTE_SYS_INTTYPES_H "///usr/include/sys/inttypes.h"').
|
||||
# The three "///" are to pacify Sun C 5.8, which otherwise would say
|
||||
# "warning: #include of /usr/include/... may be non-portable".
|
||||
# Use '""', not '<>', so that the /// cannot be confused with a C99 comment.
|
||||
# Note: This macro assumes that the header file is not empty after
|
||||
# preprocessing, i.e. it does not only define preprocessor macros but also
|
||||
# provides some type/enum definitions or function/variable declarations.
|
||||
AC_DEFUN([gl_ABSOLUTE_HEADER],
|
||||
[AC_REQUIRE([AC_CANONICAL_HOST])
|
||||
AC_LANG_PREPROC_REQUIRE()dnl
|
||||
dnl FIXME: gl_absolute_header and ac_header_exists must be used unquoted
|
||||
dnl until we can assume autoconf 2.64 or newer.
|
||||
m4_foreach_w([gl_HEADER_NAME], [$1],
|
||||
[AS_VAR_PUSHDEF([gl_absolute_header],
|
||||
[gl_cv_absolute_]m4_defn([gl_HEADER_NAME]))dnl
|
||||
AC_CACHE_CHECK([absolute name of <]m4_defn([gl_HEADER_NAME])[>],
|
||||
m4_defn([gl_absolute_header]),
|
||||
[AS_VAR_PUSHDEF([ac_header_exists],
|
||||
[ac_cv_header_]m4_defn([gl_HEADER_NAME]))dnl
|
||||
AC_CHECK_HEADERS_ONCE(m4_defn([gl_HEADER_NAME]))dnl
|
||||
if test AS_VAR_GET(ac_header_exists) = yes; then
|
||||
gl_ABSOLUTE_HEADER_ONE(m4_defn([gl_HEADER_NAME]))
|
||||
fi
|
||||
AS_VAR_POPDEF([ac_header_exists])dnl
|
||||
])dnl
|
||||
AC_DEFINE_UNQUOTED(AS_TR_CPP([ABSOLUTE_]m4_defn([gl_HEADER_NAME])),
|
||||
["AS_VAR_GET(gl_absolute_header)"],
|
||||
[Define this to an absolute name of <]m4_defn([gl_HEADER_NAME])[>.])
|
||||
AS_VAR_POPDEF([gl_absolute_header])dnl
|
||||
])dnl
|
||||
])# gl_ABSOLUTE_HEADER
|
||||
|
||||
# gl_ABSOLUTE_HEADER_ONE(HEADER)
|
||||
# ------------------------------
|
||||
# Like gl_ABSOLUTE_HEADER, except that:
|
||||
# - it assumes that the header exists,
|
||||
# - it uses the current CPPFLAGS,
|
||||
# - it does not cache the result,
|
||||
# - it is silent.
|
||||
AC_DEFUN([gl_ABSOLUTE_HEADER_ONE],
|
||||
[
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])
|
||||
AC_LANG_CONFTEST([AC_LANG_SOURCE([[#include <]]m4_dquote([$1])[[>]])])
|
||||
dnl AIX "xlc -E" and "cc -E" omit #line directives for header files
|
||||
dnl that contain only a #include of other header files and no
|
||||
dnl non-comment tokens of their own. This leads to a failure to
|
||||
dnl detect the absolute name of <dirent.h>, <signal.h>, <poll.h>
|
||||
dnl and others. The workaround is to force preservation of comments
|
||||
dnl through option -C. This ensures all necessary #line directives
|
||||
dnl are present. GCC supports option -C as well.
|
||||
case "$host_os" in
|
||||
aix*) gl_absname_cpp="$ac_cpp -C" ;;
|
||||
*) gl_absname_cpp="$ac_cpp" ;;
|
||||
esac
|
||||
changequote(,)
|
||||
case "$host_os" in
|
||||
mingw*)
|
||||
dnl For the sake of native Windows compilers (excluding gcc),
|
||||
dnl treat backslash as a directory separator, like /.
|
||||
dnl Actually, these compilers use a double-backslash as
|
||||
dnl directory separator, inside the
|
||||
dnl # line "filename"
|
||||
dnl directives.
|
||||
gl_dirsep_regex='[/\\]'
|
||||
;;
|
||||
*)
|
||||
gl_dirsep_regex='\/'
|
||||
;;
|
||||
esac
|
||||
dnl A sed expression that turns a string into a basic regular
|
||||
dnl expression, for use within "/.../".
|
||||
gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g'
|
||||
gl_header_literal_regex=`echo '$1' \
|
||||
| sed -e "$gl_make_literal_regex_sed"`
|
||||
gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{
|
||||
s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/
|
||||
s|^/[^/]|//&|
|
||||
p
|
||||
q
|
||||
}'
|
||||
changequote([,])
|
||||
dnl eval is necessary to expand gl_absname_cpp.
|
||||
dnl Ultrix and Pyramid sh refuse to redirect output of eval,
|
||||
dnl so use subshell.
|
||||
AS_VAR_SET([gl_cv_absolute_]AS_TR_SH([[$1]]),
|
||||
[`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD |
|
||||
sed -n "$gl_absolute_header_sed"`])
|
||||
])
|
|
@ -0,0 +1,982 @@
|
|||
# ===========================================================================
|
||||
# http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_CXX_COMPILE_STDCXX(VERSION, [ext|noext], [mandatory|optional])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Check for baseline language coverage in the compiler for the specified
|
||||
# version of the C++ standard. If necessary, add switches to CXX and
|
||||
# CXXCPP to enable support. VERSION may be '11' (for the C++11 standard)
|
||||
# or '14' (for the C++14 standard).
|
||||
#
|
||||
# The second argument, if specified, indicates whether you insist on an
|
||||
# extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g.
|
||||
# -std=c++11). If neither is specified, you get whatever works, with
|
||||
# preference for an extended mode.
|
||||
#
|
||||
# The third argument, if specified 'mandatory' or if left unspecified,
|
||||
# indicates that baseline support for the specified C++ standard is
|
||||
# required and that the macro should error out if no mode with that
|
||||
# support is found. If specified 'optional', then configuration proceeds
|
||||
# regardless, after defining HAVE_CXX${VERSION} if and only if a
|
||||
# supporting mode is found.
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2008 Benjamin Kosnik <bkoz@redhat.com>
|
||||
# Copyright (c) 2012 Zack Weinberg <zackw@panix.com>
|
||||
# Copyright (c) 2013 Roy Stogner <roystgnr@ices.utexas.edu>
|
||||
# Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov <sokolov@google.com>
|
||||
# Copyright (c) 2015 Paul Norman <penorman@mac.com>
|
||||
# Copyright (c) 2015 Moritz Klammler <moritz@klammler.eu>
|
||||
# Copyright (c) 2016 Krzesimir Nowak <qdlacz@gmail.com>
|
||||
#
|
||||
# Copying and distribution of this file, with or without modification, are
|
||||
# permitted in any medium without royalty provided the copyright notice
|
||||
# and this notice are preserved. This file is offered as-is, without any
|
||||
# warranty.
|
||||
|
||||
#serial 6
|
||||
|
||||
dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro
|
||||
dnl (serial version number 13).
|
||||
|
||||
AX_REQUIRE_DEFINED([AC_MSG_WARN])
|
||||
AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl
|
||||
m4_if([$1], [11], [ax_cxx_compile_alternatives="11 0x"],
|
||||
[$1], [14], [ax_cxx_compile_alternatives="14 1y"],
|
||||
[$1], [17], [ax_cxx_compile_alternatives="17 1z"],
|
||||
[m4_fatal([invalid first argument `$1' to AX_CXX_COMPILE_STDCXX])])dnl
|
||||
m4_if([$2], [], [],
|
||||
[$2], [ext], [],
|
||||
[$2], [noext], [],
|
||||
[m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX])])dnl
|
||||
m4_if([$3], [], [ax_cxx_compile_cxx$1_required=true],
|
||||
[$3], [mandatory], [ax_cxx_compile_cxx$1_required=true],
|
||||
[$3], [optional], [ax_cxx_compile_cxx$1_required=false],
|
||||
[m4_fatal([invalid third argument `$3' to AX_CXX_COMPILE_STDCXX])])
|
||||
AC_LANG_PUSH([C++])dnl
|
||||
ac_success=no
|
||||
AC_CACHE_CHECK(whether $CXX supports C++$1 features by default,
|
||||
ax_cv_cxx_compile_cxx$1,
|
||||
[AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])],
|
||||
[ax_cv_cxx_compile_cxx$1=yes],
|
||||
[ax_cv_cxx_compile_cxx$1=no])])
|
||||
if test x$ax_cv_cxx_compile_cxx$1 = xyes; then
|
||||
ac_success=yes
|
||||
fi
|
||||
|
||||
m4_if([$2], [noext], [], [dnl
|
||||
if test x$ac_success = xno; then
|
||||
for alternative in ${ax_cxx_compile_alternatives}; do
|
||||
switch="-std=gnu++${alternative}"
|
||||
cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch])
|
||||
AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch,
|
||||
$cachevar,
|
||||
[ac_save_CXX="$CXX"
|
||||
CXX="$CXX $switch"
|
||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])],
|
||||
[eval $cachevar=yes],
|
||||
[eval $cachevar=no])
|
||||
CXX="$ac_save_CXX"])
|
||||
if eval test x\$$cachevar = xyes; then
|
||||
CXX="$CXX $switch"
|
||||
if test -n "$CXXCPP" ; then
|
||||
CXXCPP="$CXXCPP $switch"
|
||||
fi
|
||||
ac_success=yes
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi])
|
||||
|
||||
m4_if([$2], [ext], [], [dnl
|
||||
if test x$ac_success = xno; then
|
||||
dnl HP's aCC needs +std=c++11 according to:
|
||||
dnl http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/PDF_Release_Notes/769149-001.pdf
|
||||
dnl Cray's crayCC needs "-h std=c++11"
|
||||
for alternative in ${ax_cxx_compile_alternatives}; do
|
||||
for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}"; do
|
||||
cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch])
|
||||
AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch,
|
||||
$cachevar,
|
||||
[ac_save_CXX="$CXX"
|
||||
CXX="$CXX $switch"
|
||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])],
|
||||
[eval $cachevar=yes],
|
||||
[eval $cachevar=no])
|
||||
CXX="$ac_save_CXX"])
|
||||
if eval test x\$$cachevar = xyes; then
|
||||
CXX="$CXX $switch"
|
||||
if test -n "$CXXCPP" ; then
|
||||
CXXCPP="$CXXCPP $switch"
|
||||
fi
|
||||
ac_success=yes
|
||||
break
|
||||
fi
|
||||
done
|
||||
if test x$ac_success = xyes; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi])
|
||||
AC_LANG_POP([C++])
|
||||
if test x$ax_cxx_compile_cxx$1_required = xtrue; then
|
||||
if test x$ac_success = xno; then
|
||||
AC_MSG_ERROR([*** A compiler with support for C++$1 language features is required.])
|
||||
fi
|
||||
fi
|
||||
if test x$ac_success = xno; then
|
||||
HAVE_CXX$1=0
|
||||
AC_MSG_NOTICE([No compiler with C++$1 support was found])
|
||||
else
|
||||
HAVE_CXX$1=1
|
||||
AC_DEFINE(HAVE_CXX$1,1,
|
||||
[define if the compiler supports basic C++$1 syntax])
|
||||
fi
|
||||
AC_SUBST(HAVE_CXX$1)
|
||||
m4_if([$1], [17], [AC_MSG_WARN([C++17 is not yet standardized, so the checks may change in incompatible ways anytime])])
|
||||
])
|
||||
|
||||
|
||||
dnl Test body for checking C++11 support
|
||||
|
||||
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_11],
|
||||
_AX_CXX_COMPILE_STDCXX_testbody_new_in_11
|
||||
)
|
||||
|
||||
|
||||
dnl Test body for checking C++14 support
|
||||
|
||||
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_14],
|
||||
_AX_CXX_COMPILE_STDCXX_testbody_new_in_11
|
||||
_AX_CXX_COMPILE_STDCXX_testbody_new_in_14
|
||||
)
|
||||
|
||||
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_17],
|
||||
_AX_CXX_COMPILE_STDCXX_testbody_new_in_11
|
||||
_AX_CXX_COMPILE_STDCXX_testbody_new_in_14
|
||||
_AX_CXX_COMPILE_STDCXX_testbody_new_in_17
|
||||
)
|
||||
|
||||
dnl Tests for new features in C++11
|
||||
|
||||
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_11], [[
|
||||
|
||||
// If the compiler admits that it is not ready for C++11, why torture it?
|
||||
// Hopefully, this will speed up the test.
|
||||
|
||||
#ifndef __cplusplus
|
||||
|
||||
#error "This is not a C++ compiler"
|
||||
|
||||
#elif __cplusplus < 201103L
|
||||
|
||||
#error "This is not a C++11 compiler"
|
||||
|
||||
#else
|
||||
|
||||
namespace cxx11
|
||||
{
|
||||
|
||||
namespace test_static_assert
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
struct check
|
||||
{
|
||||
static_assert(sizeof(int) <= sizeof(T), "not big enough");
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
namespace test_final_override
|
||||
{
|
||||
|
||||
struct Base
|
||||
{
|
||||
virtual void f() {}
|
||||
};
|
||||
|
||||
struct Derived : public Base
|
||||
{
|
||||
virtual void f() override {}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
namespace test_double_right_angle_brackets
|
||||
{
|
||||
|
||||
template < typename T >
|
||||
struct check {};
|
||||
|
||||
typedef check<void> single_type;
|
||||
typedef check<check<void>> double_type;
|
||||
typedef check<check<check<void>>> triple_type;
|
||||
typedef check<check<check<check<void>>>> quadruple_type;
|
||||
|
||||
}
|
||||
|
||||
namespace test_decltype
|
||||
{
|
||||
|
||||
int
|
||||
f()
|
||||
{
|
||||
int a = 1;
|
||||
decltype(a) b = 2;
|
||||
return a + b;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace test_type_deduction
|
||||
{
|
||||
|
||||
template < typename T1, typename T2 >
|
||||
struct is_same
|
||||
{
|
||||
static const bool value = false;
|
||||
};
|
||||
|
||||
template < typename T >
|
||||
struct is_same<T, T>
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
template < typename T1, typename T2 >
|
||||
auto
|
||||
add(T1 a1, T2 a2) -> decltype(a1 + a2)
|
||||
{
|
||||
return a1 + a2;
|
||||
}
|
||||
|
||||
int
|
||||
test(const int c, volatile int v)
|
||||
{
|
||||
static_assert(is_same<int, decltype(0)>::value == true, "");
|
||||
static_assert(is_same<int, decltype(c)>::value == false, "");
|
||||
static_assert(is_same<int, decltype(v)>::value == false, "");
|
||||
auto ac = c;
|
||||
auto av = v;
|
||||
auto sumi = ac + av + 'x';
|
||||
auto sumf = ac + av + 1.0;
|
||||
static_assert(is_same<int, decltype(ac)>::value == true, "");
|
||||
static_assert(is_same<int, decltype(av)>::value == true, "");
|
||||
static_assert(is_same<int, decltype(sumi)>::value == true, "");
|
||||
static_assert(is_same<int, decltype(sumf)>::value == false, "");
|
||||
static_assert(is_same<int, decltype(add(c, v))>::value == true, "");
|
||||
return (sumf > 0.0) ? sumi : add(c, v);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace test_noexcept
|
||||
{
|
||||
|
||||
int f() { return 0; }
|
||||
int g() noexcept { return 0; }
|
||||
|
||||
static_assert(noexcept(f()) == false, "");
|
||||
static_assert(noexcept(g()) == true, "");
|
||||
|
||||
}
|
||||
|
||||
namespace test_constexpr
|
||||
{
|
||||
|
||||
template < typename CharT >
|
||||
unsigned long constexpr
|
||||
strlen_c_r(const CharT *const s, const unsigned long acc) noexcept
|
||||
{
|
||||
return *s ? strlen_c_r(s + 1, acc + 1) : acc;
|
||||
}
|
||||
|
||||
template < typename CharT >
|
||||
unsigned long constexpr
|
||||
strlen_c(const CharT *const s) noexcept
|
||||
{
|
||||
return strlen_c_r(s, 0UL);
|
||||
}
|
||||
|
||||
static_assert(strlen_c("") == 0UL, "");
|
||||
static_assert(strlen_c("1") == 1UL, "");
|
||||
static_assert(strlen_c("example") == 7UL, "");
|
||||
static_assert(strlen_c("another\0example") == 7UL, "");
|
||||
|
||||
}
|
||||
|
||||
namespace test_rvalue_references
|
||||
{
|
||||
|
||||
template < int N >
|
||||
struct answer
|
||||
{
|
||||
static constexpr int value = N;
|
||||
};
|
||||
|
||||
answer<1> f(int&) { return answer<1>(); }
|
||||
answer<2> f(const int&) { return answer<2>(); }
|
||||
answer<3> f(int&&) { return answer<3>(); }
|
||||
|
||||
void
|
||||
test()
|
||||
{
|
||||
int i = 0;
|
||||
const int c = 0;
|
||||
static_assert(decltype(f(i))::value == 1, "");
|
||||
static_assert(decltype(f(c))::value == 2, "");
|
||||
static_assert(decltype(f(0))::value == 3, "");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace test_uniform_initialization
|
||||
{
|
||||
|
||||
struct test
|
||||
{
|
||||
static const int zero {};
|
||||
static const int one {1};
|
||||
};
|
||||
|
||||
static_assert(test::zero == 0, "");
|
||||
static_assert(test::one == 1, "");
|
||||
|
||||
}
|
||||
|
||||
namespace test_lambdas
|
||||
{
|
||||
|
||||
void
|
||||
test1()
|
||||
{
|
||||
auto lambda1 = [](){};
|
||||
auto lambda2 = lambda1;
|
||||
lambda1();
|
||||
lambda2();
|
||||
}
|
||||
|
||||
int
|
||||
test2()
|
||||
{
|
||||
auto a = [](int i, int j){ return i + j; }(1, 2);
|
||||
auto b = []() -> int { return '0'; }();
|
||||
auto c = [=](){ return a + b; }();
|
||||
auto d = [&](){ return c; }();
|
||||
auto e = [a, &b](int x) mutable {
|
||||
const auto identity = [](int y){ return y; };
|
||||
for (auto i = 0; i < a; ++i)
|
||||
a += b--;
|
||||
return x + identity(a + b);
|
||||
}(0);
|
||||
return a + b + c + d + e;
|
||||
}
|
||||
|
||||
int
|
||||
test3()
|
||||
{
|
||||
const auto nullary = [](){ return 0; };
|
||||
const auto unary = [](int x){ return x; };
|
||||
using nullary_t = decltype(nullary);
|
||||
using unary_t = decltype(unary);
|
||||
const auto higher1st = [](nullary_t f){ return f(); };
|
||||
const auto higher2nd = [unary](nullary_t f1){
|
||||
return [unary, f1](unary_t f2){ return f2(unary(f1())); };
|
||||
};
|
||||
return higher1st(nullary) + higher2nd(nullary)(unary);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace test_variadic_templates
|
||||
{
|
||||
|
||||
template <int...>
|
||||
struct sum;
|
||||
|
||||
template <int N0, int... N1toN>
|
||||
struct sum<N0, N1toN...>
|
||||
{
|
||||
static constexpr auto value = N0 + sum<N1toN...>::value;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct sum<>
|
||||
{
|
||||
static constexpr auto value = 0;
|
||||
};
|
||||
|
||||
static_assert(sum<>::value == 0, "");
|
||||
static_assert(sum<1>::value == 1, "");
|
||||
static_assert(sum<23>::value == 23, "");
|
||||
static_assert(sum<1, 2>::value == 3, "");
|
||||
static_assert(sum<5, 5, 11>::value == 21, "");
|
||||
static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, "");
|
||||
|
||||
}
|
||||
|
||||
// http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae
|
||||
// Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function
|
||||
// because of this.
|
||||
namespace test_template_alias_sfinae
|
||||
{
|
||||
|
||||
struct foo {};
|
||||
|
||||
template<typename T>
|
||||
using member = typename T::member_type;
|
||||
|
||||
template<typename T>
|
||||
void func(...) {}
|
||||
|
||||
template<typename T>
|
||||
void func(member<T>*) {}
|
||||
|
||||
void test();
|
||||
|
||||
void test() { func<foo>(0); }
|
||||
|
||||
}
|
||||
|
||||
} // namespace cxx11
|
||||
|
||||
#endif // __cplusplus >= 201103L
|
||||
|
||||
]])
|
||||
|
||||
|
||||
dnl Tests for new features in C++14
|
||||
|
||||
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_14], [[
|
||||
|
||||
// If the compiler admits that it is not ready for C++14, why torture it?
|
||||
// Hopefully, this will speed up the test.
|
||||
|
||||
#ifndef __cplusplus
|
||||
|
||||
#error "This is not a C++ compiler"
|
||||
|
||||
#elif __cplusplus < 201402L
|
||||
|
||||
#error "This is not a C++14 compiler"
|
||||
|
||||
#else
|
||||
|
||||
namespace cxx14
|
||||
{
|
||||
|
||||
namespace test_polymorphic_lambdas
|
||||
{
|
||||
|
||||
int
|
||||
test()
|
||||
{
|
||||
const auto lambda = [](auto&&... args){
|
||||
const auto istiny = [](auto x){
|
||||
return (sizeof(x) == 1UL) ? 1 : 0;
|
||||
};
|
||||
const int aretiny[] = { istiny(args)... };
|
||||
return aretiny[0];
|
||||
};
|
||||
return lambda(1, 1L, 1.0f, '1');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace test_binary_literals
|
||||
{
|
||||
|
||||
constexpr auto ivii = 0b0000000000101010;
|
||||
static_assert(ivii == 42, "wrong value");
|
||||
|
||||
}
|
||||
|
||||
namespace test_generalized_constexpr
|
||||
{
|
||||
|
||||
template < typename CharT >
|
||||
constexpr unsigned long
|
||||
strlen_c(const CharT *const s) noexcept
|
||||
{
|
||||
auto length = 0UL;
|
||||
for (auto p = s; *p; ++p)
|
||||
++length;
|
||||
return length;
|
||||
}
|
||||
|
||||
static_assert(strlen_c("") == 0UL, "");
|
||||
static_assert(strlen_c("x") == 1UL, "");
|
||||
static_assert(strlen_c("test") == 4UL, "");
|
||||
static_assert(strlen_c("another\0test") == 7UL, "");
|
||||
|
||||
}
|
||||
|
||||
namespace test_lambda_init_capture
|
||||
{
|
||||
|
||||
int
|
||||
test()
|
||||
{
|
||||
auto x = 0;
|
||||
const auto lambda1 = [a = x](int b){ return a + b; };
|
||||
const auto lambda2 = [a = lambda1(x)](){ return a; };
|
||||
return lambda2();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace test_digit_separators
|
||||
{
|
||||
|
||||
constexpr auto ten_million = 100'000'000;
|
||||
static_assert(ten_million == 100000000, "");
|
||||
|
||||
}
|
||||
|
||||
namespace test_return_type_deduction
|
||||
{
|
||||
|
||||
auto f(int& x) { return x; }
|
||||
decltype(auto) g(int& x) { return x; }
|
||||
|
||||
template < typename T1, typename T2 >
|
||||
struct is_same
|
||||
{
|
||||
static constexpr auto value = false;
|
||||
};
|
||||
|
||||
template < typename T >
|
||||
struct is_same<T, T>
|
||||
{
|
||||
static constexpr auto value = true;
|
||||
};
|
||||
|
||||
int
|
||||
test()
|
||||
{
|
||||
auto x = 0;
|
||||
static_assert(is_same<int, decltype(f(x))>::value, "");
|
||||
static_assert(is_same<int&, decltype(g(x))>::value, "");
|
||||
return x;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} // namespace cxx14
|
||||
|
||||
#endif // __cplusplus >= 201402L
|
||||
|
||||
]])
|
||||
|
||||
|
||||
dnl Tests for new features in C++17
|
||||
|
||||
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_17], [[
|
||||
|
||||
// If the compiler admits that it is not ready for C++17, why torture it?
|
||||
// Hopefully, this will speed up the test.
|
||||
|
||||
#ifndef __cplusplus
|
||||
|
||||
#error "This is not a C++ compiler"
|
||||
|
||||
#elif __cplusplus <= 201402L
|
||||
|
||||
#error "This is not a C++17 compiler"
|
||||
|
||||
#else
|
||||
|
||||
#if defined(__clang__)
|
||||
#define REALLY_CLANG
|
||||
#else
|
||||
#if defined(__GNUC__)
|
||||
#define REALLY_GCC
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <initializer_list>
|
||||
#include <utility>
|
||||
#include <type_traits>
|
||||
|
||||
namespace cxx17
|
||||
{
|
||||
|
||||
#if !defined(REALLY_CLANG)
|
||||
namespace test_constexpr_lambdas
|
||||
{
|
||||
|
||||
// TODO: test it with clang++ from git
|
||||
|
||||
constexpr int foo = [](){return 42;}();
|
||||
|
||||
}
|
||||
#endif // !defined(REALLY_CLANG)
|
||||
|
||||
namespace test::nested_namespace::definitions
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
namespace test_fold_expression
|
||||
{
|
||||
|
||||
template<typename... Args>
|
||||
int multiply(Args... args)
|
||||
{
|
||||
return (args * ... * 1);
|
||||
}
|
||||
|
||||
template<typename... Args>
|
||||
bool all(Args... args)
|
||||
{
|
||||
return (args && ...);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace test_extended_static_assert
|
||||
{
|
||||
|
||||
static_assert (true);
|
||||
|
||||
}
|
||||
|
||||
namespace test_auto_brace_init_list
|
||||
{
|
||||
|
||||
auto foo = {5};
|
||||
auto bar {5};
|
||||
|
||||
static_assert(std::is_same<std::initializer_list<int>, decltype(foo)>::value);
|
||||
static_assert(std::is_same<int, decltype(bar)>::value);
|
||||
}
|
||||
|
||||
namespace test_typename_in_template_template_parameter
|
||||
{
|
||||
|
||||
template<template<typename> typename X> struct D;
|
||||
|
||||
}
|
||||
|
||||
namespace test_fallthrough_nodiscard_maybe_unused_attributes
|
||||
{
|
||||
|
||||
int f1()
|
||||
{
|
||||
return 42;
|
||||
}
|
||||
|
||||
[[nodiscard]] int f2()
|
||||
{
|
||||
[[maybe_unused]] auto unused = f1();
|
||||
|
||||
switch (f1())
|
||||
{
|
||||
case 17:
|
||||
f1();
|
||||
[[fallthrough]];
|
||||
case 42:
|
||||
f1();
|
||||
}
|
||||
return f1();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace test_extended_aggregate_initialization
|
||||
{
|
||||
|
||||
struct base1
|
||||
{
|
||||
int b1, b2 = 42;
|
||||
};
|
||||
|
||||
struct base2
|
||||
{
|
||||
base2() {
|
||||
b3 = 42;
|
||||
}
|
||||
int b3;
|
||||
};
|
||||
|
||||
struct derived : base1, base2
|
||||
{
|
||||
int d;
|
||||
};
|
||||
|
||||
derived d1 {{1, 2}, {}, 4}; // full initialization
|
||||
derived d2 {{}, {}, 4}; // value-initialized bases
|
||||
|
||||
}
|
||||
|
||||
namespace test_general_range_based_for_loop
|
||||
{
|
||||
|
||||
struct iter
|
||||
{
|
||||
int i;
|
||||
|
||||
int& operator* ()
|
||||
{
|
||||
return i;
|
||||
}
|
||||
|
||||
const int& operator* () const
|
||||
{
|
||||
return i;
|
||||
}
|
||||
|
||||
iter& operator++()
|
||||
{
|
||||
++i;
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
struct sentinel
|
||||
{
|
||||
int i;
|
||||
};
|
||||
|
||||
bool operator== (const iter& i, const sentinel& s)
|
||||
{
|
||||
return i.i == s.i;
|
||||
}
|
||||
|
||||
bool operator!= (const iter& i, const sentinel& s)
|
||||
{
|
||||
return !(i == s);
|
||||
}
|
||||
|
||||
struct range
|
||||
{
|
||||
iter begin() const
|
||||
{
|
||||
return {0};
|
||||
}
|
||||
|
||||
sentinel end() const
|
||||
{
|
||||
return {5};
|
||||
}
|
||||
};
|
||||
|
||||
void f()
|
||||
{
|
||||
range r {};
|
||||
|
||||
for (auto i : r)
|
||||
{
|
||||
[[maybe_unused]] auto v = i;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace test_lambda_capture_asterisk_this_by_value
|
||||
{
|
||||
|
||||
struct t
|
||||
{
|
||||
int i;
|
||||
int foo()
|
||||
{
|
||||
return [*this]()
|
||||
{
|
||||
return i;
|
||||
}();
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
namespace test_enum_class_construction
|
||||
{
|
||||
|
||||
enum class byte : unsigned char
|
||||
{};
|
||||
|
||||
byte foo {42};
|
||||
|
||||
}
|
||||
|
||||
namespace test_constexpr_if
|
||||
{
|
||||
|
||||
template <bool cond>
|
||||
int f ()
|
||||
{
|
||||
if constexpr(cond)
|
||||
{
|
||||
return 13;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 42;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace test_selection_statement_with_initializer
|
||||
{
|
||||
|
||||
int f()
|
||||
{
|
||||
return 13;
|
||||
}
|
||||
|
||||
int f2()
|
||||
{
|
||||
if (auto i = f(); i > 0)
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
switch (auto i = f(); i + 4)
|
||||
{
|
||||
case 17:
|
||||
return 2;
|
||||
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#if !defined(REALLY_CLANG)
|
||||
namespace test_template_argument_deduction_for_class_templates
|
||||
{
|
||||
|
||||
// TODO: test it with clang++ from git
|
||||
|
||||
template <typename T1, typename T2>
|
||||
struct pair
|
||||
{
|
||||
pair (T1 p1, T2 p2)
|
||||
: m1 {p1},
|
||||
m2 {p2}
|
||||
{}
|
||||
|
||||
T1 m1;
|
||||
T2 m2;
|
||||
};
|
||||
|
||||
void f()
|
||||
{
|
||||
[[maybe_unused]] auto p = pair{13, 42u};
|
||||
}
|
||||
|
||||
}
|
||||
#endif // !defined(REALLY_CLANG)
|
||||
|
||||
namespace test_non_type_auto_template_parameters
|
||||
{
|
||||
|
||||
template <auto n>
|
||||
struct B
|
||||
{};
|
||||
|
||||
B<5> b1;
|
||||
B<'a'> b2;
|
||||
|
||||
}
|
||||
|
||||
#if !defined(REALLY_CLANG)
|
||||
namespace test_structured_bindings
|
||||
{
|
||||
|
||||
// TODO: test it with clang++ from git
|
||||
|
||||
int arr[2] = { 1, 2 };
|
||||
std::pair<int, int> pr = { 1, 2 };
|
||||
|
||||
auto f1() -> int(&)[2]
|
||||
{
|
||||
return arr;
|
||||
}
|
||||
|
||||
auto f2() -> std::pair<int, int>&
|
||||
{
|
||||
return pr;
|
||||
}
|
||||
|
||||
struct S
|
||||
{
|
||||
int x1 : 2;
|
||||
volatile double y1;
|
||||
};
|
||||
|
||||
S f3()
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
auto [ x1, y1 ] = f1();
|
||||
auto& [ xr1, yr1 ] = f1();
|
||||
auto [ x2, y2 ] = f2();
|
||||
auto& [ xr2, yr2 ] = f2();
|
||||
const auto [ x3, y3 ] = f3();
|
||||
|
||||
}
|
||||
#endif // !defined(REALLY_CLANG)
|
||||
|
||||
#if !defined(REALLY_CLANG)
|
||||
namespace test_exception_spec_type_system
|
||||
{
|
||||
|
||||
// TODO: test it with clang++ from git
|
||||
|
||||
struct Good {};
|
||||
struct Bad {};
|
||||
|
||||
void g1() noexcept;
|
||||
void g2();
|
||||
|
||||
template<typename T>
|
||||
Bad
|
||||
f(T*, T*);
|
||||
|
||||
template<typename T1, typename T2>
|
||||
Good
|
||||
f(T1*, T2*);
|
||||
|
||||
static_assert (std::is_same_v<Good, decltype(f(g1, g2))>);
|
||||
|
||||
}
|
||||
#endif // !defined(REALLY_CLANG)
|
||||
|
||||
namespace test_inline_variables
|
||||
{
|
||||
|
||||
template<class T> void f(T)
|
||||
{}
|
||||
|
||||
template<class T> inline T g(T)
|
||||
{
|
||||
return T{};
|
||||
}
|
||||
|
||||
template<> inline void f<>(int)
|
||||
{}
|
||||
|
||||
template<> int g<>(int)
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} // namespace cxx17
|
||||
|
||||
#endif // __cplusplus <= 201402L
|
||||
|
||||
]])
|
|
@ -0,0 +1,27 @@
|
|||
# configmake.m4 serial 3
|
||||
dnl Copyright (C) 2010-2018 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
AC_PREREQ([2.60])
|
||||
|
||||
# gl_CONFIGMAKE_PREP
|
||||
# ------------------
|
||||
# Guarantee all of the standard directory variables, even when used with
|
||||
# autoconf 2.63 (runstatedir wasn't supported before 2.70) or
|
||||
# automake 1.11 (runstatedir isn't supported even in 1.16.1).
|
||||
AC_DEFUN([gl_CONFIGMAKE_PREP],
|
||||
[
|
||||
if test "x$lispdir" = x; then
|
||||
AC_SUBST([lispdir], ['${datarootdir}/emacs/site-lisp'])
|
||||
fi
|
||||
dnl Added in autoconf 2.70.
|
||||
if test "x$runstatedir" = x; then
|
||||
AC_SUBST([runstatedir], ['${localstatedir}/run'])
|
||||
fi
|
||||
|
||||
dnl Automake 1.11 provides pkglibexecdir merely without AC_SUBST.
|
||||
dnl This blind use of AC_SUBST is safe.
|
||||
AC_SUBST([pkglibexecdir], ['${libexecdir}/${PACKAGE}'])
|
||||
])
|
|
@ -0,0 +1,189 @@
|
|||
# serial 18 -*- Autoconf -*-
|
||||
# Enable extensions on systems that normally disable them.
|
||||
|
||||
# Copyright (C) 2003, 2006-2018 Free Software Foundation, Inc.
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This definition of AC_USE_SYSTEM_EXTENSIONS is stolen from git
|
||||
# Autoconf. Perhaps we can remove this once we can assume Autoconf
|
||||
# 2.70 or later everywhere, but since Autoconf mutates rapidly
|
||||
# enough in this area it's likely we'll need to redefine
|
||||
# AC_USE_SYSTEM_EXTENSIONS for quite some time.
|
||||
|
||||
# If autoconf reports a warning
|
||||
# warning: AC_COMPILE_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS
|
||||
# or warning: AC_RUN_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS
|
||||
# the fix is
|
||||
# 1) to ensure that AC_USE_SYSTEM_EXTENSIONS is never directly invoked
|
||||
# but always AC_REQUIREd,
|
||||
# 2) to ensure that for each occurrence of
|
||||
# AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
|
||||
# or
|
||||
# AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
|
||||
# the corresponding gnulib module description has 'extensions' among
|
||||
# its dependencies. This will ensure that the gl_USE_SYSTEM_EXTENSIONS
|
||||
# invocation occurs in gl_EARLY, not in gl_INIT.
|
||||
|
||||
# AC_USE_SYSTEM_EXTENSIONS
|
||||
# ------------------------
|
||||
# Enable extensions on systems that normally disable them,
|
||||
# typically due to standards-conformance issues.
|
||||
#
|
||||
# Remember that #undef in AH_VERBATIM gets replaced with #define by
|
||||
# AC_DEFINE. The goal here is to define all known feature-enabling
|
||||
# macros, then, if reports of conflicts are made, disable macros that
|
||||
# cause problems on some platforms (such as __EXTENSIONS__).
|
||||
AC_DEFUN_ONCE([AC_USE_SYSTEM_EXTENSIONS],
|
||||
[AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
|
||||
AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
|
||||
|
||||
AC_CHECK_HEADER([minix/config.h], [MINIX=yes], [MINIX=])
|
||||
if test "$MINIX" = yes; then
|
||||
AC_DEFINE([_POSIX_SOURCE], [1],
|
||||
[Define to 1 if you need to in order for 'stat' and other
|
||||
things to work.])
|
||||
AC_DEFINE([_POSIX_1_SOURCE], [2],
|
||||
[Define to 2 if the system does not provide POSIX.1 features
|
||||
except with this defined.])
|
||||
AC_DEFINE([_MINIX], [1],
|
||||
[Define to 1 if on MINIX.])
|
||||
AC_DEFINE([_NETBSD_SOURCE], [1],
|
||||
[Define to 1 to make NetBSD features available. MINIX 3 needs this.])
|
||||
fi
|
||||
|
||||
dnl Use a different key than __EXTENSIONS__, as that name broke existing
|
||||
dnl configure.ac when using autoheader 2.62.
|
||||
AH_VERBATIM([USE_SYSTEM_EXTENSIONS],
|
||||
[/* Enable extensions on AIX 3, Interix. */
|
||||
#ifndef _ALL_SOURCE
|
||||
# undef _ALL_SOURCE
|
||||
#endif
|
||||
/* Enable general extensions on macOS. */
|
||||
#ifndef _DARWIN_C_SOURCE
|
||||
# undef _DARWIN_C_SOURCE
|
||||
#endif
|
||||
/* Enable GNU extensions on systems that have them. */
|
||||
#ifndef _GNU_SOURCE
|
||||
# undef _GNU_SOURCE
|
||||
#endif
|
||||
/* Enable NetBSD extensions on NetBSD. */
|
||||
#ifndef _NETBSD_SOURCE
|
||||
# undef _NETBSD_SOURCE
|
||||
#endif
|
||||
/* Enable OpenBSD extensions on NetBSD. */
|
||||
#ifndef _OPENBSD_SOURCE
|
||||
# undef _OPENBSD_SOURCE
|
||||
#endif
|
||||
/* Enable threading extensions on Solaris. */
|
||||
#ifndef _POSIX_PTHREAD_SEMANTICS
|
||||
# undef _POSIX_PTHREAD_SEMANTICS
|
||||
#endif
|
||||
/* Enable extensions specified by ISO/IEC TS 18661-5:2014. */
|
||||
#ifndef __STDC_WANT_IEC_60559_ATTRIBS_EXT__
|
||||
# undef __STDC_WANT_IEC_60559_ATTRIBS_EXT__
|
||||
#endif
|
||||
/* Enable extensions specified by ISO/IEC TS 18661-1:2014. */
|
||||
#ifndef __STDC_WANT_IEC_60559_BFP_EXT__
|
||||
# undef __STDC_WANT_IEC_60559_BFP_EXT__
|
||||
#endif
|
||||
/* Enable extensions specified by ISO/IEC TS 18661-2:2015. */
|
||||
#ifndef __STDC_WANT_IEC_60559_DFP_EXT__
|
||||
# undef __STDC_WANT_IEC_60559_DFP_EXT__
|
||||
#endif
|
||||
/* Enable extensions specified by ISO/IEC TS 18661-4:2015. */
|
||||
#ifndef __STDC_WANT_IEC_60559_FUNCS_EXT__
|
||||
# undef __STDC_WANT_IEC_60559_FUNCS_EXT__
|
||||
#endif
|
||||
/* Enable extensions specified by ISO/IEC TS 18661-3:2015. */
|
||||
#ifndef __STDC_WANT_IEC_60559_TYPES_EXT__
|
||||
# undef __STDC_WANT_IEC_60559_TYPES_EXT__
|
||||
#endif
|
||||
/* Enable extensions specified by ISO/IEC TR 24731-2:2010. */
|
||||
#ifndef __STDC_WANT_LIB_EXT2__
|
||||
# undef __STDC_WANT_LIB_EXT2__
|
||||
#endif
|
||||
/* Enable extensions specified by ISO/IEC 24747:2009. */
|
||||
#ifndef __STDC_WANT_MATH_SPEC_FUNCS__
|
||||
# undef __STDC_WANT_MATH_SPEC_FUNCS__
|
||||
#endif
|
||||
/* Enable extensions on HP NonStop. */
|
||||
#ifndef _TANDEM_SOURCE
|
||||
# undef _TANDEM_SOURCE
|
||||
#endif
|
||||
/* Enable X/Open extensions if necessary. HP-UX 11.11 defines
|
||||
mbstate_t only if _XOPEN_SOURCE is defined to 500, regardless of
|
||||
whether compiling with -Ae or -D_HPUX_SOURCE=1. */
|
||||
#ifndef _XOPEN_SOURCE
|
||||
# undef _XOPEN_SOURCE
|
||||
#endif
|
||||
/* Enable X/Open compliant socket functions that do not require linking
|
||||
with -lxnet on HP-UX 11.11. */
|
||||
#ifndef _HPUX_ALT_XOPEN_SOCKET_API
|
||||
# undef _HPUX_ALT_XOPEN_SOCKET_API
|
||||
#endif
|
||||
/* Enable general extensions on Solaris. */
|
||||
#ifndef __EXTENSIONS__
|
||||
# undef __EXTENSIONS__
|
||||
#endif
|
||||
])
|
||||
AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__],
|
||||
[ac_cv_safe_to_define___extensions__],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[
|
||||
# define __EXTENSIONS__ 1
|
||||
]AC_INCLUDES_DEFAULT])],
|
||||
[ac_cv_safe_to_define___extensions__=yes],
|
||||
[ac_cv_safe_to_define___extensions__=no])])
|
||||
test $ac_cv_safe_to_define___extensions__ = yes &&
|
||||
AC_DEFINE([__EXTENSIONS__])
|
||||
AC_DEFINE([_ALL_SOURCE])
|
||||
AC_DEFINE([_DARWIN_C_SOURCE])
|
||||
AC_DEFINE([_GNU_SOURCE])
|
||||
AC_DEFINE([_NETBSD_SOURCE])
|
||||
AC_DEFINE([_OPENBSD_SOURCE])
|
||||
AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
|
||||
AC_DEFINE([__STDC_WANT_IEC_60559_ATTRIBS_EXT__])
|
||||
AC_DEFINE([__STDC_WANT_IEC_60559_BFP_EXT__])
|
||||
AC_DEFINE([__STDC_WANT_IEC_60559_DFP_EXT__])
|
||||
AC_DEFINE([__STDC_WANT_IEC_60559_FUNCS_EXT__])
|
||||
AC_DEFINE([__STDC_WANT_IEC_60559_TYPES_EXT__])
|
||||
AC_DEFINE([__STDC_WANT_LIB_EXT2__])
|
||||
AC_DEFINE([__STDC_WANT_MATH_SPEC_FUNCS__])
|
||||
AC_DEFINE([_TANDEM_SOURCE])
|
||||
AC_CACHE_CHECK([whether _XOPEN_SOURCE should be defined],
|
||||
[ac_cv_should_define__xopen_source],
|
||||
[ac_cv_should_define__xopen_source=no
|
||||
AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[
|
||||
#include <wchar.h>
|
||||
mbstate_t x;]])],
|
||||
[],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[
|
||||
#define _XOPEN_SOURCE 500
|
||||
#include <wchar.h>
|
||||
mbstate_t x;]])],
|
||||
[ac_cv_should_define__xopen_source=yes])])])
|
||||
test $ac_cv_should_define__xopen_source = yes &&
|
||||
AC_DEFINE([_XOPEN_SOURCE], [500])
|
||||
AC_DEFINE([_HPUX_ALT_XOPEN_SOCKET_API])
|
||||
])# AC_USE_SYSTEM_EXTENSIONS
|
||||
|
||||
# gl_USE_SYSTEM_EXTENSIONS
|
||||
# ------------------------
|
||||
# Enable extensions on systems that normally disable them,
|
||||
# typically due to standards-conformance issues.
|
||||
AC_DEFUN_ONCE([gl_USE_SYSTEM_EXTENSIONS],
|
||||
[
|
||||
dnl Require this macro before AC_USE_SYSTEM_EXTENSIONS.
|
||||
dnl gnulib does not need it. But if it gets required by third-party macros
|
||||
dnl after AC_USE_SYSTEM_EXTENSIONS is required, autoconf 2.62..2.63 emit a
|
||||
dnl warning: "AC_COMPILE_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS".
|
||||
dnl Note: We can do this only for one of the macros AC_AIX, AC_GNU_SOURCE,
|
||||
dnl AC_MINIX. If people still use AC_AIX or AC_MINIX, they are out of luck.
|
||||
AC_REQUIRE([AC_GNU_SOURCE])
|
||||
|
||||
AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
|
||||
])
|
|
@ -0,0 +1,114 @@
|
|||
dnl 'extern inline' a la ISO C99.
|
||||
|
||||
dnl Copyright 2012-2018 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
AC_DEFUN([gl_EXTERN_INLINE],
|
||||
[
|
||||
AH_VERBATIM([extern_inline],
|
||||
[/* Please see the Gnulib manual for how to use these macros.
|
||||
|
||||
Suppress extern inline with HP-UX cc, as it appears to be broken; see
|
||||
<https://lists.gnu.org/r/bug-texinfo/2013-02/msg00030.html>.
|
||||
|
||||
Suppress extern inline with Sun C in standards-conformance mode, as it
|
||||
mishandles inline functions that call each other. E.g., for 'inline void f
|
||||
(void) { } inline void g (void) { f (); }', c99 incorrectly complains
|
||||
'reference to static identifier "f" in extern inline function'.
|
||||
This bug was observed with Sun C 5.12 SunOS_i386 2011/11/16.
|
||||
|
||||
Suppress extern inline (with or without __attribute__ ((__gnu_inline__)))
|
||||
on configurations that mistakenly use 'static inline' to implement
|
||||
functions or macros in standard C headers like <ctype.h>. For example,
|
||||
if isdigit is mistakenly implemented via a static inline function,
|
||||
a program containing an extern inline function that calls isdigit
|
||||
may not work since the C standard prohibits extern inline functions
|
||||
from calling static functions (ISO C 99 section 6.7.4.(3).
|
||||
This bug is known to occur on:
|
||||
|
||||
OS X 10.8 and earlier; see:
|
||||
https://lists.gnu.org/r/bug-gnulib/2012-12/msg00023.html
|
||||
|
||||
DragonFly; see
|
||||
http://muscles.dragonflybsd.org/bulk/bleeding-edge-potential/latest-per-pkg/ah-tty-0.3.12.log
|
||||
|
||||
FreeBSD; see:
|
||||
https://lists.gnu.org/r/bug-gnulib/2014-07/msg00104.html
|
||||
|
||||
OS X 10.9 has a macro __header_inline indicating the bug is fixed for C and
|
||||
for clang but remains for g++; see <https://trac.macports.org/ticket/41033>.
|
||||
Assume DragonFly and FreeBSD will be similar.
|
||||
|
||||
GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99
|
||||
inline semantics, unless -fgnu89-inline is used. It defines a macro
|
||||
__GNUC_STDC_INLINE__ to indicate this situation or a macro
|
||||
__GNUC_GNU_INLINE__ to indicate the opposite situation.
|
||||
GCC 4.2 with -std=c99 or -std=gnu99 implements the GNU C inline
|
||||
semantics but warns, unless -fgnu89-inline is used:
|
||||
warning: C99 inline functions are not supported; using GNU89
|
||||
warning: to disable this warning use -fgnu89-inline or the gnu_inline function attribute
|
||||
It defines a macro __GNUC_GNU_INLINE__ to indicate this situation.
|
||||
*/
|
||||
#if (((defined __APPLE__ && defined __MACH__) \
|
||||
|| defined __DragonFly__ || defined __FreeBSD__) \
|
||||
&& (defined __header_inline \
|
||||
? (defined __cplusplus && defined __GNUC_STDC_INLINE__ \
|
||||
&& ! defined __clang__) \
|
||||
: ((! defined _DONT_USE_CTYPE_INLINE_ \
|
||||
&& (defined __GNUC__ || defined __cplusplus)) \
|
||||
|| (defined _FORTIFY_SOURCE && 0 < _FORTIFY_SOURCE \
|
||||
&& defined __GNUC__ && ! defined __cplusplus))))
|
||||
# define _GL_EXTERN_INLINE_STDHEADER_BUG
|
||||
#endif
|
||||
#if ((__GNUC__ \
|
||||
? defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ \
|
||||
: (199901L <= __STDC_VERSION__ \
|
||||
&& !defined __HP_cc \
|
||||
&& !defined __PGI \
|
||||
&& !(defined __SUNPRO_C && __STDC__))) \
|
||||
&& !defined _GL_EXTERN_INLINE_STDHEADER_BUG)
|
||||
# define _GL_INLINE inline
|
||||
# define _GL_EXTERN_INLINE extern inline
|
||||
# define _GL_EXTERN_INLINE_IN_USE
|
||||
#elif (2 < __GNUC__ + (7 <= __GNUC_MINOR__) && !defined __STRICT_ANSI__ \
|
||||
&& !defined _GL_EXTERN_INLINE_STDHEADER_BUG)
|
||||
# if defined __GNUC_GNU_INLINE__ && __GNUC_GNU_INLINE__
|
||||
/* __gnu_inline__ suppresses a GCC 4.2 diagnostic. */
|
||||
# define _GL_INLINE extern inline __attribute__ ((__gnu_inline__))
|
||||
# else
|
||||
# define _GL_INLINE extern inline
|
||||
# endif
|
||||
# define _GL_EXTERN_INLINE extern
|
||||
# define _GL_EXTERN_INLINE_IN_USE
|
||||
#else
|
||||
# define _GL_INLINE static _GL_UNUSED
|
||||
# define _GL_EXTERN_INLINE static _GL_UNUSED
|
||||
#endif
|
||||
|
||||
/* In GCC 4.6 (inclusive) to 5.1 (exclusive),
|
||||
suppress bogus "no previous prototype for 'FOO'"
|
||||
and "no previous declaration for 'FOO'" diagnostics,
|
||||
when FOO is an inline function in the header; see
|
||||
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54113> and
|
||||
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63877>. */
|
||||
#if __GNUC__ == 4 && 6 <= __GNUC_MINOR__
|
||||
# if defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__
|
||||
# define _GL_INLINE_HEADER_CONST_PRAGMA
|
||||
# else
|
||||
# define _GL_INLINE_HEADER_CONST_PRAGMA \
|
||||
_Pragma ("GCC diagnostic ignored \"-Wsuggest-attribute=const\"")
|
||||
# endif
|
||||
# define _GL_INLINE_HEADER_BEGIN \
|
||||
_Pragma ("GCC diagnostic push") \
|
||||
_Pragma ("GCC diagnostic ignored \"-Wmissing-prototypes\"") \
|
||||
_Pragma ("GCC diagnostic ignored \"-Wmissing-declarations\"") \
|
||||
_GL_INLINE_HEADER_CONST_PRAGMA
|
||||
# define _GL_INLINE_HEADER_END \
|
||||
_Pragma ("GCC diagnostic pop")
|
||||
#else
|
||||
# define _GL_INLINE_HEADER_BEGIN
|
||||
# define _GL_INLINE_HEADER_END
|
||||
#endif])
|
||||
])
|
|
@ -0,0 +1,24 @@
|
|||
# flock.m4 serial 3
|
||||
dnl Copyright (C) 2008-2018 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
AC_DEFUN([gl_FUNC_FLOCK],
|
||||
[
|
||||
AC_REQUIRE([gl_HEADER_SYS_FILE_H_DEFAULTS])
|
||||
AC_CHECK_FUNCS_ONCE([flock])
|
||||
if test $ac_cv_func_flock = no; then
|
||||
HAVE_FLOCK=0
|
||||
fi
|
||||
])
|
||||
|
||||
dnl Prerequisites of lib/flock.c.
|
||||
AC_DEFUN([gl_PREREQ_FLOCK],
|
||||
[
|
||||
AC_CHECK_FUNCS_ONCE([fcntl])
|
||||
AC_CHECK_HEADERS_ONCE([unistd.h])
|
||||
|
||||
dnl Do we have a POSIX fcntl lock implementation?
|
||||
AC_CHECK_MEMBERS([struct flock.l_type],[],[],[[#include <fcntl.h>]])
|
||||
])
|
|
@ -0,0 +1,379 @@
|
|||
# getopt.m4 serial 46
|
||||
dnl Copyright (C) 2002-2006, 2008-2018 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# Request a POSIX compliant getopt function.
|
||||
AC_DEFUN([gl_FUNC_GETOPT_POSIX],
|
||||
[
|
||||
m4_divert_text([DEFAULTS], [gl_getopt_required=POSIX])
|
||||
AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
|
||||
AC_REQUIRE([gl_GETOPT_CHECK_HEADERS])
|
||||
dnl Other modules can request the gnulib implementation of the getopt
|
||||
dnl functions unconditionally, by defining gl_REPLACE_GETOPT_ALWAYS.
|
||||
dnl argp.m4 does this.
|
||||
m4_ifdef([gl_REPLACE_GETOPT_ALWAYS], [
|
||||
REPLACE_GETOPT=1
|
||||
], [
|
||||
REPLACE_GETOPT=0
|
||||
if test -n "$gl_replace_getopt"; then
|
||||
REPLACE_GETOPT=1
|
||||
fi
|
||||
])
|
||||
if test $REPLACE_GETOPT = 1; then
|
||||
dnl Arrange for getopt.h to be created.
|
||||
gl_GETOPT_SUBSTITUTE_HEADER
|
||||
fi
|
||||
])
|
||||
|
||||
# Request a POSIX compliant getopt function with GNU extensions (such as
|
||||
# options with optional arguments) and the functions getopt_long,
|
||||
# getopt_long_only.
|
||||
AC_DEFUN([gl_FUNC_GETOPT_GNU],
|
||||
[
|
||||
dnl Set the variable gl_getopt_required, so that all invocations of
|
||||
dnl gl_GETOPT_CHECK_HEADERS in the scope of the current configure file
|
||||
dnl will check for getopt with GNU extensions.
|
||||
dnl This means that if one gnulib-tool invocation requests getopt-posix
|
||||
dnl and another gnulib-tool invocation requests getopt-gnu, it is as if
|
||||
dnl both had requested getopt-gnu.
|
||||
m4_divert_text([INIT_PREPARE], [gl_getopt_required=GNU])
|
||||
|
||||
dnl No need to invoke gl_FUNC_GETOPT_POSIX here; this is automatically
|
||||
dnl done through the module dependency getopt-gnu -> getopt-posix.
|
||||
])
|
||||
|
||||
# Determine whether to replace the entire getopt facility.
|
||||
AC_DEFUN([gl_GETOPT_CHECK_HEADERS],
|
||||
[
|
||||
AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
|
||||
AC_REQUIRE([AC_PROG_AWK]) dnl for awk that supports ENVIRON
|
||||
|
||||
dnl Persuade Solaris <unistd.h> to declare optarg, optind, opterr, optopt.
|
||||
AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
|
||||
|
||||
gl_CHECK_NEXT_HEADERS([getopt.h])
|
||||
if test $ac_cv_header_getopt_h = yes; then
|
||||
HAVE_GETOPT_H=1
|
||||
else
|
||||
HAVE_GETOPT_H=0
|
||||
fi
|
||||
AC_SUBST([HAVE_GETOPT_H])
|
||||
|
||||
gl_replace_getopt=
|
||||
|
||||
dnl Test whether <getopt.h> is available.
|
||||
if test -z "$gl_replace_getopt" && test $gl_getopt_required = GNU; then
|
||||
AC_CHECK_HEADERS([getopt.h], [], [gl_replace_getopt=yes])
|
||||
fi
|
||||
|
||||
dnl Test whether the function getopt_long is available.
|
||||
if test -z "$gl_replace_getopt" && test $gl_getopt_required = GNU; then
|
||||
AC_CHECK_FUNCS([getopt_long_only], [], [gl_replace_getopt=yes])
|
||||
fi
|
||||
|
||||
dnl POSIX 2008 does not specify leading '+' behavior, but see
|
||||
dnl http://austingroupbugs.net/view.php?id=191 for a recommendation on
|
||||
dnl the next version of POSIX. For now, we only guarantee leading '+'
|
||||
dnl behavior with getopt-gnu.
|
||||
if test -z "$gl_replace_getopt"; then
|
||||
AC_CACHE_CHECK([whether getopt is POSIX compatible],
|
||||
[gl_cv_func_getopt_posix],
|
||||
[
|
||||
dnl Merging these three different test programs into a single one
|
||||
dnl would require a reset mechanism. On BSD systems, it can be done
|
||||
dnl through 'optreset'; on some others (glibc), it can be done by
|
||||
dnl setting 'optind' to 0; on others again (HP-UX, IRIX, OSF/1,
|
||||
dnl Solaris 9, musl libc), there is no such mechanism.
|
||||
if test $cross_compiling = no; then
|
||||
dnl Sanity check. Succeeds everywhere (except on MSVC,
|
||||
dnl which lacks <unistd.h> and getopt() entirely).
|
||||
AC_RUN_IFELSE(
|
||||
[AC_LANG_SOURCE([[
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
static char program[] = "program";
|
||||
static char a[] = "-a";
|
||||
static char foo[] = "foo";
|
||||
static char bar[] = "bar";
|
||||
char *argv[] = { program, a, foo, bar, NULL };
|
||||
int c;
|
||||
|
||||
c = getopt (4, argv, "ab");
|
||||
if (!(c == 'a'))
|
||||
return 1;
|
||||
c = getopt (4, argv, "ab");
|
||||
if (!(c == -1))
|
||||
return 2;
|
||||
if (!(optind == 2))
|
||||
return 3;
|
||||
return 0;
|
||||
}
|
||||
]])],
|
||||
[gl_cv_func_getopt_posix=maybe],
|
||||
[gl_cv_func_getopt_posix=no])
|
||||
if test $gl_cv_func_getopt_posix = maybe; then
|
||||
dnl Sanity check with '+'. Succeeds everywhere (except on MSVC,
|
||||
dnl which lacks <unistd.h> and getopt() entirely).
|
||||
AC_RUN_IFELSE(
|
||||
[AC_LANG_SOURCE([[
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
static char program[] = "program";
|
||||
static char donald[] = "donald";
|
||||
static char p[] = "-p";
|
||||
static char billy[] = "billy";
|
||||
static char duck[] = "duck";
|
||||
static char a[] = "-a";
|
||||
static char bar[] = "bar";
|
||||
char *argv[] = { program, donald, p, billy, duck, a, bar, NULL };
|
||||
int c;
|
||||
|
||||
c = getopt (7, argv, "+abp:q:");
|
||||
if (!(c == -1))
|
||||
return 4;
|
||||
if (!(strcmp (argv[0], "program") == 0))
|
||||
return 5;
|
||||
if (!(strcmp (argv[1], "donald") == 0))
|
||||
return 6;
|
||||
if (!(strcmp (argv[2], "-p") == 0))
|
||||
return 7;
|
||||
if (!(strcmp (argv[3], "billy") == 0))
|
||||
return 8;
|
||||
if (!(strcmp (argv[4], "duck") == 0))
|
||||
return 9;
|
||||
if (!(strcmp (argv[5], "-a") == 0))
|
||||
return 10;
|
||||
if (!(strcmp (argv[6], "bar") == 0))
|
||||
return 11;
|
||||
if (!(optind == 1))
|
||||
return 12;
|
||||
return 0;
|
||||
}
|
||||
]])],
|
||||
[gl_cv_func_getopt_posix=maybe],
|
||||
[gl_cv_func_getopt_posix=no])
|
||||
fi
|
||||
if test $gl_cv_func_getopt_posix = maybe; then
|
||||
dnl Detect Mac OS X 10.5, AIX 7.1, mingw bug.
|
||||
AC_RUN_IFELSE(
|
||||
[AC_LANG_SOURCE([[
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
static char program[] = "program";
|
||||
static char ab[] = "-ab";
|
||||
char *argv[3] = { program, ab, NULL };
|
||||
if (getopt (2, argv, "ab:") != 'a')
|
||||
return 13;
|
||||
if (getopt (2, argv, "ab:") != '?')
|
||||
return 14;
|
||||
if (optopt != 'b')
|
||||
return 15;
|
||||
if (optind != 2)
|
||||
return 16;
|
||||
return 0;
|
||||
}
|
||||
]])],
|
||||
[gl_cv_func_getopt_posix=yes],
|
||||
[gl_cv_func_getopt_posix=no])
|
||||
fi
|
||||
else
|
||||
case "$host_os" in
|
||||
darwin* | aix* | mingw*) gl_cv_func_getopt_posix="guessing no";;
|
||||
*) gl_cv_func_getopt_posix="guessing yes";;
|
||||
esac
|
||||
fi
|
||||
])
|
||||
case "$gl_cv_func_getopt_posix" in
|
||||
*no) gl_replace_getopt=yes ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
if test -z "$gl_replace_getopt" && test $gl_getopt_required = GNU; then
|
||||
AC_CACHE_CHECK([for working GNU getopt function], [gl_cv_func_getopt_gnu],
|
||||
[# Even with POSIXLY_CORRECT, the GNU extension of leading '-' in the
|
||||
# optstring is necessary for programs like m4 that have POSIX-mandated
|
||||
# semantics for supporting options interspersed with files.
|
||||
# Also, since getopt_long is a GNU extension, we require optind=0.
|
||||
# Bash ties 'set -o posix' to a non-exported POSIXLY_CORRECT;
|
||||
# so take care to revert to the correct (non-)export state.
|
||||
dnl GNU Coding Standards currently allow awk but not env; besides, env
|
||||
dnl is ambiguous with environment values that contain newlines.
|
||||
gl_awk_probe='BEGIN { if ("POSIXLY_CORRECT" in ENVIRON) print "x" }'
|
||||
case ${POSIXLY_CORRECT+x}`$AWK "$gl_awk_probe" </dev/null` in
|
||||
xx) gl_had_POSIXLY_CORRECT=exported ;;
|
||||
x) gl_had_POSIXLY_CORRECT=yes ;;
|
||||
*) gl_had_POSIXLY_CORRECT= ;;
|
||||
esac
|
||||
POSIXLY_CORRECT=1
|
||||
export POSIXLY_CORRECT
|
||||
AC_RUN_IFELSE(
|
||||
[AC_LANG_PROGRAM([[#include <getopt.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
]GL_NOCRASH[
|
||||
]], [[
|
||||
int result = 0;
|
||||
|
||||
nocrash_init();
|
||||
|
||||
/* This code succeeds on glibc 2.8, OpenBSD 4.0, Cygwin, mingw,
|
||||
and fails on Mac OS X 10.5, AIX 5.2, HP-UX 11, IRIX 6.5,
|
||||
OSF/1 5.1, Solaris 10. */
|
||||
{
|
||||
static char conftest[] = "conftest";
|
||||
static char plus[] = "-+";
|
||||
char *argv[3] = { conftest, plus, NULL };
|
||||
opterr = 0;
|
||||
if (getopt (2, argv, "+a") != '?')
|
||||
result |= 1;
|
||||
}
|
||||
/* This code succeeds on glibc 2.8, mingw,
|
||||
and fails on Mac OS X 10.5, OpenBSD 4.0, AIX 5.2, HP-UX 11,
|
||||
IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 1.5.x. */
|
||||
{
|
||||
static char program[] = "program";
|
||||
static char p[] = "-p";
|
||||
static char foo[] = "foo";
|
||||
static char bar[] = "bar";
|
||||
char *argv[] = { program, p, foo, bar, NULL };
|
||||
|
||||
optind = 1;
|
||||
if (getopt (4, argv, "p::") != 'p')
|
||||
result |= 2;
|
||||
else if (optarg != NULL)
|
||||
result |= 4;
|
||||
else if (getopt (4, argv, "p::") != -1)
|
||||
result |= 6;
|
||||
else if (optind != 2)
|
||||
result |= 8;
|
||||
}
|
||||
/* This code succeeds on glibc 2.8 and fails on Cygwin 1.7.0. */
|
||||
{
|
||||
static char program[] = "program";
|
||||
static char foo[] = "foo";
|
||||
static char p[] = "-p";
|
||||
char *argv[] = { program, foo, p, NULL };
|
||||
optind = 0;
|
||||
if (getopt (3, argv, "-p") != 1)
|
||||
result |= 16;
|
||||
else if (getopt (3, argv, "-p") != 'p')
|
||||
result |= 16;
|
||||
}
|
||||
/* This code fails on glibc 2.11. */
|
||||
{
|
||||
static char program[] = "program";
|
||||
static char b[] = "-b";
|
||||
static char a[] = "-a";
|
||||
char *argv[] = { program, b, a, NULL };
|
||||
optind = opterr = 0;
|
||||
if (getopt (3, argv, "+:a:b") != 'b')
|
||||
result |= 32;
|
||||
else if (getopt (3, argv, "+:a:b") != ':')
|
||||
result |= 32;
|
||||
}
|
||||
/* This code dumps core on glibc 2.14. */
|
||||
{
|
||||
static char program[] = "program";
|
||||
static char w[] = "-W";
|
||||
static char dummy[] = "dummy";
|
||||
char *argv[] = { program, w, dummy, NULL };
|
||||
optind = opterr = 1;
|
||||
if (getopt (3, argv, "W;") != 'W')
|
||||
result |= 64;
|
||||
}
|
||||
return result;
|
||||
]])],
|
||||
[gl_cv_func_getopt_gnu=yes],
|
||||
[gl_cv_func_getopt_gnu=no],
|
||||
[dnl Cross compiling. Assume the worst, even on glibc platforms.
|
||||
gl_cv_func_getopt_gnu="guessing no"
|
||||
])
|
||||
case $gl_had_POSIXLY_CORRECT in
|
||||
exported) ;;
|
||||
yes) AS_UNSET([POSIXLY_CORRECT]); POSIXLY_CORRECT=1 ;;
|
||||
*) AS_UNSET([POSIXLY_CORRECT]) ;;
|
||||
esac
|
||||
])
|
||||
if test "$gl_cv_func_getopt_gnu" != yes; then
|
||||
gl_replace_getopt=yes
|
||||
else
|
||||
AC_CACHE_CHECK([for working GNU getopt_long function],
|
||||
[gl_cv_func_getopt_long_gnu],
|
||||
[AC_RUN_IFELSE(
|
||||
[AC_LANG_PROGRAM(
|
||||
[[#include <getopt.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
]],
|
||||
[[static const struct option long_options[] =
|
||||
{
|
||||
{ "xtremely-",no_argument, NULL, 1003 },
|
||||
{ "xtra", no_argument, NULL, 1001 },
|
||||
{ "xtreme", no_argument, NULL, 1002 },
|
||||
{ "xtremely", no_argument, NULL, 1003 },
|
||||
{ NULL, 0, NULL, 0 }
|
||||
};
|
||||
/* This code fails on OpenBSD 5.0. */
|
||||
{
|
||||
static char program[] = "program";
|
||||
static char xtremel[] = "--xtremel";
|
||||
char *argv[] = { program, xtremel, NULL };
|
||||
int option_index;
|
||||
optind = 1; opterr = 0;
|
||||
if (getopt_long (2, argv, "", long_options, &option_index) != 1003)
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
]])],
|
||||
[gl_cv_func_getopt_long_gnu=yes],
|
||||
[gl_cv_func_getopt_long_gnu=no],
|
||||
[dnl Cross compiling. Guess no on OpenBSD, yes otherwise.
|
||||
case "$host_os" in
|
||||
openbsd*) gl_cv_func_getopt_long_gnu="guessing no";;
|
||||
*) gl_cv_func_getopt_long_gnu="guessing yes";;
|
||||
esac
|
||||
])
|
||||
])
|
||||
case "$gl_cv_func_getopt_long_gnu" in
|
||||
*yes) ;;
|
||||
*) gl_replace_getopt=yes ;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN([gl_GETOPT_SUBSTITUTE_HEADER],
|
||||
[
|
||||
AC_CHECK_HEADERS_ONCE([sys/cdefs.h])
|
||||
if test $ac_cv_header_sys_cdefs_h = yes; then
|
||||
HAVE_SYS_CDEFS_H=1
|
||||
else
|
||||
HAVE_SYS_CDEFS_H=0
|
||||
fi
|
||||
AC_SUBST([HAVE_SYS_CDEFS_H])
|
||||
|
||||
AC_DEFINE([__GETOPT_PREFIX], [[rpl_]],
|
||||
[Define to rpl_ if the getopt replacement functions and variables
|
||||
should be used.])
|
||||
GETOPT_H=getopt.h
|
||||
GETOPT_CDEFS_H=getopt-cdefs.h
|
||||
AC_SUBST([GETOPT_H])
|
||||
AC_SUBST([GETOPT_CDEFS_H])
|
||||
])
|
|
@ -0,0 +1,17 @@
|
|||
# Determine whether recent-enough GNU Make is being used.
|
||||
|
||||
# Copyright (C) 2007, 2009-2018 Free Software Foundation, Inc.
|
||||
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# Written by Paul Eggert.
|
||||
|
||||
# Set GNU_MAKE if we are using a recent-enough version of GNU make.
|
||||
|
||||
AC_DEFUN([gl_GNU_MAKE],
|
||||
[
|
||||
AM_CONDITIONAL([GNU_MAKE],
|
||||
[LC_ALL=C ${MAKE-make} --version 2>/dev/null | sed -e '2,$d' | grep GNU >/dev/null])
|
||||
])
|
|
@ -0,0 +1,83 @@
|
|||
# Copyright (C) 2002-2018 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This file is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this file. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
# As a special exception to the GNU General Public License,
|
||||
# this file may be distributed as part of a program that
|
||||
# contains a configuration script generated by Autoconf, under
|
||||
# the same distribution terms as the rest of that program.
|
||||
#
|
||||
# Generated by gnulib-tool.
|
||||
#
|
||||
# This file represents the specification of how gnulib-tool is used.
|
||||
# It acts as a cache: It is written and read by gnulib-tool.
|
||||
# In projects that use version control, this file is meant to be put under
|
||||
# version control, like the configure.ac and various Makefile.am files.
|
||||
|
||||
|
||||
# Specification in the form of a command-line invocation:
|
||||
# gnulib-tool --import --local-dir=gl --local-dir=gl-mod/bootstrap \
|
||||
# --lib=libgnu \
|
||||
# --source-base=lib \
|
||||
# --m4-base=m4 \
|
||||
# --doc-base=doc \
|
||||
# --tests-base=tests \
|
||||
# --aux-dir=build-aux \
|
||||
# --lgpl \
|
||||
# --makefile-name=Makefile.gnulib \
|
||||
# --no-conditional-dependencies \
|
||||
# --libtool \
|
||||
# --macro-prefix=gl \
|
||||
# bootstrap \
|
||||
# c99 \
|
||||
# configmake \
|
||||
# flock \
|
||||
# getopt-posix \
|
||||
# gnu-make \
|
||||
# manywarnings \
|
||||
# relocatable-lib-lgpl \
|
||||
# snippet/unused-parameter \
|
||||
# ssize_t \
|
||||
# strchrnul \
|
||||
# strdup-posix
|
||||
|
||||
# Specification in the form of a few gnulib-tool.m4 macro invocations:
|
||||
gl_LOCAL_DIR([gl:gl-mod/bootstrap])
|
||||
gl_MODULES([
|
||||
bootstrap
|
||||
c99
|
||||
configmake
|
||||
flock
|
||||
getopt-posix
|
||||
gnu-make
|
||||
manywarnings
|
||||
relocatable-lib-lgpl
|
||||
snippet/unused-parameter
|
||||
ssize_t
|
||||
strchrnul
|
||||
strdup-posix
|
||||
])
|
||||
gl_AVOID([])
|
||||
gl_SOURCE_BASE([lib])
|
||||
gl_M4_BASE([m4])
|
||||
gl_PO_BASE([])
|
||||
gl_DOC_BASE([doc])
|
||||
gl_TESTS_BASE([tests])
|
||||
gl_LIB([libgnu])
|
||||
gl_LGPL
|
||||
gl_MAKEFILE_NAME([Makefile.gnulib])
|
||||
gl_LIBTOOL
|
||||
gl_MACRO_PREFIX([gl])
|
||||
gl_PO_DOMAIN([])
|
||||
gl_WITNESS_C_MACRO([])
|
|
@ -0,0 +1,391 @@
|
|||
# gnulib-common.m4 serial 40
|
||||
dnl Copyright (C) 2007-2018 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
AC_PREREQ([2.62])
|
||||
|
||||
# gl_COMMON
|
||||
# is expanded unconditionally through gnulib-tool magic.
|
||||
AC_DEFUN([gl_COMMON], [
|
||||
dnl Use AC_REQUIRE here, so that the code is expanded once only.
|
||||
AC_REQUIRE([gl_00GNULIB])
|
||||
AC_REQUIRE([gl_COMMON_BODY])
|
||||
])
|
||||
AC_DEFUN([gl_COMMON_BODY], [
|
||||
AH_VERBATIM([_Noreturn],
|
||||
[/* The _Noreturn keyword of C11. */
|
||||
#if ! (defined _Noreturn \
|
||||
|| (defined __STDC_VERSION__ && 201112 <= __STDC_VERSION__))
|
||||
# if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__) \
|
||||
|| 0x5110 <= __SUNPRO_C)
|
||||
# define _Noreturn __attribute__ ((__noreturn__))
|
||||
# elif defined _MSC_VER && 1200 <= _MSC_VER
|
||||
# define _Noreturn __declspec (noreturn)
|
||||
# else
|
||||
# define _Noreturn
|
||||
# endif
|
||||
#endif
|
||||
])
|
||||
AH_VERBATIM([isoc99_inline],
|
||||
[/* Work around a bug in Apple GCC 4.0.1 build 5465: In C99 mode, it supports
|
||||
the ISO C 99 semantics of 'extern inline' (unlike the GNU C semantics of
|
||||
earlier versions), but does not display it by setting __GNUC_STDC_INLINE__.
|
||||
__APPLE__ && __MACH__ test for Mac OS X.
|
||||
__APPLE_CC__ tests for the Apple compiler and its version.
|
||||
__STDC_VERSION__ tests for the C99 mode. */
|
||||
#if defined __APPLE__ && defined __MACH__ && __APPLE_CC__ >= 5465 && !defined __cplusplus && __STDC_VERSION__ >= 199901L && !defined __GNUC_STDC_INLINE__
|
||||
# define __GNUC_STDC_INLINE__ 1
|
||||
#endif])
|
||||
AH_VERBATIM([unused_parameter],
|
||||
[/* Define as a marker that can be attached to declarations that might not
|
||||
be used. This helps to reduce warnings, such as from
|
||||
GCC -Wunused-parameter. */
|
||||
#if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
|
||||
# define _GL_UNUSED __attribute__ ((__unused__))
|
||||
#else
|
||||
# define _GL_UNUSED
|
||||
#endif
|
||||
/* The name _UNUSED_PARAMETER_ is an earlier spelling, although the name
|
||||
is a misnomer outside of parameter lists. */
|
||||
#define _UNUSED_PARAMETER_ _GL_UNUSED
|
||||
|
||||
/* gcc supports the "unused" attribute on possibly unused labels, and
|
||||
g++ has since version 4.5. Note to support C++ as well as C,
|
||||
_GL_UNUSED_LABEL should be used with a trailing ; */
|
||||
#if !defined __cplusplus || __GNUC__ > 4 \
|
||||
|| (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
|
||||
# define _GL_UNUSED_LABEL _GL_UNUSED
|
||||
#else
|
||||
# define _GL_UNUSED_LABEL
|
||||
#endif
|
||||
|
||||
/* The __pure__ attribute was added in gcc 2.96. */
|
||||
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
|
||||
# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
|
||||
#else
|
||||
# define _GL_ATTRIBUTE_PURE /* empty */
|
||||
#endif
|
||||
|
||||
/* The __const__ attribute was added in gcc 2.95. */
|
||||
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
|
||||
# define _GL_ATTRIBUTE_CONST __attribute__ ((__const__))
|
||||
#else
|
||||
# define _GL_ATTRIBUTE_CONST /* empty */
|
||||
#endif
|
||||
|
||||
/* The __malloc__ attribute was added in gcc 3. */
|
||||
#if 3 <= __GNUC__
|
||||
# define _GL_ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
|
||||
#else
|
||||
# define _GL_ATTRIBUTE_MALLOC /* empty */
|
||||
#endif
|
||||
])
|
||||
dnl Preparation for running test programs:
|
||||
dnl Tell glibc to write diagnostics from -D_FORTIFY_SOURCE=2 to stderr, not
|
||||
dnl to /dev/tty, so they can be redirected to log files. Such diagnostics
|
||||
dnl arise e.g., in the macros gl_PRINTF_DIRECTIVE_N, gl_SNPRINTF_DIRECTIVE_N.
|
||||
LIBC_FATAL_STDERR_=1
|
||||
export LIBC_FATAL_STDERR_
|
||||
])
|
||||
|
||||
# gl_MODULE_INDICATOR_CONDITION
|
||||
# expands to a C preprocessor expression that evaluates to 1 or 0, depending
|
||||
# whether a gnulib module that has been requested shall be considered present
|
||||
# or not.
|
||||
m4_define([gl_MODULE_INDICATOR_CONDITION], [1])
|
||||
|
||||
# gl_MODULE_INDICATOR_SET_VARIABLE([modulename])
|
||||
# sets the shell variable that indicates the presence of the given module to
|
||||
# a C preprocessor expression that will evaluate to 1.
|
||||
AC_DEFUN([gl_MODULE_INDICATOR_SET_VARIABLE],
|
||||
[
|
||||
gl_MODULE_INDICATOR_SET_VARIABLE_AUX(
|
||||
[GNULIB_[]m4_translit([[$1]],
|
||||
[abcdefghijklmnopqrstuvwxyz./-],
|
||||
[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])],
|
||||
[gl_MODULE_INDICATOR_CONDITION])
|
||||
])
|
||||
|
||||
# gl_MODULE_INDICATOR_SET_VARIABLE_AUX([variable])
|
||||
# modifies the shell variable to include the gl_MODULE_INDICATOR_CONDITION.
|
||||
# The shell variable's value is a C preprocessor expression that evaluates
|
||||
# to 0 or 1.
|
||||
AC_DEFUN([gl_MODULE_INDICATOR_SET_VARIABLE_AUX],
|
||||
[
|
||||
m4_if(m4_defn([gl_MODULE_INDICATOR_CONDITION]), [1],
|
||||
[
|
||||
dnl Simplify the expression VALUE || 1 to 1.
|
||||
$1=1
|
||||
],
|
||||
[gl_MODULE_INDICATOR_SET_VARIABLE_AUX_OR([$1],
|
||||
[gl_MODULE_INDICATOR_CONDITION])])
|
||||
])
|
||||
|
||||
# gl_MODULE_INDICATOR_SET_VARIABLE_AUX_OR([variable], [condition])
|
||||
# modifies the shell variable to include the given condition. The shell
|
||||
# variable's value is a C preprocessor expression that evaluates to 0 or 1.
|
||||
AC_DEFUN([gl_MODULE_INDICATOR_SET_VARIABLE_AUX_OR],
|
||||
[
|
||||
dnl Simplify the expression 1 || CONDITION to 1.
|
||||
if test "$[]$1" != 1; then
|
||||
dnl Simplify the expression 0 || CONDITION to CONDITION.
|
||||
if test "$[]$1" = 0; then
|
||||
$1=$2
|
||||
else
|
||||
$1="($[]$1 || $2)"
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
# gl_MODULE_INDICATOR([modulename])
|
||||
# defines a C macro indicating the presence of the given module
|
||||
# in a location where it can be used.
|
||||
# | Value | Value |
|
||||
# | in lib/ | in tests/ |
|
||||
# --------------------------------------------+---------+-----------+
|
||||
# Module present among main modules: | 1 | 1 |
|
||||
# --------------------------------------------+---------+-----------+
|
||||
# Module present among tests-related modules: | 0 | 1 |
|
||||
# --------------------------------------------+---------+-----------+
|
||||
# Module not present at all: | 0 | 0 |
|
||||
# --------------------------------------------+---------+-----------+
|
||||
AC_DEFUN([gl_MODULE_INDICATOR],
|
||||
[
|
||||
AC_DEFINE_UNQUOTED([GNULIB_]m4_translit([[$1]],
|
||||
[abcdefghijklmnopqrstuvwxyz./-],
|
||||
[ABCDEFGHIJKLMNOPQRSTUVWXYZ___]),
|
||||
[gl_MODULE_INDICATOR_CONDITION],
|
||||
[Define to a C preprocessor expression that evaluates to 1 or 0,
|
||||
depending whether the gnulib module $1 shall be considered present.])
|
||||
])
|
||||
|
||||
# gl_MODULE_INDICATOR_FOR_TESTS([modulename])
|
||||
# defines a C macro indicating the presence of the given module
|
||||
# in lib or tests. This is useful to determine whether the module
|
||||
# should be tested.
|
||||
# | Value | Value |
|
||||
# | in lib/ | in tests/ |
|
||||
# --------------------------------------------+---------+-----------+
|
||||
# Module present among main modules: | 1 | 1 |
|
||||
# --------------------------------------------+---------+-----------+
|
||||
# Module present among tests-related modules: | 1 | 1 |
|
||||
# --------------------------------------------+---------+-----------+
|
||||
# Module not present at all: | 0 | 0 |
|
||||
# --------------------------------------------+---------+-----------+
|
||||
AC_DEFUN([gl_MODULE_INDICATOR_FOR_TESTS],
|
||||
[
|
||||
AC_DEFINE([GNULIB_TEST_]m4_translit([[$1]],
|
||||
[abcdefghijklmnopqrstuvwxyz./-],
|
||||
[ABCDEFGHIJKLMNOPQRSTUVWXYZ___]), [1],
|
||||
[Define to 1 when the gnulib module $1 should be tested.])
|
||||
])
|
||||
|
||||
# gl_ASSERT_NO_GNULIB_POSIXCHECK
|
||||
# asserts that there will never be a need to #define GNULIB_POSIXCHECK.
|
||||
# and thereby enables an optimization of configure and config.h.
|
||||
# Used by Emacs.
|
||||
AC_DEFUN([gl_ASSERT_NO_GNULIB_POSIXCHECK],
|
||||
[
|
||||
dnl Override gl_WARN_ON_USE_PREPARE.
|
||||
dnl But hide this definition from 'aclocal'.
|
||||
AC_DEFUN([gl_W][ARN_ON_USE_PREPARE], [])
|
||||
])
|
||||
|
||||
# gl_ASSERT_NO_GNULIB_TESTS
|
||||
# asserts that there will be no gnulib tests in the scope of the configure.ac
|
||||
# and thereby enables an optimization of config.h.
|
||||
# Used by Emacs.
|
||||
AC_DEFUN([gl_ASSERT_NO_GNULIB_TESTS],
|
||||
[
|
||||
dnl Override gl_MODULE_INDICATOR_FOR_TESTS.
|
||||
AC_DEFUN([gl_MODULE_INDICATOR_FOR_TESTS], [])
|
||||
])
|
||||
|
||||
# Test whether <features.h> exists.
|
||||
# Set HAVE_FEATURES_H.
|
||||
AC_DEFUN([gl_FEATURES_H],
|
||||
[
|
||||
AC_CHECK_HEADERS_ONCE([features.h])
|
||||
if test $ac_cv_header_features_h = yes; then
|
||||
HAVE_FEATURES_H=1
|
||||
else
|
||||
HAVE_FEATURES_H=0
|
||||
fi
|
||||
AC_SUBST([HAVE_FEATURES_H])
|
||||
])
|
||||
|
||||
# AS_VAR_IF(VAR, VALUE, [IF-MATCH], [IF-NOT-MATCH])
|
||||
# ----------------------------------------------------
|
||||
# Backport of autoconf-2.63b's macro.
|
||||
# Remove this macro when we can assume autoconf >= 2.64.
|
||||
m4_ifndef([AS_VAR_IF],
|
||||
[m4_define([AS_VAR_IF],
|
||||
[AS_IF([test x"AS_VAR_GET([$1])" = x""$2], [$3], [$4])])])
|
||||
|
||||
# gl_PROG_CC_C99
|
||||
# Modifies the value of the shell variable CC in an attempt to make $CC
|
||||
# understand ISO C99 source code.
|
||||
# This is like AC_PROG_CC_C99, except that
|
||||
# - AC_PROG_CC_C99 does not mix well with AC_PROG_CC_STDC
|
||||
# <https://lists.gnu.org/r/bug-gnulib/2011-09/msg00367.html>,
|
||||
# but many more packages use AC_PROG_CC_STDC than AC_PROG_CC_C99
|
||||
# <https://lists.gnu.org/r/bug-gnulib/2011-09/msg00441.html>.
|
||||
# Remaining problems:
|
||||
# - When AC_PROG_CC_STDC is invoked twice, it adds the C99 enabling options
|
||||
# to CC twice
|
||||
# <https://lists.gnu.org/r/bug-gnulib/2011-09/msg00431.html>.
|
||||
# - AC_PROG_CC_STDC is likely to change now that C11 is an ISO standard.
|
||||
AC_DEFUN([gl_PROG_CC_C99],
|
||||
[
|
||||
dnl Change that version number to the minimum Autoconf version that supports
|
||||
dnl mixing AC_PROG_CC_C99 calls with AC_PROG_CC_STDC calls.
|
||||
m4_version_prereq([9.0],
|
||||
[AC_REQUIRE([AC_PROG_CC_C99])],
|
||||
[AC_REQUIRE([AC_PROG_CC_STDC])])
|
||||
])
|
||||
|
||||
# gl_PROG_AR_RANLIB
|
||||
# Determines the values for AR, ARFLAGS, RANLIB that fit with the compiler.
|
||||
# The user can set the variables AR, ARFLAGS, RANLIB if he wants to override
|
||||
# the values.
|
||||
AC_DEFUN([gl_PROG_AR_RANLIB],
|
||||
[
|
||||
dnl Minix 3 comes with two toolchains: The Amsterdam Compiler Kit compiler
|
||||
dnl as "cc", and GCC as "gcc". They have different object file formats and
|
||||
dnl library formats. In particular, the GNU binutils programs ar and ranlib
|
||||
dnl produce libraries that work only with gcc, not with cc.
|
||||
AC_REQUIRE([AC_PROG_CC])
|
||||
dnl The '][' hides this use from 'aclocal'.
|
||||
AC_BEFORE([$0], [A][M_PROG_AR])
|
||||
AC_CACHE_CHECK([for Minix Amsterdam compiler], [gl_cv_c_amsterdam_compiler],
|
||||
[
|
||||
AC_EGREP_CPP([Amsterdam],
|
||||
[
|
||||
#ifdef __ACK__
|
||||
Amsterdam
|
||||
#endif
|
||||
],
|
||||
[gl_cv_c_amsterdam_compiler=yes],
|
||||
[gl_cv_c_amsterdam_compiler=no])
|
||||
])
|
||||
|
||||
dnl Don't compete with AM_PROG_AR's decision about AR/ARFLAGS if we are not
|
||||
dnl building with __ACK__.
|
||||
if test $gl_cv_c_amsterdam_compiler = yes; then
|
||||
if test -z "$AR"; then
|
||||
AR='cc -c.a'
|
||||
fi
|
||||
if test -z "$ARFLAGS"; then
|
||||
ARFLAGS='-o'
|
||||
fi
|
||||
else
|
||||
dnl AM_PROG_AR was added in automake v1.11.2. AM_PROG_AR does not AC_SUBST
|
||||
dnl ARFLAGS variable (it is filed into Makefile.in directly by automake
|
||||
dnl script on-demand, if not specified by ./configure of course).
|
||||
dnl Don't AC_REQUIRE the AM_PROG_AR otherwise the code for __ACK__ above
|
||||
dnl will be ignored. Also, pay attention to call AM_PROG_AR in else block
|
||||
dnl because AM_PROG_AR is written so it could re-set AR variable even for
|
||||
dnl __ACK__. It may seem like its easier to avoid calling the macro here,
|
||||
dnl but we need to AC_SUBST both AR/ARFLAGS (thus those must have some good
|
||||
dnl default value and automake should usually know them).
|
||||
dnl
|
||||
dnl The '][' hides this use from 'aclocal'.
|
||||
m4_ifdef([A][M_PROG_AR], [A][M_PROG_AR], [:])
|
||||
fi
|
||||
|
||||
dnl In case the code above has not helped with setting AR/ARFLAGS, use
|
||||
dnl Automake-documented default values for AR and ARFLAGS, but prefer
|
||||
dnl ${host}-ar over ar (useful for cross-compiling).
|
||||
AC_CHECK_TOOL([AR], [ar], [ar])
|
||||
if test -z "$ARFLAGS"; then
|
||||
ARFLAGS='cr'
|
||||
fi
|
||||
|
||||
AC_SUBST([AR])
|
||||
AC_SUBST([ARFLAGS])
|
||||
if test -z "$RANLIB"; then
|
||||
if test $gl_cv_c_amsterdam_compiler = yes; then
|
||||
RANLIB=':'
|
||||
else
|
||||
dnl Use the ranlib program if it is available.
|
||||
AC_PROG_RANLIB
|
||||
fi
|
||||
fi
|
||||
AC_SUBST([RANLIB])
|
||||
])
|
||||
|
||||
# AC_C_RESTRICT
|
||||
# This definition is copied from post-2.69 Autoconf and overrides the
|
||||
# AC_C_RESTRICT macro from autoconf 2.60..2.69. It can be removed
|
||||
# once autoconf >= 2.70 can be assumed. It's painful to check version
|
||||
# numbers, and in practice this macro is more up-to-date than Autoconf
|
||||
# is, so override Autoconf unconditionally.
|
||||
AC_DEFUN([AC_C_RESTRICT],
|
||||
[AC_CACHE_CHECK([for C/C++ restrict keyword], [ac_cv_c_restrict],
|
||||
[ac_cv_c_restrict=no
|
||||
# The order here caters to the fact that C++ does not require restrict.
|
||||
for ac_kw in __restrict __restrict__ _Restrict restrict; do
|
||||
AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM(
|
||||
[[typedef int *int_ptr;
|
||||
int foo (int_ptr $ac_kw ip) { return ip[0]; }
|
||||
int bar (int [$ac_kw]); /* Catch GCC bug 14050. */
|
||||
int bar (int ip[$ac_kw]) { return ip[0]; }
|
||||
]],
|
||||
[[int s[1];
|
||||
int *$ac_kw t = s;
|
||||
t[0] = 0;
|
||||
return foo (t) + bar (t);
|
||||
]])],
|
||||
[ac_cv_c_restrict=$ac_kw])
|
||||
test "$ac_cv_c_restrict" != no && break
|
||||
done
|
||||
])
|
||||
AH_VERBATIM([restrict],
|
||||
[/* Define to the equivalent of the C99 'restrict' keyword, or to
|
||||
nothing if this is not supported. Do not define if restrict is
|
||||
supported directly. */
|
||||
#undef restrict
|
||||
/* Work around a bug in Sun C++: it does not support _Restrict or
|
||||
__restrict__, even though the corresponding Sun C compiler ends up with
|
||||
"#define restrict _Restrict" or "#define restrict __restrict__" in the
|
||||
previous line. Perhaps some future version of Sun C++ will work with
|
||||
restrict; if so, hopefully it defines __RESTRICT like Sun C does. */
|
||||
#if defined __SUNPRO_CC && !defined __RESTRICT
|
||||
# define _Restrict
|
||||
# define __restrict__
|
||||
#endif])
|
||||
case $ac_cv_c_restrict in
|
||||
restrict) ;;
|
||||
no) AC_DEFINE([restrict], []) ;;
|
||||
*) AC_DEFINE_UNQUOTED([restrict], [$ac_cv_c_restrict]) ;;
|
||||
esac
|
||||
])# AC_C_RESTRICT
|
||||
|
||||
# gl_BIGENDIAN
|
||||
# is like AC_C_BIGENDIAN, except that it can be AC_REQUIREd.
|
||||
# Note that AC_REQUIRE([AC_C_BIGENDIAN]) does not work reliably because some
|
||||
# macros invoke AC_C_BIGENDIAN with arguments.
|
||||
AC_DEFUN([gl_BIGENDIAN],
|
||||
[
|
||||
AC_C_BIGENDIAN
|
||||
])
|
||||
|
||||
# gl_CACHE_VAL_SILENT(cache-id, command-to-set-it)
|
||||
# is like AC_CACHE_VAL(cache-id, command-to-set-it), except that it does not
|
||||
# output a spurious "(cached)" mark in the midst of other configure output.
|
||||
# This macro should be used instead of AC_CACHE_VAL when it is not surrounded
|
||||
# by an AC_MSG_CHECKING/AC_MSG_RESULT pair.
|
||||
AC_DEFUN([gl_CACHE_VAL_SILENT],
|
||||
[
|
||||
saved_as_echo_n="$as_echo_n"
|
||||
as_echo_n=':'
|
||||
AC_CACHE_VAL([$1], [$2])
|
||||
as_echo_n="$saved_as_echo_n"
|
||||
])
|
||||
|
||||
# AS_VAR_COPY was added in autoconf 2.63b
|
||||
m4_define_default([AS_VAR_COPY],
|
||||
[AS_LITERAL_IF([$1[]$2], [$1=$$2], [eval $1=\$$2])])
|
|
@ -0,0 +1,371 @@
|
|||
# DO NOT EDIT! GENERATED AUTOMATICALLY!
|
||||
# Copyright (C) 2002-2018 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This file is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this file. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
# As a special exception to the GNU General Public License,
|
||||
# this file may be distributed as part of a program that
|
||||
# contains a configuration script generated by Autoconf, under
|
||||
# the same distribution terms as the rest of that program.
|
||||
#
|
||||
# Generated by gnulib-tool.
|
||||
#
|
||||
# This file represents the compiled summary of the specification in
|
||||
# gnulib-cache.m4. It lists the computed macro invocations that need
|
||||
# to be invoked from configure.ac.
|
||||
# In projects that use version control, this file can be treated like
|
||||
# other built files.
|
||||
|
||||
|
||||
# This macro should be invoked from ./configure.ac, in the section
|
||||
# "Checks for programs", right after AC_PROG_CC, and certainly before
|
||||
# any checks for libraries, header files, types and library functions.
|
||||
AC_DEFUN([gl_EARLY],
|
||||
[
|
||||
m4_pattern_forbid([^gl_[A-Z]])dnl the gnulib macro namespace
|
||||
m4_pattern_allow([^gl_ES$])dnl a valid locale name
|
||||
m4_pattern_allow([^gl_LIBOBJS$])dnl a variable
|
||||
m4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable
|
||||
|
||||
# Pre-early section.
|
||||
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
|
||||
AC_REQUIRE([gl_PROG_AR_RANLIB])
|
||||
|
||||
# Code from module absolute-header:
|
||||
# Code from module bootstrap:
|
||||
# Code from module c99:
|
||||
# Code from module configmake:
|
||||
# Code from module extensions:
|
||||
# Code from module extern-inline:
|
||||
# Code from module extract-trace:
|
||||
# Code from module flock:
|
||||
# Code from module funclib.sh:
|
||||
# Code from module getopt-posix:
|
||||
# Code from module gettext-h:
|
||||
# Code from module gnu-make:
|
||||
# Code from module include_next:
|
||||
# Code from module inline-source:
|
||||
# Code from module malloc-posix:
|
||||
# Code from module manywarnings:
|
||||
# Code from module msvc-inval:
|
||||
# Code from module msvc-nothrow:
|
||||
# Code from module options-parser:
|
||||
# Code from module rawmemchr:
|
||||
# Code from module relocatable-lib-lgpl:
|
||||
# Code from module snippet/_Noreturn:
|
||||
# Code from module snippet/arg-nonnull:
|
||||
# Code from module snippet/c++defs:
|
||||
# Code from module snippet/unused-parameter:
|
||||
# Code from module snippet/warn-on-use:
|
||||
# Code from module ssize_t:
|
||||
# Code from module std-gnu11:
|
||||
# Code from module stddef:
|
||||
# Code from module stdlib:
|
||||
# Code from module strchrnul:
|
||||
# Code from module strdup-posix:
|
||||
# Code from module string:
|
||||
# Code from module sys_file:
|
||||
# Code from module sys_types:
|
||||
# Code from module unistd:
|
||||
# Code from module warnings:
|
||||
])
|
||||
|
||||
# This macro should be invoked from ./configure.ac, in the section
|
||||
# "Check for header files, types and library functions".
|
||||
AC_DEFUN([gl_INIT],
|
||||
[
|
||||
AM_CONDITIONAL([GL_COND_LIBTOOL], [true])
|
||||
gl_cond_libtool=true
|
||||
gl_m4_base='m4'
|
||||
m4_pushdef([AC_LIBOBJ], m4_defn([gl_LIBOBJ]))
|
||||
m4_pushdef([AC_REPLACE_FUNCS], m4_defn([gl_REPLACE_FUNCS]))
|
||||
m4_pushdef([AC_LIBSOURCES], m4_defn([gl_LIBSOURCES]))
|
||||
m4_pushdef([gl_LIBSOURCES_LIST], [])
|
||||
m4_pushdef([gl_LIBSOURCES_DIR], [])
|
||||
gl_COMMON
|
||||
gl_source_base='lib'
|
||||
gl_CONFIGMAKE_PREP
|
||||
AC_REQUIRE([gl_EXTERN_INLINE])
|
||||
gl_FUNC_FLOCK
|
||||
if test $HAVE_FLOCK = 0; then
|
||||
AC_LIBOBJ([flock])
|
||||
gl_PREREQ_FLOCK
|
||||
fi
|
||||
gl_HEADER_SYS_FILE_MODULE_INDICATOR([flock])
|
||||
gl_FUNC_GETOPT_POSIX
|
||||
if test $REPLACE_GETOPT = 1; then
|
||||
AC_LIBOBJ([getopt])
|
||||
AC_LIBOBJ([getopt1])
|
||||
dnl Arrange for unistd.h to include getopt.h.
|
||||
GNULIB_GL_UNISTD_H_GETOPT=1
|
||||
fi
|
||||
AC_SUBST([GNULIB_GL_UNISTD_H_GETOPT])
|
||||
AC_SUBST([LIBINTL])
|
||||
AC_SUBST([LTLIBINTL])
|
||||
gl_GNU_MAKE
|
||||
gl_FUNC_MALLOC_POSIX
|
||||
if test $REPLACE_MALLOC = 1; then
|
||||
AC_LIBOBJ([malloc])
|
||||
fi
|
||||
gl_STDLIB_MODULE_INDICATOR([malloc-posix])
|
||||
AC_REQUIRE([gl_MSVC_INVAL])
|
||||
if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then
|
||||
AC_LIBOBJ([msvc-inval])
|
||||
fi
|
||||
AC_REQUIRE([gl_MSVC_NOTHROW])
|
||||
if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then
|
||||
AC_LIBOBJ([msvc-nothrow])
|
||||
fi
|
||||
gl_MODULE_INDICATOR([msvc-nothrow])
|
||||
gl_FUNC_RAWMEMCHR
|
||||
if test $HAVE_RAWMEMCHR = 0; then
|
||||
AC_LIBOBJ([rawmemchr])
|
||||
gl_PREREQ_RAWMEMCHR
|
||||
fi
|
||||
gl_STRING_MODULE_INDICATOR([rawmemchr])
|
||||
gl_RELOCATABLE_LIBRARY
|
||||
if test $RELOCATABLE = yes; then
|
||||
AC_LIBOBJ([relocatable])
|
||||
fi
|
||||
gt_TYPE_SSIZE_T
|
||||
gl_STDDEF_H
|
||||
gl_STDLIB_H
|
||||
gl_FUNC_STRCHRNUL
|
||||
if test $HAVE_STRCHRNUL = 0 || test $REPLACE_STRCHRNUL = 1; then
|
||||
AC_LIBOBJ([strchrnul])
|
||||
gl_PREREQ_STRCHRNUL
|
||||
fi
|
||||
gl_STRING_MODULE_INDICATOR([strchrnul])
|
||||
gl_FUNC_STRDUP_POSIX
|
||||
if test $ac_cv_func_strdup = no || test $REPLACE_STRDUP = 1; then
|
||||
AC_LIBOBJ([strdup])
|
||||
gl_PREREQ_STRDUP
|
||||
fi
|
||||
gl_STRING_MODULE_INDICATOR([strdup])
|
||||
gl_HEADER_STRING_H
|
||||
gl_HEADER_SYS_FILE_H
|
||||
AC_PROG_MKDIR_P
|
||||
gl_SYS_TYPES_H
|
||||
AC_PROG_MKDIR_P
|
||||
gl_UNISTD_H
|
||||
# End of code from modules
|
||||
m4_ifval(gl_LIBSOURCES_LIST, [
|
||||
m4_syscmd([test ! -d ]m4_defn([gl_LIBSOURCES_DIR])[ ||
|
||||
for gl_file in ]gl_LIBSOURCES_LIST[ ; do
|
||||
if test ! -r ]m4_defn([gl_LIBSOURCES_DIR])[/$gl_file ; then
|
||||
echo "missing file ]m4_defn([gl_LIBSOURCES_DIR])[/$gl_file" >&2
|
||||
exit 1
|
||||
fi
|
||||
done])dnl
|
||||
m4_if(m4_sysval, [0], [],
|
||||
[AC_FATAL([expected source file, required through AC_LIBSOURCES, not found])])
|
||||
])
|
||||
m4_popdef([gl_LIBSOURCES_DIR])
|
||||
m4_popdef([gl_LIBSOURCES_LIST])
|
||||
m4_popdef([AC_LIBSOURCES])
|
||||
m4_popdef([AC_REPLACE_FUNCS])
|
||||
m4_popdef([AC_LIBOBJ])
|
||||
AC_CONFIG_COMMANDS_PRE([
|
||||
gl_libobjs=
|
||||
gl_ltlibobjs=
|
||||
if test -n "$gl_LIBOBJS"; then
|
||||
# Remove the extension.
|
||||
sed_drop_objext='s/\.o$//;s/\.obj$//'
|
||||
for i in `for i in $gl_LIBOBJS; do echo "$i"; done | sed -e "$sed_drop_objext" | sort | uniq`; do
|
||||
gl_libobjs="$gl_libobjs $i.$ac_objext"
|
||||
gl_ltlibobjs="$gl_ltlibobjs $i.lo"
|
||||
done
|
||||
fi
|
||||
AC_SUBST([gl_LIBOBJS], [$gl_libobjs])
|
||||
AC_SUBST([gl_LTLIBOBJS], [$gl_ltlibobjs])
|
||||
])
|
||||
gltests_libdeps=
|
||||
gltests_ltlibdeps=
|
||||
m4_pushdef([AC_LIBOBJ], m4_defn([gltests_LIBOBJ]))
|
||||
m4_pushdef([AC_REPLACE_FUNCS], m4_defn([gltests_REPLACE_FUNCS]))
|
||||
m4_pushdef([AC_LIBSOURCES], m4_defn([gltests_LIBSOURCES]))
|
||||
m4_pushdef([gltests_LIBSOURCES_LIST], [])
|
||||
m4_pushdef([gltests_LIBSOURCES_DIR], [])
|
||||
gl_COMMON
|
||||
gl_source_base='tests'
|
||||
changequote(,)dnl
|
||||
gltests_WITNESS=IN_`echo "${PACKAGE-$PACKAGE_TARNAME}" | LC_ALL=C tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ | LC_ALL=C sed -e 's/[^A-Z0-9_]/_/g'`_GNULIB_TESTS
|
||||
changequote([, ])dnl
|
||||
AC_SUBST([gltests_WITNESS])
|
||||
gl_module_indicator_condition=$gltests_WITNESS
|
||||
m4_pushdef([gl_MODULE_INDICATOR_CONDITION], [$gl_module_indicator_condition])
|
||||
m4_popdef([gl_MODULE_INDICATOR_CONDITION])
|
||||
m4_ifval(gltests_LIBSOURCES_LIST, [
|
||||
m4_syscmd([test ! -d ]m4_defn([gltests_LIBSOURCES_DIR])[ ||
|
||||
for gl_file in ]gltests_LIBSOURCES_LIST[ ; do
|
||||
if test ! -r ]m4_defn([gltests_LIBSOURCES_DIR])[/$gl_file ; then
|
||||
echo "missing file ]m4_defn([gltests_LIBSOURCES_DIR])[/$gl_file" >&2
|
||||
exit 1
|
||||
fi
|
||||
done])dnl
|
||||
m4_if(m4_sysval, [0], [],
|
||||
[AC_FATAL([expected source file, required through AC_LIBSOURCES, not found])])
|
||||
])
|
||||
m4_popdef([gltests_LIBSOURCES_DIR])
|
||||
m4_popdef([gltests_LIBSOURCES_LIST])
|
||||
m4_popdef([AC_LIBSOURCES])
|
||||
m4_popdef([AC_REPLACE_FUNCS])
|
||||
m4_popdef([AC_LIBOBJ])
|
||||
AC_CONFIG_COMMANDS_PRE([
|
||||
gltests_libobjs=
|
||||
gltests_ltlibobjs=
|
||||
if test -n "$gltests_LIBOBJS"; then
|
||||
# Remove the extension.
|
||||
sed_drop_objext='s/\.o$//;s/\.obj$//'
|
||||
for i in `for i in $gltests_LIBOBJS; do echo "$i"; done | sed -e "$sed_drop_objext" | sort | uniq`; do
|
||||
gltests_libobjs="$gltests_libobjs $i.$ac_objext"
|
||||
gltests_ltlibobjs="$gltests_ltlibobjs $i.lo"
|
||||
done
|
||||
fi
|
||||
AC_SUBST([gltests_LIBOBJS], [$gltests_libobjs])
|
||||
AC_SUBST([gltests_LTLIBOBJS], [$gltests_ltlibobjs])
|
||||
])
|
||||
])
|
||||
|
||||
# Like AC_LIBOBJ, except that the module name goes
|
||||
# into gl_LIBOBJS instead of into LIBOBJS.
|
||||
AC_DEFUN([gl_LIBOBJ], [
|
||||
AS_LITERAL_IF([$1], [gl_LIBSOURCES([$1.c])])dnl
|
||||
gl_LIBOBJS="$gl_LIBOBJS $1.$ac_objext"
|
||||
])
|
||||
|
||||
# Like AC_REPLACE_FUNCS, except that the module name goes
|
||||
# into gl_LIBOBJS instead of into LIBOBJS.
|
||||
AC_DEFUN([gl_REPLACE_FUNCS], [
|
||||
m4_foreach_w([gl_NAME], [$1], [AC_LIBSOURCES(gl_NAME[.c])])dnl
|
||||
AC_CHECK_FUNCS([$1], , [gl_LIBOBJ($ac_func)])
|
||||
])
|
||||
|
||||
# Like AC_LIBSOURCES, except the directory where the source file is
|
||||
# expected is derived from the gnulib-tool parameterization,
|
||||
# and alloca is special cased (for the alloca-opt module).
|
||||
# We could also entirely rely on EXTRA_lib..._SOURCES.
|
||||
AC_DEFUN([gl_LIBSOURCES], [
|
||||
m4_foreach([_gl_NAME], [$1], [
|
||||
m4_if(_gl_NAME, [alloca.c], [], [
|
||||
m4_define([gl_LIBSOURCES_DIR], [lib])
|
||||
m4_append([gl_LIBSOURCES_LIST], _gl_NAME, [ ])
|
||||
])
|
||||
])
|
||||
])
|
||||
|
||||
# Like AC_LIBOBJ, except that the module name goes
|
||||
# into gltests_LIBOBJS instead of into LIBOBJS.
|
||||
AC_DEFUN([gltests_LIBOBJ], [
|
||||
AS_LITERAL_IF([$1], [gltests_LIBSOURCES([$1.c])])dnl
|
||||
gltests_LIBOBJS="$gltests_LIBOBJS $1.$ac_objext"
|
||||
])
|
||||
|
||||
# Like AC_REPLACE_FUNCS, except that the module name goes
|
||||
# into gltests_LIBOBJS instead of into LIBOBJS.
|
||||
AC_DEFUN([gltests_REPLACE_FUNCS], [
|
||||
m4_foreach_w([gl_NAME], [$1], [AC_LIBSOURCES(gl_NAME[.c])])dnl
|
||||
AC_CHECK_FUNCS([$1], , [gltests_LIBOBJ($ac_func)])
|
||||
])
|
||||
|
||||
# Like AC_LIBSOURCES, except the directory where the source file is
|
||||
# expected is derived from the gnulib-tool parameterization,
|
||||
# and alloca is special cased (for the alloca-opt module).
|
||||
# We could also entirely rely on EXTRA_lib..._SOURCES.
|
||||
AC_DEFUN([gltests_LIBSOURCES], [
|
||||
m4_foreach([_gl_NAME], [$1], [
|
||||
m4_if(_gl_NAME, [alloca.c], [], [
|
||||
m4_define([gltests_LIBSOURCES_DIR], [tests])
|
||||
m4_append([gltests_LIBSOURCES_LIST], _gl_NAME, [ ])
|
||||
])
|
||||
])
|
||||
])
|
||||
|
||||
# This macro records the list of files which have been installed by
|
||||
# gnulib-tool and may be removed by future gnulib-tool invocations.
|
||||
AC_DEFUN([gl_FILE_LIST], [
|
||||
build-aux/bootstrap.in
|
||||
build-aux/extract-trace
|
||||
build-aux/funclib.sh
|
||||
build-aux/inline-source
|
||||
build-aux/options-parser
|
||||
doc/relocatable.texi
|
||||
lib/_Noreturn.h
|
||||
lib/arg-nonnull.h
|
||||
lib/c++defs.h
|
||||
lib/flock.c
|
||||
lib/getopt-cdefs.in.h
|
||||
lib/getopt-core.h
|
||||
lib/getopt-ext.h
|
||||
lib/getopt-pfx-core.h
|
||||
lib/getopt-pfx-ext.h
|
||||
lib/getopt.c
|
||||
lib/getopt.in.h
|
||||
lib/getopt1.c
|
||||
lib/getopt_int.h
|
||||
lib/gettext.h
|
||||
lib/malloc.c
|
||||
lib/msvc-inval.c
|
||||
lib/msvc-inval.h
|
||||
lib/msvc-nothrow.c
|
||||
lib/msvc-nothrow.h
|
||||
lib/rawmemchr.c
|
||||
lib/rawmemchr.valgrind
|
||||
lib/relocatable.c
|
||||
lib/relocatable.h
|
||||
lib/relocatable.valgrind
|
||||
lib/stddef.in.h
|
||||
lib/stdlib.in.h
|
||||
lib/strchrnul.c
|
||||
lib/strchrnul.valgrind
|
||||
lib/strdup.c
|
||||
lib/string.in.h
|
||||
lib/sys_file.in.h
|
||||
lib/sys_types.in.h
|
||||
lib/unistd.c
|
||||
lib/unistd.in.h
|
||||
lib/unused-parameter.h
|
||||
lib/warn-on-use.h
|
||||
m4/00gnulib.m4
|
||||
m4/absolute-header.m4
|
||||
m4/configmake.m4
|
||||
m4/extensions.m4
|
||||
m4/extern-inline.m4
|
||||
m4/flock.m4
|
||||
m4/getopt.m4
|
||||
m4/gnu-make.m4
|
||||
m4/gnulib-common.m4
|
||||
m4/include_next.m4
|
||||
m4/malloc.m4
|
||||
m4/manywarnings-c++.m4
|
||||
m4/manywarnings.m4
|
||||
m4/msvc-inval.m4
|
||||
m4/msvc-nothrow.m4
|
||||
m4/off_t.m4
|
||||
m4/rawmemchr.m4
|
||||
m4/relocatable-lib.m4
|
||||
m4/ssize_t.m4
|
||||
m4/std-gnu11.m4
|
||||
m4/stddef_h.m4
|
||||
m4/stdlib_h.m4
|
||||
m4/strchrnul.m4
|
||||
m4/strdup.m4
|
||||
m4/string_h.m4
|
||||
m4/sys_file_h.m4
|
||||
m4/sys_types_h.m4
|
||||
m4/unistd_h.m4
|
||||
m4/warn-on-use.m4
|
||||
m4/warnings.m4
|
||||
m4/wchar_t.m4
|
||||
])
|
|
@ -0,0 +1,224 @@
|
|||
# include_next.m4 serial 24
|
||||
dnl Copyright (C) 2006-2018 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
dnl From Paul Eggert and Derek Price.
|
||||
|
||||
dnl Sets INCLUDE_NEXT, INCLUDE_NEXT_AS_FIRST_DIRECTIVE, PRAGMA_SYSTEM_HEADER,
|
||||
dnl and PRAGMA_COLUMNS.
|
||||
dnl
|
||||
dnl INCLUDE_NEXT expands to 'include_next' if the compiler supports it, or to
|
||||
dnl 'include' otherwise.
|
||||
dnl
|
||||
dnl INCLUDE_NEXT_AS_FIRST_DIRECTIVE expands to 'include_next' if the compiler
|
||||
dnl supports it in the special case that it is the first include directive in
|
||||
dnl the given file, or to 'include' otherwise.
|
||||
dnl
|
||||
dnl PRAGMA_SYSTEM_HEADER can be used in files that contain #include_next,
|
||||
dnl so as to avoid GCC warnings when the gcc option -pedantic is used.
|
||||
dnl '#pragma GCC system_header' has the same effect as if the file was found
|
||||
dnl through the include search path specified with '-isystem' options (as
|
||||
dnl opposed to the search path specified with '-I' options). Namely, gcc
|
||||
dnl does not warn about some things, and on some systems (Solaris and Interix)
|
||||
dnl __STDC__ evaluates to 0 instead of to 1. The latter is an undesired side
|
||||
dnl effect; we are therefore careful to use 'defined __STDC__' or '1' instead
|
||||
dnl of plain '__STDC__'.
|
||||
dnl
|
||||
dnl PRAGMA_COLUMNS can be used in files that override system header files, so
|
||||
dnl as to avoid compilation errors on HP NonStop systems when the gnulib file
|
||||
dnl is included by a system header file that does a "#pragma COLUMNS 80" (which
|
||||
dnl has the effect of truncating the lines of that file and all files that it
|
||||
dnl includes to 80 columns) and the gnulib file has lines longer than 80
|
||||
dnl columns.
|
||||
|
||||
AC_DEFUN([gl_INCLUDE_NEXT],
|
||||
[
|
||||
AC_LANG_PREPROC_REQUIRE()
|
||||
AC_CACHE_CHECK([whether the preprocessor supports include_next],
|
||||
[gl_cv_have_include_next],
|
||||
[rm -rf conftestd1a conftestd1b conftestd2
|
||||
mkdir conftestd1a conftestd1b conftestd2
|
||||
dnl IBM C 9.0, 10.1 (original versions, prior to the 2009-01 updates) on
|
||||
dnl AIX 6.1 support include_next when used as first preprocessor directive
|
||||
dnl in a file, but not when preceded by another include directive. Check
|
||||
dnl for this bug by including <stdio.h>.
|
||||
dnl Additionally, with this same compiler, include_next is a no-op when
|
||||
dnl used in a header file that was included by specifying its absolute
|
||||
dnl file name. Despite these two bugs, include_next is used in the
|
||||
dnl compiler's <math.h>. By virtue of the second bug, we need to use
|
||||
dnl include_next as well in this case.
|
||||
cat <<EOF > conftestd1a/conftest.h
|
||||
#define DEFINED_IN_CONFTESTD1
|
||||
#include_next <conftest.h>
|
||||
#ifdef DEFINED_IN_CONFTESTD2
|
||||
int foo;
|
||||
#else
|
||||
#error "include_next doesn't work"
|
||||
#endif
|
||||
EOF
|
||||
cat <<EOF > conftestd1b/conftest.h
|
||||
#define DEFINED_IN_CONFTESTD1
|
||||
#include <stdio.h>
|
||||
#include_next <conftest.h>
|
||||
#ifdef DEFINED_IN_CONFTESTD2
|
||||
int foo;
|
||||
#else
|
||||
#error "include_next doesn't work"
|
||||
#endif
|
||||
EOF
|
||||
cat <<EOF > conftestd2/conftest.h
|
||||
#ifndef DEFINED_IN_CONFTESTD1
|
||||
#error "include_next test doesn't work"
|
||||
#endif
|
||||
#define DEFINED_IN_CONFTESTD2
|
||||
EOF
|
||||
gl_save_CPPFLAGS="$CPPFLAGS"
|
||||
CPPFLAGS="$gl_save_CPPFLAGS -Iconftestd1b -Iconftestd2"
|
||||
dnl We intentionally avoid using AC_LANG_SOURCE here.
|
||||
AC_COMPILE_IFELSE([AC_LANG_DEFINES_PROVIDED[#include <conftest.h>]],
|
||||
[gl_cv_have_include_next=yes],
|
||||
[CPPFLAGS="$gl_save_CPPFLAGS -Iconftestd1a -Iconftestd2"
|
||||
AC_COMPILE_IFELSE([AC_LANG_DEFINES_PROVIDED[#include <conftest.h>]],
|
||||
[gl_cv_have_include_next=buggy],
|
||||
[gl_cv_have_include_next=no])
|
||||
])
|
||||
CPPFLAGS="$gl_save_CPPFLAGS"
|
||||
rm -rf conftestd1a conftestd1b conftestd2
|
||||
])
|
||||
PRAGMA_SYSTEM_HEADER=
|
||||
if test $gl_cv_have_include_next = yes; then
|
||||
INCLUDE_NEXT=include_next
|
||||
INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include_next
|
||||
if test -n "$GCC"; then
|
||||
PRAGMA_SYSTEM_HEADER='#pragma GCC system_header'
|
||||
fi
|
||||
else
|
||||
if test $gl_cv_have_include_next = buggy; then
|
||||
INCLUDE_NEXT=include
|
||||
INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include_next
|
||||
else
|
||||
INCLUDE_NEXT=include
|
||||
INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include
|
||||
fi
|
||||
fi
|
||||
AC_SUBST([INCLUDE_NEXT])
|
||||
AC_SUBST([INCLUDE_NEXT_AS_FIRST_DIRECTIVE])
|
||||
AC_SUBST([PRAGMA_SYSTEM_HEADER])
|
||||
AC_CACHE_CHECK([whether system header files limit the line length],
|
||||
[gl_cv_pragma_columns],
|
||||
[dnl HP NonStop systems, which define __TANDEM, have this misfeature.
|
||||
AC_EGREP_CPP([choke me],
|
||||
[
|
||||
#ifdef __TANDEM
|
||||
choke me
|
||||
#endif
|
||||
],
|
||||
[gl_cv_pragma_columns=yes],
|
||||
[gl_cv_pragma_columns=no])
|
||||
])
|
||||
if test $gl_cv_pragma_columns = yes; then
|
||||
PRAGMA_COLUMNS="#pragma COLUMNS 10000"
|
||||
else
|
||||
PRAGMA_COLUMNS=
|
||||
fi
|
||||
AC_SUBST([PRAGMA_COLUMNS])
|
||||
])
|
||||
|
||||
# gl_CHECK_NEXT_HEADERS(HEADER1 HEADER2 ...)
|
||||
# ------------------------------------------
|
||||
# For each arg foo.h, if #include_next works, define NEXT_FOO_H to be
|
||||
# '<foo.h>'; otherwise define it to be
|
||||
# '"///usr/include/foo.h"', or whatever other absolute file name is suitable.
|
||||
# Also, if #include_next works as first preprocessing directive in a file,
|
||||
# define NEXT_AS_FIRST_DIRECTIVE_FOO_H to be '<foo.h>'; otherwise define it to
|
||||
# be
|
||||
# '"///usr/include/foo.h"', or whatever other absolute file name is suitable.
|
||||
# That way, a header file with the following line:
|
||||
# #@INCLUDE_NEXT@ @NEXT_FOO_H@
|
||||
# or
|
||||
# #@INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ @NEXT_AS_FIRST_DIRECTIVE_FOO_H@
|
||||
# behaves (after sed substitution) as if it contained
|
||||
# #include_next <foo.h>
|
||||
# even if the compiler does not support include_next.
|
||||
# The three "///" are to pacify Sun C 5.8, which otherwise would say
|
||||
# "warning: #include of /usr/include/... may be non-portable".
|
||||
# Use '""', not '<>', so that the /// cannot be confused with a C99 comment.
|
||||
# Note: This macro assumes that the header file is not empty after
|
||||
# preprocessing, i.e. it does not only define preprocessor macros but also
|
||||
# provides some type/enum definitions or function/variable declarations.
|
||||
#
|
||||
# This macro also checks whether each header exists, by invoking
|
||||
# AC_CHECK_HEADERS_ONCE or AC_CHECK_HEADERS on each argument.
|
||||
AC_DEFUN([gl_CHECK_NEXT_HEADERS],
|
||||
[
|
||||
gl_NEXT_HEADERS_INTERNAL([$1], [check])
|
||||
])
|
||||
|
||||
# gl_NEXT_HEADERS(HEADER1 HEADER2 ...)
|
||||
# ------------------------------------
|
||||
# Like gl_CHECK_NEXT_HEADERS, except do not check whether the headers exist.
|
||||
# This is suitable for headers like <stddef.h> that are standardized by C89
|
||||
# and therefore can be assumed to exist.
|
||||
AC_DEFUN([gl_NEXT_HEADERS],
|
||||
[
|
||||
gl_NEXT_HEADERS_INTERNAL([$1], [assume])
|
||||
])
|
||||
|
||||
# The guts of gl_CHECK_NEXT_HEADERS and gl_NEXT_HEADERS.
|
||||
AC_DEFUN([gl_NEXT_HEADERS_INTERNAL],
|
||||
[
|
||||
AC_REQUIRE([gl_INCLUDE_NEXT])
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])
|
||||
|
||||
m4_if([$2], [check],
|
||||
[AC_CHECK_HEADERS_ONCE([$1])
|
||||
])
|
||||
|
||||
dnl FIXME: gl_next_header and gl_header_exists must be used unquoted
|
||||
dnl until we can assume autoconf 2.64 or newer.
|
||||
m4_foreach_w([gl_HEADER_NAME], [$1],
|
||||
[AS_VAR_PUSHDEF([gl_next_header],
|
||||
[gl_cv_next_]m4_defn([gl_HEADER_NAME]))
|
||||
if test $gl_cv_have_include_next = yes; then
|
||||
AS_VAR_SET(gl_next_header, ['<'gl_HEADER_NAME'>'])
|
||||
else
|
||||
AC_CACHE_CHECK(
|
||||
[absolute name of <]m4_defn([gl_HEADER_NAME])[>],
|
||||
m4_defn([gl_next_header]),
|
||||
[m4_if([$2], [check],
|
||||
[AS_VAR_PUSHDEF([gl_header_exists],
|
||||
[ac_cv_header_]m4_defn([gl_HEADER_NAME]))
|
||||
if test AS_VAR_GET(gl_header_exists) = yes; then
|
||||
AS_VAR_POPDEF([gl_header_exists])
|
||||
])
|
||||
gl_ABSOLUTE_HEADER_ONE(gl_HEADER_NAME)
|
||||
AS_VAR_COPY([gl_header], [gl_cv_absolute_]AS_TR_SH(gl_HEADER_NAME))
|
||||
AS_VAR_SET(gl_next_header, ['"'$gl_header'"'])
|
||||
m4_if([$2], [check],
|
||||
[else
|
||||
AS_VAR_SET(gl_next_header, ['<'gl_HEADER_NAME'>'])
|
||||
fi
|
||||
])
|
||||
])
|
||||
fi
|
||||
AC_SUBST(
|
||||
AS_TR_CPP([NEXT_]m4_defn([gl_HEADER_NAME])),
|
||||
[AS_VAR_GET(gl_next_header)])
|
||||
if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then
|
||||
# INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next'
|
||||
gl_next_as_first_directive='<'gl_HEADER_NAME'>'
|
||||
else
|
||||
# INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include'
|
||||
gl_next_as_first_directive=AS_VAR_GET(gl_next_header)
|
||||
fi
|
||||
AC_SUBST(
|
||||
AS_TR_CPP([NEXT_AS_FIRST_DIRECTIVE_]m4_defn([gl_HEADER_NAME])),
|
||||
[$gl_next_as_first_directive])
|
||||
AS_VAR_POPDEF([gl_next_header])])
|
||||
])
|
||||
|
||||
# Autoconf 2.68 added warnings for our use of AC_COMPILE_IFELSE;
|
||||
# this fallback is safe for all earlier autoconf versions.
|
||||
m4_define_default([AC_LANG_DEFINES_PROVIDED])
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,437 @@
|
|||
# Helper functions for option handling. -*- Autoconf -*-
|
||||
#
|
||||
# Copyright (C) 2004-2005, 2007-2009, 2011-2015 Free Software
|
||||
# Foundation, Inc.
|
||||
# Written by Gary V. Vaughan, 2004
|
||||
#
|
||||
# This file is free software; the Free Software Foundation gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 8 ltoptions.m4
|
||||
|
||||
# This is to help aclocal find these macros, as it can't see m4_define.
|
||||
AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
|
||||
|
||||
|
||||
# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME)
|
||||
# ------------------------------------------
|
||||
m4_define([_LT_MANGLE_OPTION],
|
||||
[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])])
|
||||
|
||||
|
||||
# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME)
|
||||
# ---------------------------------------
|
||||
# Set option OPTION-NAME for macro MACRO-NAME, and if there is a
|
||||
# matching handler defined, dispatch to it. Other OPTION-NAMEs are
|
||||
# saved as a flag.
|
||||
m4_define([_LT_SET_OPTION],
|
||||
[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl
|
||||
m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),
|
||||
_LT_MANGLE_DEFUN([$1], [$2]),
|
||||
[m4_warning([Unknown $1 option '$2'])])[]dnl
|
||||
])
|
||||
|
||||
|
||||
# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET])
|
||||
# ------------------------------------------------------------
|
||||
# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
|
||||
m4_define([_LT_IF_OPTION],
|
||||
[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])])
|
||||
|
||||
|
||||
# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET)
|
||||
# -------------------------------------------------------
|
||||
# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME
|
||||
# are set.
|
||||
m4_define([_LT_UNLESS_OPTIONS],
|
||||
[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
|
||||
[m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option),
|
||||
[m4_define([$0_found])])])[]dnl
|
||||
m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3
|
||||
])[]dnl
|
||||
])
|
||||
|
||||
|
||||
# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST)
|
||||
# ----------------------------------------
|
||||
# OPTION-LIST is a space-separated list of Libtool options associated
|
||||
# with MACRO-NAME. If any OPTION has a matching handler declared with
|
||||
# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about
|
||||
# the unknown option and exit.
|
||||
m4_defun([_LT_SET_OPTIONS],
|
||||
[# Set options
|
||||
m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
|
||||
[_LT_SET_OPTION([$1], _LT_Option)])
|
||||
|
||||
m4_if([$1],[LT_INIT],[
|
||||
dnl
|
||||
dnl Simply set some default values (i.e off) if boolean options were not
|
||||
dnl specified:
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no
|
||||
])
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no
|
||||
])
|
||||
dnl
|
||||
dnl If no reference was made to various pairs of opposing options, then
|
||||
dnl we run the default mode handler for the pair. For example, if neither
|
||||
dnl 'shared' nor 'disable-shared' was passed, we enable building of shared
|
||||
dnl archives by default:
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],
|
||||
[_LT_ENABLE_FAST_INSTALL])
|
||||
_LT_UNLESS_OPTIONS([LT_INIT], [aix-soname=aix aix-soname=both aix-soname=svr4],
|
||||
[_LT_WITH_AIX_SONAME([aix])])
|
||||
])
|
||||
])# _LT_SET_OPTIONS
|
||||
|
||||
|
||||
## --------------------------------- ##
|
||||
## Macros to handle LT_INIT options. ##
|
||||
## --------------------------------- ##
|
||||
|
||||
# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME)
|
||||
# -----------------------------------------
|
||||
m4_define([_LT_MANGLE_DEFUN],
|
||||
[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])])
|
||||
|
||||
|
||||
# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE)
|
||||
# -----------------------------------------------
|
||||
m4_define([LT_OPTION_DEFINE],
|
||||
[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl
|
||||
])# LT_OPTION_DEFINE
|
||||
|
||||
|
||||
# dlopen
|
||||
# ------
|
||||
LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes
|
||||
])
|
||||
|
||||
AU_DEFUN([AC_LIBTOOL_DLOPEN],
|
||||
[_LT_SET_OPTION([LT_INIT], [dlopen])
|
||||
AC_DIAGNOSE([obsolete],
|
||||
[$0: Remove this warning and the call to _LT_SET_OPTION when you
|
||||
put the 'dlopen' option into LT_INIT's first parameter.])
|
||||
])
|
||||
|
||||
dnl aclocal-1.4 backwards compatibility:
|
||||
dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], [])
|
||||
|
||||
|
||||
# win32-dll
|
||||
# ---------
|
||||
# Declare package support for building win32 dll's.
|
||||
LT_OPTION_DEFINE([LT_INIT], [win32-dll],
|
||||
[enable_win32_dll=yes
|
||||
|
||||
case $host in
|
||||
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
|
||||
AC_CHECK_TOOL(AS, as, false)
|
||||
AC_CHECK_TOOL(DLLTOOL, dlltool, false)
|
||||
AC_CHECK_TOOL(OBJDUMP, objdump, false)
|
||||
;;
|
||||
esac
|
||||
|
||||
test -z "$AS" && AS=as
|
||||
_LT_DECL([], [AS], [1], [Assembler program])dnl
|
||||
|
||||
test -z "$DLLTOOL" && DLLTOOL=dlltool
|
||||
_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl
|
||||
|
||||
test -z "$OBJDUMP" && OBJDUMP=objdump
|
||||
_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl
|
||||
])# win32-dll
|
||||
|
||||
AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
|
||||
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
||||
_LT_SET_OPTION([LT_INIT], [win32-dll])
|
||||
AC_DIAGNOSE([obsolete],
|
||||
[$0: Remove this warning and the call to _LT_SET_OPTION when you
|
||||
put the 'win32-dll' option into LT_INIT's first parameter.])
|
||||
])
|
||||
|
||||
dnl aclocal-1.4 backwards compatibility:
|
||||
dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])
|
||||
|
||||
|
||||
# _LT_ENABLE_SHARED([DEFAULT])
|
||||
# ----------------------------
|
||||
# implement the --enable-shared flag, and supports the 'shared' and
|
||||
# 'disable-shared' LT_INIT options.
|
||||
# DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'.
|
||||
m4_define([_LT_ENABLE_SHARED],
|
||||
[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl
|
||||
AC_ARG_ENABLE([shared],
|
||||
[AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
|
||||
[build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])],
|
||||
[p=${PACKAGE-default}
|
||||
case $enableval in
|
||||
yes) enable_shared=yes ;;
|
||||
no) enable_shared=no ;;
|
||||
*)
|
||||
enable_shared=no
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
|
||||
for pkg in $enableval; do
|
||||
IFS=$lt_save_ifs
|
||||
if test "X$pkg" = "X$p"; then
|
||||
enable_shared=yes
|
||||
fi
|
||||
done
|
||||
IFS=$lt_save_ifs
|
||||
;;
|
||||
esac],
|
||||
[enable_shared=]_LT_ENABLE_SHARED_DEFAULT)
|
||||
|
||||
_LT_DECL([build_libtool_libs], [enable_shared], [0],
|
||||
[Whether or not to build shared libraries])
|
||||
])# _LT_ENABLE_SHARED
|
||||
|
||||
LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])])
|
||||
LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])])
|
||||
|
||||
# Old names:
|
||||
AC_DEFUN([AC_ENABLE_SHARED],
|
||||
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared])
|
||||
])
|
||||
|
||||
AC_DEFUN([AC_DISABLE_SHARED],
|
||||
[_LT_SET_OPTION([LT_INIT], [disable-shared])
|
||||
])
|
||||
|
||||
AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
|
||||
AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
|
||||
|
||||
dnl aclocal-1.4 backwards compatibility:
|
||||
dnl AC_DEFUN([AM_ENABLE_SHARED], [])
|
||||
dnl AC_DEFUN([AM_DISABLE_SHARED], [])
|
||||
|
||||
|
||||
|
||||
# _LT_ENABLE_STATIC([DEFAULT])
|
||||
# ----------------------------
|
||||
# implement the --enable-static flag, and support the 'static' and
|
||||
# 'disable-static' LT_INIT options.
|
||||
# DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'.
|
||||
m4_define([_LT_ENABLE_STATIC],
|
||||
[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl
|
||||
AC_ARG_ENABLE([static],
|
||||
[AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],
|
||||
[build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])],
|
||||
[p=${PACKAGE-default}
|
||||
case $enableval in
|
||||
yes) enable_static=yes ;;
|
||||
no) enable_static=no ;;
|
||||
*)
|
||||
enable_static=no
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
|
||||
for pkg in $enableval; do
|
||||
IFS=$lt_save_ifs
|
||||
if test "X$pkg" = "X$p"; then
|
||||
enable_static=yes
|
||||
fi
|
||||
done
|
||||
IFS=$lt_save_ifs
|
||||
;;
|
||||
esac],
|
||||
[enable_static=]_LT_ENABLE_STATIC_DEFAULT)
|
||||
|
||||
_LT_DECL([build_old_libs], [enable_static], [0],
|
||||
[Whether or not to build static libraries])
|
||||
])# _LT_ENABLE_STATIC
|
||||
|
||||
LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])])
|
||||
LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])])
|
||||
|
||||
# Old names:
|
||||
AC_DEFUN([AC_ENABLE_STATIC],
|
||||
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static])
|
||||
])
|
||||
|
||||
AC_DEFUN([AC_DISABLE_STATIC],
|
||||
[_LT_SET_OPTION([LT_INIT], [disable-static])
|
||||
])
|
||||
|
||||
AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
|
||||
AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
|
||||
|
||||
dnl aclocal-1.4 backwards compatibility:
|
||||
dnl AC_DEFUN([AM_ENABLE_STATIC], [])
|
||||
dnl AC_DEFUN([AM_DISABLE_STATIC], [])
|
||||
|
||||
|
||||
|
||||
# _LT_ENABLE_FAST_INSTALL([DEFAULT])
|
||||
# ----------------------------------
|
||||
# implement the --enable-fast-install flag, and support the 'fast-install'
|
||||
# and 'disable-fast-install' LT_INIT options.
|
||||
# DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'.
|
||||
m4_define([_LT_ENABLE_FAST_INSTALL],
|
||||
[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl
|
||||
AC_ARG_ENABLE([fast-install],
|
||||
[AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
|
||||
[optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
|
||||
[p=${PACKAGE-default}
|
||||
case $enableval in
|
||||
yes) enable_fast_install=yes ;;
|
||||
no) enable_fast_install=no ;;
|
||||
*)
|
||||
enable_fast_install=no
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
|
||||
for pkg in $enableval; do
|
||||
IFS=$lt_save_ifs
|
||||
if test "X$pkg" = "X$p"; then
|
||||
enable_fast_install=yes
|
||||
fi
|
||||
done
|
||||
IFS=$lt_save_ifs
|
||||
;;
|
||||
esac],
|
||||
[enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)
|
||||
|
||||
_LT_DECL([fast_install], [enable_fast_install], [0],
|
||||
[Whether or not to optimize for fast installation])dnl
|
||||
])# _LT_ENABLE_FAST_INSTALL
|
||||
|
||||
LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])])
|
||||
LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])])
|
||||
|
||||
# Old names:
|
||||
AU_DEFUN([AC_ENABLE_FAST_INSTALL],
|
||||
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
|
||||
AC_DIAGNOSE([obsolete],
|
||||
[$0: Remove this warning and the call to _LT_SET_OPTION when you put
|
||||
the 'fast-install' option into LT_INIT's first parameter.])
|
||||
])
|
||||
|
||||
AU_DEFUN([AC_DISABLE_FAST_INSTALL],
|
||||
[_LT_SET_OPTION([LT_INIT], [disable-fast-install])
|
||||
AC_DIAGNOSE([obsolete],
|
||||
[$0: Remove this warning and the call to _LT_SET_OPTION when you put
|
||||
the 'disable-fast-install' option into LT_INIT's first parameter.])
|
||||
])
|
||||
|
||||
dnl aclocal-1.4 backwards compatibility:
|
||||
dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])
|
||||
dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
|
||||
|
||||
|
||||
# _LT_WITH_AIX_SONAME([DEFAULT])
|
||||
# ----------------------------------
|
||||
# implement the --with-aix-soname flag, and support the `aix-soname=aix'
|
||||
# and `aix-soname=both' and `aix-soname=svr4' LT_INIT options. DEFAULT
|
||||
# is either `aix', `both' or `svr4'. If omitted, it defaults to `aix'.
|
||||
m4_define([_LT_WITH_AIX_SONAME],
|
||||
[m4_define([_LT_WITH_AIX_SONAME_DEFAULT], [m4_if($1, svr4, svr4, m4_if($1, both, both, aix))])dnl
|
||||
shared_archive_member_spec=
|
||||
case $host,$enable_shared in
|
||||
power*-*-aix[[5-9]]*,yes)
|
||||
AC_MSG_CHECKING([which variant of shared library versioning to provide])
|
||||
AC_ARG_WITH([aix-soname],
|
||||
[AS_HELP_STRING([--with-aix-soname=aix|svr4|both],
|
||||
[shared library versioning (aka "SONAME") variant to provide on AIX, @<:@default=]_LT_WITH_AIX_SONAME_DEFAULT[@:>@.])],
|
||||
[case $withval in
|
||||
aix|svr4|both)
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR([Unknown argument to --with-aix-soname])
|
||||
;;
|
||||
esac
|
||||
lt_cv_with_aix_soname=$with_aix_soname],
|
||||
[AC_CACHE_VAL([lt_cv_with_aix_soname],
|
||||
[lt_cv_with_aix_soname=]_LT_WITH_AIX_SONAME_DEFAULT)
|
||||
with_aix_soname=$lt_cv_with_aix_soname])
|
||||
AC_MSG_RESULT([$with_aix_soname])
|
||||
if test aix != "$with_aix_soname"; then
|
||||
# For the AIX way of multilib, we name the shared archive member
|
||||
# based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o',
|
||||
# and 'shr.imp' or 'shr_64.imp', respectively, for the Import File.
|
||||
# Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag,
|
||||
# the AIX toolchain works better with OBJECT_MODE set (default 32).
|
||||
if test 64 = "${OBJECT_MODE-32}"; then
|
||||
shared_archive_member_spec=shr_64
|
||||
else
|
||||
shared_archive_member_spec=shr
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
with_aix_soname=aix
|
||||
;;
|
||||
esac
|
||||
|
||||
_LT_DECL([], [shared_archive_member_spec], [0],
|
||||
[Shared archive member basename, for filename based shared library versioning on AIX])dnl
|
||||
])# _LT_WITH_AIX_SONAME
|
||||
|
||||
LT_OPTION_DEFINE([LT_INIT], [aix-soname=aix], [_LT_WITH_AIX_SONAME([aix])])
|
||||
LT_OPTION_DEFINE([LT_INIT], [aix-soname=both], [_LT_WITH_AIX_SONAME([both])])
|
||||
LT_OPTION_DEFINE([LT_INIT], [aix-soname=svr4], [_LT_WITH_AIX_SONAME([svr4])])
|
||||
|
||||
|
||||
# _LT_WITH_PIC([MODE])
|
||||
# --------------------
|
||||
# implement the --with-pic flag, and support the 'pic-only' and 'no-pic'
|
||||
# LT_INIT options.
|
||||
# MODE is either 'yes' or 'no'. If omitted, it defaults to 'both'.
|
||||
m4_define([_LT_WITH_PIC],
|
||||
[AC_ARG_WITH([pic],
|
||||
[AS_HELP_STRING([--with-pic@<:@=PKGS@:>@],
|
||||
[try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
|
||||
[lt_p=${PACKAGE-default}
|
||||
case $withval in
|
||||
yes|no) pic_mode=$withval ;;
|
||||
*)
|
||||
pic_mode=default
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
|
||||
for lt_pkg in $withval; do
|
||||
IFS=$lt_save_ifs
|
||||
if test "X$lt_pkg" = "X$lt_p"; then
|
||||
pic_mode=yes
|
||||
fi
|
||||
done
|
||||
IFS=$lt_save_ifs
|
||||
;;
|
||||
esac],
|
||||
[pic_mode=m4_default([$1], [default])])
|
||||
|
||||
_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
|
||||
])# _LT_WITH_PIC
|
||||
|
||||
LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])])
|
||||
LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])])
|
||||
|
||||
# Old name:
|
||||
AU_DEFUN([AC_LIBTOOL_PICMODE],
|
||||
[_LT_SET_OPTION([LT_INIT], [pic-only])
|
||||
AC_DIAGNOSE([obsolete],
|
||||
[$0: Remove this warning and the call to _LT_SET_OPTION when you
|
||||
put the 'pic-only' option into LT_INIT's first parameter.])
|
||||
])
|
||||
|
||||
dnl aclocal-1.4 backwards compatibility:
|
||||
dnl AC_DEFUN([AC_LIBTOOL_PICMODE], [])
|
||||
|
||||
## ----------------- ##
|
||||
## LTDL_INIT Options ##
|
||||
## ----------------- ##
|
||||
|
||||
m4_define([_LTDL_MODE], [])
|
||||
LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive],
|
||||
[m4_define([_LTDL_MODE], [nonrecursive])])
|
||||
LT_OPTION_DEFINE([LTDL_INIT], [recursive],
|
||||
[m4_define([_LTDL_MODE], [recursive])])
|
||||
LT_OPTION_DEFINE([LTDL_INIT], [subproject],
|
||||
[m4_define([_LTDL_MODE], [subproject])])
|
||||
|
||||
m4_define([_LTDL_TYPE], [])
|
||||
LT_OPTION_DEFINE([LTDL_INIT], [installable],
|
||||
[m4_define([_LTDL_TYPE], [installable])])
|
||||
LT_OPTION_DEFINE([LTDL_INIT], [convenience],
|
||||
[m4_define([_LTDL_TYPE], [convenience])])
|
|
@ -0,0 +1,124 @@
|
|||
# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*-
|
||||
#
|
||||
# Copyright (C) 2004-2005, 2007-2008, 2011-2015 Free Software
|
||||
# Foundation, Inc.
|
||||
# Written by Gary V. Vaughan, 2004
|
||||
#
|
||||
# This file is free software; the Free Software Foundation gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 6 ltsugar.m4
|
||||
|
||||
# This is to help aclocal find these macros, as it can't see m4_define.
|
||||
AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])
|
||||
|
||||
|
||||
# lt_join(SEP, ARG1, [ARG2...])
|
||||
# -----------------------------
|
||||
# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their
|
||||
# associated separator.
|
||||
# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier
|
||||
# versions in m4sugar had bugs.
|
||||
m4_define([lt_join],
|
||||
[m4_if([$#], [1], [],
|
||||
[$#], [2], [[$2]],
|
||||
[m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])])
|
||||
m4_define([_lt_join],
|
||||
[m4_if([$#$2], [2], [],
|
||||
[m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])])
|
||||
|
||||
|
||||
# lt_car(LIST)
|
||||
# lt_cdr(LIST)
|
||||
# ------------
|
||||
# Manipulate m4 lists.
|
||||
# These macros are necessary as long as will still need to support
|
||||
# Autoconf-2.59, which quotes differently.
|
||||
m4_define([lt_car], [[$1]])
|
||||
m4_define([lt_cdr],
|
||||
[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],
|
||||
[$#], 1, [],
|
||||
[m4_dquote(m4_shift($@))])])
|
||||
m4_define([lt_unquote], $1)
|
||||
|
||||
|
||||
# lt_append(MACRO-NAME, STRING, [SEPARATOR])
|
||||
# ------------------------------------------
|
||||
# Redefine MACRO-NAME to hold its former content plus 'SEPARATOR''STRING'.
|
||||
# Note that neither SEPARATOR nor STRING are expanded; they are appended
|
||||
# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked).
|
||||
# No SEPARATOR is output if MACRO-NAME was previously undefined (different
|
||||
# than defined and empty).
|
||||
#
|
||||
# This macro is needed until we can rely on Autoconf 2.62, since earlier
|
||||
# versions of m4sugar mistakenly expanded SEPARATOR but not STRING.
|
||||
m4_define([lt_append],
|
||||
[m4_define([$1],
|
||||
m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])])
|
||||
|
||||
|
||||
|
||||
# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...])
|
||||
# ----------------------------------------------------------
|
||||
# Produce a SEP delimited list of all paired combinations of elements of
|
||||
# PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list
|
||||
# has the form PREFIXmINFIXSUFFIXn.
|
||||
# Needed until we can rely on m4_combine added in Autoconf 2.62.
|
||||
m4_define([lt_combine],
|
||||
[m4_if(m4_eval([$# > 3]), [1],
|
||||
[m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl
|
||||
[[m4_foreach([_Lt_prefix], [$2],
|
||||
[m4_foreach([_Lt_suffix],
|
||||
]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[,
|
||||
[_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])])
|
||||
|
||||
|
||||
# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ])
|
||||
# -----------------------------------------------------------------------
|
||||
# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited
|
||||
# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ.
|
||||
m4_define([lt_if_append_uniq],
|
||||
[m4_ifdef([$1],
|
||||
[m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1],
|
||||
[lt_append([$1], [$2], [$3])$4],
|
||||
[$5])],
|
||||
[lt_append([$1], [$2], [$3])$4])])
|
||||
|
||||
|
||||
# lt_dict_add(DICT, KEY, VALUE)
|
||||
# -----------------------------
|
||||
m4_define([lt_dict_add],
|
||||
[m4_define([$1($2)], [$3])])
|
||||
|
||||
|
||||
# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE)
|
||||
# --------------------------------------------
|
||||
m4_define([lt_dict_add_subkey],
|
||||
[m4_define([$1($2:$3)], [$4])])
|
||||
|
||||
|
||||
# lt_dict_fetch(DICT, KEY, [SUBKEY])
|
||||
# ----------------------------------
|
||||
m4_define([lt_dict_fetch],
|
||||
[m4_ifval([$3],
|
||||
m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]),
|
||||
m4_ifdef([$1($2)], [m4_defn([$1($2)])]))])
|
||||
|
||||
|
||||
# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE])
|
||||
# -----------------------------------------------------------------
|
||||
m4_define([lt_if_dict_fetch],
|
||||
[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4],
|
||||
[$5],
|
||||
[$6])])
|
||||
|
||||
|
||||
# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...])
|
||||
# --------------------------------------------------------------
|
||||
m4_define([lt_dict_filter],
|
||||
[m4_if([$5], [], [],
|
||||
[lt_join(m4_quote(m4_default([$4], [[, ]])),
|
||||
lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]),
|
||||
[lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl
|
||||
])
|
|
@ -0,0 +1,23 @@
|
|||
# ltversion.m4 -- version numbers -*- Autoconf -*-
|
||||
#
|
||||
# Copyright (C) 2004, 2011-2015 Free Software Foundation, Inc.
|
||||
# Written by Scott James Remnant, 2004
|
||||
#
|
||||
# This file is free software; the Free Software Foundation gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
|
||||
# @configure_input@
|
||||
|
||||
# serial 4179 ltversion.m4
|
||||
# This file is part of GNU Libtool
|
||||
|
||||
m4_define([LT_PACKAGE_VERSION], [2.4.6])
|
||||
m4_define([LT_PACKAGE_REVISION], [2.4.6])
|
||||
|
||||
AC_DEFUN([LTVERSION_VERSION],
|
||||
[macro_version='2.4.6'
|
||||
macro_revision='2.4.6'
|
||||
_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
|
||||
_LT_DECL(, macro_revision, 0)
|
||||
])
|
|
@ -0,0 +1,99 @@
|
|||
# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*-
|
||||
#
|
||||
# Copyright (C) 2004-2005, 2007, 2009, 2011-2015 Free Software
|
||||
# Foundation, Inc.
|
||||
# Written by Scott James Remnant, 2004.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 5 lt~obsolete.m4
|
||||
|
||||
# These exist entirely to fool aclocal when bootstrapping libtool.
|
||||
#
|
||||
# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN),
|
||||
# which have later been changed to m4_define as they aren't part of the
|
||||
# exported API, or moved to Autoconf or Automake where they belong.
|
||||
#
|
||||
# The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN
|
||||
# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us
|
||||
# using a macro with the same name in our local m4/libtool.m4 it'll
|
||||
# pull the old libtool.m4 in (it doesn't see our shiny new m4_define
|
||||
# and doesn't know about Autoconf macros at all.)
|
||||
#
|
||||
# So we provide this file, which has a silly filename so it's always
|
||||
# included after everything else. This provides aclocal with the
|
||||
# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything
|
||||
# because those macros already exist, or will be overwritten later.
|
||||
# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6.
|
||||
#
|
||||
# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here.
|
||||
# Yes, that means every name once taken will need to remain here until
|
||||
# we give up compatibility with versions before 1.7, at which point
|
||||
# we need to keep only those names which we still refer to.
|
||||
|
||||
# This is to help aclocal find these macros, as it can't see m4_define.
|
||||
AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])])
|
||||
|
||||
m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])])
|
||||
m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])])
|
||||
m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])])
|
||||
m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])])
|
||||
m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])])
|
||||
m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])])
|
||||
m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])])
|
||||
m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])])
|
||||
m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])])
|
||||
m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])])
|
||||
m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])])
|
||||
m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])])
|
||||
m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])])
|
||||
m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])])
|
||||
m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])])
|
||||
m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])])
|
||||
m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])])
|
||||
m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])])
|
||||
m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])])
|
||||
m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])])
|
||||
m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])])
|
||||
m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])])
|
||||
m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])])
|
||||
m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])])
|
||||
m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])])
|
||||
m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])])
|
||||
m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])])
|
||||
m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])])
|
||||
m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])])
|
||||
m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])])
|
||||
m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])])
|
||||
m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])])
|
||||
m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])])
|
||||
m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])])
|
||||
m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])])
|
||||
m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])])
|
||||
m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])])
|
||||
m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])])
|
||||
m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])])
|
||||
m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])])
|
||||
m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])])
|
||||
m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])])
|
||||
m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])])
|
||||
m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])])
|
||||
m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])])
|
||||
m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])])
|
||||
m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])])
|
||||
m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])])
|
||||
m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])])
|
||||
m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])])
|
||||
m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])])
|
||||
m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])])
|
||||
m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])])
|
||||
m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])])
|
||||
m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])])
|
||||
m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])])
|
||||
m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])])
|
||||
m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])])
|
||||
m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])])
|
||||
m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])])
|
||||
m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])])
|
|
@ -0,0 +1,101 @@
|
|||
# malloc.m4 serial 17
|
||||
dnl Copyright (C) 2007, 2009-2018 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
m4_version_prereq([2.70], [] ,[
|
||||
|
||||
# This is adapted with modifications from upstream Autoconf here:
|
||||
# https://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=04be2b7a29d65d9a08e64e8e56e594c91749598c
|
||||
AC_DEFUN([_AC_FUNC_MALLOC_IF],
|
||||
[
|
||||
AC_REQUIRE([AC_HEADER_STDC])dnl
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])dnl for cross-compiles
|
||||
AC_CHECK_HEADERS([stdlib.h])
|
||||
AC_CACHE_CHECK([for GNU libc compatible malloc],
|
||||
[ac_cv_func_malloc_0_nonnull],
|
||||
[AC_RUN_IFELSE(
|
||||
[AC_LANG_PROGRAM(
|
||||
[[#if defined STDC_HEADERS || defined HAVE_STDLIB_H
|
||||
# include <stdlib.h>
|
||||
#else
|
||||
char *malloc ();
|
||||
#endif
|
||||
]],
|
||||
[[char *p = malloc (0);
|
||||
int result = !p;
|
||||
free (p);
|
||||
return result;]])
|
||||
],
|
||||
[ac_cv_func_malloc_0_nonnull=yes],
|
||||
[ac_cv_func_malloc_0_nonnull=no],
|
||||
[case "$host_os" in
|
||||
# Guess yes on platforms where we know the result.
|
||||
*-gnu* | gnu* | freebsd* | netbsd* | openbsd* \
|
||||
| hpux* | solaris* | cygwin* | mingw*)
|
||||
ac_cv_func_malloc_0_nonnull=yes ;;
|
||||
# If we don't know, assume the worst.
|
||||
*) ac_cv_func_malloc_0_nonnull=no ;;
|
||||
esac
|
||||
])
|
||||
])
|
||||
AS_IF([test $ac_cv_func_malloc_0_nonnull = yes], [$1], [$2])
|
||||
])# _AC_FUNC_MALLOC_IF
|
||||
|
||||
])
|
||||
|
||||
# gl_FUNC_MALLOC_GNU
|
||||
# ------------------
|
||||
# Test whether 'malloc (0)' is handled like in GNU libc, and replace malloc if
|
||||
# it is not.
|
||||
AC_DEFUN([gl_FUNC_MALLOC_GNU],
|
||||
[
|
||||
AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
|
||||
dnl _AC_FUNC_MALLOC_IF is defined in Autoconf.
|
||||
_AC_FUNC_MALLOC_IF(
|
||||
[AC_DEFINE([HAVE_MALLOC_GNU], [1],
|
||||
[Define to 1 if your system has a GNU libc compatible 'malloc'
|
||||
function, and to 0 otherwise.])],
|
||||
[AC_DEFINE([HAVE_MALLOC_GNU], [0])
|
||||
REPLACE_MALLOC=1
|
||||
])
|
||||
])
|
||||
|
||||
# gl_FUNC_MALLOC_POSIX
|
||||
# --------------------
|
||||
# Test whether 'malloc' is POSIX compliant (sets errno to ENOMEM when it
|
||||
# fails), and replace malloc if it is not.
|
||||
AC_DEFUN([gl_FUNC_MALLOC_POSIX],
|
||||
[
|
||||
AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
|
||||
AC_REQUIRE([gl_CHECK_MALLOC_POSIX])
|
||||
if test $gl_cv_func_malloc_posix = yes; then
|
||||
AC_DEFINE([HAVE_MALLOC_POSIX], [1],
|
||||
[Define if the 'malloc' function is POSIX compliant.])
|
||||
else
|
||||
REPLACE_MALLOC=1
|
||||
fi
|
||||
])
|
||||
|
||||
# Test whether malloc, realloc, calloc are POSIX compliant,
|
||||
# Set gl_cv_func_malloc_posix to yes or no accordingly.
|
||||
AC_DEFUN([gl_CHECK_MALLOC_POSIX],
|
||||
[
|
||||
AC_CACHE_CHECK([whether malloc, realloc, calloc are POSIX compliant],
|
||||
[gl_cv_func_malloc_posix],
|
||||
[
|
||||
dnl It is too dangerous to try to allocate a large amount of memory:
|
||||
dnl some systems go to their knees when you do that. So assume that
|
||||
dnl all Unix implementations of the function are POSIX compliant.
|
||||
AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM(
|
||||
[[]],
|
||||
[[#if defined _WIN32 && ! defined __CYGWIN__
|
||||
choke me
|
||||
#endif
|
||||
]])],
|
||||
[gl_cv_func_malloc_posix=yes],
|
||||
[gl_cv_func_malloc_posix=no])
|
||||
])
|
||||
])
|
|
@ -0,0 +1,245 @@
|
|||
# manywarnings-c++.m4 serial 3
|
||||
dnl Copyright (C) 2008-2018 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# Implementation of the specialization of gl_MANYWARN_ALL_GCC
|
||||
# for _AC_LANG = C++.
|
||||
AC_DEFUN([gl_MANYWARN_ALL_GCC_CXX_IMPL],
|
||||
[
|
||||
AC_LANG_PUSH([C++])
|
||||
|
||||
dnl First, check for some issues that only occur when combining multiple
|
||||
dnl gcc warning categories.
|
||||
AC_REQUIRE([AC_PROG_CXX])
|
||||
if test -n "$GXX"; then
|
||||
|
||||
dnl Check if -W -Werror -Wno-missing-field-initializers is supported
|
||||
dnl with the current $CXX $CXXFLAGS $CPPFLAGS.
|
||||
AC_CACHE_CHECK([whether -Wno-missing-field-initializers is supported],
|
||||
[gl_cv_cxx_nomfi_supported],
|
||||
[gl_save_CXXFLAGS="$CXXFLAGS"
|
||||
CXXFLAGS="$CXXFLAGS -W -Werror -Wno-missing-field-initializers"
|
||||
AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[]], [[]])],
|
||||
[gl_cv_cxx_nomfi_supported=yes],
|
||||
[gl_cv_cxx_nomfi_supported=no])
|
||||
CXXFLAGS="$gl_save_CXXFLAGS"
|
||||
])
|
||||
|
||||
if test "$gl_cv_cxx_nomfi_supported" = yes; then
|
||||
dnl Now check whether -Wno-missing-field-initializers is needed
|
||||
dnl for the { 0, } construct.
|
||||
AC_CACHE_CHECK([whether -Wno-missing-field-initializers is needed],
|
||||
[gl_cv_cxx_nomfi_needed],
|
||||
[gl_save_CXXFLAGS="$CXXFLAGS"
|
||||
CXXFLAGS="$CXXFLAGS -W -Werror"
|
||||
AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM(
|
||||
[[int f (void)
|
||||
{
|
||||
typedef struct { int a; int b; } s_t;
|
||||
s_t s1 = { 0, };
|
||||
return s1.b;
|
||||
}
|
||||
]],
|
||||
[[]])],
|
||||
[gl_cv_cxx_nomfi_needed=no],
|
||||
[gl_cv_cxx_nomfi_needed=yes])
|
||||
CXXFLAGS="$gl_save_CXXFLAGS"
|
||||
])
|
||||
fi
|
||||
|
||||
dnl Next, check if -Werror -Wuninitialized is useful with the
|
||||
dnl user's choice of $CXXFLAGS; some versions of gcc warn that it
|
||||
dnl has no effect if -O is not also used
|
||||
AC_CACHE_CHECK([whether -Wuninitialized is supported],
|
||||
[gl_cv_cxx_uninitialized_supported],
|
||||
[gl_save_CXXFLAGS="$CXXFLAGS"
|
||||
CXXFLAGS="$CXXFLAGS -Werror -Wuninitialized"
|
||||
AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[]], [[]])],
|
||||
[gl_cv_cxx_uninitialized_supported=yes],
|
||||
[gl_cv_cxx_uninitialized_supported=no])
|
||||
CXXFLAGS="$gl_save_CXXFLAGS"
|
||||
])
|
||||
|
||||
fi
|
||||
|
||||
# List all gcc warning categories.
|
||||
# To compare this list to your installed GCC's, run this Bash command:
|
||||
#
|
||||
# comm -3 \
|
||||
# <(sed -n 's/^ *\(-[^ ]*\) .*/\1/p' manywarnings-c++.m4 | sort) \
|
||||
# <(gcc --help=warnings | sed -n 's/^ \(-[^ ]*\) .*/\1/p' | sort |
|
||||
# grep -v -x -f <(
|
||||
# awk '/^[^#]/ {print $1}' ../build-aux/g++-warning.spec))
|
||||
|
||||
gl_manywarn_set=
|
||||
for gl_manywarn_item in \
|
||||
-W \
|
||||
-Wabi \
|
||||
-Wabi-tag \
|
||||
-Waddress \
|
||||
-Waggressive-loop-optimizations \
|
||||
-Wall \
|
||||
-Wattributes \
|
||||
-Wbool-compare \
|
||||
-Wbuiltin-macro-redefined \
|
||||
-Wcast-align \
|
||||
-Wchar-subscripts \
|
||||
-Wchkp \
|
||||
-Wclobbered \
|
||||
-Wcomment \
|
||||
-Wcomments \
|
||||
-Wconditionally-supported \
|
||||
-Wconversion-null \
|
||||
-Wcoverage-mismatch \
|
||||
-Wcpp \
|
||||
-Wctor-dtor-privacy \
|
||||
-Wdate-time \
|
||||
-Wdelete-incomplete \
|
||||
-Wdelete-non-virtual-dtor \
|
||||
-Wdeprecated \
|
||||
-Wdeprecated-declarations \
|
||||
-Wdisabled-optimization \
|
||||
-Wdiv-by-zero \
|
||||
-Wdouble-promotion \
|
||||
-Weffc++ \
|
||||
-Wempty-body \
|
||||
-Wendif-labels \
|
||||
-Wenum-compare \
|
||||
-Wextra \
|
||||
-Wformat-contains-nul \
|
||||
-Wformat-extra-args \
|
||||
-Wformat-nonliteral \
|
||||
-Wformat-security \
|
||||
-Wformat-signedness \
|
||||
-Wformat-y2k \
|
||||
-Wformat-zero-length \
|
||||
-Wfree-nonheap-object \
|
||||
-Wignored-qualifiers \
|
||||
-Winherited-variadic-ctor \
|
||||
-Winit-self \
|
||||
-Winline \
|
||||
-Wint-to-pointer-cast \
|
||||
-Winvalid-memory-model \
|
||||
-Winvalid-offsetof \
|
||||
-Winvalid-pch \
|
||||
-Wliteral-suffix \
|
||||
-Wlogical-not-parentheses \
|
||||
-Wlogical-op \
|
||||
-Wmain \
|
||||
-Wmaybe-uninitialized \
|
||||
-Wmemset-transposed-args \
|
||||
-Wmissing-braces \
|
||||
-Wmissing-declarations \
|
||||
-Wmissing-field-initializers \
|
||||
-Wmissing-include-dirs \
|
||||
-Wmultichar \
|
||||
-Wnarrowing \
|
||||
-Wnoexcept \
|
||||
-Wnon-template-friend \
|
||||
-Wnon-virtual-dtor \
|
||||
-Wnonnull \
|
||||
-Wodr \
|
||||
-Wold-style-cast \
|
||||
-Wopenmp-simd \
|
||||
-Woverflow \
|
||||
-Woverlength-strings \
|
||||
-Woverloaded-virtual \
|
||||
-Wpacked \
|
||||
-Wpacked-bitfield-compat \
|
||||
-Wparentheses \
|
||||
-Wpmf-conversions \
|
||||
-Wpointer-arith \
|
||||
-Wpragmas \
|
||||
-Wreorder \
|
||||
-Wreturn-local-addr \
|
||||
-Wreturn-type \
|
||||
-Wsequence-point \
|
||||
-Wshadow \
|
||||
-Wshift-count-negative \
|
||||
-Wshift-count-overflow \
|
||||
-Wsign-promo \
|
||||
-Wsized-deallocation \
|
||||
-Wsizeof-array-argument \
|
||||
-Wsizeof-pointer-memaccess \
|
||||
-Wstack-protector \
|
||||
-Wstrict-aliasing \
|
||||
-Wstrict-null-sentinel \
|
||||
-Wstrict-overflow \
|
||||
-Wsuggest-attribute=const \
|
||||
-Wsuggest-attribute=format \
|
||||
-Wsuggest-attribute=noreturn \
|
||||
-Wsuggest-attribute=pure \
|
||||
-Wsuggest-final-methods \
|
||||
-Wsuggest-final-types \
|
||||
-Wsuggest-override \
|
||||
-Wswitch \
|
||||
-Wswitch-bool \
|
||||
-Wsync-nand \
|
||||
-Wsystem-headers \
|
||||
-Wtrampolines \
|
||||
-Wtrigraphs \
|
||||
-Wtype-limits \
|
||||
-Wuninitialized \
|
||||
-Wunknown-pragmas \
|
||||
-Wunsafe-loop-optimizations \
|
||||
-Wunused \
|
||||
-Wunused-but-set-parameter \
|
||||
-Wunused-but-set-variable \
|
||||
-Wunused-function \
|
||||
-Wunused-label \
|
||||
-Wunused-local-typedefs \
|
||||
-Wunused-macros \
|
||||
-Wunused-parameter \
|
||||
-Wunused-result \
|
||||
-Wunused-value \
|
||||
-Wunused-variable \
|
||||
-Wuseless-cast \
|
||||
-Wvarargs \
|
||||
-Wvariadic-macros \
|
||||
-Wvector-operation-performance \
|
||||
-Wvirtual-move-assign \
|
||||
-Wvla \
|
||||
-Wvolatile-register-var \
|
||||
-Wwrite-strings \
|
||||
-Wzero-as-null-pointer-constant \
|
||||
\
|
||||
; do
|
||||
gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item"
|
||||
done
|
||||
|
||||
# gcc --help=warnings outputs an unusual form for these options; list
|
||||
# them here so that the above 'comm' command doesn't report a false match.
|
||||
gl_manywarn_set="$gl_manywarn_set -Warray-bounds=2"
|
||||
gl_manywarn_set="$gl_manywarn_set -Wnormalized=nfc"
|
||||
gl_manywarn_set="$gl_manywarn_set -Wshift-overflow=2"
|
||||
gl_manywarn_set="$gl_manywarn_set -Wunused-const-variable=2"
|
||||
|
||||
# These are needed for older GCC versions.
|
||||
if test -n "$GXX"; then
|
||||
case `($CXX --version) 2>/dev/null` in
|
||||
'g++ (GCC) '[[0-3]].* | \
|
||||
'g++ (GCC) '4.[[0-7]].*)
|
||||
gl_manywarn_set="$gl_manywarn_set -fdiagnostics-show-option"
|
||||
gl_manywarn_set="$gl_manywarn_set -funit-at-a-time"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Disable specific options as needed.
|
||||
if test "$gl_cv_cxx_nomfi_needed" = yes; then
|
||||
gl_manywarn_set="$gl_manywarn_set -Wno-missing-field-initializers"
|
||||
fi
|
||||
|
||||
if test "$gl_cv_cxx_uninitialized_supported" = no; then
|
||||
gl_manywarn_set="$gl_manywarn_set -Wno-uninitialized"
|
||||
fi
|
||||
|
||||
$1=$gl_manywarn_set
|
||||
|
||||
AC_LANG_POP([C++])
|
||||
])
|
|
@ -0,0 +1,334 @@
|
|||
# manywarnings.m4 serial 17
|
||||
dnl Copyright (C) 2008-2018 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
dnl From Simon Josefsson
|
||||
|
||||
# gl_MANYWARN_COMPLEMENT(OUTVAR, LISTVAR, REMOVEVAR)
|
||||
# --------------------------------------------------
|
||||
# Copy LISTVAR to OUTVAR except for the entries in REMOVEVAR.
|
||||
# Elements separated by whitespace. In set logic terms, the function
|
||||
# does OUTVAR = LISTVAR \ REMOVEVAR.
|
||||
AC_DEFUN([gl_MANYWARN_COMPLEMENT],
|
||||
[
|
||||
gl_warn_set=
|
||||
set x $2; shift
|
||||
for gl_warn_item
|
||||
do
|
||||
case " $3 " in
|
||||
*" $gl_warn_item "*)
|
||||
;;
|
||||
*)
|
||||
gl_warn_set="$gl_warn_set $gl_warn_item"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
$1=$gl_warn_set
|
||||
])
|
||||
|
||||
# gl_MANYWARN_ALL_GCC(VARIABLE)
|
||||
# -----------------------------
|
||||
# Add all documented GCC warning parameters to variable VARIABLE.
|
||||
# Note that you need to test them using gl_WARN_ADD if you want to
|
||||
# make sure your gcc understands it.
|
||||
#
|
||||
# The effects of this macro depend on the current language (_AC_LANG).
|
||||
AC_DEFUN([gl_MANYWARN_ALL_GCC],
|
||||
[_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
|
||||
|
||||
# Specialization for _AC_LANG = C.
|
||||
# Use of m4_defun rather than AC_DEFUN works around a bug in autoconf < 2.63b.
|
||||
m4_defun([gl_MANYWARN_ALL_GCC(C)],
|
||||
[
|
||||
AC_LANG_PUSH([C])
|
||||
|
||||
dnl First, check for some issues that only occur when combining multiple
|
||||
dnl gcc warning categories.
|
||||
AC_REQUIRE([AC_PROG_CC])
|
||||
if test -n "$GCC"; then
|
||||
|
||||
dnl Check if -W -Werror -Wno-missing-field-initializers is supported
|
||||
dnl with the current $CC $CFLAGS $CPPFLAGS.
|
||||
AC_CACHE_CHECK([whether -Wno-missing-field-initializers is supported],
|
||||
[gl_cv_cc_nomfi_supported],
|
||||
[gl_save_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -W -Werror -Wno-missing-field-initializers"
|
||||
AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[]], [[]])],
|
||||
[gl_cv_cc_nomfi_supported=yes],
|
||||
[gl_cv_cc_nomfi_supported=no])
|
||||
CFLAGS="$gl_save_CFLAGS"
|
||||
])
|
||||
|
||||
if test "$gl_cv_cc_nomfi_supported" = yes; then
|
||||
dnl Now check whether -Wno-missing-field-initializers is needed
|
||||
dnl for the { 0, } construct.
|
||||
AC_CACHE_CHECK([whether -Wno-missing-field-initializers is needed],
|
||||
[gl_cv_cc_nomfi_needed],
|
||||
[gl_save_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -W -Werror"
|
||||
AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM(
|
||||
[[int f (void)
|
||||
{
|
||||
typedef struct { int a; int b; } s_t;
|
||||
s_t s1 = { 0, };
|
||||
return s1.b;
|
||||
}
|
||||
]],
|
||||
[[]])],
|
||||
[gl_cv_cc_nomfi_needed=no],
|
||||
[gl_cv_cc_nomfi_needed=yes])
|
||||
CFLAGS="$gl_save_CFLAGS"
|
||||
])
|
||||
fi
|
||||
|
||||
dnl Next, check if -Werror -Wuninitialized is useful with the
|
||||
dnl user's choice of $CFLAGS; some versions of gcc warn that it
|
||||
dnl has no effect if -O is not also used
|
||||
AC_CACHE_CHECK([whether -Wuninitialized is supported],
|
||||
[gl_cv_cc_uninitialized_supported],
|
||||
[gl_save_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -Werror -Wuninitialized"
|
||||
AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[]], [[]])],
|
||||
[gl_cv_cc_uninitialized_supported=yes],
|
||||
[gl_cv_cc_uninitialized_supported=no])
|
||||
CFLAGS="$gl_save_CFLAGS"
|
||||
])
|
||||
|
||||
fi
|
||||
|
||||
# List all gcc warning categories.
|
||||
# To compare this list to your installed GCC's, run this Bash command:
|
||||
#
|
||||
# comm -3 \
|
||||
# <((sed -n 's/^ *\(-[^ 0-9][^ ]*\) .*/\1/p' manywarnings.m4; \
|
||||
# awk '/^[^#]/ {print $1}' ../build-aux/gcc-warning.spec) | sort) \
|
||||
# <(LC_ALL=C gcc --help=warnings | sed -n 's/^ \(-[^ ]*\) .*/\1/p' | sort)
|
||||
|
||||
gl_manywarn_set=
|
||||
for gl_manywarn_item in -fno-common \
|
||||
-W \
|
||||
-Waddress \
|
||||
-Waggressive-loop-optimizations \
|
||||
-Wall \
|
||||
-Wattribute-alias \
|
||||
-Wattributes \
|
||||
-Wbad-function-cast \
|
||||
-Wbool-compare \
|
||||
-Wbool-operation \
|
||||
-Wbuiltin-declaration-mismatch \
|
||||
-Wbuiltin-macro-redefined \
|
||||
-Wcast-align \
|
||||
-Wcast-align=strict \
|
||||
-Wcast-function-type \
|
||||
-Wchar-subscripts \
|
||||
-Wclobbered \
|
||||
-Wcomment \
|
||||
-Wcomments \
|
||||
-Wcoverage-mismatch \
|
||||
-Wcpp \
|
||||
-Wdangling-else \
|
||||
-Wdate-time \
|
||||
-Wdeprecated \
|
||||
-Wdeprecated-declarations \
|
||||
-Wdesignated-init \
|
||||
-Wdisabled-optimization \
|
||||
-Wdiscarded-array-qualifiers \
|
||||
-Wdiscarded-qualifiers \
|
||||
-Wdiv-by-zero \
|
||||
-Wdouble-promotion \
|
||||
-Wduplicated-branches \
|
||||
-Wduplicated-cond \
|
||||
-Wduplicate-decl-specifier \
|
||||
-Wempty-body \
|
||||
-Wendif-labels \
|
||||
-Wenum-compare \
|
||||
-Wexpansion-to-defined \
|
||||
-Wextra \
|
||||
-Wformat-contains-nul \
|
||||
-Wformat-extra-args \
|
||||
-Wformat-nonliteral \
|
||||
-Wformat-security \
|
||||
-Wformat-signedness \
|
||||
-Wformat-y2k \
|
||||
-Wformat-zero-length \
|
||||
-Wframe-address \
|
||||
-Wfree-nonheap-object \
|
||||
-Whsa \
|
||||
-Wif-not-aligned \
|
||||
-Wignored-attributes \
|
||||
-Wignored-qualifiers \
|
||||
-Wimplicit \
|
||||
-Wimplicit-function-declaration \
|
||||
-Wimplicit-int \
|
||||
-Wincompatible-pointer-types \
|
||||
-Winit-self \
|
||||
-Winline \
|
||||
-Wint-conversion \
|
||||
-Wint-in-bool-context \
|
||||
-Wint-to-pointer-cast \
|
||||
-Winvalid-memory-model \
|
||||
-Winvalid-pch \
|
||||
-Wlogical-not-parentheses \
|
||||
-Wlogical-op \
|
||||
-Wmain \
|
||||
-Wmaybe-uninitialized \
|
||||
-Wmemset-elt-size \
|
||||
-Wmemset-transposed-args \
|
||||
-Wmisleading-indentation \
|
||||
-Wmissing-attributes \
|
||||
-Wmissing-braces \
|
||||
-Wmissing-declarations \
|
||||
-Wmissing-field-initializers \
|
||||
-Wmissing-include-dirs \
|
||||
-Wmissing-parameter-type \
|
||||
-Wmissing-prototypes \
|
||||
-Wmultichar \
|
||||
-Wmultistatement-macros \
|
||||
-Wnarrowing \
|
||||
-Wnested-externs \
|
||||
-Wnonnull \
|
||||
-Wnonnull-compare \
|
||||
-Wnull-dereference \
|
||||
-Wodr \
|
||||
-Wold-style-declaration \
|
||||
-Wold-style-definition \
|
||||
-Wopenmp-simd \
|
||||
-Woverflow \
|
||||
-Woverlength-strings \
|
||||
-Woverride-init \
|
||||
-Wpacked \
|
||||
-Wpacked-bitfield-compat \
|
||||
-Wpacked-not-aligned \
|
||||
-Wparentheses \
|
||||
-Wpointer-arith \
|
||||
-Wpointer-compare \
|
||||
-Wpointer-sign \
|
||||
-Wpointer-to-int-cast \
|
||||
-Wpragmas \
|
||||
-Wpsabi \
|
||||
-Wrestrict \
|
||||
-Wreturn-local-addr \
|
||||
-Wreturn-type \
|
||||
-Wscalar-storage-order \
|
||||
-Wsequence-point \
|
||||
-Wshadow \
|
||||
-Wshift-count-negative \
|
||||
-Wshift-count-overflow \
|
||||
-Wshift-negative-value \
|
||||
-Wsizeof-array-argument \
|
||||
-Wsizeof-pointer-div \
|
||||
-Wsizeof-pointer-memaccess \
|
||||
-Wstack-protector \
|
||||
-Wstrict-aliasing \
|
||||
-Wstrict-overflow \
|
||||
-Wstrict-prototypes \
|
||||
-Wstringop-truncation \
|
||||
-Wsuggest-attribute=cold \
|
||||
-Wsuggest-attribute=const \
|
||||
-Wsuggest-attribute=format \
|
||||
-Wsuggest-attribute=malloc \
|
||||
-Wsuggest-attribute=noreturn \
|
||||
-Wsuggest-attribute=pure \
|
||||
-Wsuggest-final-methods \
|
||||
-Wsuggest-final-types \
|
||||
-Wswitch \
|
||||
-Wswitch-bool \
|
||||
-Wswitch-unreachable \
|
||||
-Wsync-nand \
|
||||
-Wsystem-headers \
|
||||
-Wtautological-compare \
|
||||
-Wtrampolines \
|
||||
-Wtrigraphs \
|
||||
-Wtype-limits \
|
||||
-Wuninitialized \
|
||||
-Wunknown-pragmas \
|
||||
-Wunsafe-loop-optimizations \
|
||||
-Wunused \
|
||||
-Wunused-but-set-parameter \
|
||||
-Wunused-but-set-variable \
|
||||
-Wunused-function \
|
||||
-Wunused-label \
|
||||
-Wunused-local-typedefs \
|
||||
-Wunused-macros \
|
||||
-Wunused-parameter \
|
||||
-Wunused-result \
|
||||
-Wunused-value \
|
||||
-Wunused-variable \
|
||||
-Wvarargs \
|
||||
-Wvariadic-macros \
|
||||
-Wvector-operation-performance \
|
||||
-Wvla \
|
||||
-Wvolatile-register-var \
|
||||
-Wwrite-strings \
|
||||
\
|
||||
; do
|
||||
gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item"
|
||||
done
|
||||
|
||||
# gcc --help=warnings outputs an unusual form for these options; list
|
||||
# them here so that the above 'comm' command doesn't report a false match.
|
||||
# Would prefer "min (PTRDIFF_MAX, SIZE_MAX)", but it must be a literal.
|
||||
# Also, AC_COMPUTE_INT requires it to fit in a long; it is 2**63 on
|
||||
# the only platforms where it does not fit in a long, so make that
|
||||
# a special case.
|
||||
AC_MSG_CHECKING([max safe object size])
|
||||
AC_COMPUTE_INT([gl_alloc_max],
|
||||
[LONG_MAX < (PTRDIFF_MAX < (size_t) -1 ? PTRDIFF_MAX : (size_t) -1)
|
||||
? -1
|
||||
: PTRDIFF_MAX < (size_t) -1 ? (long) PTRDIFF_MAX : (long) (size_t) -1],
|
||||
[[#include <limits.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
]],
|
||||
[gl_alloc_max=2147483647])
|
||||
case $gl_alloc_max in
|
||||
-1) gl_alloc_max=9223372036854775807;;
|
||||
esac
|
||||
AC_MSG_RESULT([$gl_alloc_max])
|
||||
gl_manywarn_set="$gl_manywarn_set -Walloc-size-larger-than=$gl_alloc_max"
|
||||
gl_manywarn_set="$gl_manywarn_set -Warray-bounds=2"
|
||||
gl_manywarn_set="$gl_manywarn_set -Wformat-overflow=2"
|
||||
gl_manywarn_set="$gl_manywarn_set -Wformat-truncation=2"
|
||||
gl_manywarn_set="$gl_manywarn_set -Wimplicit-fallthrough=5"
|
||||
gl_manywarn_set="$gl_manywarn_set -Wnormalized=nfc"
|
||||
gl_manywarn_set="$gl_manywarn_set -Wshift-overflow=2"
|
||||
gl_manywarn_set="$gl_manywarn_set -Wstringop-overflow=2"
|
||||
gl_manywarn_set="$gl_manywarn_set -Wunused-const-variable=2"
|
||||
gl_manywarn_set="$gl_manywarn_set -Wvla-larger-than=4031"
|
||||
|
||||
# These are needed for older GCC versions.
|
||||
if test -n "$GCC"; then
|
||||
case `($CC --version) 2>/dev/null` in
|
||||
'gcc (GCC) '[[0-3]].* | \
|
||||
'gcc (GCC) '4.[[0-7]].*)
|
||||
gl_manywarn_set="$gl_manywarn_set -fdiagnostics-show-option"
|
||||
gl_manywarn_set="$gl_manywarn_set -funit-at-a-time"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Disable specific options as needed.
|
||||
if test "$gl_cv_cc_nomfi_needed" = yes; then
|
||||
gl_manywarn_set="$gl_manywarn_set -Wno-missing-field-initializers"
|
||||
fi
|
||||
|
||||
if test "$gl_cv_cc_uninitialized_supported" = no; then
|
||||
gl_manywarn_set="$gl_manywarn_set -Wno-uninitialized"
|
||||
fi
|
||||
|
||||
$1=$gl_manywarn_set
|
||||
|
||||
AC_LANG_POP([C])
|
||||
])
|
||||
|
||||
# Specialization for _AC_LANG = C++.
|
||||
# Use of m4_defun rather than AC_DEFUN works around a bug in autoconf < 2.63b.
|
||||
m4_defun([gl_MANYWARN_ALL_GCC(C++)],
|
||||
[
|
||||
gl_MANYWARN_ALL_GCC_CXX_IMPL([$1])
|
||||
])
|
|
@ -0,0 +1,19 @@
|
|||
# msvc-inval.m4 serial 1
|
||||
dnl Copyright (C) 2011-2018 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
AC_DEFUN([gl_MSVC_INVAL],
|
||||
[
|
||||
AC_CHECK_FUNCS_ONCE([_set_invalid_parameter_handler])
|
||||
if test $ac_cv_func__set_invalid_parameter_handler = yes; then
|
||||
HAVE_MSVC_INVALID_PARAMETER_HANDLER=1
|
||||
AC_DEFINE([HAVE_MSVC_INVALID_PARAMETER_HANDLER], [1],
|
||||
[Define to 1 on MSVC platforms that have the "invalid parameter handler"
|
||||
concept.])
|
||||
else
|
||||
HAVE_MSVC_INVALID_PARAMETER_HANDLER=0
|
||||
fi
|
||||
AC_SUBST([HAVE_MSVC_INVALID_PARAMETER_HANDLER])
|
||||
])
|
|
@ -0,0 +1,10 @@
|
|||
# msvc-nothrow.m4 serial 1
|
||||
dnl Copyright (C) 2011-2018 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
AC_DEFUN([gl_MSVC_NOTHROW],
|
||||
[
|
||||
AC_REQUIRE([gl_MSVC_INVAL])
|
||||
])
|
|
@ -0,0 +1,18 @@
|
|||
# off_t.m4 serial 1
|
||||
dnl Copyright (C) 2012-2018 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
dnl Check whether to override the 'off_t' type.
|
||||
dnl Set WINDOWS_64_BIT_OFF_T.
|
||||
|
||||
AC_DEFUN([gl_TYPE_OFF_T],
|
||||
[
|
||||
m4_ifdef([gl_LARGEFILE], [
|
||||
AC_REQUIRE([gl_LARGEFILE])
|
||||
], [
|
||||
WINDOWS_64_BIT_OFF_T=0
|
||||
])
|
||||
AC_SUBST([WINDOWS_64_BIT_OFF_T])
|
||||
])
|
|
@ -0,0 +1,275 @@
|
|||
dnl pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
|
||||
dnl serial 11 (pkg-config-0.29.1)
|
||||
dnl
|
||||
dnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
|
||||
dnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
|
||||
dnl
|
||||
dnl This program is free software; you can redistribute it and/or modify
|
||||
dnl it under the terms of the GNU General Public License as published by
|
||||
dnl the Free Software Foundation; either version 2 of the License, or
|
||||
dnl (at your option) any later version.
|
||||
dnl
|
||||
dnl This program is distributed in the hope that it will be useful, but
|
||||
dnl WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
dnl General Public License for more details.
|
||||
dnl
|
||||
dnl You should have received a copy of the GNU General Public License
|
||||
dnl along with this program; if not, write to the Free Software
|
||||
dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
dnl 02111-1307, USA.
|
||||
dnl
|
||||
dnl As a special exception to the GNU General Public License, if you
|
||||
dnl distribute this file as part of a program that contains a
|
||||
dnl configuration script generated by Autoconf, you may include it under
|
||||
dnl the same distribution terms that you use for the rest of that
|
||||
dnl program.
|
||||
|
||||
dnl PKG_PREREQ(MIN-VERSION)
|
||||
dnl -----------------------
|
||||
dnl Since: 0.29
|
||||
dnl
|
||||
dnl Verify that the version of the pkg-config macros are at least
|
||||
dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
|
||||
dnl installed version of pkg-config, this checks the developer's version
|
||||
dnl of pkg.m4 when generating configure.
|
||||
dnl
|
||||
dnl To ensure that this macro is defined, also add:
|
||||
dnl m4_ifndef([PKG_PREREQ],
|
||||
dnl [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
|
||||
dnl
|
||||
dnl See the "Since" comment for each macro you use to see what version
|
||||
dnl of the macros you require.
|
||||
m4_defun([PKG_PREREQ],
|
||||
[m4_define([PKG_MACROS_VERSION], [0.29.1])
|
||||
m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
|
||||
[m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
|
||||
])dnl PKG_PREREQ
|
||||
|
||||
dnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
|
||||
dnl ----------------------------------
|
||||
dnl Since: 0.16
|
||||
dnl
|
||||
dnl Search for the pkg-config tool and set the PKG_CONFIG variable to
|
||||
dnl first found in the path. Checks that the version of pkg-config found
|
||||
dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
|
||||
dnl used since that's the first version where most current features of
|
||||
dnl pkg-config existed.
|
||||
AC_DEFUN([PKG_PROG_PKG_CONFIG],
|
||||
[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
|
||||
m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
|
||||
m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
|
||||
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
|
||||
AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
|
||||
AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
|
||||
|
||||
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
|
||||
AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
|
||||
fi
|
||||
if test -n "$PKG_CONFIG"; then
|
||||
_pkg_min_version=m4_default([$1], [0.9.0])
|
||||
AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
|
||||
if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
PKG_CONFIG=""
|
||||
fi
|
||||
fi[]dnl
|
||||
])dnl PKG_PROG_PKG_CONFIG
|
||||
|
||||
dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
|
||||
dnl -------------------------------------------------------------------
|
||||
dnl Since: 0.18
|
||||
dnl
|
||||
dnl Check to see whether a particular set of modules exists. Similar to
|
||||
dnl PKG_CHECK_MODULES(), but does not set variables or print errors.
|
||||
dnl
|
||||
dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
|
||||
dnl only at the first occurence in configure.ac, so if the first place
|
||||
dnl it's called might be skipped (such as if it is within an "if", you
|
||||
dnl have to call PKG_CHECK_EXISTS manually
|
||||
AC_DEFUN([PKG_CHECK_EXISTS],
|
||||
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
|
||||
if test -n "$PKG_CONFIG" && \
|
||||
AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
|
||||
m4_default([$2], [:])
|
||||
m4_ifvaln([$3], [else
|
||||
$3])dnl
|
||||
fi])
|
||||
|
||||
dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
|
||||
dnl ---------------------------------------------
|
||||
dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
|
||||
dnl pkg_failed based on the result.
|
||||
m4_define([_PKG_CONFIG],
|
||||
[if test -n "$$1"; then
|
||||
pkg_cv_[]$1="$$1"
|
||||
elif test -n "$PKG_CONFIG"; then
|
||||
PKG_CHECK_EXISTS([$3],
|
||||
[pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
|
||||
test "x$?" != "x0" && pkg_failed=yes ],
|
||||
[pkg_failed=yes])
|
||||
else
|
||||
pkg_failed=untried
|
||||
fi[]dnl
|
||||
])dnl _PKG_CONFIG
|
||||
|
||||
dnl _PKG_SHORT_ERRORS_SUPPORTED
|
||||
dnl ---------------------------
|
||||
dnl Internal check to see if pkg-config supports short errors.
|
||||
AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
|
||||
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
|
||||
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
|
||||
_pkg_short_errors_supported=yes
|
||||
else
|
||||
_pkg_short_errors_supported=no
|
||||
fi[]dnl
|
||||
])dnl _PKG_SHORT_ERRORS_SUPPORTED
|
||||
|
||||
|
||||
dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
|
||||
dnl [ACTION-IF-NOT-FOUND])
|
||||
dnl --------------------------------------------------------------
|
||||
dnl Since: 0.4.0
|
||||
dnl
|
||||
dnl Note that if there is a possibility the first call to
|
||||
dnl PKG_CHECK_MODULES might not happen, you should be sure to include an
|
||||
dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
|
||||
AC_DEFUN([PKG_CHECK_MODULES],
|
||||
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
|
||||
AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
|
||||
AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
|
||||
|
||||
pkg_failed=no
|
||||
AC_MSG_CHECKING([for $1])
|
||||
|
||||
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
|
||||
_PKG_CONFIG([$1][_LIBS], [libs], [$2])
|
||||
|
||||
m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
|
||||
and $1[]_LIBS to avoid the need to call pkg-config.
|
||||
See the pkg-config man page for more details.])
|
||||
|
||||
if test $pkg_failed = yes; then
|
||||
AC_MSG_RESULT([no])
|
||||
_PKG_SHORT_ERRORS_SUPPORTED
|
||||
if test $_pkg_short_errors_supported = yes; then
|
||||
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
|
||||
else
|
||||
$1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
|
||||
fi
|
||||
# Put the nasty error message in config.log where it belongs
|
||||
echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
|
||||
|
||||
m4_default([$4], [AC_MSG_ERROR(
|
||||
[Package requirements ($2) were not met:
|
||||
|
||||
$$1_PKG_ERRORS
|
||||
|
||||
Consider adjusting the PKG_CONFIG_PATH environment variable if you
|
||||
installed software in a non-standard prefix.
|
||||
|
||||
_PKG_TEXT])[]dnl
|
||||
])
|
||||
elif test $pkg_failed = untried; then
|
||||
AC_MSG_RESULT([no])
|
||||
m4_default([$4], [AC_MSG_FAILURE(
|
||||
[The pkg-config script could not be found or is too old. Make sure it
|
||||
is in your PATH or set the PKG_CONFIG environment variable to the full
|
||||
path to pkg-config.
|
||||
|
||||
_PKG_TEXT
|
||||
|
||||
To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
|
||||
])
|
||||
else
|
||||
$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
|
||||
$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
|
||||
AC_MSG_RESULT([yes])
|
||||
$3
|
||||
fi[]dnl
|
||||
])dnl PKG_CHECK_MODULES
|
||||
|
||||
|
||||
dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
|
||||
dnl [ACTION-IF-NOT-FOUND])
|
||||
dnl ---------------------------------------------------------------------
|
||||
dnl Since: 0.29
|
||||
dnl
|
||||
dnl Checks for existence of MODULES and gathers its build flags with
|
||||
dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
|
||||
dnl and VARIABLE-PREFIX_LIBS from --libs.
|
||||
dnl
|
||||
dnl Note that if there is a possibility the first call to
|
||||
dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
|
||||
dnl include an explicit call to PKG_PROG_PKG_CONFIG in your
|
||||
dnl configure.ac.
|
||||
AC_DEFUN([PKG_CHECK_MODULES_STATIC],
|
||||
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
|
||||
_save_PKG_CONFIG=$PKG_CONFIG
|
||||
PKG_CONFIG="$PKG_CONFIG --static"
|
||||
PKG_CHECK_MODULES($@)
|
||||
PKG_CONFIG=$_save_PKG_CONFIG[]dnl
|
||||
])dnl PKG_CHECK_MODULES_STATIC
|
||||
|
||||
|
||||
dnl PKG_INSTALLDIR([DIRECTORY])
|
||||
dnl -------------------------
|
||||
dnl Since: 0.27
|
||||
dnl
|
||||
dnl Substitutes the variable pkgconfigdir as the location where a module
|
||||
dnl should install pkg-config .pc files. By default the directory is
|
||||
dnl $libdir/pkgconfig, but the default can be changed by passing
|
||||
dnl DIRECTORY. The user can override through the --with-pkgconfigdir
|
||||
dnl parameter.
|
||||
AC_DEFUN([PKG_INSTALLDIR],
|
||||
[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
|
||||
m4_pushdef([pkg_description],
|
||||
[pkg-config installation directory @<:@]pkg_default[@:>@])
|
||||
AC_ARG_WITH([pkgconfigdir],
|
||||
[AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
|
||||
[with_pkgconfigdir=]pkg_default)
|
||||
AC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
|
||||
m4_popdef([pkg_default])
|
||||
m4_popdef([pkg_description])
|
||||
])dnl PKG_INSTALLDIR
|
||||
|
||||
|
||||
dnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
|
||||
dnl --------------------------------
|
||||
dnl Since: 0.27
|
||||
dnl
|
||||
dnl Substitutes the variable noarch_pkgconfigdir as the location where a
|
||||
dnl module should install arch-independent pkg-config .pc files. By
|
||||
dnl default the directory is $datadir/pkgconfig, but the default can be
|
||||
dnl changed by passing DIRECTORY. The user can override through the
|
||||
dnl --with-noarch-pkgconfigdir parameter.
|
||||
AC_DEFUN([PKG_NOARCH_INSTALLDIR],
|
||||
[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
|
||||
m4_pushdef([pkg_description],
|
||||
[pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
|
||||
AC_ARG_WITH([noarch-pkgconfigdir],
|
||||
[AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
|
||||
[with_noarch_pkgconfigdir=]pkg_default)
|
||||
AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
|
||||
m4_popdef([pkg_default])
|
||||
m4_popdef([pkg_description])
|
||||
])dnl PKG_NOARCH_INSTALLDIR
|
||||
|
||||
|
||||
dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
|
||||
dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
|
||||
dnl -------------------------------------------
|
||||
dnl Since: 0.28
|
||||
dnl
|
||||
dnl Retrieves the value of the pkg-config variable for the given module.
|
||||
AC_DEFUN([PKG_CHECK_VAR],
|
||||
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
|
||||
AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
|
||||
|
||||
_PKG_CONFIG([$1], [variable="][$3]["], [$2])
|
||||
AS_VAR_COPY([$1], [pkg_cv_][$1])
|
||||
|
||||
AS_VAR_IF([$1], [""], [$5], [$4])dnl
|
||||
])dnl PKG_CHECK_VAR
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue