Adding upstream version 1.0.2.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-04-22 17:57:53 +02:00
parent a04160a00d
commit 36fe29e3d5
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
464 changed files with 372850 additions and 0 deletions

6
.clang-format Normal file
View file

@ -0,0 +1,6 @@
BasedOnStyle: webkit
IndentWidth: 4
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: true
AlignOperands: true
SortIncludes: false

23
.copr/Makefile Normal file
View file

@ -0,0 +1,23 @@
top=..
all: srpm
prereq: $(top)/rpmbuild
rpm -q git rpm-build >/dev/null || dnf -y install git rpm-build
update-dist-tools: $(top)/dist-tools
( cd "$(top)/dist-tools" && git pull )
$(top)/dist-tools:
git clone https://github.com/jelu/dist-tools.git "$(top)/dist-tools"
$(top)/rpmbuild:
mkdir -p "$(top)"/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
srpm: prereq update-dist-tools
test -f .gitmodules && git submodule update --init || true
echo "$(spec)" | grep -q "develop.spec" && auto_build_number=`date --utc +%s` message="Auto build `date --utc --iso-8601=seconds`" "$(top)/dist-tools/spec-new-changelog-entry" || true
overwrite=yes nosign=yes "$(top)/dist-tools/create-source-packages" rpm
cp ../*.orig.tar.gz "$(top)/rpmbuild/SOURCES/"
echo "$(spec)" | grep -q "develop.spec" && rpmbuild -bs --define "%_topdir $(top)/rpmbuild" --undefine=dist rpm/*.spec || rpmbuild -bs --define "%_topdir $(top)/rpmbuild" --undefine=dist "$(spec)"
cp "$(top)"/rpmbuild/SRPMS/*.src.rpm "$(outdir)"

1
.github/FUNDING.yml vendored Normal file
View file

@ -0,0 +1 @@
custom: https://www.dns-oarc.net/donate

93
.gitignore vendored Normal file
View file

@ -0,0 +1,93 @@
# Prerequisites
*.d
# Object files
*.o
*.ko
*.obj
*.elf
# Linker output
*.ilk
*.map
*.exp
# Precompiled Headers
*.gch
*.pch
# Libraries
*.lib
*.a
*.la
*.lo
# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib
# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex
# Debug files
*.dSYM/
*.su
*.idb
*.pdb
# Kernel Module Compile Results
*.mod*
*.cmd
.tmp_versions/
modules.order
Module.symvers
Mkfile.old
dkms.conf
# Automake
Makefile.in
aclocal.m4
ar-lib
autom4te.cache
compile
config.guess
config.sub
configure
depcomp
install-sh
ltmain.sh
m4/libtool.m4
m4/ltoptions.m4
m4/ltsugar.m4
m4/ltversion.m4
m4/lt~obsolete.m4
missing
config.h.in
config.h.in~
test-driver
# Configure
Makefile
config.log
config.status
libtool
.deps
src/config.h
src/stamp-h1
build
.dirstamp
# Project specific files
src/dnsmeter
src/dnsmeter.1
src/test/test-suite.log
src/test/test*.sh.log
src/test/test*.sh.trs
src/test/*.dist

3
.gitmodules vendored Normal file
View file

@ -0,0 +1,3 @@
[submodule "src/pplib"]
path = src/pplib
url = https://github.com/DNS-OARC/pplib.git

23
.lgtm.yml Normal file
View file

@ -0,0 +1,23 @@
path_classifiers:
library:
- "src/pplib/*"
extraction:
cpp:
prepare:
packages:
- build-essential
- automake
- autoconf
- libtool
- pkg-config
- libbind-dev
- libssl-dev
- libbz2-dev
- libidn2-dev
- zlib1g-dev
- libpcap-dev
- libpcre3-dev
configure:
command:
- ./autogen.sh
- ./configure

26
.travis.yml Normal file
View file

@ -0,0 +1,26 @@
dist: bionic
addons:
apt:
update: true
packages:
- libbind-dev
- libssl-dev
- libbz2-dev
- libidn2-dev
- zlib1g-dev
- libpcap-dev
- libpcre3-dev
language: cpp
compiler:
- gcc
install: ./autogen.sh
script:
- ./configure --enable-warn-all
- make dist
- tar zxvf *.tar.gz
- cd dnsmeter-*[0-9]
- mkdir build
- cd build
- ../configure --enable-warn-all
- make
- make test

42
CHANGES Normal file
View file

@ -0,0 +1,42 @@
2021-06-02 Jerry Lundström
Release 1.0.2
This release fixes an issue with source port being static when only
using `-q` to generate traffic from one host/IP. The source port is
now randomized for every DNS query.
Other changes is mainly about build system, packages and fixed issues
detected by code analysis tools.
05000cc Typo, random source port
6a71707 Coverage
1c724ce SonarCloud
0776d20 Badges
c274884 LGTM
5a12c61 COPR
f77efed Build dependency
a359b66 iconv
2019-10-07 Jerry Lundström
Release 1.0.1
This release fixes a few minor bugs and a dependency issue which made
`dnsmeter` throw an exception when using the `-r` option.
Bugfixes:
- Use existing `rtt_avg`, was showing total RTT divided by number of threads
- Fix an issue which missed the first 8 bytes of a text payload
72197b5 PCAP detect
665be2d RTT average
3fe7b66 pplib dependencies, RTT average
e565d42 Funding
1a1ea40 README
2019-09-23 Jerry Lundström
Release 1.0.0
Initial release after project was moved from DENIC to DNS-OARC.

674
LICENSE Normal file
View file

@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If 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 convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 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 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/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.

32
Makefile.am Normal file
View file

@ -0,0 +1,32 @@
# Copyright (c) 2019-2021, OARC, Inc.
# Copyright (c) 2019, DENIC eG
# All rights reserved.
#
# This file is part of dnsmeter.
#
# dnsmeter 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.
#
# dnsmeter 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 dnsmeter. If not, see <http://www.gnu.org/licenses/>.
ACLOCAL_AMFLAGS = -I m4
MAINTAINERCLEANFILES = $(srcdir)/Makefile.in \
$(srcdir)/src/config.h.in~ \
$(srcdir)/configure
SUBDIRS = src
dist_doc_DATA = CHANGES README.md LICENSE
EXTRA_DIST = m4
test: check

158
README.md Normal file
View file

@ -0,0 +1,158 @@
# dnsmeter
[![Build Status](https://travis-ci.com/DNS-OARC/dnsmeter.svg?branch=develop)](https://travis-ci.com/DNS-OARC/dnsmeter) [![Total alerts](https://img.shields.io/lgtm/alerts/g/DNS-OARC/dnsmeter.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/DNS-OARC/dnsmeter/alerts/) [![Bugs](https://sonarcloud.io/api/project_badges/measure?project=dns-oarc%3Adnsmeter&metric=bugs)](https://sonarcloud.io/dashboard?id=dns-oarc%3Adnsmeter) [![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=dns-oarc%3Adnsmeter&metric=security_rating)](https://sonarcloud.io/dashboard?id=dns-oarc%3Adnsmeter)
`dnsmeter` is a tool for testing performance of a nameserver and the
infrastructure around it. It generates DNS queries and sends them via UDP
to a target nameserver and counts the answers.
Features:
- payload can be given as a text file or a PCAP file
- can automatically run different load steps, which can be given as a list or ranges
- results per load step can be stored in a CSV file
- sender addresses can be spoofed from a given network or from the addresses found in the PCAP file
- answers are counted, even if source address is spoofed, if answers get routed back to the load generator
- round-trip-times are measured (average, min, mix)
- the amount of DNSSEC queries can be given as percentage of total traffic
- optimized for high amount of packets, on an Intel(R) Xeon(R) CPU E5-2430 v2 @ 2.50GHz it can generate more than 900.000 packets per second
- runs on Linux and FreeBSD
## Dependencies
`dnsmeter` requires a couple of libraries beside a normal C++ compiling
environment with autoconf, automake and libtool.
`dnsmeter` has a non-optional dependency on the PCRE library, `libresolv`
and PCAP library.
`dnsmeter` also includes [pplib](https://github.com/DNS-OARC/pplib),
collection of C++ functions and classes, and it has non-optional dependency
on OpenSSL, bzip2, IDN2 (or IDN1) library and zlib.
To install the dependencies under Debian/Ubuntu:
```
apt-get install -y libssl-dev libbz2-dev libidn2-dev zlib1g-dev libpcap-dev libpcre3-dev gettext
```
NOTE: If your system does not have `libidn2-dev`, please use `libidn11-dev` instead.
To install the dependencies under CentOS (with EPEL enabled):
```
yum install -y openssl-devel bzip2-devel libidn2-devel zlib-devel libpcap-devel pcre-devel gettext-devel
```
NOTE: If your using openSUSE/SLE then bzip2's package is `libbz2-devel`.
To install the dependencies under FreeBSD 10+ using `pkg`:
```
pkg install -y openssl libidn2 libpcap pcre gettext
```
## Building from source tarball
The [source tarball from DNS-OARC](https://www.dns-oarc.net/tools/dnsmeter)
comes prepared with `configure`:
```
tar zxvf dnsmeter-version.tar.gz
cd dnsmeter-version
./configure [options]
make
make install
```
NOTE: If building fails on FreeBSD, try adding these configure
options: `--with-extra-cflags="-I /usr/local/include" --with-extra-ldflags="-L/usr/local/lib"`.
## Building from Git repository
If you are building `dnsmeter` from it's Git repository you will first need
to initiate the Git submodules that exists and later create autoconf/automake
files, this will require a build environment with autoconf, automake and
libtool to be installed.
```
git clone https://github.com/DNS-OARC/dnsmeter.git
cd dnsmeter
git submodule update --init
./autogen.sh
./configure [options]
make
make install
```
## Usage
Once installed please see `man dnsmeter` for usage.
## Example
Lets assume the following scenario:
- load generator runs on FreeBSD
- network interface an which the traffic goes out and comes back is `igb0`
- source IP on the load generator is 192.168.155.20
- target nameserver has IP 192.168.0.1, port 53
- we want to spoof the sender address from the network 10.0.0.0/8
- the payload file is found here: `/home/testdata/payload.txt`
- the nameserver is running on CentOS and we need to set a route back to the load generator: `ip route add 10.0.0.0/8 via 192.168.155.20`
- we want to test the following load steps: 30000,40000,45000,50000,100000,150000
- results should be written to `results.csv`
- DNSSEC rate should be 70%
This makes the following command:
```
dnsmeter -p /home/testdata/payload.txt \
-r 30000,40000,45000,50000,100000,150000 \
-s 10.0.0.0/8 \
-z 192.168.0.1:53 \
-e igb0 \
-d 70 \
-c results.csv
```
In the second example, we want to use a PCAP file as payload and want
to spoof with the addresses from that file:
```
dnsmeter -p /home/testdata/pcap.file1 \
-r 30000,40000,45000,50000,100000,150000 \
-s pcap \
-z 192.168.0.1:53 \
-e igb0 \
-c results_pcap.csv
```
## Author(s)
- Patrick Fedick [@pfedick](https://github.com/pfedick)
## Contributor(s)
- Jerry Lundström [@jelu](https://github.com/jelu)
## Copyright
Copyright (c) 2019-2021, OARC, Inc.
Copyright (c) 2019, DENIC eG
All rights reserved.
```
This file is part of dnsmeter.
dnsmeter 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.
dnsmeter 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 dnsmeter. If not, see <http://www.gnu.org/licenses/>.
```

21
autogen.sh Executable file
View file

@ -0,0 +1,21 @@
#!/bin/sh -e
# Copyright (c) 2019-2021, OARC, Inc.
# Copyright (c) 2019, DENIC eG
# All rights reserved.
#
# This file is part of dnsmeter.
#
# dnsmeter 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.
#
# dnsmeter 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 dnsmeter. If not, see <http://www.gnu.org/licenses/>.
autoreconf --force --install --no-recursive --include=m4

1
config.rpath Symbolic link
View file

@ -0,0 +1 @@
src/pplib/autoconf/config.rpath

91
configure.ac Normal file
View file

@ -0,0 +1,91 @@
# Copyright (c) 2019-2021, OARC, Inc.
# Copyright (c) 2019, DENIC eG
# All rights reserved.
#
# This file is part of dnsmeter.
#
# dnsmeter 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.
#
# dnsmeter 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 dnsmeter. If not, see <http://www.gnu.org/licenses/>.
AC_PREREQ(2.69)
AC_INIT([dnsmeter], [1.0.2], [admin@dns-oarc.net], [dnsmeter], [https://github.com/DNS-OARC/dnsmeter/issues])
AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects])
AC_CONFIG_SRCDIR([src/main.cpp])
AC_CONFIG_HEADER([src/config.h])
AC_CONFIG_MACRO_DIR([m4])
# Checks for programs.
AC_PROG_CXX
AC_CANONICAL_HOST
LT_INIT([disable-static])
# Check --enable-warn-all
AC_ARG_ENABLE([warn-all], [AS_HELP_STRING([--enable-warn-all], [Enable all compiler warnings])], [AX_CFLAGS_WARN_ALL()])
# Check --with-extra-cflags
AC_ARG_WITH([extra-cflags], [AS_HELP_STRING([--with-extra-cflags=CFLAGS], [Add extra CFLAGS/CXXFLAGS])], [
AC_MSG_NOTICE([appending extra CFLAGS/CXXFLAGS... $withval])
AS_VAR_APPEND(CFLAGS, [" $withval"])
AS_VAR_APPEND(CXXFLAGS, [" $withval"])
])
# Check --with-extra-ldflags
AC_ARG_WITH([extra-ldflags], [AS_HELP_STRING([--with-extra-ldflags=LDFLAGS], [Add extra LDFLAGS])], [
AC_MSG_NOTICE([appending extra LDFLAGS... $withval])
AS_VAR_APPEND(LDFLAGS, [" $withval"])
])
# Check --enable-gcov
AC_ARG_ENABLE([gcov], [AS_HELP_STRING([--enable-gcov], [Enable coverage testing])], [
coverage_cxxflags="--coverage -g -O0 -fno-inline -fno-inline-small-functions -fno-default-inline"
AC_MSG_NOTICE([enabling coverage testing... $coverage_cxxflags])
AS_VAR_APPEND(CXXFLAGS, [" $coverage_cxxflags"])
])
AM_CONDITIONAL([ENABLE_GCOV], [test "x$enable_gcov" != "xno"])
AM_EXTRA_RECURSIVE_TARGETS([gcov])
# Checks for support.
AX_PTHREAD
AC_CHECK_LIB([pcap], [pcap_open_live], [], [AC_MSG_ERROR([libpcap not found])])
AC_CHECK_LIB([m], [sqrt])
AC_CHECK_LIB([bind], [ns_initparse], [], [AC_CHECK_LIB([bind], [__ns_initparse])])
AC_CHECK_LIB([resolv], [res_mkquery], [], [
AC_CHECK_LIB([resolv], [__res_mkquery], [], [
AC_CHECK_LIB([resolv], [res_9_mkquery])
])
])
AC_CHECK_LIB([idn], [idna_to_ascii_4z])
AC_CHECK_LIB([idn2], [idn2_to_ascii_4z])
AC_CHECK_LIB([pcre], [pcre_exec])
sinclude(src/pplib/autoconf/iconv.m4)
# Check for OS specific libraries
case "$host_os" in
freebsd*)
AC_CHECK_LIB([kvm], [kvm_open])
AM_ICONV
ICONV_CFLAGS="$INCICONV"
ICONV_LIBS="$LIBICONV"
AC_SUBST(ICONV_CFLAGS)
AC_SUBST(ICONV_LIBS)
;;
esac
# Output Makefiles
AC_CONFIG_FILES([
Makefile
src/Makefile
src/test/Makefile
])
AC_OUTPUT

7
fmt.sh Executable file
View file

@ -0,0 +1,7 @@
#!/bin/sh
clang-format-4.0 \
-style=file \
-i \
src/*.cpp \
src/*.h

50
m4/ax_append_flag.m4 Normal file
View file

@ -0,0 +1,50 @@
# ===========================================================================
# https://www.gnu.org/software/autoconf-archive/ax_append_flag.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_APPEND_FLAG(FLAG, [FLAGS-VARIABLE])
#
# DESCRIPTION
#
# FLAG is appended to the FLAGS-VARIABLE shell variable, with a space
# added in between.
#
# If FLAGS-VARIABLE is not specified, the current language's flags (e.g.
# CFLAGS) is used. FLAGS-VARIABLE is not changed if it already contains
# FLAG. If FLAGS-VARIABLE is unset in the shell, it is set to exactly
# FLAG.
#
# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION.
#
# LICENSE
#
# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
# Copyright (c) 2011 Maarten Bosmans <mkbosmans@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 8
AC_DEFUN([AX_APPEND_FLAG],
[dnl
AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_SET_IF
AS_VAR_PUSHDEF([FLAGS], [m4_default($2,_AC_LANG_PREFIX[FLAGS])])
AS_VAR_SET_IF(FLAGS,[
AS_CASE([" AS_VAR_GET(FLAGS) "],
[*" $1 "*], [AC_RUN_LOG([: FLAGS already contains $1])],
[
AS_VAR_APPEND(FLAGS,[" $1"])
AC_RUN_LOG([: FLAGS="$FLAGS"])
])
],
[
AS_VAR_SET(FLAGS,[$1])
AC_RUN_LOG([: FLAGS="$FLAGS"])
])
AS_VAR_POPDEF([FLAGS])dnl
])dnl AX_APPEND_FLAG

158
m4/ax_cflags_warn_all.m4 Normal file
View file

@ -0,0 +1,158 @@
# ===========================================================================
# https://www.gnu.org/software/autoconf-archive/ax_cflags_warn_all.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_CFLAGS_WARN_ALL [(shellvar[, default[, action-if-found[, action-if-not-found]]])]
# AX_CXXFLAGS_WARN_ALL [(shellvar[, default[, action-if-found[, action-if-not-found]]])]
# AX_FCFLAGS_WARN_ALL [(shellvar[, default[, action-if-found[, action-if-not-found]]])]
#
# DESCRIPTION
#
# Specify compiler options that enable most reasonable warnings. For the
# GNU Compiler Collection (GCC), for example, it will be "-Wall". The
# result is added to shellvar, one of CFLAGS, CXXFLAGS or FCFLAGS if the
# first parameter is not specified.
#
# Each of these macros accepts the following optional arguments:
#
# - $1 - shellvar
# shell variable to use (CFLAGS, CXXFLAGS or FCFLAGS if not
# specified, depending on macro)
#
# - $2 - default
# value to use for flags if compiler vendor cannot be determined (by
# default, "")
#
# - $3 - action-if-found
# action to take if the compiler vendor has been successfully
# determined (by default, add the appropriate compiler flags to
# shellvar)
#
# - $4 - action-if-not-found
# action to take if the compiler vendor has not been determined or
# is unknown (by default, add the default flags, or "" if not
# specified, to shellvar)
#
# These macros use AX_COMPILER_VENDOR to determine which flags should be
# returned for a given compiler. Not all compilers currently have flags
# defined for them; patches are welcome. If need be, compiler flags may
# be made language-dependent: use a construct like the following:
#
# [vendor_name], [m4_if(_AC_LANG_PREFIX,[C], VAR="--relevant-c-flags",dnl
# m4_if(_AC_LANG_PREFIX,[CXX], VAR="--relevant-c++-flags",dnl
# m4_if(_AC_LANG_PREFIX,[FC], VAR="--relevant-fortran-flags",dnl
# VAR="$2"; FOUND="no")))],
#
# Note: These macros also depend on AX_PREPEND_FLAG.
#
# LICENSE
#
# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
# Copyright (c) 2010 Rhys Ulerich <rhys.ulerich@gmail.com>
# Copyright (c) 2018 John Zaitseff <J.Zaitseff@zap.org.au>
#
# 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 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 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, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
# scripts that are the output of Autoconf when processing the Macro. You
# need not follow the terms of the GNU General Public License when using
# or distributing such scripts, even though portions of the text of the
# Macro appear in them. The GNU General Public License (GPL) does govern
# all other use of the material that constitutes the Autoconf Macro.
#
# This special exception to the GPL applies to versions of the Autoconf
# Macro released by the Autoconf Archive. When you make and distribute a
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
#serial 25
AC_DEFUN([AX_FLAGS_WARN_ALL], [
AX_REQUIRE_DEFINED([AX_PREPEND_FLAG])dnl
AC_REQUIRE([AX_COMPILER_VENDOR])dnl
AS_VAR_PUSHDEF([FLAGS], [m4_default($1,_AC_LANG_PREFIX[]FLAGS)])dnl
AS_VAR_PUSHDEF([VAR], [ac_cv_[]_AC_LANG_ABBREV[]flags_warn_all])dnl
AS_VAR_PUSHDEF([FOUND], [ac_save_[]_AC_LANG_ABBREV[]flags_warn_all_found])dnl
AC_CACHE_CHECK([FLAGS for most reasonable warnings], VAR, [
VAR=""
FOUND="yes"
dnl Cases are listed in the order found in ax_compiler_vendor.m4
AS_CASE("$ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor",
[intel], [VAR="-w2"],
[ibm], [VAR="-qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd"],
[pathscale], [],
[clang], [VAR="-Wall"],
[cray], [VAR="-h msglevel 2"],
[fujitsu], [],
[sdcc], [],
[sx], [VAR="-pvctl[,]fullmsg"],
[portland], [],
[gnu], [VAR="-Wall"],
[sun], [VAR="-v"],
[hp], [VAR="+w1"],
[dec], [VAR="-verbose -w0 -warnprotos"],
[borland], [],
[comeau], [],
[kai], [],
[lcc], [],
[sgi], [VAR="-fullwarn"],
[microsoft], [],
[metrowerks], [],
[watcom], [],
[tcc], [],
[unknown], [
VAR="$2"
FOUND="no"
],
[
AC_MSG_WARN([Unknown compiler vendor returned by [AX_COMPILER_VENDOR]])
VAR="$2"
FOUND="no"
]
)
AS_IF([test "x$FOUND" = "xyes"], [dnl
m4_default($3, [AS_IF([test "x$VAR" != "x"], [AX_PREPEND_FLAG([$VAR], [FLAGS])])])
], [dnl
m4_default($4, [m4_ifval($2, [AX_PREPEND_FLAG([$VAR], [FLAGS])], [true])])
])dnl
])dnl
AS_VAR_POPDEF([FOUND])dnl
AS_VAR_POPDEF([VAR])dnl
AS_VAR_POPDEF([FLAGS])dnl
])dnl AX_FLAGS_WARN_ALL
AC_DEFUN([AX_CFLAGS_WARN_ALL], [dnl
AC_LANG_PUSH([C])
AX_FLAGS_WARN_ALL([$1], [$2], [$3], [$4])
AC_LANG_POP([C])
])dnl
AC_DEFUN([AX_CXXFLAGS_WARN_ALL], [dnl
AC_LANG_PUSH([C++])
AX_FLAGS_WARN_ALL([$1], [$2], [$3], [$4])
AC_LANG_POP([C++])
])dnl
AC_DEFUN([AX_FCFLAGS_WARN_ALL], [dnl
AC_LANG_PUSH([Fortran])
AX_FLAGS_WARN_ALL([$1], [$2], [$3], [$4])
AC_LANG_POP([Fortran])
])dnl

117
m4/ax_compiler_vendor.m4 Normal file
View file

@ -0,0 +1,117 @@
# ===========================================================================
# https://www.gnu.org/software/autoconf-archive/ax_compiler_vendor.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_COMPILER_VENDOR
#
# DESCRIPTION
#
# Determine the vendor of the C, C++ or Fortran compiler. The vendor is
# returned in the cache variable $ax_cv_c_compiler_vendor for C,
# $ax_cv_cxx_compiler_vendor for C++ or $ax_cv_fc_compiler_vendor for
# (modern) Fortran. The value is one of "intel", "ibm", "pathscale",
# "clang" (LLVM), "cray", "fujitsu", "sdcc", "sx", "portland" (PGI), "gnu"
# (GCC), "sun" (Oracle Developer Studio), "hp", "dec", "borland",
# "comeau", "kai", "lcc", "sgi", "microsoft", "metrowerks", "watcom",
# "tcc" (Tiny CC) or "unknown" (if the compiler cannot be determined).
#
# To check for a Fortran compiler, you must first call AC_FC_PP_SRCEXT
# with an appropriate preprocessor-enabled extension. For example:
#
# AC_LANG_PUSH([Fortran])
# AC_PROG_FC
# AC_FC_PP_SRCEXT([F])
# AX_COMPILER_VENDOR
# AC_LANG_POP([Fortran])
#
# LICENSE
#
# Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
# Copyright (c) 2008 Matteo Frigo
# Copyright (c) 2018-19 John Zaitseff <J.Zaitseff@zap.org.au>
#
# 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 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 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, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
# scripts that are the output of Autoconf when processing the Macro. You
# need not follow the terms of the GNU General Public License when using
# or distributing such scripts, even though portions of the text of the
# Macro appear in them. The GNU General Public License (GPL) does govern
# all other use of the material that constitutes the Autoconf Macro.
#
# This special exception to the GPL applies to versions of the Autoconf
# Macro released by the Autoconf Archive. When you make and distribute a
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
#serial 30
AC_DEFUN([AX_COMPILER_VENDOR], [dnl
AC_CACHE_CHECK([for _AC_LANG compiler vendor], ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor, [dnl
dnl If you modify this list of vendors, please add similar support
dnl to ax_compiler_version.m4 if at all possible.
dnl
dnl Note: Do NOT check for GCC first since some other compilers
dnl define __GNUC__ to remain compatible with it. Compilers that
dnl are very slow to start (such as Intel) are listed first.
vendors="
intel: __ICC,__ECC,__INTEL_COMPILER
ibm: __xlc__,__xlC__,__IBMC__,__IBMCPP__,__ibmxl__
pathscale: __PATHCC__,__PATHSCALE__
clang: __clang__
cray: _CRAYC
fujitsu: __FUJITSU
sdcc: SDCC,__SDCC
sx: _SX
portland: __PGI
gnu: __GNUC__
sun: __SUNPRO_C,__SUNPRO_CC,__SUNPRO_F90,__SUNPRO_F95
hp: __HP_cc,__HP_aCC
dec: __DECC,__DECCXX,__DECC_VER,__DECCXX_VER
borland: __BORLANDC__,__CODEGEARC__,__TURBOC__
comeau: __COMO__
kai: __KCC
lcc: __LCC__
sgi: __sgi,sgi
microsoft: _MSC_VER
metrowerks: __MWERKS__
watcom: __WATCOMC__
tcc: __TINYC__
unknown: UNKNOWN
"
for ventest in $vendors; do
case $ventest in
*:)
vendor=$ventest
continue
;;
*)
vencpp="defined("`echo $ventest | sed 's/,/) || defined(/g'`")"
;;
esac
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
#if !($vencpp)
thisisanerror;
#endif
]])], [break])
done
ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor=`echo $vendor | cut -d: -f1`
])
])dnl

51
m4/ax_prepend_flag.m4 Normal file
View file

@ -0,0 +1,51 @@
# ===========================================================================
# https://www.gnu.org/software/autoconf-archive/ax_prepend_flag.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_PREPEND_FLAG(FLAG, [FLAGS-VARIABLE])
#
# DESCRIPTION
#
# FLAG is added to the front of the FLAGS-VARIABLE shell variable, with a
# space added in between.
#
# If FLAGS-VARIABLE is not specified, the current language's flags (e.g.
# CFLAGS) is used. FLAGS-VARIABLE is not changed if it already contains
# FLAG. If FLAGS-VARIABLE is unset in the shell, it is set to exactly
# FLAG.
#
# NOTE: Implementation based on AX_APPEND_FLAG.
#
# LICENSE
#
# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
# Copyright (c) 2018 John Zaitseff <J.Zaitseff@zap.org.au>
#
# 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 2
AC_DEFUN([AX_PREPEND_FLAG],
[dnl
AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_SET_IF
AS_VAR_PUSHDEF([FLAGS], [m4_default($2,_AC_LANG_PREFIX[FLAGS])])
AS_VAR_SET_IF(FLAGS,[
AS_CASE([" AS_VAR_GET(FLAGS) "],
[*" $1 "*], [AC_RUN_LOG([: FLAGS already contains $1])],
[
FLAGS="$1 $FLAGS"
AC_RUN_LOG([: FLAGS="$FLAGS"])
])
],
[
AS_VAR_SET(FLAGS,[$1])
AC_RUN_LOG([: FLAGS="$FLAGS"])
])
AS_VAR_POPDEF([FLAGS])dnl
])dnl AX_PREPEND_FLAG

486
m4/ax_pthread.m4 Normal file
View file

@ -0,0 +1,486 @@
# ===========================================================================
# https://www.gnu.org/software/autoconf-archive/ax_pthread.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
#
# DESCRIPTION
#
# This macro figures out how to build C programs using POSIX threads. It
# sets the PTHREAD_LIBS output variable to the threads library and linker
# flags, and the PTHREAD_CFLAGS output variable to any special C compiler
# flags that are needed. (The user can also force certain compiler
# flags/libs to be tested by setting these environment variables.)
#
# Also sets PTHREAD_CC to any special C compiler that is needed for
# multi-threaded programs (defaults to the value of CC otherwise). (This
# is necessary on AIX to use the special cc_r compiler alias.)
#
# NOTE: You are assumed to not only compile your program with these flags,
# but also to link with them as well. For example, you might link with
# $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS
#
# If you are only building threaded programs, you may wish to use these
# variables in your default LIBS, CFLAGS, and CC:
#
# LIBS="$PTHREAD_LIBS $LIBS"
# CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
# CC="$PTHREAD_CC"
#
# In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant
# has a nonstandard name, this macro defines PTHREAD_CREATE_JOINABLE to
# that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
#
# Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the
# PTHREAD_PRIO_INHERIT symbol is defined when compiling with
# PTHREAD_CFLAGS.
#
# ACTION-IF-FOUND is a list of shell commands to run if a threads library
# is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it
# is not found. If ACTION-IF-FOUND is not specified, the default action
# will define HAVE_PTHREAD.
#
# Please let the authors know if this macro fails on any platform, or if
# you have any other suggestions or comments. This macro was based on work
# by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help
# from M. Frigo), as well as ac_pthread and hb_pthread macros posted by
# Alejandro Forero Cuervo to the autoconf macro repository. We are also
# grateful for the helpful feedback of numerous users.
#
# Updated for Autoconf 2.68 by Daniel Richard G.
#
# LICENSE
#
# Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
# Copyright (c) 2011 Daniel Richard G. <skunk@iSKUNK.ORG>
#
# 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 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 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, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
# scripts that are the output of Autoconf when processing the Macro. You
# need not follow the terms of the GNU General Public License when using
# or distributing such scripts, even though portions of the text of the
# Macro appear in them. The GNU General Public License (GPL) does govern
# all other use of the material that constitutes the Autoconf Macro.
#
# This special exception to the GPL applies to versions of the Autoconf
# Macro released by the Autoconf Archive. When you make and distribute a
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
#serial 25
AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD])
AC_DEFUN([AX_PTHREAD], [
AC_REQUIRE([AC_CANONICAL_HOST])
AC_REQUIRE([AC_PROG_CC])
AC_REQUIRE([AC_PROG_SED])
AC_LANG_PUSH([C])
ax_pthread_ok=no
# We used to check for pthread.h first, but this fails if pthread.h
# requires special compiler flags (e.g. on Tru64 or Sequent).
# It gets checked for in the link test anyway.
# First of all, check if the user has set any of the PTHREAD_LIBS,
# etcetera environment variables, and if threads linking works using
# them:
if test "x$PTHREAD_CFLAGS$PTHREAD_LIBS" != "x"; then
ax_pthread_save_CC="$CC"
ax_pthread_save_CFLAGS="$CFLAGS"
ax_pthread_save_LIBS="$LIBS"
AS_IF([test "x$PTHREAD_CC" != "x"], [CC="$PTHREAD_CC"])
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
LIBS="$PTHREAD_LIBS $LIBS"
AC_MSG_CHECKING([for pthread_join using $CC $PTHREAD_CFLAGS $PTHREAD_LIBS])
AC_LINK_IFELSE([AC_LANG_CALL([], [pthread_join])], [ax_pthread_ok=yes])
AC_MSG_RESULT([$ax_pthread_ok])
if test "x$ax_pthread_ok" = "xno"; then
PTHREAD_LIBS=""
PTHREAD_CFLAGS=""
fi
CC="$ax_pthread_save_CC"
CFLAGS="$ax_pthread_save_CFLAGS"
LIBS="$ax_pthread_save_LIBS"
fi
# We must check for the threads library under a number of different
# names; the ordering is very important because some systems
# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
# libraries is broken (non-POSIX).
# Create a list of thread flags to try. Items starting with a "-" are
# C compiler flags, and other items are library names, except for "none"
# which indicates that we try without any flags at all, and "pthread-config"
# which is a program returning the flags for the Pth emulation library.
ax_pthread_flags="pthreads none -Kthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
# The ordering *is* (sometimes) important. Some notes on the
# individual items follow:
# pthreads: AIX (must check this before -lpthread)
# none: in case threads are in libc; should be tried before -Kthread and
# other compiler flags to prevent continual compiler warnings
# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads), Tru64
# (Note: HP C rejects this with "bad form for `-t' option")
# -pthreads: Solaris/gcc (Note: HP C also rejects)
# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
# doesn't hurt to check since this sometimes defines pthreads and
# -D_REENTRANT too), HP C (must be checked before -lpthread, which
# is present but should not be used directly; and before -mthreads,
# because the compiler interprets this as "-mt" + "-hreads")
# -mthreads: Mingw32/gcc, Lynx/gcc
# pthread: Linux, etcetera
# --thread-safe: KAI C++
# pthread-config: use pthread-config program (for GNU Pth library)
case $host_os in
freebsd*)
# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
ax_pthread_flags="-kthread lthread $ax_pthread_flags"
;;
hpux*)
# From the cc(1) man page: "[-mt] Sets various -D flags to enable
# multi-threading and also sets -lpthread."
ax_pthread_flags="-mt -pthread pthread $ax_pthread_flags"
;;
openedition*)
# IBM z/OS requires a feature-test macro to be defined in order to
# enable POSIX threads at all, so give the user a hint if this is
# not set. (We don't define these ourselves, as they can affect
# other portions of the system API in unpredictable ways.)
AC_EGREP_CPP([AX_PTHREAD_ZOS_MISSING],
[
# if !defined(_OPEN_THREADS) && !defined(_UNIX03_THREADS)
AX_PTHREAD_ZOS_MISSING
# endif
],
[AC_MSG_WARN([IBM z/OS requires -D_OPEN_THREADS or -D_UNIX03_THREADS to enable pthreads support.])])
;;
solaris*)
# On Solaris (at least, for some versions), libc contains stubbed
# (non-functional) versions of the pthreads routines, so link-based
# tests will erroneously succeed. (N.B.: The stubs are missing
# pthread_cleanup_push, or rather a function called by this macro,
# so we could check for that, but who knows whether they'll stub
# that too in a future libc.) So we'll check first for the
# standard Solaris way of linking pthreads (-mt -lpthread).
ax_pthread_flags="-mt,pthread pthread $ax_pthread_flags"
;;
esac
# GCC generally uses -pthread, or -pthreads on some platforms (e.g. SPARC)
AS_IF([test "x$GCC" = "xyes"],
[ax_pthread_flags="-pthread -pthreads $ax_pthread_flags"])
# The presence of a feature test macro requesting re-entrant function
# definitions is, on some systems, a strong hint that pthreads support is
# correctly enabled
case $host_os in
darwin* | hpux* | linux* | osf* | solaris*)
ax_pthread_check_macro="_REENTRANT"
;;
aix*)
ax_pthread_check_macro="_THREAD_SAFE"
;;
*)
ax_pthread_check_macro="--"
;;
esac
AS_IF([test "x$ax_pthread_check_macro" = "x--"],
[ax_pthread_check_cond=0],
[ax_pthread_check_cond="!defined($ax_pthread_check_macro)"])
# Are we compiling with Clang?
AC_CACHE_CHECK([whether $CC is Clang],
[ax_cv_PTHREAD_CLANG],
[ax_cv_PTHREAD_CLANG=no
# Note that Autoconf sets GCC=yes for Clang as well as GCC
if test "x$GCC" = "xyes"; then
AC_EGREP_CPP([AX_PTHREAD_CC_IS_CLANG],
[/* Note: Clang 2.7 lacks __clang_[a-z]+__ */
# if defined(__clang__) && defined(__llvm__)
AX_PTHREAD_CC_IS_CLANG
# endif
],
[ax_cv_PTHREAD_CLANG=yes])
fi
])
ax_pthread_clang="$ax_cv_PTHREAD_CLANG"
ax_pthread_clang_warning=no
# Clang needs special handling, because older versions handle the -pthread
# option in a rather... idiosyncratic way
if test "x$ax_pthread_clang" = "xyes"; then
# Clang takes -pthread; it has never supported any other flag
# (Note 1: This will need to be revisited if a system that Clang
# supports has POSIX threads in a separate library. This tends not
# to be the way of modern systems, but it's conceivable.)
# (Note 2: On some systems, notably Darwin, -pthread is not needed
# to get POSIX threads support; the API is always present and
# active. We could reasonably leave PTHREAD_CFLAGS empty. But
# -pthread does define _REENTRANT, and while the Darwin headers
# ignore this macro, third-party headers might not.)
PTHREAD_CFLAGS="-pthread"
PTHREAD_LIBS=
ax_pthread_ok=yes
# However, older versions of Clang make a point of warning the user
# that, in an invocation where only linking and no compilation is
# taking place, the -pthread option has no effect ("argument unused
# during compilation"). They expect -pthread to be passed in only
# when source code is being compiled.
#
# Problem is, this is at odds with the way Automake and most other
# C build frameworks function, which is that the same flags used in
# compilation (CFLAGS) are also used in linking. Many systems
# supported by AX_PTHREAD require exactly this for POSIX threads
# support, and in fact it is often not straightforward to specify a
# flag that is used only in the compilation phase and not in
# linking. Such a scenario is extremely rare in practice.
#
# Even though use of the -pthread flag in linking would only print
# a warning, this can be a nuisance for well-run software projects
# that build with -Werror. So if the active version of Clang has
# this misfeature, we search for an option to squash it.
AC_CACHE_CHECK([whether Clang needs flag to prevent "argument unused" warning when linking with -pthread],
[ax_cv_PTHREAD_CLANG_NO_WARN_FLAG],
[ax_cv_PTHREAD_CLANG_NO_WARN_FLAG=unknown
# Create an alternate version of $ac_link that compiles and
# links in two steps (.c -> .o, .o -> exe) instead of one
# (.c -> exe), because the warning occurs only in the second
# step
ax_pthread_save_ac_link="$ac_link"
ax_pthread_sed='s/conftest\.\$ac_ext/conftest.$ac_objext/g'
ax_pthread_link_step=`$as_echo "$ac_link" | sed "$ax_pthread_sed"`
ax_pthread_2step_ac_link="($ac_compile) && (echo ==== >&5) && ($ax_pthread_link_step)"
ax_pthread_save_CFLAGS="$CFLAGS"
for ax_pthread_try in '' -Qunused-arguments -Wno-unused-command-line-argument unknown; do
AS_IF([test "x$ax_pthread_try" = "xunknown"], [break])
CFLAGS="-Werror -Wunknown-warning-option $ax_pthread_try -pthread $ax_pthread_save_CFLAGS"
ac_link="$ax_pthread_save_ac_link"
AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])],
[ac_link="$ax_pthread_2step_ac_link"
AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])],
[break])
])
done
ac_link="$ax_pthread_save_ac_link"
CFLAGS="$ax_pthread_save_CFLAGS"
AS_IF([test "x$ax_pthread_try" = "x"], [ax_pthread_try=no])
ax_cv_PTHREAD_CLANG_NO_WARN_FLAG="$ax_pthread_try"
])
case "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" in
no | unknown) ;;
*) PTHREAD_CFLAGS="$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG $PTHREAD_CFLAGS" ;;
esac
fi # $ax_pthread_clang = yes
if test "x$ax_pthread_ok" = "xno"; then
for ax_pthread_try_flag in $ax_pthread_flags; do
case $ax_pthread_try_flag in
none)
AC_MSG_CHECKING([whether pthreads work without any flags])
;;
-mt,pthread)
AC_MSG_CHECKING([whether pthreads work with -mt -lpthread])
PTHREAD_CFLAGS="-mt"
PTHREAD_LIBS="-lpthread"
;;
-*)
AC_MSG_CHECKING([whether pthreads work with $ax_pthread_try_flag])
PTHREAD_CFLAGS="$ax_pthread_try_flag"
;;
pthread-config)
AC_CHECK_PROG([ax_pthread_config], [pthread-config], [yes], [no])
AS_IF([test "x$ax_pthread_config" = "xno"], [continue])
PTHREAD_CFLAGS="`pthread-config --cflags`"
PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
;;
*)
AC_MSG_CHECKING([for the pthreads library -l$ax_pthread_try_flag])
PTHREAD_LIBS="-l$ax_pthread_try_flag"
;;
esac
ax_pthread_save_CFLAGS="$CFLAGS"
ax_pthread_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
LIBS="$PTHREAD_LIBS $LIBS"
# Check for various functions. We must include pthread.h,
# since some functions may be macros. (On the Sequent, we
# need a special flag -Kthread to make this header compile.)
# We check for pthread_join because it is in -lpthread on IRIX
# while pthread_create is in libc. We check for pthread_attr_init
# due to DEC craziness with -lpthreads. We check for
# pthread_cleanup_push because it is one of the few pthread
# functions on Solaris that doesn't have a non-functional libc stub.
# We try pthread_create on general principles.
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>
# if $ax_pthread_check_cond
# error "$ax_pthread_check_macro must be defined"
# endif
static void routine(void *a) { a = 0; }
static void *start_routine(void *a) { return a; }],
[pthread_t th; pthread_attr_t attr;
pthread_create(&th, 0, start_routine, 0);
pthread_join(th, 0);
pthread_attr_init(&attr);
pthread_cleanup_push(routine, 0);
pthread_cleanup_pop(0) /* ; */])],
[ax_pthread_ok=yes],
[])
CFLAGS="$ax_pthread_save_CFLAGS"
LIBS="$ax_pthread_save_LIBS"
AC_MSG_RESULT([$ax_pthread_ok])
AS_IF([test "x$ax_pthread_ok" = "xyes"], [break])
PTHREAD_LIBS=""
PTHREAD_CFLAGS=""
done
fi
# Various other checks:
if test "x$ax_pthread_ok" = "xyes"; then
ax_pthread_save_CFLAGS="$CFLAGS"
ax_pthread_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
LIBS="$PTHREAD_LIBS $LIBS"
# Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
AC_CACHE_CHECK([for joinable pthread attribute],
[ax_cv_PTHREAD_JOINABLE_ATTR],
[ax_cv_PTHREAD_JOINABLE_ATTR=unknown
for ax_pthread_attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
[int attr = $ax_pthread_attr; return attr /* ; */])],
[ax_cv_PTHREAD_JOINABLE_ATTR=$ax_pthread_attr; break],
[])
done
])
AS_IF([test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xunknown" && \
test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xPTHREAD_CREATE_JOINABLE" && \
test "x$ax_pthread_joinable_attr_defined" != "xyes"],
[AC_DEFINE_UNQUOTED([PTHREAD_CREATE_JOINABLE],
[$ax_cv_PTHREAD_JOINABLE_ATTR],
[Define to necessary symbol if this constant
uses a non-standard name on your system.])
ax_pthread_joinable_attr_defined=yes
])
AC_CACHE_CHECK([whether more special flags are required for pthreads],
[ax_cv_PTHREAD_SPECIAL_FLAGS],
[ax_cv_PTHREAD_SPECIAL_FLAGS=no
case $host_os in
solaris*)
ax_cv_PTHREAD_SPECIAL_FLAGS="-D_POSIX_PTHREAD_SEMANTICS"
;;
esac
])
AS_IF([test "x$ax_cv_PTHREAD_SPECIAL_FLAGS" != "xno" && \
test "x$ax_pthread_special_flags_added" != "xyes"],
[PTHREAD_CFLAGS="$ax_cv_PTHREAD_SPECIAL_FLAGS $PTHREAD_CFLAGS"
ax_pthread_special_flags_added=yes])
AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT],
[ax_cv_PTHREAD_PRIO_INHERIT],
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>]],
[[int i = PTHREAD_PRIO_INHERIT;
return i;]])],
[ax_cv_PTHREAD_PRIO_INHERIT=yes],
[ax_cv_PTHREAD_PRIO_INHERIT=no])
])
AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes" && \
test "x$ax_pthread_prio_inherit_defined" != "xyes"],
[AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], [1], [Have PTHREAD_PRIO_INHERIT.])
ax_pthread_prio_inherit_defined=yes
])
CFLAGS="$ax_pthread_save_CFLAGS"
LIBS="$ax_pthread_save_LIBS"
# More AIX lossage: compile with *_r variant
if test "x$GCC" != "xyes"; then
case $host_os in
aix*)
AS_CASE(["x/$CC"],
[x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6],
[#handle absolute path differently from PATH based program lookup
AS_CASE(["x$CC"],
[x/*],
[AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"])],
[AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC])])])
;;
esac
fi
fi
test -n "$PTHREAD_CC" || PTHREAD_CC="$CC"
AC_SUBST([PTHREAD_LIBS])
AC_SUBST([PTHREAD_CFLAGS])
AC_SUBST([PTHREAD_CC])
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
if test "x$ax_pthread_ok" = "xyes"; then
ifelse([$1],,[AC_DEFINE([HAVE_PTHREAD],[1],[Define if you have POSIX threads libraries and header files.])],[$1])
:
else
ax_pthread_ok=no
$2
fi
AC_LANG_POP
])dnl AX_PTHREAD

37
m4/ax_require_defined.m4 Normal file
View file

@ -0,0 +1,37 @@
# ===========================================================================
# https://www.gnu.org/software/autoconf-archive/ax_require_defined.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_REQUIRE_DEFINED(MACRO)
#
# DESCRIPTION
#
# AX_REQUIRE_DEFINED is a simple helper for making sure other macros have
# been defined and thus are available for use. This avoids random issues
# where a macro isn't expanded. Instead the configure script emits a
# non-fatal:
#
# ./configure: line 1673: AX_CFLAGS_WARN_ALL: command not found
#
# It's like AC_REQUIRE except it doesn't expand the required macro.
#
# Here's an example:
#
# AX_REQUIRE_DEFINED([AX_CHECK_LINK_FLAG])
#
# LICENSE
#
# Copyright (c) 2014 Mike Frysinger <vapier@gentoo.org>
#
# 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 2
AC_DEFUN([AX_REQUIRE_DEFINED], [dnl
m4_ifndef([$1], [m4_fatal([macro ]$1[ is not defined; is a m4 file missing?])])
])dnl AX_REQUIRE_DEFINED

27
m4/dl.sh Executable file
View file

@ -0,0 +1,27 @@
#!/bin/sh -e
# Copyright (c) 2019-2021, OARC, Inc.
# Copyright (c) 2019, DENIC eG
# All rights reserved.
#
# This file is part of dnsmeter.
#
# dnsmeter 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.
#
# dnsmeter 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 dnsmeter. If not, see <http://www.gnu.org/licenses/>.
m4_files="ax_append_flag.m4 ax_cflags_warn_all.m4 ax_compiler_vendor.m4 \
ax_prepend_flag.m4 ax_pthread.m4 ax_require_defined.m4"
for ax in $m4_files; do
rm -f "$ax"
wget -O "$ax" "http://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=blob_plain;f=m4/$ax"
done

115
rpm/dnsmeter.spec Normal file
View file

@ -0,0 +1,115 @@
Name: dnsmeter
Version: 1.0.2
Release: 1%{?dist}
Summary: DNS performance and infrastructure testing
Group: Productivity/Networking/DNS/Utilities
License: GPL-3.0
URL: https://www.dns-oarc.net/tools/dnsmeter
# Source needs to be generated by dist-tools/create-source-packages, see
# https://github.com/jelu/dist-tools
Source0: https://github.com/DNS-OARC/dnsmeter/archive/v%{version}.tar.gz?/%{name}_%{version}.orig.tar.gz
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: libtool
BuildRequires: gcc-c++
BuildRequires: bind-devel
BuildRequires: openssl-devel
%if 0%{?suse_version} || 0%{?sle_version}
BuildRequires: libbz2-devel
%else
BuildRequires: bzip2-devel
%endif
BuildRequires: libidn2-devel
BuildRequires: zlib-devel
BuildRequires: libpcap-devel
BuildRequires: pcre-devel
BuildRequires: gettext-devel
%description
DNSMeter is a tool for testing performance of nameserver and/or
infrastructure around it.
It generates dns queries and sends them via UDP to a target nameserver
and counts the answers.
Features:
- payload can be given as text file or pcap file
- can automatically run different load steps, which can be given as
list or ranges
- results per load step can be stored in CSV file
- sender address can be spoofed from a given network or from pcap file,
if payload is a pcap file
- answers are counted, even if source address is spoofed, if answers get
routed back to the load generator
- roundtrip-times are measured (average, min, mix)
- amount of DNSSEC queries can be given as percentage of total traffic
- optimized for high amount of packets. On an Intel(R) Xeon(R) CPU E5-2430
v2 @ 2.50GHz it can generate more than 900.000 packets per second
%prep
%setup -q -n %{name}_%{version}
%build
sh autogen.sh
%configure
make %{?_smp_mflags}
%check
#make test
true
%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root)
%{_bindir}/dnsmeter
%{_datadir}/doc/*
%{_mandir}/man1/*
%changelog
* Wed Jun 02 2021 Jerry Lundström <lundstrom.jerry@gmail.com> 1.0.2-1
- Release 1.0.2
* This release fixes an issue with source port being static when only
using `-q` to generate traffic from one host/IP. The source port is
now randomized for every DNS query.
* Other changes is mainly about build system, packages and fixed issues
detected by code analysis tools.
* Commits:
05000cc Typo, random source port
6a71707 Coverage
1c724ce SonarCloud
0776d20 Badges
c274884 LGTM
5a12c61 COPR
f77efed Build dependency
a359b66 iconv
* Mon Oct 07 2019 Jerry Lundström <lundstrom.jerry@gmail.com> 1.0.1-1
- Release 1.0.1
* This release fixes a few minor bugs and a dependency issue which made
`dnsmeter` throw an exception when using the `-r` option.
* Bugfixes:
- Use existing `rtt_avg`, was showing total RTT divided by number of threads
- Fix an issue which missed the first 8 bytes of a text payload
* Commits:
72197b5 PCAP detect
665be2d RTT average
3fe7b66 pplib dependencies, RTT average
e565d42 Funding
1a1ea40 README
* Mon Sep 23 2019 Jerry Lundström <lundstrom.jerry@gmail.com> 1.0.0-1
- Release 1.0.0
* Wed Sep 18 2019 Jerry Lundström <lundstrom.jerry@gmail.com> 0.9.0-1
- First package release

472
src/Makefile.am Normal file
View file

@ -0,0 +1,472 @@
# Copyright (c) 2019-2021, OARC, Inc.
# Copyright (c) 2019, DENIC eG
# All rights reserved.
#
# This file is part of dnsmeter.
#
# dnsmeter 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.
#
# dnsmeter 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 dnsmeter. If not, see <http://www.gnu.org/licenses/>.
MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
DISTCLEANFILES = $(srcdir)/pplib/include/ppl7-config.h \
$(srcdir)/pplib/release/libppl7.a
CLEANFILES = dnsmeter.1 *.gcda *.gcno *.gcov
SUBDIRS = test
AM_CXXFLAGS = -I$(srcdir) \
-I$(top_srcdir) \
-I$(srcdir)/pplib/include \
$(PTHREAD_CFLAGS) $(ICONV_CFLAGS)
bin_PROGRAMS = dnsmeter
dnsmeter_SOURCES = dns_receiver_thread.cpp dns_sender.cpp \
dns_sender_thread.cpp main.cpp packet.cpp payload_file.cpp query.cpp \
raw_socket_receiver.cpp raw_socket_sender.cpp system_stat.cpp
dist_dnsmeter_SOURCES = dns_receiver_thread.h dns_sender.h \
dns_sender_thread.h exceptions.h packet.h payload_file.h query.h \
raw_socket_receiver.h raw_socket_sender.h system_stat.h
dnsmeter_LDADD = $(PTHREAD_LIBS) $(ICONV_LIBS) \
$(srcdir)/pplib/release/libppl7.a
BUILT_SOURCES = pplib/include/ppl7-config.h
pplib/include/ppl7-config.h:
cd "$(srcdir)/pplib" && ./configure --disable-oggtest \
--disable-freetypetest --disable-sdltest --disable-sdlframework \
--without-jpeg --without-libjpegturbo --without-libpng \
--without-libmicrohttpd --without-libmcrypt-prefix \
--without-libtiff --without-libcurl --without-mpg123 \
--without-lame --without-ogg --without-libcdio --without-libiconv-prefix \
--without-imlib --without-mysql --without-postgresql \
--without-sqlite3 --without-libldn --without-nasm
$(srcdir)/pplib/release/libppl7.a: pplib/include/ppl7-config.h
cd "$(srcdir)/pplib" && make
man1_MANS = dnsmeter.1
dnsmeter.1: dnsmeter.1.in Makefile
sed -e 's,[@]PACKAGE_VERSION[@],$(PACKAGE_VERSION),g' \
-e 's,[@]PACKAGE_URL[@],$(PACKAGE_URL),g' \
-e 's,[@]PACKAGE_BUGREPORT[@],$(PACKAGE_BUGREPORT),g' \
< $(srcdir)/dnsmeter.1.in > dnsmeter.1
if ENABLE_GCOV
gcov-local:
for src in $(dnsmeter_SOURCES); do \
gcov -l -r -s "$(srcdir)" "$$src"; \
done
endif
EXTRA_DIST = dnsmeter.1.in \
pplib/Makefile.in \
pplib/src/types/ByteArrayPtr.cpp \
pplib/src/types/ByteArray.cpp \
pplib/src/types/Array.cpp \
pplib/src/types/Pointer.cpp \
pplib/src/types/WideString.cpp \
pplib/src/types/AssocArray.cpp \
pplib/src/types/String.cpp \
pplib/src/types/Variant.cpp \
pplib/src/types/DateTime.cpp \
pplib/src/math/crc32.cpp \
pplib/src/math/calc.cpp \
pplib/src/math/md5.cpp \
pplib/src/math/random.cpp \
pplib/src/database/MySQL.cpp \
pplib/src/database/ResultSet.cpp \
pplib/src/database/Database.cpp \
pplib/src/database/PostgreSQL.cpp \
pplib/src/database/DBPool.cpp \
pplib/src/database/DBPoolOfPools.cpp \
pplib/src/database/Sqlite3.cpp \
pplib/src/audio/AudioCD.cpp \
pplib/src/audio/AudioEncoder_MP3.cpp \
pplib/src/audio/AudioDecoder_Ogg.cpp \
pplib/src/audio/AudioInfo.cpp \
pplib/src/audio/Cddb.cpp \
pplib/src/audio/AudioDecoder_MP3.cpp \
pplib/src/audio/AudioDecoder_Aiff.cpp \
pplib/src/audio/AudioEncoder_Wave.cpp \
pplib/src/audio/Icecast.cpp \
pplib/src/audio/AudioEncoder_Ogg.cpp \
pplib/src/audio/ID3Tag.cpp \
pplib/src/audio/AudioDecoder_Wave.cpp \
pplib/src/audio/Mp3.cpp \
pplib/src/audio/AudioEncoder_Aiff.cpp \
pplib/src/toolkit/Divider.cpp \
pplib/src/toolkit/WindowManager.cpp \
pplib/src/toolkit/Window.cpp \
pplib/src/toolkit/LineInput.cpp \
pplib/src/toolkit/WindowManager_SDL2.cpp \
pplib/src/toolkit/Layout.cpp \
pplib/src/toolkit/Widget.cpp \
pplib/src/toolkit/Surface.cpp \
pplib/src/toolkit/Frame.cpp \
pplib/src/toolkit/Label.cpp \
pplib/src/toolkit/Button.cpp \
pplib/src/toolkit/Event.cpp \
pplib/src/asm/common.asm \
pplib/src/asm/colors.asm \
pplib/src/asm/pixel.asm \
pplib/src/asm/chromakey.asm \
pplib/src/asm/cpu.asm \
pplib/src/asm/blt_blend.asm \
pplib/src/asm/rect.asm \
pplib/src/asm/fonts.asm \
pplib/src/asm/blt.asm \
pplib/src/internet/WikiParser.cpp \
pplib/src/internet/Webserver.cpp \
pplib/src/internet/ipaddress.cpp \
pplib/src/internet/sockaddr.cpp \
pplib/src/internet/resolver.cpp \
pplib/src/internet/UDPSocket.cpp \
pplib/src/internet/ipnetwork.cpp \
pplib/src/internet/curl.cpp \
pplib/src/internet/SocketMessage.cpp \
pplib/src/internet/inet_functions.cpp \
pplib/src/internet/openssl.cpp \
pplib/src/internet/TCPSocket.cpp \
pplib/src/crypto/Digest.cpp \
pplib/src/crypto/Crypt.cpp \
pplib/src/crypto/MCrypt.cpp \
pplib/src/core/Signal.cpp \
pplib/src/core/Compat.cpp \
pplib/src/core/Mutex.cpp \
pplib/src/core/ThreadPool.cpp \
pplib/src/core/Functions.cpp \
pplib/src/core/MemoryGroup.cpp \
pplib/src/core/MemFile.cpp \
pplib/src/core/StringFunctions.cpp \
pplib/src/core/Dir.cpp \
pplib/src/core/File.cpp \
pplib/src/core/ConfigParser.cpp \
pplib/src/core/DirEntry.cpp \
pplib/src/core/Resourcen.cpp \
pplib/src/core/Exceptions.cpp \
pplib/src/core/FileObject.cpp \
pplib/src/core/PerlHelper.cpp \
pplib/src/core/Json.cpp \
pplib/src/core/Iconv.cpp \
pplib/src/core/AVLTree.cpp \
pplib/src/core/Logger.cpp \
pplib/src/core/Threads.cpp \
pplib/src/core/PythonHelper.cpp \
pplib/src/core/Compression.cpp \
pplib/src/core/Time.cpp \
pplib/src/core/cpu.cpp \
pplib/src/core/MemoryHeap.cpp \
pplib/src/core/PFPFile.cpp \
pplib/src/core/Resource.cpp \
pplib/src/core/GzFile.cpp \
pplib/src/grafix/Point.cpp \
pplib/src/grafix/ImageFilter_PPM.cpp \
pplib/src/grafix/Font5.cpp \
pplib/src/grafix/ImageFilter_JPEG.cpp \
pplib/src/grafix/Rect.cpp \
pplib/src/grafix/DrawableBlit.cpp \
pplib/src/grafix/Point3D.cpp \
pplib/src/grafix/RGBFormat.cpp \
pplib/src/grafix/ImageFilter_GIF.cpp \
pplib/src/grafix/Fonts.cpp \
pplib/src/grafix/ImageFilter_TGA.cpp \
pplib/src/grafix/ImageFilter_PNG.cpp \
pplib/src/grafix/FontFreeType.cpp \
pplib/src/grafix/Grafix.cpp \
pplib/src/grafix/Font6.cpp \
pplib/src/grafix/DrawablePixel.cpp \
pplib/src/grafix/ImageFilter_BMP.cpp \
pplib/src/grafix/Sprite.cpp \
pplib/src/grafix/ImageFilter_TIFF.cpp \
pplib/src/grafix/Size.cpp \
pplib/src/grafix/ImageList.cpp \
pplib/src/grafix/DrawableLines.cpp \
pplib/src/grafix/DrawableColor.cpp \
pplib/src/grafix/DrawableShapes.cpp \
pplib/src/grafix/Image.cpp \
pplib/src/grafix/ImageFilter.cpp \
pplib/src/grafix/ImageFilter_ImageMagick.cpp \
pplib/src/grafix/Font4.cpp \
pplib/src/grafix/Drawable.cpp \
pplib/src/grafix/Color.cpp \
pplib/genConfigure \
pplib/genMakefile.in \
pplib/aclocal.m4 \
pplib/conf.sh \
pplib/include/crypto.h \
pplib/include/ppl7-ppl6compat.h \
pplib/include/ppl7.h \
pplib/include/ppl7-tk.h \
pplib/include/ppl7-visualc-config.h \
pplib/include/ppl7-config.h.in \
pplib/include/config.h.in \
pplib/include/ppl7-inet.h \
pplib/include/ppl7-audio.h \
pplib/include/threads.h \
pplib/include/ppl7-grafix.h \
pplib/include/socket.h \
pplib/include/ppl7-crypto.h \
pplib/include/prolog.h \
pplib/include/ppl7-types.h \
pplib/include/ppl7-algorithms.h \
pplib/include/ppl7-exceptions.h \
pplib/include/ppl7-db.h \
pplib/include/compat.h \
pplib/tests/Makefile.in \
pplib/tests/src/toolkit.h \
pplib/tests/src/stringspeed.cpp \
pplib/tests/src/database/db_mysql.cpp \
pplib/tests/src/database/db_sqlite.cpp \
pplib/tests/src/database/db_postgres.cpp \
pplib/tests/src/audio/id3tag.cpp \
pplib/tests/src/audio/audio_decoder_aiff.cpp \
pplib/tests/src/audio/audio_decoder_mp3.cpp \
pplib/tests/src/audio/audio_encoder_mp3.cpp \
pplib/tests/src/audio/audioinfo.cpp \
pplib/tests/src/audio/audio_encoder_aiff.cpp \
pplib/tests/src/audio/audio_encoder_wave.cpp \
pplib/tests/src/audio/audio_decoder_wave.cpp \
pplib/tests/src/ppl6/strings.cpp \
pplib/tests/src/ppl6/assocarray.cpp \
pplib/tests/src/crypto/mcrypt.cpp \
pplib/tests/src/crypto/crypto.cpp \
pplib/tests/src/crypto/digest.cpp \
pplib/tests/src/wordlist.cpp \
pplib/tests/src/core/stringfunctions.cpp \
pplib/tests/src/core/iconv.cpp \
pplib/tests/src/core/functions.cpp \
pplib/tests/src/core/json.cpp \
pplib/tests/src/core/filestatic.cpp \
pplib/tests/src/core/strings.cpp \
pplib/tests/src/core/gzfile.cpp \
pplib/tests/src/core/pythonhelper.cpp \
pplib/tests/src/core/memoryheap.cpp \
pplib/tests/src/core/avltree.cpp \
pplib/tests/src/core/variant.cpp \
pplib/tests/src/core/pointer.cpp \
pplib/tests/src/core/math.cpp \
pplib/tests/src/core/dir.cpp \
pplib/tests/src/core/configparser.cpp \
pplib/tests/src/core/time.cpp \
pplib/tests/src/core/bytearray.cpp \
pplib/tests/src/core/datetime.cpp \
pplib/tests/src/core/memorygroup.cpp \
pplib/tests/src/core/bytearrayptr.cpp \
pplib/tests/src/core/widestrings.cpp \
pplib/tests/src/core/array.cpp \
pplib/tests/src/core/perlhelper.cpp \
pplib/tests/src/core/file.cpp \
pplib/tests/src/core/logger.cpp \
pplib/tests/src/core/assocarray.cpp \
pplib/tests/src/core/list.cpp \
pplib/tests/src/loggertest.cpp \
pplib/tests/src/grafix/grafix_image.cpp \
pplib/tests/src/grafix/grafix_rect.cpp \
pplib/tests/src/grafix/grafix_imagefilter.cpp \
pplib/tests/src/grafix/grafix_size.cpp \
pplib/tests/src/grafix/grafix_font.cpp \
pplib/tests/src/grafix/grafix_rgbformat.cpp \
pplib/tests/src/grafix/grafix_point3d.cpp \
pplib/tests/src/grafix/grafix_point.cpp \
pplib/tests/src/grafix/grafix.cpp \
pplib/tests/src/grafix/grafix_color.cpp \
pplib/tests/src/grafix/grafix_drawable.cpp \
pplib/tests/src/gfxreftest.cpp \
pplib/tests/src/toolkit.cpp \
pplib/tests/src/textsnippets.cpp \
pplib/tests/src/main.cpp \
pplib/tests/src/threadtest.cpp \
pplib/tests/src/inet/tcpsocket.cpp \
pplib/tests/src/inet/ipaddress.cpp \
pplib/tests/src/inet/wikiparser.cpp \
pplib/tests/src/inet/sockaddr.cpp \
pplib/tests/src/inet/resolver.cpp \
pplib/tests/src/inet/inet.cpp \
pplib/tests/src/inet/ipnetwork.cpp \
pplib/tests/create_postgres_db.sh \
pplib/tests/valgrind.suppressions \
pplib/tests/gcovr \
pplib/tests/test.conf \
pplib/tests/ppl7-tests.h \
pplib/tests/testdata/test_192cbr_taggedWithCover.mp3 \
pplib/tests/testdata/test_192vbr.mp3 \
pplib/tests/testdata/unittest.png \
pplib/tests/testdata/ppl7-icon-64x64.png \
pplib/tests/testdata/test_44kHz_tagged.wav \
pplib/tests/testdata/test.pcx \
pplib/tests/testdata/unicodeUSASCII.txt \
pplib/tests/testdata/test-pal-trans.png \
pplib/tests/testdata/fonts/liberationsans8.fnt5 \
pplib/tests/testdata/fonts/LiberationSans-Bold.ttf \
pplib/tests/testdata/fonts/freesans4.fnt5 \
pplib/tests/testdata/fonts/segoeui4.fnt5 \
pplib/tests/testdata/filenameUSASCII.txt \
pplib/tests/testdata/database/postgresql.sql \
pplib/tests/testdata/database/mysql.sql \
pplib/tests/testdata/database/sqlite3.sql \
pplib/tests/testdata/test_192cbr_tagged.mp3 \
pplib/tests/testdata/test.tga \
pplib/tests/testdata/test.png \
pplib/tests/testdata/jsontest2.json \
pplib/tests/testdata/jsontest4.json \
pplib/tests/testdata/compression.txt \
pplib/tests/testdata/mpg123.h \
pplib/tests/testdata/test.gif \
pplib/tests/testdata/cover.jpg \
pplib/tests/testdata/unittest.bmp \
pplib/tests/testdata/screenshot1.png \
pplib/tests/testdata/lame.h \
pplib/tests/testdata/example.conf \
pplib/tests/testdata/test.tif \
pplib/tests/testdata/dirwalk/testfile.txt \
pplib/tests/testdata/dirwalk/zfile.txt \
pplib/tests/testdata/dirwalk/file1.txt \
pplib/tests/testdata/dirwalk/LICENSE.TXT \
pplib/tests/testdata/dirwalk/file3.txt \
pplib/tests/testdata/dirwalk/file4äöü.txt \
pplib/tests/testdata/dirwalk/afile.txt \
pplib/tests/testdata/dirwalk/file2.txt \
pplib/tests/testdata/test.jpg \
pplib/tests/testdata/reference.png \
pplib/tests/testdata/lame_API.txt \
pplib/tests/testdata/filenameUTF8äöü.txt \
pplib/tests/testdata/tags_at_eof.aiff \
pplib/tests/testdata/test_44kHz.aiff \
pplib/tests/testdata/test_44kHz_tagged.aiff \
pplib/tests/testdata/compression.txt.gz \
pplib/tests/testdata/test_44kHz_taggedWithCover.aiff \
pplib/tests/testdata/test_192cbr.mp3 \
pplib/tests/testdata/test_44kHz.wav \
pplib/tests/testdata/test.ppm \
pplib/tests/testdata/jsontest1.json \
pplib/tests/testdata/unicodeUtf8äöü.txt \
pplib/tests/testdata/jsontest3.json \
pplib/tests/testdata/test_320cbr.mp3 \
pplib/tests/testdata/test.bmp \
pplib/tests/testdata/test-pal.png \
pplib/LICENSE.TXT \
pplib/configure \
pplib/autoconf/iconv.m4 \
pplib/autoconf/imlib.m4 \
pplib/autoconf/libidn.m4 \
pplib/autoconf/imagemagick.m4 \
pplib/autoconf/freetds.m4 \
pplib/autoconf/ax_lib_gcrypt.m4 \
pplib/autoconf/checkfuncs.m4 \
pplib/autoconf/libtiff.m4 \
pplib/autoconf/ldns.m4 \
pplib/autoconf/bzip2.m4 \
pplib/autoconf/ax_lib_crypto.m4 \
pplib/autoconf/ax_lib_sqlite3.m4 \
pplib/autoconf/lib-link.m4 \
pplib/autoconf/ax_check_compiler_flags.m4 \
pplib/autoconf/ax_path_lib_pcre.m4 \
pplib/autoconf/nasm.m4 \
pplib/autoconf/missing \
pplib/autoconf/libcdio.m4 \
pplib/autoconf/libjpeg-turbo.m4 \
pplib/autoconf/libmicrohttpd.m4 \
pplib/autoconf/ax_gcc_x86_cpuid.m4 \
pplib/autoconf/ogg.m4 \
pplib/autoconf/compile \
pplib/autoconf/ax_pthread.m4 \
pplib/autoconf/sdl2.m4 \
pplib/autoconf/ax_cxx_compile_stdcxx.m4 \
pplib/autoconf/ax_check_openssl.m4 \
pplib/autoconf/ax_lib_mysql.m4 \
pplib/autoconf/ax_lib_postgresql.m4 \
pplib/autoconf/ax_have_qt.m4 \
pplib/autoconf/ax_gcc_archflag.m4 \
pplib/autoconf/gtest.m4 \
pplib/autoconf/ax_check_zlib.m4 \
pplib/autoconf/shout.m4 \
pplib/autoconf/jpeg.m4 \
pplib/autoconf/libcurl.m4 \
pplib/autoconf/config.rpath \
pplib/autoconf/ax_cc_maxopt.m4 \
pplib/autoconf/freetype.m4 \
pplib/autoconf/install-sh \
pplib/autoconf/config.sub \
pplib/autoconf/lame.m4 \
pplib/autoconf/libbind.m4 \
pplib/autoconf/config.guess \
pplib/autoconf/libidn2.m4 \
pplib/autoconf/png.m4 \
pplib/autoconf/mpg123.m4 \
pplib/autoconf/libmcrypt.m4 \
pplib/autoconf/ax_cxx_compile_stdcxx_11.m4 \
pplib/TODO.TXT \
pplib/docs/threads.dox \
pplib/docs/credits.dox \
pplib/docs/CWikiParser_diagram.png \
pplib/docs/groups.dox \
pplib/docs/formate.dox \
pplib/docs/pcrenote.dox \
pplib/docs/CWStringSetFunctions.dox \
pplib/docs/pregexpr.dox \
pplib/docs/verwendung.dox \
pplib/docs/win32-vc9-clr.png \
pplib/docs/header-bg.png \
pplib/docs/ppl7style.css \
pplib/docs/CDrawable.png \
pplib/docs/Class_Point.png \
pplib/docs/datentypen.dox \
pplib/docs/main.dox \
pplib/docs/DoxygenLayout.xml \
pplib/docs/sprintf.dox \
pplib/docs/strftime.dox \
pplib/docs/examples/nasm.rules \
pplib/docs/examples/db_examples.cpp \
pplib/docs/examples/CThread_ThreadMain.cpp \
pplib/docs/examples/IcecastExample.cpp \
pplib/docs/examples/ppl7.m4 \
pplib/docs/installation.dox \
pplib/docs/gtest.dox \
pplib/docs/sockets.dox \
pplib/docs/icecast_status.png \
pplib/docs/formate/PFPVersion1.dox \
pplib/docs/formate/PFPVersion2.dox \
pplib/docs/formate/SocketMessage.dox \
pplib/docs/formate/PFPVersion3.dox \
pplib/docs/formate/PPLResVersion6.dox \
pplib/docs/structures.dox \
pplib/docs/header.html \
pplib/docs/win32-vc9-rl.png \
pplib/docs/datenbanken.dox \
pplib/Doxyfile \
pplib/configure.ac \
pplib/HISTORY.TXT \
pplib/acinclude.m4 \
pplib/ppl7-config.in \
pplib/resource/ppl7-icon-16x16.png \
pplib/resource/ppl7-icon-64x64.png \
pplib/resource/toolbar.png \
pplib/resource/wikistyle.css \
pplib/resource/liberationsans2.fnt6 \
pplib/resource/resourcen.lst \
pplib/resource/ppl7.ico \
pplib/resource/ppl7-icon-256x256.png \
pplib/resource/ppl7-icon-32x32.png \
pplib/resource/ButtonSymbols.png \
pplib/resource/ppl7-icon-128x128.png \
pplib/resource/ppl7-icon-48x48.png \
pplib/resource/cursor.png \
pplib/resource/makefonts.sh \
pplib/resource/mimetypes.png \
pplib/resource/liberationmono2.fnt6 \
pplib/resource/res.h \
pplib/resource/SymbolsAlpha.png \
pplib/resource/icons.png \
pplib/README.TXT

View file

@ -0,0 +1,90 @@
/*
* Copyright (c) 2019-2021, OARC, Inc.
* Copyright (c) 2019, DENIC eG
* All rights reserved.
*
* This file is part of dnsmeter.
*
* dnsmeter 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.
*
* dnsmeter 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 dnsmeter. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include "dns_receiver_thread.h"
DNSReceiverThread::DNSReceiverThread()
{
}
DNSReceiverThread::~DNSReceiverThread()
{
}
void DNSReceiverThread::setInterface(const ppl7::String& Device)
{
Socket.initInterface(Device);
}
void DNSReceiverThread::setSource(const ppl7::IPAddress& ip, int port)
{
Socket.setSource(ip, port);
}
void DNSReceiverThread::run()
{
counter.clear();
while (1) {
if (Socket.socketReady())
Socket.receive(counter);
if (this->threadShouldStop())
break;
}
}
ppluint64 DNSReceiverThread::getPacketsReceived() const
{
return counter.num_pkgs;
}
ppluint64 DNSReceiverThread::getBytesReceived() const
{
return counter.bytes_rcv;
}
double DNSReceiverThread::getDuration() const
{
return counter.rtt_total;
}
double DNSReceiverThread::getRoundTripTimeAverage() const
{
if (counter.num_pkgs)
return counter.rtt_total / counter.num_pkgs; //NOSONAR
return 0.0f;
}
double DNSReceiverThread::getRoundTripTimeMin() const
{
return counter.rtt_min;
}
double DNSReceiverThread::getRoundTripTimeMax() const
{
return counter.rtt_max;
}
const RawSocketReceiver::Counter& DNSReceiverThread::getCounter() const
{
return counter;
}

52
src/dns_receiver_thread.h Normal file
View file

@ -0,0 +1,52 @@
/*
* Copyright (c) 2019-2021, OARC, Inc.
* Copyright (c) 2019, DENIC eG
* All rights reserved.
*
* This file is part of dnsmeter.
*
* dnsmeter 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.
*
* dnsmeter 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 dnsmeter. If not, see <http://www.gnu.org/licenses/>.
*/
#include "raw_socket_receiver.h"
#include <ppl7.h>
#include <ppl7-inet.h>
#ifndef __dnsmeter_dns_receiver_thread_h
#define __dnsmeter_dns_receiver_thread_h
class DNSReceiverThread : public ppl7::Thread {
private:
RawSocketReceiver Socket;
RawSocketReceiver::Counter counter;
public:
DNSReceiverThread();
~DNSReceiverThread();
void setInterface(const ppl7::String& Device);
void setSource(const ppl7::IPAddress& ip, int port);
void run();
ppluint64 getPacketsReceived() const;
ppluint64 getBytesReceived() const;
double getDuration() const;
double getRoundTripTimeAverage() const;
double getRoundTripTimeMin() const;
double getRoundTripTimeMax() const;
const RawSocketReceiver::Counter& getCounter() const;
};
#endif

571
src/dns_sender.cpp Normal file
View file

@ -0,0 +1,571 @@
/*
* Copyright (c) 2019-2021, OARC, Inc.
* Copyright (c) 2019, DENIC eG
* All rights reserved.
*
* This file is part of dnsmeter.
*
* dnsmeter 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.
*
* dnsmeter 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 dnsmeter. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include "dns_sender.h"
#include "exceptions.h"
#include "dns_sender_thread.h"
#include <signal.h>
#include <string.h>
static const char* rcode_names[] = {
"OK", "FORMAT", "SRVFAIL", "NAME", "NOTIMPL", "REFUSED",
"YXDOMAIN", "YXRRSET", "NXRRSET", "NOTAUTH", "NOTZONE",
"11", "12", "13", "14", "15",
NULL
};
bool stopFlag = false;
void sighandler(int sig)
{
stopFlag = true;
printf("Stopping...\n");
}
void DNSSender::help()
{
ppl7::String name, underline;
name.setf("dnsmeter %s", PACKAGE_VERSION);
underline.repeat("=", name.size());
name.printnl();
underline.printnl();
printf("\nUsage:\n"
" -h shows this help\n"
" -q HOST hostname or IP address of sender if you don't want to spoof\n"
" (see -s)\n"
" -s NET|pcap spoof sender address. Use random IP from the given network\n"
" (example: 192.168.0.0/16). Only works when running as root!\n"
" If payload is a pcap file, you can use \"-s pcap\" to use the\n"
" source addresses and ports from the pcap file.\n"
" -e ETH interface on which the packet receiver should listen\n"
" (FreeBSD only)\n"
" -z HOST:PORT hostname or IP address and port of the target nameserver\n"
" -p FILE file with queries/payload or pcap file\n"
" -l # runtime in seconds (default=10 seconds)\n"
" -t # timeout in seconds (default=2 seconds)\n"
" -n # number of worker threads (default=1)\n"
" -r # queryrate (Default=as much as possible)\n"
" can be a single value, a comma separated list (rate,rate,...)\n"
" or a range and a step value (start - end, step)\n"
" -d # amount of queries in percent on which the DNSSEC-flags are set\n"
" (default=0)\n"
" -c FILE CSV-file for results\n"
" --ignore answers are ignored and therefor not counted. In this mode\n"
" the tool only generates traffic."
"\n");
}
DNSSender::Results::Results()
{
queryrate = 0;
counter_send = 0;
counter_received = 0;
bytes_send = 0;
bytes_received = 0;
counter_errors = 0;
packages_lost = 0;
counter_0bytes = 0;
for (int i = 0; i < 255; i++)
counter_errorcodes[i] = 0;
rtt_avg = 0.0f;
rtt_total = 0.0f;
rtt_min = 0.0f;
rtt_max = 0.0f;
for (int i = 0; i < 16; i++)
rcodes[i] = 0;
truncated = 0;
}
void DNSSender::Results::clear()
{
queryrate = 0;
counter_send = 0;
counter_received = 0;
bytes_send = 0;
bytes_received = 0;
counter_errors = 0;
packages_lost = 0;
counter_0bytes = 0;
for (int i = 0; i < 255; i++)
counter_errorcodes[i] = 0;
rtt_avg = 0.0f;
rtt_total = 0.0f;
rtt_min = 0.0f;
rtt_max = 0.0f;
for (int i = 0; i < 16; i++)
rcodes[i] = 0;
truncated = 0;
}
DNSSender::Results operator-(const DNSSender::Results& second, const DNSSender::Results& first)
{
DNSSender::Results r;
r.queryrate = second.queryrate - first.queryrate;
r.counter_send = second.counter_send - first.counter_send;
r.counter_received = second.counter_received - first.counter_received;
r.bytes_send = second.bytes_send - first.bytes_send;
r.bytes_received = second.bytes_received - first.bytes_received;
r.counter_errors = second.counter_errors - first.counter_errors;
r.packages_lost = second.packages_lost - first.packages_lost;
r.counter_0bytes = second.counter_0bytes - first.counter_0bytes;
for (int i = 0; i < 255; i++)
r.counter_errorcodes[i] = second.counter_errorcodes[i] - first.counter_errorcodes[i];
r.rtt_total = second.rtt_total - first.rtt_total;
if (r.counter_received)
r.rtt_avg = r.rtt_total / r.counter_received; //NOSONAR
else
r.rtt_avg = 0.0;
r.rtt_min = second.rtt_min - first.rtt_min;
r.rtt_max = second.rtt_max - first.rtt_max;
for (int i = 0; i < 16; i++)
r.rcodes[i] = second.rcodes[i] - first.rcodes[i];
r.truncated = second.truncated - first.truncated;
return r;
}
DNSSender::DNSSender()
{
ppl7::InitSockets();
Runtime = 10;
Timeout = 2;
ThreadCount = 1;
Timeslices = 1.0f;
ignoreResponses = false;
DnssecRate = 0;
TargetPort = 53;
spoofingEnabled = false;
Receiver = NULL;
spoofFromPcap = false;
}
DNSSender::~DNSSender()
{
if (Receiver)
delete Receiver;
}
ppl7::Array DNSSender::getQueryRates(const ppl7::String& QueryRates)
{
ppl7::Array rates;
if (QueryRates.isEmpty()) {
rates.add("0");
} else {
ppl7::Array matches;
if (QueryRates.pregMatch("/^([0-9]+)-([0-9]+),([0-9]+)$", matches)) {
for (ppluint64 i = matches[1].toUnsignedInt64(); i <= matches[2].toUnsignedInt64(); i += matches[3].toUnsignedInt64()) {
rates.addf("%llu", i);
}
} else {
rates.explode(QueryRates, ",");
}
}
return rates;
}
void DNSSender::getTarget(int argc, char** argv)
{
if (!ppl7::HaveArgv(argc, argv, "-z")) {
throw MissingCommandlineParameter("target IP/hostname or port missing (-z IP:PORT)");
}
ppl7::String Tmp = ppl7::GetArgv(argc, argv, "-z");
ppl7::Array Tok(Tmp, ":");
if (Tok.size() != 2) {
if (Tok.size() != 1)
throw InvalidCommandlineParameter("-z IP:PORT");
TargetPort = 53;
} else {
TargetPort = Tok[1].toInt();
}
if (TargetPort < 1 || TargetPort > 65535)
throw InvalidCommandlineParameter("-z IP:PORT, Invalid Port");
std::list<ppl7::IPAddress> Result;
size_t num = ppl7::GetHostByName(Tok[0], Result, ppl7::af_inet);
if (!num)
throw InvalidCommandlineParameter("-z IP:PORT, Invalid IP or could not resolve Hostname");
TargetIP = Result.front();
//printf ("num=%d, %s\n",num, (const char*)TargetIP.toString());
}
void DNSSender::getSource(int argc, char** argv)
{
if (ppl7::HaveArgv(argc, argv, "-s")) {
ppl7::String Tmp = ppl7::GetArgv(argc, argv, "-s").toLowerCase();
if (Tmp == "pcap") {
spoofFromPcap = true;
} else {
SourceNet.set(Tmp);
if (SourceNet.family() != ppl7::IPAddress::IPv4)
throw UnsupportedIPFamily("only IPv4 works");
}
spoofingEnabled = true;
} else {
ppl7::String Tmp = ppl7::GetArgv(argc, argv, "-q");
std::list<ppl7::IPAddress> Result;
size_t num = ppl7::GetHostByName(Tmp, Result, ppl7::af_inet);
if (!num)
throw InvalidCommandlineParameter("-q HOST, Invalid IP or could not resolve Hostname");
SourceIP = Result.front();
if (SourceIP.family() != ppl7::IPAddress::IPv4)
throw UnsupportedIPFamily("only IPv4 works");
spoofingEnabled = false;
}
}
int DNSSender::getParameter(int argc, char** argv)
{
if (ppl7::HaveArgv(argc, argv, "-q") && ppl7::HaveArgv(argc, argv, "-s")) {
printf("ERROR: could not use parameters -q and -s together\n\n");
help();
return 1;
}
if ((!ppl7::HaveArgv(argc, argv, "-q")) && (!ppl7::HaveArgv(argc, argv, "-s"))) {
printf("ERROR: source IP/hostname or network for source address spoofing missing (-q IP | -s NETWORK)\n\n");
help();
return 1;
}
ignoreResponses = ppl7::HaveArgv(argc, argv, "--ignore");
if (ppl7::HaveArgv(argc, argv, "-e")) {
InterfaceName = ppl7::GetArgv(argc, argv, "-e");
}
try {
getTarget(argc, argv);
getSource(argc, argv);
} catch (const ppl7::Exception& e) {
printf("ERROR: missing or invalid parameter\n");
e.print();
printf("\n");
help();
return 1;
}
Runtime = ppl7::GetArgv(argc, argv, "-l").toInt();
Timeout = ppl7::GetArgv(argc, argv, "-t").toInt();
ThreadCount = ppl7::GetArgv(argc, argv, "-n").toInt();
ppl7::String QueryRates = ppl7::GetArgv(argc, argv, "-r");
CSVFileName = ppl7::GetArgv(argc, argv, "-c");
QueryFilename = ppl7::GetArgv(argc, argv, "-p");
if (ppl7::HaveArgv(argc, argv, "-d")) {
DnssecRate = ppl7::GetArgv(argc, argv, "-d").toInt();
if (DnssecRate < 0 || DnssecRate > 100) {
printf("ERROR: DNSSEC-Rate must be an integer between 0 and 100 (-d #)\n\n");
help();
return 1;
}
}
if (!ThreadCount)
ThreadCount = 1;
if (!Runtime)
Runtime = 10;
if (!Timeout)
Timeout = 2;
if (QueryFilename.isEmpty()) {
printf("ERROR: Payload-File is missing (-p FILENAME)\n\n");
help();
return 1;
}
rates = getQueryRates(QueryRates);
return 0;
}
int DNSSender::openFiles()
{
if (CSVFileName.notEmpty()) {
try {
openCSVFile(CSVFileName);
} catch (const ppl7::Exception& e) {
printf("ERROR: could not open CSV-file for writing\n");
e.print();
return 1;
}
}
try {
payload.openQueryFile(QueryFilename);
} catch (const ppl7::Exception& e) {
printf("ERROR: could not open payload file or it does not contain any queries\n");
e.print();
return 1;
}
return 0;
}
int DNSSender::main(int argc, char** argv)
{
if (ppl7::HaveArgv(argc, argv, "-h") || ppl7::HaveArgv(argc, argv, "--help") || argc < 2) {
help();
return 0;
}
if (getParameter(argc, argv) != 0)
return 1;
if (openFiles() != 0)
return 1;
signal(SIGINT, sighandler);
signal(SIGKILL, sighandler);
DNSSender::Results results;
try {
if (!ignoreResponses) {
Receiver = new DNSReceiverThread();
Receiver->setSource(TargetIP, TargetPort);
try {
Receiver->setInterface(InterfaceName);
} catch (const ppl7::Exception& e) {
printf("ERROR: could not bind on device [%s]\n", (const char*)InterfaceName);
e.print();
printf("\n");
help();
return 1;
}
}
prepareThreads();
for (size_t i = 0; i < rates.size(); i++) {
results.queryrate = rates[i].toInt();
run(rates[i].toInt());
getResults(results);
presentResults(results);
saveResultsToCsv(results);
}
threadpool.destroyAllThreads();
} catch (const ppl7::OperationInterruptedException&) {
getResults(results);
presentResults(results);
saveResultsToCsv(results);
} catch (const ppl7::Exception& e) {
e.print();
return 1;
}
return 0;
}
void DNSSender::prepareThreads()
{
for (int i = 0; i < ThreadCount; i++) {
DNSSenderThread* thread = new DNSSenderThread();
thread->setDestination(TargetIP, TargetPort);
thread->setRuntime(Runtime);
thread->setTimeout(Timeout);
thread->setTimeslice(Timeslices);
thread->setDNSSECRate(DnssecRate);
thread->setVerbose(false);
thread->setPayload(payload);
if (spoofingEnabled) {
if (spoofFromPcap)
thread->setSourcePcap();
else
thread->setSourceNet(SourceNet);
} else {
thread->setSourceIP(SourceIP);
}
threadpool.addThread(thread);
}
}
void DNSSender::openCSVFile(const ppl7::String& Filename)
{
CSVFile.open(Filename, ppl7::File::APPEND);
if (CSVFile.size() == 0) {
CSVFile.putsf("#QPS Send; QPS Received; QPS Errors; Lostrate; "
"rtt_avg; rtt_min; rtt_max;"
"\n");
CSVFile.flush();
}
}
void DNSSender::showCurrentStats(ppl7::ppl_time_t start_time)
{
DNSSender::Results result, diff;
ppl7::ppl_time_t runtime = ppl7::GetTime() - start_time;
getResults(result);
diff = result - vis_prev_results;
vis_prev_results = result;
int h = (int)(runtime / 3600);
runtime -= h * 3600;
int m = (int)(runtime / 60);
int s = runtime - (m * 60);
printf("%02d:%02d:%02d Queries send: %7llu, rcv: %7llu, ", h, m, s,
diff.counter_send, diff.counter_received);
printf("Data send: %6llu KB, rcv: %6llu KB", diff.bytes_send / 1024, diff.bytes_received / 1024);
printf("\n");
}
void DNSSender::calcTimeslice(int queryrate)
{
Timeslices = (1000.0f / queryrate) * ThreadCount; //NOSONAR
//if (Zeitscheibe<1.0f) Zeitscheibe=1.0f;
if (Timeslices < 0.1f)
Timeslices = 0.1f;
}
void DNSSender::run(int queryrate)
{
printf("###############################################################################\n");
if (queryrate) {
calcTimeslice(queryrate);
printf("# Start Session with Threads: %d, Queryrate: %d, Timeslot: %0.6f ms\n",
ThreadCount, queryrate, Timeslices);
} else {
printf("# Start Session with Threads: %d, Queryrate: unlimited\n",
ThreadCount);
}
ppl7::ThreadPool::iterator it;
for (it = threadpool.begin(); it != threadpool.end(); ++it) {
((DNSSenderThread*)(*it))->setQueryRate(queryrate / ThreadCount);
((DNSSenderThread*)(*it))->setTimeslice(Timeslices);
}
vis_prev_results.clear();
sampleSensorData(sys1);
if (Receiver)
Receiver->threadStart();
threadpool.startThreads();
ppl7::ppl_time_t start = ppl7::GetTime();
ppl7::ppl_time_t report = start + 1;
ppl7::MSleep(500);
while (threadpool.running() == true && stopFlag == false) {
ppl7::MSleep(100);
ppl7::ppl_time_t now = ppl7::GetTime();
if (now >= report) {
report = now + 1;
showCurrentStats(start);
}
}
if (Receiver)
Receiver->threadStop();
sampleSensorData(sys2);
if (stopFlag == true) {
threadpool.stopThreads();
throw ppl7::OperationInterruptedException("test aborted");
}
}
void DNSSender::getResults(DNSSender::Results& result)
{
ppl7::ThreadPool::iterator it;
result.clear();
for (it = threadpool.begin(); it != threadpool.end(); ++it) {
result.counter_send += ((DNSSenderThread*)(*it))->getPacketsSend();
result.bytes_send += ((DNSSenderThread*)(*it))->getBytesSend();
result.counter_errors += ((DNSSenderThread*)(*it))->getErrors();
result.counter_0bytes += ((DNSSenderThread*)(*it))->getCounter0Bytes();
for (int i = 0; i < 255; i++)
result.counter_errorcodes[i] += ((DNSSenderThread*)(*it))->getCounterErrorCode(i);
}
if (Receiver) {
const RawSocketReceiver::Counter& counter = Receiver->getCounter();
result.counter_received = counter.num_pkgs;
result.bytes_received = counter.bytes_rcv;
result.rtt_total = counter.rtt_total;
if (counter.num_pkgs)
result.rtt_avg = counter.rtt_total / counter.num_pkgs; //NOSONAR
else
result.rtt_avg = 0.0;
result.rtt_min = counter.rtt_min;
result.rtt_max = counter.rtt_max;
for (int i = 0; i < 16; i++)
result.rcodes[i] = counter.rcodes[i];
result.truncated = counter.truncated;
}
result.packages_lost = result.counter_send - result.counter_received;
if (result.counter_received > result.counter_send)
result.packages_lost = 0;
}
void DNSSender::saveResultsToCsv(const DNSSender::Results& result)
{
if (CSVFile.isOpen()) {
CSVFile.putsf("%llu;%llu;%llu;%0.3f;%0.4f;%0.4f;%0.4f;\n",
(ppluint64)((double)result.counter_send / (double)Runtime),
(ppluint64)((double)result.counter_received / (double)Runtime),
(ppluint64)((double)result.counter_errors / (double)Runtime),
(double)result.packages_lost * 100.0 / (double)result.counter_send,
result.rtt_avg * 1000.0,
result.rtt_min * 1000.0,
result.rtt_max * 1000.0);
CSVFile.flush();
}
}
void DNSSender::presentResults(const DNSSender::Results& result)
{
printf("===============================================================================\n");
const SystemStat::Interface& net1 = sys1.interfaces[InterfaceName];
const SystemStat::Interface& net2 = sys2.interfaces[InterfaceName];
SystemStat::Network transmit = SystemStat::Network::getDelta(net1.transmit, net2.transmit);
SystemStat::Network received = SystemStat::Network::getDelta(net1.receive, net2.receive);
printf("network if %s Pkt send: %lu, rcv: %lu, Data send: %lu KB, rcv: %lu KB\n",
(const char*)InterfaceName,
transmit.packets, received.packets, transmit.bytes / 1024, received.bytes / 1024);
ppluint64 qps_send = (ppluint64)((double)result.counter_send / (double)Runtime);
ppluint64 bps_send = (ppluint64)((double)result.bytes_send / (double)Runtime);
ppluint64 qps_received = (ppluint64)((double)result.counter_received / (double)Runtime);
ppluint64 bps_received = (ppluint64)((double)result.bytes_received / (double)Runtime);
printf("DNS Queries send: %10llu, Qps: %7llu, Data send: %7llu KB = %6llu MBit\n",
result.counter_send, qps_send, result.bytes_send / 1024, bps_send / (1024 * 1024));
printf("DNS Queries rcv: %10llu, Qps: %7llu, Data rcv: %7llu KB = %6llu MBit\n",
result.counter_received, qps_received, result.bytes_received / 1024, bps_received / (1024 * 1024));
printf("DNS Queries lost: %10llu = %0.3f %%\n", result.packages_lost,
(double)result.packages_lost * 100.0 / (double)result.counter_send);
printf("DNS rtt average: %0.4f ms, "
"min: %0.4f ms, "
"max: %0.4f ms\n",
result.rtt_avg * 1000.0,
result.rtt_min * 1000.0,
result.rtt_max * 1000.0);
printf("DNS truncated: %llu\nDNS RCODES: ", result.truncated);
for (int i = 0; i < 15; i++) {
if (result.rcodes[i]) {
printf("%s: %llu, ", rcode_names[i], result.rcodes[i]);
}
}
printf("\n");
if (result.counter_errors) {
printf("Errors: %10llu, Qps: %10llu\n", result.counter_errors,
(ppluint64)((double)result.counter_errors / (double)Runtime));
}
if (result.counter_0bytes) {
printf("Errors 0Byte: %10llu, Qps: %10llu\n", result.counter_0bytes,
(ppluint64)((double)result.counter_0bytes / (double)Runtime));
}
for (int i = 0; i < 255; i++) {
if (result.counter_errorcodes[i] > 0) {
printf("Errors %3d: %10llu, Qps: %10llu [%s]\n", i, result.counter_errorcodes[i],
(ppluint64)((double)result.counter_errorcodes[i] / (double)Runtime),
strerror(i));
}
}
}

112
src/dns_sender.h Normal file
View file

@ -0,0 +1,112 @@
/*
* Copyright (c) 2019-2021, OARC, Inc.
* Copyright (c) 2019, DENIC eG
* All rights reserved.
*
* This file is part of dnsmeter.
*
* dnsmeter 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.
*
* dnsmeter 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 dnsmeter. If not, see <http://www.gnu.org/licenses/>.
*/
#include "dns_receiver_thread.h"
#include "payload_file.h"
#include "system_stat.h"
#include <ppl7.h>
#ifndef __dnsmeter_dns_sender_h
#define __dnsmeter_dns_sender_h
class DNSSender {
private:
#if defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L
DNSSender& operator=(const DNSSender& other);
DNSSender(DNSSender &&other) noexcept;
DNSSender const & operator=(DNSSender &&other);
#endif
public:
class Results {
public:
int queryrate;
ppluint64 counter_send;
ppluint64 counter_received;
ppluint64 bytes_send;
ppluint64 bytes_received;
ppluint64 counter_errors;
ppluint64 packages_lost;
ppluint64 counter_0bytes;
ppluint64 counter_errorcodes[255];
ppluint64 rcodes[16];
ppluint64 truncated;
double rtt_total;
double rtt_avg;
double rtt_min;
double rtt_max;
Results();
void clear();
};
private:
ppl7::ThreadPool threadpool;
ppl7::IPAddress TargetIP;
ppl7::IPAddress SourceIP;
ppl7::IPNetwork SourceNet;
ppl7::String CSVFileName;
ppl7::String QueryFilename;
ppl7::File CSVFile;
ppl7::Array rates;
ppl7::String InterfaceName;
PayloadFile payload;
DNSReceiverThread* Receiver;
DNSSender::Results vis_prev_results;
SystemStat sys1, sys2;
int TargetPort;
int Runtime;
int Timeout;
int ThreadCount;
int DnssecRate;
float Timeslices;
bool ignoreResponses;
bool spoofingEnabled;
bool spoofFromPcap;
void openCSVFile(const ppl7::String& Filename);
void run(int queryrate);
void presentResults(const DNSSender::Results& result);
void saveResultsToCsv(const DNSSender::Results& result);
void prepareThreads();
void getResults(DNSSender::Results& result);
ppl7::Array getQueryRates(const ppl7::String& QueryRates);
void readSourceIPList(const ppl7::String& filename);
void getTarget(int argc, char** argv);
void getSource(int argc, char** argv);
int getParameter(int argc, char** argv);
int openFiles();
void calcTimeslice(int queryrate);
void showCurrentStats(ppl7::ppl_time_t start_time);
public:
DNSSender();
~DNSSender();
void help();
int main(int argc, char** argv);
};
DNSSender::Results operator-(const DNSSender::Results& first, const DNSSender::Results& second);
#endif

332
src/dns_sender_thread.cpp Normal file
View file

@ -0,0 +1,332 @@
/*
* Copyright (c) 2019-2021, OARC, Inc.
* Copyright (c) 2019, DENIC eG
* All rights reserved.
*
* This file is part of dnsmeter.
*
* dnsmeter 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.
*
* dnsmeter 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 dnsmeter. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include "dns_sender_thread.h"
#include "query.h"
#include "exceptions.h"
#include <netinet/in.h>
#include <arpa/inet.h>
#include <math.h>
#include <netinet/ip.h>
#include <netinet/udp.h>
#include <string.h>
#include <errno.h>
DNSSenderThread::DNSSenderThread()
{
buffer = (unsigned char*)malloc(4096);
if (!buffer)
throw ppl7::OutOfMemoryException();
Timeslice = 0.0f;
runtime = 10;
timeout = 5;
queryrate = 0;
counter_packets_send = 0;
counter_bytes_send = 0;
errors = 0;
counter_0bytes = 0;
duration = 0.0;
for (int i = 0; i < 255; i++)
counter_errorcodes[i] = 0;
verbose = false;
spoofingEnabled = false;
DnssecRate = 0;
dnsseccounter = 0;
payload = NULL;
spoofing_net_start = 0;
spoofing_net_size = 0;
payloadIsPcap = false;
spoofingFromPcap = false;
}
DNSSenderThread::~DNSSenderThread()
{
free(buffer);
}
void DNSSenderThread::setDestination(const ppl7::IPAddress& ip, int port)
{
Socket.setDestination(ip, port);
pkt.setDestination(ip, port);
}
void DNSSenderThread::setPayload(PayloadFile& payload)
{
this->payload = &payload;
this->payloadIsPcap = payload.isPcap();
}
void DNSSenderThread::setRuntime(int seconds)
{
runtime = seconds;
}
void DNSSenderThread::setTimeout(int seconds)
{
timeout = seconds;
}
void DNSSenderThread::setDNSSECRate(int rate)
{
DnssecRate = rate;
}
void DNSSenderThread::setQueryRate(ppluint64 qps)
{
queryrate = qps;
}
void DNSSenderThread::setTimeslice(float ms)
{
if (ms == 0.0f || ms > 1000.0f)
throw ppl7::InvalidArgumentsException();
//if ((1000 % ms)!=0) throw ppl7::InvalidArgumentsException();
Timeslice = (double)ms / 1000;
}
void DNSSenderThread::setSourceIP(const ppl7::IPAddress& ip)
{
sourceip = ip;
spoofingEnabled = false;
}
void DNSSenderThread::setSourceNet(const ppl7::IPNetwork& net)
{
sourcenet = net;
spoofingEnabled = true;
spoofing_net_start = ntohl(*(in_addr_t*)net.first().addr());
spoofing_net_size = powl(2, 32 - net.prefixlen());
}
void DNSSenderThread::setSourcePcap()
{
spoofingEnabled = true;
spoofingFromPcap = true;
}
void DNSSenderThread::setVerbose(bool verbose)
{
this->verbose = verbose;
}
#define PCAP_HEADER_SIZE 14 + sizeof(struct ip) + sizeof(struct udphdr)
void DNSSenderThread::sendPacket()
{
size_t query_size;
while (1) {
try {
const ppl7::ByteArrayPtr& bap = payload->getQuery();
query_size = bap.size();
if (payloadIsPcap) {
query_size -= PCAP_HEADER_SIZE;
memcpy(buffer, ((const char*)bap.ptr()) + PCAP_HEADER_SIZE, query_size);
} else {
memcpy(buffer, bap.ptr(), query_size);
dnsseccounter += DnssecRate;
if (dnsseccounter >= 100) {
query_size = AddDnssecToQuery(buffer, 4096, query_size);
dnsseccounter -= 100;
}
}
pkt.setPayload(buffer, query_size);
if (spoofingEnabled) {
if (spoofingFromPcap) {
pkt.useSourceFromPcap((const char*)bap.ptr(), bap.size());
} else {
pkt.randomSourceIP(spoofing_net_start, spoofing_net_size);
pkt.randomSourcePort();
}
} else {
pkt.randomSourcePort();
}
pkt.setDnsId(getQueryTimestamp());
ssize_t n = Socket.send(pkt);
if (n > 0 && (size_t)n == pkt.size()) {
counter_packets_send++;
counter_bytes_send += pkt.size();
} else if (n < 0) {
if (errno < 255)
counter_errorcodes[errno]++;
errors++;
} else {
counter_0bytes++;
}
return;
} catch (const UnknownRRType& exp) {
continue;
} catch (const InvalidDNSQuery& exp) {
continue;
}
}
}
void DNSSenderThread::run()
{
if (!payload)
throw ppl7::NullPointerException("payload not set!");
if (!spoofingEnabled) {
pkt.setSource(sourceip, 0x4567);
}
dnsseccounter = 0;
counter_packets_send = 0;
counter_bytes_send = 0;
counter_0bytes = 0;
errors = 0;
duration = 0.0;
for (int i = 0; i < 255; i++)
counter_errorcodes[i] = 0;
double start = ppl7::GetMicrotime();
if (queryrate > 0) {
runWithRateLimit();
} else {
runWithoutRateLimit();
}
duration = ppl7::GetMicrotime() - start;
waitForTimeout();
}
void DNSSenderThread::runWithoutRateLimit()
{
double start = ppl7::GetMicrotime();
double end = start + (double)runtime;
double now;
int pc = 0;
while (1) {
sendPacket();
pc++;
if (pc > 10000) {
pc = 0;
if (this->threadShouldStop())
break;
now = ppl7::GetMicrotime();
if (now > end)
break;
}
}
}
static inline double getNsec()
{
struct timespec ts;
clock_gettime(CLOCK_REALTIME, &ts);
return (double)ts.tv_sec + ((double)ts.tv_nsec / 1000000000.0);
}
void DNSSenderThread::runWithRateLimit()
{
struct timespec ts;
ppluint64 total_timeslices = runtime * 1000 / (Timeslice * 1000.0);
ppluint64 queries_rest = runtime * queryrate;
ppl7::SockAddr addr = Socket.getSockAddr();
verbose = true;
if (verbose) {
//printf ("qps=%d, runtime=%d\n",queryrate, runtime);
printf("runtime: %d s, timeslice: %0.6f s, total timeslices: %llu, Qpts: %llu, Source: %s:%d\n",
runtime, Timeslice, total_timeslices,
queries_rest / total_timeslices,
(const char*)addr.toIPAddress().toString(), addr.port());
}
double now = getNsec();
double next_timeslice = now;
double next_checktime = now + 0.1;
double start = ppl7::GetMicrotime();
double end = start + (double)runtime;
double total_idle = 0.0;
for (ppluint64 z = 0; z < total_timeslices; z++) {
next_timeslice += Timeslice;
ppluint64 timeslices_rest = total_timeslices - z;
ppluint64 queries_per_timeslice = queries_rest / timeslices_rest;
if (timeslices_rest == 1)
queries_per_timeslice = queries_rest;
for (ppluint64 i = 0; i < queries_per_timeslice; i++) {
sendPacket();
}
queries_rest -= queries_per_timeslice;
while ((now = getNsec()) < next_timeslice) {
if (now < next_timeslice) {
total_idle += next_timeslice - now;
ts.tv_sec = 0;
ts.tv_nsec = (next_timeslice - now) * 1000000000;
nanosleep(&ts, NULL);
}
}
if (now > next_checktime) {
next_checktime = now + 0.1;
if (this->threadShouldStop())
break;
if (ppl7::GetMicrotime() >= end)
break;
//printf ("Zeitscheiben rest: %llu\n", z);
}
}
if (verbose) {
//printf ("total idle: %0.6f\n",total_idle);
}
}
void DNSSenderThread::waitForTimeout()
{
double start = ppl7::GetMicrotime();
double end = start + (double)timeout;
double now, next_checktime = start + 0.1;
while ((now = ppl7::GetMicrotime()) < end) {
if (now > next_checktime) {
next_checktime = now + 0.1;
if (this->threadShouldStop())
break;
}
ppl7::MSleep(10);
}
}
ppluint64 DNSSenderThread::getPacketsSend() const
{
return counter_packets_send;
}
ppluint64 DNSSenderThread::getBytesSend() const
{
return counter_bytes_send;
}
ppluint64 DNSSenderThread::getErrors() const
{
return errors;
}
ppluint64 DNSSenderThread::getCounter0Bytes() const
{
return counter_0bytes;
}
ppluint64 DNSSenderThread::getCounterErrorCode(int err) const
{
if (err < 255)
return counter_errorcodes[err];
return 0;
}

97
src/dns_sender_thread.h Normal file
View file

@ -0,0 +1,97 @@
/*
* Copyright (c) 2019-2021, OARC, Inc.
* Copyright (c) 2019, DENIC eG
* All rights reserved.
*
* This file is part of dnsmeter.
*
* dnsmeter 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.
*
* dnsmeter 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 dnsmeter. If not, see <http://www.gnu.org/licenses/>.
*/
#include "raw_socket_sender.h"
#include "payload_file.h"
#include <ppl7.h>
#ifndef __dnsmeter_dns_sender_thread_h
#define __dnsmeter_dns_sender_thread_h
class DNSSenderThread : public ppl7::Thread {
private:
#if defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L
DNSSenderThread& operator=(const DNSSenderThread& other);
DNSSenderThread(DNSSenderThread &&other) noexcept;
DNSSenderThread const & operator=(DNSSenderThread &&other);
#endif
RawSocketSender Socket;
Packet pkt;
ppl7::IPAddress destination;
ppl7::IPAddress sourceip;
ppl7::IPNetwork sourcenet;
PayloadFile* payload;
unsigned char* buffer;
ppluint64 queryrate;
ppluint64 counter_packets_send, errors, counter_0bytes;
ppluint64 counter_bytes_send;
ppluint64 counter_errorcodes[255];
unsigned int spoofing_net_start;
unsigned int spoofing_net_size;
int runtime;
int timeout;
int DnssecRate;
int dnsseccounter;
double Timeslice;
double duration;
bool spoofingEnabled;
bool verbose;
bool payloadIsPcap;
bool spoofingFromPcap;
void sendPacket();
void waitForTimeout();
bool socketReady();
void runWithoutRateLimit();
void runWithRateLimit();
public:
DNSSenderThread();
~DNSSenderThread();
void setDestination(const ppl7::IPAddress& ip, int port);
void setSourceIP(const ppl7::IPAddress& ip);
void setSourceNet(const ppl7::IPNetwork& net);
void setSourcePcap();
void setRandomSource(const ppl7::IPNetwork& net);
void setRuntime(int seconds);
void setTimeout(int seconds);
void setDNSSECRate(int rate);
void setQueryRate(ppluint64 qps);
void setTimeslice(float ms);
void setVerbose(bool verbose);
void setPayload(PayloadFile& payload);
void run();
ppluint64 getPacketsSend() const;
ppluint64 getBytesSend() const;
ppluint64 getErrors() const;
ppluint64 getCounter0Bytes() const;
ppluint64 getCounterErrorCode(int err) const;
};
#endif

276
src/dnsmeter.1.in Normal file
View file

@ -0,0 +1,276 @@
.\" Copyright (c) 2019-2021, OARC, Inc.
.\" Copyright (c) 2019, DENIC eG
.\" All rights reserved.
.\"
.\" This file is part of dnsmeter.
.\"
.\" dnsmeter 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.
.\"
.\" dnsmeter 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 dnsmeter. If not, see <http://www.gnu.org/licenses/>.
.TH dnsmeter 1 "@PACKAGE_VERSION@" "dnsmeter"
.SH NAME
dnsmeter \- DNS performance and infrastructure testing
.SH SYNOPSIS
.hy 0
.ad l
\fBdnsmeter\fR\ [\fB\-h\fR]
[\fB\-q\ \fIHOST\fR]
[\fB\-s\ \fINET|pcap\fR]
[\fB\-e\ \fIETH\fR]
[\fB\-z\ \fIHOST:PORT\fR]
[\fB\-p\ \fIFILE\fR]
[\fB\-l\ \fI#\fR]
[\fB\-t\ \fI#\fR]
[\fB\-n\ \fI#\fR]
[\fB\-r\ \fI#\fR]
[\fB\-d\ \fI#\fR]
[\fB\-c\ \fIFILE\fR]
[\fB\--ignore\fR]
.ad
.hy
.SH DESCRIPTION
DNSMeter is a tool for testing performance of nameserver and/or
infrastructure around it.
It generates dns queries and sends them via UDP to a target nameserver
and counts the answers.
Features:
.br
- payload can be given as text file or PCAP file
.br
- can automatically run different load steps, which can be given as
list or ranges
.br
- results per load step can be stored in CSV file
.br
- sender address can be spoofed from a given network or from PCAP file,
if payload is a PCAP file
.br
- answers are counted, even if source address is spoofed, if answers get
routed back to the load generator
.br
- roundtrip-times are measured (average, min, mix)
.br
- amount of DNSSEC queries can be given as percentage of total traffic
.br
- optimized for high amount of packets. On an Intel(R) Xeon(R) CPU E5-2430
v2 @ 2.50GHz it can generate more than 900.000 packets per second
.SH OPTIONS
.TP
.B -h
Show option help.
.TP
.BI -q \ HOST
Hostname or IP address of sender if you don't want to spoof (see
.IR -s ).
.TP
.BI -s \ NET|pcap
Spoof sender address.
Use random IP from the given network (example:
.IR 192.168.0.0/16 ).
Only works when running as root!
If payload is a PCAP file, you can use
.BI -s pcap
to use the source addresses and ports from the PCAP file.
.TP
.BI -e \ ETH
Interface on which the packet receiver should listen (FreeBSD only).
.TP
.BI -z \ HOST:PORT
Hostname or IP address and port of the target nameserver.
.TP
.BI -p \ FILE
File with queries/payload or PCAP file.
.TP
.BI -l \ #
Runtime in seconds (default=10 seconds).
.TP
.BI -t \ #
Timeout in seconds (default=2 seconds).
.TP
.BI -n \ #
Number of worker threads (default=1).
.TP
.BI -r \ #
Query rate (Default=as much as possible) can be a single value, a comma
separated list (rate,rate,...) or a range and a step value (start - end,
step).
.TP
.BI -d \ #
Amount of queries in percent on which the DNSSEC-flags are set (default=0).
.TP
.BI -c \ FILE
CSV-file for results.
.TP
.B --ignore
Answers are ignored and therefor not counted.
In this mode the tool only generates traffic.
.SH USAGE
This section contains additional usage information not covered by
the options documentation.
.BI -q \ HOST
|
.BI -s \ NETWORK
|
.BI -s \ pcap
Source IP, hostname or network from which the packets should be send.
If you dont't want to spoof, use
.I -q
with a single IP address or hostname.
Use
.I -s
followed by a network, if you want to spoof the source address.
.B dnsmeter
will generated random IP addresses inside this network.
Example:
.B -s
.IR 10.0.0.0/8 .
If payload is a PCAP file, you can use the source addresses and ports
from the PCAP file, if you use
.B -s
.IR pcap .
.BI -e \ ETH
Ignored on Linux, but on FreeBSD you have to enter the name of the
network interface on which the tool should listen for the answers.
.BI -p \ FILE
File with payload in text format or PCAP file.
When using a text format each line must contain one query with name
and record type.
Example:
www.denic.de A
denic.de NS
...
.IR NOTE :
the file should not be too big, because it is completely
loaded into memory and pre-compiled to DNS query packets.
.BI -n \ #
Number of worker threads, recommendation:
.br
- less than 200000 packets per second: 1 Thread
.br
- 200000 - 500000 packets per second: 2 Threads
.br
- more than 500000 packets per second: 4 Threads
.BI NOTE :
this is CPU dependent!
If you have a fast CPU, you may need lesser threads, on a slow CPU you
may need more threads.
Don't use more threads than cores available on your CPU, minus one!
.BI -r \ #[,#,#]
Query rate or load steps.
Can be a single value if you want to test a specific query rate, a comma
separated list or a range with step with.
Examples:
.br
- Single value: -r 100000
.br
- a list of query rates: -r 10000,20000,30000,40000,50000,60000
.br
- a range with step: -r 10000-200000,10000
.BI -d \ #
Amount of DNSSEC queries in percentage between 0 and 100.
Is ignored, if using PCAP file as payload.
.BI -c \ FILENAME
Filename for results in CSV format.
.BI NOTE :
if file exists, results are appended!
.SH EXAMPLE
Lets assume the following scenario:
.br
- load generator runs on FreeBSD
.br
- network interface an which the traffic goes out and comes back is "igb0"
.br
- source ip on the load generator is 192.168.155.20
.br
- target nameserver has ip 192.168.0.1, port 53
.br
- we want to spoof the sender address from the network 10.0.0.0/8
.br
- the payload file is found here: /home/testdata/payload.txt
.br
- the nameserver is running on CentOS and we need to set a route back to the load generator:
.br
ip route add 10.0.0.0/8 via 192.168.155.20
.br
- we want to test the following load steps: 30000,40000,45000,50000,100000,150000
.br
- results should be written to results.csv
.br
- DNSSEC rate should be 70%
This makes the following command:
dnsmeter -p /home/testdata/payload.txt \\
-r 30000,40000,45000,50000,100000,150000 \\
-s 10.0.0.0/8 \\
-z 192.168.0.1:53 \\
-e igb0 \\
-d 70 \\
-c results.csv
In the second example, we want to use a PCAP file as payload and want
to spoof with the addresses from that file:
dnsmeter -p /home/testdata/pcap.file1 \\
-r 30000,40000,45000,50000,100000,150000 \\
-s pcap \\
-z 192.168.0.1:53 \\
-e igb0 \\
-c results_pcap.csv
.SH AUTHOR
Patrick Fedick
.RI ( https://github.com/pfedick )
.LP
Maintained by DNS-OARC
.LP
.RS
.I https://www.dns-oarc.net/
.RE
.LP
.SH BUGS
For issues and feature requests please use:
.LP
.RS
\fI@PACKAGE_URL@\fP
.RE
.LP
For question and help please use:
.LP
.RS
\fI@PACKAGE_BUGREPORT@\fP
.RE
.LP

39
src/exceptions.h Normal file
View file

@ -0,0 +1,39 @@
/*
* Copyright (c) 2019-2021, OARC, Inc.
* Copyright (c) 2019, DENIC eG
* All rights reserved.
*
* This file is part of dnsmeter.
*
* dnsmeter 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.
*
* dnsmeter 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 dnsmeter. If not, see <http://www.gnu.org/licenses/>.
*/
#include <ppl7.h>
#ifndef __dnsmeter_exceptions_h
#define __dnsmeter_exceptions_h
PPL7EXCEPTION(MissingCommandlineParameter, Exception);
PPL7EXCEPTION(InvalidCommandlineParameter, Exception);
PPL7EXCEPTION(InvalidDNSQuery, Exception);
PPL7EXCEPTION(UnknownRRType, Exception);
PPL7EXCEPTION(BufferOverflow, Exception);
PPL7EXCEPTION(UnknownDestination, Exception);
PPL7EXCEPTION(InvalidQueryFile, Exception);
PPL7EXCEPTION(UnsupportedIPFamily, Exception);
PPL7EXCEPTION(FailedToInitializePacketfilter, Exception);
PPL7EXCEPTION(KernelAccessFailed, Exception);
PPL7EXCEPTION(SystemCallFailed, Exception);
#endif

40
src/main.cpp Normal file
View file

@ -0,0 +1,40 @@
/*
* Copyright (c) 2019-2021, OARC, Inc.
* Copyright (c) 2019, DENIC eG
* All rights reserved.
*
* This file is part of dnsmeter.
*
* dnsmeter 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.
*
* dnsmeter 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 dnsmeter. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include "dns_sender.h"
#include <unistd.h>
#include <netinet/in.h>
#include <resolv.h>
int main(int argc, char** argv)
{
res_init();
// For unknown reason, res_mkquery is much slower (factor 3) when not
// setting the following options:
_res.options |= RES_USE_EDNS0;
_res.options |= RES_USE_DNSSEC;
DNSSender Sender;
return Sender.main(argc, argv);
}

220
src/packet.cpp Normal file
View file

@ -0,0 +1,220 @@
/*
* Copyright (c) 2019-2021, OARC, Inc.
* Copyright (c) 2019, DENIC eG
* All rights reserved.
*
* This file is part of dnsmeter.
*
* dnsmeter 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.
*
* dnsmeter 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 dnsmeter. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include "packet.h"
#include "exceptions.h"
#include "query.h"
#define __FAVOR_BSD 1
#include <netinet/in.h>
#include <string.h>
#include <netinet/ip.h>
#include <netinet/udp.h>
#include <math.h>
#define USZ sizeof(struct udphdr)
#define ISZ sizeof(struct ip)
#define HDRSZ ISZ + USZ
#define MAXPACKETSIZE 4096
static unsigned short in_cksum(unsigned short* addr, int len)
{
int nleft = len;
unsigned short* w = addr;
int sum = 0;
unsigned short answer = 0;
while (nleft > 1) {
sum += *w++;
nleft -= 2;
}
if (nleft == 1) {
*(unsigned char*)(&answer) = *(unsigned char*)w;
sum += answer;
}
sum = (sum >> 16) + (sum & 0xffff);
sum += (sum >> 16);
answer = ~sum;
return (answer);
}
static unsigned short udp_cksum(const struct ip* iphdr, const struct udphdr* udp, const unsigned char* payload, size_t payload_size)
{
unsigned char cbuf[MAXPACKETSIZE];
memset(cbuf, 0, sizeof(cbuf));
unsigned char* p = (unsigned char*)cbuf;
*(unsigned int*)p = iphdr->ip_src.s_addr;
p += sizeof(unsigned int);
*(unsigned int*)p = iphdr->ip_dst.s_addr;
p += sizeof(unsigned int);
*(unsigned char*)p++ = 0;
*(unsigned char*)p++ = iphdr->ip_p;
*(unsigned short*)p = udp->uh_ulen;
p += sizeof(unsigned short);
memcpy(p, udp, USZ);
p += USZ;
memcpy(p, payload, payload_size);
return in_cksum((unsigned short*)cbuf, sizeof(uint) * 3 + sizeof(struct udphdr) + payload_size + (payload_size % 2));
}
Packet::Packet()
{
buffersize = MAXPACKETSIZE;
payload_size = 0;
buffer = (unsigned char*)calloc(1, buffersize);
if (!buffer)
throw ppl7::OutOfMemoryException();
struct ip* iphdr = (struct ip*)buffer;
struct udphdr* udp = (struct udphdr*)(buffer + ISZ);
iphdr->ip_hl = ISZ >> 2;
iphdr->ip_v = IPVERSION;
iphdr->ip_tos = 0;
iphdr->ip_off = 0;
iphdr->ip_ttl = 64;
iphdr->ip_p = IPPROTO_UDP;
iphdr->ip_sum = 0;
iphdr->ip_id = 0;
iphdr->ip_src.s_addr = 0;
iphdr->ip_dst.s_addr = 0;
iphdr->ip_len = htons(HDRSZ + payload_size);
iphdr->ip_sum = in_cksum((unsigned short*)iphdr, ISZ);
udp->uh_ulen = htons(USZ + payload_size);
chksum_valid = false;
}
Packet::~Packet()
{
free(buffer);
}
void Packet::setSource(const ppl7::IPAddress& ip_addr, int port)
{
struct ip* iphdr = (struct ip*)buffer;
struct udphdr* udp = (struct udphdr*)(buffer + ISZ);
iphdr->ip_src.s_addr = *(in_addr_t*)ip_addr.addr();
udp->uh_sport = htons(port);
chksum_valid = false;
}
void Packet::randomSourcePort()
{
struct udphdr* udp = (struct udphdr*)(buffer + ISZ);
udp->uh_sport = htons(ppl7::rand(1024, 65535));
chksum_valid = false;
}
void Packet::randomSourceIP(const ppl7::IPNetwork& net)
{
struct ip* iphdr = (struct ip*)buffer;
in_addr_t start = ntohl(*(in_addr_t*)net.first().addr());
size_t size = powl(2, 32 - net.prefixlen());
iphdr->ip_src.s_addr = htonl(ppl7::rand(start, start + size - 1));
chksum_valid = false;
}
void Packet::randomSourceIP(unsigned int start, unsigned int size)
{
struct ip* iphdr = (struct ip*)buffer;
iphdr->ip_src.s_addr = htonl(ppl7::rand(start, start + size - 1));
chksum_valid = false;
}
void Packet::useSourceFromPcap(const char* pkt, size_t size)
{
const struct ip* s_iphdr = (const struct ip*)(pkt + 14);
const struct udphdr* s_udp = (const struct udphdr*)(pkt + 14 + sizeof(struct ip));
struct ip* iphdr = (struct ip*)buffer;
struct udphdr* udp = (struct udphdr*)(buffer + ISZ);
iphdr->ip_src.s_addr = s_iphdr->ip_src.s_addr;
udp->uh_sport = s_udp->uh_sport;
}
void Packet::setDestination(const ppl7::IPAddress& ip_addr, int port)
{
struct ip* iphdr = (struct ip*)buffer;
struct udphdr* udp = (struct udphdr*)(buffer + ISZ);
iphdr->ip_dst.s_addr = *(in_addr_t*)ip_addr.addr();
udp->uh_dport = htons(port);
chksum_valid = false;
}
void Packet::setIpId(unsigned short id)
{
struct ip* iphdr = (struct ip*)buffer;
iphdr->ip_id = htons(id);
chksum_valid = false;
}
void Packet::setDnsId(unsigned short id)
{
*((unsigned short*)(buffer + HDRSZ)) = htons(id);
chksum_valid = false;
}
void Packet::setPayload(const void* payload, size_t size)
{
if (size + HDRSZ > MAXPACKETSIZE)
throw BufferOverflow("%zd > %zd", size, MAXPACKETSIZE - HDRSZ);
memcpy(buffer + HDRSZ, payload, size);
payload_size = size;
struct ip* iphdr = (struct ip*)buffer;
struct udphdr* udp = (struct udphdr*)(buffer + ISZ);
iphdr->ip_len = htons(HDRSZ + payload_size);
udp->uh_ulen = htons(USZ + payload_size);
chksum_valid = false;
}
void Packet::setPayloadDNSQuery(const ppl7::String& query, bool dnssec)
{
payload_size = MakeQuery(query, buffer + HDRSZ, buffersize - HDRSZ, dnssec);
struct ip* iphdr = (struct ip*)buffer;
struct udphdr* udp = (struct udphdr*)(buffer + ISZ);
iphdr->ip_len = htons(HDRSZ + payload_size);
udp->uh_ulen = htons(USZ + payload_size);
chksum_valid = false;
}
void Packet::updateChecksums()
{
struct ip* iphdr = (struct ip*)buffer;
struct udphdr* udp = (struct udphdr*)(buffer + ISZ);
iphdr->ip_sum = 0;
iphdr->ip_sum = in_cksum((unsigned short*)iphdr, ISZ);
udp->uh_sum = 0;
udp->uh_sum = udp_cksum(iphdr, udp, buffer + HDRSZ, payload_size);
chksum_valid = true;
}
size_t Packet::size() const
{
return HDRSZ + payload_size;
}
unsigned char* Packet::ptr()
{
if (!chksum_valid)
updateChecksums();
return buffer;
}

62
src/packet.h Normal file
View file

@ -0,0 +1,62 @@
/*
* Copyright (c) 2019-2021, OARC, Inc.
* Copyright (c) 2019, DENIC eG
* All rights reserved.
*
* This file is part of dnsmeter.
*
* dnsmeter 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.
*
* dnsmeter 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 dnsmeter. If not, see <http://www.gnu.org/licenses/>.
*/
#include <ppl7.h>
#include <ppl7-inet.h>
#ifndef __dnsmeter_packet_h
#define __dnsmeter_packet_h
class Packet {
private:
#if defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L
Packet& operator=(const Packet& other);
Packet(Packet &&other) noexcept;
Packet const & operator=(Packet &&other);
#endif
unsigned char* buffer;
int buffersize;
int payload_size;
bool chksum_valid;
void updateChecksums();
public:
Packet();
~Packet();
void setSource(const ppl7::IPAddress& ip_addr, int port);
void setDestination(const ppl7::IPAddress& ip_addr, int port);
void setPayload(const void* payload, size_t size);
void setPayloadDNSQuery(const ppl7::String& query, bool dnssec = false);
void setDnsId(unsigned short id);
void setIpId(unsigned short id);
void randomSourceIP(const ppl7::IPNetwork& net);
void randomSourceIP(unsigned int start, unsigned int size);
void randomSourcePort();
void useSourceFromPcap(const char* pkt, size_t size);
size_t size() const;
unsigned char* ptr();
};
#endif

172
src/payload_file.cpp Normal file
View file

@ -0,0 +1,172 @@
/*
* Copyright (c) 2019-2021, OARC, Inc.
* Copyright (c) 2019, DENIC eG
* All rights reserved.
*
* This file is part of dnsmeter.
*
* dnsmeter 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.
*
* dnsmeter 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 dnsmeter. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include "payload_file.h"
#include "exceptions.h"
#include "query.h"
#define __FAVOR_BSD 1
#include <netinet/in.h>
#include <arpa/inet.h>
#include <pcap/pcap.h>
#include <netinet/ip.h>
#include <netinet/udp.h>
#pragma pack(push) /* push current alignment to stack */
#pragma pack(1) /* set alignment to 1 byte boundary */
struct ETHER {
unsigned char destination[6];
unsigned char source[6];
unsigned short type;
};
#pragma pack(pop) /* restore original alignment from stack */
PayloadFile::PayloadFile()
{
validLinesInQueryFile = 0;
payloadIsPcap = false;
}
bool PayloadFile::detectPcap(ppl7::File& ff)
{
unsigned char buffer[8];
if (ff.read(buffer, 8) != 8) {
ff.seek(0);
return false;
}
ff.seek(0);
unsigned int magic = ppl7::Peek32(buffer + 0);
if (magic == 0xa1b2c3d4 || magic == 0xa1b23c4d)
return true;
if (magic == 0xd4c3b2a1 || magic == 0x4d3cb2a1)
return true;
return false;
}
void PayloadFile::openQueryFile(const ppl7::String& Filename)
{
if (Filename.isEmpty())
throw InvalidQueryFile("File not given");
ppl7::File QueryFile;
QueryFile.open(Filename, ppl7::File::READ);
if (QueryFile.size() == 0) {
throw InvalidQueryFile("File is empty [%s]", (const char*)Filename);
}
printf("INFO: Loading and precompile payload. This could take some time...\n");
if (detectPcap(QueryFile)) {
loadAndCompilePcapFile(Filename);
} else {
loadAndCompile(QueryFile);
}
printf("INFO: %llu queries loaded\n", validLinesInQueryFile);
it = querycache.begin();
}
void PayloadFile::loadAndCompile(ppl7::File& ff)
{
ppl7::ByteArray buf(4096);
ppl7::String buffer;
validLinesInQueryFile = 0;
unsigned char* compiled_query = (unsigned char*)buf.ptr();
while (1) {
try {
if (ff.eof())
throw ppl7::EndOfFileException();
ff.gets(buffer, 1024);
buffer.trim();
if (buffer.isEmpty())
continue;
if (buffer.c_str()[0] == '#')
continue;
try {
// Precompile Query
int size = MakeQuery(buffer, compiled_query, 4096, false);
querycache.push_back(ppl7::ByteArray(compiled_query, size));
validLinesInQueryFile++;
} catch (...) {
// ignore invalid queries
continue;
}
} catch (const ppl7::EndOfFileException&) {
if (validLinesInQueryFile == 0) {
throw InvalidQueryFile("No valid Queries found in Queryfile");
}
return;
}
}
}
void PayloadFile::loadAndCompilePcapFile(const ppl7::String& Filename)
{
char errorbuffer[PCAP_ERRBUF_SIZE];
struct pcap_pkthdr hdr;
payloadIsPcap = true;
validLinesInQueryFile = 0;
pcap_t* pp = pcap_open_offline((const char*)Filename, errorbuffer);
if (!pp)
throw InvalidQueryFile("%s", errorbuffer);
ppluint64 pkts_total = 0;
const u_char* pkt;
while ((pkt = pcap_next(pp, &hdr)) != NULL) {
pkts_total++;
//printf ("len=%d, caplen=%d\n",hdr.len,hdr.caplen);
const struct ETHER* eth = (const struct ETHER*)pkt;
if (hdr.caplen > 4096)
continue;
if (eth->type != htons(0x0800))
continue;
const struct ip* iphdr = (const struct ip*)(pkt + 14);
if (iphdr->ip_v != 4)
continue;
const struct udphdr* udp = (const struct udphdr*)(pkt + 14 + sizeof(struct ip));
if (udp->uh_dport != htons(53))
continue;
const struct DNS_HEADER* dns = (const struct DNS_HEADER*)(pkt + 14 + sizeof(struct ip) + sizeof(struct udphdr));
if (dns->qr != 0 || dns->opcode != 0)
continue;
querycache.push_back(ppl7::ByteArray(pkt, hdr.caplen));
validLinesInQueryFile++;
}
printf("Packets read from pcap file: %llu, valid UDP DNS queries: %llu\n",
pkts_total, validLinesInQueryFile);
pcap_close(pp);
if (validLinesInQueryFile == 0) {
throw InvalidQueryFile("No valid Queries found in pcap file [%s]", (const char*)Filename);
}
}
const ppl7::ByteArrayPtr& PayloadFile::getQuery()
{
QueryMutex.lock();
const ppl7::ByteArrayPtr& bap = *it;
++it;
if (it == querycache.end())
it = querycache.begin();
QueryMutex.unlock();
return bap;
}
bool PayloadFile::isPcap()
{
return payloadIsPcap;
}

46
src/payload_file.h Normal file
View file

@ -0,0 +1,46 @@
/*
* Copyright (c) 2019-2021, OARC, Inc.
* Copyright (c) 2019, DENIC eG
* All rights reserved.
*
* This file is part of dnsmeter.
*
* dnsmeter 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.
*
* dnsmeter 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 dnsmeter. If not, see <http://www.gnu.org/licenses/>.
*/
#include <ppl7.h>
#include <list>
#ifndef __dnsmeter_payload_file_h
#define __dnsmeter_payload_file_h
class PayloadFile {
private:
ppl7::Mutex QueryMutex;
ppluint64 validLinesInQueryFile;
std::list<ppl7::ByteArray> querycache;
std::list<ppl7::ByteArray>::const_iterator it;
bool payloadIsPcap;
bool detectPcap(ppl7::File& ff);
void loadAndCompile(ppl7::File& ff);
void loadAndCompilePcapFile(const ppl7::String& Filename);
public:
PayloadFile();
void openQueryFile(const ppl7::String& Filename);
const ppl7::ByteArrayPtr& getQuery();
bool isPcap();
};
#endif

409
src/pplib/.cproject Normal file
View file

@ -0,0 +1,409 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?><cproject>
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="converted.config.93810054">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="converted.config.93810054" moduleId="org.eclipse.cdt.core.settings" name="Configuration1">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.nullindexer" point="org.eclipse.cdt.core.CIndexer"/>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.VCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.MakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings">
<doc-comment-owner id="org.eclipse.cdt.ui.doxygen">
<path value=""/>
</doc-comment-owner>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactName="PPL7 - SVN" buildProperties="" description="" errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GASErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.VCErrorParser" id="converted.config.93810054" name="Configuration1" parent="org.eclipse.cdt.build.core.prefbase.cfg">
<folderInfo id="converted.config.93810054." name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.llvm.clang.linux.base.1587122097" name="LLVM with Clang (Linux)" superClass="cdt.managedbuild.toolchain.llvm.clang.linux.base">
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.target.llvm.platform.base.619710203" isAbstract="true" name="Debug Platform" osList="linux,hpux,aix,qnx" superClass="cdt.managedbuild.target.llvm.platform.base"/>
<builder appendEnvironment="true" buildPath="${workspace_loc:/PPL7}/Configuration1" environment="" id="cdt.managedbuild.target.llvm.builder.base.1137982095" keepEnvironmentInBuildfile="false" name="CDT Internal Builder" superClass="cdt.managedbuild.target.llvm.builder.base"/>
<tool id="cdt.managedbuild.tool.llvm.assembler.base.1992323027" name="LLVM assembler" superClass="cdt.managedbuild.tool.llvm.assembler.base"/>
<tool id="cdt.managedbuild.tool.llvm.archiver.base.51186090" name="LLVM archiver" superClass="cdt.managedbuild.tool.llvm.archiver.base"/>
<tool id="cdt.managedbuild.tool.llvm.c.compiler.base.1733591885" name="LLVM Clang" superClass="cdt.managedbuild.tool.llvm.c.compiler.base">
<option id="llvm.c_cpp.compiler.option.include.paths.468219924" name="Include paths (-I)" superClass="llvm.c_cpp.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;C:\jenkins\local\include&quot;"/>
<listOptionValue builtIn="false" value="/usr/local/gtest-1.7.0/include"/>
<listOptionValue builtIn="false" value="/usr/include"/>
</option>
<option id="llvm.c_cpp.compiler.option.preprocessor.def.1358268360" name="Defined symbols (-D)" superClass="llvm.c_cpp.compiler.option.preprocessor.def" valueType="definedSymbols">
<listOptionValue builtIn="false" value="PPL7LIB=1"/>
<listOptionValue builtIn="false" value="HAVE_CONFIG_H=1"/>
</option>
<inputType id="cdt.managedbuild.tool.llvm.c.compiler.input.1849789181" superClass="cdt.managedbuild.tool.llvm.c.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.llvm.cpp.compiler.base.375125671" name="LLVM Clang++" superClass="cdt.managedbuild.tool.llvm.cpp.compiler.base">
<option id="llvm.c_cpp.compiler.option.include.paths.614324950" name="Include paths (-I)" superClass="llvm.c_cpp.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="/msys64/usr/include"/>
<listOptionValue builtIn="false" value="/msys64/mingw64/include/SDL2"/>
<listOptionValue builtIn="false" value="/jenkins/include"/>
<listOptionValue builtIn="false" value="/msys64/usr/local/gtest-1.7.0/include"/>
<listOptionValue builtIn="false" value="/usr/local/gtest-1.7.0/include"/>
<listOptionValue builtIn="false" value="/usr/local/llvm60/include"/>
<listOptionValue builtIn="false" value="/usr/include"/>
</option>
<option id="llvm.c_cpp.compiler.option.preprocessor.def.918920336" name="Defined symbols (-D)" superClass="llvm.c_cpp.compiler.option.preprocessor.def" valueType="definedSymbols">
<listOptionValue builtIn="false" value="PPL7LIB=1"/>
<listOptionValue builtIn="false" value="HAVE_CONFIG_H=1"/>
</option>
<inputType id="cdt.managedbuild.tool.llvm.cpp.compiler.input.1520616570" superClass="cdt.managedbuild.tool.llvm.cpp.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.llvm.c.linker.base.655509769" name="LLVM Clang C linker" superClass="cdt.managedbuild.tool.llvm.c.linker.base"/>
<tool id="cdt.managedbuild.tool.llvm.cpp.linker.base.2055298512" name="LLVM Clang C++ linker" superClass="cdt.managedbuild.tool.llvm.cpp.linker.base">
<inputType id="cdt.managedbuild.tool.llvm.c.linker.input.2047286980" superClass="cdt.managedbuild.tool.llvm.c.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
</inputType>
</tool>
</toolChain>
</folderInfo>
</configuration>
</storageModule>
</cconfiguration>
</storageModule>
<storageModule moduleId="refreshScope" versionNumber="2">
<configuration configurationName="Configuration1">
<resource resourceType="PROJECT" workspacePath="/PPL7 - SVN"/>
</configuration>
<configuration configurationName="convertedConfig">
<resource resourceType="PROJECT" workspacePath="/PPL7 - SVN"/>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
<storageModule moduleId="org.eclipse.cdt.core.pathentry">
<pathentry kind="mac" name="PPL7LIB" path="" value="1"/>
<pathentry base-path="PPL7 - SVN" include="include" kind="inc" path="" system="true"/>
<pathentry kind="out" path=""/>
<pathentry kind="con" path="org.eclipse.cdt.make.core.DISCOVERED_SCANNER_INFO"/>
<pathentry kind="src" path=""/>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="PPL7 - SVN.null.400560975" name="PPL7 - SVN"/>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets">
<buildTargets>
<target name="debug" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments>-j6</buildArguments>
<buildTarget>install_debug</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
</buildTargets>
</storageModule>
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
<buildOutputProvider>
<openAction enabled="false" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="makefileGenerator">
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
<parser enabled="false"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="false" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="false"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="false" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="false"/>
</scannerInfoProvider>
</profile>
<scannerConfigBuildInfo instanceId="converted.config.93810054;converted.config.93810054.;org.eclipse.linuxtools.cdt.autotools.core.toolchain.tool.gpp.759528567;cdt.managedbuild.tool.gnu.cpp.compiler.input.444355472">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
<buildOutputProvider>
<openAction enabled="false" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="makefileGenerator">
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
<parser enabled="false"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="false" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="false"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="false" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="false"/>
</scannerInfoProvider>
</profile>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="converted.config.93810054;converted.config.93810054.;org.eclipse.linuxtools.cdt.autotools.core.toolchain.tool.gpp.1774392251;cdt.managedbuild.tool.gnu.cpp.compiler.input.354986712">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
<buildOutputProvider>
<openAction enabled="false" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="makefileGenerator">
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
<parser enabled="false"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="false" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="false"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="false" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="false"/>
</scannerInfoProvider>
</profile>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="converted.config.93810054;converted.config.93810054.;org.eclipse.linuxtools.cdt.autotools.core.toolchain.tool.gpp.1206095395;cdt.managedbuild.tool.gnu.cpp.compiler.input.1419406729">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
<buildOutputProvider>
<openAction enabled="false" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="makefileGenerator">
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
<parser enabled="false"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="false" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="false"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="false" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="false"/>
</scannerInfoProvider>
</profile>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="converted.config.93810054;converted.config.93810054.;org.eclipse.linuxtools.cdt.autotools.core.toolchain.tool.gcc.389611427;cdt.managedbuild.tool.gnu.c.compiler.input.1460018740">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
<buildOutputProvider>
<openAction enabled="false" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="makefileGenerator">
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
<parser enabled="false"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="false" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="false"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="false" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="false"/>
</scannerInfoProvider>
</profile>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="converted.config.93810054">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="converted.config.93810054;converted.config.93810054.;org.eclipse.linuxtools.cdt.autotools.core.toolchain.tool.gcc.882322743;cdt.managedbuild.tool.gnu.c.compiler.input.1930661638">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
<buildOutputProvider>
<openAction enabled="false" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="makefileGenerator">
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
<parser enabled="false"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="false" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="false"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="false" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="false"/>
</scannerInfoProvider>
</profile>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="converted.config.93810054;converted.config.93810054.;org.eclipse.linuxtools.cdt.autotools.core.toolchain.tool.gcc.1348013222;cdt.managedbuild.tool.gnu.c.compiler.input.322443003">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
<buildOutputProvider>
<openAction enabled="false" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="makefileGenerator">
<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
<parser enabled="false"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="false" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="false"/>
</scannerInfoProvider>
</profile>
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
<buildOutputProvider>
<openAction enabled="false" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
<parser enabled="false"/>
</scannerInfoProvider>
</profile>
</scannerConfigBuildInfo>
</storageModule>
</cproject>

16
src/pplib/.gitignore vendored Normal file
View file

@ -0,0 +1,16 @@
/debug/
/release/
/config.log
/config.status
/Makefile
/ppl7-config
/autom4te.cache
/PPL7.config
/PPL7.creator
/PPL7.creator.user
/PPL7.files
/PPL7.includes
/x64/
/documentation/
/.settings/
.vscode/

93
src/pplib/.project Normal file
View file

@ -0,0 +1,93 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>PPL7</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers>
<arguments>
<dictionary>
<key>?name?</key>
<value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.append_environment</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.autoBuildTarget</key>
<value>install_debug</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildArguments</key>
<value>-j1</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildCommand</key>
<value>make</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildLocation</key>
<value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
<value>clean</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.contents</key>
<value>org.eclipse.cdt.make.core.activeConfigSettings</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableFullBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.environment</key>
<value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.fullBuildTarget</key>
<value>install_debug</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.stopOnError</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
<value>true</value>
</dictionary>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.cdt.core.ccnature</nature>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
</natures>
</projectDescription>

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project>
<configuration id="converted.config.93810054" name="Configuration1">
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider copy-of="extension" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
</extension>
</configuration>
</project>

View file

@ -0,0 +1,73 @@
eclipse.preferences.version=1
org.eclipse.cdt.codan.checkers.errnoreturn=Warning
org.eclipse.cdt.codan.checkers.errnoreturn.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"No return\\")",implicit\=>false}
org.eclipse.cdt.codan.checkers.errreturnvalue=Error
org.eclipse.cdt.codan.checkers.errreturnvalue.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Unused return value\\")"}
org.eclipse.cdt.codan.checkers.nocommentinside=-Error
org.eclipse.cdt.codan.checkers.nocommentinside.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Nesting comments\\")"}
org.eclipse.cdt.codan.checkers.nolinecomment=-Error
org.eclipse.cdt.codan.checkers.nolinecomment.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Line comments\\")"}
org.eclipse.cdt.codan.checkers.noreturn=Error
org.eclipse.cdt.codan.checkers.noreturn.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"No return value\\")",implicit\=>false}
org.eclipse.cdt.codan.internal.checkers.AbstractClassCreation=Error
org.eclipse.cdt.codan.internal.checkers.AbstractClassCreation.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Abstract class cannot be instantiated\\")"}
org.eclipse.cdt.codan.internal.checkers.AmbiguousProblem=Error
org.eclipse.cdt.codan.internal.checkers.AmbiguousProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Ambiguous problem\\")"}
org.eclipse.cdt.codan.internal.checkers.AssignmentInConditionProblem=Warning
org.eclipse.cdt.codan.internal.checkers.AssignmentInConditionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Assignment in condition\\")"}
org.eclipse.cdt.codan.internal.checkers.AssignmentToItselfProblem=Error
org.eclipse.cdt.codan.internal.checkers.AssignmentToItselfProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Assignment to itself\\")"}
org.eclipse.cdt.codan.internal.checkers.CaseBreakProblem=Warning
org.eclipse.cdt.codan.internal.checkers.CaseBreakProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"No break at end of case\\")",no_break_comment\=>"no break",last_case_param\=>false,empty_case_param\=>false}
org.eclipse.cdt.codan.internal.checkers.CatchByReference=Warning
org.eclipse.cdt.codan.internal.checkers.CatchByReference.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Catching by reference is recommended\\")",unknown\=>false,exceptions\=>()}
org.eclipse.cdt.codan.internal.checkers.CircularReferenceProblem=Error
org.eclipse.cdt.codan.internal.checkers.CircularReferenceProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Circular inheritance\\")"}
org.eclipse.cdt.codan.internal.checkers.ClassMembersInitialization=Warning
org.eclipse.cdt.codan.internal.checkers.ClassMembersInitialization.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Class members should be properly initialized\\")",skip\=>true}
org.eclipse.cdt.codan.internal.checkers.FieldResolutionProblem=Error
org.eclipse.cdt.codan.internal.checkers.FieldResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Field cannot be resolved\\")"}
org.eclipse.cdt.codan.internal.checkers.FunctionResolutionProblem=Error
org.eclipse.cdt.codan.internal.checkers.FunctionResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Function cannot be resolved\\")"}
org.eclipse.cdt.codan.internal.checkers.InvalidArguments=Error
org.eclipse.cdt.codan.internal.checkers.InvalidArguments.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Invalid arguments\\")"}
org.eclipse.cdt.codan.internal.checkers.InvalidTemplateArgumentsProblem=Error
org.eclipse.cdt.codan.internal.checkers.InvalidTemplateArgumentsProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Invalid template argument\\")"}
org.eclipse.cdt.codan.internal.checkers.LabelStatementNotFoundProblem=Error
org.eclipse.cdt.codan.internal.checkers.LabelStatementNotFoundProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Label statement not found\\")"}
org.eclipse.cdt.codan.internal.checkers.MemberDeclarationNotFoundProblem=Error
org.eclipse.cdt.codan.internal.checkers.MemberDeclarationNotFoundProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Member declaration not found\\")"}
org.eclipse.cdt.codan.internal.checkers.MethodResolutionProblem=Error
org.eclipse.cdt.codan.internal.checkers.MethodResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Method cannot be resolved\\")"}
org.eclipse.cdt.codan.internal.checkers.NamingConventionFunctionChecker=-Info
org.eclipse.cdt.codan.internal.checkers.NamingConventionFunctionChecker.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Name convention for function\\")",pattern\=>"^[a-z]",macro\=>true,exceptions\=>()}
org.eclipse.cdt.codan.internal.checkers.NonVirtualDestructorProblem=Warning
org.eclipse.cdt.codan.internal.checkers.NonVirtualDestructorProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Class has a virtual method and non-virtual destructor\\")"}
org.eclipse.cdt.codan.internal.checkers.OverloadProblem=Error
org.eclipse.cdt.codan.internal.checkers.OverloadProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Invalid overload\\")"}
org.eclipse.cdt.codan.internal.checkers.RedeclarationProblem=Error
org.eclipse.cdt.codan.internal.checkers.RedeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Invalid redeclaration\\")"}
org.eclipse.cdt.codan.internal.checkers.RedefinitionProblem=Error
org.eclipse.cdt.codan.internal.checkers.RedefinitionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Invalid redefinition\\")"}
org.eclipse.cdt.codan.internal.checkers.ReturnStyleProblem=-Warning
org.eclipse.cdt.codan.internal.checkers.ReturnStyleProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Return with parenthesis\\")"}
org.eclipse.cdt.codan.internal.checkers.ScanfFormatStringSecurityProblem=Warning
org.eclipse.cdt.codan.internal.checkers.ScanfFormatStringSecurityProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Format String Vulnerability\\")"}
org.eclipse.cdt.codan.internal.checkers.StatementHasNoEffectProblem=Warning
org.eclipse.cdt.codan.internal.checkers.StatementHasNoEffectProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Statement has no effect\\")",macro\=>true,exceptions\=>()}
org.eclipse.cdt.codan.internal.checkers.SuggestedParenthesisProblem=Warning
org.eclipse.cdt.codan.internal.checkers.SuggestedParenthesisProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Suggested parenthesis around expression\\")",paramNot\=>false}
org.eclipse.cdt.codan.internal.checkers.SuspiciousSemicolonProblem=Warning
org.eclipse.cdt.codan.internal.checkers.SuspiciousSemicolonProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Suspicious semicolon\\")",else\=>false,afterelse\=>false}
org.eclipse.cdt.codan.internal.checkers.TypeResolutionProblem=Error
org.eclipse.cdt.codan.internal.checkers.TypeResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Type cannot be resolved\\")"}
org.eclipse.cdt.codan.internal.checkers.UnusedFunctionDeclarationProblem=Warning
org.eclipse.cdt.codan.internal.checkers.UnusedFunctionDeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Unused function declaration\\")",macro\=>true}
org.eclipse.cdt.codan.internal.checkers.UnusedStaticFunctionProblem=Warning
org.eclipse.cdt.codan.internal.checkers.UnusedStaticFunctionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Unused static function\\")",macro\=>true}
org.eclipse.cdt.codan.internal.checkers.UnusedVariableDeclarationProblem=Warning
org.eclipse.cdt.codan.internal.checkers.UnusedVariableDeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Unused variable declaration in file scope\\")",macro\=>true,exceptions\=>("@(\#)","$Id")}
org.eclipse.cdt.codan.internal.checkers.VariableResolutionProblem=Error
org.eclipse.cdt.codan.internal.checkers.VariableResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Symbol is not resolved\\")"}
org.eclipse.cdt.qt.core.qtproblem=Warning
org.eclipse.cdt.qt.core.qtproblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_ON_FILE_OPEN\=>true,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>null}

View file

@ -0,0 +1,3 @@
eclipse.preferences.version=1
encoding//src/core/File.cpp=UTF-8
encoding/<project>=UTF-8

View file

@ -0,0 +1,3 @@
#Sat Nov 03 10:37:37 CET 2012
eclipse.preferences.version=1
org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false

2507
src/pplib/Doxyfile Normal file

File diff suppressed because it is too large Load diff

1675
src/pplib/HISTORY.TXT Normal file

File diff suppressed because it is too large Load diff

22
src/pplib/LICENSE.TXT Normal file
View file

@ -0,0 +1,22 @@
Copyright (c) 2019, Patrick Fedick <patrick@pfp.de>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

2702
src/pplib/Makefile.in Normal file

File diff suppressed because it is too large Load diff

334
src/pplib/PPL7.vcxproj Normal file
View file

@ -0,0 +1,334 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>15.0</VCProjectVersion>
<ProjectGuid>{771F38E9-2735-4C7D-ABAC-2A1FAE923BD5}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>PPL7</RootNamespace>
<WindowsTargetPlatformVersion>10.0.14393.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<IncludePath>D:\jenkins\local\include;D:\jenkins\local\include\freetype2;include;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<IncludePath>D:\jenkins\local\include;D:\jenkins\local\include\freetype2;include;$(IncludePath)</IncludePath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>PPL7LIB;PPLVISUALC;_DEBUG;_LIB;PPL7LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
</Link>
<PostBuildEvent>
<Command>copy include\ppl7.h c:\local\include
copy include\ppl7-algorithms.h c:\local\include
copy include\ppl7-audio.h c:\local\include
copy include\ppl7-crypto.h c:\local\include
copy include\ppl7-db.h c:\local\include
copy include\ppl7-exceptions.h c:\local\include
copy include\ppl7-grafix.h c:\local\include
copy include\ppl7-inet.h c:\local\include
copy include\ppl7-tk.h c:\local\include
copy include\ppl7-types.h c:\local\include
copy include\ppl7-visualc-config.h c:\local\include\ppl7-config.h
copy "$(OutputPath)\PPL7.lib" c:\local\lib\ppl7_debug.lib
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>Use</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>Use</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>PPL7LIB;PPLVISUALC;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
<PostBuildEvent>
<Command>copy include\ppl7.h c:\local\include
copy include\ppl7-algorithms.h c:\local\include
copy include\ppl7-audio.h c:\local\include
copy include\ppl7-crypto.h c:\local\include
copy include\ppl7-db.h c:\local\include
copy include\ppl7-exceptions.h c:\local\include
copy include\ppl7-grafix.h c:\local\include
copy include\ppl7-inet.h c:\local\include
copy include\ppl7-tk.h c:\local\include
copy include\ppl7-types.h c:\local\include
copy include\ppl7-visualc-config.h c:\local\include\ppl7-config.h
copy "$(OutputPath)\PPL7.lib" c:\local\lib\ppl7.lib</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<Text Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="include\compat.h" />
<ClInclude Include="include\crypto.h" />
<ClInclude Include="include\ppl7-algorithms.h" />
<ClInclude Include="include\ppl7-audio.h" />
<ClInclude Include="include\ppl7-crypto.h" />
<ClInclude Include="include\ppl7-db.h" />
<ClInclude Include="include\ppl7-exceptions.h" />
<ClInclude Include="include\ppl7-grafix.h" />
<ClInclude Include="include\ppl7-inet.h" />
<ClInclude Include="include\ppl7-tk.h" />
<ClInclude Include="include\ppl7-types.h" />
<ClInclude Include="include\ppl7-visualc-config.h" />
<ClInclude Include="include\ppl7.h" />
<ClInclude Include="include\prolog.h" />
<ClInclude Include="include\socket.h" />
<ClInclude Include="include\threads.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\core\AVLTree.cpp" />
<ClCompile Include="src\core\Compat.cpp" />
<ClCompile Include="src\core\Compression.cpp" />
<ClCompile Include="src\core\ConfigParser.cpp" />
<ClCompile Include="src\core\cpu.cpp" />
<ClCompile Include="src\core\Dir.cpp" />
<ClCompile Include="src\core\DirEntry.cpp" />
<ClCompile Include="src\core\Exceptions.cpp" />
<ClCompile Include="src\core\File.cpp" />
<ClCompile Include="src\core\FileObject.cpp" />
<ClCompile Include="src\core\Functions.cpp" />
<ClCompile Include="src\core\GzFile.cpp" />
<ClCompile Include="src\core\Iconv.cpp" />
<ClCompile Include="src\core\Logger.cpp" />
<ClCompile Include="src\core\MemFile.cpp" />
<ClCompile Include="src\core\MemoryGroup.cpp" />
<ClCompile Include="src\core\MemoryHeap.cpp" />
<ClCompile Include="src\core\Mutex.cpp" />
<ClCompile Include="src\core\PerlHelper.cpp" />
<ClCompile Include="src\core\PFPFile.cpp" />
<ClCompile Include="src\core\Resource.cpp" />
<ClCompile Include="src\core\Resourcen.cpp" />
<ClCompile Include="src\core\Signal.cpp" />
<ClCompile Include="src\core\StringFunctions.cpp" />
<ClCompile Include="src\core\Threads.cpp" />
<ClCompile Include="src\core\Time.cpp" />
<ClCompile Include="src\grafix\Color.cpp" />
<ClCompile Include="src\grafix\Drawable.cpp" />
<ClCompile Include="src\grafix\DrawableBlit.cpp" />
<ClCompile Include="src\grafix\DrawableColor.cpp" />
<ClCompile Include="src\grafix\DrawableLines.cpp" />
<ClCompile Include="src\grafix\DrawablePixel.cpp" />
<ClCompile Include="src\grafix\DrawableShapes.cpp" />
<ClCompile Include="src\grafix\Font4.cpp" />
<ClCompile Include="src\grafix\Font5.cpp" />
<ClCompile Include="src\grafix\Font6.cpp" />
<ClCompile Include="src\grafix\FontFreeType.cpp" />
<ClCompile Include="src\grafix\Fonts.cpp" />
<ClCompile Include="src\grafix\Grafix.cpp" />
<ClCompile Include="src\grafix\Image.cpp" />
<ClCompile Include="src\grafix\ImageFilter.cpp" />
<ClCompile Include="src\grafix\ImageFilter_BMP.cpp" />
<ClCompile Include="src\grafix\ImageFilter_GIF.cpp" />
<ClCompile Include="src\grafix\ImageFilter_JPEG.cpp" />
<ClCompile Include="src\grafix\ImageFilter_PNG.cpp" />
<ClCompile Include="src\grafix\ImageFilter_PPM.cpp" />
<ClCompile Include="src\grafix\ImageFilter_TGA.cpp" />
<ClCompile Include="src\grafix\ImageFilter_TIFF.cpp" />
<ClCompile Include="src\grafix\ImageList.cpp" />
<ClCompile Include="src\grafix\Point.cpp" />
<ClCompile Include="src\grafix\Point3D.cpp" />
<ClCompile Include="src\grafix\Rect.cpp" />
<ClCompile Include="src\grafix\RGBFormat.cpp" />
<ClCompile Include="src\grafix\Size.cpp" />
<ClCompile Include="src\grafix\Sprite.cpp" />
<ClCompile Include="src\math\calc.cpp" />
<ClCompile Include="src\math\crc32.cpp" />
<ClCompile Include="src\math\md5.cpp" />
<ClCompile Include="src\math\random.cpp" />
<ClCompile Include="src\types\Array.cpp" />
<ClCompile Include="src\types\AssocArray.cpp" />
<ClCompile Include="src\types\ByteArray.cpp" />
<ClCompile Include="src\types\ByteArrayPtr.cpp" />
<ClCompile Include="src\types\DateTime.cpp" />
<ClCompile Include="src\types\Pointer.cpp" />
<ClCompile Include="src\types\String.cpp" />
<ClCompile Include="src\types\Variant.cpp" />
<ClCompile Include="src\types\WideString.cpp" />
</ItemGroup>
<ItemGroup>
<CustomBuild Include="src\asm\blt.asm">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
<FileType>Document</FileType>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</ExcludedFromBuild>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">C:\msys64\usr\bin\nasm.exe -f win64 -l $(IntDir)/asm_blt.lst -o $(IntDir)/asm_blt.obj src/asm/blt.asm</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)/asm_blt.obj</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">C:\msys64\usr\bin\nasm.exe -f win64 -l $(IntDir)/asm_blt.lst -o $(IntDir)/asm_blt.obj src/asm/blt.asm</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)/asm_blt.obj</Outputs>
</CustomBuild>
<CustomBuild Include="src\asm\blt_blend.asm">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
<FileType>Document</FileType>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</ExcludedFromBuild>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">C:\msys64\usr\bin\nasm.exe -f win64 -l $(IntDir)/asm_blt_blend.lst -o $(IntDir)/asm_blt_blend.obj src/asm/blt_blend.asm</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)/asm_blt_blend.obj</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">C:\msys64\usr\bin\nasm.exe -f win64 -l $(IntDir)/asm_blt_blend.lst -o $(IntDir)/asm_blt_blend.obj src/asm/blt_blend.asm</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)/asm_blt_blend.obj</Outputs>
</CustomBuild>
<CustomBuild Include="src\asm\chromakey.asm">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
<FileType>Document</FileType>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</ExcludedFromBuild>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">C:\msys64\usr\bin\nasm.exe -f win64 -l $(IntDir)/asm_chromakey.lst -o $(IntDir)/asm_chromakey.obj src/asm/chromakey.asm</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)/asm_chromakey.obj</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">C:\msys64\usr\bin\nasm.exe -f win64 -l $(IntDir)/asm_chromakey.lst -o $(IntDir)/asm_chromakey.obj src/asm/chromakey.asm</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)/asm_chromakey.obj</Outputs>
</CustomBuild>
<CustomBuild Include="src\asm\colors.asm">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
<FileType>Document</FileType>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</ExcludedFromBuild>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">C:\msys64\usr\bin\nasm.exe -f win64 -l $(IntDir)/asm_colors.lst -o $(IntDir)/asm_colors.obj src/asm/colors.asm</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)/asm_colors.obj</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">C:\msys64\usr\bin\nasm.exe -f win64 -l $(IntDir)/asm_colors.lst -o $(IntDir)/asm_colors.obj src/asm/colors.asm</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)/asm_colors.obj</Outputs>
</CustomBuild>
<None Include="src\asm\common.asm" />
<CustomBuild Include="src\asm\cpu.asm">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
<FileType>Document</FileType>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</ExcludedFromBuild>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">C:\msys64\usr\bin\nasm.exe -f win64 -l $(IntDir)/asm_cpu.lst -o $(IntDir)/asm_cpu.obj src/asm/cpu.asm</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)/asm_cpu.obj</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">C:\msys64\usr\bin\nasm.exe -f win64 -l $(IntDir)/asm_cpu.lst -o $(IntDir)/asm_cpu.obj src/asm/cpu.asm</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)/asm_cpu.obj</Outputs>
</CustomBuild>
<CustomBuild Include="src\asm\fonts.asm">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
<FileType>Document</FileType>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</ExcludedFromBuild>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">C:\msys64\usr\bin\nasm.exe -f win64 -l $(IntDir)/asm_fonts.lst -o $(IntDir)/asm_fonts.obj src/asm/fonts.asm</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)/asm_fonts.obj</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">C:\msys64\usr\bin\nasm.exe -f win64 -l $(IntDir)/asm_fonts.lst -o $(IntDir)/asm_fonts.obj src/asm/fonts.asm</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)/asm_fonts.obj</Outputs>
</CustomBuild>
<CustomBuild Include="src\asm\pixel.asm">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
<FileType>Document</FileType>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</ExcludedFromBuild>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">C:\msys64\usr\bin\nasm.exe -f win64 -l $(IntDir)/asm_pixel.lst -o $(IntDir)/asm_pixel.obj src/asm/pixel.asm</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)/asm_pixel.obj</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">C:\msys64\usr\bin\nasm.exe -f win64 -l $(IntDir)/asm_pixel.lst -o $(IntDir)/asm_pixel.obj src/asm/pixel.asm</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)/asm_pixel.obj</Outputs>
</CustomBuild>
<CustomBuild Include="src\asm\rect.asm">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
<FileType>Document</FileType>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</ExcludedFromBuild>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">C:\msys64\usr\bin\nasm.exe -f win64 -l $(IntDir)/asm_rect.lst -o $(IntDir)/asm_rect.obj src/asm/rect.asm</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)/asm_rect.obj</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">C:\msys64\usr\bin\nasm.exe -f win64 -l $(IntDir)/asm_rect.lst -o $(IntDir)/asm_rect.obj src/asm/rect.asm</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)/asm_rect.obj</Outputs>
</CustomBuild>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View file

@ -0,0 +1,322 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Quelldateien">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Headerdateien">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Ressourcendateien">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="Quelldateien\Types">
<UniqueIdentifier>{66e3414f-3a67-4d52-8ffc-53c1959c915e}</UniqueIdentifier>
</Filter>
<Filter Include="Quelldateien\Core">
<UniqueIdentifier>{3a8e2399-8b23-4023-853c-954a5915e0cd}</UniqueIdentifier>
</Filter>
<Filter Include="Quelldateien\Assembler">
<UniqueIdentifier>{95507578-a2c6-4b6b-b375-3f35bfbb6f93}</UniqueIdentifier>
</Filter>
<Filter Include="Quelldateien\Math">
<UniqueIdentifier>{c7dafec5-b489-48f2-8678-407c3550fc4e}</UniqueIdentifier>
</Filter>
<Filter Include="Quelldateien\Grafix">
<UniqueIdentifier>{d39b4bf7-3477-4635-83c3-5f81b0149947}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<Text Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="include\compat.h">
<Filter>Headerdateien</Filter>
</ClInclude>
<ClInclude Include="include\crypto.h">
<Filter>Headerdateien</Filter>
</ClInclude>
<ClInclude Include="include\ppl7.h">
<Filter>Headerdateien</Filter>
</ClInclude>
<ClInclude Include="include\ppl7-algorithms.h">
<Filter>Headerdateien</Filter>
</ClInclude>
<ClInclude Include="include\ppl7-audio.h">
<Filter>Headerdateien</Filter>
</ClInclude>
<ClInclude Include="include\ppl7-crypto.h">
<Filter>Headerdateien</Filter>
</ClInclude>
<ClInclude Include="include\ppl7-db.h">
<Filter>Headerdateien</Filter>
</ClInclude>
<ClInclude Include="include\ppl7-exceptions.h">
<Filter>Headerdateien</Filter>
</ClInclude>
<ClInclude Include="include\ppl7-grafix.h">
<Filter>Headerdateien</Filter>
</ClInclude>
<ClInclude Include="include\ppl7-inet.h">
<Filter>Headerdateien</Filter>
</ClInclude>
<ClInclude Include="include\ppl7-tk.h">
<Filter>Headerdateien</Filter>
</ClInclude>
<ClInclude Include="include\ppl7-types.h">
<Filter>Headerdateien</Filter>
</ClInclude>
<ClInclude Include="include\prolog.h">
<Filter>Headerdateien</Filter>
</ClInclude>
<ClInclude Include="include\socket.h">
<Filter>Headerdateien</Filter>
</ClInclude>
<ClInclude Include="include\threads.h">
<Filter>Headerdateien</Filter>
</ClInclude>
<ClInclude Include="include\ppl7-visualc-config.h">
<Filter>Headerdateien</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\types\Variant.cpp">
<Filter>Quelldateien\Types</Filter>
</ClCompile>
<ClCompile Include="src\types\Pointer.cpp">
<Filter>Quelldateien\Types</Filter>
</ClCompile>
<ClCompile Include="src\types\Array.cpp">
<Filter>Quelldateien\Types</Filter>
</ClCompile>
<ClCompile Include="src\types\String.cpp">
<Filter>Quelldateien\Types</Filter>
</ClCompile>
<ClCompile Include="src\core\Compat.cpp">
<Filter>Quelldateien\Core</Filter>
</ClCompile>
<ClCompile Include="src\types\ByteArray.cpp">
<Filter>Quelldateien\Types</Filter>
</ClCompile>
<ClCompile Include="src\types\ByteArrayPtr.cpp">
<Filter>Quelldateien\Types</Filter>
</ClCompile>
<ClCompile Include="src\types\AssocArray.cpp">
<Filter>Quelldateien\Types</Filter>
</ClCompile>
<ClCompile Include="src\types\DateTime.cpp">
<Filter>Quelldateien\Types</Filter>
</ClCompile>
<ClCompile Include="src\types\WideString.cpp">
<Filter>Quelldateien\Types</Filter>
</ClCompile>
<ClCompile Include="src\core\AVLTree.cpp">
<Filter>Quelldateien\Core</Filter>
</ClCompile>
<ClCompile Include="src\core\Compression.cpp">
<Filter>Quelldateien\Core</Filter>
</ClCompile>
<ClCompile Include="src\core\ConfigParser.cpp">
<Filter>Quelldateien\Core</Filter>
</ClCompile>
<ClCompile Include="src\core\cpu.cpp">
<Filter>Quelldateien\Core</Filter>
</ClCompile>
<ClCompile Include="src\core\DirEntry.cpp">
<Filter>Quelldateien\Core</Filter>
</ClCompile>
<ClCompile Include="src\core\Exceptions.cpp">
<Filter>Quelldateien\Core</Filter>
</ClCompile>
<ClCompile Include="src\core\Functions.cpp">
<Filter>Quelldateien\Core</Filter>
</ClCompile>
<ClCompile Include="src\core\StringFunctions.cpp">
<Filter>Quelldateien\Core</Filter>
</ClCompile>
<ClCompile Include="src\math\calc.cpp">
<Filter>Quelldateien\Math</Filter>
</ClCompile>
<ClCompile Include="src\math\crc32.cpp">
<Filter>Quelldateien\Math</Filter>
</ClCompile>
<ClCompile Include="src\math\md5.cpp">
<Filter>Quelldateien\Math</Filter>
</ClCompile>
<ClCompile Include="src\math\random.cpp">
<Filter>Quelldateien\Math</Filter>
</ClCompile>
<ClCompile Include="src\core\MemoryGroup.cpp">
<Filter>Quelldateien\Core</Filter>
</ClCompile>
<ClCompile Include="src\core\MemoryHeap.cpp">
<Filter>Quelldateien\Core</Filter>
</ClCompile>
<ClCompile Include="src\core\Iconv.cpp">
<Filter>Quelldateien\Core</Filter>
</ClCompile>
<ClCompile Include="src\core\Time.cpp">
<Filter>Quelldateien\Core</Filter>
</ClCompile>
<ClCompile Include="src\core\Mutex.cpp">
<Filter>Quelldateien\Core</Filter>
</ClCompile>
<ClCompile Include="src\core\PerlHelper.cpp">
<Filter>Quelldateien\Core</Filter>
</ClCompile>
<ClCompile Include="src\core\PFPFile.cpp">
<Filter>Quelldateien\Core</Filter>
</ClCompile>
<ClCompile Include="src\core\Resource.cpp">
<Filter>Quelldateien\Core</Filter>
</ClCompile>
<ClCompile Include="src\core\Resourcen.cpp">
<Filter>Quelldateien\Core</Filter>
</ClCompile>
<ClCompile Include="src\core\Threads.cpp">
<Filter>Quelldateien\Core</Filter>
</ClCompile>
<ClCompile Include="src\grafix\Color.cpp">
<Filter>Quelldateien\Grafix</Filter>
</ClCompile>
<ClCompile Include="src\grafix\Drawable.cpp">
<Filter>Quelldateien\Grafix</Filter>
</ClCompile>
<ClCompile Include="src\grafix\DrawableBlit.cpp">
<Filter>Quelldateien\Grafix</Filter>
</ClCompile>
<ClCompile Include="src\grafix\DrawableColor.cpp">
<Filter>Quelldateien\Grafix</Filter>
</ClCompile>
<ClCompile Include="src\grafix\DrawableLines.cpp">
<Filter>Quelldateien\Grafix</Filter>
</ClCompile>
<ClCompile Include="src\grafix\DrawablePixel.cpp">
<Filter>Quelldateien\Grafix</Filter>
</ClCompile>
<ClCompile Include="src\grafix\DrawableShapes.cpp">
<Filter>Quelldateien\Grafix</Filter>
</ClCompile>
<ClCompile Include="src\grafix\Font4.cpp">
<Filter>Quelldateien\Grafix</Filter>
</ClCompile>
<ClCompile Include="src\grafix\Font5.cpp">
<Filter>Quelldateien\Grafix</Filter>
</ClCompile>
<ClCompile Include="src\grafix\Font6.cpp">
<Filter>Quelldateien\Grafix</Filter>
</ClCompile>
<ClCompile Include="src\grafix\FontFreeType.cpp">
<Filter>Quelldateien\Grafix</Filter>
</ClCompile>
<ClCompile Include="src\grafix\Fonts.cpp">
<Filter>Quelldateien\Grafix</Filter>
</ClCompile>
<ClCompile Include="src\grafix\Grafix.cpp">
<Filter>Quelldateien\Grafix</Filter>
</ClCompile>
<ClCompile Include="src\grafix\Image.cpp">
<Filter>Quelldateien\Grafix</Filter>
</ClCompile>
<ClCompile Include="src\grafix\ImageFilter.cpp">
<Filter>Quelldateien\Grafix</Filter>
</ClCompile>
<ClCompile Include="src\grafix\ImageFilter_BMP.cpp">
<Filter>Quelldateien\Grafix</Filter>
</ClCompile>
<ClCompile Include="src\grafix\ImageFilter_GIF.cpp">
<Filter>Quelldateien\Grafix</Filter>
</ClCompile>
<ClCompile Include="src\grafix\ImageFilter_JPEG.cpp">
<Filter>Quelldateien\Grafix</Filter>
</ClCompile>
<ClCompile Include="src\grafix\ImageFilter_PNG.cpp">
<Filter>Quelldateien\Grafix</Filter>
</ClCompile>
<ClCompile Include="src\grafix\ImageFilter_PPM.cpp">
<Filter>Quelldateien\Grafix</Filter>
</ClCompile>
<ClCompile Include="src\grafix\ImageFilter_TGA.cpp">
<Filter>Quelldateien\Grafix</Filter>
</ClCompile>
<ClCompile Include="src\grafix\ImageFilter_TIFF.cpp">
<Filter>Quelldateien\Grafix</Filter>
</ClCompile>
<ClCompile Include="src\grafix\ImageList.cpp">
<Filter>Quelldateien\Grafix</Filter>
</ClCompile>
<ClCompile Include="src\grafix\Point.cpp">
<Filter>Quelldateien\Grafix</Filter>
</ClCompile>
<ClCompile Include="src\grafix\Point3D.cpp">
<Filter>Quelldateien\Grafix</Filter>
</ClCompile>
<ClCompile Include="src\grafix\Rect.cpp">
<Filter>Quelldateien\Grafix</Filter>
</ClCompile>
<ClCompile Include="src\grafix\RGBFormat.cpp">
<Filter>Quelldateien\Grafix</Filter>
</ClCompile>
<ClCompile Include="src\grafix\Size.cpp">
<Filter>Quelldateien\Grafix</Filter>
</ClCompile>
<ClCompile Include="src\grafix\Sprite.cpp">
<Filter>Quelldateien\Grafix</Filter>
</ClCompile>
<ClCompile Include="src\core\FileObject.cpp">
<Filter>Quelldateien\Core</Filter>
</ClCompile>
<ClCompile Include="src\core\MemFile.cpp">
<Filter>Quelldateien\Core</Filter>
</ClCompile>
<ClCompile Include="src\core\File.cpp">
<Filter>Quelldateien\Core</Filter>
</ClCompile>
<ClCompile Include="src\core\GzFile.cpp">
<Filter>Quelldateien\Core</Filter>
</ClCompile>
<ClCompile Include="src\core\Logger.cpp">
<Filter>Quelldateien\Core</Filter>
</ClCompile>
<ClCompile Include="src\core\Signal.cpp">
<Filter>Quelldateien\Core</Filter>
</ClCompile>
<ClCompile Include="src\core\Dir.cpp">
<Filter>Quelldateien\Core</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="src\asm\common.asm">
<Filter>Quelldateien\Assembler</Filter>
</None>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="src\asm\blt.asm">
<Filter>Quelldateien</Filter>
</CustomBuild>
<CustomBuild Include="src\asm\blt_blend.asm">
<Filter>Quelldateien</Filter>
</CustomBuild>
<CustomBuild Include="src\asm\chromakey.asm">
<Filter>Quelldateien</Filter>
</CustomBuild>
<CustomBuild Include="src\asm\colors.asm">
<Filter>Quelldateien</Filter>
</CustomBuild>
<CustomBuild Include="src\asm\cpu.asm">
<Filter>Quelldateien</Filter>
</CustomBuild>
<CustomBuild Include="src\asm\fonts.asm">
<Filter>Quelldateien</Filter>
</CustomBuild>
<CustomBuild Include="src\asm\pixel.asm">
<Filter>Quelldateien</Filter>
</CustomBuild>
<CustomBuild Include="src\asm\rect.asm">
<Filter>Quelldateien</Filter>
</CustomBuild>
</ItemGroup>
</Project>

133
src/pplib/README.TXT Normal file
View file

@ -0,0 +1,133 @@
PPLib - Patrick's Programming Library
===========================================================================
INDEX
1. What is PPLib?
2. Installation
2.1 UNIX
2.2 Windows
3. Usage
4. Documentation
5. Credits
6. Copyright
7. Licence
===========================================================================
1. What is PPLib?
PPLib (or PPL) stands for "Patrick's Programming Library" and is a
collection of functions and classes for C++ applications, written by
Patrick Fedick. It covers file and directory functions, strings and
arrays, time, math, threads, graphics, sound, database access and
internet communication.
You can find the newest version and documentation of this library under
http://www.pfp.de/pplib
===========================================================================
2. Installation
2.1 UNIX
The UNIX version comes with a standard configure-script. In most
cases it is sufficient to simply do
./configure
make
make install (do this as root)
The configure script tries to find out on what system the library
should be compiled and what optional libraries are available of
which PPLib can make use of (e.g. graphic libraries or databases).
If it does not find a library of which you know that it is
installed somewhere, you can manually set a search path for it
during configure, e.g.:
./configure --with-mysql=/usr/local/mysql
If you don't want a specific library compiled in, you can deselect
it with "--without-xxx', where xxx stands for the library. Example:
./configure --without-mysql
Please see "./configure --help" for a list of all available
options.
2.2 Windows
PPLib comes with project files for Microsoft Visual Studio .NET 2003,
but you have to do some manual configuration to adapt it to your
system.
For more details and examples about installation, please read the HTML
documentation.
===========================================================================
3. Usage
How to use the functions and classes if PPLib is described in the
HTML documentation.
===========================================================================
4. Documentation
Documentation is available in HTML and can be found in the subdirectory
"documentation/html" of the source distribution and and online on the
PPLib webpage:
http://www.pfp.de/pplib
===========================================================================
5. Credits
Some parts of PPLib includes code from other projects or can make use of
third party libraries.
- MD5-Hash calculation
Copyright RSA Data Security, Inc. MD5 Message-Digest Algorithm)
- random number generation
Copyright (c) 1983, 1993 The Regents of the University of California
- CRC32 checksum calculation
unknown source
- GIF-Reader
Copyright 1990, 1991, 1993 by David Koblas
- PCRE (http://www.pcre.org/)
Copyright (c) 1997-2008 University of Cambridge All rights reserved.
- Zlib (http://www.zlib.net/)
Copyright (C) 1995-2005 Jean-loup Gailly and Mark Adler
- Bzip2 (http://www.bzip.org/)\n
Copyright (C) 1996-2007 Julian R Seward
===========================================================================
6. Copyright
PPLib is copyright by Patrick Fedick <patrick@pfp.de> in 2005-2019
All rights reserved.
===========================================================================
7. Licence
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

3
src/pplib/TODO.TXT Normal file
View file

@ -0,0 +1,3 @@
Compiler-Warnings:

115
src/pplib/acinclude.m4 Normal file
View file

@ -0,0 +1,115 @@
dnl Zusaetzliche Macros
#######################################################
# AX_FPOS_ISSTRUCT
# Prüft, ob fpos_t ein scalar oder eine structure ist
#######################################################
AC_DEFUN([AX_FPOS_ISSTRUCT],[
AC_MSG_CHECKING(if fpos_t is struct or scalar)
AC_LANG_PUSH(C++)
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include <stdio.h>
int main(void){
fpos_t f;
f.__pos=1;
}
]]) ],
AC_DEFINE(FPOS_T_STRUCT,1,)
AC_MSG_RESULT(struct),
AC_MSG_RESULT(scalar)
)
dnl #AC_DEFINE(FPOS_T_STRUCT,1,),)
AC_LANG_POP(C++)
])
#######################################################
# AX_TM_HAS_GMTOFF
# Prüft, ob die structure "tm" das Element "tm_gmtoff"
# hat
#######################################################
AC_DEFUN([AX_TM_HAS_GMTOFF],[
AC_MSG_CHECKING(if struct tm hast tm_gmtoff)
AC_LANG_PUSH(C++)
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include <time.h>
int main(void){
struct tm tt;
tt.tm_gmtoff=1;
}
]]) ],
AC_DEFINE(STRUCT_TM_HAS_GMTOFF,1,)
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no)
)
AC_LANG_POP(C++)
])
AC_DEFUN([AC_FUNC_VSNPRINTF],
[AC_CACHE_CHECK(for working vsnprintf,
ac_cv_func_vsnprintf,
[AC_TRY_RUN(
[#include <stdio.h>
#include <stdarg.h>
int
doit(char * s, ...)
{
char buffer[32];
va_list args;
int r;
buffer[5] = 'X';
va_start(args, s);
r = vsnprintf(buffer, 5, s, args);
va_end(args);
/* -1 is pre-C99, 7 is C99. */
if (r != -1 && r != 7)
exit(1);
/* We deliberately do not care if the result is NUL-terminated or
not, since this is easy to work around like this. */
buffer[4] = 0;
/* Simple sanity check. */
if (strcmp(buffer, "1234"))
exit(1);
if (buffer[5] != 'X')
exit(1);
exit(0);
}
int
main(void)
{
doit("1234567");
exit(1);
}], ac_cv_func_vsnprintf=yes, ac_cv_func_vsnprintf=no, ac_cv_func_vsnprintf=no)])
dnl Note that the default is to be pessimistic in the case of cross compilation.
dnl If you know that the target has a sensible vsnprintf(), you can get around this
dnl by setting ac_func_vsnprintf to yes, as described in the Autoconf manual.
if test $ac_cv_func_vsnprintf = yes; then
AC_DEFINE(HAVE_WORKING_VSNPRINTF, 1,
[Define if you have a version of the `vsnprintf' function
that honours the size argument and has a proper return value.])
fi
])# AC_FUNC_VSNPRINTF

1849
src/pplib/aclocal.m4 vendored Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,180 @@
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_cc_maxopt.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_CC_MAXOPT
#
# DESCRIPTION
#
# Try to turn on "good" C optimization flags for various compilers and
# architectures, for some definition of "good". (In our case, good for
# FFTW and hopefully for other scientific codes. Modify as needed.)
#
# The user can override the flags by setting the CFLAGS environment
# variable. The user can also specify --enable-portable-binary in order to
# disable any optimization flags that might result in a binary that only
# runs on the host architecture.
#
# Note also that the flags assume that ANSI C aliasing rules are followed
# by the code (e.g. for gcc's -fstrict-aliasing), and that floating-point
# computations can be re-ordered as needed.
#
# Requires macros: AX_CHECK_COMPILE_FLAG, AX_COMPILER_VENDOR,
# AX_GCC_ARCHFLAG, AX_GCC_X86_CPUID.
#
# LICENSE
#
# Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
# Copyright (c) 2008 Matteo Frigo
#
# 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 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 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, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
# scripts that are the output of Autoconf when processing the Macro. You
# need not follow the terms of the GNU General Public License when using
# or distributing such scripts, even though portions of the text of the
# Macro appear in them. The GNU General Public License (GPL) does govern
# all other use of the material that constitutes the Autoconf Macro.
#
# This special exception to the GPL applies to versions of the Autoconf
# Macro released by the Autoconf Archive. When you make and distribute a
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
#serial 13
AC_DEFUN([AX_CC_MAXOPT],
[
AC_REQUIRE([AC_PROG_CC])
AC_REQUIRE([AX_COMPILER_VENDOR])
AC_REQUIRE([AC_CANONICAL_HOST])
AC_ARG_ENABLE(portable-binary, [AS_HELP_STRING([--enable-portable-binary], [disable compiler optimizations that would produce unportable binaries])],
acx_maxopt_portable=$enableval, acx_maxopt_portable=no)
# Try to determine "good" native compiler flags if none specified via CFLAGS
if test "$ac_test_CFLAGS" != "set"; then
CFLAGS=""
case $ax_cv_c_compiler_vendor in
dec) CFLAGS="-newc -w0 -O5 -ansi_alias -ansi_args -fp_reorder -tune host"
if test "x$acx_maxopt_portable" = xno; then
CFLAGS="$CFLAGS -arch host"
fi;;
sun) CFLAGS="-native -fast -xO5 -dalign"
if test "x$acx_maxopt_portable" = xyes; then
CFLAGS="$CFLAGS -xarch=generic"
fi;;
hp) CFLAGS="+Oall +Optrs_ansi +DSnative"
if test "x$acx_maxopt_portable" = xyes; then
CFLAGS="$CFLAGS +DAportable"
fi;;
ibm) if test "x$acx_maxopt_portable" = xno; then
xlc_opt="-qarch=auto -qtune=auto"
else
xlc_opt="-qtune=auto"
fi
AX_CHECK_COMPILE_FLAG($xlc_opt,
CFLAGS="-O3 -qansialias -w $xlc_opt",
[CFLAGS="-O3 -qansialias -w"
echo "******************************************************"
echo "* You seem to have the IBM C compiler. It is *"
echo "* recommended for best performance that you use: *"
echo "* *"
echo "* CFLAGS=-O3 -qarch=xxx -qtune=xxx -qansialias -w *"
echo "* ^^^ ^^^ *"
echo "* where xxx is pwr2, pwr3, 604, or whatever kind of *"
echo "* CPU you have. (Set the CFLAGS environment var. *"
echo "* and re-run configure.) For more info, man cc. *"
echo "******************************************************"])
;;
intel) CFLAGS="-O3 -ansi_alias"
if test "x$acx_maxopt_portable" = xno; then
icc_archflag=unknown
icc_flags=""
case $host_cpu in
i686*|x86_64*)
# icc accepts gcc assembly syntax, so these should work:
AX_GCC_X86_CPUID(0)
AX_GCC_X86_CPUID(1)
case $ax_cv_gcc_x86_cpuid_0 in # see AX_GCC_ARCHFLAG
*:756e6547:*:*) # Intel
case $ax_cv_gcc_x86_cpuid_1 in
*6a?:*[[234]]:*:*|*6[[789b]]?:*:*:*) icc_flags="-xK";;
*f3[[347]]:*:*:*|*f4[1347]:*:*:*) icc_flags="-xP -xN -xW -xK";;
*f??:*:*:*) icc_flags="-xN -xW -xK";;
esac ;;
esac ;;
esac
if test "x$icc_flags" != x; then
for flag in $icc_flags; do
AX_CHECK_COMPILE_FLAG($flag, [icc_archflag=$flag; break])
done
fi
AC_MSG_CHECKING([for icc architecture flag])
AC_MSG_RESULT($icc_archflag)
if test "x$icc_archflag" != xunknown; then
CFLAGS="$CFLAGS $icc_archflag"
fi
fi
;;
gnu)
# default optimization flags for gcc on all systems
CFLAGS="-O3 -fomit-frame-pointer"
# -malign-double for x86 systems
AX_CHECK_COMPILE_FLAG(-malign-double, CFLAGS="$CFLAGS -malign-double")
# -fstrict-aliasing for gcc-2.95+
AX_CHECK_COMPILE_FLAG(-fstrict-aliasing,
CFLAGS="$CFLAGS -fstrict-aliasing")
# note that we enable "unsafe" fp optimization with other compilers, too
AX_CHECK_COMPILE_FLAG(-ffast-math, CFLAGS="$CFLAGS -ffast-math")
AX_GCC_ARCHFLAG($acx_maxopt_portable)
;;
esac
if test -z "$CFLAGS"; then
echo ""
echo "********************************************************"
echo "* WARNING: Don't know the best CFLAGS for this system *"
echo "* Use ./configure CFLAGS=... to specify your own flags *"
echo "* (otherwise, a default of CFLAGS=-O3 will be used) *"
echo "********************************************************"
echo ""
CFLAGS="-O3"
fi
AX_CHECK_COMPILE_FLAG($CFLAGS, [], [
echo ""
echo "********************************************************"
echo "* WARNING: The guessed CFLAGS don't seem to work with *"
echo "* your compiler. *"
echo "* Use ./configure CFLAGS=... to specify your own flags *"
echo "********************************************************"
echo ""
CFLAGS=""
])
fi
])

View file

@ -0,0 +1,78 @@
# ===========================================================================
# http://autoconf-archive.cryp.to/ax_check_compiler_flags.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_CHECK_COMPILER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE])
#
# DESCRIPTION
#
# Check whether the given compiler FLAGS work with the current language's
# compiler, or whether they give an error. (Warnings, however, are
# ignored.)
#
# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
# success/failure.
#
# LAST MODIFICATION
#
# 2008-04-12
#
# COPYLEFT
#
# Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
# Copyright (c) 2008 Matteo Frigo
#
# 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 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 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, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
# scripts that are the output of Autoconf when processing the Macro. You
# need not follow the terms of the GNU General Public License when using
# or distributing such scripts, even though portions of the text of the
# Macro appear in them. The GNU General Public License (GPL) does govern
# all other use of the material that constitutes the Autoconf Macro.
#
# This special exception to the GPL applies to versions of the Autoconf
# Macro released by the Autoconf Macro Archive. When you make and
# distribute a modified version of the Autoconf Macro, you may extend this
# special exception to the GPL to apply to your modified version as well.
AC_DEFUN([AX_CHECK_COMPILER_FLAGS],
[AC_PREREQ(2.59) dnl for _AC_LANG_PREFIX
AC_MSG_CHECKING([whether _AC_LANG compiler accepts $1])
dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
AS_LITERAL_IF([$1],
[AC_CACHE_VAL(AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_$1), [
ax_save_FLAGS=$[]_AC_LANG_PREFIX[]FLAGS
_AC_LANG_PREFIX[]FLAGS="$1"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_$1)=yes,
AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_$1)=no)
_AC_LANG_PREFIX[]FLAGS=$ax_save_FLAGS])],
[ax_save_FLAGS=$[]_AC_LANG_PREFIX[]FLAGS
_AC_LANG_PREFIX[]FLAGS="$1"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
eval AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_$1)=yes,
eval AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_$1)=no)
_AC_LANG_PREFIX[]FLAGS=$ax_save_FLAGS])
eval ax_check_compiler_flags=$AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_$1)
AC_MSG_RESULT($ax_check_compiler_flags)
if test "x$ax_check_compiler_flags" = xyes; then
m4_default([$2], :)
else
m4_default([$3], :)
fi
])dnl AX_CHECK_COMPILER_FLAGS

View file

@ -0,0 +1,130 @@
# ===========================================================================
# https://www.gnu.org/software/autoconf-archive/ax_check_openssl.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_CHECK_OPENSSL([action-if-found[, action-if-not-found]])
#
# DESCRIPTION
#
# Look for OpenSSL in a number of default spots, or in a user-selected
# spot (via --with-openssl). Sets
#
# OPENSSL_INCLUDES to the include directives required
# OPENSSL_LIBS to the -l directives required
# OPENSSL_LDFLAGS to the -L or -R flags required
#
# and calls ACTION-IF-FOUND or ACTION-IF-NOT-FOUND appropriately
#
# This macro sets OPENSSL_INCLUDES such that source files should use the
# openssl/ directory in include directives:
#
# #include <openssl/hmac.h>
#
# LICENSE
#
# Copyright (c) 2009,2010 Zmanda Inc. <http://www.zmanda.com/>
# Copyright (c) 2009,2010 Dustin J. Mitchell <dustin@zmanda.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 10
AU_ALIAS([CHECK_SSL], [AX_CHECK_OPENSSL])
AC_DEFUN([AX_CHECK_OPENSSL], [
found=false
AC_ARG_WITH([openssl],
[AS_HELP_STRING([--with-openssl=DIR],
[root of the OpenSSL directory])],
[
case "$withval" in
"" | y | ye | yes | n | no)
AC_MSG_ERROR([Invalid --with-openssl value])
;;
*) ssldirs="$withval"
;;
esac
], [
# if pkg-config is installed and openssl has installed a .pc file,
# then use that information and don't search ssldirs
AC_CHECK_TOOL([PKG_CONFIG], [pkg-config])
if test x"$PKG_CONFIG" != x""; then
OPENSSL_LDFLAGS=`$PKG_CONFIG openssl --libs-only-L 2>/dev/null`
if test $? = 0; then
OPENSSL_LIBS=`$PKG_CONFIG openssl --libs-only-l 2>/dev/null`
OPENSSL_INCLUDES=`$PKG_CONFIG openssl --cflags-only-I 2>/dev/null`
found=true
fi
fi
# no such luck; use some default ssldirs
if ! $found; then
ssldirs="/usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /usr"
fi
]
)
# note that we #include <openssl/foo.h>, so the OpenSSL headers have to be in
# an 'openssl' subdirectory
if ! $found; then
OPENSSL_INCLUDES=
for ssldir in $ssldirs; do
AC_MSG_CHECKING([for openssl/ssl.h in $ssldir])
if test -f "$ssldir/include/openssl/ssl.h"; then
OPENSSL_INCLUDES="-I$ssldir/include"
OPENSSL_LDFLAGS="-L$ssldir/lib"
OPENSSL_LIBS="-lssl -lcrypto"
found=true
AC_MSG_RESULT([yes])
break
else
AC_MSG_RESULT([no])
fi
done
# if the file wasn't found, well, go ahead and try the link anyway -- maybe
# it will just work!
fi
# try the preprocessor and linker with our new flags,
# being careful not to pollute the global LIBS, LDFLAGS, and CPPFLAGS
AC_MSG_CHECKING([whether compiling and linking against OpenSSL works])
echo "Trying link with OPENSSL_LDFLAGS=$OPENSSL_LDFLAGS;" \
"OPENSSL_LIBS=$OPENSSL_LIBS; OPENSSL_INCLUDES=$OPENSSL_INCLUDES" >&AS_MESSAGE_LOG_FD
save_LIBS="$LIBS"
save_LDFLAGS="$LDFLAGS"
save_CPPFLAGS="$CPPFLAGS"
LDFLAGS="$LDFLAGS $OPENSSL_LDFLAGS"
LIBS="$OPENSSL_LIBS $LIBS"
CPPFLAGS="$OPENSSL_INCLUDES $CPPFLAGS"
case "${host_cpu}-${host_os}" in
*mingw32*|*msys*)
LIBS="$LIBS -lwsock32 -luser32 -lgdi32"
;;
esac
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([#include <openssl/ssl.h>], [SSL_new(NULL)])],
[
AC_MSG_RESULT([yes])
$1
], [
AC_MSG_RESULT([no])
$2
])
CPPFLAGS="$save_CPPFLAGS"
LDFLAGS="$save_LDFLAGS"
LIBS="$save_LIBS"
AC_SUBST([OPENSSL_INCLUDES])
AC_SUBST([OPENSSL_LIBS])
AC_SUBST([OPENSSL_LDFLAGS])
])

View file

@ -0,0 +1,142 @@
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_check_zlib.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_CHECK_ZLIB([action-if-found], [action-if-not-found])
#
# DESCRIPTION
#
# This macro searches for an installed zlib library. If nothing was
# specified when calling configure, it searches first in /usr/local and
# then in /usr, /opt/local and /sw. If the --with-zlib=DIR is specified,
# it will try to find it in DIR/include/zlib.h and DIR/lib/libz.a. If
# --without-zlib is specified, the library is not searched at all.
#
# If either the header file (zlib.h) or the library (libz) is not found,
# shell commands 'action-if-not-found' is run. If 'action-if-not-found' is
# not specified, the configuration exits on error, asking for a valid zlib
# installation directory or --without-zlib.
#
# If both header file and library are found, shell commands
# 'action-if-found' is run. If 'action-if-found' is not specified, the
# default action appends '-I${ZLIB_HOME}/include' to CPFLAGS, appends
# '-L$ZLIB_HOME}/lib' to LDFLAGS, prepends '-lz' to LIBS, and calls
# AC_DEFINE(HAVE_LIBZ). You should use autoheader to include a definition
# for this symbol in a config.h file. Sample usage in a C/C++ source is as
# follows:
#
# #ifdef HAVE_LIBZ
# #include <zlib.h>
# #endif /* HAVE_LIBZ */
#
# LICENSE
#
# Copyright (c) 2008 Loic Dachary <loic@senga.org>
# Copyright (c) 2010 Bastien Chevreux <bach@chevreux.org>
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
# scripts that are the output of Autoconf when processing the Macro. You
# need not follow the terms of the GNU General Public License when using
# or distributing such scripts, even though portions of the text of the
# Macro appear in them. The GNU General Public License (GPL) does govern
# all other use of the material that constitutes the Autoconf Macro.
#
# This special exception to the GPL applies to versions of the Autoconf
# Macro released by the Autoconf Archive. When you make and distribute a
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
#serial 14
AU_ALIAS([CHECK_ZLIB], [AX_CHECK_ZLIB])
AC_DEFUN([AX_CHECK_ZLIB],
#
# Handle user hints
#
[AC_MSG_CHECKING(if zlib is wanted)
zlib_places="/usr/local /usr /opt/local /sw"
AC_ARG_WITH([zlib],
[ --with-zlib=DIR root directory path of zlib installation @<:@defaults to
/usr/local or /usr if not found in /usr/local@:>@
--without-zlib to disable zlib usage completely],
[if test "$withval" != no ; then
AC_MSG_RESULT(yes)
if test -d "$withval"
then
zlib_places="$withval $zlib_places"
else
AC_MSG_WARN([Sorry, $withval does not exist, checking usual places])
fi
else
zlib_places=
AC_MSG_RESULT(no)
fi],
[AC_MSG_RESULT(yes)])
#
# Locate zlib, if wanted
#
if test -n "${zlib_places}"
then
# check the user supplied or any other more or less 'standard' place:
# Most UNIX systems : /usr/local and /usr
# MacPorts / Fink on OSX : /opt/local respectively /sw
for ZLIB_HOME in ${zlib_places} ; do
if test -f "${ZLIB_HOME}/include/zlib.h"; then break; fi
ZLIB_HOME=""
done
ZLIB_OLD_LDFLAGS=$LDFLAGS
ZLIB_OLD_CPPFLAGS=$CPPFLAGS
if test -n "${ZLIB_HOME}"; then
LDFLAGS="$LDFLAGS -L${ZLIB_HOME}/lib"
CPPFLAGS="$CPPFLAGS -I${ZLIB_HOME}/include"
fi
AC_LANG_SAVE
AC_LANG_C
AC_CHECK_LIB([z], [inflateEnd], [zlib_cv_libz=yes], [zlib_cv_libz=no])
AC_CHECK_HEADER([zlib.h], [zlib_cv_zlib_h=yes], [zlib_cv_zlib_h=no])
AC_LANG_RESTORE
if test "$zlib_cv_libz" = "yes" && test "$zlib_cv_zlib_h" = "yes"
then
#
# If both library and header were found, action-if-found
#
m4_ifblank([$1],[
CPPFLAGS="$CPPFLAGS -I${ZLIB_HOME}/include"
LDFLAGS="$LDFLAGS -L${ZLIB_HOME}/lib"
LIBS="-lz $LIBS"
AC_DEFINE([HAVE_LIBZ], [1],
[Define to 1 if you have `z' library (-lz)])
],[
# Restore variables
LDFLAGS="$ZLIB_OLD_LDFLAGS"
CPPFLAGS="$ZLIB_OLD_CPPFLAGS"
$1
])
else
#
# If either header or library was not found, action-if-not-found
#
m4_default([$2],[
AC_MSG_ERROR([either specify a valid zlib installation with --with-zlib=DIR or disable zlib usage with --without-zlib])
])
fi
fi
])

View file

@ -0,0 +1,558 @@
# ===========================================================================
# 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 CXXFLAGS 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>
#
# 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 1
dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro
dnl (serial version number 13).
AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl
m4_if([$1], [11], [],
[$1], [14], [],
[$1], [17], [m4_fatal([support for C++17 not yet implemented in AX_CXX_COMPILE_STDCXX])],
[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 switch in -std=gnu++$1 -std=gnu++0x; 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_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS $switch"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])],
[eval $cachevar=yes],
[eval $cachevar=no])
CXXFLAGS="$ac_save_CXXFLAGS"])
if eval test x\$$cachevar = xyes; then
CXXFLAGS="$CXXFLAGS $switch"
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 switch in -std=c++$1 -std=c++0x +std=c++$1 "-h std=c++$1"; 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_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS $switch"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])],
[eval $cachevar=yes],
[eval $cachevar=no])
CXXFLAGS="$ac_save_CXXFLAGS"])
if eval test x\$$cachevar = xyes; then
CXXFLAGS="$CXXFLAGS $switch"
ac_success=yes
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
else
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)
fi
])
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
)
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_seperators
{
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
]])

View file

@ -0,0 +1,39 @@
# ============================================================================
# http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_11.html
# ============================================================================
#
# SYNOPSIS
#
# AX_CXX_COMPILE_STDCXX_11([ext|noext], [mandatory|optional])
#
# DESCRIPTION
#
# Check for baseline language coverage in the compiler for the C++11
# standard; if necessary, add switches to CXXFLAGS to enable support.
#
# This macro is a convenience alias for calling the AX_CXX_COMPILE_STDCXX
# macro with the version set to C++11. The two optional arguments are
# forwarded literally as the second and third argument respectively.
# Please see the documentation for the AX_CXX_COMPILE_STDCXX macro for
# more information. If you want to use this macro, you also need to
# download the ax_cxx_compile_stdcxx.m4 file.
#
# 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>
#
# 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 14
include([ax_cxx_compile_stdcxx.m4])
AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [AX_CXX_COMPILE_STDCXX([11], [$1], [$2])])

View file

@ -0,0 +1,225 @@
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_gcc_archflag.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_GCC_ARCHFLAG([PORTABLE?], [ACTION-SUCCESS], [ACTION-FAILURE])
#
# DESCRIPTION
#
# This macro tries to guess the "native" arch corresponding to the target
# architecture for use with gcc's -march=arch or -mtune=arch flags. If
# found, the cache variable $ax_cv_gcc_archflag is set to this flag and
# ACTION-SUCCESS is executed; otherwise $ax_cv_gcc_archflag is set to
# "unknown" and ACTION-FAILURE is executed. The default ACTION-SUCCESS is
# to add $ax_cv_gcc_archflag to the end of $CFLAGS.
#
# PORTABLE? should be either [yes] (default) or [no]. In the former case,
# the flag is set to -mtune (or equivalent) so that the architecture is
# only used for tuning, but the instruction set used is still portable. In
# the latter case, the flag is set to -march (or equivalent) so that
# architecture-specific instructions are enabled.
#
# The user can specify --with-gcc-arch=<arch> in order to override the
# macro's choice of architecture, or --without-gcc-arch to disable this.
#
# When cross-compiling, or if $CC is not gcc, then ACTION-FAILURE is
# called unless the user specified --with-gcc-arch manually.
#
# Requires macros: AX_CHECK_COMPILE_FLAG, AX_GCC_X86_CPUID
#
# (The main emphasis here is on recent CPUs, on the principle that doing
# high-performance computing on old hardware is uncommon.)
#
# LICENSE
#
# Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
# Copyright (c) 2008 Matteo Frigo
# Copyright (c) 2012 Tsukasa Oi
#
# 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 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 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, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
# scripts that are the output of Autoconf when processing the Macro. You
# need not follow the terms of the GNU General Public License when using
# or distributing such scripts, even though portions of the text of the
# Macro appear in them. The GNU General Public License (GPL) does govern
# all other use of the material that constitutes the Autoconf Macro.
#
# This special exception to the GPL applies to versions of the Autoconf
# Macro released by the Autoconf Archive. When you make and distribute a
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
#serial 13
AC_DEFUN([AX_GCC_ARCHFLAG],
[AC_REQUIRE([AC_PROG_CC])
AC_REQUIRE([AC_CANONICAL_HOST])
AC_ARG_WITH(gcc-arch, [AS_HELP_STRING([--with-gcc-arch=<arch>], [use architecture <arch> for gcc -march/-mtune, instead of guessing])],
ax_gcc_arch=$withval, ax_gcc_arch=yes)
AC_MSG_CHECKING([for gcc architecture flag])
AC_MSG_RESULT([])
AC_CACHE_VAL(ax_cv_gcc_archflag,
[
ax_cv_gcc_archflag="unknown"
if test "$GCC" = yes; then
if test "x$ax_gcc_arch" = xyes; then
ax_gcc_arch=""
if test "$cross_compiling" = no; then
case $host_cpu in
i[[3456]]86*|x86_64*|amd64*) # use cpuid codes
AX_GCC_X86_CPUID(0)
AX_GCC_X86_CPUID(1)
case $ax_cv_gcc_x86_cpuid_0 in
*:756e6547:*:*) # Intel
case $ax_cv_gcc_x86_cpuid_1 in
*5[[48]]?:*:*:*) ax_gcc_arch="pentium-mmx pentium" ;;
*5??:*:*:*) ax_gcc_arch=pentium ;;
*1?6[[7d]]?:*:*:*) ax_gcc_arch="penryn core2 pentium-m pentium3 pentiumpro" ;;
*1?6[[aef]]?:*:*:*|*2?6[[5cef]]?:*:*:*) ax_gcc_arch="corei7 core2 pentium-m pentium3 pentiumpro" ;;
*1?6c?:*:*:*|*[[23]]?66?:*:*:*) ax_gcc_arch="atom core2 pentium-m pentium3 pentiumpro" ;;
*2?6[[ad]]?:*:*:*) ax_gcc_arch="corei7-avx corei7 core2 pentium-m pentium3 pentiumpro" ;;
*[[1-9a-f]]?6??:*:*:*) ax_gcc_arch="core2 pentiumpro" ;;
*6[[3456]]?:*:*:*) ax_gcc_arch="pentium2 pentiumpro" ;;
*6a?:*[[01]]:*:*) ax_gcc_arch="pentium2 pentiumpro" ;;
*6a?:*[[234]]:*:*) ax_gcc_arch="pentium3 pentiumpro" ;;
*6[[9de]]?:*:*:*) ax_gcc_arch="pentium-m pentium3 pentiumpro" ;;
*6[[78b]]?:*:*:*) ax_gcc_arch="pentium3 pentiumpro" ;;
*6f?:*:*:*) ax_gcc_arch="core2 pentium-m pentium3 pentiumpro" ;;
*6??:*:*:*) ax_gcc_arch=pentiumpro ;;
*f3[[347]]:*:*:*|*f4[1347]:*:*:*|*f6?:*:*:*)
case $host_cpu in
x86_64*) ax_gcc_arch="nocona pentium4 pentiumpro" ;;
*) ax_gcc_arch="prescott pentium4 pentiumpro" ;;
esac ;;
*f??:*:*:*) ax_gcc_arch="pentium4 pentiumpro";;
esac ;;
*:68747541:*:*) # AMD
case $ax_cv_gcc_x86_cpuid_1 in
*5[[67]]?:*:*:*) ax_gcc_arch=k6 ;;
*5[[8d]]?:*:*:*) ax_gcc_arch="k6-2 k6" ;;
*5[[9]]?:*:*:*) ax_gcc_arch="k6-3 k6" ;;
*60?:*:*:*) ax_gcc_arch=k7 ;;
*6[[12]]?:*:*:*) ax_gcc_arch="athlon k7" ;;
*6[[34]]?:*:*:*) ax_gcc_arch="athlon-tbird k7" ;;
*67?:*:*:*) ax_gcc_arch="athlon-4 athlon k7" ;;
*6[[68a]]?:*:*:*)
AX_GCC_X86_CPUID(0x80000006) # L2 cache size
case $ax_cv_gcc_x86_cpuid_0x80000006 in
*:*:*[[1-9a-f]]??????:*) # (L2 = ecx >> 16) >= 256
ax_gcc_arch="athlon-xp athlon-4 athlon k7" ;;
*) ax_gcc_arch="athlon-4 athlon k7" ;;
esac ;;
*5??f??:*:*:*) ax_gcc_arch="btver1 amdfam10 k8" ;;
*6??f??:*:*:*) ax_gcc_arch="bdver1 amdfam10 k8" ;;
*[[1-9a-f]]??f??:*:*:*) ax_gcc_arch="amdfam10 k8" ;;
*f[[4cef8b]]?:*:*:*) ax_gcc_arch="athlon64 k8" ;;
*f5?:*:*:*) ax_gcc_arch="opteron k8" ;;
*f7?:*:*:*) ax_gcc_arch="athlon-fx opteron k8" ;;
*f??:*:*:*) ax_gcc_arch="k8" ;;
esac ;;
*:746e6543:*:*) # IDT
case $ax_cv_gcc_x86_cpuid_1 in
*54?:*:*:*) ax_gcc_arch=winchip-c6 ;;
*58?:*:*:*) ax_gcc_arch=winchip2 ;;
*6[[78]]?:*:*:*) ax_gcc_arch=c3 ;;
*69?:*:*:*) ax_gcc_arch="c3-2 c3" ;;
esac ;;
esac
if test x"$ax_gcc_arch" = x; then # fallback
case $host_cpu in
i586*) ax_gcc_arch=pentium ;;
i686*) ax_gcc_arch=pentiumpro ;;
esac
fi
;;
sparc*)
AC_PATH_PROG([PRTDIAG], [prtdiag], [prtdiag], [$PATH:/usr/platform/`uname -i`/sbin/:/usr/platform/`uname -m`/sbin/])
cputype=`(((grep cpu /proc/cpuinfo | cut -d: -f2) ; ($PRTDIAG -v |grep -i sparc) ; grep -i cpu /var/run/dmesg.boot ) | head -n 1) 2> /dev/null`
cputype=`echo "$cputype" | tr -d ' -' |tr $as_cr_LETTERS $as_cr_letters`
case $cputype in
*ultrasparciv*) ax_gcc_arch="ultrasparc4 ultrasparc3 ultrasparc v9" ;;
*ultrasparciii*) ax_gcc_arch="ultrasparc3 ultrasparc v9" ;;
*ultrasparc*) ax_gcc_arch="ultrasparc v9" ;;
*supersparc*|*tms390z5[[05]]*) ax_gcc_arch="supersparc v8" ;;
*hypersparc*|*rt62[[056]]*) ax_gcc_arch="hypersparc v8" ;;
*cypress*) ax_gcc_arch=cypress ;;
esac ;;
alphaev5) ax_gcc_arch=ev5 ;;
alphaev56) ax_gcc_arch=ev56 ;;
alphapca56) ax_gcc_arch="pca56 ev56" ;;
alphapca57) ax_gcc_arch="pca57 pca56 ev56" ;;
alphaev6) ax_gcc_arch=ev6 ;;
alphaev67) ax_gcc_arch=ev67 ;;
alphaev68) ax_gcc_arch="ev68 ev67" ;;
alphaev69) ax_gcc_arch="ev69 ev68 ev67" ;;
alphaev7) ax_gcc_arch="ev7 ev69 ev68 ev67" ;;
alphaev79) ax_gcc_arch="ev79 ev7 ev69 ev68 ev67" ;;
powerpc*)
cputype=`((grep cpu /proc/cpuinfo | head -n 1 | cut -d: -f2 | cut -d, -f1 | sed 's/ //g') ; /usr/bin/machine ; /bin/machine; grep CPU /var/run/dmesg.boot | head -n 1 | cut -d" " -f2) 2> /dev/null`
cputype=`echo $cputype | sed -e 's/ppc//g;s/ *//g'`
case $cputype in
*750*) ax_gcc_arch="750 G3" ;;
*740[[0-9]]*) ax_gcc_arch="$cputype 7400 G4" ;;
*74[[4-5]][[0-9]]*) ax_gcc_arch="$cputype 7450 G4" ;;
*74[[0-9]][[0-9]]*) ax_gcc_arch="$cputype G4" ;;
*970*) ax_gcc_arch="970 G5 power4";;
*POWER4*|*power4*|*gq*) ax_gcc_arch="power4 970";;
*POWER5*|*power5*|*gr*|*gs*) ax_gcc_arch="power5 power4 970";;
603ev|8240) ax_gcc_arch="$cputype 603e 603";;
*) ax_gcc_arch=$cputype ;;
esac
ax_gcc_arch="$ax_gcc_arch powerpc"
;;
esac
fi # not cross-compiling
fi # guess arch
if test "x$ax_gcc_arch" != x -a "x$ax_gcc_arch" != xno; then
for arch in $ax_gcc_arch; do
if test "x[]m4_default([$1],yes)" = xyes; then # if we require portable code
flags="-mtune=$arch"
# -mcpu=$arch and m$arch generate nonportable code on every arch except
# x86. And some other arches (e.g. Alpha) don't accept -mtune. Grrr.
case $host_cpu in i*86|x86_64*) flags="$flags -mcpu=$arch -m$arch";; esac
else
flags="-march=$arch -mcpu=$arch -m$arch"
fi
for flag in $flags; do
AX_CHECK_COMPILE_FLAG($flag, [ax_cv_gcc_archflag=$flag; break])
done
test "x$ax_cv_gcc_archflag" = xunknown || break
done
fi
fi # $GCC=yes
])
AC_MSG_CHECKING([for gcc architecture flag])
AC_MSG_RESULT($ax_cv_gcc_archflag)
if test "x$ax_cv_gcc_archflag" = xunknown; then
m4_default([$3],:)
else
m4_default([$2], [CFLAGS="$CFLAGS $ax_cv_gcc_archflag"])
fi
])

View file

@ -0,0 +1,79 @@
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_gcc_x86_cpuid.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_GCC_X86_CPUID(OP)
#
# DESCRIPTION
#
# On Pentium and later x86 processors, with gcc or a compiler that has a
# compatible syntax for inline assembly instructions, run a small program
# that executes the cpuid instruction with input OP. This can be used to
# detect the CPU type.
#
# On output, the values of the eax, ebx, ecx, and edx registers are stored
# as hexadecimal strings as "eax:ebx:ecx:edx" in the cache variable
# ax_cv_gcc_x86_cpuid_OP.
#
# If the cpuid instruction fails (because you are running a
# cross-compiler, or because you are not using gcc, or because you are on
# a processor that doesn't have this instruction), ax_cv_gcc_x86_cpuid_OP
# is set to the string "unknown".
#
# This macro mainly exists to be used in AX_GCC_ARCHFLAG.
#
# LICENSE
#
# Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
# Copyright (c) 2008 Matteo Frigo
#
# 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 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 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, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
# scripts that are the output of Autoconf when processing the Macro. You
# need not follow the terms of the GNU General Public License when using
# or distributing such scripts, even though portions of the text of the
# Macro appear in them. The GNU General Public License (GPL) does govern
# all other use of the material that constitutes the Autoconf Macro.
#
# This special exception to the GPL applies to versions of the Autoconf
# Macro released by the Autoconf Archive. When you make and distribute a
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
#serial 7
AC_DEFUN([AX_GCC_X86_CPUID],
[AC_REQUIRE([AC_PROG_CC])
AC_LANG_PUSH([C])
AC_CACHE_CHECK(for x86 cpuid $1 output, ax_cv_gcc_x86_cpuid_$1,
[AC_RUN_IFELSE([AC_LANG_PROGRAM([#include <stdio.h>], [
int op = $1, eax, ebx, ecx, edx;
FILE *f;
__asm__("cpuid"
: "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx)
: "a" (op));
f = fopen("conftest_cpuid", "w"); if (!f) return 1;
fprintf(f, "%x:%x:%x:%x\n", eax, ebx, ecx, edx);
fclose(f);
return 0;
])],
[ax_cv_gcc_x86_cpuid_$1=`cat conftest_cpuid`; rm -f conftest_cpuid],
[ax_cv_gcc_x86_cpuid_$1=unknown; rm -f conftest_cpuid],
[ax_cv_gcc_x86_cpuid_$1=unknown])])
AC_LANG_POP([C])
])

View file

@ -0,0 +1,515 @@
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_have_qt.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_HAVE_QT [--with-Qt-dir=DIR] [--with-Qt-lib-dir=DIR] [--with-Qt-lib=LIB]
# AX_HAVE_QT [--with-Qt-include-dir=DIR] [--with-Qt-bin-dir=DIR] [--with-Qt-lib-dir=DIR] [--with-Qt-lib=LIB]
#
# DESCRIPTION
#
# Searches common directories for Qt include files, libraries and Qt
# binary utilities. The macro supports several different versions of the
# Qt framework being installed on the same machine. Without options, the
# macro is designed to look for the latest library, i.e., the highest
# definition of QT_VERSION in qglobal.h. By use of one or more options a
# different library may be selected. There are two different sets of
# options. Both sets contain the option --with-Qt-lib=LIB which can be
# used to force the use of a particular version of the library file when
# more than one are available. LIB must be in the form as it would appear
# behind the "-l" option to the compiler. Examples for LIB would be
# "qt-mt" for the multi-threaded version and "qt" for the regular version.
# In addition to this, the first set consists of an option
# --with-Qt-dir=DIR which can be used when the installation conforms to
# Trolltech's standard installation, which means that header files are in
# DIR/include, binary utilities are in DIR/bin and the library is in
# DIR/lib. The second set of options can be used to indicate individual
# locations for the header files, the binary utilities and the library
# file, in addition to the specific version of the library file.
#
# The following shell variable is set to either "yes" or "no":
#
# have_qt
#
# Additionally, the following variables are exported:
#
# QT_CXXFLAGS
# QT_LIBS
# QT_MOC
# QT_UIC
# QT_LRELEASE
# QT_LUPDATE
# QT_DIR
#
# which respectively contain an "-I" flag pointing to the Qt include
# directory (and "-DQT_THREAD_SUPPORT" when LIB is "qt-mt"), link flags
# necessary to link with Qt and X, the name of the meta object compiler
# and the user interface compiler both with full path, and finaly the
# variable QTDIR as Trolltech likes to see it defined (if possible).
#
# Example lines for Makefile.in:
#
# CXXFLAGS = @QT_CXXFLAGS@
# MOC = @QT_MOC@
#
# After the variables have been set, a trial compile and link is performed
# to check the correct functioning of the meta object compiler. This test
# may fail when the different detected elements stem from different
# releases of the Qt framework. In that case, an error message is emitted
# and configure stops.
#
# No common variables such as $LIBS or $CFLAGS are polluted.
#
# Options:
#
# --with-Qt-dir=DIR: DIR is equal to $QTDIR if you have followed the
# installation instructions of Trolltech. Header files are in DIR/include,
# binary utilities are in DIR/bin and the library is in DIR/lib.
#
# --with-Qt-include-dir=DIR: Qt header files are in DIR.
#
# --with-Qt-bin-dir=DIR: Qt utilities such as moc and uic are in DIR.
#
# --with-Qt-lib-dir=DIR: The Qt library is in DIR.
#
# --with-Qt-lib=LIB: Use -lLIB to link with the Qt library.
#
# If some option "=no" or, equivalently, a --without-Qt-* version is given
# in stead of a --with-Qt-*, "have_qt" is set to "no" and the other
# variables are set to the empty string.
#
# LICENSE
#
# Copyright (c) 2008 Bastiaan Veelo <Bastiaan@Veelo.net>
#
# 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 10
dnl Calls AX_PATH_QT_DIRECT (contained in this file) as a subroutine.
AU_ALIAS([BNV_HAVE_QT], [AX_HAVE_QT])
AC_DEFUN([AX_HAVE_QT],
[
AC_REQUIRE([AC_PROG_CXX])
AC_REQUIRE([AC_PATH_X])
AC_REQUIRE([AC_PATH_XTRA])
AC_MSG_CHECKING(for Qt)
AC_ARG_WITH([Qt-dir],
AS_HELP_STRING([--with-Qt-dir=DIR],
[DIR is equal to $QTDIR if you have followed the
installation instructions of Trolltech. Header
files are in DIR/include, binary utilities are
in DIR/bin. The library is in DIR/lib, unless
--with-Qt-lib-dir is also set.]))
AC_ARG_WITH([Qt-include-dir],
AS_HELP_STRING([--with-Qt-include-dir=DIR],
[Qt header files are in DIR]))
AC_ARG_WITH([Qt-bin-dir],
AS_HELP_STRING([--with-Qt-bin-dir=DIR],
[Qt utilities such as moc and uic are in DIR]))
AC_ARG_WITH([Qt-lib-dir],
AS_HELP_STRING([--with-Qt-lib-dir=DIR],
[The Qt library is in DIR]))
AC_ARG_WITH([Qt-lib],
AS_HELP_STRING([--with-Qt-lib=LIB],
[Use -lLIB to link with the Qt library]))
if test x"$with_Qt_dir" = x"no" ||
test x"$with_Qt_include-dir" = x"no" ||
test x"$with_Qt_bin_dir" = x"no" ||
test x"$with_Qt_lib_dir" = x"no" ||
test x"$with_Qt_lib" = x"no"; then
# user disabled Qt. Leave cache alone.
have_qt="User disabled Qt."
else
# "yes" is a bogus option
if test x"$with_Qt_dir" = xyes; then
with_Qt_dir=
fi
if test x"$with_Qt_include_dir" = xyes; then
with_Qt_include_dir=
fi
if test x"$with_Qt_bin_dir" = xyes; then
with_Qt_bin_dir=
fi
if test x"$with_Qt_lib_dir" = xyes; then
with_Qt_lib_dir=
fi
if test x"$with_Qt_lib" = xyes; then
with_Qt_lib=
fi
# No Qt unless we discover otherwise
have_qt=no
# Check whether we are requested to link with a specific version
if test x"$with_Qt_lib" != x; then
ax_qt_lib="$with_Qt_lib"
fi
# Check whether we were supplied with an answer already
if test x"$with_Qt_dir" != x; then
have_qt=yes
ax_qt_dir="$with_Qt_dir"
ax_qt_include_dir="$with_Qt_dir/include"
ax_qt_bin_dir="$with_Qt_dir/bin"
ax_qt_lib_dir="$with_Qt_dir/lib"
# Only search for the lib if the user did not define one already
if test x"$ax_qt_lib" = x; then
ax_qt_lib="`ls $ax_qt_lib_dir/libqt* | sed -n 1p |
sed s@$ax_qt_lib_dir/lib@@ | [sed s@[.].*@@]`"
fi
ax_qt_LIBS="-L$ax_qt_lib_dir -l$ax_qt_lib $X_PRE_LIBS $X_LIBS -lX11 -lXext -lXmu -lXt -lXi $X_EXTRA_LIBS"
else
# Use cached value or do search, starting with suggestions from
# the command line
AC_CACHE_VAL(ax_cv_have_qt,
[
# We are not given a solution and there is no cached value.
ax_qt_dir=NO
ax_qt_include_dir=NO
ax_qt_lib_dir=NO
if test x"$ax_qt_lib" = x; then
ax_qt_lib=NO
fi
AX_PATH_QT_DIRECT
if test "$ax_qt_dir" = NO ||
test "$ax_qt_include_dir" = NO ||
test "$ax_qt_lib_dir" = NO ||
test "$ax_qt_lib" = NO; then
# Problem with finding complete Qt. Cache the known absence of Qt.
ax_cv_have_qt="have_qt=no"
else
# Record where we found Qt for the cache.
ax_cv_have_qt="have_qt=yes \
ax_qt_dir=$ax_qt_dir \
ax_qt_include_dir=$ax_qt_include_dir \
ax_qt_bin_dir=$ax_qt_bin_dir \
ax_qt_LIBS=\"$ax_qt_LIBS\""
fi
])dnl
eval "$ax_cv_have_qt"
fi # all $ax_qt_* are set
fi # $have_qt reflects the system status
if test x"$have_qt" = xyes; then
QT_CXXFLAGS="-I$ax_qt_include_dir"
if test x"$ax_qt_lib" = xqt-mt; then
QT_CXXFLAGS="$QT_CXXFLAGS -DQT_THREAD_SUPPORT"
fi
QT_DIR="$ax_qt_dir"
QT_LIBS="$ax_qt_LIBS"
# If ax_qt_dir is defined, utilities are expected to be in the
# bin subdirectory
if test x"$ax_qt_dir" != x; then
if test -x "$ax_qt_dir/bin/uic"; then
QT_UIC="$ax_qt_dir/bin/uic"
else
# Old versions of Qt don't have uic
QT_UIC=
fi
QT_MOC="$ax_qt_dir/bin/moc"
QT_LRELEASE="$ax_qt_dir/bin/lrelease"
QT_LUPDATE="$ax_qt_dir/bin/lupdate"
else
# Or maybe we are told where to look for the utilities
if test x"$ax_qt_bin_dir" != x; then
if test -x "$ax_qt_bin_dir/uic"; then
QT_UIC="$ax_qt_bin_dir/uic"
else
# Old versions of Qt don't have uic
QT_UIC=
fi
QT_MOC="$ax_qt_bin_dir/moc"
QT_LRELEASE="$ax_qt_bin_dir/lrelease"
QT_LUPDATE="$ax_qt_bin_dir/lupdate"
else
# Last possibility is that they are in $PATH
QT_UIC="`which uic`"
QT_MOC="`which moc`"
QT_LRELEASE="`which lrelease`"
QT_LUPDATE="`which lupdate`"
fi
fi
# All variables are defined, report the result
AC_MSG_RESULT([$have_qt:
QT_CXXFLAGS=$QT_CXXFLAGS
QT_DIR=$QT_DIR
QT_LIBS=$QT_LIBS
QT_UIC=$QT_UIC
QT_MOC=$QT_MOC
QT_LRELEASE=$QT_LRELEASE
QT_LUPDATE=$QT_LUPDATE])
else
# Qt was not found
QT_CXXFLAGS=
QT_DIR=
QT_LIBS=
QT_UIC=
QT_MOC=
QT_LRELEASE=
QT_LUPDATE=
AC_MSG_RESULT($have_qt)
fi
AC_SUBST(QT_CXXFLAGS)
AC_SUBST(QT_DIR)
AC_SUBST(QT_LIBS)
AC_SUBST(QT_UIC)
AC_SUBST(QT_MOC)
AC_SUBST(QT_LRELEASE)
AC_SUBST(QT_LUPDATE)
#### Being paranoid:
if test x"$have_qt" = xyes; then
AC_MSG_CHECKING(correct functioning of Qt installation)
AC_CACHE_VAL(ax_cv_qt_test_result,
[
cat > ax_qt_test.h << EOF
#include <qobject.h>
class Test : public QObject
{
Q_OBJECT
public:
Test() {}
~Test() {}
public slots:
void receive() {}
signals:
void send();
};
EOF
cat > ax_qt_main.$ac_ext << EOF
#include "ax_qt_test.h"
#include <qapplication.h>
int main( int argc, char **argv )
{
QApplication app( argc, argv );
Test t;
QObject::connect( &t, SIGNAL(send()), &t, SLOT(receive()) );
}
EOF
ax_cv_qt_test_result="failure"
ax_try_1="$QT_MOC ax_qt_test.h -o moc_ax_qt_test.$ac_ext >/dev/null 2>/dev/null"
AC_TRY_EVAL(ax_try_1)
if test x"$ac_status" != x0; then
echo "$ax_err_1" >&AS_MESSAGE_LOG_FD
echo "configure: could not run $QT_MOC on:" >&AS_MESSAGE_LOG_FD
cat ax_qt_test.h >&AS_MESSAGE_LOG_FD
else
ax_try_2="$CXX $QT_CXXFLAGS -c $CXXFLAGS -o moc_ax_qt_test.o moc_ax_qt_test.$ac_ext >/dev/null 2>/dev/null"
AC_TRY_EVAL(ax_try_2)
if test x"$ac_status" != x0; then
echo "$ax_err_2" >&AS_MESSAGE_LOG_FD
echo "configure: could not compile:" >&AS_MESSAGE_LOG_FD
cat moc_ax_qt_test.$ac_ext >&AS_MESSAGE_LOG_FD
else
ax_try_3="$CXX $QT_CXXFLAGS -c $CXXFLAGS -o ax_qt_main.o ax_qt_main.$ac_ext >/dev/null 2>/dev/null"
AC_TRY_EVAL(ax_try_3)
if test x"$ac_status" != x0; then
echo "$ax_err_3" >&AS_MESSAGE_LOG_FD
echo "configure: could not compile:" >&AS_MESSAGE_LOG_FD
cat ax_qt_main.$ac_ext >&AS_MESSAGE_LOG_FD
else
ax_try_4="$CXX -o ax_qt_main ax_qt_main.o moc_ax_qt_test.o $QT_LIBS $LIBS >/dev/null 2>/dev/null"
AC_TRY_EVAL(ax_try_4)
if test x"$ac_status" != x0; then
echo "$ax_err_4" >&AS_MESSAGE_LOG_FD
else
ax_cv_qt_test_result="success"
fi
fi
fi
fi
])dnl AC_CACHE_VAL ax_cv_qt_test_result
AC_MSG_RESULT([$ax_cv_qt_test_result])
if test x"$ax_cv_qt_test_result" = "xfailure"; then
AC_MSG_ERROR([Failed to find matching components of a complete
Qt installation. Try using more options,
see ./configure --help.])
fi
rm -f ax_qt_test.h moc_ax_qt_test.$ac_ext moc_ax_qt_test.o \
ax_qt_main.$ac_ext ax_qt_main.o ax_qt_main
fi
])
dnl Internal subroutine of AX_HAVE_QT
dnl Set ax_qt_dir ax_qt_include_dir ax_qt_bin_dir ax_qt_lib_dir ax_qt_lib
AC_DEFUN([AX_PATH_QT_DIRECT],
[
## Binary utilities ##
if test x"$with_Qt_bin_dir" != x; then
ax_qt_bin_dir=$with_Qt_bin_dir
fi
## Look for header files ##
if test x"$with_Qt_include_dir" != x; then
ax_qt_include_dir="$with_Qt_include_dir"
else
# The following header file is expected to define QT_VERSION.
qt_direct_test_header=qglobal.h
# Look for the header file in a standard set of common directories.
ax_include_path_list="
/usr/include
`ls -dr ${QTDIR}/include 2>/dev/null`
`ls -dr /usr/include/qt* 2>/dev/null`
`ls -dr /usr/lib/qt*/include 2>/dev/null`
`ls -dr /usr/local/qt*/include 2>/dev/null`
`ls -dr /opt/qt*/include 2>/dev/null`
`ls -dr /Developer/qt*/include 2>/dev/null`
"
for ax_dir in $ax_include_path_list; do
if test -r "$ax_dir/$qt_direct_test_header"; then
ax_dirs="$ax_dirs $ax_dir"
fi
done
# Now look for the newest in this list
ax_prev_ver=0
for ax_dir in $ax_dirs; do
ax_this_ver=`egrep -w '#define QT_VERSION' $ax_dir/$qt_direct_test_header | sed s/'#define QT_VERSION'//`
if expr $ax_this_ver '>' $ax_prev_ver > /dev/null; then
ax_qt_include_dir=$ax_dir
ax_prev_ver=$ax_this_ver
fi
done
fi dnl Found header files.
# Are these headers located in a traditional Trolltech installation?
# That would be $ax_qt_include_dir stripped from its last element:
ax_possible_qt_dir=`dirname $ax_qt_include_dir`
if (test -x $ax_possible_qt_dir/bin/moc) &&
((ls $ax_possible_qt_dir/lib/libqt* > /dev/null 2>/dev/null) ||
(ls $ax_possible_qt_dir/lib64/libqt* > /dev/null 2>/dev/null)); then
# Then the rest is a piece of cake
ax_qt_dir=$ax_possible_qt_dir
ax_qt_bin_dir="$ax_qt_dir/bin"
if test x"$with_Qt_lib_dir" != x; then
ax_qt_lib_dir="$with_Qt_lib_dir"
else
if (test -d $ax_qt_dir/lib64); then
ax_qt_lib_dir="$ax_qt_dir/lib64"
else
ax_qt_lib_dir="$ax_qt_dir/lib"
fi
fi
# Only look for lib if the user did not supply it already
if test x"$ax_qt_lib" = xNO; then
ax_qt_lib="`ls $ax_qt_lib_dir/libqt* | sed -n 1p |
sed s@$ax_qt_lib_dir/lib@@ | [sed s@[.].*@@]`"
fi
ax_qt_LIBS="-L$ax_qt_lib_dir -l$ax_qt_lib $X_PRE_LIBS $X_LIBS -lX11 -lXext -lXmu -lXt -lXi $X_EXTRA_LIBS"
else
# There is no valid definition for $QTDIR as Trolltech likes to see it
ax_qt_dir=
## Look for Qt library ##
if test x"$with_Qt_lib_dir" != x; then
ax_qt_lib_dir="$with_Qt_lib_dir"
# Only look for lib if the user did not supply it already
if test x"$ax_qt_lib" = xNO; then
ax_qt_lib="`ls $ax_qt_lib_dir/libqt* | sed -n 1p |
sed s@$ax_qt_lib_dir/lib@@ | [sed s@[.].*@@]`"
fi
ax_qt_LIBS="-L$ax_qt_lib_dir -l$ax_qt_lib $X_PRE_LIBS $X_LIBS -lX11 -lXext -lXmu -lXt -lXi $X_EXTRA_LIBS"
else
# Normally, when there is no traditional Trolltech installation,
# the library is installed in a place where the linker finds it
# automatically.
# If the user did not define the library name, try with qt
if test x"$ax_qt_lib" = xNO; then
ax_qt_lib=qt
fi
qt_direct_test_header=qapplication.h
qt_direct_test_main="
int argc;
char ** argv;
QApplication app(argc,argv);
"
# See if we find the library without any special options.
# Don't add top $LIBS permanently yet
ax_save_LIBS="$LIBS"
LIBS="-l$ax_qt_lib $X_PRE_LIBS $X_LIBS -lX11 -lXext -lXmu -lXt -lXi $X_EXTRA_LIBS"
ax_qt_LIBS="$LIBS"
ax_save_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="-I$ax_qt_include_dir"
AC_TRY_LINK([#include <$qt_direct_test_header>],
$qt_direct_test_main,
[
# Success.
# We can link with no special library directory.
ax_qt_lib_dir=
], [
# That did not work. Try the multi-threaded version
echo "Non-critical error, please neglect the above." >&AS_MESSAGE_LOG_FD
ax_qt_lib=qt-mt
LIBS="-l$ax_qt_lib $X_PRE_LIBS $X_LIBS -lX11 -lXext -lXmu -lXt -lXi $X_EXTRA_LIBS"
AC_TRY_LINK([#include <$qt_direct_test_header>],
$qt_direct_test_main,
[
# Success.
# We can link with no special library directory.
ax_qt_lib_dir=
], [
# That did not work. Try the OpenGL version
echo "Non-critical error, please neglect the above." >&AS_MESSAGE_LOG_FD
ax_qt_lib=qt-gl
LIBS="-l$ax_qt_lib $X_PRE_LIBS $X_LIBS -lX11 -lXext -lXmu -lXt -lXi $X_EXTRA_LIBS"
AC_TRY_LINK([#include <$qt_direct_test_header>],
$qt_direct_test_main,
[
# Success.
# We can link with no special library directory.
ax_qt_lib_dir=
], [
# That did not work. Maybe a library version I don't know about?
echo "Non-critical error, please neglect the above." >&AS_MESSAGE_LOG_FD
# Look for some Qt lib in a standard set of common directories.
ax_dir_list="
`echo $ax_qt_includes | sed ss/includess`
/lib
/usr/lib64
/usr/lib
/usr/local/lib64
/usr/local/lib
/opt/lib64
/opt/lib
`ls -dr /usr/lib64/qt* 2>/dev/null`
`ls -dr /usr/lib64/qt*/lib64 2>/dev/null`
`ls -dr /usr/lib/qt* 2>/dev/null`
`ls -dr /usr/local/qt* 2>/dev/null`
`ls -dr /opt/qt* 2>/dev/null`
"
for ax_dir in $ax_dir_list; do
if ls $ax_dir/libqt* >/dev/null 2>/dev/null; then
# Gamble that it's the first one...
ax_qt_lib="`ls $ax_dir/libqt* | sed -n 1p |
sed s@$ax_dir/lib@@ | sed s/[[.]].*//`"
ax_qt_lib_dir="$ax_dir"
break
fi
done
# Try with that one
LIBS="-l$ax_qt_lib $X_PRE_LIBS $X_LIBS -lX11 -lXext -lXmu -lXt -lXi $X_EXTRA_LIBS"
AC_TRY_LINK([#include <$qt_direct_test_header>],
$qt_direct_test_main,
[
# Success.
# We can link with no special library directory.
ax_qt_lib_dir=
], [
: # Leave ax_qt_lib_dir defined
])
])
])
])
if test x"$ax_qt_lib_dir" != x; then
ax_qt_LIBS="-L$ax_qt_lib_dir $LIBS"
else
ax_qt_LIBS="$LIBS"
fi
LIBS="$ax_save_LIBS"
CXXFLAGS="$ax_save_CXXFLAGS"
fi dnl $with_Qt_lib_dir was not given
fi dnl Done setting up for non-traditional Trolltech installation
])

View file

@ -0,0 +1,85 @@
# ===========================================================================
# https://www.gnu.org/software/autoconf-archive/ax_lib_crypto.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_LIB_CRYPTO([yes|no|auto])
#
# DESCRIPTION
#
# Searches for the 'crypto' library with the --with... option.
#
# If found, define HAVE_CRYPTO and macro CRYPTO_LIBS. Also defines
# CRYPTO_WITH_<algo> for the algorithms found available. Possible
# algorithms: AES BF CAMELLIA CAST DES IDEA RC2 RC5 MD2 MD4 MD5 SHA RIPEMD
# RSA DSA DH
#
# The argument is used if no --with...-crypto option is set. Value "yes"
# requires the configuration by default. Value "no" does not require it by
# default. Value "auto" configures the library only if available.
#
# See also AX_LIB_BEECRYPT and AX_LIB_GCRYPT.
#
# LICENSE
#
# Copyright (c) 2009 Fabien Coelho <autoconf.archive@coelho.net>
#
# 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 10
# AX_CHECK_CRYPTO_LIB([algo-name],[function])
AC_DEFUN([AX_CHECK_CRYPTO_LIB],[
AC_CHECK_LIB([crypto], $2, [
AC_DEFINE([CRYPTO_WITH_$1],[1],[Algorithm $1 in openssl crypto library])
])
])
# AX_LIB_CRYPTO([yes|no|auto])
AC_DEFUN([AX_LIB_CRYPTO],[
AC_MSG_CHECKING([whether openssl crypto is enabled])
AC_ARG_WITH([crypto],[ --with-crypto requite crypto library
--without-crypto disable crypto library],[
AC_MSG_RESULT([$withval])
ac_with_crypto=$withval
],[
AC_MSG_RESULT([$1])
ac_with_crypto=$1
])
if test "$ac_with_crypto" = "yes" -o "$ac_with_crypto" = "auto" ; then
AC_CHECK_HEADERS([openssl/opensslconf.h],[
AC_CHECK_LIB([crypto], [CRYPTO_lock],[
AC_DEFINE([HAVE_CRYPTO],[1],[Openssl crypto library is available])
HAVE_CRYPTO=1
AC_SUBST([CRYPTO_LIBS],[-lcrypto])
# ciphers
AX_CHECK_CRYPTO_LIB([AES],[AES_ecb_encrypt])
AX_CHECK_CRYPTO_LIB([BF],[BF_ecb_encrypt])
AX_CHECK_CRYPTO_LIB([CAST],[CAST_ecb_encrypt])
AX_CHECK_CRYPTO_LIB([CAMELLIA],[Camellia_ecb_encrypt])
AX_CHECK_CRYPTO_LIB([DES],[DES_ecb_encrypt])
AX_CHECK_CRYPTO_LIB([IDEA],[idea_ecb_encrypt])
AX_CHECK_CRYPTO_LIB([RC2],[RC2_ecb_encrypt])
AX_CHECK_CRYPTO_LIB([RC5],[RC5_32_ecb_encrypt])
# digests
AX_CHECK_CRYPTO_LIB([MD2],[MD2])
AX_CHECK_CRYPTO_LIB([MD4],[MD4])
AX_CHECK_CRYPTO_LIB([MD5],[MD5])
AX_CHECK_CRYPTO_LIB([RIPEMD],[RIPEMD160])
AX_CHECK_CRYPTO_LIB([SHA],[SHA1])
# others
AX_CHECK_CRYPTO_LIB([RSA],[RSA_set_method])
AX_CHECK_CRYPTO_LIB([DSA],[DSA_set_method])
AX_CHECK_CRYPTO_LIB([DH],[DH_set_method])
])
])
# complain only if crypto as *explicitly* required
if test "$ac_with_crypto" = "yes" -a "x$HAVE_CRYPTO" = "x" ; then
AC_MSG_ERROR([cannot configure required openssl crypto library])
fi
fi
])

View file

@ -0,0 +1,108 @@
# ===========================================================================
# https://www.gnu.org/software/autoconf-archive/ax_lib_gcrypt.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_LIB_GCRYPT([yes|no|auto])
#
# DESCRIPTION
#
# Searches for the 'gcrypt' library with the --with... option.
#
# If found, define HAVE_GCRYPT and macro GCRYPT_LIBS and GCRYPT_CFLAGS.
# Also defines GCRYPT_WITH_<algo> for the algorithms found available.
# Possible algorithms are: AES ARCFOUR BLOWFISH CAST5 DES IDEA RFC2268
# SERPENT TWOFISH CRC HAVAL MD2 MD4 MD5 RMD160 SHA0 SHA1 SHA224 SHA256
# SHA384 SHA512 TIGER WHIRLPOOL DSA ELGAMAL RSA
#
# The argument is used if no --with...-gcrypt option is set. Value "yes"
# requires the configuration by default. Value "no" does not require it by
# default. Value "auto" configures the library only if available.
#
# See also AX_LIB_BEECRYPT and AX_LIB_CRYPTO.
#
# LICENSE
#
# Copyright (c) 2009 Fabien Coelho <autoconf.archive@coelho.net>
#
# 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 12
# AX_CHECK_GCRYPT_ALGO([algo])
# generate convenient defines for each algorithm
AC_DEFUN([AX_CHECK_GCRYPT_ALGO],[
AC_REQUIRE([AC_PROG_EGREP])
AC_MSG_CHECKING([for $1 in gcrypt])
if echo $gcrypt_algos | $EGREP -i ":.*( $1 | $1$)" > /dev/null ; then
AC_DEFINE([GCRYPT_WITH_$1],[1],[Algorithm $1 in gcrypt library])
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
])
# AX_LIB_GCRYPT([yes|no|auto])
AC_DEFUN([AX_LIB_GCRYPT],[
AC_MSG_CHECKING([whether gcrypt is enabled])
AC_ARG_WITH([gcrypt],[ --with-gcrypt require gcrypt library
--without-gcrypt disable gcrypt library],[
AC_MSG_RESULT([$withval])
ac_with_gcrypt=$withval
],[
AC_MSG_RESULT($1)
ac_with_gcrypt=$1
])
if test "$ac_with_gcrypt" = "yes" -o "$ac_with_gcrypt" = "auto" ; then
AM_PATH_LIBGCRYPT([1.2.0],[
AC_DEFINE([HAVE_GCRYPT],[1],[Gcrypt library is available])
HAVE_GCRYPT=1
# checking for available algorithms...
gcrypt_algos=`$LIBGCRYPT_CONFIG --algorithms`
# ciphers
# this does not work with a "for" loop: nothing generated in config.h:-(
AX_CHECK_GCRYPT_ALGO([AES])
AX_CHECK_GCRYPT_ALGO([ARCFOUR])
AX_CHECK_GCRYPT_ALGO([BLOWFISH])
AX_CHECK_GCRYPT_ALGO([CAST5])
AX_CHECK_GCRYPT_ALGO([DES])
AX_CHECK_GCRYPT_ALGO([IDEA])
AX_CHECK_GCRYPT_ALGO([RFC2268])
AX_CHECK_GCRYPT_ALGO([SERPENT])
AX_CHECK_GCRYPT_ALGO([TWOFISH])
# digests
AX_CHECK_GCRYPT_ALGO([CRC])
AX_CHECK_GCRYPT_ALGO([HAVAL])
AX_CHECK_GCRYPT_ALGO([MD2])
AX_CHECK_GCRYPT_ALGO([MD4])
AX_CHECK_GCRYPT_ALGO([MD5])
AX_CHECK_GCRYPT_ALGO([RMD160])
AX_CHECK_GCRYPT_ALGO([SHA0])
AX_CHECK_GCRYPT_ALGO([SHA1])
AX_CHECK_GCRYPT_ALGO([SHA224])
AX_CHECK_GCRYPT_ALGO([SHA256])
AX_CHECK_GCRYPT_ALGO([SHA384])
AX_CHECK_GCRYPT_ALGO([SHA512])
AX_CHECK_GCRYPT_ALGO([TIGER])
AX_CHECK_GCRYPT_ALGO([WHIRLPOOL])
# others
AX_CHECK_GCRYPT_ALGO([DSA])
AX_CHECK_GCRYPT_ALGO([ELGAMAL])
AX_CHECK_GCRYPT_ALGO([RSA])
# conclusion
GCRYPT_CFLAGS=`$LIBGCRYPT_CONFIG --cflags`
GCRYPT_LIBS=`$LIBGCRYPT_CONFIG --libs`
AC_SUBST(GCRYPT_CFLAGS)
AC_SUBST(GCRYPT_LIBS)
],[
# complain only if explicitly required
if test "$ac_with_gcrypt" = "yes" ; then
AC_MSG_ERROR([cannot configure required gcrypt library])
fi
])
fi
])

View file

@ -0,0 +1,147 @@
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_lib_mysql.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_LIB_MYSQL([MINIMUM-VERSION])
#
# DESCRIPTION
#
# This macro provides tests of availability of MySQL client library of
# particular version or newer.
#
# AX_LIB_MYSQL macro takes only one argument which is optional. If there
# is no required version passed, then macro does not run version test.
#
# The --with-mysql option takes one of three possible values:
#
# no - do not check for MySQL client library
#
# yes - do check for MySQL library in standard locations (mysql_config
# should be in the PATH)
#
# path - complete path to mysql_config utility, use this option if
# mysql_config can't be found in the PATH
#
# This macro calls:
#
# AC_SUBST(MYSQL_CFLAGS)
# AC_SUBST(MYSQL_LDFLAGS)
# AC_SUBST(MYSQL_VERSION)
#
# And sets:
#
# HAVE_MYSQL
#
# LICENSE
#
# Copyright (c) 2008 Mateusz Loskot <mateusz@loskot.net>
#
# 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 12
AC_DEFUN([AX_LIB_MYSQL],
[
AC_ARG_WITH([mysql],
AS_HELP_STRING([--with-mysql=@<:@ARG@:>@],
[use MySQL client library @<:@default=yes@:>@, optionally specify path to mysql_config]
),
[
if test "$withval" = "no"; then
want_mysql="no"
elif test "$withval" = "yes"; then
want_mysql="yes"
else
want_mysql="yes"
MYSQL_CONFIG="$withval"
fi
],
[want_mysql="yes"]
)
AC_ARG_VAR([MYSQL_CONFIG], [Full path to mysql_config program])
MYSQL_CFLAGS=""
MYSQL_LDFLAGS=""
MYSQL_VERSION=""
dnl
dnl Check MySQL libraries
dnl
if test "$want_mysql" = "yes"; then
if test -z "$MYSQL_CONFIG" ; then
AC_PATH_PROGS([MYSQL_CONFIG], [mysql_config mysql_config5], [no])
fi
if test "$MYSQL_CONFIG" != "no"; then
MYSQL_CFLAGS="`$MYSQL_CONFIG --cflags`"
MYSQL_LDFLAGS="`$MYSQL_CONFIG --libs`"
MYSQL_VERSION=`$MYSQL_CONFIG --version`
found_mysql="yes"
else
found_mysql="no"
fi
fi
dnl
dnl Check if required version of MySQL is available
dnl
mysql_version_req=ifelse([$1], [], [], [$1])
if test "$found_mysql" = "yes" -a -n "$mysql_version_req"; then
AC_MSG_CHECKING([if MySQL version is >= $mysql_version_req])
dnl Decompose required version string of MySQL
dnl and calculate its number representation
mysql_version_req_major=`expr $mysql_version_req : '\([[0-9]]*\)'`
mysql_version_req_minor=`expr $mysql_version_req : '[[0-9]]*\.\([[0-9]]*\)'`
mysql_version_req_micro=`expr $mysql_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
if test "x$mysql_version_req_micro" = "x"; then
mysql_version_req_micro="0"
fi
mysql_version_req_number=`expr $mysql_version_req_major \* 1000000 \
\+ $mysql_version_req_minor \* 1000 \
\+ $mysql_version_req_micro`
dnl Decompose version string of installed MySQL
dnl and calculate its number representation
mysql_version_major=`expr $MYSQL_VERSION : '\([[0-9]]*\)'`
mysql_version_minor=`expr $MYSQL_VERSION : '[[0-9]]*\.\([[0-9]]*\)'`
mysql_version_micro=`expr $MYSQL_VERSION : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
if test "x$mysql_version_micro" = "x"; then
mysql_version_micro="0"
fi
mysql_version_number=`expr $mysql_version_major \* 1000000 \
\+ $mysql_version_minor \* 1000 \
\+ $mysql_version_micro`
mysql_version_check=`expr $mysql_version_number \>\= $mysql_version_req_number`
if test "$mysql_version_check" = "1"; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
fi
if test "$found_mysql" = "yes" ; then
AC_DEFINE([HAVE_MYSQL], [1],
[Define to 1 if MySQL libraries are available])
fi
AC_SUBST([MYSQL_VERSION])
AC_SUBST([MYSQL_CFLAGS])
AC_SUBST([MYSQL_LDFLAGS])
])

View file

@ -0,0 +1,155 @@
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_lib_postgresql.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_LIB_POSTGRESQL([MINIMUM-VERSION])
#
# DESCRIPTION
#
# This macro provides tests of availability of PostgreSQL 'libpq' library
# of particular version or newer.
#
# AX_LIB_POSTGRESQL macro takes only one argument which is optional. If
# there is no required version passed, then macro does not run version
# test.
#
# The --with-postgresql option takes one of three possible values:
#
# no - do not check for PostgreSQL client library
#
# yes - do check for PostgreSQL library in standard locations (pg_config
# should be in the PATH)
#
# path - complete path to pg_config utility, use this option if pg_config
# can't be found in the PATH
#
# This macro calls:
#
# AC_SUBST(POSTGRESQL_CFLAGS)
# AC_SUBST(POSTGRESQL_LDFLAGS)
# AC_SUBST(POSTGRESQL_VERSION)
#
# And sets:
#
# HAVE_POSTGRESQL
#
# LICENSE
#
# Copyright (c) 2008 Mateusz Loskot <mateusz@loskot.net>
#
# 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 9
AC_DEFUN([AX_LIB_POSTGRESQL],
[
AC_ARG_WITH([postgresql],
AS_HELP_STRING([--with-postgresql=@<:@ARG@:>@],
[use PostgreSQL library @<:@default=yes@:>@, optionally specify path to pg_config]
),
[
if test "$withval" = "no"; then
want_postgresql="no"
elif test "$withval" = "yes"; then
want_postgresql="yes"
else
want_postgresql="yes"
PG_CONFIG="$withval"
fi
],
[want_postgresql="yes"]
)
POSTGRESQL_CFLAGS=""
POSTGRESQL_LDFLAGS=""
POSTGRESQL_VERSION=""
dnl
dnl Check PostgreSQL libraries (libpq)
dnl
if test "$want_postgresql" = "yes"; then
if test -z "$PG_CONFIG" -o test; then
AC_PATH_PROG([PG_CONFIG], [pg_config], [])
fi
if test ! -x "$PG_CONFIG"; then
AC_MSG_ERROR([$PG_CONFIG does not exist or it is not an exectuable file])
PG_CONFIG="no"
found_postgresql="no"
fi
if test "$PG_CONFIG" != "no"; then
AC_MSG_CHECKING([for PostgreSQL libraries])
POSTGRESQL_CFLAGS="-I`$PG_CONFIG --includedir`"
POSTGRESQL_LDFLAGS="-L`$PG_CONFIG --libdir` -lpq"
POSTGRESQL_VERSION=`$PG_CONFIG --version | sed -e 's#PostgreSQL ##'`
AC_DEFINE([HAVE_POSTGRESQL], [1],
[Define to 1 if PostgreSQL libraries are available])
found_postgresql="yes"
AC_MSG_RESULT([yes])
else
found_postgresql="no"
AC_MSG_RESULT([no])
fi
fi
dnl
dnl Check if required version of PostgreSQL is available
dnl
postgresql_version_req=ifelse([$1], [], [], [$1])
if test "$found_postgresql" = "yes" -a -n "$postgresql_version_req"; then
AC_MSG_CHECKING([if PostgreSQL version is >= $postgresql_version_req])
dnl Decompose required version string of PostgreSQL
dnl and calculate its number representation
postgresql_version_req_major=`expr $postgresql_version_req : '\([[0-9]]*\)'`
postgresql_version_req_minor=`expr $postgresql_version_req : '[[0-9]]*\.\([[0-9]]*\)'`
postgresql_version_req_micro=`expr $postgresql_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
if test "x$postgresql_version_req_micro" = "x"; then
postgresql_version_req_micro="0"
fi
postgresql_version_req_number=`expr $postgresql_version_req_major \* 1000000 \
\+ $postgresql_version_req_minor \* 1000 \
\+ $postgresql_version_req_micro`
dnl Decompose version string of installed PostgreSQL
dnl and calculate its number representation
postgresql_version_major=`expr $POSTGRESQL_VERSION : '\([[0-9]]*\)'`
postgresql_version_minor=`expr $POSTGRESQL_VERSION : '[[0-9]]*\.\([[0-9]]*\)'`
postgresql_version_micro=`expr $POSTGRESQL_VERSION : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
if test "x$postgresql_version_micro" = "x"; then
postgresql_version_micro="0"
fi
postgresql_version_number=`expr $postgresql_version_major \* 1000000 \
\+ $postgresql_version_minor \* 1000 \
\+ $postgresql_version_micro`
postgresql_version_check=`expr $postgresql_version_number \>\= $postgresql_version_req_number`
if test "$postgresql_version_check" = "1"; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
fi
AC_SUBST([POSTGRESQL_VERSION])
AC_SUBST([POSTGRESQL_CFLAGS])
AC_SUBST([POSTGRESQL_LDFLAGS])
])

View file

@ -0,0 +1,156 @@
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_lib_sqlite3.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_LIB_SQLITE3([MINIMUM-VERSION])
#
# DESCRIPTION
#
# Test for the SQLite 3 library of a particular version (or newer)
#
# This macro takes only one optional argument, required version of SQLite
# 3 library. If required version is not passed, 3.0.0 is used in the test
# of existance of SQLite 3.
#
# If no intallation prefix to the installed SQLite library is given the
# macro searches under /usr, /usr/local, and /opt.
#
# This macro calls:
#
# AC_SUBST(SQLITE3_CFLAGS)
# AC_SUBST(SQLITE3_LDFLAGS)
# AC_SUBST(SQLITE3_VERSION)
#
# And sets:
#
# HAVE_SQLITE3
#
# LICENSE
#
# Copyright (c) 2008 Mateusz Loskot <mateusz@loskot.net>
#
# 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 14
AC_DEFUN([AX_LIB_SQLITE3],
[
AC_ARG_WITH([sqlite3],
AS_HELP_STRING(
[--with-sqlite3=@<:@ARG@:>@],
[use SQLite 3 library @<:@default=yes@:>@, optionally specify the prefix for sqlite3 library]
),
[
if test "$withval" = "no"; then
WANT_SQLITE3="no"
elif test "$withval" = "yes"; then
WANT_SQLITE3="yes"
ac_sqlite3_path=""
else
WANT_SQLITE3="yes"
ac_sqlite3_path="$withval"
fi
],
[WANT_SQLITE3="yes"]
)
SQLITE3_CFLAGS=""
SQLITE3_LDFLAGS=""
SQLITE3_VERSION=""
if test "x$WANT_SQLITE3" = "xyes"; then
ac_sqlite3_header="sqlite3.h"
sqlite3_version_req=ifelse([$1], [], [3.0.0], [$1])
sqlite3_version_req_shorten=`expr $sqlite3_version_req : '\([[0-9]]*\.[[0-9]]*\)'`
sqlite3_version_req_major=`expr $sqlite3_version_req : '\([[0-9]]*\)'`
sqlite3_version_req_minor=`expr $sqlite3_version_req : '[[0-9]]*\.\([[0-9]]*\)'`
sqlite3_version_req_micro=`expr $sqlite3_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
if test "x$sqlite3_version_req_micro" = "x" ; then
sqlite3_version_req_micro="0"
fi
sqlite3_version_req_number=`expr $sqlite3_version_req_major \* 1000000 \
\+ $sqlite3_version_req_minor \* 1000 \
\+ $sqlite3_version_req_micro`
AC_MSG_CHECKING([for SQLite3 library >= $sqlite3_version_req])
if test "$ac_sqlite3_path" != ""; then
ac_sqlite3_ldflags="-L$ac_sqlite3_path/lib"
ac_sqlite3_cppflags="-I$ac_sqlite3_path/include"
else
for ac_sqlite3_path_tmp in /usr /usr/local /opt ; do
if test -f "$ac_sqlite3_path_tmp/include/$ac_sqlite3_header" \
&& test -r "$ac_sqlite3_path_tmp/include/$ac_sqlite3_header"; then
ac_sqlite3_path=$ac_sqlite3_path_tmp
ac_sqlite3_cppflags="-I$ac_sqlite3_path_tmp/include"
ac_sqlite3_ldflags="-L$ac_sqlite3_path_tmp/lib"
break;
fi
done
fi
ac_sqlite3_ldflags="$ac_sqlite3_ldflags -lsqlite3"
saved_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $ac_sqlite3_cppflags"
AC_LANG_PUSH(C)
AC_COMPILE_IFELSE(
[
AC_LANG_PROGRAM([[@%:@include <sqlite3.h>]],
[[
#if (SQLITE_VERSION_NUMBER >= $sqlite3_version_req_number)
/* Everything is okay */
#else
# error SQLite version is too old
#endif
]]
)
],
[
AC_MSG_RESULT([yes])
success="yes"
],
[
AC_MSG_RESULT([not found])
success="no"
]
)
AC_LANG_POP(C)
CPPFLAGS="$saved_CPPFLAGS"
if test "$success" = "yes"; then
SQLITE3_CFLAGS="$ac_sqlite3_cppflags"
SQLITE3_LDFLAGS="$ac_sqlite3_ldflags"
ac_sqlite3_header_path="$ac_sqlite3_path/include/$ac_sqlite3_header"
dnl Retrieve SQLite release version
if test "x$ac_sqlite3_header_path" != "x"; then
ac_sqlite3_version=`cat $ac_sqlite3_header_path \
| grep '#define.*SQLITE_VERSION.*\"' | sed -e 's/.* "//' \
| sed -e 's/"//'`
if test $ac_sqlite3_version != ""; then
SQLITE3_VERSION=$ac_sqlite3_version
else
AC_MSG_WARN([Cannot find SQLITE_VERSION macro in sqlite3.h header to retrieve SQLite version!])
fi
fi
AC_SUBST(SQLITE3_CFLAGS)
AC_SUBST(SQLITE3_LDFLAGS)
AC_SUBST(SQLITE3_VERSION)
AC_DEFINE([HAVE_SQLITE3], [], [Have the SQLITE3 library])
fi
fi
])

View file

@ -0,0 +1,101 @@
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_path_lib_pcre.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_PATH_LIB_PCRE [(A/NA)]
#
# DESCRIPTION
#
# check for pcre lib and set PCRE_LIBS and PCRE_CFLAGS accordingly.
#
# also provide --with-pcre option that may point to the $prefix of the
# pcre installation - the macro will check $pcre/include and $pcre/lib to
# contain the necessary files.
#
# the usual two ACTION-IF-FOUND / ACTION-IF-NOT-FOUND are supported and
# they can take advantage of the LIBS/CFLAGS additions.
#
# LICENSE
#
# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
#
# 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 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 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, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
# scripts that are the output of Autoconf when processing the Macro. You
# need not follow the terms of the GNU General Public License when using
# or distributing such scripts, even though portions of the text of the
# Macro appear in them. The GNU General Public License (GPL) does govern
# all other use of the material that constitutes the Autoconf Macro.
#
# This special exception to the GPL applies to versions of the Autoconf
# Macro released by the Autoconf Archive. When you make and distribute a
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
#serial 7
AC_DEFUN([AX_PATH_LIB_PCRE],[dnl
AC_MSG_CHECKING([lib pcre])
AC_ARG_WITH(pcre,
[ --with-pcre[[=prefix]] compile xmlpcre part (via libpcre check)],,
with_pcre="yes")
if test ".$with_pcre" = ".no" ; then
AC_MSG_RESULT([disabled])
m4_ifval($2,$2)
else
AC_MSG_RESULT([(testing)])
OLDLIBS="$LIBS"
AC_CHECK_LIB(pcre, pcre_study)
if test "$ac_cv_lib_pcre_pcre_study" = "yes" ; then
PCRE_LIBS="-lpcre"
AC_MSG_CHECKING([lib pcre])
AC_MSG_RESULT([$PCRE_LIBS])
m4_ifval($1,$1)
else
OLDLDFLAGS="$LDFLAGS" ; LDFLAGS="$LDFLAGS -L$with_pcre/lib"
OLDCPPFLAGS="$CPPFLAGS" ; CPPFLAGS="$CPPFLAGS -I$with_pcre/include"
AC_CHECK_LIB(pcre, pcre_compile)
CPPFLAGS="$OLDCPPFLAGS"
LDFLAGS="$OLDLDFLAGS"
if test "$ac_cv_lib_pcre_pcre_compile" = "yes" ; then
AC_MSG_RESULT(.setting PCRE_LIBS -L$with_pcre/lib -lpcre)
PCRE_LIBS="-L$with_pcre/lib -lpcre"
test -d "$with_pcre/include" && PCRE_CFLAGS="-I$with_pcre/include"
AC_MSG_CHECKING([lib pcre])
AC_MSG_RESULT([$PCRE_LIBS])
m4_ifval($1,$1)
else
AC_PATH_PROG([PKGCONFIG], [pkg-config], [no])
AC_MSG_CHECKING([lib pcre found with $PKGCONFIG])
if test "$PKGCONFIG" != "no" && `$PKGCONFIG --exists libpcre`
then
AC_MSG_RESULT([yes])
PCRE_LIBS=`$PKGCONFIG --libs libpcre`
PCRE_CFLAGS=`$PKGCONFIG --cflags libpcre`
m4_ifval($1,$1)
else
AC_MSG_RESULT([no])
m4_ifval($2,$2)
fi
fi
fi
LIBS="$OLDLIBS"
fi
AC_SUBST([PCRE_LIBS])
AC_SUBST([PCRE_CFLAGS])
])

View file

@ -0,0 +1,317 @@
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_pthread.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
#
# DESCRIPTION
#
# This macro figures out how to build C programs using POSIX threads. It
# sets the PTHREAD_LIBS output variable to the threads library and linker
# flags, and the PTHREAD_CFLAGS output variable to any special C compiler
# flags that are needed. (The user can also force certain compiler
# flags/libs to be tested by setting these environment variables.)
#
# Also sets PTHREAD_CC to any special C compiler that is needed for
# multi-threaded programs (defaults to the value of CC otherwise). (This
# is necessary on AIX to use the special cc_r compiler alias.)
#
# NOTE: You are assumed to not only compile your program with these flags,
# but also link it with them as well. e.g. you should link with
# $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS
#
# If you are only building threads programs, you may wish to use these
# variables in your default LIBS, CFLAGS, and CC:
#
# LIBS="$PTHREAD_LIBS $LIBS"
# CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
# CC="$PTHREAD_CC"
#
# In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant
# has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to that name
# (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
#
# Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the
# PTHREAD_PRIO_INHERIT symbol is defined when compiling with
# PTHREAD_CFLAGS.
#
# ACTION-IF-FOUND is a list of shell commands to run if a threads library
# is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it
# is not found. If ACTION-IF-FOUND is not specified, the default action
# will define HAVE_PTHREAD.
#
# Please let the authors know if this macro fails on any platform, or if
# you have any other suggestions or comments. This macro was based on work
# by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help
# from M. Frigo), as well as ac_pthread and hb_pthread macros posted by
# Alejandro Forero Cuervo to the autoconf macro repository. We are also
# grateful for the helpful feedback of numerous users.
#
# Updated for Autoconf 2.68 by Daniel Richard G.
#
# LICENSE
#
# Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
# Copyright (c) 2011 Daniel Richard G. <skunk@iSKUNK.ORG>
#
# 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 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 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, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
# scripts that are the output of Autoconf when processing the Macro. You
# need not follow the terms of the GNU General Public License when using
# or distributing such scripts, even though portions of the text of the
# Macro appear in them. The GNU General Public License (GPL) does govern
# all other use of the material that constitutes the Autoconf Macro.
#
# This special exception to the GPL applies to versions of the Autoconf
# Macro released by the Autoconf Archive. When you make and distribute a
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
#serial 20
AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD])
AC_DEFUN([AX_PTHREAD], [
AC_REQUIRE([AC_CANONICAL_HOST])
AC_LANG_PUSH([C])
ax_pthread_ok=no
# We used to check for pthread.h first, but this fails if pthread.h
# requires special compiler flags (e.g. on True64 or Sequent).
# It gets checked for in the link test anyway.
# First of all, check if the user has set any of the PTHREAD_LIBS,
# etcetera environment variables, and if threads linking works using
# them:
if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
save_LIBS="$LIBS"
LIBS="$PTHREAD_LIBS $LIBS"
AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
AC_TRY_LINK_FUNC(pthread_join, ax_pthread_ok=yes)
AC_MSG_RESULT($ax_pthread_ok)
if test x"$ax_pthread_ok" = xno; then
PTHREAD_LIBS=""
PTHREAD_CFLAGS=""
fi
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
fi
# We must check for the threads library under a number of different
# names; the ordering is very important because some systems
# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
# libraries is broken (non-POSIX).
# Create a list of thread flags to try. Items starting with a "-" are
# C compiler flags, and other items are library names, except for "none"
# which indicates that we try without any flags at all, and "pthread-config"
# which is a program returning the flags for the Pth emulation library.
ax_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
# The ordering *is* (sometimes) important. Some notes on the
# individual items follow:
# pthreads: AIX (must check this before -lpthread)
# none: in case threads are in libc; should be tried before -Kthread and
# other compiler flags to prevent continual compiler warnings
# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
# -pthreads: Solaris/gcc
# -mthreads: Mingw32/gcc, Lynx/gcc
# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
# doesn't hurt to check since this sometimes defines pthreads too;
# also defines -D_REENTRANT)
# ... -mt is also the pthreads flag for HP/aCC
# pthread: Linux, etcetera
# --thread-safe: KAI C++
# pthread-config: use pthread-config program (for GNU Pth library)
case ${host_os} in
solaris*)
# On Solaris (at least, for some versions), libc contains stubbed
# (non-functional) versions of the pthreads routines, so link-based
# tests will erroneously succeed. (We need to link with -pthreads/-mt/
# -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
# a function called by this macro, so we could check for that, but
# who knows whether they'll stub that too in a future libc.) So,
# we'll just look for -pthreads and -lpthread first:
ax_pthread_flags="-pthreads pthread -mt -pthread $ax_pthread_flags"
;;
darwin*)
ax_pthread_flags="-pthread $ax_pthread_flags"
;;
esac
if test x"$ax_pthread_ok" = xno; then
for flag in $ax_pthread_flags; do
case $flag in
none)
AC_MSG_CHECKING([whether pthreads work without any flags])
;;
-*)
AC_MSG_CHECKING([whether pthreads work with $flag])
PTHREAD_CFLAGS="$flag"
;;
pthread-config)
AC_CHECK_PROG(ax_pthread_config, pthread-config, yes, no)
if test x"$ax_pthread_config" = xno; then continue; fi
PTHREAD_CFLAGS="`pthread-config --cflags`"
PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
;;
*)
AC_MSG_CHECKING([for the pthreads library -l$flag])
PTHREAD_LIBS="-l$flag"
;;
esac
save_LIBS="$LIBS"
save_CFLAGS="$CFLAGS"
LIBS="$PTHREAD_LIBS $LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
# Check for various functions. We must include pthread.h,
# since some functions may be macros. (On the Sequent, we
# need a special flag -Kthread to make this header compile.)
# We check for pthread_join because it is in -lpthread on IRIX
# while pthread_create is in libc. We check for pthread_attr_init
# due to DEC craziness with -lpthreads. We check for
# pthread_cleanup_push because it is one of the few pthread
# functions on Solaris that doesn't have a non-functional libc stub.
# We try pthread_create on general principles.
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>
static void routine(void *a) { a = 0; }
static void *start_routine(void *a) { return a; }],
[pthread_t th; pthread_attr_t attr;
pthread_create(&th, 0, start_routine, 0);
pthread_join(th, 0);
pthread_attr_init(&attr);
pthread_cleanup_push(routine, 0);
pthread_cleanup_pop(0) /* ; */])],
[ax_pthread_ok=yes],
[])
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
AC_MSG_RESULT($ax_pthread_ok)
if test "x$ax_pthread_ok" = xyes; then
break;
fi
PTHREAD_LIBS=""
PTHREAD_CFLAGS=""
done
fi
# Various other checks:
if test "x$ax_pthread_ok" = xyes; then
save_LIBS="$LIBS"
LIBS="$PTHREAD_LIBS $LIBS"
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
# Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
AC_MSG_CHECKING([for joinable pthread attribute])
attr_name=unknown
for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
[int attr = $attr; return attr /* ; */])],
[attr_name=$attr; break],
[])
done
AC_MSG_RESULT($attr_name)
if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name,
[Define to necessary symbol if this constant
uses a non-standard name on your system.])
fi
AC_MSG_CHECKING([if more special flags are required for pthreads])
flag=no
case ${host_os} in
aix* | freebsd* | darwin*) flag="-D_THREAD_SAFE";;
osf* | hpux*) flag="-D_REENTRANT";;
solaris*)
if test "$GCC" = "yes"; then
flag="-D_REENTRANT"
else
flag="-mt -D_REENTRANT"
fi
;;
esac
AC_MSG_RESULT(${flag})
if test "x$flag" != xno; then
PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
fi
AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT],
ax_cv_PTHREAD_PRIO_INHERIT, [
AC_LINK_IFELSE([
AC_LANG_PROGRAM([[#include <pthread.h>]], [[int i = PTHREAD_PRIO_INHERIT;]])],
[ax_cv_PTHREAD_PRIO_INHERIT=yes],
[ax_cv_PTHREAD_PRIO_INHERIT=no])
])
AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes"],
AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], 1, [Have PTHREAD_PRIO_INHERIT.]))
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
# More AIX lossage: compile with *_r variant
if test "x$GCC" != xyes; then
case $host_os in
aix*)
AS_CASE(["x/$CC"],
[x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6],
[#handle absolute path differently from PATH based program lookup
AS_CASE(["x$CC"],
[x/*],
[AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"])],
[AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC])])])
;;
esac
fi
fi
test -n "$PTHREAD_CC" || PTHREAD_CC="$CC"
AC_SUBST(PTHREAD_LIBS)
AC_SUBST(PTHREAD_CFLAGS)
AC_SUBST(PTHREAD_CC)
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
if test x"$ax_pthread_ok" = xyes; then
ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
:
else
ax_pthread_ok=no
$2
fi
AC_LANG_POP
])dnl AX_PTHREAD

View file

@ -0,0 +1,64 @@
dnl AM_BZIP2([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
AC_DEFUN([AM_BZIP2],[dnl
AC_MSG_CHECKING([for compatible bzip2 library and headers])
AC_ARG_WITH([bzip2],
[ --with-bzip2[[=PATH]] Prefix where bzip2 is installed (optional)],
[bzip2_prefix="$withval"],
[bzip2_prefix="no"])
am_save_CPPFLAGS="$CPPFLAGS"
am_save_LIBS="$LIBS"
am_save_LDFLAGS="$LDFLAGS"
BZ2_LIBS="-lbz2"
BZ2_CFLAGS=""
report_have_bzip2="no"
if test "$bzip2_prefix" != "yes"
then
if test "$bzip2_prefix" != "no"
then
LIBS="-L$bzip2_prefix/lib -lbz2"
CPPFLAGS="-I$bzip2_prefix/include"
BZ2_LIBS="-L$bzip2_prefix/lib -lbz2"
BZ2_CFLAGS="-I$bzip2_prefix/include"
else
LIBS="$LIBS -lbz2"
BZ2_LIBS="-lbz2"
fi
else
LIBS="$LIBS -lbz2"
BZ2_LIBS="-lbz2"
fi
AC_LINK_IFELSE( [AC_LANG_SOURCE([[
#include <bzlib.h>
int main()
{
char* source = "Hello World";
char* dest;
unsigned int destLen = 1000;
unsigned int sourceLen = 1000;
int blockSize100k = 5;
int verbosity = 0;
int workFactor = 5;
BZ2_bzBuffToBuffCompress( dest, &destLen, source,
sourceLen, blockSize100k,
verbosity, workFactor);
}
]]) ],
[AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_BZIP2, 1, [ Define if you have bzip2. ])
AC_SUBST(BZ2_CFLAGS)
AC_SUBST(BZ2_LIBS)
report_have_bzip2="yes"
],
[
AC_MSG_RESULT(no)
]
)
CPPFLAGS=$am_save_CPPFLAGS
LIBS=$am_save_LIBS
LDFLAGS=$am_save_LDFLAGS
])

View file

@ -0,0 +1,64 @@
dnl AC_FIND_FUNC_NO_LIBS(func, libraries, includes, arguments)
AC_DEFUN([AC_FIND_FUNC_NO_LIBS], [
AC_MSG_CHECKING([for $1])
AC_CACHE_VAL(ac_cv_funclib_$1,
[
if eval "test \"\$ac_cv_func_$1\" != yes" ; then
ac_save_LIBS="$LIBS"
for ac_lib in "" $2; do
if test -n "$ac_lib"; then
ac_lib="-l$ac_lib"
LIBS="$ac_lib $ac_save_LIBS"
fi
AC_TRY_LINK([$3],[$1($4)],eval "if test -n \"$ac_lib\";then ac_cv_funclib_$1=$ac_lib; else ac_cv_funclib_$1=yes; fi";break)
done
eval "ac_cv_funclib_$1=\${ac_cv_funclib_$1-no}"
LIBS="$ac_save_LIBS"
fi
])
eval "ac_res=\$ac_cv_funclib_$1"
# autoheader tricks *sigh*
: << END
@@@funcs="$funcs $1"@@@
@@@libs="$libs $2"@@@
END
changequote(, )dnl
eval "ac_tr_func=HAVE_`echo $1 | tr '[a-z]' '[A-Z]'`"
eval "ac_tr_lib=HAVE_LIB`echo $ac_res | sed -e 's/-l//' | tr '[a-z]' '[A-Z]'`"
eval "LIB_$1=$ac_res"
changequote([, ])dnl
case "$ac_res" in
yes)
eval "ac_cv_func_$1=yes"
eval "LIB_$1="
AC_DEFINE_UNQUOTED($ac_tr_func)
AC_MSG_RESULT([yes])
;;
no)
eval "ac_cv_func_$1=no"
eval "LIB_$1="
AC_MSG_RESULT([no])
;;
*)
eval "ac_cv_func_$1=yes"
eval "ac_cv_lib_`echo "$ac_res" | sed 's/-l//'`=yes"
AC_DEFINE_UNQUOTED($ac_tr_func)
AC_DEFINE_UNQUOTED($ac_tr_lib)
AC_MSG_RESULT([yes, in $ac_res])
;;
esac
AC_SUBST(LIB_$1)
])
dnl AC_FIND_FUNC(func, libraries, includes, arguments)
AC_DEFUN([AC_FIND_FUNC], [
AC_FIND_FUNC_NO_LIBS([$1], [$2], [$3], [$4])
if test -n "$LIB_$1"; then
LIBS="$LIB_$1 $LIBS"
fi
])

347
src/pplib/autoconf/compile Executable file
View file

@ -0,0 +1,347 @@
#! /bin/sh
# Wrapper for compilers which do not understand '-c -o'.
scriptversion=2012-10-14.11; # UTC
# Copyright (C) 1999-2013 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:

1547
src/pplib/autoconf/config.guess vendored Executable file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,666 @@
#! /bin/sh
# Output a system dependent set of variables, describing how to set the
# run time search path of shared libraries in an executable.
#
# Copyright 1996-2007 Free Software Foundation, Inc.
# Taken from GNU libtool, 2001
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
#
# This file is free software; the Free Software Foundation gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
#
# The first argument passed to this file is the canonical host specification,
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
# or
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld
# should be set by the caller.
#
# The set of defined variables is at the end of this script.
# Known limitations:
# - On IRIX 6.5 with CC="cc", the run time search patch must not be longer
# than 256 bytes, otherwise the compiler driver will dump core. The only
# known workaround is to choose shorter directory names for the build
# directory and/or the installation directory.
# All known linkers require a `.a' archive for static linking (except MSVC,
# which needs '.lib').
libext=a
shrext=.so
host="$1"
host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
# Code taken from libtool.m4's _LT_CC_BASENAME.
for cc_temp in $CC""; do
case $cc_temp in
compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
\-*) ;;
*) break;;
esac
done
cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'`
# Code taken from libtool.m4's AC_LIBTOOL_PROG_COMPILER_PIC.
wl=
if test "$GCC" = yes; then
wl='-Wl,'
else
case "$host_os" in
aix*)
wl='-Wl,'
;;
darwin*)
case $cc_basename in
xlc*)
wl='-Wl,'
;;
esac
;;
mingw* | cygwin* | pw32* | os2*)
;;
hpux9* | hpux10* | hpux11*)
wl='-Wl,'
;;
irix5* | irix6* | nonstopux*)
wl='-Wl,'
;;
newsos6)
;;
linux* | k*bsd*-gnu)
case $cc_basename in
icc* | ecc*)
wl='-Wl,'
;;
pgcc | pgf77 | pgf90)
wl='-Wl,'
;;
ccc*)
wl='-Wl,'
;;
como)
wl='-lopt='
;;
*)
case `$CC -V 2>&1 | sed 5q` in
*Sun\ C*)
wl='-Wl,'
;;
esac
;;
esac
;;
osf3* | osf4* | osf5*)
wl='-Wl,'
;;
rdos*)
;;
solaris*)
wl='-Wl,'
;;
sunos4*)
wl='-Qoption ld '
;;
sysv4 | sysv4.2uw2* | sysv4.3*)
wl='-Wl,'
;;
sysv4*MP*)
;;
sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
wl='-Wl,'
;;
unicos*)
wl='-Wl,'
;;
uts4*)
;;
esac
fi
# Code taken from libtool.m4's AC_LIBTOOL_PROG_LD_SHLIBS.
hardcode_libdir_flag_spec=
hardcode_libdir_separator=
hardcode_direct=no
hardcode_minus_L=no
case "$host_os" in
cygwin* | mingw* | pw32*)
# FIXME: the MSVC++ port hasn't been tested in a loooong time
# When not using gcc, we currently assume that we are using
# Microsoft Visual C++.
if test "$GCC" != yes; then
with_gnu_ld=no
fi
;;
interix*)
# we just hope/assume this is gcc and not c89 (= MSVC++)
with_gnu_ld=yes
;;
openbsd*)
with_gnu_ld=no
;;
esac
ld_shlibs=yes
if test "$with_gnu_ld" = yes; then
# Set some defaults for GNU ld with shared library support. These
# are reset later if shared libraries are not supported. Putting them
# here allows them to be overridden if necessary.
# Unlike libtool, we use -rpath here, not --rpath, since the documented
# option of GNU ld is called -rpath, not --rpath.
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
case "$host_os" in
aix3* | aix4* | aix5*)
# On AIX/PPC, the GNU linker is very broken
if test "$host_cpu" != ia64; then
ld_shlibs=no
fi
;;
amigaos*)
hardcode_libdir_flag_spec='-L$libdir'
hardcode_minus_L=yes
# Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
# that the semantics of dynamic libraries on AmigaOS, at least up
# to version 4, is to share data among multiple programs linked
# with the same dynamic library. Since this doesn't match the
# behavior of shared libraries on other platforms, we cannot use
# them.
ld_shlibs=no
;;
beos*)
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
:
else
ld_shlibs=no
fi
;;
cygwin* | mingw* | pw32*)
# hardcode_libdir_flag_spec is actually meaningless, as there is
# no search path for DLLs.
hardcode_libdir_flag_spec='-L$libdir'
if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
:
else
ld_shlibs=no
fi
;;
interix[3-9]*)
hardcode_direct=no
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
;;
gnu* | linux* | k*bsd*-gnu)
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
:
else
ld_shlibs=no
fi
;;
netbsd*)
;;
solaris*)
if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
ld_shlibs=no
elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
:
else
ld_shlibs=no
fi
;;
sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
case `$LD -v 2>&1` in
*\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
ld_shlibs=no
;;
*)
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
else
ld_shlibs=no
fi
;;
esac
;;
sunos4*)
hardcode_direct=yes
;;
*)
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
:
else
ld_shlibs=no
fi
;;
esac
if test "$ld_shlibs" = no; then
hardcode_libdir_flag_spec=
fi
else
case "$host_os" in
aix3*)
# Note: this linker hardcodes the directories in LIBPATH if there
# are no directories specified by -L.
hardcode_minus_L=yes
if test "$GCC" = yes; then
# Neither direct hardcoding nor static linking is supported with a
# broken collect2.
hardcode_direct=unsupported
fi
;;
aix4* | aix5*)
if test "$host_cpu" = ia64; then
# On IA64, the linker does run time linking by default, so we don't
# have to do anything special.
aix_use_runtimelinking=no
else
aix_use_runtimelinking=no
# Test if we are trying to use run time linking or normal
# AIX style linking. If -brtl is somewhere in LDFLAGS, we
# need to do runtime linking.
case $host_os in aix4.[23]|aix4.[23].*|aix5*)
for ld_flag in $LDFLAGS; do
if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
aix_use_runtimelinking=yes
break
fi
done
;;
esac
fi
hardcode_direct=yes
hardcode_libdir_separator=':'
if test "$GCC" = yes; then
case $host_os in aix4.[012]|aix4.[012].*)
collect2name=`${CC} -print-prog-name=collect2`
if test -f "$collect2name" && \
strings "$collect2name" | grep resolve_lib_name >/dev/null
then
# We have reworked collect2
:
else
# We have old collect2
hardcode_direct=unsupported
hardcode_minus_L=yes
hardcode_libdir_flag_spec='-L$libdir'
hardcode_libdir_separator=
fi
;;
esac
fi
# Begin _LT_AC_SYS_LIBPATH_AIX.
echo 'int main () { return 0; }' > conftest.c
${CC} ${LDFLAGS} conftest.c -o conftest
aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
}'`
if test -z "$aix_libpath"; then
aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
}'`
fi
if test -z "$aix_libpath"; then
aix_libpath="/usr/lib:/lib"
fi
rm -f conftest.c conftest
# End _LT_AC_SYS_LIBPATH_AIX.
if test "$aix_use_runtimelinking" = yes; then
hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
else
if test "$host_cpu" = ia64; then
hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
else
hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
fi
fi
;;
amigaos*)
hardcode_libdir_flag_spec='-L$libdir'
hardcode_minus_L=yes
# see comment about different semantics on the GNU ld section
ld_shlibs=no
;;
bsdi[45]*)
;;
cygwin* | mingw* | pw32*)
# When not using gcc, we currently assume that we are using
# Microsoft Visual C++.
# hardcode_libdir_flag_spec is actually meaningless, as there is
# no search path for DLLs.
hardcode_libdir_flag_spec=' '
libext=lib
;;
darwin* | rhapsody*)
hardcode_direct=no
if test "$GCC" = yes ; then
:
else
case $cc_basename in
xlc*)
;;
*)
ld_shlibs=no
;;
esac
fi
;;
dgux*)
hardcode_libdir_flag_spec='-L$libdir'
;;
freebsd1*)
ld_shlibs=no
;;
freebsd2.2*)
hardcode_libdir_flag_spec='-R$libdir'
hardcode_direct=yes
;;
freebsd2*)
hardcode_direct=yes
hardcode_minus_L=yes
;;
freebsd* | dragonfly*)
hardcode_libdir_flag_spec='-R$libdir'
hardcode_direct=yes
;;
hpux9*)
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
hardcode_libdir_separator=:
hardcode_direct=yes
# hardcode_minus_L: Not really in the search PATH,
# but as the default location of the library.
hardcode_minus_L=yes
;;
hpux10*)
if test "$with_gnu_ld" = no; then
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
hardcode_libdir_separator=:
hardcode_direct=yes
# hardcode_minus_L: Not really in the search PATH,
# but as the default location of the library.
hardcode_minus_L=yes
fi
;;
hpux11*)
if test "$with_gnu_ld" = no; then
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
hardcode_libdir_separator=:
case $host_cpu in
hppa*64*|ia64*)
hardcode_direct=no
;;
*)
hardcode_direct=yes
# hardcode_minus_L: Not really in the search PATH,
# but as the default location of the library.
hardcode_minus_L=yes
;;
esac
fi
;;
irix5* | irix6* | nonstopux*)
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
hardcode_libdir_separator=:
;;
netbsd*)
hardcode_libdir_flag_spec='-R$libdir'
hardcode_direct=yes
;;
newsos6)
hardcode_direct=yes
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
hardcode_libdir_separator=:
;;
openbsd*)
if test -f /usr/libexec/ld.so; then
hardcode_direct=yes
if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
else
case "$host_os" in
openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
hardcode_libdir_flag_spec='-R$libdir'
;;
*)
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
;;
esac
fi
else
ld_shlibs=no
fi
;;
os2*)
hardcode_libdir_flag_spec='-L$libdir'
hardcode_minus_L=yes
;;
osf3*)
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
hardcode_libdir_separator=:
;;
osf4* | osf5*)
if test "$GCC" = yes; then
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
else
# Both cc and cxx compiler support -rpath directly
hardcode_libdir_flag_spec='-rpath $libdir'
fi
hardcode_libdir_separator=:
;;
solaris*)
hardcode_libdir_flag_spec='-R$libdir'
;;
sunos4*)
hardcode_libdir_flag_spec='-L$libdir'
hardcode_direct=yes
hardcode_minus_L=yes
;;
sysv4)
case $host_vendor in
sni)
hardcode_direct=yes # is this really true???
;;
siemens)
hardcode_direct=no
;;
motorola)
hardcode_direct=no #Motorola manual says yes, but my tests say they lie
;;
esac
;;
sysv4.3*)
;;
sysv4*MP*)
if test -d /usr/nec; then
ld_shlibs=yes
fi
;;
sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
;;
sysv5* | sco3.2v5* | sco5v6*)
hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
hardcode_libdir_separator=':'
;;
uts4*)
hardcode_libdir_flag_spec='-L$libdir'
;;
*)
ld_shlibs=no
;;
esac
fi
# Check dynamic linker characteristics
# Code taken from libtool.m4's AC_LIBTOOL_SYS_DYNAMIC_LINKER.
# Unlike libtool.m4, here we don't care about _all_ names of the library, but
# only about the one the linker finds when passed -lNAME. This is the last
# element of library_names_spec in libtool.m4, or possibly two of them if the
# linker has special search rules.
library_names_spec= # the last element of library_names_spec in libtool.m4
libname_spec='lib$name'
case "$host_os" in
aix3*)
library_names_spec='$libname.a'
;;
aix4* | aix5*)
library_names_spec='$libname$shrext'
;;
amigaos*)
library_names_spec='$libname.a'
;;
beos*)
library_names_spec='$libname$shrext'
;;
bsdi[45]*)
library_names_spec='$libname$shrext'
;;
cygwin* | mingw* | pw32*)
shrext=.dll
library_names_spec='$libname.dll.a $libname.lib'
;;
darwin* | rhapsody*)
shrext=.dylib
library_names_spec='$libname$shrext'
;;
dgux*)
library_names_spec='$libname$shrext'
;;
freebsd1*)
;;
freebsd* | dragonfly*)
case "$host_os" in
freebsd[123]*)
library_names_spec='$libname$shrext$versuffix' ;;
*)
library_names_spec='$libname$shrext' ;;
esac
;;
gnu*)
library_names_spec='$libname$shrext'
;;
hpux9* | hpux10* | hpux11*)
case $host_cpu in
ia64*)
shrext=.so
;;
hppa*64*)
shrext=.sl
;;
*)
shrext=.sl
;;
esac
library_names_spec='$libname$shrext'
;;
interix[3-9]*)
library_names_spec='$libname$shrext'
;;
irix5* | irix6* | nonstopux*)
library_names_spec='$libname$shrext'
case "$host_os" in
irix5* | nonstopux*)
libsuff= shlibsuff=
;;
*)
case $LD in
*-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;;
*-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;;
*-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;;
*) libsuff= shlibsuff= ;;
esac
;;
esac
;;
linux*oldld* | linux*aout* | linux*coff*)
;;
linux* | k*bsd*-gnu)
library_names_spec='$libname$shrext'
;;
knetbsd*-gnu)
library_names_spec='$libname$shrext'
;;
netbsd*)
library_names_spec='$libname$shrext'
;;
newsos6)
library_names_spec='$libname$shrext'
;;
nto-qnx*)
library_names_spec='$libname$shrext'
;;
openbsd*)
library_names_spec='$libname$shrext$versuffix'
;;
os2*)
libname_spec='$name'
shrext=.dll
library_names_spec='$libname.a'
;;
osf3* | osf4* | osf5*)
library_names_spec='$libname$shrext'
;;
rdos*)
;;
solaris*)
library_names_spec='$libname$shrext'
;;
sunos4*)
library_names_spec='$libname$shrext$versuffix'
;;
sysv4 | sysv4.3*)
library_names_spec='$libname$shrext'
;;
sysv4*MP*)
library_names_spec='$libname$shrext'
;;
sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
library_names_spec='$libname$shrext'
;;
uts4*)
library_names_spec='$libname$shrext'
;;
esac
sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"`
shlibext=`echo "$shrext" | sed -e 's,^\.,,'`
escaped_libname_spec=`echo "X$libname_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
escaped_library_names_spec=`echo "X$library_names_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF
# How to pass a linker flag through the compiler.
wl="$escaped_wl"
# Static library suffix (normally "a").
libext="$libext"
# Shared library suffix (normally "so").
shlibext="$shlibext"
# Format of library name prefix.
libname_spec="$escaped_libname_spec"
# Library names that the linker finds when passed -lNAME.
library_names_spec="$escaped_library_names_spec"
# Flag to hardcode \$libdir into a binary during linking.
# This must work even if \$libdir does not exist.
hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec"
# Whether we need a single -rpath flag with a separated argument.
hardcode_libdir_separator="$hardcode_libdir_separator"
# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
# resulting binary.
hardcode_direct="$hardcode_direct"
# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
# resulting binary.
hardcode_minus_L="$hardcode_minus_L"
EOF

1807
src/pplib/autoconf/config.sub vendored Executable file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,63 @@
dnl AC_CHECK_FREETDS([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
AC_DEFUN([AC_CHECK_FREETDS],[
AC_MSG_CHECKING(if FreeTDS should be used)
AC_ARG_WITH([freetds],
[ --with-freetds[[=PATH]] Prefix where freetds is installed (optional)],
[freetds_prefix="$withval"],
[freetds_prefix="auto"])
if test "$freetds_prefix" != "no"
then
AC_MSG_RESULT(yes)
my_save_LIBS="$LIBS"
my_save_CFLAGS="$CFLAGS"
my_save_LDFLAGS="$LDFLAGS"
if test "$freetds_prefix" = "yes" -o "$freetds_prefix" = "auto"
then
PKG_CHECK_MODULES([FreeTDS], [freedts], have_freetds="yes", have_freetds="no")
else
LIBS="-L$freetds_prefix/lib"
CFLAGS="-I$freetds_prefix/include"
FREETDS_LIBS="-L$freetds_prefix/lib"
FREETDS_CFLAGS="-I$freetds_prefix/include"
fi
if test "$have_freetds" != "yes"
then
dnl echo "FreeTDS ist nicht in autoconf, manuelle suche..."
AC_CHECK_LIB(rt,clock_gettime,
FREETDS_LIBS="$FREETDS_LIBS -lrt "
LIBS="$LIBS -lrt"
)
AC_CHECK_LIB(ct,ct_connect,
have_freetds="yes"
FREETDS_LIBS="-lct $FREETDS_LIBS "
)
AC_CHECK_HEADERS([ctpublic.h],,have_freetds="no")
fi
LIBS="$my_save_LIBS"
CFLAGS="$my_save_CFLAGS"
LDFLAGS="$my_save_LDFLAGS"
else
AC_MSG_RESULT(no)
fi
if test $have_freetds = "yes"
then
echo "FREETDS_LIBS=$FREETDS_LIBS"
echo "FREETDS_CFLAGS=$FREETDS_CFLAGS"
ifelse([$2], , :, [$2])
else
FREETDS_LIBS=""
FREETDS_CFLAGS=""
ifelse([$3], , :, [$3])
fi
])

View file

@ -0,0 +1,190 @@
# Configure paths for FreeType2
# Marcelo Magallon 2001-10-26, based on gtk.m4 by Owen Taylor
#
# Copyright 2001, 2003 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
#
# serial 2
# AC_CHECK_FT2([MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
# Test for FreeType 2, and define FT2_CFLAGS and FT2_LIBS.
# MINIMUM-VERSION is what libtool reports; the default is `7.0.1' (this is
# FreeType 2.0.4).
#
AC_DEFUN([AC_CHECK_FT2],
[# Get the cflags and libraries from the freetype-config script
#
AC_ARG_WITH([ft-prefix],
dnl don't quote AS_HELP_STRING!
AS_HELP_STRING([--with-ft-prefix=PREFIX],
[Prefix where FreeType is installed (optional)]),
[ft_config_prefix="$withval"],
[ft_config_prefix=""])
AC_ARG_WITH([ft-exec-prefix],
dnl don't quote AS_HELP_STRING!
AS_HELP_STRING([--with-ft-exec-prefix=PREFIX],
[Exec prefix where FreeType is installed (optional)]),
[ft_config_exec_prefix="$withval"],
[ft_config_exec_prefix=""])
AC_ARG_ENABLE([freetypetest],
dnl don't quote AS_HELP_STRING!
AS_HELP_STRING([--disable-freetypetest],
[Do not try to compile and run a test FreeType program]),
[],
[enable_fttest=yes])
if test x$ft_config_exec_prefix != x ; then
ft_config_args="$ft_config_args --exec-prefix=$ft_config_exec_prefix"
if test x${FT2_CONFIG+set} != xset ; then
FT2_CONFIG=$ft_config_exec_prefix/bin/freetype-config
fi
fi
if test x$ft_config_prefix != x ; then
ft_config_args="$ft_config_args --prefix=$ft_config_prefix"
if test x${FT2_CONFIG+set} != xset ; then
FT2_CONFIG=$ft_config_prefix/bin/freetype-config
fi
fi
AC_PATH_PROG([FT2_CONFIG], [freetype-config], [no])
min_ft_version=m4_if([$1], [], [7.0.1], [$1])
AC_MSG_CHECKING([for FreeType -- version >= $min_ft_version])
no_ft=""
if test "$FT2_CONFIG" = "no" ; then
no_ft=yes
else
FT2_CFLAGS=`$FT2_CONFIG $ft_config_args --cflags`
FT2_LIBS=`$FT2_CONFIG $ft_config_args --libs`
ft_config_major_version=`$FT2_CONFIG $ft_config_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
ft_config_minor_version=`$FT2_CONFIG $ft_config_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
ft_config_micro_version=`$FT2_CONFIG $ft_config_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
ft_min_major_version=`echo $min_ft_version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
ft_min_minor_version=`echo $min_ft_version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
ft_min_micro_version=`echo $min_ft_version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
if test x$enable_fttest = xyes ; then
ft_config_is_lt=""
if test $ft_config_major_version -lt $ft_min_major_version ; then
ft_config_is_lt=yes
else
if test $ft_config_major_version -eq $ft_min_major_version ; then
if test $ft_config_minor_version -lt $ft_min_minor_version ; then
ft_config_is_lt=yes
else
if test $ft_config_minor_version -eq $ft_min_minor_version ; then
if test $ft_config_micro_version -lt $ft_min_micro_version ; then
ft_config_is_lt=yes
fi
fi
fi
fi
fi
if test x$ft_config_is_lt = xyes ; then
no_ft=yes
else
ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $FT2_CFLAGS"
LIBS="$FT2_LIBS $LIBS"
#
# Sanity checks for the results of freetype-config to some extent.
#
AC_RUN_IFELSE([
AC_LANG_SOURCE([[
#include <ft2build.h>
#include FT_FREETYPE_H
#include <stdio.h>
#include <stdlib.h>
int
main()
{
FT_Library library;
FT_Error error;
error = FT_Init_FreeType(&library);
if (error)
return 1;
else
{
FT_Done_FreeType(library);
return 0;
}
}
]])
],
[],
[no_ft=yes],
[echo $ECHO_N "cross compiling; assuming OK... $ECHO_C"])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi # test $ft_config_version -lt $ft_min_version
fi # test x$enable_fttest = xyes
fi # test "$FT2_CONFIG" = "no"
if test x$no_ft = x ; then
AC_MSG_RESULT([yes])
m4_if([$2], [], [:], [$2])
else
AC_MSG_RESULT([no])
if test "$FT2_CONFIG" = "no" ; then
AC_MSG_WARN([
The freetype-config script installed by FreeType 2 could not be found.
If FreeType 2 was installed in PREFIX, make sure PREFIX/bin is in
your path, or set the FT2_CONFIG environment variable to the
full path to freetype-config.
])
else
if test x$ft_config_is_lt = xyes ; then
AC_MSG_WARN([
Your installed version of the FreeType 2 library is too old.
If you have different versions of FreeType 2, make sure that
correct values for --with-ft-prefix or --with-ft-exec-prefix
are used, or set the FT2_CONFIG environment variable to the
full path to freetype-config.
])
else
AC_MSG_WARN([
The FreeType test program failed to run. If your system uses
shared libraries and they are installed outside the normal
system library path, make sure the variable LD_LIBRARY_PATH
(or whatever is appropiate for your system) is correctly set.
])
fi
fi
FT2_CFLAGS=""
FT2_LIBS=""
m4_if([$3], [], [:], [$3])
fi
AC_SUBST([FT2_CFLAGS])
AC_SUBST([FT2_LIBS])])
# end of freetype2.m4

View file

@ -0,0 +1,49 @@
dnl AC_CHECK_GTEST([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
AC_DEFUN([AC_CHECK_GTEST],[
AC_MSG_CHECKING(if googletest should be used for unittesting)
AC_ARG_ENABLE([gtest],[
AS_HELP_STRING([--enable-gtest=PATH],
[Enable tests using the Google C++ Testing Framework.
(Default is enabled.)])],
[],
[enable_gtest=])
HAVE_GTEST="no"
if test "$enable_gtest" != "no"
then
if test -d "$enable_gtest"
then
if test -f "$enable_gtest/src/gtest-all.cc"
then
if test -d "$enable_gtest/include/gtest"
then
HAVE_GTEST="yes"
GTEST_PREFIX="$enable_gtest"
AC_SUBST([GTEST_PREFIX])
fi
fi
fi
if test "$HAVE_GTEST" = "yes"
then
AC_MSG_RESULT(yes: $enable_gtest)
else
AC_MSG_RESULT(no)
fi
else
AC_MSG_RESULT(no)
fi
AC_SUBST([HAVE_GTEST])
if test $HAVE_GTEST = "yes"
then
ifelse([$1], , :, [$1])
else
ifelse([$2], , :, [$2])
fi
])

180
src/pplib/autoconf/iconv.m4 Normal file
View file

@ -0,0 +1,180 @@
# iconv.m4 serial AM7 (gettext-0.18)
dnl Copyright (C) 2000-2002, 2007-2009 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 Bruno Haible.
AC_DEFUN([AM_ICONV_LINKFLAGS_BODY],
[
dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
AC_REQUIRE([AC_LIB_RPATH])
dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
dnl accordingly.
AC_LIB_LINKFLAGS_BODY([iconv])
])
AC_DEFUN([AM_ICONV_LINK],
[
dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
dnl those with the standalone portable GNU libiconv installed).
AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
dnl accordingly.
AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
dnl Add $INCICONV to CPPFLAGS before performing the following checks,
dnl because if the user has installed libiconv and not disabled its use
dnl via --without-libiconv-prefix, he wants to use it. The first
dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed.
am_save_CPPFLAGS="$CPPFLAGS"
AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
AC_CACHE_CHECK([for iconv], [am_cv_func_iconv], [
am_cv_func_iconv="no, consider installing GNU libiconv"
am_cv_lib_iconv=no
AC_TRY_LINK([#include <stdlib.h>
#include <iconv.h>],
[iconv_t cd = iconv_open("","");
iconv(cd,NULL,NULL,NULL,NULL);
iconv_close(cd);],
[am_cv_func_iconv=yes])
if test "$am_cv_func_iconv" != yes; then
am_save_LIBS="$LIBS"
LIBS="$LIBS $LIBICONV"
AC_TRY_LINK([#include <stdlib.h>
#include <iconv.h>],
[iconv_t cd = iconv_open("","");
iconv(cd,NULL,NULL,NULL,NULL);
iconv_close(cd);],
[am_cv_lib_iconv=yes]
[am_cv_func_iconv=yes])
LIBS="$am_save_LIBS"
fi
])
if test "$am_cv_func_iconv" = yes; then
AC_CACHE_CHECK([for working iconv], [am_cv_func_iconv_works], [
dnl This tests against bugs in AIX 5.1 and HP-UX 11.11.
am_save_LIBS="$LIBS"
if test $am_cv_lib_iconv = yes; then
LIBS="$LIBS $LIBICONV"
fi
AC_TRY_RUN([
#include <iconv.h>
#include <string.h>
int main ()
{
/* Test against AIX 5.1 bug: Failures are not distinguishable from successful
returns. */
{
iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8");
if (cd_utf8_to_88591 != (iconv_t)(-1))
{
static const char input[] = "\342\202\254"; /* EURO SIGN */
char buf[10];
const char *inptr = input;
size_t inbytesleft = strlen (input);
char *outptr = buf;
size_t outbytesleft = sizeof (buf);
size_t res = iconv (cd_utf8_to_88591,
(char **) &inptr, &inbytesleft,
&outptr, &outbytesleft);
if (res == 0)
return 1;
}
}
#if 0 /* This bug could be worked around by the caller. */
/* Test against HP-UX 11.11 bug: Positive return value instead of 0. */
{
iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591");
if (cd_88591_to_utf8 != (iconv_t)(-1))
{
static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
char buf[50];
const char *inptr = input;
size_t inbytesleft = strlen (input);
char *outptr = buf;
size_t outbytesleft = sizeof (buf);
size_t res = iconv (cd_88591_to_utf8,
(char **) &inptr, &inbytesleft,
&outptr, &outbytesleft);
if ((int)res > 0)
return 1;
}
}
#endif
/* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is
provided. */
if (/* Try standardized names. */
iconv_open ("UTF-8", "EUC-JP") == (iconv_t)(-1)
/* Try IRIX, OSF/1 names. */
&& iconv_open ("UTF-8", "eucJP") == (iconv_t)(-1)
/* Try AIX names. */
&& iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1)
/* Try HP-UX names. */
&& iconv_open ("utf8", "eucJP") == (iconv_t)(-1))
return 1;
return 0;
}], [am_cv_func_iconv_works=yes], [am_cv_func_iconv_works=no],
[case "$host_os" in
aix* | hpux*) am_cv_func_iconv_works="guessing no" ;;
*) am_cv_func_iconv_works="guessing yes" ;;
esac])
LIBS="$am_save_LIBS"
])
case "$am_cv_func_iconv_works" in
*no) am_func_iconv=no am_cv_lib_iconv=no ;;
*) am_func_iconv=yes ;;
esac
else
am_func_iconv=no am_cv_lib_iconv=no
fi
if test "$am_func_iconv" = yes; then
AC_DEFINE([HAVE_ICONV], [1],
[Define if you have the iconv() function and it works.])
fi
if test "$am_cv_lib_iconv" = yes; then
AC_MSG_CHECKING([how to link with libiconv])
AC_MSG_RESULT([$LIBICONV])
else
dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV
dnl either.
CPPFLAGS="$am_save_CPPFLAGS"
LIBICONV=
LTLIBICONV=
fi
AC_SUBST([LIBICONV])
AC_SUBST([LTLIBICONV])
])
AC_DEFUN([AM_ICONV],
[
AM_ICONV_LINK
if test "$am_cv_func_iconv" = yes; then
AC_MSG_CHECKING([for iconv declaration])
AC_CACHE_VAL([am_cv_proto_iconv], [
AC_TRY_COMPILE([
#include <stdlib.h>
#include <iconv.h>
extern
#ifdef __cplusplus
"C"
#endif
#if defined(__STDC__) || defined(__cplusplus)
size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
#else
size_t iconv();
#endif
], [], [am_cv_proto_iconv_arg1=""], [am_cv_proto_iconv_arg1="const"])
am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
AC_MSG_RESULT([${ac_t:-
}$am_cv_proto_iconv])
AC_DEFINE_UNQUOTED([ICONV_CONST], [$am_cv_proto_iconv_arg1],
[Define as const if the declaration of iconv() needs const.])
fi
])

View file

@ -0,0 +1,48 @@
dnl AX_PATH_LIB_IMLIB([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
AC_DEFUN([AX_PATH_LIB_IMLIB],[dnl
AC_MSG_CHECKING([lib ImageMagick])
AC_ARG_WITH([imlib],
[ --with-imlib[[=PATH]] Prefix where ImageMagick is installed (default=autodetected)],
[imlib_prefix="$withval"],
[imlib_prefix=""])
if test "$imlib_prefix" != "no"
then
save_path=$PATH
if test -n "$imlib_prefix"
then
if test "$imlib_prefix" != "yes"
then
PATH=$imlib_prefix:$PATH
export PATH
fi
fi
echo "Suche nach imlib, imlib_prefix=$imlib_prefix, PATH: $PATH"
AC_PATH_PROG(imlibconfig,MagickWand-config)
PATH=$save_path
echo "imlibconfig=$imlibconfig"
if test [ ! -x "$imlibconfig" ] ; then
imlibconfig=""
fi
if test [ -z "$imlibconfig" ]
then
AC_MSG_RESULT(no)
ifelse([$3], , :, [$3])
else
AC_MSG_RESULT(yes: $imlibconfig)
AC_MSG_CHECKING(imlib libraries)
IMLIB_LIBS=`${imlibconfig} --libs`
AC_MSG_RESULT($IMLIB_LIBS)
AC_MSG_CHECKING(imlib includes)
IMLIB_CFLAGS=`${imlibconfig} --cflags`
AC_MSG_RESULT($IMLIB_CFLAGS)
ifelse([$2], , :, [$2])
fi
else
AC_MSG_RESULT(not configured)
fi
])

301
src/pplib/autoconf/imlib.m4 Normal file
View file

@ -0,0 +1,301 @@
# Configure paths for IMLIB
# Frank Belew 98-8-31
# stolen from Manish Singh
# Shamelessly stolen from Owen Taylor
dnl AM_PATH_IMLIB([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
dnl Test for IMLIB, and define IMLIB_CFLAGS and IMLIB_LIBS
dnl
AC_DEFUN(AM_PATH_IMLIB,
[dnl
dnl Get the cflags and libraries from the imlib-config script
dnl
AC_ARG_WITH(imlib-prefix,[ --with-imlib-prefix=PFX Prefix where IMLIB is installed (optional)],
imlib_prefix="$withval", imlib_prefix="")
AC_ARG_WITH(imlib-exec-prefix,[ --with-imlib-exec-prefix=PFX Exec prefix where IMLIB is installed (optional)],
imlib_exec_prefix="$withval", imlib_exec_prefix="")
AC_ARG_ENABLE(imlibtest, [ --disable-imlibtest Do not try to compile and run a test IMLIB program],
, enable_imlibtest=yes)
if test x$imlib_exec_prefix != x ; then
imlib_args="$imlib_args --exec-prefix=$imlib_exec_prefix"
if test x${IMLIB_CONFIG+set} != xset ; then
IMLIB_CONFIG=$imlib_exec_prefix/bin/imlib-config
fi
fi
if test x$imlib_prefix != x ; then
imlib_args="$imlib_args --prefix=$imlib_prefix"
if test x${IMLIB_CONFIG+set} != xset ; then
IMLIB_CONFIG=$imlib_prefix/bin/imlib-config
fi
fi
AC_PATH_PROG(IMLIB_CONFIG, imlib-config, no)
min_imlib_version=ifelse([$1], ,1.8.2,$1)
AC_MSG_CHECKING(for IMLIB - version >= $min_imlib_version)
no_imlib=""
if test "$IMLIB_CONFIG" = "no" ; then
no_imlib=yes
else
IMLIB_CFLAGS=`$IMLIB_CONFIG $imlibconf_args --cflags`
IMLIB_LIBS=`$IMLIB_CONFIG $imlibconf_args --libs`
imlib_major_version=`$IMLIB_CONFIG $imlib_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
imlib_minor_version=`$IMLIB_CONFIG $imlib_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
imlib_micro_version=`$IMLIB_CONFIG $imlib_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
if test "x$enable_imlibtest" = "xyes" ; then
ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $IMLIB_CFLAGS"
LIBS="$LIBS $IMLIB_LIBS"
dnl
dnl Now check if the installed IMLIB is sufficiently new. (Also sanity
dnl checks the results of imlib-config to some extent
dnl
rm -f conf.imlibtest
AC_TRY_RUN([
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <Imlib.h>
char*
my_strdup (char *str)
{
char *new_str;
if (str)
{
new_str = malloc ((strlen (str) + 1) * sizeof(char));
strcpy (new_str, str);
}
else
new_str = NULL;
return new_str;
}
int main ()
{
int major, minor, micro;
char *tmp_version;
system ("touch conf.imlibtest");
/* HP/UX 9 (%@#!) writes to sscanf strings */
tmp_version = my_strdup("$min_imlib_version");
if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
printf("%s, bad version string\n", "$min_imlib_version");
exit(1);
}
if (($imlib_major_version > major) ||
(($imlib_major_version == major) && ($imlib_minor_version > minor)) ||
(($imlib_major_version == major) && ($imlib_minor_version == minor) &&
($imlib_micro_version >= micro)))
{
return 0;
}
else
{
printf("\n*** 'imlib-config --version' returned %d.%d, but the minimum version\n", $imlib_major_version, $imlib_minor_version);
printf("*** of IMLIB required is %d.%d. If imlib-config is correct, then it is\n", major, minor);
printf("*** best to upgrade to the required version.\n");
printf("*** If imlib-config was wrong, set the environment variable IMLIB_CONFIG\n");
printf("*** to point to the correct copy of imlib-config, and remove the file\n");
printf("*** config.cache before re-running configure\n");
return 1;
}
}
],, no_imlib=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi
fi
if test "x$no_imlib" = x ; then
AC_MSG_RESULT(yes)
ifelse([$2], , :, [$2])
else
AC_MSG_RESULT(no)
if test "$IMLIB_CONFIG" = "no" ; then
echo "*** The imlib-config script installed by IMLIB could not be found"
echo "*** If IMLIB was installed in PREFIX, make sure PREFIX/bin is in"
echo "*** your path, or set the IMLIB_CONFIG environment variable to the"
echo "*** full path to imlib-config."
else
if test -f conf.imlibtest ; then
:
else
echo "*** Could not run IMLIB test program, checking why..."
CFLAGS="$CFLAGS $IMLIB_CFLAGS"
LIBS="$LIBS $IMLIB_LIBS"
AC_TRY_LINK([
#include <stdio.h>
#include <Imlib.h>
], [ return 0; ],
[ echo "*** The test program compiled, but did not run. This usually means"
echo "*** that the run-time linker is not finding IMLIB or finding the wrong"
echo "*** version of IMLIB. If it is not finding IMLIB, you'll need to set your"
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
echo "*** to the installed location Also, make sure you have run ldconfig if that"
echo "*** is required on your system"
echo "***"
echo "*** If you have an old version installed, it is best to remove it, although"
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
[ echo "*** The test program failed to compile or link. See the file config.log for the"
echo "*** exact error that occured. This usually means IMLIB was incorrectly installed"
echo "*** or that you have moved IMLIB since it was installed. In the latter case, you"
echo "*** may want to edit the imlib-config script: $IMLIB_CONFIG" ])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi
fi
IMLIB_CFLAGS=""
IMLIB_LIBS=""
ifelse([$3], , :, [$3])
fi
AC_SUBST(IMLIB_CFLAGS)
AC_SUBST(IMLIB_LIBS)
rm -f conf.imlibtest
])
# Check for gdk-imlib
AC_DEFUN(AM_PATH_GDK_IMLIB,
[dnl
dnl Get the cflags and libraries from the imlib-config script
dnl
AC_ARG_WITH(imlib-prefix,[ --with-imlib-prefix=PFX Prefix where IMLIB is installed (optional)],
imlib_prefix="$withval", imlib_prefix="")
AC_ARG_WITH(imlib-exec-prefix,[ --with-imlib-exec-prefix=PFX Exec prefix where IMLIB is installed (optional)],
imlib_exec_prefix="$withval", imlib_exec_prefix="")
AC_ARG_ENABLE(imlibtest, [ --disable-imlibtest Do not try to compile and run a test IMLIB program],
, enable_imlibtest=yes)
if test x$imlib_exec_prefix != x ; then
imlib_args="$imlib_args --exec-prefix=$imlib_exec_prefix"
if test x${IMLIB_CONFIG+set} != xset ; then
IMLIB_CONFIG=$imlib_exec_prefix/bin/imlib-config
fi
fi
if test x$imlib_prefix != x ; then
imlib_args="$imlib_args --prefix=$imlib_prefix"
if test x${IMLIB_CONFIG+set} != xset ; then
IMLIB_CONFIG=$imlib_prefix/bin/imlib-config
fi
fi
AC_PATH_PROG(IMLIB_CONFIG, imlib-config, no)
min_imlib_version=ifelse([$1], ,1.8.2,$1)
AC_MSG_CHECKING(for IMLIB - version >= $min_imlib_version)
no_imlib=""
if test "$IMLIB_CONFIG" = "no" ; then
no_imlib=yes
else
GDK_IMLIB_CFLAGS=`$IMLIB_CONFIG $imlibconf_args --cflags-gdk`
GDK_IMLIB_LIBS=`$IMLIB_CONFIG $imlibconf_args --libs-gdk`
imlib_major_version=`$IMLIB_CONFIG $imlib_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
imlib_minor_version=`$IMLIB_CONFIG $imlib_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
if test "x$enable_imlibtest" = "xyes" ; then
ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $GDK_IMLIB_CFLAGS"
LIBS="$LIBS $GDK_IMLIB_LIBS"
dnl
dnl Now check if the installed IMLIB is sufficiently new. (Also sanity
dnl checks the results of imlib-config to some extent
dnl
rm -f conf.imlibtest
AC_TRY_RUN([
#include <stdio.h>
#include <stdlib.h>
#include <gdk_imlib.h>
int main ()
{
int major, minor;
char *tmp_version;
system ("touch conf.gdkimlibtest");
/* HP/UX 9 (%@#!) writes to sscanf strings */
tmp_version = g_strdup("$min_imlib_version");
if (sscanf(tmp_version, "%d.%d", &major, &minor) != 2) {
printf("%s, bad version string\n", "$min_imlib_version");
exit(1);
}
if (($imlib_major_version > major) ||
(($imlib_major_version == major) && ($imlib_minor_version >= minor)))
{
return 0;
}
else
{
printf("\n*** 'imlib-config --version' returned %d.%d, but the minimum version\n", $imlib_major_version, $imlib_minor_version);
printf("*** of IMLIB required is %d.%d. If imlib-config is correct, then it is\n", major, minor);
printf("*** best to upgrade to the required version.\n");
printf("*** If imlib-config was wrong, set the environment variable IMLIB_CONFIG\n");
printf("*** to point to the correct copy of imlib-config, and remove the file\n");
printf("*** config.cache before re-running configure\n");
return 1;
}
}
],, no_imlib=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi
fi
if test "x$no_imlib" = x ; then
AC_MSG_RESULT(yes)
ifelse([$2], , :, [$2])
else
AC_MSG_RESULT(no)
if test "$IMLIB_CONFIG" = "no" ; then
echo "*** The imlib-config script installed by IMLIB could not be found"
echo "*** If IMLIB was installed in PREFIX, make sure PREFIX/bin is in"
echo "*** your path, or set the IMLIB_CONFIG environment variable to the"
echo "*** full path to imlib-config."
else
if test -f conf.gdkimlibtest ; then
:
else
echo "*** Could not run IMLIB test program, checking why..."
CFLAGS="$CFLAGS $GDK_IMLIB_CFLAGS"
LIBS="$LIBS $GDK_IMLIB_LIBS"
AC_TRY_LINK([
#include <stdio.h>
#include <gdk_imlib.h>
], [ return 0; ],
[ echo "*** The test program compiled, but did not run. This usually means"
echo "*** that the run-time linker is not finding IMLIB or finding the wrong"
echo "*** version of IMLIB. If it is not finding IMLIB, you'll need to set your"
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
echo "*** to the installed location Also, make sure you have run ldconfig if that"
echo "*** is required on your system"
echo "***"
echo "*** If you have an old version installed, it is best to remove it, although"
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
[ echo "*** The test program failed to compile or link. See the file config.log for the"
echo "*** exact error that occured. This usually means IMLIB was incorrectly installed"
echo "*** or that you have moved IMLIB since it was installed. In the latter case, you"
echo "*** may want to edit the imlib-config script: $IMLIB_CONFIG" ])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi
fi
IMLIB_CFLAGS=""
IMLIB_LIBS=""
ifelse([$3], , :, [$3])
fi
AC_SUBST(GDK_IMLIB_CFLAGS)
AC_SUBST(GDK_IMLIB_LIBS)
rm -f conf.gdkimlibtest
])

527
src/pplib/autoconf/install-sh Executable file
View file

@ -0,0 +1,527 @@
#!/bin/sh
# install - install a program, script, or datafile
scriptversion=2011-11-20.07; # 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.
nl='
'
IFS=" "" $nl"
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit=${DOITPROG-}
if test -z "$doit"; then
doit_exec=exec
else
doit_exec=$doit
fi
# 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_glob='?'
initialize_posix_glob='
test "$posix_glob" != "?" || {
if (set -f) 2>/dev/null; then
posix_glob=
else
posix_glob=:
fi
}
'
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
no_target_directory=
usage="\
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
or: $0 [OPTION]... SRCFILES... DIRECTORY
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
or: $0 [OPTION]... -d DIRECTORIES...
In the 1st form, copy SRCFILE to DSTFILE.
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
In the 4th, create DIRECTORIES.
Options:
--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
*' '* | *' '* | *'
'* | *'*'* | *'?'* | *'['*)
echo "$0: invalid mode: $mode" >&2
exit 1;;
esac
shift;;
-o) chowncmd="$chownprog $2"
shift;;
-s) stripcmd=$stripprog;;
-t) dst_arg=$2
# Protect names problematic for 'test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
shift;;
-T) no_target_directory=true;;
--version) echo "$0 $scriptversion"; exit $?;;
--) shift
break;;
-*) echo "$0: invalid option: $1" >&2
exit 1;;
*) break;;
esac
shift
done
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
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 -n "$no_target_directory"; then
echo "$0: $dst_arg: Is a directory" >&2
exit 1
fi
dstdir=$dst
dst=$dstdir/`basename "$src"`
dstdir_status=0
else
# Prefer dirname, but fall back on a substitute if dirname fails.
dstdir=`
(dirname "$dst") 2>/dev/null ||
expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$dst" : 'X\(//\)[^/]' \| \
X"$dst" : 'X\(//\)$' \| \
X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
echo X"$dst" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'
`
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.
;;
*)
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
if (umask $mkdir_umask &&
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/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.
ls_ld_tmpdir=`ls -ld "$tmpdir"`
case $ls_ld_tmpdir in
d????-?r-*) different_mode=700;;
d????-?--*) different_mode=755;;
*) false;;
esac &&
$mkdirprog -m$different_mode -p -- "$tmpdir" && {
ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
}
}
then posix_mkdir=:
fi
rmdir "$tmpdir/d" "$tmpdir"
else
# Remove any dirs left behind by ancient mkdir implementations.
rmdir ./$mkdir_mode ./-p ./-- 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
eval "$initialize_posix_glob"
oIFS=$IFS
IFS=/
$posix_glob set -f
set fnord $dstdir
shift
$posix_glob 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` &&
eval "$initialize_posix_glob" &&
$posix_glob set -f &&
set X $old && old=:$2:$4:$5:$6 &&
set X $new && new=:$2:$4:$5:$6 &&
$posix_glob 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:

View file

@ -0,0 +1,42 @@
dnl AC_CHECK_LIBPJPEG([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
AC_DEFUN([AC_CHECK_LIBJPEG],[
AC_MSG_CHECKING(for libjpeg)
AC_ARG_WITH([jpeg],
[ --with-jpeg[[=PATH]] Prefix where libjpeg is installed (optional)],
[jpeg_prefix="$withval"],
[jpeg_prefix=""])
if test "$jpeg_prefix" != "no"
then
AC_MSG_RESULT(yes)
am_save_CPPFLAGS="$CPPFLAGS"
am_save_CFLAGS="$CFLAGS"
am_save_LIBS="$LIBS"
am_save_LDFLAGS="$LDFLAGS"
PKG_CHECK_MODULES([JPEG], [libjpeg >= 6.0.0],
ifelse([$2], , :, [$2])
,
AC_SEARCH_LIBS( [jpeg_finish_decompress],[jpeg],
dnl echo "LIBS=$LIBS"
dnl echo "LDFLAGS=$LDFLAGS"
dnl echo "CFLAGS=$CFLAGS"
dnl echo "CPPFLAGS=$CPPFLAGS"
JPEG_LIBS="$LIBS"
JPEG_CFLAGS=""
ifelse([$2], , :, [$2])
,
ifelse([$3], , :, [$3])
:)
)
CPPFLAGS="$am_save_CPPFLAGS"
LIBS="$am_save_LIBS"
LDFLAGS="$am_save_LDFLAGS"
CFLAGS="$am_save_CFLAGS"
else
AC_MSG_RESULT(no)
ifelse([$3], , :, [$3])
fi
])

View file

@ -0,0 +1,57 @@
dnl AC_CHECK_LIBMP3LAME([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
AC_DEFUN([AC_CHECK_LIBMP3LAME],[
AC_ARG_WITH([lame],
[[ --with-lame[=DIR] enable support for MP3 encoding with lame [in DIR]]],
[lame_prefix="$withval"],
[lame_prefix="no"])
AC_MSG_CHECKING(if lame should be included)
if test "$with_lame" != "no"
then
AC_MSG_RESULT(yes)
have_LAME="no"
am_save_CPPFLAGS="$CPPFLAGS"
am_save_LIBS="$LIBS"
am_save_LDFLAGS="$LDFLAGS"
if test -n "$with_lame" -a "$with_lame" != "yes"
then
intLAME_CFLAGS="-I$with_lame/include"
intLAME_LIBS="-L$with_lame/lib -lmp3lame -lm"
intLAME_LDFLAGS="-L$with_lame/lib"
else
intLAME_CFLAGS=""
intLAME_LIBS="-lmp3lame -lm"
intLAME_LDFLAGS=""
fi
CPPFLAGS="$CPPFLAGS $intLAME_CFLAGS"
LDFLAGS="$LDFLAGS $intLAME_LDFLAGS"
AC_CHECK_HEADER(lame/lame.h, [
have_LAME="maybe",
AC_DEFINE(HAVE_LAME_LAME_H, 1, [Use <lame/lame.h> instead of <lame.h>])
], [
AC_CHECK_HEADER(lame.h, [
have_LAME="maybe"
])
])
if test "$have_LAME" != "no"
then
LIBS="$LIBS $intLAME_LIBS"
AC_CHECK_LIB(mp3lame, lame_encode_flush_nogap,
LAME_CFLAGS=$intLAME_CFLAGS
LAME_LIBS=$intLAME_LIBS
LAME_LDFLAGS=$intLAME_LDFLAGS
ifelse([$2], , :, [$2])
,
ifelse([$3], , :, [$3])
:)
AC_CHECK_LIB(mp3lame, hip_decode, [
AC_DEFINE(HAVE_LAME_HIP_DECODE, 1, [Lame has threadsafe decoder])
])
fi
CPPFLAGS=$am_save_CPPFLAGS
LIBS=$am_save_LIBS
LDFLAGS=$am_save_LDFLAGD
else
AC_MSG_RESULT(no)
fi
])

View file

@ -0,0 +1,65 @@
dnl AX_PATH_LIB_LDNS([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
AC_DEFUN([AX_PATH_LIB_LDNS],[dnl
AC_ARG_WITH([libldns],
[ --with-libldns[[=PATH]] Prefix where LDNS-Library from netlabs.nl is installed],
[ldns_prefix="$withval"],
[ldns_prefix="no"])
if test "$ldns_prefix" = "no"
then
AC_PATH_PROG(ldnsconfig,ldns-config)
elif test "$ldns_prefix" != "yes"
then
ldnsconfig="$ldns_prefix/bin/ldns-config"
else
AC_PATH_PROG(ldnsconfig,ldns-config)
fi
AC_MSG_CHECKING([for lib ldns])
if test [ -z "$ldnsconfig" ]
then
AC_MSG_RESULT(no)
ifelse([$3], , :, [$3])
else
AC_MSG_RESULT(yes)
min_ldns_version=ifelse([$1], ,1.6.0,[$1])
AC_MSG_CHECKING(for ldns version >= $min_ldns_version)
if test [ -f ${ldnsconfig} ]
then
ldns_version=`${ldnsconfig} --version`
elif test [ -f $ldns_prefix/bin/ldns-version ]
then
ldns_version=`$ldns_prefix/bin/ldns-version`
fi
ldns_config_major_version=`echo $ldns_version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
ldns_config_minor_version=`echo $ldns_version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
ldns_config_micro_version=`echo $ldns_version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
ldns_config_version=`expr $ldns_config_major_version \* 10000 + $ldns_config_minor_version \* 100 + $ldns_config_micro_version`
ldns_req_major_version=`echo $min_ldns_version | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
ldns_req_minor_version=`echo $min_ldns_version | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
ldns_req_micro_version=`echo $min_ldns_version | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
ldns_req_version=`expr $ldns_req_major_version \* 10000 + $ldns_req_minor_version \* 100 + $ldns_req_micro_version`
if test $ldns_config_version -lt $ldns_req_version
then
AC_MSG_RESULT([no, have $ldns_version])
ifelse([$3], , :, [$3])
else
AC_MSG_RESULT([yes (version $ldns_version) ])
LIBLDNS_LIBS=`${ldnsconfig} --libs`
LIBLDNS_CFLAGS=`${ldnsconfig} --cflags`
ifelse([$2], , :, [$2])
fi
fi
])

View file

@ -0,0 +1,764 @@
# lib-link.m4 serial 20 (gettext-0.18)
dnl Copyright (C) 2001-2009 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 Bruno Haible.
AC_PREREQ([2.54])
dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
dnl the libraries corresponding to explicit and implicit dependencies.
dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
dnl augments the CPPFLAGS variable.
dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
AC_DEFUN([AC_LIB_LINKFLAGS],
[
AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
AC_REQUIRE([AC_LIB_RPATH])
pushdef([Name],[translit([$1],[./-], [___])])
pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
AC_LIB_LINKFLAGS_BODY([$1], [$2])
ac_cv_lib[]Name[]_libs="$LIB[]NAME"
ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
ac_cv_lib[]Name[]_prefix="$LIB[]NAME[]_PREFIX"
])
LIB[]NAME="$ac_cv_lib[]Name[]_libs"
LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
LIB[]NAME[]_PREFIX="$ac_cv_lib[]Name[]_prefix"
AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
AC_SUBST([LIB]NAME)
AC_SUBST([LTLIB]NAME)
AC_SUBST([LIB]NAME[_PREFIX])
dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
dnl results of this search when this library appears as a dependency.
HAVE_LIB[]NAME=yes
popdef([NAME])
popdef([Name])
])
dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode, [missing-message])
dnl searches for libname and the libraries corresponding to explicit and
dnl implicit dependencies, together with the specified include files and
dnl the ability to compile and link the specified testcode. The missing-message
dnl defaults to 'no' and may contain additional hints for the user.
dnl If found, it sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME}
dnl and LTLIB${NAME} variables and augments the CPPFLAGS variable, and
dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
[
AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
AC_REQUIRE([AC_LIB_RPATH])
pushdef([Name],[translit([$1],[./-], [___])])
pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
dnl accordingly.
AC_LIB_LINKFLAGS_BODY([$1], [$2])
dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
dnl because if the user has installed lib[]Name and not disabled its use
dnl via --without-lib[]Name-prefix, he wants to use it.
ac_save_CPPFLAGS="$CPPFLAGS"
AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
ac_save_LIBS="$LIBS"
LIBS="$LIBS $LIB[]NAME"
AC_TRY_LINK([$3], [$4],
[ac_cv_lib[]Name=yes],
[ac_cv_lib[]Name='m4_if([$5], [], [no], [[$5]])'])
LIBS="$ac_save_LIBS"
])
if test "$ac_cv_lib[]Name" = yes; then
HAVE_LIB[]NAME=yes
AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the lib][$1 library.])
AC_MSG_CHECKING([how to link with lib[]$1])
AC_MSG_RESULT([$LIB[]NAME])
else
HAVE_LIB[]NAME=no
dnl If $LIB[]NAME didn't lead to a usable library, we don't need
dnl $INC[]NAME either.
CPPFLAGS="$ac_save_CPPFLAGS"
LIB[]NAME=
LTLIB[]NAME=
LIB[]NAME[]_PREFIX=
fi
AC_SUBST([HAVE_LIB]NAME)
AC_SUBST([LIB]NAME)
AC_SUBST([LTLIB]NAME)
AC_SUBST([LIB]NAME[_PREFIX])
popdef([NAME])
popdef([Name])
])
dnl Determine the platform dependent parameters needed to use rpath:
dnl acl_libext,
dnl acl_shlibext,
dnl acl_hardcode_libdir_flag_spec,
dnl acl_hardcode_libdir_separator,
dnl acl_hardcode_direct,
dnl acl_hardcode_minus_L.
AC_DEFUN([AC_LIB_RPATH],
[
dnl Tell automake >= 1.10 to complain if config.rpath is missing.
m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])])
AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS
AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld
AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host
AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
AC_CACHE_CHECK([for shared library run path origin], [acl_cv_rpath], [
CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
. ./conftest.sh
rm -f ./conftest.sh
acl_cv_rpath=done
])
wl="$acl_cv_wl"
acl_libext="$acl_cv_libext"
acl_shlibext="$acl_cv_shlibext"
acl_libname_spec="$acl_cv_libname_spec"
acl_library_names_spec="$acl_cv_library_names_spec"
acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
acl_hardcode_direct="$acl_cv_hardcode_direct"
acl_hardcode_minus_L="$acl_cv_hardcode_minus_L"
dnl Determine whether the user wants rpath handling at all.
AC_ARG_ENABLE([rpath],
[ --disable-rpath do not hardcode runtime library paths],
:, enable_rpath=yes)
])
dnl AC_LIB_FROMPACKAGE(name, package)
dnl declares that libname comes from the given package. The configure file
dnl will then not have a --with-libname-prefix option but a
dnl --with-package-prefix option. Several libraries can come from the same
dnl package. This declaration must occur before an AC_LIB_LINKFLAGS or similar
dnl macro call that searches for libname.
AC_DEFUN([AC_LIB_FROMPACKAGE],
[
pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
define([acl_frompackage_]NAME, [$2])
popdef([NAME])
pushdef([PACK],[$2])
pushdef([PACKUP],[translit(PACK,[abcdefghijklmnopqrstuvwxyz./-],
[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
define([acl_libsinpackage_]PACKUP,
m4_ifdef([acl_libsinpackage_]PACKUP, [acl_libsinpackage_]PACKUP[[, ]],)[lib$1])
popdef([PACKUP])
popdef([PACK])
])
dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
dnl the libraries corresponding to explicit and implicit dependencies.
dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
dnl Also, sets the LIB${NAME}_PREFIX variable to nonempty if libname was found
dnl in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
[
AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
pushdef([PACK],[m4_ifdef([acl_frompackage_]NAME, [acl_frompackage_]NAME, lib[$1])])
pushdef([PACKUP],[translit(PACK,[abcdefghijklmnopqrstuvwxyz./-],
[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
pushdef([PACKLIBS],[m4_ifdef([acl_frompackage_]NAME, [acl_libsinpackage_]PACKUP, lib[$1])])
dnl Autoconf >= 2.61 supports dots in --with options.
pushdef([P_A_C_K],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61]),[-1],[translit(PACK,[.],[_])],PACK)])
dnl By default, look in $includedir and $libdir.
use_additional=yes
AC_LIB_WITH_FINAL_PREFIX([
eval additional_includedir=\"$includedir\"
eval additional_libdir=\"$libdir\"
])
AC_ARG_WITH(P_A_C_K[-prefix],
[[ --with-]]P_A_C_K[[-prefix[=DIR] search for ]PACKLIBS[ in DIR/include and DIR/lib
--without-]]P_A_C_K[[-prefix don't search for ]PACKLIBS[ in includedir and libdir]],
[
if test "X$withval" = "Xno"; then
use_additional=no
else
if test "X$withval" = "X"; then
AC_LIB_WITH_FINAL_PREFIX([
eval additional_includedir=\"$includedir\"
eval additional_libdir=\"$libdir\"
])
else
additional_includedir="$withval/include"
additional_libdir="$withval/$acl_libdirstem"
if test "$acl_libdirstem2" != "$acl_libdirstem" \
&& ! test -d "$withval/$acl_libdirstem"; then
additional_libdir="$withval/$acl_libdirstem2"
fi
fi
fi
])
dnl Search the library and its dependencies in $additional_libdir and
dnl $LDFLAGS. Using breadth-first-seach.
LIB[]NAME=
LTLIB[]NAME=
INC[]NAME=
LIB[]NAME[]_PREFIX=
dnl HAVE_LIB${NAME} is an indicator that LIB${NAME}, LTLIB${NAME} have been
dnl computed. So it has to be reset here.
HAVE_LIB[]NAME=
rpathdirs=
ltrpathdirs=
names_already_handled=
names_next_round='$1 $2'
while test -n "$names_next_round"; do
names_this_round="$names_next_round"
names_next_round=
for name in $names_this_round; do
already_handled=
for n in $names_already_handled; do
if test "$n" = "$name"; then
already_handled=yes
break
fi
done
if test -z "$already_handled"; then
names_already_handled="$names_already_handled $name"
dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
dnl or AC_LIB_HAVE_LINKFLAGS call.
uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
eval value=\"\$HAVE_LIB$uppername\"
if test -n "$value"; then
if test "$value" = yes; then
eval value=\"\$LIB$uppername\"
test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
eval value=\"\$LTLIB$uppername\"
test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
else
dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
dnl that this library doesn't exist. So just drop it.
:
fi
else
dnl Search the library lib$name in $additional_libdir and $LDFLAGS
dnl and the already constructed $LIBNAME/$LTLIBNAME.
found_dir=
found_la=
found_so=
found_a=
eval libname=\"$acl_libname_spec\" # typically: libname=lib$name
if test -n "$acl_shlibext"; then
shrext=".$acl_shlibext" # typically: shrext=.so
else
shrext=
fi
if test $use_additional = yes; then
dir="$additional_libdir"
dnl The same code as in the loop below:
dnl First look for a shared library.
if test -n "$acl_shlibext"; then
if test -f "$dir/$libname$shrext"; then
found_dir="$dir"
found_so="$dir/$libname$shrext"
else
if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
ver=`(cd "$dir" && \
for f in "$libname$shrext".*; do echo "$f"; done \
| sed -e "s,^$libname$shrext\\\\.,," \
| sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
| sed 1q ) 2>/dev/null`
if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
found_dir="$dir"
found_so="$dir/$libname$shrext.$ver"
fi
else
eval library_names=\"$acl_library_names_spec\"
for f in $library_names; do
if test -f "$dir/$f"; then
found_dir="$dir"
found_so="$dir/$f"
break
fi
done
fi
fi
fi
dnl Then look for a static library.
if test "X$found_dir" = "X"; then
if test -f "$dir/$libname.$acl_libext"; then
found_dir="$dir"
found_a="$dir/$libname.$acl_libext"
fi
fi
if test "X$found_dir" != "X"; then
if test -f "$dir/$libname.la"; then
found_la="$dir/$libname.la"
fi
fi
fi
if test "X$found_dir" = "X"; then
for x in $LDFLAGS $LTLIB[]NAME; do
AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
case "$x" in
-L*)
dir=`echo "X$x" | sed -e 's/^X-L//'`
dnl First look for a shared library.
if test -n "$acl_shlibext"; then
if test -f "$dir/$libname$shrext"; then
found_dir="$dir"
found_so="$dir/$libname$shrext"
else
if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
ver=`(cd "$dir" && \
for f in "$libname$shrext".*; do echo "$f"; done \
| sed -e "s,^$libname$shrext\\\\.,," \
| sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
| sed 1q ) 2>/dev/null`
if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
found_dir="$dir"
found_so="$dir/$libname$shrext.$ver"
fi
else
eval library_names=\"$acl_library_names_spec\"
for f in $library_names; do
if test -f "$dir/$f"; then
found_dir="$dir"
found_so="$dir/$f"
break
fi
done
fi
fi
fi
dnl Then look for a static library.
if test "X$found_dir" = "X"; then
if test -f "$dir/$libname.$acl_libext"; then
found_dir="$dir"
found_a="$dir/$libname.$acl_libext"
fi
fi
if test "X$found_dir" != "X"; then
if test -f "$dir/$libname.la"; then
found_la="$dir/$libname.la"
fi
fi
;;
esac
if test "X$found_dir" != "X"; then
break
fi
done
fi
if test "X$found_dir" != "X"; then
dnl Found the library.
LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
if test "X$found_so" != "X"; then
dnl Linking with a shared library. We attempt to hardcode its
dnl directory into the executable's runpath, unless it's the
dnl standard /usr/lib.
if test "$enable_rpath" = no \
|| test "X$found_dir" = "X/usr/$acl_libdirstem" \
|| test "X$found_dir" = "X/usr/$acl_libdirstem2"; then
dnl No hardcoding is needed.
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
else
dnl Use an explicit option to hardcode DIR into the resulting
dnl binary.
dnl Potentially add DIR to ltrpathdirs.
dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
haveit=
for x in $ltrpathdirs; do
if test "X$x" = "X$found_dir"; then
haveit=yes
break
fi
done
if test -z "$haveit"; then
ltrpathdirs="$ltrpathdirs $found_dir"
fi
dnl The hardcoding into $LIBNAME is system dependent.
if test "$acl_hardcode_direct" = yes; then
dnl Using DIR/libNAME.so during linking hardcodes DIR into the
dnl resulting binary.
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
else
if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
dnl Use an explicit option to hardcode DIR into the resulting
dnl binary.
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
dnl Potentially add DIR to rpathdirs.
dnl The rpathdirs will be appended to $LIBNAME at the end.
haveit=
for x in $rpathdirs; do
if test "X$x" = "X$found_dir"; then
haveit=yes
break
fi
done
if test -z "$haveit"; then
rpathdirs="$rpathdirs $found_dir"
fi
else
dnl Rely on "-L$found_dir".
dnl But don't add it if it's already contained in the LDFLAGS
dnl or the already constructed $LIBNAME
haveit=
for x in $LDFLAGS $LIB[]NAME; do
AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
if test "X$x" = "X-L$found_dir"; then
haveit=yes
break
fi
done
if test -z "$haveit"; then
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
fi
if test "$acl_hardcode_minus_L" != no; then
dnl FIXME: Not sure whether we should use
dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
dnl here.
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
else
dnl We cannot use $acl_hardcode_runpath_var and LD_RUN_PATH
dnl here, because this doesn't fit in flags passed to the
dnl compiler. So give up. No hardcoding. This affects only
dnl very old systems.
dnl FIXME: Not sure whether we should use
dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
dnl here.
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
fi
fi
fi
fi
else
if test "X$found_a" != "X"; then
dnl Linking with a static library.
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
else
dnl We shouldn't come here, but anyway it's good to have a
dnl fallback.
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
fi
fi
dnl Assume the include files are nearby.
additional_includedir=
case "$found_dir" in
*/$acl_libdirstem | */$acl_libdirstem/)
basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'`
if test "$name" = '$1'; then
LIB[]NAME[]_PREFIX="$basedir"
fi
additional_includedir="$basedir/include"
;;
*/$acl_libdirstem2 | */$acl_libdirstem2/)
basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'`
if test "$name" = '$1'; then
LIB[]NAME[]_PREFIX="$basedir"
fi
additional_includedir="$basedir/include"
;;
esac
if test "X$additional_includedir" != "X"; then
dnl Potentially add $additional_includedir to $INCNAME.
dnl But don't add it
dnl 1. if it's the standard /usr/include,
dnl 2. if it's /usr/local/include and we are using GCC on Linux,
dnl 3. if it's already present in $CPPFLAGS or the already
dnl constructed $INCNAME,
dnl 4. if it doesn't exist as a directory.
if test "X$additional_includedir" != "X/usr/include"; then
haveit=
if test "X$additional_includedir" = "X/usr/local/include"; then
if test -n "$GCC"; then
case $host_os in
linux* | gnu* | k*bsd*-gnu) haveit=yes;;
esac
fi
fi
if test -z "$haveit"; then
for x in $CPPFLAGS $INC[]NAME; do
AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
if test "X$x" = "X-I$additional_includedir"; then
haveit=yes
break
fi
done
if test -z "$haveit"; then
if test -d "$additional_includedir"; then
dnl Really add $additional_includedir to $INCNAME.
INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
fi
fi
fi
fi
fi
dnl Look for dependencies.
if test -n "$found_la"; then
dnl Read the .la file. It defines the variables
dnl dlname, library_names, old_library, dependency_libs, current,
dnl age, revision, installed, dlopen, dlpreopen, libdir.
save_libdir="$libdir"
case "$found_la" in
*/* | *\\*) . "$found_la" ;;
*) . "./$found_la" ;;
esac
libdir="$save_libdir"
dnl We use only dependency_libs.
for dep in $dependency_libs; do
case "$dep" in
-L*)
additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME.
dnl But don't add it
dnl 1. if it's the standard /usr/lib,
dnl 2. if it's /usr/local/lib and we are using GCC on Linux,
dnl 3. if it's already present in $LDFLAGS or the already
dnl constructed $LIBNAME,
dnl 4. if it doesn't exist as a directory.
if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \
&& test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then
haveit=
if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \
|| test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then
if test -n "$GCC"; then
case $host_os in
linux* | gnu* | k*bsd*-gnu) haveit=yes;;
esac
fi
fi
if test -z "$haveit"; then
haveit=
for x in $LDFLAGS $LIB[]NAME; do
AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
if test "X$x" = "X-L$additional_libdir"; then
haveit=yes
break
fi
done
if test -z "$haveit"; then
if test -d "$additional_libdir"; then
dnl Really add $additional_libdir to $LIBNAME.
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir"
fi
fi
haveit=
for x in $LDFLAGS $LTLIB[]NAME; do
AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
if test "X$x" = "X-L$additional_libdir"; then
haveit=yes
break
fi
done
if test -z "$haveit"; then
if test -d "$additional_libdir"; then
dnl Really add $additional_libdir to $LTLIBNAME.
LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir"
fi
fi
fi
fi
;;
-R*)
dir=`echo "X$dep" | sed -e 's/^X-R//'`
if test "$enable_rpath" != no; then
dnl Potentially add DIR to rpathdirs.
dnl The rpathdirs will be appended to $LIBNAME at the end.
haveit=
for x in $rpathdirs; do
if test "X$x" = "X$dir"; then
haveit=yes
break
fi
done
if test -z "$haveit"; then
rpathdirs="$rpathdirs $dir"
fi
dnl Potentially add DIR to ltrpathdirs.
dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
haveit=
for x in $ltrpathdirs; do
if test "X$x" = "X$dir"; then
haveit=yes
break
fi
done
if test -z "$haveit"; then
ltrpathdirs="$ltrpathdirs $dir"
fi
fi
;;
-l*)
dnl Handle this in the next round.
names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
;;
*.la)
dnl Handle this in the next round. Throw away the .la's
dnl directory; it is already contained in a preceding -L
dnl option.
names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
;;
*)
dnl Most likely an immediate library name.
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
;;
esac
done
fi
else
dnl Didn't find the library; assume it is in the system directories
dnl known to the linker and runtime loader. (All the system
dnl directories known to the linker should also be known to the
dnl runtime loader, otherwise the system is severely misconfigured.)
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
fi
fi
fi
done
done
if test "X$rpathdirs" != "X"; then
if test -n "$acl_hardcode_libdir_separator"; then
dnl Weird platform: only the last -rpath option counts, the user must
dnl pass all path elements in one option. We can arrange that for a
dnl single library, but not when more than one $LIBNAMEs are used.
alldirs=
for found_dir in $rpathdirs; do
alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir"
done
dnl Note: acl_hardcode_libdir_flag_spec uses $libdir and $wl.
acl_save_libdir="$libdir"
libdir="$alldirs"
eval flag=\"$acl_hardcode_libdir_flag_spec\"
libdir="$acl_save_libdir"
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
else
dnl The -rpath options are cumulative.
for found_dir in $rpathdirs; do
acl_save_libdir="$libdir"
libdir="$found_dir"
eval flag=\"$acl_hardcode_libdir_flag_spec\"
libdir="$acl_save_libdir"
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
done
fi
fi
if test "X$ltrpathdirs" != "X"; then
dnl When using libtool, the option that works for both libraries and
dnl executables is -R. The -R options are cumulative.
for found_dir in $ltrpathdirs; do
LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
done
fi
popdef([P_A_C_K])
popdef([PACKLIBS])
popdef([PACKUP])
popdef([PACK])
popdef([NAME])
])
dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
dnl unless already present in VAR.
dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
dnl contains two or three consecutive elements that belong together.
AC_DEFUN([AC_LIB_APPENDTOVAR],
[
for element in [$2]; do
haveit=
for x in $[$1]; do
AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
if test "X$x" = "X$element"; then
haveit=yes
break
fi
done
if test -z "$haveit"; then
[$1]="${[$1]}${[$1]:+ }$element"
fi
done
])
dnl For those cases where a variable contains several -L and -l options
dnl referring to unknown libraries and directories, this macro determines the
dnl necessary additional linker options for the runtime path.
dnl AC_LIB_LINKFLAGS_FROM_LIBS([LDADDVAR], [LIBSVALUE], [USE-LIBTOOL])
dnl sets LDADDVAR to linker options needed together with LIBSVALUE.
dnl If USE-LIBTOOL evaluates to non-empty, linking with libtool is assumed,
dnl otherwise linking without libtool is assumed.
AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS],
[
AC_REQUIRE([AC_LIB_RPATH])
AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
$1=
if test "$enable_rpath" != no; then
if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
dnl Use an explicit option to hardcode directories into the resulting
dnl binary.
rpathdirs=
next=
for opt in $2; do
if test -n "$next"; then
dir="$next"
dnl No need to hardcode the standard /usr/lib.
if test "X$dir" != "X/usr/$acl_libdirstem" \
&& test "X$dir" != "X/usr/$acl_libdirstem2"; then
rpathdirs="$rpathdirs $dir"
fi
next=
else
case $opt in
-L) next=yes ;;
-L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'`
dnl No need to hardcode the standard /usr/lib.
if test "X$dir" != "X/usr/$acl_libdirstem" \
&& test "X$dir" != "X/usr/$acl_libdirstem2"; then
rpathdirs="$rpathdirs $dir"
fi
next= ;;
*) next= ;;
esac
fi
done
if test "X$rpathdirs" != "X"; then
if test -n ""$3""; then
dnl libtool is used for linking. Use -R options.
for dir in $rpathdirs; do
$1="${$1}${$1:+ }-R$dir"
done
else
dnl The linker is used for linking directly.
if test -n "$acl_hardcode_libdir_separator"; then
dnl Weird platform: only the last -rpath option counts, the user
dnl must pass all path elements in one option.
alldirs=
for dir in $rpathdirs; do
alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$dir"
done
acl_save_libdir="$libdir"
libdir="$alldirs"
eval flag=\"$acl_hardcode_libdir_flag_spec\"
libdir="$acl_save_libdir"
$1="$flag"
else
dnl The -rpath options are cumulative.
for dir in $rpathdirs; do
acl_save_libdir="$libdir"
libdir="$dir"
eval flag=\"$acl_hardcode_libdir_flag_spec\"
libdir="$acl_save_libdir"
$1="${$1}${$1:+ }$flag"
done
fi
fi
fi
fi
fi
AC_SUBST([$1])
])

View file

@ -0,0 +1,197 @@
dnl AM_CHECK_LIBBIND()
AC_DEFUN([AM_CHECK_LIBBIND],[
AC_ARG_WITH([libbind],
[ --with-libbind[[=PATH]] Prefix where libbind is installed (optional)],
[libbind_prefix="$withval"],
[libbind_prefix=""])
if test "x$libbind_prefix" != "xno"
then
dnl res_query
AC_SEARCH_LIBS(res_query,[resolv bind],have_res_query=yes,
[dnl Have to include resolv.h as res_query is sometimes defined as a macro
AC_MSG_CHECKING([for res_query in -lresolv (with resolv.h if present)])
saved_libs="$LIBS"
LIBS="-lresolv $LIBS"
AC_TRY_LINK([
#ifdef HAVE_RESOLV_H
#include <resolv.h>
#endif],
[res_query(0,0,0,0,0)],
[AC_MSG_RESULT(yes)
have_res_query=yes],
[AC_MSG_RESULT(no)
LIBS="$saved_libs"])
]
)
if test "$have_res_query" = "yes"
then
AC_DEFINE(HAVE_RES_QUERY,1, [Define if you have res_query function])
fi
dnl res_search
AC_SEARCH_LIBS(res_search,[resolv bind],have_res_search=yes,
[dnl Have to include resolv.h as res_query is sometimes defined as a macro
AC_MSG_CHECKING([for res_search in -lresolv (with resolv.h if present)])
saved_libs="$LIBS"
LIBS="-lresolv $LIBS"
AC_TRY_LINK([
#ifdef HAVE_RESOLV_H
#include <resolv.h>
#endif],
[res_search(0,0,0,0,0)],
[AC_MSG_RESULT(yes)
have_res_search=yes],
[AC_MSG_RESULT(no)
LIBS="$saved_libs"])
]
)
if test "$have_res_search" = "yes"
then
AC_DEFINE(HAVE_RES_SEARCH,1, [Define if you have res_search function])
fi
dnl res_querydomain
AC_SEARCH_LIBS(res_querydomain,[resolv bind],have_res_querydomain=yes,
[dnl Have to include resolv.h as res_query is sometimes defined as a macro
AC_MSG_CHECKING([for res_querydomain in -lresolv (with resolv.h if present)])
saved_libs="$LIBS"
LIBS="-lresolv $LIBS"
AC_TRY_LINK([
#ifdef HAVE_RESOLV_H
#include <resolv.h>
#endif],
[res_querydomain(0,0,0,0,0,0)],
[AC_MSG_RESULT(yes)
have_res_querydomain=yes],
[AC_MSG_RESULT(no)
LIBS="$saved_libs"])
]
)
if test "$have_res_querydomain" = "yes"
then
AC_DEFINE(HAVE_RES_QUERYDOMAIN,1, [Define if you have res_querydomain function])
fi
dnl res_mkquery
AC_SEARCH_LIBS(res_mkquery,[resolv bind],have_res_mkquery=yes,
[dnl Have to include resolv.h as res_query is sometimes defined as a macro
AC_MSG_CHECKING([for res_mkquery in -lresolv (with resolv.h if present)])
saved_libs="$LIBS"
LIBS="-lresolv $LIBS"
AC_TRY_LINK([
#ifdef HAVE_RESOLV_H
#include <resolv.h>
#endif],
[res_mkquery(0,0,0,0,0,0,0,0,0)],
[AC_MSG_RESULT(yes)
have_res_mkquery=yes],
[AC_MSG_RESULT(no)
LIBS="$saved_libs"])
]
)
if test "$have_res_mkquery" = "yes"
then
AC_DEFINE(HAVE_RES_MKQUERY,1, [Define if you have res_mkquery function])
fi
dnl res_send
AC_SEARCH_LIBS(res_send,[resolv bind],have_res_send=yes,
[dnl Have to include resolv.h as res_query is sometimes defined as a macro
AC_MSG_CHECKING([for res_send in -lresolv (with resolv.h if present)])
saved_libs="$LIBS"
LIBS="-lresolv $LIBS"
AC_TRY_LINK([
#ifdef HAVE_RESOLV_H
#include <resolv.h>
#endif],
[res_send(0,0,0,0)],
[AC_MSG_RESULT(yes)
have_res_send=yes],
[AC_MSG_RESULT(no)
LIBS="$saved_libs"])
]
)
if test "$have_res_send" = "yes"
then
AC_DEFINE(HAVE_RES_SEND,1, [Define if you have res_send function])
fi
dnl dn_comp
AC_SEARCH_LIBS(dn_comp,[resolv bind],have_dn_comp=yes,
[dnl Have to include resolv.h as res_query is sometimes defined as a macro
AC_MSG_CHECKING([for dn_comp in -lresolv (with resolv.h if present)])
saved_libs="$LIBS"
LIBS="-lresolv $LIBS"
AC_TRY_LINK([
#ifdef HAVE_RESOLV_H
#include <resolv.h>
#endif],
[dn_comp(0,0,0,0,0)],
[AC_MSG_RESULT(yes)
have_dn_comp=yes],
[AC_MSG_RESULT(no)
LIBS="$saved_libs"])
]
)
if test "$have_dn_comp" = "yes"
then
AC_DEFINE(HAVE_DN_COMP,1, [Define if you have dn_comp function])
fi
dnl dn_expand
AC_SEARCH_LIBS(dn_expand,[resolv bind],have_dn_expand=yes,
[dnl Have to include resolv.h as dn_expand is sometimes defined as a macro
AC_MSG_CHECKING([for dn_expand in -lresolv (with resolv.h if present)])
saved_libs="$LIBS"
LIBS="-lresolv $LIBS"
AC_TRY_LINK([
#ifdef HAVE_RESOLV_H
#include <resolv.h>
#endif],
[dn_expand(0,0,0,0,0)],
[AC_MSG_RESULT(yes)
have_dn_expand=yes],
[AC_MSG_RESULT(no)
LIBS="$saved_libs"])
]
)
if test "$have_dn_expand" = "yes"
then
AC_DEFINE(HAVE_DN_EXPAND,1, [Define if you have dn_expand function])
fi
dnl ns_initparse
AC_SEARCH_LIBS(ns_initparse,[resolv bind],have_ns_initparse=yes,
[dnl Have to include resolv.h as ns_initparse is sometimes defined as a macro
AC_MSG_CHECKING([for ns_initparse in -lresolv (with resolv.h if present)])
saved_libs="$LIBS"
LIBS="-lresolv $LIBS"
AC_TRY_LINK([
#ifdef HAVE_RESOLV_H
#include <resolv.h>
#endif],
[ns_initparse(0,0,0,0,0)],
[AC_MSG_RESULT(yes)
have_ns_initparse=yes],
[AC_MSG_RESULT(no)
LIBS="$saved_libs"])
]
)
if test "$have_ns_initparse" = "yes"
then
AC_DEFINE(HAVE_NS_INITPARSE,1, [Define if you have ns_initparse function])
fi
fi
])

View file

@ -0,0 +1,82 @@
dnl AX_CHECK_LIBCDIO([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
dnl
dnl Autor: Patrick Fedick <patrick@pfp.de>
dnl
dnl If library is found, it sets the following defines:
dnl HAVE_LIBCDIO
dnl LIBCDIO_CFLAGS
dnl LIBCDIO_LDFLAGS
AC_DEFUN([AX_CHECK_LIBCDIO],[
AC_MSG_CHECKING(if we should use libcdio)
AC_ARG_WITH([libcdio],
[ --with-libcdio[[=PATH]] support accesing audio cds (optional)],
[libcdio_prefix="$withval"],
[libcdio_prefix="auto"])
have_libcdio="no"
if test "$libcdio_prefix" != "no"
then
AC_MSG_RESULT(yes)
am_save_CPPFLAGS="$CPPFLAGS"
am_save_LIBS="$LIBS"
am_save_LDFLAGS="$LDFLAGS"
if test -n "$libcdio_prefix" -a "$libcdio_prefix" != "yes" -a "$libcdio_prefix" != "auto"
then
LIBCDIO_CFLAGS="-I$with_libcdio/include"
LIBCDIO_LDFLAGS="-L$with_libcdio/lib -lcdio "
else
AC_PATH_PROG([PKGCONFIG], [pkg-config], [no])
if test "$PKGCONFIG" != "no" && `$PKGCONFIG --exists libcdio`
then
LIBCDIO_CFLAGS=`$PKGCONFIG --cflags libcdio `
LIBCDIO_LDFLAGS=`$PKGCONFIG --libs libcdio `
else
PKG_CHECK_MODULES([libcdio], [libcdio],
LIBCDIO_CFLAGS=$libcdio_CFLAGS
LIBCDIO_LDFLAGS=$libcdio_LIBS
,
LIBCDIO_LDFLAGS="-lcdio "
)
fi
fi
CFLAGS="$CFLAGS $LIBCDIO_CFLAGS"
LDFLAGS="$LDFLAGS $LIBCDIO_LDFLAGS"
AC_MSG_CHECKING(if we can link against libcdio)
AC_TRY_LINK([
#include <stdio.h>
#include <cdio/cdio.h>
],[
CdIo_t *p_cdio = cdio_open (NULL, DRIVER_DEVICE);
],
AC_MSG_RESULT(yes)
have_libcdio="yes"
,
AC_MSG_RESULT(no)
)
CPPFLAGS=$am_save_CPPFLAGS
LIBS=$am_save_LIBS
LDFLAGS=$am_save_LDFLAGS
else
AC_MSG_RESULT(no)
fi
if test $have_libcdio = "yes"
then
AC_DEFINE(HAVE_LIBCDIO, 1, [Define if you have the libcdio library])
ifelse([$1], , :, [$1])
else
LIBCDIO_CFLAGS=""
LIBCDIO_LDFLAGS=""
ifelse([$2], , :, [$2])
fi
AC_SUBST(LIBCDIO_CFLAGS)
AC_SUBST(LIBCDIO_LDFLAGS)
])

View file

@ -0,0 +1,272 @@
#***************************************************************************
# _ _ ____ _
# Project ___| | | | _ \| |
# / __| | | | |_) | |
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# Copyright (C) 2006, David Shaw <dshaw@jabberwocky.com>
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://curl.haxx.se/docs/copyright.html.
#
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
# copies of the Software, and permit persons to whom the Software is
# furnished to do so, under the terms of the COPYING file.
#
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
# KIND, either express or implied.
#
###########################################################################
# LIBCURL_CHECK_CONFIG ([DEFAULT-ACTION], [MINIMUM-VERSION],
# [ACTION-IF-YES], [ACTION-IF-NO])
# ----------------------------------------------------------
# David Shaw <dshaw@jabberwocky.com> May-09-2006
#
# Checks for libcurl. DEFAULT-ACTION is the string yes or no to
# specify whether to default to --with-libcurl or --without-libcurl.
# If not supplied, DEFAULT-ACTION is yes. MINIMUM-VERSION is the
# minimum version of libcurl to accept. Pass the version as a regular
# version number like 7.10.1. If not supplied, any version is
# accepted. ACTION-IF-YES is a list of shell commands to run if
# libcurl was successfully found and passed the various tests.
# ACTION-IF-NO is a list of shell commands that are run otherwise.
# Note that using --without-libcurl does run ACTION-IF-NO.
#
# This macro #defines HAVE_LIBCURL if a working libcurl setup is
# found, and sets @LIBCURL@ and @LIBCURL_CPPFLAGS@ to the necessary
# values. Other useful defines are LIBCURL_FEATURE_xxx where xxx are
# the various features supported by libcurl, and LIBCURL_PROTOCOL_yyy
# where yyy are the various protocols supported by libcurl. Both xxx
# and yyy are capitalized. See the list of AH_TEMPLATEs at the top of
# the macro for the complete list of possible defines. Shell
# variables $libcurl_feature_xxx and $libcurl_protocol_yyy are also
# defined to 'yes' for those features and protocols that were found.
# Note that xxx and yyy keep the same capitalization as in the
# curl-config list (e.g. it's "HTTP" and not "http").
#
# Users may override the detected values by doing something like:
# LIBCURL="-lcurl" LIBCURL_CPPFLAGS="-I/usr/myinclude" ./configure
#
# For the sake of sanity, this macro assumes that any libcurl that is
# found is after version 7.7.2, the first version that included the
# curl-config script. Note that it is very important for people
# packaging binary versions of libcurl to include this script!
# Without curl-config, we can only guess what protocols are available,
# or use curl_version_info to figure it out at runtime.
AC_DEFUN([LIBCURL_CHECK_CONFIG],
[
AH_TEMPLATE([LIBCURL_FEATURE_SSL],[Defined if libcurl supports SSL])
AH_TEMPLATE([LIBCURL_FEATURE_KRB4],[Defined if libcurl supports KRB4])
AH_TEMPLATE([LIBCURL_FEATURE_IPV6],[Defined if libcurl supports IPv6])
AH_TEMPLATE([LIBCURL_FEATURE_LIBZ],[Defined if libcurl supports libz])
AH_TEMPLATE([LIBCURL_FEATURE_ASYNCHDNS],[Defined if libcurl supports AsynchDNS])
AH_TEMPLATE([LIBCURL_FEATURE_IDN],[Defined if libcurl supports IDN])
AH_TEMPLATE([LIBCURL_FEATURE_SSPI],[Defined if libcurl supports SSPI])
AH_TEMPLATE([LIBCURL_FEATURE_NTLM],[Defined if libcurl supports NTLM])
AH_TEMPLATE([LIBCURL_PROTOCOL_HTTP],[Defined if libcurl supports HTTP])
AH_TEMPLATE([LIBCURL_PROTOCOL_HTTPS],[Defined if libcurl supports HTTPS])
AH_TEMPLATE([LIBCURL_PROTOCOL_FTP],[Defined if libcurl supports FTP])
AH_TEMPLATE([LIBCURL_PROTOCOL_FTPS],[Defined if libcurl supports FTPS])
AH_TEMPLATE([LIBCURL_PROTOCOL_FILE],[Defined if libcurl supports FILE])
AH_TEMPLATE([LIBCURL_PROTOCOL_TELNET],[Defined if libcurl supports TELNET])
AH_TEMPLATE([LIBCURL_PROTOCOL_LDAP],[Defined if libcurl supports LDAP])
AH_TEMPLATE([LIBCURL_PROTOCOL_DICT],[Defined if libcurl supports DICT])
AH_TEMPLATE([LIBCURL_PROTOCOL_TFTP],[Defined if libcurl supports TFTP])
AH_TEMPLATE([LIBCURL_PROTOCOL_RTSP],[Defined if libcurl supports RTSP])
AH_TEMPLATE([LIBCURL_PROTOCOL_POP3],[Defined if libcurl supports POP3])
AH_TEMPLATE([LIBCURL_PROTOCOL_IMAP],[Defined if libcurl supports IMAP])
AH_TEMPLATE([LIBCURL_PROTOCOL_SMTP],[Defined if libcurl supports SMTP])
AC_ARG_WITH(libcurl,
AC_HELP_STRING([--with-libcurl=PREFIX],[look for the curl library in PREFIX/lib and headers in PREFIX/include]),
[_libcurl_with=$withval],[_libcurl_with=ifelse([$1],,[yes],[$1])])
if test "$_libcurl_with" != "no" ; then
AC_PROG_AWK
_libcurl_version_parse="eval $AWK '{split(\$NF,A,\".\"); X=256*256*A[[1]]+256*A[[2]]+A[[3]]; print X;}'"
_libcurl_try_link=yes
if test -d "$_libcurl_with" ; then
LIBCURL_CPPFLAGS="-I$withval/include"
_libcurl_ldflags="-L$withval/lib"
AC_PATH_PROG([_libcurl_config],[curl-config],[],
["$withval/bin"])
else
AC_PATH_PROG([_libcurl_config],[curl-config],[],[$PATH])
fi
if test x$_libcurl_config != "x" ; then
AC_CACHE_CHECK([for the version of libcurl],
[libcurl_cv_lib_curl_version],
[libcurl_cv_lib_curl_version=`$_libcurl_config --version | $AWK '{print $[]2}'`])
_libcurl_version=`echo $libcurl_cv_lib_curl_version | $_libcurl_version_parse`
_libcurl_wanted=`echo ifelse([$2],,[0],[$2]) | $_libcurl_version_parse`
if test $_libcurl_wanted -gt 0 ; then
AC_CACHE_CHECK([for libcurl >= version $2],
[libcurl_cv_lib_version_ok],
[
if test $_libcurl_version -ge $_libcurl_wanted ; then
libcurl_cv_lib_version_ok=yes
else
libcurl_cv_lib_version_ok=no
fi
])
fi
if test $_libcurl_wanted -eq 0 || test x$libcurl_cv_lib_version_ok = xyes ; then
if test x"$LIBCURL_CPPFLAGS" = "x" ; then
LIBCURL_CPPFLAGS=`$_libcurl_config --cflags`
fi
if test x"$LIBCURL" = "x" ; then
LIBCURL=`$_libcurl_config --libs`
# This is so silly, but Apple actually has a bug in their
# curl-config script. Fixed in Tiger, but there are still
# lots of Panther installs around.
case "${host}" in
powerpc-apple-darwin7*)
LIBCURL=`echo $LIBCURL | sed -e 's|-arch i386||g'`
;;
esac
fi
# All curl-config scripts support --feature
_libcurl_features=`$_libcurl_config --feature`
# Is it modern enough to have --protocols? (7.12.4)
if test $_libcurl_version -ge 461828 ; then
_libcurl_protocols=`$_libcurl_config --protocols`
fi
else
_libcurl_try_link=no
fi
unset _libcurl_wanted
fi
if test $_libcurl_try_link = yes ; then
# we didn't find curl-config, so let's see if the user-supplied
# link line (or failing that, "-lcurl") is enough.
LIBCURL=${LIBCURL-"$_libcurl_ldflags -lcurl"}
AC_CACHE_CHECK([whether libcurl is usable],
[libcurl_cv_lib_curl_usable],
[
_libcurl_save_cppflags=$CPPFLAGS
CPPFLAGS="$LIBCURL_CPPFLAGS $CPPFLAGS"
_libcurl_save_libs=$LIBS
LIBS="$LIBCURL $LIBS"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <curl/curl.h>]],[[
/* Try and use a few common options to force a failure if we are
missing symbols or can't link. */
int x;
curl_easy_setopt(NULL,CURLOPT_URL,NULL);
x=CURL_ERROR_SIZE;
x=CURLOPT_WRITEFUNCTION;
x=CURLOPT_WRITEDATA;
x=CURLOPT_ERRORBUFFER;
x=CURLOPT_STDERR;
x=CURLOPT_VERBOSE;
if (x) ;
]])],libcurl_cv_lib_curl_usable=yes,libcurl_cv_lib_curl_usable=no)
CPPFLAGS=$_libcurl_save_cppflags
LIBS=$_libcurl_save_libs
unset _libcurl_save_cppflags
unset _libcurl_save_libs
])
if test $libcurl_cv_lib_curl_usable = yes ; then
# Does curl_free() exist in this version of libcurl?
# If not, fake it with free()
_libcurl_save_cppflags=$CPPFLAGS
CPPFLAGS="$CPPFLAGS $LIBCURL_CPPFLAGS"
_libcurl_save_libs=$LIBS
LIBS="$LIBS $LIBCURL"
AC_CHECK_FUNC(curl_free,,
AC_DEFINE(curl_free,free,
[Define curl_free() as free() if our version of curl lacks curl_free.]))
CPPFLAGS=$_libcurl_save_cppflags
LIBS=$_libcurl_save_libs
unset _libcurl_save_cppflags
unset _libcurl_save_libs
AC_DEFINE(HAVE_LIBCURL,1,
[Define to 1 if you have a functional curl library.])
AC_SUBST(LIBCURL_CPPFLAGS)
AC_SUBST(LIBCURL)
for _libcurl_feature in $_libcurl_features ; do
AC_DEFINE_UNQUOTED(AS_TR_CPP(libcurl_feature_$_libcurl_feature),[1])
eval AS_TR_SH(libcurl_feature_$_libcurl_feature)=yes
done
if test "x$_libcurl_protocols" = "x" ; then
# We don't have --protocols, so just assume that all
# protocols are available
_libcurl_protocols="HTTP FTP FILE TELNET LDAP DICT TFTP"
if test x$libcurl_feature_SSL = xyes ; then
_libcurl_protocols="$_libcurl_protocols HTTPS"
# FTPS wasn't standards-compliant until version
# 7.11.0 (0x070b00 == 461568)
if test $_libcurl_version -ge 461568; then
_libcurl_protocols="$_libcurl_protocols FTPS"
fi
fi
# RTSP, IMAP, POP3 and SMTP were added in
# 7.20.0 (0x071400 == 463872)
if test $_libcurl_version -ge 463872; then
_libcurl_protocols="$_libcurl_protocols RTSP IMAP POP3 SMTP"
fi
fi
for _libcurl_protocol in $_libcurl_protocols ; do
AC_DEFINE_UNQUOTED(AS_TR_CPP(libcurl_protocol_$_libcurl_protocol),[1])
eval AS_TR_SH(libcurl_protocol_$_libcurl_protocol)=yes
done
else
unset LIBCURL
unset LIBCURL_CPPFLAGS
fi
fi
unset _libcurl_try_link
unset _libcurl_version_parse
unset _libcurl_config
unset _libcurl_feature
unset _libcurl_features
unset _libcurl_protocol
unset _libcurl_protocols
unset _libcurl_version
unset _libcurl_ldflags
fi
if test x$_libcurl_with = xno || test x$libcurl_cv_lib_curl_usable != xyes ; then
# This is the IF-NO path
ifelse([$4],,:,[$4])
else
# This is the IF-YES path
ifelse([$3],,:,[$3])
fi
unset _libcurl_with
])dnl

View file

@ -0,0 +1,68 @@
dnl AM_LIBIDN([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
AC_DEFUN([AM_LIBIDN],[
AC_ARG_WITH([libidn],
[ --with-libidn[[=PATH]] Prefix where libidn is installed (optional)],
[libidn_prefix="$withval"],
[libidn_prefix="no"])
am_save_CFLAGS="$CFLAGS"
am_save_LIBS="$LIBS"
am_save_LDFLAGS="$LDFLAGS"
LIBIDN_LIBS="-lidn"
LIBIDN_CFLAGS=""
have_libidn="no"
if test "$libidn_prefix" != "yes"
then
if test "$libidn_prefix" != "no"
then
LIBS="-L$libidn_prefix/lib -lidn $LIBS"
CFLAGS="$CFLAGS -I$libidn_prefix/include"
LIBIDN_LIBS="-L$libidn_prefix/lib -lidn"
LIBIDN_CFLAGS="-I$libidn_prefix/include"
else
LIBS="-lidn $LIBS"
LIBIDN_LIBS="-lidn"
fi
else
LIBS="-lidn $LIBS"
LIBIDN_LIBS="-lidn"
fi
AC_CHECK_HEADER([idna.h], [
AC_MSG_CHECKING([for idn library and linking])
AC_LINK_IFELSE([AC_LANG_SOURCE(
[[
#include <idna.h>
int main()
{
char *idn=NULL;
char *a=NULL;
if (IDNA_SUCCESS==idna_to_ascii_8z(idn, &a,0) && a!=NULL) {
return 1;
}
return 0;
}
]])],
[AC_MSG_RESULT(yes)
have_libidn="yes"
],
[
AC_MSG_RESULT(no)
]
)
])
CFLAGS=$am_save_CFLAGS
LIBS=$am_save_LIBS
LDFLAGS=$am_save_LDFLAGS
if test "$have_libidn" = "yes"
then
ifelse([$2], , :, [$2])
else
LIBIDN_LIBS=""
LIBIDN_CFLAGS=""
ifelse([$3], , :, [$3])
fi
])

View file

@ -0,0 +1,91 @@
dnl AM_LIBIDN([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
AC_DEFUN([AM_LIBIDN2],[
AC_ARG_WITH([libidn2],
[ --with-libidn2[[=PATH]] Prefix where libidn2 is installed (optional)],
[libidn2_prefix="$withval"],
[libidn2_prefix="no"])
am_save_CPPFLAGS="$CPPFLAGS"
am_save_CFLAGS="$CFLAGS"
am_save_LIBS="$LIBS"
am_save_LDFLAGS="$LDFLAGS"
LIBIDN2_LIBS=""
LIBIDN2_CFLAGS=""
have_libidn="no"
if test "$libidn2_prefix" != "yes"
then
if test "$libidn2_prefix" != "no"
then
LIBS="-L$libidn2_prefix/lib -lidn2 $LIBS"
CPPFLAGS="$CPPFLAGS -I$libidn2_prefix/include"
CFLAGS="$CFLAGS -I$libidn2_prefix/include"
LIBIDN2_LIBS="-L$libidn2_prefix/lib -lidn2"
LIBIDN2_CFLAGS="-I$libidn2_prefix/include"
else
LIBS="-lidn2 $LIBS"
LIBIDN2_LIBS="-lidn2"
fi
else
LIBS="-lidn2 $LIBS"
LIBIDN2_LIBS="-lidn2"
fi
AC_CHECK_HEADER([idn2.h], [
AC_MSG_CHECKING([for idn2 library and linking])
AC_LINK_IFELSE([AC_LANG_SOURCE(
[[
#include <idn2.h>
int main()
{
char *idn=NULL;
char *a=NULL;
if (IDNA_SUCCESS==idn2_to_ascii_8z(idn, &a,0) && a!=NULL) {
return 1;
}
return 0;
}
]])],
[AC_MSG_RESULT(yes)
have_libidn2="yes"
],
[
AC_MSG_RESULT(no)
]
)
AC_MSG_CHECKING([for existing IDN2_NO_TR46-flag in idn2 library])
AC_LINK_IFELSE([AC_LANG_SOURCE(
[[
#include <idn2.h>
int main()
{
char *idn=NULL;
char *a=NULL;
if (IDNA_SUCCESS==idn2_to_ascii_8z(idn, &a,IDN2_NO_TR46) && a!=NULL) {
return 1;
}
return 0;
}
]])],
[AC_MSG_RESULT(yes)
have_libidn2_IDN2_NO_TR46="yes"
AC_DEFINE(HAVE_LIBIDN2_IDN2_NO_TR46, 1, [ Define if libidn2 has IDN2_NO_TR46 flag. ])
],
[
AC_MSG_RESULT(no)
]
)
])
CFLAGS=$am_save_CFLAGS
CPPFLAGS=$am_save_CPPFLAGS
LIBS=$am_save_LIBS
LDFLAGS=$am_save_LDFLAGS
if test "$have_libidn2" = "yes"
then
ifelse([$2], , :, [$2])
else
ifelse([$3], , :, [$3])
fi
])

View file

@ -0,0 +1,42 @@
dnl AC_CHECK_LIBJPEGTURBO([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
AC_DEFUN([AC_CHECK_LIBJPEGTURBO],[
AC_MSG_CHECKING(for libjpegturbo)
AC_ARG_WITH([libjpegturbo],
[ --with-libjpegturbo[[=PATH]] Prefix where libjpeg-turbo is installed (optional)],
[libjpegturbo_prefix="$withval"],
[libjpegturbo_prefix=""])
if test "$libjpegturbo_prefix" != "no"
then
AC_MSG_RESULT(yes)
am_save_CPPFLAGS="$CPPFLAGS"
am_save_CFLAGS="$CFLAGS"
am_save_LIBS="$LIBS"
am_save_LDFLAGS="$LDFLAGS"
LIBS=""
PKG_CHECK_MODULES([TURBOJPEG], [libturbojpeg >= $1],
ifelse([$2], , :, [$2])
,
AC_SEARCH_LIBS( [tjInitDecompress],[turbojpeg],
dnl echo "LIBS=$LIBS"
dnl echo "LDFLAGS=$LDFLAGS"
dnl echo "CFLAGS=$CFLAGS"
dnl echo "CPPFLAGS=$CPPFLAGS"
TURBOJPEG_LIBS="$LIBS"
TURBOJPEG_CFLAGS=""
ifelse([$2], , :, [$2])
,
ifelse([$3], , :, [$3])
:)
)
CPPFLAGS="$am_save_CPPFLAGS"
LIBS="$am_save_LIBS"
LDFLAGS="$am_save_LDFLAGS"
CFLAGS="$am_save_CFLAGS"
else
AC_MSG_RESULT(no)
ifelse([$3], , :, [$3])
fi
])

View file

@ -0,0 +1,251 @@
dnl Autoconf macros for libmcrypt
dnl $id$
# This script detects libmcrypt version and defines
# LIBMCRYPT_CFLAGS, LIBMCRYPT_LIBS
# and LIBMCRYPT24 or LIBMCRYPT22 depending on libmcrypt version
# found.
# Modified for LIBMCRYPT -- nmav
# Configure paths for LIBGCRYPT
# Shamelessly stolen from the one of XDELTA by Owen Taylor
# Werner Koch 99-12-09
dnl AM_PATH_LIBMCRYPT([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
dnl Test for libmcrypt, and define LIBMCRYPT_CFLAGS and LIBMCRYPT_LIBS
dnl
AC_DEFUN([AM_PATH_LIBMCRYPT],
[dnl
dnl Get the cflags and libraries from the libmcrypt-config script
dnl
AC_ARG_WITH(libmcrypt-prefix,
[ --with-libmcrypt-prefix=PFX Prefix where libmcrypt is installed (optional)],
libmcrypt_config_prefix="$withval", libmcrypt_config_prefix="")
if test x$libmcrypt_config_prefix != x ; then
libmcrypt_config_args="$libmcrypt_config_args --prefix=$libmcrypt_config_prefix"
if test x${LIBMCRYPT_CONFIG+set} != xset ; then
LIBMCRYPT_CONFIG=$libmcrypt_config_prefix/bin/libmcrypt-config
fi
fi
AC_PATH_PROG(LIBMCRYPT_CONFIG, libmcrypt-config, no)
min_libmcrypt_version=ifelse([$1], ,2.4.0,$1)
AC_MSG_CHECKING(for libmcrypt - version >= $min_libmcrypt_version)
no_libmcrypt=""
if test "$LIBMCRYPT_CONFIG" = "no" ; then
dnl libmcrypt-config was not found (pre 2.4.11 versions)
dnl Try to detect libmcrypt version
AC_TRY_RUN([
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <mcrypt.h>
int
main ()
{
#if MCRYPT_API_VERSION <= 19991015
/* version 2.2 */
return 0;
#else
/* version 2.4 */
return 1;
#endif /* 19991015 */
}
], libmcrypt_config_version="2.2.0"
if test x$libmcrypt_config_prefix != x ; then
TTLIBS="-L${libmcrypt_config_prefix}/libs"
TTINCLUDE="-I${libmcrypt_config_prefix}/include"
fi
LIBMCRYPT_CFLAGS="${TTINCLUDE}"
LIBMCRYPT_LIBS="${TTLIBS} -lmcrypt"
AC_DEFINE(LIBMCRYPT22, 1, [have libmcrypt 2.2])
, libmcrypt_config_version="2.4.0"
if test x$libmcrypt_config_prefix != x ; then
TTLIBS="-L${libmcrypt_config_prefix}/libs"
TTINCLUDE="-I${libmcrypt_config_prefix}/include"
fi
LIBMCRYPT_CFLAGS="${TTINCLUDE}"
LIBMCRYPT_LIBS="${TTLIBS} -lmcrypt -lltdl ${LIBADD_DL}"
AC_DEFINE(LIBMCRYPT24, 1, [have libmcrypt 2.4]))
else
dnl libmcrypt-config was found
LIBMCRYPT_CFLAGS=`$LIBMCRYPT_CONFIG $libmcrypt_config_args --cflags`
LIBMCRYPT_LIBS=`$LIBMCRYPT_CONFIG $libmcrypt_config_args --libs`
libmcrypt_config_version=`$LIBMCRYPT_CONFIG $libmcrypt_config_args --version`
AC_DEFINE(LIBMCRYPT24, 1, [have libmcrypt 2.4])
fi
ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $LIBMCRYPT_CFLAGS"
LIBS="$LIBS $LIBMCRYPT_LIBS"
dnl
dnl Now check if the installed libmcrypt is sufficiently new. Also sanity
dnl checks the results of libmcrypt-config to some extent
dnl
rm -f conf.libmcrypttest
AC_TRY_RUN([
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <mcrypt.h>
#define TWO "2.2"
int
main ()
{
#if MCRYPT_API_VERSION <= 20010201
#if MCRYPT_API_VERSION <= 19991015
/* version 2.2 */
int x = mcrypt_get_key_size(MCRYPT_TWOFISH_128);
system ("touch conf.libmcrypttest");
if( strncmp( TWO, "$min_libmcrypt_version", strlen(TWO))) {
printf("\n*** Requested libmcrypt %s, but LIBMCRYPT (%s)\n",
"$min_libmcrypt_version", TWO );
printf("*** was found!\n");
return 1;
}
return 0;
#else
/* version 2.4 before 11 */
MCRYPT td = mcrypt_module_open("twofish", NULL, "cbc", NULL);
system ("touch conf.libmcrypttest");
mcrypt_module_close(td);
return 0;
#endif /* 19991015 */
#else
system ("touch conf.libmcrypttest");
if( strcmp( mcrypt_check_version(NULL), "$libmcrypt_config_version" ) )
{
printf("\n*** 'libmcrypt-config --version' returned %s, but LIBMCRYPT (%s)\n",
"$libmcrypt_config_version", mcrypt_check_version(NULL) );
printf("*** was found! If libmcrypt-config was correct, then it is best\n");
printf("*** to remove the old version of LIBMCRYPT. You may also be able to fix the error\n");
printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
printf("*** required on your system.\n");
printf("*** If libmcrypt-config was wrong, set the environment variable LIBMCRYPT_CONFIG\n");
printf("*** to point to the correct copy of libmcrypt-config, and remove the file config.cache\n");
printf("*** before re-running configure\n");
}
else if ( strcmp(mcrypt_check_version(NULL), LIBMCRYPT_VERSION ) )
{
printf("\n*** LIBMCRYPT header file (version %s) does not match\n", LIBMCRYPT_VERSION);
printf("*** library (version %s)\n", mcrypt_check_version(NULL) );
}
else
{
if ( mcrypt_check_version( "$min_libmcrypt_version" ) )
{
return 0;
}
else
{
printf("no\n*** An old version of LIBMCRYPT (%s) was found.\n",
mcrypt_check_version(NULL) );
printf("*** You need a version of LIBMCRYPT newer than %s. The latest version of\n",
"$min_libmcrypt_version" );
printf("*** LIBMCRYPT is always available from ftp://mcrypt.hellug.gr/pub/mcrypt.\n");
printf("*** \n");
printf("*** If you have already installed a sufficiently new version, this error\n");
printf("*** probably means that the wrong copy of the libmcrypt-config shell script is\n");
printf("*** being found. The easiest way to fix this is to remove the old version\n");
printf("*** of LIBMCRYPT, but you can also set the LIBMCRYPT_CONFIG environment to point to the\n");
printf("*** correct copy of libmcrypt-config. (In this case, you will have to\n");
printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
printf("*** so that the correct libraries are found at run-time))\n");
}
}
return 1;
#endif /* 20010201 */
}
],, no_libmcrypt=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
if test "$libmcrypt_config_prefix" = "no" ; then
no_libmcrypt="yes"
fi
if test "x$no_libmcrypt" = x ; then
AC_MSG_RESULT(yes)
ifelse([$2], , :, [$2])
else
if test -f conf.libmcrypttest ; then
:
else
AC_MSG_RESULT(no)
fi
if test -f conf.libmcrypttest ; then
:
else
echo "*** Could not run libmcrypt test program, checking why..."
CFLAGS="$CFLAGS $LIBMCRYPT_CFLAGS"
LIBS="$LIBS $LIBMCRYPT_LIBS"
AC_TRY_LINK([
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <mcrypt.h>
], [
#if MCRYPT_API_VERSION <= 20010201
#if MCRYPT_API_VERSION <= 19991015
/* version 2.2 */
int x = mcrypt_get_key_size(MCRYPT_TWOFISH_128);
return 0;
#else
/* version 2.4 before 11 */
MCRYPT td = mcrypt_module_open("twofish", NULL, "cbc", NULL);
mcrypt_module_close(td);
return 0;
#endif /* 19991015 */
#else
return !!mcrypt_check_version(NULL);
#endif /* 20010201 */
],
[ echo "*** The test program compiled, but did not run. This usually means"
echo "*** that the run-time linker is not finding LIBMCRYPT or finding the wrong"
echo "*** version of LIBMCRYPT. If it is not finding LIBMCRYPT, you'll need to set your"
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
echo "*** to the installed location Also, make sure you have run ldconfig if that"
echo "*** is required on your system"
echo "***"
echo "*** If you have an old version installed, it is best to remove it, although"
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
echo "***" ],
[ echo "*** The test program failed to compile or link. See the file config.log for the"
echo "*** exact error that occured. This usually means LIBMCRYPT was incorrectly installed"
echo "*** or that you have moved LIBMCRYPT since it was installed. In the latter case, you"
echo "*** may want to edit the libmcrypt-config script: $LIBMCRYPT_CONFIG" ])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi
LIBMCRYPT_CFLAGS=""
LIBMCRYPT_LIBS=""
ifelse([$3], , :, [$3])
fi
rm -f conf.libmcrypttest
AC_SUBST(LIBMCRYPT_CFLAGS)
AC_SUBST(LIBMCRYPT_LIBS)
])
dnl *-*wedit:notab*-* Please keep this as the last line.

View file

@ -0,0 +1,53 @@
dnl AM_LIBMICROHTTPD([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
AC_DEFUN([AM_LIBMICROHTTPD],[dnl
AC_MSG_CHECKING([for libmicrohttpd library and headers])
AC_ARG_WITH([libmicrohttpd],
[ --with-libmicrohttpd[[=PATH]] Prefix where libmicrohttpd is installed (optional)],
[libmicrohttpd_prefix="$withval"],
[libmicrohttpd_prefix="no"])
if test "$libmicrohttpd_prefix" != "no"
then
am_save_CPPFLAGS="$CPPFLAGS"
am_save_LIBS="$LIBS"
am_save_LDFLAGS="$LDFLAGS"
LIBS="$LIBS -lmicrohttpd"
LIBMICROHTTPD_LIBS="-lmicrohttpd"
LIBMICROHTTPD_CFLAGS=""
if test "$libmicrohttpd_prefix" != "yes"
then
LIBS="-L$libmicrohttpd_prefix/lib -lmicrohttpd"
CPPFLAGS="-I$libmicrohttpd_prefix/include"
LIBMICROHTTPD_LIBS="-L$libmicrohttpd_prefix/lib -lmicrohttpd"
LIBMICROHTTPD_CFLAGS="-I$libmicrohttpd_prefix/include"
fi
AC_LINK_IFELSE( [AC_LANG_SOURCE([[
#include <microhttpd.h>
int main()
{
struct MHD_Daemon* daemon;
MHD_stop_daemon(daemon);
}
]]) ],
[AC_MSG_RESULT(yes)
ifelse([$2], , :, [$2])
],
[
AC_MSG_RESULT(no)
ifelse([$3], , :, [$3])
]
)
CPPFLAGS=$am_save_CPPFLAGS
LIBS=$am_save_LIBS
LDFLAGS=$am_save_LDFLAGS
else
AC_MSG_RESULT(no)
ifelse([$3], , :, [$3])
fi
])

View file

@ -0,0 +1,59 @@
dnl AC_CHECK_LIBTIFF([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
AC_DEFUN([AC_CHECK_LIBTIFF],[
AC_MSG_CHECKING(for libtiff)
AC_ARG_WITH([libtiff],
[ --with-libtiff[[=PATH]] Prefix where libtiff is installed (optional)],
[libtiff_prefix="$withval"],
[libtiff_prefix="no"])
if test "$libtiff_prefix" != "no"
then
if test "$libtiff_prefix" != "yes"
then
intLIBTIFF_LIBS="-L $libtiff_prefix/lib -ltiff"
intLIBTIFF_CFLAGS="-I $libtiff_prefix/include"
else
intLIBTIFF_LIBS="-ltiff"
intLIBTIFF_CFLAGS=""
fi
am_save_CPPFLAGS="$CPPFLAGS"
am_save_LIBS="$LIBS"
am_save_LDFLAGS="$LDFLAGS"
am_save_CFLAGS="$CFLAGS"
AC_CHECK_LIB(lzma,lzma_code,
intLIBTIFF_LIBS="$intLIBTIFF_LIBS -llzma"
AC_MSG_RESULT(yes)
,
AC_MSG_RESULT(no)
)
LIBS="$LIBS $intLIBTIFF_LIBS $JPEG_LIBS -lz"
CFLAGS="$CFLAGS $intLIBTIFF_CFLAGS $JPEG_CFLAGS"
AC_CHECK_HEADERS([tiffio.h],
AC_CHECK_LIB(tiff,TIFFClientOpen,
TIFF_LIBS=$intLIBTIFF_LIBS
TIFF_CFLAGS=$intLIBTIFF_CFLAGS
AC_MSG_RESULT(yes)
ifelse([$2], , :, [$2])
,
AC_MSG_RESULT(no)
ifelse([$3], , :, [$3])
:)
,
AC_MSG_RESULT(no)
ifelse([$3], , :, [$3])
)
CPPFLAGS="$am_save_CPPFLAGS"
LIBS="$am_save_LIBS"
LDFLAGS="$am_save_LDFLAGS"
CFLAGS="$am_save_CFLAGS"
else
AC_MSG_RESULT(no)
ifelse([$3], , :, [$3])
fi
])

215
src/pplib/autoconf/missing Executable file
View file

@ -0,0 +1,215 @@
#! /bin/sh
# Common wrapper for a few potentially missing GNU programs.
scriptversion=2012-06-26.16; # UTC
# Copyright (C) 1996-2013 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 'automa4te' 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:

View file

@ -0,0 +1,49 @@
dnl AC_CHECK_LIBJPEG([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
AC_DEFUN([AC_CHECK_LIBMPG123],[
AC_ARG_WITH([mpg123],
[ --with-mpg123[[=PATH]] Prefix where libmpg123 is installed (optional)],
[mpg123_prefix="$withval"],
[mpg123_prefix="no"])
if test "$mpg123_prefix" != "no"
then
if test "$mpg123_prefix" != "yes"
then
intMPG123_LIBS="-L $mpg123_prefix/lib -lmpg123"
intMPG123_CFLAGS="-I $mpg123_prefix/include"
else
intMPG123_LIBS="-lmpg123"
intMPG123_CFLAGS=""
fi
am_save_CPPFLAGS="$CPPFLAGS"
am_save_LIBS="$LIBS"
am_save_LDFLAGS="$LDFLAGS"
am_save_CFLAGS="$CFLAGS"
LIBS="$LIBS $intMPG123_LIBS"
CFLAGS="$CFLAGS $intMPG123_CFLAGS"
AC_CHECK_HEADERS([mpg123.h],
AC_CHECK_LIB(mpg123,mpg123_init,
MPG123_LIBS=$intMPG123_LIBS
MPG123_CFLAGS=$intMPG123_CFLAGS
ifelse([$2], , :, [$2])
,
ifelse([$3], , :, [$3])
:)
,
ifelse([$3], , :, [$3])
)
CPPFLAGS="$am_save_CPPFLAGS"
LIBS="$am_save_LIBS"
LDFLAGS="$am_save_LDFLAGS"
CFLAGS="$am_save_CFLAGS"
else
AC_MSG_RESULT(no)
ifelse([$3], , :, [$3])
fi
])

View file

@ -0,0 +1,61 @@
dnl AC_CHECK_NASM([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
AC_DEFUN([AC_CHECK_NASM],[
AC_ARG_WITH([nasm],
[ --with-nasm[[=PATH]] Prefix where nasm is installed (optional)],
[nasm_prefix="$withval"],
[nasm_prefix="yes"])
if test "$nasm_prefix" != "no"
then
save_path=$PATH
if test -n "$nasm_prefix"
then
if test "$nasm_prefix" != "yes"
then
PATH=$nasm_prefix
export PATH
fi
fi
AC_PATH_PROG(nasm,nasm)
PATH=$save_path
echo "nasm=$nasm"
if test -n "$nasm" -a -x "$nasm"
then
NASM=${nasm}
AC_SUBST(NASM)
NASMDEBUGFLAGS="-g"
case `uname -m`-`uname -s` in
win32*)
NASMFLAGS="-f win32"
;;
win64*|x86_64-MSYS*)
NASMFLAGS="-f win64"
;;
x86_64*|amd64*)
NASMFLAGS="-f elf64"
;;
*)
NASMFLAGS="-f elf32"
;;
esac
case `uname -s` in
MINGW32*)
NASMFLAGS="-f win32"
NASMDEBUGFLAGS="-g"
;;
MINGW64*)
NASMFLAGS="-f win64"
NASMDEBUGFLAGS="-g"
;;
esac
AC_SUBST(NASMFLAGS)
AC_SUBST(NASMDEBUGFLAGS)
ifelse([$2], , :, [$2])
fi
fi
])

Some files were not shown because too many files have changed in this diff Show more