add p25 and ctcss repeater blocks
git-svn-id: http://op25.osmocom.org/svn/trunk@207 65a5c917-d112-43f1-993d-58c26a4786be
This commit is contained in:
parent
59e8c4216a
commit
8689e29f5f
|
@ -0,0 +1,3 @@
|
|||
Max <>
|
||||
Mike Ossman <>
|
||||
Steve Glass <stevie@sedition.org.au>
|
|
@ -0,0 +1,340 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) 19yy <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) 19yy name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
|
@ -0,0 +1,23 @@
|
|||
#
|
||||
# Copyright 2008 Steve Glass
|
||||
#
|
||||
# This file is part of OP25
|
||||
#
|
||||
# OP25 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, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# OP25 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 OP25; see the file COPYING. If not, write to the Free
|
||||
# Software Foundation, Inc., 51 Franklin Street, Boston, MA
|
||||
# 02110-1301, USA.
|
||||
|
||||
For the complete project change log, please see
|
||||
http://www.sedition.org.au/op25/timeline
|
||||
|
|
@ -0,0 +1,229 @@
|
|||
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software
|
||||
Foundation, Inc.
|
||||
|
||||
This file is free documentation; the Free Software Foundation gives
|
||||
unlimited permission to copy, distribute and modify it.
|
||||
|
||||
Basic Installation
|
||||
==================
|
||||
|
||||
These are generic installation instructions.
|
||||
|
||||
The `configure' shell script attempts to guess correct values for
|
||||
various system-dependent variables used during compilation. It uses
|
||||
those values to create a `Makefile' in each directory of the package.
|
||||
It may also create one or more `.h' files containing system-dependent
|
||||
definitions. Finally, it creates a shell script `config.status' that
|
||||
you can run in the future to recreate the current configuration, and a
|
||||
file `config.log' containing compiler output (useful mainly for
|
||||
debugging `configure').
|
||||
|
||||
It can also use an optional file (typically called `config.cache'
|
||||
and enabled with `--cache-file=config.cache' or simply `-C') that saves
|
||||
the results of its tests to speed up reconfiguring. (Caching is
|
||||
disabled by default to prevent problems with accidental use of stale
|
||||
cache files.)
|
||||
|
||||
If you need to do unusual things to compile the package, please try
|
||||
to figure out how `configure' could check whether to do them, and mail
|
||||
diffs or instructions to the address given in the `README' so they can
|
||||
be considered for the next release. If you are using the cache, and at
|
||||
some point `config.cache' contains results you don't want to keep, you
|
||||
may remove or edit it.
|
||||
|
||||
The file `configure.ac' (or `configure.in') is used to create
|
||||
`configure' by a program called `autoconf'. You only need
|
||||
`configure.ac' if you want to change it or regenerate `configure' using
|
||||
a newer version of `autoconf'.
|
||||
|
||||
The simplest way to compile this package is:
|
||||
|
||||
1. `cd' to the directory containing the package's source code and type
|
||||
`./configure' to configure the package for your system. If you're
|
||||
using `csh' on an old version of System V, you might need to type
|
||||
`sh ./configure' instead to prevent `csh' from trying to execute
|
||||
`configure' itself.
|
||||
|
||||
Running `configure' takes awhile. While running, it prints some
|
||||
messages telling which features it is checking for.
|
||||
|
||||
2. Type `make' to compile the package.
|
||||
|
||||
3. Optionally, type `make check' to run any self-tests that come with
|
||||
the package.
|
||||
|
||||
4. Type `make install' to install the programs and any data files and
|
||||
documentation.
|
||||
|
||||
5. You can remove the program binaries and object files from the
|
||||
source code directory by typing `make clean'. To also remove the
|
||||
files that `configure' created (so you can compile the package for
|
||||
a different kind of computer), type `make distclean'. There is
|
||||
also a `make maintainer-clean' target, but that is intended mainly
|
||||
for the package's developers. If you use it, you may have to get
|
||||
all sorts of other programs in order to regenerate files that came
|
||||
with the distribution.
|
||||
|
||||
Compilers and Options
|
||||
=====================
|
||||
|
||||
Some systems require unusual options for compilation or linking that
|
||||
the `configure' script does not know about. Run `./configure --help'
|
||||
for details on some of the pertinent environment variables.
|
||||
|
||||
You can give `configure' initial values for configuration parameters
|
||||
by setting variables in the command line or in the environment. Here
|
||||
is an example:
|
||||
|
||||
./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
|
||||
|
||||
*Note Defining Variables::, for more details.
|
||||
|
||||
Compiling For Multiple Architectures
|
||||
====================================
|
||||
|
||||
You can compile the package for more than one kind of computer at the
|
||||
same time, by placing the object files for each architecture in their
|
||||
own directory. To do this, you must use a version of `make' that
|
||||
supports the `VPATH' variable, such as GNU `make'. `cd' to the
|
||||
directory where you want the object files and executables to go and run
|
||||
the `configure' script. `configure' automatically checks for the
|
||||
source code in the directory that `configure' is in and in `..'.
|
||||
|
||||
If you have to use a `make' that does not support the `VPATH'
|
||||
variable, you have to compile the package for one architecture at a
|
||||
time in the source code directory. After you have installed the
|
||||
package for one architecture, use `make distclean' before reconfiguring
|
||||
for another architecture.
|
||||
|
||||
Installation Names
|
||||
==================
|
||||
|
||||
By default, `make install' will install the package's files in
|
||||
`/usr/local/bin', `/usr/local/man', etc. You can specify an
|
||||
installation prefix other than `/usr/local' by giving `configure' the
|
||||
option `--prefix=PATH'.
|
||||
|
||||
You can specify separate installation prefixes for
|
||||
architecture-specific files and architecture-independent files. If you
|
||||
give `configure' the option `--exec-prefix=PATH', the package will use
|
||||
PATH as the prefix for installing programs and libraries.
|
||||
Documentation and other data files will still use the regular prefix.
|
||||
|
||||
In addition, if you use an unusual directory layout you can give
|
||||
options like `--bindir=PATH' to specify different values for particular
|
||||
kinds of files. Run `configure --help' for a list of the directories
|
||||
you can set and what kinds of files go in them.
|
||||
|
||||
If the package supports it, you can cause programs to be installed
|
||||
with an extra prefix or suffix on their names by giving `configure' the
|
||||
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
|
||||
|
||||
Optional Features
|
||||
=================
|
||||
|
||||
Some packages pay attention to `--enable-FEATURE' options to
|
||||
`configure', where FEATURE indicates an optional part of the package.
|
||||
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
|
||||
is something like `gnu-as' or `x' (for the X Window System). The
|
||||
`README' should mention any `--enable-' and `--with-' options that the
|
||||
package recognizes.
|
||||
|
||||
For packages that use the X Window System, `configure' can usually
|
||||
find the X include and library files automatically, but if it doesn't,
|
||||
you can use the `configure' options `--x-includes=DIR' and
|
||||
`--x-libraries=DIR' to specify their locations.
|
||||
|
||||
Specifying the System Type
|
||||
==========================
|
||||
|
||||
There may be some features `configure' cannot figure out
|
||||
automatically, but needs to determine by the type of machine the package
|
||||
will run on. Usually, assuming the package is built to be run on the
|
||||
_same_ architectures, `configure' can figure that out, but if it prints
|
||||
a message saying it cannot guess the machine type, give it the
|
||||
`--build=TYPE' option. TYPE can either be a short name for the system
|
||||
type, such as `sun4', or a canonical name which has the form:
|
||||
|
||||
CPU-COMPANY-SYSTEM
|
||||
|
||||
where SYSTEM can have one of these forms:
|
||||
|
||||
OS KERNEL-OS
|
||||
|
||||
See the file `config.sub' for the possible values of each field. If
|
||||
`config.sub' isn't included in this package, then this package doesn't
|
||||
need to know the machine type.
|
||||
|
||||
If you are _building_ compiler tools for cross-compiling, you should
|
||||
use the `--target=TYPE' option to select the type of system they will
|
||||
produce code for.
|
||||
|
||||
If you want to _use_ a cross compiler, that generates code for a
|
||||
platform different from the build platform, you should specify the
|
||||
"host" platform (i.e., that on which the generated programs will
|
||||
eventually be run) with `--host=TYPE'.
|
||||
|
||||
Sharing Defaults
|
||||
================
|
||||
|
||||
If you want to set default values for `configure' scripts to share,
|
||||
you can create a site shell script called `config.site' that gives
|
||||
default values for variables like `CC', `cache_file', and `prefix'.
|
||||
`configure' looks for `PREFIX/share/config.site' if it exists, then
|
||||
`PREFIX/etc/config.site' if it exists. Or, you can set the
|
||||
`CONFIG_SITE' environment variable to the location of the site script.
|
||||
A warning: not all `configure' scripts look for a site script.
|
||||
|
||||
Defining Variables
|
||||
==================
|
||||
|
||||
Variables not defined in a site shell script can be set in the
|
||||
environment passed to `configure'. However, some packages may run
|
||||
configure again during the build, and the customized values of these
|
||||
variables may be lost. In order to avoid this problem, you should set
|
||||
them in the `configure' command line, using `VAR=value'. For example:
|
||||
|
||||
./configure CC=/usr/local2/bin/gcc
|
||||
|
||||
will cause the specified gcc to be used as the C compiler (unless it is
|
||||
overridden in the site shell script).
|
||||
|
||||
`configure' Invocation
|
||||
======================
|
||||
|
||||
`configure' recognizes the following options to control how it
|
||||
operates.
|
||||
|
||||
`--help'
|
||||
`-h'
|
||||
Print a summary of the options to `configure', and exit.
|
||||
|
||||
`--version'
|
||||
`-V'
|
||||
Print the version of Autoconf used to generate the `configure'
|
||||
script, and exit.
|
||||
|
||||
`--cache-file=FILE'
|
||||
Enable the cache: use and save the results of the tests in FILE,
|
||||
traditionally `config.cache'. FILE defaults to `/dev/null' to
|
||||
disable caching.
|
||||
|
||||
`--config-cache'
|
||||
`-C'
|
||||
Alias for `--cache-file=config.cache'.
|
||||
|
||||
`--quiet'
|
||||
`--silent'
|
||||
`-q'
|
||||
Do not print messages saying which checks are being made. To
|
||||
suppress all normal output, redirect it to `/dev/null' (any error
|
||||
messages will still be shown).
|
||||
|
||||
`--srcdir=DIR'
|
||||
Look for the package's source code in directory DIR. Usually
|
||||
`configure' can determine that directory automatically.
|
||||
|
||||
`configure' also accepts some other, not widely useful, options. Run
|
||||
`configure --help' for more details.
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
#
|
||||
# Copyright 2004 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is part of GNU Radio
|
||||
#
|
||||
# GNU Radio 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.
|
||||
#
|
||||
# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
|
||||
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
# Boston, MA 02111-1307, USA.
|
||||
#
|
||||
|
||||
include $(top_srcdir)/Makefile.common
|
||||
|
||||
EXTRA_DIST = bootstrap configure config.h.in .buildpri
|
||||
SUBDIRS = config src
|
||||
DIST_SUBDIRS = config src
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA =
|
|
@ -0,0 +1,38 @@
|
|||
# -*- Makefile -*-
|
||||
#
|
||||
# Copyright 2004,2006 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is part of GNU Radio
|
||||
#
|
||||
# GNU Radio 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.
|
||||
#
|
||||
# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
|
||||
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
# Boston, MA 02111-1307, USA.
|
||||
#
|
||||
|
||||
# includes
|
||||
grincludedir = $(includedir)/gnuradio
|
||||
|
||||
# swig includes
|
||||
swigincludedir = $(grincludedir)/swig
|
||||
|
||||
# Install this stuff in the appropriate subdirectory
|
||||
# This usually ends up at:
|
||||
# ${prefix}/lib/python${python_version}/site-packages/gnuradio
|
||||
|
||||
grpythondir = $(pythondir)/gnuradio
|
||||
grpyexecdir = $(pyexecdir)/gnuradio
|
||||
|
||||
# swig flags
|
||||
SWIGPYTHONFLAGS = -fvirtual -python -modern
|
||||
SWIGGRFLAGS = -I$(GNURADIO_CORE_INCLUDEDIR)/swig -I$(GNURADIO_CORE_INCLUDEDIR)
|
|
@ -0,0 +1,3 @@
|
|||
This package implements an APCO P25 decoder as a GNU Radio signal
|
||||
processing block. It is intended to be used with the Radio Rausch
|
||||
4-Level FSK demodulator.
|
|
@ -0,0 +1,29 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Copyright 2001,2005 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is part of GNU Radio
|
||||
#
|
||||
# GNU Radio 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.
|
||||
#
|
||||
# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
|
||||
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
# Boston, MA 02111-1307, USA.
|
||||
|
||||
|
||||
rm -fr config.cache autom4te*.cache
|
||||
|
||||
aclocal -I config
|
||||
autoconf
|
||||
autoheader
|
||||
libtoolize --automake
|
||||
automake --add-missing
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,276 @@
|
|||
/* config.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* Define if for loop scoping is broken */
|
||||
#undef CXX_HAS_BUGGY_FOR_LOOPS
|
||||
|
||||
/* Define if C++ is missing bool type */
|
||||
#undef CXX_HAS_NO_BOOL
|
||||
|
||||
/* Define if has std::isnan */
|
||||
#undef CXX_HAS_STD_ISNAN
|
||||
|
||||
/* Define to 1 if you have the `clock_gettime' function. */
|
||||
#undef HAVE_CLOCK_GETTIME
|
||||
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
#undef HAVE_DLFCN_H
|
||||
|
||||
/* Define to 1 if you have the <fcntl.h> header file. */
|
||||
#undef HAVE_FCNTL_H
|
||||
|
||||
/* Define to 1 if you have the `getopt' function. */
|
||||
#undef HAVE_GETOPT
|
||||
|
||||
/* Define to 1 if you have the `gettimeofday' function. */
|
||||
#undef HAVE_GETTIMEOFDAY
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
/* Define to 1 if you have the <io.h> header file. */
|
||||
#undef HAVE_IO_H
|
||||
|
||||
/* Define to 1 if you have the <limits.h> header file. */
|
||||
#undef HAVE_LIMITS_H
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
/* Define to 1 if you have the `nanosleep' function. */
|
||||
#undef HAVE_NANOSLEEP
|
||||
|
||||
/* Define if you have POSIX threads libraries and header files. */
|
||||
#undef HAVE_PTHREAD
|
||||
|
||||
/* Define to 1 if you have the <Python.h> header file. */
|
||||
#undef HAVE_PYTHON_H
|
||||
|
||||
/* Define to 1 if you have the `rand' function. */
|
||||
#undef HAVE_RAND
|
||||
|
||||
/* Define to 1 if you have the `random' function. */
|
||||
#undef HAVE_RANDOM
|
||||
|
||||
/* Define to 1 if you have the `sigaction' function. */
|
||||
#undef HAVE_SIGACTION
|
||||
|
||||
/* Define to 1 if you have the `sleep' function. */
|
||||
#undef HAVE_SLEEP
|
||||
|
||||
/* Define to 1 if you have the `srand' function. */
|
||||
#undef HAVE_SRAND
|
||||
|
||||
/* Define to 1 if you have the `srandom' function. */
|
||||
#undef HAVE_SRANDOM
|
||||
|
||||
/* Define to 1 if the system has the type `ssize_t'. */
|
||||
#undef HAVE_SSIZE_T
|
||||
|
||||
/* Define to 1 if you have win32 Sleep */
|
||||
#undef HAVE_SSLEEP
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#undef HAVE_STDINT_H
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#undef HAVE_STDLIB_H
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#undef HAVE_STRINGS_H
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#undef HAVE_STRING_H
|
||||
|
||||
/* Define to 1 if the system has the type `struct timespec'. */
|
||||
#undef HAVE_STRUCT_TIMESPEC
|
||||
|
||||
/* Define to 1 if the system has the type `struct timezone'. */
|
||||
#undef HAVE_STRUCT_TIMEZONE
|
||||
|
||||
/* Define to 1 if you have the <sys/ioctl.h> header file. */
|
||||
#undef HAVE_SYS_IOCTL_H
|
||||
|
||||
/* Define to 1 if you have the <sys/mman.h> header file. */
|
||||
#undef HAVE_SYS_MMAN_H
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#undef HAVE_SYS_STAT_H
|
||||
|
||||
/* Define to 1 if you have the <sys/time.h> header file. */
|
||||
#undef HAVE_SYS_TIME_H
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#undef HAVE_SYS_TYPES_H
|
||||
|
||||
/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
|
||||
#undef HAVE_SYS_WAIT_H
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Define to 1 if you have the `usleep' function. */
|
||||
#undef HAVE_USLEEP
|
||||
|
||||
/* Define to 1 if you have the <winbase.h> header file. */
|
||||
#undef HAVE_WINBASE_H
|
||||
|
||||
/* Define to 1 if you have the <windows.h> header file. */
|
||||
#undef HAVE_WINDOWS_H
|
||||
|
||||
/* Define to 1 if you have the <winioctl.h> header file. */
|
||||
#undef HAVE_WINIOCTL_H
|
||||
|
||||
/* Define to the sub-directory in which libtool stores uninstalled libraries.
|
||||
*/
|
||||
#undef LT_OBJDIR
|
||||
|
||||
/* Define if mkdir accepts only one arg */
|
||||
#undef MKDIR_TAKES_ONE_ARG
|
||||
|
||||
/* Define to disable asserts (don't doit!) */
|
||||
#undef NDEBUG
|
||||
|
||||
/* Define to 1 to enable NT thread */
|
||||
#undef OMNITHREAD_NT
|
||||
|
||||
/* Define to 1 to enable pthread */
|
||||
#undef OMNITHREAD_POSIX
|
||||
|
||||
/* Name of package */
|
||||
#undef PACKAGE
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#undef PACKAGE_BUGREPORT
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#undef PACKAGE_NAME
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#undef PACKAGE_STRING
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#undef PACKAGE_TARNAME
|
||||
|
||||
/* Define to the home page for this package. */
|
||||
#undef PACKAGE_URL
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
||||
|
||||
/* Define to the necessary symbol if this constant uses a non-standard name on
|
||||
your system. */
|
||||
#undef PTHREAD_CREATE_JOINABLE
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
|
||||
#undef TIME_WITH_SYS_TIME
|
||||
|
||||
/* Version number of package */
|
||||
#undef VERSION
|
||||
|
||||
/* Define to empty if `const' does not conform to ANSI C. */
|
||||
#undef const
|
||||
|
||||
/* Define to `__inline__' or `__inline' if that's what the C compiler
|
||||
calls it, or to nothing if 'inline' is not supported under any name. */
|
||||
#ifndef __cplusplus
|
||||
#undef inline
|
||||
#endif
|
||||
|
||||
/* Define to `unsigned int' if <sys/types.h> does not define. */
|
||||
#undef size_t
|
||||
|
||||
// Workaround for compilers with buggy for-loop scoping
|
||||
// That's quite a few compilers actually including recent versions of
|
||||
// Dec Alpha cxx, HP-UX CC and SGI CC.
|
||||
// The trivial "if" statement provides the correct scoping to the
|
||||
// for loop
|
||||
|
||||
#ifdef CXX_HAS_BUGGY_FOR_LOOPS
|
||||
#undef for
|
||||
#define for if(1) for
|
||||
#endif
|
||||
|
||||
|
||||
// If the C++ compiler we use doesn't have bool, then
|
||||
// the following is a near-perfect work-around.
|
||||
// You must make sure your code does not depend on "int" and "bool"
|
||||
// being two different types, in overloading for instance.
|
||||
|
||||
#ifdef CXX_HAS_NO_BOOL
|
||||
#define bool int
|
||||
#define true 1
|
||||
#define false 0
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* Define missing prototypes, implemented in replacement lib */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_GETOPT
|
||||
int getopt (int argc, char * const argv[], const char * optstring);
|
||||
extern char * optarg;
|
||||
extern int optind, opterr, optopt;
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_USLEEP
|
||||
int usleep(unsigned long usec); /* SUSv2 */
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_NANOSLEEP
|
||||
#ifndef HAVE_STRUCT_TIMESPEC
|
||||
#if HAVE_SYS_TYPES_H
|
||||
# include <sys/types.h> /* need time_t */
|
||||
#endif
|
||||
struct timespec {
|
||||
time_t tv_sec;
|
||||
long tv_nsec;
|
||||
};
|
||||
#endif
|
||||
static inline int nanosleep(const struct timespec *req, struct timespec *rem) { return usleep(req->tv_sec*1000000+req->tv_nsec/1000); }
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_SSLEEP) && !defined(HAVE_SLEEP)
|
||||
#ifdef HAVE_WINBASE_H
|
||||
#include <windows.h>
|
||||
#include <winbase.h>
|
||||
#endif
|
||||
/* TODO: what about SleepEx? */
|
||||
static inline unsigned int sleep (unsigned int nb_sec) { Sleep(nb_sec*1000); return 0; }
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_GETTIMEOFDAY
|
||||
#ifdef HAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#ifndef HAVE_STRUCT_TIMEZONE
|
||||
struct timezone {
|
||||
int tz_minuteswest;
|
||||
int tz_dsttime;
|
||||
};
|
||||
#endif
|
||||
int gettimeofday(struct timeval *tv, struct timezone *tz);
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_RANDOM) && defined(HAVE_RAND)
|
||||
#include <stdlib.h>
|
||||
static inline long int random (void) { return rand(); }
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_SRANDOM) && defined(HAVE_SRAND)
|
||||
static inline void srandom (unsigned int seed) { srand(seed); }
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_SSIZE_T
|
||||
typedef size_t ssize_t;
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,66 @@
|
|||
#
|
||||
# Copyright 2001 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is part of GNU Radio
|
||||
#
|
||||
# GNU Radio 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.
|
||||
#
|
||||
# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
|
||||
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
# Boston, MA 02111-1307, USA.
|
||||
#
|
||||
|
||||
include $(top_srcdir)/Makefile.common
|
||||
|
||||
# Install m4 macros in this directory
|
||||
m4datadir = $(datadir)/aclocal
|
||||
|
||||
# List your m4 macros here
|
||||
m4macros = \
|
||||
acx_pthread.m4 \
|
||||
bnv_have_qt.m4 \
|
||||
cppunit.m4 \
|
||||
gr_as.m4 \
|
||||
gr_boost.m4 \
|
||||
gr_check_createfilemapping.m4 \
|
||||
gr_check_usrp.m4 \
|
||||
gr_check_mc4020.m4 \
|
||||
gr_check_shm_open.m4 \
|
||||
gr_doxygen.m4 \
|
||||
gr_gprof.m4 \
|
||||
gr_libgnuradio_core_extra_ldflags.m4 \
|
||||
gr_no_undefined.m4 \
|
||||
gr_omnithread.m4 \
|
||||
gr_pwin32.m4 \
|
||||
gr_python.m4 \
|
||||
gr_require_mc4020.m4 \
|
||||
gr_scripting.m4 \
|
||||
gr_set_md_cpu.m4 \
|
||||
gr_swig.m4 \
|
||||
gr_sysv_shm.m4 \
|
||||
gr_x86_64.m4 \
|
||||
lf_cc.m4 \
|
||||
lf_cxx.m4 \
|
||||
lf_warnings.m4 \
|
||||
lf_x11.m4 \
|
||||
mkstemp.m4 \
|
||||
onceonly.m4 \
|
||||
pkg.m4 \
|
||||
usrp_fusb_tech.m4 \
|
||||
usrp_libusb.m4 \
|
||||
usrp_sdcc.m4
|
||||
|
||||
|
||||
# Don't install m4 macros anymore
|
||||
# m4data_DATA = $(m4macros)
|
||||
|
||||
EXTRA_DIST = $(m4macros)
|
|
@ -0,0 +1,190 @@
|
|||
dnl Available from the GNU Autoconf Macro Archive at:
|
||||
dnl http://www.gnu.org/software/ac-archive/htmldoc/acx_pthread.html
|
||||
dnl
|
||||
AC_DEFUN([ACX_PTHREAD], [
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_C
|
||||
acx_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, acx_pthread_ok=yes)
|
||||
AC_MSG_RESULT($acx_pthread_ok)
|
||||
if test x"$acx_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.
|
||||
|
||||
acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt"
|
||||
|
||||
# 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)
|
||||
# pthread: Linux, etcetera
|
||||
# --thread-safe: KAI C++
|
||||
|
||||
case "${host_cpu}-${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 -pthread or
|
||||
# -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:
|
||||
|
||||
acx_pthread_flags="-pthread -pthreads pthread -mt $acx_pthread_flags"
|
||||
;;
|
||||
esac
|
||||
|
||||
if test x"$acx_pthread_ok" = xno; then
|
||||
for flag in $acx_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"
|
||||
;;
|
||||
|
||||
*)
|
||||
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_TRY_LINK([#include <pthread.h>],
|
||||
[pthread_t th; pthread_join(th, 0);
|
||||
pthread_attr_init(0); pthread_cleanup_push(0, 0);
|
||||
pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
|
||||
[acx_pthread_ok=yes])
|
||||
|
||||
LIBS="$save_LIBS"
|
||||
CFLAGS="$save_CFLAGS"
|
||||
|
||||
AC_MSG_RESULT($acx_pthread_ok)
|
||||
if test "x$acx_pthread_ok" = xyes; then
|
||||
break;
|
||||
fi
|
||||
|
||||
PTHREAD_LIBS=""
|
||||
PTHREAD_CFLAGS=""
|
||||
done
|
||||
fi
|
||||
|
||||
# Various other checks:
|
||||
if test "x$acx_pthread_ok" = xyes; then
|
||||
save_LIBS="$LIBS"
|
||||
LIBS="$PTHREAD_LIBS $LIBS"
|
||||
save_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
|
||||
|
||||
# Detect AIX lossage: threads are created detached by default
|
||||
# and the JOINABLE attribute has a nonstandard name (UNDETACHED).
|
||||
AC_MSG_CHECKING([for joinable pthread attribute])
|
||||
AC_TRY_LINK([#include <pthread.h>],
|
||||
[int attr=PTHREAD_CREATE_JOINABLE;],
|
||||
ok=PTHREAD_CREATE_JOINABLE, ok=unknown)
|
||||
if test x"$ok" = xunknown; then
|
||||
AC_TRY_LINK([#include <pthread.h>],
|
||||
[int attr=PTHREAD_CREATE_UNDETACHED;],
|
||||
ok=PTHREAD_CREATE_UNDETACHED, ok=unknown)
|
||||
fi
|
||||
if test x"$ok" != xPTHREAD_CREATE_JOINABLE; then
|
||||
AC_DEFINE(PTHREAD_CREATE_JOINABLE, $ok,
|
||||
[Define to the necessary symbol if this constant
|
||||
uses a non-standard name on your system.])
|
||||
fi
|
||||
AC_MSG_RESULT(${ok})
|
||||
if test x"$ok" = xunknown; then
|
||||
AC_MSG_WARN([we do not know how to create joinable pthreads])
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([if more special flags are required for pthreads])
|
||||
flag=no
|
||||
case "${host_cpu}-${host_os}" in
|
||||
*-aix* | *-freebsd*) flag="-D_THREAD_SAFE";;
|
||||
*solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
|
||||
esac
|
||||
AC_MSG_RESULT(${flag})
|
||||
if test "x$flag" != xno; then
|
||||
PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
|
||||
fi
|
||||
|
||||
LIBS="$save_LIBS"
|
||||
CFLAGS="$save_CFLAGS"
|
||||
|
||||
# More AIX lossage: must compile with cc_r
|
||||
AC_CHECK_PROG(PTHREAD_CC, cc_r, cc_r, ${CC})
|
||||
else
|
||||
PTHREAD_CC="$CC"
|
||||
fi
|
||||
|
||||
AC_SUBST(PTHREAD_LIBS)
|
||||
AC_SUBST(PTHREAD_CFLAGS)
|
||||
AC_SUBST(PTHREAD_CC)
|
||||
|
||||
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
|
||||
if test x"$acx_pthread_ok" = xyes; then
|
||||
ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
|
||||
:
|
||||
else
|
||||
acx_pthread_ok=no
|
||||
$2
|
||||
fi
|
||||
AC_LANG_RESTORE
|
||||
])dnl ACX_PTHREAD
|
|
@ -0,0 +1,404 @@
|
|||
dnl Available from the GNU Autoconf Macro Archive at:
|
||||
dnl http://www.gnu.org/software/ac-archive/htmldoc/bnv_have_qt.html
|
||||
dnl
|
||||
AC_DEFUN([BNV_HAVE_QT],
|
||||
[
|
||||
dnl THANKS! This code includes bug fixes by:
|
||||
dnl Tim McClarren.
|
||||
|
||||
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],
|
||||
[ --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])
|
||||
AC_ARG_WITH([Qt-include-dir],
|
||||
[ --with-Qt-include-dir=DIR
|
||||
Qt header files are in DIR])
|
||||
AC_ARG_WITH([Qt-bin-dir],
|
||||
[ --with-Qt-bin-dir=DIR Qt utilities such as moc and uic are in DIR])
|
||||
AC_ARG_WITH([Qt-lib-dir],
|
||||
[ --with-Qt-lib-dir=DIR The Qt library is in DIR])
|
||||
AC_ARG_WITH([Qt-lib],
|
||||
[ --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
|
||||
bnv_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
|
||||
bnv_qt_dir="$with_Qt_dir"
|
||||
bnv_qt_include_dir="$with_Qt_dir/include"
|
||||
bnv_qt_bin_dir="$with_Qt_dir/bin"
|
||||
bnv_qt_lib_dir="$with_Qt_dir/lib"
|
||||
# Only search for the lib if the user did not define one already
|
||||
if test x"$bnv_qt_lib" = x; then
|
||||
bnv_qt_lib="`ls $bnv_qt_lib_dir/libqt* | sed -n 1p |
|
||||
sed s@$bnv_qt_lib_dir/lib@@ | [sed s@[.].*@@]`"
|
||||
fi
|
||||
bnv_qt_LIBS="-L$bnv_qt_lib_dir -l$bnv_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(bnv_cv_have_qt,
|
||||
[
|
||||
# We are not given a solution and there is no cached value.
|
||||
bnv_qt_dir=NO
|
||||
bnv_qt_include_dir=NO
|
||||
bnv_qt_lib_dir=NO
|
||||
if test x"$bnv_qt_lib" = x; then
|
||||
bnv_qt_lib=NO
|
||||
fi
|
||||
BNV_PATH_QT_DIRECT
|
||||
if test "$bnv_qt_dir" = NO ||
|
||||
test "$bnv_qt_include_dir" = NO ||
|
||||
test "$bnv_qt_lib_dir" = NO ||
|
||||
test "$bnv_qt_lib" = NO; then
|
||||
# Problem with finding complete Qt. Cache the known absence of Qt.
|
||||
bnv_cv_have_qt="have_qt=no"
|
||||
else
|
||||
# Record where we found Qt for the cache.
|
||||
bnv_cv_have_qt="have_qt=yes \
|
||||
bnv_qt_dir=$bnv_qt_dir \
|
||||
bnv_qt_include_dir=$bnv_qt_include_dir \
|
||||
bnv_qt_bin_dir=$bnv_qt_bin_dir \
|
||||
bnv_qt_LIBS=\"$bnv_qt_LIBS\""
|
||||
fi
|
||||
])dnl
|
||||
eval "$bnv_cv_have_qt"
|
||||
fi # all $bnv_qt_* are set
|
||||
fi # $have_qt reflects the system status
|
||||
if test x"$have_qt" = xyes; then
|
||||
QT_CXXFLAGS="-I$bnv_qt_include_dir"
|
||||
QT_DIR="$bnv_qt_dir"
|
||||
QT_LIBS="$bnv_qt_LIBS"
|
||||
# If bnv_qt_dir is defined, utilities are expected to be in the
|
||||
# bin subdirectory
|
||||
if test x"$bnv_qt_dir" != x; then
|
||||
if test -x "$bnv_qt_dir/bin/uic"; then
|
||||
QT_UIC="$bnv_qt_dir/bin/uic"
|
||||
else
|
||||
# Old versions of Qt don't have uic
|
||||
QT_UIC=
|
||||
fi
|
||||
QT_MOC="$bnv_qt_dir/bin/moc"
|
||||
else
|
||||
# Or maybe we are told where to look for the utilities
|
||||
if test x"$bnv_qt_bin_dir" != x; then
|
||||
if test -x "$bnv_qt_bin_dir/uic"; then
|
||||
QT_UIC="$bnv_qt_bin_dir/uic"
|
||||
else
|
||||
# Old versions of Qt don't have uic
|
||||
QT_UIC=
|
||||
fi
|
||||
QT_MOC="$bnv_qt_bin_dir/moc"
|
||||
else
|
||||
# Last possibility is that they are in $PATH
|
||||
QT_UIC="`which uic`"
|
||||
QT_MOC="`which moc`"
|
||||
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])
|
||||
else
|
||||
# Qt was not found
|
||||
QT_CXXFLAGS=
|
||||
QT_DIR=
|
||||
QT_LIBS=
|
||||
QT_UIC=
|
||||
QT_MOC=
|
||||
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)
|
||||
|
||||
#### Being paranoid:
|
||||
if test x"$have_qt" = xyes; then
|
||||
AC_MSG_CHECKING(correct functioning of Qt installation)
|
||||
AC_CACHE_VAL(bnv_cv_qt_test_result,
|
||||
[
|
||||
cat > bnv_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 > bnv_qt_main.$ac_ext << EOF
|
||||
#include "bnv_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
|
||||
|
||||
bnv_cv_qt_test_result="failure"
|
||||
bnv_try_1="$QT_MOC bnv_qt_test.h -o moc_bnv_qt_test.$ac_ext >/dev/null 2>bnv_qt_test_1.out"
|
||||
AC_TRY_EVAL(bnv_try_1)
|
||||
bnv_err_1=`grep -v '^ *+' bnv_qt_test_1.out | grep -v "^bnv_qt_test.h\$"`
|
||||
if test x"$bnv_err_1" != x; then
|
||||
echo "$bnv_err_1" >&AC_FD_CC
|
||||
echo "configure: could not run $QT_MOC on:" >&AC_FD_CC
|
||||
cat bnv_qt_test.h >&AC_FD_CC
|
||||
else
|
||||
bnv_try_2="$CXX $QT_CXXFLAGS -c $CXXFLAGS -o moc_bnv_qt_test.o moc_bnv_qt_test.$ac_ext >/dev/null 2>bnv_qt_test_2.out"
|
||||
AC_TRY_EVAL(bnv_try_2)
|
||||
bnv_err_2=`grep -v '^ *+' bnv_qt_test_2.out | grep -v "^bnv_qt_test.{$ac_ext}\$"`
|
||||
if test x"$bnv_err_2" != x; then
|
||||
echo "$bnv_err_2" >&AC_FD_CC
|
||||
echo "configure: could not compile:" >&AC_FD_CC
|
||||
cat bnv_qt_test.$ac_ext >&AC_FD_CC
|
||||
else
|
||||
bnv_try_3="$CXX $QT_CXXFLAGS -c $CXXFLAGS -o bnv_qt_main.o bnv_qt_main.$ac_ext >/dev/null 2>bnv_qt_test_3.out"
|
||||
AC_TRY_EVAL(bnv_try_3)
|
||||
bnv_err_3=`grep -v '^ *+' bnv_qt_test_3.out | grep -v "^bnv_qt_main.{$ac_ext}\$"`
|
||||
if test x"$bnv_err_3" != x; then
|
||||
echo "$bnv_err_3" >&AC_FD_CC
|
||||
echo "configure: could not compile:" >&AC_FD_CC
|
||||
cat bnv_qt_main.$ac_ext >&AC_FD_CC
|
||||
else
|
||||
bnv_try_4="$CXX $QT_LIBS $LIBS -o bnv_qt_main bnv_qt_main.o moc_bnv_qt_test.o >/dev/null 2>bnv_qt_test_4.out"
|
||||
AC_TRY_EVAL(bnv_try_4)
|
||||
bnv_err_4=`grep -v '^ *+' bnv_qt_test_4.out`
|
||||
if test x"$bnv_err_4" != x; then
|
||||
echo "$bnv_err_4" >&AC_FD_CC
|
||||
else
|
||||
bnv_cv_qt_test_result="success"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
])dnl AC_CACHE_VAL bnv_cv_qt_test_result
|
||||
AC_MSG_RESULT([$bnv_cv_qt_test_result]);
|
||||
if test x"$bnv_cv_qt_test_result" = "xfailure"; then
|
||||
# working Qt was not found
|
||||
QT_CXXFLAGS=
|
||||
QT_DIR=
|
||||
QT_LIBS=
|
||||
QT_UIC=
|
||||
QT_MOC=
|
||||
have_qt=no
|
||||
AC_MSG_WARN([Failed to find matching components of a complete
|
||||
Qt installation. Try using more options,
|
||||
see ./configure --help.])
|
||||
fi
|
||||
|
||||
rm -f bnv_qt_test.h moc_bnv_qt_test.$ac_ext moc_bnv_qt_test.o \
|
||||
bnv_qt_main.$ac_ext bnv_qt_main.o bnv_qt_main \
|
||||
bnv_qt_test_1.out bnv_qt_test_2.out bnv_qt_test_3.out bnv_qt_test_4.out
|
||||
fi
|
||||
])
|
||||
|
||||
dnl Internal subroutine of BNV_HAVE_QT
|
||||
dnl Set bnv_qt_dir bnv_qt_include_dir bnv_qt_bin_dir bnv_qt_lib_dir bnv_qt_lib
|
||||
dnl Copyright 2001 Bastiaan N. Veelo <Bastiaan.N.Veelo@immtek.ntnu.no>
|
||||
AC_DEFUN([BNV_PATH_QT_DIRECT],
|
||||
[
|
||||
## Binary utilities ##
|
||||
if test x"$with_Qt_bin_dir" != x; then
|
||||
bnv_qt_bin_dir=$with_Qt_bin_dir
|
||||
fi
|
||||
## Look for header files ##
|
||||
if test x"$with_Qt_include_dir" != x; then
|
||||
bnv_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.
|
||||
bnv_include_path_list="
|
||||
/usr/include
|
||||
`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`
|
||||
"
|
||||
for bnv_dir in $bnv_include_path_list; do
|
||||
if test -r "$bnv_dir/$qt_direct_test_header"; then
|
||||
bnv_dirs="$bnv_dirs $bnv_dir"
|
||||
fi
|
||||
done
|
||||
# Now look for the newest in this list
|
||||
bnv_prev_ver=0
|
||||
for bnv_dir in $bnv_dirs; do
|
||||
bnv_this_ver=`egrep -w '#define QT_VERSION' $bnv_dir/$qt_direct_test_header | sed s/'#define QT_VERSION'//`
|
||||
if expr $bnv_this_ver '>' $bnv_prev_ver > /dev/null; then
|
||||
bnv_qt_include_dir=$bnv_dir
|
||||
bnv_prev_ver=$bnv_this_ver
|
||||
fi
|
||||
done
|
||||
fi dnl Found header files.
|
||||
|
||||
# Are these headers located in a traditional Trolltech installation?
|
||||
# That would be $bnv_qt_include_dir stripped from its last element:
|
||||
bnv_possible_qt_dir=`dirname $bnv_qt_include_dir`
|
||||
if test -x $bnv_possible_qt_dir/bin/moc &&
|
||||
ls $bnv_possible_qt_dir/lib/libqt* > /dev/null; then
|
||||
# Then the rest is a piece of cake
|
||||
bnv_qt_dir=$bnv_possible_qt_dir
|
||||
bnv_qt_bin_dir="$bnv_qt_dir/bin"
|
||||
bnv_qt_lib_dir="$bnv_qt_dir/lib"
|
||||
# Only look for lib if the user did not supply it already
|
||||
if test x"$bnv_qt_lib" = xNO; then
|
||||
bnv_qt_lib="`ls $bnv_qt_lib_dir/libqt* | sed -n 1p |
|
||||
sed s@$bnv_qt_lib_dir/lib@@ | [sed s@[.].*@@]`"
|
||||
fi
|
||||
bnv_qt_LIBS="-L$bnv_qt_lib_dir -l$bnv_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
|
||||
bnv_qt_dir=
|
||||
## Look for Qt library ##
|
||||
if test x"$with_Qt_lib_dir" != x; then
|
||||
bnv_qt_lib_dir="$with_Qt_lib_dir"
|
||||
# Only look for lib if the user did not supply it already
|
||||
if test x"$bnv_qt_lib" = xNO; then
|
||||
bnv_qt_lib="`ls $bnv_qt_lib_dir/libqt* | sed -n 1p |
|
||||
sed s@$bnv_qt_lib_dir/lib@@ | [sed s@[.].*@@]`"
|
||||
fi
|
||||
bnv_qt_LIBS="-L$bnv_qt_lib_dir -l$bnv_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"$bnv_qt_lib" = xNO; then
|
||||
bnv_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
|
||||
bnv_save_LIBS="$LIBS"
|
||||
LIBS="-l$bnv_qt_lib $X_PRE_LIBS $X_LIBS -lX11 -lXext -lXmu -lXt -lXi $X_EXTRA_LIBS"
|
||||
bnv_qt_LIBS="$LIBS"
|
||||
bnv_save_CXXFLAGS="$CXXFLAGS"
|
||||
CXXFLAGS="-I$bnv_qt_include_dir"
|
||||
AC_TRY_LINK([#include <$qt_direct_test_header>],
|
||||
$qt_direct_test_main,
|
||||
[
|
||||
# Success.
|
||||
# We can link with no special library directory.
|
||||
bnv_qt_lib_dir=
|
||||
], [
|
||||
# That did not work. Try the multi-threaded version
|
||||
echo "Non-critical error, please neglect the above." >&AC_FD_CC
|
||||
bnv_qt_lib=qt-mt
|
||||
LIBS="-l$bnv_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.
|
||||
bnv_qt_lib_dir=
|
||||
], [
|
||||
# That did not work. Try the OpenGL version
|
||||
echo "Non-critical error, please neglect the above." >&AC_FD_CC
|
||||
bnv_qt_lib=qt-gl
|
||||
LIBS="-l$bnv_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,
|
||||
[
|
||||
# Succes.
|
||||
# We can link with no special library directory.
|
||||
bnv_qt_lib_dir=
|
||||
], [
|
||||
# That did not work. Maybe a library version I don't know about?
|
||||
echo "Non-critical error, please neglect the above." >&AC_FD_CC
|
||||
# Look for some Qt lib in a standard set of common directories.
|
||||
bnv_dir_list="
|
||||
`echo $bnv_qt_includes | sed ss/includess`
|
||||
/lib
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
/opt/lib
|
||||
`ls -dr /usr/lib/qt* 2>/dev/null`
|
||||
`ls -dr /usr/local/qt* 2>/dev/null`
|
||||
`ls -dr /opt/qt* 2>/dev/null`
|
||||
"
|
||||
for bnv_dir in $bnv_dir_list; do
|
||||
if ls $bnv_dir/libqt*; then
|
||||
# Gamble that it's the first one...
|
||||
bnv_qt_lib="`ls $bnv_dir/libqt* | sed -n 1p |
|
||||
sed s@$bnv_dir/lib@@ | sed s/[.].*//`"
|
||||
bnv_qt_lib_dir="$bnv_dir"
|
||||
break
|
||||
fi
|
||||
done
|
||||
# Try with that one
|
||||
LIBS="-l$bnv_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,
|
||||
[
|
||||
# Succes.
|
||||
# We can link with no special library directory.
|
||||
bnv_qt_lib_dir=
|
||||
], [
|
||||
# Leave bnv_qt_lib_dir defined
|
||||
])
|
||||
])
|
||||
])
|
||||
])
|
||||
if test x"$bnv_qt_lib_dir" != x; then
|
||||
bnv_qt_LIBS="-l$bnv_qt_lib_dir $LIBS"
|
||||
else
|
||||
bnv_qt_LIBS="$LIBS"
|
||||
fi
|
||||
LIBS="$bnv_save_LIBS"
|
||||
CXXFLAGS="$bnv_save_CXXFLAGS"
|
||||
fi dnl $with_Qt_lib_dir was not given
|
||||
fi dnl Done setting up for non-traditional Trolltech installation
|
||||
])
|
|
@ -0,0 +1,80 @@
|
|||
dnl
|
||||
dnl AM_PATH_CPPUNIT(MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
|
||||
dnl
|
||||
AC_DEFUN([AM_PATH_CPPUNIT],
|
||||
[
|
||||
|
||||
AC_ARG_WITH(cppunit-prefix,[ --with-cppunit-prefix=PFX Prefix where CppUnit is installed (optional)],
|
||||
cppunit_config_prefix="$withval", cppunit_config_prefix="")
|
||||
AC_ARG_WITH(cppunit-exec-prefix,[ --with-cppunit-exec-prefix=PFX Exec prefix where CppUnit is installed (optional)],
|
||||
cppunit_config_exec_prefix="$withval", cppunit_config_exec_prefix="")
|
||||
|
||||
if test x$cppunit_config_exec_prefix != x ; then
|
||||
cppunit_config_args="$cppunit_config_args --exec-prefix=$cppunit_config_exec_prefix"
|
||||
if test x${CPPUNIT_CONFIG+set} != xset ; then
|
||||
CPPUNIT_CONFIG=$cppunit_config_exec_prefix/bin/cppunit-config
|
||||
fi
|
||||
fi
|
||||
if test x$cppunit_config_prefix != x ; then
|
||||
cppunit_config_args="$cppunit_config_args --prefix=$cppunit_config_prefix"
|
||||
if test x${CPPUNIT_CONFIG+set} != xset ; then
|
||||
CPPUNIT_CONFIG=$cppunit_config_prefix/bin/cppunit-config
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_PATH_PROG(CPPUNIT_CONFIG, cppunit-config, no)
|
||||
cppunit_version_min=$1
|
||||
|
||||
AC_MSG_CHECKING(for Cppunit - version >= $cppunit_version_min)
|
||||
no_cppunit=""
|
||||
if test "$CPPUNIT_CONFIG" = "no" ; then
|
||||
no_cppunit=yes
|
||||
else
|
||||
CPPUNIT_CFLAGS=`$CPPUNIT_CONFIG --cflags`
|
||||
CPPUNIT_LIBS=`$CPPUNIT_CONFIG --libs`
|
||||
cppunit_version=`$CPPUNIT_CONFIG --version`
|
||||
|
||||
cppunit_major_version=`echo $cppunit_version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
|
||||
cppunit_minor_version=`echo $cppunit_version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
|
||||
cppunit_micro_version=`echo $cppunit_version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
|
||||
|
||||
cppunit_major_min=`echo $cppunit_version_min | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
|
||||
cppunit_minor_min=`echo $cppunit_version_min | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
|
||||
cppunit_micro_min=`echo $cppunit_version_min | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
|
||||
|
||||
cppunit_version_proper=`expr \
|
||||
$cppunit_major_version \> $cppunit_major_min \| \
|
||||
$cppunit_major_version \= $cppunit_major_min \& \
|
||||
$cppunit_minor_version \> $cppunit_minor_min \| \
|
||||
$cppunit_major_version \= $cppunit_major_min \& \
|
||||
$cppunit_minor_version \= $cppunit_minor_min \& \
|
||||
$cppunit_micro_version \>= $cppunit_micro_min `
|
||||
|
||||
if test "$cppunit_version_proper" = "1" ; then
|
||||
AC_MSG_RESULT([$cppunit_major_version.$cppunit_minor_version.$cppunit_micro_version])
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
no_cppunit=yes
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$no_cppunit" = x ; then
|
||||
ifelse([$2], , :, [$2])
|
||||
else
|
||||
CPPUNIT_CFLAGS=""
|
||||
CPPUNIT_LIBS=""
|
||||
ifelse([$3], , :, [$3])
|
||||
fi
|
||||
|
||||
AC_SUBST(CPPUNIT_CFLAGS)
|
||||
AC_SUBST(CPPUNIT_LIBS)
|
||||
])
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
# Figure out how to run the assembler. -*- Autoconf -*-
|
||||
|
||||
# serial 2
|
||||
|
||||
# Copyright 2001 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
|
||||
# I just copy and renamed this from automake-1.6.3 so we should work
|
||||
# under both 1.4-p6 and later. -eb
|
||||
|
||||
# GR_PROG_AS
|
||||
# ----------
|
||||
AC_DEFUN([GR_PROG_AS],
|
||||
[# By default we simply use the C compiler to build assembly code.
|
||||
AC_REQUIRE([AC_PROG_CC])
|
||||
: ${CCAS='$(CC)'}
|
||||
# Set ASFLAGS if not already set.
|
||||
: ${CCASFLAGS='$(CFLAGS)'}
|
||||
AC_SUBST(CCAS)
|
||||
AC_SUBST(CCASFLAGS)])
|
|
@ -0,0 +1,111 @@
|
|||
dnl
|
||||
dnl Copyright 2004,2005 Free Software Foundation, Inc.
|
||||
dnl
|
||||
dnl This file is part of GNU Radio
|
||||
dnl
|
||||
dnl GNU Radio is free software; you can redistribute it and/or modify
|
||||
dnl it under the terms of the GNU General Public License as published by
|
||||
dnl the Free Software Foundation; either version 2, or (at your option)
|
||||
dnl any later version.
|
||||
dnl
|
||||
dnl GNU Radio is distributed in the hope that it will be useful,
|
||||
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
dnl GNU General Public License for more details.
|
||||
dnl
|
||||
dnl You should have received a copy of the GNU General Public License
|
||||
dnl along with GNU Radio; see the file COPYING. If not, write to
|
||||
dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
dnl Boston, MA 02111-1307, USA.
|
||||
dnl
|
||||
|
||||
dnl This tries to do the "right thing" to locate the boost include files.
|
||||
dnl If the user explicitly specified --with-boost-include-dir=<foo>
|
||||
dnl we believe them and use it. Otherwise,
|
||||
dnl
|
||||
dnl We look for boost/shared_ptr.hpp in the "normal places". That is,
|
||||
dnl wherever AC_CHECK_HEADER looks. If the boost includes are in /usr/local/include
|
||||
dnl this step will find them.
|
||||
dnl
|
||||
dnl Otherwise, we check to see if the boost stuff was installed in a version-specific
|
||||
dnl directory under /usr/local/include. These look like: /usr/local/include/boost-1_33_1
|
||||
dnl If there's more than one version installed, we select the
|
||||
dnl lexicographically greatest one.
|
||||
dnl
|
||||
dnl If none of these work, we bail.
|
||||
|
||||
AC_DEFUN([GR_REQUIRE_BOOST_INCLUDES],
|
||||
[
|
||||
AC_LANG_PUSH(C++)
|
||||
gr_boost_include_dir=
|
||||
AC_ARG_WITH([boost-include-dir],
|
||||
AC_HELP_STRING([--with-boost-include-dir=<path>],
|
||||
[path to boost c++ include files]),
|
||||
[
|
||||
# "yes" and "no" are bogus answers
|
||||
if test x"$with_boost_include_dir" == xyes ||
|
||||
test x"$with_boost_include_dir" == xno; then
|
||||
gr_boost_include_dir=
|
||||
else
|
||||
gr_boost_include_dir=$with_boost_include_dir
|
||||
fi
|
||||
])
|
||||
echo "gr_boost_include_dir = $gr_boost_include_dir"
|
||||
if test x$gr_boost_include_dir != x; then
|
||||
#
|
||||
# If the user specified a directory, then we use it
|
||||
#
|
||||
OLD_CPPFLAGS=$CPPFLAGS
|
||||
CPPFLAGS="$CPPFLAGS -I$gr_boost_include_dir"
|
||||
AC_CHECK_HEADER([boost/shared_ptr.hpp],
|
||||
[BOOST_CFLAGS="-I$gr_boost_include_dir"],
|
||||
[AC_MSG_ERROR(
|
||||
[Failed to locate boost/shared_ptr.hpp.
|
||||
Try using --with-boost-include-dir=<path>,
|
||||
E.g., --with-boost-include-dir=/usr/local/include/boost-1_33_1])])
|
||||
CPPFLAGS=$OLD_CPPFLAGS
|
||||
else
|
||||
#
|
||||
# Otherwise we check in the default places
|
||||
#
|
||||
AC_CHECK_HEADER([boost/shared_ptr.hpp],
|
||||
[BOOST_CFLAGS=""],
|
||||
[ # Nope, look for latest version if any in $prefix/include/boost-*
|
||||
|
||||
# Wipe out cached value. KLUDGE: AC should have API for this
|
||||
unset AS_TR_SH([ac_cv_header_boost/shared_ptr.hpp])
|
||||
|
||||
boost_last_match(){
|
||||
#echo "boost_last_match: [$]*"
|
||||
pattern="[$]1"
|
||||
shift
|
||||
if test "[$]pattern" = "[$]1"
|
||||
then
|
||||
LM=''
|
||||
else
|
||||
shift `expr [$]# - 1`
|
||||
LM=[$]1
|
||||
fi
|
||||
#echo "LM(1)='[$]LM'"
|
||||
}
|
||||
|
||||
pattern="/usr/local/include/boost-*"
|
||||
boost_last_match "$pattern" $pattern
|
||||
#echo "LM(2)='$LM'"
|
||||
|
||||
OLD_CPPFLAGS=$CPP_FLAGS
|
||||
CPPFLAGS="$CPPFLAGS -I$LM"
|
||||
AC_CHECK_HEADER([boost/shared_ptr.hpp],
|
||||
[BOOST_CFLAGS="-I$LM"],
|
||||
[AC_MSG_ERROR(
|
||||
[Failed to locate boost/shared_ptr.hpp.
|
||||
Try using --with-boost-include-dir=<path>,
|
||||
E.g., --with-boost-include-dir=/usr/local/include/boost-1_33_1])])
|
||||
CPPFLAGS=$OLD_CPPFLAGS
|
||||
])
|
||||
|
||||
fi
|
||||
unset boost_last_match LM
|
||||
AC_LANG_POP
|
||||
AC_SUBST(BOOST_CFLAGS)
|
||||
])
|
|
@ -0,0 +1,52 @@
|
|||
dnl
|
||||
dnl Copyright 2005 Free Software Foundation, Inc.
|
||||
dnl
|
||||
dnl This file is part of GNU Radio
|
||||
dnl
|
||||
dnl GNU Radio is free software; you can redistribute it and/or modify
|
||||
dnl it under the terms of the GNU General Public License as published by
|
||||
dnl the Free Software Foundation; either version 2, or (at your option)
|
||||
dnl any later version.
|
||||
dnl
|
||||
dnl GNU Radio is distributed in the hope that it will be useful,
|
||||
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
dnl GNU General Public License for more details.
|
||||
dnl
|
||||
dnl You should have received a copy of the GNU General Public License
|
||||
dnl along with GNU Radio; see the file COPYING. If not, write to
|
||||
dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
dnl Boston, MA 02111-1307, USA.
|
||||
|
||||
dnl AC_DEFUN([GR_CHECK_CREATEFILEMAPPING],
|
||||
dnl [
|
||||
dnl AC_CHECK_FUNCS([CreateFileMapping])
|
||||
dnl ])
|
||||
|
||||
AC_DEFUN([GR_CHECK_CREATEFILEMAPPING],[
|
||||
AC_MSG_CHECKING([for CreateFileMapping function])
|
||||
AC_COMPILE_IFELSE([
|
||||
#include <windows.h>
|
||||
int main (int argc, char **argv)
|
||||
{
|
||||
HANDLE handle;
|
||||
int size;
|
||||
char seg_name[[1024]];
|
||||
handle = CreateFileMapping(
|
||||
INVALID_HANDLE_VALUE, // use paging file
|
||||
NULL, // default security
|
||||
PAGE_READWRITE, // read/write access
|
||||
0, // max. object size
|
||||
size, // buffer size
|
||||
seg_name); // name of mapping object
|
||||
return 0;
|
||||
}
|
||||
],[HAVE_CREATEFILEMAPPING=yes
|
||||
AC_DEFINE(HAVE_CREATEFILEMAPPING,[1],[Define if you have the CreateFilemapping function(win32).])],
|
||||
[HAVE_CREATEFILEMAPPING=no])
|
||||
|
||||
AC_MSG_RESULT($HAVE_CREATEFILEMAPPING)
|
||||
AM_CONDITIONAL(HAVE_CREATEFILEMAPPING, test x$HAVE_CREATEFILEMAPPING = xyes)
|
||||
])
|
||||
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
dnl
|
||||
dnl Copyright 2003 Free Software Foundation, Inc.
|
||||
dnl
|
||||
dnl This file is part of GNU Radio
|
||||
dnl
|
||||
dnl GNU Radio is free software; you can redistribute it and/or modify
|
||||
dnl it under the terms of the GNU General Public License as published by
|
||||
dnl the Free Software Foundation; either version 2, or (at your option)
|
||||
dnl any later version.
|
||||
dnl
|
||||
dnl GNU Radio is distributed in the hope that it will be useful,
|
||||
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
dnl GNU General Public License for more details.
|
||||
dnl
|
||||
dnl You should have received a copy of the GNU General Public License
|
||||
dnl along with GNU Radio; see the file COPYING. If not, write to
|
||||
dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
dnl Boston, MA 02111-1307, USA.
|
||||
dnl
|
||||
|
||||
AC_DEFUN([GR_CHECK_MC4020],[
|
||||
AC_MSG_CHECKING([for mc4020 A/D driver include file])
|
||||
AC_COMPILE_IFELSE([
|
||||
#include <mc4020.h>
|
||||
int main (int argc, char **argv)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
],[HAVE_MC4020=yes
|
||||
AC_DEFINE(HAVE_MC4020,[1],[Define if you have a Measurement Computing PCI-DAS4020/12 A/D])],
|
||||
[HAVE_MC4020=no])
|
||||
|
||||
AC_MSG_RESULT($HAVE_MC4020)
|
||||
AM_CONDITIONAL(HAVE_MC4020, test x$HAVE_MC4020 = xyes)
|
||||
])
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
dnl
|
||||
dnl Copyright 2003 Free Software Foundation, Inc.
|
||||
dnl
|
||||
dnl This file is part of GNU Radio
|
||||
dnl
|
||||
dnl GNU Radio is free software; you can redistribute it and/or modify
|
||||
dnl it under the terms of the GNU General Public License as published by
|
||||
dnl the Free Software Foundation; either version 2, or (at your option)
|
||||
dnl any later version.
|
||||
dnl
|
||||
dnl GNU Radio is distributed in the hope that it will be useful,
|
||||
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
dnl GNU General Public License for more details.
|
||||
dnl
|
||||
dnl You should have received a copy of the GNU General Public License
|
||||
dnl along with GNU Radio; see the file COPYING. If not, write to
|
||||
dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
dnl Boston, MA 02111-1307, USA.
|
||||
|
||||
AC_DEFUN([GR_CHECK_SHM_OPEN],
|
||||
[
|
||||
SHM_OPEN_LIBS=""
|
||||
save_LIBS="$LIBS"
|
||||
AC_SEARCH_LIBS([shm_open], [rt], [SHM_OPEN_LIBS="$LIBS"])
|
||||
AC_CHECK_FUNCS([shm_open])
|
||||
LIBS="$save_LIBS"
|
||||
AC_SUBST(SHM_OPEN_LIBS)
|
||||
])
|
|
@ -0,0 +1,32 @@
|
|||
dnl
|
||||
dnl Copyright 2003 Free Software Foundation, Inc.
|
||||
dnl
|
||||
dnl This file is part of GNU Radio
|
||||
dnl
|
||||
dnl GNU Radio is free software; you can redistribute it and/or modify
|
||||
dnl it under the terms of the GNU General Public License as published by
|
||||
dnl the Free Software Foundation; either version 2, or (at your option)
|
||||
dnl any later version.
|
||||
dnl
|
||||
dnl GNU Radio is distributed in the hope that it will be useful,
|
||||
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
dnl GNU General Public License for more details.
|
||||
dnl
|
||||
dnl You should have received a copy of the GNU General Public License
|
||||
dnl along with GNU Radio; see the file COPYING. If not, write to
|
||||
dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
dnl Boston, MA 02111-1307, USA.
|
||||
dnl
|
||||
|
||||
dnl Check for Universal Software Radio Peripheral
|
||||
|
||||
AC_DEFUN([GR_CHECK_USRP],[
|
||||
PKG_CHECK_MODULES(USRP, usrp >= 0.2,
|
||||
[HAVE_USRP=yes
|
||||
AC_DEFINE(HAVE_USRP,[1],[Define if you have a USRP])],
|
||||
[HAVE_USRP=no])
|
||||
|
||||
AM_CONDITIONAL(HAVE_USRP, test x$HAVE_USRP = xyes)
|
||||
])
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
dnl
|
||||
dnl Copyright 2003,2005 Free Software Foundation, Inc.
|
||||
dnl
|
||||
dnl This file is part of GNU Radio
|
||||
dnl
|
||||
dnl GNU Radio is free software; you can redistribute it and/or modify
|
||||
dnl it under the terms of the GNU General Public License as published by
|
||||
dnl the Free Software Foundation; either version 2, or (at your option)
|
||||
dnl any later version.
|
||||
dnl
|
||||
dnl GNU Radio is distributed in the hope that it will be useful,
|
||||
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
dnl GNU General Public License for more details.
|
||||
dnl
|
||||
dnl You should have received a copy of the GNU General Public License
|
||||
dnl along with GNU Radio; see the file COPYING. If not, write to
|
||||
dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
dnl Boston, MA 02111-1307, USA.
|
||||
dnl
|
||||
|
||||
AC_DEFUN([GR_CHECK_DOXYGEN],[
|
||||
AC_ARG_ENABLE(doxygen, [ --enable-doxygen enable documentation generation with doxygen (no)])
|
||||
AC_ARG_ENABLE(dot, [ --enable-dot use 'dot' to generate graphs in doxygen (auto)])
|
||||
AC_ARG_ENABLE(html-docs, [ --enable-html-docs enable HTML generation with doxygen (yes)], [], [ enable_html_docs=yes])
|
||||
AC_ARG_ENABLE(latex-docs, [ --enable-latex-docs enable LaTeX doc generation with doxygen (no)], [], [ enable_latex_docs=no])
|
||||
|
||||
if test "x$enable_doxygen" = xyes; then
|
||||
AC_PATH_PROG(DOXYGEN, doxygen, , $PATH)
|
||||
if test x$DOXYGEN = x; then
|
||||
if test "x$enable_doxygen" = xyes; then
|
||||
AC_MSG_ERROR([could not find doxygen])
|
||||
fi
|
||||
enable_doc=no
|
||||
generate_docs=
|
||||
else
|
||||
enable_doc=yes
|
||||
generate_docs=docs
|
||||
AC_PATH_PROG(DOT, dot, , $PATH)
|
||||
fi
|
||||
else
|
||||
enable_doc=no
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL(DOC, test x$enable_doc = xyes)
|
||||
|
||||
if test x$DOT = x; then
|
||||
if test "x$enable_dot" = xyes; then
|
||||
AC_MSG_ERROR([could not find dot])
|
||||
fi
|
||||
enable_dot=no
|
||||
else
|
||||
enable_dot=yes
|
||||
fi
|
||||
AC_SUBST(enable_dot)
|
||||
AC_SUBST(enable_html_docs)
|
||||
AC_SUBST(enable_latex_docs)
|
||||
AC_SUBST(generate_docs)
|
||||
])
|
|
@ -0,0 +1,72 @@
|
|||
dnl
|
||||
dnl Copyright 2002 Free Software Foundation, Inc.
|
||||
dnl
|
||||
dnl This file is part of GNU Radio
|
||||
dnl
|
||||
dnl GNU Radio is free software; you can redistribute it and/or modify
|
||||
dnl it under the terms of the GNU General Public License as published by
|
||||
dnl the Free Software Foundation; either version 2, or (at your option)
|
||||
dnl any later version.
|
||||
dnl
|
||||
dnl GNU Radio is distributed in the hope that it will be useful,
|
||||
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
dnl GNU General Public License for more details.
|
||||
dnl
|
||||
dnl You should have received a copy of the GNU General Public License
|
||||
dnl along with GNU Radio; see the file COPYING. If not, write to
|
||||
dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
dnl Boston, MA 02111-1307, USA.
|
||||
dnl
|
||||
|
||||
dnl FIXME probably need to add linker flag too...
|
||||
|
||||
AC_DEFUN([GR_SET_GPROF],[
|
||||
dnl Check for --with-gprof
|
||||
AC_MSG_CHECKING([whether user wants gprof])
|
||||
AC_ARG_WITH(gprof,
|
||||
[ --with-gprof Turn on gprof profiling],
|
||||
[], [ with_gprof=no ])
|
||||
AC_MSG_RESULT($with_gprof)
|
||||
|
||||
dnl gprof profiling flags for the two main compilers
|
||||
cc_profiling_flags="-pg"
|
||||
cxx_profiling_flags="-pg"
|
||||
ld_profiling_flags="-pg"
|
||||
if test $with_gprof = yes
|
||||
then
|
||||
if test -n "${CC}"
|
||||
then
|
||||
LF_CHECK_CC_FLAG($cc_profiling_flags)
|
||||
fi
|
||||
if test -n "${CXX}"
|
||||
then
|
||||
LF_CHECK_CXX_FLAG($cxx_profiling_flags)
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN([GR_SET_PROF],[
|
||||
dnl Check for --with-prof
|
||||
AC_MSG_CHECKING([whether user wants prof])
|
||||
AC_ARG_WITH(prof,
|
||||
[ --with-prof Turn on prof profiling],
|
||||
[], [ with_prof=no ])
|
||||
AC_MSG_RESULT($with_prof)
|
||||
|
||||
dnl prof profiling flags for the two main compilers
|
||||
cc_profiling_flags="-p"
|
||||
cxx_profiling_flags="-p"
|
||||
ld_profiling_flags="-p"
|
||||
if test $with_prof = yes
|
||||
then
|
||||
if test -n "${CC}"
|
||||
then
|
||||
LF_CHECK_CC_FLAG($cc_profiling_flags)
|
||||
fi
|
||||
if test -n "${CXX}"
|
||||
then
|
||||
LF_CHECK_CXX_FLAG($cxx_profiling_flags)
|
||||
fi
|
||||
fi
|
||||
])
|
|
@ -0,0 +1,40 @@
|
|||
# Check for (MinGW)win32 extra ld options. -*- Autoconf -*-
|
||||
|
||||
# Copyright 2003,2004,2005 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is part of GNU Radio
|
||||
#
|
||||
# GNU Radio 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.
|
||||
#
|
||||
# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
|
||||
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
# Boston, MA 02111-1307, USA.
|
||||
|
||||
dnl
|
||||
AC_DEFUN([GR_LIBGNURADIO_CORE_EXTRA_LDFLAGS], [
|
||||
AC_REQUIRE([AC_PROG_LD])
|
||||
# on Mingw32 extra LDFLAGS are required to ease global variable linking
|
||||
LIBGNURADIO_CORE_EXTRA_LDFLAGS=""
|
||||
|
||||
AC_MSG_CHECKING([whether $LD accepts --enable-runtime-pseudo-reloc])
|
||||
if ${LD} --enable-runtime-pseudo-reloc --version >/dev/null 2>&1
|
||||
then
|
||||
# libtool requires the quotes
|
||||
LIBGNURADIO_CORE_EXTRA_LDFLAGS="\"-Wl,--enable-runtime-pseudo-reloc\""
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
|
||||
AC_SUBST(LIBGNURADIO_CORE_EXTRA_LDFLAGS)
|
||||
|
||||
])
|
|
@ -0,0 +1,44 @@
|
|||
dnl
|
||||
dnl Copyright 2005 Free Software Foundation, Inc.
|
||||
dnl
|
||||
dnl This file is part of GNU Radio
|
||||
dnl
|
||||
dnl GNU Radio is free software; you can redistribute it and/or modify
|
||||
dnl it under the terms of the GNU General Public License as published by
|
||||
dnl the Free Software Foundation; either version 2, or (at your option)
|
||||
dnl any later version.
|
||||
dnl
|
||||
dnl GNU Radio is distributed in the hope that it will be useful,
|
||||
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
dnl GNU General Public License for more details.
|
||||
dnl
|
||||
dnl You should have received a copy of the GNU General Public License
|
||||
dnl along with GNU Radio; see the file COPYING. If not, write to
|
||||
dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
dnl Boston, MA 02111-1307, USA.
|
||||
dnl
|
||||
|
||||
# GR_NO_UNDEFINED()
|
||||
#
|
||||
# Detemine whether we need to use the -no-undefined linker flag
|
||||
# when building shared libraries.
|
||||
# Sets NO_UNDEFINED to "" or "-no-undefined"
|
||||
#
|
||||
# As far as I can tell, we need -no-undefined only when building
|
||||
# windows DLLs. This occurs when using MinGW and Cygwin.
|
||||
#
|
||||
# For now, we stub this out.
|
||||
|
||||
AC_DEFUN([GR_NO_UNDEFINED],[
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])
|
||||
no_undefined=""
|
||||
case "${host_os}" in
|
||||
*mingw* | *cygwin*)
|
||||
|
||||
# on MinGW/Cygwin extra LDFLAGS are required
|
||||
no_undefined="-no-undefined"
|
||||
;;
|
||||
esac
|
||||
AC_SUBST(NO_UNDEFINED,[$no_undefined])
|
||||
])
|
|
@ -0,0 +1,51 @@
|
|||
# Check for Omnithread (pthread/NT) thread support. -*- Autoconf -*-
|
||||
|
||||
# Copyright 2003 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
|
||||
AC_DEFUN([GR_OMNITHREAD],
|
||||
[
|
||||
# Check first for POSIX
|
||||
ACX_PTHREAD(
|
||||
[ ot_posix="yes"
|
||||
AC_DEFINE(OMNITHREAD_POSIX,[1],[Define to 1 to enable pthread])
|
||||
],[
|
||||
# If no POSIX support found, then check for NT threads
|
||||
AC_MSG_CHECKING([for NT threads])
|
||||
|
||||
AC_LINK_IFELSE([
|
||||
#include <windows.h>
|
||||
#include <winbase.h>
|
||||
int main() { InitializeCriticalSection(NULL); return 0; }
|
||||
],
|
||||
[
|
||||
ot_nt="yes"
|
||||
AC_DEFINE(OMNITHREAD_NT,[1],[Define to 1 to enable NT thread])
|
||||
],
|
||||
[AC_MSG_FAILURE([GNU Radio requires POSIX threads. pthreads not found.])]
|
||||
)
|
||||
AC_MSG_RESULT(yes)
|
||||
])
|
||||
AM_CONDITIONAL(OMNITHREAD_POSIX, test "x$ot_posix" = xyes)
|
||||
AM_CONDITIONAL(OMNITHREAD_NT, test "x$ot_nt" = xyes)
|
||||
|
||||
save_LIBS="$LIBS"
|
||||
AC_SEARCH_LIBS([clock_gettime], [rt], [PTHREAD_LIBS="$PTHREAD_LIBS $LIBS"])
|
||||
AC_CHECK_FUNCS([clock_gettime gettimeofday nanosleep])
|
||||
LIBS="$save_LIBS"
|
||||
])
|
||||
|
|
@ -0,0 +1,146 @@
|
|||
# Check for (mingw)win32 POSIX replacements. -*- Autoconf -*-
|
||||
|
||||
# Copyright 2003,2004,2005 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is part of GNU Radio
|
||||
#
|
||||
# GNU Radio 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.
|
||||
#
|
||||
# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
|
||||
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
# Boston, MA 02111-1307, USA.
|
||||
|
||||
|
||||
AC_DEFUN([GR_PWIN32],
|
||||
[
|
||||
AC_REQUIRE([AC_HEADER_TIME])
|
||||
AC_CHECK_HEADERS([sys/types.h fcntl.h io.h])
|
||||
AC_CHECK_HEADERS([windows.h])
|
||||
AC_CHECK_HEADERS([winioctl.h winbase.h], [], [], [
|
||||
#if HAVE_WINDOWS_H
|
||||
#include <windows.h>
|
||||
#endif
|
||||
])
|
||||
|
||||
AC_CHECK_FUNCS([getopt usleep gettimeofday nanosleep rand srand random srandom sleep sigaction])
|
||||
AC_CHECK_TYPES([struct timezone, struct timespec, ssize_t],[],[],[
|
||||
#if HAVE_SYS_TYPES_H
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
#if TIME_WITH_SYS_TIME
|
||||
# include <sys/time.h>
|
||||
# include <time.h>
|
||||
#else
|
||||
# if HAVE_SYS_TIME_H
|
||||
# include <sys/time.h>
|
||||
# else
|
||||
# include <time.h>
|
||||
# endif
|
||||
#endif
|
||||
])
|
||||
|
||||
dnl Checks for replacements
|
||||
AC_REPLACE_FUNCS([getopt usleep gettimeofday])
|
||||
|
||||
|
||||
AC_MSG_CHECKING(for Sleep)
|
||||
AC_TRY_LINK([ #include <windows.h>
|
||||
#include <winbase.h>
|
||||
], [ Sleep(0); ],
|
||||
[AC_DEFINE(HAVE_SSLEEP,1,[Define to 1 if you have win32 Sleep])
|
||||
AC_MSG_RESULT(yes)],
|
||||
AC_MSG_RESULT(no)
|
||||
)
|
||||
|
||||
dnl Under Win32, mkdir prototype in io.h has only one arg
|
||||
AC_MSG_CHECKING(whether mkdir accepts only one arg)
|
||||
AC_TRY_COMPILE([#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>], [
|
||||
mkdir("")
|
||||
], [ AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(MKDIR_TAKES_ONE_ARG,[],[Define if mkdir accepts only one arg]) ],
|
||||
[ AC_MSG_RESULT(no)
|
||||
])
|
||||
|
||||
AH_BOTTOM(
|
||||
[
|
||||
/* Define missing prototypes, implemented in replacement lib */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_GETOPT
|
||||
int getopt (int argc, char * const argv[], const char * optstring);
|
||||
extern char * optarg;
|
||||
extern int optind, opterr, optopt;
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_USLEEP
|
||||
int usleep(unsigned long usec); /* SUSv2 */
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_NANOSLEEP
|
||||
#ifndef HAVE_STRUCT_TIMESPEC
|
||||
#if HAVE_SYS_TYPES_H
|
||||
# include <sys/types.h> /* need time_t */
|
||||
#endif
|
||||
struct timespec {
|
||||
time_t tv_sec;
|
||||
long tv_nsec;
|
||||
};
|
||||
#endif
|
||||
static inline int nanosleep(const struct timespec *req, struct timespec *rem) { return usleep(req->tv_sec*1000000+req->tv_nsec/1000); }
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_SSLEEP) && !defined(HAVE_SLEEP)
|
||||
#ifdef HAVE_WINBASE_H
|
||||
#include <windows.h>
|
||||
#include <winbase.h>
|
||||
#endif
|
||||
/* TODO: what about SleepEx? */
|
||||
static inline unsigned int sleep (unsigned int nb_sec) { Sleep(nb_sec*1000); return 0; }
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_GETTIMEOFDAY
|
||||
#ifdef HAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#ifndef HAVE_STRUCT_TIMEZONE
|
||||
struct timezone {
|
||||
int tz_minuteswest;
|
||||
int tz_dsttime;
|
||||
};
|
||||
#endif
|
||||
int gettimeofday(struct timeval *tv, struct timezone *tz);
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_RANDOM) && defined(HAVE_RAND)
|
||||
#include <stdlib.h>
|
||||
static inline long int random (void) { return rand(); }
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_SRANDOM) && defined(HAVE_SRAND)
|
||||
static inline void srandom (unsigned int seed) { srand(seed); }
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_SSIZE_T
|
||||
typedef size_t ssize_t;
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
])
|
||||
|
||||
|
||||
])
|
|
@ -0,0 +1,116 @@
|
|||
dnl
|
||||
dnl Copyright 2003,2004,2005 Free Software Foundation, Inc.
|
||||
dnl
|
||||
dnl This file is part of GNU Radio
|
||||
dnl
|
||||
dnl GNU Radio is free software; you can redistribute it and/or modify
|
||||
dnl it under the terms of the GNU General Public License as published by
|
||||
dnl the Free Software Foundation; either version 2, or (at your option)
|
||||
dnl any later version.
|
||||
dnl
|
||||
dnl GNU Radio is distributed in the hope that it will be useful,
|
||||
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
dnl GNU General Public License for more details.
|
||||
dnl
|
||||
dnl You should have received a copy of the GNU General Public License
|
||||
dnl along with GNU Radio; see the file COPYING. If not, write to
|
||||
dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
dnl Boston, MA 02111-1307, USA.
|
||||
dnl
|
||||
|
||||
# PYTHON_DEVEL()
|
||||
#
|
||||
# Checks for Python and tries to get the include path to 'Python.h'.
|
||||
# It provides the $(PYTHON_CPPFLAGS) and $(PYTHON_LDFLAGS) output variables.
|
||||
#
|
||||
AC_DEFUN([PYTHON_DEVEL],[
|
||||
AC_REQUIRE([AM_PATH_PYTHON])
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])
|
||||
|
||||
# Check for Python include path
|
||||
AC_MSG_CHECKING([for Python include path])
|
||||
if test -z "$PYTHON" ; then
|
||||
AC_MSG_ERROR([cannot find Python path])
|
||||
fi
|
||||
|
||||
# ask distutils which include path we should use
|
||||
python_cmd='
|
||||
import distutils.sysconfig
|
||||
import os
|
||||
path = distutils.sysconfig.get_python_inc(plat_specific=False)
|
||||
if os.sep == "\\":
|
||||
path = path.replace("\\", "/")
|
||||
print path
|
||||
'
|
||||
python_path=`$PYTHON -c "$python_cmd"`
|
||||
AC_MSG_RESULT([$python_path])
|
||||
if test -z "$python_path" ; then
|
||||
AC_MSG_ERROR([cannot find Python include path])
|
||||
fi
|
||||
|
||||
AC_SUBST(PYTHON_CPPFLAGS,[-I$python_path])
|
||||
|
||||
# Check for Python headers usability
|
||||
python_save_CPPFLAGS=$CPPFLAGS
|
||||
CPPFLAGS="$CPPFLAGS $PYTHON_CPPFLAGS"
|
||||
AC_CHECK_HEADERS([Python.h], [],
|
||||
[AC_MSG_ERROR([cannot find usable Python headers])])
|
||||
CPPFLAGS="$python_save_CPPFLAGS"
|
||||
|
||||
# Only set this on mingw and cygwin hosts, (only implemented
|
||||
# for mingw host, for crosscompiling you need to trick this)
|
||||
|
||||
PYTHON_LDFLAGS=""
|
||||
case $host_os in
|
||||
*mingw* | *cygwin* )
|
||||
AC_MSG_CHECKING([for Python LDFLAGS])
|
||||
|
||||
python_cmd='
|
||||
import distutils.sysconfig
|
||||
import os
|
||||
path = distutils.sysconfig.get_config_var("LIBPL")
|
||||
if path == None:
|
||||
path = distutils.sysconfig.PREFIX + "/libs"
|
||||
if os.sep == "\\":
|
||||
path = path.replace("\\", "/")
|
||||
print path
|
||||
'
|
||||
python_stdlib_path=`$PYTHON -c "$python_cmd"`
|
||||
|
||||
python_version_nodot=`echo $PYTHON_VERSION | sed "s,\.,,"`
|
||||
libpython_name="python$PYTHON_VERSION"
|
||||
|
||||
# Standard install of python for win32 has libpython24.a
|
||||
# instead of libpython2.4.a so we check for the library
|
||||
# without the dot in the version number.
|
||||
|
||||
python_stdlib_filename=`find $python_stdlib_path -type f -name libpython$python_version_nodot.* -print | sed "1q"`
|
||||
if test -n "$python_stdlib_filename" ; then
|
||||
libpython_name="python$python_version_nodot"
|
||||
fi
|
||||
|
||||
PYTHON_LDFLAGS="-L$python_stdlib_path -l$libpython_name"
|
||||
AC_MSG_RESULT($PYTHON_LDFLAGS)
|
||||
# Replace all backslashes in PYTHON Paths with forward slashes
|
||||
AC_MSG_CHECKING([for pythondir])
|
||||
pythondir=`echo $pythondir |sed 's,\\\\,/,g'`
|
||||
AC_MSG_RESULT($pythondir)
|
||||
AC_SUBST([pythondir])
|
||||
AC_MSG_CHECKING([for pkgpythondir])
|
||||
pkgpythondir=`echo $pkgpythondir |sed 's,\\\\,/,g'`
|
||||
AC_MSG_RESULT($pkgpythondir)
|
||||
AC_SUBST([pkgpythondir])
|
||||
AC_MSG_CHECKING([for pyexecdir])
|
||||
pyexecdir=`echo $pyexecdir |sed 's,\\\\,/,g'`
|
||||
AC_MSG_RESULT($pyexecdir)
|
||||
AC_SUBST([pyexecdir])
|
||||
AC_MSG_CHECKING([for pkgpyexecdir])
|
||||
pkgpyexecdir=`echo $pkgpyexecdir |sed 's,\\\\,/,g'`
|
||||
AC_MSG_RESULT($pkgpyexecdir)
|
||||
AC_SUBST([pkgpyexecdir])
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_SUBST([PYTHON_LDFLAGS])
|
||||
])
|
|
@ -0,0 +1,33 @@
|
|||
dnl
|
||||
dnl Copyright 2003,2004 Free Software Foundation, Inc.
|
||||
dnl
|
||||
dnl This file is part of GNU Radio
|
||||
dnl
|
||||
dnl GNU Radio is free software; you can redistribute it and/or modify
|
||||
dnl it under the terms of the GNU General Public License as published by
|
||||
dnl the Free Software Foundation; either version 2, or (at your option)
|
||||
dnl any later version.
|
||||
dnl
|
||||
dnl GNU Radio is distributed in the hope that it will be useful,
|
||||
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
dnl GNU General Public License for more details.
|
||||
dnl
|
||||
dnl You should have received a copy of the GNU General Public License
|
||||
dnl along with GNU Radio; see the file COPYING. If not, write to
|
||||
dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
dnl Boston, MA 02111-1307, USA.
|
||||
dnl
|
||||
|
||||
AC_DEFUN([GR_REQUIRE_MC4020],[
|
||||
AC_MSG_CHECKING([for mc4020 A/D driver include file])
|
||||
AC_COMPILE_IFELSE([
|
||||
#include <mc4020.h>
|
||||
int main (int argc, char **argv)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
],[AC_MSG_RESULT([yes])],
|
||||
[AC_MSG_RESULT([no])
|
||||
AC_MSG_ERROR([mc4020.h not found.])])
|
||||
])
|
|
@ -0,0 +1,30 @@
|
|||
dnl
|
||||
dnl Copyright 2003 Free Software Foundation, Inc.
|
||||
dnl
|
||||
dnl This file is part of GNU Radio
|
||||
dnl
|
||||
dnl GNU Radio is free software; you can redistribute it and/or modify
|
||||
dnl it under the terms of the GNU General Public License as published by
|
||||
dnl the Free Software Foundation; either version 2, or (at your option)
|
||||
dnl any later version.
|
||||
dnl
|
||||
dnl GNU Radio is distributed in the hope that it will be useful,
|
||||
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
dnl GNU General Public License for more details.
|
||||
dnl
|
||||
dnl You should have received a copy of the GNU General Public License
|
||||
dnl along with GNU Radio; see the file COPYING. If not, write to
|
||||
dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
dnl Boston, MA 02111-1307, USA.
|
||||
dnl
|
||||
|
||||
AC_DEFUN([GR_SCRIPTING],[
|
||||
AC_REQUIRE([AC_PROG_LN_S])
|
||||
AC_REQUIRE([AC_PROG_CXX])
|
||||
AC_REQUIRE([AC_PROG_LIBTOOL])
|
||||
|
||||
SWIG_PROG(1.3.23)
|
||||
SWIG_ENABLE_CXX
|
||||
SWIG_PYTHON
|
||||
])
|
|
@ -0,0 +1,44 @@
|
|||
dnl
|
||||
dnl Copyright 2003 Free Software Foundation, Inc.
|
||||
dnl
|
||||
dnl This file is part of GNU Radio
|
||||
dnl
|
||||
dnl GNU Radio is free software; you can redistribute it and/or modify
|
||||
dnl it under the terms of the GNU General Public License as published by
|
||||
dnl the Free Software Foundation; either version 2, or (at your option)
|
||||
dnl any later version.
|
||||
dnl
|
||||
dnl GNU Radio is distributed in the hope that it will be useful,
|
||||
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
dnl GNU General Public License for more details.
|
||||
dnl
|
||||
dnl You should have received a copy of the GNU General Public License
|
||||
dnl along with GNU Radio; see the file COPYING. If not, write to
|
||||
dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
dnl Boston, MA 02111-1307, USA.
|
||||
dnl
|
||||
|
||||
AC_DEFUN([GR_SET_MD_CPU],[
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])
|
||||
AC_ARG_WITH(md-cpu,
|
||||
[ --with-md-cpu=ARCH set machine dependent speedups (auto)],
|
||||
[cf_with_md_cpu="$withval"],
|
||||
[cf_with_md_cpu="$host_cpu"])
|
||||
|
||||
AC_MSG_CHECKING([for machine dependent speedups])
|
||||
case "$cf_with_md_cpu" in
|
||||
x86 | i[[3-7]]86) MD_CPU=x86 MD_SUBCPU=x86 ;;
|
||||
x86_64) MD_CPU=x86 MD_SUBCPU=x86_64 ;;
|
||||
# sparc) MD_CPU=sparc ;;
|
||||
*) MD_CPU=generic ;;
|
||||
esac
|
||||
AC_MSG_RESULT($MD_CPU)
|
||||
AC_SUBST(MD_CPU)
|
||||
AC_SUBST(MD_SUBCPU)
|
||||
|
||||
AM_CONDITIONAL(MD_CPU_x86, test $MD_CPU = x86)
|
||||
AM_CONDITIONAL(MD_SUBCPU_x86_64, test $MD_SUBCPU = x86_64)
|
||||
AM_CONDITIONAL(MD_CPU_generic, test $MD_CPU = generic)
|
||||
])
|
||||
|
|
@ -0,0 +1,85 @@
|
|||
dnl
|
||||
dnl Copyright 2003 Free Software Foundation, Inc.
|
||||
dnl
|
||||
dnl This file is part of GNU Radio
|
||||
dnl
|
||||
dnl GNU Radio is free software; you can redistribute it and/or modify
|
||||
dnl it under the terms of the GNU General Public License as published by
|
||||
dnl the Free Software Foundation; either version 2, or (at your option)
|
||||
dnl any later version.
|
||||
dnl
|
||||
dnl GNU Radio is distributed in the hope that it will be useful,
|
||||
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
dnl GNU General Public License for more details.
|
||||
dnl
|
||||
dnl You should have received a copy of the GNU General Public License
|
||||
dnl along with GNU Radio; see the file COPYING. If not, write to
|
||||
dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
dnl Boston, MA 02111-1307, USA.
|
||||
dnl
|
||||
|
||||
# SWIG_PROG([required-version])
|
||||
#
|
||||
# Checks for the SWIG program. If found you can (and should) call SWIG via $(SWIG).
|
||||
# You can use the optional first argument to check if the version of the available SWIG
|
||||
# is greater or equal to the value of the argument. It should have the format:
|
||||
# N[.N[.N]] (N is a number between 0 and 999. Only the first N is mandatory.)
|
||||
AC_DEFUN([SWIG_PROG],[
|
||||
AC_REQUIRE([AC_PROG_MAKE_SET])
|
||||
AC_CHECK_PROG(SWIG,swig,[`which swig`])
|
||||
if test -z "$SWIG" ; then
|
||||
AC_MSG_ERROR([Cannot find 'swig' program. SWIG version >= $1 required])
|
||||
SWIG=false
|
||||
elif test -n "$1" ; then
|
||||
AC_MSG_CHECKING([for SWIG version])
|
||||
swig_version=`$SWIG -version 2>&1 | \
|
||||
awk '/^SWIG Version [[0-9]+\.[0-9]+\.[0-9]]+.*$/ { split($[3],a,"[[^.0-9]]"); print a[[1]] }'`
|
||||
AC_MSG_RESULT([$swig_version])
|
||||
if test -n "$swig_version" ; then
|
||||
swig_version=`echo $swig_version | \
|
||||
awk '{ split($[1],a,"\."); print [a[1]*1000000+a[2]*1000+a[3]] }' 2>/dev/null`
|
||||
swig_required_version=`echo $1 | \
|
||||
awk '{ split($[1],a,"\."); print [a[1]*1000000+a[2]*1000+a[3]] }' 2>/dev/null`
|
||||
if test $swig_required_version -gt $swig_version ; then
|
||||
AC_MSG_ERROR([SWIG version >= $1 required])
|
||||
fi
|
||||
else
|
||||
AC_MSG_ERROR([cannot determine SWIG version])
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
# SWIG_ENABLE_CXX()
|
||||
#
|
||||
# Enable swig C++ support. This effects all invocations of $(SWIG).
|
||||
AC_DEFUN([SWIG_ENABLE_CXX],[
|
||||
AC_REQUIRE([SWIG_PROG])
|
||||
AC_REQUIRE([AC_PROG_CXX])
|
||||
if test "$SWIG" != "false" ; then
|
||||
SWIG="$SWIG -c++"
|
||||
fi
|
||||
])
|
||||
|
||||
# SWIG_PYTHON([use-shadow-classes])
|
||||
#
|
||||
# Checks for Python and provides the $(SWIG_PYTHON_CPPFLAGS),
|
||||
# $(SWIG_PYTHON_LIB) and $(SWIG_PYTHON_OPT) output variables.
|
||||
# $(SWIG_PYTHON_OPT) contains all necessary swig options to generate
|
||||
# code for Python. If you need multi module support use
|
||||
# $(SWIG_PYTHON_LIB) (provided by the SWIG_MULTI_MODULE_SUPPORT()
|
||||
# macro) to link against the appropriate library. It contains the
|
||||
# SWIG Python runtime library that is needed by the type check system
|
||||
# for example.
|
||||
|
||||
AC_DEFUN([SWIG_PYTHON],[
|
||||
AC_REQUIRE([SWIG_PROG])
|
||||
AC_REQUIRE([PYTHON_DEVEL])
|
||||
if test "$SWIG" != "false" ; then
|
||||
AC_SUBST(SWIG_PYTHON_LIB,[-lswigpy])
|
||||
dnl test ! "x$1" = "xno" && swig_shadow=" -shadow" || swig_shadow=""
|
||||
dnl AC_SUBST(SWIG_PYTHON_OPT,[-python$swig_shadow])
|
||||
AC_SUBST(SWIG_PYTHON_OPT,[-python])
|
||||
fi
|
||||
AC_SUBST(SWIG_PYTHON_CPPFLAGS,[$PYTHON_CPPFLAGS])
|
||||
])
|
|
@ -0,0 +1,36 @@
|
|||
# Check for IPC System V shm support. -*- Autoconf -*-
|
||||
|
||||
# Copyright 2003 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
|
||||
AC_DEFUN([GR_SYSV_SHM],
|
||||
[
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_C
|
||||
|
||||
AC_CHECK_HEADERS([sys/ipc.h sys/shm.h])
|
||||
|
||||
save_LIBS="$LIBS"
|
||||
AC_SEARCH_LIBS(shmat, [cygipc ipc],
|
||||
[ IPC_LIBS="$LIBS" ],
|
||||
[ AC_MSG_WARN([SystemV IPC support not found. ]) ]
|
||||
)
|
||||
LIBS="$save_LIBS"
|
||||
|
||||
AC_LANG_RESTORE
|
||||
AC_SUBST(IPC_LIBS)
|
||||
])
|
|
@ -0,0 +1,39 @@
|
|||
dnl
|
||||
dnl Copyright 2005 Free Software Foundation, Inc.
|
||||
dnl
|
||||
dnl This file is part of GNU Radio
|
||||
dnl
|
||||
dnl GNU Radio is free software; you can redistribute it and/or modify
|
||||
dnl it under the terms of the GNU General Public License as published by
|
||||
dnl the Free Software Foundation; either version 2, or (at your option)
|
||||
dnl any later version.
|
||||
dnl
|
||||
dnl GNU Radio is distributed in the hope that it will be useful,
|
||||
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
dnl GNU General Public License for more details.
|
||||
dnl
|
||||
dnl You should have received a copy of the GNU General Public License
|
||||
dnl along with GNU Radio; see the file COPYING. If not, write to
|
||||
dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
dnl Boston, MA 02111-1307, USA.
|
||||
dnl
|
||||
|
||||
# GR_X86_64()
|
||||
#
|
||||
# Checks to see if we're on a x86_64 machine, and if so, ensure
|
||||
# that libdir ends in "64"
|
||||
#
|
||||
AC_DEFUN([GR_X86_64],[
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])
|
||||
if test "$host_cpu" = "x86_64"; then
|
||||
AC_MSG_CHECKING([libdir for lib64 suffix])
|
||||
t=${libdir##*/lib}
|
||||
if test "$t" != 64 && test -d /lib64 && ! test -L /lib64; then
|
||||
libdir=${libdir}64
|
||||
AC_MSG_RESULT([no. Setting libdir to $libdir])
|
||||
else
|
||||
AC_MSG_RESULT([yes])
|
||||
fi
|
||||
fi
|
||||
])
|
|
@ -0,0 +1,42 @@
|
|||
dnl Autoconf support for C++
|
||||
dnl Copyright (C) 1988 Eleftherios Gkioulekas <lf@amath.washington.edu>
|
||||
dnl
|
||||
dnl This program is free software; you can redistribute it and/or modify
|
||||
dnl it under the terms of the GNU General Public License as published by
|
||||
dnl the Free Software Foundation; either version 2 of the License, or
|
||||
dnl (at your option) any later version.
|
||||
dnl
|
||||
dnl This program is distributed in the hope that it will be useful,
|
||||
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
dnl GNU General Public License for more details.
|
||||
dnl
|
||||
dnl You should have received a copy of the GNU General Public License
|
||||
dnl along with this program; if not, write to the Free Software
|
||||
dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
dnl
|
||||
dnl As a special exception to the GNU General Public License, if you
|
||||
dnl distribute this file as part of a program that contains a configuration
|
||||
dnl script generated by Autoconf, you may include it under the same
|
||||
dnl distribution terms that you use for the rest of that program.
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# Use this macro to configure your C compiler
|
||||
# When called the macro does the following things:
|
||||
# 1. It finds an appropriate C compiler.
|
||||
# If you passed the flag --with-cc=foo then it uses that
|
||||
# particular compiler
|
||||
# 2. Check whether the compiler works.
|
||||
# 3. Checks whether the compiler accepts the -g
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
AC_DEFUN([LF_CONFIGURE_CC],[
|
||||
dnl Sing the song
|
||||
AC_REQUIRE([AC_PROG_CC])dnl
|
||||
AC_REQUIRE([AC_PROG_CPP])dnl
|
||||
AC_REQUIRE([AC_AIX])dnl
|
||||
AC_REQUIRE([AC_ISC_POSIX])dnl
|
||||
AC_REQUIRE([AC_MINIX])dnl
|
||||
AC_REQUIRE([AC_HEADER_STDC])dnl
|
||||
])
|
||||
|
|
@ -0,0 +1,121 @@
|
|||
dnl Autoconf support for C++
|
||||
dnl Copyright (C) 1988 Eleftherios Gkioulekas <lf@amath.washington.edu>
|
||||
dnl
|
||||
dnl This program is free software; you can redistribute it and/or modify
|
||||
dnl it under the terms of the GNU General Public License as published by
|
||||
dnl the Free Software Foundation; either version 2 of the License, or
|
||||
dnl (at your option) any later version.
|
||||
dnl
|
||||
dnl This program is distributed in the hope that it will be useful,
|
||||
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
dnl GNU General Public License for more details.
|
||||
dnl
|
||||
dnl You should have received a copy of the GNU General Public License
|
||||
dnl along with this program; if not, write to the Free Software
|
||||
dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
dnl
|
||||
dnl As a special exception to the GNU General Public License, if you
|
||||
dnl distribute this file as part of a program that contains a configuration
|
||||
dnl script generated by Autoconf, you may include it under the same
|
||||
dnl distribution terms that you use for the rest of that program.
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
# This macro should be called to configure your C++ compiler.
|
||||
# When called, the macro does the following things:
|
||||
# 1. It finds an appropriate C++ compiler
|
||||
# If you passed the flag --with-cxx=foo, then it uses that
|
||||
# particular compiler
|
||||
# 2. Checks whether the compiler accepts the -g
|
||||
# ------------------------------------------------------------------
|
||||
|
||||
AC_DEFUN([LF_CONFIGURE_CXX],[
|
||||
AC_REQUIRE([AC_PROG_CXX])dnl
|
||||
AC_REQUIRE([AC_PROG_CXXCPP])dnl
|
||||
LF_CXX_PORTABILITY
|
||||
])
|
||||
|
||||
# -----------------------------------------------------------------------
|
||||
# This macro tests the C++ compiler for various portability problem.
|
||||
# 1. Defines CXX_HAS_NO_BOOL if the compiler does not support the bool
|
||||
# data type
|
||||
# 2. Defines CXX_HAS_BUGGY_FOR_LOOPS if the compiler has buggy
|
||||
# scoping for the for-loop
|
||||
# 3. Defines USE_ASSERT if the user wants to use assertions
|
||||
# -----------------------------------------------------------------------
|
||||
|
||||
|
||||
AC_DEFUN([LF_CXX_PORTABILITY],[
|
||||
|
||||
dnl
|
||||
dnl Check for common C++ portability problems
|
||||
dnl
|
||||
|
||||
dnl AC_LANG_PUSH
|
||||
dnl AC_LANG_CPLUSPLUS
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_CPLUSPLUS
|
||||
|
||||
dnl Check whether we have bool
|
||||
AC_MSG_CHECKING(whether C++ has bool)
|
||||
AC_TRY_RUN([main() { bool b1=true; bool b2=false; }],
|
||||
[ AC_MSG_RESULT(yes) ],
|
||||
[ AC_MSG_RESULT(no)
|
||||
AC_DEFINE(CXX_HAS_NO_BOOL,[],[Define if C++ is missing bool type]) ],
|
||||
[ AC_MSG_WARN(Don't cross-compile)]
|
||||
)
|
||||
|
||||
dnl Test whether C++ has buggy for-loops
|
||||
AC_MSG_CHECKING(whether C++ has buggy scoping in for-loops)
|
||||
AC_TRY_COMPILE([#include <iostream.h>], [
|
||||
for (int i=0;i<10;i++) { }
|
||||
for (int i=0;i<10;i++) { }
|
||||
], [ AC_MSG_RESULT(no) ],
|
||||
[ AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(CXX_HAS_BUGGY_FOR_LOOPS,[],[Define if for loop scoping is broken]) ])
|
||||
|
||||
dnl Test whether the user wants to enable assertions
|
||||
AC_MSG_CHECKING(whether user wants assertions)
|
||||
AC_ARG_ENABLE(assert,
|
||||
[ --disable-assert don't use cpp.h assert],
|
||||
[ AC_DEFINE(NDEBUG,[],[Define to disable asserts (don't doit!)])
|
||||
AC_MSG_RESULT(no) ],
|
||||
[ AC_MSG_RESULT(yes) ],
|
||||
)
|
||||
|
||||
dnl Test whether C++ has std::isnan
|
||||
AC_MSG_CHECKING(whether C++ has std::isnan)
|
||||
AC_TRY_COMPILE([#include <math.h>], [
|
||||
std::isnan(0);
|
||||
], [ AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(CXX_HAS_STD_ISNAN,[],[Define if has std::isnan]) ],
|
||||
[ AC_MSG_RESULT(no) ])
|
||||
|
||||
dnl Done with the portability checks
|
||||
dnl AC_LANG_POP([C++])
|
||||
AC_LANG_RESTORE
|
||||
])
|
||||
|
||||
AH_BOTTOM([// Workaround for compilers with buggy for-loop scoping
|
||||
// That's quite a few compilers actually including recent versions of
|
||||
// Dec Alpha cxx, HP-UX CC and SGI CC.
|
||||
// The trivial "if" statement provides the correct scoping to the
|
||||
// for loop
|
||||
|
||||
#ifdef CXX_HAS_BUGGY_FOR_LOOPS
|
||||
#undef for
|
||||
#define for if(1) for
|
||||
#endif
|
||||
])
|
||||
|
||||
AH_BOTTOM([// If the C++ compiler we use doesn't have bool, then
|
||||
// the following is a near-perfect work-around.
|
||||
// You must make sure your code does not depend on "int" and "bool"
|
||||
// being two different types, in overloading for instance.
|
||||
|
||||
#ifdef CXX_HAS_NO_BOOL
|
||||
#define bool int
|
||||
#define true 1
|
||||
#define false 0
|
||||
#endif
|
||||
])
|
|
@ -0,0 +1,128 @@
|
|||
dnl Copyright (C) 1988 Eleftherios Gkioulekas <lf@amath.washington.edu>
|
||||
dnl
|
||||
dnl This program is free software; you can redistribute it and/or modify
|
||||
dnl it under the terms of the GNU General Public License as published by
|
||||
dnl the Free Software Foundation; either version 2 of the License, or
|
||||
dnl (at your option) any later version.
|
||||
dnl
|
||||
dnl This program is distributed in the hope that it will be useful,
|
||||
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
dnl GNU General Public License for more details.
|
||||
dnl
|
||||
dnl You should have received a copy of the GNU General Public License
|
||||
dnl along with this program; if not, write to the Free Software
|
||||
dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
dnl
|
||||
dnl As a special exception to the GNU General Public License, if you
|
||||
dnl distribute this file as part of a program that contains a configuration
|
||||
dnl script generated by Autoconf, you may include it under the same
|
||||
dnl distribution terms that you use for the rest of that program.
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Check whether the C++ compiler accepts a certain flag
|
||||
# If it does it adds the flag to CXXFLAGS
|
||||
# If it does not then it returns an error to lf_ok
|
||||
# Usage:
|
||||
# LF_CHECK_CXX_FLAG(-flag1 -flag2 -flag3 ...)
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
AC_DEFUN([LF_CHECK_CXX_FLAG],[
|
||||
echo 'void f(){}' > conftest.cc
|
||||
for i in $1
|
||||
do
|
||||
AC_MSG_CHECKING([whether $CXX accepts $i])
|
||||
if test -z "`${CXX} $i -c conftest.cc 2>&1`"
|
||||
then
|
||||
CXXFLAGS="${CXXFLAGS} $i"
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
done
|
||||
rm -f conftest.cc conftest.o
|
||||
])
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Check whether the C compiler accepts a certain flag
|
||||
# If it does it adds the flag to CFLAGS
|
||||
# If it does not then it returns an error to lf_ok
|
||||
# Usage:
|
||||
# LF_CHECK_CC_FLAG(-flag1 -flag2 -flag3 ...)
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
AC_DEFUN([LF_CHECK_CC_FLAG],[
|
||||
echo 'void f(){}' > conftest.c
|
||||
for i in $1
|
||||
do
|
||||
AC_MSG_CHECKING([whether $CC accepts $i])
|
||||
if test -z "`${CC} $i -c conftest.c 2>&1`"
|
||||
then
|
||||
CFLAGS="${CFLAGS} $i"
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
done
|
||||
rm -f conftest.c conftest.o
|
||||
])
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Check whether the Fortran compiler accepts a certain flag
|
||||
# If it does it adds the flag to FFLAGS
|
||||
# If it does not then it returns an error to lf_ok
|
||||
# Usage:
|
||||
# LF_CHECK_F77_FLAG(-flag1 -flag2 -flag3 ...)
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
AC_DEFUN([LF_CHECK_F77_FLAG],[
|
||||
cat << EOF > conftest.f
|
||||
c....:++++++++++++++++++++++++
|
||||
PROGRAM MAIN
|
||||
PRINT*,'Hello World!'
|
||||
END
|
||||
EOF
|
||||
for i in $1
|
||||
do
|
||||
AC_MSG_CHECKING([whether $F77 accepts $i])
|
||||
if test -z "`${F77} $i -c conftest.f 2>&1`"
|
||||
then
|
||||
FFLAGS="${FFLAGS} $i"
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
done
|
||||
rm -f conftest.f conftest.o
|
||||
])
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Provide the configure script with an --with-warnings option that
|
||||
# turns on warnings. Call this command AFTER you have configured ALL your
|
||||
# compilers.
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
AC_DEFUN([LF_SET_WARNINGS],[
|
||||
dnl Check for --with-warnings
|
||||
AC_MSG_CHECKING([whether user wants warnings])
|
||||
AC_ARG_WITH(warnings,
|
||||
[ --with-warnings Turn on warnings],
|
||||
[ lf_warnings=yes ], [ lf_warnings=no ])
|
||||
lf_warnings=yes # hard code for now -eb
|
||||
AC_MSG_RESULT($lf_warnings)
|
||||
|
||||
dnl Warnings for the two main compilers
|
||||
cc_warning_flags="-Wall"
|
||||
cxx_warning_flags="-Wall -Woverloaded-virtual"
|
||||
if test $lf_warnings = yes
|
||||
then
|
||||
if test -n "${CC}"
|
||||
then
|
||||
LF_CHECK_CC_FLAG($cc_warning_flags)
|
||||
fi
|
||||
if test -n "${CXX}"
|
||||
then
|
||||
LF_CHECK_CXX_FLAG($cxx_warning_flags)
|
||||
fi
|
||||
fi
|
||||
])
|
|
@ -0,0 +1,39 @@
|
|||
dnl Copyright (C) 1988 Eleftherios Gkioulekas <lf@amath.washington.edu>
|
||||
dnl
|
||||
dnl This program is free software; you can redistribute it and/or modify
|
||||
dnl it under the terms of the GNU General Public License as published by
|
||||
dnl the Free Software Foundation; either version 2 of the License, or
|
||||
dnl (at your option) any later version.
|
||||
dnl
|
||||
dnl This program is distributed in the hope that it will be useful,
|
||||
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
dnl GNU General Public License for more details.
|
||||
dnl
|
||||
dnl You should have received a copy of the GNU General Public License
|
||||
dnl along with this program; if not, write to the Free Software
|
||||
dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
dnl
|
||||
dnl As a special exception to the GNU General Public License, if you
|
||||
dnl distribute this file as part of a program that contains a configuration
|
||||
dnl script generated by Autoconf, you may include it under the same
|
||||
dnl distribution terms that you use for the rest of that program.
|
||||
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
# This macro searches for Xlib and when it finds it it adds the
|
||||
# appropriate flags to CXXFLAGS and export the link sequence to
|
||||
# the variable XLIB.
|
||||
# In your configure.in file add:
|
||||
# LF_PATH_XLIB
|
||||
# In your Makefile.am add
|
||||
# program_LDADD = .... $(XLIB)
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
AC_DEFUN([LF_PATH_XLIB],[
|
||||
AC_PATH_XTRA
|
||||
CXXFLAGS="$CXXFLAGS $X_CFLAGS"
|
||||
XLIB="$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
|
||||
AC_SUBST(XLIB)
|
||||
])
|
||||
|
|
@ -0,0 +1,89 @@
|
|||
#serial 4
|
||||
|
||||
# On some hosts (e.g., HP-UX 10.20, SunOS 4.1.4, Solaris 2.5.1), mkstemp has a
|
||||
# silly limit that it can create no more than 26 files from a given template.
|
||||
# Other systems lack mkstemp altogether.
|
||||
# On OSF1/Tru64 V4.0F, the system-provided mkstemp function can create
|
||||
# only 32 files per process.
|
||||
# On systems like the above, arrange to use the replacement function.
|
||||
AC_DEFUN([UTILS_FUNC_MKSTEMP],
|
||||
[dnl
|
||||
AC_REPLACE_FUNCS(mkstemp)
|
||||
if test $ac_cv_func_mkstemp = no; then
|
||||
utils_cv_func_mkstemp_limitations=yes
|
||||
else
|
||||
AC_CACHE_CHECK([for mkstemp limitations],
|
||||
utils_cv_func_mkstemp_limitations,
|
||||
[
|
||||
AC_TRY_RUN([
|
||||
# include <stdlib.h>
|
||||
int main ()
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 70; i++)
|
||||
{
|
||||
char template[] = "conftestXXXXXX";
|
||||
int fd = mkstemp (template);
|
||||
if (fd == -1)
|
||||
exit (1);
|
||||
close (fd);
|
||||
}
|
||||
exit (0);
|
||||
}
|
||||
],
|
||||
utils_cv_func_mkstemp_limitations=no,
|
||||
utils_cv_func_mkstemp_limitations=yes,
|
||||
utils_cv_func_mkstemp_limitations=yes
|
||||
)
|
||||
]
|
||||
)
|
||||
fi
|
||||
|
||||
if test $utils_cv_func_mkstemp_limitations = yes; then
|
||||
AC_LIBOBJ(mkstemp)
|
||||
AC_LIBOBJ(tempname)
|
||||
AC_DEFINE(mkstemp, rpl_mkstemp,
|
||||
[Define to rpl_mkstemp if the replacement function should be used.])
|
||||
gl_PREREQ_MKSTEMP
|
||||
jm_PREREQ_TEMPNAME
|
||||
fi
|
||||
])
|
||||
|
||||
# Prerequisites of lib/mkstemp.c.
|
||||
AC_DEFUN([gl_PREREQ_MKSTEMP],
|
||||
[
|
||||
AH_BOTTOM(
|
||||
[
|
||||
#ifndef HAVE_MKSTEMP
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
int rpl_mkstemp (char *templ);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
])
|
||||
])
|
||||
|
||||
# Prerequisites of lib/tempname.c.
|
||||
AC_DEFUN([jm_PREREQ_TEMPNAME],
|
||||
[
|
||||
AC_REQUIRE([AC_HEADER_STAT])
|
||||
AC_CHECK_HEADERS_ONCE(fcntl.h sys/time.h unistd.h)
|
||||
AC_CHECK_HEADERS(stdint.h)
|
||||
AC_CHECK_FUNCS(__secure_getenv gettimeofday lstat)
|
||||
AC_CHECK_DECLS_ONCE(getenv)
|
||||
# AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])
|
||||
|
||||
dnl Under Win32, mkdir prototype in io.h has only one arg
|
||||
AC_MSG_CHECKING(whether mkdir accepts only one arg)
|
||||
AC_TRY_COMPILE([#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>], [
|
||||
mkdir("")
|
||||
], [ AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(MKDIR_TAKES_ONE_ARG,[],[Define if mkdir accepts only one arg]) ],
|
||||
[ AC_MSG_RESULT(no)
|
||||
])
|
||||
])
|
|
@ -0,0 +1,63 @@
|
|||
# onceonly.m4 serial 3
|
||||
dnl Copyright (C) 2002, 2003 Free Software Foundation, Inc.
|
||||
dnl This file is free software, distributed under the terms of the GNU
|
||||
dnl General Public License. As a special exception to the GNU General
|
||||
dnl Public License, this file may be distributed as part of a program
|
||||
dnl that contains a configuration script generated by Autoconf, under
|
||||
dnl the same distribution terms as the rest of that program.
|
||||
|
||||
dnl This file defines some "once only" variants of standard autoconf macros.
|
||||
dnl AC_CHECK_HEADERS_ONCE like AC_CHECK_HEADERS
|
||||
dnl AC_CHECK_FUNCS_ONCE like AC_CHECK_FUNCS
|
||||
dnl AC_CHECK_DECLS_ONCE like AC_CHECK_DECLS
|
||||
dnl AC_REQUIRE([AC_HEADER_STDC]) like AC_HEADER_STDC
|
||||
dnl The advantage is that the check for each of the headers/functions/decls
|
||||
dnl will be put only once into the 'configure' file. It keeps the size of
|
||||
dnl the 'configure' file down, and avoids redundant output when 'configure'
|
||||
dnl is run.
|
||||
dnl The drawback is that the checks cannot be conditionalized. If you write
|
||||
dnl if some_condition; then gl_CHECK_HEADERS(stdlib.h); fi
|
||||
dnl inside an AC_DEFUNed function, the gl_CHECK_HEADERS macro call expands to
|
||||
dnl empty, and the check will be inserted before the body of the AC_DEFUNed
|
||||
dnl function.
|
||||
|
||||
dnl Autoconf version 2.57 or newer is recommended.
|
||||
AC_PREREQ(2.54)
|
||||
|
||||
# AC_CHECK_HEADERS_ONCE(HEADER1 HEADER2 ...) is a once-only variant of
|
||||
# AC_CHECK_HEADERS(HEADER1 HEADER2 ...).
|
||||
AC_DEFUN([AC_CHECK_HEADERS_ONCE], [
|
||||
:
|
||||
AC_FOREACH([gl_HEADER_NAME], [$1], [
|
||||
AC_DEFUN([gl_CHECK_HEADER_]m4_quote(translit(defn([gl_HEADER_NAME]),
|
||||
[-./], [___])), [
|
||||
AC_CHECK_HEADERS(gl_HEADER_NAME)
|
||||
])
|
||||
AC_REQUIRE([gl_CHECK_HEADER_]m4_quote(translit(gl_HEADER_NAME,
|
||||
[-./], [___])))
|
||||
])
|
||||
])
|
||||
|
||||
# AC_CHECK_FUNCS_ONCE(FUNC1 FUNC2 ...) is a once-only variant of
|
||||
# AC_CHECK_FUNCS(FUNC1 FUNC2 ...).
|
||||
AC_DEFUN([AC_CHECK_FUNCS_ONCE], [
|
||||
:
|
||||
AC_FOREACH([gl_FUNC_NAME], [$1], [
|
||||
AC_DEFUN([gl_CHECK_FUNC_]defn([gl_FUNC_NAME]), [
|
||||
AC_CHECK_FUNCS(defn([gl_FUNC_NAME]))
|
||||
])
|
||||
AC_REQUIRE([gl_CHECK_FUNC_]defn([gl_FUNC_NAME]))
|
||||
])
|
||||
])
|
||||
|
||||
# AC_CHECK_DECLS_ONCE(DECL1 DECL2 ...) is a once-only variant of
|
||||
# AC_CHECK_DECLS(DECL1, DECL2, ...).
|
||||
AC_DEFUN([AC_CHECK_DECLS_ONCE], [
|
||||
:
|
||||
AC_FOREACH([gl_DECL_NAME], [$1], [
|
||||
AC_DEFUN([gl_CHECK_DECL_]defn([gl_DECL_NAME]), [
|
||||
AC_CHECK_DECLS(defn([gl_DECL_NAME]))
|
||||
])
|
||||
AC_REQUIRE([gl_CHECK_DECL_]defn([gl_DECL_NAME]))
|
||||
])
|
||||
])
|
|
@ -0,0 +1,68 @@
|
|||
dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
|
||||
dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
|
||||
dnl also defines GSTUFF_PKG_ERRORS on error
|
||||
AC_DEFUN([PKG_CHECK_MODULES], [
|
||||
succeeded=no
|
||||
|
||||
if test -z "$PKG_CONFIG"; then
|
||||
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
|
||||
fi
|
||||
|
||||
if test "$PKG_CONFIG" = "no" ; then
|
||||
echo "*** The pkg-config script could not be found. Make sure it is"
|
||||
echo "*** in your path, or set the PKG_CONFIG environment variable"
|
||||
echo "*** to the full path to pkg-config."
|
||||
echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
|
||||
else
|
||||
dnl If PKG_CONFIG_PATH is not already set, add /usr/local/lib/pkgconfig.
|
||||
dnl If it's set, assume the user knows what they're doing.
|
||||
dnl This should help avoid failures while looking for fftw3f
|
||||
if test -z "$PKG_CONFIG_PATH"; then
|
||||
export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig"
|
||||
fi
|
||||
|
||||
PKG_CONFIG_MIN_VERSION=0.9.0
|
||||
if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
|
||||
AC_MSG_CHECKING(for $2)
|
||||
|
||||
if $PKG_CONFIG --exists "$2" ; then
|
||||
AC_MSG_RESULT(yes)
|
||||
succeeded=yes
|
||||
|
||||
AC_MSG_CHECKING($1_CFLAGS)
|
||||
$1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
|
||||
AC_MSG_RESULT($$1_CFLAGS)
|
||||
|
||||
AC_MSG_CHECKING($1_LIBS)
|
||||
$1_LIBS=`$PKG_CONFIG --libs "$2"`
|
||||
AC_MSG_RESULT($$1_LIBS)
|
||||
|
||||
AC_MSG_CHECKING($1_INCLUDEDIR)
|
||||
$1_INCLUDEDIR=`$PKG_CONFIG --variable=includedir "$2"`
|
||||
AC_MSG_RESULT($$1_INCLUDEDIR)
|
||||
else
|
||||
$1_CFLAGS=""
|
||||
$1_LIBS=""
|
||||
## If we have a custom action on failure, don't print errors, but
|
||||
## do set a variable so people can do so.
|
||||
$1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
|
||||
ifelse([$4], ,echo $$1_PKG_ERRORS,)
|
||||
fi
|
||||
|
||||
AC_SUBST($1_CFLAGS)
|
||||
AC_SUBST($1_LIBS)
|
||||
AC_SUBST($1_INCLUDEDIR)
|
||||
else
|
||||
echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
|
||||
echo "*** See http://www.freedesktop.org/software/pkgconfig"
|
||||
fi
|
||||
fi
|
||||
|
||||
if test $succeeded = yes; then
|
||||
ifelse([$3], , :, [$3])
|
||||
else
|
||||
ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4])
|
||||
fi
|
||||
])
|
||||
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
dnl
|
||||
dnl Copyright 2003 Free Software Foundation, Inc.
|
||||
dnl
|
||||
dnl This file is part of GNU Radio
|
||||
dnl
|
||||
dnl GNU Radio is free software; you can redistribute it and/or modify
|
||||
dnl it under the terms of the GNU General Public License as published by
|
||||
dnl the Free Software Foundation; either version 2, or (at your option)
|
||||
dnl any later version.
|
||||
dnl
|
||||
dnl GNU Radio is distributed in the hope that it will be useful,
|
||||
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
dnl GNU General Public License for more details.
|
||||
dnl
|
||||
dnl You should have received a copy of the GNU General Public License
|
||||
dnl along with GNU Radio; see the file COPYING. If not, write to
|
||||
dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
dnl Boston, MA 02111-1307, USA.
|
||||
dnl
|
||||
|
||||
AC_DEFUN([USRP_SET_FUSB_TECHNIQUE],[
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])
|
||||
AC_ARG_WITH(fusb-tech,
|
||||
[ --with-fusb-tech=OS set fast usb technique (auto)],
|
||||
[cf_with_fusb_tech="$withval"],
|
||||
[cf_with_fusb_tech="$host_os"])
|
||||
|
||||
|
||||
AC_CHECK_HEADER([linux/usbdevice_fs.h],
|
||||
[x_have_usbdevice_fs_h=yes],
|
||||
[x_have_usbdevice_fs_h=no])
|
||||
|
||||
AC_MSG_CHECKING([for fast usb technique to use])
|
||||
case "$cf_with_fusb_tech" in
|
||||
linux*) if test x${x_have_usbdevice_fs_h} = xyes;
|
||||
then
|
||||
FUSB_TECH=linux
|
||||
else
|
||||
FUSB_TECH=generic
|
||||
fi ;;
|
||||
|
||||
darwin*) FUSB_TECH=darwin ;;
|
||||
cygwin*|win*|mingw*) FUSB_TECH=win32 ;;
|
||||
*) FUSB_TECH=generic ;;
|
||||
esac
|
||||
|
||||
AC_MSG_RESULT($FUSB_TECH)
|
||||
AC_SUBST(FUSB_TECH)
|
||||
|
||||
AM_CONDITIONAL(FUSB_TECH_darwin, test $FUSB_TECH = darwin)
|
||||
AM_CONDITIONAL(FUSB_TECH_win32, test $FUSB_TECH = win32)
|
||||
AM_CONDITIONAL(FUSB_TECH_generic, test $FUSB_TECH = generic)
|
||||
AM_CONDITIONAL(FUSB_TECH_linux, test $FUSB_TECH = linux)
|
||||
])
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
# Check for libusb support. -*- Autoconf -*-
|
||||
|
||||
# Copyright 2003 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
|
||||
AC_DEFUN([USRP_LIBUSB],
|
||||
[
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])
|
||||
AC_LANG_PUSH(C)
|
||||
|
||||
AC_CHECK_HEADERS([usb.h],
|
||||
[],
|
||||
[ AC_MSG_ERROR([USRP requires libusb. usb.h not found, stop. See http://libusb.sf.net]) ]
|
||||
)
|
||||
|
||||
save_LIBS="$LIBS"
|
||||
case "$host_os" in
|
||||
darwin*) LIBS="$LIBS -lIOKit" ;;
|
||||
*) ;;
|
||||
esac
|
||||
AC_SEARCH_LIBS(usb_bulk_write, [usb],
|
||||
[ USB_LIBS="$LIBS" ],
|
||||
[ AC_MSG_ERROR([USRP requires libusb. usb_bulk_write not found, stop. See http://libusb.sf.net]) ]
|
||||
)
|
||||
LIBS="$save_LIBS"
|
||||
|
||||
AC_LANG_POP
|
||||
AC_SUBST(USB_LIBS)
|
||||
])
|
|
@ -0,0 +1,67 @@
|
|||
# Check for sdcc support. -*- Autoconf -*-
|
||||
|
||||
# Copyright 2004 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
|
||||
AC_DEFUN([USRP_SDCC],
|
||||
[
|
||||
AC_CHECK_PROG(XCC, sdcc, sdcc -mmcs51 --no-xinit-opt,no)
|
||||
AC_CHECK_PROG(XAS, asx8051, asx8051 -plosgff,no)
|
||||
|
||||
if test "$XCC" = "no" -o "$XAS" = "no" ; then
|
||||
AC_MSG_ERROR([USRP requires sdcc. sdcc not found, stop. See http://sdcc.sf.net])
|
||||
fi
|
||||
|
||||
sdcc_version_min=$1
|
||||
|
||||
sdcc_version=`sdcc --version 2>&1 | \
|
||||
sed 's/\(SDCC.* \)\([[0-9]]*\.[[0-9]]*\.[[0-9]]*\)\( .*$\)/\2/'`
|
||||
|
||||
AC_MSG_CHECKING([sdcc_version "$sdcc_version"])
|
||||
|
||||
sdcc_major_version=`echo $sdcc_version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
|
||||
sdcc_minor_version=`echo $sdcc_version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
|
||||
sdcc_micro_version=`echo $sdcc_version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
|
||||
|
||||
sdcc_major_min=`echo $sdcc_version_min | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
|
||||
sdcc_minor_min=`echo $sdcc_version_min | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
|
||||
sdcc_micro_min=`echo $sdcc_version_min | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
|
||||
|
||||
sdcc_version_proper=`expr \
|
||||
"$sdcc_major_version" \> "$sdcc_major_min" \| \
|
||||
"$sdcc_major_version" \= "$sdcc_major_min" \& \
|
||||
"$sdcc_minor_version" \> "$sdcc_minor_min" \| \
|
||||
"$sdcc_major_version" \= "$sdcc_major_min" \& \
|
||||
"$sdcc_minor_version" \= "$sdcc_minor_min" \& \
|
||||
"$sdcc_micro_version" \>= "$sdcc_micro_min" `
|
||||
|
||||
if test "$sdcc_version_proper" = "1" ; then
|
||||
AC_MSG_RESULT([$sdcc_major_version.$sdcc_minor_version.$sdcc_micro_version])
|
||||
else
|
||||
AC_MSG_ERROR([USRP requires sdcc >= $sdcc_version_min. sdcc not found, stop. See http://sdcc.sf.net])
|
||||
fi
|
||||
|
||||
AC_SUBST(XCC)
|
||||
AC_SUBST(XAS)
|
||||
|
||||
])
|
|
@ -0,0 +1,103 @@
|
|||
dnl
|
||||
dnl Copyright 2004,2005 Free Software Foundation, Inc.
|
||||
dnl
|
||||
dnl This file is part of GNU Radio
|
||||
dnl
|
||||
dnl GNU Radio is free software; you can redistribute it and/or modify
|
||||
dnl it under the terms of the GNU General Public License as published by
|
||||
dnl the Free Software Foundation; either version 2, or (at your option)
|
||||
dnl any later version.
|
||||
dnl
|
||||
dnl GNU Radio is distributed in the hope that it will be useful,
|
||||
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
dnl GNU General Public License for more details.
|
||||
dnl
|
||||
dnl You should have received a copy of the GNU General Public License
|
||||
dnl along with GNU Radio; see the file COPYING. If not, write to
|
||||
dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
dnl Boston, MA 02111-1307, USA.
|
||||
dnl
|
||||
|
||||
AC_INIT
|
||||
AC_PREREQ(2.57)
|
||||
AC_CONFIG_SRCDIR([src/lib/repeater.i])
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
AC_CANONICAL_TARGET([])
|
||||
AM_INIT_AUTOMAKE(gr-repeater,0.01)
|
||||
|
||||
GR_X86_64
|
||||
dnl LF_CONFIGURE_CC
|
||||
LF_CONFIGURE_CXX
|
||||
LF_SET_WARNINGS
|
||||
GR_SET_GPROF
|
||||
GR_SET_PROF
|
||||
GR_PROG_AS
|
||||
AC_PROG_LN_S
|
||||
AC_PROG_MAKE_SET
|
||||
AC_PROG_INSTALL
|
||||
|
||||
AC_LIBTOOL_WIN32_DLL
|
||||
AC_ENABLE_SHARED dnl do build shared libraries
|
||||
AC_DISABLE_STATIC dnl don't build static libraries
|
||||
AC_PROG_LIBTOOL
|
||||
|
||||
dnl Locate python, SWIG, etc
|
||||
GR_NO_UNDEFINED
|
||||
GR_SCRIPTING
|
||||
|
||||
dnl Checks for libraries.
|
||||
|
||||
dnl check for threads (mandatory)
|
||||
GR_OMNITHREAD
|
||||
|
||||
CFLAGS="${CFLAGS} $PTHREAD_CFLAGS"
|
||||
CXXFLAGS="${CXXFLAGS} $PTHREAD_CFLAGS"
|
||||
|
||||
if test "x$CXX_FOR_BUILD" = x
|
||||
then
|
||||
CXX_FOR_BUILD=${CXX}
|
||||
fi
|
||||
AC_SUBST(CXX_FOR_BUILD)
|
||||
|
||||
dnl Checks for header files.
|
||||
AC_HEADER_STDC
|
||||
AC_HEADER_SYS_WAIT
|
||||
AC_CHECK_HEADERS(fcntl.h limits.h strings.h sys/ioctl.h sys/time.h unistd.h)
|
||||
AC_CHECK_HEADERS(sys/mman.h)
|
||||
|
||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_C_CONST
|
||||
AC_C_INLINE
|
||||
AC_TYPE_SIZE_T
|
||||
AC_HEADER_TIME
|
||||
|
||||
dnl Checks for library functions.
|
||||
AC_CHECK_FUNCS([])
|
||||
|
||||
dnl Check for Mingw support
|
||||
GR_PWIN32
|
||||
|
||||
PKG_CHECK_MODULES(GNURADIO_CORE, gnuradio-core >= 2)
|
||||
LIBS="$LIBS $GNURADIO_CORE_LIBS"
|
||||
|
||||
dnl Define where to find boost includes
|
||||
dnl defines BOOST_CFLAGS
|
||||
GR_REQUIRE_BOOST_INCLUDES
|
||||
|
||||
STD_DEFINES_AND_INCLUDES="$GNURADIO_CORE_CFLAGS $BOOST_CFLAGS"
|
||||
AC_SUBST(STD_DEFINES_AND_INCLUDES)
|
||||
|
||||
AC_CONFIG_FILES([\
|
||||
Makefile \
|
||||
config/Makefile \
|
||||
src/Makefile \
|
||||
src/lib/Makefile \
|
||||
src/python/Makefile \
|
||||
src/python/run_tests \
|
||||
])
|
||||
|
||||
dnl run_tests is created from run_tests.in. Make it executable.
|
||||
AC_CONFIG_COMMANDS([run_tests], [chmod +x src/python/run_tests])
|
||||
|
||||
AC_OUTPUT
|
|
@ -0,0 +1,22 @@
|
|||
#
|
||||
# Copyright 2004 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is part of GNU Radio
|
||||
#
|
||||
# GNU Radio 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.
|
||||
#
|
||||
# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
|
||||
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
# Boston, MA 02111-1307, USA.
|
||||
#
|
||||
|
||||
SUBDIRS = lib python
|
|
@ -0,0 +1,102 @@
|
|||
#
|
||||
# Copyright 2004,2005,2006 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is part of GNU Radio
|
||||
#
|
||||
# GNU Radio 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.
|
||||
#
|
||||
# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
|
||||
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
# Boston, MA 02111-1307, USA.
|
||||
#
|
||||
|
||||
include $(top_srcdir)/Makefile.common
|
||||
|
||||
# Install this stuff so that it ends up as the gnuradio.howto module
|
||||
# This usually ends up at:
|
||||
# ${prefix}/lib/python${python_version}/site-packages/gnuradio
|
||||
|
||||
ourpythondir = $(grpythondir)
|
||||
ourlibdir = $(grpyexecdir)
|
||||
|
||||
INCLUDES = $(STD_DEFINES_AND_INCLUDES) $(PYTHON_CPPFLAGS)
|
||||
|
||||
SWIGPYTHONARGS = $(SWIGPYTHONFLAGS) $(SWIGGRFLAGS)
|
||||
|
||||
ALL_IFILES = \
|
||||
$(LOCAL_IFILES) \
|
||||
$(NON_LOCAL_IFILES)
|
||||
|
||||
NON_LOCAL_IFILES = \
|
||||
$(GNURADIO_CORE_INCLUDEDIR)/swig/gnuradio.i
|
||||
|
||||
|
||||
LOCAL_IFILES = \
|
||||
repeater.i
|
||||
|
||||
# These files are built by SWIG. The first is the C++ glue.
|
||||
# The second is the python wrapper that loads the _howto shared library
|
||||
# and knows how to call our extensions.
|
||||
|
||||
BUILT_SOURCES = \
|
||||
repeater.cc \
|
||||
repeater.py
|
||||
|
||||
# This gets howto.py installed in the right place
|
||||
ourpython_PYTHON = \
|
||||
repeater.py
|
||||
|
||||
ourlib_LTLIBRARIES = _repeater.la
|
||||
|
||||
# These are the source files that go into the shared library
|
||||
_repeater_la_SOURCES = repeater\
|
||||
repeater.cc \
|
||||
repeater_fsk4_slicer_fb.cc \
|
||||
repeater_p25_frame_fb.cc \
|
||||
repeater_imbe_decode_fb.cc \
|
||||
repeater_pipe.cc \
|
||||
repeater_ctcss_squelch_ff.cc \
|
||||
repeater_squelch_base_ff.cc \
|
||||
bch.cc
|
||||
|
||||
# magic flags
|
||||
_repeater_la_LDFLAGS = $(NO_UNDEFINED) -module -avoid-version
|
||||
|
||||
# link the library against some comon swig runtime code and the
|
||||
# c++ standard library
|
||||
_repeater_la_LIBADD = \
|
||||
$(PYTHON_LDFLAGS) \
|
||||
-lstdc++
|
||||
|
||||
repeater.cc repeater.py: repeater.i $(ALL_IFILES)
|
||||
$(SWIG) $(SWIGPYTHONARGS) -module repeater -o repeater.cc $<
|
||||
|
||||
# These headers get installed in ${prefix}/include/gnuradio
|
||||
grinclude_HEADERS = \
|
||||
repeater_fsk4_slicer_fb.h \
|
||||
repeater_p25_frame_fb.h \
|
||||
repeater_imbe_decode_fb.h \
|
||||
repeater_pipe.h \
|
||||
repeater_ctcss_squelch_ff.h
|
||||
|
||||
|
||||
# These swig headers get installed in ${prefix}/include/gnuradio/swig
|
||||
swiginclude_HEADERS = \
|
||||
$(LOCAL_IFILES)
|
||||
|
||||
|
||||
MOSTLYCLEANFILES = $(BUILT_SOURCES) *.pyc
|
||||
|
||||
# Don't distribute output of swig
|
||||
dist-hook:
|
||||
@for file in $(BUILT_SOURCES); do echo $(RM) $(distdir)/$$file; done
|
||||
@for file in $(BUILT_SOURCES); do $(RM) $(distdir)/$$file; done
|
|
@ -0,0 +1,160 @@
|
|||
|
||||
#include <stdio.h>
|
||||
#include <vector>
|
||||
#include <bch.h>
|
||||
|
||||
static const int bchGFexp[64] = {
|
||||
1, 2, 4, 8, 16, 32, 3, 6, 12, 24, 48, 35, 5, 10, 20, 40,
|
||||
19, 38, 15, 30, 60, 59, 53, 41, 17, 34, 7, 14, 28, 56, 51, 37,
|
||||
9, 18, 36, 11, 22, 44, 27, 54, 47, 29, 58, 55, 45, 25, 50, 39,
|
||||
13, 26, 52, 43, 21, 42, 23, 46, 31, 62, 63, 61, 57, 49, 33, 0
|
||||
};
|
||||
|
||||
static const int bchGFlog[64] = {
|
||||
-1, 0, 1, 6, 2, 12, 7, 26, 3, 32, 13, 35, 8, 48, 27, 18,
|
||||
4, 24, 33, 16, 14, 52, 36, 54, 9, 45, 49, 38, 28, 41, 19, 56,
|
||||
5, 62, 25, 11, 34, 31, 17, 47, 15, 23, 53, 51, 37, 44, 55, 40,
|
||||
10, 61, 46, 30, 50, 22, 39, 43, 29, 60, 42, 21, 20, 59, 57, 58
|
||||
};
|
||||
|
||||
static const int bchG[48] = {
|
||||
1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0,
|
||||
1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0,
|
||||
1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1
|
||||
};
|
||||
|
||||
int bchDec(bit_vector& Codeword)
|
||||
{
|
||||
|
||||
int elp[24][ 22], S[23];
|
||||
int D[23], L[24], uLu[24];
|
||||
int root[11], locn[11], reg[12];
|
||||
int i,j,U,q,count;
|
||||
int SynError, CantDecode;
|
||||
|
||||
SynError = 0; CantDecode = 0;
|
||||
|
||||
for(i = 1; i <= 22; i++) {
|
||||
S[i] = 0;
|
||||
// FOR j = 0 TO 62
|
||||
for(j = 0; j <= 62; j++) {
|
||||
if( Codeword[j]) { S[i] = S[i] ^ bchGFexp[(i * j) % 63]; }
|
||||
}
|
||||
if( S[i]) { SynError = 1; }
|
||||
S[i] = bchGFlog[S[i]];
|
||||
// printf("S[%d] %d\n", i, S[i]);
|
||||
}
|
||||
|
||||
if( SynError) { //if there are errors, try to correct them
|
||||
L[0] = 0; uLu[0] = -1; D[0] = 0; elp[0][ 0] = 0;
|
||||
L[1] = 0; uLu[1] = 0; D[1] = S[1]; elp[1][ 0] = 1;
|
||||
//FOR i = 1 TO 21
|
||||
for(i = 1; i <= 21; i++) {
|
||||
elp[0][ i] = -1; elp[1][ i] = 0;
|
||||
}
|
||||
U = 0;
|
||||
|
||||
do {
|
||||
U = U + 1;
|
||||
if( D[U] == -1) {
|
||||
L[U + 1] = L[U];
|
||||
// FOR i = 0 TO L[U]
|
||||
for(i = 0; i <= L[U]; i++) {
|
||||
elp[U + 1][ i] = elp[U][ i]; elp[U][ i] = bchGFlog[elp[U][ i]];
|
||||
}
|
||||
} else {
|
||||
//search for words with greatest uLu(q) for which d(q)!=0
|
||||
q = U - 1;
|
||||
while((D[q] == -1) &&(q > 0)) { q = q - 1; }
|
||||
//have found first non-zero d(q)
|
||||
if( q > 0) {
|
||||
j = q;
|
||||
do { j = j - 1; if((D[j] != -1) &&(uLu[q] < uLu[j])) { q = j; }
|
||||
} while( j > 0) ;
|
||||
}
|
||||
|
||||
//store degree of new elp polynomial
|
||||
if( L[U] > L[q] + U - q) {
|
||||
L[U + 1] = L[U] ;
|
||||
} else {
|
||||
L[U + 1] = L[q] + U - q;
|
||||
}
|
||||
|
||||
///* form new elp(x) */
|
||||
// FOR i = 0 TO 21
|
||||
for(i = 0; i <= 21; i++) {
|
||||
elp[U + 1][ i] = 0;
|
||||
}
|
||||
// FOR i = 0 TO L(q)
|
||||
for(i = 0; i <= L[q]; i++) {
|
||||
if( elp[q][ i] != -1) {
|
||||
elp[U + 1][ i + U - q] = bchGFexp[(D[U] + 63 - D[q] + elp[q][ i]) % 63];
|
||||
}
|
||||
}
|
||||
// FOR i = 0 TO L(U)
|
||||
for(i = 0; i <= L[U]; i++) {
|
||||
elp[U + 1][ i] = elp[U + 1][ i] ^ elp[U][ i];
|
||||
elp[U][ i] = bchGFlog[elp[U][ i]];
|
||||
}
|
||||
}
|
||||
uLu[U + 1] = U - L[U + 1];
|
||||
|
||||
//form(u+1)th discrepancy
|
||||
if( U < 22) {
|
||||
//no discrepancy computed on last iteration
|
||||
if( S[U + 1] != -1) { D[U + 1] = bchGFexp[S[U + 1]]; } else { D[U + 1] = 0; }
|
||||
// FOR i = 1 TO L(U + 1)
|
||||
for(i = 1; i <= L[U + 1]; i++) {
|
||||
if((S[U + 1 - i] != -1) &&(elp[U + 1][ i] != 0)) {
|
||||
D[U + 1] = D[U + 1] ^ bchGFexp[(S[U + 1 - i] + bchGFlog[elp[U + 1][ i]]) % 63];
|
||||
}
|
||||
}
|
||||
//put d(u+1) into index form */
|
||||
D[U + 1] = bchGFlog[D[U + 1]];
|
||||
}
|
||||
} while((U < 22) &&(L[U + 1] <= 11));
|
||||
|
||||
U = U + 1;
|
||||
if( L[U] <= 11) { // /* Can correct errors */
|
||||
//put elp into index form
|
||||
// FOR i = 0 TO L[U]
|
||||
for(i = 0; i <= L[U]; i++) {
|
||||
elp[U][ i] = bchGFlog[elp[U][ i]];
|
||||
}
|
||||
|
||||
//Chien search: find roots of the error location polynomial
|
||||
// FOR i = 1 TO L(U)
|
||||
for(i = 1; i <= L[U]; i++) {
|
||||
reg[i] = elp[U][ i];
|
||||
}
|
||||
count = 0;
|
||||
// FOR i = 1 TO 63
|
||||
for(i = 1; i <= 63; i++) {
|
||||
q = 1;
|
||||
//FOR j = 1 TO L(U)
|
||||
for(j = 1; j <= L[U]; j++) {
|
||||
if( reg[j] != -1) {
|
||||
reg[j] =(reg[j] + j) % 63; q = q ^ bchGFexp[reg[j]];
|
||||
}
|
||||
}
|
||||
if( q == 0) { //store root and error location number indices
|
||||
root[count] = i; locn[count] = 63 - i; count = count + 1;
|
||||
}
|
||||
}
|
||||
if( count == L[U]) {
|
||||
//no. roots = degree of elp hence <= t errors
|
||||
//FOR i = 0 TO L[U] - 1
|
||||
for(i = 0; i <= L[U]-1; i++) {
|
||||
Codeword[locn[i]] = Codeword[locn[i]] ^ 1;
|
||||
}
|
||||
CantDecode = count;
|
||||
} else { //elp has degree >t hence cannot solve
|
||||
CantDecode = -1;
|
||||
}
|
||||
} else {
|
||||
CantDecode = -2;
|
||||
}
|
||||
}
|
||||
return CantDecode;
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
#include <vector>
|
||||
typedef std::vector<bool> bit_vector;
|
||||
int bchDec(bit_vector& Codeword);
|
||||
|
|
@ -0,0 +1,115 @@
|
|||
/* -*- c++ -*- */
|
||||
|
||||
%feature("autodoc", "1"); // generate python docstrings
|
||||
|
||||
%include "exception.i"
|
||||
%import "gnuradio.i" // the common stuff
|
||||
|
||||
%{
|
||||
#include "gnuradio_swig_bug_workaround.h" // mandatory bug fix
|
||||
#include "repeater_squelch_base_ff.h"
|
||||
#include "repeater_fsk4_slicer_fb.h"
|
||||
#include "repeater_p25_frame_fb.h"
|
||||
#include "repeater_imbe_decode_fb.h"
|
||||
#include "repeater_pipe.h"
|
||||
#include "repeater_ctcss_squelch_ff.h"
|
||||
#include <stdexcept>
|
||||
%}
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
|
||||
/*
|
||||
* First arg is the package prefix.
|
||||
* Second arg is the name of the class minus the prefix.
|
||||
*
|
||||
* This does some behind-the-scenes magic so we can
|
||||
* access repeater_fsk4_slicer_fb from python as repeater.fsk4_slicer_fb
|
||||
*/
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
|
||||
GR_SWIG_BLOCK_MAGIC(repeater,fsk4_slicer_fb);
|
||||
|
||||
repeater_fsk4_slicer_fb_sptr repeater_make_fsk4_slicer_fb ();
|
||||
|
||||
class repeater_fsk4_slicer_fb : public gr_sync_block
|
||||
{
|
||||
private:
|
||||
repeater_fsk4_slicer_fb ();
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
|
||||
GR_SWIG_BLOCK_MAGIC(repeater,p25_frame_fb);
|
||||
|
||||
repeater_p25_frame_fb_sptr repeater_make_p25_frame_fb ();
|
||||
|
||||
class repeater_p25_frame_fb : public gr_sync_block
|
||||
{
|
||||
private:
|
||||
repeater_p25_frame_fb ();
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
|
||||
GR_SWIG_BLOCK_MAGIC(repeater,imbe_decode_fb);
|
||||
|
||||
repeater_imbe_decode_fb_sptr repeater_make_imbe_decode_fb ();
|
||||
|
||||
class repeater_imbe_decode_fb : public gr_sync_block
|
||||
{
|
||||
private:
|
||||
repeater_imbe_decode_fb ();
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
|
||||
GR_SWIG_BLOCK_MAGIC(repeater,pipe);
|
||||
|
||||
repeater_pipe_sptr repeater_make_pipe (size_t input_size, size_t output_size, const char* pathname, float io_ratio);
|
||||
|
||||
class repeater_pipe : public gr_sync_block
|
||||
{
|
||||
private:
|
||||
repeater_pipe (size_t input_size, size_t output_size, const char* pathname, float io_ratio);
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
|
||||
GR_SWIG_BLOCK_MAGIC(repeater,squelch_base_ff);
|
||||
|
||||
class repeater_squelch_base_ff : public gr_block
|
||||
{
|
||||
private:
|
||||
enum { ST_MUTED, ST_ATTACK, ST_UNMUTED, ST_DECAY } d_state;
|
||||
|
||||
public:
|
||||
repeater_squelch_base_ff(const char *name, int ramp, bool gate);
|
||||
|
||||
int ramp() const { return d_ramp; }
|
||||
void set_ramp(int ramp) { d_ramp = ramp; }
|
||||
bool gate() const { return d_gate; }
|
||||
void set_gate(bool gate) { d_gate = gate; }
|
||||
bool unmuted() const { return (d_state == ST_UNMUTED || d_state == ST_ATTACK); }
|
||||
|
||||
virtual std::vector<float> squelch_range() const = 0;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
|
||||
GR_SWIG_BLOCK_MAGIC(repeater,ctcss_squelch_ff);
|
||||
|
||||
repeater_ctcss_squelch_ff_sptr repeater_make_ctcss_squelch_ff (int rate, float freq, float level=5.0, int len=0, int ramp=0, bool gate=false);
|
||||
|
||||
class repeater_ctcss_squelch_ff : public repeater_squelch_base_ff
|
||||
{
|
||||
private:
|
||||
repeater_ctcss_squelch_ff ();
|
||||
|
||||
public:
|
||||
std::vector<float> squelch_range() const;
|
||||
float level() const { return d_level; }
|
||||
void set_level(float level) { d_level = level; }
|
||||
int len() const { return d_len; }
|
||||
|
||||
};
|
|
@ -0,0 +1,133 @@
|
|||
/* -*- c++ -*- */
|
||||
/*
|
||||
* Copyright 2004,2006 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of GNU Radio
|
||||
*
|
||||
* GNU Radio 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, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <repeater_ctcss_squelch_ff.h>
|
||||
|
||||
static float ctcss_tones[] = {
|
||||
67.0, 71.9, 74.4, 77.0, 79.7, 82.5, 85.4, 88.5, 91.5, 94.8,
|
||||
97.4, 100.0, 103.5, 107.2, 110.9, 114.8, 118.8, 123.0, 127.3, 131.8,
|
||||
136.5, 141.3, 146.2, 151.4, 156.7, 162.2, 167.9, 173.8, 179.9, 186.2,
|
||||
192.8, 203.5, 210.7, 218.1, 225.7, 233.6, 241.8, 250.3
|
||||
};
|
||||
|
||||
static int max_tone_index = 37;
|
||||
|
||||
repeater_ctcss_squelch_ff_sptr
|
||||
repeater_make_ctcss_squelch_ff(int rate, float freq, float level, int len, int ramp, bool gate)
|
||||
{
|
||||
return repeater_ctcss_squelch_ff_sptr(new repeater_ctcss_squelch_ff(rate, freq, level, len, ramp, gate));
|
||||
}
|
||||
|
||||
int repeater_ctcss_squelch_ff::find_tone(float freq)
|
||||
{
|
||||
for (int i = 0; i <= max_tone_index; i++)
|
||||
if (ctcss_tones[i] == freq) // FIXME: make almost equal
|
||||
return i;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
repeater_ctcss_squelch_ff::repeater_ctcss_squelch_ff(int rate, float freq, float level, int len, int ramp, bool gate) :
|
||||
repeater_squelch_base_ff("ctcss_squelch_ff", ramp, gate)
|
||||
{
|
||||
d_freq = freq;
|
||||
d_level = level;
|
||||
|
||||
// Default is 100 ms detection time
|
||||
if (len == 0)
|
||||
d_len = (int)(rate/10.0);
|
||||
else
|
||||
d_len = len;
|
||||
|
||||
int i = find_tone(freq);
|
||||
|
||||
// Non-standard tones or edge tones get 2% guard band, otherwise
|
||||
// guards are set at adjacent ctcss tone frequencies
|
||||
float f_l, f_r;
|
||||
if (i == -1 || i == 0)
|
||||
f_l = freq*0.98;
|
||||
else
|
||||
f_l = ctcss_tones[i-1];
|
||||
|
||||
if (i == -1 || i == max_tone_index)
|
||||
f_r = freq*1.02;
|
||||
else
|
||||
f_r = ctcss_tones[i+1];
|
||||
|
||||
d_goertzel_l = gri_goertzel(rate, d_len, f_l);
|
||||
d_goertzel_c = gri_goertzel(rate, d_len, freq);
|
||||
d_goertzel_r = gri_goertzel(rate, d_len, f_r);
|
||||
#define pick_tone_freq(f,t,a) ((fabsf(f-t) > 15.0) ? t : a)
|
||||
d_goertzel_v = gri_goertzel(rate, d_len, pick_tone_freq(freq, 71.0, 171.0));
|
||||
d_goertzel_w = gri_goertzel(rate, d_len, pick_tone_freq(freq, 133.0, 233.0));
|
||||
d_goertzel_x = gri_goertzel(rate, d_len, pick_tone_freq(freq, 180.0, 80.0));
|
||||
d_goertzel_y = gri_goertzel(rate, d_len, pick_tone_freq(freq, 222.0, 122.0));
|
||||
d_goertzel_z = gri_goertzel(rate, d_len, pick_tone_freq(freq, 285.0, 185.0));
|
||||
#undef pick_tone_freq
|
||||
d_mute = true;
|
||||
}
|
||||
|
||||
std::vector<float> repeater_ctcss_squelch_ff::squelch_range() const
|
||||
{
|
||||
std::vector<float> r(3);
|
||||
r[0] = 0.0;
|
||||
r[1] = 1.0;
|
||||
r[2] = (r[1]-r[0])/100; // step size
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
void repeater_ctcss_squelch_ff::update_state(const float &in)
|
||||
{
|
||||
float f;
|
||||
d_goertzel_l.input(in);
|
||||
d_goertzel_c.input(in);
|
||||
d_goertzel_r.input(in);
|
||||
d_goertzel_v.input(in);
|
||||
d_goertzel_w.input(in);
|
||||
d_goertzel_x.input(in);
|
||||
d_goertzel_y.input(in);
|
||||
d_goertzel_z.input(in);
|
||||
|
||||
float d_out_l, d_out_c, d_out_r, d_out_v, d_out_w, d_out_x, d_out_y, d_out_z;
|
||||
if (d_goertzel_c.ready()) {
|
||||
d_out_l = abs(d_goertzel_l.output());
|
||||
d_out_c = abs(d_goertzel_c.output());
|
||||
d_out_r = abs(d_goertzel_r.output());
|
||||
d_out_v = abs(d_goertzel_v.output());
|
||||
d_out_w = abs(d_goertzel_w.output());
|
||||
d_out_x = abs(d_goertzel_x.output());
|
||||
d_out_y = abs(d_goertzel_y.output());
|
||||
d_out_z = abs(d_goertzel_z.output());
|
||||
|
||||
// ratio of energy at tone freq vs. energy at "all" freqs
|
||||
f = d_out_c / (d_out_v + d_out_w + d_out_x + d_out_y + d_out_z);
|
||||
|
||||
d_mute = (f < d_level || d_out_c < d_out_l || d_out_c < d_out_r );
|
||||
|
||||
// printf("d_mute=%d d_out_l=%f d_out_c=%f d_out_r=%f v=%f w=%f x=%f y=%f z=%f f=%f\n", d_mute, d_out_l, d_out_c, d_out_r, d_out_v, d_out_w, d_out_x, d_out_y, d_out_z, f);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
/* -*- c++ -*- */
|
||||
/*
|
||||
* Copyright 2006 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of GNU Radio
|
||||
*
|
||||
* GNU Radio 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, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_REPEATER_CTCSS_SQUELCH_FF_H
|
||||
#define INCLUDED_REPEATER_CTCSS_SQUELCH_FF_H
|
||||
|
||||
#include <repeater_squelch_base_ff.h>
|
||||
#include <gri_goertzel.h>
|
||||
|
||||
class repeater_ctcss_squelch_ff;
|
||||
typedef boost::shared_ptr<repeater_ctcss_squelch_ff> repeater_ctcss_squelch_ff_sptr;
|
||||
|
||||
repeater_ctcss_squelch_ff_sptr
|
||||
repeater_make_ctcss_squelch_ff(int rate, float freq, float level=0.01, int len=0, int ramp=0, bool gate=false);
|
||||
|
||||
/*!
|
||||
* \brief gate or zero output if ctcss tone not present
|
||||
* \ingroup level_blk
|
||||
*/
|
||||
class repeater_ctcss_squelch_ff : public repeater_squelch_base_ff
|
||||
{
|
||||
private:
|
||||
float d_freq;
|
||||
float d_level;
|
||||
int d_len;
|
||||
bool d_mute;
|
||||
|
||||
gri_goertzel d_goertzel_l;
|
||||
gri_goertzel d_goertzel_c;
|
||||
gri_goertzel d_goertzel_r;
|
||||
gri_goertzel d_goertzel_v;
|
||||
gri_goertzel d_goertzel_w;
|
||||
gri_goertzel d_goertzel_x;
|
||||
gri_goertzel d_goertzel_y;
|
||||
gri_goertzel d_goertzel_z;
|
||||
|
||||
friend repeater_ctcss_squelch_ff_sptr repeater_make_ctcss_squelch_ff(int rate, float freq, float level, int len, int ramp, bool gate);
|
||||
repeater_ctcss_squelch_ff(int rate, float freq, float level, int len, int ramp, bool gate);
|
||||
|
||||
int find_tone(float freq);
|
||||
|
||||
protected:
|
||||
virtual void update_state(const float &in);
|
||||
virtual bool mute() const { return d_mute; }
|
||||
|
||||
public:
|
||||
std::vector<float> squelch_range() const;
|
||||
float level() const { return d_level; }
|
||||
void set_level(float level) { d_level = level; }
|
||||
int len() const { return d_len; }
|
||||
};
|
||||
|
||||
#endif /* INCLUDED_REPEATER_CTCSS_SQUELCH_FF_H */
|
|
@ -0,0 +1,100 @@
|
|||
/* -*- c++ -*- */
|
||||
/*
|
||||
* Copyright 2004 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of GNU Radio
|
||||
*
|
||||
* GNU Radio 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.
|
||||
*
|
||||
* GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* config.h is generated by configure. It contains the results
|
||||
* of probing for features, options etc. It should be the first
|
||||
* file included in your .cc file.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <repeater_fsk4_slicer_fb.h>
|
||||
#include <gr_io_signature.h>
|
||||
|
||||
/*
|
||||
* Create a new instance of repeater_fsk4_slicer_fb and return
|
||||
* a boost shared_ptr. This is effectively the public constructor.
|
||||
*/
|
||||
repeater_fsk4_slicer_fb_sptr
|
||||
repeater_make_fsk4_slicer_fb ()
|
||||
{
|
||||
return repeater_fsk4_slicer_fb_sptr (new repeater_fsk4_slicer_fb ());
|
||||
}
|
||||
|
||||
/*
|
||||
* Specify constraints on number of input and output streams.
|
||||
* This info is used to construct the input and output signatures
|
||||
* (2nd & 3rd args to gr_block's constructor). The input and
|
||||
* output signatures are used by the runtime system to
|
||||
* check that a valid number and type of inputs and outputs
|
||||
* are connected to this block. In this case, we accept
|
||||
* only 1 input and 1 output.
|
||||
*/
|
||||
static const int MIN_IN = 1; // mininum number of input streams
|
||||
static const int MAX_IN = 1; // maximum number of input streams
|
||||
static const int MIN_OUT = 1; // minimum number of output streams
|
||||
static const int MAX_OUT = 1; // maximum number of output streams
|
||||
|
||||
/*
|
||||
* The private constructor
|
||||
*/
|
||||
repeater_fsk4_slicer_fb::repeater_fsk4_slicer_fb ()
|
||||
: gr_sync_block ("fsk4_slicer_fb",
|
||||
gr_make_io_signature (MIN_IN, MAX_IN, sizeof (float)),
|
||||
gr_make_io_signature (MIN_OUT, MAX_OUT, sizeof (unsigned char)))
|
||||
{
|
||||
// nothing else required in this example
|
||||
}
|
||||
|
||||
/*
|
||||
* Our virtual destructor.
|
||||
*/
|
||||
repeater_fsk4_slicer_fb::~repeater_fsk4_slicer_fb ()
|
||||
{
|
||||
// nothing else required in this example
|
||||
}
|
||||
|
||||
int
|
||||
repeater_fsk4_slicer_fb::work (int noutput_items,
|
||||
gr_vector_const_void_star &input_items,
|
||||
gr_vector_void_star &output_items)
|
||||
{
|
||||
const float *in = (const float *) input_items[0];
|
||||
unsigned char *out = (unsigned char *) output_items[0];
|
||||
|
||||
for (int i = 0; i < noutput_items; i++){
|
||||
if (in[i] < -2.0) {
|
||||
out[i] = 3;
|
||||
} else if (in[i] < 0.0) {
|
||||
out[i] = 2;
|
||||
} else if (in[i] < 2.0) {
|
||||
out[i] = 0;
|
||||
} else {
|
||||
out[i] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Tell runtime system how many output items we produced.
|
||||
return noutput_items;
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
/* -*- c++ -*- */
|
||||
/*
|
||||
* Copyright 2004 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of GNU Radio
|
||||
*
|
||||
* GNU Radio 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.
|
||||
*
|
||||
* GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#ifndef INCLUDED_REPEATER_SLICER_FF_H
|
||||
#define INCLUDED_REPEATER_SLICER_FF_H
|
||||
|
||||
#include <gr_sync_block.h>
|
||||
|
||||
class repeater_fsk4_slicer_fb;
|
||||
|
||||
/*
|
||||
* We use boost::shared_ptr's instead of raw pointers for all access
|
||||
* to gr_blocks (and many other data structures). The shared_ptr gets
|
||||
* us transparent reference counting, which greatly simplifies storage
|
||||
* management issues. This is especially helpful in our hybrid
|
||||
* C++ / Python system.
|
||||
*
|
||||
* See http://www.boost.org/libs/smart_ptr/smart_ptr.htm
|
||||
*
|
||||
* As a convention, the _sptr suffix indicates a boost::shared_ptr
|
||||
*/
|
||||
typedef boost::shared_ptr<repeater_fsk4_slicer_fb> repeater_fsk4_slicer_fb_sptr;
|
||||
|
||||
/*!
|
||||
* \brief Return a shared_ptr to a new instance of repeater_fsk4_slicer_fb.
|
||||
*
|
||||
* To avoid accidental use of raw pointers, repeater_fsk4_slicer_fb's
|
||||
* constructor is private. repeater_make_fsk4_slicer_fb is the public
|
||||
* interface for creating new instances.
|
||||
*/
|
||||
repeater_fsk4_slicer_fb_sptr repeater_make_fsk4_slicer_fb ();
|
||||
|
||||
/*!
|
||||
* \brief produce a stream of dibits, given a stream of floats in [-3,-1,1,3]
|
||||
* \ingroup block
|
||||
*
|
||||
* This uses the preferred technique: subclassing gr_sync_block.
|
||||
*/
|
||||
class repeater_fsk4_slicer_fb : public gr_sync_block
|
||||
{
|
||||
private:
|
||||
// The friend declaration allows repeater_make_fsk4_slicer_fb to
|
||||
// access the private constructor.
|
||||
|
||||
friend repeater_fsk4_slicer_fb_sptr repeater_make_fsk4_slicer_fb ();
|
||||
|
||||
repeater_fsk4_slicer_fb (); // private constructor
|
||||
|
||||
public:
|
||||
~repeater_fsk4_slicer_fb (); // public destructor
|
||||
|
||||
// Where all the action really happens
|
||||
|
||||
int work (int noutput_items,
|
||||
gr_vector_const_void_star &input_items,
|
||||
gr_vector_void_star &output_items);
|
||||
};
|
||||
|
||||
#endif /* INCLUDED_REPEATER_SLICER_FF_H */
|
|
@ -0,0 +1,249 @@
|
|||
/* -*- c++ -*- */
|
||||
/*
|
||||
* Copyright 2004 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of GNU Radio
|
||||
*
|
||||
* GNU Radio 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.
|
||||
*
|
||||
* GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* config.h is generated by configure. It contains the results
|
||||
* of probing for features, options etc. It should be the first
|
||||
* file included in your .cc file.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <repeater_imbe_decode_fb.h>
|
||||
#include <gr_io_signature.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <vector>
|
||||
#include <bch.h>
|
||||
#include <op25_imbe_frame.h>
|
||||
#include <op25_p25_frame.h>
|
||||
#include <repeater_imbe_decode_fb.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
/*
|
||||
* Create a new instance of repeater_imbe_decode_fb and return
|
||||
* a boost shared_ptr. This is effectively the public constructor.
|
||||
*/
|
||||
repeater_imbe_decode_fb_sptr
|
||||
repeater_make_imbe_decode_fb ()
|
||||
{
|
||||
return repeater_imbe_decode_fb_sptr (new repeater_imbe_decode_fb ());
|
||||
}
|
||||
|
||||
/*
|
||||
* Specify constraints on number of input and output streams.
|
||||
* This info is used to construct the input and output signatures
|
||||
* (2nd & 3rd args to gr_block's constructor). The input and
|
||||
* output signatures are used by the runtime system to
|
||||
* check that a valid number and type of inputs and outputs
|
||||
* are connected to this block. In this case, we accept
|
||||
* only 1 input and 1 output.
|
||||
*/
|
||||
static const int MIN_IN = 1; // mininum number of input streams
|
||||
static const int MAX_IN = 1; // maximum number of input streams
|
||||
static const int MIN_OUT = 1; // minimum number of output streams
|
||||
static const int MAX_OUT = 1; // maximum number of output streams
|
||||
|
||||
/*
|
||||
* The private constructor
|
||||
*/
|
||||
repeater_imbe_decode_fb::repeater_imbe_decode_fb ()
|
||||
: gr_block ("imbe_decode_fb",
|
||||
gr_make_io_signature (MIN_IN, MAX_IN, sizeof (float)),
|
||||
gr_make_io_signature (MIN_OUT, MAX_OUT, sizeof (unsigned char))),
|
||||
reverse_p(0),
|
||||
hdr_syms(0),
|
||||
next_bit(0),
|
||||
frame_body(P25_VOICE_FRAME_SIZE),
|
||||
symbol_queue()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* Our virtual destructor.
|
||||
*/
|
||||
repeater_imbe_decode_fb::~repeater_imbe_decode_fb ()
|
||||
{
|
||||
// nothing else required in this example
|
||||
}
|
||||
|
||||
/*
|
||||
* Process the 64 bits after the frame sync, which should be the frame header
|
||||
* 1. verify bch and reject if bch cannot be decoded
|
||||
* 2. extract NAC and DUID
|
||||
* Returns false if decode failure, else true
|
||||
*/
|
||||
bool repeater_imbe_decode_fb::header_codeword(uint64_t acc, uint32_t& nac, uint32_t& duid) {
|
||||
bit_vector cw(64);
|
||||
bool low = acc & 1;
|
||||
// for bch, split bits into codeword vector
|
||||
for (int i=0; i < 64; i++) {
|
||||
acc >>= 1;
|
||||
cw[i] = acc & 1;
|
||||
}
|
||||
|
||||
// do bch decode
|
||||
int rc = bchDec(cw);
|
||||
|
||||
// check if bch decode unsuccessful
|
||||
if (rc < 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// load corrected bch bits into acc
|
||||
acc = 0;
|
||||
for (int i=63; i>=0; i--) {
|
||||
acc |= cw[i];
|
||||
acc <<= 1;
|
||||
}
|
||||
acc |= low; // FIXME
|
||||
|
||||
// extract nac and duid
|
||||
nac = (acc >> 52) & 0xfff;
|
||||
duid = (acc >> 48) & 0x00f;
|
||||
hdr_word = acc;
|
||||
printf ("nac %x duid %x errs %d\n", nac, duid, rc);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* rx_sym: called once per received symbol
|
||||
* 1. looks for flags sequences
|
||||
* 2. after flags detected (hdr_syms > 0), accumulate 64-bit header word
|
||||
* 3. check for voice frames (ldu1|2)
|
||||
* 4. for ldu1|2 (next_bit > 0), accumulate all 1728 bits in frame
|
||||
* 5. FIXME regenerate all fields in frame (flags, bch, hamming/golay, rs, pn)
|
||||
* 6. place symbols into output symbol queue
|
||||
*/
|
||||
void repeater_imbe_decode_fb::rx_sym(uint8_t dibit) {
|
||||
// FIXME assert(dibit >= 0 && dibit <= 3)
|
||||
header_accum <<= 2;
|
||||
header_accum |= dibit;
|
||||
if (hdr_syms == 12) {
|
||||
// ignore status dibit
|
||||
header_accum >>= 2;
|
||||
} else if (hdr_syms >= 33) {
|
||||
// header completely received
|
||||
bool bch_rc = header_codeword(header_accum, nac, duid);
|
||||
// next_bit = 48 + 64 + 2;
|
||||
if (bch_rc) {
|
||||
next_bit = 48 + 64;
|
||||
frame_size_limit = P25_VOICE_FRAME_SIZE;
|
||||
}
|
||||
hdr_syms = 0;
|
||||
}
|
||||
if (hdr_syms)
|
||||
// count symbols in header
|
||||
hdr_syms++;
|
||||
if ((header_accum & P25_FRAME_SYNC_MASK) == P25_FRAME_SYNC_MAGIC) {
|
||||
hdr_syms = 1;
|
||||
}
|
||||
if ((header_accum & P25_FRAME_SYNC_MASK) == P25_FRAME_SYNC_REV_P) {
|
||||
reverse_p = 0x02;
|
||||
hdr_syms = 1;
|
||||
}
|
||||
if (next_bit) {
|
||||
frame_body[next_bit++] = (dibit >> 1) & 1;
|
||||
frame_body[next_bit++] = dibit & 1;
|
||||
}
|
||||
// dispose of received frame (if exists) and:
|
||||
// 1. complete frame is received, or
|
||||
// 2. flags is received
|
||||
if (next_bit && (next_bit >= frame_size_limit || hdr_syms == 1)) {
|
||||
// dump_cw(frame_body, 216, stdout);
|
||||
if (duid == 0x5 || duid == 0xa) { // if voice - ldu1 or ldu2
|
||||
for(size_t i = 0; i < nof_voice_codewords; ++i) {
|
||||
voice_codeword cw(voice_codeword_sz);
|
||||
uint32_t E0, ET;
|
||||
uint32_t u[8];
|
||||
char s[128];
|
||||
imbe_deinterleave(frame_body, cw, i);
|
||||
imbe_header_decode(cw, u[0], u[1], u[2], u[3], u[4], u[5], u[6], u[7], E0, ET);
|
||||
sprintf(s, "%x %x %x %x %x %x %x %x\n", u[0], u[1], u[2], u[3], u[4], u[5], u[6], u[7]);
|
||||
for (size_t j=0; j < strlen(s); j++) {
|
||||
symbol_queue.push_back(s[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
next_bit = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Slicer for normalized baseband FSK4
|
||||
*/
|
||||
static inline uint8_t
|
||||
slice (float s) {
|
||||
uint8_t dibit;
|
||||
if(s < -2.0) {
|
||||
dibit = 3;
|
||||
} else if(s < 0.0) {
|
||||
dibit = 2;
|
||||
} else if(s < 2.0) {
|
||||
dibit = 0;
|
||||
} else {
|
||||
dibit = 1;
|
||||
}
|
||||
return dibit;
|
||||
}
|
||||
|
||||
void
|
||||
repeater_imbe_decode_fb::forecast(int nof_output_items, gr_vector_int &nof_input_items_reqd)
|
||||
{
|
||||
/* input rate: 4800, output rate: 1550 (31 * 50) */
|
||||
const size_t nof_inputs = nof_input_items_reqd.size();
|
||||
const int nof_samples_reqd = 3.1 * nof_output_items;
|
||||
std::fill(&nof_input_items_reqd[0], &nof_input_items_reqd[nof_inputs], nof_samples_reqd);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
repeater_imbe_decode_fb::general_work (int noutput_items,
|
||||
gr_vector_int &ninput_items,
|
||||
gr_vector_const_void_star &input_items,
|
||||
gr_vector_void_star &output_items)
|
||||
{
|
||||
|
||||
const float *in = (const float *) input_items[0];
|
||||
unsigned char *out = (unsigned char *) output_items[0];
|
||||
|
||||
for (int i = 0; i < noutput_items; i++){
|
||||
rx_sym(slice(in[i]) ^ reverse_p);
|
||||
}
|
||||
int amt_produce = 0;
|
||||
amt_produce = noutput_items;
|
||||
if (amt_produce > (int)symbol_queue.size())
|
||||
amt_produce = symbol_queue.size();
|
||||
if (amt_produce > 0) {
|
||||
copy(symbol_queue.begin(), symbol_queue.begin() + amt_produce, out);
|
||||
symbol_queue.erase(symbol_queue.begin(), symbol_queue.begin() + amt_produce);
|
||||
}
|
||||
// printf ("work: ninp[0]: %d nout: %d size %d produce: %d surplus %d\n", ninput_items[0], noutput_items, symbol_queue.size(), amt_produce, surplus);
|
||||
consume_each(noutput_items);
|
||||
// Tell runtime system how many output items we produced.
|
||||
return amt_produce;
|
||||
}
|
|
@ -0,0 +1,100 @@
|
|||
/* -*- c++ -*- */
|
||||
/*
|
||||
* Copyright 2004 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of GNU Radio
|
||||
*
|
||||
* GNU Radio 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.
|
||||
*
|
||||
* GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#ifndef INCLUDED_REPEATER_IMBE_DECODE_H
|
||||
#define INCLUDED_REPEATER_IMBE_DECODE_H
|
||||
|
||||
#include <gr_sync_block.h>
|
||||
#include <deque>
|
||||
|
||||
class repeater_imbe_decode_fb;
|
||||
|
||||
/*
|
||||
* We use boost::shared_ptr's instead of raw pointers for all access
|
||||
* to gr_blocks (and many other data structures). The shared_ptr gets
|
||||
* us transparent reference counting, which greatly simplifies storage
|
||||
* management issues. This is especially helpful in our hybrid
|
||||
* C++ / Python system.
|
||||
*
|
||||
* See http://www.boost.org/libs/smart_ptr/smart_ptr.htm
|
||||
*
|
||||
* As a convention, the _sptr suffix indicates a boost::shared_ptr
|
||||
*/
|
||||
typedef boost::shared_ptr<repeater_imbe_decode_fb> repeater_imbe_decode_fb_sptr;
|
||||
typedef std::deque<uint8_t> dibit_queue;
|
||||
|
||||
/*!
|
||||
* \brief Return a shared_ptr to a new instance of repeater_imbe_decode_fb.
|
||||
*
|
||||
* To avoid accidental use of raw pointers, repeater_imbe_decode_fb's
|
||||
* constructor is private. repeater_make_imbe_decode_fb is the public
|
||||
* interface for creating new instances.
|
||||
*/
|
||||
repeater_imbe_decode_fb_sptr repeater_make_imbe_decode_fb ();
|
||||
|
||||
/*!
|
||||
* \brief produce a stream of dibits, given a stream of floats in [-3,-1,1,3]
|
||||
* \ingroup block
|
||||
*
|
||||
* This uses the preferred technique: subclassing gr_sync_block.
|
||||
*/
|
||||
|
||||
class repeater_imbe_decode_fb : public gr_block
|
||||
{
|
||||
private:
|
||||
// The friend declaration allows repeater_make_imbe_decode_fb to
|
||||
// access the private constructor.
|
||||
|
||||
friend repeater_imbe_decode_fb_sptr repeater_make_imbe_decode_fb ();
|
||||
|
||||
repeater_imbe_decode_fb (); // private constructor
|
||||
// internal functions
|
||||
typedef std::vector<bool> bit_vector;
|
||||
bool header_codeword(uint64_t acc, uint32_t& nac, uint32_t& duid);
|
||||
void proc_voice_unit(bit_vector& frame_body) ;
|
||||
void rx_sym(uint8_t dibit) ;
|
||||
// internal instance variables and state
|
||||
int reverse_p;
|
||||
int hdr_syms;
|
||||
uint32_t next_bit;
|
||||
uint64_t hdr_word;
|
||||
bit_vector frame_body;
|
||||
dibit_queue symbol_queue;
|
||||
|
||||
uint64_t header_accum;
|
||||
uint32_t nac;
|
||||
uint32_t duid;
|
||||
uint32_t frame_size_limit;
|
||||
|
||||
public:
|
||||
virtual void forecast(int nof_output_items, gr_vector_int &nof_input_items_reqd);
|
||||
~repeater_imbe_decode_fb (); // public destructor
|
||||
|
||||
// Where all the action really happens
|
||||
|
||||
int general_work (int noutput_items,
|
||||
gr_vector_int &ninput_items,
|
||||
gr_vector_const_void_star &input_items,
|
||||
gr_vector_void_star &output_items);
|
||||
|
||||
};
|
||||
|
||||
#endif /* INCLUDED_REPEATER_IMBE_DECODE_H */
|
|
@ -0,0 +1,330 @@
|
|||
/* -*- c++ -*- */
|
||||
/*
|
||||
* Copyright 2004 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of GNU Radio
|
||||
*
|
||||
* GNU Radio 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.
|
||||
*
|
||||
* GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* config.h is generated by configure. It contains the results
|
||||
* of probing for features, options etc. It should be the first
|
||||
* file included in your .cc file.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <repeater_p25_frame_fb.h>
|
||||
#include <gr_io_signature.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <vector>
|
||||
#include <bch.h>
|
||||
#include <op25_imbe_frame.h>
|
||||
#include <op25_p25_frame.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
/*
|
||||
* Create a new instance of repeater_p25_frame_fb and return
|
||||
* a boost shared_ptr. This is effectively the public constructor.
|
||||
*/
|
||||
repeater_p25_frame_fb_sptr
|
||||
repeater_make_p25_frame_fb ()
|
||||
{
|
||||
return repeater_p25_frame_fb_sptr (new repeater_p25_frame_fb ());
|
||||
}
|
||||
|
||||
/*
|
||||
* Specify constraints on number of input and output streams.
|
||||
* This info is used to construct the input and output signatures
|
||||
* (2nd & 3rd args to gr_block's constructor). The input and
|
||||
* output signatures are used by the runtime system to
|
||||
* check that a valid number and type of inputs and outputs
|
||||
* are connected to this block. In this case, we accept
|
||||
* only 1 input and 1 output.
|
||||
*/
|
||||
static const int MIN_IN = 1; // mininum number of input streams
|
||||
static const int MAX_IN = 1; // maximum number of input streams
|
||||
static const int MIN_OUT = 1; // minimum number of output streams
|
||||
static const int MAX_OUT = 1; // maximum number of output streams
|
||||
|
||||
/*
|
||||
* The private constructor
|
||||
*/
|
||||
repeater_p25_frame_fb::repeater_p25_frame_fb ()
|
||||
: gr_block ("p25_frame_fb",
|
||||
gr_make_io_signature (MIN_IN, MAX_IN, sizeof (float)),
|
||||
gr_make_io_signature (MIN_OUT, MAX_OUT, sizeof (unsigned char))),
|
||||
reverse_p(0),
|
||||
hdr_syms(0),
|
||||
next_bit(0),
|
||||
frame_body(P25_VOICE_FRAME_SIZE),
|
||||
symbol_queue(),
|
||||
surplus(-864),
|
||||
frame_size_limit(0),
|
||||
last_sym_ct(0),
|
||||
closed_repeater(1),
|
||||
stats_sym_ct(0),
|
||||
stats_bad_bch(0),
|
||||
stats_good_bch(0),
|
||||
stats_bch_errs(0),
|
||||
stats_e0_errs(0),
|
||||
stats_et_errs(0)
|
||||
{
|
||||
set_history(864); // always behind by sizeof(voice data unit)
|
||||
memset(stats_frames_received, 0, sizeof(stats_frames_received));
|
||||
memset(closed_nac_list, 0, sizeof(closed_nac_list));
|
||||
memset(stats_frame_history, 0, sizeof(stats_frame_history));
|
||||
}
|
||||
|
||||
/*
|
||||
* Our virtual destructor.
|
||||
*/
|
||||
repeater_p25_frame_fb::~repeater_p25_frame_fb ()
|
||||
{
|
||||
// nothing else required in this example
|
||||
}
|
||||
|
||||
static const int max_frame_lengths[16] = {
|
||||
792, // 0 - pdu
|
||||
0, 0, // 1, 2 - undef
|
||||
144, // 3 - tdu
|
||||
0, // 4 - undef
|
||||
P25_VOICE_FRAME_SIZE, // 5 - ldu1
|
||||
0, // 6 - undef
|
||||
0, // 7 - tsbk
|
||||
0, // 8 - undef
|
||||
0, // 9 - VSELP "voice PDU"
|
||||
P25_VOICE_FRAME_SIZE, // a - ldu2
|
||||
0, // b - undef
|
||||
0, // c - VSELP "voice PDU"
|
||||
0, 0, // d, e - undef
|
||||
432 // f - tdu
|
||||
};
|
||||
|
||||
/*
|
||||
* Record stats. If received NAC matches a previous entry, use it;
|
||||
* otherwise overlay least-recent non-matching history entry (unless an empty
|
||||
* one exists)
|
||||
*/
|
||||
void repeater_p25_frame_fb::record_frame(uint32_t nac, uint32_t duid) {
|
||||
struct timeval tv;
|
||||
struct timezone tz;
|
||||
time_t t0=0;
|
||||
suseconds_t u0=0;
|
||||
int least_recent = 0;
|
||||
int emptyp = -1;
|
||||
int i;
|
||||
|
||||
stats_frames_received[duid]++;
|
||||
|
||||
gettimeofday(&tv, &tz);
|
||||
for (i=0; i < FRAME_HISTORY_SIZE; i++) {
|
||||
if (stats_frame_history[i].nac == nac) {
|
||||
stats_frame_history[i].sec = tv.tv_sec;
|
||||
stats_frame_history[i].usec = tv.tv_usec;
|
||||
stats_frame_history[i].frame_ctr++;
|
||||
return;
|
||||
}
|
||||
if (stats_frame_history[i].nac == 0) {
|
||||
emptyp = i;
|
||||
}
|
||||
if (t0 == 0 || stats_frame_history[i].sec < t0 ||
|
||||
(stats_frame_history[i].sec == t0 &&
|
||||
stats_frame_history[i].usec < u0)) {
|
||||
t0 = stats_frame_history[i].sec;
|
||||
u0 = stats_frame_history[i].usec;
|
||||
least_recent = i;
|
||||
}
|
||||
}
|
||||
if (emptyp >= 0)
|
||||
i = emptyp;
|
||||
else
|
||||
i = least_recent;
|
||||
stats_frame_history[i].nac = nac;
|
||||
stats_frame_history[i].sec = tv.tv_sec;
|
||||
stats_frame_history[i].usec = tv.tv_usec;
|
||||
stats_frame_history[i].frame_ctr++;
|
||||
}
|
||||
|
||||
/*
|
||||
* Process the 64 bits after the frame sync, which should be the frame header
|
||||
* 1. verify bch and reject if bch cannot be decoded
|
||||
* 2. extract NAC and DUID
|
||||
* Returns false if decode failure, else true
|
||||
*/
|
||||
bool repeater_p25_frame_fb::header_codeword(uint64_t acc, uint32_t& nac, uint32_t& duid) {
|
||||
bit_vector cw(64);
|
||||
bool low = acc & 1;
|
||||
// for bch, split bits into codeword vector
|
||||
for (int i=0; i < 64; i++) {
|
||||
acc >>= 1;
|
||||
cw[i] = acc & 1;
|
||||
}
|
||||
|
||||
// do bch decode
|
||||
int rc = bchDec(cw);
|
||||
|
||||
// check if bch decode unsuccessful
|
||||
if (rc < 0) {
|
||||
stats_bad_bch ++;
|
||||
return false;
|
||||
}
|
||||
stats_good_bch ++;
|
||||
if (rc > 0) {
|
||||
// FIXME: stats_bch_err_counters[rc] ++;
|
||||
stats_bch_errs ++;
|
||||
}
|
||||
|
||||
// load corrected bch bits into acc
|
||||
acc = 0;
|
||||
for (int i=63; i>=0; i--) {
|
||||
acc |= cw[i];
|
||||
acc <<= 1;
|
||||
}
|
||||
acc |= low; // FIXME
|
||||
|
||||
// extract nac and duid
|
||||
nac = (acc >> 52) & 0xfff;
|
||||
duid = (acc >> 48) & 0x00f;
|
||||
hdr_word = acc;
|
||||
record_frame(nac, duid);
|
||||
printf ("nac %x duid %x errs %d sym %llu [%llu]\n", nac, duid, rc, stats_sym_ct, stats_sym_ct - last_sym_ct);
|
||||
last_sym_ct = stats_sym_ct;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void repeater_p25_frame_fb::rebuild_frame(bit_vector& frame_body){
|
||||
if (duid == 0x5 || duid == 0xa) {
|
||||
imbe_regenerate_voice_unit(frame_body);
|
||||
}
|
||||
// FIXME: handle other frame types
|
||||
}
|
||||
|
||||
/*
|
||||
* rx_sym: called once per received symbol
|
||||
* 1. looks for flags sequences
|
||||
* 2. after flags detected (hdr_syms > 0), accumulate 64-bit header word
|
||||
* 3. check for voice frames (ldu1|2)
|
||||
* 4. for ldu1|2 (next_bit > 0), accumulate all 1728 bits in frame
|
||||
* 5. FIXME regenerate all fields in frame (flags, bch, hamming/golay, rs, pn)
|
||||
* 6. place symbols into output symbol queue
|
||||
*/
|
||||
void repeater_p25_frame_fb::rx_sym(uint8_t dibit) {
|
||||
// FIXME assert(dibit >= 0 && dibit <= 3)
|
||||
header_accum <<= 2;
|
||||
header_accum |= dibit;
|
||||
if (hdr_syms == 12) {
|
||||
// ignore status dibit
|
||||
header_accum >>= 2;
|
||||
} else if (hdr_syms >= 33) {
|
||||
// header completely received
|
||||
bool bch_rc = header_codeword(header_accum, nac, duid);
|
||||
// next_bit = 48 + 64 + 2;
|
||||
if (bch_rc) {
|
||||
next_bit = 48 + 64;
|
||||
frame_size_limit = max_frame_lengths[duid];
|
||||
if (frame_size_limit <= next_bit)
|
||||
frame_size_limit = P25_VOICE_FRAME_SIZE;
|
||||
}
|
||||
hdr_syms = 0;
|
||||
}
|
||||
if (hdr_syms)
|
||||
// count symbols in header
|
||||
hdr_syms++;
|
||||
if ((header_accum & P25_FRAME_SYNC_MASK) == P25_FRAME_SYNC_MAGIC) {
|
||||
hdr_syms = 1;
|
||||
}
|
||||
if ((header_accum & P25_FRAME_SYNC_MASK) == P25_FRAME_SYNC_REV_P) {
|
||||
reverse_p = 0x02;
|
||||
hdr_syms = 1;
|
||||
}
|
||||
if (next_bit) {
|
||||
frame_body[next_bit++] = (dibit >> 1) & 1;
|
||||
frame_body[next_bit++] = dibit & 1;
|
||||
}
|
||||
// dispose of received frame (if exists) and:
|
||||
// 1. complete frame is received, or
|
||||
// 2. flags is received
|
||||
if (next_bit && (next_bit >= frame_size_limit || hdr_syms == 1)) {
|
||||
// dump_cw(frame_body, 216, stdout);
|
||||
rebuild_frame(frame_body);
|
||||
p25_setup_frame_header(frame_body, hdr_word);
|
||||
for (uint32_t i = 0; i < next_bit; i += 2) {
|
||||
uint8_t new_dibit = (frame_body[i] << 1) +
|
||||
frame_body[i+1];
|
||||
symbol_queue.push_back(new_dibit);
|
||||
}
|
||||
next_bit = 0;
|
||||
}
|
||||
++stats_sym_ct;
|
||||
}
|
||||
|
||||
/*
|
||||
* Slicer for normalized baseband FSK4
|
||||
*/
|
||||
static inline uint8_t
|
||||
slice (float s) {
|
||||
uint8_t dibit;
|
||||
if(s < -2.0) {
|
||||
dibit = 3;
|
||||
} else if(s < 0.0) {
|
||||
dibit = 2;
|
||||
} else if(s < 2.0) {
|
||||
dibit = 0;
|
||||
} else {
|
||||
dibit = 1;
|
||||
}
|
||||
return dibit;
|
||||
}
|
||||
|
||||
int
|
||||
repeater_p25_frame_fb::general_work (int noutput_items,
|
||||
gr_vector_int &ninput_items,
|
||||
gr_vector_const_void_star &input_items,
|
||||
gr_vector_void_star &output_items)
|
||||
{
|
||||
|
||||
const float *in = (const float *) input_items[0];
|
||||
unsigned char *out = (unsigned char *) output_items[0];
|
||||
|
||||
for (int i = 0; i < noutput_items; i++){
|
||||
rx_sym(slice(in[i]) ^ reverse_p);
|
||||
surplus++;
|
||||
}
|
||||
int amt_produce = 0;
|
||||
if (surplus > 0)
|
||||
amt_produce = surplus;
|
||||
if (amt_produce > noutput_items)
|
||||
amt_produce = noutput_items;
|
||||
if (amt_produce > (int)symbol_queue.size())
|
||||
amt_produce = symbol_queue.size();
|
||||
if (amt_produce > 0) {
|
||||
copy(symbol_queue.begin(), symbol_queue.begin() + amt_produce, out);
|
||||
symbol_queue.erase(symbol_queue.begin(), symbol_queue.begin() + amt_produce);
|
||||
surplus -= amt_produce;
|
||||
}
|
||||
// printf ("work: ninp[0]: %d nout: %d size %d produce: %d surplus %d\n", ninput_items[0], noutput_items, symbol_queue.size(), amt_produce, surplus);
|
||||
consume_each(noutput_items);
|
||||
// Tell runtime system how many output items we produced.
|
||||
return amt_produce;
|
||||
}
|
|
@ -0,0 +1,124 @@
|
|||
/* -*- c++ -*- */
|
||||
/*
|
||||
* Copyright 2004 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of GNU Radio
|
||||
*
|
||||
* GNU Radio 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.
|
||||
*
|
||||
* GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#ifndef INCLUDED_REPEATER_P25_FRAME_H
|
||||
#define INCLUDED_REPEATER_P25_FRAME_H
|
||||
|
||||
#include <gr_sync_block.h>
|
||||
#include <deque>
|
||||
|
||||
class repeater_p25_frame_fb;
|
||||
|
||||
/*
|
||||
* We use boost::shared_ptr's instead of raw pointers for all access
|
||||
* to gr_blocks (and many other data structures). The shared_ptr gets
|
||||
* us transparent reference counting, which greatly simplifies storage
|
||||
* management issues. This is especially helpful in our hybrid
|
||||
* C++ / Python system.
|
||||
*
|
||||
* See http://www.boost.org/libs/smart_ptr/smart_ptr.htm
|
||||
*
|
||||
* As a convention, the _sptr suffix indicates a boost::shared_ptr
|
||||
*/
|
||||
typedef boost::shared_ptr<repeater_p25_frame_fb> repeater_p25_frame_fb_sptr;
|
||||
typedef std::deque<uint8_t> dibit_queue;
|
||||
|
||||
/*!
|
||||
* \brief Return a shared_ptr to a new instance of repeater_p25_frame_fb.
|
||||
*
|
||||
* To avoid accidental use of raw pointers, repeater_p25_frame_fb's
|
||||
* constructor is private. repeater_make_p25_frame_fb is the public
|
||||
* interface for creating new instances.
|
||||
*/
|
||||
repeater_p25_frame_fb_sptr repeater_make_p25_frame_fb ();
|
||||
|
||||
/*!
|
||||
* \brief produce a stream of dibits, given a stream of floats in [-3,-1,1,3]
|
||||
* \ingroup block
|
||||
*
|
||||
* This uses the preferred technique: subclassing gr_sync_block.
|
||||
*/
|
||||
|
||||
struct _stats_frame_history {
|
||||
uint32_t nac;
|
||||
time_t sec;
|
||||
suseconds_t usec;
|
||||
uint64_t frame_ctr;
|
||||
};
|
||||
|
||||
static const int FRAME_HISTORY_SIZE=5;
|
||||
static const int MAX_NAC_LIST=5;
|
||||
|
||||
class repeater_p25_frame_fb : public gr_block
|
||||
{
|
||||
private:
|
||||
// The friend declaration allows repeater_make_p25_frame_fb to
|
||||
// access the private constructor.
|
||||
|
||||
friend repeater_p25_frame_fb_sptr repeater_make_p25_frame_fb ();
|
||||
|
||||
repeater_p25_frame_fb (); // private constructor
|
||||
// internal functions
|
||||
typedef std::vector<bool> bit_vector;
|
||||
bool header_codeword(uint64_t acc, uint32_t& nac, uint32_t& duid);
|
||||
void rebuild_frame(bit_vector& frame_body) ;
|
||||
void proc_voice_unit(bit_vector& frame_body) ;
|
||||
void rx_sym(uint8_t dibit) ;
|
||||
void record_frame(uint32_t, uint32_t);
|
||||
// internal instance variables and state
|
||||
int reverse_p;
|
||||
int hdr_syms;
|
||||
uint32_t next_bit;
|
||||
uint64_t hdr_word;
|
||||
bit_vector frame_body;
|
||||
dibit_queue symbol_queue;
|
||||
int32_t surplus;
|
||||
uint64_t header_accum;
|
||||
uint32_t nac;
|
||||
uint32_t duid;
|
||||
uint32_t frame_size_limit;
|
||||
uint64_t last_sym_ct;
|
||||
uint32_t closed_nac_list[MAX_NAC_LIST];
|
||||
bool closed_repeater;
|
||||
|
||||
// stats
|
||||
uint64_t stats_sym_ct;
|
||||
uint64_t stats_bad_bch;
|
||||
uint64_t stats_good_bch;
|
||||
uint64_t stats_bch_errs;
|
||||
uint64_t stats_e0_errs;
|
||||
uint64_t stats_et_errs;
|
||||
uint64_t stats_frames_received[16];
|
||||
struct _stats_frame_history stats_frame_history[FRAME_HISTORY_SIZE];
|
||||
|
||||
public:
|
||||
~repeater_p25_frame_fb (); // public destructor
|
||||
|
||||
// Where all the action really happens
|
||||
|
||||
int general_work (int noutput_items,
|
||||
gr_vector_int &ninput_items,
|
||||
gr_vector_const_void_star &input_items,
|
||||
gr_vector_void_star &output_items);
|
||||
|
||||
};
|
||||
|
||||
#endif /* INCLUDED_REPEATER_P25_FRAME_H */
|
|
@ -0,0 +1,266 @@
|
|||
/* -*- c++ -*- */
|
||||
/*
|
||||
* Copyright 2004 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of GNU Radio
|
||||
*
|
||||
* GNU Radio 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.
|
||||
*
|
||||
* GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* config.h is generated by configure. It contains the results
|
||||
* of probing for features, options etc. It should be the first
|
||||
* file included in your .cc file.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <repeater_pipe.h>
|
||||
#include <gr_io_signature.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
/*
|
||||
* Create a new instance of repeater_pipe and return
|
||||
* a boost shared_ptr. This is effectively the public constructor.
|
||||
*/
|
||||
repeater_pipe_sptr
|
||||
repeater_make_pipe (size_t input_size, size_t output_size, const char* pathname, float io_ratio)
|
||||
{
|
||||
return repeater_pipe_sptr (new repeater_pipe (input_size, output_size, pathname, io_ratio));
|
||||
}
|
||||
|
||||
/*
|
||||
* The private constructor
|
||||
*/
|
||||
repeater_pipe::repeater_pipe (size_t input_size, size_t output_size, const char* pathname, float io_ratio)
|
||||
: gr_block ("pipe",
|
||||
gr_make_io_signature ((input_size>0) ? 1 : 0, (input_size>0) ? 1 : 0, input_size),
|
||||
gr_make_io_signature ((output_size>0) ? 1 : 0, (output_size>0) ? 1 : 0, output_size)),
|
||||
d_pid(0),
|
||||
d_e_in(0),
|
||||
d_e_out(0)
|
||||
{
|
||||
|
||||
d_input_size = input_size;
|
||||
d_output_size = output_size;
|
||||
d_io_ratio = io_ratio;
|
||||
d_pathname = pathname;
|
||||
|
||||
switch(input_size) {
|
||||
case 0:
|
||||
d_e_in = 0;
|
||||
break;
|
||||
case 1:
|
||||
d_e_in = 1;
|
||||
break;
|
||||
case 2:
|
||||
d_e_in = 2;
|
||||
break;
|
||||
case 4:
|
||||
d_e_in = 3;
|
||||
break;
|
||||
case 8:
|
||||
d_e_in = 4;
|
||||
break;
|
||||
default:
|
||||
d_e_in = 0;
|
||||
fprintf(stderr, "error: repeater_pipe: input_size invalid\n");
|
||||
break;
|
||||
}
|
||||
switch(output_size) {
|
||||
case 0:
|
||||
d_e_out = 0;
|
||||
break;
|
||||
case 1:
|
||||
d_e_out = 1;
|
||||
break;
|
||||
case 2:
|
||||
d_e_out = 2;
|
||||
break;
|
||||
case 4:
|
||||
d_e_out = 3;
|
||||
break;
|
||||
case 8:
|
||||
d_e_out = 4;
|
||||
break;
|
||||
default:
|
||||
d_e_out = 0;
|
||||
fprintf(stderr, "error: repeater_pipe: output_size invalid\n");
|
||||
break;
|
||||
}
|
||||
|
||||
// parent writes to fd_in[1], reads from fd_out[0]
|
||||
// child writes to fd_out[1], reads from fd_in[0]
|
||||
if (pipe(pipe_fd_in) == -1) {
|
||||
fprintf(stderr, "pipe: %s\n", strerror(errno));
|
||||
return;
|
||||
}
|
||||
if (pipe(pipe_fd_out) == -1) {
|
||||
fprintf(stderr, "pipe: %s\n", strerror(errno));
|
||||
return;
|
||||
}
|
||||
pid_t pid = fork();
|
||||
if (pid < 0) {
|
||||
fprintf(stderr, "fork: %s\n", strerror(errno));
|
||||
return;
|
||||
} else if (pid == 0) { /* in child */
|
||||
// close unused fd's
|
||||
close(pipe_fd_in[1]);
|
||||
close(pipe_fd_out[0]);
|
||||
|
||||
// setup stdin and stdout for child
|
||||
dup2(pipe_fd_in[0], 0);
|
||||
dup2(pipe_fd_out[1], 1);
|
||||
|
||||
// close duped fd's
|
||||
close(pipe_fd_in[0]);
|
||||
close(pipe_fd_out[1]);
|
||||
|
||||
system(d_pathname);
|
||||
|
||||
exit(0);
|
||||
} /* end of if(in child) */
|
||||
/* in parent */
|
||||
d_pid = pid;
|
||||
|
||||
// close unused fd's
|
||||
close(pipe_fd_in[0]);
|
||||
close(pipe_fd_out[1]);
|
||||
|
||||
if (fcntl(pipe_fd_in[1], F_SETFL, O_NONBLOCK) == -1) {
|
||||
fprintf(stderr, "fcntl: %s\n", strerror(errno));
|
||||
return;
|
||||
}
|
||||
#if 1
|
||||
if (fcntl(pipe_fd_out[0], F_SETFL, O_NONBLOCK) == -1) {
|
||||
fprintf(stderr, "fcntl: %s\n", strerror(errno));
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* Our virtual destructor.
|
||||
*/
|
||||
repeater_pipe::~repeater_pipe ()
|
||||
{
|
||||
if (d_pid)
|
||||
kill (d_pid, SIGTERM);
|
||||
}
|
||||
|
||||
void
|
||||
repeater_pipe::forecast(int nof_output_items, gr_vector_int &nof_input_items_reqd)
|
||||
{
|
||||
const size_t nof_inputs = nof_input_items_reqd.size();
|
||||
// const int nof_samples_reqd = (int)(d_io_ratio * nof_output_items) << 1;
|
||||
const int nof_samples_reqd = d_io_ratio * nof_output_items;
|
||||
std::fill(&nof_input_items_reqd[0], &nof_input_items_reqd[nof_inputs], nof_samples_reqd);
|
||||
// fprintf(stderr, "forecast nout %d nin %d sr %d\n", nof_output_items, nof_inputs, nof_samples_reqd);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
repeater_pipe::general_work (int noutput_items,
|
||||
gr_vector_int &ninput_items,
|
||||
gr_vector_const_void_star &input_items,
|
||||
gr_vector_void_star &output_items)
|
||||
{
|
||||
unsigned char *in;
|
||||
unsigned char *out;
|
||||
if (d_input_size > 0)
|
||||
in = (unsigned char *) input_items[0];
|
||||
if (d_output_size > 0)
|
||||
out = (unsigned char *) output_items[0];
|
||||
static const unsigned int e_masks[] = {0, 1, 3, 0xf, 0xff};
|
||||
static int tot1=0;
|
||||
static int tot2=0;
|
||||
struct timeval tv;
|
||||
struct timezone tz;
|
||||
gettimeofday(&tv, &tz);
|
||||
#define min(a,b) ((a<b)?a:b)
|
||||
// fprintf(stderr, "nout %d, nin[0] %d\n", noutput_items, ninput_items[0]);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// first, handle parent write from gr's source to child's stdin
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
size_t amt = noutput_items * d_input_size;
|
||||
amt = min(amt, 512);
|
||||
amt = ((tot1 - tot2) > 512) ? 0 : amt;
|
||||
if (amt > 0) {
|
||||
int rc = write(pipe_fd_in[1], in, amt);
|
||||
if (rc < 0 && errno != EAGAIN) {
|
||||
fprintf(stderr, "write: %d: %s\n", errno, strerror(errno));
|
||||
}
|
||||
if (rc > 0) {
|
||||
// FIXME: handle if amt actually written not exact multiple of size
|
||||
// if not, for size 2, 4, or 8, bytewise alignment would be lost
|
||||
// if(rc & e_masks[d_e_in] != 0)
|
||||
fprintf(stderr, "%d amt %d rc %d d_e_in %d mask %x t1 %d t2 %d nin0 %d\n", (int)tv.tv_usec, amt, rc, d_e_in, e_masks[d_e_in], tot1, tot2, ninput_items[0]);
|
||||
|
||||
// Tell runtime system how many input items we consumed on
|
||||
// each input stream.
|
||||
|
||||
consume_each(rc >> (d_e_in - 1));
|
||||
tot1 += rc;
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// do parent read from child's stdout to gr's sink
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
amt = noutput_items * d_output_size;
|
||||
#if 1
|
||||
size_t read_amt=0;
|
||||
if (ioctl(pipe_fd_out[0], FIONREAD, &read_amt) == -1) {
|
||||
fprintf(stderr, "ioctl: %s\n", strerror(errno));
|
||||
return 0;
|
||||
}
|
||||
// fprintf(stderr, "%d read_amt: %d noutput %d\n", (int)tv.tv_usec, read_amt, noutput_items);
|
||||
amt = min(amt, read_amt);
|
||||
#endif
|
||||
if (amt > 0) {
|
||||
int rc = read(pipe_fd_out[0], out, amt);
|
||||
if (rc < 0 && errno != EAGAIN)
|
||||
fprintf(stderr, "read: %s\n", strerror(errno));
|
||||
if (rc < 0)
|
||||
return 0;
|
||||
else if (rc == 0) { /* if EOF */
|
||||
fprintf(stderr, "tot1 %d tot2 %d\n", tot1, tot2);
|
||||
return 0;
|
||||
}
|
||||
// FIXME: check that amt is exact multiple of size
|
||||
// if not, for size 2, 4, or 8, bytewise alignment would be lost
|
||||
// if (rc & e_masks[d_e_out] != 0)
|
||||
fprintf(stderr, "%d amt %d rc %d d_e_out %d mask %x t1 %d t2 %d\n", (int)tv.tv_usec, amt, rc, d_e_in, e_masks[d_e_in], tot1, tot2);
|
||||
tot2 += rc;
|
||||
return rc >> (d_e_out - 1);
|
||||
}
|
||||
|
||||
// Tell runtime system how many output items we produced.
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,91 @@
|
|||
/* -*- c++ -*- */
|
||||
/*
|
||||
* Copyright 2004 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of GNU Radio
|
||||
*
|
||||
* GNU Radio 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.
|
||||
*
|
||||
* GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#ifndef INCLUDED_REPEATER_PIPE_H
|
||||
#define INCLUDED_REPEATER_PIPE_H
|
||||
|
||||
#include <gr_sync_block.h>
|
||||
|
||||
class repeater_pipe;
|
||||
|
||||
/*
|
||||
* We use boost::shared_ptr's instead of raw pointers for all access
|
||||
* to gr_blocks (and many other data structures). The shared_ptr gets
|
||||
* us transparent reference counting, which greatly simplifies storage
|
||||
* management issues. This is especially helpful in our hybrid
|
||||
* C++ / Python system.
|
||||
*
|
||||
* See http://www.boost.org/libs/smart_ptr/smart_ptr.htm
|
||||
*
|
||||
* As a convention, the _sptr suffix indicates a boost::shared_ptr
|
||||
*/
|
||||
typedef boost::shared_ptr<repeater_pipe> repeater_pipe_sptr;
|
||||
|
||||
/*!
|
||||
* \brief Return a shared_ptr to a new instance of repeater_pipe.
|
||||
*
|
||||
* To avoid accidental use of raw pointers, repeater_pipe's
|
||||
* constructor is private. repeater_make_pipe is the public
|
||||
* interface for creating new instances.
|
||||
*/
|
||||
repeater_pipe_sptr repeater_make_pipe (size_t input_size, size_t output_size, const char* pathname, float io_ratio);
|
||||
|
||||
/*!
|
||||
* \brief plumbing: OS interface
|
||||
* \ingroup block
|
||||
*
|
||||
* This uses the preferred technique: subclassing gr_sync_block.
|
||||
*/
|
||||
|
||||
class repeater_pipe : public gr_block
|
||||
{
|
||||
private:
|
||||
// The friend declaration allows repeater_make_pipe to
|
||||
// access the private constructor.
|
||||
|
||||
friend repeater_pipe_sptr repeater_make_pipe (size_t input_size, size_t output_size, const char* pathname, float io_ratio);
|
||||
|
||||
repeater_pipe (size_t input_size, size_t output_size, const char* pathname, float io_ratio); // private constructor
|
||||
|
||||
size_t d_input_size;
|
||||
size_t d_output_size;
|
||||
float d_io_ratio;
|
||||
const char* d_pathname;
|
||||
pid_t d_pid;
|
||||
int pipe_fd_in[2];
|
||||
int pipe_fd_out[2];
|
||||
int d_e_in;
|
||||
int d_e_out;
|
||||
|
||||
public:
|
||||
virtual void forecast(int nof_output_items, gr_vector_int &nof_input_items_reqd);
|
||||
~repeater_pipe (); // public destructor
|
||||
|
||||
// Where all the action really happens
|
||||
|
||||
int general_work (int noutput_items,
|
||||
gr_vector_int &ninput_items,
|
||||
gr_vector_const_void_star &input_items,
|
||||
gr_vector_void_star &output_items);
|
||||
|
||||
};
|
||||
|
||||
#endif /* INCLUDED_REPEATER_PIPE_H */
|
|
@ -0,0 +1,93 @@
|
|||
/* -*- c++ -*- */
|
||||
/*
|
||||
* Copyright 2004,2006 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of GNU Radio
|
||||
*
|
||||
* GNU Radio 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, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <repeater_squelch_base_ff.h>
|
||||
#include <gr_io_signature.h>
|
||||
|
||||
repeater_squelch_base_ff::repeater_squelch_base_ff(const char *name, int ramp, bool gate) :
|
||||
gr_block(name,
|
||||
gr_make_io_signature(1, 1, sizeof(float)),
|
||||
gr_make_io_signature(1, 1, sizeof(float)))
|
||||
{
|
||||
set_ramp(ramp);
|
||||
set_gate(gate);
|
||||
d_state = ST_MUTED;
|
||||
d_envelope = d_ramp ? 0.0 : 1.0;
|
||||
d_ramped = 0;
|
||||
}
|
||||
|
||||
int repeater_squelch_base_ff::general_work(int noutput_items,
|
||||
gr_vector_int &ninput_items,
|
||||
gr_vector_const_void_star &input_items,
|
||||
gr_vector_void_star &output_items)
|
||||
{
|
||||
const float *in = (const float *) input_items[0];
|
||||
float *out = (float *) output_items[0];
|
||||
|
||||
int j = 0;
|
||||
|
||||
for (int i = 0; i < noutput_items; i++) {
|
||||
update_state(in[i]);
|
||||
|
||||
// Adjust envelope based on current state
|
||||
switch(d_state) {
|
||||
case ST_MUTED:
|
||||
if (!mute())
|
||||
d_state = d_ramp ? ST_ATTACK : ST_UNMUTED; // If not ramping, go straight to unmuted
|
||||
break;
|
||||
|
||||
case ST_UNMUTED:
|
||||
if (mute())
|
||||
d_state = d_ramp ? ST_DECAY : ST_MUTED; // If not ramping, go straight to muted
|
||||
break;
|
||||
|
||||
case ST_ATTACK:
|
||||
d_envelope = 0.5-std::cos(M_PI*(++d_ramped)/d_ramp)/2.0; // FIXME: precalculate window for speed
|
||||
if (d_ramped >= d_ramp) { // use >= in case d_ramp is set to lower value elsewhere
|
||||
d_state = ST_UNMUTED;
|
||||
d_envelope = 1.0;
|
||||
}
|
||||
break;
|
||||
|
||||
case ST_DECAY:
|
||||
d_envelope = 0.5-std::cos(M_PI*(--d_ramped)/d_ramp)/2.0; // FIXME: precalculate window for speed
|
||||
if (d_ramped == 0.0)
|
||||
d_state = ST_MUTED;
|
||||
break;
|
||||
};
|
||||
|
||||
// If unmuted, copy input times envelope to output
|
||||
// Otherwise, if not gating, copy zero to output
|
||||
if (d_state != ST_MUTED)
|
||||
out[j++] = in[i]*d_envelope;
|
||||
else
|
||||
if (!d_gate)
|
||||
out[j++] = 0.0;
|
||||
}
|
||||
|
||||
consume_each(noutput_items); // Use all the inputs
|
||||
return j; // But only report outputs copied
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
/* -*- c++ -*- */
|
||||
/*
|
||||
* Copyright 2006 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of GNU Radio
|
||||
*
|
||||
* GNU Radio 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, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_REPEATER_SQUELCH_BASE_FF_H
|
||||
#define INCLUDED_REPEATER_SQUELCH_BASE_FF_H
|
||||
|
||||
#include <gr_block.h>
|
||||
|
||||
class repeater_squelch_base_ff : public gr_block
|
||||
{
|
||||
private:
|
||||
int d_ramp;
|
||||
int d_ramped;
|
||||
bool d_gate;
|
||||
double d_envelope;
|
||||
enum { ST_MUTED, ST_ATTACK, ST_UNMUTED, ST_DECAY } d_state;
|
||||
|
||||
protected:
|
||||
virtual void update_state(const float &sample) {};
|
||||
virtual bool mute() const { return false; };
|
||||
|
||||
public:
|
||||
repeater_squelch_base_ff(const char *name, int ramp, bool gate);
|
||||
|
||||
int ramp() const { return d_ramp; }
|
||||
void set_ramp(int ramp) { d_ramp = ramp; }
|
||||
bool gate() const { return d_gate; }
|
||||
void set_gate(bool gate) { d_gate = gate; }
|
||||
bool unmuted() const { return (d_state == ST_UNMUTED || d_state == ST_ATTACK); }
|
||||
|
||||
virtual std::vector<float> squelch_range() const = 0;
|
||||
|
||||
int general_work (int noutput_items,
|
||||
gr_vector_int &ninput_items,
|
||||
gr_vector_const_void_star &input_items,
|
||||
gr_vector_void_star &output_items);
|
||||
};
|
||||
|
||||
#endif /* INCLUDED_REPEATER_SQUELCH_BASE_FF_H */
|
|
@ -0,0 +1,32 @@
|
|||
#
|
||||
# Copyright 2004 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is part of GNU Radio
|
||||
#
|
||||
# GNU Radio 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.
|
||||
#
|
||||
# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
|
||||
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
# Boston, MA 02111-1307, USA.
|
||||
#
|
||||
|
||||
include $(top_srcdir)/Makefile.common
|
||||
|
||||
EXTRA_DIST = run_tests.in
|
||||
|
||||
|
||||
TESTS = \
|
||||
run_tests
|
||||
|
||||
|
||||
noinst_PYTHON = \
|
||||
qa_repeater.py
|
|
@ -0,0 +1,47 @@
|
|||
#!/usr/bin/env python
|
||||
#
|
||||
# Copyright 2004 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is part of GNU Radio
|
||||
#
|
||||
# GNU Radio 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.
|
||||
#
|
||||
# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
|
||||
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
# Boston, MA 02111-1307, USA.
|
||||
#
|
||||
|
||||
from gnuradio import gr, gr_unittest
|
||||
import repeater
|
||||
|
||||
class qa_repeater (gr_unittest.TestCase):
|
||||
|
||||
def setUp (self):
|
||||
self.fg = gr.top_block ()
|
||||
|
||||
def tearDown (self):
|
||||
self.fg = None
|
||||
|
||||
def test_001_slice (self):
|
||||
src_data = (-3, -1, 1, 3)
|
||||
expected_result = (3, 2, 0, 1)
|
||||
src = gr.vector_source_f (src_data)
|
||||
slicer = repeater.fsk4_slicer_fb ()
|
||||
dst = gr.vector_sink_b ()
|
||||
self.fg.connect (src, slicer)
|
||||
self.fg.connect (slicer, dst)
|
||||
self.fg.run ()
|
||||
result_data = dst.data ()
|
||||
self.assertFloatTuplesAlmostEqual (expected_result, result_data, 4)
|
||||
|
||||
if __name__ == '__main__':
|
||||
gr_unittest.main ()
|
|
@ -0,0 +1,50 @@
|
|||
#!/bin/sh
|
||||
|
||||
# All this strange PYTHONPATH manipulation is required to run our
|
||||
# tests using our just built shared library and swig-generated python
|
||||
# code prior to installation.
|
||||
|
||||
# build tree == src tree unless you're doing a VPATH build.
|
||||
# If you don't know what a VPATH build is, you're not doing one. Relax...
|
||||
|
||||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
|
||||
# Where to look in the build tree for our shared library
|
||||
libbld=@abs_top_builddir@/src/lib
|
||||
# Where to look in the src tree for swig generated python code
|
||||
libsrc=@abs_top_srcdir@/src/lib
|
||||
# Where to look in the src tree for hand written python code
|
||||
py=@abs_top_srcdir@/src/python
|
||||
|
||||
# Where to look for installed GNU Radio python modules
|
||||
# FIXME this is wrong on a distcheck. We really need to ask gnuradio-core
|
||||
# where it put its python files.
|
||||
installed_pythondir=@pythondir@
|
||||
installed_pyexecdir=@pyexecdir@
|
||||
|
||||
PYTHONPATH="$libbld:$libbld/.libs:$libsrc:$py:$installed_pythondir:$installed_pyexecdir:$PYTHONPATH"
|
||||
#PYTHONPATH="$libbld:$libbld/.libs:$libsrc:$py:$installed_pythondir:$installed_pyexecdir"
|
||||
|
||||
export PYTHONPATH
|
||||
|
||||
#
|
||||
# This is the simple part...
|
||||
# Run everything that matches qa_*.py and return the final result.
|
||||
#
|
||||
|
||||
ok=yes
|
||||
for file in @srcdir@/qa_*.py
|
||||
do
|
||||
if ! $file
|
||||
then
|
||||
ok=no
|
||||
fi
|
||||
done
|
||||
|
||||
if [ $ok = yes ]
|
||||
then
|
||||
exit 0
|
||||
else
|
||||
exit 1
|
||||
fi
|
Reference in New Issue