diff options
author | Timothy Pearson <[email protected]> | 2013-07-24 11:29:03 -0500 |
---|---|---|
committer | Timothy Pearson <[email protected]> | 2013-07-24 11:29:03 -0500 |
commit | 066bae76e94c21604fe4132c4ca26e5b2f0c6375 (patch) | |
tree | 64cd6638d6f513ef8ddb094f9437467c0a810d86 | |
download | knmap-066bae76e94c21604fe4132c4ca26e5b2f0c6375.tar.gz knmap-066bae76e94c21604fe4132c4ca26e5b2f0c6375.zip |
Initial import of knmap 2.1 sources
119 files changed, 24006 insertions, 0 deletions
@@ -0,0 +1 @@ +Kevin Gilbert <[email protected]> @@ -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) <year> <name of author> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 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) year 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. diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..fa31f39 --- /dev/null +++ b/ChangeLog @@ -0,0 +1,36 @@ +2.1 +=== + +* If root-only options are selected by a 'normal' user, + the 'kdesu' facility is envoked to run nmap as root + +* Previously all nmap output was "wrapped", this is now + an option. The default is to wrap long lines. + +2.0 +=== + +* Minor syntax corrections +* No major changes since 2.0-beta-1 + +2.0-beta-1 +========== + +* Added support for multiple concurrent scans + +1.0 +=== + +* Added support for the "-6" and "-A' nmap options + +* Changes to the docbook documentation for the "-6" + and "-A" option support and other small changes. + +1.0-beta-1 +========== + +* This is a completely new program! + + There was a prior Knmap - the last version was 0.9 + but that version does not compile under the current + Qt / KDE environments. @@ -0,0 +1,178 @@ +For the impatient +================= + + ./configure + make + make install + + Dont blame me if your impatience f**ks up your machine. But +please email me with your tale of woe. I always enjoy a good belly +laugh! ;) + +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, a file +`config.cache' that saves the results of its tests to speed up +reconfiguring, and a file `config.log' containing compiler output +(useful mainly for debugging `configure'). + + 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 at some point `config.cache' +contains results you don't want to keep, you may remove or edit it. + + The file `configure.in' is used to create `configure' by a program +called `autoconf'. You only need `configure.in' 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 a while. While running, it prints some + messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Type `make install' to install the programs and any data files and + documentation. + + 4. You can remove the program binaries and object files from the + source code directory by typing `make clean'. + +Compilers and Options +===================== + + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. You can give `configure' +initial values for variables by setting them in the environment. Using +a Bourne-compatible shell, you can do that on the command line like +this: + CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure + +Or on systems that have the `env' program, you can do it like this: + env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure + +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 supports 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. + + 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' can not figure out +automatically, but needs to determine by the type of host the package +will run on. Usually `configure' can figure that out, but if it prints +a message saying it can not guess the host type, give it the +`--host=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name with three fields: + CPU-COMPANY-SYSTEM + +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 host type. + + If you are building compiler tools for cross-compiling, you can also +use the `--target=TYPE' option to select the type of system they will +produce code for and the `--build=TYPE' option to select the type of +system on which you are compiling the package. + +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. + +Operation Controls +================== + + `configure' recognizes the following options to control how it +operates. + +`--cache-file=FILE' + Use and save the results of the tests in FILE instead of + `./config.cache'. Set FILE to `/dev/null' to disable caching, for + debugging `configure'. + +`--help' + Print a summary of the options to `configure', and exit. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`--version' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`configure' also accepts some other, not widely useful, options. + diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..8a2284f --- /dev/null +++ b/Makefile.am @@ -0,0 +1,22 @@ +SUBDIRS = $(TOPSUBDIRS) + +$(top_srcdir)/configure.in: configure.in.in $(top_srcdir)/subdirs + cd $(top_srcdir) && $(MAKE) -f admin/Makefile.common configure.in ; + +$(top_srcdir)/subdirs: + cd $(top_srcdir) && $(MAKE) -f admin/Makefile.common subdirs + +$(top_srcdir)/acinclude.m4: $(top_srcdir)/admin/acinclude.m4.in $(top_srcdir)/admin/libtool.m4.in + @cd $(top_srcdir) && cat admin/acinclude.m4.in admin/libtool.m4.in > acinclude.m4 + +MAINTAINERCLEANFILES = subdirs configure.in acinclude.m4 configure.files + +package-messages: + cd $(top_srcdir) && $(MAKE) -f admin/Makefile.common package-messages + $(MAKE) -C po merge + +EXTRA_DIST = admin COPYING configure.in.in + +dist-hook: + cd $(top_distdir) && perl admin/am_edit -padmin + cd $(top_distdir) && $(MAKE) -f admin/Makefile.common subdirs diff --git a/Makefile.cvs b/Makefile.cvs new file mode 100644 index 0000000..4c0afd1 --- /dev/null +++ b/Makefile.cvs @@ -0,0 +1,10 @@ +all: + @echo "This Makefile is only for the CVS repository" + @echo "This will be deleted before making the distribution" + @echo "" + $(MAKE) -f admin/Makefile.common cvs + +dist: + $(MAKE) -f admin/Makefile.common dist + +.SILENT: @@ -0,0 +1,4 @@ +If you've got time to read this file you've got +too much time on your hands. + +Go get a life! diff --git a/acinclude.m4 b/acinclude.m4 new file mode 100644 index 0000000..4f122d7 --- /dev/null +++ b/acinclude.m4 @@ -0,0 +1,11207 @@ +## -*- autoconf -*- + +dnl This file is part of the KDE libraries/packages +dnl Copyright (C) 1997 Janos Farkas ([email protected]) +dnl (C) 1997,98,99 Stephan Kulow ([email protected]) + +dnl This file is free software; you can redistribute it and/or +dnl modify it under the terms of the GNU Library General Public +dnl License as published by the Free Software Foundation; either +dnl version 2 of the License, or (at your option) any later version. + +dnl This library 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 GNU +dnl Library General Public License for more details. + +dnl You should have received a copy of the GNU Library General Public License +dnl along with this library; see the file COPYING.LIB. If not, write to +dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +dnl Boston, MA 02111-1307, USA. + +dnl IMPORTANT NOTE: +dnl Please do not modify this file unless you expect your modifications to be +dnl carried into every other module in the repository. +dnl +dnl Single-module modifications are best placed in configure.in for kdelibs +dnl and kdebase or configure.in.in if present. + +# KDE_PATH_X_DIRECT +dnl Internal subroutine of AC_PATH_X. +dnl Set ac_x_includes and/or ac_x_libraries. +AC_DEFUN([KDE_PATH_X_DIRECT], +[ +AC_REQUIRE([KDE_CHECK_LIB64]) + +if test "$ac_x_includes" = NO; then + # Guess where to find include files, by looking for this one X11 .h file. + test -z "$x_direct_test_include" && x_direct_test_include=X11/Intrinsic.h + + # First, try using that file with no special directory specified. +AC_TRY_CPP([#include <$x_direct_test_include>], +[# We can compile using X headers with no special include directory. +ac_x_includes=], +[# Look for the header file in a standard set of common directories. +# Check X11 before X11Rn because it is often a symlink to the current release. + for ac_dir in \ + /usr/X11/include \ + /usr/X11R6/include \ + /usr/X11R5/include \ + /usr/X11R4/include \ + \ + /usr/include/X11 \ + /usr/include/X11R6 \ + /usr/include/X11R5 \ + /usr/include/X11R4 \ + \ + /usr/local/X11/include \ + /usr/local/X11R6/include \ + /usr/local/X11R5/include \ + /usr/local/X11R4/include \ + \ + /usr/local/include/X11 \ + /usr/local/include/X11R6 \ + /usr/local/include/X11R5 \ + /usr/local/include/X11R4 \ + \ + /usr/X386/include \ + /usr/x386/include \ + /usr/XFree86/include/X11 \ + \ + /usr/include \ + /usr/local/include \ + /usr/unsupported/include \ + /usr/athena/include \ + /usr/local/x11r5/include \ + /usr/lpp/Xamples/include \ + \ + /usr/openwin/include \ + /usr/openwin/share/include \ + ; \ + do + if test -r "$ac_dir/$x_direct_test_include"; then + ac_x_includes=$ac_dir + break + fi + done]) +fi # $ac_x_includes = NO + +if test "$ac_x_libraries" = NO; then + # Check for the libraries. + + test -z "$x_direct_test_library" && x_direct_test_library=Xt + test -z "$x_direct_test_function" && x_direct_test_function=XtMalloc + + # See if we find them without any special options. + # Don't add to $LIBS permanently. + ac_save_LIBS="$LIBS" + LIBS="-l$x_direct_test_library $LIBS" +AC_TRY_LINK(, [${x_direct_test_function}()], +[LIBS="$ac_save_LIBS" +# We can link X programs with no special library path. +ac_x_libraries=], +[LIBS="$ac_save_LIBS" +# First see if replacing the include by lib works. +# Check X11 before X11Rn because it is often a symlink to the current release. +for ac_dir in `echo "$ac_x_includes" | sed s/include/lib${kdelibsuff}/` \ + /usr/X11/lib${kdelibsuff} \ + /usr/X11R6/lib${kdelibsuff} \ + /usr/X11R5/lib${kdelibsuff} \ + /usr/X11R4/lib${kdelibsuff} \ + \ + /usr/lib${kdelibsuff}/X11 \ + /usr/lib${kdelibsuff}/X11R6 \ + /usr/lib${kdelibsuff}/X11R5 \ + /usr/lib${kdelibsuff}/X11R4 \ + \ + /usr/local/X11/lib${kdelibsuff} \ + /usr/local/X11R6/lib${kdelibsuff} \ + /usr/local/X11R5/lib${kdelibsuff} \ + /usr/local/X11R4/lib${kdelibsuff} \ + \ + /usr/local/lib${kdelibsuff}/X11 \ + /usr/local/lib${kdelibsuff}/X11R6 \ + /usr/local/lib${kdelibsuff}/X11R5 \ + /usr/local/lib${kdelibsuff}/X11R4 \ + \ + /usr/X386/lib${kdelibsuff} \ + /usr/x386/lib${kdelibsuff} \ + /usr/XFree86/lib${kdelibsuff}/X11 \ + \ + /usr/lib${kdelibsuff} \ + /usr/local/lib${kdelibsuff} \ + /usr/unsupported/lib${kdelibsuff} \ + /usr/athena/lib${kdelibsuff} \ + /usr/local/x11r5/lib${kdelibsuff} \ + /usr/lpp/Xamples/lib${kdelibsuff} \ + /lib/usr/lib${kdelibsuff}/X11 \ + \ + /usr/openwin/lib${kdelibsuff} \ + /usr/openwin/share/lib${kdelibsuff} \ + ; \ +do +dnl Don't even attempt the hair of trying to link an X program! + for ac_extension in a so sl; do + if test -r $ac_dir/lib${x_direct_test_library}.$ac_extension; then + ac_x_libraries=$ac_dir + break 2 + fi + done +done]) +fi # $ac_x_libraries = NO +]) + + +dnl ------------------------------------------------------------------------ +dnl Find a file (or one of more files in a list of dirs) +dnl ------------------------------------------------------------------------ +dnl +AC_DEFUN([AC_FIND_FILE], +[ +$3=NO +for i in $2; +do + for j in $1; + do + echo "configure: __oline__: $i/$j" >&AC_FD_CC + if test -r "$i/$j"; then + echo "taking that" >&AC_FD_CC + $3=$i + break 2 + fi + done +done +]) + +dnl KDE_FIND_PATH(programm-name, variable-name, list of directories, +dnl if-not-found, test-parameter) +AC_DEFUN([KDE_FIND_PATH], +[ + AC_MSG_CHECKING([for $1]) + if test -n "$$2"; then + kde_cv_path="$$2"; + else + kde_cache=`echo $1 | sed 'y%./+-%__p_%'` + + AC_CACHE_VAL(kde_cv_path_$kde_cache, + [ + kde_cv_path="NONE" + dirs="$3" + kde_save_IFS=$IFS + IFS=':' + for dir in $PATH; do + dirs="$dirs $dir" + done + IFS=$kde_save_IFS + + for dir in $dirs; do + if test -x "$dir/$1"; then + if test -n "$5" + then + evalstr="$dir/$1 $5 2>&1 " + if eval $evalstr; then + kde_cv_path="$dir/$1" + break + fi + else + kde_cv_path="$dir/$1" + break + fi + fi + done + + eval "kde_cv_path_$kde_cache=$kde_cv_path" + + ]) + + eval "kde_cv_path=\"`echo '$kde_cv_path_'$kde_cache`\"" + + fi + + if test -z "$kde_cv_path" || test "$kde_cv_path" = NONE; then + AC_MSG_RESULT(not found) + $4 + else + AC_MSG_RESULT($kde_cv_path) + $2=$kde_cv_path + + fi +]) + +AC_DEFUN([KDE_MOC_ERROR_MESSAGE], +[ + AC_MSG_ERROR([No Qt meta object compiler (moc) found! +Please check whether you installed Qt correctly. +You need to have a running moc binary. +configure tried to run $ac_cv_path_moc and the test didn't +succeed. If configure shouldn't have tried this one, set +the environment variable MOC to the right one before running +configure. +]) +]) + +AC_DEFUN([KDE_UIC_ERROR_MESSAGE], +[ + AC_MSG_WARN([No Qt ui compiler (uic) found! +Please check whether you installed Qt correctly. +You need to have a running uic binary. +configure tried to run $ac_cv_path_uic and the test didn't +succeed. If configure shouldn't have tried this one, set +the environment variable UIC to the right one before running +configure. +]) +]) + + +AC_DEFUN([KDE_CHECK_UIC_FLAG], +[ + AC_MSG_CHECKING([whether uic supports -$1 ]) + kde_cache=`echo $1 | sed 'y% .=/+-%____p_%'` + AC_CACHE_VAL(kde_cv_prog_uic_$kde_cache, + [ + cat >conftest.ui <<EOT + <!DOCTYPE UI><UI version="3" stdsetdef="1"></UI> +EOT + ac_uic_testrun="$UIC_PATH -$1 $2 conftest.ui >/dev/null" + if AC_TRY_EVAL(ac_uic_testrun); then + eval "kde_cv_prog_uic_$kde_cache=yes" + else + eval "kde_cv_prog_uic_$kde_cache=no" + fi + rm -f conftest* + ]) + + if eval "test \"`echo '$kde_cv_prog_uic_'$kde_cache`\" = yes"; then + AC_MSG_RESULT([yes]) + : + $3 + else + AC_MSG_RESULT([no]) + : + $4 + fi +]) + + +dnl ------------------------------------------------------------------------ +dnl Find the meta object compiler and the ui compiler in the PATH, +dnl in $QTDIR/bin, and some more usual places +dnl ------------------------------------------------------------------------ +dnl +AC_DEFUN([AC_PATH_QT_MOC_UIC], +[ + AC_REQUIRE([KDE_CHECK_PERL]) + qt_bindirs="" + for dir in $kde_qt_dirs; do + qt_bindirs="$qt_bindirs $dir/bin $dir/src/moc" + done + qt_bindirs="$qt_bindirs /usr/bin /usr/X11R6/bin /usr/local/qt/bin" + if test ! "$ac_qt_bindir" = "NO"; then + qt_bindirs="$ac_qt_bindir $qt_bindirs" + fi + + KDE_FIND_PATH(moc, MOC, [$qt_bindirs], [KDE_MOC_ERROR_MESSAGE]) + if test -z "$UIC_NOT_NEEDED"; then + KDE_FIND_PATH(uic, UIC_PATH, [$qt_bindirs], [UIC_PATH=""]) + if test -z "$UIC_PATH" ; then + KDE_UIC_ERROR_MESSAGE + exit 1 + else + UIC=$UIC_PATH + + if test $kde_qtver = 3; then + KDE_CHECK_UIC_FLAG(L,[/nonexistent],ac_uic_supports_libpath=yes,ac_uic_supports_libpath=no) + KDE_CHECK_UIC_FLAG(nounload,,ac_uic_supports_nounload=yes,ac_uic_supports_nounload=no) + + if test x$ac_uic_supports_libpath = xyes; then + UIC="$UIC -L \$(kde_widgetdir)" + fi + if test x$ac_uic_supports_nounload = xyes; then + UIC="$UIC -nounload" + fi + fi + fi + else + UIC="echo uic not available: " + fi + + AC_SUBST(MOC) + AC_SUBST(UIC) + + UIC_TR="i18n" + if test $kde_qtver = 3; then + UIC_TR="tr2i18n" + fi + + AC_SUBST(UIC_TR) +]) + +AC_DEFUN([KDE_1_CHECK_PATHS], +[ + KDE_1_CHECK_PATH_HEADERS + + KDE_TEST_RPATH= + + if test -n "$USE_RPATH"; then + + if test -n "$kde_libraries"; then + KDE_TEST_RPATH="-R $kde_libraries" + fi + + if test -n "$qt_libraries"; then + KDE_TEST_RPATH="$KDE_TEST_RPATH -R $qt_libraries" + fi + + if test -n "$x_libraries"; then + KDE_TEST_RPATH="$KDE_TEST_RPATH -R $x_libraries" + fi + + KDE_TEST_RPATH="$KDE_TEST_RPATH $KDE_EXTRA_RPATH" + fi + +AC_MSG_CHECKING([for KDE libraries installed]) +ac_link='$LIBTOOL_SHELL --silent --mode=link ${CXX-g++} -o conftest $CXXFLAGS $all_includes $CPPFLAGS $LDFLAGS $all_libraries conftest.$ac_ext $LIBS -lkdecore $LIBQT $KDE_TEST_RPATH 1>&5' + +if AC_TRY_EVAL(ac_link) && test -s conftest; then + AC_MSG_RESULT(yes) +else + AC_MSG_ERROR([your system fails at linking a small KDE application! +Check, if your compiler is installed correctly and if you have used the +same compiler to compile Qt and kdelibs as you did use now. +For more details about this problem, look at the end of config.log.]) +fi + +if eval `KDEDIR= ./conftest 2>&5`; then + kde_result=done +else + kde_result=problems +fi + +KDEDIR= ./conftest 2> /dev/null >&5 # make an echo for config.log +kde_have_all_paths=yes + +KDE_SET_PATHS($kde_result) + +]) + +AC_DEFUN([KDE_SET_PATHS], +[ + kde_cv_all_paths="kde_have_all_paths=\"yes\" \ + kde_htmldir=\"$kde_htmldir\" \ + kde_appsdir=\"$kde_appsdir\" \ + kde_icondir=\"$kde_icondir\" \ + kde_sounddir=\"$kde_sounddir\" \ + kde_datadir=\"$kde_datadir\" \ + kde_locale=\"$kde_locale\" \ + kde_cgidir=\"$kde_cgidir\" \ + kde_confdir=\"$kde_confdir\" \ + kde_kcfgdir=\"$kde_kcfgdir\" \ + kde_mimedir=\"$kde_mimedir\" \ + kde_toolbardir=\"$kde_toolbardir\" \ + kde_wallpaperdir=\"$kde_wallpaperdir\" \ + kde_templatesdir=\"$kde_templatesdir\" \ + kde_bindir=\"$kde_bindir\" \ + kde_servicesdir=\"$kde_servicesdir\" \ + kde_servicetypesdir=\"$kde_servicetypesdir\" \ + kde_moduledir=\"$kde_moduledir\" \ + kde_styledir=\"$kde_styledir\" \ + kde_widgetdir=\"$kde_widgetdir\" \ + xdg_appsdir=\"$xdg_appsdir\" \ + xdg_menudir=\"$xdg_menudir\" \ + xdg_directorydir=\"$xdg_directorydir\" \ + kde_result=$1" +]) + +AC_DEFUN([KDE_SET_DEFAULT_PATHS], +[ +if test "$1" = "default"; then + + if test -z "$kde_htmldir"; then + kde_htmldir='\${datadir}/doc/HTML' + fi + if test -z "$kde_appsdir"; then + kde_appsdir='\${datadir}/applnk' + fi + if test -z "$kde_icondir"; then + kde_icondir='\${datadir}/icons' + fi + if test -z "$kde_sounddir"; then + kde_sounddir='\${datadir}/sounds' + fi + if test -z "$kde_datadir"; then + kde_datadir='\${datadir}/apps' + fi + if test -z "$kde_locale"; then + kde_locale='\${datadir}/locale' + fi + if test -z "$kde_cgidir"; then + kde_cgidir='\${exec_prefix}/cgi-bin' + fi + if test -z "$kde_confdir"; then + kde_confdir='\${datadir}/config' + fi + if test -z "$kde_kcfgdir"; then + kde_kcfgdir='\${datadir}/config.kcfg' + fi + if test -z "$kde_mimedir"; then + kde_mimedir='\${datadir}/mimelnk' + fi + if test -z "$kde_toolbardir"; then + kde_toolbardir='\${datadir}/toolbar' + fi + if test -z "$kde_wallpaperdir"; then + kde_wallpaperdir='\${datadir}/wallpapers' + fi + if test -z "$kde_templatesdir"; then + kde_templatesdir='\${datadir}/templates' + fi + if test -z "$kde_bindir"; then + kde_bindir='\${exec_prefix}/bin' + fi + if test -z "$kde_servicesdir"; then + kde_servicesdir='\${datadir}/services' + fi + if test -z "$kde_servicetypesdir"; then + kde_servicetypesdir='\${datadir}/servicetypes' + fi + if test -z "$kde_moduledir"; then + if test "$kde_qtver" = "2"; then + kde_moduledir='\${libdir}/kde2' + else + kde_moduledir='\${libdir}/kde3' + fi + fi + if test -z "$kde_styledir"; then + kde_styledir='\${libdir}/kde3/plugins/styles' + fi + if test -z "$kde_widgetdir"; then + kde_widgetdir='\${libdir}/kde3/plugins/designer' + fi + if test -z "$xdg_appsdir"; then + xdg_appsdir='\${datadir}/applications/kde' + fi + if test -z "$xdg_menudir"; then + xdg_menudir='\${sysconfdir}/xdg/menus' + fi + if test -z "$xdg_directorydir"; then + xdg_directorydir='\${datadir}/desktop-directories' + fi + + KDE_SET_PATHS(defaults) + +else + + if test $kde_qtver = 1; then + AC_MSG_RESULT([compiling]) + KDE_1_CHECK_PATHS + else + AC_MSG_ERROR([path checking not yet supported for KDE 2]) + fi + +fi +]) + +AC_DEFUN([KDE_CHECK_PATHS_FOR_COMPLETENESS], +[ if test -z "$kde_htmldir" || test -z "$kde_appsdir" || + test -z "$kde_icondir" || test -z "$kde_sounddir" || + test -z "$kde_datadir" || test -z "$kde_locale" || + test -z "$kde_cgidir" || test -z "$kde_confdir" || + test -z "$kde_kcfgdir" || + test -z "$kde_mimedir" || test -z "$kde_toolbardir" || + test -z "$kde_wallpaperdir" || test -z "$kde_templatesdir" || + test -z "$kde_bindir" || test -z "$kde_servicesdir" || + test -z "$kde_servicetypesdir" || test -z "$kde_moduledir" || + test -z "$kde_styledir" || test -z "kde_widgetdir" || + test -z "$xdg_appsdir" || test -z "$xdg_menudir" || test -z "$xdg_directorydir" || + test "x$kde_have_all_paths" != "xyes"; then + kde_have_all_paths=no + fi +]) + +AC_DEFUN([KDE_MISSING_PROG_ERROR], +[ + AC_MSG_ERROR([The important program $1 was not found! +Please check whether you installed KDE correctly. +]) +]) + +AC_DEFUN([KDE_MISSING_ARTS_ERROR], +[ + AC_MSG_ERROR([The important program $1 was not found! +Please check whether you installed aRts correctly or use +--without-arts to compile without aRts support (this will remove functionality). +]) +]) + +AC_DEFUN([KDE_SUBST_PROGRAMS], +[ + AC_ARG_WITH(arts, + AC_HELP_STRING([--without-arts],[build without aRts [default=yes]]), + [build_arts=$withval], + [build_arts=yes] + ) + AM_CONDITIONAL(include_ARTS, test "$build_arts" != "no") + + kde_default_bindirs="/usr/bin /usr/local/bin /opt/local/bin /usr/X11R6/bin /opt/kde/bin /opt/kde3/bin /usr/kde/bin /usr/local/kde/bin" + test -n "$KDEDIR" && kde_default_bindirs="$KDEDIR/bin $kde_default_bindirs" + if test -n "$KDEDIRS"; then + kde_save_IFS=$IFS + IFS=: + for dir in $KDEDIRS; do + kde_default_bindirs="$dir/bin $kde_default_bindirs " + done + IFS=$kde_save_IFS + fi + kde_default_bindirs="$exec_prefix/bin $prefix/bin $kde_default_bindirs" + KDE_FIND_PATH(dcopidl, DCOPIDL, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(dcopidl)]) + KDE_FIND_PATH(dcopidl2cpp, DCOPIDL2CPP, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(dcopidl2cpp)]) + if test "$build_arts" != "no"; then + KDE_FIND_PATH(mcopidl, MCOPIDL, [$kde_default_bindirs], [KDE_MISSING_ARTS_ERROR(mcopidl)]) + KDE_FIND_PATH(artsc-config, ARTSCCONFIG, [$kde_default_bindirs], [KDE_MISSING_ARTS_ERROR(artsc-config)]) + fi + KDE_FIND_PATH(kde-config, KDECONFIG, [$kde_default_bindirs]) + KDE_FIND_PATH(meinproc, MEINPROC, [$kde_default_bindirs]) + + kde32ornewer=1 + if test -n "$kde_qtver" && test "$kde_qtver" -lt 3; then + kde32ornewer= + else + if test "$kde_qtver" = "3" && test "$kde_qtsubver" -le 1; then + kde32ornewer= + fi + fi + + if test -n "$kde32ornewer"; then + KDE_FIND_PATH(kconfig_compiler, KCONFIG_COMPILER, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(kconfig_compiler)]) + KDE_FIND_PATH(dcopidlng, DCOPIDLNG, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(dcopidlng)]) + fi + KDE_FIND_PATH(xmllint, XMLLINT, [${prefix}/bin ${exec_prefix}/bin /usr/local/bin /opt/local/bin], [XMLLINT=""]) + + if test -n "$MEINPROC" && test ! "$MEINPROC" = "compiled"; then + kde_sharedirs="/usr/share/kde /usr/local/share /usr/share /opt/kde3/share /opt/kde/share $prefix/share" + test -n "$KDEDIR" && kde_sharedirs="$KDEDIR/share $kde_sharedirs" + AC_FIND_FILE(apps/ksgmltools2/customization/kde-chunk.xsl, $kde_sharedirs, KDE_XSL_STYLESHEET) + if test "$KDE_XSL_STYLESHEET" = "NO"; then + KDE_XSL_STYLESHEET="" + else + KDE_XSL_STYLESHEET="$KDE_XSL_STYLESHEET/apps/ksgmltools2/customization/kde-chunk.xsl" + fi + fi + + DCOP_DEPENDENCIES='$(DCOPIDL)' + if test -n "$kde32ornewer"; then + KCFG_DEPENDENCIES='$(KCONFIG_COMPILER)' + DCOP_DEPENDENCIES='$(DCOPIDL) $(DCOPIDLNG)' + AC_SUBST(KCONFIG_COMPILER) + AC_SUBST(KCFG_DEPENDENCIES) + AC_SUBST(DCOPIDLNG) + fi + AC_SUBST(DCOPIDL) + AC_SUBST(DCOPIDL2CPP) + AC_SUBST(DCOP_DEPENDENCIES) + AC_SUBST(MCOPIDL) + AC_SUBST(ARTSCCONFIG) + AC_SUBST(KDECONFIG) + AC_SUBST(MEINPROC) + AC_SUBST(KDE_XSL_STYLESHEET) + AC_SUBST(XMLLINT) + + if test -x "$KDECONFIG"; then # it can be "compiled" + kde_libs_prefix=`$KDECONFIG --prefix` + if test -z "$kde_libs_prefix" || test ! -x "$kde_libs_prefix"; then + AC_MSG_ERROR([$KDECONFIG --prefix outputed the non existant prefix '$kde_libs_prefix' for kdelibs. + This means it has been moved since you installed it. + This won't work. Please recompile kdelibs for the new prefix. + ]) + fi + kde_libs_htmldir=`$KDECONFIG --install html --expandvars` + else + kde_libs_prefix='$(prefix)' + kde_libs_htmldir='$(kde_htmldir)' + fi + AC_SUBST(kde_libs_prefix) + AC_SUBST(kde_libs_htmldir) +])dnl + +AC_DEFUN([AC_CREATE_KFSSTND], +[ +AC_REQUIRE([AC_CHECK_RPATH]) + +AC_MSG_CHECKING([for KDE paths]) +kde_result="" +kde_cached_paths=yes +AC_CACHE_VAL(kde_cv_all_paths, +[ + KDE_SET_DEFAULT_PATHS($1) + kde_cached_paths=no +]) +eval "$kde_cv_all_paths" +KDE_CHECK_PATHS_FOR_COMPLETENESS +if test "$kde_have_all_paths" = "no" && test "$kde_cached_paths" = "yes"; then + # wrong values were cached, may be, we can set better ones + kde_result= + kde_htmldir= kde_appsdir= kde_icondir= kde_sounddir= + kde_datadir= kde_locale= kde_cgidir= kde_confdir= kde_kcfgdir= + kde_mimedir= kde_toolbardir= kde_wallpaperdir= kde_templatesdir= + kde_bindir= kde_servicesdir= kde_servicetypesdir= kde_moduledir= + kde_have_all_paths= + kde_styledir= + kde_widgetdir= + xdg_appsdir = xdg_menudir= xdg_directorydir= + KDE_SET_DEFAULT_PATHS($1) + eval "$kde_cv_all_paths" + KDE_CHECK_PATHS_FOR_COMPLETENESS + kde_result="$kde_result (cache overridden)" +fi +if test "$kde_have_all_paths" = "no"; then + AC_MSG_ERROR([configure could not run a little KDE program to test the environment. +Since it had compiled and linked before, it must be a strange problem on your system. +Look at config.log for details. If you are not able to fix this, look at +http://www.kde.org/faq/installation.html or any www.kde.org mirror. +(If you're using an egcs version on Linux, you may update binutils!) +]) +else + rm -f conftest* + AC_MSG_RESULT($kde_result) +fi + +bindir=$kde_bindir + +KDE_SUBST_PROGRAMS + +]) + +AC_DEFUN([AC_SUBST_KFSSTND], +[ +AC_SUBST(kde_htmldir) +AC_SUBST(kde_appsdir) +AC_SUBST(kde_icondir) +AC_SUBST(kde_sounddir) +AC_SUBST(kde_datadir) +AC_SUBST(kde_locale) +AC_SUBST(kde_confdir) +AC_SUBST(kde_kcfgdir) +AC_SUBST(kde_mimedir) +AC_SUBST(kde_wallpaperdir) +AC_SUBST(kde_bindir) +dnl X Desktop Group standards +AC_SUBST(xdg_appsdir) +AC_SUBST(xdg_menudir) +AC_SUBST(xdg_directorydir) +dnl for KDE 2 +AC_SUBST(kde_templatesdir) +AC_SUBST(kde_servicesdir) +AC_SUBST(kde_servicetypesdir) +AC_SUBST(kde_moduledir) +AC_SUBST(kdeinitdir, '$(kde_moduledir)') +AC_SUBST(kde_styledir) +AC_SUBST(kde_widgetdir) +if test "$kde_qtver" = 1; then + kde_minidir="$kde_icondir/mini" +else +# for KDE 1 - this breaks KDE2 apps using minidir, but +# that's the plan ;-/ + kde_minidir="/dev/null" +fi +dnl AC_SUBST(kde_minidir) +dnl AC_SUBST(kde_cgidir) +dnl AC_SUBST(kde_toolbardir) +]) + +AC_DEFUN([KDE_MISC_TESTS], +[ + dnl Checks for libraries. + AC_CHECK_LIB(util, main, [LIBUTIL="-lutil"]) dnl for *BSD + AC_SUBST(LIBUTIL) + AC_CHECK_LIB(compat, main, [LIBCOMPAT="-lcompat"]) dnl for *BSD + AC_SUBST(LIBCOMPAT) + kde_have_crypt= + AC_CHECK_LIB(crypt, crypt, [LIBCRYPT="-lcrypt"; kde_have_crypt=yes], + AC_CHECK_LIB(c, crypt, [kde_have_crypt=yes], [ + AC_MSG_WARN([you have no crypt in either libcrypt or libc. +You should install libcrypt from another source or configure with PAM +support]) + kde_have_crypt=no + ])) + AC_SUBST(LIBCRYPT) + if test $kde_have_crypt = yes; then + AC_DEFINE_UNQUOTED(HAVE_CRYPT, 1, [Defines if your system has the crypt function]) + fi + AC_CHECK_SOCKLEN_T + AC_CHECK_LIB(dnet, dnet_ntoa, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet"]) + if test $ac_cv_lib_dnet_dnet_ntoa = no; then + AC_CHECK_LIB(dnet_stub, dnet_ntoa, + [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"]) + fi + AC_CHECK_FUNC(inet_ntoa) + if test $ac_cv_func_inet_ntoa = no; then + AC_CHECK_LIB(nsl, inet_ntoa, X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl") + fi + AC_CHECK_FUNC(connect) + if test $ac_cv_func_connect = no; then + AC_CHECK_LIB(socket, connect, X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS", , + $X_EXTRA_LIBS) + fi + + AC_CHECK_FUNC(remove) + if test $ac_cv_func_remove = no; then + AC_CHECK_LIB(posix, remove, X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix") + fi + + # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. + AC_CHECK_FUNC(shmat, , + AC_CHECK_LIB(ipc, shmat, X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc")) + + # more headers that need to be explicitly included on darwin + AC_CHECK_HEADERS(sys/types.h stdint.h) + + # darwin requires a poll emulation library + AC_CHECK_LIB(poll, poll, LIB_POLL="-lpoll") + + # CoreAudio framework + AC_CHECK_HEADER(CoreAudio/CoreAudio.h, [ + AC_DEFINE(HAVE_COREAUDIO, 1, [Define if you have the CoreAudio API]) + FRAMEWORK_COREAUDIO="-Xlinker -framework -Xlinker CoreAudio" + ]) + + AC_CHECK_RES_INIT + AC_SUBST(LIB_POLL) + AC_SUBST(FRAMEWORK_COREAUDIO) + LIBSOCKET="$X_EXTRA_LIBS" + AC_SUBST(LIBSOCKET) + AC_SUBST(X_EXTRA_LIBS) + AC_CHECK_LIB(ucb, killpg, [LIBUCB="-lucb"]) dnl for Solaris2.4 + AC_SUBST(LIBUCB) + + case $host in dnl this *is* LynxOS specific + *-*-lynxos* ) + AC_MSG_CHECKING([LynxOS header file wrappers]) + [CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"] + AC_MSG_RESULT(disabled) + AC_CHECK_LIB(bsd, gethostbyname, [LIBSOCKET="-lbsd"]) dnl for LynxOS + ;; + esac + + KDE_CHECK_TYPES + KDE_CHECK_LIBDL + KDE_CHECK_STRLCPY + +# darwin needs this to initialize the environment +AC_CHECK_HEADERS(crt_externs.h) +AC_CHECK_FUNC(_NSGetEnviron, [AC_DEFINE(HAVE_NSGETENVIRON, 1, [Define if your system needs _NSGetEnviron to set up the environment])]) + +AH_VERBATIM(_DARWIN_ENVIRON, +[ +#if defined(HAVE_NSGETENVIRON) && defined(HAVE_CRT_EXTERNS_H) +# include <sys/time.h> +# include <crt_externs.h> +# define environ (*_NSGetEnviron()) +#endif +]) + +AH_VERBATIM(_AIX_STRINGS_H_BZERO, +[ +/* + * AIX defines FD_SET in terms of bzero, but fails to include <strings.h> + * that defines bzero. + */ + +#if defined(_AIX) +#include <strings.h> +#endif +]) + +AC_CHECK_FUNCS([vsnprintf snprintf]) + +AH_VERBATIM(_TRU64,[ +/* + * On HP-UX, the declaration of vsnprintf() is needed every time ! + */ + +#if !defined(HAVE_VSNPRINTF) || defined(hpux) +#if __STDC__ +#include <stdarg.h> +#include <stdlib.h> +#else +#include <varargs.h> +#endif +#ifdef __cplusplus +extern "C" +#endif +int vsnprintf(char *str, size_t n, char const *fmt, va_list ap); +#ifdef __cplusplus +extern "C" +#endif +int snprintf(char *str, size_t n, char const *fmt, ...); +#endif +]) + +]) + +dnl ------------------------------------------------------------------------ +dnl Find the header files and libraries for X-Windows. Extended the +dnl macro AC_PATH_X +dnl ------------------------------------------------------------------------ +dnl +AC_DEFUN([K_PATH_X], +[ +AC_REQUIRE([KDE_MISC_TESTS])dnl +AC_REQUIRE([KDE_CHECK_LIB64]) + +AC_ARG_ENABLE( + embedded, + AC_HELP_STRING([--enable-embedded],[link to Qt-embedded, don't use X]), + kde_use_qt_emb=$enableval, + kde_use_qt_emb=no +) + +AC_ARG_ENABLE( + qtopia, + AC_HELP_STRING([--enable-qtopia],[link to Qt-embedded, link to the Qtopia Environment]), + kde_use_qt_emb_palm=$enableval, + kde_use_qt_emb_palm=no +) + +AC_ARG_ENABLE( + mac, + AC_HELP_STRING([--enable-mac],[link to Qt/Mac (don't use X)]), + kde_use_qt_mac=$enableval, + kde_use_qt_mac=no +) + +if test "$kde_use_qt_emb" = "no" && test "$kde_use_qt_mac" = "no"; then + +AC_MSG_CHECKING(for X) + +AC_CACHE_VAL(kde_cv_have_x, +[# One or both of the vars are not set, and there is no cached value. +if test "{$x_includes+set}" = set || test "$x_includes" = NONE; then + kde_x_includes=NO +else + kde_x_includes=$x_includes +fi +if test "{$x_libraries+set}" = set || test "$x_libraries" = NONE; then + kde_x_libraries=NO +else + kde_x_libraries=$x_libraries +fi + +# below we use the standard autoconf calls +ac_x_libraries=$kde_x_libraries +ac_x_includes=$kde_x_includes + +KDE_PATH_X_DIRECT +dnl AC_PATH_X_XMKMF picks /usr/lib as the path for the X libraries. +dnl Unfortunately, if compiling with the N32 ABI, this is not the correct +dnl location. The correct location is /usr/lib32 or an undefined value +dnl (the linker is smart enough to pick the correct default library). +dnl Things work just fine if you use just AC_PATH_X_DIRECT. +dnl Solaris has a similar problem. AC_PATH_X_XMKMF forces x_includes to +dnl /usr/openwin/include, which doesn't work. /usr/include does work, so +dnl x_includes should be left alone. +case "$host" in +mips-sgi-irix6*) + ;; +*-*-solaris*) + ;; +*) + _AC_PATH_X_XMKMF + if test -z "$ac_x_includes"; then + ac_x_includes="." + fi + if test -z "$ac_x_libraries"; then + ac_x_libraries="/usr/lib${kdelibsuff}" + fi +esac +#from now on we use our own again + +# when the user already gave --x-includes, we ignore +# what the standard autoconf macros told us. +if test "$kde_x_includes" = NO; then + kde_x_includes=$ac_x_includes +fi + +# for --x-libraries too +if test "$kde_x_libraries" = NO; then + kde_x_libraries=$ac_x_libraries +fi + +if test "$kde_x_includes" = NO; then + AC_MSG_ERROR([Can't find X includes. Please check your installation and add the correct paths!]) +fi + +if test "$kde_x_libraries" = NO; then + AC_MSG_ERROR([Can't find X libraries. Please check your installation and add the correct paths!]) +fi + +# Record where we found X for the cache. +kde_cv_have_x="have_x=yes \ + kde_x_includes=$kde_x_includes kde_x_libraries=$kde_x_libraries" +])dnl + +eval "$kde_cv_have_x" + +if test "$have_x" != yes; then + AC_MSG_RESULT($have_x) + no_x=yes +else + AC_MSG_RESULT([libraries $kde_x_libraries, headers $kde_x_includes]) +fi + +if test -z "$kde_x_includes" || test "x$kde_x_includes" = xNONE; then + X_INCLUDES="" + x_includes="."; dnl better than nothing :- + else + x_includes=$kde_x_includes + X_INCLUDES="-I$x_includes" +fi + +if test -z "$kde_x_libraries" || test "x$kde_x_libraries" = xNONE; then + X_LDFLAGS="" + x_libraries="/usr/lib"; dnl better than nothing :- + else + x_libraries=$kde_x_libraries + X_LDFLAGS="-L$x_libraries" +fi +all_includes="$X_INCLUDES" +all_libraries="$X_LDFLAGS" + +# Check for libraries that X11R6 Xt/Xaw programs need. +ac_save_LDFLAGS="$LDFLAGS" +LDFLAGS="$LDFLAGS $X_LDFLAGS" +# SM needs ICE to (dynamically) link under SunOS 4.x (so we have to +# check for ICE first), but we must link in the order -lSM -lICE or +# we get undefined symbols. So assume we have SM if we have ICE. +# These have to be linked with before -lX11, unlike the other +# libraries we check for below, so use a different variable. +AC_CHECK_LIB(ICE, IceConnectionNumber, + [LIBSM="-lSM -lICE"], , $X_EXTRA_LIBS) +LDFLAGS="$ac_save_LDFLAGS" + +LIB_X11='-lX11 $(LIBSOCKET)' + +AC_MSG_CHECKING(for libXext) +AC_CACHE_VAL(kde_cv_have_libXext, +[ +kde_ldflags_safe="$LDFLAGS" +kde_libs_safe="$LIBS" + +LDFLAGS="$LDFLAGS $X_LDFLAGS $USER_LDFLAGS" +LIBS="-lXext -lX11 $LIBSOCKET" + +AC_TRY_LINK([ +#include <stdio.h> +#ifdef STDC_HEADERS +# include <stdlib.h> +#endif +], +[ +printf("hello Xext\n"); +], +kde_cv_have_libXext=yes, +kde_cv_have_libXext=no +) + +LDFLAGS=$kde_ldflags_safe +LIBS=$kde_libs_safe +]) + +AC_MSG_RESULT($kde_cv_have_libXext) + +if test "$kde_cv_have_libXext" = "no"; then + AC_MSG_ERROR([We need a working libXext to proceed. Since configure +can't find it itself, we stop here assuming that make wouldn't find +them either.]) +fi + +LIB_XEXT="-lXext" +QTE_NORTTI="" + +elif test "$kde_use_qt_emb" = "yes"; then + dnl We're using QT Embedded + CPPFLAGS=-DQWS + CXXFLAGS="$CXXFLAGS -fno-rtti" + QTE_NORTTI="-fno-rtti -DQWS" + X_PRE_LIBS="" + LIB_X11="" + LIB_XEXT="" + LIB_XRENDER="" + LIBSM="" + X_INCLUDES="" + X_LDFLAGS="" + x_includes="" + x_libraries="" +elif test "$kde_use_qt_mac" = "yes"; then + dnl We're using QT/Mac (I use QT_MAC so that qglobal.h doesn't *have* to + dnl be included to get the information) --Sam + CXXFLAGS="$CXXFLAGS -DQT_MAC -no-cpp-precomp" + CFLAGS="$CFLAGS -DQT_MAC -no-cpp-precomp" + X_PRE_LIBS="" + LIB_X11="" + LIB_XEXT="" + LIB_XRENDER="" + LIBSM="" + X_INCLUDES="" + X_LDFLAGS="" + x_includes="" + x_libraries="" +fi +AC_SUBST(X_PRE_LIBS) +AC_SUBST(LIB_X11) +AC_SUBST(LIB_XRENDER) +AC_SUBST(LIBSM) +AC_SUBST(X_INCLUDES) +AC_SUBST(X_LDFLAGS) +AC_SUBST(x_includes) +AC_SUBST(x_libraries) +AC_SUBST(QTE_NORTTI) +AC_SUBST(LIB_XEXT) + +]) + +AC_DEFUN([KDE_PRINT_QT_PROGRAM], +[ +AC_REQUIRE([KDE_USE_QT]) +cat > conftest.$ac_ext <<EOF +#include "confdefs.h" +#include <qglobal.h> +#include <qapplication.h> +EOF +if test "$kde_qtver" = "2"; then +cat >> conftest.$ac_ext <<EOF +#include <qevent.h> +#include <qstring.h> +#include <qstyle.h> +EOF + +if test $kde_qtsubver -gt 0; then +cat >> conftest.$ac_ext <<EOF +#if QT_VERSION < 210 +#error 1 +#endif +EOF +fi +fi + +if test "$kde_qtver" = "3"; then +cat >> conftest.$ac_ext <<EOF +#include <qcursor.h> +#include <qstylefactory.h> +#include <private/qucomextra_p.h> +EOF +fi + +echo "#if ! ($kde_qt_verstring)" >> conftest.$ac_ext +cat >> conftest.$ac_ext <<EOF +#error 1 +#endif + +int main() { +EOF +if test "$kde_qtver" = "2"; then +cat >> conftest.$ac_ext <<EOF + QStringList *t = new QStringList(); + Q_UNUSED(t); +EOF +if test $kde_qtsubver -gt 0; then +cat >> conftest.$ac_ext <<EOF + QString s; + s.setLatin1("Elvis is alive", 14); +EOF +fi +fi +if test "$kde_qtver" = "3"; then +cat >> conftest.$ac_ext <<EOF + (void)QStyleFactory::create(QString::null); + QCursor c(Qt::WhatsThisCursor); +EOF +fi +cat >> conftest.$ac_ext <<EOF + return 0; +} +EOF +]) + +AC_DEFUN([KDE_USE_QT], +[ +if test -z "$1"; then + # Current default Qt version: 3.2 + kde_qtver=3 + kde_qtsubver=2 +else + kde_qtsubver=`echo "$1" | sed -e 's#[0-9][0-9]*\.\([0-9][0-9]*\).*#\1#'` + # following is the check if subversion isnt found in passed argument + if test "$kde_qtsubver" = "$1"; then + kde_qtsubver=1 + fi + kde_qtver=`echo "$1" | sed -e 's#^\([0-9][0-9]*\)\..*#\1#'` + if test "$kde_qtver" = "1"; then + kde_qtsubver=42 + fi +fi + +if test -z "$2"; then + if test "$kde_qtver" = "2"; then + if test $kde_qtsubver -gt 0; then + kde_qt_minversion=">= Qt 2.2.2" + else + kde_qt_minversion=">= Qt 2.0.2" + fi + fi + if test "$kde_qtver" = "3"; then + if test $kde_qtsubver -gt 0; then + if test $kde_qtsubver -gt 1; then + kde_qt_minversion=">= Qt 3.2" + else + kde_qt_minversion=">= Qt 3.1 (20021021)" + fi + else + kde_qt_minversion=">= Qt 3.0" + fi + fi + if test "$kde_qtver" = "1"; then + kde_qt_minversion=">= 1.42 and < 2.0" + fi +else + kde_qt_minversion="$2" +fi + +if test -z "$3"; then + if test $kde_qtver = 3; then + if test $kde_qtsubver -gt 0; then + kde_qt_verstring="QT_VERSION >= 0x03@VER@00" + qtsubver=`echo "00$kde_qtsubver" | sed -e 's,.*\(..\)$,\1,'` + kde_qt_verstring=`echo $kde_qt_verstring | sed -e "s,@VER@,$qtsubver,"` + else + kde_qt_verstring="QT_VERSION >= 300" + fi + fi + if test $kde_qtver = 2; then + if test $kde_qtsubver -gt 0; then + kde_qt_verstring="QT_VERSION >= 222" + else + kde_qt_verstring="QT_VERSION >= 200" + fi + fi + if test $kde_qtver = 1; then + kde_qt_verstring="QT_VERSION >= 142 && QT_VERSION < 200" + fi +else + kde_qt_verstring="$3" +fi + +if test $kde_qtver = 3; then + kde_qt_dirs="$QTDIR /usr/lib/qt3 /usr/lib/qt /usr/share/qt3" +fi +if test $kde_qtver = 2; then + kde_qt_dirs="$QTDIR /usr/lib/qt2 /usr/lib/qt" +fi +if test $kde_qtver = 1; then + kde_qt_dirs="$QTDIR /usr/lib/qt" +fi +]) + +AC_DEFUN([KDE_CHECK_QT_DIRECT], +[ +AC_REQUIRE([KDE_USE_QT]) +AC_MSG_CHECKING([if Qt compiles without flags]) +AC_CACHE_VAL(kde_cv_qt_direct, +[ +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +ac_LD_LIBRARY_PATH_safe=$LD_LIBRARY_PATH +ac_LIBRARY_PATH="$LIBRARY_PATH" +ac_cxxflags_safe="$CXXFLAGS" +ac_ldflags_safe="$LDFLAGS" +ac_libs_safe="$LIBS" + +CXXFLAGS="$CXXFLAGS -I$qt_includes" +LDFLAGS="$LDFLAGS $X_LDFLAGS" +if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then +LIBS="$LIBQT -lXext -lX11 $LIBSOCKET" +else +LIBS="$LIBQT $LIBSOCKET" +fi +LD_LIBRARY_PATH= +export LD_LIBRARY_PATH +LIBRARY_PATH= +export LIBRARY_PATH + +KDE_PRINT_QT_PROGRAM + +if AC_TRY_EVAL(ac_link) && test -s conftest; then + kde_cv_qt_direct="yes" +else + kde_cv_qt_direct="no" + echo "configure: failed program was:" >&AC_FD_CC + cat conftest.$ac_ext >&AC_FD_CC +fi + +rm -f conftest* +CXXFLAGS="$ac_cxxflags_safe" +LDFLAGS="$ac_ldflags_safe" +LIBS="$ac_libs_safe" + +LD_LIBRARY_PATH="$ac_LD_LIBRARY_PATH_safe" +export LD_LIBRARY_PATH +LIBRARY_PATH="$ac_LIBRARY_PATH" +export LIBRARY_PATH +AC_LANG_RESTORE +]) + +if test "$kde_cv_qt_direct" = "yes"; then + AC_MSG_RESULT(yes) + $1 +else + AC_MSG_RESULT(no) + $2 +fi +]) + +dnl ------------------------------------------------------------------------ +dnl Try to find the Qt headers and libraries. +dnl $(QT_LDFLAGS) will be -Lqtliblocation (if needed) +dnl and $(QT_INCLUDES) will be -Iqthdrlocation (if needed) +dnl ------------------------------------------------------------------------ +dnl +AC_DEFUN([AC_PATH_QT_1_3], +[ +AC_REQUIRE([K_PATH_X]) +AC_REQUIRE([KDE_USE_QT]) +AC_REQUIRE([KDE_CHECK_LIB64]) + +dnl ------------------------------------------------------------------------ +dnl Add configure flag to enable linking to MT version of Qt library. +dnl ------------------------------------------------------------------------ + +AC_ARG_ENABLE( + mt, + AC_HELP_STRING([--disable-mt],[link to non-threaded Qt (deprecated)]), + kde_use_qt_mt=$enableval, + [ + if test $kde_qtver = 3; then + kde_use_qt_mt=yes + else + kde_use_qt_mt=no + fi + ] +) + +USING_QT_MT="" + +dnl ------------------------------------------------------------------------ +dnl If we not get --disable-qt-mt then adjust some vars for the host. +dnl ------------------------------------------------------------------------ + +KDE_MT_LDFLAGS= +KDE_MT_LIBS= +if test "x$kde_use_qt_mt" = "xyes"; then + KDE_CHECK_THREADING + if test "x$kde_use_threading" = "xyes"; then + CPPFLAGS="$USE_THREADS -DQT_THREAD_SUPPORT $CPPFLAGS" + KDE_MT_LDFLAGS="$USE_THREADS" + KDE_MT_LIBS="$LIBPTHREAD" + else + kde_use_qt_mt=no + fi +fi +AC_SUBST(KDE_MT_LDFLAGS) +AC_SUBST(KDE_MT_LIBS) + +kde_qt_was_given=yes + +dnl ------------------------------------------------------------------------ +dnl If we haven't been told how to link to Qt, we work it out for ourselves. +dnl ------------------------------------------------------------------------ +if test -z "$LIBQT_GLOB"; then + if test "x$kde_use_qt_emb" = "xyes"; then + LIBQT_GLOB="libqte.*" + else + LIBQT_GLOB="libqt.*" + fi +fi + +if test -z "$LIBQT"; then +dnl ------------------------------------------------------------ +dnl If we got --enable-embedded then adjust the Qt library name. +dnl ------------------------------------------------------------ + if test "x$kde_use_qt_emb" = "xyes"; then + qtlib="qte" + else + qtlib="qt" + fi + + kde_int_qt="-l$qtlib" +else + kde_int_qt="$LIBQT" + kde_lib_qt_set=yes +fi + +if test -z "$LIBQPE"; then +dnl ------------------------------------------------------------ +dnl If we got --enable-palmtop then add -lqpe to the link line +dnl ------------------------------------------------------------ + if test "x$kde_use_qt_emb" = "xyes"; then + if test "x$kde_use_qt_emb_palm" = "xyes"; then + LIB_QPE="-lqpe" + else + LIB_QPE="" + fi + else + LIB_QPE="" + fi +fi + +dnl ------------------------------------------------------------------------ +dnl If we got --enable-qt-mt then adjust the Qt library name for the host. +dnl ------------------------------------------------------------------------ + +if test "x$kde_use_qt_mt" = "xyes"; then + if test -z "$LIBQT"; then + LIBQT="-l$qtlib-mt" + kde_int_qt="-l$qtlib-mt" + else + LIBQT="$qtlib-mt" + kde_int_qt="$qtlib-mt" + fi + LIBQT_GLOB="lib$qtlib-mt.*" + USING_QT_MT="using -mt" +else + LIBQT="-l$qtlib" +fi + +if test $kde_qtver != 1; then + + AC_REQUIRE([AC_FIND_PNG]) + AC_REQUIRE([AC_FIND_JPEG]) + LIBQT="$LIBQT $LIBPNG $LIBJPEG" +fi + +if test $kde_qtver = 3; then + AC_REQUIRE([KDE_CHECK_LIBDL]) + LIBQT="$LIBQT $LIBDL" +fi + +AC_MSG_CHECKING([for Qt]) + +if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then +LIBQT="$LIBQT $X_PRE_LIBS -lXext -lX11 $LIBSM $LIBSOCKET" +fi +ac_qt_includes=NO ac_qt_libraries=NO ac_qt_bindir=NO +qt_libraries="" +qt_includes="" +AC_ARG_WITH(qt-dir, + AC_HELP_STRING([--with-qt-dir=DIR],[where the root of Qt is installed ]), + [ ac_qt_includes="$withval"/include + ac_qt_libraries="$withval"/lib${kdelibsuff} + ac_qt_bindir="$withval"/bin + ]) + +AC_ARG_WITH(qt-includes, + AC_HELP_STRING([--with-qt-includes=DIR],[where the Qt includes are. ]), + [ + ac_qt_includes="$withval" + ]) + +kde_qt_libs_given=no + +AC_ARG_WITH(qt-libraries, + AC_HELP_STRING([--with-qt-libraries=DIR],[where the Qt library is installed.]), + [ ac_qt_libraries="$withval" + kde_qt_libs_given=yes + ]) + +AC_CACHE_VAL(ac_cv_have_qt, +[#try to guess Qt locations + +qt_incdirs="" +for dir in $kde_qt_dirs; do + qt_incdirs="$qt_incdirs $dir/include $dir" +done +qt_incdirs="$QTINC $qt_incdirs /usr/local/qt/include /usr/include/qt /usr/include /usr/X11R6/include/X11/qt /usr/X11R6/include/qt /usr/X11R6/include/qt2 /usr/include/qt3 $x_includes" +if test ! "$ac_qt_includes" = "NO"; then + qt_incdirs="$ac_qt_includes $qt_incdirs" +fi + +if test "$kde_qtver" != "1"; then + kde_qt_header=qstyle.h +else + kde_qt_header=qglobal.h +fi + +AC_FIND_FILE($kde_qt_header, $qt_incdirs, qt_incdir) +ac_qt_includes="$qt_incdir" + +qt_libdirs="" +for dir in $kde_qt_dirs; do + qt_libdirs="$qt_libdirs $dir/lib${kdelibsuff} $dir" +done +qt_libdirs="$QTLIB $qt_libdirs /usr/X11R6/lib /usr/lib /usr/local/qt/lib $x_libraries" +if test ! "$ac_qt_libraries" = "NO"; then + qt_libdir=$ac_qt_libraries +else + qt_libdirs="$ac_qt_libraries $qt_libdirs" + # if the Qt was given, the chance is too big that libqt.* doesn't exist + qt_libdir=NONE + for dir in $qt_libdirs; do + try="ls -1 $dir/${LIBQT_GLOB}" + if test -n "`$try 2> /dev/null`"; then qt_libdir=$dir; break; else echo "tried $dir" >&AC_FD_CC ; fi + done +fi +for a in $qt_libdir/lib`echo ${kde_int_qt} | sed 's,^-l,,'`_incremental.*; do + if test -e "$a"; then + LIBQT="$LIBQT ${kde_int_qt}_incremental" + break + fi +done + +ac_qt_libraries="$qt_libdir" + +AC_LANG_SAVE +AC_LANG_CPLUSPLUS + +ac_cxxflags_safe="$CXXFLAGS" +ac_ldflags_safe="$LDFLAGS" +ac_libs_safe="$LIBS" + +CXXFLAGS="$CXXFLAGS -I$qt_incdir $all_includes" +LDFLAGS="$LDFLAGS -L$qt_libdir $all_libraries $USER_LDFLAGS $KDE_MT_LDFLAGS" +LIBS="$LIBS $LIBQT $KDE_MT_LIBS" + +KDE_PRINT_QT_PROGRAM + +if AC_TRY_EVAL(ac_link) && test -s conftest; then + rm -f conftest* +else + echo "configure: failed program was:" >&AC_FD_CC + cat conftest.$ac_ext >&AC_FD_CC + ac_qt_libraries="NO" +fi +rm -f conftest* +CXXFLAGS="$ac_cxxflags_safe" +LDFLAGS="$ac_ldflags_safe" +LIBS="$ac_libs_safe" + +AC_LANG_RESTORE +if test "$ac_qt_includes" = NO || test "$ac_qt_libraries" = NO; then + ac_cv_have_qt="have_qt=no" + ac_qt_notfound="" + missing_qt_mt="" + if test "$ac_qt_includes" = NO; then + if test "$ac_qt_libraries" = NO; then + ac_qt_notfound="(headers and libraries)"; + else + ac_qt_notfound="(headers)"; + fi + else + if test "x$kde_use_qt_mt" = "xyes"; then + missing_qt_mt=" +Make sure that you have compiled Qt with thread support!" + ac_qt_notfound="(library $qtlib-mt)"; + else + ac_qt_notfound="(library $qtlib)"; + fi + fi + + AC_MSG_ERROR([Qt ($kde_qt_minversion) $ac_qt_notfound not found. Please check your installation! +For more details about this problem, look at the end of config.log.$missing_qt_mt]) +else + have_qt="yes" +fi +]) + +eval "$ac_cv_have_qt" + +if test "$have_qt" != yes; then + AC_MSG_RESULT([$have_qt]); +else + ac_cv_have_qt="have_qt=yes \ + ac_qt_includes=$ac_qt_includes ac_qt_libraries=$ac_qt_libraries" + AC_MSG_RESULT([libraries $ac_qt_libraries, headers $ac_qt_includes $USING_QT_MT]) + + qt_libraries="$ac_qt_libraries" + qt_includes="$ac_qt_includes" +fi + +if test ! "$kde_qt_libs_given" = "yes" && test ! "$kde_qtver" = 3; then + KDE_CHECK_QT_DIRECT(qt_libraries= ,[]) +fi + +AC_SUBST(qt_libraries) +AC_SUBST(qt_includes) + +if test "$qt_includes" = "$x_includes" || test -z "$qt_includes"; then + QT_INCLUDES="" +else + QT_INCLUDES="-I$qt_includes" + all_includes="$QT_INCLUDES $all_includes" +fi + +if test "$qt_libraries" = "$x_libraries" || test -z "$qt_libraries"; then + QT_LDFLAGS="" +else + QT_LDFLAGS="-L$qt_libraries" + all_libraries="$all_libraries $QT_LDFLAGS" +fi +test -z "$KDE_MT_LDFLAGS" || all_libraries="$all_libraries $KDE_MT_LDFLAGS" + +AC_SUBST(QT_INCLUDES) +AC_SUBST(QT_LDFLAGS) +AC_PATH_QT_MOC_UIC + +KDE_CHECK_QT_JPEG + +if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then +LIB_QT="$kde_int_qt $LIBJPEG_QT "'$(LIBZ) $(LIBPNG) -lXext $(LIB_X11) $(LIBSM)' +else +LIB_QT="$kde_int_qt $LIBJPEG_QT "'$(LIBZ) $(LIBPNG)' +fi +test -z "$KDE_MT_LIBS" || LIB_QT="$LIB_QT $KDE_MT_LIBS" +for a in $qt_libdir/lib`echo ${kde_int_qt} | sed 's,^-l,,'`_incremental.*; do + if test -e "$a"; then + LIB_QT="$LIB_QT ${kde_int_qt}_incremental" + break + fi +done + +AC_SUBST(LIB_QT) +AC_SUBST(LIB_QPE) + +AC_SUBST(kde_qtver) +]) + +AC_DEFUN([AC_PATH_QT], +[ +AC_PATH_QT_1_3 +]) + +AC_DEFUN([KDE_CHECK_UIC_PLUGINS], +[ +AC_REQUIRE([AC_PATH_QT_MOC_UIC]) + +if test x$ac_uic_supports_libpath = xyes; then + +AC_MSG_CHECKING([if UIC has KDE plugins available]) +AC_CACHE_VAL(kde_cv_uic_plugins, +[ +cat > actest.ui << EOF +<!DOCTYPE UI><UI version="3.0" stdsetdef="1"> +<class>NewConnectionDialog</class> +<widget class="QDialog"> + <widget class="KLineEdit"> + <property name="name"> + <cstring>testInput</cstring> + </property> + </widget> +</widget> +</UI> +EOF + + + +kde_cv_uic_plugins=no +kde_line="$UIC_PATH -L $kde_widgetdir" +if test x$ac_uic_supports_nounload = xyes; then + kde_line="$kde_line -nounload" +fi +kde_line="$kde_line -impl actest.h actest.ui > actest.cpp" +if AC_TRY_EVAL(kde_line); then + # if you're trying to debug this check and think it's incorrect, + # better check your installation. The check _is_ correct - your + # installation is not. + if test -f actest.cpp && grep klineedit actest.cpp > /dev/null; then + kde_cv_uic_plugins=yes + fi +fi +rm -f actest.ui actest.cpp +]) + +AC_MSG_RESULT([$kde_cv_uic_plugins]) +if test "$kde_cv_uic_plugins" != yes; then + AC_MSG_ERROR([you need to install kdelibs first.]) +fi +fi +]) + +AC_DEFUN([KDE_CHECK_FINAL], +[ + AC_ARG_ENABLE(final, + AC_HELP_STRING([--enable-final], + [build size optimized apps (experimental - needs lots of memory)]), + kde_use_final=$enableval, kde_use_final=no) + + if test "x$kde_use_final" = "xyes"; then + KDE_USE_FINAL_TRUE="" + KDE_USE_FINAL_FALSE="#" + else + KDE_USE_FINAL_TRUE="#" + KDE_USE_FINAL_FALSE="" + fi + AC_SUBST(KDE_USE_FINAL_TRUE) + AC_SUBST(KDE_USE_FINAL_FALSE) +]) + +AC_DEFUN([KDE_CHECK_CLOSURE], +[ + AC_ARG_ENABLE(closure, + AC_HELP_STRING([--enable-closure],[delay template instantiation]), + kde_use_closure=$enableval, kde_use_closure=no) + + KDE_NO_UNDEFINED="" + if test "x$kde_use_closure" = "xyes"; then + KDE_USE_CLOSURE_TRUE="" + KDE_USE_CLOSURE_FALSE="#" +# CXXFLAGS="$CXXFLAGS $REPO" + else + KDE_USE_CLOSURE_TRUE="#" + KDE_USE_CLOSURE_FALSE="" + KDE_NO_UNDEFINED="" + case $host in + *-*-linux-gnu) + KDE_CHECK_COMPILER_FLAG([Wl,--no-undefined], + [KDE_CHECK_COMPILER_FLAG([Wl,--allow-shlib-undefined], + [KDE_NO_UNDEFINED="-Wl,--no-undefined -Wl,--allow-shlib-undefined"], + [KDE_NO_UNDEFINED=""])], + [KDE_NO_UNDEFINED=""]) + ;; + esac + fi + AC_SUBST(KDE_USE_CLOSURE_TRUE) + AC_SUBST(KDE_USE_CLOSURE_FALSE) + AC_SUBST(KDE_NO_UNDEFINED) +]) + +AC_DEFUN([KDE_CHECK_NMCHECK], +[ + AC_ARG_ENABLE(nmcheck,AC_HELP_STRING([--enable-nmcheck],[enable automatic namespace cleanness check]), + kde_use_nmcheck=$enableval, kde_use_nmcheck=no) + + if test "$kde_use_nmcheck" = "yes"; then + KDE_USE_NMCHECK_TRUE="" + KDE_USE_NMCHECK_FALSE="#" + else + KDE_USE_NMCHECK_TRUE="#" + KDE_USE_NMCHECK_FALSE="" + fi + AC_SUBST(KDE_USE_NMCHECK_TRUE) + AC_SUBST(KDE_USE_NMCHECK_FALSE) +]) + +AC_DEFUN([KDE_EXPAND_MAKEVAR], [ +savex=$exec_prefix +test "x$exec_prefix" = xNONE && exec_prefix=$prefix +tmp=$$2 +while $1=`eval echo "$tmp"`; test "x$$1" != "x$tmp"; do tmp=$$1; done +exec_prefix=$savex +]) + +dnl ------------------------------------------------------------------------ +dnl Now, the same with KDE +dnl $(KDE_LDFLAGS) will be the kdeliblocation (if needed) +dnl and $(kde_includes) will be the kdehdrlocation (if needed) +dnl ------------------------------------------------------------------------ +dnl +AC_DEFUN([AC_BASE_PATH_KDE], +[ +AC_REQUIRE([KDE_CHECK_STL]) +AC_REQUIRE([AC_PATH_QT])dnl +AC_REQUIRE([KDE_CHECK_LIB64]) + +AC_CHECK_RPATH +AC_MSG_CHECKING([for KDE]) + +if test "${prefix}" != NONE; then + kde_includes=${includedir} + KDE_EXPAND_MAKEVAR(ac_kde_includes, includedir) + + kde_libraries=${libdir} + KDE_EXPAND_MAKEVAR(ac_kde_libraries, libdir) + +else + ac_kde_includes= + ac_kde_libraries= + kde_libraries="" + kde_includes="" +fi + +AC_CACHE_VAL(ac_cv_have_kde, +[#try to guess kde locations + +if test "$kde_qtver" = 1; then + kde_check_header="ksock.h" + kde_check_lib="libkdecore.la" +else + kde_check_header="ksharedptr.h" + kde_check_lib="libkio.la" +fi + +if test -z "$1"; then + +kde_incdirs="/usr/lib/kde/include /usr/local/kde/include /usr/local/include /usr/kde/include /usr/include/kde /usr/include /opt/kde3/include /opt/kde/include $x_includes $qt_includes" +test -n "$KDEDIR" && kde_incdirs="$KDEDIR/include $KDEDIR/include/kde $KDEDIR $kde_incdirs" +kde_incdirs="$ac_kde_includes $kde_incdirs" +AC_FIND_FILE($kde_check_header, $kde_incdirs, kde_incdir) +ac_kde_includes="$kde_incdir" + +if test -n "$ac_kde_includes" && test ! -r "$ac_kde_includes/$kde_check_header"; then + AC_MSG_ERROR([ +in the prefix, you've chosen, are no KDE headers installed. This will fail. +So, check this please and use another prefix!]) +fi + +kde_libdirs="/usr/lib/kde/lib${kdelibsuff} /usr/local/kde/lib${kdelibsuff} /usr/kde/lib${kdelibsuff} /usr/lib${kdelibsuff}/kde /usr/lib${kdelibsuff}/kde3 /usr/lib${kdelibsuff} /usr/X11R6/lib${kdelibsuff} /usr/local/lib${kdelibsuff} /opt/kde3/lib${kdelibsuff} /opt/kde/lib${kdelibsuff} /usr/X11R6/kde/lib${kdelibsuff}" +test -n "$KDEDIR" && kde_libdirs="$KDEDIR/lib${kdelibsuff} $KDEDIR $kde_libdirs" +kde_libdirs="$ac_kde_libraries $libdir $kde_libdirs" +AC_FIND_FILE($kde_check_lib, $kde_libdirs, kde_libdir) +ac_kde_libraries="$kde_libdir" + +kde_widgetdir=NO +dnl this might be somewhere else +AC_FIND_FILE("kde3/plugins/designer/kdewidgets.la", $kde_libdirs, kde_widgetdir) + +if test -n "$ac_kde_libraries" && test ! -r "$ac_kde_libraries/$kde_check_lib"; then +AC_MSG_ERROR([ +in the prefix, you've chosen, are no KDE libraries installed. This will fail. +So, check this please and use another prefix!]) +fi + +if test -n "$kde_widgetdir" && test ! -r "$kde_widgetdir/kde3/plugins/designer/kdewidgets.la"; then +AC_MSG_ERROR([ +I can't find the designer plugins. These are required and should have been installed +by kdelibs]) +fi + +if test -n "$kde_widgetdir"; then + kde_widgetdir="$kde_widgetdir/kde3/plugins/designer" +fi + + +if test "$ac_kde_includes" = NO || test "$ac_kde_libraries" = NO || test "$kde_widgetdir" = NO; then + ac_cv_have_kde="have_kde=no" +else + ac_cv_have_kde="have_kde=yes \ + ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries" +fi + +else dnl test -z $1 + + ac_cv_have_kde="have_kde=no" + +fi +])dnl + +eval "$ac_cv_have_kde" + +if test "$have_kde" != "yes"; then + if test "${prefix}" = NONE; then + ac_kde_prefix="$ac_default_prefix" + else + ac_kde_prefix="$prefix" + fi + if test "$exec_prefix" = NONE; then + ac_kde_exec_prefix="$ac_kde_prefix" + AC_MSG_RESULT([will be installed in $ac_kde_prefix]) + else + ac_kde_exec_prefix="$exec_prefix" + AC_MSG_RESULT([will be installed in $ac_kde_prefix and $ac_kde_exec_prefix]) + fi + + kde_libraries="${libdir}" + kde_includes="${includedir}" + +else + ac_cv_have_kde="have_kde=yes \ + ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries" + AC_MSG_RESULT([libraries $ac_kde_libraries, headers $ac_kde_includes]) + + kde_libraries="$ac_kde_libraries" + kde_includes="$ac_kde_includes" +fi +AC_SUBST(kde_libraries) +AC_SUBST(kde_includes) + +if test "$kde_includes" = "$x_includes" || test "$kde_includes" = "$qt_includes" || test "$kde_includes" = "/usr/include"; then + KDE_INCLUDES="" +else + KDE_INCLUDES="-I$kde_includes" + all_includes="$KDE_INCLUDES $all_includes" +fi + +KDE_DEFAULT_CXXFLAGS="-DQT_CLEAN_NAMESPACE -DQT_NO_ASCII_CAST -DQT_NO_STL -DQT_NO_COMPAT -DQT_NO_TRANSLATION" + +KDE_LDFLAGS="-L$kde_libraries" +if test ! "$kde_libraries" = "$x_libraries" && test ! "$kde_libraries" = "$qt_libraries" ; then + all_libraries="$all_libraries $KDE_LDFLAGS" +fi + +AC_SUBST(KDE_LDFLAGS) +AC_SUBST(KDE_INCLUDES) + +AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) + +all_libraries="$all_libraries $USER_LDFLAGS" +all_includes="$all_includes $USER_INCLUDES" +AC_SUBST(all_includes) +AC_SUBST(all_libraries) + +if test -z "$1"; then +KDE_CHECK_UIC_PLUGINS +fi + +ac_kde_libraries="$kde_libdir" + +AC_SUBST(AUTODIRS) + + +]) + +AC_DEFUN([KDE_CHECK_EXTRA_LIBS], +[ +AC_MSG_CHECKING(for extra includes) +AC_ARG_WITH(extra-includes,AC_HELP_STRING([--with-extra-includes=DIR],[adds non standard include paths]), + kde_use_extra_includes="$withval", + kde_use_extra_includes=NONE +) +kde_extra_includes= +if test -n "$kde_use_extra_includes" && \ + test "$kde_use_extra_includes" != "NONE"; then + + ac_save_ifs=$IFS + IFS=':' + for dir in $kde_use_extra_includes; do + kde_extra_includes="$kde_extra_includes $dir" + USER_INCLUDES="$USER_INCLUDES -I$dir" + done + IFS=$ac_save_ifs + kde_use_extra_includes="added" +else + kde_use_extra_includes="no" +fi +AC_SUBST(USER_INCLUDES) + +AC_MSG_RESULT($kde_use_extra_includes) + +kde_extra_libs= +AC_MSG_CHECKING(for extra libs) +AC_ARG_WITH(extra-libs,AC_HELP_STRING([--with-extra-libs=DIR],[adds non standard library paths]), + kde_use_extra_libs=$withval, + kde_use_extra_libs=NONE +) +if test -n "$kde_use_extra_libs" && \ + test "$kde_use_extra_libs" != "NONE"; then + + ac_save_ifs=$IFS + IFS=':' + for dir in $kde_use_extra_libs; do + kde_extra_libs="$kde_extra_libs $dir" + KDE_EXTRA_RPATH="$KDE_EXTRA_RPATH -R $dir" + USER_LDFLAGS="$USER_LDFLAGS -L$dir" + done + IFS=$ac_save_ifs + kde_use_extra_libs="added" +else + kde_use_extra_libs="no" +fi + +AC_SUBST(USER_LDFLAGS) + +AC_MSG_RESULT($kde_use_extra_libs) + +]) + +AC_DEFUN([KDE_1_CHECK_PATH_HEADERS], +[ + AC_MSG_CHECKING([for KDE headers installed]) + AC_LANG_SAVE + AC_LANG_CPLUSPLUS +cat > conftest.$ac_ext <<EOF +#ifdef STDC_HEADERS +# include <stdlib.h> +#endif +#include <stdio.h> +#include "confdefs.h" +#include <kapp.h> + +int main() { + printf("kde_htmldir=\\"%s\\"\n", KApplication::kde_htmldir().data()); + printf("kde_appsdir=\\"%s\\"\n", KApplication::kde_appsdir().data()); + printf("kde_icondir=\\"%s\\"\n", KApplication::kde_icondir().data()); + printf("kde_sounddir=\\"%s\\"\n", KApplication::kde_sounddir().data()); + printf("kde_datadir=\\"%s\\"\n", KApplication::kde_datadir().data()); + printf("kde_locale=\\"%s\\"\n", KApplication::kde_localedir().data()); + printf("kde_cgidir=\\"%s\\"\n", KApplication::kde_cgidir().data()); + printf("kde_confdir=\\"%s\\"\n", KApplication::kde_configdir().data()); + printf("kde_mimedir=\\"%s\\"\n", KApplication::kde_mimedir().data()); + printf("kde_toolbardir=\\"%s\\"\n", KApplication::kde_toolbardir().data()); + printf("kde_wallpaperdir=\\"%s\\"\n", + KApplication::kde_wallpaperdir().data()); + printf("kde_bindir=\\"%s\\"\n", KApplication::kde_bindir().data()); + printf("kde_partsdir=\\"%s\\"\n", KApplication::kde_partsdir().data()); + printf("kde_servicesdir=\\"/tmp/dummy\\"\n"); + printf("kde_servicetypesdir=\\"/tmp/dummy\\"\n"); + printf("kde_moduledir=\\"/tmp/dummy\\"\n"); + printf("kde_styledir=\\"/tmp/dummy\\"\n"); + printf("kde_widgetdir=\\"/tmp/dummy\\"\n"); + printf("xdg_appsdir=\\"/tmp/dummy\\"\n"); + printf("xdg_menudir=\\"/tmp/dummy\\"\n"); + printf("xdg_directorydir=\\"/tmp/dummy\\"\n"); + printf("kde_kcfgdir=\\"/tmp/dummy\\"\n"); + return 0; + } +EOF + + ac_save_CPPFLAGS=$CPPFLAGS + CPPFLAGS="$all_includes $CPPFLAGS" + if AC_TRY_EVAL(ac_compile); then + AC_MSG_RESULT(yes) + else + AC_MSG_ERROR([your system is not able to compile a small KDE application! +Check, if you installed the KDE header files correctly. +For more details about this problem, look at the end of config.log.]) + fi + CPPFLAGS=$ac_save_CPPFLAGS + + AC_LANG_RESTORE +]) + +AC_DEFUN([KDE_CHECK_KDEQTADDON], +[ +AC_MSG_CHECKING(for kde-qt-addon) +AC_CACHE_VAL(kde_cv_have_kdeqtaddon, +[ + kde_ldflags_safe="$LDFLAGS" + kde_libs_safe="$LIBS" + kde_cxxflags_safe="$CXXFLAGS" + + LIBS="-lkde-qt-addon $LIBQT $LIBS" + CXXFLAGS="$CXXFLAGS -I$prefix/include -I$prefix/include/kde $all_includes" + LDFLAGS="$LDFLAGS $all_libraries $USER_LDFLAGS" + + AC_TRY_LINK([ + #include <qdom.h> + ], + [ + QDomDocument doc; + ], + kde_cv_have_kdeqtaddon=yes, + kde_cv_have_kdeqtaddon=no + ) + + LDFLAGS=$kde_ldflags_safe + LIBS=$kde_libs_safe + CXXFLAGS=$kde_cxxflags_safe +]) + +AC_MSG_RESULT($kde_cv_have_kdeqtaddon) + +if test "$kde_cv_have_kdeqtaddon" = "no"; then + AC_MSG_ERROR([Can't find libkde-qt-addon. You need to install it first. +It is a separate package (and CVS module) named kde-qt-addon.]) +fi +]) + +AC_DEFUN([KDE_CREATE_LIBS_ALIASES], +[ + AC_REQUIRE([KDE_MISC_TESTS]) + AC_REQUIRE([KDE_CHECK_LIBDL]) + AC_REQUIRE([K_PATH_X]) + +if test $kde_qtver = 3; then + AC_SUBST(LIB_KDECORE, "-lkdecore") + AC_SUBST(LIB_KDEUI, "-lkdeui") + AC_SUBST(LIB_KIO, "-lkio") + AC_SUBST(LIB_SMB, "-lsmb") + AC_SUBST(LIB_KAB, "-lkab") + AC_SUBST(LIB_KABC, "-lkabc") + AC_SUBST(LIB_KHTML, "-lkhtml") + AC_SUBST(LIB_KSPELL, "-lkspell") + AC_SUBST(LIB_KPARTS, "-lkparts") + AC_SUBST(LIB_KDEPRINT, "-lkdeprint") + AC_SUBST(LIB_KUTILS, "-lkutils") + AC_SUBST(LIB_KDEPIM, "-lkdepim") +# these are for backward compatibility + AC_SUBST(LIB_KSYCOCA, "-lkio") + AC_SUBST(LIB_KFILE, "-lkio") +elif test $kde_qtver = 2; then + AC_SUBST(LIB_KDECORE, "-lkdecore") + AC_SUBST(LIB_KDEUI, "-lkdeui") + AC_SUBST(LIB_KIO, "-lkio") + AC_SUBST(LIB_KSYCOCA, "-lksycoca") + AC_SUBST(LIB_SMB, "-lsmb") + AC_SUBST(LIB_KFILE, "-lkfile") + AC_SUBST(LIB_KAB, "-lkab") + AC_SUBST(LIB_KHTML, "-lkhtml") + AC_SUBST(LIB_KSPELL, "-lkspell") + AC_SUBST(LIB_KPARTS, "-lkparts") + AC_SUBST(LIB_KDEPRINT, "-lkdeprint") +else + AC_SUBST(LIB_KDECORE, "-lkdecore -lXext $(LIB_QT)") + AC_SUBST(LIB_KDEUI, "-lkdeui $(LIB_KDECORE)") + AC_SUBST(LIB_KFM, "-lkfm $(LIB_KDECORE)") + AC_SUBST(LIB_KFILE, "-lkfile $(LIB_KFM) $(LIB_KDEUI)") + AC_SUBST(LIB_KAB, "-lkab $(LIB_KIMGIO) $(LIB_KDECORE)") +fi +]) + +AC_DEFUN([AC_PATH_KDE], +[ + AC_BASE_PATH_KDE + AC_ARG_ENABLE(path-check,AC_HELP_STRING([--disable-path-check],[don't try to find out, where to install]), + [ + if test "$enableval" = "no"; + then ac_use_path_checking="default" + else ac_use_path_checking="" + fi + ], + [ + if test "$kde_qtver" = 1; + then ac_use_path_checking="" + else ac_use_path_checking="default" + fi + ] + ) + + AC_CREATE_KFSSTND($ac_use_path_checking) + + AC_SUBST_KFSSTND + KDE_CREATE_LIBS_ALIASES +]) + +dnl KDE_CHECK_FUNC_EXT(<func>, [headers], [sample-use], [C prototype], [autoheader define], [call if found]) +AC_DEFUN([KDE_CHECK_FUNC_EXT], +[ +AC_MSG_CHECKING(for $1) +AC_CACHE_VAL(kde_cv_func_$1, +[ +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +save_CXXFLAGS="$CXXFLAGS" +kde_safe_LIBS="$LIBS" +LIBS="$LIBS $X_EXTRA_LIBS" +if test "$GXX" = "yes"; then +CXXFLAGS="$CXXFLAGS -pedantic-errors" +fi +AC_TRY_COMPILE([ +$2 +], +[ +$3 +], +kde_cv_func_$1=yes, +kde_cv_func_$1=no) +CXXFLAGS="$save_CXXFLAGS" +LIBS="$kde_safe_LIBS" +AC_LANG_RESTORE +]) + +AC_MSG_RESULT($kde_cv_func_$1) + +AC_MSG_CHECKING([if $1 needs custom prototype]) +AC_CACHE_VAL(kde_cv_proto_$1, +[ +if test "x$kde_cv_func_$1" = xyes; then + kde_cv_proto_$1=no +else + case "$1" in + setenv|unsetenv|usleep|random|srandom|seteuid|mkstemps|mkstemp|revoke|vsnprintf|strlcpy|strlcat) + kde_cv_proto_$1="yes - in libkdefakes" + ;; + *) + kde_cv_proto_$1=unknown + ;; + esac +fi + +if test "x$kde_cv_proto_$1" = xunknown; then + +AC_LANG_SAVE +AC_LANG_CPLUSPLUS + kde_safe_libs=$LIBS + LIBS="$LIBS $X_EXTRA_LIBS" + AC_TRY_LINK([ +$2 + +extern "C" $4; +], +[ +$3 +], +[ kde_cv_func_$1=yes + kde_cv_proto_$1=yes ], + [kde_cv_proto_$1="$1 unavailable"] +) +LIBS=$kde_safe_libs +AC_LANG_RESTORE +fi +]) +AC_MSG_RESULT($kde_cv_proto_$1) + +if test "x$kde_cv_func_$1" = xyes; then + AC_DEFINE(HAVE_$5, 1, [Define if you have $1]) + $6 +fi +if test "x$kde_cv_proto_$1" = xno; then + AC_DEFINE(HAVE_$5_PROTO, 1, + [Define if you have the $1 prototype]) +fi + +AH_VERBATIM([_HAVE_$5_PROTO], +[ +#if !defined(HAVE_$5_PROTO) +#ifdef __cplusplus +extern "C" { +#endif +$4; +#ifdef __cplusplus +} +#endif +#endif +]) +]) + +AC_DEFUN([AC_CHECK_SETENV], +[ + KDE_CHECK_FUNC_EXT(setenv, [ +#include <stdlib.h> +], + [setenv("VAR", "VALUE", 1);], + [int setenv (const char *, const char *, int)], + [SETENV]) +]) + +AC_DEFUN([AC_CHECK_UNSETENV], +[ + KDE_CHECK_FUNC_EXT(unsetenv, [ +#include <stdlib.h> +], + [unsetenv("VAR");], + [void unsetenv (const char *)], + [UNSETENV]) +]) + +AC_DEFUN([AC_CHECK_GETDOMAINNAME], +[ + KDE_CHECK_FUNC_EXT(getdomainname, [ +#include <stdlib.h> +#include <unistd.h> +#include <netdb.h> +], + [ +char buffer[200]; +getdomainname(buffer, 200); +], + [#include <sys/types.h> + int getdomainname (char *, size_t)], + [GETDOMAINNAME]) +]) + +AC_DEFUN([AC_CHECK_GETHOSTNAME], +[ + KDE_CHECK_FUNC_EXT(gethostname, [ +#include <stdlib.h> +#include <unistd.h> +], + [ +char buffer[200]; +gethostname(buffer, 200); +], + [int gethostname (char *, unsigned int)], + [GETHOSTNAME]) +]) + +AC_DEFUN([AC_CHECK_USLEEP], +[ + KDE_CHECK_FUNC_EXT(usleep, [ +#include <unistd.h> +], + [ +usleep(200); +], + [int usleep (unsigned int)], + [USLEEP]) +]) + + +AC_DEFUN([AC_CHECK_RANDOM], +[ + KDE_CHECK_FUNC_EXT(random, [ +#include <stdlib.h> +], + [ +random(); +], + [long int random(void)], + [RANDOM]) + + KDE_CHECK_FUNC_EXT(srandom, [ +#include <stdlib.h> +], + [ +srandom(27); +], + [void srandom(unsigned int)], + [SRANDOM]) + +]) + +AC_DEFUN([AC_CHECK_INITGROUPS], +[ + KDE_CHECK_FUNC_EXT(initgroups, [ +#include <sys/types.h> +#include <unistd.h> +#include <grp.h> +], + [ +char buffer[200]; +initgroups(buffer, 27); +], + [int initgroups(const char *, gid_t)], + [INITGROUPS]) +]) + +AC_DEFUN([AC_CHECK_MKSTEMPS], +[ + KDE_CHECK_FUNC_EXT(mkstemps, [ +#include <stdlib.h> +#include <unistd.h> +], + [ +mkstemps("/tmp/aaaXXXXXX", 6); +], + [int mkstemps(char *, int)], + [MKSTEMPS]) +]) + +AC_DEFUN([AC_CHECK_MKDTEMP], +[ + KDE_CHECK_FUNC_EXT(mkdtemp, [ +#include <stdlib.h> +#include <unistd.h> +], + [ +mkdtemp("/tmp/aaaXXXXXX"); +], + [char *mkdtemp(char *)], + [MKDTEMP]) +]) + + +AC_DEFUN([AC_CHECK_RES_INIT], +[ + AC_MSG_CHECKING([if res_init needs -lresolv]) + kde_libs_safe="$LIBS" + LIBS="$LIBS $X_EXTRA_LIBS -lresolv" + AC_TRY_LINK( + [ +#include <sys/types.h> +#include <netinet/in.h> +#include <arpa/nameser.h> +#include <resolv.h> + ], + [ + res_init(); + ], + [ + LIBRESOLV="-lresolv" + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_RES_INIT, 1, [Define if you have the res_init function]) + ], + [ AC_MSG_RESULT(no) ] + ) + LIBS=$kde_libs_safe + AC_SUBST(LIBRESOLV) + + AC_MSG_CHECKING([if res_init is available]) + AC_TRY_COMPILE( + [ +#include <sys/types.h> +#include <netinet/in.h> +#include <arpa/nameser.h> +#include <resolv.h> + ], + [ + res_init(); + ], + [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_RES_INIT, 1, [Define if you have the res_init function]) + ], + [ AC_MSG_RESULT(no) ] + ) +]) + +AC_DEFUN([AC_CHECK_STRLCPY], +[ + KDE_CHECK_FUNC_EXT(strlcpy, [ +#include <string.h> +], +[ char buf[20]; + strlcpy(buf, "KDE function test", sizeof(buf)); +], + [unsigned long strlcpy(char*, const char*, unsigned long)], + [STRLCPY]) +]) + +AC_DEFUN([AC_CHECK_STRLCAT], +[ + KDE_CHECK_FUNC_EXT(strlcat, [ +#include <string.h> +], +[ char buf[20]; + buf[0]='\0'; + strlcat(buf, "KDE function test", sizeof(buf)); +], + [unsigned long strlcat(char*, const char*, unsigned long)], + [STRLCAT]) +]) + +AC_DEFUN([AC_FIND_GIF], + [AC_MSG_CHECKING([for giflib]) +AC_CACHE_VAL(ac_cv_lib_gif, +[ac_save_LIBS="$LIBS" +if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then +LIBS="$all_libraries -lgif -lX11 $LIBSOCKET" +else +LIBS="$all_libraries -lgif" +fi +AC_TRY_LINK(dnl +[ +#ifdef __cplusplus +extern "C" { +#endif +int GifLastError(void); +#ifdef __cplusplus +} +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +], + [return GifLastError();], + eval "ac_cv_lib_gif=yes", + eval "ac_cv_lib_gif=no") +LIBS="$ac_save_LIBS" +])dnl +if eval "test \"`echo $ac_cv_lib_gif`\" = yes"; then + AC_MSG_RESULT(yes) + AC_DEFINE_UNQUOTED(HAVE_LIBGIF, 1, [Define if you have libgif]) +else + AC_MSG_ERROR(You need giflib30. Please install the kdesupport package) +fi +]) + +AC_DEFUN([KDE_FIND_JPEG_HELPER], +[ +AC_MSG_CHECKING([for libjpeg$2]) +AC_CACHE_VAL(ac_cv_lib_jpeg_$1, +[ +ac_save_LIBS="$LIBS" +LIBS="$all_libraries $USER_LDFLAGS -ljpeg$2 -lm" +ac_save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS $all_includes $USER_INCLUDES" +AC_TRY_LINK( +[/* Override any gcc2 internal prototype to avoid an error. */ +struct jpeg_decompress_struct; +typedef struct jpeg_decompress_struct * j_decompress_ptr; +typedef int size_t; +#ifdef __cplusplus +extern "C" { +#endif + void jpeg_CreateDecompress(j_decompress_ptr cinfo, + int version, size_t structsize); +#ifdef __cplusplus +} +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +], + [jpeg_CreateDecompress(0L, 0, 0);], + eval "ac_cv_lib_jpeg_$1=-ljpeg$2", + eval "ac_cv_lib_jpeg_$1=no") +LIBS="$ac_save_LIBS" +CFLAGS="$ac_save_CFLAGS" +]) + +if eval "test ! \"`echo $ac_cv_lib_jpeg_$1`\" = no"; then + LIBJPEG="$ac_cv_lib_jpeg_$1" + AC_MSG_RESULT($ac_cv_lib_jpeg_$1) +else + AC_MSG_RESULT(no) + $3 +fi + +]) + +AC_DEFUN([AC_FIND_JPEG], +[ +dnl first look for libraries +KDE_FIND_JPEG_HELPER(6b, 6b, + KDE_FIND_JPEG_HELPER(normal, [], + [ + LIBJPEG= + ] + ) +) + +dnl then search the headers (can't use simply AC_TRY_xxx, as jpeglib.h +dnl requires system dependent includes loaded before it) +jpeg_incdirs="$includedir /usr/include /usr/local/include $kde_extra_includes" +AC_FIND_FILE(jpeglib.h, $jpeg_incdirs, jpeg_incdir) +test "x$jpeg_incdir" = xNO && jpeg_incdir= + +dnl if headers _and_ libraries are missing, this is no error, and we +dnl continue with a warning (the user will get no jpeg support in khtml) +dnl if only one is missing, it means a configuration error, but we still +dnl only warn +if test -n "$jpeg_incdir" && test -n "$LIBJPEG" ; then + AC_DEFINE_UNQUOTED(HAVE_LIBJPEG, 1, [Define if you have libjpeg]) +else + if test -n "$jpeg_incdir" || test -n "$LIBJPEG" ; then + AC_MSG_WARN([ +There is an installation error in jpeg support. You seem to have only one +of either the headers _or_ the libraries installed. You may need to either +provide correct --with-extra-... options, or the development package of +libjpeg6b. You can get a source package of libjpeg from http://www.ijg.org/ +Disabling JPEG support. +]) + else + AC_MSG_WARN([libjpeg not found. disable JPEG support.]) + fi + jpeg_incdir= + LIBJPEG= +fi + +AC_SUBST(LIBJPEG) +AH_VERBATIM(_AC_CHECK_JPEG, +[/* + * jpeg.h needs HAVE_BOOLEAN, when the system uses boolean in system + * headers and I'm too lazy to write a configure test as long as only + * unixware is related + */ +#ifdef _UNIXWARE +#define HAVE_BOOLEAN +#endif +]) +]) + +AC_DEFUN([KDE_CHECK_QT_JPEG], +[ +if test -n "$LIBJPEG"; then +AC_MSG_CHECKING([if Qt needs $LIBJPEG]) +AC_CACHE_VAL(kde_cv_qt_jpeg, +[ +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +ac_save_LIBS="$LIBS" +LIBS="$all_libraries $USER_LDFLAGS $LIBQT" +LIBS=`echo $LIBS | sed "s/$LIBJPEG//"` +ac_save_CXXFLAGS="$CXXFLAGS" +CXXFLAGS="$CXXFLAGS $all_includes $USER_INCLUDES" +AC_TRY_LINK( +[#include <qapplication.h>], + [ + int argc; + char** argv; + QApplication app(argc, argv);], + eval "kde_cv_qt_jpeg=no", + eval "kde_cv_qt_jpeg=yes") +LIBS="$ac_save_LIBS" +CXXFLAGS="$ac_save_CXXFLAGS" +AC_LANG_RESTORE +fi +]) + +if eval "test ! \"`echo $kde_cv_qt_jpeg`\" = no"; then + AC_MSG_RESULT(yes) + LIBJPEG_QT='$(LIBJPEG)' +else + AC_MSG_RESULT(no) + LIBJPEG_QT= +fi + +]) + +AC_DEFUN([AC_FIND_ZLIB], +[ +AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) +AC_MSG_CHECKING([for libz]) +AC_CACHE_VAL(ac_cv_lib_z, +[ +kde_save_LIBS="$LIBS" +LIBS="$all_libraries $USER_LDFLAGS -lz $LIBSOCKET" +kde_save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS $all_includes $USER_INCLUDES" +AC_TRY_LINK(dnl +[ +#include<zlib.h> +], +[ + char buf[42]; + gzFile f = (gzFile) 0; + /* this would segfault.. but we only link, don't run */ + (void) gzgets(f, buf, sizeof(buf)); + + return (zlibVersion() == ZLIB_VERSION); +], + eval "ac_cv_lib_z='-lz'", + eval "ac_cv_lib_z=no") +LIBS="$kde_save_LIBS" +CFLAGS="$kde_save_CFLAGS" +])dnl +if test ! "$ac_cv_lib_z" = no; then + AC_DEFINE_UNQUOTED(HAVE_LIBZ, 1, [Define if you have libz]) + LIBZ="$ac_cv_lib_z" + AC_MSG_RESULT($ac_cv_lib_z) +else + AC_MSG_ERROR(not found. + Possibly configure picks up an outdated version + installed by XFree86. Remove it from your system. + + Check your installation and look into config.log) + LIBZ="" +fi +AC_SUBST(LIBZ) +]) + +AC_DEFUN([KDE_TRY_TIFFLIB], +[ +AC_MSG_CHECKING([for libtiff $1]) + +AC_CACHE_VAL(kde_cv_libtiff_$1, +[ +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +kde_save_LIBS="$LIBS" +if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then +LIBS="$all_libraries $USER_LDFLAGS -l$1 $LIBJPEG $LIBZ -lX11 $LIBSOCKET -lm" +else +LIBS="$all_libraries $USER_LDFLAGS -l$1 $LIBJPEG $LIBZ -lm" +fi +kde_save_CXXFLAGS="$CXXFLAGS" +CXXFLAGS="$CXXFLAGS $all_includes $USER_INCLUDES" + +AC_TRY_LINK(dnl +[ +#include<tiffio.h> +], + [return (TIFFOpen( "", "r") == 0); ], +[ + kde_cv_libtiff_$1="-l$1 $LIBJPEG $LIBZ" +], [ + kde_cv_libtiff_$1=no +]) + +LIBS="$kde_save_LIBS" +CXXFLAGS="$kde_save_CXXFLAGS" +AC_LANG_RESTORE +]) + +if test "$kde_cv_libtiff_$1" = "no"; then + AC_MSG_RESULT(no) + LIBTIFF="" + $3 +else + LIBTIFF="$kde_cv_libtiff_$1" + AC_MSG_RESULT(yes) + AC_DEFINE_UNQUOTED(HAVE_LIBTIFF, 1, [Define if you have libtiff]) + $2 +fi + +]) + +AC_DEFUN([AC_FIND_TIFF], +[ +AC_REQUIRE([K_PATH_X]) +AC_REQUIRE([AC_FIND_ZLIB]) +AC_REQUIRE([AC_FIND_JPEG]) +AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) + +KDE_TRY_TIFFLIB(tiff, [], + KDE_TRY_TIFFLIB(tiff34)) + +AC_SUBST(LIBTIFF) +]) + + +AC_DEFUN([AC_FIND_PNG], +[ +AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) +AC_REQUIRE([AC_FIND_ZLIB]) +AC_MSG_CHECKING([for libpng]) +AC_CACHE_VAL(ac_cv_lib_png, +[ +kde_save_LIBS="$LIBS" +if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then +LIBS="$LIBS $all_libraries $USER_LDFLAGS -lpng $LIBZ -lm -lX11 $LIBSOCKET" +else +LIBS="$LIBS $all_libraries $USER_LDFLAGS -lpng $LIBZ -lm" +fi +kde_save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS $all_includes $USER_INCLUDES" + +AC_TRY_LINK(dnl + [ + #include<png.h> + ], + [ + png_structp png_ptr = png_create_read_struct( /* image ptr */ + PNG_LIBPNG_VER_STRING, 0, 0, 0 ); + return( png_ptr != 0 ); + ], + eval "ac_cv_lib_png='-lpng $LIBZ -lm'", + eval "ac_cv_lib_png=no" +) +LIBS="$kde_save_LIBS" +CFLAGS="$kde_save_CFLAGS" +])dnl +if eval "test ! \"`echo $ac_cv_lib_png`\" = no"; then + AC_DEFINE_UNQUOTED(HAVE_LIBPNG, 1, [Define if you have libpng]) + LIBPNG="$ac_cv_lib_png" + AC_SUBST(LIBPNG) + AC_MSG_RESULT($ac_cv_lib_png) +else + AC_MSG_RESULT(no) + LIBPNG="" + AC_SUBST(LIBPNG) +fi +]) + + +AC_DEFUN([AC_FIND_JASPER], +[ +AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) +AC_REQUIRE([AC_FIND_JPEG]) +AC_MSG_CHECKING([for jasper]) +AC_CACHE_VAL(ac_cv_jasper, +[ +kde_save_LIBS="$LIBS" +LIBS="$LIBS $all_libraries $USER_LDFLAGS -ljasper $LIBJPEG -lm" +kde_save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS $all_includes $USER_INCLUDES" + +AC_TRY_LINK(dnl + [ + #include<jasper/jasper.h> + ], + [ + return( jas_init() ); + ], + eval "ac_cv_jasper='-ljasper $LIBJPEG -lm'", + eval "ac_cv_jasper=no" +) +LIBS="$kde_save_LIBS" +CFLAGS="$kde_save_CFLAGS" +])dnl +if eval "test ! \"`echo $ac_cv_jasper`\" = no"; then + AC_DEFINE_UNQUOTED(HAVE_JASPER, 1, [Define if you have jasper]) + LIB_JASPER="$ac_cv_jasper" + AC_MSG_RESULT($ac_cv_jasper) +else + AC_MSG_RESULT(no) + LIB_JASPER="" +fi +AC_SUBST(LIB_JASPER) +]) + +AC_DEFUN([AC_CHECK_BOOL], +[ + AC_DEFINE_UNQUOTED(HAVE_BOOL, 1, [You _must_ have bool]) +]) + +AC_DEFUN([AC_CHECK_GNU_EXTENSIONS], +[ +AC_MSG_CHECKING(if you need GNU extensions) +AC_CACHE_VAL(ac_cv_gnu_extensions, +[ +cat > conftest.c << EOF +#include <features.h> + +#ifdef __GNU_LIBRARY__ +yes +#endif +EOF + +if (eval "$ac_cpp conftest.c") 2>&5 | + egrep "yes" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_gnu_extensions=yes +else + ac_cv_gnu_extensions=no +fi +]) + +AC_MSG_RESULT($ac_cv_gnu_extensions) +if test "$ac_cv_gnu_extensions" = "yes"; then + AC_DEFINE_UNQUOTED(_GNU_SOURCE, 1, [Define if you need to use the GNU extensions]) +fi +]) + +AC_DEFUN([KDE_CHECK_COMPILER_FLAG], +[ +AC_MSG_CHECKING([whether $CXX supports -$1]) +kde_cache=`echo $1 | sed 'y% .=/+-,%____p__%'` +AC_CACHE_VAL(kde_cv_prog_cxx_$kde_cache, +[ + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + save_CXXFLAGS="$CXXFLAGS" + CXXFLAGS="$CXXFLAGS -$1" + AC_TRY_LINK([],[ return 0; ], [eval "kde_cv_prog_cxx_$kde_cache=yes"], []) + CXXFLAGS="$save_CXXFLAGS" + AC_LANG_RESTORE +]) +if eval "test \"`echo '$kde_cv_prog_cxx_'$kde_cache`\" = yes"; then + AC_MSG_RESULT(yes) + : + $2 +else + AC_MSG_RESULT(no) + : + $3 +fi +]) + +dnl AC_REMOVE_FORBIDDEN removes forbidden arguments from variables +dnl use: AC_REMOVE_FORBIDDEN(CC, [-forbid -bad-option whatever]) +dnl it's all white-space separated +AC_DEFUN([AC_REMOVE_FORBIDDEN], +[ __val=$$1 + __forbid=" $2 " + if test -n "$__val"; then + __new="" + ac_save_IFS=$IFS + IFS=" " + for i in $__val; do + case "$__forbid" in + *" $i "*) AC_MSG_WARN([found forbidden $i in $1, removing it]) ;; + *) # Careful to not add spaces, where there were none, because otherwise + # libtool gets confused, if we change e.g. CXX + if test -z "$__new" ; then __new=$i ; else __new="$__new $i" ; fi ;; + esac + done + IFS=$ac_save_IFS + $1=$__new + fi +]) + +dnl AC_VALIDIFY_CXXFLAGS checks for forbidden flags the user may have given +AC_DEFUN([AC_VALIDIFY_CXXFLAGS], +[dnl +if test "x$kde_use_qt_emb" != "xyes"; then + AC_REMOVE_FORBIDDEN(CXX, [-fno-rtti -rpath]) + AC_REMOVE_FORBIDDEN(CXXFLAGS, [-fno-rtti -rpath]) +else + AC_REMOVE_FORBIDDEN(CXX, [-rpath]) + AC_REMOVE_FORBIDDEN(CXXFLAGS, [-rpath]) +fi +]) + +AC_DEFUN([AC_CHECK_COMPILERS], +[ + AC_ARG_ENABLE(debug, + AC_HELP_STRING([--enable-debug=ARG],[enables debug symbols (yes|no|full) [default=no]]), + [ + case $enableval in + yes) + kde_use_debug_code="yes" + kde_use_debug_define=no + ;; + full) + kde_use_debug_code="full" + kde_use_debug_define=no + ;; + *) + kde_use_debug_code="no" + kde_use_debug_define=yes + ;; + esac + ], + [kde_use_debug_code="no" + kde_use_debug_define=no + ]) + + dnl Just for configure --help + AC_ARG_ENABLE(dummyoption, + AC_HELP_STRING([--disable-debug], + [disables debug output and debug symbols [default=no]]), + [],[]) + + AC_ARG_ENABLE(strict, + AC_HELP_STRING([--enable-strict], + [compiles with strict compiler options (may not work!)]), + [ + if test $enableval = "no"; then + kde_use_strict_options="no" + else + kde_use_strict_options="yes" + fi + ], [kde_use_strict_options="no"]) + + AC_ARG_ENABLE(warnings,AC_HELP_STRING([--disable-warnings],[disables compilation with -Wall and similiar]), + [ + if test $enableval = "no"; then + kde_use_warnings="no" + else + kde_use_warnings="yes" + fi + ], [kde_use_warnings="yes"]) + + dnl enable warnings for debug build + if test "$kde_use_debug_code" != "no"; then + kde_use_warnings=yes + fi + + AC_ARG_ENABLE(profile,AC_HELP_STRING([--enable-profile],[creates profiling infos [default=no]]), + [kde_use_profiling=$enableval], + [kde_use_profiling="no"] + ) + + dnl this prevents stupid AC_PROG_CC to add "-g" to the default CFLAGS + CFLAGS=" $CFLAGS" + + AC_PROG_CC + + AC_PROG_CPP + + if test "$GCC" = "yes"; then + if test "$kde_use_debug_code" != "no"; then + if test $kde_use_debug_code = "full"; then + CFLAGS="-g3 -fno-inline $CFLAGS" + else + CFLAGS="-g -O2 $CFLAGS" + fi + else + CFLAGS="-O2 $CFLAGS" + fi + fi + + if test "$kde_use_debug_define" = "yes"; then + CFLAGS="-DNDEBUG $CFLAGS" + fi + + + case "$host" in + *-*-sysv4.2uw*) CFLAGS="-D_UNIXWARE $CFLAGS";; + *-*-sysv5uw7*) CFLAGS="-D_UNIXWARE7 $CFLAGS";; + esac + + if test -z "$LDFLAGS" && test "$kde_use_debug_code" = "no" && test "$GCC" = "yes"; then + LDFLAGS="" + fi + + CXXFLAGS=" $CXXFLAGS" + + AC_PROG_CXX + + if test "$GXX" = "yes" || test "$CXX" = "KCC"; then + if test "$kde_use_debug_code" != "no"; then + if test "$CXX" = "KCC"; then + CXXFLAGS="+K0 -Wall -pedantic -W -Wpointer-arith -Wwrite-strings $CXXFLAGS" + else + if test "$kde_use_debug_code" = "full"; then + CXXFLAGS="-g3 -fno-inline $CXXFLAGS" + else + CXXFLAGS="-g -O2 $CXXFLAGS" + fi + fi + KDE_CHECK_COMPILER_FLAG(fno-builtin,[CXXFLAGS="-fno-builtin $CXXFLAGS"]) + + dnl convenience compiler flags + KDE_CHECK_COMPILER_FLAG(Woverloaded-virtual, [WOVERLOADED_VIRTUAL="-Woverloaded-virtual"], [WOVERLOADED_VRITUAL=""]) + AC_SUBST(WOVERLOADED_VIRTUAL) + else + if test "$CXX" = "KCC"; then + CXXFLAGS="+K3 $CXXFLAGS" + else + CXXFLAGS="-O2 $CXXFLAGS" + fi + fi + fi + + if test "$kde_use_debug_define" = "yes"; then + CXXFLAGS="-DNDEBUG -DNO_DEBUG $CXXFLAGS" + fi + + if test "$kde_use_profiling" = "yes"; then + KDE_CHECK_COMPILER_FLAG(pg, + [ + CFLAGS="-pg $CFLAGS" + CXXFLAGS="-pg $CXXFLAGS" + ]) + fi + + if test "$kde_use_warnings" = "yes"; then + if test "$GCC" = "yes"; then + case $host in + *-*-linux-gnu) + CFLAGS="-ansi -W -Wall -Wchar-subscripts -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -D_XOPEN_SOURCE=500 -D_BSD_SOURCE $CFLAGS" + CXXFLAGS="-ansi -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wcast-align -Wconversion -Wchar-subscripts $CXXFLAGS" + KDE_CHECK_COMPILER_FLAG(Wmissing-format-attribute, [CXXFLAGS="$CXXFLAGS -Wformat-security -Wmissing-format-attribute"; CFLAGS="$CFLAGS -Wformat-security -Wmissing-format-attribute"]) + ;; + esac + CXXFLAGS="-Wall -W -Wpointer-arith -Wwrite-strings $CXXFLAGS" + KDE_CHECK_COMPILER_FLAG(Wundef,[CXXFLAGS="-Wundef $CXXFLAGS"]) + KDE_CHECK_COMPILER_FLAG(Wno-long-long,[CXXFLAGS="-Wno-long-long $CXXFLAGS"]) + KDE_CHECK_COMPILER_FLAG(Wnon-virtual-dtor,[CXXFLAGS="-Wnon-virtual-dtor $CXXFLAGS"]) + fi + fi + + if test "$GXX" = "yes" && test "$kde_use_strict_options" = "yes"; then + CXXFLAGS="-Wcast-qual -Wshadow -Wcast-align $CXXFLAGS" + fi + + if test "$GXX" = "yes"; then + KDE_CHECK_COMPILER_FLAG(fno-exceptions,[CXXFLAGS="$CXXFLAGS -fno-exceptions"]) + KDE_CHECK_COMPILER_FLAG(fno-check-new, [CXXFLAGS="$CXXFLAGS -fno-check-new"]) + KDE_CHECK_COMPILER_FLAG(fno-common, [CXXFLAGS="$CXXFLAGS -fno-common"]) + KDE_CHECK_COMPILER_FLAG(fexceptions, [USE_EXCEPTIONS="-fexceptions"], USE_EXCEPTIONS= ) + fi + if test "$CXX" = "KCC"; then + dnl unfortunately we currently cannot disable exception support in KCC + dnl because doing so is binary incompatible and Qt by default links with exceptions :-( + dnl KDE_CHECK_COMPILER_FLAG(-no_exceptions,[CXXFLAGS="$CXXFLAGS --no_exceptions"]) + dnl KDE_CHECK_COMPILER_FLAG(-exceptions, [USE_EXCEPTIONS="--exceptions"], USE_EXCEPTIONS= ) + + AC_ARG_ENABLE(pch, + AC_HELP_STRING([--enable-pch], + [enables precompiled header support (currently only KCC) [default=no]]), + [ + kde_use_pch=$enableval + ],[kde_use_pch=no]) + + if test "$kde_use_pch" = "yes"; then + dnl TODO: support --pch-dir! + KDE_CHECK_COMPILER_FLAG(-pch,[CXXFLAGS="$CXXFLAGS --pch"]) + dnl the below works (but the dir must exist), but it's + dnl useless for a whole package. + dnl The are precompiled headers for each source file, so when compiling + dnl from scratch, it doesn't make a difference, and they take up + dnl around ~5Mb _per_ sourcefile. + dnl KDE_CHECK_COMPILER_FLAG(-pch_dir /tmp, + dnl [CXXFLAGS="$CXXFLAGS --pch_dir `pwd`/pcheaders"]) + fi + dnl this flag controls inlining. by default KCC inlines in optimisation mode + dnl all implementations that are defined inside the class {} declaration. + dnl because of templates-compatibility with broken gcc compilers, this + dnl can cause excessive inlining. This flag limits it to a sane level + KDE_CHECK_COMPILER_FLAG(-inline_keyword_space_time=6,[CXXFLAGS="$CXXFLAGS --inline_keyword_space_time=6"]) + KDE_CHECK_COMPILER_FLAG(-inline_auto_space_time=2,[CXXFLAGS="$CXXFLAGS --inline_auto_space_time=2"]) + KDE_CHECK_COMPILER_FLAG(-inline_implicit_space_time=2.0,[CXXFLAGS="$CXXFLAGS --inline_implicit_space_time=2.0"]) + KDE_CHECK_COMPILER_FLAG(-inline_generated_space_time=2.0,[CXXFLAGS="$CXXFLAGS --inline_generated_space_time=2.0"]) + dnl Some source files are shared between multiple executables + dnl (or libraries) and some of those need template instantiations. + dnl In that case KCC needs to compile those sources with + dnl --one_instantiation_per_object. To make it easy for us we compile + dnl _all_ objects with that flag (--one_per is a shorthand). + KDE_CHECK_COMPILER_FLAG(-one_per, [CXXFLAGS="$CXXFLAGS --one_per"]) + fi + AC_SUBST(USE_EXCEPTIONS) + dnl obsolete macro - provided to keep things going + USE_RTTI= + AC_SUBST(USE_RTTI) + + case "$host" in + *-*-irix*) test "$GXX" = yes && CXXFLAGS="-D_LANGUAGE_C_PLUS_PLUS -D__LANGUAGE_C_PLUS_PLUS $CXXFLAGS" ;; + *-*-sysv4.2uw*) CXXFLAGS="-D_UNIXWARE $CXXFLAGS";; + *-*-sysv5uw7*) CXXFLAGS="-D_UNIXWARE7 $CXXFLAGS";; + *-*-solaris*) + if test "$GXX" = yes; then + libstdcpp=`$CXX -print-file-name=libstdc++.so` + if test ! -f $libstdcpp; then + AC_MSG_ERROR([You've compiled gcc without --enable-shared. This doesn't work with KDE. Please recompile gcc with --enable-shared to receive a libstdc++.so]) + fi + fi + ;; + esac + + AC_VALIDIFY_CXXFLAGS + + AC_PROG_CXXCPP + + if test "$GCC" = yes; then + NOOPT_CFLAGS=-O0 + fi + KDE_CHECK_COMPILER_FLAG(O0,[NOOPT_CXXFLAGS=-O0]) + + AC_SUBST(NOOPT_CXXFLAGS) + AC_SUBST(NOOPT_CFLAGS) + + KDE_CHECK_FINAL + KDE_CHECK_CLOSURE + KDE_CHECK_NMCHECK + + ifdef([AM_DEPENDENCIES], AC_REQUIRE([KDE_ADD_DEPENDENCIES]), []) +]) + +AC_DEFUN([KDE_ADD_DEPENDENCIES], +[ + [A]M_DEPENDENCIES(CC) + [A]M_DEPENDENCIES(CXX) +]) + +dnl just a wrapper to clean up configure.in +AC_DEFUN([KDE_PROG_LIBTOOL], +[ +AC_REQUIRE([AC_CHECK_COMPILERS]) +AC_REQUIRE([AC_ENABLE_SHARED]) +AC_REQUIRE([AC_ENABLE_STATIC]) + +AC_REQUIRE([AC_LIBTOOL_DLOPEN]) +AC_REQUIRE([KDE_CHECK_LIB64]) + +AC_OBJEXT +AC_EXEEXT + +AM_PROG_LIBTOOL +AC_LIBTOOL_CXX + +LIBTOOL_SHELL="/bin/sh ./libtool" +# LIBTOOL="$LIBTOOL --silent" +KDE_PLUGIN="-avoid-version -module -no-undefined \$(KDE_NO_UNDEFINED) \$(KDE_RPATH) \$(KDE_MT_LDFLAGS)" +AC_SUBST(KDE_PLUGIN) + +# we patch configure quite some so we better keep that consistent for incremental runs +AC_SUBST(AUTOCONF,'$(SHELL) $(top_srcdir)/admin/cvs.sh configure || touch configure') +]) + +AC_DEFUN([KDE_CHECK_LIB64], +[ + kdelibsuff=no + AC_ARG_ENABLE(libsuffix, + AC_HELP_STRING([--enable-libsuffix], + [/lib directory suffix (64,32,none[=default])]), + kdelibsuff=$enableval) + # TODO: add an auto case that compiles a little C app to check + # where the glibc is + if test "$kdelibsuff" = "no"; then + kdelibsuff= + fi + if test -z "$kdelibsuff"; then + AC_MSG_RESULT([not using lib directory suffix]) + AC_DEFINE(KDELIBSUFF, [""], Suffix for lib directories) + else + if test "$libdir" = '${exec_prefix}/lib'; then + libdir="$libdir${kdelibsuff}" + AC_SUBST([libdir], ["$libdir"]) dnl ugly hack for lib64 platforms + fi + AC_DEFINE_UNQUOTED(KDELIBSUFF, ["\"${kdelibsuff}\""], Suffix for lib directories) + AC_MSG_RESULT([using lib directory suffix $kdelibsuff]) + fi +]) + +AC_DEFUN([KDE_CHECK_TYPES], +[ AC_CHECK_SIZEOF(int, 4)dnl + AC_CHECK_SIZEOF(short)dnl + AC_CHECK_SIZEOF(long, 4)dnl + AC_CHECK_SIZEOF(char *, 4)dnl +])dnl + +AC_DEFUN([KDE_DO_IT_ALL], +[ +AC_CANONICAL_SYSTEM +AC_ARG_PROGRAM +AM_INIT_AUTOMAKE($1, $2) +AM_DISABLE_LIBRARIES +AC_PREFIX_DEFAULT(${KDEDIR:-/usr/local/kde}) +AC_CHECK_COMPILERS +KDE_PROG_LIBTOOL +AM_KDE_WITH_NLS +AC_PATH_KDE +]) + +AC_DEFUN([AC_CHECK_RPATH], +[ +AC_MSG_CHECKING(for rpath) +AC_ARG_ENABLE(rpath, + AC_HELP_STRING([--disable-rpath],[do not use the rpath feature of ld]), + USE_RPATH=$enableval, USE_RPATH=yes) + +if test -z "$KDE_RPATH" && test "$USE_RPATH" = "yes"; then + + KDE_RPATH="-R \$(kde_libraries)" + + if test -n "$qt_libraries"; then + KDE_RPATH="$KDE_RPATH -R \$(qt_libraries)" + fi + dnl $x_libraries is set to /usr/lib in case + if test -n "$X_LDFLAGS"; then + X_RPATH="-R \$(x_libraries)" + KDE_RPATH="$KDE_RPATH $X_RPATH" + fi + if test -n "$KDE_EXTRA_RPATH"; then + KDE_RPATH="$KDE_RPATH \$(KDE_EXTRA_RPATH)" + fi +fi +AC_SUBST(KDE_EXTRA_RPATH) +AC_SUBST(KDE_RPATH) +AC_SUBST(X_RPATH) +AC_MSG_RESULT($USE_RPATH) +]) + +dnl Check for the type of the third argument of getsockname +AC_DEFUN([AC_CHECK_SOCKLEN_T], [ + AC_MSG_CHECKING(for socklen_t) + AC_CACHE_VAL(ac_cv_socklen_t, [ + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + AC_TRY_COMPILE([ +#include <sys/types.h> +#include <sys/socket.h> + ],[ +socklen_t a=0; +getsockname(0,(struct sockaddr*)0, &a); + ], + ac_cv_socklen_t=socklen_t, + AC_TRY_COMPILE([ +#include <sys/types.h> +#include <sys/socket.h> + ],[ +int a=0; +getsockname(0,(struct sockaddr*)0, &a); + ], + ac_cv_socklen_t=int, + ac_cv_socklen_t=size_t + ) + ) + AC_LANG_RESTORE + ]) + + AC_MSG_RESULT($ac_cv_socklen_t) + if test "$ac_cv_socklen_t" != "socklen_t"; then + AC_DEFINE_UNQUOTED(socklen_t, $ac_cv_socklen_t, + [Define the real type of socklen_t]) + fi + AC_DEFINE_UNQUOTED(ksize_t, socklen_t, [Compatibility define]) + +]) + +dnl This is a merge of some macros out of the gettext aclocal.m4 +dnl since we don't need anything, I took the things we need +dnl the copyright for them is: +dnl > +dnl Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. +dnl This Makefile.in is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without +dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A +dnl PARTICULAR PURPOSE. +dnl > +dnl for this file it is relicensed under LGPL + +AC_DEFUN([AM_KDE_WITH_NLS], + [ + dnl If we use NLS figure out what method + + AM_PATH_PROG_WITH_TEST_KDE(MSGFMT, msgfmt, + [test -n "`$ac_dir/$ac_word --version 2>&1 | grep 'GNU gettext'`"], msgfmt) + AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) + + if test -z "`$GMSGFMT --version 2>&1 | grep 'GNU gettext'`"; then + AC_MSG_RESULT([found msgfmt program is not GNU msgfmt; ignore it]) + GMSGFMT=":" + fi + MSGFMT=$GMSGFMT + AC_SUBST(GMSGFMT) + AC_SUBST(MSGFMT) + + AM_PATH_PROG_WITH_TEST_KDE(XGETTEXT, xgettext, + [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) + + dnl Test whether we really found GNU xgettext. + if test "$XGETTEXT" != ":"; then + dnl If it is no GNU xgettext we define it as : so that the + dnl Makefiles still can work. + if $XGETTEXT --omit-header /dev/null 2> /dev/null; then + : ; + else + AC_MSG_RESULT( + [found xgettext programs is not GNU xgettext; ignore it]) + XGETTEXT=":" + fi + fi + AC_SUBST(XGETTEXT) + + ]) + +# Search path for a program which passes the given test. +# Ulrich Drepper <[email protected]>, 1996. + +# serial 1 +# Stephan Kulow: I appended a _KDE against name conflicts + +dnl AM_PATH_PROG_WITH_TEST_KDE(VARIABLE, PROG-TO-CHECK-FOR, +dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) +AC_DEFUN([AM_PATH_PROG_WITH_TEST_KDE], +[# Extract the first word of "$2", so it can be a program name with args. +set dummy $2; ac_word=[$]2 +AC_MSG_CHECKING([for $ac_word]) +AC_CACHE_VAL(ac_cv_path_$1, +[case "[$]$1" in + /*) + ac_cv_path_$1="[$]$1" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in ifelse([$5], , $PATH, [$5]); do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if [$3]; then + ac_cv_path_$1="$ac_dir/$ac_word" + break + fi + fi + done + IFS="$ac_save_ifs" +dnl If no 4th arg is given, leave the cache variable unset, +dnl so AC_PATH_PROGS will keep looking. +ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" +])dnl + ;; +esac])dnl +$1="$ac_cv_path_$1" +if test -n "[$]$1"; then + AC_MSG_RESULT([$]$1) +else + AC_MSG_RESULT(no) +fi +AC_SUBST($1)dnl +]) + + +# Check whether LC_MESSAGES is available in <locale.h>. +# Ulrich Drepper <[email protected]>, 1995. + +# serial 1 + +AC_DEFUN([AM_LC_MESSAGES], + [if test $ac_cv_header_locale_h = yes; then + AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES, + [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES], + am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)]) + if test $am_cv_val_LC_MESSAGES = yes; then + AC_DEFINE(HAVE_LC_MESSAGES, 1, [Define if your locale.h file contains LC_MESSAGES]) + fi + fi]) + +dnl From Jim Meyering. +dnl FIXME: migrate into libit. + +AC_DEFUN([AM_FUNC_OBSTACK], +[AC_CACHE_CHECK([for obstacks], am_cv_func_obstack, + [AC_TRY_LINK([#include "obstack.h"], + [struct obstack *mem;obstack_free(mem,(char *) 0)], + am_cv_func_obstack=yes, + am_cv_func_obstack=no)]) + if test $am_cv_func_obstack = yes; then + AC_DEFINE(HAVE_OBSTACK) + else + LIBOBJS="$LIBOBJS obstack.o" + fi +]) + +dnl From Jim Meyering. Use this if you use the GNU error.[ch]. +dnl FIXME: Migrate into libit + +AC_DEFUN([AM_FUNC_ERROR_AT_LINE], +[AC_CACHE_CHECK([for error_at_line], am_cv_lib_error_at_line, + [AC_TRY_LINK([],[error_at_line(0, 0, "", 0, "");], + am_cv_lib_error_at_line=yes, + am_cv_lib_error_at_line=no)]) + if test $am_cv_lib_error_at_line = no; then + LIBOBJS="$LIBOBJS error.o" + fi + AC_SUBST(LIBOBJS)dnl +]) + +# Macro to add for using GNU gettext. +# Ulrich Drepper <[email protected]>, 1995. + +# serial 1 +# Stephan Kulow: I put a KDE in it to avoid name conflicts + +AC_DEFUN([AM_KDE_GNU_GETTEXT], + [AC_REQUIRE([AC_PROG_MAKE_SET])dnl + AC_REQUIRE([AC_PROG_RANLIB])dnl + AC_REQUIRE([AC_HEADER_STDC])dnl + AC_REQUIRE([AC_TYPE_OFF_T])dnl + AC_REQUIRE([AC_TYPE_SIZE_T])dnl + AC_REQUIRE([AC_FUNC_ALLOCA])dnl + AC_REQUIRE([AC_FUNC_MMAP])dnl + AC_REQUIRE([AM_KDE_WITH_NLS])dnl + AC_CHECK_HEADERS([limits.h locale.h nl_types.h string.h values.h alloca.h]) + AC_CHECK_FUNCS([getcwd munmap putenv setlocale strchr strcasecmp \ +__argz_count __argz_stringify __argz_next]) + + AC_MSG_CHECKING(for stpcpy) + AC_CACHE_VAL(kde_cv_func_stpcpy, + [ + kde_safe_cxxflags=$CXXFLAGS + CXXFLAGS="-Werror" + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + AC_TRY_COMPILE([ + #include <string.h> + ], + [ + char buffer[200]; + stpcpy(buffer, buffer); + ], + kde_cv_func_stpcpy=yes, + kde_cv_func_stpcpy=no) + AC_LANG_RESTORE + CXXFLAGS=$kde_safe_cxxflags + ]) + AC_MSG_RESULT($kde_cv_func_stpcpy) + if eval "test \"`echo $kde_cv_func_stpcpy`\" = yes"; then + AC_DEFINE(HAVE_STPCPY, 1, [Define if you have stpcpy]) + fi + + AM_LC_MESSAGES + + if test "x$CATOBJEXT" != "x"; then + if test "x$ALL_LINGUAS" = "x"; then + LINGUAS= + else + AC_MSG_CHECKING(for catalogs to be installed) + NEW_LINGUAS= + for lang in ${LINGUAS=$ALL_LINGUAS}; do + case "$ALL_LINGUAS" in + *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;; + esac + done + LINGUAS=$NEW_LINGUAS + AC_MSG_RESULT($LINGUAS) + fi + + dnl Construct list of names of catalog files to be constructed. + if test -n "$LINGUAS"; then + for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done + fi + fi + + ]) + +AC_DEFUN([AC_HAVE_XPM], + [AC_REQUIRE_CPP()dnl + AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) + + test -z "$XPM_LDFLAGS" && XPM_LDFLAGS= + test -z "$XPM_INCLUDE" && XPM_INCLUDE= + + AC_ARG_WITH(xpm,AC_HELP_STRING([--without-xpm],[disable color pixmap XPM tests]), + xpm_test=$withval, xpm_test="yes") + if test "x$xpm_test" = xno; then + ac_cv_have_xpm=no + else + AC_MSG_CHECKING(for XPM) + AC_CACHE_VAL(ac_cv_have_xpm, + [ + ac_save_ldflags="$LDFLAGS" + ac_save_cflags="$CFLAGS" + if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then + LDFLAGS="$LDFLAGS $X_LDFLAGS $USER_LDFLAGS $LDFLAGS $XPM_LDFLAGS $all_libraries -lXpm -lX11 -lXext $LIBZ $LIBSOCKET" + else + LDFLAGS="$LDFLAGS $X_LDFLAGS $USER_LDFLAGS $LDFLAGS $XPM_LDFLAGS $all_libraries -lXpm $LIBZ $LIBSOCKET" + fi + CFLAGS="$CFLAGS $X_INCLUDES $USER_INCLUDES" + test -n "$XPM_INCLUDE" && CFLAGS="-I$XPM_INCLUDE $CFLAGS" + AC_TRY_LINK([#include <X11/xpm.h>],[], + ac_cv_have_xpm="yes",ac_cv_have_xpm="no") + LDFLAGS="$ac_save_ldflags" + CFLAGS="$ac_save_cflags" + ])dnl + + if test "$ac_cv_have_xpm" = no; then + AC_MSG_RESULT(no) + XPM_LDFLAGS="" + XPMINC="" + $2 + else + AC_DEFINE(HAVE_XPM, 1, [Define if you have XPM support]) + if test "$XPM_LDFLAGS" = ""; then + XPMLIB='-lXpm $(LIB_X11)' + else + XPMLIB="-L$XPM_LDFLAGS -lXpm "'$(LIB_X11)' + fi + if test "$XPM_INCLUDE" = ""; then + XPMINC="" + else + XPMINC="-I$XPM_INCLUDE" + fi + AC_MSG_RESULT(yes) + $1 + fi + fi + AC_SUBST(XPMINC) + AC_SUBST(XPMLIB) +]) + +AC_DEFUN([AC_HAVE_DPMS], + [AC_REQUIRE_CPP()dnl + AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) + + test -z "$DPMS_LDFLAGS" && DPMS_LDFLAGS= + test -z "$DPMS_INCLUDE" && DPMS_INCLUDE= + DPMS_LIB= + + AC_ARG_WITH(dpms,AC_HELP_STRING([--without-dpms],[disable DPMS power saving]), + dpms_test=$withval, dpms_test="yes") + if test "x$dpms_test" = xno; then + ac_cv_have_dpms=no + else + AC_MSG_CHECKING(for DPMS) + dnl Note: ac_cv_have_dpms can be no, yes, or -lXdpms. + dnl 'yes' means DPMS_LIB="", '-lXdpms' means DPMS_LIB="-lXdpms". + AC_CACHE_VAL(ac_cv_have_dpms, + [ + if test "x$kde_use_qt_emb" = "xyes" || test "x$kde_use_qt_mac" = "xyes"; then + AC_MSG_RESULT(no) + ac_cv_have_dpms="no" + else + ac_save_ldflags="$LDFLAGS" + ac_save_cflags="$CFLAGS" + ac_save_libs="$LIBS" + LDFLAGS="$LDFLAGS $DPMS_LDFLAGS $all_libraries -lX11 -lXext $LIBSOCKET" + CFLAGS="$CFLAGS $X_INCLUDES" + test -n "$DPMS_INCLUDE" && CFLAGS="-I$DPMS_INCLUDE $CFLAGS" + AC_TRY_LINK([ + #include <X11/Xproto.h> + #include <X11/X.h> + #include <X11/Xlib.h> + #include <X11/extensions/dpms.h> + int foo_test_dpms() + { return DPMSSetTimeouts( 0, 0, 0, 0 ); }],[], + ac_cv_have_dpms="yes", [ + LDFLAGS="$ac_save_ldflags" + CFLAGS="$ac_save_cflags" + LDFLAGS="$LDFLAGS $DPMS_LDFLAGS $all_libraries -lX11 -lXext $LIBSOCKET" + LIBS="$LIBS -lXdpms" + CFLAGS="$CFLAGS $X_INCLUDES" + test -n "$DPMS_INCLUDE" && CFLAGS="-I$DPMS_INCLUDE $CFLAGS" + AC_TRY_LINK([ + #include <X11/Xproto.h> + #include <X11/X.h> + #include <X11/Xlib.h> + #include <X11/extensions/dpms.h> + int foo_test_dpms() + { return DPMSSetTimeouts( 0, 0, 0, 0 ); }],[], + [ + ac_cv_have_dpms="-lXdpms" + ],ac_cv_have_dpms="no") + ]) + LDFLAGS="$ac_save_ldflags" + CFLAGS="$ac_save_cflags" + LIBS="$ac_save_libs" + fi + ])dnl + + if test "$ac_cv_have_dpms" = no; then + AC_MSG_RESULT(no) + DPMS_LDFLAGS="" + DPMSINC="" + $2 + else + AC_DEFINE(HAVE_DPMS, 1, [Define if you have DPMS support]) + if test "$ac_cv_have_dpms" = "-lXdpms"; then + DPMS_LIB="-lXdpms" + fi + if test "$DPMS_LDFLAGS" = ""; then + DPMSLIB="$DPMS_LIB "'$(LIB_X11)' + else + DPMSLIB="$DPMS_LDFLAGS $DPMS_LIB "'$(LIB_X11)' + fi + if test "$DPMS_INCLUDE" = ""; then + DPMSINC="" + else + DPMSINC="-I$DPMS_INCLUDE" + fi + AC_MSG_RESULT(yes) + $1 + fi + fi + ac_save_cflags="$CFLAGS" + CFLAGS="$CFLAGS $X_INCLUDES" + test -n "$DPMS_INCLUDE" && CFLAGS="-I$DPMS_INCLUDE $CFLAGS" + AH_TEMPLATE(HAVE_DPMSCAPABLE_PROTO, + [Define if you have the DPMSCapable prototype in <X11/extensions/dpms.h>]) + AC_CHECK_DECL(DPMSCapable, + AC_DEFINE(HAVE_DPMSCAPABLE_PROTO),, + [#include <X11/extensions/dpms.h>]) + AH_TEMPLATE(HAVE_DPMSINFO_PROTO, + [Define if you have the DPMSInfo prototype in <X11/extensions/dpms.h>]) + AC_CHECK_DECL(DPMSInfo, + AC_DEFINE(HAVE_DPMSINFO_PROTO),, + [#include <X11/extensions/dpms.h>]) + CFLAGS="$ac_save_cflags" + AC_SUBST(DPMSINC) + AC_SUBST(DPMSLIB) +]) + +AC_DEFUN([AC_HAVE_GL], + [AC_REQUIRE_CPP()dnl + AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) + + test -z "$GL_LDFLAGS" && GL_LDFLAGS= + test -z "$GL_INCLUDE" && GL_INCLUDE= + + AC_ARG_WITH(gl,AC_HELP_STRING([--without-gl],[disable 3D GL modes]), + gl_test=$withval, gl_test="yes") + if test "x$kde_use_qt_emb" = "xyes"; then + # GL and Qt Embedded is a no-go for now. + ac_cv_have_gl=no + elif test "x$gl_test" = xno; then + ac_cv_have_gl=no + else + AC_MSG_CHECKING(for GL) + AC_CACHE_VAL(ac_cv_have_gl, + [ + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + ac_save_ldflags="$LDFLAGS" + ac_save_cxxflags="$CXXFLAGS" + LDFLAGS="$LDFLAGS $GL_LDFLAGS $X_LDFLAGS $all_libraries -lMesaGL -lMesaGLU" + test "x$kde_use_qt_mac" != xyes && test "x$kde_use_qt_emb" != xyes && LDFLAGS="$LDFLAGS -lX11" + LDFLAGS="$LDFLAGS $LIB_XEXT -lm $LIBSOCKET" + CXXFLAGS="$CFLAGS $X_INCLUDES" + test -n "$GL_INCLUDE" && CFLAGS="-I$GL_INCLUDE $CFLAGS" + AC_TRY_LINK([#include <GL/gl.h> +#include <GL/glu.h> +], [], + ac_cv_have_gl="mesa", ac_cv_have_gl="no") + if test "x$ac_cv_have_gl" = "xno"; then + LDFLAGS="$ac_save_ldflags $X_LDFLAGS $GL_LDFLAGS $all_libraries -lGLU -lGL" + test "x$kde_use_qt_mac" != xyes && test "x$kde_use_qt_emb" != xyes && LDFLAGS="$LDFLAGS -lX11" + LDFLAGS="$LDFLAGS $LIB_XEXT -lm $LIBSOCKET" + CXXFLAGS="$ac_save_cflags $X_INCLUDES" + test -n "$GL_INCLUDE" && CFLAGS="-I$GL_INCLUDE $CFLAGS" + AC_TRY_LINK([#include <GL/gl.h> +#include <GL/glu.h> +], [], + ac_cv_have_gl="yes", ac_cv_have_gl="no") + fi + AC_LANG_RESTORE + LDFLAGS="$ac_save_ldflags" + CXXFLAGS="$ac_save_cxxflags" + ])dnl + + if test "$ac_cv_have_gl" = "no"; then + AC_MSG_RESULT(no) + GL_LDFLAGS="" + GLINC="" + $2 + else + AC_DEFINE(HAVE_GL, 1, [Defines if you have GL (Mesa, OpenGL, ...)]) + if test "$GL_LDFLAGS" = ""; then + if test "$ac_cv_have_gl" = "mesa"; then + GLLIB='-lMesaGLU -lMesaGL $(LIB_X11)' + else + GLLIB='-lGLU -lGL $(LIB_X11)' + fi + else + if test "$ac_cv_have_gl" = "mesa"; then + GLLIB="$GL_LDFLAGS -lMesaGLU -lMesaGL "'$(LIB_X11)' + else + GLLIB="$GL_LDFLAGS -lGLU -lGL "'$(LIB_X11)' + fi + fi + if test "$GL_INCLUDE" = ""; then + GLINC="" + else + GLINC="-I$GL_INCLUDE" + fi + AC_MSG_RESULT($ac_cv_have_gl) + $1 + fi + fi + AC_SUBST(GLINC) + AC_SUBST(GLLIB) +]) + + + dnl shadow password and PAM magic - maintained by [email protected] + +AC_DEFUN([KDE_PAM], [ + AC_REQUIRE([KDE_CHECK_LIBDL]) + + want_pam= + AC_ARG_WITH(pam, + AC_HELP_STRING([--with-pam[=ARG]],[enable support for PAM: ARG=[yes|no|service name]]), + [ if test "x$withval" = "xyes"; then + want_pam=yes + pam_service=kde + elif test "x$withval" = "xno"; then + want_pam=no + else + want_pam=yes + pam_service=$withval + fi + ], [ pam_service=kde ]) + + use_pam= + PAMLIBS= + if test "x$want_pam" != xno; then + AC_CHECK_LIB(pam, pam_start, [ + AC_CHECK_HEADER(security/pam_appl.h, + [ pam_header=security/pam_appl.h ], + [ AC_CHECK_HEADER(pam/pam_appl.h, + [ pam_header=pam/pam_appl.h ], + [ + AC_MSG_WARN([PAM detected, but no headers found! +Make sure you have the necessary development packages installed.]) + ] + ) + ] + ) + ], , $LIBDL) + if test -z "$pam_header"; then + if test "x$want_pam" = xyes; then + AC_MSG_ERROR([--with-pam was specified, but cannot compile with PAM!]) + fi + else + AC_DEFINE(HAVE_PAM, 1, [Defines if you have PAM (Pluggable Authentication Modules)]) + PAMLIBS="$PAM_MISC_LIB -lpam $LIBDL" + use_pam=yes + + dnl darwin claims to be something special + if test "$pam_header" = "pam/pam_appl.h"; then + AC_DEFINE(HAVE_PAM_PAM_APPL_H, 1, [Define if your PAM headers are in pam/ instead of security/]) + fi + + dnl test whether struct pam_message is const (Linux) or not (Sun) + AC_MSG_CHECKING(for const pam_message) + AC_EGREP_HEADER([struct pam_message], $pam_header, + [ AC_EGREP_HEADER([const struct pam_message], $pam_header, + [AC_MSG_RESULT([const: Linux-type PAM])], + [AC_MSG_RESULT([nonconst: Sun-type PAM]) + AC_DEFINE(PAM_MESSAGE_NONCONST, 1, [Define if your PAM support takes non-const arguments (Solaris)])] + )], + [AC_MSG_RESULT([not found - assume const, Linux-type PAM])]) + fi + fi + + AC_SUBST(PAMLIBS) +]) + +dnl DEF_PAM_SERVICE(arg name, full name, define name) +AC_DEFUN([DEF_PAM_SERVICE], [ + AC_ARG_WITH($1-pam, + AC_HELP_STRING([--with-$1-pam=[val]],[override PAM service from --with-pam for $2]), + [ if test "x$use_pam" = xyes; then + $3_PAM_SERVICE=$withval + else + AC_MSG_ERROR([Cannot use use --with-$1-pam, as no PAM was detected. +You may want to enforce it by using --with-pam.]) + fi + ], + [ if test "x$use_pam" = xyes; then + $3_PAM_SERVICE="$pam_service" + fi + ]) + if test -n "$$3_PAM_SERVICE"; then + AC_MSG_RESULT([The PAM service used by $2 will be $$3_PAM_SERVICE]) + AC_DEFINE_UNQUOTED($3_PAM_SERVICE, "$$3_PAM_SERVICE", [The PAM service to be used by $2]) + fi + AC_SUBST($3_PAM_SERVICE) +]) + +AC_DEFUN([KDE_SHADOWPASSWD], [ + AC_REQUIRE([KDE_PAM]) + + AC_CHECK_LIB(shadow, getspent, + [ LIBSHADOW="-lshadow" + ac_use_shadow=yes + ], + [ dnl for UnixWare + AC_CHECK_LIB(gen, getspent, + [ LIBGEN="-lgen" + ac_use_shadow=yes + ], + [ AC_CHECK_FUNC(getspent, + [ ac_use_shadow=yes ], + [ ac_use_shadow=no ]) + ]) + ]) + AC_SUBST(LIBSHADOW) + AC_SUBST(LIBGEN) + + AC_MSG_CHECKING([for shadow passwords]) + + AC_ARG_WITH(shadow, + AC_HELP_STRING([--with-shadow],[If you want shadow password support]), + [ if test "x$withval" != "xno"; then + use_shadow=yes + else + use_shadow=no + fi + ], [ + use_shadow="$ac_use_shadow" + ]) + + if test "x$use_shadow" = xyes; then + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_SHADOW, 1, [Define if you use shadow passwords]) + else + AC_MSG_RESULT(no) + LIBSHADOW= + LIBGEN= + fi + + dnl finally make the relevant binaries setuid root, if we have shadow passwds. + dnl this still applies, if we could use it indirectly through pam. + if test "x$use_shadow" = xyes || + ( test "x$use_pam" = xyes && test "x$ac_use_shadow" = xyes ); then + case $host in + *-*-freebsd* | *-*-netbsd* | *-*-openbsd*) + SETUIDFLAGS="-m 4755 -o root";; + *) + SETUIDFLAGS="-m 4755";; + esac + fi + AC_SUBST(SETUIDFLAGS) + +]) + +AC_DEFUN([KDE_PASSWDLIBS], [ + AC_REQUIRE([KDE_MISC_TESTS]) dnl for LIBCRYPT + AC_REQUIRE([KDE_PAM]) + AC_REQUIRE([KDE_SHADOWPASSWD]) + + if test "x$use_pam" = "xyes"; then + PASSWDLIBS="$PAMLIBS" + else + PASSWDLIBS="$LIBCRYPT $LIBSHADOW $LIBGEN" + fi + + dnl FreeBSD uses a shadow-like setup, where /etc/passwd holds the users, but + dnl /etc/master.passwd holds the actual passwords. /etc/master.passwd requires + dnl root to read, so kcheckpass needs to be root (even when using pam, since pam + dnl may need to read /etc/master.passwd). + case $host in + *-*-freebsd*) + SETUIDFLAGS="-m 4755 -o root" + ;; + *) + ;; + esac + + AC_SUBST(PASSWDLIBS) +]) + +AC_DEFUN([KDE_CHECK_LIBDL], +[ +AC_CHECK_LIB(dl, dlopen, [ +LIBDL="-ldl" +ac_cv_have_dlfcn=yes +]) + +AC_CHECK_LIB(dld, shl_unload, [ +LIBDL="-ldld" +ac_cv_have_shload=yes +]) + +AC_SUBST(LIBDL) +]) + +AC_DEFUN([KDE_CHECK_DLOPEN], +[ +KDE_CHECK_LIBDL +AC_CHECK_HEADERS(dlfcn.h dl.h) +if test "$ac_cv_header_dlfcn_h" = "no"; then + ac_cv_have_dlfcn=no +fi + +if test "$ac_cv_header_dl_h" = "no"; then + ac_cv_have_shload=no +fi + +dnl XXX why change enable_dlopen? its already set by autoconf's AC_ARG_ENABLE +dnl (MM) +AC_ARG_ENABLE(dlopen, +AC_HELP_STRING([--disable-dlopen],[link statically [default=no]]), +enable_dlopen=$enableval, +enable_dlopen=yes) + +# override the user's opinion, if we know it better ;) +if test "$ac_cv_have_dlfcn" = "no" && test "$ac_cv_have_shload" = "no"; then + enable_dlopen=no +fi + +if test "$ac_cv_have_dlfcn" = "yes"; then + AC_DEFINE_UNQUOTED(HAVE_DLFCN, 1, [Define if you have dlfcn]) +fi + +if test "$ac_cv_have_shload" = "yes"; then + AC_DEFINE_UNQUOTED(HAVE_SHLOAD, 1, [Define if you have shload]) +fi + +if test "$enable_dlopen" = no ; then + test -n "$1" && eval $1 +else + test -n "$2" && eval $2 +fi + +]) + +AC_DEFUN([KDE_CHECK_DYNAMIC_LOADING], +[ +KDE_CHECK_DLOPEN(libtool_enable_shared=yes, libtool_enable_static=no) +KDE_PROG_LIBTOOL +AC_MSG_CHECKING([dynamic loading]) +eval "`egrep '^build_libtool_libs=' libtool`" +if test "$build_libtool_libs" = "yes" && test "$enable_dlopen" = "yes"; then + dynamic_loading=yes + AC_DEFINE_UNQUOTED(HAVE_DYNAMIC_LOADING) +else + dynamic_loading=no +fi +AC_MSG_RESULT($dynamic_loading) +if test "$dynamic_loading" = "yes"; then + $1 +else + $2 +fi +]) + +AC_DEFUN([KDE_ADD_INCLUDES], +[ +if test -z "$1"; then + test_include="Pix.h" +else + test_include="$1" +fi + +AC_MSG_CHECKING([for libg++ ($test_include)]) + +AC_CACHE_VAL(kde_cv_libgpp_includes, +[ +kde_cv_libgpp_includes=no + + for ac_dir in \ + \ + /usr/include/g++ \ + /usr/include \ + /usr/unsupported/include \ + /opt/include \ + $extra_include \ + ; \ + do + if test -r "$ac_dir/$test_include"; then + kde_cv_libgpp_includes=$ac_dir + break + fi + done +]) + +AC_MSG_RESULT($kde_cv_libgpp_includes) +if test "$kde_cv_libgpp_includes" != "no"; then + all_includes="-I$kde_cv_libgpp_includes $all_includes $USER_INCLUDES" +fi +]) +]) + +AC_DEFUN([KDE_CHECK_LIBPTHREAD], +[ + LIBPTHREAD="" + + if test -n "$PTHREAD_LIBS"; then + PTHREAD_LIBS_save="$PTHREAD_LIBS" + PTHREAD_LIBS=`echo "$PTHREAD_LIBS_save" | sed -e 's,^-l,,g'` + KDE_CHECK_LIB($PTHREAD_LIBS, pthread_create, [LIBPTHREAD="$PTHREAD_LIBS_save"] ) + PTHREAD_LIBS="$PTHREAD_LIBS_save" + fi + + if test -z "$LIBPTHREAD"; then + AC_CHECK_LIB(pthread, pthread_create, [LIBPTHREAD="-lpthread"] ) + fi + + AC_SUBST(LIBPTHREAD) +]) + +AC_DEFUN([KDE_CHECK_PTHREAD_OPTION], +[ + USE_THREADS="" + if test -z "$LIBPTHREAD"; then + KDE_CHECK_COMPILER_FLAG(pthread, [USE_THREADS="-D_THREAD_SAFE -pthread"]) + fi + + AH_VERBATIM(__svr_define, [ +#if defined(__SVR4) && !defined(__svr4__) +#define __svr4__ 1 +#endif +]) + case $host_os in + solaris*) + KDE_CHECK_COMPILER_FLAG(mt, [USE_THREADS="-mt"]) + CPPFLAGS="$CPPFLAGS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DUSE_SOLARIS -DSVR4" + ;; + freebsd*) + CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE $PTHREAD_CFLAGS" + ;; + aix*) + CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" + LIBPTHREAD="$LIBPTHREAD -lc_r" + ;; + linux*) CPPFLAGS="$CPPFLAGS -D_REENTRANT" + if test "$CXX" = "KCC"; then + CXXFLAGS="$CXXFLAGS --thread_safe" + NOOPT_CXXFLAGS="$NOOPT_CXXFLAGS --thread_safe" + fi + ;; + *) + ;; + esac + AC_SUBST(USE_THREADS) + AC_SUBST(LIBPTHREAD) +]) + +AC_DEFUN([KDE_CHECK_THREADING], +[ + AC_REQUIRE([KDE_CHECK_LIBPTHREAD]) + AC_REQUIRE([KDE_CHECK_PTHREAD_OPTION]) + dnl default is yes if libpthread is found and no if no libpthread is available + if test -z "$LIBPTHREAD"; then + if test -z "$USE_THREADS"; then + kde_check_threading_default=no + else + kde_check_threading_default=yes + fi + else + kde_check_threading_default=yes + fi + AC_ARG_ENABLE(threading,AC_HELP_STRING([--disable-threading],[disables threading even if libpthread found]), + kde_use_threading=$enableval, kde_use_threading=$kde_check_threading_default) + if test "x$kde_use_threading" = "xyes"; then + AC_DEFINE(HAVE_LIBPTHREAD, 1, [Define if you have a working libpthread (will enable threaded code)]) + fi +]) + +AC_DEFUN([KDE_TRY_LINK_PYTHON], +[ +if test "$kde_python_link_found" = no; then + +if test "$1" = normal; then + AC_MSG_CHECKING(if a Python application links) +else + AC_MSG_CHECKING(if Python depends on $2) +fi + +AC_CACHE_VAL(kde_cv_try_link_python_$1, +[ +kde_save_cflags="$CFLAGS" +CFLAGS="$CFLAGS $PYTHONINC" +kde_save_libs="$LIBS" +LIBS="$LIBS $LIBPYTHON $2 $LIBDL $LIBSOCKET" +kde_save_ldflags="$LDFLAGS" +LDFLAGS="$LDFLAGS $PYTHONLIB" + +AC_TRY_LINK( +[ +#include <Python.h> +],[ + PySys_SetArgv(1, 0); +], + [kde_cv_try_link_python_$1=yes], + [kde_cv_try_link_python_$1=no] +) +CFLAGS="$kde_save_cflags" +LIBS="$kde_save_libs" +LDFLAGS="$kde_save_ldflags" +]) + +if test "$kde_cv_try_link_python_$1" = "yes"; then + AC_MSG_RESULT(yes) + kde_python_link_found=yes + if test ! "$1" = normal; then + LIBPYTHON="$LIBPYTHON $2" + fi + $3 +else + AC_MSG_RESULT(no) + $4 +fi + +fi + +]) + +AC_DEFUN([KDE_CHECK_PYTHON_DIR], +[ +AC_MSG_CHECKING([for Python directory]) + +AC_CACHE_VAL(kde_cv_pythondir, +[ + if test -z "$PYTHONDIR"; then + kde_cv_pythondir=/usr/local + else + kde_cv_pythondir="$PYTHONDIR" + fi +]) + +AC_ARG_WITH(pythondir, +AC_HELP_STRING([--with-pythondir=pythondir],[use python installed in pythondir]), +[ + ac_python_dir=$withval +], ac_python_dir=$kde_cv_pythondir +) + +AC_MSG_RESULT($ac_python_dir) +]) + +AC_DEFUN([KDE_CHECK_PYTHON_INTERN], +[ +AC_REQUIRE([KDE_CHECK_LIBDL]) +AC_REQUIRE([KDE_CHECK_LIBPTHREAD]) +AC_REQUIRE([KDE_CHECK_PYTHON_DIR]) + +if test -z "$1"; then + version="1.5" +else + version="$1" +fi + +AC_MSG_CHECKING([for Python$version]) + +python_incdirs="$ac_python_dir/include /usr/include /usr/local/include/ $kde_extra_includes" +AC_FIND_FILE(Python.h, $python_incdirs, python_incdir) +if test ! -r $python_incdir/Python.h; then + AC_FIND_FILE(python$version/Python.h, $python_incdirs, python_incdir) + python_incdir=$python_incdir/python$version + if test ! -r $python_incdir/Python.h; then + python_incdir=no + fi +fi + +PYTHONINC=-I$python_incdir + +python_libdirs="$ac_python_dir/lib$kdelibsuff /usr/lib$kdelibsuff /usr/local /usr/lib$kdelibsuff $kde_extra_libs" +AC_FIND_FILE(libpython$version.so, $python_libdirs, python_libdir) +if test ! -r $python_libdir/libpython$version.so; then + AC_FIND_FILE(libpython$version.a, $python_libdirs, python_libdir) + if test ! -r $python_libdir/libpython$version.a; then + AC_FIND_FILE(python$version/config/libpython$version.a, $python_libdirs, python_libdir) + python_libdir=$python_libdir/python$version/config + if test ! -r $python_libdir/libpython$version.a; then + python_libdir=no + fi + fi +fi + +PYTHONLIB=-L$python_libdir +kde_orig_LIBPYTHON=$LIBPYTHON +if test -z "$LIBPYTHON"; then + LIBPYTHON=-lpython$version +fi + +AC_FIND_FILE(python$version/copy.py, $python_libdirs, python_moddir) +python_moddir=$python_moddir/python$version +if test ! -r $python_moddir/copy.py; then + python_moddir=no +fi + +PYTHONMODDIR=$python_moddir + +AC_MSG_RESULT(header $python_incdir library $python_libdir modules $python_moddir) + +if test x$python_incdir = xno || test x$python_libdir = xno || test x$python_moddir = xno; then + LIBPYTHON=$kde_orig_LIBPYTHON + test "x$PYTHONLIB" = "x-Lno" && PYTHONLIB="" + test "x$PYTHONINC" = "x-Ino" && PYTHONINC="" + $2 +else + dnl Note: this test is very weak + kde_python_link_found=no + KDE_TRY_LINK_PYTHON(normal) + KDE_TRY_LINK_PYTHON(m, -lm) + KDE_TRY_LINK_PYTHON(pthread, $LIBPTHREAD) + KDE_TRY_LINK_PYTHON(tcl, -ltcl) + KDE_TRY_LINK_PYTHON(db2, -ldb2) + KDE_TRY_LINK_PYTHON(m_and_thread, [$LIBPTHREAD -lm]) + KDE_TRY_LINK_PYTHON(m_and_thread_and_util, [$LIBPTHREAD -lm -lutil]) + KDE_TRY_LINK_PYTHON(m_and_thread_and_db3, [$LIBPTHREAD -lm -ldb-3 -lutil]) + KDE_TRY_LINK_PYTHON(pthread_and_db3, [$LIBPTHREAD -ldb-3]) + KDE_TRY_LINK_PYTHON(m_and_thread_and_db, [$LIBPTHREAD -lm -ldb -ltermcap -lutil]) + KDE_TRY_LINK_PYTHON(pthread_and_dl, [$LIBPTHREAD $LIBDL -lutil -lreadline -lncurses -lm]) + KDE_TRY_LINK_PYTHON(pthread_and_panel_curses, [$LIBPTHREAD $LIBDL -lm -lpanel -lcurses]) + KDE_TRY_LINK_PYTHON(m_and_thread_and_db_special, [$LIBPTHREAD -lm -ldb -lutil], [], + [AC_MSG_WARN([it seems, Python depends on another library. + Please set LIBPYTHON to '-lpython$version -lotherlib' before calling configure to fix this + and contact the authors to let them know about this problem]) + ]) + + LIBPYTHON="$LIBPYTHON $LIBDL $LIBSOCKET" + AC_SUBST(PYTHONINC) + AC_SUBST(PYTHONLIB) + AC_SUBST(LIBPYTHON) + AC_SUBST(PYTHONMODDIR) + AC_DEFINE(HAVE_PYTHON, 1, [Define if you have the development files for python]) +fi + +]) + + +AC_DEFUN([KDE_CHECK_PYTHON], +[ + KDE_CHECK_PYTHON_INTERN("2.3", + [KDE_CHECK_PYTHON_INTERN("2.2", + [KDE_CHECK_PYTHON_INTERN("2.1", + [KDE_CHECK_PYTHON_INTERN("2.0", + [KDE_CHECK_PYTHON_INTERN($1, $2) ]) + ]) + ]) + ]) +]) + +AC_DEFUN([KDE_CHECK_STL], +[ + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + ac_save_CXXFLAGS="$CXXFLAGS" + CXXFLAGS="`echo $CXXFLAGS | sed s/-fno-exceptions//`" + + AC_MSG_CHECKING([if C++ programs can be compiled]) + AC_CACHE_VAL(kde_cv_stl_works, + [ + AC_TRY_COMPILE([ +#include <string> +using namespace std; +],[ + string astring="Hallo Welt."; + astring.erase(0, 6); // now astring is "Welt" + return 0; +], kde_cv_stl_works=yes, + kde_cv_stl_works=no) +]) + + AC_MSG_RESULT($kde_cv_stl_works) + + if test "$kde_cv_stl_works" = "yes"; then + # back compatible + AC_DEFINE_UNQUOTED(HAVE_SGI_STL, 1, [Define if you have a STL implementation by SGI]) + else + AC_MSG_ERROR([Your Installation isn't able to compile simple C++ programs. +Check config.log for details - if you're using a Linux distribution you might miss +a package named similiar to libstd++-dev.]) + fi + + CXXFLAGS="$ac_save_CXXFLAGS" + AC_LANG_RESTORE +]) + +AC_DEFUN([AC_FIND_QIMGIO], + [AC_REQUIRE([AC_FIND_JPEG]) +AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) +AC_MSG_CHECKING([for qimgio]) +AC_CACHE_VAL(ac_cv_lib_qimgio, +[ +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +ac_save_LIBS="$LIBS" +ac_save_CXXFLAGS="$CXXFLAGS" +LIBS="$all_libraries -lqimgio -lpng -lz $LIBJPEG $LIBQT" +CXXFLAGS="$CXXFLAGS -I$qt_incdir $all_includes" +AC_TRY_RUN(dnl +[ +#include <qimageio.h> +#include <qstring.h> +int main() { + QString t = "hallo"; + t.fill('t'); + qInitImageIO(); +} +], + ac_cv_lib_qimgio=yes, + ac_cv_lib_qimgio=no, + ac_cv_lib_qimgio=no) +LIBS="$ac_save_LIBS" +CXXFLAGS="$ac_save_CXXFLAGS" +AC_LANG_RESTORE +])dnl +if eval "test \"`echo $ac_cv_lib_qimgio`\" = yes"; then + LIBQIMGIO="-lqimgio -lpng -lz $LIBJPEG" + AC_MSG_RESULT(yes) + AC_DEFINE_UNQUOTED(HAVE_QIMGIO, 1, [Define if you have the Qt extension qimgio available]) + AC_SUBST(LIBQIMGIO) +else + AC_MSG_RESULT(not found) +fi +]) + +AC_DEFUN([AM_DISABLE_LIBRARIES], +[ + AC_PROVIDE([AM_ENABLE_STATIC]) + AC_PROVIDE([AM_ENABLE_SHARED]) + enable_static=no + enable_shared=yes +]) + + +AC_DEFUN([AC_CHECK_UTMP_FILE], +[ + AC_MSG_CHECKING([for utmp file]) + + AC_CACHE_VAL(kde_cv_utmp_file, + [ + kde_cv_utmp_file=no + + for ac_file in \ + \ + /var/run/utmp \ + /var/adm/utmp \ + /etc/utmp \ + ; \ + do + if test -r "$ac_file"; then + kde_cv_utmp_file=$ac_file + break + fi + done + ]) + + if test "$kde_cv_utmp_file" != "no"; then + AC_DEFINE_UNQUOTED(UTMP, "$kde_cv_utmp_file", [Define the file for utmp entries]) + $1 + AC_MSG_RESULT($kde_cv_utmp_file) + else + $2 + AC_MSG_RESULT([non found]) + fi +]) + + +AC_DEFUN([KDE_CREATE_SUBDIRSLIST], +[ + +DO_NOT_COMPILE="$DO_NOT_COMPILE CVS debian bsd-port admin" + +if test ! -s $srcdir/subdirs; then + dnl Note: Makefile.common creates subdirs, so this is just a fallback + TOPSUBDIRS="" + files=`cd $srcdir && ls -1` + dirs=`for i in $files; do if test -d $i; then echo $i; fi; done` + for i in $dirs; do + echo $i >> $srcdir/subdirs + done +fi + +ac_topsubdirs= +if test -s $srcdir/inst-apps; then + ac_topsubdirs="`cat $srcdir/inst-apps`" +elif test -s $srcdir/subdirs; then + ac_topsubdirs="`cat $srcdir/subdirs`" +fi + +for i in $ac_topsubdirs; do + AC_MSG_CHECKING([if $i should be compiled]) + if test -d $srcdir/$i; then + install_it="yes" + for j in $DO_NOT_COMPILE; do + if test $i = $j; then + install_it="no" + fi + done + else + install_it="no" + fi + AC_MSG_RESULT($install_it) + vari=`echo $i | sed -e 's,[[-+.]],_,g'` + if test $install_it = "yes"; then + TOPSUBDIRS="$TOPSUBDIRS $i" + eval "$vari""_SUBDIR_included=yes" + else + eval "$vari""_SUBDIR_included=no" + fi +done + +AC_SUBST(TOPSUBDIRS) +]) + +AC_DEFUN([KDE_CHECK_NAMESPACES], +[ +AC_MSG_CHECKING(whether C++ compiler supports namespaces) +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +AC_TRY_COMPILE([ +], +[ +namespace Foo { + extern int i; + namespace Bar { + extern int i; + } +} + +int Foo::i = 0; +int Foo::Bar::i = 1; +],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_NAMESPACES) +], [ +AC_MSG_RESULT(no) +]) +AC_LANG_RESTORE +]) + +dnl ------------------------------------------------------------------------ +dnl Check for S_ISSOCK macro. Doesn't exist on Unix SCO. [email protected] +dnl ------------------------------------------------------------------------ +dnl +AC_DEFUN([AC_CHECK_S_ISSOCK], +[ +AC_MSG_CHECKING(for S_ISSOCK) +AC_CACHE_VAL(ac_cv_have_s_issock, +[ +AC_TRY_LINK( +[ +#include <sys/stat.h> +], +[ +struct stat buff; +int b = S_ISSOCK( buff.st_mode ); +], +ac_cv_have_s_issock=yes, +ac_cv_have_s_issock=no) +]) +AC_MSG_RESULT($ac_cv_have_s_issock) +if test "$ac_cv_have_s_issock" = "yes"; then + AC_DEFINE_UNQUOTED(HAVE_S_ISSOCK, 1, [Define if sys/stat.h declares S_ISSOCK.]) +fi + +AH_VERBATIM(_ISSOCK, +[ +#ifndef HAVE_S_ISSOCK +#define HAVE_S_ISSOCK +#define S_ISSOCK(mode) (1==0) +#endif +]) + +]) + +dnl ------------------------------------------------------------------------ +dnl Check for MAXPATHLEN macro, defines KDEMAXPATHLEN. [email protected] +dnl ------------------------------------------------------------------------ +dnl +AC_DEFUN([AC_CHECK_KDEMAXPATHLEN], +[ +AC_MSG_CHECKING(for MAXPATHLEN) +AC_CACHE_VAL(ac_cv_maxpathlen, +[ +cat > conftest.$ac_ext <<EOF +#ifdef STDC_HEADERS +# include <stdlib.h> +#endif +#include <stdio.h> +#include <sys/param.h> +#ifndef MAXPATHLEN +#define MAXPATHLEN 1024 +#endif + +KDE_HELLO MAXPATHLEN + +EOF + +ac_try="$ac_cpp conftest.$ac_ext 2>/dev/null | grep '^KDE_HELLO' >conftest.out" + +if AC_TRY_EVAL(ac_try) && test -s conftest.out; then + ac_cv_maxpathlen=`sed 's#KDE_HELLO ##' conftest.out` +else + ac_cv_maxpathlen=1024 +fi + +rm conftest.* + +]) +AC_MSG_RESULT($ac_cv_maxpathlen) +AC_DEFINE_UNQUOTED(KDEMAXPATHLEN,$ac_cv_maxpathlen, [Define a safe value for MAXPATHLEN] ) +]) + +AC_DEFUN([KDE_CHECK_HEADER], +[ + AC_LANG_SAVE + kde_safe_cppflags=$CPPFLAGS + CPPFLAGS="$CPPFLAGS $all_includes" + AC_LANG_CPLUSPLUS + AC_CHECK_HEADER([$1], [$2], [$3], [$4]) + CPPFLAGS=$kde_safe_cppflags + AC_LANG_RESTORE +]) + +AC_DEFUN([KDE_CHECK_HEADERS], +[ + AH_CHECK_HEADERS([$1]) + AC_LANG_SAVE + kde_safe_cppflags=$CPPFLAGS + CPPFLAGS="$CPPFLAGS $all_includes" + AC_LANG_CPLUSPLUS + AC_CHECK_HEADERS([$1], [$2], [$3], [$4]) + CPPFLAGS=$kde_safe_cppflags + AC_LANG_RESTORE +]) + +AC_DEFUN([KDE_FAST_CONFIGURE], +[ + dnl makes configure fast (needs perl) + AC_ARG_ENABLE(fast-perl, AC_HELP_STRING([--disable-fast-perl],[disable fast Makefile generation (needs perl)]), + with_fast_perl=$enableval, with_fast_perl=yes) +]) + +AC_DEFUN([KDE_CONF_FILES], +[ + val= + if test -f $srcdir/configure.files ; then + val=`sed -e 's%^%\$(top_srcdir)/%' $srcdir/configure.files` + fi + CONF_FILES= + if test -n "$val" ; then + for i in $val ; do + CONF_FILES="$CONF_FILES $i" + done + fi + AC_SUBST(CONF_FILES) +])dnl + +AC_DEFUN([KDE_SET_PREFIX], +[ + unset CDPATH + dnl make $KDEDIR the default for the installation + AC_PREFIX_DEFAULT(${KDEDIR:-/usr/local/kde}) + + if test "x$prefix" = "xNONE"; then + prefix=$ac_default_prefix + ac_configure_args="$ac_configure_args --prefix=$prefix" + fi + # And delete superfluous '/' to make compares easier + prefix=`echo "$prefix" | sed 's,//*,/,g' | sed -e 's,/$,,'` + exec_prefix=`echo "$exec_prefix" | sed 's,//*,/,g' | sed -e 's,/$,,'` + KDE_FAST_CONFIGURE + KDE_CONF_FILES +]) + +pushdef([AC_PROG_INSTALL], +[ + dnl our own version, testing for a -p flag + popdef([AC_PROG_INSTALL]) + dnl as AC_PROG_INSTALL works as it works we first have + dnl to save if the user didn't specify INSTALL, as the + dnl autoconf one overwrites INSTALL and we have no chance to find + dnl out afterwards + test -n "$INSTALL" && kde_save_INSTALL_given=$INSTALL + test -n "$INSTALL_PROGRAM" && kde_save_INSTALL_PROGRAM_given=$INSTALL_PROGRAM + test -n "$INSTALL_SCRIPT" && kde_save_INSTALL_SCRIPT_given=$INSTALL_SCRIPT + AC_PROG_INSTALL + + if test -z "$kde_save_INSTALL_given" ; then + # OK, user hasn't given any INSTALL, autoconf found one for us + # now we test, if it supports the -p flag + AC_MSG_CHECKING(for -p flag to install) + rm -f confinst.$$.* > /dev/null 2>&1 + echo "Testtest" > confinst.$$.orig + ac_res=no + if ${INSTALL} -p confinst.$$.orig confinst.$$.new > /dev/null 2>&1 ; then + if test -f confinst.$$.new ; then + # OK, -p seems to do no harm to install + INSTALL="${INSTALL} -p" + ac_res=yes + fi + fi + rm -f confinst.$$.* + AC_MSG_RESULT($ac_res) + fi + dnl the following tries to resolve some signs and wonders coming up + dnl with different autoconf/automake versions + dnl e.g.: + dnl *automake 1.4 install-strip sets A_M_INSTALL_PROGRAM_FLAGS to -s + dnl and has INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(A_M_INSTALL_PROGRAM_FLAGS) + dnl it header-vars.am, so there the actual INSTALL_PROGRAM gets the -s + dnl *automake 1.4a (and above) use INSTALL_STRIP_FLAG and only has + dnl INSTALL_PROGRAM = @INSTALL_PROGRAM@ there, but changes the + dnl install-@DIR@PROGRAMS targets to explicitly use that flag + dnl *autoconf 2.13 is dumb, and thinks it can use INSTALL_PROGRAM as + dnl INSTALL_SCRIPT, which breaks with automake <= 1.4 + dnl *autoconf >2.13 (since 10.Apr 1999) has not that failure + dnl *sometimes KDE does not use the install-@DIR@PROGRAM targets from + dnl automake (due to broken Makefile.am or whatever) to install programs, + dnl and so does not see the -s flag in automake > 1.4 + dnl to clean up that mess we: + dnl +set INSTALL_PROGRAM to use INSTALL_STRIP_FLAG + dnl which cleans KDE's program with automake > 1.4; + dnl +set INSTALL_SCRIPT to only use INSTALL, to clean up autoconf's problems + dnl with automake<=1.4 + dnl note that dues to this sometimes two '-s' flags are used (if KDE + dnl properly uses install-@DIR@PROGRAMS, but I don't care + dnl + dnl And to all this comes, that I even can't write in comments variable + dnl names used by automake, because it is so stupid to think I wanted to + dnl _use_ them, therefor I have written A_M_... instead of AM_ + dnl hmm, I wanted to say something ... ahh yes: Arghhh. + + if test -z "$kde_save_INSTALL_PROGRAM_given" ; then + INSTALL_PROGRAM='${INSTALL} $(INSTALL_STRIP_FLAG)' + fi + if test -z "$kde_save_INSTALL_SCRIPT_given" ; then + INSTALL_SCRIPT='${INSTALL}' + fi +])dnl + +AC_DEFUN([KDE_LANG_CPLUSPLUS], +[AC_LANG_CPLUSPLUS +ac_link='rm -rf SunWS_cache; ${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&AC_FD_CC' +pushdef([AC_LANG_CPLUSPLUS], [popdef([AC_LANG_CPLUSPLUS]) KDE_LANG_CPLUSPLUS]) +]) + +pushdef([AC_LANG_CPLUSPLUS], +[popdef([AC_LANG_CPLUSPLUS]) +KDE_LANG_CPLUSPLUS +]) + +AC_DEFUN([KDE_CHECK_LONG_LONG], +[ +AC_MSG_CHECKING(for long long) +AC_CACHE_VAL(kde_cv_c_long_long, +[ + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + AC_TRY_LINK([], [ + long long foo = 0; + foo = foo+1; + ], + kde_cv_c_long_long=yes, kde_cv_c_long_long=no) + AC_LANG_RESTORE +]) +AC_MSG_RESULT($kde_cv_c_long_long) +if test "$kde_cv_c_long_long" = yes; then + AC_DEFINE(HAVE_LONG_LONG, 1, [Define if you have long long as datatype]) +fi +]) + +AC_DEFUN([KDE_CHECK_LIB], +[ + kde_save_LDFLAGS="$LDFLAGS" + dnl AC_CHECK_LIB modifies LIBS, so save it here + kde_save_LIBS="$LIBS" + LDFLAGS="$LDFLAGS $all_libraries" + case $host_os in + aix*) LDFLAGS="-brtl $LDFLAGS" + test "$GCC" = yes && LDFLAGS="-Wl,$LDFLAGS" + ;; + esac + AC_CHECK_LIB($1, $2, $3, $4, $5) + LDFLAGS="$kde_save_LDFLAGS" + LIBS="$kde_save_LIBS" +]) + +AC_DEFUN([KDE_JAVA_PREFIX], +[ + dir=`dirname "$1"` + base=`basename "$1"` + list=`ls -1 $dir 2> /dev/null` + for entry in $list; do + if test -d $dir/$entry/bin; then + case $entry in + $base) + javadirs="$javadirs $dir/$entry/bin" + ;; + esac + elif test -d $dir/$entry/jre/bin; then + case $entry in + $base) + javadirs="$javadirs $dir/$entry/jre/bin" + ;; + esac + fi + done +]) + +dnl KDE_CHEC_JAVA_DIR(onlyjre) +AC_DEFUN([KDE_CHECK_JAVA_DIR], +[ + +AC_ARG_WITH(java, +AC_HELP_STRING([--with-java=javadir],[use java installed in javadir, --without-java disables]), +[ ac_java_dir=$withval +], ac_java_dir="" +) + +AC_MSG_CHECKING([for Java]) + +dnl at this point ac_java_dir is either a dir, 'no' to disable, or '' to say look in $PATH +if test "x$ac_java_dir" = "xno"; then + kde_java_bindir=no + kde_java_includedir=no + kde_java_libjvmdir=no + kde_java_libgcjdir=no + kde_java_libhpidir=no +else + if test "x$ac_java_dir" = "x"; then + + + dnl No option set -> collect list of candidate paths + if test -n "$JAVA_HOME"; then + KDE_JAVA_PREFIX($JAVA_HOME) + fi + KDE_JAVA_PREFIX(/usr/j2se) + KDE_JAVA_PREFIX(/usr/lib/j2se) + KDE_JAVA_PREFIX(/usr/j*dk*) + KDE_JAVA_PREFIX(/usr/lib/j*dk*) + KDE_JAVA_PREFIX(/opt/j*sdk*) + KDE_JAVA_PREFIX(/usr/lib/java*) + KDE_JAVA_PREFIX(/usr/java*) + KDE_JAVA_PREFIX(/usr/java/j*dk*) + KDE_JAVA_PREFIX(/usr/java/j*re*) + KDE_JAVA_PREFIX(/usr/lib/SunJava2*) + KDE_JAVA_PREFIX(/usr/lib/SunJava*) + KDE_JAVA_PREFIX(/usr/lib/IBMJava2*) + KDE_JAVA_PREFIX(/usr/lib/IBMJava*) + KDE_JAVA_PREFIX(/opt/java*) + + kde_cv_path="NONE" + kde_save_IFS=$IFS + IFS=':' + for dir in $PATH; do + if test -d "$dir"; then + javadirs="$javadirs $dir" + fi + done + IFS=$kde_save_IFS + jredirs= + + dnl Now javadirs contains a list of paths that exist, all ending with bin/ + for dir in $javadirs; do + dnl Check for the java executable + if test -x "$dir/java"; then + dnl And also check for a libjvm.so somewhere under there + dnl Since we have to go to the parent dir, /usr/bin is excluded, /usr is too big. + if test "$dir" != "/usr/bin"; then + libjvmdir=`find $dir/.. -name libjvm.so | sed 's,libjvm.so,,'|head -n 1` + if test ! -f $libjvmdir/libjvm.so; then continue; fi + jredirs="$jredirs $dir" + fi + fi + done + + dnl Now jredirs contains a reduced list, of paths where both java and ../**/libjvm.so was found + JAVAC= + JAVA= + kde_java_bindir=no + for dir in $jredirs; do + JAVA="$dir/java" + kde_java_bindir=$dir + if test -x "$dir/javac"; then + JAVAC="$dir/javac" + break + fi + done + + if test -n "$JAVAC"; then + dnl this substitution might not work - well, we test for jni.h below + kde_java_includedir=`echo $JAVAC | sed -e 's,bin/javac$,include/,'` + else + kde_java_includedir=no + fi + else + dnl config option set + kde_java_bindir=$ac_java_dir/bin + if test -x $ac_java_dir/bin/java && test ! -x $ac_java_dir/bin/javac; then + kde_java_includedir=no + else + kde_java_includedir=$ac_java_dir/include + fi + fi +fi + +dnl At this point kde_java_bindir and kde_java_includedir are either set or "no" +if test "x$kde_java_bindir" != "xno"; then + + dnl Look for libjvm.so + kde_java_libjvmdir=`find $kde_java_bindir/.. -name libjvm.so | sed 's,libjvm.so,,'|head -n 1` + dnl Look for libgcj.so + kde_java_libgcjdir=`find $kde_java_bindir/.. -name libgcj.so | sed 's,libgcj.so,,'|head -n 1` + dnl Look for libhpi.so and avoid green threads + kde_java_libhpidir=`find $kde_java_bindir/.. -name libhpi.so | grep -v green | sed 's,libhpi.so,,' | head -n 1` + + dnl Now check everything's fine under there + dnl the include dir is our flag for having the JDK + if test -d "$kde_java_includedir"; then + if test ! -x "$kde_java_bindir/javac"; then + AC_MSG_ERROR([javac not found under $kde_java_bindir - it seems you passed a wrong --with-java.]) + fi + if test ! -x "$kde_java_bindir/javah"; then + AC_MSG_ERROR([javah not found under $kde_java_bindir. javac was found though! Use --with-java or --without-java.]) + fi + if test ! -x "$kde_java_bindir/jar"; then + AC_MSG_ERROR([jar not found under $kde_java_bindir. javac was found though! Use --with-java or --without-java.]) + fi + if test ! -r "$kde_java_includedir/jni.h"; then + AC_MSG_ERROR([jni.h not found under $kde_java_includedir. Use --with-java or --without-java.]) + fi + + jni_includes="-I$kde_java_includedir" + dnl Strange thing, jni.h requires jni_md.h which is under genunix here.. + dnl and under linux here.. + + dnl not needed for gcj + + if test "x$kde_java_libgcjdir" = "x"; then + test -d "$kde_java_includedir/linux" && jni_includes="$jni_includes -I$kde_java_includedir/linux" + test -d "$kde_java_includedir/solaris" && jni_includes="$jni_includes -I$kde_java_includedir/solaris" + test -d "$kde_java_includedir/genunix" && jni_includes="$jni_includes -I$kde_java_includedir/genunix" + fi + + else + JAVAC= + jni_includes= + fi + + if test "x$kde_java_libgcjdir" = "x"; then + if test ! -r "$kde_java_libjvmdir/libjvm.so"; then + AC_MSG_ERROR([libjvm.so not found under $kde_java_libjvmdir. Use --without-java.]) + fi + else + if test ! -r "$kde_java_libgcjdir/libgcj.so"; then + AC_MSG_ERROR([libgcj.so not found under $kde_java_libgcjdir. Use --without-java.]) + fi + fi + + if test ! -x "$kde_java_bindir/java"; then + AC_MSG_ERROR([java not found under $kde_java_bindir. javac was found though! Use --with-java or --without-java.]) + fi + + dnl not needed for gcj compile + + if test "x$kde_java_libgcjdir" = "x"; then + if test ! -r "$kde_java_libhpidir/libhpi.so"; then + AC_MSG_ERROR([libhpi.so not found under $kde_java_libhpidir. Use --without-java.]) + fi + fi + + if test -n "$jni_includes"; then + dnl Check for JNI version + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + ac_cxxflags_safe="$CXXFLAGS" + CXXFLAGS="$CXXFLAGS $all_includes $jni_includes" + + AC_TRY_COMPILE([ + #include <jni.h> + ], + [ + #ifndef JNI_VERSION_1_2 + Syntax Error + #endif + ],[ kde_jni_works=yes ], + [ kde_jni_works=no ]) + + if test $kde_jni_works = no; then + AC_MSG_ERROR([Incorrect version of $kde_java_includedir/jni.h. + You need to have Java Development Kit (JDK) version 1.2. + + Use --with-java to specify another location. + Use --without-java to configure without java support. + Or download a newer JDK and try again. + See e.g. http://java.sun.com/products/jdk/1.2 ]) + fi + + CXXFLAGS="$ac_cxxflags_safe" + AC_LANG_RESTORE + + dnl All tests ok, inform and subst the variables + + JAVAC=$kde_java_bindir/javac + JAVAH=$kde_java_bindir/javah + JAR=$kde_java_bindir/jar + AC_DEFINE_UNQUOTED(PATH_JAVA, "$kde_java_bindir/java", [Define where your java executable is]) + if test "x$kde_java_libgcjdir" = "x"; then + JVMLIBS="-L$kde_java_libjvmdir -ljvm -L$kde_java_libhpidir -lhpi" + else + JVMLIBS="-L$kde_java_libgcjdir -lgcj" + fi + AC_MSG_RESULT([java JDK in $kde_java_bindir]) + + else + AC_DEFINE_UNQUOTED(PATH_JAVA, "$kde_java_bindir/java", [Define where your java executable is]) + AC_MSG_RESULT([java JRE in $kde_java_bindir]) + fi +elif test -d "/Library/Java/Home"; then + kde_java_bindir="/Library/Java/Home/bin" + jni_includes="-I/Library/Java/Home/include" + + JAVAC=$kde_java_bindir/javac + JAVAH=$kde_java_bindir/javah + JAR=$kde_java_bindir/jar + JVMLIBS="-Xlinker -framework -Xlinker JavaVM" + + AC_DEFINE_UNQUOTED(PATH_JAVA, "$kde_java_bindir/java", [Define where your java executable is]) + AC_MSG_RESULT([Apple Java Framework]) +else + AC_MSG_RESULT([none found]) +fi + +AC_SUBST(JAVAC) +AC_SUBST(JAVAH) +AC_SUBST(JAR) +AC_SUBST(JVMLIBS) +AC_SUBST(jni_includes) + +# for backward compat +kde_cv_java_includedir=$kde_java_includedir +kde_cv_java_bindir=$kde_java_bindir +]) + +dnl this is a redefinition of autoconf 2.5x's AC_FOREACH. +dnl When the argument list becomes big, as in KDE for AC_OUTPUT in +dnl big packages, m4_foreach is dog-slow. So use our own version of +dnl it. ([email protected]) +m4_define([mm_foreach], +[m4_pushdef([$1])_mm_foreach($@)m4_popdef([$1])]) +m4_define([mm_car], [[$1]]) +m4_define([mm_car2], [[$@]]) +m4_define([_mm_foreach], +[m4_if(m4_quote($2), [], [], + [m4_define([$1], mm_car($2))$3[]_mm_foreach([$1], + mm_car2(m4_shift($2)), + [$3])])]) +m4_define([AC_FOREACH], +[mm_foreach([$1], m4_split(m4_normalize([$2])), [$3])]) + +AC_DEFUN([KDE_NEED_FLEX], +[ +kde_libs_safe=$LIBS +LIBS="$LIBS $USER_LDFLAGS" +AM_PROG_LEX +LIBS=$kde_libs_safe +if test -z "$LEXLIB"; then + AC_MSG_ERROR([You need to have flex installed.]) +fi +AC_SUBST(LEXLIB) +]) + +AC_DEFUN([AC_PATH_QTOPIA], +[ + dnl TODO: use AC_CACHE_VAL + + if test -z "$1"; then + qtopia_minver_maj=1 + qtopia_minver_min=5 + qtopia_minver_pat=0 + else + qtopia_minver_maj=`echo "$1" | sed -e "s/^\(.*\)\..*\..*$/\1/"` + qtopia_minver_min=`echo "$1" | sed -e "s/^.*\.\(.*\)\..*$/\1/"` + qtopia_minver_pat=`echo "$1" | sed -e "s/^.*\..*\.\(.*\)$/\1/"` + fi + + qtopia_minver="$qtopia_minver_maj$qtopia_minver_min$qtopia_minver_pat" + qtopia_minverstr="$qtopia_minver_maj.$qtopia_minver_min.$qtopia_minver_pat" + + AC_REQUIRE([AC_PATH_QT]) + + AC_MSG_CHECKING([for Qtopia]) + + LIB_QTOPIA="-lqpe" + AC_SUBST(LIB_QTOPIA) + + kde_qtopia_dirs="$QPEDIR /opt/Qtopia" + + ac_qtopia_incdir=NO + + AC_ARG_WITH(qtopia-dir, + AC_HELP_STRING([--with-qtopia-dir=DIR],[where the root of Qtopia is installed]), + [ ac_qtopia_incdir="$withval"/include] ) + + qtopia_incdirs="" + for dir in $kde_qtopia_dirs; do + qtopia_incdirs="$qtopia_incdirs $dir/include" + done + + if test ! "$ac_qtopia_incdir" = "NO"; then + qtopia_incdirs="$ac_qtopia_incdir $qtopia_incdirs" + fi + + qtopia_incdir="" + AC_FIND_FILE(qpe/qpeapplication.h, $qtopia_incdirs, qtopia_incdir) + ac_qtopia_incdir="$qtopia_incdir" + + if test -z "$qtopia_incdir"; then + AC_MSG_ERROR([Cannot find Qtopia headers. Please check your installation.]) + fi + + qtopia_ver_maj=`cat $qtopia_incdir/qpe/version.h | sed -n -e 's,.*QPE_VERSION "\(.*\)\..*\..*".*,\1,p'`; + qtopia_ver_min=`cat $qtopia_incdir/qpe/version.h | sed -n -e 's,.*QPE_VERSION ".*\.\(.*\)\..*".*,\1,p'`; + qtopia_ver_pat=`cat $qtopia_incdir/qpe/version.h | sed -n -e 's,.*QPE_VERSION ".*\..*\.\(.*\)".*,\1,p'`; + + qtopia_ver="$qtopia_ver_maj$qtopia_ver_min$qtopia_ver_pat" + qtopia_verstr="$qtopia_ver_maj.$qtopia_ver_min.$qtopia_ver_pat" + if test "$qtopia_ver" -lt "$qtopia_minver"; then + AC_MSG_ERROR([found Qtopia version $qtopia_verstr but version $qtopia_minverstr +is required.]) + fi + + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + + ac_cxxflags_safe="$CXXFLAGS" + ac_ldflags_safe="$LDFLAGS" + ac_libs_safe="$LIBS" + + CXXFLAGS="$CXXFLAGS -I$qtopia_incdir $all_includes" + LDFLAGS="$LDFLAGS $QT_LDFLAGS $all_libraries $USER_LDFLAGS $KDE_MT_LDFLAGS" + LIBS="$LIBS $LIB_QTOPIA $LIBQT" + + cat > conftest.$ac_ext <<EOF +#include "confdefs.h" +#include <qpe/qpeapplication.h> +#include <qpe/version.h> + +int main( int argc, char **argv ) +{ + QPEApplication app( argc, argv ); + return 0; +} +EOF + + if AC_TRY_EVAL(ac_link) && test -s conftest; then + rm -f conftest* + else + rm -f conftest* + AC_MSG_ERROR([Cannot link small Qtopia Application. For more details look at +the end of config.log]) + fi + + CXXFLAGS="$ac_cxxflags_safe" + LDFLAGS="$ac_ldflags_safe" + LIBS="$ac_libs_safe" + + AC_LANG_RESTORE + + QTOPIA_INCLUDES="-I$qtopia_incdir" + AC_SUBST(QTOPIA_INCLUDES) + + AC_MSG_RESULT([found version $qtopia_verstr with headers at $qtopia_incdir]) +]) + + +AC_DEFUN([KDE_INIT_DOXYGEN], +[ +AC_MSG_CHECKING([for Qt docs]) +kde_qtdir= +if test "${with_qt_dir+set}" = set; then + kde_qtdir="$with_qt_dir" +fi + +AC_FIND_FILE(qsql.html, [ $kde_qtdir/doc/html $QTDIR/doc/html /usr/share/doc/packages/qt3/html /usr/lib/qt/doc /usr/lib/qt3/doc /usr/lib/qt3/doc/html /usr/doc/qt3/html /usr/doc/qt3 /usr/share/doc/qt3-doc /usr/share/qt3/doc/html /usr/X11R6/share/doc/qt/html ], QTDOCDIR) +AC_MSG_RESULT($QTDOCDIR) + +AC_SUBST(QTDOCDIR) + +KDE_FIND_PATH(dot, DOT, [], []) +if test -n "$DOT"; then + KDE_HAVE_DOT="YES" +else + KDE_HAVE_DOT="NO" +fi +AC_SUBST(KDE_HAVE_DOT) +KDE_FIND_PATH(doxygen, DOXYGEN, [], []) +AC_SUBST(DOXYGEN) + +DOXYGEN_PROJECT_NAME="$1" +DOXYGEN_PROJECT_NUMBER="$2" +AC_SUBST(DOXYGEN_PROJECT_NAME) +AC_SUBST(DOXYGEN_PROJECT_NUMBER) + +KDE_HAS_DOXYGEN=no +if test -n "$DOXYGEN" && test -x "$DOXYGEN" && test -f $QTDOCDIR/qsql.html; then + KDE_HAS_DOXYGEN=yes +fi +AC_SUBST(KDE_HAS_DOXYGEN) + +]) + + +AC_DEFUN([AC_FIND_BZIP2], +[ +AC_MSG_CHECKING([for bzDecompress in libbz2]) +AC_CACHE_VAL(ac_cv_lib_bzip2, +[ +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +kde_save_LIBS="$LIBS" +LIBS="$all_libraries $USER_LDFLAGS -lbz2 $LIBSOCKET" +kde_save_CXXFLAGS="$CXXFLAGS" +CXXFLAGS="$CXXFLAGS $all_includes $USER_INCLUDES" +AC_TRY_LINK(dnl +[ +#define BZ_NO_STDIO +#include<bzlib.h> +], + [ bz_stream s; (void) bzDecompress(&s); ], + eval "ac_cv_lib_bzip2='-lbz2'", + eval "ac_cv_lib_bzip2=no") +LIBS="$kde_save_LIBS" +CXXFLAGS="$kde_save_CXXFLAGS" +AC_LANG_RESTORE +])dnl +AC_MSG_RESULT($ac_cv_lib_bzip2) + +if test ! "$ac_cv_lib_bzip2" = no; then + BZIP2DIR=bzip2 + + LIBBZ2="$ac_cv_lib_bzip2" + AC_SUBST(LIBBZ2) + +else + + cxx_shared_flag= + ld_shared_flag= + KDE_CHECK_COMPILER_FLAG(shared, [ + ld_shared_flag="-shared" + ]) + KDE_CHECK_COMPILER_FLAG(fPIC, [ + cxx_shared_flag="-fPIC" + ]) + + AC_MSG_CHECKING([for BZ2_bzDecompress in (shared) libbz2]) + AC_CACHE_VAL(ac_cv_lib_bzip2_prefix, + [ + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + kde_save_LIBS="$LIBS" + LIBS="$all_libraries $USER_LDFLAGS $ld_shared_flag -lbz2 $LIBSOCKET" + kde_save_CXXFLAGS="$CXXFLAGS" + CXXFLAGS="$CFLAGS $cxx_shared_flag $all_includes $USER_INCLUDES" + + AC_TRY_LINK(dnl + [ + #define BZ_NO_STDIO + #include<bzlib.h> + ], + [ bz_stream s; (void) BZ2_bzDecompress(&s); ], + eval "ac_cv_lib_bzip2_prefix='-lbz2'", + eval "ac_cv_lib_bzip2_prefix=no") + LIBS="$kde_save_LIBS" + CXXFLAGS="$kde_save_CXXFLAGS" + AC_LANG_RESTORE + ])dnl + + AC_MSG_RESULT($ac_cv_lib_bzip2_prefix) + + if test ! "$ac_cv_lib_bzip2_prefix" = no; then + BZIP2DIR=bzip2 + + LIBBZ2="$ac_cv_lib_bzip2_prefix" + AC_SUBST(LIBBZ2) + + AC_DEFINE(NEED_BZ2_PREFIX, 1, [Define if the libbz2 functions need the BZ2_ prefix]) + dnl else, we just ignore this + fi + +fi +AM_CONDITIONAL(include_BZIP2, test -n "$BZIP2DIR") +]) + +dnl ------------------------------------------------------------------------ +dnl Try to find the SSL headers and libraries. +dnl $(SSL_LDFLAGS) will be -Lsslliblocation (if needed) +dnl and $(SSL_INCLUDES) will be -Isslhdrlocation (if needed) +dnl ------------------------------------------------------------------------ +dnl +AC_DEFUN([KDE_CHECK_SSL], +[ +LIBSSL="-lssl -lcrypto" +AC_REQUIRE([KDE_CHECK_LIB64]) + +ac_ssl_includes=NO ac_ssl_libraries=NO +ssl_libraries="" +ssl_includes="" +AC_ARG_WITH(ssl-dir, + AC_HELP_STRING([--with-ssl-dir=DIR],[where the root of OpenSSL is installed]), + [ ac_ssl_includes="$withval"/include + ac_ssl_libraries="$withval"/lib$kdelibsuff + ]) + +want_ssl=yes +AC_ARG_WITH(ssl, + AC_HELP_STRING([--without-ssl],[disable SSL checks]), + [want_ssl=$withval]) + +if test $want_ssl = yes; then + +AC_MSG_CHECKING(for OpenSSL) + +AC_CACHE_VAL(ac_cv_have_ssl, +[#try to guess OpenSSL locations + + ssl_incdirs="/usr/include /usr/local/include /usr/ssl/include /usr/local/ssl/include $prefix/include $kde_extra_includes" + ssl_incdirs="$ac_ssl_includes $ssl_incdirs" + AC_FIND_FILE(openssl/ssl.h, $ssl_incdirs, ssl_incdir) + ac_ssl_includes="$ssl_incdir" + + ssl_libdirs="/usr/lib$kdelibsuff /usr/local/lib$kdelibsuff /usr/ssl/lib$kdelibsuff /usr/local/ssl/lib$kdelibsuff $libdir $prefix/lib$kdelibsuff $exec_prefix/lib$kdelibsuff $kde_extra_libs" + if test ! "$ac_ssl_libraries" = "NO"; then + ssl_libdirs="$ac_ssl_libraries $ssl_libdirs" + fi + + test=NONE + ssl_libdir=NONE + for dir in $ssl_libdirs; do + try="ls -1 $dir/libssl*" + if test=`eval $try 2> /dev/null`; then ssl_libdir=$dir; break; else echo "tried $dir" >&AC_FD_CC ; fi + done + + ac_ssl_libraries="$ssl_libdir" + + ac_ldflags_safe="$LDFLAGS" + ac_libs_safe="$LIBS" + + LDFLAGS="$LDFLAGS -L$ssl_libdir $all_libraries" + LIBS="$LIBS $LIBSSL -lRSAglue -lrsaref" + + AC_TRY_LINK(,void RSAPrivateEncrypt(void);RSAPrivateEncrypt();, + ac_ssl_rsaref="yes" + , + ac_ssl_rsaref="no" + ) + + LDFLAGS="$ac_ldflags_safe" + LIBS="$ac_libs_safe" + + if test "$ac_ssl_includes" = NO || test "$ac_ssl_libraries" = NO; then + have_ssl=no + else + have_ssl=yes; + fi + + ]) + + eval "$ac_cv_have_ssl" + + AC_MSG_RESULT([libraries $ac_ssl_libraries, headers $ac_ssl_includes]) + + AC_MSG_CHECKING([whether OpenSSL uses rsaref]) + AC_MSG_RESULT($ac_ssl_rsaref) + + AC_MSG_CHECKING([for easter eggs]) + AC_MSG_RESULT([none found]) + +else + have_ssl=no +fi + +if test "$have_ssl" = yes; then + AC_MSG_CHECKING(for OpenSSL version) + dnl Check for SSL version + AC_CACHE_VAL(ac_cv_ssl_version, + [ + + cat >conftest.$ac_ext <<EOF +#include <openssl/opensslv.h> +#include <stdio.h> + int main() { + +#ifndef OPENSSL_VERSION_NUMBER + printf("ssl_version=\\"error\\"\n"); +#else + if (OPENSSL_VERSION_NUMBER < 0x00906000) + printf("ssl_version=\\"old\\"\n"); + else + printf("ssl_version=\\"ok\\"\n"); +#endif + return (0); + } +EOF + + ac_save_CPPFLAGS=$CPPFLAGS + if test "$ac_ssl_includes" != "/usr/include"; then + CPPFLAGS="$CPPFLAGS -I$ac_ssl_includes" + fi + + if AC_TRY_EVAL(ac_link); then + + if eval `./conftest 2>&5`; then + if test $ssl_version = error; then + AC_MSG_ERROR([$ssl_incdir/openssl/opensslv.h doesn't define OPENSSL_VERSION_NUMBER !]) + else + if test $ssl_version = old; then + AC_MSG_WARN([OpenSSL version too old. Upgrade to 0.9.6 at least, see http://www.openssl.org. SSL support disabled.]) + have_ssl=no + fi + fi + ac_cv_ssl_version="ssl_version=$ssl_version" + else + AC_MSG_ERROR([Your system couldn't run a small SSL test program. + Check config.log, and if you can't figure it out, send a mail to + David Faure <[email protected]>, attaching your config.log]) + fi + + else + AC_MSG_ERROR([Your system couldn't link a small SSL test program. + Check config.log, and if you can't figure it out, send a mail to + David Faure <[email protected]>, attaching your config.log]) + fi + CPPFLAGS=$ac_save_CPPFLAGS + + ]) + + eval "$ac_cv_ssl_version" + AC_MSG_RESULT($ssl_version) +fi + +if test "$have_ssl" != yes; then + LIBSSL=""; +else + AC_DEFINE(HAVE_SSL, 1, [If we are going to use OpenSSL]) + ac_cv_have_ssl="have_ssl=yes \ + ac_ssl_includes=$ac_ssl_includes ac_ssl_libraries=$ac_ssl_libraries ac_ssl_rsaref=$ac_ssl_rsaref" + + + ssl_libraries="$ac_ssl_libraries" + ssl_includes="$ac_ssl_includes" + + if test "$ac_ssl_rsaref" = yes; then + LIBSSL="-lssl -lcrypto -lRSAglue -lrsaref" + fi + + if test $ssl_version = "old"; then + AC_DEFINE(HAVE_OLD_SSL_API, 1, [Define if you have OpenSSL < 0.9.6]) + fi +fi + +SSL_INCLUDES= + +if test "$ssl_includes" = "/usr/include"; then + if test -f /usr/kerberos/include/krb5.h; then + SSL_INCLUDES="-I/usr/kerberos/include" + fi +elif test "$ssl_includes" != "/usr/local/include" && test -n "$ssl_includes"; then + SSL_INCLUDES="-I$ssl_includes" +fi + +if test "$ssl_libraries" = "/usr/lib" || test "$ssl_libraries" = "/usr/local/lib" || test -z "$ssl_libraries" || test "$ssl_libraries" = "NONE"; then + SSL_LDFLAGS="" +else + SSL_LDFLAGS="-L$ssl_libraries -R$ssl_libraries" +fi + +AC_SUBST(SSL_INCLUDES) +AC_SUBST(SSL_LDFLAGS) +AC_SUBST(LIBSSL) +]) + +AC_DEFUN([KDE_CHECK_STRLCPY], +[ + AC_REQUIRE([AC_CHECK_STRLCAT]) + AC_REQUIRE([AC_CHECK_STRLCPY]) + AC_CHECK_SIZEOF(size_t) + AC_CHECK_SIZEOF(unsigned long) + + AC_MSG_CHECKING([sizeof size_t == sizeof unsigned long]) + AC_TRY_COMPILE(,[ + #if SIZEOF_SIZE_T != SIZEOF_UNSIGNED_LONG + choke me + #endif + ],AC_MSG_RESULT([yes]),[ + AC_MSG_RESULT(no) + AC_MSG_ERROR([ + Apparently on your system our assumption sizeof size_t == sizeof unsigned long + does not apply. Please mail [email protected] with a description of your system! + ]) + ]) +]) + +AC_DEFUN([KDE_CHECK_BINUTILS], +[ + AC_MSG_CHECKING([if ld supports unversioned version maps]) + + kde_save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map" + echo "{ local: extern \"C++\" { foo }; };" > conftest.map + AC_TRY_LINK([int foo;], +[ +#ifdef __INTEL_COMPILER +icc apparently does not support libtools version-info and version-script +at the same time. Dunno where the bug is, but until somebody figured out, +better disable the optional version scripts. +#endif + + foo = 42; +], kde_supports_versionmaps=yes, kde_supports_versionmaps=no) + LDFLAGS="$kde_save_LDFLAGS" + rm -f conftest.map + AM_CONDITIONAL(include_VERSION_SCRIPT, + [test "$kde_supports_versionmaps" = "yes" && test "$kde_use_debug_code" = "no"]) + + AC_MSG_RESULT($kde_supports_versionmaps) +]) + +AC_DEFUN([AM_PROG_OBJC],[ +AC_CHECK_PROGS(OBJC, gcc, gcc) +test -z "$OBJC" && AC_MSG_ERROR([no acceptable objective-c gcc found in \$PATH]) +if test "x${OBJCFLAGS-unset}" = xunset; then + OBJCFLAGS="-g -O2" +fi +AC_SUBST(OBJCFLAGS) +_AM_IF_OPTION([no-dependencies],, [_AM_DEPENDENCIES(OBJC)]) +]) + +AC_DEFUN([KDE_CHECK_PERL], +[ + KDE_FIND_PATH(perl, PERL, [$bindir $exec_prefix/bin $prefix/bin], [ + AC_MSG_ERROR([No Perl found in your $PATH. +We need perl to generate some code.]) + ]) + AC_SUBST(PERL) +]) +# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- +## Copyright 1996, 1997, 1998, 1999, 2000, 2001 +## Free Software Foundation, Inc. +## Originally by Gordon Matzigkeit <[email protected]>, 1996 +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +## +## As a special exception to the GNU General Public License, if you +## distribute this file as part of a program that contains a +## configuration script generated by Autoconf, you may include it under +## the same distribution terms that you use for the rest of that program. + +# serial 47 AC_PROG_LIBTOOL + + +# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED) +# ----------------------------------------------------------- +# If this macro is not defined by Autoconf, define it here. +m4_ifdef([AC_PROVIDE_IFELSE], + [], + [m4_define([AC_PROVIDE_IFELSE], + [m4_ifdef([AC_PROVIDE_$1], + [$2], [$3])])]) + + +# AC_PROG_LIBTOOL +# --------------- +AC_DEFUN([AC_PROG_LIBTOOL], +[AC_REQUIRE([_AC_PROG_LIBTOOL])dnl +dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX +dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX. + AC_PROVIDE_IFELSE([AC_PROG_CXX], + [AC_LIBTOOL_CXX], + [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX + ])]) +dnl And a similar setup for Fortran 77 support + AC_PROVIDE_IFELSE([AC_PROG_F77], + [AC_LIBTOOL_F77], + [define([AC_PROG_F77], defn([AC_PROG_F77])[AC_LIBTOOL_F77 +])]) + +dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly. +dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run +dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both. + AC_PROVIDE_IFELSE([AC_PROG_GCJ], + [AC_LIBTOOL_GCJ], + [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], + [AC_LIBTOOL_GCJ], + [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ], + [AC_LIBTOOL_GCJ], + [ifdef([AC_PROG_GCJ], + [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ])]) + ifdef([A][M_PROG_GCJ], + [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ])]) + ifdef([LT_AC_PROG_GCJ], + [define([LT_AC_PROG_GCJ], + defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])])]) +])])# AC_PROG_LIBTOOL + + +# _AC_PROG_LIBTOOL +# ---------------- +AC_DEFUN([_AC_PROG_LIBTOOL], +[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl +AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl +AC_BEFORE([$0],[AC_LIBTOOL_F77])dnl +AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool --silent' +AC_SUBST(LIBTOOL)dnl + +# Prevent multiple expansion +define([AC_PROG_LIBTOOL], []) +])# _AC_PROG_LIBTOOL + + +# AC_LIBTOOL_SETUP +# ---------------- +AC_DEFUN([AC_LIBTOOL_SETUP], +[AC_PREREQ(2.50)dnl +AC_REQUIRE([AC_ENABLE_SHARED])dnl +AC_REQUIRE([AC_ENABLE_STATIC])dnl +AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_PROG_LD])dnl +AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl +AC_REQUIRE([AC_PROG_NM])dnl + +AC_REQUIRE([AC_PROG_LN_S])dnl +AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl +# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! +AC_REQUIRE([AC_OBJEXT])dnl +AC_REQUIRE([AC_EXEEXT])dnl +dnl + +AC_LIBTOOL_SYS_MAX_CMD_LEN +AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE +AC_LIBTOOL_OBJDIR + +AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl +_LT_AC_PROG_ECHO_BACKSLASH + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e s/^X//' +[sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'] + +# Same as above, but do not quote variable references. +[double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g'] + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' + +# Constants: +rm="rm -f" + +# Global variables: +default_ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except M$VC, +# which needs '.lib'). +libext=a +ltmain="$ac_aux_dir/ltmain.sh" +ofile="$default_ofile" +with_gnu_ld="$lt_cv_prog_gnu_ld" + +AC_CHECK_TOOL(AR, ar, false) +AC_CHECK_TOOL(RANLIB, ranlib, :) +AC_CHECK_TOOL(STRIP, strip, :) + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$AR" && AR=ar +test -z "$AR_FLAGS" && AR_FLAGS=cru +test -z "$AS" && AS=as +test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC +test -z "$DLLTOOL" && DLLTOOL=dlltool +test -z "$LD" && LD=ld +test -z "$LN_S" && LN_S="ln -s" +test -z "$MAGIC_CMD" && MAGIC_CMD=file +test -z "$NM" && NM=nm +test -z "$SED" && SED=sed +test -z "$OBJDUMP" && OBJDUMP=objdump +test -z "$RANLIB" && RANLIB=: +test -z "$STRIP" && STRIP=: +test -z "$ac_objext" && ac_objext=o + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" + ;; + *) + old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" +fi + +# Only perform the check for file, if the check method requires it +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + AC_PATH_MAGIC + fi + ;; +esac + +AC_PROVIDE_IFELSE([AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no) +AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], +enable_win32_dll=yes, enable_win32_dll=no) + +AC_ARG_ENABLE([libtool-lock], + [AC_HELP_STRING([--disable-libtool-lock], + [avoid locking (might break parallel builds)])]) +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +AC_ARG_WITH([pic], + [AC_HELP_STRING([--with-pic], + [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], + [pic_mode="$withval"], + [pic_mode=default]) +test -z "$pic_mode" && pic_mode=default + +# Use C for the default configuration in the libtool script +tagname= +AC_LIBTOOL_LANG_C_CONFIG +_LT_AC_TAGCONFIG +])# AC_LIBTOOL_SETUP + + +# _LT_AC_SYS_COMPILER +# ------------------- +AC_DEFUN([_LT_AC_SYS_COMPILER], +[AC_REQUIRE([AC_PROG_CC])dnl + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# Allow CC to be a program name with arguments. +compiler=$CC +])# _LT_AC_SYS_COMPILER + + +# _LT_AC_SYS_LIBPATH_AIX +# ---------------------- +# Links a minimal program and checks the executable +# for the system default hardcoded library path. In most cases, +# this is /usr/lib:/lib, but when the MPI compilers are used +# the location of the communication and MPI libs are included too. +# If we don't find anything, use the default library path according +# to the aix ld manual. +AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX], +[AC_LINK_IFELSE(AC_LANG_PROGRAM,[ +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi],[]) +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +])# _LT_AC_SYS_LIBPATH_AIX + + +# _LT_AC_SHELL_INIT(ARG) +# ---------------------- +AC_DEFUN([_LT_AC_SHELL_INIT], +[ifdef([AC_DIVERSION_NOTICE], + [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], + [AC_DIVERT_PUSH(NOTICE)]) +$1 +AC_DIVERT_POP +])# _LT_AC_SHELL_INIT + + +# _LT_AC_PROG_ECHO_BACKSLASH +# -------------------------- +# Add some code to the start of the generated configure script which +# will find an echo command which doesn't interpret backslashes. +AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH], +[_LT_AC_SHELL_INIT([ +# Check that we are running under the correct shell. +SHELL=${CONFIG_SHELL-/bin/sh} + +case X$ECHO in +X*--fallback-echo) + # Remove one level of quotation (which was required for Make). + ECHO=`echo "$ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','` + ;; +esac + +echo=${ECHO-echo} +if test "X[$]1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X[$]1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then + # Yippee, $echo works! + : +else + # Restart under the correct shell. + exec $SHELL "[$]0" --no-reexec ${1+"[$]@"} +fi + +if test "X[$]1" = X--fallback-echo; then + # used as fallback echo + shift + cat <<EOF +[$]* +EOF + exit 0 +fi + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi + +if test -z "$ECHO"; then +if test "X${echo_test_string+set}" != Xset; then +# find a string as large as possible, as long as the shell can cope with it + for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do + # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... + if (echo_test_string="`eval $cmd`") 2>/dev/null && + echo_test_string="`eval $cmd`" && + (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null + then + break + fi + done +fi + +if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + : +else + # The Solaris, AIX, and Digital Unix default echo programs unquote + # backslashes. This makes it impossible to quote backslashes using + # echo "$something" | sed 's/\\/\\\\/g' + # + # So, first we look for a working echo in the user's PATH. + + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for dir in $PATH /usr/ucb; do + IFS="$lt_save_ifs" + if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && + test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$dir/echo" + break + fi + done + IFS="$lt_save_ifs" + + if test "X$echo" = Xecho; then + # We didn't find a better echo, so look for alternatives. + if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # This shell has a builtin print -r that does the trick. + echo='print -r' + elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && + test "X$CONFIG_SHELL" != X/bin/ksh; then + # If we have ksh, try running configure again with it. + ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} + export ORIGINAL_CONFIG_SHELL + CONFIG_SHELL=/bin/ksh + export CONFIG_SHELL + exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"} + else + # Try using printf. + echo='printf %s\n' + if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # Cool, printf works + : + elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL + export CONFIG_SHELL + SHELL="$CONFIG_SHELL" + export SHELL + echo="$CONFIG_SHELL [$]0 --fallback-echo" + elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$CONFIG_SHELL [$]0 --fallback-echo" + else + # maybe with a smaller string... + prev=: + + for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do + if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null + then + break + fi + prev="$cmd" + done + + if test "$prev" != 'sed 50q "[$]0"'; then + echo_test_string=`eval $prev` + export echo_test_string + exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"} + else + # Oops. We lost completely, so just stick with echo. + echo=echo + fi + fi + fi + fi +fi +fi + +# Copy echo and quote the copy suitably for passing to libtool from +# the Makefile, instead of quoting the original, which is used later. +ECHO=$echo +if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then + ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo" +fi + +AC_SUBST(ECHO) +])])# _LT_AC_PROG_ECHO_BACKSLASH + + +# _LT_AC_LOCK +# ----------- +AC_DEFUN([_LT_AC_LOCK], +[AC_ARG_ENABLE([libtool-lock], + [AC_HELP_STRING([--disable-libtool-lock], + [avoid locking (might break parallel builds)])]) +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out which ABI we are using. + echo '[#]line __oline__ "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + if test "$lt_cv_prog_gnu_ld" = yes; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + fi + rm -rf conftest* + ;; + +x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case "`/usr/bin/file conftest.o`" in + *32-bit*) + LINUX_64_MODE="32" + case $host in + x86_64-*linux*) + LD="${LD-ld} -m elf_i386" + ;; + ppc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + LINUX_64_MODE="64" + case $host in + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + ppc*-*linux*|powerpc*-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, + [AC_LANG_PUSH(C) + AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) + AC_LANG_POP]) + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; +AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], +[*-*-cygwin* | *-*-mingw* | *-*-pw32*) + AC_CHECK_TOOL(DLLTOOL, dlltool, false) + AC_CHECK_TOOL(AS, as, false) + AC_CHECK_TOOL(OBJDUMP, objdump, false) + ;; + ]) +esac + +need_locks="$enable_libtool_lock" + +])# _LT_AC_LOCK + + +# AC_LIBTOOL_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) +# ---------------------------------------------------------------- +# Check whether the given compiler option works +AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], +[AC_REQUIRE([LT_AC_PROG_SED]) +AC_CACHE_CHECK([$1], [$2], + [$2=no + ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$3" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s conftest.err; then + $2=yes + fi + fi + $rm conftest* +]) + +if test x"[$]$2" = xyes; then + ifelse([$5], , :, [$5]) +else + ifelse([$6], , :, [$6]) +fi +])# AC_LIBTOOL_COMPILER_OPTION + + +# AC_LIBTOOL_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [ACTION-SUCCESS], [ACTION-FAILURE]) +# ------------------------------------------------------------ +# Check whether the given compiler option works +AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], +[AC_CACHE_CHECK([$1], [$2], + [$2=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $3" + printf "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&AS_MESSAGE_LOG_FD + else + $2=yes + fi + fi + $rm conftest* + LDFLAGS="$save_LDFLAGS" +]) + +if test x"[$]$2" = xyes; then + ifelse([$4], , :, [$4]) +else + ifelse([$5], , :, [$5]) +fi +])# AC_LIBTOOL_LINKER_OPTION + + +# AC_LIBTOOL_SYS_MAX_CMD_LEN +# -------------------------- +AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], +[# find the maximum length of command line arguments +AC_MSG_CHECKING([the maximum length of command line arguments]) +AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl + i=0 + testring="ABCD" + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + *) + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + while (test "X"`$CONFIG_SHELL [$]0 --fallback-echo "X$testring" 2>/dev/null` \ + = "XX$testring") >/dev/null 2>&1 && + new_result=`expr "X$testring" : ".*" 2>&1` && + lt_cv_sys_max_cmd_len=$new_result && + test $i != 17 # 1/2 MB should be enough + do + i=`expr $i + 1` + testring=$testring$testring + done + testring= + # Add a significant safety factor because C++ compilers can tack on massive + # amounts of additional arguments before passing them to the linker. + # It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + ;; + esac +]) +if test -n $lt_cv_sys_max_cmd_len ; then + AC_MSG_RESULT($lt_cv_sys_max_cmd_len) +else + AC_MSG_RESULT(none) +fi +])# AC_LIBTOOL_SYS_MAX_CMD_LEN + + +# _LT_AC_CHECK_DLFCN +# -------------------- +AC_DEFUN([_LT_AC_CHECK_DLFCN], +[AC_CHECK_HEADERS(dlfcn.h)dnl +])# _LT_AC_CHECK_DLFCN + + +# _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, +# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) +# ------------------------------------------------------------------ +AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF], +[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl +if test "$cross_compiling" = yes; then : + [$4] +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<EOF +[#line __oline__ "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include <dlfcn.h> +#endif + +#include <stdio.h> + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + + exit (status); +}] +EOF + if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) $1 ;; + x$lt_dlneed_uscore) $2 ;; + x$lt_unknown|x*) $3 ;; + esac + else : + # compilation failed + $3 + fi +fi +rm -fr conftest* +])# _LT_AC_TRY_DLOPEN_SELF + + +# AC_LIBTOOL_DLOPEN_SELF +# ------------------- +AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], +[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl +if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ]) + ;; + + *) + AC_CHECK_FUNC([shl_load], + [lt_cv_dlopen="shl_load"], + [AC_CHECK_LIB([dld], [shl_load], + [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"], + [AC_CHECK_FUNC([dlopen], + [lt_cv_dlopen="dlopen"], + [AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], + [AC_CHECK_LIB([svld], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], + [AC_CHECK_LIB([dld], [dld_link], + [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"]) + ]) + ]) + ]) + ]) + ]) + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + AC_CACHE_CHECK([whether a program can dlopen itself], + lt_cv_dlopen_self, [dnl + _LT_AC_TRY_DLOPEN_SELF( + lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, + lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) + ]) + + if test "x$lt_cv_dlopen_self" = xyes; then + LDFLAGS="$LDFLAGS $link_static_flag" + AC_CACHE_CHECK([whether a statically linked program can dlopen itself], + lt_cv_dlopen_self_static, [dnl + _LT_AC_TRY_DLOPEN_SELF( + lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, + lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) + ]) + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi +])# AC_LIBTOOL_DLOPEN_SELF + + +# AC_LIBTOOL_PROG_CC_C_O([TAGNAME]) +# --------------------------------- +# Check to see if options -c and -o are simultaneously supported by compiler +AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O], +[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl +AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], + [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)], + [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no + $rm -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + # According to Tom Tromey, Ian Lance Taylor reported there are C compilers + # that will create temporary files in the current directory regardless of + # the output directory. Thus, making CWD read-only will cause this test + # to fail, enabling locking or at least warning the user not to do parallel + # builds. + chmod -w . + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s out/conftest.err; then + _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes + fi + fi + chmod u+w . + $rm conftest* out/* + rmdir out + cd .. + rmdir conftest + $rm conftest* +]) +])# AC_LIBTOOL_PROG_CC_C_O + + +# AC_LIBTOOL_SYS_HARD_LINK_LOCKS([TAGNAME]) +# ----------------------------------------- +# Check to see if we can do hard links to lock some files if needed +AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], +[AC_REQUIRE([_LT_AC_LOCK])dnl + +hard_links="nottested" +if test "$_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + AC_MSG_CHECKING([if we can lock with hard links]) + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + AC_MSG_RESULT([$hard_links]) + if test "$hard_links" = no; then + AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) + need_locks=warn + fi +else + need_locks=no +fi +])# AC_LIBTOOL_SYS_HARD_LINK_LOCKS + + +# AC_LIBTOOL_OBJDIR +# ----------------- +AC_DEFUN([AC_LIBTOOL_OBJDIR], +[AC_CACHE_CHECK([for objdir], [lt_cv_objdir], +[rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null]) +objdir=$lt_cv_objdir +])# AC_LIBTOOL_OBJDIR + + +# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH([TAGNAME]) +# ---------------------------------------------- +# Check hardcoding attributes. +AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], +[AC_MSG_CHECKING([how to hardcode library paths into programs]) +_LT_AC_TAGVAR(hardcode_action, $1)= +if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \ + test -n "$_LT_AC_TAGVAR(runpath_var $1)" || \ + test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)"="Xyes" ; then + + # We can hardcode non-existant directories. + if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)" != no && + test "$_LT_AC_TAGVAR(hardcode_minus_L, $1)" != no; then + # Linking always hardcodes the temporary library directory. + _LT_AC_TAGVAR(hardcode_action, $1)=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + _LT_AC_TAGVAR(hardcode_action, $1)=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + _LT_AC_TAGVAR(hardcode_action, $1)=unsupported +fi +AC_MSG_RESULT([$_LT_AC_TAGVAR(hardcode_action, $1)]) + +if test "$_LT_AC_TAGVAR(hardcode_action, $1)" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi +])# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH + + +# AC_LIBTOOL_SYS_LIB_STRIP +# ------------------------ +AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP], +[striplib= +old_striplib= +AC_MSG_CHECKING([whether stripping libraries is possible]) +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + AC_MSG_RESULT([yes]) +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) +fi + ;; + *) + AC_MSG_RESULT([no]) + ;; + esac +fi +])# AC_LIBTOOL_SYS_LIB_STRIP + + +# AC_LIBTOOL_SYS_DYNAMIC_LINKER +# ----------------------------- +# PORTME Fill in your ld.so characteristics +AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER], +[AC_MSG_CHECKING([dynamic linker characteristics]) +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix4* | aix5*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[[01]] | aix4.[[01]].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib<name>.so + # instead of lib<name>.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi4*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32*) + version_type=windows + shrext=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32*) + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | [grep ';[c-zC-Z]:/' >/dev/null]; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + ;; + esac + ;; + + *) + library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext='$(test .$module = .yes && echo .so || echo .dylib)' + # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. + if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + else + sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' + fi + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +freebsd*-gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + +freebsd*) + objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[01]* | freebsdelf3.[01]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + *) # from 3.2 on + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case "$host_cpu" in + ia64*) + shrext='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + libsuff= + if test "x$LINUX_64_MODE" = x64; then + # Some platforms are per default 64-bit, so there's no /lib64 + if test -d /lib64; then + libsuff=64 + fi + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff}" + sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}" + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +nto-qnx*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[[89]] | openbsd2.[[89]].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +sco3.2v5*) + version_type=osf + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + export_dynamic_flag_spec='${wl}-Blargedynsym' + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +AC_MSG_RESULT([$dynamic_linker]) +test "$dynamic_linker" = no && can_build_shared=no +])# AC_LIBTOOL_SYS_DYNAMIC_LINKER + + +# _LT_AC_TAGCONFIG +# ---------------- +AC_DEFUN([_LT_AC_TAGCONFIG], +[AC_ARG_WITH([tags], + [AC_HELP_STRING([--with-tags@<:@=TAGS@:>@], + [include additional configurations @<:@automatic@:>@])], + [tagnames="$withval"]) + +if test -f "$ltmain" && test -n "$tagnames"; then + if test ! -f "${ofile}"; then + AC_MSG_WARN([output file `$ofile' does not exist]) + fi + + if test -z "$LTCC"; then + eval "`$SHELL ${ofile} --config | grep '^LTCC='`" + if test -z "$LTCC"; then + AC_MSG_WARN([output file `$ofile' does not look like a libtool script]) + else + AC_MSG_WARN([using `LTCC=$LTCC', extracted from `$ofile']) + fi + fi + + # Extract list of available tagged configurations in $ofile. + # Note that this assumes the entire list is on one line. + available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` + + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for tagname in $tagnames; do + IFS="$lt_save_ifs" + # Check whether tagname contains only valid characters + case `$echo "X$tagname" | $Xsed -e 's:[[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]]::g'` in + "") ;; + *) AC_MSG_ERROR([invalid tag name: $tagname]) + ;; + esac + + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null + then + AC_MSG_ERROR([tag name \"$tagname\" already exists]) + fi + + # Update the list of available tags. + if test -n "$tagname"; then + echo appending configuration tag \"$tagname\" to $ofile + + case $tagname in + CXX) + if test -n "$CXX" && test "X$CXX" != "Xno"; then + AC_LIBTOOL_LANG_CXX_CONFIG + else + tagname="" + fi + ;; + + F77) + if test -n "$F77" && test "X$F77" != "Xno"; then + AC_LIBTOOL_LANG_F77_CONFIG + else + tagname="" + fi + ;; + + GCJ) + if test -n "$GCJ" && test "X$GCJ" != "Xno"; then + AC_LIBTOOL_LANG_GCJ_CONFIG + else + tagname="" + fi + ;; + + RC) + AC_LIBTOOL_LANG_RC_CONFIG + ;; + + *) + AC_MSG_ERROR([Unsupported tag name: $tagname]) + ;; + esac + + # Append the new tag name to the list of available tags. + if test -n "$tagname" ; then + available_tags="$available_tags $tagname" + fi + fi + done + IFS="$lt_save_ifs" + + # Now substitute the updated list of available tags. + if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then + mv "${ofile}T" "$ofile" + chmod +x "$ofile" + else + rm -f "${ofile}T" + AC_MSG_ERROR([unable to update list of available tagged configurations.]) + fi +fi +])# _LT_AC_TAGCONFIG + + +# AC_LIBTOOL_DLOPEN +# ----------------- +# enable checks for dlopen support +AC_DEFUN([AC_LIBTOOL_DLOPEN], + [AC_BEFORE([$0],[AC_LIBTOOL_SETUP]) +])# AC_LIBTOOL_DLOPEN + + +# AC_LIBTOOL_WIN32_DLL +# -------------------- +# declare package support for building win32 dll's +AC_DEFUN([AC_LIBTOOL_WIN32_DLL], +[AC_BEFORE([$0], [AC_LIBTOOL_SETUP]) +])# AC_LIBTOOL_WIN32_DLL + + +# AC_ENABLE_SHARED([DEFAULT]) +# --------------------------- +# implement the --enable-shared flag +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +AC_DEFUN([AC_ENABLE_SHARED], +[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE([shared], + [AC_HELP_STRING([--enable-shared@<:@=PKGS@:>@], + [build shared libraries @<:@default=]AC_ENABLE_SHARED_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_shared=yes ;; + no) enable_shared=no ;; + *) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_shared=]AC_ENABLE_SHARED_DEFAULT) +])# AC_ENABLE_SHARED + + +# AC_DISABLE_SHARED +# ----------------- +#- set the default shared flag to --disable-shared +AC_DEFUN([AC_DISABLE_SHARED], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_SHARED(no) +])# AC_DISABLE_SHARED + + +# AC_ENABLE_STATIC([DEFAULT]) +# --------------------------- +# implement the --enable-static flag +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +AC_DEFUN([AC_ENABLE_STATIC], +[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE([static], + [AC_HELP_STRING([--enable-static@<:@=PKGS@:>@], + [build static libraries @<:@default=]AC_ENABLE_STATIC_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_static=yes ;; + no) enable_static=no ;; + *) + enable_static=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_static=]AC_ENABLE_STATIC_DEFAULT) +])# AC_ENABLE_STATIC + + +# AC_DISABLE_STATIC +# ----------------- +# set the default static flag to --disable-static +AC_DEFUN([AC_DISABLE_STATIC], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_STATIC(no) +])# AC_DISABLE_STATIC + + +# AC_ENABLE_FAST_INSTALL([DEFAULT]) +# --------------------------------- +# implement the --enable-fast-install flag +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +AC_DEFUN([AC_ENABLE_FAST_INSTALL], +[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE([fast-install], + [AC_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], + [optimize for fast installation @<:@default=]AC_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_fast_install=yes ;; + no) enable_fast_install=no ;; + *) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_fast_install=]AC_ENABLE_FAST_INSTALL_DEFAULT) +])# AC_ENABLE_FAST_INSTALL + + +# AC_DISABLE_FAST_INSTALL +# ----------------------- +# set the default to --disable-fast-install +AC_DEFUN([AC_DISABLE_FAST_INSTALL], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_FAST_INSTALL(no) +])# AC_DISABLE_FAST_INSTALL + + +# AC_LIBTOOL_PICMODE([MODE]) +# -------------------------- +# implement the --with-pic flag +# MODE is either `yes' or `no'. If omitted, it defaults to `both'. +AC_DEFUN([AC_LIBTOOL_PICMODE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +pic_mode=ifelse($#,1,$1,default) +])# AC_LIBTOOL_PICMODE + + +# AC_PROG_EGREP +# ------------- +# This is predefined starting with Autoconf 2.54, so this conditional +# definition can be removed once we require Autoconf 2.54 or later. +m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP], +[AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep], + [if echo a | (grep -E '(a|b)') >/dev/null 2>&1 + then ac_cv_prog_egrep='grep -E' + else ac_cv_prog_egrep='egrep' + fi]) + EGREP=$ac_cv_prog_egrep + AC_SUBST([EGREP]) +])]) + + +# AC_PATH_TOOL_PREFIX +# ------------------- +# find a file program which can recognise shared library +AC_DEFUN([AC_PATH_TOOL_PREFIX], +[AC_REQUIRE([AC_PROG_EGREP])dnl +AC_MSG_CHECKING([for $1]) +AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, +[case $MAGIC_CMD in +[[\\/*] | ?:[\\/]*]) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR +dnl $ac_dummy forces splitting on constant user-supplied paths. +dnl POSIX.2 word splitting is done only on the output of word expansions, +dnl not every word. This closes a longstanding sh security hole. + ac_dummy="ifelse([$2], , $PATH, [$2])" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$1; then + lt_cv_path_MAGIC_CMD="$ac_dir/$1" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <<EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** [email protected] + +EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac]) +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + AC_MSG_RESULT($MAGIC_CMD) +else + AC_MSG_RESULT(no) +fi +])# AC_PATH_TOOL_PREFIX + + +# AC_PATH_MAGIC +# ------------- +# find a file program which can recognise a shared library +AC_DEFUN([AC_PATH_MAGIC], +[AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + AC_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) + else + MAGIC_CMD=: + fi +fi +])# AC_PATH_MAGIC + + +# AC_PROG_LD +# ---------- +# find the pathname to the GNU or non-GNU linker +AC_DEFUN([AC_PROG_LD], +[AC_ARG_WITH([gnu-ld], + [AC_HELP_STRING([--with-gnu-ld], + [assume the C compiler uses GNU ld @<:@default=no@:>@])], + [test "$withval" = no || with_gnu_ld=yes], + [with_gnu_ld=no]) +AC_REQUIRE([LT_AC_PROG_SED])dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + AC_MSG_CHECKING([for ld used by $CC]) + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [[\\/]]* | ?:[[\\/]]*) + re_direlt='/[[^/]][[^/]]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + AC_MSG_CHECKING([for GNU ld]) +else + AC_MSG_CHECKING([for non-GNU ld]) +fi +AC_CACHE_VAL(lt_cv_path_LD, +[if test -z "$LD"; then + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in + *GNU* | *'with BFD'*) + test "$with_gnu_ld" != no && break + ;; + *) + test "$with_gnu_ld" != yes && break + ;; + esac + fi + done + IFS="$lt_save_ifs" +else + lt_cv_path_LD="$LD" # Let the user override the test with a path. +fi]) +LD="$lt_cv_path_LD" +if test -n "$LD"; then + AC_MSG_RESULT($LD) +else + AC_MSG_RESULT(no) +fi +test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) +AC_PROG_LD_GNU +])# AC_PROG_LD + + +# AC_PROG_LD_GNU +# -------------- +AC_DEFUN([AC_PROG_LD_GNU], +[AC_REQUIRE([AC_PROG_EGREP])dnl +AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld, +[# I'd rather use --version here, but apparently some GNU ld's only accept -v. +case `$LD -v 2>&1 </dev/null` in +*GNU* | *'with BFD'*) + lt_cv_prog_gnu_ld=yes + ;; +*) + lt_cv_prog_gnu_ld=no + ;; +esac]) +with_gnu_ld=$lt_cv_prog_gnu_ld +])# AC_PROG_LD_GNU + + +# AC_PROG_LD_RELOAD_FLAG +# ---------------------- +# find reload flag for linker +# -- PORTME Some linkers may need a different reload flag. +AC_DEFUN([AC_PROG_LD_RELOAD_FLAG], +[AC_CACHE_CHECK([for $LD option to reload object files], + lt_cv_ld_reload_flag, + [lt_cv_ld_reload_flag='-r']) +reload_flag=$lt_cv_ld_reload_flag +case $reload_flag in +"" | " "*) ;; +*) reload_flag=" $reload_flag" ;; +esac +reload_cmds='$LD$reload_flag -o $output$reload_objs' +])# AC_PROG_LD_RELOAD_FLAG + + +# AC_DEPLIBS_CHECK_METHOD +# ----------------------- +# how to check for library dependencies +# -- PORTME fill in with the dynamic library characteristics +AC_DEFUN([AC_DEPLIBS_CHECK_METHOD], +[AC_CACHE_CHECK([how to recognise dependent libraries], +lt_cv_deplibs_check_method, +[lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# `unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [[regex]]' -- check by looking for files in library path +# which responds to the $file_magic_cmd with a given extended regex. +# If you have `file' or equivalent on your system and you're not sure +# whether `pass_all' will *always* work, you probably want this one. + +case $host_os in +aix4* | aix5*) + lt_cv_deplibs_check_method=pass_all + ;; + +beos*) + lt_cv_deplibs_check_method=pass_all + ;; + +bsdi4*) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)' + lt_cv_file_magic_cmd='/usr/bin/file -L' + lt_cv_file_magic_test_file=/shlib/libc.so + ;; + +cygwin* | mingw* | pw32*) + # win32_libid is a shell function defined in ltmain.sh + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='win32_libid' + ;; + +darwin* | rhapsody*) + # this will be overwritten by pass_all, but leave it in just in case + lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library' + lt_cv_file_magic_cmd='/usr/bin/file -L' + case "$host_os" in + rhapsody* | darwin1.[[012]]) + lt_cv_file_magic_test_file=`/System/Library/Frameworks/System.framework/System` + ;; + *) # Darwin 1.3 on + lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib' + ;; + esac + lt_cv_deplibs_check_method=pass_all + ;; + +freebsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[[3-9]]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20* | hpux11*) + lt_cv_file_magic_cmd=/usr/bin/file + case "$host_cpu" in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'] + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library' + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + esac + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + irix5* | nonstopux*) + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" + ;; + *) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[[1234]] dynamic lib MIPS - version 1" + ;; + esac + lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*` + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be Linux ELF. +linux*) + case $host_cpu in + alpha* | hppa* | i*86 | ia64* | m68* | mips* | powerpc* | sparc* | s390* | sh* | x86_64* ) + lt_cv_deplibs_check_method=pass_all ;; + # the debian people say, arm and glibc 2.3.1 works for them with pass_all + arm* ) + lt_cv_deplibs_check_method=pass_all ;; + *) + # glibc up to 2.1.1 does not perform some relocations on ARM + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;; + esac + lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` + ;; + +netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +nto-qnx*) + lt_cv_deplibs_check_method=unknown + ;; + +openbsd*) + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB shared object' + else + lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library' + fi + ;; + +osf3* | osf4* | osf5*) + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method='file_magic COFF format alpha shared library' + lt_cv_file_magic_test_file=/shlib/libc.so + lt_cv_deplibs_check_method=pass_all + ;; + +sco3.2v5*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + lt_cv_file_magic_test_file=/lib/libc.so + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; + +sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; +esac +]) +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown +])# AC_DEPLIBS_CHECK_METHOD + + +# AC_PROG_NM +# ---------- +# find the pathname to a BSD-compatible name lister +AC_DEFUN([AC_PROG_NM], +[AC_CACHE_CHECK([for BSD-compatible nm], lt_cv_path_NM, +[if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + tmp_nm="$ac_dir/${ac_tool_prefix}nm" + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break + ;; + *) + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + ;; + esac + esac + fi + done + IFS="$lt_save_ifs" + test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm +fi]) +NM="$lt_cv_path_NM" +])# AC_PROG_NM + + +# AC_CHECK_LIBM +# ------------- +# check for math library +AC_DEFUN([AC_CHECK_LIBM], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +LIBM= +case $host in +*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*) + # These system don't have libm, or don't need it + ;; +*-ncr-sysv4.3*) + AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") + AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") + ;; +*) + AC_CHECK_LIB(m, cos, LIBM="-lm") + ;; +esac +])# AC_CHECK_LIBM + + +# AC_LIBLTDL_CONVENIENCE([DIRECTORY]) +# ----------------------------------- +# sets LIBLTDL to the link flags for the libltdl convenience library and +# LTDLINCL to the include flags for the libltdl header and adds +# --enable-ltdl-convenience to the configure arguments. Note that LIBLTDL +# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If +# DIRECTORY is not provided, it is assumed to be `libltdl'. LIBLTDL will +# be prefixed with '${top_builddir}/' and LTDLINCL will be prefixed with +# '${top_srcdir}/' (note the single quotes!). If your package is not +# flat and you're not using automake, define top_builddir and +# top_srcdir appropriately in the Makefiles. +AC_DEFUN([AC_LIBLTDL_CONVENIENCE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl + case $enable_ltdl_convenience in + no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; + "") enable_ltdl_convenience=yes + ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; + esac + LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la + LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + # For backwards non-gettext consistent compatibility... + INCLTDL="$LTDLINCL" +])# AC_LIBLTDL_CONVENIENCE + + +# AC_LIBLTDL_INSTALLABLE([DIRECTORY]) +# ----------------------------------- +# sets LIBLTDL to the link flags for the libltdl installable library and +# LTDLINCL to the include flags for the libltdl header and adds +# --enable-ltdl-install to the configure arguments. Note that LIBLTDL +# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If +# DIRECTORY is not provided and an installed libltdl is not found, it is +# assumed to be `libltdl'. LIBLTDL will be prefixed with '${top_builddir}/' +# and LTDLINCL will be prefixed with '${top_srcdir}/' (note the single +# quotes!). If your package is not flat and you're not using automake, +# define top_builddir and top_srcdir appropriately in the Makefiles. +# In the future, this macro may have to be called after AC_PROG_LIBTOOL. +AC_DEFUN([AC_LIBLTDL_INSTALLABLE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl + AC_CHECK_LIB(ltdl, lt_dlinit, + [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], + [if test x"$enable_ltdl_install" = xno; then + AC_MSG_WARN([libltdl not installed, but installation disabled]) + else + enable_ltdl_install=yes + fi + ]) + if test x"$enable_ltdl_install" = x"yes"; then + ac_configure_args="$ac_configure_args --enable-ltdl-install" + LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la + LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + else + ac_configure_args="$ac_configure_args --enable-ltdl-install=no" + LIBLTDL="-lltdl" + LTDLINCL= + fi + # For backwards non-gettext consistent compatibility... + INCLTDL="$LTDLINCL" +])# AC_LIBLTDL_INSTALLABLE + + +# AC_LIBTOOL_CXX +# -------------- +# enable support for C++ libraries +AC_DEFUN([AC_LIBTOOL_CXX], +[AC_REQUIRE([_LT_AC_LANG_CXX]) +])# AC_LIBTOOL_CXX + + +# _LT_AC_LANG_CXX +# --------------- +AC_DEFUN([_LT_AC_LANG_CXX], +[AC_REQUIRE([AC_PROG_CXX]) +AC_REQUIRE([AC_PROG_CXXCPP]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}CXX]) +])# _LT_AC_LANG_CXX + + +# AC_LIBTOOL_F77 +# -------------- +# enable support for Fortran 77 libraries +AC_DEFUN([AC_LIBTOOL_F77], +[AC_REQUIRE([_LT_AC_LANG_F77]) +])# AC_LIBTOOL_F77 + + +# _LT_AC_LANG_F77 +# --------------- +AC_DEFUN([_LT_AC_LANG_F77], +[AC_REQUIRE([AC_PROG_F77]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}F77]) +])# _LT_AC_LANG_F77 + + +# AC_LIBTOOL_GCJ +# -------------- +# enable support for GCJ libraries +AC_DEFUN([AC_LIBTOOL_GCJ], +[AC_REQUIRE([_LT_AC_LANG_GCJ]) +])# AC_LIBTOOL_GCJ + + +# _LT_AC_LANG_GCJ +# --------------- +AC_DEFUN([_LT_AC_LANG_GCJ], +[AC_PROVIDE_IFELSE([AC_PROG_GCJ],[], + [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[], + [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[], + [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])], + [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])], + [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}GCJ]) +])# _LT_AC_LANG_GCJ + + +# AC_LIBTOOL_RC +# -------------- +# enable support for Windows resource files +AC_DEFUN([AC_LIBTOOL_RC], +[AC_REQUIRE([LT_AC_PROG_RC]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}RC]) +])# AC_LIBTOOL_RC + + +# AC_LIBTOOL_LANG_C_CONFIG +# ------------------------ +# Ensure that the configuration vars for the C compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG], [_LT_AC_LANG_C_CONFIG]) +AC_DEFUN([_LT_AC_LANG_C_CONFIG], +[lt_save_CC="$CC" +AC_LANG_PUSH(C) + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}\n' + +_LT_AC_SYS_COMPILER + +# +# Check for any special shared library compilation flags. +# +_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)= +if test "$GCC" = no; then + case $host_os in + sco3.2v5*) + _LT_AC_TAGVAR(lt_prog_cc_shlib, $1)='-belf' + ;; + esac +fi +if test -n "$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)"; then + AC_MSG_WARN([`$CC' requires `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to build shared libraries]) + if echo "$old_CC $old_CFLAGS " | grep "[[ ]]$]_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)[[[ ]]" >/dev/null; then : + else + AC_MSG_WARN([add `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to the CC or CFLAGS env variable and reconfigure]) + _LT_AC_TAGVAR(lt_cv_prog_cc_can_build_shared, $1)=no + fi +fi + + +# +# Check to make sure the static flag actually works. +# +AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $_LT_AC_TAGVAR(lt_prog_compiler_static, $1) works], + _LT_AC_TAGVAR(lt_prog_compiler_static_works, $1), + $_LT_AC_TAGVAR(lt_prog_compiler_static, $1), + [], + [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=]) + + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) +AC_LIBTOOL_PROG_COMPILER_PIC($1) +AC_LIBTOOL_PROG_CC_C_O($1) +AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) +AC_LIBTOOL_PROG_LD_SHLIBS($1) +AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) +AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) +AC_LIBTOOL_SYS_LIB_STRIP +AC_LIBTOOL_DLOPEN_SELF($1) + +# Report which librarie types wil actually be built +AC_MSG_CHECKING([if libtool supports shared libraries]) +AC_MSG_RESULT([$can_build_shared]) + +AC_MSG_CHECKING([whether to build shared libraries]) +test "$can_build_shared" = "no" && enable_shared=no + +# On AIX, shared libraries and static libraries use the same namespace, and +# are all built from PIC. +case "$host_os" in +aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + +aix4*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; + darwin* | rhapsody*) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + case "$host_os" in + rhapsody* | darwin1.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' + ;; + *) # Darwin 1.3 on + test -z ${LD_TWOLEVEL_NAMESPACE} && _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' + ;; + esac + output_verbose_link_cmd='echo' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring' + _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_automatic, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; +esac +AC_MSG_RESULT([$enable_shared]) + +AC_MSG_CHECKING([whether to build static libraries]) +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes +AC_MSG_RESULT([$enable_static]) + +AC_LIBTOOL_CONFIG($1) + +AC_LANG_POP +CC="$lt_save_CC" +])# AC_LIBTOOL_LANG_C_CONFIG + + +# AC_LIBTOOL_LANG_CXX_CONFIG +# -------------------------- +# Ensure that the configuration vars for the C compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG], [_LT_AC_LANG_CXX_CONFIG(CXX)]) +AC_DEFUN([_LT_AC_LANG_CXX_CONFIG], +[AC_LANG_PUSH(C++) +AC_REQUIRE([AC_PROG_CXX]) +AC_REQUIRE([AC_PROG_CXXCPP]) + +_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_AC_TAGVAR(allow_undefined_flag, $1)= +_LT_AC_TAGVAR(always_export_symbols, $1)=no +_LT_AC_TAGVAR(archive_expsym_cmds, $1)= +_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_AC_TAGVAR(hardcode_direct, $1)=no +_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= +_LT_AC_TAGVAR(hardcode_libdir_separator, $1)= +_LT_AC_TAGVAR(hardcode_minus_L, $1)=no +_LT_AC_TAGVAR(hardcode_automatic, $1)=no +_LT_AC_TAGVAR(module_cmds, $1)= +_LT_AC_TAGVAR(module_expsym_cmds, $1)= +_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown +_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_AC_TAGVAR(no_undefined_flag, $1)= +_LT_AC_TAGVAR(whole_archive_flag_spec, $1)= +_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Dependencies to place before and after the object being linked: +_LT_AC_TAGVAR(predep_objects, $1)= +_LT_AC_TAGVAR(postdep_objects, $1)= +_LT_AC_TAGVAR(predeps, $1)= +_LT_AC_TAGVAR(postdeps, $1)= +_LT_AC_TAGVAR(compiler_lib_search_path, $1)= + +# Source file extension for C++ test sources. +ac_ext=cc + +# Object file extension for compiled C++ test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(int, char *[]) { return(0); }\n' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_AC_SYS_COMPILER + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +lt_save_LD=$LD +lt_save_GCC=$GCC +GCC=$GXX +lt_save_with_gnu_ld=$with_gnu_ld +lt_save_path_LD=$lt_cv_path_LD +if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then + lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx +else + unset lt_cv_prog_gnu_ld +fi +if test -n "${lt_cv_path_LDCXX+set}"; then + lt_cv_path_LD=$lt_cv_path_LDCXX +else + unset lt_cv_path_LD +fi +test -z "${LDCXX+set}" || LD=$LDCXX +CC=${CXX-"c++"} +compiler=$CC +_LT_AC_TAGVAR(compiler, $1)=$CC +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` + +# We don't want -fno-exception wen compiling C++ code, so set the +# no_builtin_flag separately +if test "$GXX" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' +else + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= +fi + +if test "$GXX" = yes; then + # Set up default GNU C++ configuration + + AC_PROG_LD + + # Check if GNU C++ uses GNU ld as the underlying linker, since the + # archiving commands below assume that GNU ld is being used. + if test "$with_gnu_ld" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + + # If archive_cmds runs LD, not CC, wlarc should be empty + # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to + # investigate it a little bit more. (MM) + wlarc='${wl}' + + # ancient GNU ld didn't support --whole-archive et. al. + if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ + grep 'no-whole-archive' > /dev/null; then + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + fi + else + with_gnu_ld=no + wlarc= + + # A generic and very simple default shared library creation + # command for GNU C++ for the case where it uses the native + # linker, instead of GNU ld. If possible, this setting should + # overridden to take advantage of the native linker features on + # the platform it is being used on. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + fi + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + +else + GXX=no + with_gnu_ld=no + wlarc= +fi + +# PORTME: fill in a description of your system's C++ link characteristics +AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) +_LT_AC_TAGVAR(ld_shlibs, $1)=yes +case $host_os in + aix3*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # KDE requires run time linking. Make it the default. + aix_use_runtimelinking=yes + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_AC_TAGVAR(archive_cmds, $1)='' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + if test "$GXX" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + else + # We have old collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= + fi + esac + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='-qmkshrobj ${wl}-G' + else + shared_flag='-qmkshrobj' + fi + fi + fi + + # Let the compiler handle the export list. + _LT_AC_TAGVAR(always_export_symbols, $1)=no + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + + _LT_AC_TAGVAR(archive_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '" $shared_flag" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' + _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' + # -bexpall does not export symbols beginning with underscore (_) + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + # Exported symbols can be pulled into shared objects from archives + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + # This is similar to how AIX traditionally builds it's shared libraries. + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + chorus*) + case $cc_basename in + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(always_export_symbols, $1)=no + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + darwin* | rhapsody*) + if test "$GXX" = yes; then + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + case "$host_os" in + rhapsody* | darwin1.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' + ;; + *) # Darwin 1.3 on + test -z ${LD_TWOLEVEL_NAMESPACE} && _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' + ;; + esac + lt_int_apple_cc_single_mod=no + output_verbose_link_cmd='echo' + if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then + lt_int_apple_cc_single_mod=yes + fi + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + fi + _LT_AC_TAGVAR(module_cmds, $1)='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_automatic, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + dgux*) + case $cc_basename in + ec++) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + ghcx) + # Green Hills C++ Compiler + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + freebsd[12]*) + # C++ shared libraries reported to be fairly broken before switch to ELF + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + freebsd-elf*) + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + ;; + freebsd*) + # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF + # conventions + _LT_AC_TAGVAR(ld_shlibs, $1)=yes + ;; + gnu*) + ;; + hpux9*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + + case $cc_basename in + CC) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + aCC) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | egrep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + hpux10*|hpux11*) + if test $with_gnu_ld = no; then + case "$host_cpu" in + hppa*64*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + ia64*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + ;; + *) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + ;; + esac + fi + case "$host_cpu" in + hppa*64*) + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + ia64*) + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + *) + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + esac + + case $cc_basename in + CC) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + aCC) + case "$host_cpu" in + hppa*64*|ia64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes; then + if test $with_gnu_ld = no; then + case "$host_cpu" in + ia64*|hppa*64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + fi + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + irix5* | irix6*) + case $cc_basename in + CC) + # SGI C++ + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + + # Archives containing C++ object files must be created using + # "CC -ar", where "CC" is the IRIX C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' + ;; + *) + if test "$GXX" = yes; then + if test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' + fi + fi + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + ;; + esac + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + linux*) + case $cc_basename in + KCC) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' + ;; + icpc) + # Intel C++ + with_gnu_ld=yes + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + ;; + cxx) + # Compaq C++ + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' + + runpath_var=LD_RUN_PATH + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + esac + ;; + lynxos*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + m88k*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + mvs*) + case $cc_basename in + cxx) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' + wlarc= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + fi + # Workaround some broken pre-1.5 toolchains + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' + ;; + osf3*) + case $cc_basename in + KCC) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' + + ;; + RCC) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + cxx) + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + osf4* | osf5*) + case $cc_basename in + KCC) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Archives containing C++ object files must be created using + # the KAI C++ compiler. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' + ;; + RCC) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + cxx) + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ + echo "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~ + $rm $lib.exp' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + psos*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + sco*) + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + case $cc_basename in + CC) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC) + # Sun C++ 4.x + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + lcc) + # Lucid + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + solaris*) + case $cc_basename in + CC) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} -nolib ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + # The C++ compiler is used as linker so we must use $wl + # flag to pass the commands to the underlying system + # linker. + # Supported since Solaris 2.6 (maybe 2.5.1?) + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + ;; + esac + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep "\-[[LR]]"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' + ;; + gcx) + # Green Hills C++ Compiler + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + + # The C++ compiler must be used to create the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' + ;; + *) + # GNU C++ compiler with Solaris linker + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' + if $CC --version | grep -v '^2\.7' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" + else + # g++ 2.7 appears to require `-G' NOT `-shared' on this + # platform. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" + fi + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' + fi + ;; + esac + ;; + sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + ;; + tandem*) + case $cc_basename in + NCC) + # NonStop-UX NCC 3.20 + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + vxworks*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; +esac +AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) +test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no + +_LT_AC_TAGVAR(GCC, $1)="$GXX" +_LT_AC_TAGVAR(LD, $1)="$LD" + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +AC_LIBTOOL_POSTDEP_PREDEP($1) +AC_LIBTOOL_PROG_COMPILER_PIC($1) +AC_LIBTOOL_PROG_CC_C_O($1) +AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) +AC_LIBTOOL_PROG_LD_SHLIBS($1) +AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) +AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) +AC_LIBTOOL_SYS_LIB_STRIP +AC_LIBTOOL_DLOPEN_SELF($1) + +AC_LIBTOOL_CONFIG($1) + +AC_LANG_POP +CC=$lt_save_CC +LDCXX=$LD +LD=$lt_save_LD +GCC=$lt_save_GCC +with_gnu_ldcxx=$with_gnu_ld +with_gnu_ld=$lt_save_with_gnu_ld +lt_cv_path_LDCXX=$lt_cv_path_LD +lt_cv_path_LD=$lt_save_path_LD +lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld +lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld +])# AC_LIBTOOL_LANG_CXX_CONFIG + +# AC_LIBTOOL_POSTDEP_PREDEP([TAGNAME]) +# ------------------------ +# Figure out "hidden" library dependencies from verbose +# compiler output when linking a shared library. +# Parse the compiler output and extract the necessary +# objects, libraries and library flags. +AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP],[ +dnl we can't use the lt_simple_compile_test_code here, +dnl because it contains code intended for an executable, +dnl not a library. It's possible we should let each +dnl tag define a new lt_????_link_test_code variable, +dnl but it's only used here... +ifelse([$1],[],[cat > conftest.$ac_ext <<EOF +int a; +void foo (void) { a = 0; } +EOF +],[$1],[CXX],[cat > conftest.$ac_ext <<EOF +class Foo +{ +public: + Foo (void) { a = 0; } +private: + int a; +}; +EOF +],[$1],[F77],[cat > conftest.$ac_ext <<EOF + subroutine foo + implicit none + integer*4 a + a=0 + return + end +EOF +],[$1],[GCJ],[cat > conftest.$ac_ext <<EOF +public class foo { + private int a; + public void bar (void) { + a = 0; + } +}; +EOF +]) +dnl Parse the compiler output and extract the necessary +dnl objects, libraries and library flags. +if AC_TRY_EVAL(ac_compile); then + # Parse the compiler output and extract the necessary + # objects, libraries and library flags. + + # Sentinel used to keep track of whether or not we are before + # the conftest object file. + pre_test_object_deps_done=no + + # The `*' in the case matches for architectures that use `case' in + # $output_verbose_cmd can trigger glob expansion during the loop + # eval without this substitution. + output_verbose_link_cmd="`$echo \"X$output_verbose_link_cmd\" | $Xsed -e \"$no_glob_subst\"`" + + for p in `eval $output_verbose_link_cmd`; do + case $p in + + -L* | -R* | -l*) + # Some compilers place space between "-{L,R}" and the path. + # Remove the space. + if test $p = "-L" \ + || test $p = "-R"; then + prev=$p + continue + else + prev= + fi + + if test "$pre_test_object_deps_done" = no; then + case $p in + -L* | -R*) + # Internal compiler library paths should come after those + # provided the user. The postdeps already come after the + # user supplied libs so there is no need to process them. + if test -z "$_LT_AC_TAGVAR(compiler_lib_search_path, $1)"; then + _LT_AC_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}" + else + _LT_AC_TAGVAR(compiler_lib_search_path, $1)="${_LT_AC_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}" + fi + ;; + # The "-l" case would never come before the object being + # linked, so don't bother handling this case. + esac + else + if test -z "$_LT_AC_TAGVAR(postdeps, $1)"; then + _LT_AC_TAGVAR(postdeps, $1)="${prev}${p}" + else + _LT_AC_TAGVAR(postdeps, $1)="${_LT_AC_TAGVAR(postdeps, $1)} ${prev}${p}" + fi + fi + ;; + + *.$objext|*.$libext) + # This assumes that the test object file only shows up + # once in the compiler output. + if test "$p" = "conftest.$objext"; then + pre_test_object_deps_done=yes + continue + fi + + if test "$pre_test_object_deps_done" = no; then + if test -z "$_LT_AC_TAGVAR(predep_objects, $1)"; then + _LT_AC_TAGVAR(predep_objects, $1)="$p" + else + _LT_AC_TAGVAR(predep_objects, $1)="$_LT_AC_TAGVAR(predep_objects, $1) $p" + fi + else + if test -z "$_LT_AC_TAGVAR(postdep_objects, $1)"; then + _LT_AC_TAGVAR(postdep_objects, $1)="$p" + else + _LT_AC_TAGVAR(postdep_objects, $1)="$_LT_AC_TAGVAR(postdep_objects, $1) $p" + fi + fi + ;; + + *) ;; # Ignore the rest. + + esac + done + + # Clean up. + rm -f a.out a.exe +else + echo "libtool.m4: error: problem compiling $1 test program" +fi + +$rm -f confest.$objext + +case " $_LT_AC_TAGVAR(postdeps, $1) " in +*" -lc "*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no ;; +esac +])# AC_LIBTOOL_POSTDEP_PREDEP + +# AC_LIBTOOL_LANG_F77_CONFIG +# ------------------------ +# Ensure that the configuration vars for the C compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG], [_LT_AC_LANG_F77_CONFIG(F77)]) +AC_DEFUN([_LT_AC_LANG_F77_CONFIG], +[AC_REQUIRE([AC_PROG_F77]) +AC_LANG_PUSH(Fortran 77) + +_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_AC_TAGVAR(allow_undefined_flag, $1)= +_LT_AC_TAGVAR(always_export_symbols, $1)=no +_LT_AC_TAGVAR(archive_expsym_cmds, $1)= +_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_AC_TAGVAR(hardcode_direct, $1)=no +_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= +_LT_AC_TAGVAR(hardcode_libdir_separator, $1)= +_LT_AC_TAGVAR(hardcode_minus_L, $1)=no +_LT_AC_TAGVAR(hardcode_automatic, $1)=no +_LT_AC_TAGVAR(module_cmds, $1)= +_LT_AC_TAGVAR(module_expsym_cmds, $1)= +_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown +_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_AC_TAGVAR(no_undefined_flag, $1)= +_LT_AC_TAGVAR(whole_archive_flag_spec, $1)= +_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Source file extension for f77 test sources. +ac_ext=f + +# Object file extension for compiled f77 test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code=" subroutine t\n return\n end\n" + +# Code to be used in simple link tests +lt_simple_link_test_code=" program t\n end\n" + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_AC_SYS_COMPILER + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +CC=${F77-"f77"} +compiler=$CC +_LT_AC_TAGVAR(compiler, $1)=$CC +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` + +AC_MSG_CHECKING([if libtool supports shared libraries]) +AC_MSG_RESULT([$can_build_shared]) + +AC_MSG_CHECKING([whether to build shared libraries]) +test "$can_build_shared" = "no" && enable_shared=no + +# On AIX, shared libraries and static libraries use the same namespace, and +# are all built from PIC. +case "$host_os" in +aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; +aix4*) + test "$enable_shared" = yes && enable_static=no + ;; +esac +AC_MSG_RESULT([$enable_shared]) + +AC_MSG_CHECKING([whether to build static libraries]) +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes +AC_MSG_RESULT([$enable_static]) + +test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no + +_LT_AC_TAGVAR(GCC, $1)="$G77" +_LT_AC_TAGVAR(LD, $1)="$LD" + +AC_LIBTOOL_PROG_COMPILER_PIC($1) +AC_LIBTOOL_PROG_CC_C_O($1) +AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) +AC_LIBTOOL_PROG_LD_SHLIBS($1) +AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) +AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) +AC_LIBTOOL_SYS_LIB_STRIP + + +AC_LIBTOOL_CONFIG($1) + +AC_LANG_POP +CC="$lt_save_CC" +])# AC_LIBTOOL_LANG_F77_CONFIG + + +# AC_LIBTOOL_LANG_GCJ_CONFIG +# -------------------------- +# Ensure that the configuration vars for the C compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG], [_LT_AC_LANG_GCJ_CONFIG(GCJ)]) +AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG], +[AC_LANG_SAVE + +# Source file extension for Java test sources. +ac_ext=java + +# Object file extension for compiled Java test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="class foo {}\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='public class conftest { public static void main(String[] argv) {}; }\n' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_AC_SYS_COMPILER + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +CC=${GCJ-"gcj"} +compiler=$CC +_LT_AC_TAGVAR(compiler, $1)=$CC + +# GCJ did not exist at the time GCC didn't implicitly link libc in. +_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) +AC_LIBTOOL_PROG_COMPILER_PIC($1) +AC_LIBTOOL_PROG_CC_C_O($1) +AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) +AC_LIBTOOL_PROG_LD_SHLIBS($1) +AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) +AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) +AC_LIBTOOL_SYS_LIB_STRIP +AC_LIBTOOL_DLOPEN_SELF($1) + +AC_LIBTOOL_CONFIG($1) + +AC_LANG_RESTORE +CC="$lt_save_CC" +])# AC_LIBTOOL_LANG_GCJ_CONFIG + + +# AC_LIBTOOL_LANG_RC_CONFIG +# -------------------------- +# Ensure that the configuration vars for the Windows resource compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG], [_LT_AC_LANG_RC_CONFIG(RC)]) +AC_DEFUN([_LT_AC_LANG_RC_CONFIG], +[AC_LANG_SAVE + +# Source file extension for RC test sources. +ac_ext=rc + +# Object file extension for compiled RC test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }\n' + +# Code to be used in simple link tests +lt_simple_link_test_code="$lt_simple_compile_test_code" + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_AC_SYS_COMPILER + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +CC=${RC-"windres"} +compiler=$CC +_LT_AC_TAGVAR(compiler, $1)=$CC +_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes + +AC_LIBTOOL_CONFIG($1) + +AC_LANG_RESTORE +CC="$lt_save_CC" +])# AC_LIBTOOL_LANG_RC_CONFIG + + +# AC_LIBTOOL_CONFIG([TAGNAME]) +# ---------------------------- +# If TAGNAME is not passed, then create an initial libtool script +# with a default configuration from the untagged config vars. Otherwise +# add code to config.status for appending the configuration named by +# TAGNAME from the matching tagged config vars. +AC_DEFUN([AC_LIBTOOL_CONFIG], +[# The else clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM SED SHELL \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + old_postinstall_cmds old_postuninstall_cmds \ + _LT_AC_TAGVAR(compiler, $1) \ + _LT_AC_TAGVAR(CC, $1) \ + _LT_AC_TAGVAR(LD, $1) \ + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1) \ + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1) \ + _LT_AC_TAGVAR(lt_prog_compiler_static, $1) \ + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) \ + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1) \ + _LT_AC_TAGVAR(thread_safe_flag_spec, $1) \ + _LT_AC_TAGVAR(whole_archive_flag_spec, $1) \ + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) \ + _LT_AC_TAGVAR(old_archive_cmds, $1) \ + _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) \ + _LT_AC_TAGVAR(predep_objects, $1) \ + _LT_AC_TAGVAR(postdep_objects, $1) \ + _LT_AC_TAGVAR(predeps, $1) \ + _LT_AC_TAGVAR(postdeps, $1) \ + _LT_AC_TAGVAR(compiler_lib_search_path, $1) \ + _LT_AC_TAGVAR(archive_cmds, $1) \ + _LT_AC_TAGVAR(archive_expsym_cmds, $1) \ + _LT_AC_TAGVAR(postinstall_cmds, $1) \ + _LT_AC_TAGVAR(postuninstall_cmds, $1) \ + _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) \ + _LT_AC_TAGVAR(allow_undefined_flag, $1) \ + _LT_AC_TAGVAR(no_undefined_flag, $1) \ + _LT_AC_TAGVAR(export_symbols_cmds, $1) \ + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) \ + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) \ + _LT_AC_TAGVAR(hardcode_libdir_separator, $1) \ + _LT_AC_TAGVAR(hardcode_automatic, $1) \ + _LT_AC_TAGVAR(module_cmds, $1) \ + _LT_AC_TAGVAR(module_expsym_cmds, $1) \ + _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) \ + _LT_AC_TAGVAR(exclude_expsyms, $1) \ + _LT_AC_TAGVAR(include_expsyms, $1); do + + case $var in + _LT_AC_TAGVAR(old_archive_cmds, $1) | \ + _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) | \ + _LT_AC_TAGVAR(archive_cmds, $1) | \ + _LT_AC_TAGVAR(archive_expsym_cmds, $1) | \ + _LT_AC_TAGVAR(module_cmds, $1) | \ + _LT_AC_TAGVAR(module_expsym_cmds, $1) | \ + _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) | \ + _LT_AC_TAGVAR(export_symbols_cmds, $1) | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\[$]0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\[$]0 --fallback-echo"[$]/[$]0 --fallback-echo"/'` + ;; + esac + +ifelse([$1], [], + [cfgfile="${ofile}T" + trap "$rm \"$cfgfile\"; exit 1" 1 2 15 + $rm -f "$cfgfile" + AC_MSG_NOTICE([creating $ofile])], + [cfgfile="$ofile"]) + + cat <<__EOF__ >> "$cfgfile" +ifelse([$1], [], +[#! $SHELL + +# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. +# +# This file is part of GNU Libtool: +# Originally by Gordon Matzigkeit <[email protected]>, 1996 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# A sed program that does not truncate output. +SED=$lt_SED + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="$SED -e s/^X//" + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi + +# The names of the tagged configurations supported by this script. +available_tags= + +# ### BEGIN LIBTOOL CONFIG], +[# ### BEGIN LIBTOOL TAG CONFIG: $tagname]) + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$_LT_AC_TAGVAR(archive_cmds_need_lc, $1) + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# A language-specific compiler. +CC=$lt_[]_LT_AC_TAGVAR(compiler, $1) + +# Is the compiler the GNU C compiler? +with_gcc=$_LT_AC_TAGVAR(GCC, $1) + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_[]_LT_AC_TAGVAR(LD, $1) + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext='$shrext' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) + +# Must we lock files when doing compilation ? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_static, $1) + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_[]_LT_AC_TAGVAR(export_dynamic_flag_spec, $1) + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_[]_LT_AC_TAGVAR(whole_archive_flag_spec, $1) + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_[]_LT_AC_TAGVAR(thread_safe_flag_spec, $1) + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_cmds, $1) +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_new_cmds, $1) + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) + +# Commands used to build and install a shared archive. +archive_cmds=$lt_[]_LT_AC_TAGVAR(archive_cmds, $1) +archive_expsym_cmds=$lt_[]_LT_AC_TAGVAR(archive_expsym_cmds, $1) +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_[]_LT_AC_TAGVAR(module_cmds, $1) +module_expsym_cmds=$lt_[]_LT_AC_TAGVAR(module_expsym_cmds, $1) + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_[]_LT_AC_TAGVAR(predep_objects, $1) + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_[]_LT_AC_TAGVAR(postdep_objects, $1) + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_[]_LT_AC_TAGVAR(predeps, $1) + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1) + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1) + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_[]_LT_AC_TAGVAR(allow_undefined_flag, $1) + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_[]_LT_AC_TAGVAR(no_undefined_flag, $1) + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$_LT_AC_TAGVAR(hardcode_action, $1) + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_separator, $1) + +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$_LT_AC_TAGVAR(hardcode_direct, $1) + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$_LT_AC_TAGVAR(hardcode_minus_L, $1) + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1) + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$_LT_AC_TAGVAR(hardcode_automatic, $1) + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$_LT_AC_TAGVAR(link_all_deplibs, $1) + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$_LT_AC_TAGVAR(fix_srcfile_path, $1)" + +# Set to yes if exported symbols are required. +always_export_symbols=$_LT_AC_TAGVAR(always_export_symbols, $1) + +# The commands to list exported symbols. +export_symbols_cmds=$lt_[]_LT_AC_TAGVAR(export_symbols_cmds, $1) + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_[]_LT_AC_TAGVAR(exclude_expsyms, $1) + +# Symbols that must always be exported. +include_expsyms=$lt_[]_LT_AC_TAGVAR(include_expsyms, $1) + +ifelse([$1],[], +[# ### END LIBTOOL CONFIG], +[# ### END LIBTOOL TAG CONFIG: $tagname]) + +__EOF__ + +ifelse([$1],[], [ + case $host_os in + aix3*) + cat <<\EOF >> "$cfgfile" + +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +EOF + ;; + esac + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) + + mv -f "$cfgfile" "$ofile" || \ + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" +]) +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + test -f Makefile && make "$ltmain" +fi +])# AC_LIBTOOL_CONFIG + + +# AC_LIBTOOL_PROG_COMPILER_NO_RTTI([TAGNAME]) +# ------------------------------------------- +AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], +[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl + +_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= + +if test "$GCC" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' + + AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], + lt_cv_prog_compiler_rtti_exceptions, + [-fno-rtti -fno-exceptions], [], + [_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) +fi +])# AC_LIBTOOL_PROG_COMPILER_NO_RTTI + + +# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE +# --------------------------------- +AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], +[AC_REQUIRE([AC_CANONICAL_HOST]) +AC_REQUIRE([AC_PROG_NM]) +AC_REQUIRE([AC_OBJEXT]) +# Check for command to grab the raw symbol name followed by C symbol from nm. +AC_MSG_CHECKING([command to parse $NM output from $compiler object]) +AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], +[ +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[[BCDEGRST]]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' + +# Transform the above into a raw symbol and a C symbol. +symxfrm='\1 \2\3 \3' + +# Transform an extracted symbol line into a proper C declaration +lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[[BCDT]]' + ;; +cygwin* | mingw* | pw32*) + symcode='[[ABCDGISTW]]' + ;; +hpux*) # Its linker distinguishes data from code symbols + if test "$host_cpu" = ia64; then + symcode='[[ABCDEGRST]]' + fi + lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + ;; +irix* | nonstopux*) + symcode='[[BCDEGRST]]' + ;; +osf*) + symcode='[[BCDEGQRST]]' + ;; +solaris* | sysv5*) + symcode='[[BDT]]' + ;; +sysv4) + symcode='[[DFNSTU]]' + ;; +esac + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[[ABCDGISTW]]' ;; +esac + +# Try without a prefix undercore, then with it. +for ac_symprfx in "" "_"; do + + # Write the raw and C identifiers. + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext <<EOF +#ifdef __cplusplus +extern "C" { +#endif +char nm_test_var; +void nm_test_func(){} +#ifdef __cplusplus +} +#endif +int main(){nm_test_var='a';nm_test_func();return(0);} +EOF + + if AC_TRY_EVAL(ac_compile); then + # Now try to grab the symbols. + nlist=conftest.nm + if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if grep ' nm_test_var$' "$nlist" >/dev/null; then + if grep ' nm_test_func$' "$nlist" >/dev/null; then + cat <<EOF > conftest.$ac_ext +#ifdef __cplusplus +extern "C" { +#endif + +EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' + + cat <<EOF >> conftest.$ac_ext +#if defined (__STDC__) && __STDC__ +# define lt_ptr_t void * +#else +# define lt_ptr_t char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr_t address; +} +lt_preloaded_symbols[[]] = +{ +EOF + $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext + cat <<\EOF >> conftest.$ac_ext + {0, (lt_ptr_t) 0} +}; + +#ifdef __cplusplus +} +#endif +EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_save_LIBS="$LIBS" + lt_save_CFLAGS="$CFLAGS" + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" + if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then + pipe_works=yes + fi + LIBS="$lt_save_LIBS" + CFLAGS="$lt_save_CFLAGS" + else + echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD + fi + else + echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD + cat conftest.$ac_ext >&5 + fi + rm -f conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done +]) +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + AC_MSG_RESULT(failed) +else + AC_MSG_RESULT(ok) +fi +]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE + + +# AC_LIBTOOL_PROG_COMPILER_PIC([TAGNAME]) +# --------------------------------------- +AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC], +[_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)= +_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= +_LT_AC_TAGVAR(lt_prog_compiler_static, $1)= + +AC_MSG_CHECKING([for $compiler option to produce PIC]) + ifelse([$1],[CXX],[ + # C++ specific cases for pic, static, wl, etc. + if test "$GXX" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + mingw* | os2* | pw32*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + *djgpp*) + # DJGPP does not support shared libraries at all + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + sysv4*MP*) + if test -d /usr/nec; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + else + case $host_os in + aix4* | aix5*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + chorus*) + case $cc_basename in + cxch68) + # Green Hills C++ Compiler + # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" + ;; + esac + ;; + dgux*) + case $cc_basename in + ec++) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + ghcx) + # Green Hills C++ Compiler + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + freebsd*) + # FreeBSD uses GNU C++ + ;; + hpux9* | hpux10* | hpux11*) + case $cc_basename in + CC) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" + if test "$host_cpu" != ia64; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + fi + ;; + aCC) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + ;; + *) + ;; + esac + ;; + irix5* | irix6* | nonstopux*) + case $cc_basename in + CC) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + # CC pic flag -KPIC is the default. + ;; + *) + ;; + esac + ;; + linux*) + case $cc_basename in + KCC) + # KAI C++ Compiler + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + icpc) + # Intel C++ + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + cxx) + # Compaq C++ + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + *) + ;; + esac + ;; + lynxos*) + ;; + m88k*) + ;; + mvs*) + case $cc_basename in + cxx) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' + ;; + *) + ;; + esac + ;; + netbsd*) + ;; + osf3* | osf4* | osf5*) + case $cc_basename in + KCC) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + ;; + RCC) + # Rational C++ 2.4.1 + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + cxx) + # Digital/Compaq C++ + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + *) + ;; + esac + ;; + psos*) + ;; + sco*) + case $cc_basename in + CC) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + *) + ;; + esac + ;; + solaris*) + case $cc_basename in + CC) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + gcx) + # Green Hills C++ Compiler + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + ;; + *) + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC) + # Sun C++ 4.x + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + lcc) + # Lucid + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + tandem*) + case $cc_basename in + NCC) + # NonStop-UX NCC 3.20 + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + *) + ;; + esac + ;; + unixware*) + ;; + vxworks*) + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +], +[ + if test "$GCC" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + + beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + enable_shared=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC (with -KPIC) is the default. + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + newsos6) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + linux*) + case $CC in + icc* | ecc*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + ccc*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All Alpha code is PIC. + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + esac + ;; + + osf3* | osf4* | osf5*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All OSF/1 code is PIC. + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + sco3.2v5*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kpic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-dn' + ;; + + solaris*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sunos4*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + uts4*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + *) + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +]) +AC_MSG_RESULT([$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)]) + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then + AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works], + _LT_AC_TAGVAR(lt_prog_compiler_pic_works, $1), + [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])], [], + [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in + "" | " "*) ;; + *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)" ;; + esac], + [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) +fi +case "$host_os" in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])" + ;; +esac +]) + + +# AC_LIBTOOL_PROG_LD_SHLIBS([TAGNAME]) +# ------------------------------------ +# See if the linker supports building shared libraries. +AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS], +[AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) +ifelse([$1],[CXX],[ + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + case $host_os in + aix4* | aix5*) + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + else + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + fi + ;; + pw32*) + _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" + ;; + cygwin* | mingw*) + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' + ;; + *) + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + ;; + esac +],[ + runpath_var= + _LT_AC_TAGVAR(allow_undefined_flag, $1)= + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no + _LT_AC_TAGVAR(archive_cmds, $1)= + _LT_AC_TAGVAR(archive_expsym_cmds, $1)= + _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)= + _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)= + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + _LT_AC_TAGVAR(thread_safe_flag_spec, $1)= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_minus_L, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown + _LT_AC_TAGVAR(hardcode_automatic, $1)=no + _LT_AC_TAGVAR(module_cmds, $1)= + _LT_AC_TAGVAR(module_expsym_cmds, $1)= + _LT_AC_TAGVAR(always_export_symbols, $1)=no + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + _LT_AC_TAGVAR(include_expsyms, $1)= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + _LT_AC_TAGVAR(exclude_expsyms, $1)="_GLOBAL_OFFSET_TABLE_" + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + _LT_AC_TAGVAR(ld_shlibs, $1)=yes + if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # See if GNU ld supports shared libraries. + case $host_os in + aix3* | aix4* | aix5*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + _LT_AC_TAGVAR(ld_shlibs, $1)=no + cat <<EOF 1>&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + fi + ;; + + amigaos*) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + + # Samuel A. Falvo II <[email protected]> reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can't use + # them. + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + # Joseph Beckenbach <[email protected]> says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(always_export_symbols, $1)=no + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + else + ld_shlibs=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris* | sysv5*) + if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then + _LT_AC_TAGVAR(ld_shlibs, $1)=no + cat <<EOF 1>&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + sunos4*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + + if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = yes; then + runpath_var=LD_RUN_PATH + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + fi + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + if test "$GCC" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported + fi + ;; + + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + else + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + fi + + # KDE requires run time linking. Make it the default. + aix_use_runtimelinking=yes + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_AC_TAGVAR(archive_cmds, $1)='' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + else + # We have old collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= + fi + esac + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='-qmkshrobj ${wl}-G' + else + shared_flag='-qmkshrobj' + fi + fi + fi + + # Let the compiler handle the export list. + _LT_AC_TAGVAR(always_export_symbols, $1)=no + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + _LT_AC_TAGVAR(archive_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '" $shared_flag" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' + _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' + # -bexpall does not export symbols beginning with underscore (_) + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + # Exported symbols can be pulled into shared objects from archives + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + # This is similar to how AIX traditionally builds it's shared libraries. + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + # see comment about different semantics on the GNU ld section + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + + bsdi4*) + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic + ;; + + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext=".dll" + # FIXME: Setting linknames here is a bad hack. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='true' + # FIXME: Should let the user specify the lib program. + _LT_AC_TAGVAR(old_archive_cmds, $1)='lib /OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path='`cygpath -w "$srcfile"`' + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + ;; + + darwin* | rhapsody*) + if test "$GXX" = yes ; then + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + case "$host_os" in + rhapsody* | darwin1.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' + ;; + *) # Darwin 1.3 on + test -z ${LD_TWOLEVEL_NAMESPACE} && _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' + ;; + esac + lt_int_apple_cc_single_mod=no + output_verbose_link_cmd='echo' + if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then + lt_int_apple_cc_single_mod=yes + fi + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + fi + _LT_AC_TAGVAR(module_cmds, $1)='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_automatic, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + dgux*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + freebsd1*) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + hpux9*) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + ;; + + hpux10* | hpux11*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*|ia64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case "$host_cpu" in + hppa*64*|ia64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + ;; + esac + fi + if test "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + ia64*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + ;; + *) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + newsos6) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + openbsd*) + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + else + case $host_os in + openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + ;; + esac + fi + ;; + + os2*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(archive_cmds, $1)='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + else + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + + # Both c and cxx compiler support -rpath directly + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + fi + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + sco3.2v5*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ;; + + solaris*) + _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; + esac + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4) + case $host_vendor in + sni) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + ;; + motorola) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4.3*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + _LT_AC_TAGVAR(ld_shlibs, $1)=yes + fi + ;; + + sysv4.2uw2*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + hardcode_runpath_var=yes + runpath_var=LD_RUN_PATH + ;; + + sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) + _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z ${wl}text' + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + runpath_var='LD_RUN_PATH' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv5*) + _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var='LD_RUN_PATH' + ;; + + uts4*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + fi +]) +AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) +test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +# +# Do we need to explicitly link libc? +# +case "x$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)" in +x|xyes) + # Assume -lc should be added + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $_LT_AC_TAGVAR(archive_cmds, $1) in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + AC_MSG_CHECKING([whether -lc should be explicitly linked in]) + $rm conftest* + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + if AC_TRY_EVAL(ac_compile) 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$_LT_AC_TAGVAR(allow_undefined_flag, $1) + _LT_AC_TAGVAR(allow_undefined_flag, $1)= + if AC_TRY_EVAL(_LT_AC_TAGVAR(archive_cmds, $1) 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) + then + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + else + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + fi + _LT_AC_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + AC_MSG_RESULT([$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)]) + ;; + esac + fi + ;; +esac +])# AC_LIBTOOL_PROG_LD_SHLIBS + + +# _LT_AC_FILE_LTDLL_C +# ------------------- +# Be careful that the start marker always follows a newline. +AC_DEFUN([_LT_AC_FILE_LTDLL_C], [ +# /* ltdll.c starts here */ +# #define WIN32_LEAN_AND_MEAN +# #include <windows.h> +# #undef WIN32_LEAN_AND_MEAN +# #include <stdio.h> +# +# #ifndef __CYGWIN__ +# # ifdef __CYGWIN32__ +# # define __CYGWIN__ __CYGWIN32__ +# # endif +# #endif +# +# #ifdef __cplusplus +# extern "C" { +# #endif +# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); +# #ifdef __cplusplus +# } +# #endif +# +# #ifdef __CYGWIN__ +# #include <cygwin/cygwin_dll.h> +# DECLARE_CYGWIN_DLL( DllMain ); +# #endif +# HINSTANCE __hDllInstance_base; +# +# BOOL APIENTRY +# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) +# { +# __hDllInstance_base = hInst; +# return TRUE; +# } +# /* ltdll.c ends here */ +])# _LT_AC_FILE_LTDLL_C + + +# _LT_AC_TAGVAR(VARNAME, [TAGNAME]) +# --------------------------------- +AC_DEFUN([_LT_AC_TAGVAR], [ifelse([$2], [], [$1], [$1_$2])]) + + +# old names +AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL]) +AC_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) +AC_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) +AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) +AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) +AC_DEFUN([AM_PROG_LD], [AC_PROG_LD]) +AC_DEFUN([AM_PROG_NM], [AC_PROG_NM]) + +# This is just to silence aclocal about the macro not being used +ifelse([AC_DISABLE_FAST_INSTALL]) + +AC_DEFUN([LT_AC_PROG_GCJ], +[AC_CHECK_TOOL(GCJ, gcj, no) + test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" + AC_SUBST(GCJFLAGS) +]) + +AC_DEFUN([LT_AC_PROG_RC], +[AC_CHECK_TOOL(RC, windres, no) +]) + +############################################################ +# NOTE: This macro has been submitted for inclusion into # +# GNU Autoconf as AC_PROG_SED. When it is available in # +# a released version of Autoconf we should remove this # +# macro and use it instead. # +############################################################ +# LT_AC_PROG_SED +# -------------- +# Check for a fully-functional sed program, that truncates +# as few characters as possible. Prefer GNU sed if found. +AC_DEFUN([LT_AC_PROG_SED], +[AC_MSG_CHECKING([for a sed that does not truncate output]) +AC_CACHE_VAL(lt_cv_path_SED, +[# Loop through the user's path and test for sed and gsed. +# Then use that list of sed's as ones to test for truncation. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for lt_ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then + lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" + fi + done + done +done +lt_ac_max=0 +lt_ac_count=0 +# Add /usr/xpg4/bin/sed as it is typically found on Solaris +# along with /bin/sed that truncates output. +for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do + test ! -f $lt_ac_sed && break + cat /dev/null > conftest.in + lt_ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >conftest.in + # Check for GNU sed and select it if it is found. + if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then + lt_cv_path_SED=$lt_ac_sed + break + fi + while true; do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo >>conftest.nl + $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break + cmp -s conftest.out conftest.nl || break + # 10000 chars as input seems more than enough + test $lt_ac_count -gt 10 && break + lt_ac_count=`expr $lt_ac_count + 1` + if test $lt_ac_count -gt $lt_ac_max; then + lt_ac_max=$lt_ac_count + lt_cv_path_SED=$lt_ac_sed + fi + done +done +]) +SED=$lt_cv_path_SED +AC_MSG_RESULT([$SED]) +]) diff --git a/config.h.in b/config.h.in new file mode 100644 index 0000000..0611cad --- /dev/null +++ b/config.h.in @@ -0,0 +1,219 @@ +/* config.h.in. Generated from configure.in by autoheader. */ + +/* Define if you have the CoreAudio API */ +#undef HAVE_COREAUDIO + +/* Define to 1 if you have the <crt_externs.h> header file. */ +#undef HAVE_CRT_EXTERNS_H + +/* Defines if your system has the crypt function */ +#undef HAVE_CRYPT + +/* Define to 1 if you have the <dlfcn.h> header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you have the <inttypes.h> header file. */ +#undef HAVE_INTTYPES_H + +/* Define if you have libjpeg */ +#undef HAVE_LIBJPEG + +/* Define if you have libpng */ +#undef HAVE_LIBPNG + +/* Define if you have a working libpthread (will enable threaded code) */ +#undef HAVE_LIBPTHREAD + +/* Define if you have libz */ +#undef HAVE_LIBZ + +/* Define to 1 if you have the <memory.h> header file. */ +#undef HAVE_MEMORY_H + +/* Define if your system needs _NSGetEnviron to set up the environment */ +#undef HAVE_NSGETENVIRON + +/* Define if you have the res_init function */ +#undef HAVE_RES_INIT + +/* Define if you have a STL implementation by SGI */ +#undef HAVE_SGI_STL + +/* Define to 1 if you have the `snprintf' function. */ +#undef HAVE_SNPRINTF + +/* 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 if you have strlcat */ +#undef HAVE_STRLCAT + +/* Define if you have the strlcat prototype */ +#undef HAVE_STRLCAT_PROTO + +/* Define if you have strlcpy */ +#undef HAVE_STRLCPY + +/* Define if you have the strlcpy prototype */ +#undef HAVE_STRLCPY_PROTO + +/* Define to 1 if you have the <sys/stat.h> header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the <sys/types.h> header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the <unistd.h> header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if you have the `vsnprintf' function. */ +#undef HAVE_VSNPRINTF + +/* Suffix for lib directories */ +#undef KDELIBSUFF + +/* Define a safe value for MAXPATHLEN */ +#undef KDEMAXPATHLEN + +/* 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 version of this package. */ +#undef PACKAGE_VERSION + +/* The size of a `char *', as computed by sizeof. */ +#undef SIZEOF_CHAR_P + +/* The size of a `int', as computed by sizeof. */ +#undef SIZEOF_INT + +/* The size of a `long', as computed by sizeof. */ +#undef SIZEOF_LONG + +/* The size of a `short', as computed by sizeof. */ +#undef SIZEOF_SHORT + +/* The size of a `size_t', as computed by sizeof. */ +#undef SIZEOF_SIZE_T + +/* The size of a `unsigned long', as computed by sizeof. */ +#undef SIZEOF_UNSIGNED_LONG + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Version number of package */ +#undef VERSION + +/* Define to 1 if your processor stores words with the most significant byte + first (like Motorola and SPARC, unlike Intel and VAX). */ +#undef WORDS_BIGENDIAN + +/* + * jpeg.h needs HAVE_BOOLEAN, when the system uses boolean in system + * headers and I'm too lazy to write a configure test as long as only + * unixware is related + */ +#ifdef _UNIXWARE +#define HAVE_BOOLEAN +#endif + + + +/* + * AIX defines FD_SET in terms of bzero, but fails to include <strings.h> + * that defines bzero. + */ + +#if defined(_AIX) +#include <strings.h> +#endif + + + +#if defined(HAVE_NSGETENVIRON) && defined(HAVE_CRT_EXTERNS_H) +# include <sys/time.h> +# include <crt_externs.h> +# define environ (*_NSGetEnviron()) +#endif + + + +#if !defined(HAVE_STRLCAT_PROTO) +#ifdef __cplusplus +extern "C" { +#endif +unsigned long strlcat(char*, const char*, unsigned long); +#ifdef __cplusplus +} +#endif +#endif + + + +#if !defined(HAVE_STRLCPY_PROTO) +#ifdef __cplusplus +extern "C" { +#endif +unsigned long strlcpy(char*, const char*, unsigned long); +#ifdef __cplusplus +} +#endif +#endif + + + +/* + * On HP-UX, the declaration of vsnprintf() is needed every time ! + */ + +#if !defined(HAVE_VSNPRINTF) || defined(hpux) +#if __STDC__ +#include <stdarg.h> +#include <stdlib.h> +#else +#include <varargs.h> +#endif +#ifdef __cplusplus +extern "C" +#endif +int vsnprintf(char *str, size_t n, char const *fmt, va_list ap); +#ifdef __cplusplus +extern "C" +#endif +int snprintf(char *str, size_t n, char const *fmt, ...); +#endif + + + +#if defined(__SVR4) && !defined(__svr4__) +#define __svr4__ 1 +#endif + + +/* Compatibility define */ +#undef ksize_t + +/* Define the real type of socklen_t */ +#undef socklen_t diff --git a/configure.files b/configure.files new file mode 100644 index 0000000..030bce8 --- /dev/null +++ b/configure.files @@ -0,0 +1,2 @@ +./admin/configure.in.min +configure.in.in diff --git a/configure.in b/configure.in new file mode 100644 index 0000000..a444002 --- /dev/null +++ b/configure.in @@ -0,0 +1,82 @@ +dnl This file is part of the KDE libraries/packages +dnl Copyright (C) 2001 Stephan Kulow ([email protected]) + +dnl This file is free software; you can redistribute it and/or +dnl modify it under the terms of the GNU Library General Public +dnl License as published by the Free Software Foundation; either +dnl version 2 of the License, or (at your option) any later version. + +dnl This library 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 GNU +dnl Library General Public License for more details. + +dnl You should have received a copy of the GNU Library General Public License +dnl along with this library; see the file COPYING.LIB. If not, write to +dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +dnl Boston, MA 02111-1307, USA. + +# Original Author was [email protected] +# I lifted it in some mater. (Stephan Kulow) +# I used much code from Janos Farkas + +dnl Process this file with autoconf to produce a configure script. + +AC_INIT(acinclude.m4) dnl a source file from your sub dir + +dnl This is so we can use kde-common +AC_CONFIG_AUX_DIR(admin) + +dnl This ksh/zsh feature conflicts with `cd blah ; pwd` +unset CDPATH + +dnl Checking host/target/build systems, for make, install etc. +AC_CANONICAL_SYSTEM +dnl Perform program name transformation +AC_ARG_PROGRAM + +dnl Automake doc recommends to do this only here. (Janos) +AM_INIT_AUTOMAKE(knmap, 0.1) dnl searches for some needed programs + +KDE_SET_PREFIX + +dnl generate the config header +AM_CONFIG_HEADER(config.h) dnl at the distribution this done + +dnl Checks for programs. +AC_CHECK_COMPILERS +AC_ENABLE_SHARED(yes) +AC_ENABLE_STATIC(no) +KDE_PROG_LIBTOOL + +dnl for NLS support. Call them in this order! +dnl WITH_NLS is for the po files +AM_KDE_WITH_NLS + +KDE_USE_QT(3.2.0) +AC_PATH_KDE +#MIN_CONFIG(3.2.0) + +dnl PACKAGE set before +AC_C_BIGENDIAN +AC_CHECK_KDEMAXPATHLEN + +KDE_CREATE_SUBDIRSLIST +AC_CONFIG_FILES([ Makefile ]) +AC_CONFIG_FILES([ doc/Makefile ]) +AC_CONFIG_FILES([ doc/en/Makefile ]) +AC_CONFIG_FILES([ po/Makefile ]) +AC_CONFIG_FILES([ src/Makefile ]) +AC_OUTPUT +if test "$all_tests" = "bad"; then + if test ! "$cache_file" = "/dev/null"; then + echo "" + echo "Please remove the file $cache_file after changing your setup" + echo "so that configure will find the changes next time." + echo "" + fi +else + echo "" + echo "Good - your configure finished. Start make now" + echo "" +fi diff --git a/configure.in.in b/configure.in.in new file mode 100644 index 0000000..2e8250b --- /dev/null +++ b/configure.in.in @@ -0,0 +1,6 @@ +#MIN_CONFIG(3.2.0) + +AM_INIT_AUTOMAKE(knmap, 0.1) +AC_C_BIGENDIAN +AC_CHECK_KDEMAXPATHLEN + diff --git a/doc/Makefile.am b/doc/Makefile.am new file mode 100644 index 0000000..79a09b7 --- /dev/null +++ b/doc/Makefile.am @@ -0,0 +1,6 @@ +# the SUBDIRS is filled automatically by am_edit. If files are +# in this directory they are installed into the english dir + +KDE_LANG = en +KDE_DOCS = knmap +SUBDIRS = $(AUTODIRS) diff --git a/doc/en/Makefile.am b/doc/en/Makefile.am new file mode 100644 index 0000000..fb2ea2a --- /dev/null +++ b/doc/en/Makefile.am @@ -0,0 +1,3 @@ +KDE_DOCS = knmap +KDE_LANG = en +kde_docs_KDEDOCS = new_scan.png diff --git a/doc/en/button_bar.png b/doc/en/button_bar.png Binary files differnew file mode 100644 index 0000000..9c59354 --- /dev/null +++ b/doc/en/button_bar.png diff --git a/doc/en/common_options.png b/doc/en/common_options.png Binary files differnew file mode 100644 index 0000000..f9e460c --- /dev/null +++ b/doc/en/common_options.png diff --git a/doc/en/compound_options.png b/doc/en/compound_options.png Binary files differnew file mode 100644 index 0000000..5f3f00c --- /dev/null +++ b/doc/en/compound_options.png diff --git a/doc/en/demo.png b/doc/en/demo.png Binary files differnew file mode 100644 index 0000000..60b8d82 --- /dev/null +++ b/doc/en/demo.png diff --git a/doc/en/index.docbook b/doc/en/index.docbook new file mode 100644 index 0000000..2a28769 --- /dev/null +++ b/doc/en/index.docbook @@ -0,0 +1,784 @@ +<?xml version="1.0" ?> + +<!DOCTYPE book PUBLIC "-//KDE//DTD DocBook XML V4.1.2-Based Variant V1.1//EN" "dtd/kdex.dtd" [ + <!ENTITY knmap "<application>Knmap</application>"> + <!ENTITY kappname "&knmap;"> + <!ENTITY package "kde-module"><!-- kdebase, kdeadmin, etc --> + <!ENTITY % addindex "IGNORE"> + <!ENTITY % English "INCLUDE"> +]> + +<book lang="&language;"> +<bookinfo> + <title>The &knmap; Handbook</title> + + <authorgroup> + <author> + <firstname>Kevin</firstname> + <othername></othername> + <surname>Gilbert</surname> + <affiliation> + <address><email>[email protected]</email></address> + </affiliation> + </author> + </authorgroup> + + <copyright> + <year>2005</year> + <year>2006</year> + <holder>Kevin Gilbert</holder> + </copyright> + + <legalnotice>&FDLNotice;</legalnotice> + <date>2006-01-17</date> + <releaseinfo>2.1</releaseinfo> + + <abstract> + <para> + &knmap; is a graphical front end to the <computeroutput>nmap</computeroutput> "Network exploration tool and security scanner". + </para> + </abstract> + + <keywordset> + <keyword>KDE</keyword> + <keyword>Knmap</keyword> + <keyword>nmap</keyword> + </keywordset> +</bookinfo> + +<chapter id="introduction"> + <title>Introduction</title> + + <para> + This program is a complete re-write of one by the same name written by Alexandre Sagala. The last version of that program was 0.9 which was released on 2003-03-09 and targeted the KDE 2.2 and QT 2.3 environments. Unfortunately it does not compile on today's KDE / QT environments. + </para> + + <para> + Not to mention that it did not cater for the full set of <computeroutput>nmap</computeroutput> options. Or, perhaps, <computeroutput>nmap</computeroutput> progressed whilst that version of Knmap languished. + </para> + + <para> + The icons used in this application are from the Open Clip Art Library. I am indebted to those damn fine folk as my artistic ability is zero - which is marginally above my programming ability. :-( + </para> + + <para> + Version 1.0 of &knmap; was merely a re-write of the original. Version 2.0 adds the extra functionality of multiple concurrent <computeroutput>nmap</computeroutput> scans from within the one instance of &knmap;. Version 2.1 allows a normal (non-root) user to use the privileged nmap functions via to 'kdesu' utility. (Previously, the privileged options were only available if &knmap; was run by root.) + </para> +</chapter> + +<chapter id="using-knmap"> + <title>Using &knmap;</title> + <para> + It is assumed that you are familiar with the operation of <computeroutput>nmap</computeroutput>. + </para> + + <para> + If your aren't, then please refer to <computeroutput>nmap(1)</computeroutput> or any other resource you can lay your hands on. This document is all about how to use &knmap; as a front end to <computeroutput>nmap</computeroutput>. + </para> + + <para> + This following screenshot shows an actual run of <computeroutput>nmap</computeroutput> under the control of &knmap;. The main &knmap; window is divided into two partitions - the Index Window on the left and (a stack of) Scan Windows on the right. Each Scan Window is composed of three partitions - from top to bottom: the Options Window, the Button Bar, and the Output Window. + + <screenshot> + <mediaobject> + <imageobject> + <imagedata fileref="demo.png" format="PNG"/> + </imageobject> + </mediaobject> + </screenshot> + </para> + + <para> + The following sections contain screenshots that describe the contents of the various components of &knmap;'s main window. In the main, the contents of the Scan Window should be self-explanatory for readers familiar with <computeroutput>nmap</computeroutput> + </para> + + <sect1 id="index_window"> + <title>Index Window</title> + <para> + This window contains the names of all Scan Windows - with the current entry highlighted (in the KDE "Alternate Background in Lists" colour). When a scan is active, the entry for that scan will flash. When the scan has completed, if that scan is not the current entry, then the entry will be highlighted in the KDE "Selected Background" colour. + </para> + + <para> + Left clicking on an entry will display the Scan Window for that scan. The caption of the &knmap; main window will be updated to show the name of the scan and its associated profile. + </para> + + <para> + Entries can be manipulated via options in the "File" menu and via a RMB Context Menu. The order of the entries can be changed by dragging individual entries (multiple entries cannot be dragged concurrently). + </para> + + <para> + Scans for which the "Use target host name" property is active will have an asterisk displayed before their name. + </para> + </sect1> + + <sect1 id="output_window"> + <title>Output Window</title> + <para> + As its name implies, this window displays the output of an <computeroutput>nmap</computeroutput> scan. As can be seen from the previous screenshot, the text appearance varies. The following list explains how each type of output is displayed. + </para> + + <para> + <variablelist> + <varlistentry> + <term>Standard Input</term> + <listitem> + <para> + No font modifiers. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term>Standard Output</term> + <listitem> + <para> + Text is displayed in bold-face font. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term>Standard Error</term> + <listitem> + <para> + Text is displayed in bold-face, italic font. + </para> + </listitem> + </varlistentry> + </variablelist> + </para> + </sect1> + + <sect1 id="button_bar"> + <title>Button Bar</title> + <para> + This row of buttons control the operation of &knmap;. The following screenshot shows the button row in its normal state. + + <screenshot> + <mediaobject> + <imageobject> + <imagedata fileref="button_bar.png" format="PNG"/> + </imageobject> + </mediaobject> + </screenshot> + </para> + + <para> + The <computeroutput>Start nmap</computeroutput> and <computeroutput>Stop nmap</computeroutput> buttons should require no explanation. (No - I wont now launch into a multi-thousand word explanation of the bloody obvious.) + </para> + + <para> + The <computeroutput>Clear output</computeroutput> button does just that - deletes all the text in the Output Window. + </para> + + <para> + The <computeroutput>Hide options</computeroutput> button can be used to enlarge the Output Window so as to reduce scrolling as shown in the following screenshot. The text of the button reflects the state of the Options Window. + + <screenshot> + <mediaobject> + <imageobject> + <imagedata fileref="output_full.png" format="PNG"/> + </imageobject> + </mediaobject> + </screenshot> + </para> + </sect1> + + <sect1 id="common_options"> + <title>Common Options</title> + <para> + <screenshot> + <mediaobject> + <imageobject> + <imagedata fileref="common_options.png" format="PNG"/> + </imageobject> + </mediaobject> + </screenshot> + + This screenshot shows the <computeroutput>nmap</computeroutput> options that are common to most network scans. + </para> + + <para> + <variablelist> + <varlistentry> + <term>New data range</term> + <listitem> + <para> + The range of ports are entered here in the format specified in the <computeroutput>nmap</computeroutput> man page for the <computeroutput>-p</computeroutput> parametere, BUT without the protocol specifier. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term>Protocol</term> + <listitem> + <para> + Select the protocol(s) for the port list shown in the input area. Note that the list of ports can contain a combination of protocols. &knmap; will ensure that the port ranges do not overlap. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term>Add</term> + <listitem> + <para> + As soon as data has been entered in the input area, the <computeroutput>Add</computeroutput> button will be activated. Pressing this button will cause &knmap; to read the input and, if, valid, add it to the list of existing port ranges. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term>Delete</term> + <listitem> + <para> + To delete a port range, double click on the entry in the list. That entry will be copied to the input area, the <computeroutput>Protocol</computeroutput> combo box updated to reflect the selected entry and the <computeroutput>Delete</computeroutput> button will be activated. + </para> + + <para> + If the button is then pressed, the input area will NOT be cleared and the <computeroutput>Add</computeroutput> button will be activated. The allows for the port range to be added back into the list if the deletion was performed in error. + </para> + </listitem> + </varlistentry> + </variablelist> + </para> + </sect1> + + <sect1 id="compound_options"> + <title>Compound Options</title> + <para> + <screenshot> + <mediaobject> + <imageobject> + <imagedata fileref="compound_options.png" format="PNG"/> + </imageobject> + </mediaobject> + </screenshot> + + This screenshot shows those <computeroutput>nmap</computeroutput> options that require a value. The associated input area is activated when the option is activated. Options preceded by a hash (#) require root privileges. When the "Start nmap" button is pressed, the 'kdesu' facility will be invoked to run nmap as the super user. + </para> + </sect1> + + <sect1 id="logging_options"> + <title>Logging Options</title> + <para> + <screenshot> + <mediaobject> + <imageobject> + <imagedata fileref="logging_options.png" format="PNG"/> + </imageobject> + </mediaobject> + </screenshot> + + This screenshot shows the <computeroutput>nmap</computeroutput> options that relate to logging. + </para> + + <para> + &knmap; considers the <computeroutput>--resume</computeroutput> option to be a logging option as its use requires that logging was enabled in the interrupted scan. + </para> + </sect1> + + <sect1 id="man_page"> + <title><computeroutput>man</computeroutput> Page</title> + <para> + <screenshot> + <mediaobject> + <imageobject> + <imagedata fileref="man_page.png" format="PNG"/> + </imageobject> + </mediaobject> + </screenshot> + + &knmap; comes packaged with the <computeroutput>man</computeroutput> page for <computeroutput>nmap</computeroutput> version 3.93 in HTML format. See the Settings -> <computeroutput>man</computeroutput> page stylesheet... menu option for how to control the appearance of this documentation and the Settings -> Zoom in / out / custom options for controlling the size.. + </para> + </sect1> + + <sect1 id="ping_and_scan_options"> + <title>Ping and Scan Options</title> + <para> + <screenshot> + <mediaobject> + <imageobject> + <imagedata fileref="ping_and_scan_options.png" format="PNG"/> + </imageobject> + </mediaobject> + </screenshot> + + This screenshot shows the <computeroutput>nmap</computeroutput> options that control the types of ping and scans that will be performed. Options preceded by a hash (#) require root privileges. When the "Start nmap" button is pressed, the 'kdesu' facility will be invoked to run nmap as the super user. + </para> + </sect1> + + <sect1 id="simple_options"> + <title>Simple Options</title> + <para> + <screenshot> + <mediaobject> + <imageobject> + <imagedata fileref="simple_options.png" format="PNG"/> + </imageobject> + </mediaobject> + </screenshot> + + This screenshot shows the boolean <computeroutput>nmap</computeroutput> options, i.e., those options that do not require a value. Options preceded by a hash (#) require root privileges. When the "Start nmap" button is pressed, the 'kdesu' facility will be invoked to run nmap as the super user. + </para> + </sect1> + + <sect1 id="timing_options"> + <title>Timing Options</title> + <para> + <screenshot> + <mediaobject> + <imageobject> + <imagedata fileref="timing_options.png" format="PNG"/> + </imageobject> + </mediaobject> + </screenshot> + + This screenshot shows the <computeroutput>nmap</computeroutput> options that control the timing of network activity. Note that the <computeroutput>Default</computeroutput> does nothing. It is provided as a means to disable the other timing options. + </para> + </sect1> +</chapter> + +<chapter id="commands"> + <title>Command Reference</title> + <sect1 id="knmap_menu_options"> + <title>The &knmap; Menu Options</title> + <sect2> + <title>The File Menu</title> + <para> + <variablelist> + <varlistentry> + <term><menuchoice> + <shortcut> + <keycombo action="simul">&Ctrl;<keycap>S</keycap></keycombo> + </shortcut> + <guimenu>File</guimenu> + <guimenuitem>Save</guimenuitem> + </menuchoice></term> + <listitem> + <para> + <action> + Saves the current content of the Output Window. Note, however, that all text formatting is lost. If you don't like this - tough. Go tell someone that gives a shit! + </action> + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><menuchoice> + <guimenu>File</guimenu> + <guimenuitem>Save As...</guimenuitem> + </menuchoice></term> + <listitem> + <para> + <action> + Given the above explanation of what "File -> Save" does, this option should need no further explanation. + </action> + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><menuchoice> + <shortcut> + <keycombo action="simul">&Ctrl;<keycap>N</keycap></keycombo> + </shortcut> + <guimenu>File</guimenu> + <guimenuitem>New scan...</guimenuitem> + </menuchoice></term> + <listitem> + <para> + <action> + Creates a new Scan Window. The dialog box shown below will be displayed to allow the name of the scan to be entered. The "Use target host name" option allows the name of the scan to automatically track the target of the nmap scan. If that option is not selected, the name of the scan can be entered in the edit window - which is activated when the "Use target host name" option is unchecked. + </action> + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><menuchoice> + <shortcut> + <keycombo action="simul">&Ctrl;<keycap>C</keycap></keycombo> + </shortcut> + <guimenu>File</guimenu> + <guimenuitem>Duplicate scan</guimenuitem> + </menuchoice></term> + <listitem> + <para> + <action> + As the name imples, the current scan is duplicated. Unusual / unfortunate and / or strange behaviour may / will result if the name of the scan is not changed but a different profile is associated with the duplicated scan (name). + </action> + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><menuchoice> + <shortcut> + <keycombo action="simul"><keycap>F2</keycap></keycombo> + </shortcut> + <guimenu>File</guimenu> + <guimenuitem>Rename scan...</guimenuitem> + </menuchoice></term> + <listitem> + <para> + <action> + Obvious - but it is also possible to select the "Use target host name" property via this menu item. + </action> + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><menuchoice> + <shortcut> + <keycombo action="simul"><keycap>F2</keycap></keycombo> + </shortcut> + <guimenu>File</guimenu> + <guimenuitem>Use target host name</guimenuitem> + </menuchoice></term> + <listitem> + <para> + <action> + This is a toggle item that causes the name of the scan to automatically track the target of the nmap scan. + </action> + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><menuchoice> + <shortcut> + <keycombo action="simul">&Ctrl;<keycap>W</keycap></keycombo> + </shortcut> + <guimenu>File</guimenu> + <guimenuitem>Close scan</guimenuitem> + </menuchoice></term> + <listitem> + <para> + <action> + Obvious - but if the profile has been updated you will be asked whether it should be saved. + </action> + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><menuchoice> + <shortcut> + <keycombo action="simul">&Ctrl;<keycap>Q</keycap></keycombo> + </shortcut> + <guimenu>File</guimenu> + <guimenuitem>Quit</guimenuitem> + </menuchoice></term> + <listitem><para><action>Quits</action> &knmap;</para></listitem> + </varlistentry> + </variablelist> + </para> + + <para> + <screenshot> + <mediaobject> + <imageobject> + <imagedata fileref="new_scan.png" format="PNG"/> + </imageobject> + </mediaobject> + </screenshot> + </para> + </sect2> + + <sect2> + <title>The Profiles Menu</title> + <para> + Before launching into the explanation of the items under this menu, it is necessary to define what a "Profile" is. + </para> + + <para> + Quite simply, a Profile is the set of values of all the <computeroutput>nmap</computeroutput> options supported by &knmap; and some &knmap;-specific data (e.g., the order of the tabs in the Options Window and the current options tab). + </para> + + <para> + The status of the Hide / Show buttons is not saved. All windows are shown on &knmap; startup regrardless of their status at the time a Profile saved. + </para> + + <para> + Having the same profile associated with multiple scans is not recommended - unusual / unfortunate and / or strange behaviour may / will result. + </para> + + <para> + The following screenshot shows the dialog window that controls all options in this menu. + <screenshot> + <mediaobject> + <imageobject> + <imagedata fileref="profile_dlg.png" format="PNG"/> + </imageobject> + </mediaobject> + </screenshot> + The top window is used for the entry of new names for the copy and rename functions. The lower window lists all known profiles. (For the technically minded, the profiles are stored in the standard KDE <computeroutput>knmaprc</computeroutput> configuration file - but with the name "Knmap_<profile name>".) + </para> + + <para> + The copy, delete and rename functions available in this menu are also available when a profile name is right-clicked in the list window. + </para> + + <para> + <variablelist> + <varlistentry> + <term><menuchoice> + <guimenu>Profiles</guimenu> + <guimenuitem>Load profile...</guimenuitem> + </menuchoice></term> + <listitem> + <para> + <action> + Equivalent to a "File -> Open" in your favourite editor. If the current profile has been modified you will be asked if you want to save it prior to loading the new profile. + </action> + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><menuchoice> + <guimenu>Profiles</guimenu> + <guimenuitem>Save profile...</guimenuitem> + </menuchoice></term> + <listitem> + <para> + <action> + Equivalent to a "File -> Save" in your favourite editor. + </action> + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><menuchoice> + <guimenu>Profiles</guimenu> + <guimenuitem>Save profile as...</guimenuitem> + </menuchoice></term> + <listitem> + <para> + <action> + Equivilent to a "File -> Save" as in your favourite editor. + </action> + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><menuchoice> + <guimenu>Profiles</guimenu> + <guimenuitem>Copy profile...</guimenuitem> + </menuchoice></term> + <listitem> + <para> + <action> + The selected profile is copied, the name of the new profile is entered in the upper input window. + </action> + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><menuchoice> + <guimenu>Profiles</guimenu> + <guimenuitem>Delete profile...</guimenuitem> + </menuchoice></term> + <listitem> + <para> + <action> + Bloody obvious. + </action> + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><menuchoice> + <guimenu>Profiles</guimenu> + <guimenuitem>Rename profile...</guimenuitem> + </menuchoice></term> + <listitem> + <para> + <action> + The name of the selected profile is changed to the name entered in the upper input window. + </action> + </para> + </listitem> + </varlistentry> + </variablelist> + </para> + </sect2> + + <sect2> + <title>The Settings Menu</title> + <para> + <variablelist> + <varlistentry> + <term><menuchoice> + <guimenu>Settings</guimenu> + <guimenuitem>Wrap text</guimenuitem> + </menuchoice></term> + <listitem> + <para> + <action> + Selects whether the nmap output should be word-wrapped at the windows right-border. + </action> + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><menuchoice> + <guimenu>Settings</guimenu> + <guimenuitem>'man' page stylesheet...</guimenuitem> + </menuchoice></term> + <listitem> + <para> + <action> + Allows for the selection of the stylesheet to be used when the nmap man page is displayed. + </action> + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><menuchoice> + <guimenu>Settings</guimenu> + <guimenuitem>Use local 'man' page</guimenuitem> + </menuchoice></term> + <listitem> + <para> + <action> + This is a toggle action, the text changes depending upon its state. If the &knmap; nmap man page is being displayed, this option allows for the >man page stored on the local machine to be displayed. This is useful when the local version of the nmap man page differs from the version distrubuted with &knmap;. + </action> + </para> + + <para> + <action> + When the local man page is being displayed, this option allows for the &knmap; version to be displayed. + </action> + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><menuchoice> + <guimenu>Settings</guimenu> + <guimenuitem>Zoom in</guimenuitem> + </menuchoice></term> + <listitem> + <para> + <action> + Increases the font size in the man page window by 25% - limits are 20% - 300%. + </action> + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><menuchoice> + <guimenu>Settings</guimenu> + <guimenuitem>Zoom out</guimenuitem> + </menuchoice></term> + <listitem> + <para> + <action> + Decreases the font size in the man page window by 25% - limits are 20% - 300%. + </action> + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><menuchoice> + <guimenu>Settings</guimenu> + <guimenuitem>Zoom custom</guimenuitem> + </menuchoice></term> + <listitem> + <para> + <action> + Allows manual control of the font size - limits are 20% - 300%. + </action> + </para> + </listitem> + </varlistentry> + </variablelist> + </para> + + <para> + The remaining options in this menu are standard KDE options. + </para> + </sect2> + + <sect2> + <title>The Help Menu</title> + <para> + &help.menu.documentation; + </para> + </sect2> + </sect1> +</chapter> + +<chapter id="developers"> + <title>Developer's Guide to &knmap;</title> + <para> + The only item worthy of mention here is the file <computeroutput>nmap_manpage.html.diff</computeroutput>. This file contains a <computeroutput>diff</computeroutput> of the <computeroutput>nmap</computeroutput> version 3.93 HTML formatted <computeroutput>man</computeroutput> page and that distributed with &knmap;. You can use this to update your version of that <computeroutput>man</computeroutput> page. + </para> +</chapter> + +<chapter id="credits"> + <title>Credits and License</title> + <para> + &knmap; + </para> + + <para> + Program copyright 2005, 2006 Kevin Gilbert <email>[email protected]</email> + </para> + + <para> + Documentation copyright 2005, 2006 Kevin Gilbert <email>[email protected]</email> + </para> + + &underFDL; + &underGPL; +</chapter> + +<appendix id="installation"> + <title>Installation</title> + + <sect1 id="getting-knmap"> + <title>How to obtain &knmap;</title> + + <para> + Now let me see... You're reading this documentation - which come packaged with &knmap;, which means that you have &knmap; installed, which means that you have somehow obtained &knmap;, and now you want to know how to obtain &knmap;? + </para> + + <para> + You have _way_ too much time on your hands! ;-) + </para> + + <para> + Okay, Okay. Go to <ulink url="http://sourceforge.net/projects/knmap">http://sourceforge.net/projects/knmap</ulink> and follow the download links. + </para> + </sect1> + + <sect1 id="requirements"> + <title>Requirements</title> + <para> + &knmap; was developed and tested under Qt 3.3.4 / KDE 3.4 & 3.5. YMMV vary if your configuration differs from this. + </para> + + <para> + And, of course, you will need <computeroutput>nmap</computeroutput>. Go to <ulink url="http://www.insecure.org/nmap">http://www.insecure.org/nmap</ulink> for details on how to download <computeroutput>nmap</computeroutput>. + </para> + </sect1> + + <sect1 id="compilation"> + <title>Compilation and Installation</title> + &install.compile.documentation; + </sect1> +</appendix> + + &documentation.index; +</book> diff --git a/doc/en/logging_options.png b/doc/en/logging_options.png Binary files differnew file mode 100644 index 0000000..bd68f1e --- /dev/null +++ b/doc/en/logging_options.png diff --git a/doc/en/man_page.png b/doc/en/man_page.png Binary files differnew file mode 100644 index 0000000..7f45ba7 --- /dev/null +++ b/doc/en/man_page.png diff --git a/doc/en/man_page_full.png b/doc/en/man_page_full.png Binary files differnew file mode 100644 index 0000000..4b27d71 --- /dev/null +++ b/doc/en/man_page_full.png diff --git a/doc/en/new_scan.png b/doc/en/new_scan.png Binary files differnew file mode 100644 index 0000000..ff0dc38 --- /dev/null +++ b/doc/en/new_scan.png diff --git a/doc/en/output_full.png b/doc/en/output_full.png Binary files differnew file mode 100644 index 0000000..739ebe0 --- /dev/null +++ b/doc/en/output_full.png diff --git a/doc/en/ping_and_scan_options.png b/doc/en/ping_and_scan_options.png Binary files differnew file mode 100644 index 0000000..bc79a24 --- /dev/null +++ b/doc/en/ping_and_scan_options.png diff --git a/doc/en/profile_dlg.png b/doc/en/profile_dlg.png Binary files differnew file mode 100644 index 0000000..113476b --- /dev/null +++ b/doc/en/profile_dlg.png diff --git a/doc/en/simple_options.png b/doc/en/simple_options.png Binary files differnew file mode 100644 index 0000000..af69c4c --- /dev/null +++ b/doc/en/simple_options.png diff --git a/doc/en/timing_options.png b/doc/en/timing_options.png Binary files differnew file mode 100644 index 0000000..85b5a67 --- /dev/null +++ b/doc/en/timing_options.png diff --git a/po/Makefile.am b/po/Makefile.am new file mode 100644 index 0000000..0fa209c --- /dev/null +++ b/po/Makefile.am @@ -0,0 +1 @@ +POFILES = AUTO diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 0000000..6a38c98 --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,46 @@ +# set the include path for X, qt and KDE +INCLUDES = $(all_includes) + +# these are the headers for your project +noinst_HEADERS = knmap.h global.h mainwidget.h outputwidget.h commonwidget.h \ + timingwidget.h compoundwidget.h htmlwidget.h stylesheetdialog.h profiledialog.h \ + loggingoptions.h simpleoptions.h pandsoptions.h whatsthis.h tabwidgetptrlist.h \ + tabwidgetdata.h scanwidget.h indexwidget.h scannamedialog.h scanstack.h scanmonitor.h \ + scanmonitorevent.h nmapoutputbuffer.h + +# let automoc handle all of the meta source files (moc) +METASOURCES = AUTO + +messages: rc.cpp + $(EXTRACTRC) `find . -name \*.ui -o -name \*.rc` > rc.cpp + $(XGETTEXT) *.cpp -o $(podir)/knmap.pot + +KDE_ICON = AUTO + +######################################################################### +# APPLICATION SECTION +######################################################################### +# this is the program that gets installed. it's name is used for all +# of the other Makefile.am variables +bin_PROGRAMS = knmap + +# the application source, library search path, and link libraries +knmap_SOURCES = main.cpp knmap.cpp mainwidget.cpp outputwidget.cpp \ + commonwidget.cpp timingwidget.cpp compoundwidget.cpp htmlwidget.cpp stylesheetdialog.cpp \ + profiledialog.cpp loggingoptions.cpp simpleoptions.cpp pandsoptions.cpp whatsthis.cpp \ + tabwidgetptrlist.cpp tabwidgetdata.cpp scanwidget.cpp indexwidget.cpp scannamedialog.cpp \ + scanstack.cpp scanmonitor.cpp scanmonitorevent.cpp nmapoutputbuffer.cpp +knmap_LDFLAGS = $(KDE_RPATH) $(all_libraries) +knmap_LDADD = $(LIB_KIO) $(LIB_KHTML) + +# this is where the desktop file will go +shelldesktopdir = $(kde_appsdir)/Utilities +shelldesktop_DATA = knmap.desktop + +# this is where the shell's XML-GUI resource file goes +shellrcdir = $(kde_datadir)/knmap +shellrc_DATA = knmapui.rc nmap_manpage.html nmap_manpage.html.diff + +kde_icon_KDEICON = hi16-app-scanclose.png hi32-app-scanclose.png \ + hi16-app-scannew.png hi32-app-scannew.png hi16-app-scanrename.png hi32-app-scanrename.png \ + hi16-app-scanduplicate.png hi32-app-scanduplicate.png hi16-app-manpage.png hi32-app-manpage.png diff --git a/src/commonwidget.cpp b/src/commonwidget.cpp new file mode 100644 index 0000000..e9dbe12 --- /dev/null +++ b/src/commonwidget.cpp @@ -0,0 +1,655 @@ +/*************************************************************************** + * * + * Copyright (C) 2005, 2006 by Kevin Gilbert * + * [email protected] * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + ***************************************************************************/ + +#include <qbuttongroup.h> +#include <qcheckbox.h> +#include <qcombobox.h> +#include <qlabel.h> +#include <qlayout.h> +#include <qlineedit.h> +#include <qlistbox.h> +#include <qpushbutton.h> +#include <qradiobutton.h> +#include <qstringlist.h> +#include <qvalidator.h> + +#include <kconfig.h> +#include <kdebug.h> +#include <kglobal.h> +#include <kiconloader.h> +#include <klocale.h> +#include <kmessagebox.h> + +#include "commonwidget.h" +#include "whatsthis.h" + +// constructor +// =========== + +CommonWidget::CommonWidget( QWidget* parent, const char* name ) +: QWidget( parent, name ), + m_hosts( NULL ), + m_portRangeIgnoreChange( false ), + m_portRanges( NULL ) +{ createLayout( ); + m_portRangeAddButton->setEnabled( false ); + m_portRangeDeleteButton->setEnabled( false ); +} + +// destructor +// ========== + +CommonWidget::~CommonWidget( ) +{ if( m_hosts != NULL ) + delete m_hosts; + + if( m_portRanges != NULL ) + delete m_portRanges; +} + +// buildPortRangesTables +// ===================== + +bool CommonWidget::buildPortRangesTables( const boolPtr tcpPorts, const boolPtr udpPorts ) +{ memset( tcpPorts, 0, 64 * 1024 ); + memset( udpPorts, 0, 64 * 1024 ); + + QStringList portRanges; + getPortRanges( &portRanges ); + + for( QStringList::Iterator it = portRanges.begin( ); it != portRanges.end( ); ++it ) + { QString portRange = *it; + bool tcp = false; + bool udp = false; + + if( portRange[ 0 ].isDigit( )) + { tcp = true; + udp = true; + } + else + if( portRange[ 0 ].lower( ) == 't' ) + { tcp = true; + portRange = portRange.right( portRange.length( ) - 2 ); + } + else + if( portRange[ 0 ].lower( ) == 'u' ) + { udp = true; + portRange = portRange.right( portRange.length( ) - 2 ); + } + else + { KMessageBox::error( this, i18n( QString( "Internal error - Unknown Port Range protocol '%1'" ).arg( portRange[ 0 ])), i18n( "Internal error" )); + return false; + } + + QStringList ports = QStringList::split( "-", portRange ); + + if( ports.count( ) > 2 ) + { KMessageBox::error( this, i18n( "Internal error - Illegal Port Range encountered" ), i18n( "Internal error" )); + return false; + } + + ushort portFirst = ports.front( ).toUShort( ); + ushort portLast = portFirst; + + if( ports.count( ) > 1 ) + portLast = ports.back( ).toUShort( ); + + for( uint port = portFirst; port <= portLast; port++ ) + { if( tcp ) + tcpPorts[ port ] = true; + + if( udp ) + udpPorts[ port ] = true; + } + } + + return true; +} + +// createLayout +// ============ + +void CommonWidget::createLayout( ) +{ QGridLayout* gridLayout = new QGridLayout( this ); + KIconLoader* iconLoader = KGlobal::iconLoader( ); + QIconSet clearRightIconSet = iconLoader->loadIconSet( "locationbar_erase", KIcon::Small ); + + byte row = 1; + m_hostButton = new QPushButton( clearRightIconSet, NULL, this, "host button" ); + m_hostComboBox = new QComboBox( true, this, "target hosts combobox" ); + QHBoxLayout* hostLayout = new QHBoxLayout( ); + + byte col = 0; + hostLayout->insertStretch( col++, 0 ); + hostLayout->insertWidget( col++, new QLabel( i18n( "Target host(s)" ), this, "target hosts label" ), 0 ); + hostLayout->insertStretch( col++, 1 ); + hostLayout->insertWidget( col++, m_hostButton, 0 ); + hostLayout->insertStretch( col++, 1 ); + hostLayout->insertWidget( col++, m_hostComboBox, 100 ); + hostLayout->insertStretch( col++, 0 ); + gridLayout->addMultiCellLayout( hostLayout, row, row, 1, 5 ); + + QButtonGroup* resloveGroup = new QButtonGroup( 3, Qt::Vertical, i18n( "Resolve names" ), this, "resolve names group" ); + m_resovleDefaultRadio = new QRadioButton( i18n( "Default" ), resloveGroup, "default resolve radio" ); + m_resovleAlwaysRadio = new QRadioButton( i18n( "Always (-R)" ), resloveGroup, "always resolve radio" ); + m_resovleNeverRadio = new QRadioButton( i18n( "Never (-n)" ), resloveGroup, "never resolve radio" ); + + row = 4; + gridLayout->addMultiCellWidget( resloveGroup, row, row + 3, 1, 1 ); + byte rowBlock1 = ++row; + + m_portRangeAddButton = new QPushButton( i18n( "Add" ), this, "add port range button" ); + m_portRangeDeleteButton = new QPushButton( i18n( "Delete" ), this, "delete port range button" ); + m_portRangeComboBox = new QComboBox( this, "port range combobox" ); + m_portRangeLineEdit = new QLineEdit( this, "port range line edit" ); + m_portRangeListBox = new QListBox( this, "port range listbox" ); + m_portRangesCheckBox = new QCheckBox( i18n( "Port ranges (-p <port ranges>)" ), this, "port ranges checkbox" ); + + m_portRangeComboBox->insertItem( i18n( "Both" ), BothProtocol ); + m_portRangeComboBox->insertItem( i18n( "TCP" ), TCPProtocol ); + m_portRangeComboBox->insertItem( i18n( "UDP" ), UDPProtocol ); + + m_portRangeLineEdit->setValidator( new QRegExpValidator( QRegExp( "^\\d{1,5}-{1}\\d{1,5}$" ), this, "port range regx" )); + + row = 3; + gridLayout->addMultiCellWidget( m_portRangesCheckBox, row, row, 3, 5, Qt::AlignCenter ); + row++; + + m_portRangeButton = new QPushButton( clearRightIconSet, NULL, this, "host button" ); + QHBoxLayout* portRangeLayout = new QHBoxLayout( ); + + col = 0; + portRangeLayout->insertStretch( col++, 0 ); + portRangeLayout->insertWidget( col++, new QLabel( i18n( "New range data: " ), this, "new range data label" ), 0 ); + portRangeLayout->insertStretch( col++, 1 ); + portRangeLayout->insertWidget( col++, m_portRangeButton, 0 ); + portRangeLayout->insertStretch( col++, 1 ); + portRangeLayout->insertWidget( col++, m_portRangeLineEdit, 100 ); + portRangeLayout->insertStretch( col++, 0 ); + gridLayout->addMultiCellLayout( portRangeLayout, row, row, 3, 5 ); + + gridLayout->addWidget( new QLabel( i18n( "Protocol" ), this, "protocol label" ), row + 1, 3 ); + gridLayout->addWidget( m_portRangeComboBox, row + 2, 3 ); + gridLayout->addWidget( m_portRangeAddButton, row + 4, 3 ); + gridLayout->addWidget( m_portRangeDeleteButton, row + 5, 3 ); + byte rowBlock2 = _max_( row + 5, rowBlock1 ); + gridLayout->addMultiCellWidget( m_portRangeListBox, row + 1, rowBlock2, 5, 5 ); + + gridLayout->setColStretch( 0, 4 ); + gridLayout->setColStretch( 2, 2 ); + gridLayout->setColStretch( 5, 10 ); + gridLayout->setColStretch( 6, 4 ); + + gridLayout->setRowStretch( 0, 10 ); + gridLayout->setRowStretch( 2, 10 ); + gridLayout->setRowStretch( rowBlock2 + 1, 10 ); +} + +// enablePortRangeWidgets +// ====================== + +void CommonWidget::enablePortRangeWidgets( ) +{ bool portRangesState = m_portRangesCheckBox->isChecked( ); + + m_portRangeAddButton->setEnabled( false ); + m_portRangeDeleteButton->setEnabled( false ); + m_portRangeButton->setEnabled( portRangesState ); + m_portRangeLineEdit->setEnabled( portRangesState ); + m_portRangeLineEdit->clear( ); + m_portRangeComboBox->setEnabled( portRangesState ); + m_portRangeListBox->setEnabled( portRangesState ); + + if( portRangesState ) + emit( disableFastScan( )); +} + +// finaliseInitialisation +// ====================== + +void CommonWidget::finaliseInitialisation( ) +{ WhatsThis* whatsThis = new WhatsThis( this ); + + connect( m_hostButton, SIGNAL( clicked( )), SLOT( slotHostButtonClicked( ))); + connect( m_hostComboBox, SIGNAL( activated( int )), SLOT( slotHostActivated( int ))); + connect( m_hostComboBox, SIGNAL( textChanged( const QString& )), SLOT( slotHostTextChanged( const QString& ))); + connect( m_portRangeAddButton, SIGNAL( clicked( )), SLOT( slotPortRangeAddClicked( ))); + connect( m_portRangeButton, SIGNAL( clicked( )), SLOT( slotPortRangeButtonClicked( ))); + connect( m_portRangeDeleteButton, SIGNAL( clicked( )), SLOT( slotPortRangeDeleteClicked( ))); + connect( m_portRangeComboBox, SIGNAL( activated( int )), SLOT( slotPortRangeActivated( int ))); + connect( m_portRangeLineEdit, SIGNAL( textChanged( const QString& )), SLOT( slotPortRangeTextChanged( const QString& ))); + connect( m_portRangeListBox, SIGNAL( doubleClicked( QListBoxItem* )), SLOT( slotPortRangeDoubleClicked( QListBoxItem* ))); + connect( m_portRangeListBox, SIGNAL( highlighted( int )), SLOT( slotPortRangeHighlighted( ))); + connect( m_portRangesCheckBox, SIGNAL( clicked( )), SLOT( slotPortRangesClicked( ))); + connect( whatsThis, SIGNAL( clicked( )), SLOT( slotWhatsThisClicked( ))); + + connect( m_hostButton, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_hostComboBox, SIGNAL( activated ( int )), SIGNAL( optionsDirty( ))); + connect( m_hostComboBox, SIGNAL( textChanged( const QString& )), SIGNAL( optionsDirty( ))); + connect( m_portRangeAddButton, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_portRangeButton, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_portRangeComboBox, SIGNAL( activated( int )), SIGNAL( optionsDirty( ))); + connect( m_portRangeDeleteButton, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_portRangeLineEdit, SIGNAL( textChanged( const QString& )), SIGNAL( optionsDirty( ))); + connect( m_portRangeListBox, SIGNAL( doubleClicked( QListBoxItem* )), SIGNAL( optionsDirty( ))); + connect( m_portRangeListBox, SIGNAL( highlighted ( int )), SIGNAL( optionsDirty( ))); + connect( m_portRangesCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_resovleAlwaysRadio, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_resovleDefaultRadio, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_resovleNeverRadio, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + + emit( targetChanged( m_hostComboBox->currentText( ))); +} +QString CommonWidget::getHostName( ) const +{ return m_hostComboBox->currentText( ); +} + +// getHosts +// ======== + +void CommonWidget::getHosts( QStringList* hosts ) +{ hosts->clear( ); + + for( ushort i = 0; i < m_hostComboBox->count( ); i++ ) + hosts->append( m_hostComboBox->text( i )); +} + +// getOptions +// ========== + +bool CommonWidget::getOptions( ) +{ QStringList portRanges; + getPortRanges( &portRanges ); + + bool portRangesState = m_portRangesCheckBox->isChecked( ); + + if( portRangesState && portRanges.isEmpty( )) + { KMessageBox::error( this, i18n( QString( "Port ranges not specified" )), i18n( "Port ranges error" )); + return false; + } + + m_host = m_hostComboBox->currentText( ); + m_hostCurrentItem = m_hostComboBox->currentItem( ); + m_portRangeCurrentItem = m_portRangeComboBox->currentItem( ); + m_portRangesState = portRangesState; + m_resovleAlwaysState = m_resovleAlwaysRadio->isChecked( ); + m_resovleDefaultState = m_resovleDefaultRadio->isChecked( ); + m_resovleNeverState = m_resovleNeverRadio->isChecked( ); + + if( m_portRanges != NULL ) + delete m_portRanges; + + m_portRanges = new QStringList( portRanges ); + getHosts( m_hosts ); + + disconnect( m_hostComboBox, SIGNAL( activated( int )), this, SLOT( slotHostActivated( int ))); + disconnect( m_hostComboBox, SIGNAL( textChanged( const QString& )), this, SLOT( slotHostTextChanged( const QString& ))); + + disconnect( m_hostComboBox, SIGNAL( activated ( int )), this, SIGNAL( optionsDirty( ))); + disconnect( m_hostComboBox, SIGNAL( textChanged( const QString& )), this, SIGNAL( optionsDirty( ))); + + byte i; + QStringList::Iterator it; + + for( i = 0, it = m_hosts->begin( ); it != m_hosts->end( ); i++, ++it ) + if( *it == m_host ) + break; + + if( it != m_hosts->end( )) + { m_hostComboBox->removeItem( i ); + m_hosts->remove( it ); + } + else + while( m_hostComboBox->count( ) > MAX_HOST_HISTORY - 1 ) + { m_hostComboBox->removeItem( MAX_HOST_HISTORY - 1 ); + m_hosts->pop_back( ); + } + + m_hostComboBox->insertItem( m_host, 0 ); + m_hostComboBox->setCurrentItem( 0 ); + m_hosts->prepend( m_host ); + + connect( m_hostComboBox, SIGNAL( activated( int )), SLOT( slotHostActivated( int ))); + connect( m_hostComboBox, SIGNAL( textChanged( const QString& )), SLOT( slotHostTextChanged( const QString& ))); + + connect( m_hostComboBox, SIGNAL( activated ( int )), SIGNAL( optionsDirty( ))); + connect( m_hostComboBox, SIGNAL( textChanged( const QString& )), SIGNAL( optionsDirty( ))); + + return true; +} + +// getPortRanges +// ============= + +void CommonWidget::getPortRanges( QStringList* portRanges ) +{ portRanges->clear( ); + + for( ushort i = 0; i < m_portRangeListBox->count( ); i++ ) + portRanges->append( m_portRangeListBox->text( i )); +} + +// portRangesOverlapping +// ===================== + +bool CommonWidget::portRangesOverlapping( const ushort portFirst, const ushort portLast ) +{ boolPtr tcpPorts = new bool[ 64 * 1024 ]; + boolPtr udpPorts = new bool[ 64 * 1024 ]; + + if( !buildPortRangesTables( tcpPorts, udpPorts )) + { delete [] tcpPorts; + delete [] udpPorts; + return false; + } + + bool tcp = false; + bool udp = false; + + switch( m_portRangeComboBox->currentItem( )) + { case 0: tcp = udp = true; break; + case 1: tcp = true; break; + case 2: udp = true; break; + + default: + kdDebug( ) << i18n( "unknown value in Port Range Protocol combo box" ) << endl; + ASSERT( false ); + delete [] tcpPorts; + delete [] udpPorts; + return false; + } + + uint port; + QString protocol; + + for( port = portFirst; port <= portLast; port++ ) + { if( tcp && tcpPorts[ port ]) + { protocol = "TCP"; + break; + } + + if( udp && udpPorts[ port ]) + { protocol = "UDP"; + break; + } + } + + if( port <= portLast ) + { KMessageBox::sorry( this, i18n( "Overlapping Port Range - %1 port %2" ).arg( protocol ).arg( QString::number( port )), i18n( "Overlapping Port Range" )); + delete [] tcpPorts; + delete [] udpPorts; + return false; + } + + delete [] tcpPorts; + delete [] udpPorts; + return true; +} + +// readProfile +// =========== + +void CommonWidget::readProfile( KConfig* config ) +{ m_hostCurrentItem = config->readNumEntry( "hostCurrentItem" ); + m_portRangeCurrentItem = config->readNumEntry( "portRangeCurrentItem" ); + m_portRangesState = config->readBoolEntry( "portRangesState" ); + m_resovleAlwaysState = config->readBoolEntry( "resovleAlwaysState" ); + m_resovleDefaultState = config->readBoolEntry( "resovleDefaultState" ); + m_resovleNeverState = config->readBoolEntry( "resovleNeverState" ); + + m_hosts = new QStringList( config->readListEntry( "hosts" )); + m_portRanges = new QStringList( config->readListEntry( "portRanges" )); +} + +// saveProfile +// =========== + +void CommonWidget::saveProfile( KConfig* config ) +{ config->writeEntry( "hostCurrentItem", m_hostCurrentItem ); + config->writeEntry( "hosts", *m_hosts ); + config->writeEntry( "portRanges", *m_portRanges ); + config->writeEntry( "portRangeCurrentItem", m_portRangeCurrentItem ); + config->writeEntry( "portRangesState", m_portRangesState ); + config->writeEntry( "resovleAlwaysState", m_resovleAlwaysState ); + config->writeEntry( "resovleDefaultState", m_resovleDefaultState ); + config->writeEntry( "resovleNeverState", m_resovleNeverState ); +} + +// setInitialValues +// ================ + +void CommonWidget::setInitialValues( ) +{ m_hostComboBox->clear( ); + m_hostComboBox->insertStringList( *m_hosts ); + m_portRangeListBox->insertStringList( *m_portRanges ); + m_portRangeComboBox->setCurrentItem( m_portRangeCurrentItem ); + m_portRangesCheckBox->setChecked( m_portRangesState ); + m_resovleAlwaysRadio->setChecked( m_resovleAlwaysState ); + m_resovleDefaultRadio->setChecked( m_resovleDefaultState ); + m_resovleNeverRadio->setChecked( m_resovleNeverState ); + + if( m_hostComboBox->count( )) + m_hostComboBox->setCurrentItem( m_hostCurrentItem ); + + enablePortRangeWidgets( ); +} + +// slotDisablePortRanges +// ===================== + +void CommonWidget::slotDisablePortRanges( ) +{ m_portRangesCheckBox->setChecked( false ); + slotPortRangesClicked( ); +} + +// slotHostActivated +// ================= + +void CommonWidget::slotHostActivated( int /* index */) +{ emit( targetChanged( m_hostComboBox->currentText( ))); +} + +// slotHostButtonClicked +// ===================== + +void CommonWidget::slotHostButtonClicked( ) +{ m_hostComboBox->clearEdit( ); +} + +// slotHostTextChanged +// =================== + +void CommonWidget::slotHostTextChanged( const QString& text ) +{ emit( targetChanged( text )); +} + +// slotPortRangeAddClicked +// ======================= + +void CommonWidget::slotPortRangeAddClicked( ) +{ QString text; + + if( !validatePortRange( text )) + return; + + switch( m_portRangeComboBox->currentItem( )) + { case BothProtocol: break; + case TCPProtocol: text = "T:" + text; break; + case UDPProtocol: text = "U:" + text; break; + + default: + kdDebug( ) << i18n( "unknown value in Port Range Protocol combo box" ) << endl; + ASSERT( false ); + } + + m_portRangeAddButton->setEnabled( false ); + emit( optionsDirty( )); + m_portRangeLineEdit->clear( ); + m_portRangeListBox->insertItem( text ); +} + +// slotPortRangeDeleteClicked +// ========================== + +void CommonWidget::slotPortRangeDeleteClicked( ) +{ m_portRangeIgnoreChange = true; + m_portRangeListBox->removeItem( m_portRangeListBox->currentItem( )); + m_portRangeAddButton->setEnabled( true ); + m_portRangeDeleteButton->setEnabled( false ); + emit( optionsDirty( )); +} + +// slotPortRangeActivated +// ====================== + +void CommonWidget::slotPortRangeActivated( int /* index */) +{ m_portRangeAddButton->setEnabled( true ); +} + +// slotPortRangeActivated +// ====================== + +void CommonWidget::slotPortRangeButtonClicked( ) +{ m_portRangeAddButton->setEnabled( false ); + m_portRangeDeleteButton->setEnabled( false ); + m_portRangeLineEdit->clear( ); +} + +// slotPortRangeDoubleClicked +// ========================== + +void CommonWidget::slotPortRangeDoubleClicked( QListBoxItem* item ) +{ if( item == NULL ) + return; + + QString text = item->text( ); + + if( text[ 0 ].isDigit( )) + m_portRangeComboBox->setCurrentItem( BothProtocol ); + else + { switch( text[ 0 ].latin1( )) + { case 'T': m_portRangeComboBox->setCurrentItem( TCPProtocol ); break; + case 'U': m_portRangeComboBox->setCurrentItem( UDPProtocol ); break; + + default: + kdDebug( ) << i18n( "unknown value in Port Range Protocol" ) << endl; + ASSERT( false ); + m_portRangeComboBox->setCurrentItem( BothProtocol ); + } + + text = text.right( text.length( ) - 2 ); + } + + m_portRangeIgnoreChange = true; + m_portRangeLineEdit->setText( text ); + m_portRangeDeleteButton->setEnabled( true ); +} + +// slotPortRangeHighlighted +// ======================== + +void CommonWidget::slotPortRangeHighlighted( ) +{ if( m_portRangeIgnoreChange ) + m_portRangeIgnoreChange = false; + else + { m_portRangeAddButton->setEnabled( false ); + m_portRangeDeleteButton->setEnabled( false ); + m_portRangeLineEdit->clear( ); + } +} + +// slotPortRangesClicked +// ===================== + +void CommonWidget::slotPortRangesClicked( ) +{ enablePortRangeWidgets( ); +} + +// slotPortRangeTextChanged +// ======================== + +void CommonWidget::slotPortRangeTextChanged( const QString& /* text */) +{ if( m_portRangeIgnoreChange ) + m_portRangeIgnoreChange = false; + else + m_portRangeAddButton->setEnabled( m_portRangeLineEdit->text( ).length( )); +} + +// slotWhatsThisClicked +// ==================== + +void CommonWidget::slotWhatsThisClicked( ) +{ if( m_hostButton->hasMouse( )) emit( displayHelp( "target" )); + else if( m_hostComboBox->hasMouse( )) emit( displayHelp( "target" )); + else if( m_portRangeAddButton->hasMouse( )) emit( displayDocBook( "common_options" )); + else if( m_portRangeButton->hasMouse( )) emit( displayDocBook( "common_options" )); + else if( m_portRangeComboBox->hasMouse( )) emit( displayDocBook( "common_options" )); + else if( m_portRangeDeleteButton->hasMouse( )) emit( displayDocBook( "common_options" )); + else if( m_portRangeLineEdit->hasMouse( )) emit( displayDocBook( "common_options" )); + else if( m_portRangeListBox->hasMouse( )) emit( displayDocBook( "common_options" )); + else if( m_portRangesCheckBox->hasMouse( )) emit( displayHelp( "-p" )); + else if( m_resovleAlwaysRadio->hasMouse( )) emit( displayHelp( "-R" )); + else if( m_resovleDefaultRadio->hasMouse( )) emit( displayDocBook( "common_options" )); + else if( m_resovleNeverRadio->hasMouse( )) emit( displayHelp( "-n" )); + else emit( displayUnknown( )); +} + +// validatePortRange +// ================= + +bool CommonWidget::validatePortRange( QString& text ) +{ uint portFirst; + uint portLast; + + if( !validatePortRangeText( text, portFirst, portLast )) + return false; + + if( !portRangesOverlapping( portFirst, portLast )) + return false; + + return true; +} + +// validatePortRangeText +// ===================== + +bool CommonWidget::validatePortRangeText( QString& text, uint& portFirst, uint& portLast ) +{ text = m_portRangeLineEdit->text( ); + QStringList ports = QStringList::split( "-", text ); + + if( ports.count( ) > 2 ) + { KMessageBox::error( this, i18n( "Internal error - you seem to have been allowed to entered an illegal Port Range" ), i18n( "Internal error" )); + return false; + } + + portFirst = ports.front( ).toUInt( ); + portLast = portFirst; + + if( ports.count( ) > 1 ) + portLast = ports.back( ).toUInt( ); + + if( !portFirst || portFirst > 65535 || !portLast || portLast > 65535 || portFirst > portLast ) + { KMessageBox::sorry( this, + i18n( "Ports must be in the range 1 to 65,535 and ranges must be in ascending order" ), + i18n( "Invalid Port Range" )); + return false; + } + + return true; +} diff --git a/src/commonwidget.h b/src/commonwidget.h new file mode 100644 index 0000000..30e2a78 --- /dev/null +++ b/src/commonwidget.h @@ -0,0 +1,140 @@ +/*************************************************************************** + * * + * Copyright (C) 2005, 2006 by Kevin Gilbert * + * [email protected] * + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef _COMMONWIDGET_H_ +#define _COMMONWIDGET_H_ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <qwidget.h> +#include "global.h" + +// forward class definitions +// ========================= + +class KConfig; +class QCheckBox; +class QComboBox; +class QLineEdit; +class QListBox; +class QListBoxItem; +class QPushButton; +class QRadioButton; +class QStringList; + +// CommonWidget class definition +// ============================= + +class CommonWidget : public QWidget +{ Q_OBJECT + + public: + CommonWidget( QWidget* parent, const char* name = NULL ); + virtual ~CommonWidget( ); + + void finaliseInitialisation( ); + bool getOptions( ); + void readProfile( KConfig* config ); + void saveProfile( KConfig* config ); + void setInitialValues( ); + + QString getHostName( ) const; + int hostCurrentItem( ) const { return m_hostCurrentItem; } + QString host( ) const { return m_host; } + int portRangeCurrentItem( ) const { return m_portRangeCurrentItem; } + QStringList* portRanges( ) const { return m_portRanges; } + bool portRangesState( ) const { return m_portRangesState; } + bool resovleAlwaysState( ) const { return m_resovleAlwaysState; } + bool resovleDefaultState( ) const { return m_resovleDefaultState; } + bool resovleNeverState( ) const { return m_resovleNeverState; } + + signals: + void disableFastScan( ); + void displayDocBook( const QString& ); + void displayHelp( const QString& ); + void displayUnknown( ); + void optionsDirty( ); + void targetChanged( const QString& ); + + public slots: + void slotDisablePortRanges( ); + + private slots: + void slotHostActivated( int index ); + void slotHostButtonClicked( ); + void slotHostTextChanged( const QString& text ); + void slotPortRangeActivated( int index ); + void slotPortRangeAddClicked( ); + void slotPortRangeDeleteClicked( ); + void slotPortRangeButtonClicked( ); + void slotPortRangeDoubleClicked( QListBoxItem* item ); + void slotPortRangeHighlighted( ); + void slotPortRangesClicked( ); + void slotPortRangeTextChanged( const QString& text ); + void slotWhatsThisClicked( ); + + private: + bool buildPortRangesTables( const boolPtr tcpPorts, const boolPtr udpPorts ); + void createLayout( ); + void enablePortRangeWidgets( ); + void getHosts( QStringList* hosts ); + void getPortRanges( QStringList* portRanges ); + bool portRangesOverlapping( const ushort portFirst, const ushort portLast ); + bool validatePortRange( QString& text ); + bool validatePortRangeText( QString& text, uint& portFirst, uint& portLast ); + + // protocol indices + // ================ + + enum Protocol + { BothProtocol, + TCPProtocol, + UDPProtocol + }; + + QString m_host; + QPushButton* m_hostButton; + QComboBox* m_hostComboBox; + int m_hostCurrentItem; + QStringList* m_hosts; + QPushButton* m_portRangeAddButton; + QPushButton* m_portRangeButton; + QComboBox* m_portRangeComboBox; + int m_portRangeCurrentItem; + QPushButton* m_portRangeDeleteButton; + bool m_portRangeIgnoreChange; + QLineEdit* m_portRangeLineEdit; + QListBox* m_portRangeListBox; + QStringList* m_portRanges; + QCheckBox* m_portRangesCheckBox; + bool m_portRangesState; + QRadioButton* m_resovleAlwaysRadio; + bool m_resovleAlwaysState; + QRadioButton* m_resovleDefaultRadio; + bool m_resovleDefaultState; + QRadioButton* m_resovleNeverRadio; + bool m_resovleNeverState; +}; + +#endif // _COMMONWIDGET_H_ diff --git a/src/compoundwidget.cpp b/src/compoundwidget.cpp new file mode 100644 index 0000000..a0ee885 --- /dev/null +++ b/src/compoundwidget.cpp @@ -0,0 +1,682 @@ +/*************************************************************************** + * * + * Copyright (C) 2005, 2006 by Kevin Gilbert * + * [email protected] * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + ***************************************************************************/ + +#include <qcheckbox.h> +#include <qiconset.h> +#include <qlabel.h> +#include <qlayout.h> +#include <qlineedit.h> +#include <qpushbutton.h> +#include <qspinbox.h> + +#include <kconfig.h> +#include <kdebug.h> +#include <kglobal.h> +#include <kiconloader.h> +#include <klocale.h> +#include <kmessagebox.h> + +#include "compoundwidget.h" +#include "knmap.h" +#include "whatsthis.h" + +// constructor +// =========== + +CompoundWidget::CompoundWidget( QWidget* parent, const char* name ) +: QWidget( parent, name ) +{ createLayout( ); +} + +// createLayout +// ============ + +void CompoundWidget::createLayout( ) +{ QGridLayout* gridLayout = new QGridLayout( this ); + KIconLoader* iconLoader = KGlobal::iconLoader( ); + QIconSet clearLeftIconSet = iconLoader->loadIconSet( "clear_left", KIcon::Small ); + QIconSet fileOpenIconSet = iconLoader->loadIconSet( "fileopen", KIcon::Small ); + + m_decoyButton = new QPushButton( clearLeftIconSet, NULL, this, "target file button" ); + m_excludeButton = new QPushButton( clearLeftIconSet, NULL, this, "target file button" ); + m_interfaceButton = new QPushButton( clearLeftIconSet, NULL, this, "target file button" ); + m_sourceIPButton = new QPushButton( clearLeftIconSet, NULL, this, "target file button" ); + m_spoofMacButton = new QPushButton( clearLeftIconSet, NULL, this, "target file button" ); + + m_dataDirButton = new QPushButton( fileOpenIconSet, NULL, this, "datadir button" ); + m_excludeFileButton = new QPushButton( fileOpenIconSet, NULL, this, "exclude file button" ); + m_targetFileButton = new QPushButton( fileOpenIconSet, NULL, this, "target file button" ); + + m_dataDirCheckBox = new QCheckBox( i18n( "Data directory (--datadir <name>) " ), this, "datadir checkbox" ); + m_dataLengthCheckBox = new QCheckBox( i18n( "Data length (--data_length <value>" ), this, "data length checkbox" ); + m_debugLevelCheckBox = new QCheckBox( i18n( "Debug level (-d)" ), this, "debug checkbox" ); + m_decoyCheckBox = new QCheckBox( i18n( "Decoy hosts (-D <host list>)" ), this, "decoy checkbox" ); + m_excludeCheckBox = new QCheckBox( i18n( "Exclude hosts (--exclude <hosts>) " ), this, "exclude checkbox" ); + m_excludeFileCheckBox = new QCheckBox( i18n( "Exclude file (--excludefile <path>) " ), this, "exclude checkbox" ); + m_fragmentLevelCheckBox = new QCheckBox( i18n( "Fragment level (-f)" ), this, "fragment checkbox" ); + m_interfaceCheckBox = new QCheckBox( i18n( "Interface (-e)" ), this, "interface checkbox" ); + m_maxSocketsCheckBox = new QCheckBox( i18n( "Max sockets (-M <value>)" ), this, "max sockets checkbox" ); + m_randomIPCheckBox = new QCheckBox( i18n( "Random IP scan (-iR <value>)" ), this, "random ip checkbox" ); + m_sourceIPCheckBox = new QCheckBox( i18n( "Source IP addr (-S <value>)" ), this, "source ip checkbox" ); + m_sourcePortCheckBox = new QCheckBox( i18n( "Source port (-g <value>)" ), this, "source port checkbox" ); + m_spoofMacCheckBox = new QCheckBox( i18n( "Spoof MAC addr (--spoof_mac <value>)" ), this, "spoof mac checkbox" ); + m_targetFileCheckBox = new QCheckBox( i18n( "Target hosts file (-iL <path>) " ), this, "target checkbox" ); + m_ttlCheckBox = new QCheckBox( i18n( "TTL (--ttl <value>)" ), this, "ttl checkbox" ); + + m_dataDirLineEdit = new QLineEdit( this, "datadir line edit" ); + m_decoyLineEdit = new QLineEdit( this, "decoy edit" ); + m_excludeLineEdit = new QLineEdit( this, "exclude line edit" ); + m_excludeFileLineEdit = new QLineEdit( this, "exclude file line edit" ); + m_interfaceLineEdit = new QLineEdit( this, "interface edit" ); + m_sourceIPLineEdit = new QLineEdit( this, "source ip edit" ); + m_spoofMacLineEdit = new QLineEdit( this, "spoof mac edit" ); + m_targetFileLineEdit = new QLineEdit( this, "target file line edit" ); + + m_dataLengthSpinBox = new QSpinBox( 1, 1460, 128, this, "data length spin box" ); + m_debugLevelSpinBox = new QSpinBox( 1, 5, 1, this, "debug spin box" ); + m_fragmentLevelSpinBox = new QSpinBox( 1, 2, 1, this, "fragment spin box" ); + m_maxSocketsSpinBox = new QSpinBox( 1, 999, 10, this, "max sockets spin box" ); + m_randomIPSpinBox = new QSpinBox( 1, 999, 10, this, "random ip spin box" ); + m_sourcePortSpinBox = new QSpinBox( 1, 65535, 64, this, "source port spin box" ); + m_ttlSpinBox = new QSpinBox( 1, 255, 32, this, "ttl spin box" ); + + byte row = 1; + gridLayout->addWidget( new QLabel( " ", this ), row, 1 ); + gridLayout->addWidget( m_dataLengthCheckBox, row, 3 ); + gridLayout->addWidget( m_dataLengthSpinBox, row++, 4 ); + + gridLayout->addWidget( new QLabel( " ", this ), row, 1 ); + gridLayout->addWidget( m_debugLevelCheckBox, row, 3 ); + gridLayout->addWidget( m_debugLevelSpinBox, row++, 4 ); + + gridLayout->addWidget( new QLabel( "#", this ), row, 1 ); + gridLayout->addWidget( m_fragmentLevelCheckBox, row, 3 ); + gridLayout->addWidget( m_fragmentLevelSpinBox, row++, 4 ); + + gridLayout->addWidget( new QLabel( " ", this ), row, 1 ); + gridLayout->addWidget( m_maxSocketsCheckBox, row, 3 ); + gridLayout->addWidget( m_maxSocketsSpinBox, row++, 4 ); + + gridLayout->addWidget( new QLabel( " ", this ), row, 1 ); + gridLayout->addWidget( m_randomIPCheckBox, row, 3 ); + gridLayout->addWidget( m_randomIPSpinBox, row++, 4 ); + + gridLayout->addWidget( new QLabel( " ", this ), row, 1 ); + gridLayout->addWidget( m_sourcePortCheckBox, row, 3 ); + gridLayout->addWidget( m_sourcePortSpinBox, row++, 4 ); + + gridLayout->addWidget( new QLabel( " ", this ), row, 1 ); + gridLayout->addWidget( m_ttlCheckBox, row, 3 ); + gridLayout->addWidget( m_ttlSpinBox, row++, 4 ); + byte rowBlock1 = row; + + row = 1; + gridLayout->addWidget( new QLabel( "#", this ), row, 6 ); + gridLayout->addWidget( m_decoyCheckBox, row, 8 ); + gridLayout->addWidget( m_decoyLineEdit, row, 9 ); + gridLayout->addWidget( m_decoyButton, row++, 10 ); + + gridLayout->addWidget( new QLabel( " ", this ), row, 6 ); + gridLayout->addWidget( m_excludeCheckBox, row, 8 ); + gridLayout->addWidget( m_excludeLineEdit, row, 9 ); + gridLayout->addWidget( m_excludeButton, row++, 10 ); + + gridLayout->addWidget( new QLabel( " ", this ), row, 6 ); + gridLayout->addWidget( m_interfaceCheckBox, row, 8 ); + gridLayout->addWidget( m_interfaceLineEdit, row, 9 ); + gridLayout->addWidget( m_interfaceButton, row++, 10 ); + + gridLayout->addWidget( new QLabel( " ", this ), row, 6 ); + gridLayout->addWidget( m_sourceIPCheckBox, row, 8 ); + gridLayout->addWidget( m_sourceIPLineEdit, row, 9 ); + gridLayout->addWidget( m_sourceIPButton, row++, 10 ); + + gridLayout->addWidget( new QLabel( " ", this ), row, 6 ); + gridLayout->addWidget( m_spoofMacCheckBox, row, 8 ); + gridLayout->addWidget( m_spoofMacLineEdit, row, 9 ); + gridLayout->addWidget( m_spoofMacButton, row++, 10 ); + + row++; + gridLayout->addWidget( new QLabel( " ", this ), row, 6 ); + gridLayout->addWidget( m_excludeFileCheckBox, row, 8 ); + gridLayout->addWidget( m_excludeFileLineEdit, row, 9 ); + gridLayout->addWidget( m_excludeFileButton, row++, 10 ); + + gridLayout->addWidget( new QLabel( " ", this ), row, 6 ); + gridLayout->addWidget( m_dataDirCheckBox, row, 8 ); + gridLayout->addWidget( m_dataDirLineEdit, row, 9 ); + gridLayout->addWidget( m_dataDirButton, row++, 10 ); + + gridLayout->addWidget( new QLabel( " ", this ), row, 6 ); + gridLayout->addWidget( m_targetFileCheckBox, row, 8 ); + gridLayout->addWidget( m_targetFileLineEdit, row, 9 ); + gridLayout->addWidget( m_targetFileButton, row++, 10 ); + byte rowBlock2 = row; + + gridLayout->setColStretch( 0, 4 ); + gridLayout->setColStretch( 2, 1 ); + gridLayout->setColStretch( 4, 20 ); + gridLayout->setColStretch( 5, 4 ); + gridLayout->setColStretch( 7, 1 ); + gridLayout->setColStretch( 9, 20 ); + gridLayout->setColStretch( 11, 4 ); + + gridLayout->setRowStretch( 0, 1 ); + gridLayout->setRowStretch( _max_( rowBlock1, rowBlock2 ), 1 ); +} + +// finaliseInitialisation +// ====================== + +void CompoundWidget::finaliseInitialisation( ) +{ WhatsThis* whatsThis = new WhatsThis( this ); + + connect( m_dataDirButton, SIGNAL( clicked( )), SLOT( slotDataDirButtonClicked( ))); + connect( m_dataDirCheckBox, SIGNAL( clicked( )), SLOT( slotDataDirCheckBoxClicked( ))); + connect( m_dataLengthCheckBox, SIGNAL( clicked( )), SLOT( slotDataLengthCheckBoxClicked( ))); + connect( m_debugLevelCheckBox, SIGNAL( clicked( )), SLOT( slotDebugLevelCheckBoxClicked( ))); + connect( m_decoyButton, SIGNAL( clicked( )), SLOT( slotDecoyButtonClicked( ))); + connect( m_decoyCheckBox, SIGNAL( clicked( )), SLOT( slotDecoyCheckBoxClicked( ))); + connect( m_excludeButton, SIGNAL( clicked( )), SLOT( slotExcludeButtonClicked( ))); + connect( m_excludeCheckBox, SIGNAL( clicked( )), SLOT( slotExcludeCheckBoxClicked( ))); + connect( m_excludeFileButton, SIGNAL( clicked( )), SLOT( slotExcludeFileButtonClicked( ))); + connect( m_excludeFileCheckBox, SIGNAL( clicked( )), SLOT( slotExcludeFileCheckBoxClicked( ))); + connect( m_fragmentLevelCheckBox, SIGNAL( clicked( )), SLOT( slotFragmentLevelCheckBoxClicked( ))); + connect( m_interfaceButton, SIGNAL( clicked( )), SLOT( slotInterfaceButtonClicked( ))); + connect( m_interfaceCheckBox, SIGNAL( clicked( )), SLOT( slotInterfaceCheckBoxClicked( ))); + connect( m_maxSocketsCheckBox, SIGNAL( clicked( )), SLOT( slotMaxSocketsCheckBoxClicked( ))); + connect( m_randomIPCheckBox, SIGNAL( clicked( )), SLOT( slotRandomIPCheckBoxClicked( ))); + connect( m_sourceIPButton, SIGNAL( clicked( )), SLOT( slotSourceIPButtonClicked( ))); + connect( m_sourceIPCheckBox, SIGNAL( clicked( )), SLOT( slotSourceIPCheckBoxClicked( ))); + connect( m_sourcePortCheckBox, SIGNAL( clicked( )), SLOT( slotSourcePortCheckBoxClicked( ))); + connect( m_spoofMacButton, SIGNAL( clicked( )), SLOT( slotSpoofMACButtonClicked( ))); + connect( m_spoofMacCheckBox, SIGNAL( clicked( )), SLOT( slotSpoofMacCheckBoxClicked( ))); + connect( m_targetFileButton, SIGNAL( clicked( )), SLOT( slotTargetFileButtonClicked( ))); + connect( m_targetFileCheckBox, SIGNAL( clicked( )), SLOT( slotTargetFileCheckBoxClicked( ))); + connect( m_ttlCheckBox, SIGNAL( clicked( )), SLOT( slotTTLCheckBoxClicked( ))); + connect( whatsThis, SIGNAL( clicked( )), SLOT( slotWhatsThisClicked( ))); + + connect( m_dataDirCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_dataDirLineEdit, SIGNAL( textChanged( const QString& )), SIGNAL( optionsDirty( ))); + connect( m_dataLengthCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_dataLengthSpinBox, SIGNAL( valueChanged( int )), SIGNAL( optionsDirty( ))); + connect( m_debugLevelCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_debugLevelSpinBox, SIGNAL( valueChanged( int )), SIGNAL( optionsDirty( ))); + connect( m_decoyCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_decoyLineEdit, SIGNAL( textChanged( const QString& )), SIGNAL( optionsDirty( ))); + connect( m_excludeCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_excludeLineEdit, SIGNAL( textChanged( const QString& )), SIGNAL( optionsDirty( ))); + connect( m_excludeFileCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_excludeFileLineEdit, SIGNAL( textChanged( const QString& )), SIGNAL( optionsDirty( ))); + connect( m_fragmentLevelCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_fragmentLevelSpinBox, SIGNAL( valueChanged( int )), SIGNAL( optionsDirty( ))); + connect( m_interfaceCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_interfaceLineEdit, SIGNAL( textChanged( const QString& )), SIGNAL( optionsDirty( ))); + connect( m_maxSocketsCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_maxSocketsSpinBox, SIGNAL( valueChanged( int )), SIGNAL( optionsDirty( ))); + connect( m_randomIPCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_randomIPSpinBox, SIGNAL( valueChanged( int )), SIGNAL( optionsDirty( ))); + connect( m_sourceIPCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_sourceIPLineEdit, SIGNAL( textChanged( const QString& )), SIGNAL( optionsDirty( ))); + connect( m_sourcePortCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_sourcePortSpinBox, SIGNAL( valueChanged( int )), SIGNAL( optionsDirty( ))); + connect( m_spoofMacCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_spoofMacLineEdit, SIGNAL( textChanged( const QString& )), SIGNAL( optionsDirty( ))); + connect( m_targetFileCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_targetFileLineEdit, SIGNAL( textChanged( const QString& )), SIGNAL( optionsDirty( ))); + connect( m_ttlCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_ttlSpinBox, SIGNAL( valueChanged( int )), SIGNAL( optionsDirty( ))); +} + +// getOptions +// ========== + +bool CompoundWidget::getOptions( bool& needRoot ) +{ bool dataDirState = m_dataDirCheckBox->isChecked( ); + QString dataDirValue = m_dataDirLineEdit->text( ); + bool decoyState = m_decoyCheckBox->isChecked( ); + QString decoyValue = m_decoyLineEdit->text( ); + bool excludeState = m_excludeCheckBox->isChecked( ); + QString excludeValue = m_excludeLineEdit->text( ); + bool excludeFileState = m_excludeFileCheckBox->isChecked( ); + QString excludeFileValue = m_excludeFileLineEdit->text( ); + bool interfaceState = m_interfaceCheckBox->isChecked( ); + QString interfaceValue = m_interfaceLineEdit->text( ); + bool sourceIPState = m_sourceIPCheckBox->isChecked( ); + QString sourceIPValue = m_sourceIPLineEdit->text( ); + bool spoofMacState = m_spoofMacCheckBox->isChecked( ); + QString spoofMacValue = m_spoofMacLineEdit->text( ); + bool targetFileState = m_targetFileCheckBox->isChecked( ); + QString targetFileValue = m_targetFileLineEdit->text( ); + + if( dataDirState && dataDirValue.isEmpty( )) + { KMessageBox::error( this, i18n( QString( "Data directory name not specified" )), i18n( "Data directory name error" )); + return false; + } + + if( decoyState && decoyValue.isEmpty( )) + { KMessageBox::error( this, i18n( QString( "Decoy host list not specified" )), i18n( "Decoy hosts error" )); + return false; + } + + if( excludeState && excludeValue.isEmpty( )) + { KMessageBox::error( this, i18n( QString( "Exclude hosts not specified" )), i18n( "Exclude hosts error" )); + return false; + } + + if( excludeFileState && excludeFileValue.isEmpty( )) + { KMessageBox::error( this, i18n( QString( "Exclude hosts file name not specified" )), i18n( "Exclude hosts file name error" )); + return false; + } + + if( interfaceState && interfaceValue.isEmpty( )) + { KMessageBox::error( this, i18n( QString( "Interface name not specified" )), i18n( "Interface name error" )); + return false; + } + + if( sourceIPState && sourceIPValue.isEmpty( )) + { KMessageBox::error( this, i18n( QString( "Source IP address not specified" )), i18n( "Source IP address error" )); + return false; + } + + if( spoofMacState && spoofMacValue.isEmpty( )) + { KMessageBox::error( this, i18n( QString( "Spoof MAC address not specified" )), i18n( "Spoof MAC address error" )); + return false; + } + + if( targetFileState && targetFileValue.isEmpty( )) + { KMessageBox::error( this, i18n( QString( "Target hosts file name not specified" )), i18n( "Target hosts file name error" )); + return false; + } + + m_dataDirState = dataDirState; + m_dataDirValue = dataDirValue; + m_dataLengthState = m_dataLengthCheckBox->isChecked( ); + m_dataLengthValue = m_dataLengthSpinBox->value( ); + m_debugLevelState = m_debugLevelCheckBox->isChecked( ); + m_debugLevelValue = m_debugLevelSpinBox->value( ); + m_decoyState = decoyState; + m_decoyValue = decoyValue; + m_excludeState = excludeState; + m_excludeValue = excludeValue; + m_excludeFileState = excludeFileState; + m_excludeFileValue = excludeFileValue; + m_fragmentLevelState = m_fragmentLevelCheckBox->isChecked( ); + m_fragmentLevelValue = m_fragmentLevelSpinBox->value( ); + m_interfaceState = interfaceState; + m_interfaceValue = interfaceValue; + m_maxSocketsState = m_maxSocketsCheckBox->isChecked( ); + m_maxSocketsValue = m_maxSocketsSpinBox->value( ); + m_randomIPState = m_randomIPCheckBox->isChecked( ); + m_randomIPValue = m_randomIPSpinBox->value( ); + m_sourceIPState = sourceIPState; + m_sourceIPValue = sourceIPValue; + m_sourcePortState = m_sourcePortCheckBox->isChecked( ); + m_sourcePortValue = m_sourcePortSpinBox->value( ); + m_spoofMacState = spoofMacState; + m_spoofMacValue = spoofMacValue; + m_targetFileState = targetFileState; + m_targetFileValue = targetFileValue; + m_ttlState = m_ttlCheckBox->isChecked( ); + m_ttlValue = m_ttlSpinBox->value( ); + + needRoot = needRoot || m_decoyState || m_fragmentLevelState; + return true; +} + +// readProfile +// =========== + +void CompoundWidget::readProfile( KConfig* config ) +{ m_dataDirState = config->readBoolEntry( "dataDirState" ); + m_dataDirValue = config->readEntry( "dataDirValue" ); + m_dataLengthState = config->readBoolEntry( "dataLengthState" ); + m_dataLengthValue = config->readNumEntry( "dataLengthValue", 40 ); + m_debugLevelState = config->readBoolEntry( "debugLevelState" ); + m_debugLevelValue = config->readNumEntry( "debugLevelValue" ); + m_decoyState = config->readBoolEntry( "decoyState" ); + m_decoyValue = config->readEntry( "decoyValue" ); + m_excludeState = config->readBoolEntry( "excludeState" ); + m_excludeValue = config->readEntry( "excludeValue" ); + m_excludeFileState = config->readBoolEntry( "excludeFileState" ); + m_excludeFileValue = config->readEntry( "excludeFileValue" ); + m_fragmentLevelState = config->readBoolEntry( "fragmentLevelState" ); + m_fragmentLevelValue = config->readNumEntry( "fragmentLevelValue" ); + m_interfaceState = config->readBoolEntry( "interfaceState" ); + m_interfaceValue = config->readEntry( "interfaceValue" ); + m_maxSocketsState = config->readBoolEntry( "maxSocketsState" ); + m_maxSocketsValue = config->readNumEntry( "maxSocketsValue" ); + m_randomIPState = config->readBoolEntry( "randomIPState" ); + m_randomIPValue = config->readNumEntry( "randomIPValue" ); + m_sourceIPState = config->readBoolEntry( "sourceIPState" ); + m_sourceIPValue = config->readEntry( "sourceIPValue" ); + m_sourcePortState = config->readBoolEntry( "sourcePortState" ); + m_sourcePortValue = config->readNumEntry( "sourcePortValue" ); + m_spoofMacState = config->readBoolEntry( "spoofMacState" ); + m_spoofMacValue = config->readEntry( "spoofMacValue" ); + m_targetFileState = config->readBoolEntry( "targetFileState" ); + m_targetFileValue = config->readEntry( "targetFileValue" ); + m_ttlState = config->readBoolEntry( "ttlState" ); + m_ttlValue = config->readNumEntry( "ttlValue" ); +} + +// saveProfile +// =========== + +void CompoundWidget::saveProfile( KConfig* config ) +{ config->writeEntry( "dataDirState", m_dataDirState ); + config->writeEntry( "dataDirValue", m_dataDirValue ); + config->writeEntry( "dataLengthState", m_dataLengthState ); + config->writeEntry( "dataLengthValue", m_dataLengthValue ); + config->writeEntry( "debugLevelState", m_debugLevelState ); + config->writeEntry( "debugLevelValue", m_debugLevelValue ); + config->writeEntry( "decoyState", m_decoyState ); + config->writeEntry( "decoyValue", m_decoyValue ); + config->writeEntry( "excludeState", m_excludeState ); + config->writeEntry( "excludeValue", m_excludeValue ); + config->writeEntry( "excludeFileState", m_excludeFileState ); + config->writeEntry( "excludeFileValue", m_excludeFileValue ); + config->writeEntry( "fragmentLevelState", m_fragmentLevelState ); + config->writeEntry( "fragmentLevelValue", m_fragmentLevelValue ); + config->writeEntry( "interfaceState", m_interfaceState ); + config->writeEntry( "interfaceValue", m_interfaceValue ); + config->writeEntry( "maxSocketsState", m_maxSocketsState ); + config->writeEntry( "maxSocketsValue", m_maxSocketsValue ); + config->writeEntry( "randomIPState", m_randomIPState ); + config->writeEntry( "randomIPValue", m_randomIPValue ); + config->writeEntry( "sourceIPState", m_sourceIPState ); + config->writeEntry( "sourceIPValue", m_sourceIPValue ); + config->writeEntry( "sourcePortState", m_sourcePortState ); + config->writeEntry( "sourcePortValue", m_sourcePortValue ); + config->writeEntry( "spoofMacState", m_spoofMacState ); + config->writeEntry( "spoofMacValue", m_spoofMacValue ); + config->writeEntry( "targetFileState", m_targetFileState ); + config->writeEntry( "targetFileValue", m_targetFileValue ); + config->writeEntry( "ttlState", m_ttlState ); + config->writeEntry( "ttlValue", m_ttlValue ); +} + +// setInitialValues +// ================ + +void CompoundWidget::setInitialValues( ) +{ m_dataDirCheckBox->setChecked( m_dataDirState ); + m_dataDirLineEdit->setText( m_dataDirValue ); + m_dataLengthCheckBox->setChecked( m_dataLengthState ); + m_dataLengthSpinBox->setValue( m_dataLengthValue ); + m_debugLevelCheckBox->setChecked( m_debugLevelState ); + m_debugLevelSpinBox->setValue( m_debugLevelValue ); + m_decoyCheckBox->setChecked( m_decoyState ); + m_decoyLineEdit->setText( m_decoyValue ); + m_excludeCheckBox->setChecked( m_excludeState ); + m_excludeLineEdit->setText( m_excludeValue ); + m_excludeFileCheckBox->setChecked( m_excludeFileState ); + m_excludeFileLineEdit->setText( m_excludeFileValue ); + m_fragmentLevelCheckBox->setChecked( m_fragmentLevelState ); + m_fragmentLevelSpinBox->setValue( m_fragmentLevelValue ); + m_interfaceCheckBox->setChecked( m_interfaceState ); + m_interfaceLineEdit->setText( m_interfaceValue ); + m_maxSocketsCheckBox->setChecked( m_maxSocketsState ); + m_maxSocketsSpinBox->setValue( m_maxSocketsValue ); + m_randomIPCheckBox->setChecked( m_randomIPState ); + m_randomIPSpinBox->setValue( m_randomIPValue ); + m_sourceIPCheckBox->setChecked( m_sourceIPState ); + m_sourceIPLineEdit->setText( m_sourceIPValue ); + m_sourcePortCheckBox->setChecked( m_sourcePortState ); + m_sourcePortSpinBox->setValue( m_sourcePortValue ); + m_spoofMacCheckBox->setChecked( m_spoofMacState ); + m_spoofMacLineEdit->setText( m_spoofMacValue ); + m_targetFileCheckBox->setChecked( m_targetFileState ); + m_targetFileLineEdit->setText( m_targetFileValue ); + m_ttlCheckBox->setChecked( m_ttlState ); + m_ttlSpinBox->setValue( m_ttlValue ); + + slotDataDirCheckBoxClicked( ); + slotDataLengthCheckBoxClicked( ); + slotDebugLevelCheckBoxClicked( ); + slotDecoyCheckBoxClicked( ); + slotExcludeCheckBoxClicked( ); + slotExcludeFileCheckBoxClicked( ); + slotFragmentLevelCheckBoxClicked( ); + slotInterfaceCheckBoxClicked( ); + slotMaxSocketsCheckBoxClicked( ); + slotRandomIPCheckBoxClicked( ); + slotSourceIPCheckBoxClicked( ); + slotSourcePortCheckBoxClicked( ); + slotSpoofMacCheckBoxClicked( ); + slotTargetFileCheckBoxClicked( ); + slotTTLCheckBoxClicked( ); +} + +// slotDataDirButtonClicked +// ======================== + +void CompoundWidget::slotDataDirButtonClicked( ) +{ Knmap::getDirPath( "Data directory", m_dataDirValue, m_dataDirLineEdit ); +} + +// slotDataDirCheckBoxClicked +// ========================== + +void CompoundWidget::slotDataDirCheckBoxClicked( ) +{ m_dataDirButton->setEnabled( m_dataDirCheckBox->isChecked( )); + m_dataDirLineEdit->setEnabled( m_dataDirCheckBox->isChecked( )); +} + +// slotDataLengthCheckBoxClicked +// ============================= + +void CompoundWidget::slotDataLengthCheckBoxClicked( ) +{ m_dataLengthSpinBox->setEnabled( m_dataLengthCheckBox->isChecked( )); +} + +// slotDebugLevelCheckBoxClicked +// ============================= + +void CompoundWidget::slotDebugLevelCheckBoxClicked( ) +{ m_debugLevelSpinBox->setEnabled( m_debugLevelCheckBox->isChecked( )); +} + +// slotDecoyButtonClicked +// ====================== + +void CompoundWidget::slotDecoyButtonClicked( ) +{ m_decoyLineEdit->clear( ); +} + +// slotDecoyCheckBoxClicked +// ======================== + +void CompoundWidget::slotDecoyCheckBoxClicked( ) +{ m_decoyButton->setEnabled( m_decoyCheckBox->isChecked( )); + m_decoyLineEdit->setEnabled( m_decoyCheckBox->isChecked( )); +} + +// slotExcludeButtonClicked +// ======================== + +void CompoundWidget::slotExcludeButtonClicked( ) +{ m_excludeLineEdit->clear( ); +} + +// slotExcludeCheckBoxClicked +// ========================== + +void CompoundWidget::slotExcludeCheckBoxClicked( ) +{ m_excludeButton->setEnabled( m_excludeCheckBox->isChecked( )); + m_excludeLineEdit->setEnabled( m_excludeCheckBox->isChecked( )); +} + +// slotExcludeFileButtonClicked +// ============================ + +void CompoundWidget::slotExcludeFileButtonClicked( ) +{ Knmap::getFilePath( "Exclude hosts file", m_excludeFileValue, m_excludeFileLineEdit, false ); +} + +// slotExcludeFileCheckBoxClicked +// ============================== + +void CompoundWidget::slotExcludeFileCheckBoxClicked( ) +{ m_excludeFileButton->setEnabled( m_excludeFileCheckBox->isChecked( )); + m_excludeFileLineEdit->setEnabled( m_excludeFileCheckBox->isChecked( )); +} + +// slotFragmentLevelCheckBoxClicked +// ================================ + +void CompoundWidget::slotFragmentLevelCheckBoxClicked( ) +{ m_fragmentLevelSpinBox->setEnabled( m_fragmentLevelCheckBox->isChecked( )); +} + +// slotInterfaceButtonClicked +// ========================== + +void CompoundWidget::slotInterfaceButtonClicked( ) +{ m_interfaceLineEdit->clear( ); +} + +// slotInterfaceCheckBoxClicked +// ============================ + +void CompoundWidget::slotInterfaceCheckBoxClicked( ) +{ m_interfaceButton->setEnabled( m_interfaceCheckBox->isChecked( )); + m_interfaceLineEdit->setEnabled( m_interfaceCheckBox->isChecked( )); +} + +// slotMaxSocketsCheckBoxClicked +// ============================= + +void CompoundWidget::slotMaxSocketsCheckBoxClicked( ) +{ m_maxSocketsSpinBox->setEnabled( m_maxSocketsCheckBox->isChecked( )); +} + +// slotRandomIPCheckBoxClicked +// =========================== + +void CompoundWidget::slotRandomIPCheckBoxClicked( ) +{ m_randomIPSpinBox->setEnabled( m_randomIPCheckBox->isChecked( )); +} + +// slotSourceIPButtonClicked +// ========================= + +void CompoundWidget::slotSourceIPButtonClicked( ) +{ m_sourceIPLineEdit->clear( ); +} + +// slotSourceIPCheckBoxClicked +// =========================== + +void CompoundWidget::slotSourceIPCheckBoxClicked( ) +{ m_sourceIPButton->setEnabled( m_sourceIPCheckBox->isChecked( )); + m_sourceIPLineEdit->setEnabled( m_sourceIPCheckBox->isChecked( )); +} + +// slotSourcePortCheckBoxClicked +// ============================= + +void CompoundWidget::slotSourcePortCheckBoxClicked( ) +{ m_sourcePortSpinBox->setEnabled( m_sourcePortCheckBox->isChecked( )); +} + +// slotSpoofMACButtonClicked +// ========================= + +void CompoundWidget::slotSpoofMACButtonClicked( ) +{ m_spoofMacLineEdit->clear( ); +} + +// slotSpoofMacCheckBoxClicked +// =========================== + +void CompoundWidget::slotSpoofMacCheckBoxClicked( ) +{ m_spoofMacButton->setEnabled( m_spoofMacCheckBox->isChecked( )); + m_spoofMacLineEdit->setEnabled( m_spoofMacCheckBox->isChecked( )); +} + +// slotTargetFileButtonClicked +// =========================== + +void CompoundWidget::slotTargetFileButtonClicked( ) +{ Knmap::getFilePath( "Target hosts file", m_targetFileValue, m_targetFileLineEdit, false ); +} + +// slotTargetFileCheckBoxClicked +// ============================= + +void CompoundWidget::slotTargetFileCheckBoxClicked( ) +{ m_targetFileButton->setEnabled( m_targetFileCheckBox->isChecked( )); + m_targetFileLineEdit->setEnabled( m_targetFileCheckBox->isChecked( )); +} + +// slotTTLCheckBoxClicked +// ====================== + +void CompoundWidget::slotTTLCheckBoxClicked( ) +{ m_ttlSpinBox->setEnabled( m_ttlCheckBox->isChecked( )); +} + +// slotWhatsThisClicked +// ==================== + +void CompoundWidget::slotWhatsThisClicked( ) +{ if( m_dataDirButton->hasMouse( )) emit( displayHelp( "--datadir" )); + else if( m_dataDirCheckBox->hasMouse( )) emit( displayHelp( "--datadir" )); + else if( m_dataDirLineEdit->hasMouse( )) emit( displayHelp( "--datadir" )); + else if( m_dataLengthCheckBox->hasMouse( )) emit( displayHelp( "--data_length" )); + else if( m_dataLengthSpinBox->hasMouse( )) emit( displayHelp( "--data_length" )); + else if( m_decoyButton->hasMouse( )) emit( displayHelp( "-D" )); + else if( m_decoyCheckBox->hasMouse( )) emit( displayHelp( "-D" )); + else if( m_decoyLineEdit->hasMouse( )) emit( displayHelp( "-D" )); + else if( m_debugLevelCheckBox->hasMouse( )) emit( displayHelp( "-d" )); + else if( m_debugLevelSpinBox->hasMouse( )) emit( displayHelp( "-d" )); + else if( m_excludeButton->hasMouse( )) emit( displayHelp( "--exclude" )); + else if( m_excludeCheckBox->hasMouse( )) emit( displayHelp( "--exclude" )); + else if( m_excludeLineEdit->hasMouse( )) emit( displayHelp( "--exclude" )); + else if( m_excludeFileButton->hasMouse( )) emit( displayHelp( "--exclude" )); + else if( m_excludeFileCheckBox->hasMouse( )) emit( displayHelp( "--exclude" )); + else if( m_excludeFileLineEdit->hasMouse( )) emit( displayHelp( "--exclude" )); + else if( m_fragmentLevelCheckBox->hasMouse( )) emit( displayHelp( "-f" )); + else if( m_fragmentLevelSpinBox->hasMouse( )) emit( displayHelp( "-f" )); + else if( m_interfaceButton->hasMouse( )) emit( displayHelp( "-e" )); + else if( m_interfaceCheckBox->hasMouse( )) emit( displayHelp( "-e" )); + else if( m_interfaceLineEdit->hasMouse( )) emit( displayHelp( "-e" )); + else if( m_maxSocketsCheckBox->hasMouse( )) emit( displayHelp( "-M" )); + else if( m_maxSocketsSpinBox->hasMouse( )) emit( displayHelp( "-M" )); + else if( m_randomIPCheckBox->hasMouse( )) emit( displayHelp( "-iR" )); + else if( m_randomIPSpinBox->hasMouse( )) emit( displayHelp( "-iR" )); + else if( m_sourceIPButton->hasMouse( )) emit( displayHelp( "-S" )); + else if( m_sourceIPCheckBox->hasMouse( )) emit( displayHelp( "-S" )); + else if( m_sourceIPLineEdit->hasMouse( )) emit( displayHelp( "-S" )); + else if( m_sourcePortCheckBox->hasMouse( )) emit( displayHelp( "--source_port" )); + else if( m_sourcePortSpinBox->hasMouse( )) emit( displayHelp( "--source_port" )); + else if( m_spoofMacButton->hasMouse( )) emit( displayHelp( "--spoof_mac" )); + else if( m_spoofMacCheckBox->hasMouse( )) emit( displayHelp( "--spoof_mac" )); + else if( m_spoofMacLineEdit->hasMouse( )) emit( displayHelp( "--spoof_mac" )); + else if( m_targetFileButton->hasMouse( )) emit( displayHelp( "-iL" )); + else if( m_targetFileCheckBox->hasMouse( )) emit( displayHelp( "-iL" )); + else if( m_targetFileLineEdit->hasMouse( )) emit( displayHelp( "-iL" )); + else if( m_ttlCheckBox->hasMouse( )) emit( displayHelp( "--ttl" )); + else if( m_ttlSpinBox->hasMouse( )) emit( displayHelp( "--ttl" )); + else emit( displayUnknown( )); +} diff --git a/src/compoundwidget.h b/src/compoundwidget.h new file mode 100644 index 0000000..0522c74 --- /dev/null +++ b/src/compoundwidget.h @@ -0,0 +1,192 @@ +/*************************************************************************** + * * + * Copyright (C) 2005, 2006 by Kevin Gilbert * + * [email protected] * + * * + * 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. * + * * + ***************************************************************************/ +#ifndef _COMPOUNDWIDGET_H_ +#define _COMPOUNDWIDGET_H_ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <qwidget.h> +#include "global.h" + +// forward class definitions +// ========================= + +class KConfig; +class QCheckBox; +class QLineEdit; +class QPushButton; +class QSpinBox; + +// CompountWidget class definition +// =============================== + +class CompoundWidget : public QWidget +{ Q_OBJECT + + public: + CompoundWidget( QWidget* parent, const char* name = NULL ); + + void finaliseInitialisation( ); + bool getOptions( bool& needRoot ); + void readProfile( KConfig* config ); + void saveProfile( KConfig* config ); + void setInitialValues( ); + + bool dataDirState( ) const { return m_dataDirState; } + QString dataDirValue( ) const { return m_dataDirValue; } + bool dataLengthState( ) const { return m_dataLengthState; } + int dataLengthValue( ) const { return m_dataLengthValue; } + bool decoyState( ) const { return m_decoyState; } + QString decoyValue( ) const { return m_decoyValue; } + bool debugLevelState( ) const { return m_debugLevelState; } + int debugLevelValue( ) const { return m_debugLevelValue; } + bool excludeState( ) const { return m_excludeState; } + QString excludeValue( ) const { return m_excludeValue; } + bool excludeFileState( ) const { return m_excludeFileState; } + QString excludeFileValue( ) const { return m_excludeFileValue; } + bool fragmentLevelState( ) const { return m_fragmentLevelState; } + int fragmentLevelValue( ) const { return m_fragmentLevelValue; } + bool interfaceState( ) const { return m_interfaceState; } + QString interfaceValue( ) const { return m_interfaceValue; } + bool maxSocketsState( ) const { return m_maxSocketsState; } + int maxSocketsValue( ) const { return m_maxSocketsValue; } + bool randomIPState( ) const { return m_randomIPState; } + int randomIPValue( ) const { return m_randomIPValue; } + bool sourceIPState( ) const { return m_sourceIPState; } + QString sourceIPValue( ) const { return m_sourceIPValue; } + bool sourcePortState( ) const { return m_sourcePortState; } + int sourcePortValue( ) const { return m_sourcePortValue; } + bool spoofMacState( ) const { return m_spoofMacState; } + QString spoofMacValue( ) const { return m_spoofMacValue; } + bool targetFileState( ) const { return m_targetFileState; } + QString targetFileValue( ) const { return m_targetFileValue; } + bool ttlState( ) const { return m_ttlState; } + int ttlValue( ) const { return m_ttlValue; } + + signals: + void displayDocBook( const QString& ); + void displayHelp( const QString& ); + void displayUnknown( ); + void optionsDirty( ); + + private slots: + void slotDataDirButtonClicked( ); + void slotDataDirCheckBoxClicked( ); + void slotDataLengthCheckBoxClicked( ); + void slotDebugLevelCheckBoxClicked( ); + void slotDecoyButtonClicked( ); + void slotDecoyCheckBoxClicked( ); + void slotExcludeButtonClicked( ); + void slotExcludeCheckBoxClicked( ); + void slotExcludeFileButtonClicked( ); + void slotExcludeFileCheckBoxClicked( ); + void slotFragmentLevelCheckBoxClicked( ); + void slotInterfaceButtonClicked( ); + void slotInterfaceCheckBoxClicked( ); + void slotMaxSocketsCheckBoxClicked( ); + void slotRandomIPCheckBoxClicked( ); + void slotSourceIPButtonClicked( ); + void slotSourceIPCheckBoxClicked( ); + void slotSourcePortCheckBoxClicked( ); + void slotSpoofMACButtonClicked( ); + void slotSpoofMacCheckBoxClicked( ); + void slotTargetFileButtonClicked( ); + void slotTargetFileCheckBoxClicked( ); + void slotTTLCheckBoxClicked( ); + void slotWhatsThisClicked( ); + + private: + void createLayout( ); + + QPushButton* m_dataDirButton; + QCheckBox* m_dataDirCheckBox; + QLineEdit* m_dataDirLineEdit; + bool m_dataDirState; + QString m_dataDirValue; + QCheckBox* m_dataLengthCheckBox; + QSpinBox* m_dataLengthSpinBox; + bool m_dataLengthState; + int m_dataLengthValue; + QPushButton* m_decoyButton; + QCheckBox* m_decoyCheckBox; + QLineEdit* m_decoyLineEdit; + bool m_decoyState; + QString m_decoyValue; + QCheckBox* m_debugLevelCheckBox; + QSpinBox* m_debugLevelSpinBox; + bool m_debugLevelState; + int m_debugLevelValue; + QPushButton* m_excludeButton; + QCheckBox* m_excludeCheckBox; + QLineEdit* m_excludeLineEdit; + bool m_excludeState; + QString m_excludeValue; + QPushButton* m_excludeFileButton; + QCheckBox* m_excludeFileCheckBox; + QLineEdit* m_excludeFileLineEdit; + bool m_excludeFileState; + QString m_excludeFileValue; + QCheckBox* m_fragmentLevelCheckBox; + QSpinBox* m_fragmentLevelSpinBox; + bool m_fragmentLevelState; + int m_fragmentLevelValue; + QPushButton* m_interfaceButton; + QCheckBox* m_interfaceCheckBox; + QLineEdit* m_interfaceLineEdit; + bool m_interfaceState; + QString m_interfaceValue; + QCheckBox* m_maxSocketsCheckBox; + QSpinBox* m_maxSocketsSpinBox; + bool m_maxSocketsState; + int m_maxSocketsValue; + QCheckBox* m_randomIPCheckBox; + QSpinBox* m_randomIPSpinBox; + bool m_randomIPState; + int m_randomIPValue; + QPushButton* m_sourceIPButton; + QCheckBox* m_sourceIPCheckBox; + QLineEdit* m_sourceIPLineEdit; + bool m_sourceIPState; + QString m_sourceIPValue; + QCheckBox* m_sourcePortCheckBox; + QSpinBox* m_sourcePortSpinBox; + bool m_sourcePortState; + int m_sourcePortValue; + QPushButton* m_spoofMacButton; + QCheckBox* m_spoofMacCheckBox; + QLineEdit* m_spoofMacLineEdit; + bool m_spoofMacState; + QString m_spoofMacValue; + QPushButton* m_targetFileButton; + QCheckBox* m_targetFileCheckBox; + QLineEdit* m_targetFileLineEdit; + bool m_targetFileState; + QString m_targetFileValue; + QCheckBox* m_ttlCheckBox; + QSpinBox* m_ttlSpinBox; + bool m_ttlState; + int m_ttlValue; +}; + +#endif // _COMPOUNDWIDGET_H_ diff --git a/src/global.h b/src/global.h new file mode 100644 index 0000000..df039df --- /dev/null +++ b/src/global.h @@ -0,0 +1,60 @@ +/*************************************************************************** + * * + * Copyright (C) 2005, 2006 by Kevin Gilbert * + * [email protected] * + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef _GLOBAL_H_ +#define _GLOBAL_H_ + +// forward class definitions +// ========================= + +class NmapOutputBuffer; +class ScanMonitorEvent; + +// typedef's +// ========= + +typedef bool* boolPtr; +typedef unsigned char byte; +typedef NmapOutputBuffer* nobPtr; +typedef ScanMonitorEvent* smePtr; +typedef char* string; +typedef unsigned short ushort; +typedef unsigned int uint; + +// macros +// ====== + +#define _max_( a, b ) (a > b ? a : b) +#define _min_( a, b ) (a < b ? a : b) + +// general shit +// ============ + +const char DEFAULT_PROFILE[] = "Knmap_Default"; // bloody obvious +const char DEFAULT_SCAN_NAME[] = "Target host"; // used to auto-name scan widgets +const char DOCBOOK[] = "docbook"; // used to determine if documentation exists in the nmap html widget +const byte MAX_HOST_HISTORY = 10; // the maximum number of hosts that we will remember +const char PROFILE_PREFIX[] = "Knmap_"; // wot's in the from of all our profile names +const uint ZOOM_MAX_FACTOR = 300; // for the HTML page +const uint ZOOM_MIN_FACTOR = 20; // for the HTML page + +#endif // _GLOBAL_H_ diff --git a/src/hi16-app-knmap.png b/src/hi16-app-knmap.png Binary files differnew file mode 100644 index 0000000..aa02743 --- /dev/null +++ b/src/hi16-app-knmap.png diff --git a/src/hi16-app-knmapman.png b/src/hi16-app-knmapman.png Binary files differnew file mode 100644 index 0000000..8f837f5 --- /dev/null +++ b/src/hi16-app-knmapman.png diff --git a/src/hi16-app-localman.png b/src/hi16-app-localman.png Binary files differnew file mode 100644 index 0000000..dc630e5 --- /dev/null +++ b/src/hi16-app-localman.png diff --git a/src/hi16-app-manpage.png b/src/hi16-app-manpage.png Binary files differnew file mode 100644 index 0000000..ffae697 --- /dev/null +++ b/src/hi16-app-manpage.png diff --git a/src/hi16-app-manstylesheet.png b/src/hi16-app-manstylesheet.png Binary files differnew file mode 100644 index 0000000..1033ef6 --- /dev/null +++ b/src/hi16-app-manstylesheet.png diff --git a/src/hi16-app-profilecopy.png b/src/hi16-app-profilecopy.png Binary files differnew file mode 100644 index 0000000..df277b8 --- /dev/null +++ b/src/hi16-app-profilecopy.png diff --git a/src/hi16-app-profiledelete.png b/src/hi16-app-profiledelete.png Binary files differnew file mode 100644 index 0000000..d4edad5 --- /dev/null +++ b/src/hi16-app-profiledelete.png diff --git a/src/hi16-app-profileload.png b/src/hi16-app-profileload.png Binary files differnew file mode 100644 index 0000000..95b4d72 --- /dev/null +++ b/src/hi16-app-profileload.png diff --git a/src/hi16-app-profilerename.png b/src/hi16-app-profilerename.png Binary files differnew file mode 100644 index 0000000..1230120 --- /dev/null +++ b/src/hi16-app-profilerename.png diff --git a/src/hi16-app-profilesave.png b/src/hi16-app-profilesave.png Binary files differnew file mode 100644 index 0000000..ab04a11 --- /dev/null +++ b/src/hi16-app-profilesave.png diff --git a/src/hi16-app-profilesaveas.png b/src/hi16-app-profilesaveas.png Binary files differnew file mode 100644 index 0000000..42e9541 --- /dev/null +++ b/src/hi16-app-profilesaveas.png diff --git a/src/hi16-app-scanclose.png b/src/hi16-app-scanclose.png Binary files differnew file mode 100644 index 0000000..16f5ced --- /dev/null +++ b/src/hi16-app-scanclose.png diff --git a/src/hi16-app-scanduplicate.png b/src/hi16-app-scanduplicate.png Binary files differnew file mode 100644 index 0000000..e8e2d2c --- /dev/null +++ b/src/hi16-app-scanduplicate.png diff --git a/src/hi16-app-scannew.png b/src/hi16-app-scannew.png Binary files differnew file mode 100644 index 0000000..358192f --- /dev/null +++ b/src/hi16-app-scannew.png diff --git a/src/hi16-app-scanrename.png b/src/hi16-app-scanrename.png Binary files differnew file mode 100644 index 0000000..94cc109 --- /dev/null +++ b/src/hi16-app-scanrename.png diff --git a/src/hi16-app-zoomcustom.png b/src/hi16-app-zoomcustom.png Binary files differnew file mode 100644 index 0000000..b78a6fd --- /dev/null +++ b/src/hi16-app-zoomcustom.png diff --git a/src/hi16-app-zoomin.png b/src/hi16-app-zoomin.png Binary files differnew file mode 100644 index 0000000..1c8a729 --- /dev/null +++ b/src/hi16-app-zoomin.png diff --git a/src/hi16-app-zoomout.png b/src/hi16-app-zoomout.png Binary files differnew file mode 100644 index 0000000..1ca95a1 --- /dev/null +++ b/src/hi16-app-zoomout.png diff --git a/src/hi32-app-knmap.png b/src/hi32-app-knmap.png Binary files differnew file mode 100644 index 0000000..6f5f704 --- /dev/null +++ b/src/hi32-app-knmap.png diff --git a/src/hi32-app-knmapman.png b/src/hi32-app-knmapman.png Binary files differnew file mode 100644 index 0000000..6676bca --- /dev/null +++ b/src/hi32-app-knmapman.png diff --git a/src/hi32-app-localman.png b/src/hi32-app-localman.png Binary files differnew file mode 100644 index 0000000..1880b42 --- /dev/null +++ b/src/hi32-app-localman.png diff --git a/src/hi32-app-manpage.png b/src/hi32-app-manpage.png Binary files differnew file mode 100644 index 0000000..136ad48 --- /dev/null +++ b/src/hi32-app-manpage.png diff --git a/src/hi32-app-manstylesheet.png b/src/hi32-app-manstylesheet.png Binary files differnew file mode 100644 index 0000000..6ab6e65 --- /dev/null +++ b/src/hi32-app-manstylesheet.png diff --git a/src/hi32-app-profilecopy.png b/src/hi32-app-profilecopy.png Binary files differnew file mode 100644 index 0000000..22924a0 --- /dev/null +++ b/src/hi32-app-profilecopy.png diff --git a/src/hi32-app-profiledelete.png b/src/hi32-app-profiledelete.png Binary files differnew file mode 100644 index 0000000..9cbf9b9 --- /dev/null +++ b/src/hi32-app-profiledelete.png diff --git a/src/hi32-app-profileload.png b/src/hi32-app-profileload.png Binary files differnew file mode 100644 index 0000000..0bccbc8 --- /dev/null +++ b/src/hi32-app-profileload.png diff --git a/src/hi32-app-profilerename.png b/src/hi32-app-profilerename.png Binary files differnew file mode 100644 index 0000000..9a2e404 --- /dev/null +++ b/src/hi32-app-profilerename.png diff --git a/src/hi32-app-profilesave.png b/src/hi32-app-profilesave.png Binary files differnew file mode 100644 index 0000000..9cee0cd --- /dev/null +++ b/src/hi32-app-profilesave.png diff --git a/src/hi32-app-profilesaveas.png b/src/hi32-app-profilesaveas.png Binary files differnew file mode 100644 index 0000000..8cd6cd2 --- /dev/null +++ b/src/hi32-app-profilesaveas.png diff --git a/src/hi32-app-scanclose.png b/src/hi32-app-scanclose.png Binary files differnew file mode 100644 index 0000000..7b8106e --- /dev/null +++ b/src/hi32-app-scanclose.png diff --git a/src/hi32-app-scanduplicate.png b/src/hi32-app-scanduplicate.png Binary files differnew file mode 100644 index 0000000..79deac9 --- /dev/null +++ b/src/hi32-app-scanduplicate.png diff --git a/src/hi32-app-scannew.png b/src/hi32-app-scannew.png Binary files differnew file mode 100644 index 0000000..ae84d87 --- /dev/null +++ b/src/hi32-app-scannew.png diff --git a/src/hi32-app-scanrename.png b/src/hi32-app-scanrename.png Binary files differnew file mode 100644 index 0000000..4a686ac --- /dev/null +++ b/src/hi32-app-scanrename.png diff --git a/src/hi32-app-zoomcustom.png b/src/hi32-app-zoomcustom.png Binary files differnew file mode 100644 index 0000000..f96cf7e --- /dev/null +++ b/src/hi32-app-zoomcustom.png diff --git a/src/hi32-app-zoomin.png b/src/hi32-app-zoomin.png Binary files differnew file mode 100644 index 0000000..3d11785 --- /dev/null +++ b/src/hi32-app-zoomin.png diff --git a/src/hi32-app-zoomout.png b/src/hi32-app-zoomout.png Binary files differnew file mode 100644 index 0000000..20d6b40 --- /dev/null +++ b/src/hi32-app-zoomout.png diff --git a/src/htmlwidget.cpp b/src/htmlwidget.cpp new file mode 100644 index 0000000..aea1ff7 --- /dev/null +++ b/src/htmlwidget.cpp @@ -0,0 +1,366 @@ +/*************************************************************************** + * * + * Copyright (C) 2005, 2006 by Kevin Gilbert * + * [email protected] * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + ***************************************************************************/ + +#include <qfile.h> +#include <qtextstream.h> + +#include <kapplication.h> +#include <kconfig.h> +#include <kdebug.h> +#include <khtml_part.h> +#include <khtmlview.h> +#include <klocale.h> +#include <kmessagebox.h> +#include <kprocess.h> +#include <kstandarddirs.h> + +#include "htmlwidget.h" +#include "knmap.h" +#include "stylesheetdialog.h" + +const float HTMLWidget::m_zoomIncrement = 25; + +// constructor +// =========== + +HTMLWidget::HTMLWidget( QStringList* stylesheetURLs, QWidget* parent, const char* name ) +: QWidget( parent, name ), + m_dlg( NULL ), + m_process( NULL ), + m_stylesheetURLs( stylesheetURLs ), + m_zoomFactor( 100 ) +{ m_htmlPart = new KHTMLPart( this, "html part" ); + m_htmlPart->setOnlyLocalReferences( true ); +} + +// destructor +// ========== + +HTMLWidget::~HTMLWidget( ) +{ if( m_dlg != NULL ) + delete m_dlg; + + if( m_process != NULL ) + delete m_process; +} + +// gotoAnchor +// ========== + +void HTMLWidget::gotoAnchor( const QString& anchor ) +{ if( !m_htmlPart->gotoAnchor( anchor )) + KMessageBox::sorry( this, i18n( "There does not appear to be ANY help available for the item you requested.\nSorry! Now piss off and stop bothering me.\nYou stink.\nYou've got bad breath.\nYour ugly.\nNobody loves you.\nNow for your bad points..." ), i18n( "No help available in Knmap page" )); +} + +// loadKnmapManPage +// ================ + +void HTMLWidget::loadKnmapManPage( ) +{ if( !tryKnmapFile( )) + { m_htmlPart->begin( ); + m_htmlPart->write( i18n( "<h1 align=center>Missing File</h1>" )); + m_htmlPart->write( i18n( "<p align=center>The file <b>knmap/nmap_manpage.html</b>, which is part of the <i>Knmap</i> package, could not be found." )); + m_htmlPart->write(i18n( "<p align=center>As a result, the prepackaged <code>man</code> page for <i>Knmap</i> is not available." )); + m_htmlPart->write( i18n( "<p align=center>You may be able to view your local <code>man</code> page for <i>nmap</i> by selecting <b>Settings / Use local man page</b>" )); + m_htmlPart->end( ); + } + + m_htmlPart->setUserStyleSheet( m_stylesheetURL ); + m_htmlPart->setZoomFactor( int( m_zoomFactor )); +} + +// loadLocalManPage +// ================ + +void HTMLWidget::loadLocalManPage( ) +{ m_process = new KProcess( ); + *m_process << "man"; + *m_process << "-w"; + *m_process << "nmap"; + + connect( m_process, SIGNAL( processExited( KProcess* )), SLOT( slotManProcessExited( ))); + connect( m_process, SIGNAL( receivedStdout( KProcess*, char*, int )), SLOT( slotManReceivedStdout( KProcess*, char*, int ))); + + m_manPagePath = QString::null; + m_process->start( KProcess::NotifyOnExit, KProcess::Stdout ); +} + +// loadManPage +// =========== + +void HTMLWidget::loadManPage( const bool localManPage ) +{ if( localManPage ) + loadLocalManPage( ); + else + loadKnmapManPage( ); +} + +// readSettings +// ============ + +void HTMLWidget::readSettings( ) +{ KConfig* config = kapp->config( ); + config->setGroup( "General" ); + m_zoomFactor = config->readDoubleNumEntry( "zoomFactor", 100.0 ); + m_stylesheetURL.setPath( config->readPathEntry( "stylesheetURL" )); +} + +// resizeEvent +// =========== + +void HTMLWidget::resizeEvent( QResizeEvent* event ) +{ QWidget::resizeEvent( event ); + m_htmlPart->view( )->resize( width( ), height( )); +} + +// saveSettings +// ============ + +void HTMLWidget::saveSettings( ) +{ KConfig* config = kapp->config( ); + config->setGroup( "General" ); + config->writeEntry( "stylesheetURL", m_stylesheetURL.path( )); + config->writeEntry( "zoomFactor", m_zoomFactor ); +} + +// setInitialValues +// ================ + +void HTMLWidget::setInitialValues( ) +{ m_htmlPart->setUserStyleSheet( m_stylesheetURL ); + m_htmlPart->setZoomFactor( int( m_zoomFactor )); +} + +// setStylesheet +// ============= + +void HTMLWidget::setStylesheet( ) +{ m_dlg = new StylesheetDialog( m_stylesheetURL.path( ), *m_stylesheetURLs, this, "man stylesheet dlg" ); + connect( m_dlg, SIGNAL( stylesheetRemoved( )), SLOT( slotStylesheetRemoved( ))); + + if( m_dlg->exec( ) != QDialog::Accepted ) + { delete m_dlg; + m_dlg = NULL; + return; + } + + *m_stylesheetURLs = m_dlg->stylesheetURLs( ); + m_stylesheetURL.setPath( m_stylesheetURLs->front( )); + m_htmlPart->setUserStyleSheet( m_stylesheetURL ); + + emit( optionsDirty( )); + delete m_dlg; + m_dlg = NULL; +} + +// slotGunzipProcessExited +// ======================= + +void HTMLWidget::slotGunzipProcessExited( ) +{ if( !m_process->normalExit( )) + { delete m_process; + m_process = NULL; + emit( errorLoadingLocalManPage( i18n( "Could not load the local 'man' page - the 'gunzip' process failed." ))); + return; + } + + delete m_process; + + m_process = new KProcess( ); + *m_process << "man2html"; + *m_process << "-"; + + connect( m_process, SIGNAL( processExited( KProcess* )), SLOT( slotMan2HTMLProcessExited( ))); + connect( m_process, SIGNAL( receivedStdout( KProcess*, char*, int )), SLOT( slotMan2HTMLReceivedStdout( KProcess*, char*, int ))); + + m_htmlData = QString::null; + m_process->start( KProcess::NotifyOnExit, KProcess::Communication( KProcess::Stdin | KProcess::Stdout )); + m_process->writeStdin( m_manPageData, m_manPageData.length( )); + m_process->closeStdin( ); +} + +// slotGunzipReceivedStdout +// ======================== + +void HTMLWidget::slotGunzipReceivedStdout( KProcess* /* process */, char* buffer, int buflen ) +{ m_manPageData += QString::fromLatin1( buffer, buflen ); +} + +// slotMan2HTMLReceivedStdout +// ========================== + +void HTMLWidget::slotMan2HTMLReceivedStdout( KProcess* /* process */, char* buffer, int buflen ) +{ m_htmlData += QString::fromLatin1( buffer, buflen ); +} + +// slotMan2HTMLProcessExited +// ========================= + +void HTMLWidget::slotMan2HTMLProcessExited( ) +{ if( !m_process->normalExit( )) + emit( errorLoadingLocalManPage( i18n( "Could not load the local 'man' page - the 'man2html' process failed." ))); + + delete m_process; + m_process = NULL; + + m_htmlPart->begin( ); + QTextStream textStream( &m_htmlData, IO_ReadOnly ); + + while( !textStream.atEnd( )) + { QString htmlLine = textStream.readLine( ); + + if( htmlLine.startsWith( "<H2>TARGET SPECIFICATION</H2>" )) + m_htmlPart->write( "<a id='target'>" ); + else + if( htmlLine.startsWith( "<DT><B>-" )) + { QStringList nmapOptions = QStringList::split( " ", htmlLine.right( htmlLine.length( ) - 7 )); + QString anchors; + + for( QStringList::Iterator it = nmapOptions.begin( ); it != nmapOptions.end( ); ++it ) + { if( (*it)[ 0 ] != '-' ) + break; + + QStringList nmapOption = QStringList::split( "<", *it ); + anchors += QString( "<a id='%1'>" ).arg( nmapOption.front( )); + } + + m_htmlPart->write( anchors ); + } + + m_htmlPart->write( htmlLine + "\n" ); + } + + m_htmlPart->end( ); + + m_htmlPart->setUserStyleSheet( m_stylesheetURL ); + m_htmlPart->setZoomFactor( int( m_zoomFactor )); +} + +// slotManProcessExited +// ==================== + +void HTMLWidget::slotManProcessExited( ) +{ + if( !m_process->normalExit( )) + { delete m_process; + m_process = NULL; + emit( errorLoadingLocalManPage( i18n( "Could not load the local 'man' page - the 'man -w' process failed." ))); + return; + } + + delete m_process; + ushort length = m_manPagePath.length( ); + + if( m_manPagePath[ length - 1 ] == '\n' ) + m_manPagePath = m_manPagePath.left( length - 1 ); + + if( !m_manPagePath.endsWith( ".gz" )) + { m_process = NULL; + emit( errorLoadingLocalManPage( i18n( "Could not load the local 'man' page - it either was not found or it not a 'gz' file." ))); + return; + } + + m_process = new KProcess( ); + *m_process << "gunzip"; + *m_process << "-c"; + *m_process << m_manPagePath; + + connect( m_process, SIGNAL( processExited( KProcess* )), SLOT( slotGunzipProcessExited( ))); + connect( m_process, SIGNAL( receivedStdout( KProcess*, char*, int )), SLOT( slotGunzipReceivedStdout( KProcess*, char*, int ))); + + m_manPageData = QString::null; + m_process->start( KProcess::NotifyOnExit, KProcess::Stdout ); +} + +// slotManReceivedStdout +// ===================== + +void HTMLWidget::slotManReceivedStdout( KProcess* /* process */, char* buffer, int buflen ) +{ m_manPagePath += QString::fromLatin1( buffer, buflen ); +} + +// slotStylesheetRemoved +// ===================== + +void HTMLWidget::slotStylesheetRemoved( ) +{ *m_stylesheetURLs = m_dlg->stylesheetURLs( ); + emit( optionsDirty( )); +} + +// tryKnmapFile +// ============ + +bool HTMLWidget::tryKnmapFile( ) +{ +#ifdef _DEBUG + QString path = "/home/c/knmap/src/nmap_manpage.html"; +#else + QString path = locate( "data", "knmap/nmap_manpage.html" ); +#endif + + if( !QFile::exists( path )) + return false; + + QFile manPageFile( path ); + + if( !manPageFile.open( IO_ReadOnly )) + return false; + + QTextStream manPageStream( &manPageFile ); + m_htmlPart->begin( ); + + while ( !manPageStream.atEnd( )) + { QString line = manPageStream.read( ); + m_htmlPart->write( line ); + } + + m_htmlPart->end( ); + manPageFile.close(); + + return true; +} + +// zoomFactor +// ========== + +void HTMLWidget::zoomFactor( const float factor ) +{ m_zoomFactor = factor; + m_htmlPart->setZoomFactor( int( m_zoomFactor )); + emit( optionsDirty( )); +} +// zoomIn +// ====== + +void HTMLWidget::zoomIn( ) +{ m_zoomFactor = _min_( ZOOM_MAX_FACTOR, m_zoomFactor + m_zoomIncrement ); + m_htmlPart->setZoomFactor( int( m_zoomFactor )); + emit( optionsDirty( )); +} + +// zoomOut +// ======= + +void HTMLWidget::zoomOut( ) +{ m_zoomFactor = _max_( ZOOM_MIN_FACTOR, m_zoomFactor - m_zoomIncrement ); + m_htmlPart->setZoomFactor( int( m_zoomFactor )); + emit( optionsDirty( )); +} diff --git a/src/htmlwidget.h b/src/htmlwidget.h new file mode 100644 index 0000000..996d63e --- /dev/null +++ b/src/htmlwidget.h @@ -0,0 +1,95 @@ +/*************************************************************************** + * * + * Copyright (C) 2005, 2006 by Kevin Gilbert * + * [email protected] * + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef _HTMLWIDGET_H_ +#define _HTMLWIDGET_H_ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <qstringlist.h> +#include <qwidget.h> +#include <kurl.h> +#include "global.h" + +// forward class definitions +// ========================= + +class KHTMLPart; +class KProcess; +class StylesheetDialog; + +// HTMLWidget class definition +// =========================== + + +class HTMLWidget : public QWidget +{ Q_OBJECT + + public: + HTMLWidget( QStringList* stylesheetURLs, QWidget* parent = NULL, const char* name = NULL ); + virtual ~HTMLWidget( ); + + void gotoAnchor( const QString& anchor ); + void loadManPage( const bool localManPage ); + void readSettings( ); + void saveSettings( ); + void setInitialValues( ); + void setStylesheet( ); + float zoomFactor( ) const { return m_zoomFactor; } + void zoomFactor( const float factor ); + void zoomIn( ); + void zoomOut( ); + + signals: + void errorLoadingLocalManPage( const QString& ); + void optionsDirty( ); + + private slots: + void slotGunzipProcessExited( ); + void slotGunzipReceivedStdout( KProcess* process, char* buffer, int buflen ); + void slotMan2HTMLProcessExited( ); + void slotMan2HTMLReceivedStdout( KProcess* process, char* buffer, int buflen ); + void slotManProcessExited( ); + void slotManReceivedStdout( KProcess* process, char* buffer, int buflen ); + void slotStylesheetRemoved( ); + + private: + void loadKnmapManPage( ); + void loadLocalManPage( ); + void resizeEvent( QResizeEvent* event ); + bool tryKnmapFile( ); + + StylesheetDialog* m_dlg; + QString m_htmlData; + KHTMLPart* m_htmlPart; + QString m_manPageData; + QString m_manPagePath; + KProcess* m_process; + KURL m_stylesheetURL; + QStringList* m_stylesheetURLs; + float m_zoomFactor; + static const float m_zoomIncrement; +}; + +#endif // _HTMLWIDGET_H_ diff --git a/src/indexwidget.cpp b/src/indexwidget.cpp new file mode 100644 index 0000000..9c2f8ff --- /dev/null +++ b/src/indexwidget.cpp @@ -0,0 +1,273 @@ +/*************************************************************************** + * * + * Copyright (C) 2005, 2006 by Kevin Gilbert * + * [email protected] * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + ***************************************************************************/ + +#include <qdragobject.h> +#include <qfontmetrics.h> +#include <qpainter.h> +#include <qpopupmenu.h> +#include <qtimer.h> + +#include <kapplication.h> +#include <kconfig.h> +#include <kdebug.h> +#include <kglobal.h> +#include <kglobalsettings.h> +#include <kiconloader.h> +#include <klocale.h> + +#include "global.h" +#include "indexwidget.h" +#include "mainwidget.h" +#include "scanstack.h" +#include "scanwidget.h" + +// constructor +// =========== + +IndexWidget::IndexWidget( ScanStack* scanStack, MainWidget* parent, const char* name ) +: QScrollView( parent, name ), + m_blinkTimer( NULL ), + m_scanCount( 0 ), + m_scanStack( scanStack ) +{ setDragAutoScroll( true ); + viewport( )->setAcceptDrops( true ); +} + +// calculateIndex +// ============== + +short IndexWidget::calculateIndex( const ushort y ) +{ QFontMetrics metrics = fontMetrics( ); + byte height = metrics.height( ); + ushort index = y / height; + + return index > m_scanStack->count( ) - 1 ? -1 : index; +} + +// contentsContextMenuEvent +// ======================== + +void IndexWidget::contentsContextMenuEvent( QContextMenuEvent* event ) +{ short index = calculateIndex( event->y( )); + + if( index < 0 ) + return; + + ScanWidget* scanWidget = m_scanStack->makeScanWidgetVisible( index ); + emit( visibleScanWidgetChanged( scanWidget )); + + QPopupMenu* contextMenu = new QPopupMenu( this, "context menu" ); + KIconLoader* iconLoader = KGlobal::iconLoader( ); + QIconSet profileLoad = iconLoader->loadIconSet( "profileload", KIcon::Small ); + QIconSet profileSave = iconLoader->loadIconSet( "profilesave", KIcon::Small ); + QIconSet profileSaveAs = iconLoader->loadIconSet( "profilesaveas", KIcon::Small ); + QIconSet scanClose = iconLoader->loadIconSet( "scanclose", KIcon::Small ); + QIconSet scanDuplicate = iconLoader->loadIconSet( "scanduplicate", KIcon::Small ); + QIconSet scanNew = iconLoader->loadIconSet( "scannew", KIcon::Small ); + QIconSet scanRename = iconLoader->loadIconSet( "scanrename", KIcon::Small ); + + contextMenu->insertItem( scanClose, i18n( "&Close scan" ), parent( ), SLOT( slotScanClose( )), CTRL+Key_W ); + contextMenu->insertItem( scanDuplicate, i18n( "&Duplicate scan" ), parent( ), SLOT( slotScanDuplicate( )), CTRL+Key_C ); + contextMenu->insertItem( scanNew, i18n( "&New scan..." ), parent( ), SLOT( slotScanNew( )), CTRL+Key_N ); + contextMenu->insertItem( scanRename, i18n( "&Rename scan..." ), parent( ), SLOT( slotScanRename( )), Key_F2 ); + contextMenu->insertItem( i18n( "&Use target host name" ), parent( ), SLOT( slotUseTargetHost( ))); + contextMenu->insertSeparator( ); + contextMenu->insertItem( profileLoad, i18n( "&Load profile..." ), parent( ), SLOT( slotProfileLoad( ))); + contextMenu->insertItem( profileSave, i18n( "&Save profile..." ), parent( ), SLOT( slotProfileSave( ))); + contextMenu->insertItem( profileSaveAs, i18n( "&Save profile as..." ), parent( ), SLOT( slotProfileSaveAs( ))); + + contextMenu->exec( event->globalPos( )); +} + +// contentsDragMoveEvent +// ===================== + +void IndexWidget::contentsDragMoveEvent( QDragMoveEvent* event ) +{ short index = calculateIndex( event->pos( ).y( )); + index = index < 0 ? m_scanStack->count( ) - 1 : index; + + ScanWidget* scanWidget = m_scanStack->makeScanWidgetVisible( index ); + emit( visibleScanWidgetChanged( scanWidget )); +} + +// contentsMouseMoveEvent +// ====================== + +void IndexWidget::contentsMouseMoveEvent( QMouseEvent* event ) +{ if( event->stateAfter( ) != Qt::LeftButton ) + return; + + short index = calculateIndex( event->y( )); + + if( index < 0 ) + return; + + QStoredDrag* drag = new QStoredDrag( "application/octet-stream", this ); + drag->dragMove( ); + ScanWidget* scanWidget = m_scanStack->moveScanWidget( index ); + + scanWidget->ignoreTabChanges( true ); + m_scanStack->raiseWidget( scanWidget ); + scanWidget->ignoreTabChanges( false ); + + emit( visibleScanWidgetChanged( scanWidget )); +} + +// contentsMousePressEvent +// ======================= + +void IndexWidget::contentsMousePressEvent( QMouseEvent* event ) +{ if( event->stateAfter( ) != Qt::LeftButton ) + return; + + short index = calculateIndex( event->y( )); + + if( index < 0 ) + return; + + ScanWidget* scanWidget = m_scanStack->makeScanWidgetVisible( index ); + emit( visibleScanWidgetChanged( scanWidget )); + + if( scanWidget->state( ) == ScanWidget::finished ) + scanWidget->state( ScanWidget::dormant ); +} + +// drawContents +// ============ + +void IndexWidget::drawContents( QPainter* painter, int clipx, int clipy, int clipw, int cliph ) +{ painter->fillRect( clipx, clipy, clipw, cliph, KGlobalSettings::baseColor( )); + painter->setBackgroundMode( Qt::OpaqueMode ); + + QFontMetrics metrics = fontMetrics( ); + byte height = metrics.height( ); + byte aWidth2 = 2 * metrics.width( "*" ); + ushort x = height / 2; + ushort xMax = 0; + ushort y = 0; + ushort i; + + for( m_scanStack->resetScanWidgets( i ); m_scanStack->moreScanWidgets( i ); y += height, m_scanStack->nextScanWidget( i )) + { ScanWidget* scanWidget = m_scanStack->currentScanWidget( i ); + + switch( scanWidget->state( )) + { case ScanWidget::dormant: + if( m_scanStack->isVisibleWidget( scanWidget )) + { painter->fillRect( 0, y, visibleWidth( ), height, KGlobalSettings::alternateBackgroundColor( )); + painter->setBackgroundColor( KGlobalSettings::alternateBackgroundColor( )); + painter->setPen( KGlobalSettings::buttonTextColor( )); + break; + } + + painter->setBackgroundColor( KGlobalSettings::baseColor( )); + painter->setPen( KGlobalSettings::buttonTextColor( )); + break; + + case ScanWidget::finished: + painter->fillRect( 0, y, visibleWidth( ), height, KGlobalSettings::highlightColor( )); + painter->setBackgroundColor( KGlobalSettings::highlightColor( )); + painter->setPen( KGlobalSettings::activeTextColor( )); + break; + + case ScanWidget::running: + if( m_highlight ) + { painter->fillRect( 0, y, visibleWidth( ), height, KGlobalSettings::highlightColor( )); + painter->setBackgroundColor( KGlobalSettings::highlightColor( )); + painter->setPen( KGlobalSettings::activeTextColor( )); + break; + } + + if( m_scanStack->isVisibleWidget( scanWidget )) + { painter->fillRect( 0, y, visibleWidth( ), height, KGlobalSettings::alternateBackgroundColor( )); + painter->setBackgroundColor( KGlobalSettings::alternateBackgroundColor( )); + painter->setPen( KGlobalSettings::buttonTextColor( )); + break; + } + + painter->fillRect( 0, y, visibleWidth( ), height, KGlobalSettings::baseColor( )); + painter->setBackgroundColor( KGlobalSettings::baseColor( )); + painter->setPen( KGlobalSettings::buttonTextColor( )); + break; + } + + if( scanWidget->useTargetHost( )) + painter->drawText( x, y + metrics.ascent( ), "*" ); + + painter->drawText( x + aWidth2, y + metrics.ascent( ), scanWidget->scanName( )); + xMax = _max_( xMax, x + aWidth2 + metrics.width( scanWidget->scanName( ))); + } + + if( m_scanCount ) + m_highlight = !m_highlight; + + resizeContents( xMax + height / 2, y ); +} + +// ensureCurrentVisible +// ==================== + +void IndexWidget::ensureCurrentVisible( ) +{ short index = m_scanStack->indexOfVisibleScanWidget( ); + + if( index < 0 ) + return; + + QFontMetrics metrics = fontMetrics( ); + short y = index * metrics.height( ) - height( ) / 2; + setContentsPos( 0, y ); + updateContents( ); +} + +// ensureCurrentVisible +// ==================== + +void IndexWidget::slotRepaint( ) +{ repaintContents( false ); +} + +// slotScanStarted +// =============== + +void IndexWidget::slotScanStarted( ) +{ if( m_scanCount++ ) + return; + + ASSERT( m_blinkTimer == NULL ); + m_blinkTimer = new QTimer( this ); + connect( m_blinkTimer, SIGNAL( timeout( )), SLOT( slotRepaint( ))); + m_blinkTimer->start( 500 ); + m_highlight = true; +} + +// slotScanStopped +// =============== + +void IndexWidget::slotScanStopped( ScanWidget* scanWidget ) +{ scanWidget->state( scanWidget == m_scanStack->visibleWidget( ) ? ScanWidget::dormant : ScanWidget::finished ); + updateContents( ); + + if( --m_scanCount ) + return; + + delete m_blinkTimer; + m_blinkTimer = NULL; +} diff --git a/src/indexwidget.h b/src/indexwidget.h new file mode 100644 index 0000000..64692d7 --- /dev/null +++ b/src/indexwidget.h @@ -0,0 +1,75 @@ +/*************************************************************************** + * * + * Copyright (C) 2005, 2006 by Kevin Gilbert * + * [email protected] * + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef _INDEXWIDGET_H_ +#define _INDEXWIDGET_H_ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <qscrollview.h> + +// forward class definitions +// ========================= + +class KConfig; +class MainWidget; +class QPainter; +class QTimer; +class ScanStack; +class ScanWidget; + +// IndexWidget class definition +// ============================ + +class IndexWidget : public QScrollView +{ Q_OBJECT + + public: + IndexWidget( ScanStack* scanStack, MainWidget* parent, const char* name = NULL ); + + void ensureCurrentVisible( ); + + signals: + void visibleScanWidgetChanged( ScanWidget* ); + + public slots: + void slotRepaint( ); + void slotScanStarted( ); + void slotScanStopped( ScanWidget* scanWidget ); + + private: + short calculateIndex( const ushort y ); + void contentsContextMenuEvent( QContextMenuEvent* event ); + void contentsDragMoveEvent( QDragMoveEvent* event ); + void contentsMouseMoveEvent( QMouseEvent* event ); + void contentsMousePressEvent( QMouseEvent* event ); + void drawContents( QPainter* painter, int clipx, int clipy, int clipw, int cliph ); + + QTimer* m_blinkTimer; + bool m_highlight; + ushort m_scanCount; + ScanStack* m_scanStack; +}; + +#endif // _INDEXWIDGET_H_ diff --git a/src/knmap.cpp b/src/knmap.cpp new file mode 100644 index 0000000..5bdd17e --- /dev/null +++ b/src/knmap.cpp @@ -0,0 +1,405 @@ +/*************************************************************************** + * * + * Copyright (C) 2005, 2006 by Kevin Gilbert * + * [email protected] * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + ***************************************************************************/ + +#include <qdir.h> +#include <qlineedit.h> + +#include <kaction.h> +#include <kapplication.h> +#include <kconfig.h> +#include <kdebug.h> +#include <kedittoolbar.h> +#include <kfiledialog.h> +#include <kglobalsettings.h> +#include <kinputdialog.h> +#include <kkeydialog.h> +#include <klocale.h> +#include <kmainwindow.h> +#include <kmessagebox.h> +#include <kstandarddirs.h> +#include <kstatusbar.h> +#include <kstdaction.h> + +#include "htmlwidget.h" +#include "knmap.h" +#include "mainwidget.h" +#include "scanwidget.h" + +// constructor +// =========== + +Knmap::Knmap( ) +: KMainWindow( NULL, "knmap" ), + m_mainWidget( new MainWidget( this, "main widget" )) +{ findNmap( ); + setCentralWidget( m_mainWidget ); + readSettings( ); + createMenu( ); + setAutoSaveSettings( ); + + connect( m_mainWidget, + SIGNAL( outputAvailable( const bool, const bool )), + SLOT( slotOutputAvailable( const bool, const bool))); + + connect( m_mainWidget, + SIGNAL( setManPageActionStuff( const bool )), + SLOT( slotSetManPageActionStuff( const bool ))); + + connect( m_mainWidget, + SIGNAL( setCaption( const QString& )), + SLOT( slotSetCaption( const QString& ))); + + connect( m_mainWidget, + SIGNAL( statusBarText( const QString& )), statusBar( ), + SLOT( message( const QString& ))); + + connect( m_mainWidget, + SIGNAL( visibleScanWidgetChanged( ScanWidget* )), + SLOT( slotVisibleScanWidgetChanged( ScanWidget* ))); +} + +// createMenu +// ========== + +void Knmap::createMenu( ) +{ KStdAction::configureToolbars( this, SLOT( slotConfigureToolbars( )), actionCollection( )); + KStdAction::keyBindings( this, SLOT( slotConfigureShortcuts( )), actionCollection( )); + KStdAction::quit( kapp, SLOT( quit( )), actionCollection( )); + + m_fileSaveAction = KStdAction::save( m_mainWidget, + SLOT( slotFileSave( )), + actionCollection( )); + + m_fileSaveAsAction = KStdAction::saveAs( m_mainWidget, + SLOT( slotFileSaveAs( )), + actionCollection( )); + + m_settingsManAction = new KAction( i18n( "&Use local man page" ), + "localman.png", + 0, + m_mainWidget, + SLOT( slotSwitchManPages( )), + actionCollection( ), + "settings_local" ); + + m_useTargetHostAction = new KToggleAction( i18n( "Use target host name" ), + NULL, + 0, + m_mainWidget, + SLOT( slotUseTargetHost( )), + actionCollection( ), + "scan_use" ); + + m_wrapTextAction = new KToggleAction( i18n( "Wrap text" ), + NULL, + 0, + m_mainWidget, + SLOT( slotWrapText( )), + actionCollection( ), + "settings_wrap_text" ); + + new KAction( i18n( "Close scan" ), + "scanclose", + CTRL+Key_W, + m_mainWidget, + SLOT( slotScanClose( )), + actionCollection( ), + "scan_close" ); + + new KAction( i18n( "Copy profile..." ), + "profilecopy", + 0, + m_mainWidget, + SLOT( slotProfileCopy( )), + actionCollection( ), + "profile_copy" ); + + new KAction( i18n( "Delete profile..." ), + "profiledelete", + 0, + m_mainWidget, + SLOT( slotProfileDelete( )), + actionCollection( ), + "profile_delete" ); + + new KAction( i18n( "Display nmap man page" ), + "manpage", + 0, + m_mainWidget, + SLOT( slotShowManPage( )), + actionCollection( ), + "help_man_page" ); + + new KAction( i18n( "Duplicate scan" ), + "scanduplicate", + CTRL+Key_C, + m_mainWidget, + SLOT( slotScanDuplicate( )), + actionCollection( ), + "scan_duplicate" ); + + new KAction( i18n( "Load profile..." ), + "profileload", + 0, + m_mainWidget, + SLOT( slotProfileLoad( )), + actionCollection( ), + "profile_load" ); + + new KAction( i18n( "man page stylesheet..." ), + "manstylesheet", + 0, + m_mainWidget, + SLOT( slotSetStylesheet( )), + actionCollection( ), + "settings_stylesheet" ); + + new KAction( i18n( "New scan..." ), + "scannew", + CTRL+Key_N, + m_mainWidget, + SLOT( slotScanNew( )), + actionCollection( ), + "scan_new" ); + + new KAction( i18n( "Rename profile..." ), + "profilerename", + 0, + m_mainWidget, + SLOT( slotProfileRename( )), + actionCollection( ), + "profile_rename" ); + + new KAction( i18n( "Rename scan..." ), + "scanrename", + Key_F2, + m_mainWidget, + SLOT( slotScanRename( )), + actionCollection( ), + "scan_rename" ); + + new KAction( i18n( "Save profile..." ), + "profilesave", + 0, + m_mainWidget, + SLOT( slotProfileSave( )), + actionCollection( ), + "profile_save" ); + + new KAction( i18n( "Save profile as..." ), + "profilesaveas", + 0, + m_mainWidget, + SLOT( slotProfileSaveAs( )), + actionCollection( ), + "profile_save_as" ); + + new KAction( i18n( "Zoom custom" ), + "zoomcustom", + 0, + m_mainWidget, + SLOT( slotZoomCustom( )), + actionCollection( ), + "settings_zoom_custom" ); + + new KAction( i18n( "Zoom in" ), + "zoomin", + 0, + m_mainWidget, + SLOT( slotZoomIn( )), + actionCollection( ), + "settings_zoom_in" ); + + new KAction( i18n( "Zoom out" ), + "zoomout", + 0, + m_mainWidget, + SLOT( slotZoomOut( )), + actionCollection( ), + "settings_zoom_out" ); + + m_fileSaveAction->setEnabled( false ); + m_fileSaveAsAction->setEnabled( false ); + m_wrapTextAction->setChecked( m_mainWidget->wrapText( )); + + createStandardStatusBarAction( ); + setStandardToolBarMenuEnabled( true ); + +#ifdef _DEBUG + createGUI( QDir::homeDirPath( ) + "/.kde/share/apps/knmap/knmapui.rc" ); +#else + createGUI( ); +#endif +} + +// findNmap +// ======== + +void Knmap::findNmap( ) +{ QString nmapPath = KStandardDirs::findExe( "nmap" ); + + if( nmapPath.isEmpty( )) + { KMessageBox::error( this, + i18n( "nmap is not installed on the computer - we cannot proceed without it. To download nmap go to \"http://www.insecure.org/nmap\"" ), + i18n( "nmap not found" )); + kapp->quit( ); + } +} + +// getDirPath +// ========== + +bool Knmap::getDirPath( const QString& caption, QString& path ) +{ QString startDir = (path.isEmpty( )) ? KGlobalSettings::documentPath( ) : path; + QString tempPath = KFileDialog::getExistingDirectory( startDir, NULL, caption ); + + if( tempPath.isEmpty( )) + return false; + + path = tempPath; + return true; +} + +// getDirPath +// ========== + +void Knmap::getDirPath( const QString& caption, QString& path, QLineEdit* lineEdit ) +{ if( getDirPath( caption, path )) + lineEdit->setText( path ); +} + +// getFilePath +// =========== + +bool Knmap::getFilePath( const QString& caption, QString& path, const bool save ) +{ QString filter = "*.txt|Text files\n*.*|All files"; + QString startDir = (path.isEmpty( )) ? KGlobalSettings::documentPath( ) : path; + QString tempPath = KFileDialog::getSaveFileName( startDir, filter, NULL, caption ); + + if( tempPath.isEmpty( )) + return false; + + if( save && QFile::exists( tempPath )) + { if( KMessageBox::Yes != KMessageBox::questionYesNo( NULL, QString( i18n( "File \"%1\" exists.\nOverwrite?" )).arg( tempPath ), i18n( "File exists" ))) + return false; + } + + path = tempPath; + return true; +} + +// getFilePath +// =========== + +void Knmap::getFilePath( const QString& caption, QString& path, QLineEdit* lineEdit, const bool save ) +{ if( getFilePath( caption, path, save )) + lineEdit->setText( path ); +} + +// queryExit +// ========= + +bool Knmap::queryExit( ) +{ if( m_mainWidget->isDirty( ) && KMessageBox::Yes == KMessageBox::questionYesNo( this, i18n( "Some profiles has been updated - save them now?" ), i18n( "Profile data updated" ))) + m_mainWidget->saveAllDirtyProfiles( ); + + saveSettings( ); + return true; +} + +// readSettings +// ============ + +void Knmap::readSettings( ) +{ m_mainWidget->readSettings( ); +} + +// saveSettings +// ============ + +void Knmap::saveSettings( ) +{ m_mainWidget->saveSettings( ); +} + +// slotConfigureShortcuts +// ====================== + +void Knmap::slotConfigureShortcuts( ) +{ KKeyDialog::configure( actionCollection( ), this); +} + +// slotConfigureToolbars +// ===================== + +void Knmap::slotConfigureToolbars( ) +{ saveMainWindowSettings( KGlobal::config( ), autoSaveGroup( )); + + KEditToolbar dlg( actionCollection( )); + connect( &dlg, SIGNAL( newToolbarConfig( )),this, SLOT( slotNewToolbarConfig( ))); + dlg.exec( ); +} + +// slotNewToolbarConfig +// ==================== + +void Knmap::slotNewToolbarConfig( ) +{ +#ifdef _DEBUG + createGUI( QDir::homeDirPath( ) + "/.kde/share/apps/knmap/knmapui.rc" ); +#else + createGUI( ); +#endif + + applyMainWindowSettings( KGlobal::config( ), autoSaveGroup( )); +} + +// slotOutputAvailable +// =================== + +void Knmap::slotOutputAvailable( const bool saveState, const bool saveAsState ) +{ m_fileSaveAction->setEnabled( saveState ); + m_fileSaveAsAction->setEnabled( saveAsState ); +} + +// slotSetCaption +// ============== + +void Knmap::slotSetCaption( const QString& caption ) +{ setCaption( caption ); +} + +// slotSetManPageActionStuff +// ========================= + +void Knmap::slotSetManPageActionStuff( const bool useLocalManPage ) +{ m_settingsManAction->setIcon( useLocalManPage ? "knmapman.png" : "localman.png" ); + m_settingsManAction->setText( useLocalManPage ? i18n( "&Use Knmap man page" ) : i18n( "&Use local man page" )); +} + +// slotVisibleScanWidgetChanged +// ============================ + +void Knmap::slotVisibleScanWidgetChanged( ScanWidget* scanWidget ) +{ m_useTargetHostAction->setChecked( scanWidget->useTargetHost( )); +} + +#include "knmap.moc" diff --git a/src/knmap.desktop b/src/knmap.desktop new file mode 100644 index 0000000..38949f4 --- /dev/null +++ b/src/knmap.desktop @@ -0,0 +1,42 @@ +[Desktop Entry] +Encoding=UTF-8 +Name=knmap +Name[xx]=xxknmapxx +Exec=knmap +Icon=knmap +Type=Application +Comment=A simple KDE Application +Comment[br]=Ur meziant eeun evit KDE +Comment[ca]=Una aplicació KDE simple +Comment[da]=Et simpelt KDE program +Comment[de]=Eine einfache KDE-Anwendung +Comment[el]=Μια απλή εφαρμογή του KDE +Comment[es]=Una aplicación de KDE sencilla +Comment[et]=Lihtne KDE rakendus +Comment[eu]=KDE aplikazio simple bat +Comment[fr]=Une application simple pour KDE +Comment[ga]=Feidhmchlár Simplí KDE +Comment[hi]=एक सादा केडीई अनुप्रयोग +Comment[hu]=Egyszerű KDE-alkalmazás +Comment[is]=Einfalt KDE forrit +Comment[it]=Una semplice applicazione KDE +Comment[ja]=シンプルな KDE アプリケーション +Comment[nb]=Et enkelt KDE-program +Comment[nl]=Een eenvoudige KDE-toepassing +Comment[pl]=Prosty program KDE +Comment[pt]=Uma aplicação simples do KDE +Comment[pt_BR]=Um simples Aplicativo do KDE +Comment[ru]=Простое приложение KDE +Comment[sl]=Preprost program za KDE +Comment[sr]=Једноставан KDE програм +Comment[sr@Latn]=Jednostavan KDE program +Comment[sv]=Ett enkelt KDE-program +Comment[ta]=ஒரு சாதாரண கெடிஇ பயன்பாடு +Comment[tg]=Гузориши оддиKDE +Comment[tr]=Basit bir KDE Uygulaması +Comment[uk]=Проста програма KDE +Comment[xx]=xxA simple KDE Applicationxx +Comment[zh_CN]=一个简单的 KDE 应用程序 +GenericName=nmap Graphical User Interface +GenericName[fr]=Interface Graphique pour nmap +Categories=Qt;KDE;Utility diff --git a/src/knmap.h b/src/knmap.h new file mode 100644 index 0000000..1bdb622 --- /dev/null +++ b/src/knmap.h @@ -0,0 +1,81 @@ +/*************************************************************************** + * * + * Copyright (C) 2005, 2006 by Kevin Gilbert * + * [email protected] * + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef _KNMAP_H_ +#define _KNMAP_H_ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <qstringlist.h> +#include <kmainwindow.h> +#include "global.h" + +// forward class definitions +// ========================= + +class KAction; +class KToggleAction; +class MainWidget; +class ScanWidget; + +// Knmap class definition +// ====================== + +class Knmap : public KMainWindow +{ Q_OBJECT + + public: + Knmap( ); + + static bool getDirPath( const QString& caption, QString& path ); + static void getDirPath( const QString& caption, QString& path, QLineEdit* lineEdit ); + static bool getFilePath( const QString& caption, QString& path, const bool save ); + static void getFilePath( const QString& caption, QString& path, QLineEdit* lineEdit, const bool save ); + + private slots: + void slotConfigureShortcuts( ); + void slotConfigureToolbars( ); + void slotSetCaption( const QString& caption ); + void slotNewToolbarConfig( ); + void slotOutputAvailable( const bool saveState, const bool saveAsState ); + void slotSetManPageActionStuff( const bool useLocalManPage ); + void slotVisibleScanWidgetChanged( ScanWidget* scanWidget ); + + private: + void createMenu( ); + void findNmap( ); + bool queryExit( ); + void readSettings( ); + void saveSettings( ); + void switchManPages( ); + + KAction* m_fileSaveAction; + KAction* m_fileSaveAsAction; + MainWidget* m_mainWidget; + KAction* m_settingsManAction; + KToggleAction* m_useTargetHostAction; + KToggleAction* m_wrapTextAction; +}; + +#endif // _KNMAP_H_ diff --git a/src/knmapui.rc b/src/knmapui.rc new file mode 100644 index 0000000..6635b1c --- /dev/null +++ b/src/knmapui.rc @@ -0,0 +1,38 @@ +<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd"> +<kpartgui name="knmap" version="1"> +<MenuBar> + <Menu name="file" > + <Action name="scan_new" /> + <Action name="scan_duplicate" /> + <Action name="scan_rename" /> + <Action name="scan_use" /> + <Action name="scan_close" /> + <Separator/> + </Menu> + <Menu name="help" > + <Action name="help_man_page" /> + <Separator/> + </Menu> + <Menu name="profile" > + <text>&Profiles</text> + <Action name="profile_load" /> + <Action name="profile_save" /> + <Action name="profile_save_as" /> + <Separator/> + <Action name="profile_copy" /> + <Action name="profile_delete" /> + <Action name="profile_rename" /> + </Menu> + <Menu name="settings" > + <text>&Settings</text> + <Action name="settings_wrap_text" /> + <Separator/> + <Action name="settings_stylesheet" /> + <Action name="settings_local" /> + <Separator/> + <Action name="settings_zoom_in" /> + <Action name="settings_zoom_out" /> + <Action name="settings_zoom_custom" /> + </Menu> +</MenuBar> +</kpartgui> diff --git a/src/loggingoptions.cpp b/src/loggingoptions.cpp new file mode 100644 index 0000000..7a8d410 --- /dev/null +++ b/src/loggingoptions.cpp @@ -0,0 +1,460 @@ +/*************************************************************************** + * * + * Copyright (C) 2005, 2006 by Kevin Gilbert * + * [email protected] * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + ***************************************************************************/ + +#include <qbuttongroup.h> +#include <qcheckbox.h> +#include <qlayout.h> +#include <qlineedit.h> +#include <qpushbutton.h> + +#include <kconfig.h> +#include <kdebug.h> +#include <kglobal.h> +#include <kiconloader.h> +#include <kinputdialog.h> +#include <klocale.h> +#include <kmessagebox.h> + +#include "knmap.h" +#include "loggingoptions.h" +#include "whatsthis.h" + +// constructor +// =========== + +LoggingOptions::LoggingOptions( QWidget* parent, const char* name ) +: QWidget( parent, name ) +{ createLayout( ); +} + +// createLayout +// ============ + +void LoggingOptions::createLayout( ) +{ QGridLayout* gridLayout = new QGridLayout( this ); + KIconLoader* iconLoader = KGlobal::iconLoader( ); + QIconSet fileOpenIconSet = iconLoader->loadIconSet( "fileopen", KIcon::Small ); + + m_baseFileNameButton = new QPushButton( fileOpenIconSet, NULL, this, "base file name button" ); + m_grepableLogButton = new QPushButton( fileOpenIconSet, NULL, this, "grepable log button" ); + m_normalLogButton = new QPushButton( fileOpenIconSet, NULL, this, "normal log button" ); + m_resumeButton = new QPushButton( fileOpenIconSet, NULL, this, "resume button" ); + m_scriptKiddieButton = new QPushButton( fileOpenIconSet, NULL, this, "script kiddie button" ); + m_stylesheetButton = new QPushButton( fileOpenIconSet, NULL, this, "stylesheet button" ); + m_xmlLogButton = new QPushButton( fileOpenIconSet, NULL, this, "xml log button" ); + + m_appendOutputCheckBox = new QCheckBox( i18n( "Append output (--append_output)" ), this, "append output checkbox" ); + m_baseFileNameCheckBox = new QCheckBox( i18n( "Base file name (-oA <name>) " ), this, "base name checkbox" ); + m_grepableLogCheckBox = new QCheckBox( i18n( "grep'able log file (-oG <file>) " ), this, "grepable log checkbox" ); + m_normalLogCheckBox = new QCheckBox( i18n( "Normal log file (-oN <file>) " ), this, "normal log checkbox" ); + m_noStylesheetCheckBox = new QCheckBox( i18n( "No XSL stylesheet (--no_stylesheet)" ), this, "no stylesheet checkbox" ); + m_resumeCheckBox = new QCheckBox( i18n( "Resume file (--resume <file>) " ), this, "resume checkbox" ); + m_scriptKiddieCheckBox = new QCheckBox( i18n( "Script kiddie log file (-oS <file>) " ), this, "script kiddie checkbox" ); + m_stylesheetCheckBox = new QCheckBox( i18n( "XSL stylesheet (--stylesheet <file>) " ), this, "stylesheet checkbox" ); + m_xmlLogCheckBox = new QCheckBox( i18n( "XML log file (-oX <file>) " ), this, "xml log checkbox" ); + + m_baseFileNameLineEdit = new QLineEdit( this, "base file name line edit" ); + m_grepableLogLineEdit = new QLineEdit( this, "grepable log line edit" ); + m_normalLogLineEdit = new QLineEdit( this, "normal log line edit" ); + m_resumeLineEdit = new QLineEdit( this, "resume line edit" ); + m_scriptKiddieLineEdit = new QLineEdit( this, "script kiddie line edit" ); + m_stylesheetLineEdit = new QLineEdit( this, "stylesheet line edit" ); + m_xmlLogLineEdit = new QLineEdit( this, "xml log line edit" ); + + byte row = 1; + gridLayout->addWidget( m_appendOutputCheckBox, row++, 1 ); + gridLayout->addWidget( m_noStylesheetCheckBox, row++, 1 ); + byte rowBlock1 = row; + + row = 1; + gridLayout->addWidget( m_baseFileNameCheckBox, row, 3 ); + gridLayout->addWidget( m_baseFileNameLineEdit, row, 4 ); + gridLayout->addWidget( m_baseFileNameButton, row++, 5 ); + + gridLayout->addWidget( m_grepableLogCheckBox, row, 3 ); + gridLayout->addWidget( m_grepableLogLineEdit, row, 4 ); + gridLayout->addWidget( m_grepableLogButton, row++, 5 ); + + gridLayout->addWidget( m_normalLogCheckBox, row, 3 ); + gridLayout->addWidget( m_normalLogLineEdit, row, 4 ); + gridLayout->addWidget( m_normalLogButton, row++, 5 ); + + gridLayout->addWidget( m_resumeCheckBox, row, 3 ); + gridLayout->addWidget( m_resumeLineEdit, row, 4 ); + gridLayout->addWidget( m_resumeButton, row++, 5 ); + + gridLayout->addWidget( m_scriptKiddieCheckBox, row, 3 ); + gridLayout->addWidget( m_scriptKiddieLineEdit, row, 4 ); + gridLayout->addWidget( m_scriptKiddieButton, row++, 5 ); + + gridLayout->addWidget( m_xmlLogCheckBox, row, 3 ); + gridLayout->addWidget( m_xmlLogLineEdit, row, 4 ); + gridLayout->addWidget( m_xmlLogButton, row++, 5 ); + + gridLayout->addWidget( m_stylesheetCheckBox, row, 3 ); + gridLayout->addWidget( m_stylesheetLineEdit, row, 4 ); + gridLayout->addWidget( m_stylesheetButton, row++, 5 ); + byte rowBlock2 = row; + + gridLayout->setColStretch( 0, 5 ); + gridLayout->setColStretch( 2, 5 ); + gridLayout->setColStretch( 4, 10 ); + gridLayout->setColStretch( 6, 5 ); + + gridLayout->setRowStretch( 0, 10 ); + gridLayout->setRowStretch( _max_( rowBlock1, rowBlock2 ), 10 ); +} + +// finaliseInitialisation +// ====================== + +void LoggingOptions::finaliseInitialisation( ) +{ WhatsThis* whatsThis = new WhatsThis( this ); + + connect( m_baseFileNameButton, SIGNAL( clicked( )), SLOT( slotBaseFileNameButtonClicked( ))); + connect( m_baseFileNameCheckBox, SIGNAL( clicked( )), SLOT( slotBaseFileNameCheckBoxClicked( ))); + connect( m_grepableLogButton, SIGNAL( clicked( )), SLOT( slotGrepableLogButtonClicked( ))); + connect( m_grepableLogCheckBox, SIGNAL( clicked( )), SLOT( slotGrepableLogCheckBoxClicked( ))); + connect( m_normalLogButton, SIGNAL( clicked( )), SLOT( slotNormalLogButtonClicked( ))); + connect( m_normalLogCheckBox, SIGNAL( clicked( )), SLOT( slotNormalLogCheckBoxClicked( ))); + connect( m_noStylesheetCheckBox, SIGNAL( clicked( )), SLOT( slotNoStylesheetCheckBoxClicked( ))); + connect( m_resumeButton, SIGNAL( clicked( )), SLOT( slotResumeButtonClicked( ))); + connect( m_resumeCheckBox, SIGNAL( clicked( )), SLOT( slotResumeCheckBoxClicked( ))); + connect( m_scriptKiddieButton, SIGNAL( clicked( )), SLOT( slotScriptKiddieButtonClicked( ))); + connect( m_scriptKiddieCheckBox, SIGNAL( clicked( )), SLOT( slotScriptKiddieCheckBoxClicked( ))); + connect( m_stylesheetButton, SIGNAL( clicked( )), SLOT( slotStylesheetButtonClicked( ))); + connect( m_stylesheetCheckBox, SIGNAL( clicked( )), SLOT( slotStylesheetCheckBoxClicked( ))); + connect( whatsThis, SIGNAL( clicked( )), SLOT( slotWhatsThisClicked( ))); + connect( m_xmlLogButton, SIGNAL( clicked( )), SLOT( slotXMLLogButtonClicked( ))); + connect( m_xmlLogCheckBox, SIGNAL( clicked( )), SLOT( slotXMLLogCheckBoxClicked( ))); + + connect( m_appendOutputCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_baseFileNameCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_baseFileNameLineEdit, SIGNAL( textChanged( const QString& )), SIGNAL( optionsDirty( ))); + connect( m_grepableLogCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_grepableLogLineEdit, SIGNAL( textChanged( const QString& )), SIGNAL( optionsDirty( ))); + connect( m_normalLogCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_normalLogLineEdit, SIGNAL( textChanged( const QString& )), SIGNAL( optionsDirty( ))); + connect( m_resumeCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_resumeLineEdit, SIGNAL( textChanged( const QString& )), SIGNAL( optionsDirty( ))); + connect( m_scriptKiddieCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_scriptKiddieLineEdit, SIGNAL( textChanged( const QString& )), SIGNAL( optionsDirty( ))); + connect( m_stylesheetCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_stylesheetLineEdit, SIGNAL( textChanged( const QString& )), SIGNAL( optionsDirty( ))); + connect( m_xmlLogCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_xmlLogLineEdit, SIGNAL( textChanged( const QString& )), SIGNAL( optionsDirty( ))); +} + +// getOptions +// ========== + +bool LoggingOptions::getOptions( ) +{ bool baseFileNameState = m_baseFileNameCheckBox->isChecked( ); + QString baseFileNameValue = m_baseFileNameLineEdit->text( ); + bool grepableLogState = m_grepableLogCheckBox->isChecked( ); + QString grepableLogValue = m_grepableLogLineEdit->text( ); + bool normalLogState = m_normalLogCheckBox->isChecked( ); + QString normalLogValue = m_normalLogLineEdit->text( ); + bool resumeState = m_resumeCheckBox->isChecked( ); + QString resumeValue = m_resumeLineEdit->text( ); + bool scriptKiddieState = m_scriptKiddieCheckBox->isChecked( ); + QString scriptKiddieValue = m_scriptKiddieLineEdit->text( ); + bool stylesheetState = m_stylesheetCheckBox->isChecked( ); + QString stylesheetValue = m_stylesheetLineEdit->text( ); + bool xmlLogState = m_xmlLogCheckBox->isChecked( ); + QString xmlLogValue = m_xmlLogLineEdit->text( ); + + if( baseFileNameState && baseFileNameValue.isEmpty( )) + { KMessageBox::error( this, i18n( QString( "Base file name not specified" )), i18n( "Base file name error" )); + return false; + } + + if( grepableLogState && grepableLogValue.isEmpty( )) + { KMessageBox::error( this, i18n( QString( "grep'able log file name not specified" )), i18n( "grep'able log file name error" )); + return false; + } + + if( normalLogState && normalLogValue.isEmpty( )) + { KMessageBox::error( this, i18n( QString( "Normal log file name not specified" )), i18n( "Normal log file name error" )); + return false; + } + + if( resumeState && scriptKiddieValue.isEmpty( )) + { KMessageBox::error( this, i18n( QString( "Resume file name not specified" )), i18n( "Resume file name error" )); + return false; + } + + if( scriptKiddieState && scriptKiddieValue.isEmpty( )) + { KMessageBox::error( this, i18n( QString( "Script kiddie log file name not specified" )), i18n( "Script kiddie log file name error" )); + return false; + } + + if( stylesheetState && stylesheetValue.isEmpty( )) + { KMessageBox::error( this, i18n( QString( "XSL stylesheet file name not specified" )), i18n( "XSL stylesheet file name error" )); + return false; + } + + if( xmlLogState && xmlLogValue.isEmpty( )) + { KMessageBox::error( this, i18n( QString( "XML log file name not specified" )), i18n( "XML log file name error" )); + return false; + } + + m_appendOutputState = m_appendOutputCheckBox->isChecked( ); + m_baseFileNameState = baseFileNameState; + m_baseFileNameValue = baseFileNameValue; + m_grepableLogState = grepableLogState; + m_grepableLogValue = grepableLogValue; + m_normalLogState = normalLogState; + m_normalLogValue = normalLogValue; + m_noStylesheetState = m_noStylesheetCheckBox->isChecked( ); + m_resumeValue = resumeValue; + m_scriptKiddieState = scriptKiddieState; + m_scriptKiddieValue = scriptKiddieValue; + m_stylesheetState = stylesheetState; + m_stylesheetValue = stylesheetValue; + m_xmlLogState = xmlLogState; + m_xmlLogValue = xmlLogValue; + + return true; +} + +// readProfile +// =========== + +void LoggingOptions::readProfile( KConfig* config ) +{ m_appendOutputState = config->readBoolEntry( "appendOutputState" ); + m_baseFileNameState = config->readBoolEntry( "baseFileNameState" ); + m_baseFileNameValue = config->readEntry( "baseFileNameValue" ); + m_grepableLogState = config->readBoolEntry( "grepableLogState" ); + m_grepableLogValue = config->readEntry( "grepableLogValue" ); + m_normalLogState = config->readBoolEntry( "normalLogState" ); + m_normalLogValue = config->readEntry( "normalLogValue" ); + m_noStylesheetState = config->readBoolEntry( "noStylesheetState" ); + m_resumeState = config->readBoolEntry( "resumeState" ); + m_resumeValue = config->readEntry( "resumeValue" ); + m_scriptKiddieState = config->readBoolEntry( "scriptKiddieState" ); + m_scriptKiddieValue = config->readEntry( "scriptKiddieValue" ); + m_stylesheetState = config->readBoolEntry( "stylesheetState" ); + m_stylesheetValue = config->readEntry( "stylesheetValue" ); + m_xmlLogState = config->readBoolEntry( "xmlLogState" ); + m_xmlLogValue = config->readEntry( "xmlLogValue" ); +} + +// saveProfile +// =========== + +void LoggingOptions::saveProfile( KConfig* config ) +{ config->writeEntry( "appendOutputState", m_appendOutputState ); + config->writeEntry( "baseFileNameState", m_baseFileNameState ); + config->writeEntry( "baseFileNameValue", m_baseFileNameValue ); + config->writeEntry( "grepableLogState", m_grepableLogState ); + config->writeEntry( "grepableLogValue", m_grepableLogValue ); + config->writeEntry( "normalLogState", m_normalLogState ); + config->writeEntry( "normalLogValue", m_normalLogValue ); + config->writeEntry( "noStylesheetState", m_noStylesheetState ); + config->writeEntry( "resumeState", m_resumeState ); + config->writeEntry( "resumeValue", m_resumeValue ); + config->writeEntry( "scriptKiddieState", m_scriptKiddieState ); + config->writeEntry( "scriptKiddieValue", m_scriptKiddieValue ); + config->writeEntry( "stylesheetState", m_stylesheetState ); + config->writeEntry( "stylesheetValue", m_stylesheetValue ); + config->writeEntry( "xmlLogState", m_xmlLogState ); + config->writeEntry( "xmlLogValue", m_xmlLogValue ); +} + +// setInitialValues +// ================ + +void LoggingOptions::setInitialValues( ) +{ m_appendOutputCheckBox->setChecked( m_appendOutputState ); + m_baseFileNameCheckBox->setChecked( m_baseFileNameState ); + m_baseFileNameLineEdit->setText( m_baseFileNameValue ); + m_grepableLogCheckBox->setChecked( m_grepableLogState ); + m_grepableLogLineEdit->setText( m_grepableLogValue ); + m_normalLogCheckBox->setChecked( m_normalLogState ); + m_normalLogLineEdit->setText( m_normalLogValue ); + m_noStylesheetCheckBox->setChecked( m_noStylesheetState ); + m_resumeCheckBox->setChecked( m_resumeState ); + m_resumeLineEdit->setText( m_resumeValue ); + m_scriptKiddieCheckBox->setChecked( m_scriptKiddieState ); + m_scriptKiddieLineEdit->setText( m_scriptKiddieValue ); + m_stylesheetCheckBox->setChecked( m_stylesheetState ); + m_stylesheetLineEdit->setText( m_stylesheetValue ); + m_xmlLogCheckBox->setChecked( m_xmlLogState ); + m_xmlLogLineEdit->setText( m_xmlLogValue ); + + slotBaseFileNameCheckBoxClicked( ); + slotGrepableLogCheckBoxClicked( ); + slotNormalLogCheckBoxClicked( ); + slotResumeCheckBoxClicked( ); + slotScriptKiddieCheckBoxClicked( ); + slotStylesheetCheckBoxClicked( ); + slotXMLLogCheckBoxClicked( ); +} + +// slotBaseFileNameButtonClicked +// ============================= + +void LoggingOptions::slotBaseFileNameButtonClicked( ) +{ Knmap::getFilePath( "Base file name", m_baseFileNameValue, m_baseFileNameLineEdit, false ); +} + +// slotBaseFileNameCheckBoxClicked +// =============================== + +void LoggingOptions::slotBaseFileNameCheckBoxClicked( ) +{ m_baseFileNameButton->setEnabled( m_baseFileNameCheckBox->isChecked( )); + m_baseFileNameLineEdit->setEnabled( m_baseFileNameCheckBox->isChecked( )); +} + +// slotGrepableLogButtonClicked +// ============================ + +void LoggingOptions::slotGrepableLogButtonClicked( ) +{ Knmap::getFilePath( "grep'able log file", m_grepableLogValue, m_grepableLogLineEdit, true ); +} + +// slotGrepableLogCheckBoxClicked +// ============================== + +void LoggingOptions::slotGrepableLogCheckBoxClicked( ) +{ m_grepableLogButton->setEnabled( m_grepableLogCheckBox->isChecked( )); + m_grepableLogLineEdit->setEnabled( m_grepableLogCheckBox->isChecked( )); +} + +// slotNormalLogButtonClicked +// ========================== + +void LoggingOptions::slotNormalLogButtonClicked( ) +{ Knmap::getFilePath( "Normal log file", m_normalLogValue, m_normalLogLineEdit, true ); +} + +// slotNormalLogCheckBoxClicked +// ============================ + +void LoggingOptions::slotNormalLogCheckBoxClicked( ) +{ m_normalLogButton->setEnabled( m_normalLogCheckBox->isChecked( )); + m_normalLogLineEdit->setEnabled( m_normalLogCheckBox->isChecked( )); +} + +// slotNoStylesheetCheckBoxClicked +// =============================== + +void LoggingOptions::slotNoStylesheetCheckBoxClicked( ) +{ if( m_noStylesheetCheckBox->isChecked( )) + { m_stylesheetCheckBox->setChecked( false ); + slotStylesheetCheckBoxClicked( ); + } +} + +// slotResumeButtonClicked +// ======================= + +void LoggingOptions::slotResumeButtonClicked( ) +{ Knmap::getFilePath( "Resume file", m_resumeValue, m_resumeLineEdit, false ); +} + +// slotResumeCheckBoxClicked +// ========================= + +void LoggingOptions::slotResumeCheckBoxClicked( ) +{ m_resumeButton->setEnabled( m_resumeCheckBox->isChecked( )); + m_resumeLineEdit->setEnabled( m_resumeCheckBox->isChecked( )); +} + +// slotScriptKiddieButtonClicked +// ============================= + +void LoggingOptions::slotScriptKiddieButtonClicked( ) +{ Knmap::getFilePath( "Script kiddie log file", m_scriptKiddieValue, m_scriptKiddieLineEdit, true ); +} + +// slotScriptKiddieCheckBoxClicked +// =============================== + +void LoggingOptions::slotScriptKiddieCheckBoxClicked( ) +{ m_scriptKiddieButton->setEnabled( m_scriptKiddieCheckBox->isChecked( )); + m_scriptKiddieLineEdit->setEnabled( m_scriptKiddieCheckBox->isChecked( )); +} + +// slotStylesheetButtonClicked +// =========================== + +void LoggingOptions::slotStylesheetButtonClicked( ) +{ Knmap::getFilePath( "Stylesheet file", m_stylesheetValue, m_stylesheetLineEdit, false ); +} + +// slotStylesheetCheckBoxClicked +// ============================= + +void LoggingOptions::slotStylesheetCheckBoxClicked( ) +{ m_stylesheetButton->setEnabled( m_stylesheetCheckBox->isChecked( )); + m_stylesheetLineEdit->setEnabled( m_stylesheetCheckBox->isChecked( )); + + if( m_stylesheetCheckBox->isChecked( )) + m_noStylesheetCheckBox->setChecked( false ); +} + +// slotWhatsThisClicked +// ==================== + +void LoggingOptions::slotWhatsThisClicked( ) +{ if( m_appendOutputCheckBox->hasMouse( )) emit( displayHelp( "--append_output" )); + else if( m_baseFileNameButton->hasMouse( )) emit( displayHelp( "-oA" )); + else if( m_baseFileNameCheckBox->hasMouse( )) emit( displayHelp( "-oA" )); + else if( m_baseFileNameLineEdit->hasMouse( )) emit( displayHelp( "-oA" )); + else if( m_grepableLogButton->hasMouse( )) emit( displayHelp( "-oG" )); + else if( m_grepableLogCheckBox->hasMouse( )) emit( displayHelp( "-oG" )); + else if( m_grepableLogLineEdit->hasMouse( )) emit( displayHelp( "-oG" )); + else if( m_normalLogButton->hasMouse( )) emit( displayHelp( "-oN" )); + else if( m_normalLogCheckBox->hasMouse( )) emit( displayHelp( "-oN" )); + else if( m_normalLogLineEdit->hasMouse( )) emit( displayHelp( "-oN" )); + else if( m_noStylesheetCheckBox->hasMouse( )) emit( displayHelp( "--no_stylesheet" )); + else if( m_resumeButton->hasMouse( )) emit( displayHelp( "--resume" )); + else if( m_resumeCheckBox->hasMouse( )) emit( displayHelp( "--resume" )); + else if( m_resumeLineEdit->hasMouse( )) emit( displayHelp( "--resume" )); + else if( m_scriptKiddieButton->hasMouse( )) emit( displayHelp( "-oS" )); + else if( m_scriptKiddieCheckBox->hasMouse( )) emit( displayHelp( "-oS" )); + else if( m_scriptKiddieLineEdit->hasMouse( )) emit( displayHelp( "-oS" )); + else if( m_stylesheetButton->hasMouse( )) emit( displayHelp( "--stylesheet" )); + else if( m_stylesheetCheckBox->hasMouse( )) emit( displayHelp( "--stylesheet" )); + else if( m_stylesheetLineEdit->hasMouse( )) emit( displayHelp( "--stylesheet" )); + else if( m_xmlLogButton->hasMouse( )) emit( displayHelp( "-oX" )); + else if( m_xmlLogCheckBox->hasMouse( )) emit( displayHelp( "-oX" )); + else if( m_xmlLogLineEdit->hasMouse( )) emit( displayHelp( "-oX" )); + else emit( displayUnknown( )); +} + +// slotXMLLogButtonClicked +// ======================= + +void LoggingOptions::slotXMLLogButtonClicked( ) +{ Knmap::getFilePath( "XML log file", m_xmlLogValue, m_xmlLogLineEdit, true ); +} + +// slotXMLLogCheckBoxClicked +// ========================= + +void LoggingOptions::slotXMLLogCheckBoxClicked( ) +{ m_xmlLogButton->setEnabled( m_xmlLogCheckBox->isChecked( )); + m_xmlLogLineEdit->setEnabled( m_xmlLogCheckBox->isChecked( )); +} diff --git a/src/loggingoptions.h b/src/loggingoptions.h new file mode 100644 index 0000000..3260df4 --- /dev/null +++ b/src/loggingoptions.h @@ -0,0 +1,141 @@ +/*************************************************************************** + * * + * Copyright (C) 2005, 2006 by Kevin Gilbert * + * [email protected] * + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef _LOGGINGOPTIONS_ +#define _LOGGINGOPTIONS_ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <qwidget.h> +#include "global.h" + +// forward class definitions +// ========================= + +class QCheckBox; +class QLineEdit; +class QPushButton; +class KConfig; + +// LoggingOptions class definition +// =============================== + +class LoggingOptions : public QWidget +{ Q_OBJECT + + public: + LoggingOptions( QWidget* parent, const char* name = NULL ); + + void finaliseInitialisation( ); + bool getOptions( ); + void readProfile( KConfig* config ); + void saveProfile( KConfig* config ); + void setInitialValues( ); + + bool appendOutputState( ) const { return m_appendOutputState; } + bool baseFileNameState( ) const { return m_baseFileNameState; } + QString baseFileNameValue( ) const { return m_baseFileNameValue; } + bool grepableLogState( ) const { return m_grepableLogState; } + QString grepableLogValue( ) const { return m_grepableLogValue; } + bool normalLogState( ) const { return m_normalLogState; } + QString normalLogValue( ) const { return m_normalLogValue; } + bool noStylesheetState( ) const { return m_noStylesheetState; } + bool resumeState( ) const { return m_resumeState; } + QString resumeValue( ) const { return m_resumeValue; } + bool scriptKiddieState( ) const { return m_scriptKiddieState; } + QString scriptKiddieValue( ) const { return m_scriptKiddieValue; } + bool stylesheetState( ) const { return m_stylesheetState; } + QString stylesheetValue( ) const { return m_stylesheetValue; } + bool xmlLogState( ) const { return m_xmlLogState; } + QString xmlLogValue( ) const { return m_xmlLogValue; } + + signals: + void displayDocBook( const QString& ); + void displayHelp( const QString& ); + void displayUnknown( ); + void optionsDirty( ); + + private slots: + void slotBaseFileNameButtonClicked( ); + void slotBaseFileNameCheckBoxClicked( ); + void slotGrepableLogButtonClicked( ); + void slotGrepableLogCheckBoxClicked( ); + void slotNormalLogButtonClicked( ); + void slotNormalLogCheckBoxClicked( ); + void slotNoStylesheetCheckBoxClicked( ); + void slotResumeButtonClicked( ); + void slotResumeCheckBoxClicked( ); + void slotScriptKiddieButtonClicked( ); + void slotScriptKiddieCheckBoxClicked( ); + void slotStylesheetButtonClicked( ); + void slotStylesheetCheckBoxClicked( ); + void slotWhatsThisClicked( ); + void slotXMLLogButtonClicked( ); + void slotXMLLogCheckBoxClicked( ); + + private: + void createLayout( ); + + QCheckBox* m_appendOutputCheckBox; + bool m_appendOutputState; + QPushButton* m_baseFileNameButton; + QCheckBox* m_baseFileNameCheckBox; + QLineEdit* m_baseFileNameLineEdit; + bool m_baseFileNameState; + QString m_baseFileNameValue; + QPushButton* m_grepableLogButton; + QCheckBox* m_grepableLogCheckBox; + QLineEdit* m_grepableLogLineEdit; + bool m_grepableLogState; + QString m_grepableLogValue; + QPushButton* m_normalLogButton; + QCheckBox* m_normalLogCheckBox; + QLineEdit* m_normalLogLineEdit; + bool m_normalLogState; + QString m_normalLogValue; + QCheckBox* m_noStylesheetCheckBox; + bool m_noStylesheetState; + QPushButton* m_resumeButton; + QCheckBox* m_resumeCheckBox; + QLineEdit* m_resumeLineEdit; + bool m_resumeState; + QString m_resumeValue; + QPushButton* m_scriptKiddieButton; + QCheckBox* m_scriptKiddieCheckBox; + QLineEdit* m_scriptKiddieLineEdit; + bool m_scriptKiddieState; + QString m_scriptKiddieValue; + QPushButton* m_stylesheetButton; + QCheckBox* m_stylesheetCheckBox; + QLineEdit* m_stylesheetLineEdit; + bool m_stylesheetState; + QString m_stylesheetValue; + QPushButton* m_xmlLogButton; + QCheckBox* m_xmlLogCheckBox; + QLineEdit* m_xmlLogLineEdit; + bool m_xmlLogState; + QString m_xmlLogValue; +}; + +#endif // _LOGGINGOPTIONS_ diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..8552d86 --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,78 @@ +/*************************************************************************** + * * + * Copyright (C) 2005, 2006 by Kevin Gilbert * + * [email protected] * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + ***************************************************************************/ + +#include <kaboutdata.h> +#include <kapplication.h> +#include <kcmdlineargs.h> +#include <kdebug.h> +#include <klocale.h> + +#include "global.h" +#include "knmap.h" + +static const char description[] = I18N_NOOP( "A KDE frontend for nmap" ); +static KCmdLineOptions options[] = { KCmdLineLastOption }; + +// main +// ==== + +int main( int argc, string argv[]) +{ QString version = QString( "Version 2.1, %1 %2" ).arg( __TIME__ ).arg( __DATE__ ); + KAboutData about( "knmap", + I18N_NOOP( "Knmap" ), + version, + description, + KAboutData::License_GPL, + "(C) 2005, 2006 Kevin Gilbert", + I18N_NOOP( "This program is a complete re-write of one by the same name written by Alexandre\n" + "Sagala. The last version of that program was 0.9 which was released on 2003-03-09\n" + "and targeted the KDE 2.2 and QT 2.3 environments. Unfortunately it does not compile\n" + "on today's KDE / QT environments.\n" + "\n" + "Not to mention that it did not cater for the full set of 'nmap' options. Or, perhaps,\n" + "'nmap' progressed whilst that version of Knmap languished.\n" + "\n" + "The icons used for this application are from the Open Clip Art Library. I am indebted\n" + "to those damn fine folk as my artistic ability is zero - which is marginally above\n" + "my programming ability. :-(" ), + "http://informatics.cdu.edu.au/staff/kgilbert" ); + about.addAuthor( "Kevin Gilbert", + "Initial rewrite released as version 1.0\nVersions 2.0, 2.1", + "[email protected]", + "http://informatics.cdu.edu.au/staff/kgilbert" ); + KCmdLineArgs::init( argc, argv, &about ); + KCmdLineArgs::addCmdLineOptions( options ); + KApplication app; + + if( app.isRestored( )) + { RESTORE( Knmap ); + } + else + { KCmdLineArgs* args = KCmdLineArgs::parsedArgs( ); + Knmap* mainWin = new Knmap; + app.setMainWidget( mainWin ); + mainWin->show( ); + args->clear( ); + } + + return app.exec( ); +} diff --git a/src/mainwidget.cpp b/src/mainwidget.cpp new file mode 100644 index 0000000..8cf44ba --- /dev/null +++ b/src/mainwidget.cpp @@ -0,0 +1,463 @@ +/*************************************************************************** + * * + * Copyright (C) 2005, 2006 by Kevin Gilbert * + * [email protected] * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + ***************************************************************************/ + +#include <qtimer.h> + +#include <kapplication.h> +#include <kconfig.h> +#include <kdebug.h> +#include <kinputdialog.h> +#include <klocale.h> +#include <kmessagebox.h> + +#include "htmlwidget.h" +#include "indexwidget.h" +#include "knmap.h" +#include "mainwidget.h" +#include "scannamedialog.h" +#include "scanstack.h" +#include "scanwidget.h" + +// constructor +// =========== + +MainWidget::MainWidget( QWidget* parent, const char* name ) +: QSplitter( parent, name ), + m_dirty( false ), + m_wrapText( false ) +{ m_scanStack = new ScanStack( this, "scan stack" ); + m_htmlWidget = new HTMLWidget( &m_stylesheetURLs, this, "html widget" ); + m_indexWidget = new IndexWidget( m_scanStack, this, "index widget" ); + + moveToFirst( m_indexWidget ); + m_scanStack->appendHTMLWidget( m_htmlWidget ); + setOpaqueResize( true ); + QTimer::singleShot( 0, this, SLOT( slotFinaliseInitialisation( ))); + + connect( m_htmlWidget, + SIGNAL( errorLoadingLocalManPage( const QString& )), + SLOT( slotErrorLoadingLocalManPage( const QString& ))); + + connect( m_indexWidget, + SIGNAL( visibleScanWidgetChanged( ScanWidget* )), + SLOT( slotVisibleScanWidgetChanged( ScanWidget* ))); +} + +// createScan +// ========== + +ScanWidget* MainWidget::createScan( const QString& scanName, const bool useTargetHost, const QString& profileName ) +{ ScanWidget* scanWidget = new ScanWidget( scanName, useTargetHost, this, "scan widget" ); + + m_scanStack->appendAndRaiseWidget( scanWidget ); + m_scanStack->wrapText( m_wrapText ); + + if( profileName == QString::null ) + scanWidget->readSettings( ); + else + scanWidget->setProfileName( profileName ); + + connect( scanWidget, + SIGNAL( displayHelp( const QString& )), + SLOT( slotDisplayHelp( const QString& ))); + + connect( scanWidget, + SIGNAL( optionsDirty( )), + SLOT( slotOptionsDirty( ))); + + connect( scanWidget, + SIGNAL( outputAvailable( const bool, const bool )), + SIGNAL( outputAvailable( const bool, const bool ))); + + connect( scanWidget, + SIGNAL( scanRename( const QString& )), + SLOT( slotScanRename( const QString& ))); + + connect( scanWidget, + SIGNAL( scanStarted( )), + m_indexWidget, + SLOT( slotScanStarted( ))); + + connect( scanWidget, + SIGNAL( scanStopped( ScanWidget* )), + m_indexWidget, + SLOT( slotScanStopped( ScanWidget* ))); + + connect( scanWidget, + SIGNAL( statusBarText( const QString& )), + SIGNAL( statusBarText( const QString& ))); + + return scanWidget; +} + +// loadManPage +// =========== + +void MainWidget::loadManPage( ) +{ m_htmlWidget->loadManPage( m_useLocalManPage ); +} + +// readSettings +// ============ + +void MainWidget::readSettings( ) +{ m_htmlWidget->readSettings( ); + + KConfig* config = kapp->config( ); + config->setGroup( "General" ); + + m_stylesheetURLs = config->readListEntry( "stylesheetURLs" ); + m_useLocalManPage = config->readBoolEntry( "useLocalManPage", false ); + m_wrapText = config->readBoolEntry( "wrapText", false ); + + QValueList<int> splitterSizes = config->readIntListEntry( "splitterSizes" ); + setSizes( splitterSizes ); + QStringList scanNames = config->readListEntry( "scanNames" ); + + if( !scanNames.count( )) + scanNames.append( "default" ); + + QString visibleScanName = config->readEntry( "visibleScan", QString::null ); + ScanWidget* visibleScanWidget = NULL; + + for( QStringList::Iterator it = scanNames.begin( ); it != scanNames.end(); ++it ) + { ScanWidget* scanWidget = createScan( *it, false, QString::null ); + + if( visibleScanName == scanWidget->scanName( )) + visibleScanWidget = scanWidget; + } + + if( visibleScanWidget == NULL ) + { visibleScanWidget = m_scanStack->firstScanWidget( ); + + if( visibleScanWidget == NULL ) + { KMessageBox::error( this, i18n( "Internal error - no ScanWidget to display!" ), i18n( "Internal error" )); + kapp->quit( ); + } + } + + m_scanStack->raiseWidget( visibleScanWidget ); +} + +// saveAllDirtyProfiles +// ==================== + +void MainWidget::saveAllDirtyProfiles( ) +{ ushort i; + + for( m_scanStack->resetScanWidgets( i ); m_scanStack->moreScanWidgets( i ); m_scanStack->nextScanWidget( i )) + { ScanWidget* scanWidget = m_scanStack->currentScanWidget( i ); + + if( scanWidget->isDirty( )) + scanWidget->profileSave( ); + } +} + +// saveSettings +// ============ + +void MainWidget::saveSettings( ) +{ m_htmlWidget->saveSettings( ); + + ushort i; + QStringList scanNames; + + for( m_scanStack->resetScanWidgets( i ); m_scanStack->moreScanWidgets( i ); m_scanStack->nextScanWidget( i )) + { ScanWidget* scanWidget = m_scanStack->currentScanWidget( i ); + scanNames.append( scanWidget->scanName( )); + scanWidget->saveSettings( ); + } + + QValueList<int> splitterSizes = sizes( ); + KConfig* config = kapp->config( ); + + config->setGroup( "General" ); + config->writeEntry( "scanNames", scanNames ); + config->writeEntry( "splitterSizes", splitterSizes ); + config->writeEntry( "stylesheetURLs", m_stylesheetURLs ); + config->writeEntry( "useLocalManPage", m_useLocalManPage ); + config->writeEntry( "visibleScan", m_scanStack->visibleWidget( )->scanName( )); + config->writeEntry( "wrapText", m_wrapText ); +} + +// setCaption +// ========== + +void MainWidget::setCaption( ScanWidget* scanWidget ) +{ QString profileName = scanWidget->profileName( ); + profileName = profileName.right( profileName.length( ) - strlen( PROFILE_PREFIX )); + emit( setCaption( scanWidget->scanName( ) + " : " + profileName )); +} + +// slotDisplayHelp +// =============== + +void MainWidget::slotDisplayHelp( const QString& anchor ) +{ slotShowManPage( ); + m_htmlWidget->gotoAnchor( anchor ); +} + +// slotErrorLoadingLocalManPage +// ============================ + +void MainWidget::slotErrorLoadingLocalManPage( const QString& errorText ) +{ KMessageBox::sorry( this, errorText + "\nLoading the Knmap version.", "Couldn't load local nmap 'man' page" ); + slotSwitchManPages( ); +} + +// slotFileSave +// ============ + +void MainWidget::slotFileSave( ) +{ m_scanStack->visibleWidget( )->fileSave( ); +} + +// slotFileSaveAs +// ============== + +void MainWidget::slotFileSaveAs( ) +{ m_scanStack->visibleWidget( )->fileSaveAs( ); +} + +// slotFinaliseInitialisation +// ========================== + +void MainWidget::slotFinaliseInitialisation( ) +{ m_indexWidget->ensureCurrentVisible( ); + slotVisibleScanWidgetChanged( m_scanStack->visibleWidget( )); + loadManPage( ); + emit( setManPageActionStuff( m_useLocalManPage )); +} + +// slotOptionsDirty +// ================ + +void MainWidget::slotOptionsDirty( ) +{ m_dirty = false; + ushort i; + + for( m_scanStack->resetScanWidgets( i ); m_scanStack->moreScanWidgets( i ); m_scanStack->nextScanWidget( i )) + m_dirty |= m_scanStack->currentScanWidget( i )->isDirty( ); +} + +// slotProfileCopy +// =============== + +void MainWidget::slotProfileCopy( ) +{ m_scanStack->visibleWidget( )->profileCopy( ); +} + +// slotProfileDelete +// ================= + +void MainWidget::slotProfileDelete( ) +{ m_scanStack->visibleWidget( )->profileDelete( ); +} + +// slotProfileLoad +// =============== + +void MainWidget::slotProfileLoad( ) +{ ScanWidget* scanWidget = m_scanStack->visibleWidget( ); + scanWidget->profileLoad( ); + setCaption( scanWidget ); +} + +// slotProfileRename +// ================= + +void MainWidget::slotProfileRename( ) +{ m_scanStack->visibleWidget( )->profileRename( ); +} + +// slotProfileSave +// =============== + +void MainWidget::slotProfileSave( ) +{ m_scanStack->visibleWidget( )->profileSave( ); +} + +// slotProfileSaveAs +// ================= + +void MainWidget::slotProfileSaveAs( ) +{ ScanWidget* scanWidget = m_scanStack->visibleWidget( ); + scanWidget->profileSaveAs( ); + setCaption( scanWidget ); +} + +// slotScanClose +// ============= + +void MainWidget::slotScanClose( ) +{ ScanWidget* scanWidget = m_scanStack->visibleWidget( ); + scanWidget->profileAskAndSave( ); + m_scanStack->removeScanWidget( scanWidget ); + m_indexWidget->updateContents( ); + slotOptionsDirty( ); +} + +// slotScanDuplicate +// ================= + +void MainWidget::slotScanDuplicate( ) +{ ScanWidget* scanWidget = m_scanStack->visibleWidget( ); + scanWidget = createScan( scanWidget->scanName( ), scanWidget->useTargetHost( ), scanWidget->profileName( )); + slotVisibleScanWidgetChanged( scanWidget ); +} + +// slotScanNew +// =========== + +void MainWidget::slotScanNew( ) +{ ScanNameDialog dlg( NULL, this, "scan name dlg" ); + + if( dlg.exec( ) != QDialog::Accepted ) + return; + + QString scanName; + bool useTargetHost; + + if( dlg.useHostName( )) + { scanName = DEFAULT_SCAN_NAME; + useTargetHost = true; + } + else + { scanName = dlg.scanName( ); + useTargetHost = false; + } + + ScanWidget* scanWidget = createScan( scanName, useTargetHost, DEFAULT_PROFILE ); + slotVisibleScanWidgetChanged( scanWidget ); +} + +// slotScanRename +// ============== + +void MainWidget::slotScanRename( ) +{ ScanWidget* scanWidget = m_scanStack->visibleWidget( ); + ScanNameDialog dlg( scanWidget, this, "scan name dlg" ); + + if( dlg.exec( ) != QDialog::Accepted ) + return; + + if( dlg.useHostName( )) + { slotScanRename( DEFAULT_SCAN_NAME ); + scanWidget->useTargetHost( true ); + } + else + { slotScanRename( dlg.scanName( )); + scanWidget->useTargetHost( false ); + } +} + +// slotScanRename +// ============== + +void MainWidget::slotScanRename( const QString& scanName ) +{ ScanWidget* scanWidget = m_scanStack->visibleWidget( ); + + scanWidget->renameScan( scanName ); + m_indexWidget->updateContents( ); + setCaption( scanWidget ); +} + +// slotShowManPage +// =============== + +void MainWidget::slotShowManPage( ) +{ m_scanStack->raiseWidget( m_htmlWidget ); +} + +// slotSetStylesheet +// ================= + +void MainWidget::slotSetStylesheet( ) +{ m_htmlWidget->setStylesheet( ); +} + +// slotSwitchManPages +// ================== + +void MainWidget::slotSwitchManPages( ) +{ m_useLocalManPage = !m_useLocalManPage; + loadManPage( ); + emit( setManPageActionStuff( m_useLocalManPage )); +} + +// slotUseTargetHost +// ================= + +void MainWidget::slotUseTargetHost( ) +{ m_scanStack->visibleWidget( )->useTargetHost( true ); +} + +// slotVisibleScanWidgetChanged +// ============================ + +void MainWidget::slotVisibleScanWidgetChanged( ScanWidget* scanWidget ) +{ scanWidget->updateStatusBarText( ); + setCaption( scanWidget ); + m_indexWidget->updateContents( ); + emit( visibleScanWidgetChanged( scanWidget )); +} + +// slotWrapText +// ============ + +void MainWidget::slotWrapText( ) +{ m_wrapText = !m_wrapText; + m_scanStack->wrapText( m_wrapText ); +} + +// slotZoomCustom +// ============== + +void MainWidget::slotZoomCustom( ) +{ bool ok; + int zoom = KInputDialog::getInteger( i18n( "Zoom percentage" ), + i18n( QString( "Enter zoom %'age (%1% - %2%)").arg( ZOOM_MIN_FACTOR ).arg( ZOOM_MAX_FACTOR)), + int( m_htmlWidget->zoomFactor( )), + ZOOM_MIN_FACTOR, + ZOOM_MAX_FACTOR, + 10, + &ok, + NULL, + "zoom" ); + + if( ok ) + m_htmlWidget->zoomFactor( zoom ); +} + +// slotZoomIn +// ========== + +void MainWidget::slotZoomIn( ) +{ m_htmlWidget->zoomIn( ); +} + +// slotZoomOut +// =========== + +void MainWidget::slotZoomOut( ) +{ m_htmlWidget->zoomOut( ); +} diff --git a/src/mainwidget.h b/src/mainwidget.h new file mode 100644 index 0000000..985a46c --- /dev/null +++ b/src/mainwidget.h @@ -0,0 +1,111 @@ +/*************************************************************************** + * * + * Copyright (C) 2005, 2006 by Kevin Gilbert * + * [email protected] * + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef _MAINWIDGET_H_ +#define _MAINWIDGET_H_ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <qsplitter.h> +#include <qstringlist.h> + +#include "global.h" + +// forward class definitions +// ========================= + +class HTMLWidget; +class IndexWidget; +class KConfig; +class ScanStack; +class ScanWidget; + +// MainWidget class definition +// =========================== + +class MainWidget : public QSplitter +{ Q_OBJECT + + public: + MainWidget( QWidget* parent = NULL, const char* name = NULL ); + + bool isDirty( ) const { return m_dirty; } + void readSettings( ); + void saveAllDirtyProfiles( ); + void saveSettings( ); + bool wrapText( ) const { return m_wrapText; } + + signals: + void displayHelp( const QString& ); + void outputAvailable( const bool, const bool ); + void setManPageActionStuff( const bool ); + void setCaption( const QString& ); + void statusBarText( const QString& ); + void visibleScanWidgetChanged( ScanWidget* ); + + public slots: + void slotFileSave( ); + void slotFileSaveAs( ); + void slotProfileCopy( ); + void slotProfileDelete( ); + void slotProfileLoad( ); + void slotProfileRename( ); + void slotProfileSave( ); + void slotProfileSaveAs( ); + void slotScanClose( ); + void slotScanDuplicate( ); + void slotScanNew( ); + void slotScanRename( ); + void slotScanRename( const QString& scanName ); + void slotShowManPage( ); + void slotSwitchManPages( ); + void slotSetStylesheet( ); + void slotUseTargetHost( ); + void slotWrapText( ); + void slotZoomCustom( ); + void slotZoomIn( ); + void slotZoomOut( ); + + private slots: + void slotDisplayHelp( const QString& anchor ); + void slotErrorLoadingLocalManPage( const QString& errorText ); + void slotFinaliseInitialisation( ); + void slotOptionsDirty( ); + void slotVisibleScanWidgetChanged( ScanWidget* scanWidget ); + + private: + ScanWidget* createScan( const QString& scanName, const bool useTargetHost, const QString& profileName ); + void loadManPage( ); + void setCaption( ScanWidget* scanWidget ); + + bool m_dirty; + HTMLWidget* m_htmlWidget; + IndexWidget* m_indexWidget; + ScanStack* m_scanStack; + QStringList m_stylesheetURLs; + bool m_useLocalManPage; + bool m_wrapText; +}; + +#endif // _MAINWIDGET_H_ diff --git a/src/nmap_manpage.html b/src/nmap_manpage.html new file mode 100644 index 0000000..9fa59cf --- /dev/null +++ b/src/nmap_manpage.html @@ -0,0 +1,1176 @@ +<HTML> +<HEAD> +<TITLE>Nmap network security scanner man page</TITLE> +</HEAD> +<BODY> +<H1>Nmap network security scanner man page</H1> +<HR> +<PRE> +<!-- Manpage converted by man2html 3.0.1 --> +<B>NMAP(1)</B> <B>NMAP(1)</B> + + + + +</PRE> +<H2>NAME</H2><PRE> + nmap - Network exploration tool and security scanner + + +</PRE> +<H2>SYNOPSIS</H2><PRE> + <B>nmap</B> [Scan Type(s)] [Options] <host or net #1 ... [#N]> + + +</PRE> +<H2>DESCRIPTION</H2><PRE> + <I>Nmap</I> is designed to allow system administrators and curious individuals + to scan large networks to determine which hosts are up and what ser- + vices they are offering. <I>nmap</I> supports a large number of scanning + techniques such as: UDP, TCP connect(), TCP SYN (half open), ftp proxy + (bounce attack), ICMP (ping sweep), FIN, ACK sweep, Xmas Tree, SYN + sweep, IP Protocol, and Null scan. See the <I>Scan</I> <I>Types</I> section for more + details. nmap also offers a number of advanced features such as remote + OS detection via TCP/IP fingerprinting, stealth scanning, dynamic delay + and retransmission calculations, parallel scanning, detection of down + hosts via parallel pings, decoy scanning, port filtering detection, + direct (non-portmapper) RPC scanning, fragmentation scanning, and flex- + ible target and port specification. + + Significant effort has been put into decent nmap performance for non- + root users. Unfortunately, many critical kernel interfaces (such as + raw sockets) require root privileges. nmap should be run as root when- + ever possible (not setuid root, of course). + + The result of running nmap is usually a list of interesting ports on + the machine(s) being scanned (if any). Nmap always gives the port’s + "well known" service name (if any), number, state, and protocol. The + state is either "open", "closed" "filtered", or "unfiltered". Open + means that the target machine will accept() connections on that port. + Closed ports are not listening for connections (they have no applica- + tion associated with them). Filtered means that a firewall, filter, or + other network obstacle is covering the port and preventing nmap from + determining whether the port is open. Unfiltered means that the port + is known by nmap to be closed and no firewall/filter seems to be inter- + fering with nmap’s attempts to determine this. Unfiltered ports are + the common case and are only shown when most of the scanned ports are + in the filtered state. In some cases, Nmap cannot distinguish between + filtered ports and those that are either open or closed. For example, + a port that does not respond to a FIN Scan could be either open or fil- + tered. In these cases, Nmap lists ports as "open|filtered" or + "closed|filtered". + + Depending on options used, nmap may also report the following charac- + teristics of the remote host: OS in use, TCP sequentiality, usernames + running the programs which have bound to each port, the DNS name, + whether the host is a smurf address, and a few others. + + +</PRE> +<H2>OPTIONS</H2><PRE> + Options that make sense together can generally be combined. Some + options are specific to certain scan modes. <I>nmap</I> tries to catch and + warn the user about psychotic or unsupported option combinations. + + If you are impatient, you can skip to the <I>examples</I> section at the end, + which demonstrates common usage. You can also run <B>nmap</B> <B>-h</B> for a quick + reference page listing all the options. + + <B>SCAN</B> <B>TYPES</B> + + <B id="-sS">-sS</B> TCP SYN scan: This technique is often referred to as "half-open" + scanning, because you don’t open a full TCP connection. You send + a SYN packet, as if you are going to open a real connection and + you wait for a response. A SYN|ACK indicates the port is listen- + ing. A RST is indicative of a non-listener. If a SYN|ACK is + received, a RST is immediately sent to tear down the connection + (actually our OS kernel does this for us). The primary advantage + to this scanning technique is that fewer sites will log it. + Unfortunately you need root privileges to build these custom SYN + packets. This is the default scan type for privileged users. + + <B id="-sT">-sT</B> TCP connect() scan: This is the most basic form of TCP scanning. + The connect() system call provided by your operating system is + used to open a connection to every interesting port on the + machine. If the port is listening, connect() will succeed, oth- + erwise the port isn’t reachable. One strong advantage to this + technique is that you don’t need any special privileges. Any + user on most UNIX boxes is free to use this call. + + This sort of scan is easily detectable as target host logs will + show a bunch of connection and error messages for the services + which accept() the connection just to have it immediately shut- + down. This is the default scan type for unprivileged users. + + <B id="-sF">-sF</B> <B id="-sX">-sX</B> <B id="-sN">-sN</B> + Stealth FIN, Xmas Tree, or Null scan modes: There are times when + even SYN scanning isn’t clandestine enough. Some firewalls and + packet filters watch for SYNs to restricted ports, and programs + like Synlogger and Courtney are available to detect these scans. + These advanced scans, on the other hand, may be able to pass + through unmolested. + + The idea is that closed ports are required to reply to your + probe packet with an RST, while open ports must ignore the pack- + ets in question (see RFC 793 pp 64). Filered ports also tend to + drop probes without a response, so Nmap considers ports + "open|filtered" when it fails to elicit any response. If you + add version detection (-sV), it will try to verify whether the + ports are actually open and change the state as appropriate. + The FIN scan uses a bare (surprise) FIN packet as the probe, + while the Xmas tree scan turns on the FIN, URG, and PUSH flags. + The Null scan turns off all flags. Unfortunately Microsoft + (like usual) decided to completely ignore the standard and do + things their own way. Thus this scan type will not work against + systems running Windows95/NT. On the positive side, this is a + good way to distinguish between the two platforms. If the scan + finds open ports, you know the machine is not a Windows box. If + a -sF,-sX,or -sN scan shows all ports closed, yet a SYN (-sS) + scan shows ports being opened, you are probably looking at a + Windows box. This is less useful now that nmap has proper OS + detection built in. There are also a few other systems that are + broken in the same way Windows is. They include Cisco, BSDI, + HP/UX, MVS, and IRIX. All of the above send resets from the + open ports when they should just drop the packet. + + <B id="-sP">-sP</B> Ping scanning: Sometimes you only want to know which hosts on a + network are up. Nmap can do this by sending ICMP echo request + packets to every IP address on the networks you specify. Hosts + that respond are up. Unfortunately, some sites such as + microsoft.com block echo request packets. Thus nmap can also + send a TCP ack packet to (by default) port 80. If we get an RST + back, that machine is up. A third technique involves sending a + SYN packet and waiting for a RST or a SYN/ACK. For non-root + users, a connect() method is used. + + By default (for root users), nmap uses both the ICMP and ACK + techniques in parallel. You can change these with the <B>-P</B> + options described later. + + Note that pinging is done by default anyway, and only hosts that + respond are scanned. Only use this option if you wish to ping + sweep <B>without</B> doing any actual port scans. + + <B id="-sV">-sV</B> Version detection: After TCP and/or UDP ports are discovered + using one of the other scan methods, version detection communi- + cates with those ports to try and determine more about what is + actually running. A file called nmap-service-probes is used to + determine the best probes for detecting various services and the + match strings to expect. Nmap tries to determine the service + protocol (e.g. ftp, ssh, telnet, http), the application name + (e.g. ISC Bind, Apache httpd, Solaris telnetd), the version num- + ber, and sometimes miscellaneous details like whether an X + server is open to connections or the SSH protocol version). If + Nmap was compiled with OpenSSL support, it will connect to SSL + servers to deduce the service listening behind the encryption. + When RPC services are discovered, the Nmap RPC grinder is used + to determine the RPC program and version numbers. Some UDP + ports are left in the "open|filtered" state after a UDP scan is + unable to determine whether the port is open or filtered. Ver- + sion detection will try to elicit a response from these ports + (just as it does with open ports), and change the state to open + if it succeeds. Note that the Nmap -A option also enables this + feature. For a much more detailed description of Nmap service + detection, read our paper at http://www.insecure.org/nmap/ver- + sionscan.html . There is a related --version_trace option which + causes Nmap to print out extensive debugging info about what + version scanning is doing (this is a subset of what you would + get with --packet_trace). + + <B id="-sU">-sU</B> UDP scans: This method is used to determine which UDP (User + Datagram Protocol, RFC 768) ports are open on a host. The tech- + nique is to send 0 byte UDP packets to each port on the target + machine. If we receive an ICMP port unreachable message, then + the port is closed. If a UDP response is received to the probe + (unusual), the port is open. If we get no response at all, the + state is "open|filtered", meaning that the port is either open + or packet filters are blocking the communication. Versions scan + (-sV) can be used to help differentiate the truly open ports + from the filtered ones. + + Some people think UDP scanning is pointless. I usually remind + them of the Solaris rpcbind hole. Rpcbind can be found hiding on + an undocumented UDP port somewhere above 32770. So it doesn’t + matter that 111 is blocked by the firewall. But can you find + which of the more than 30,000 high ports it is listening on? + With a UDP scanner you can! There is also the cDc Back Orifice + backdoor program which hides on a configurable UDP port on Win- + dows machines. Not to mention the many commonly vulnerable ser- + vices that utilize UDP such as snmp, tftp, NFS, etc. + + Unfortunately UDP scanning is sometimes painfully slow since + most hosts implement a suggestion in RFC 1812 (section 4.3.2.8) + of limiting the ICMP error message rate. For example, the Linux + kernel (in net/ipv4/icmp.h) limits destination unreachable mes- + sage generation to 80 per 4 seconds, with a 1/4 second penalty + if that is exceeded. Solaris has much more strict limits (about + 2 messages per second) and thus takes even longer to scan. <I>nmap</I> + detects this rate limiting and slows down accordingly, rather + than flood the network with useless packets that will be ignored + by the target machine. + + As is typical, Microsoft ignored the suggestion of the RFC and + does not seem to do any rate limiting at all on Win95 and NT + machines. Thus we can scan all 65K ports of a Windows machine + <B>very</B> quickly. Whoop! + + + <B id="-sO">-sO</B> IP protocol scans: This method is used to determine which IP + protocols are supported on a host. The technique is to send raw + IP packets without any further protocol header to each specified + protocol on the target machine. If we receive an ICMP protocol + unreachable message, then the protocol is not in use. Otherwise + we assume it is open. Note that some hosts (AIX, HP-UX, Digital + UNIX) and firewalls may not send protocol unreachable messages. + This causes all of the protocols to appear "open". + + Because the implemented technique is very similar to UDP port + scanning, ICMP rate limit might apply too. But the IP protocol + field has only 8 bits, so at most 256 protocols can be probed + which should be possible in reasonable time anyway. + + <B id="-sI">-sI</B> <B><zombie</B> <B>host[:probeport]></B> + Idlescan: This advanced scan method allows for a truly blind TCP + port scan of the target (meaning no packets are sent to the tar- + get from your real IP address). Instead, a unique side-channel + attack exploits predictable "IP fragmentation ID" sequence gen- + eration on the zombie host to glean information about the open + ports on the target. IDS systems will display the scan as com- + ing from the zombie machine you specify (which must be up and + meet certain criteria). I wrote an informal paper about this + technique at http://www.insecure.org/nmap/idlescan.html . + + Besides being extraordinarily stealthy (due to its blind + nature), this scan type permits mapping out IP-based trust rela- + tionships between machines. The port listing shows open ports + <I>from</I> <I>the</I> <I>perspective</I> <I>of</I> <I>the</I> <I>zombie</I> <I>host.</I> So you can try scan- + ning a target using various zombies that you think might be + trusted (via router/packet filter rules). Obviously this is + crucial information when prioritizing attack targets. Other- + wise, you penetration testers might have to expend considerable + resources "owning" an intermediate system, only to find out that + its IP isn’t even trusted by the target host/network you are + ultimately after. + + You can add a colon followed by a port number if you wish to + probe a particular port on the zombie host for IPID changes. + Otherwise Nmap will use the port it uses by default for "tcp + pings". + + <B id="-sA">-sA</B> ACK scan: This advanced method is usually used to map out fire- + wall rulesets. In particular, it can help determine whether a + firewall is stateful or just a simple packet filter that blocks + incoming SYN packets. + + This scan type sends an ACK packet (with random looking acknowl- + edgment/sequence numbers) to the ports specified. If a RST + comes back, the ports is classified as "unfiltered". If nothing + comes back (or if an ICMP unreachable is returned), the port is + classified as "filtered". Note that <I>nmap</I> usually doesn’t print + "unfiltered" ports, so getting <B>no</B> ports shown in the output is + usually a sign that all the probes got through (and returned + RSTs). This scan will obviously never show ports in the "open" + state. + + <B id="-sW">-sW</B> Window scan: This advanced scan is very similar to the ACK scan, + except that it can sometimes detect open ports as well as fil- + tered/unfiltered due to an anomaly in the TCP window size + reporting by some operating systems. Systems vulnerable to this + include at least some versions of AIX, Amiga, BeOS, BSDI, Cray, + Tru64 UNIX, DG/UX, OpenVMS, Digital UNIX, FreeBSD, HP-UX, OS/2, + IRIX, MacOS, NetBSD, OpenBSD, OpenStep, QNX, Rhapsody, SunOS + 4.X, Ultrix, VAX, and VxWorks. See the nmap-hackers mailing + list archive for a full list. + + <B id="-sR">-sR</B> RPC scan. This method works in combination with the various + port scan methods of Nmap. It takes all the TCP/UDP ports found + open and then floods them with SunRPC program NULL commands in + an attempt to determine whether they are RPC ports, and if so, + what program and version number they serve up. Thus you can + effectively obtain the same info as "rpcinfo -p" even if the + target’s portmapper is behind a firewall (or protected by TCP + wrappers). Decoys do not currently work with RPC scan, at some + point I may add decoy support for UDP RPC scans. This is auto- + matically enabled as part of version scan (-sV) if you request + that. + + <B id="-sL">-sL</B> List scan. This method simply generates and prints a list of IP + addresses or hostnames without actually pinging or port scanning + them. DNS name resolution will be performed unless you use -n. + + <B id="-b">-b</B> <B><ftp</B> <B>relay</B> <B>host></B> + FTP bounce attack: An interesting "feature" of the ftp protocol + (RFC 959) is support for "proxy" ftp connections. In other + words, I should be able to connect from evil.com to the FTP + server of target.com and request that the server send a file + ANYWHERE on the Internet! Now this may have worked well in 1985 + when the RFC was written. But in today’s Internet, we can’t have + people hijacking ftp servers and requesting that data be spit + out to arbitrary points on the Internet. As *Hobbit* wrote back + in 1995, this protocol flaw "can be used to post virtually + untraceable mail and news, hammer on servers at various sites, + fill up disks, try to hop firewalls, and generally be annoying + and hard to track down at the same time." What we will exploit + this for is to (surprise, surprise) scan TCP ports from a + "proxy" ftp server. Thus you could connect to an ftp server + behind a firewall, and then scan ports that are more likely to + be blocked (139 is a good one). If the ftp server allows reading + from and writing to some directory (such as /incoming), you can + send arbitrary data to ports that you do find open (nmap doesn’t + do this for you though). + + The argument passed to the "b" option is the host you want to + use as a proxy, in standard URL notation. The format is: <I>user-</I> + <I>name:password@server:port.</I> Everything but <I>server</I> is optional. + To determine what servers are vulnerable to this attack, you can + see my article in <I>Phrack</I> 51. An updated version is available at + the <I>nmap</I> URL (http://www.insecure.org/nmap). + + <B>GENERAL</B> <B>OPTIONS</B> + None of these are required but some can be quite useful. Note + that the -P options can now be combined -- you can increase your + odds of penetrating strict firewalls by sending many probe types + using different TCP ports/flags and ICMP codes. + + <B id="-P0">-P0</B> Do not try to ping hosts at all before scanning them. This + allows the scanning of networks that don’t allow ICMP echo + requests (or responses) through their firewall. microsoft.com + is an example of such a network, and thus you should always use + <B>-P0</B> or <B>-PS80</B> when portscanning microsoft.com. Note that "ping" + in this context may involve more than the traditional ICMP echo + request packet. Nmap supports many such probes, including arbi- + trary combinations of TCP, UDP, and ICMP probes. By default, + Nmap sends an ICMP echo request and a TCP ACK packet to port 80. + + <B id="-PA">-PA</B> <B>[portlist]</B> + Use TCP ACK "ping" to determine what hosts are up. Instead of + sending ICMP echo request packets and waiting for a response, we + spew out TCP ACK packets throughout the target network (or to a + single machine) and then wait for responses to trickle back. + Hosts that are up should respond with a RST. This option pre- + serves the efficiency of only scanning hosts that are up while + still allowing you to scan networks/hosts that block ping pack- + ets. For non root UNIX users, we use connect() and thus a SYN + is actually being sent. To set the destination ports of the + probe packets use -PA<port1>[,port2][...]. The default port is + 80, since this port is often not filtered out. Note that this + option now accepts multiple, comma-separated port numbers. + + <B id="-PS">-PS</B> <B>[portlist]</B> + This option uses SYN (connection request) packets instead of ACK + packets for root users. Hosts that are up should respond with a + RST (or, rarely, a SYN|ACK). You can set the destination ports + in the same manner as -PA above. + + <B id="-PR">-PR</B> This option specifies a raw ethernet ARP ping. It cannot be + used in combination with any of the other ping types. When the + target machines are on the same network you are scanning from, + this is the fastest and most reliable (because it goes below IP- + level filters) ping method. Nmap sends an IPv4-to-Ethernet ARP + request for each target IP, and watches for any ARP response. + <B>-PU</B> <B>[portlist]</B> This option sends UDP probes to the specified + hosts, expecting an ICMP port unreachable packet (or possibly a + UDP response if the port is open) if the host is up. Since many + UDP services won’t reply to an empty packet, your best bet might + be to send this to expected-closed ports rather than open ones. + + <B id="-PE">-PE</B> This option uses a true ping (ICMP echo request) packet. It + finds hosts that are up and also looks for subnet-directed + broadcast addresses on your network. These are IP addresses + which are externally reachable and translate to a broadcast of + incoming IP packets to a subnet of computers. These should be + eliminated if found as they allow for numerous denial of service + attacks (Smurf is the most common). + + <B id="-PP">-PP</B> Uses an ICMP timestamp request (type 13) packet to find listen- + ing hosts. + + <B id="-PM">-PM</B> Same as <B>-PE</B> and <B>-PP</B> except uses a netmask request (ICMP type + 17). + + <B>-PB</B> This is the default ping type. It uses both the ACK ( <B>-PA</B> ) and + ICMP echo request ( <B>-PE</B> ) sweeps in parallel. This way you can + get firewalls that filter either one (but not both). The TCP + probe destination port can be set in the same manner as with -PA + above. Note that this flag is now deprecated as pingtype flags + can now be used in combination. So you should use both "PE" and + "PA" (or rely on the default behavior) to achieve this same + effect. + + <B id="-O">-O</B> This option activates remote host identification via TCP/IP fin- + gerprinting. In other words, it uses a bunch of techniques to + detect subtleties in the underlying operating system network + stack of the computers you are scanning. It uses this informa- + tion to create a "fingerprint" which it compares with its + database of known OS fingerprints (the nmap-os-fingerprints + file) to decide what type of system you are scanning. + + If Nmap is unable to guess the OS of a machine, and conditions + are good (e.g. at least one open port), Nmap will provide a URL + you can use to submit the fingerprint if you know (for sure) the + OS running on the machine. By doing this you contribute to the + pool of operating systems known to nmap and thus it will be more + accurate for everyone. Note that if you leave an IP address on + the form, the machine may be scanned when we add the fingerprint + (to validate that it works). + + The -O option also enables several other tests. One is the + "Uptime" measurement, which uses the TCP timestamp option (RFC + 1323) to guess when a machine was last rebooted. This is only + reported for machines which provide this information. + + Another test enabled by -O is TCP Sequence Predictability Clas- + sification. This is a measure that describes approximately how + hard it is to establish a forged TCP connection against the + remote host. This is useful for exploiting source-IP based + trust relationships (rlogin, firewall filters, etc) or for hid- + ing the source of an attack. The actual difficulty number is + based on statistical sampling and may fluctuate. It is gener- + ally better to use the English classification such as "worthy + challenge" or "trivial joke". This is only reported in normal + output with -v. + + When verbose mode (-v) is on with -O, IPID Sequence Generation + is also reported. Most machines are in the "incremental" class, + which means that they increment the "ID" field in the IP header + for each packet they send. This makes them vulnerable to sev- + eral advanced information gathering and spoofing attacks. + + <B id="--osscan_limit">--osscan_limit</B> + OS detection is far more effective if at least one open and one + closed TCP port are found. Set this option and Nmap will not + even try OS detection against hosts that do not meet this crite- + ria. This can save substantial time, particularly on -P0 scans + against many hosts. It only matters when OS detection is + requested (-O or -A options). + + <B id="-A">-A</B> This option enables _a_dditional _a_dvanced and _a_ggressive + options. I haven’t decided exactly which it stands for yet :). + Presently this enables OS Detection (-O) and version scanning + (-sV). More features may be added in the future. The point is + to enable a comprehensive set of scan options without people + having to remember a large set of flags. This option only + enables features, and not timing options (such as -T4) or ver- + bosity options (-v) that you might wan’t as well. + + <B id="-6">-6</B> This options enables IPv6 support. All targets must be IPv6 if + this option is used, and they can be specified via normal DNS + name (AAAA record) or as a literal IP address such as + 3ffe:501:4819:2000:210:f3ff:fe03:4d0 . Currently, connect() TCP + scan and TCP connect() Ping scan are supported. If you need UDP + or other scan types, have a look at http://nmap6.source- + forge.net/ . + + <B id="--send_eth">--send_eth</B> + Asks Nmap to send packets at the raw ethernet (data link) layer + rather than the higher IP (network) layer. By default, Nmap + chooses the one which is generally best for the platform it is + running on. Raw sockets (IP layer) are generally most efficient + for UNIX machines, while ethernet frames work best on the many + Windows versions where Microsoft has disabled raw sockets sup- + port. Nmap still uses raw IP packets when there is no other + choice (such as non-ethernet connections). + + <B id="--send_ip">--send_ip</B> + Asks Nmap to send packets via raw IP sockets rather than sending + lower level ethernet frames. It is the complement to the + --send-eth option.discussed previously. + + <B id="--spoof_mac">--spoof_mac</B> <B>[mac,</B> <B>prefix,</B> <B>or</B> <B>vendor</B> <B>substring]</B> + Ask Nmap to use the given MAC address for all of the raw ether- + net frames it sends. The MAC given can take several formats. + If it is simply the string "0", Nmap chooses a completely random + MAC for the session. If the given string is an even number of + hex digits (with the pairs optionally separated by a colon), + Nmap will use those as the MAC. If less than 12 hex digits are + provided, Nmap fills in the remainder of the 6 bytes with random + values. If the argument isn’t a 0 or hex string, Nmap looks + through the nmap-mac-prefixes to find a vendor name containing + the given string (it is case insensitive). If a match is found, + Nmap uses the vendor’s OUI (3-byte prefix) and fills out the + remaining 3 bytes randomly. Valid --spoof_mac argument examples + are "Apple", "0", "01:02:03:04:05:06", "deadbeefcafe", "0020F2", + and "Cisco". + + <B id="-f">-f</B> This option causes the requested scan (including ping scans) to + use tiny fragmented IP packets. The idea is to split up the TCP + header over several packets to make it harder for packet fil- + ters, intrusion detection systems, and other annoyances to + detect what you are doing. Be careful with this! Some programs + have trouble handling these tiny packets. The old-school sniffer + named Sniffit segmentation faulted immediately upon receiving + the first fragment. Specify this option once, and Nmap splits + the packets into 8 bytes or less after the IP header. So a + 20-byte TCP header would be split into 3 packets. + Two with eight bytes of the TCP header, and one with the final + four. Of course each fragment also has an IP header. Specify + -f again to use 16 bytes per fragment (reducing the number of + fragments). Or you can specify your own offset size with the + --mtu option. Don’t also specify -f if you use --mtu. The off- + set must be a multiple of 8. While fragmented packets won’t get + by packet filters and firewalls that queue all IP fragments, + such as the CONFIG_IP_ALWAYS_DEFRAG option in the Linux kernel, + some networks can’t afford the performance hit this causes and + thus leave it disabled. Some source systems defragment outgoing + packets in the kernel. Linux with the ip tables connection + tracking module is one such example. Do a scan with a sniffer + such as ethereal running to ensure that sent packets are frag- + mented. + + Note that I do not yet have this option working on all systems. + It works fine for my Linux, FreeBSD, and OpenBSD boxes and some + people have reported success with other *NIX variants. + + <B id="-v">-v</B> Verbose mode. This is a highly recommended option and it gives + out more information about what is going on. You can use it + twice for greater effect. You can also use <B>-d</B> a few times if + you really want to get crazy with scrolling the screen! + + <B>-h</B> This handy option display a quick reference screen of nmap usage + options. As you may have noticed, this man page is not exactly + a "quick reference" :) + + <B id="-oN">-oN</B> <B><logfilename></B> + This logs the results of your scans in a normal <B>human</B> <B>readable</B> + form into the file you specify as an argument. + + <B id="-oX">-oX</B> <B><logfilename></B> + This logs the results of your scans in <B>XML</B> form into the file + you specify as an argument. This allows programs to easily cap- + ture and interpret Nmap results. You can give the argument "-" + (without quotes) to shoot output into stdout (for shell + pipelines, etc). In this case normal output will be suppressed. + Watch out for error messages if you use this (they will still go + to stderr). Also note that "-v" may cause some extra informa- + tion to be printed. The Document Type Definition (DTD) defining + the XML output structure is available at http://www.inse- + cure.org/nmap/data/nmap.dtd . + + <B id="--stylesheet">--stylesheet</B> <B><filename></B> + Nmap ships with an XSL stylesheet named nmap.xsl for viewing or + translating XML output to HTML. The XML output includes an xml- + stylesheet directive which points to nmap.xml where it was ini- + tially installed by Nmap (or in the current working directory on + Windows). Simply load Nmap’s XML output in a modern web browser + and it should retrieve nmap.xsl from the filesystem and use it + to render results. If you wish to use a different stylesheet, + specify it as the argument to --stylesheet. You must pass the + full pathname or URL. One common invocation is --stylesheet + http://www.insecure.org/nmap/data/nmap.xsl . This tells a + browser to load the latest version of the stylesheet from Inse- + cure.Org. This makes it easier to view results on a machine + that doesn’t have Nmap (and thus nmap.xsl) installed. So the + URL is often more useful, but the local filesystem locaton of + nmap.xsl is used by default for privacy reasons. + + <B id="--no_stylesheet">--no_stylesheet</B> + Specify this option to prevent Nmap from associating any XSL + stylesheet with its XML output. The xml-stylesheet directive is + omitted. + + <B id="-oG">-oG</B> <B><logfilename></B> + This logs the results of your scans in a <B>grepable</B> form into the + file you specify as an argument. This simple format provides + all the information on one line (so you can easily grep for port + or OS information and see all the IPs. This used to be the pre- + ferred mechanism for programs to interact with Nmap, but now we + recommend XML output (-oX instead). This simple format may not + contain as much information as the other formats. You can give + the argument "-" (without quotes) to shoot output into stdout + (for shell pipelines, etc). In this case normal output will be + suppressed. Watch out for error messages if you use this (they + will still go to stderr). Also note that "-v" will cause some + extra information to be printed. + + <B id="-oA">-oA</B> <B><basefilename></B> + This tells Nmap to log in ALL the major formats (normal, + grepable, and XML). You give a base for the filename, and the + output files will be base.nmap, base.gnmap, and base.xml. + + <B id="-oS">-oS</B> <B><logfilename></B> + thIs l0gz th3 r3suLtS of YouR ScanZ iN a <B>s|<ipT</B> <B>kiDd|3</B> f0rM iNto + THe fiL3 U sPecfy 4s an arGuMEnT! U kAn gIv3 the 4rgument "-" + (wItHOUt qUOteZ) to sh00t output iNT0 stDouT!@!! + + <B id="--resume">--resume</B> <B><logfilename></B> + A network scan that is canceled due to control-C, network out- + age, etc. can be resumed using this option. The logfilename + must be either a normal (-oN) or grepable (-oG) log from the + aborted scan. No other options can be given (they will be the + same as the aborted scan). Nmap will start on the machine after + the last one successfully scanned in the log file. + + <B id="--exclude">--exclude</B> <B><host1</B> <B>[,host2][,host3],..."></B> + Specifies a list of targets (hosts, ranges, netblocks) that + should be excluded from a scan. Useful to keep from scanning + yourself, your ISP, particularly sensitive hosts, etc. + + <B>--excludefile</B> <B><exclude_file></B> + Same functionality as the --exclude option, only the excluded + targets are provided in an newline-delimited exclude_file rather + than on the command line. + + <B id="--allports">--allports</B> + Causes version detection (-sV) to scan all open ports found, + including those excluded as dangerous (likely to cause crashes + or other problems) in nmap-service-probes. + + <B id="--append_output">--append_output</B> + Tells Nmap to append scan results to any output files you have + specified rather than overwriting those files. + + <B id="-iL">-iL</B> <B><inputfilename></B> + Reads target specifications from the file specified RATHER than + from the command line. The file should contain a list of host + or network expressions separated by spaces, tabs, or newlines. + Use a hyphen (-) as <I>inputfilename</I> if you want nmap to read host + expressions from stdin (like at the end of a pipe). See the + section <I>target</I> <I>specification</I> for more information on the expres- + sions you fill the file with. + + <B id="-iR">-iR</B> <B><num</B> <B>hosts></B> + This option tells Nmap to generate its own hosts to scan by sim- + ply picking random numbers :). It will never end after the + given number of IPs has been scanned -- use 0 for a never-ending + scan. This option can be useful for statistical sampling of the + Internet to estimate various things. If you are ever really + bored, try <I>nmap</I> <I>-sS</I> <I>-PS80</I> <I>-iR</I> <I>0</I> <I>-p</I> <I>80</I> to find some web servers + to look at. + + <B id="-p">-p</B> <B><port</B> <B>ranges></B> + This option specifies what ports you want to specify. For exam- + ple "-p 23" will only try port 23 of the target host(s). "-p + 20-30,139,60000-" scans ports between 20 and 30, port 139, and + all ports greater than 60000. The default is to scan all ports + between 1 and 1024 as well as any ports listed in the services + file which comes with nmap. For IP protocol scanning (-sO), + this specifies the protocol number you wish to scan for (0-255). + + When scanning both TCP and UDP ports, you can specify a particu- + lar protocol by preceding the port numbers by "T:" or "U:". The + qualifier lasts until you specify another qualifier. For exam- + ple, the argument "-p U:53,111,137,T:21-25,80,139,8080" would + scan UDP ports 53,111,and 137, as well as the listed TCP ports. + Note that to scan both UDP & TCP, you have to specify -sU and at + least one TCP scan type (such as -sS, -sF, or -sT). If no pro- + tocol qualifier is given, the port numbers are added to all pro- + tocol lists. + + <B id="-F">-F</B> <B>Fast</B> <B>scan</B> <B>mode.</B> + Specifies that you only wish to scan for ports listed in the + services file which comes with nmap (or the protocols file for + -sO). This is obviously much faster than scanning all 65535 + ports on a host. + + <B id="-D">-D</B> <B><decoy1</B> <B>[,decoy2][,ME],...></B> + Causes a decoy scan to be performed which makes it appear to the + remote host that the host(s) you specify as decoys are scanning + the target network too. Thus their IDS might report 5-10 port + scans from unique IP addresses, but they won’t know which IP was + scanning them and which were innocent decoys. While this can be + defeated through router path tracing, response-dropping, and + other "active" mechanisms, it is generally an extremely effec- + tive technique for hiding your IP address. + + Separate each decoy host with commas, and you can optionally use + "ME" as one of the decoys to represent the position you want + your IP address to be used. If you put "ME" in the 6th position + or later, some common port scan detectors (such as Solar + Designer’s excellent scanlogd) are unlikely to show your IP + address at all. If you don’t use "ME", nmap will put you in a + random position. + + Note that the hosts you use as decoys should be up or you might + accidentally SYN flood your targets. Also it will be pretty + easy to determine which host is scanning if only one is actually + up on the network. You might want to use IP addresses instead + of names (so the decoy networks don’t see you in their name- + server logs). + + Also note that some "port scan detectors" will firewall/deny + routing to hosts that attempt port scans. The problem is that + many scan types can be forged (as this option demonstrates). So + attackers can cause such a machine to sever connectivity with + important hosts such as its internet gateway, DNS TLD servers, + sites like Windows Update, etc. Most such software offers + whitelist capabilities, but you are unlikely to enumerate all of + the critical machines. For this reason we never recommend tak- + ing action against port scans that can be forged, including SYN + scans, UDP scans, etc. The machine you block could just be a + decoy. + + Decoys are used both in the initial ping scan (using ICMP, SYN, + ACK, or whatever) and during the actual port scanning phase. + Decoys are also used during remote OS detection ( <B>-O</B> ). + + It is worth noting that using too many decoys may slow your scan + and potentially even make it less accurate. Also, some ISPs + will filter out your spoofed packets, although many (currently + most) do not restrict spoofed IP packets at all. + + <B id="-S">-S</B> <B><IP_Address></B> + In some circumstances, <I>nmap</I> may not be able to determine your + source address ( <I>nmap</I> will tell you if this is the case). In + this situation, use -S with your IP address (of the interface + you wish to send packets through). + + Another possible use of this flag is to spoof the scan to make + the targets think that <B>someone</B> <B>else</B> is scanning them. Imagine a + company being repeatedly port scanned by a competitor! This is + not a supported usage (or the main purpose) of this flag. I + just think it raises an interesting possibility that people + should be aware of before they go accusing others of port scan- + ning them. <B>-e</B> would generally be required for this sort of + usage. + + <B id="-e">-e</B> <B><interface></B> + Tells nmap what interface to send and receive packets on. Nmap + should be able to detect this but it will tell you if it cannot. + + <B id="-g">--source_port</B> <B><portnumber></B> + Sets the source port number used in scans. Many naive firewall + and packet filter installations make an exception in their rule- + set to allow DNS (53) or FTP-DATA (20) packets to come through + and establish a connection. Obviously this completely subverts + the security advantages of the firewall since intruders can just + masquerade as FTP or DNS by modifying their source port. Obvi- + ously for a UDP scan you should try 53 first and TCP scans + should try 20 before 53. Note that this is only a request -- + nmap will honor it only if and when it is able to. For example, + you can’t do TCP ISN sampling all from one host:port to one + host:port, so nmap changes the source port even if you used this + option. This is an alias for the shorter, but harder to remem- + ber, -g option. + + Be aware that there is a small performance penalty on some scans + for using this option, because I sometimes store useful informa- + tion in the source port number. + + <B id="--data_length">--data_length</B> <B><number></B> + Normally Nmap sends minimalistic packets that only contain a + header. So its TCP packets are generally 40 bytes and ICMP echo + requests are just 28. This option tells Nmap to append the + given number of random bytes to most of the packets it sends. + OS detection (-O) packets are not affected, but most pinging and + portscan packets are. This slows things down, but can be + slightly less conspicuous. + + <B id="-n">-n</B> Tells Nmap to <B>NEVER</B> do reverse DNS resolution on the active IP + addresses it finds. Since DNS is often slow, this can help + speed things up. + + <B id="-R">-R</B> Tells Nmap to <B>ALWAYS</B> do reverse DNS resolution on the target IP + addresses. Normally this is only done when a machine is found + to be alive. + + <B id="-r">-r</B> Tells Nmap <B>NOT</B> to randomize the order in which ports are + scanned. + + <B id="-ttl">--ttl</B> <B><value></B> + Sets the IPv4 time to live field in sent packets to the given + value. + + <B id="--privileged">--privileged</B> + Tells Nmap to simply assume that it is privileged enough to per- + form raw socket sends, packet sniffing, and similar operations + that usually require root privileges on UNIX systems. By + default Nmap bails if such operations are requested but + geteuid() is not zero. --privileged is useful with Linux kernel + capabilities and similar systems that may be configured to allow + unprivileged users to perform raw-packet scans. Be sure to pro- + vide this option flag before any flags for options that require + privileges (SYN scan, OS detection, etc.). The NMAP_PRIVILEGED + variable may be set as an equivalent alternative --privileged. + + <B>--interactive</B> + Starts Nmap in interactive mode, which offers an interactive + Nmap prompt allowing easy launching of multiple scans (either + synchronously or in the background). This is useful for people + who scan from multi-user systems -- they often want to test + their security without letting everyone else on the system know + exactly which systems they are scanning. Use --interactive to + activate this mode and then type usually more familiar and fea- + ture-complete. + + <B id="--randomize_hosts">--randomize_hosts</B> + Tells Nmap to shuffle each group of up to 2048 hosts before it + scans them. This can make the scans less obvious to various + network monitoring systems, especially when you combine it with + slow timing options (see below). + + <B id="-M">-M</B> <B><max</B> <B>sockets></B> + Sets the maximum number of sockets that will be used in parallel + for a TCP connect() scan (the default). This is useful to slow + down the scan a little bit and avoid crashing remote machines. + Another approach is to use -sS, which is generally easier for + machines to handle. + + <B id="--packet_trace">--packet_trace</B> + Tells Nmap to show all the packets it sends and receives in a + tcpdump-like format. This can be tremendously useful for debug- + ging, and is also a good learning tool. + + <B id="--datadir">--datadir</B> <B>[directoryname]</B> + Nmap obtains some special data at runtime in files named nmap- + service-probes, nmap-services, nmap-protocols, nmap-rpc, nmap- + mac-prefixes, and nmap-os-fingerprints. Nmap first searches + these files in the directory option to --datadir. Any files not + found there, are searched for in the directory specified by the + NMAPDIR environmental variable. Next comes ~/.nmap for real and + effective UIDs (POSIX systems only) or location of the Nmap exe- + cutable (Win32 only), and then a compiled-in location such as + /usr/local/share/nmap or /usr/share/nmap . As a last resort, + Nmap will look in the current directory. + + <B>TIMING</B> <B>OPTIONS</B> + Generally Nmap does a good job at adjusting for Network charac- + teristics at runtime and scanning as fast as possible while min- + imizing that chances of hosts/ports going undetected. However, + there are same cases where Nmap’s default timing policy may not + meet your objectives. The following options provide a fine + level of control over the scan timing: + + <B id="-T">-T</B> <B><Paranoid|Sneaky|Polite|Normal|Aggressive|Insane></B> + These are canned timing policies for conveniently expressing + your priorities to Nmap. <B>Paranoid</B> mode scans <B>very</B> slowly in the + hopes of avoiding detection by IDS systems. It serializes all + scans (no parallel scanning) and generally waits at least 5 min- + utes between sending packets. <B>Sneaky</B> is similar, except it only + waits 15 seconds between sending packets. <B>Polite</B> is meant to + ease load on the network and reduce the chances of crashing + machines. It serializes the probes and waits <B>at</B> <B>least</B> 0.4 sec- + onds between them. Note that this is generally at least an + order of magnitude slower than default scans, so only use it + when you need to. <B>Normal</B> is the default Nmap behavior, which + tries to run as quickly as possible without overloading the net- + work or missing hosts/ports. <B>Aggressive</B> This option can make + certain scans (especially SYN scans against heavily filtered + hosts) much faster. It is recommended for impatient folks with + a fast net connection. <B>Insane</B> is only suitable for very fast + networks or where you don’t mind losing some information. It + times out hosts in 15 minutes and won’t wait more than 0.3 sec- + onds for individual probes. It does allow for very quick net- + work sweeps though :). + + You can also reference these by number (0-5). For example, + "-T0" gives you Paranoid mode and "-T5" is Insane mode. If you + wish to set specific timing values such as --max_rtt_timeout or + --host_timeout, place them after any -T option on the command + line. Otherwise the defaults for the selected timing mode will + override your choices. + + <B id="--host_timeout">--host_timeout</B> <B><milliseconds></B> + Specifies the amount of time Nmap is allowed to spend scanning a + single host before giving up on that IP. The default timing + mode has no host timeout. + + <B id="--max_rtt_timeout">--max_rtt_timeout</B> <B><milliseconds></B> + Specifies the maximum amount of time Nmap is allowed to wait for + a probe response before retransmitting or timing out that par- + ticular probe. The default mode sets this to about 9000. + + <B id="--min_rtt_timeout">--min_rtt_timeout</B> <B><milliseconds></B> + When the target hosts start to establish a pattern of responding + very quickly, Nmap will shrink the amount of time given per + probe. This speeds up the scan, but can lead to missed packets + when a response takes longer than usual. With this parameter + you can guarantee that Nmap will wait at least the given amount + of time before giving up on a probe. + + <B id="--initial_rtt_timeout">--initial_rtt_timeout</B> <B><milliseconds></B> + Specifies the initial probe timeout. This is generally only + useful when scanning firewalled hosts with -P0. Normally Nmap + can obtain good RTT estimates from the ping and the first few + probes. The default mode uses 6000. + + <B id="--max_hostgroup">--max_hostgroup</B> <B><numhosts></B> + Specifies the maximum number of hosts that Nmap is allowed to + scan in parallel. Most of the port scan techniques support + multi-host operation, which makes them much quicker. Spreading + the load among multiple target hosts makes the scans gentler. + The downside is increased results latency. You need to wait for + all hosts in a group to finish, rather than having them pop up + one by one. Specify an argument of one for old-style (one host + at a time) Nmap behavior. Note that the ping scanner handles + its own grouping, and ignores this value. + + <B id="--min_hostgroup">--min_hostgroup</B> <B><numhosts></B> + Specifies the minimum host group size (see previous entry). + Large values (such as 50) are often beneficial for unattended + scans, though they do take up more memory. Nmap may override + this preference when it needs to, because a group must all use + the same network interface, and some scan types can only handle + one host at a time. + + <B id="--max_parallelism">--max_parallelism</B> <B><number></B> + Specifies the maximum number of scans Nmap is allowed to perform + in parallel. Setting this to one means Nmap will never try to + scan more than 1 port at a time. It also effects other parallel + scans such as ping sweep, RPC scan, etc. + + <B id="--min_parallelism">--min_parallelism</B> <B><number></B> + Tells Nmap to scan at least the given number of ports in paral- + lel. This can speed up scans against certain firewalled hosts + by an order of magnitude. But be careful -- results will become + unreliable if you push it too far. + + <B id="--scan_delay">--scan_delay</B> <B><milliseconds></B> + Specifies the <B>minimum</B> amount of time Nmap must wait between + probes. This is mostly useful to reduce network load or to slow + the scan way down to sneak under IDS thresholds. Nmap will + sometimes increase the delay itself when it detects many dropped + packets. For example, Solaris systems tend to respond with only + one ICMP port unreachable packet per second during a UDP scan. + So Nmap will try to detect this and lower its rate of UDP probes + to one per second. + + <B id="--max_scan_delay">--max_scan_delay</B> <B><milliseconds></B> + As noted above, Nmap will sometimes enforce a special delay + between sending packets. This can provide more accurate results + while reducing network congestion, but it can slow the scans + down substantially. By default (with no -T options specified), + Nmap allows this delay to grow to one second per probe. This + option allows you to set a lower or higher maximum. Even if you + set it to zero, Nmap will have some delay between packet sends + so that it can wait for responses and avoid having too many out- + standing probes in parallel. + + + +</PRE> +<H2 id="target">TARGET SPECIFICATION</H2><PRE> + Everything that isn’t an option (or option argument) in nmap is treated + as a target host specification. The simplest case is listing single + hostnames or IP addresses on the command line. If you want to scan a + subnet of IP addresses, you can append <B>/mask</B> to the hostname or IP + address. <B>mask</B> must be between 0 (scan the whole Internet) and 32 (scan + the single host specified). Use /24 to scan a class "C" address and + /16 for a class "B". + + Nmap also has a more powerful notation which lets you specify an IP + address using lists/ranges for each element. Thus you can scan the + whole class "B" network 192.168.*.* by specifying "192.168.*.*" or + "192.168.0-255.0-255" or even "192.168.1-50,51-255.1,2,3,4,5-255". And + of course you can use the mask notation: "192.168.0.0/16". These are + all equivalent. If you use asterisks ("*"), remember that most shells + require you to escape them with back slashes or protect them with + quotes. + + Another interesting thing to do is slice the Internet the other way. + Instead of scanning all the hosts in a class "B", scan "*.*.5.6-7" to + scan every IP address that ends in .5.6 or .5.7 Pick your own numbers. + For more information on specifying hosts to scan, see the <I>examples</I> sec- + tion. + + +</PRE> +<H2>EXAMPLES</H2><PRE> + Here are some examples of using nmap, from simple and normal to a lit- + tle more complex/esoteric. Note that actual numbers and some actual + domain names are used to make things more concrete. In their place you + should substitute addresses/names from <B>your</B> <B>own</B> <B>network.</B> I do not + think portscanning other networks is illegal; nor should portscans be + construed by others as an attack. I have scanned hundreds of thousands + of machines and have received only one complaint. But I am not a + lawyer and some (anal) people may be annoyed by <I>nmap</I> probes. Get + permission first or use at your own risk. + + <B>nmap</B> <B>-v</B> <B>target.example.com</B> + + This option scans all reserved TCP ports on the machine target.exam- + ple.com . The -v means turn on verbose mode. + + <B>nmap</B> <B>-sS</B> <B>-O</B> <B>target.example.com/24</B> + + Launches a stealth SYN scan against each machine that is up out of the + 255 machines on class "C" where target.example.com resides. It also + tries to determine what operating system is running on each host that + is up and running. This requires root privileges because of the SYN + scan and the OS detection. + + <B>nmap</B> <B>-sX</B> <B>-p</B> <B>22,53,110,143,4564</B> <B>198.116.*.1-127</B> + + Sends an Xmas tree scan to the first half of each of the 255 possible 8 + bit subnets in the 198.116 class "B" address space. We are testing + whether the systems run sshd, DNS, pop3d, imapd, or port 4564. Note + that Xmas scan doesn’t work on Microsoft boxes due to their deficient + TCP stack. Same goes with CISCO, IRIX, HP/UX, and BSDI boxes. + + <B>nmap</B> <B>-v</B> <B>--randomize_hosts</B> <B>-p</B> <B>80</B> <B>*.*.2.3-5</B> + + Rather than focus on a specific IP range, it is sometimes interesting + to slice up the entire Internet and scan a small sample from each + slice. This command finds all web servers on machines with IP + addresses ending in .2.3, .2.4, or .2.5. If you are root you might as + well add -sS. Also you will find more interesting machines starting at + 127. so you might want to use "127-222" instead of the first asterisks + because that section has a greater density of interesting machines + (IMHO). + + <B>host</B> <B>-l</B> <B>company.com</B> <B>|</B> <B>cut</B> <B>-d</B> <B>-f</B> <B>4</B> <B>|</B> <B>./nmap</B> <B>-v</B> <B>-iL</B> <B>-</B> + + Do a DNS zone transfer to find the hosts in company.com and then feed + the IP addresses to <I>nmap.</I> The above commands are for my GNU/Linux box. + You may need different commands/options on other operating systems. + + +</PRE> +<H2>BUGS</H2><PRE> + Bugs? What bugs? Send me any that you find. Patches are nice too :) + Remember to also send in new OS fingerprints so we can grow the + database. Nmap will give you a submission URL when an appropriate fin- + gerprint is found. + + +</PRE> +<H2>AUTHOR</H2><PRE> + Fyodor <I><[email protected]></I> + + +</PRE> +<H2>DISTRIBUTION</H2><PRE> + The newest version of <I>nmap</I> can be obtained from <I>http://www.inse-</I> + <I>cure.org/nmap/</I> + + The Nmap Security Scanner is (C) 1996-2004 Insecure.Com LLC. Nmap is + also a registered trademark of Insecure.Com LLC. This program is free + software; you may redistribute and/or modify it under the terms of the + GNU General Public License as published by the Free Software Founda- + tion; Version 2. This guarantees your right to use, modify, and redis- + tribute this software under certain conditions. If you wish to embed + Nmap technology into proprietary software, we may be willing to sell + alternative licenses (contact [email protected]). Many security scan- + ner vendors already license Nmap technology such as our remote OS fin- + gerprinting database and code, service/version detection system, and + port scanning code. + + Note that the GPL places important restrictions on "derived works", yet + it does not provide a detailed definition of that term. To avoid mis- + understandings, we consider an application to constitute a "derivative + work" for the purpose of this license if it does any of the following: + + o Integrates source code from Nmap + + o Reads or includes Nmap copyrighted data files, such as nmap-os-fin- + gerprints or nmap-service-probes. + + o Executes Nmap and parses the results (as opposed to typical shell or + execution-menu apps, which simply display raw Nmap output and so are + not derivative works.) + + o Integrates/includes/aggregates Nmap into a proprietary executable + installer, such as those produced by InstallShield. + + o Links to a library or executes a program that does any of the above + + The term "Nmap" should be taken to also include any portions or derived + works of Nmap. This list is not exclusive, but is just meant to clar- + ify our interpretation of derived works with some common examples. + These restrictions only apply when you actually redistribute Nmap. For + example, nothing stops you from writing and selling a proprietary + front-end to Nmap. Just distribute it by itself, and point people to + http://www.insecure.org/nmap/ to download Nmap. + + We don’t consider these to be added restrictions on top of the GPL, but + just a clarification of how we interpret "derived works" as it applies + to our GPL-licensed Nmap product. This is similar to the way Linus + Torvalds has announced his interpretation of how "derived works" + applies to Linux kernel modules. Our interpretation refers only to + Nmap - we don’t speak for any other GPL products. + + If you have any questions about the GPL licensing restrictions on using + Nmap in non-GPL works, we would be happy to help. As mentioned above, + we also offer alternative license to integrate Nmap into proprietary + applications and appliances. These contracts have been sold to many + security vendors, and generally include a perpetual license as well as + providing for priority support and updates as well as helping to fund + the continued development of Nmap technology. Please email sales@inse- + cure.com for further information. + + As a special exception to the GPL terms, Insecure.Com LLC grants per- + mission to link the code of this program with any version of the + OpenSSL library which is distributed under a license identical to that + listed in the included Copying.OpenSSL file, and distribute linked com- + binations including the two. You must obey the GNU GPL in all respects + for all of the code used other than OpenSSL. If you modify this file, + you may extend this exception to your version of the file, but you are + not obligated to do so. + + If you received these files with a written license agreement or con- + tract stating terms other than the terms above, then that alternative + license agreement takes precedence over these comments. + + Source is provided to this software because we believe users have a + right to know exactly what a program is going to do before they run it. + This also allows you to audit the software for security holes (none + have been found so far). + + Source code also allows you to port Nmap to new platforms, fix bugs, + and add new features. You are highly encouraged to send your changes + to [email protected] for possible incorporation into the main distri- + bution. By sending these changes to Fyodor or one the Insecure.Org + development mailing lists, it is assumed that you are offering Fyodor + and Insecure.Com LLC the unlimited, non-exclusive right to reuse, mod- + ify, and relicense the code. Nmap will always be available Open + Source, but this is important because the inability to relicense code + has caused devastating problems for other Free Software projects (such + as KDE and NASM). We also occasionally relicense the code to third + parties as discussed above. If you wish to specify special license + conditions of your contributions, just say so when you send them. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of MER- + CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + Public License for more details at http://www.gnu.org/copyleft/gpl.html + , or in the COPYING file included with Nmap. + + It should also be noted that Nmap has been known to crash certain + poorly written applications, TCP/IP stacks, and even operating systems. + <B>Nmap</B> <B>should</B> <B>never</B> <B>be</B> <B>run</B> <B>against</B> <B>mission</B> <B>critical</B> <B>systems</B> unless you + are prepared to suffer downtime. We acknowledge here that Nmap may + crash your systems or networks and we disclaim all liability for any + damage or problems Nmap could cause. + + Because of the slight risk of crashes and because a few black hats like + to use Nmap for reconnaissance prior to attacking systems, there are + administrators who become upset and may complain when their system is + scanned. Thus, it is often advisable to request permission before + doing even a light scan of a network. + + Nmap should never be installed with special privileges (eg suid root) + for security reasons. + + This product includes software developed by the Apache Software Founda- + tion (http://www.apache.org/). The <I>Libpcap</I> portable packet capture + library is distributed along with nmap. Libpcap was originally copy- + righted by Van Jacobson, Craig Leres and Steven McCanne, all of the + Lawrence Berkeley National Laboratory, University of California, Berke- + ley, CA. It is now maintained by http://www.tcpdump.org . + + Regular expression support is provided by the PCRE library package, + which is open source software, written by Philip Hazel, and copyright + by the University of Cambridge, England. See http://www.pcre.org/ . + + Nmap can optionally link to the OpenSSL cryptography toolkit, which is + available from http://www.openssl.org/ . + + US Export Control: Insecure.Com LLC believes that Nmap falls under US + ECCN (export control classification number) 5D992. This category is + called ’"Information Security" "software" not controlled by 5D002’. + The only restriction of this classification is AT (anti-terrorism), + which applies to almost all goods and denies export to a handful of + rogue nations such as Iran and North Korea. Thus exporting Nmap does + not require any special license, permit, or other governmental autho- + rization. + + + + <B>NMAP(1)</B> +</PRE> +<HR> +<ADDRESS> +Man(1) output converted with +<a href="http://www.oac.uci.edu/indiv/ehood/man2html.html">man2html</a> +</ADDRESS> +</BODY> +</HTML> diff --git a/src/nmap_manpage.html.diff b/src/nmap_manpage.html.diff new file mode 100644 index 0000000..bcdf5a6 --- /dev/null +++ b/src/nmap_manpage.html.diff @@ -0,0 +1,557 @@ +--- /usr/share/doc/nmap-3.93/nmap_manpage.html 2005-09-12 20:11:41.000000000 +0930 ++++ /home/c/knmap/src/nmap_manpage.html 2005-11-09 09:35:59.000000000 +0930 +@@ -78,7 +78,7 @@ + + <B>SCAN</B> <B>TYPES</B> + +- <B>-sS</B> TCP SYN scan: This technique is often referred to as "half-open" ++ <B id="-sS">-sS</B> TCP SYN scan: This technique is often referred to as "half-open" + scanning, because you don’t open a full TCP connection. You send + a SYN packet, as if you are going to open a real connection and + you wait for a response. A SYN|ACK indicates the port is listen- +@@ -89,7 +89,7 @@ + Unfortunately you need root privileges to build these custom SYN + packets. This is the default scan type for privileged users. + +- <B>-sT</B> TCP connect() scan: This is the most basic form of TCP scanning. ++ <B id="-sT">-sT</B> TCP connect() scan: This is the most basic form of TCP scanning. + The connect() system call provided by your operating system is + used to open a connection to every interesting port on the + machine. If the port is listening, connect() will succeed, oth- +@@ -102,7 +102,7 @@ + which accept() the connection just to have it immediately shut- + down. This is the default scan type for unprivileged users. + +- <B>-sF</B> <B>-sX</B> <B>-sN</B> ++ <B id="-sF">-sF</B> <B id="-sX">-sX</B> <B id="-sN">-sN</B> + Stealth FIN, Xmas Tree, or Null scan modes: There are times when + even SYN scanning isn’t clandestine enough. Some firewalls and + packet filters watch for SYNs to restricted ports, and programs +@@ -133,7 +133,7 @@ + HP/UX, MVS, and IRIX. All of the above send resets from the + open ports when they should just drop the packet. + +- <B>-sP</B> Ping scanning: Sometimes you only want to know which hosts on a ++ <B id="-sP">-sP</B> Ping scanning: Sometimes you only want to know which hosts on a + network are up. Nmap can do this by sending ICMP echo request + packets to every IP address on the networks you specify. Hosts + that respond are up. Unfortunately, some sites such as +@@ -151,7 +151,7 @@ + respond are scanned. Only use this option if you wish to ping + sweep <B>without</B> doing any actual port scans. + +- <B>-sV</B> Version detection: After TCP and/or UDP ports are discovered ++ <B id="-sV">-sV</B> Version detection: After TCP and/or UDP ports are discovered + using one of the other scan methods, version detection communi- + cates with those ports to try and determine more about what is + actually running. A file called nmap-service-probes is used to +@@ -177,7 +177,7 @@ + version scanning is doing (this is a subset of what you would + get with --packet_trace). + +- <B>-sU</B> UDP scans: This method is used to determine which UDP (User ++ <B id="-sU">-sU</B> UDP scans: This method is used to determine which UDP (User + Datagram Protocol, RFC 768) ports are open on a host. The tech- + nique is to send 0 byte UDP packets to each port on the target + machine. If we receive an ICMP port unreachable message, then +@@ -215,7 +215,7 @@ + <B>very</B> quickly. Whoop! + + +- <B>-sO</B> IP protocol scans: This method is used to determine which IP ++ <B id="-sO">-sO</B> IP protocol scans: This method is used to determine which IP + protocols are supported on a host. The technique is to send raw + IP packets without any further protocol header to each specified + protocol on the target machine. If we receive an ICMP protocol +@@ -229,7 +229,7 @@ + field has only 8 bits, so at most 256 protocols can be probed + which should be possible in reasonable time anyway. + +- <B>-sI</B> <B><zombie</B> <B>host[:probeport]></B> ++ <B id="-sI">-sI</B> <B><zombie</B> <B>host[:probeport]></B> + Idlescan: This advanced scan method allows for a truly blind TCP + port scan of the target (meaning no packets are sent to the tar- + get from your real IP address). Instead, a unique side-channel +@@ -257,7 +257,7 @@ + Otherwise Nmap will use the port it uses by default for "tcp + pings". + +- <B>-sA</B> ACK scan: This advanced method is usually used to map out fire- ++ <B id="-sA">-sA</B> ACK scan: This advanced method is usually used to map out fire- + wall rulesets. In particular, it can help determine whether a + firewall is stateful or just a simple packet filter that blocks + incoming SYN packets. +@@ -272,7 +272,7 @@ + RSTs). This scan will obviously never show ports in the "open" + state. + +- <B>-sW</B> Window scan: This advanced scan is very similar to the ACK scan, ++ <B id="-sW">-sW</B> Window scan: This advanced scan is very similar to the ACK scan, + except that it can sometimes detect open ports as well as fil- + tered/unfiltered due to an anomaly in the TCP window size + reporting by some operating systems. Systems vulnerable to this +@@ -282,7 +282,7 @@ + 4.X, Ultrix, VAX, and VxWorks. See the nmap-hackers mailing + list archive for a full list. + +- <B>-sR</B> RPC scan. This method works in combination with the various ++ <B id="-sR">-sR</B> RPC scan. This method works in combination with the various + port scan methods of Nmap. It takes all the TCP/UDP ports found + open and then floods them with SunRPC program NULL commands in + an attempt to determine whether they are RPC ports, and if so, +@@ -294,11 +294,11 @@ + matically enabled as part of version scan (-sV) if you request + that. + +- <B>-sL</B> List scan. This method simply generates and prints a list of IP ++ <B id="-sL">-sL</B> List scan. This method simply generates and prints a list of IP + addresses or hostnames without actually pinging or port scanning + them. DNS name resolution will be performed unless you use -n. + +- <B>-b</B> <B><ftp</B> <B>relay</B> <B>host></B> ++ <B id="-b">-b</B> <B><ftp</B> <B>relay</B> <B>host></B> + FTP bounce attack: An interesting "feature" of the ftp protocol + (RFC 959) is support for "proxy" ftp connections. In other + words, I should be able to connect from evil.com to the FTP +@@ -332,7 +332,7 @@ + odds of penetrating strict firewalls by sending many probe types + using different TCP ports/flags and ICMP codes. + +- <B>-P0</B> Do not try to ping hosts at all before scanning them. This ++ <B id="-P0">-P0</B> Do not try to ping hosts at all before scanning them. This + allows the scanning of networks that don’t allow ICMP echo + requests (or responses) through their firewall. microsoft.com + is an example of such a network, and thus you should always use +@@ -342,7 +342,7 @@ + trary combinations of TCP, UDP, and ICMP probes. By default, + Nmap sends an ICMP echo request and a TCP ACK packet to port 80. + +- <B>-PA</B> <B>[portlist]</B> ++ <B id="-PA">-PA</B> <B>[portlist]</B> + Use TCP ACK "ping" to determine what hosts are up. Instead of + sending ICMP echo request packets and waiting for a response, we + spew out TCP ACK packets throughout the target network (or to a +@@ -356,13 +356,13 @@ + 80, since this port is often not filtered out. Note that this + option now accepts multiple, comma-separated port numbers. + +- <B>-PS</B> <B>[portlist]</B> ++ <B id="-PS">-PS</B> <B>[portlist]</B> + This option uses SYN (connection request) packets instead of ACK + packets for root users. Hosts that are up should respond with a + RST (or, rarely, a SYN|ACK). You can set the destination ports + in the same manner as -PA above. + +- <B>-PR</B> This option specifies a raw ethernet ARP ping. It cannot be ++ <B id="-PR">-PR</B> This option specifies a raw ethernet ARP ping. It cannot be + used in combination with any of the other ping types. When the + target machines are on the same network you are scanning from, + this is the fastest and most reliable (because it goes below IP- +@@ -374,7 +374,7 @@ + UDP services won’t reply to an empty packet, your best bet might + be to send this to expected-closed ports rather than open ones. + +- <B>-PE</B> This option uses a true ping (ICMP echo request) packet. It ++ <B id="-PE">-PE</B> This option uses a true ping (ICMP echo request) packet. It + finds hosts that are up and also looks for subnet-directed + broadcast addresses on your network. These are IP addresses + which are externally reachable and translate to a broadcast of +@@ -382,10 +382,10 @@ + eliminated if found as they allow for numerous denial of service + attacks (Smurf is the most common). + +- <B>-PP</B> Uses an ICMP timestamp request (type 13) packet to find listen- ++ <B id="-PP">-PP</B> Uses an ICMP timestamp request (type 13) packet to find listen- + ing hosts. + +- <B>-PM</B> Same as <B>-PE</B> and <B>-PP</B> except uses a netmask request (ICMP type ++ <B id="-PM">-PM</B> Same as <B>-PE</B> and <B>-PP</B> except uses a netmask request (ICMP type + 17). + + <B>-PB</B> This is the default ping type. It uses both the ACK ( <B>-PA</B> ) and +@@ -397,7 +397,7 @@ + "PA" (or rely on the default behavior) to achieve this same + effect. + +- <B>-O</B> This option activates remote host identification via TCP/IP fin- ++ <B id="-O">-O</B> This option activates remote host identification via TCP/IP fin- + gerprinting. In other words, it uses a bunch of techniques to + detect subtleties in the underlying operating system network + stack of the computers you are scanning. It uses this informa- +@@ -436,7 +436,7 @@ + for each packet they send. This makes them vulnerable to sev- + eral advanced information gathering and spoofing attacks. + +- <B>--osscan_limit</B> ++ <B id="--osscan_limit">--osscan_limit</B> + OS detection is far more effective if at least one open and one + closed TCP port are found. Set this option and Nmap will not + even try OS detection against hosts that do not meet this crite- +@@ -444,7 +444,7 @@ + against many hosts. It only matters when OS detection is + requested (-O or -A options). + +- <B>-A</B> This option enables _a_dditional _a_dvanced and _a_ggressive ++ <B id="-A">-A</B> This option enables _a_dditional _a_dvanced and _a_ggressive + options. I haven’t decided exactly which it stands for yet :). + Presently this enables OS Detection (-O) and version scanning + (-sV). More features may be added in the future. The point is +@@ -453,7 +453,7 @@ + enables features, and not timing options (such as -T4) or ver- + bosity options (-v) that you might wan’t as well. + +- <B>-6</B> This options enables IPv6 support. All targets must be IPv6 if ++ <B id="-6">-6</B> This options enables IPv6 support. All targets must be IPv6 if + this option is used, and they can be specified via normal DNS + name (AAAA record) or as a literal IP address such as + 3ffe:501:4819:2000:210:f3ff:fe03:4d0 . Currently, connect() TCP +@@ -461,7 +461,7 @@ + or other scan types, have a look at http://nmap6.source- + forge.net/ . + +- <B>--send_eth</B> ++ <B id="--send_eth">--send_eth</B> + Asks Nmap to send packets at the raw ethernet (data link) layer + rather than the higher IP (network) layer. By default, Nmap + chooses the one which is generally best for the platform it is +@@ -471,12 +471,12 @@ + port. Nmap still uses raw IP packets when there is no other + choice (such as non-ethernet connections). + +- <B>--send_ip</B> ++ <B id="--send_ip">--send_ip</B> + Asks Nmap to send packets via raw IP sockets rather than sending + lower level ethernet frames. It is the complement to the + --send-eth option.discussed previously. + +- <B>--spoof_mac</B> <B>[mac,</B> <B>prefix,</B> <B>or</B> <B>vendor</B> <B>substring]</B> ++ <B id="--spoof_mac">--spoof_mac</B> <B>[mac,</B> <B>prefix,</B> <B>or</B> <B>vendor</B> <B>substring]</B> + Ask Nmap to use the given MAC address for all of the raw ether- + net frames it sends. The MAC given can take several formats. + If it is simply the string "0", Nmap chooses a completely random +@@ -492,7 +492,7 @@ + are "Apple", "0", "01:02:03:04:05:06", "deadbeefcafe", "0020F2", + and "Cisco". + +- <B>-f</B> This option causes the requested scan (including ping scans) to ++ <B id="-f">-f</B> This option causes the requested scan (including ping scans) to + use tiny fragmented IP packets. The idea is to split up the TCP + header over several packets to make it harder for packet fil- + ters, intrusion detection systems, and other annoyances to +@@ -521,7 +521,7 @@ + It works fine for my Linux, FreeBSD, and OpenBSD boxes and some + people have reported success with other *NIX variants. + +- <B>-v</B> Verbose mode. This is a highly recommended option and it gives ++ <B id="-v">-v</B> Verbose mode. This is a highly recommended option and it gives + out more information about what is going on. You can use it + twice for greater effect. You can also use <B>-d</B> a few times if + you really want to get crazy with scrolling the screen! +@@ -530,11 +530,11 @@ + options. As you may have noticed, this man page is not exactly + a "quick reference" :) + +- <B>-oN</B> <B><logfilename></B> ++ <B id="-oN">-oN</B> <B><logfilename></B> + This logs the results of your scans in a normal <B>human</B> <B>readable</B> + form into the file you specify as an argument. + +- <B>-oX</B> <B><logfilename></B> ++ <B id="-oX">-oX</B> <B><logfilename></B> + This logs the results of your scans in <B>XML</B> form into the file + you specify as an argument. This allows programs to easily cap- + ture and interpret Nmap results. You can give the argument "-" +@@ -546,7 +546,7 @@ + the XML output structure is available at http://www.inse- + cure.org/nmap/data/nmap.dtd . + +- <B>--stylesheet</B> <B><filename></B> ++ <B id="--stylesheet">--stylesheet</B> <B><filename></B> + Nmap ships with an XSL stylesheet named nmap.xsl for viewing or + translating XML output to HTML. The XML output includes an xml- + stylesheet directive which points to nmap.xml where it was ini- +@@ -563,12 +563,12 @@ + URL is often more useful, but the local filesystem locaton of + nmap.xsl is used by default for privacy reasons. + +- <B>--no_stylesheet</B> ++ <B id="--no_stylesheet">--no_stylesheet</B> + Specify this option to prevent Nmap from associating any XSL + stylesheet with its XML output. The xml-stylesheet directive is + omitted. + +- <B>-oG</B> <B><logfilename></B> ++ <B id="-oG">-oG</B> <B><logfilename></B> + This logs the results of your scans in a <B>grepable</B> form into the + file you specify as an argument. This simple format provides + all the information on one line (so you can easily grep for port +@@ -582,17 +582,17 @@ + will still go to stderr). Also note that "-v" will cause some + extra information to be printed. + +- <B>-oA</B> <B><basefilename></B> ++ <B id="-oA">-oA</B> <B><basefilename></B> + This tells Nmap to log in ALL the major formats (normal, + grepable, and XML). You give a base for the filename, and the + output files will be base.nmap, base.gnmap, and base.xml. + +- <B>-oS</B> <B><logfilename></B> ++ <B id="-oS">-oS</B> <B><logfilename></B> + thIs l0gz th3 r3suLtS of YouR ScanZ iN a <B>s|<ipT</B> <B>kiDd|3</B> f0rM iNto + THe fiL3 U sPecfy 4s an arGuMEnT! U kAn gIv3 the 4rgument "-" + (wItHOUt qUOteZ) to sh00t output iNT0 stDouT!@!! + +- <B>--resume</B> <B><logfilename></B> ++ <B id="--resume">--resume</B> <B><logfilename></B> + A network scan that is canceled due to control-C, network out- + age, etc. can be resumed using this option. The logfilename + must be either a normal (-oN) or grepable (-oG) log from the +@@ -600,7 +600,7 @@ + same as the aborted scan). Nmap will start on the machine after + the last one successfully scanned in the log file. + +- <B>--exclude</B> <B><host1</B> <B>[,host2][,host3],..."></B> ++ <B id="--exclude">--exclude</B> <B><host1</B> <B>[,host2][,host3],..."></B> + Specifies a list of targets (hosts, ranges, netblocks) that + should be excluded from a scan. Useful to keep from scanning + yourself, your ISP, particularly sensitive hosts, etc. +@@ -610,16 +610,16 @@ + targets are provided in an newline-delimited exclude_file rather + than on the command line. + +- <B>--allports</B> ++ <B id="--allports">--allports</B> + Causes version detection (-sV) to scan all open ports found, + including those excluded as dangerous (likely to cause crashes + or other problems) in nmap-service-probes. + +- <B>--append_output</B> ++ <B id="--append_output">--append_output</B> + Tells Nmap to append scan results to any output files you have + specified rather than overwriting those files. + +- <B>-iL</B> <B><inputfilename></B> ++ <B id="-iL">-iL</B> <B><inputfilename></B> + Reads target specifications from the file specified RATHER than + from the command line. The file should contain a list of host + or network expressions separated by spaces, tabs, or newlines. +@@ -628,7 +628,7 @@ + section <I>target</I> <I>specification</I> for more information on the expres- + sions you fill the file with. + +- <B>-iR</B> <B><num</B> <B>hosts></B> ++ <B id="-iR">-iR</B> <B><num</B> <B>hosts></B> + This option tells Nmap to generate its own hosts to scan by sim- + ply picking random numbers :). It will never end after the + given number of IPs has been scanned -- use 0 for a never-ending +@@ -637,7 +637,7 @@ + bored, try <I>nmap</I> <I>-sS</I> <I>-PS80</I> <I>-iR</I> <I>0</I> <I>-p</I> <I>80</I> to find some web servers + to look at. + +- <B>-p</B> <B><port</B> <B>ranges></B> ++ <B id="-p">-p</B> <B><port</B> <B>ranges></B> + This option specifies what ports you want to specify. For exam- + ple "-p 23" will only try port 23 of the target host(s). "-p + 20-30,139,60000-" scans ports between 20 and 30, port 139, and +@@ -656,13 +656,13 @@ + tocol qualifier is given, the port numbers are added to all pro- + tocol lists. + +- <B>-F</B> <B>Fast</B> <B>scan</B> <B>mode.</B> ++ <B id="-F">-F</B> <B>Fast</B> <B>scan</B> <B>mode.</B> + Specifies that you only wish to scan for ports listed in the + services file which comes with nmap (or the protocols file for + -sO). This is obviously much faster than scanning all 65535 + ports on a host. + +- <B>-D</B> <B><decoy1</B> <B>[,decoy2][,ME],...></B> ++ <B id="-D">-D</B> <B><decoy1</B> <B>[,decoy2][,ME],...></B> + Causes a decoy scan to be performed which makes it appear to the + remote host that the host(s) you specify as decoys are scanning + the target network too. Thus their IDS might report 5-10 port +@@ -708,7 +708,7 @@ + will filter out your spoofed packets, although many (currently + most) do not restrict spoofed IP packets at all. + +- <B>-S</B> <B><IP_Address></B> ++ <B id="-S">-S</B> <B><IP_Address></B> + In some circumstances, <I>nmap</I> may not be able to determine your + source address ( <I>nmap</I> will tell you if this is the case). In + this situation, use -S with your IP address (of the interface +@@ -723,11 +723,11 @@ + ning them. <B>-e</B> would generally be required for this sort of + usage. + +- <B>-e</B> <B><interface></B> ++ <B id="-e">-e</B> <B><interface></B> + Tells nmap what interface to send and receive packets on. Nmap + should be able to detect this but it will tell you if it cannot. + +- <B>--source_port</B> <B><portnumber></B> ++ <B id="-g">--source_port</B> <B><portnumber></B> + Sets the source port number used in scans. Many naive firewall + and packet filter installations make an exception in their rule- + set to allow DNS (53) or FTP-DATA (20) packets to come through +@@ -746,7 +746,7 @@ + for using this option, because I sometimes store useful informa- + tion in the source port number. + +- <B>--data_length</B> <B><number></B> ++ <B id="--data_length">--data_length</B> <B><number></B> + Normally Nmap sends minimalistic packets that only contain a + header. So its TCP packets are generally 40 bytes and ICMP echo + requests are just 28. This option tells Nmap to append the +@@ -755,22 +755,22 @@ + portscan packets are. This slows things down, but can be + slightly less conspicuous. + +- <B>-n</B> Tells Nmap to <B>NEVER</B> do reverse DNS resolution on the active IP ++ <B id="-n">-n</B> Tells Nmap to <B>NEVER</B> do reverse DNS resolution on the active IP + addresses it finds. Since DNS is often slow, this can help + speed things up. + +- <B>-R</B> Tells Nmap to <B>ALWAYS</B> do reverse DNS resolution on the target IP ++ <B id="-R">-R</B> Tells Nmap to <B>ALWAYS</B> do reverse DNS resolution on the target IP + addresses. Normally this is only done when a machine is found + to be alive. + +- <B>-r</B> Tells Nmap <B>NOT</B> to randomize the order in which ports are ++ <B id="-r">-r</B> Tells Nmap <B>NOT</B> to randomize the order in which ports are + scanned. + +- <B>--ttl</B> <B><value></B> ++ <B id="-ttl">--ttl</B> <B><value></B> + Sets the IPv4 time to live field in sent packets to the given + value. + +- <B>--privileged</B> ++ <B id="--privileged">--privileged</B> + Tells Nmap to simply assume that it is privileged enough to per- + form raw socket sends, packet sniffing, and similar operations + that usually require root privileges on UNIX systems. By +@@ -792,25 +792,25 @@ + activate this mode and then type usually more familiar and fea- + ture-complete. + +- <B>--randomize_hosts</B> ++ <B id="--randomize_hosts">--randomize_hosts</B> + Tells Nmap to shuffle each group of up to 2048 hosts before it + scans them. This can make the scans less obvious to various + network monitoring systems, especially when you combine it with + slow timing options (see below). + +- <B>-M</B> <B><max</B> <B>sockets></B> ++ <B id="-M">-M</B> <B><max</B> <B>sockets></B> + Sets the maximum number of sockets that will be used in parallel + for a TCP connect() scan (the default). This is useful to slow + down the scan a little bit and avoid crashing remote machines. + Another approach is to use -sS, which is generally easier for + machines to handle. + +- <B>--packet_trace</B> ++ <B id="--packet_trace">--packet_trace</B> + Tells Nmap to show all the packets it sends and receives in a + tcpdump-like format. This can be tremendously useful for debug- + ging, and is also a good learning tool. + +- <B>--datadir</B> <B>[directoryname]</B> ++ <B id="--datadir">--datadir</B> <B>[directoryname]</B> + Nmap obtains some special data at runtime in files named nmap- + service-probes, nmap-services, nmap-protocols, nmap-rpc, nmap- + mac-prefixes, and nmap-os-fingerprints. Nmap first searches +@@ -830,7 +830,7 @@ + meet your objectives. The following options provide a fine + level of control over the scan timing: + +- <B>-T</B> <B><Paranoid|Sneaky|Polite|Normal|Aggressive|Insane></B> ++ <B id="-T">-T</B> <B><Paranoid|Sneaky|Polite|Normal|Aggressive|Insane></B> + These are canned timing policies for conveniently expressing + your priorities to Nmap. <B>Paranoid</B> mode scans <B>very</B> slowly in the + hopes of avoiding detection by IDS systems. It serializes all +@@ -859,17 +859,17 @@ + line. Otherwise the defaults for the selected timing mode will + override your choices. + +- <B>--host_timeout</B> <B><milliseconds></B> ++ <B id="--host_timeout">--host_timeout</B> <B><milliseconds></B> + Specifies the amount of time Nmap is allowed to spend scanning a + single host before giving up on that IP. The default timing + mode has no host timeout. + +- <B>--max_rtt_timeout</B> <B><milliseconds></B> ++ <B id="--max_rtt_timeout">--max_rtt_timeout</B> <B><milliseconds></B> + Specifies the maximum amount of time Nmap is allowed to wait for + a probe response before retransmitting or timing out that par- + ticular probe. The default mode sets this to about 9000. + +- <B>--min_rtt_timeout</B> <B><milliseconds></B> ++ <B id="--min_rtt_timeout">--min_rtt_timeout</B> <B><milliseconds></B> + When the target hosts start to establish a pattern of responding + very quickly, Nmap will shrink the amount of time given per + probe. This speeds up the scan, but can lead to missed packets +@@ -877,13 +877,13 @@ + you can guarantee that Nmap will wait at least the given amount + of time before giving up on a probe. + +- <B>--initial_rtt_timeout</B> <B><milliseconds></B> ++ <B id="--initial_rtt_timeout">--initial_rtt_timeout</B> <B><milliseconds></B> + Specifies the initial probe timeout. This is generally only + useful when scanning firewalled hosts with -P0. Normally Nmap + can obtain good RTT estimates from the ping and the first few + probes. The default mode uses 6000. + +- <B>--max_hostgroup</B> <B><numhosts></B> ++ <B id="--max_hostgroup">--max_hostgroup</B> <B><numhosts></B> + Specifies the maximum number of hosts that Nmap is allowed to + scan in parallel. Most of the port scan techniques support + multi-host operation, which makes them much quicker. Spreading +@@ -894,7 +894,7 @@ + at a time) Nmap behavior. Note that the ping scanner handles + its own grouping, and ignores this value. + +- <B>--min_hostgroup</B> <B><numhosts></B> ++ <B id="--min_hostgroup">--min_hostgroup</B> <B><numhosts></B> + Specifies the minimum host group size (see previous entry). + Large values (such as 50) are often beneficial for unattended + scans, though they do take up more memory. Nmap may override +@@ -902,19 +902,19 @@ + the same network interface, and some scan types can only handle + one host at a time. + +- <B>--max_parallelism</B> <B><number></B> ++ <B id="--max_parallelism">--max_parallelism</B> <B><number></B> + Specifies the maximum number of scans Nmap is allowed to perform + in parallel. Setting this to one means Nmap will never try to + scan more than 1 port at a time. It also effects other parallel + scans such as ping sweep, RPC scan, etc. + +- <B>--min_parallelism</B> <B><number></B> ++ <B id="--min_parallelism">--min_parallelism</B> <B><number></B> + Tells Nmap to scan at least the given number of ports in paral- + lel. This can speed up scans against certain firewalled hosts + by an order of magnitude. But be careful -- results will become + unreliable if you push it too far. + +- <B>--scan_delay</B> <B><milliseconds></B> ++ <B id="--scan_delay">--scan_delay</B> <B><milliseconds></B> + Specifies the <B>minimum</B> amount of time Nmap must wait between + probes. This is mostly useful to reduce network load or to slow + the scan way down to sneak under IDS thresholds. Nmap will +@@ -924,7 +924,7 @@ + So Nmap will try to detect this and lower its rate of UDP probes + to one per second. + +- <B>--max_scan_delay</B> <B><milliseconds></B> ++ <B id="--max_scan_delay">--max_scan_delay</B> <B><milliseconds></B> + As noted above, Nmap will sometimes enforce a special delay + between sending packets. This can provide more accurate results + while reducing network congestion, but it can slow the scans +@@ -938,7 +938,7 @@ + + + </PRE> +-<H2>TARGET SPECIFICATION</H2><PRE> ++<H2 id="target">TARGET SPECIFICATION</H2><PRE> + Everything that isn’t an option (or option argument) in nmap is treated + as a target host specification. The simplest case is listing single + hostnames or IP addresses on the command line. If you want to scan a diff --git a/src/nmapoutputbuffer.cpp b/src/nmapoutputbuffer.cpp new file mode 100644 index 0000000..2667ce8 --- /dev/null +++ b/src/nmapoutputbuffer.cpp @@ -0,0 +1,41 @@ +/*************************************************************************** + * * + * Copyright (C) 2005 by Kevin Gilbert * + * [email protected] * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + ***************************************************************************/ + +#include "nmapoutputbuffer.h" + +// constructor +// =========== + +NmapOutputBuffer::NmapOutputBuffer( const uint bufferSize ) +: m_buffer( new char[ bufferSize]), + m_free( false ) +{ +} + +// destructor +// ========== + +NmapOutputBuffer::~NmapOutputBuffer( ) +{ delete [] m_buffer; +} + + diff --git a/src/nmapoutputbuffer.h b/src/nmapoutputbuffer.h new file mode 100644 index 0000000..b741dc4 --- /dev/null +++ b/src/nmapoutputbuffer.h @@ -0,0 +1,50 @@ +/*************************************************************************** + * * + * Copyright (C) 2005 by Kevin Gilbert * + * [email protected] * + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef _NMAPOUTPUTBUFFER_H_ +#define _NMAPOUTPUTBUFFER_H_ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include "global.h" + +class NmapOutputBuffer +{ public: + NmapOutputBuffer( const uint bufferSize ); + virtual ~NmapOutputBuffer( ); + + string buffer( ) const { return m_buffer; } + bool isFree( ) const { return m_free; } + uint length( ) const { return m_length; } + void length( const uint l ) { m_length = l; } + void setBusy( ) { m_free = false; } + void setFree( ) { m_free = true; } + + private: + string m_buffer; + bool m_free; + uint m_length; +}; + +#endif // _NMAPOUTPUTBUFFER_H_ diff --git a/src/outputwidget.cpp b/src/outputwidget.cpp new file mode 100644 index 0000000..2bc82c9 --- /dev/null +++ b/src/outputwidget.cpp @@ -0,0 +1,174 @@ +/*************************************************************************** + * * + * Copyright (C) 2005, 2006 by Kevin Gilbert * + * [email protected] * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + ***************************************************************************/ + +#include <qfile.h> +#include <qtimer.h> + +#include <kconfig.h> +#include <kdebug.h> +#include <klocale.h> +#include <kmessagebox.h> + +#include "knmap.h" +#include "outputwidget.h" + +// constructor +// =========== + +OutputWidget::OutputWidget( QWidget* parent, const char* name ) +: QTextEdit( parent, name ), + m_append( false ), + m_dataBytes( 0 ), + m_firstSave( true ), + m_priorType( OutputType( -1 )) +{ setFamily( "monospace" ); + setReadOnly( true ); + QTimer::singleShot( 0, this, SLOT( slotUpdateStatusBarText( ))); +} + +// addOutput +// ========= + +void OutputWidget::addOutput( const OutputType type, const char* buffer, const int buflen ) +{ m_dataBytes += buflen; + QString outputText = QString::fromLatin1( buffer, buflen ); + QString prependText; + + if( m_append && type == m_priorType && m_priorType != OutputType( -1 )) + { uint paraNo = paragraphs( ) - 1; + prependText = text( paraNo );; + prependText = prependText.left( prependText.length( ) - 1 ); + removeParagraph( paraNo ); + } + + m_append = buffer[ buflen - 1 ] != '\n'; + m_priorType = type; + + switch( type ) + { case Stderr: + m_dataBytes += 14; + append( "<b><i>" + prependText + outputText + "</i></b>" ); + break; + + case Stdin: + m_dataBytes +=7; + append( "<b>" + prependText + outputText + "</b>" ); + break; + + case Stdout: + append( prependText + outputText ); + break; + } + + slotUpdateStatusBarText(); +} + +// clearOutput +// =========== + +void OutputWidget::clearOutput( ) +{ m_dataBytes = 0; + clear( ); + slotUpdateStatusBarText(); +} + +// fileSave +// ======== + +bool OutputWidget::fileSave( const bool saveAs ) +{ if( (saveAs || m_firstSave) && !Knmap::getFilePath( "Output save file", m_path, true )) + return false; + + m_firstSave = false; + QFile file( m_path ); + + if( !file.open( IO_WriteOnly )) + { KMessageBox::error( this, QString( i18n( "Could not open \"%1\"\n%2" )).arg( m_path ).arg( file.errorString( ))); + return false; + } + + QTextStream stream( &file ); + uint noOfParagraphs = paragraphs( ); + uint paragraphNo; + + for( paragraphNo = 0; paragraphNo < noOfParagraphs; paragraphNo++ ) + stream << text( paragraphNo ) << endl; + + file.close( ); + return true; +} + +// fileSaveAs +// ========== + +bool OutputWidget::fileSaveAs( ) +{ return fileSave( true ); +} + +// readProfile +// =========== + +void OutputWidget::readProfile( KConfig* config ) +{ m_path = config->readPathEntry( "path" ); +} + +// saveProfile +// =========== + +void OutputWidget::saveProfile( KConfig* config ) +{ config->writeEntry( "path", m_path ); +} + +// slotUpdateStatusBarText +// ======================= + +void OutputWidget::slotUpdateStatusBarText( ) +{ QString dataBytes; + + if( m_dataBytes < 1024 ) + dataBytes = QString::number( m_dataBytes ) + " bytes"; + else + if( m_dataBytes < 1024 * 1024 ) + { float kiloBytes = m_dataBytes / float( 1024 ); + + if( kiloBytes < 10 ) + dataBytes.sprintf( "%.3f KBytes", kiloBytes ); + else + if( kiloBytes < 100 ) + dataBytes.sprintf( "%.2f KBytes", kiloBytes ); + else + dataBytes.sprintf( "%.1f KBytes", kiloBytes ); + } + else + { float megaBytes = m_dataBytes / float( 1024 * 1024 ); + + if( megaBytes < 10 ) + dataBytes.sprintf( "%.3f MBytes", megaBytes ); + else + if( megaBytes < 100 ) + dataBytes.sprintf( "%.2f MBytes", megaBytes ); + else + dataBytes.sprintf( "%.1f MBytes", megaBytes ); + } + + emit( statusBarText( QString( "Output: %1 lines (%2)" ).arg( QString::number( paragraphs( ) - 1 )).arg( dataBytes ))); +} diff --git a/src/outputwidget.h b/src/outputwidget.h new file mode 100644 index 0000000..8555fde --- /dev/null +++ b/src/outputwidget.h @@ -0,0 +1,79 @@ +/*************************************************************************** + * * + * Copyright (C) 2005, 2006 by Kevin Gilbert * + * [email protected] * + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef _OUTPUTWIDGET_H_ +#define _OUTPUTWIDGET_H_ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <qtextedit.h> +#include "global.h" + +// forward class definitions +// ========================= + +class KConfig; + +// OutputWidget class definition +// ============================= + +class OutputWidget : public QTextEdit +{ Q_OBJECT + + public: + OutputWidget( QWidget* parent = NULL, const char* name = NULL ); + + // output type definitions + // ======================= + + enum OutputType + { Stderr, + Stdin, + Stdout + }; + + void addOutput( const OutputType type, const char* buffer, const int buflen ); + void clearOutput( ); + bool fileSave( const bool saveAs = false ); + bool fileSaveAs( ); + void readProfile( KConfig* config ); + void saveProfile( KConfig* config ); + + signals: + void statusBarText( const QString& ); + + public slots: + void slotUpdateStatusBarText( ); + + private: + void appendLine( const OutputType type, const QString& text ); + + bool m_append; + uint m_dataBytes; + bool m_firstSave; + QString m_path; + OutputType m_priorType; +}; + +#endif // _OUTPUTWIDGET_H_ diff --git a/src/pandsoptions.cpp b/src/pandsoptions.cpp new file mode 100644 index 0000000..f007be0 --- /dev/null +++ b/src/pandsoptions.cpp @@ -0,0 +1,415 @@ +/*************************************************************************** + * * + * Copyright (C) 2005, 2006 by Kevin Gilbert * + * [email protected] * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + ***************************************************************************/ + +#include <qcheckbox.h> +#include <qlabel.h> +#include <qlayout.h> +#include <qlineedit.h> + +#include <kconfig.h> +#include <kdebug.h> +#include <kglobal.h> +#include <klocale.h> +#include <kmessagebox.h> + +#include "pandsoptions.h" +#include "whatsthis.h" + +// constructor +// =========== + +PAndSOptions::PAndSOptions( QWidget* parent, const char* name ) +: QWidget( parent, name ) +{ createLayout( ); +} + +// createLayout +// ============ + +void PAndSOptions::createLayout( ) +{ QGridLayout* gridLayout = new QGridLayout( this ); + + m_ackCheckBox = new QCheckBox( i18n( "TCP ACK (-PA)" ), this, "ack check" ); + m_ackLineEdit = new QLineEdit( this, "ack edit" ); + m_arpCheckBox = new QCheckBox( i18n( "ARP (-PR)" ), this, "arp check" ); + m_dontPingCheckBox = new QCheckBox( i18n( "Don't ping (-P0)" ), this, "dont ping check" ); + m_echoCheckBox = new QCheckBox( i18n( "ICMP echo (-PE)" ), this, "icmp echo check" ); + m_netmaskCheckBox = new QCheckBox( i18n( "ICMP netmask (-PM)" ), this, "icmp netmask check" ); + m_synCheckBox = new QCheckBox( i18n( "TCP SYN (-PS)" ), this, "syn check" ); + m_synLineEdit = new QLineEdit( this, "syn edit" ); + m_timestampCheckBox = new QCheckBox( i18n( "ICMP timestamp (-PP)" ), this, "icmp timestamp check" ); + + byte row = 1; + gridLayout->addWidget( new QLabel( " ", this ), row, 1 ); + gridLayout->addWidget( m_ackCheckBox, row++, 3 ); + gridLayout->addWidget( new QLabel( " ", this ), row, 1 ); + gridLayout->addWidget( m_ackLineEdit, row++, 3 ); + gridLayout->addWidget( new QLabel( "#", this ), row, 1 ); + gridLayout->addWidget( m_arpCheckBox, row++, 3 ); + gridLayout->addWidget( new QLabel( " ", this ), row, 1 ); + gridLayout->addWidget( m_dontPingCheckBox, row++, 3 ); + gridLayout->addWidget( new QLabel( "#", this ), row, 1 ); + gridLayout->addWidget( m_echoCheckBox, row++, 3 ); + byte rowBlock1 = row; + + row = 1; + gridLayout->addWidget( new QLabel( " ", this ), row, 5 ); + gridLayout->addWidget( m_netmaskCheckBox, row++, 7 ); + gridLayout->addWidget( new QLabel( " ", this ), row, 5 ); + gridLayout->addWidget( m_synCheckBox, row++, 7 ); + gridLayout->addWidget( new QLabel( " ", this ), row, 5 ); + gridLayout->addWidget( m_synLineEdit, row++, 7 ); + gridLayout->addWidget( new QLabel( "#", this ), row, 5 ); + gridLayout->addWidget( m_timestampCheckBox, row++, 7 ); + byte rowBlock2 = row; + + m_scanFTPBounceCheckBox = new QCheckBox( i18n( "FTP Bounce (-b)" ), this, "ftp bounce scan check" ); + m_scanFTPRelayLineEdit = new QLineEdit( this, "ftp relay edit" ); + m_scanIdleCheckBox = new QCheckBox( i18n( "Idle (-sI)" ), this, "idle scan check" ); + m_scanListCheckBox = new QCheckBox( i18n( "List Scan (-sL)" ), this, "list scan check" ); + m_scanNullCheckBox = new QCheckBox( i18n( "Null Scan (-sN)" ), this, "null scan check" ); + m_scanPingCheckBox = new QCheckBox( i18n( "Ping Scan (-sP)" ), this, "ping scan check" ); + m_scanProtocolCheckBox = new QCheckBox( i18n( "Protocol Scan (-sO)" ), this, "protocol scan check" ); + m_scanRPCCheckBox = new QCheckBox( i18n( "RPC (-sR)" ), this, "rpc scan check" ); + m_scanFINCheckBox = new QCheckBox( i18n( "Stealth FIN (-sF)" ), this, "fin scan check" ); + m_scanAckCheckBox = new QCheckBox( i18n( "TCP Ack Scan (-sA)" ), this, "ack scan check" ); + m_scanSYNCheckBox = new QCheckBox( i18n( "TCP SYN (-sS)" ), this, "syn scan check" ); + m_scanTCPConnectCheckBox = new QCheckBox( i18n( "TCP Connect (-sT)" ), this, "connect scan check" ); + m_scanUDPCheckBox = new QCheckBox( i18n( "UDP Scan (-sU)" ), this, "udp scan check" ); + m_scanVersionCheckBox = new QCheckBox( i18n( "Version Detection (-sV)" ), this, "version scan check" ); + m_scanWindowCheckBox = new QCheckBox( i18n( "Window Scan (-sW)" ), this, "window scan check" ); + m_scanXmasCheckBox = new QCheckBox( i18n( "Xmas Tree (-sX)" ), this, "xmas scan check" ); + m_zombieLineEdit = new QLineEdit( this, "zombie edit" ); + + row = 1; + gridLayout->addWidget( new QLabel( " ", this ), row, 9 ); + gridLayout->addWidget( m_scanFTPBounceCheckBox, row++, 11 ); + gridLayout->addWidget( new QLabel( " ", this ), row, 9 ); + gridLayout->addWidget( m_scanFTPRelayLineEdit, row++, 11 ); + gridLayout->addWidget( new QLabel( "#", this ), row, 9 ); + gridLayout->addWidget( m_scanIdleCheckBox, row++, 11 ); + gridLayout->addWidget( new QLabel( " ", this ), row, 9 ); + gridLayout->addWidget( m_zombieLineEdit, row++, 11 ); + gridLayout->addWidget( new QLabel( " ", this ), row, 9 ); + gridLayout->addWidget( m_scanListCheckBox, row++, 11 ); + gridLayout->addWidget( new QLabel( "#", this ), row, 9 ); + gridLayout->addWidget( m_scanNullCheckBox, row++, 11 ); + byte rowBlock3 = row; + + row = 1; + gridLayout->addWidget( new QLabel( " ", this ), row, 13 ); + gridLayout->addWidget( m_scanPingCheckBox, row++, 15 ); + gridLayout->addWidget( new QLabel( "#", this ), row, 13 ); + gridLayout->addWidget( m_scanProtocolCheckBox, row++, 15 ); + gridLayout->addWidget( new QLabel( " ", this ), row, 13 ); + gridLayout->addWidget( m_scanRPCCheckBox, row++, 15 ); + gridLayout->addWidget( new QLabel( "#", this ), row, 13 ); + gridLayout->addWidget( m_scanFINCheckBox, row++, 15 ); + gridLayout->addWidget( new QLabel( "#", this ), row, 13 ); + gridLayout->addWidget( m_scanAckCheckBox, row++, 15 ); + gridLayout->addWidget( new QLabel( "#", this ), row, 13 ); + gridLayout->addWidget( m_scanSYNCheckBox, row++, 15 ); + byte rowBlock4 = row; + + row = 1; + gridLayout->addWidget( new QLabel( " ", this ), row, 17 ); + gridLayout->addWidget( m_scanTCPConnectCheckBox, row++, 19 ); + gridLayout->addWidget( new QLabel( "#", this ), row, 17 ); + gridLayout->addWidget( m_scanUDPCheckBox, row++, 19 ); + gridLayout->addWidget( new QLabel( " ", this ), row, 17 ); + gridLayout->addWidget( m_scanVersionCheckBox, row++, 19 ); + gridLayout->addWidget( new QLabel( "#", this ), row, 17 ); + gridLayout->addWidget( m_scanWindowCheckBox, row++, 19 ); + gridLayout->addWidget( new QLabel( "#", this ), row, 17 ); + gridLayout->addWidget( m_scanXmasCheckBox, row++, 19 ); + byte rowBlock5 = row; + + gridLayout->setColStretch( 0, 5 ); + gridLayout->setColStretch( 2, 1 ); + gridLayout->setColStretch( 3, 20 ); + gridLayout->setColStretch( 4, 5 ); + gridLayout->setColStretch( 6, 1 ); + gridLayout->setColStretch( 7, 20 ); + gridLayout->setColStretch( 8, 5 ); + gridLayout->setColStretch( 10, 1 ); + gridLayout->setColStretch( 11, 20 ); + gridLayout->setColStretch( 12, 5 ); + gridLayout->setColStretch( 14, 1 ); + gridLayout->setColStretch( 15, 20 ); + gridLayout->setColStretch( 16, 5 ); + gridLayout->setColStretch( 18, 1 ); + gridLayout->setColStretch( 19, 20 ); + gridLayout->setColStretch( 20, 5 ); + + gridLayout->setRowStretch( 0, 10 ); + gridLayout->setRowStretch( _max_( rowBlock1, _max_( rowBlock2, _max_( rowBlock3, _max_( rowBlock4, rowBlock5 )))), 10 ); +} + +// finaliseInitialisation +// ====================== + +void PAndSOptions::finaliseInitialisation( ) +{ WhatsThis* whatsThis = new WhatsThis( this ); + + connect( m_ackCheckBox, SIGNAL( clicked( )), SLOT( slotAckClicked( ))); + connect( m_scanFTPBounceCheckBox, SIGNAL( clicked( )), SLOT( slotScanFTPBounceCheckBoxClicked( ))); + connect( m_scanIdleCheckBox, SIGNAL( clicked( )), SLOT( slotScanIdleCheckBoxClicked( ))); + connect( m_synCheckBox, SIGNAL( clicked( )), SLOT( slotSynClicked( ))); + connect( whatsThis, SIGNAL( clicked( )), SLOT( slotWhatsThisClicked( ))); + + connect( m_ackCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_ackLineEdit, SIGNAL( textChanged ( const QString& )), SIGNAL( optionsDirty( ))); + connect( m_arpCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_dontPingCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_echoCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_netmaskCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_scanAckCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_scanFINCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_scanFTPBounceCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_scanFTPRelayLineEdit, SIGNAL( textChanged ( const QString& )), SIGNAL( optionsDirty( ))); + connect( m_scanIdleCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_scanListCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_scanNullCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_scanPingCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_scanProtocolCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_scanRPCCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_scanSYNCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_scanTCPConnectCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_scanUDPCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_scanVersionCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_scanWindowCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_scanXmasCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_synCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_synLineEdit, SIGNAL( textChanged ( const QString& )), SIGNAL( optionsDirty( ))); + connect( m_timestampCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_zombieLineEdit, SIGNAL( textChanged ( const QString& )), SIGNAL( optionsDirty( ))); +} + +// getOptions +// ========== + +bool PAndSOptions::getOptions( bool& needRoot ) +{ m_ackState = m_ackCheckBox->isChecked( ); + m_ackValue = m_ackLineEdit->text( ); + m_arpState = m_arpCheckBox->isChecked( ); + m_dontPingState = m_dontPingCheckBox->isChecked( ); + m_echoState = m_echoCheckBox->isChecked( ); + m_netmaskState = m_netmaskCheckBox->isChecked( ); + m_scanAckState = m_scanAckCheckBox->isChecked( ); + m_scanFINState = m_scanFINCheckBox->isChecked( ); + m_scanFTPBounceState = m_scanFTPBounceCheckBox->isChecked( ); + m_scanFTPRelayHost = m_scanFTPRelayLineEdit->text( ); + m_scanIdleState = m_scanIdleCheckBox->isChecked( ); + m_scanListState = m_scanListCheckBox->isChecked( ); + m_scanNullState = m_scanNullCheckBox->isChecked( ); + m_scanPingState = m_scanPingCheckBox->isChecked( ); + m_scanProtocolState = m_scanProtocolCheckBox->isChecked( ); + m_scanRPCState = m_scanRPCCheckBox->isChecked( ); + m_scanSYNState = m_scanSYNCheckBox->isChecked( ); + m_scanTCPConnectState = m_scanTCPConnectCheckBox->isChecked( ); + m_scanUDPState = m_scanUDPCheckBox->isChecked( ); + m_scanVersionState = m_scanVersionCheckBox->isChecked( ); + m_scanWindowState = m_scanWindowCheckBox->isChecked( ); + m_scanXmasState = m_scanXmasCheckBox->isChecked( ); + m_synState = m_synCheckBox->isChecked( ); + m_synValue = m_synLineEdit->text( ); + m_timestampState = m_timestampCheckBox->isChecked( ); + m_zombieDetails = m_zombieLineEdit->text( ); + + needRoot = needRoot || + m_arpState || + m_echoState || + m_scanAckState || + m_scanFINState || + m_scanIdleState || + m_scanNullState || + m_scanProtocolState || + m_scanSYNState || + m_scanUDPState || + m_scanWindowState || + m_scanXmasState || + m_timestampState; + + return true; +} + +// readProfile +// =========== + +void PAndSOptions::readProfile( KConfig* config ) +{ m_ackState = config->readBoolEntry( "ackState" ); + m_ackValue = config->readEntry( "ackValue" ); + m_arpState = config->readBoolEntry( "arpState" ); + m_dontPingState = config->readBoolEntry( "dontPingState" ); + m_echoState = config->readBoolEntry( "echoState" ); + m_netmaskState = config->readBoolEntry( "netmaskState" ); + m_scanAckState = config->readBoolEntry( "scanAckState" ); + m_scanFINState = config->readBoolEntry( "scanFINState" ); + m_scanFTPBounceState = config->readBoolEntry( "scanFTPBounceState" ); + m_scanFTPRelayHost = config->readEntry( "scanFTPRelayHost" ); + m_scanIdleState = config->readBoolEntry( "scanIdleState" ); + m_scanListState = config->readBoolEntry( "scanListState" ); + m_scanNullState = config->readBoolEntry( "scanNullState" ); + m_scanPingState = config->readBoolEntry( "scanPingState" ); + m_scanProtocolState = config->readBoolEntry( "scanProtocolState" ); + m_scanRPCState = config->readBoolEntry( "scanRPCState" ); + m_scanSYNState = config->readBoolEntry( "scanSYNState" ); + m_scanTCPConnectState = config->readBoolEntry( "scanTCPConnectState" ); + m_scanUDPState = config->readBoolEntry( "scanUDPState" ); + m_scanVersionState = config->readBoolEntry( "scanVersionState" ); + m_scanWindowState = config->readBoolEntry( "scanWindowState" ); + m_scanXmasState = config->readBoolEntry( "scanXmasState" ); + m_synState = config->readBoolEntry( "synState" ); + m_synValue = config->readEntry( "synValue" ); + m_timestampState = config->readBoolEntry( "timestampState" ); + m_zombieDetails = config->readEntry( "zombieDetails" ); +} + +// saveProfile +// =========== + +void PAndSOptions::saveProfile( KConfig* config ) +{ config->writeEntry( "ackState", m_ackState ); + config->writeEntry( "ackValue", m_ackValue ); + config->writeEntry( "arpState", m_arpState ); + config->writeEntry( "dontPingState", m_dontPingState ); + config->writeEntry( "echoState", m_echoState ); + config->writeEntry( "netmaskState", m_netmaskState ); + config->writeEntry( "scanAckState", m_scanAckState ); + config->writeEntry( "scanFINState", m_scanFINState ); + config->writeEntry( "scanFTPBounceState", m_scanFTPBounceState ); + config->writeEntry( "scanFTPRelayHost", m_scanFTPRelayHost ); + config->writeEntry( "scanIdleState", m_scanIdleState ); + config->writeEntry( "scanListState", m_scanListState ); + config->writeEntry( "scanNullState", m_scanNullState ); + config->writeEntry( "scanPingState", m_scanPingState ); + config->writeEntry( "scanProtocolState", m_scanProtocolState ); + config->writeEntry( "scanRPCState", m_scanRPCState ); + config->writeEntry( "scanSYNState", m_scanSYNState ); + config->writeEntry( "scanTCPConnectState", m_scanTCPConnectState ); + config->writeEntry( "scanUDPState", m_scanUDPState ); + config->writeEntry( "scanVersionState", m_scanVersionState ); + config->writeEntry( "scanWindowState", m_scanWindowState ); + config->writeEntry( "scanXmasState", m_scanXmasState ); + config->writeEntry( "synState", m_synState ); + config->writeEntry( "synValue", m_synValue ); + config->writeEntry( "timestampState", m_timestampState ); + config->writeEntry( "zombieDetails", m_zombieDetails ); +} + +// setInitialValues +// ================ + +void PAndSOptions::setInitialValues( ) +{ m_ackCheckBox->setChecked( m_ackState ); + m_ackLineEdit->setText( m_ackValue ); + m_arpCheckBox->setChecked( m_arpState ); + m_dontPingCheckBox->setChecked( m_dontPingState ); + m_echoCheckBox->setChecked( m_echoState ); + m_netmaskCheckBox->setChecked( m_netmaskState ); + m_scanAckCheckBox->setChecked( m_scanAckState ); + m_scanFINCheckBox->setChecked( m_scanFINState ); + m_scanFTPBounceCheckBox->setChecked( m_scanFTPBounceState ); + m_scanFTPRelayLineEdit->setText( m_scanFTPRelayHost ); + m_scanIdleCheckBox->setChecked( m_scanIdleState ); + m_scanListCheckBox->setChecked( m_scanListState ); + m_scanNullCheckBox->setChecked( m_scanNullState ); + m_scanPingCheckBox->setChecked( m_scanPingState ); + m_scanProtocolCheckBox->setChecked( m_scanProtocolState ); + m_scanRPCCheckBox->setChecked( m_scanRPCState ); + m_scanSYNCheckBox->setChecked( m_scanSYNState ); + m_scanTCPConnectCheckBox->setChecked( m_scanTCPConnectState ); + m_scanUDPCheckBox->setChecked( m_scanUDPState ); + m_scanVersionCheckBox->setChecked( m_scanVersionState ); + m_scanWindowCheckBox->setChecked( m_scanWindowState ); + m_scanXmasCheckBox->setChecked( m_scanXmasState ); + m_synCheckBox->setChecked( m_synState ); + m_synLineEdit->setText( m_synValue ); + m_timestampCheckBox->setChecked( m_timestampState ); + m_zombieLineEdit->setText( m_zombieDetails ); + + slotAckClicked( ); + slotScanFTPBounceCheckBoxClicked( ); + slotScanIdleCheckBoxClicked( ); + slotSynClicked( ); +} + +// slotAckClicked +// ============== + +void PAndSOptions::slotAckClicked( ) +{ m_ackLineEdit->setEnabled( m_ackCheckBox->isChecked( )); +} + +// slotScanFTPBounceCheckBoxClicked +// ================================ + +void PAndSOptions::slotScanFTPBounceCheckBoxClicked( ) +{ m_scanFTPRelayLineEdit->setEnabled( m_scanFTPBounceCheckBox->isChecked( )); +} + +// slotScanIdleCheckBoxClicked +// =========================== + +void PAndSOptions::slotScanIdleCheckBoxClicked( ) +{ m_zombieLineEdit->setEnabled( m_scanIdleCheckBox->isChecked( )); +} + +// slotSynClicked +// ============== + +void PAndSOptions::slotSynClicked( ) +{ m_synLineEdit->setEnabled( m_synCheckBox->isChecked( )); +} + +// slotWhatsThisClicked +// ==================== + +void PAndSOptions::slotWhatsThisClicked( ) +{ if( m_ackCheckBox->hasMouse( )) emit( displayHelp( "-PA" )); + else if( m_ackLineEdit->hasMouse( )) emit( displayHelp( "-PA" )); + else if( m_arpCheckBox->hasMouse( )) emit( displayHelp( "-PR" )); + else if( m_dontPingCheckBox->hasMouse( )) emit( displayHelp( "-P0" )); + else if( m_echoCheckBox->hasMouse( )) emit( displayHelp( "-PE" )); + else if( m_netmaskCheckBox->hasMouse( )) emit( displayHelp( "-PM" )); + else if( m_scanAckCheckBox->hasMouse( )) emit( displayHelp( "-sA" )); + else if( m_scanFINCheckBox->hasMouse( )) emit( displayHelp( "-sF" )); + else if( m_scanFTPBounceCheckBox->hasMouse( )) emit( displayHelp( "-b" )); + else if( m_scanFTPRelayLineEdit->hasMouse( )) emit( displayHelp( "-b" )); + else if( m_scanIdleCheckBox->hasMouse( )) emit( displayHelp( "-sI" )); + else if( m_zombieLineEdit->hasMouse( )) emit( displayHelp( "-sI" )); + else if( m_scanListCheckBox->hasMouse( )) emit( displayHelp( "-sL" )); + else if( m_scanNullCheckBox->hasMouse( )) emit( displayHelp( "-sN" )); + else if( m_scanPingCheckBox->hasMouse( )) emit( displayHelp( "-sP" )); + else if( m_scanProtocolCheckBox->hasMouse( )) emit( displayHelp( "-sO" )); + else if( m_scanRPCCheckBox->hasMouse( )) emit( displayHelp( "-sR" )); + else if( m_scanTCPConnectCheckBox->hasMouse( )) emit( displayHelp( "-sT" )); + else if( m_scanUDPCheckBox->hasMouse( )) emit( displayHelp( "-sU" )); + else if( m_scanVersionCheckBox->hasMouse( )) emit( displayHelp( "-sV" )); + else if( m_scanWindowCheckBox->hasMouse( )) emit( displayHelp( "-sW" )); + else if( m_scanSYNCheckBox->hasMouse( )) emit( displayHelp( "-sS" )); + else if( m_scanXmasCheckBox->hasMouse( )) emit( displayHelp( "-sX" )); + else if( m_synCheckBox->hasMouse( )) emit( displayHelp( "-PS" )); + else if( m_synLineEdit->hasMouse( )) emit( displayHelp( "-PS" )); + else if( m_timestampCheckBox->hasMouse( )) emit( displayHelp( "-PP" )); + else emit( displayUnknown( )); +} diff --git a/src/pandsoptions.h b/src/pandsoptions.h new file mode 100644 index 0000000..92a487c --- /dev/null +++ b/src/pandsoptions.h @@ -0,0 +1,153 @@ +/*************************************************************************** + * * + * Copyright (C) 2005, 2006 by Kevin Gilbert * + * [email protected] * + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef _PANDSOPTIONS_H_ +#define _PANDSOPTIONS_H_ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <qwidget.h> +#include "global.h" + +// forward class definitions +// ========================= + +class QCheckBox; +class QLineEdit; +class KConfig; + +// SimpleOptions class definition +// ============================== + +class PAndSOptions : public QWidget +{ Q_OBJECT + + public: + PAndSOptions( QWidget* parent, const char* name = NULL ); + + void finaliseInitialisation( ); + bool getOptions( bool& needRoot ); + void readProfile( KConfig* config ); + void saveProfile( KConfig* config ); + void setInitialValues( ); + + bool ackState( ) const { return m_ackState; } + QString ackValue( ) const { return m_ackValue; } + bool arpState( ) const { return m_arpState; } + bool dontPingState( ) const { return m_dontPingState; } + bool echoState( ) const { return m_echoState; } + bool netmaskState( ) const { return m_netmaskState; } + bool scanAckState( ) const { return m_scanAckState; } + bool scanFINState( ) const { return m_scanFINState; } + bool scanFTPBounceState( ) const { return m_scanFTPBounceState; } + QString scanFTPRelayHost( ) const { return m_scanFTPRelayHost; } + bool scanIdleState( ) const { return m_scanIdleState; } + bool scanListState( ) const { return m_scanListState; } + bool scanNullState( ) const { return m_scanNullState; } + bool scanPingState( ) const { return m_scanPingState; } + bool scanProtocolState( ) const { return m_scanProtocolState; } + bool scanRPCState( ) const { return m_scanRPCState; } + bool scanSYNState( ) const { return m_scanSYNState; } + bool scanTCPConnectState( ) const { return m_scanTCPConnectState; } + bool scanUDPState( ) const { return m_scanUDPState; } + bool scanVersionState( ) const { return m_scanVersionState; } + bool scanWindowState( ) const { return m_scanWindowState; } + bool scanXmasState( ) const { return m_scanXmasState; } + bool synState( ) const { return m_synState; } + QString synValue( ) const { return m_synValue; } + bool timestampState( ) const { return m_timestampState; } + QString zombieDetails( ) const { return m_zombieDetails; } + + signals: + void disableFastScan( ); + void displayDocBook( const QString& ); + void displayHelp( const QString& ); + void displayUnknown( ); + void optionsDirty( ); + + private slots: + void slotAckClicked( ); + void slotScanFTPBounceCheckBoxClicked( ); + void slotScanIdleCheckBoxClicked( ); + void slotSynClicked( ); + void slotWhatsThisClicked( ); + + private: + void createLayout( ); + + QCheckBox* m_ackCheckBox; + QLineEdit* m_ackLineEdit; + bool m_ackState; + QString m_ackValue; + QCheckBox* m_arpCheckBox; + bool m_arpState; + QCheckBox* m_dontPingCheckBox; + bool m_dontPingState; + QCheckBox* m_echoCheckBox; + bool m_echoState; + QCheckBox* m_netmaskCheckBox; + bool m_netmaskState; + QCheckBox* m_scanAckCheckBox; + bool m_scanAckState; + QCheckBox* m_scanFINCheckBox; + bool m_scanFINState; + QCheckBox* m_scanFTPBounceCheckBox; + bool m_scanFTPBounceState; + QString m_scanFTPRelayHost; + QLineEdit* m_scanFTPRelayLineEdit; + QCheckBox* m_scanIdleCheckBox; + bool m_scanIdleState; + QCheckBox* m_scanListCheckBox; + bool m_scanListState; + QCheckBox* m_scanNullCheckBox; + bool m_scanNullState; + QCheckBox* m_scanPingCheckBox; + bool m_scanPingState; + QCheckBox* m_scanProtocolCheckBox; + bool m_scanProtocolState; + QCheckBox* m_scanRPCCheckBox; + bool m_scanRPCState; + QCheckBox* m_scanTCPConnectCheckBox; + bool m_scanTCPConnectState; + QCheckBox* m_scanUDPCheckBox; + bool m_scanUDPState; + QCheckBox* m_scanVersionCheckBox; + bool m_scanVersionState; + QCheckBox* m_scanWindowCheckBox; + bool m_scanWindowState; + QCheckBox* m_scanSYNCheckBox; + bool m_scanSYNState; + QCheckBox* m_scanXmasCheckBox; + bool m_scanXmasState; + QCheckBox* m_synCheckBox; + QLineEdit* m_synLineEdit; + bool m_synState; + QString m_synValue; + QCheckBox* m_timestampCheckBox; + bool m_timestampState; + QString m_zombieDetails; + QLineEdit* m_zombieLineEdit; +}; + +#endif // _PANDSOPTIONS_H_ diff --git a/src/profiledialog.cpp b/src/profiledialog.cpp new file mode 100644 index 0000000..b4c8f2b --- /dev/null +++ b/src/profiledialog.cpp @@ -0,0 +1,325 @@ +/*************************************************************************** + * * + * Copyright (C) 2005, 2006 by Kevin Gilbert * + * [email protected] * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + ***************************************************************************/ + +#include <qlabel.h> +#include <qlayout.h> +#include <qlineedit.h> +#include <qlistbox.h> +#include <qmap.h> +#include <qpopupmenu.h> + +#include <kapplication.h> +#include <kconfig.h> +#include <kdebug.h> +#include <kinputdialog.h> +#include <klocale.h> +#include <kmessagebox.h> + +#include "profiledialog.h" + +// constructor +// =========== + +ProfileDialog::ProfileDialog( Action action, + const QString& currentProfile, + QWidget* parent, + const char* name ) +: KDialogBase( Plain, "", Ok | Cancel, Ok, parent, name ), + m_action( action ) +{ switch( m_action ) + { case Copy: setCaption( "Copy profile" ); break; + case Delete: setCaption( "Delete profile" ); break; + case Load: setCaption( "Load profile" ); break; + case Rename: setCaption( "Rename profile" ); break; + case SaveAs: setCaption( "Save profile as" ); break; + } + + createlayout( ); + setInitialValues( currentProfile ); + + connect( m_profileListBox, SIGNAL( contextMenuRequested( QListBoxItem*, const QPoint& )), SLOT( slotProfileListContextMenu( QListBoxItem*, const QPoint& ))); + connect( m_profileListBox, SIGNAL( doubleClicked( QListBoxItem* )), SLOT( slotOk( ))); + connect( m_profileListBox, SIGNAL( selectionChanged( )), SLOT( slotProfileListBoxChanged( ))); +} + +// checkForDuplicateName +// ===================== + +bool ProfileDialog::checkForDuplicateName( const QString& profileName ) +{ if( !kapp->config( )->hasGroup( PROFILE_PREFIX + profileName )) + return true; + + KMessageBox::sorry( this, QString( i18n( "Profile \"%1\" already exists, please choose another name or press 'Cancel'" )).arg( profileName ), i18n( "Duplicate profile name" )); + return false; +} + +// constructNewProfileName +// ======================= + +QString ProfileDialog::constructNewProfileName( const QString& initialProfileName ) const +{ QString profileName = PROFILE_PREFIX + initialProfileName + "_copy"; + + while( kapp->config( )->hasGroup( profileName )) + profileName += "_copy"; + + return stripPrefix( profileName ); +} + +// copy +// ==== + +void ProfileDialog::copy( const QString& fromProfileName, const QString& toProfileName ) +{ QMap<QString, QString> map = kapp->config( )->entryMap( PROFILE_PREFIX + fromProfileName ); + kapp->config( )->setGroup( PROFILE_PREFIX + toProfileName ); + + for( QMap<QString, QString>::Iterator it = map.begin( ); it != map.end( ); ++it ) + kapp->config( )->writeEntry( it.key( ), it.data( )); + + m_profileListBox->insertItem( toProfileName ); + m_profileListBox->sort( ); +} + +// createlayout +// ============ + +void ProfileDialog::createlayout( ) +{ QGridLayout* layout = new QGridLayout( plainPage( )); + m_profileListBox = new QListBox( plainPage( ), "profiles list box" ); + m_profileLineEdit = new QLineEdit( plainPage( ), "profiles line edit" ); + + layout->addWidget( new QLabel( "Profile name: ", plainPage( ), "name label" ), 1, 1, Qt::AlignRight ); + layout->addWidget( m_profileLineEdit, 1, 2 ); + layout->addWidget( new QLabel( "Known profiles: ", plainPage( ), "name label" ), 3, 1, Qt::AlignRight | Qt::AlignTop ); + layout->addWidget( m_profileListBox, 3, 2 ); + + layout->setColStretch( 0, 1 ); + layout->setColStretch( 2, 20 ); + layout->setColStretch( 3, 1 ); + + layout->setRowStretch( 0, 2 ); + layout->setRowStretch( 2, 1 ); + layout->setRowStretch( 3, 10 ); + layout->setRowStretch( 4, 2 ); + + switch( m_action ) + { case Delete: + case Load: + m_profileLineEdit->setReadOnly( true ); + break; + + default: + break; + } +} + +// deelete +// ======= + +void ProfileDialog::deelete( const QString& profileName, const bool ask ) +{ if( !kapp->config( )->hasGroup( PROFILE_PREFIX + profileName )) + { ASSERT( false ); + return ; + } + + QListBoxItem* item = m_profileListBox->findItem( profileName, Qt::ExactMatch ); + ASSERT( item != NULL ); + + if( item != NULL ) + deelete( item, ask ); +} + +// deelete +// ======= + +void ProfileDialog::deelete( QListBoxItem* item, const bool ask ) +{ if( ask && KMessageBox::Yes != KMessageBox::questionYesNo( this, + QString( i18n( "Delete profile \"%1\"?" )).arg( item->text( )), + i18n( "Confirm profile deletion" ))) + return; + + kapp->config( )->deleteGroup( PROFILE_PREFIX + item->text( )); + m_profileListBox->takeItem( item ); + delete item; +} + +// getNewProfileName +// ================= + +bool ProfileDialog::getNewProfileName( QString& profileName ) +{ while( true ) + { bool ok; + profileName = KInputDialog::getText( i18n( "Profile name" ), i18n( "New profile name" ), profileName, &ok, this, "profile name" ); + + if( !ok ) + return false; + + if( checkForDuplicateName( profileName )) + break; + } + + return true; +} + +// setInitialValues +// ================ + +void ProfileDialog::setInitialValues( const QString& currentProfile ) +{ ushort currentItem = ushort( -1 ); + QStringList profileList = kapp->config( )->groupList( ); + ushort i; + QStringList::Iterator it; + + for( i = 0, it = profileList.begin( ); it != profileList.end( ); ++it ) + if( (*it).startsWith( PROFILE_PREFIX )) + { m_profileListBox->insertItem( stripPrefix( *it ), i ); + + if( *it == currentProfile ) + currentItem = i; + + i++; + } + + if( currentItem != ushort( -1 )) + { m_profileListBox->setSelected( currentItem, true ); + + if( m_action == Copy ) + m_profileLineEdit->setText( constructNewProfileName( m_profileListBox->currentText( ))); + else + m_profileLineEdit->setText( m_profileListBox->currentText( )); + } + + m_profileListBox->sort( ); +} + +// slotCopy +// ======== + +void ProfileDialog::slotCopy( ) +{ QString fromProfileName = m_contextItem->text( ); + QString toProfileName = constructNewProfileName( fromProfileName ); + + if( getNewProfileName( toProfileName )) + copy( fromProfileName, toProfileName ); +} + +// slotDelete +// ========== + +void ProfileDialog::slotDelete( ) +{ deelete( m_contextItem, true ); +} + +// slotOk +// ====== + +void ProfileDialog::slotOk( ) +{ QString fromProfileName; + QListBoxItem* item; + QString toProfileName; + + switch( m_action ) + { case Copy: + fromProfileName = m_profileListBox->currentText( ); + toProfileName = m_profileLineEdit->text( ); + + if( !checkForDuplicateName( toProfileName )) + return; + + copy( fromProfileName, toProfileName ); + break; + + case Delete: + deelete( m_profileLineEdit->text( ), true ); + break; + + case Load: + m_profileName = PROFILE_PREFIX + m_profileLineEdit->text( ); + break; + + case Rename: + fromProfileName = m_profileListBox->currentText( ); + toProfileName = m_profileLineEdit->text( ); + + if( !checkForDuplicateName( toProfileName )) + return; + + copy( fromProfileName, toProfileName ); + deelete( fromProfileName, false ); + break; + + case SaveAs: + m_profileName = m_profileLineEdit->text( ); + item = m_profileListBox->findItem( m_profileName, Qt::ExactMatch ); + + if( item != NULL ) + if( KMessageBox::Yes != KMessageBox::questionYesNo( this, QString( i18n( "Profile \"%1\" already exists - overwrite it?" )).arg( m_profileName ), i18n( "Profile exists" ))) + return; + + m_profileName = PROFILE_PREFIX + m_profileName; + break; + } + + KDialogBase::slotOk( ); +} + +// slotProfileListBoxChanged +// ========================= + +void ProfileDialog::slotProfileListBoxChanged( ) +{ if( m_action == Copy ) + m_profileLineEdit->setText( constructNewProfileName( m_profileListBox->currentText( ))); + else + m_profileLineEdit->setText( m_profileListBox->currentText( )); +} + +// slotProfileListContextMenu +// ========================== + +void ProfileDialog::slotProfileListContextMenu( QListBoxItem* item, const QPoint& pos ) +{ m_contextItem = item; + QPopupMenu* contextMenu = new QPopupMenu( this, "context menu" ); + + contextMenu->insertItem( i18n( "&Copy" ), this, SLOT( slotCopy( ))); + contextMenu->insertItem( i18n( "&Delete" ), this, SLOT( slotDelete( ))); + contextMenu->insertItem( i18n( "&Rename" ), this, SLOT( slotRename( ))); + + contextMenu->exec( pos ); +} + +// slotRename +// ========== + +void ProfileDialog::slotRename( ) +{ QString profileName = m_contextItem->text( ); + + if( getNewProfileName( profileName )) + { copy( m_contextItem->text( ), profileName ); + deelete( m_contextItem, false ); + } +} + +// stripPrefix +// =========== + +QString ProfileDialog::stripPrefix( const QString& profileName ) const +{ return profileName.right( profileName.length( ) - strlen( PROFILE_PREFIX )); +} diff --git a/src/profiledialog.h b/src/profiledialog.h new file mode 100644 index 0000000..3165dce --- /dev/null +++ b/src/profiledialog.h @@ -0,0 +1,90 @@ +/*************************************************************************** + * * + * Copyright (C) 2005, 2006 by Kevin Gilbert * + * [email protected] * + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef _GETPROFILEDIALOG_H_ +#define _GETPROFILEDIALOG_H_ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <kdialogbase.h> +#include "global.h" + +// forward class definitions +// ========================= + +class KConfig; +class QLineEdit; +class QListBox; +class QListBoxItem; +class QString; + +// ProfileDialog class definition +// ============================== + +class ProfileDialog : public KDialogBase +{ Q_OBJECT + + public: + enum Action + { Copy, + Delete, + Load, + Rename, + SaveAs + }; + + ProfileDialog( Action action, + const QString& currentProfile, + QWidget* parent = NULL, + const char* name = NULL ); + + QString profileName( ) const { return m_profileName; } + + private slots: + void slotOk( ); + void slotCopy( ); + void slotDelete( ); + void slotProfileListBoxChanged( ); + void slotProfileListContextMenu( QListBoxItem* item, const QPoint& pos ); + void slotRename( ); + + private: + bool checkForDuplicateName( const QString& profileName ); + QString constructNewProfileName( const QString& initialProfileName ) const; + void copy( const QString& fromProfileName, const QString& toProfileName ); + void createlayout( ); + void deelete( const QString& profileName, const bool ask ); + void deelete( QListBoxItem* item, const bool ask ); + bool getNewProfileName( QString& profileName ); + void setInitialValues( const QString& currentProfile ); + QString stripPrefix( const QString& profileName ) const; + + Action m_action; + QListBoxItem* m_contextItem; + QString m_profileName; + QLineEdit* m_profileLineEdit; + QListBox* m_profileListBox; +}; + +#endif // _GETPROFILEDIALOG_H_ diff --git a/src/scanmonitor.cpp b/src/scanmonitor.cpp new file mode 100644 index 0000000..413dd93 --- /dev/null +++ b/src/scanmonitor.cpp @@ -0,0 +1,139 @@ +/*************************************************************************** + * * + * Copyright (C) 2005 by Kevin Gilbert * + * [email protected] * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + ***************************************************************************/ + +#include <errno.h> +#include <stdio.h> +#include <string.h> +#include <sys/select.h> +#include <sys/time.h> + +#include <qapplication.h> + +#include <klocale.h> + +#include "nmapoutputbuffer.h" +#include "scanmonitor.h" +#include "scanmonitorevent.h" +#include "scanwidget.h" + +// constructor +// =========== + +ScanMonitor::ScanMonitor( ScanWidget* parent ) +: QThread( ), + m_buffer( NULL ), + m_nmapBufferSize( 16384 ), + m_parent( parent ) +{ m_buffers.setAutoDelete( true ); +} + +// getBuffer +// ========= + +void ScanMonitor::getBuffer( ) +{ for( m_buffer = m_buffers.first( ); m_buffer != NULL; m_buffer = m_buffers.next( )) + if( m_buffer->isFree( )) + { m_buffer->setBusy( ); + m_buffers.take( ); + m_buffers.append( m_buffer ); + return; + } + + m_buffer = new NmapOutputBuffer( m_nmapBufferSize ); + m_buffers.append( m_buffer ); +} + +// readNmapOutput +// ============== + +void ScanMonitor::readNmapOutput( const int pipeFD, const ScanMonitorEventType type ) +{ while( true ) + { if( m_buffer == NULL ) + getBuffer( ); + else + m_buffer->setBusy( ); + + int bytesRead = ::read( pipeFD, m_buffer->buffer( ), m_nmapBufferSize ); + + if( bytesRead > 0 ) + { m_buffer->length( bytesRead ); + QApplication::postEvent( m_parent, new ScanMonitorEvent( type, m_buffer )); + m_buffer = NULL; + continue; + } + + if( !bytesRead || errno == EAGAIN || errno == EBADF ) + { m_buffer->setFree( ); + break; + } + + QString text = QString( i18n( "error reading nmap output from pipe: %2\n" )).arg( strerror( errno )); + strcpy( m_buffer->buffer( ), text.ascii( )); + m_buffer->length( text.length( )); + QApplication::postEvent( m_parent, new ScanMonitorEvent( StderrType, m_buffer )); + m_buffer = NULL; + break; + } +} + +// run +// === + +void ScanMonitor::run( ) +{ fd_set efds; + fd_set rfds; + struct timeval timeout; + + while( true ) + { FD_ZERO( &efds ); + FD_ZERO( &rfds ); + + FD_SET( m_pipeStderrFD, &efds); + FD_SET( m_pipeStdoutFD, &efds); + + FD_SET( m_pipeStderrFD, &rfds); + FD_SET( m_pipeStdoutFD, &rfds); + + timeout.tv_sec = 2; + timeout.tv_usec = 0; + + if( !select( _max_( m_pipeStderrFD, m_pipeStdoutFD ) + 1, &rfds, NULL, &efds, &timeout )) + continue; + + if( FD_ISSET( m_pipeStderrFD, &efds ) || FD_ISSET( m_pipeStdoutFD, &efds )) + break; + + if( FD_ISSET( m_pipeStderrFD, &rfds )) + readNmapOutput( m_pipeStderrFD, StderrType ); + + if( FD_ISSET( m_pipeStdoutFD, &rfds )) + readNmapOutput( m_pipeStdoutFD, StdoutType ); + } +} + +// setPipeFDs +// ========== + +void ScanMonitor::setPipeFDs( const int pipeStderrFD, const int pipeStdoutFD ) +{ m_pipeStderrFD = pipeStderrFD; + m_pipeStdoutFD = pipeStdoutFD; +} diff --git a/src/scanmonitor.h b/src/scanmonitor.h new file mode 100644 index 0000000..8112f9a --- /dev/null +++ b/src/scanmonitor.h @@ -0,0 +1,68 @@ +/*************************************************************************** + * * + * Copyright (C) 2005 by Kevin Gilbert * + * [email protected] * + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef _SCANMONITOR_H_ +#define _SCANMONITOR_H_ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <qptrlist.h> +#include <qthread.h> + +#include "global.h" + +// forward class definitions +// ========================= + +class NmapOutputBuffer; +class ScanWidget; + +// ScanMonitor class definition +// ============================ + +class ScanMonitor : public QThread +{ public: + enum ScanMonitorEventType + { StderrType = QEvent::User, + StdoutType + }; + + ScanMonitor( ScanWidget* parent ); + void setPipeFDs( const int pipeStderrFD, const int pipeStdoutFD ); + + private: + void getBuffer( ); + void readNmapOutput( const int pipeFD, const ScanMonitorEventType type ); + void run( ); + + nobPtr m_buffer; + const uint m_nmapBufferSize; + ScanWidget* m_parent; + int m_pipeStderrFD; + int m_pipeStdoutFD; + + QPtrList<NmapOutputBuffer> m_buffers; +}; + +#endif // _SCANMONITOR_H_ diff --git a/src/scanmonitorevent.cpp b/src/scanmonitorevent.cpp new file mode 100644 index 0000000..825d9dd --- /dev/null +++ b/src/scanmonitorevent.cpp @@ -0,0 +1,32 @@ +/*************************************************************************** + * * + * Copyright (C) 2005 by Kevin Gilbert * + * [email protected] * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + ***************************************************************************/ + +#include "scanmonitorevent.h" + +// constructor +// =========== + +ScanMonitorEvent::ScanMonitorEvent( const int type, const nobPtr buffer ) +: QCustomEvent( type ), + m_buffer( buffer ) +{ +} diff --git a/src/scanmonitorevent.h b/src/scanmonitorevent.h new file mode 100644 index 0000000..1b86b6a --- /dev/null +++ b/src/scanmonitorevent.h @@ -0,0 +1,42 @@ +/*************************************************************************** + * * + * Copyright (C) 2005 by Kevin Gilbert * + * [email protected] * + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef _SCANMONITOREVENT_H_ +#define _SCANMONITOREVENT_H_ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <qevent.h> +#include "global.h" + +class ScanMonitorEvent : public QCustomEvent +{ public: + ScanMonitorEvent( const int type, const nobPtr buffer ); + nobPtr buffer( ) const { return m_buffer; } + + private: + nobPtr m_buffer; +}; + +#endif // _SCANMONITOREVENT_H_ diff --git a/src/scannamedialog.cpp b/src/scannamedialog.cpp new file mode 100644 index 0000000..4a1a645 --- /dev/null +++ b/src/scannamedialog.cpp @@ -0,0 +1,102 @@ +/*************************************************************************** + * * + * Copyright (C) 2005, 2006 by Kevin Gilbert * + * [email protected] * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + ***************************************************************************/ + +#include <qcheckbox.h> +#include <qlabel.h> +#include <qlayout.h> +#include <qlineedit.h> + +#include <kdebug.h> +#include <klocale.h> +#include <kmessagebox.h> + +#include "scannamedialog.h" +#include "scanwidget.h" + +// constructor +// =========== + +ScanNameDialog::ScanNameDialog( ScanWidget* scanWidget, QWidget* parent, const char* name ) +: KDialogBase( Plain, "Scan name", Ok | Cancel, Ok, parent, name ) +{ createlayout( ); + + if( scanWidget != NULL ) + { m_scanNameEdit->setText( scanWidget->scanName( )); + m_useHostNameCheckbox->setChecked( scanWidget->useTargetHost( )); + } + + if( !m_useHostNameCheckbox->isChecked( )) + m_scanNameEdit->setFocus( ); +} + +// createlayout +// ============ + +void ScanNameDialog::createlayout( ) +{ QGridLayout* gridLayout = new QGridLayout( plainPage( )); + byte row = 1; + + m_useHostNameCheckbox = new QCheckBox( "Use Target Host name", plainPage( ), "use target checkbox" ); + gridLayout->addWidget( m_useHostNameCheckbox, row++, 1 ); + + byte editRowTop = row++; + m_scanNameEdit = new QLineEdit( plainPage( ), "name edit" ); + gridLayout->addWidget( new QLabel( "Scan name", plainPage( ), "name label" ), row++, 1 ); + gridLayout->addWidget( m_scanNameEdit, row++, 1 ); + + gridLayout->setColStretch( 0, 1 ); + gridLayout->setColStretch( 1, 5 ); + gridLayout->setColStretch( 2, 1 ); + + gridLayout->setRowStretch( 0, 1 ); + gridLayout->setRowStretch( editRowTop, 1 ); + gridLayout->setRowStretch( row, 1 ); + + m_useHostNameCheckbox->setChecked( true ); + slotUseHostNameToggled( true ); + connect( m_useHostNameCheckbox, SIGNAL( toggled( bool )), SLOT( slotUseHostNameToggled( bool ))); +} + +// slotOk +// ====== + +void ScanNameDialog::slotOk( ) +{ m_scanName = m_scanNameEdit->text( ); + m_useHostName = m_useHostNameCheckbox->isChecked( ); + + if( !m_useHostName && m_scanName.isEmpty( )) + { KMessageBox::sorry( this, "Please enter a name or select \"Use Target Host name\"", "No scan name" ); + return; + } + + KDialogBase::slotOk( ); +} + +// slotUseHostNameToggled +// ====================== + +void ScanNameDialog::slotUseHostNameToggled( bool on ) +{ m_scanNameEdit->setEnabled( !on ); + + if( !on ) + m_scanNameEdit->setFocus( ); +} diff --git a/src/scannamedialog.h b/src/scannamedialog.h new file mode 100644 index 0000000..0fba9ee --- /dev/null +++ b/src/scannamedialog.h @@ -0,0 +1,65 @@ +/*************************************************************************** + * * + * Copyright (C) 2005, 2006 by Kevin Gilbert * + * [email protected] * + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef _SCANNAMEDIALOG_H_ +#define _SCANNAMEDIALOG_H_ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <kdialogbase.h> +#include "global.h" + +// forward class definitions +// ========================= + +class QCheckBox; +class QLineEdit; +class ScanWidget; + +// ScanNameDialog class definition +// =============================== + +class ScanNameDialog : public KDialogBase +{ Q_OBJECT + + public: + ScanNameDialog( ScanWidget* scanWidget, QWidget* parent = NULL, const char* name = NULL ); + + QString scanName( ) const { return m_scanName; } + bool useHostName( ) const { return m_useHostName; } + + private slots: + void slotOk( ); + void slotUseHostNameToggled( bool on ); + + private: + void createlayout( ); + + QString m_scanName; + QLineEdit* m_scanNameEdit; + bool m_useHostName; + QCheckBox* m_useHostNameCheckbox; +}; + +#endif // _SCANNAMEDIALOG_H_ diff --git a/src/scanstack.cpp b/src/scanstack.cpp new file mode 100644 index 0000000..7a49900 --- /dev/null +++ b/src/scanstack.cpp @@ -0,0 +1,194 @@ +/*************************************************************************** + * * + * Copyright (C) 2005, 2006 by Kevin Gilbert * + * [email protected] * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + ***************************************************************************/ + +#include <qdict.h> + +#include <kdebug.h> +#include <klocale.h> + +#include "htmlwidget.h" +#include "scanstack.h" +#include "scanwidget.h" + +// constructor +// =========== + +ScanStack::ScanStack( QWidget* parent, const char* name ) +: QWidgetStack( parent, name ), + m_dictSize( 29 ), + m_firstScanWidget( NULL ), + m_widgetId( 1 ) +{ m_scanWidgetDict = new QDict<ScanWidget>( m_dictSize ); + m_scanWidgetDict->setAutoDelete( true ); +} + +// appendAndRaiseWidget +// ==================== + +void ScanStack::appendAndRaiseWidget( ScanWidget* scanWidget ) +{ addWidget( scanWidget, m_widgetId ); + raiseWidget( m_widgetId ); + m_widgetId++; + + if( m_firstScanWidget == NULL ) + m_firstScanWidget = scanWidget; + + ushort index = m_scanWidgetDict->count( ); + + if( index == m_dictSize ) + { m_dictSize *= 2; // yes - i know it's supposed to be prime! + m_scanWidgetDict->resize( m_dictSize ); + } + + m_scanWidgetDict->insert( QString::number( index ), scanWidget ); +} + +// appendHTMLWidget +// ================ + +void ScanStack::appendHTMLWidget( HTMLWidget* htmlWidget ) +{ ASSERT( m_widgetId == 1 ); + addWidget( (QWidget*) htmlWidget, m_widgetId++ ); +} + +// findScanWidget +// ============== + +short ScanStack::findScanWidget( const ScanWidget* scanWidget ) +{ ushort i; + + for( resetScanWidgets( i ); moreScanWidgets( i ); nextScanWidget( i )) + if( scanWidget == currentScanWidget( i )) + return i; + + return -1; +} + +// indexOfVisibleScanWidget +// ======================== + +short ScanStack::indexOfVisibleScanWidget( ) +{ ushort i; + + for( resetScanWidgets( i ); moreScanWidgets( i ); nextScanWidget( i )) + if( isVisibleWidget( currentScanWidget( i ))) + break; + + if( !moreScanWidgets( i )) + { ASSERT( false ); + return -1; + } + + return i; +} + +// makeScanWidgetVisible +// ===================== + +ScanWidget* ScanStack::makeScanWidgetVisible( const ushort index ) +{ ScanWidget* current = scanWidget( index ); + + if( current == NULL ) + ASSERT( false ); + else + { current->ignoreTabChanges( true ); + raiseWidget( current ); + current->ignoreTabChanges( false ); + } + + return current; +} + +// moveScanWidget +// ============== + +ScanWidget* ScanStack::moveScanWidget( const ushort fromIndex ) +{ short toIndex = indexOfVisibleScanWidget( ); + + if( toIndex < 0 ) + return NULL; + + ScanWidget* scanWidget = m_scanWidgetDict->take( QString::number( fromIndex )); + + if( fromIndex < toIndex ) + for( ushort index = fromIndex + 1; index <= toIndex; index++ ) + { ScanWidget* scanWidget = m_scanWidgetDict->take( QString::number( index )); + m_scanWidgetDict->insert( QString::number( index - 1 ), scanWidget ); + } + else + for( short index = fromIndex - 1; index >= toIndex; index-- ) + { ScanWidget* scanWidget = m_scanWidgetDict->take( QString::number( index )); + m_scanWidgetDict->insert( QString::number( index + 1 ), scanWidget ); + } + + m_scanWidgetDict->insert( QString::number( toIndex ), scanWidget ); + return scanWidget; +} + +// removeScanWidget +// ================ + +void ScanStack::removeScanWidget( ScanWidget* scanWidgetToRemove ) +{ ushort n = m_scanWidgetDict->count( ); + + if( n == 1 ) + return; + + short index = findScanWidget( scanWidgetToRemove ); + + if( index < 0 ) + { ASSERT( false ); + return; + } + + m_scanWidgetDict->remove( QString::number( index )); + + for( ushort i = index + 1; i < n; i++ ) + { ScanWidget* scanWidget = m_scanWidgetDict->take( QString::number( i )); + m_scanWidgetDict->insert( QString::number( i - 1 ), scanWidget ); + } + + if( index >=short( m_scanWidgetDict->count( ))) + index = m_scanWidgetDict->count( ) - 1; + + ScanWidget* newVisibleWidget = scanWidget( index ); + newVisibleWidget->ignoreTabChanges( true ); + raiseWidget( newVisibleWidget ); + newVisibleWidget->ignoreTabChanges( false ); +} + +// visibleWidget +// ============= + +ScanWidget* ScanStack::visibleWidget( ) +{ return (ScanWidget*) QWidgetStack::visibleWidget( ); +} + +// wrapText +// ======== + +void ScanStack::wrapText( const bool wrap ) +{ ushort i; + + for( resetScanWidgets( i ); moreScanWidgets( i ); nextScanWidget( i )) + currentScanWidget( i )->wrapText( wrap ); +} diff --git a/src/scanstack.h b/src/scanstack.h new file mode 100644 index 0000000..44f6242 --- /dev/null +++ b/src/scanstack.h @@ -0,0 +1,76 @@ +/*************************************************************************** + * * + * Copyright (C) 2005, 2006 by Kevin Gilbert * + * [email protected] * + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef _SCANSTACK_H_ +#define _SCANSTACK_H_ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <qdict.h> +#include <qwidgetstack.h> +#include "global.h" + +// forward class definitions +// ========================= + +class HTMLWidget; +class ScanWidget; + +// ScanStack class definition +// ========================== + +class ScanStack : public QWidgetStack +{ Q_OBJECT + + public: + ScanStack( QWidget* parent, const char* name = NULL ); + + void appendAndRaiseWidget( ScanWidget* scanWidget ); + void appendHTMLWidget( HTMLWidget* htmlWidget ); + ushort count( ) const { return m_scanWidgetDict->count( ); } + ScanWidget* currentScanWidget( const ushort index ) { return scanWidget( index ); } + short findScanWidget( const ScanWidget* scanWidget ); + ScanWidget* firstScanWidget( ) const { return m_firstScanWidget; } + short indexOfVisibleScanWidget( ); + bool isVisibleWidget( const ScanWidget* scanWidget ) { return scanWidget == visibleWidget( ); } + ScanWidget* makeScanWidgetVisible( const ushort index ); + bool moreScanWidgets( const ushort index ) const { return index < m_scanWidgetDict->count( ); } + ScanWidget* moveScanWidget( const ushort fromIndex ); + void nextScanWidget( ushort& index ) { index++; } + void removeScanWidget( ScanWidget* scanWidget ); + void resetScanWidgets( ushort& index ) { index = 0; } + ScanWidget* visibleWidget( ); + void wrapText( const bool wrap ); + + private: + ScanWidget* scanWidget( const ushort index ) { return (*m_scanWidgetDict)[ QString::number( index )]; } + + ushort m_dictSize; + ScanWidget* m_firstScanWidget; + ushort m_widgetId; + + QDict<ScanWidget>* m_scanWidgetDict; +}; + +#endif // _SCANSTACK_H_ diff --git a/src/scanwidget.cpp b/src/scanwidget.cpp new file mode 100644 index 0000000..3e8a7aa --- /dev/null +++ b/src/scanwidget.cpp @@ -0,0 +1,1061 @@ +/*************************************************************************** + * * + * Copyright (C) 2005, 2006 by Kevin Gilbert * + * [email protected] * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + ***************************************************************************/ + +#include <errno.h> +#include <fcntl.h> +#include <stdlib.h> +#include <string.h> +#include <time.h> +#include <sys/types.h> +#include <sys/stat.h> + +#include <qfile.h> +#include <qlayout.h> +#include <qpushbutton.h> +#include <qstringlist.h> +#include <qtimer.h> + +#include <kapplication.h> +#include <kconfig.h> +#include <kdebug.h> +#include <klocale.h> +#include <kmessagebox.h> +#include <kprocess.h> +#include <kstandarddirs.h> +#include <ktabwidget.h> +#include <kurl.h> + +#include "commonwidget.h" +#include "compoundwidget.h" +#include "htmlwidget.h" +#include "knmap.h" +#include "loggingoptions.h" +#include "nmapoutputbuffer.h" +#include "outputwidget.h" +#include "pandsoptions.h" +#include "profiledialog.h" +#include "scanmonitor.h" +#include "scanmonitorevent.h" +#include "scanwidget.h" +#include "simpleoptions.h" +#include "tabwidgetdata.h" +#include "tabwidgetptrlist.h" +#include "timingwidget.h" + +// constructor +// =========== + +ScanWidget::ScanWidget( const QString& scanName, + const bool useTargetHost, + QWidget* parent, + const char* name ) +: QFrame( parent, name ), + m_dirty (false ), + m_hideOptions( true ), + m_ignoreTabChanges( false ), + m_nmapProcess( NULL ), + m_pipeStderr( NULL ), + m_pipeStdout( NULL ), + m_scanMonitor( NULL ), + m_scanName( scanName ), + m_state( dormant ), + m_useTargetHost( useTargetHost ) +{ setFrameStyle( QFrame::WinPanel | QFrame::Sunken ); + createLayout( ); + m_clearOutputButton->setEnabled( false ); + m_stopButton->setEnabled( false ); + m_startButton->setDefault( true ); + + srand( time( NULL )); + QTimer::singleShot( 0, this, SLOT( slotFinaliseInitialisation( ))); +} + +// destructor +// ========== + +ScanWidget::~ScanWidget( ) +{ if( m_nmapProcess != NULL ) + { m_nmapProcess->kill( SIGKILL ); + delete m_nmapProcess; + } + + if( m_pipeStderr != NULL ) + { m_pipeStderr->remove( ); + delete m_pipeStderr; + } + + if( m_pipeStdout != NULL ) + { m_pipeStdout->remove( ); + delete m_pipeStdout; + } + + if( m_scanMonitor != NULL ) + { m_scanMonitor->terminate( ); + while( m_scanMonitor->running( )) ; + delete m_scanMonitor; + } +} + +// buildNmapOptionsList +// ==================== + +QStringList ScanWidget::buildNmapOptionsList( ) +{ QStringList nmapOptions; + nmapOptions << KStandardDirs::findExe ( "nmap" ); + + if( m_commonWidget->resovleAlwaysState( )) + nmapOptions << "-R"; + + if( m_commonWidget->resovleNeverState( )) + nmapOptions << "-n"; + + if( m_timingWidget->hostTimeoutState( )) + { nmapOptions << "--host_timeout"; + nmapOptions << QString::number( m_timingWidget->hostTimeoutValue( )); + } + + if( m_timingWidget->initialRTTTimeoutState( )) + { nmapOptions << "--initial_rtt_timeout"; + nmapOptions << QString::number( m_timingWidget->initialRTTTimeoutValue( )); + } + + if( m_timingWidget->maxHostGroupState( )) + { nmapOptions << "--max_hostgroup"; + nmapOptions << QString::number( m_timingWidget->maxHostGroupValue( )); + } + + if( m_timingWidget->minHostGroupState( )) + { nmapOptions << "--min_hostgroup"; + nmapOptions << QString::number( m_timingWidget->minHostGroupValue( )); + } + + if( m_timingWidget->maxParallelismState( )) + { nmapOptions << "--max_parallelism"; + nmapOptions << QString::number( m_timingWidget->maxParallelismValue( )); + } + + if( m_timingWidget->minParallelismState( )) + { nmapOptions << "--min_parallelism"; + nmapOptions << QString::number( m_timingWidget->minParallelismValue( )); + } + + if( m_timingWidget->maxRTTTimeoutState( )) + { nmapOptions << "--max_rtt_timeout"; + nmapOptions << QString::number( m_timingWidget->maxRTTTimeoutValue( )); + } + + if( m_timingWidget->minRTTTimeoutState( )) + { nmapOptions << "--min_rtt_timeout"; + nmapOptions << QString::number( m_timingWidget->minRTTTimeoutValue( )); + } + + if( m_timingWidget->maxScanDelayState( )) + { nmapOptions << "--max_scan_delay"; + nmapOptions << QString::number( m_timingWidget->maxScanDelayValue( )); + } + + if( m_timingWidget->scanDelayState( )) + { nmapOptions << "--scan_delay"; + nmapOptions << QString::number( m_timingWidget->scanDelayValue( )); + } + + if( !m_timingWidget->simpleTiming( ).isEmpty( )) + { nmapOptions << "-T"; + nmapOptions << m_timingWidget->simpleTiming( ); + } + + if( m_pAndSWidget->ackState( )) + nmapOptions << "-PA" + m_pAndSWidget->ackValue( ); + + if( m_pAndSWidget->arpState( )) + nmapOptions << "-PR"; + + if( m_pAndSWidget->dontPingState( )) + nmapOptions << "-P0"; + + if( m_pAndSWidget->echoState( )) + nmapOptions << "-PE"; + + if( m_pAndSWidget->netmaskState( )) + nmapOptions << "-PM"; + + if( m_pAndSWidget->synState( )) + nmapOptions << "-PS" + m_pAndSWidget->synValue( ); + + if( m_pAndSWidget->timestampState( )) + nmapOptions << "-PP"; + + if( m_commonWidget->portRangesState( )) + { nmapOptions << "-p"; + nmapOptions << m_commonWidget->portRanges( )->join( "," ); + } + + if( m_compoundWidget->dataDirState( )) + { nmapOptions << "--datadir"; + nmapOptions << m_compoundWidget->dataDirValue( ); + } + + if( m_compoundWidget->debugLevelState( )) + for( byte i = 0; i < m_compoundWidget->debugLevelValue( ); i++ ) + nmapOptions << "-d"; + + if( m_compoundWidget->dataLengthState( )) + { nmapOptions << "--data_length"; + nmapOptions << QString::number( m_compoundWidget->dataLengthValue( )); + } + + if( m_compoundWidget->decoyState( )) + { nmapOptions << "-D"; + nmapOptions << m_compoundWidget->decoyValue( ); + } + + if( m_compoundWidget->excludeState( )) + { nmapOptions << "--exclude"; + nmapOptions << m_compoundWidget->excludeValue( ); + } + + if( m_compoundWidget->excludeFileState( )) + { nmapOptions << "--excludefile"; + nmapOptions << m_compoundWidget->excludeFileValue( ); + } + + if( m_compoundWidget->fragmentLevelState( )) + for( byte i = 0; i < m_compoundWidget->fragmentLevelValue( ); i++ ) + nmapOptions << "-f"; + + if( m_compoundWidget->interfaceState( )) + { nmapOptions << "-e"; + nmapOptions << m_compoundWidget->interfaceValue( ); + } + + if( m_compoundWidget->maxSocketsState( )) + { nmapOptions << "-M"; + nmapOptions << QString::number( m_compoundWidget->maxSocketsValue( )); + } + + if( m_compoundWidget->randomIPState( )) + { nmapOptions << "-iR"; + nmapOptions << QString::number( m_compoundWidget->randomIPValue( )); + } + + if( m_compoundWidget->sourcePortState( )) + { nmapOptions << "--source_port"; + nmapOptions << QString::number( m_compoundWidget->sourcePortValue( )); + } + + if( m_compoundWidget->sourceIPState( )) + { nmapOptions << "-S"; + nmapOptions << m_compoundWidget->sourceIPValue( ); + } + + if( m_compoundWidget->spoofMacState( )) + { nmapOptions << "--spoof_mac"; + nmapOptions << m_compoundWidget->spoofMacValue( ); + } + + if( m_compoundWidget->targetFileState( )) + { nmapOptions << "-iL"; + nmapOptions << m_compoundWidget->targetFileValue( ); + } + + if( m_compoundWidget->ttlState( )) + { nmapOptions << "--ttl"; + nmapOptions << QString::number( m_compoundWidget->ttlValue( )); + } + + if( m_simpleWidget->ipV6State( )) + nmapOptions << "-6"; + + if( m_simpleWidget->allPortsState( )) + nmapOptions << "--allports"; + + if( m_loggingWidget->appendOutputState( )) + nmapOptions << "--append_output"; + + if( m_loggingWidget->baseFileNameState( )) + { nmapOptions << "-oA"; + nmapOptions << m_loggingWidget->baseFileNameValue( ); + } + + if( m_simpleWidget->fastScanState( )) + nmapOptions << "-F"; + + if( m_loggingWidget->grepableLogState( )) + { nmapOptions << "-oG"; + nmapOptions << m_loggingWidget->grepableLogValue( ); + } + + if( m_simpleWidget->noRandomPortsState( )) + nmapOptions << "-r"; + + if( m_loggingWidget->normalLogState( )) + { nmapOptions << "-oN"; + nmapOptions << m_loggingWidget->normalLogValue( ); + } + + if( m_loggingWidget->noStylesheetState( )) + nmapOptions << "--no_stylesheet"; + + if( m_simpleWidget->osDetectionState( )) + nmapOptions << "-O"; + + if( m_simpleWidget->osScanLimitState( )) + nmapOptions << "--osscan_limit"; + + if( m_simpleWidget->packetTraceState( )) + nmapOptions << "--packet_trace"; + + if( m_simpleWidget->privilegedState( )) + nmapOptions << "--privileged"; + + if( m_simpleWidget->randomizeHostsState( )) + nmapOptions << "--randomize_hosts"; + + if( m_loggingWidget->resumeState( )) + { nmapOptions << "--resume"; + nmapOptions << m_loggingWidget->resumeValue( ); + } + + if( m_loggingWidget->scriptKiddieState( )) + { nmapOptions << "-oS"; + nmapOptions << m_loggingWidget->scriptKiddieValue( ); + } + + if( m_pAndSWidget->scanAckState( )) + nmapOptions << "-sA"; + + if( m_pAndSWidget->scanFINState( )) + nmapOptions << "-sF"; + + if( m_pAndSWidget->scanFTPBounceState( )) + { nmapOptions << "-b"; + nmapOptions << m_pAndSWidget->scanFTPRelayHost( ); + } + + if( m_pAndSWidget->scanIdleState( )) + { nmapOptions << "-sI"; + nmapOptions << m_pAndSWidget->zombieDetails( ); + } + + if( m_pAndSWidget->scanListState( )) + nmapOptions << "-sL"; + + if( m_pAndSWidget->scanNullState( )) + nmapOptions << "-sN"; + + if( m_pAndSWidget->scanPingState( )) + nmapOptions << "-sP"; + + if( m_pAndSWidget->scanProtocolState( )) + nmapOptions << "-sO"; + + if( m_pAndSWidget->scanRPCState( )) + nmapOptions << "-sR"; + + if( m_pAndSWidget->scanTCPConnectState( )) + nmapOptions << "-sT"; + + if( m_pAndSWidget->scanSYNState( )) + nmapOptions << "-sS"; + + if( m_pAndSWidget->scanUDPState( )) + nmapOptions << "-sU"; + + if( m_pAndSWidget->scanVersionState( )) + nmapOptions << "-sV"; + + if( m_pAndSWidget->scanWindowState( )) + nmapOptions << "-sW"; + + if( m_pAndSWidget->scanXmasState( )) + nmapOptions << "-sX"; + + if( m_simpleWidget->sendEthState( )) + nmapOptions << "--send_eth"; + + if( m_simpleWidget->sendIPState( )) + nmapOptions << "--send_ip"; + + if( m_loggingWidget->stylesheetState( )) + { nmapOptions << "--stylesheet"; + nmapOptions << m_loggingWidget->stylesheetValue( ); + } + + if( m_simpleWidget->verboseState( )) + nmapOptions << "-v"; + + if( m_loggingWidget->xmlLogState( )) + { nmapOptions << "-oX"; + nmapOptions << m_loggingWidget->xmlLogValue( ); + } + + nmapOptions << m_commonWidget->host( ); + return nmapOptions; +} + +// closePipe +// ========= + +void ScanWidget::closePipe( QFile*& pipe, int& pipeFD ) +{ if( pipe == NULL ) + return; + + ::close( pipeFD ); + + pipe->remove( ); + delete pipe; + pipe = NULL; +} + +// createLayout +// ============ + +void ScanWidget::createLayout( ) +{ m_commonWidget = new CommonWidget( this, "common widget" ); + m_compoundWidget = new CompoundWidget( this, "compound widget" ); + m_loggingWidget = new LoggingOptions( this, "logging widget" ); + m_pAndSWidget = new PAndSOptions( this, "p and s widget" ); + m_simpleWidget = new SimpleOptions( this, "simple widget" ); + m_timingWidget = new TimingWidget( this, "timing widget" ); + m_tabWidget = new KTabWidget( this, "tab widget" ); + + m_tabWidget->setTabReorderingEnabled( true ); + + byte row = 0; + QVBoxLayout* layout = new QVBoxLayout( this ); + layout->addWidget( m_tabWidget, row++ ); + + QHBoxLayout* buttonLayout = new QHBoxLayout( ); + m_clearOutputButton = new QPushButton( i18n( "Clear output" ), this, "clear output button" ); + m_hideOptionsButton = new QPushButton( i18n( "Hide options" ), this, "hide options button" ); + m_startButton = new QPushButton( i18n( "Start nmap" ), this, "start button" ); + m_stopButton = new QPushButton( i18n( "Stop nmap" ), this, "stop button" ); + + byte col = 0; + buttonLayout->insertStretch( col++, 10 ); + buttonLayout->insertWidget( col++, m_startButton, 5 ); + buttonLayout->insertStretch( col++, 3 ); + buttonLayout->insertWidget( col++, m_stopButton, 5 ); + buttonLayout->insertStretch( col++, 3 ); + buttonLayout->insertWidget( col++, m_hideOptionsButton, 5 ); + buttonLayout->insertStretch( col++, 3 ); + buttonLayout->insertWidget( col++, m_clearOutputButton, 5 ); + buttonLayout->insertStretch( col++, 10 ); + layout->addLayout( buttonLayout, row ); + + m_outputWidget = new OutputWidget( this, "output widget" ); + layout->addWidget( m_outputWidget, row++ ); +} + +// createPipe +// ========== + +bool ScanWidget::createPipe( const QString type, const QString& tempDir, QFile*& pipe, int& pipeFD ) +{ while( true ) + { pipe = new QFile( QString( "%1knmap_%2_%3" ).arg( tempDir ).arg( type ).arg( rand( ))); + + if( !pipe->exists( )) + break; + + delete pipe; + } + + if( mkfifo( pipe->name( ), 0600 )) + { QString text = QString( i18n( "Couldn't create the named pipe \"%1\" for nmap output: %2\n" )).arg( pipe->name( )).arg( strerror( errno )); + m_outputWidget->addOutput( OutputWidget::Stderr, text, text.length( )); + + delete pipe; + pipe = NULL; + return false; + } + + pipeFD = ::open( pipe->name( ), O_RDONLY | O_NONBLOCK ); + + if( pipeFD != -1 ) + return true; + + QString text = QString( i18n( "Couldn't open the named pipe \"%1\" for nmap output: %2\n" )).arg( pipe->name( )) + .arg( strerror( errno )); + m_outputWidget->addOutput( OutputWidget::Stderr, text, text.length( )); + + delete pipe; + pipe = NULL; + return false; +} + +// createPipes +// =========== + +bool ScanWidget::createPipes( ) +{ ASSERT( m_pipeStderr == NULL ); + ASSERT( m_pipeStdout == NULL ); + + KStandardDirs standardDirs; + QStringList tempDir = standardDirs.resourceDirs( "tmp" ); + + if( tempDir.isEmpty( )) + { QString text = QString( i18n( "Couldn't create the named pipe for nmap output: no temp file dir\n" )); + m_outputWidget->addOutput( OutputWidget::Stderr, text, text.length( )); + return false; + } + + if( !createPipe( "stderr", tempDir[ 0 ], m_pipeStderr, m_pipeStderrFD )) + return false; + + return createPipe( "stderr", tempDir[ 0 ], m_pipeStdout, m_pipeStdoutFD ); +} + +// customEvent +// =========== + +void ScanWidget::customEvent( QCustomEvent* event ) +{ smePtr scanMonitorEvent = (ScanMonitorEvent*) event; + nobPtr buffer; + + switch( event->type( )) + { case ScanMonitor::StderrType: + buffer = scanMonitorEvent->buffer( ); + m_outputWidget->addOutput( OutputWidget::Stderr, buffer->buffer( ), buffer->length( )); + buffer->setFree( ); + break; + + case ScanMonitor::StdoutType: + buffer = scanMonitorEvent->buffer( ); + m_outputWidget->addOutput( OutputWidget::Stdout, buffer->buffer( ), buffer->length( )); + buffer->setFree( ); + break; + + default: + kdDebug( ) << "internal error in ScanWidget::customEvent - unknown event type " + << event->type( ) + << " - ignoring it" + << endl; + } +} + +// fileSave +// ======== + +void ScanWidget::fileSave( ) +{ if( m_outputWidget->fileSave( )) + emit( outputAvailable( false, true )); +} + +// fileSaveAs +// ========== + +void ScanWidget::fileSaveAs( ) +{ if( m_outputWidget->fileSaveAs( )) + emit( outputAvailable( false, true )); +} + +// getOptions +// ========== + +bool ScanWidget::getOptions( ) +{ m_piping = false; + + if( !m_commonWidget->getOptions( )) + return false; + + if( !m_compoundWidget->getOptions( m_piping )) + return false; + + if( !m_loggingWidget->getOptions( )) + return false; + + if( !m_pAndSWidget->getOptions( m_piping )) + return false; + + if( !m_simpleWidget->getOptions( m_piping )) + return false; + + if( !m_timingWidget->getOptions( )) + return false; + + if( m_commonWidget->host( ).isEmpty( ) && !m_compoundWidget->targetFileState( )) + { KMessageBox::error( this, i18n( QString( "Target host(s) not specified by \"Target host(s)\" or \"Target hosts file\" options" )), i18n( "Target host(s) error" )); + return false; + } + + return true; +} + +// profileAskAndSave +// ================= + +void ScanWidget::profileAskAndSave( ) +{ if( !m_dirty ) + return; + + if( KMessageBox::Yes != KMessageBox::questionYesNo( this, + i18n( "Profile has been updated - save it now?" ), + i18n( "Profile data updated" ))) + return; + + profileSave( ); +} + +// profileCopy +// =========== + +void ScanWidget::profileCopy( ) +{ ProfileDialog dlg( ProfileDialog::Copy, m_profileName, this, "profile dlg" ); + dlg.exec( ); +} + +// profileDelete +// ============= + +void ScanWidget::profileDelete( ) +{ ProfileDialog dlg( ProfileDialog::Delete, m_profileName, this, "profile dlg" ); + dlg.exec( ); +} + +// profileLoad +// =========== + +void ScanWidget::profileLoad( ) +{ profileAskAndSave( ); + ProfileDialog dlg( ProfileDialog::Load, m_profileName, this, "profile dlg" ); + + if( dlg.exec( ) != QDialog::Accepted ) + return; + + m_profileName = dlg.profileName( ); + saveProfileName( ); + profileRead( ); + setInitialValues( ); +} + +// profileRead +// =========== + +void ScanWidget::profileRead( ) +{ KConfig* config = kapp->config( ); + + kapp->config( )->setGroup( m_profileName ); + m_commonWidget->readProfile( config ); + m_compoundWidget->readProfile( config ); + m_loggingWidget->readProfile( config ); + m_pAndSWidget->readProfile( config ); + m_outputWidget->readProfile( config ); + m_simpleWidget->readProfile( config ); + m_timingWidget->readProfile( config ); + + m_commonIndex = config->readNumEntry( "commonWidget", 0 ); + m_compoundIndex = config->readNumEntry( "compoundWidget", 2 ); + m_currentTab = config->readNumEntry( "currentTab", 0 ); + m_loggingIndex = config->readNumEntry( "loggingWidget", 3 ); + m_pAndSIndex = config->readNumEntry( "pAndSWidget", 4 ); + m_simpleIndex = config->readNumEntry( "simpleWidget", 1 ); + m_timingIndex = config->readNumEntry( "timingWidget", 5 ); + m_useTargetHost = config->readBoolEntry( "useTargetHost", false ); +} + +// profileRename +// ============= + +void ScanWidget::profileRename( ) +{ ProfileDialog dlg( ProfileDialog::Rename, m_profileName, this, "profile dlg" ); + dlg.exec( ); +} + +// profileSave +// =========== + +void ScanWidget::profileSave( ) +{ if( !getOptions( )) + if( KMessageBox::Yes != KMessageBox::questionYesNo( this, i18n( "Do you still want to save the profile? (It may be in an inconsistent state." ), i18n( "Save inconsistent profile" ))) + return; + + KConfig* config = kapp->config( ); + config->setGroup( m_profileName ); + + m_commonWidget->saveProfile( config ); + m_compoundWidget->saveProfile( config ); + m_loggingWidget->saveProfile( config ); + m_outputWidget->saveProfile( config ); + m_pAndSWidget->saveProfile( config ); + m_simpleWidget->saveProfile( config ); + m_timingWidget->saveProfile( config ); + + config->writeEntry( "commonWidget", m_tabWidget->indexOf( m_commonWidget )); + config->writeEntry( "compoundWidget", m_tabWidget->indexOf( m_compoundWidget )); + config->writeEntry( "currentTab", m_tabWidget->currentPageIndex( )); + config->writeEntry( "loggingWidget", m_tabWidget->indexOf( m_loggingWidget )); + config->writeEntry( "pAndSWidget", m_tabWidget->indexOf( m_pAndSWidget )); + config->writeEntry( "simpleWidget", m_tabWidget->indexOf( m_simpleWidget )); + config->writeEntry( "timingWidget", m_tabWidget->indexOf( m_timingWidget )); + config->writeEntry( "useTargetHost", m_useTargetHost ); + + slotOptionsDirty( false ); +} + +// profileSaveAs +// ============= + +void ScanWidget::profileSaveAs( ) +{ ProfileDialog dlg( ProfileDialog::SaveAs, m_profileName, this, "profile dlg" ); + + if( dlg.exec( ) != QDialog::Accepted ) + return; + + m_profileName = dlg.profileName( ); + saveProfileName( ); + profileSave( ); +} + +// readSettings +// ============ + +void ScanWidget::readSettings( ) +{ KConfig* config = kapp->config( ); + config->setGroup( m_scanName ); + m_profileName = config->readEntry( "profileName", DEFAULT_PROFILE ); + + profileRead( ); +} + +// renameScan +// ========== + +void ScanWidget::renameScan( const QString& newScanName ) +{ kapp->config( )->deleteGroup( m_scanName ); + m_scanName = newScanName; +} + +// saveProfileName +// =============== + +void ScanWidget::saveProfileName( ) +{ KConfig* config = kapp->config( ); + config->setGroup( m_scanName ); + config->writeEntry( "profileName", m_profileName ); +} + +// saveSettings +// ============ + +void ScanWidget::saveSettings( ) +{ saveProfileName( ); + profileSave( ); +} + +// setInitialValues +// ================ + +void ScanWidget::setInitialValues( ) +{ m_commonWidget->setInitialValues( ); + m_compoundWidget->setInitialValues( ); + m_loggingWidget->setInitialValues( ); + m_pAndSWidget->setInitialValues( ); + m_simpleWidget->setInitialValues( ); + m_timingWidget->setInitialValues( ); + + TabWidgetPtrList list; + list.append( new TabWidgetData( m_commonIndex, i18n( "Common options" ), m_commonWidget )); + list.append( new TabWidgetData( m_compoundIndex, i18n( "Compound options" ), m_compoundWidget )); + list.append( new TabWidgetData( m_loggingIndex, i18n( "Logging options" ), m_loggingWidget )); + list.append( new TabWidgetData( m_pAndSIndex, i18n( "Ping and Scan options" ), m_pAndSWidget )); + list.append( new TabWidgetData( m_simpleIndex, i18n( "Simple options" ), m_simpleWidget )); + list.append( new TabWidgetData( m_timingIndex, i18n( "Timing options" ), m_timingWidget )); + list.sort( ); + + while( m_tabWidget->count( )) + m_tabWidget->removePage( m_tabWidget->page( 0 )); + + for( TabWidgetData* widgetData = list.first( ); widgetData != NULL; widgetData = list.next( )) + m_tabWidget->insertTab( widgetData->widget( ), widgetData->title( ), widgetData->index( )); + + m_tabWidget->setCurrentPage( m_currentTab ); +} + +// setProfileName +// ============== + +void ScanWidget::setProfileName( const QString& profileName ) +{ m_profileName = profileName; + saveProfileName( ); + profileRead( ); +} + +// slotClearOutput +// =============== + +void ScanWidget::slotClearOutput( ) +{ m_clearOutputButton->setEnabled( false ); + m_outputWidget->clearOutput( ); + emit( outputAvailable( false, false )); +} + +// slotDisplayDocBook +// ================== + +void ScanWidget::slotDisplayDocBook( const QString& anchor ) +{ KProcess* process = new KProcess; + *process << "khelpcenter"; + *process << "help:/knmap//index.html#" + anchor; + process->start( KProcess::DontCare ); +} + +// slotDisplayUnknown +// ================== + +void ScanWidget::slotDisplayUnknown( ) +{ KMessageBox::sorry( this, i18n( "There is no help available for the item you have selected!\nTOUGH!!!\nDon't bother me with you pathetic whinges. Go get a life." ), i18n( "Help unavailable" )); +} + +// slotFinaliseInitialisation +// ========================== + +void ScanWidget::slotFinaliseInitialisation( ) +{ setInitialValues( ); + m_commonWidget->finaliseInitialisation( ); + m_compoundWidget->finaliseInitialisation( ); + m_pAndSWidget->finaliseInitialisation( ); + m_simpleWidget->finaliseInitialisation( ); + m_timingWidget->finaliseInitialisation( ); + + connect( m_outputWidget, SIGNAL( statusBarText( const QString& )), SIGNAL( statusBarText( const QString& ))); + + connect( m_clearOutputButton, SIGNAL( clicked( )), SLOT( slotClearOutput( ))); + connect( m_commonWidget, SIGNAL( disableFastScan( )), m_simpleWidget, SLOT( slotDisableFastScan( ))); + connect( m_commonWidget, SIGNAL( targetChanged( const QString& )), SLOT( slotTargetChanged( const QString& ))); + connect( m_hideOptionsButton, SIGNAL( clicked( )), SLOT( slotHideOptions( ))); + connect( m_simpleWidget, SIGNAL( disablePortRanges( )), m_commonWidget, SLOT( slotDisablePortRanges( ))); + connect( m_startButton, SIGNAL( clicked( )), SLOT( slotStartClicked( ))); + connect( m_stopButton, SIGNAL( clicked( )), SLOT( slotStopClicked( ))); + connect( m_tabWidget, SIGNAL( currentChanged( QWidget* )), SLOT( slotTabChanged( QWidget* ))); + + connect( m_commonWidget, SIGNAL( optionsDirty( )), SLOT( slotOptionsDirty( ))); + connect( m_compoundWidget, SIGNAL( optionsDirty( )), SLOT( slotOptionsDirty( ))); + connect( m_loggingWidget, SIGNAL( optionsDirty( )), SLOT( slotOptionsDirty( ))); + connect( m_pAndSWidget, SIGNAL( optionsDirty( )), SLOT( slotOptionsDirty( ))); + connect( m_simpleWidget, SIGNAL( optionsDirty( )), SLOT( slotOptionsDirty( ))); + connect( m_tabWidget, SIGNAL( movedTab( int, int )), SLOT( slotOptionsDirty( ))); + connect( m_timingWidget, SIGNAL( optionsDirty( )), SLOT( slotOptionsDirty( ))); + + connect( m_commonWidget, SIGNAL( displayHelp( const QString& )), SIGNAL( displayHelp( const QString& ))); + connect( m_compoundWidget, SIGNAL( displayHelp( const QString& )), SIGNAL( displayHelp( const QString& ))); + connect( m_loggingWidget, SIGNAL( displayHelp( const QString& )), SIGNAL( displayHelp( const QString& ))); + connect( m_pAndSWidget, SIGNAL( displayHelp( const QString& )), SIGNAL( displayHelp( const QString& ))); + connect( m_simpleWidget, SIGNAL( displayHelp( const QString& )), SIGNAL( displayHelp( const QString& ))); + connect( m_timingWidget, SIGNAL( displayHelp( const QString& )), SIGNAL( displayHelp( const QString& ))); + + connect( m_commonWidget, SIGNAL( displayDocBook( const QString& )), SLOT( slotDisplayDocBook( const QString&))); + connect( m_compoundWidget, SIGNAL( displayDocBook( const QString& )), SLOT( slotDisplayDocBook( const QString&))); + connect( m_loggingWidget, SIGNAL( displayDocBook( const QString& )), SLOT( slotDisplayDocBook( const QString&))); + connect( m_pAndSWidget, SIGNAL( displayDocBook( const QString& )), SLOT( slotDisplayDocBook( const QString&))); + connect( m_simpleWidget, SIGNAL( displayDocBook( const QString& )), SLOT( slotDisplayDocBook( const QString&))); + connect( m_timingWidget, SIGNAL( displayDocBook( const QString& )), SLOT( slotDisplayDocBook( const QString&))); + + connect( m_commonWidget, SIGNAL( displayUnknown( )), SLOT( slotDisplayUnknown( ))); + connect( m_compoundWidget, SIGNAL( displayUnknown( )), SLOT( slotDisplayUnknown( ))); + connect( m_loggingWidget, SIGNAL( displayUnknown( )), SLOT( slotDisplayUnknown( ))); + connect( m_pAndSWidget, SIGNAL( displayUnknown( )), SLOT( slotDisplayUnknown( ))); + connect( m_simpleWidget, SIGNAL( displayUnknown( )), SLOT( slotDisplayUnknown( ))); + connect( m_timingWidget, SIGNAL( displayUnknown( )), SLOT( slotDisplayUnknown( ))); + + if( m_useTargetHost ) + renameScan( m_commonWidget->getHostName( )); +} + +// slotHideOptions +// =============== + +void ScanWidget::slotHideOptions( ) +{ if( m_hideOptions ) + { m_tabWidget->hide( ); + m_hideOptionsButton->setText( i18n( "Show options" )); + } + else + { m_tabWidget->show( ); + m_hideOptionsButton->setText( i18n( "Hide options" )); + } + + m_hideOptions = !m_hideOptions; +} + +// slotOptionsDirty +// ================ + +void ScanWidget::slotOptionsDirty( const bool dirty ) +{ m_dirty = dirty; + emit( optionsDirty( )); +} + +// slotProcessExited +// ================= + +void ScanWidget::slotProcessExited( ) +{ delete m_nmapProcess; + m_nmapProcess = NULL; + + if( m_piping ) + { closePipe( m_pipeStderr, m_pipeStderrFD ); + closePipe( m_pipeStdout, m_pipeStdoutFD ); + + if( m_scanMonitor != NULL ) + while( m_scanMonitor->running( )) + sleep( 1 ); + } + + m_stopButton->setEnabled( false ); + m_startButton->setEnabled( true ); + + emit( scanStopped( this )); +} + +// slotReceivedStderr +// ================== + +void ScanWidget::slotReceivedStderr( KProcess* /* process */, char* buffer, int buflen ) +{ m_clearOutputButton->setEnabled( true ); + m_outputWidget->addOutput( OutputWidget::Stderr, buffer, buflen ); + emit( outputAvailable( true, true )); +} + +// slotReceivedStdout +// ================== + +void ScanWidget::slotReceivedStdout( KProcess* /* process */, char* buffer, int buflen ) +{ m_clearOutputButton->setEnabled( true ); + m_outputWidget->addOutput( OutputWidget::Stdout, buffer, buflen ); + emit( outputAvailable( true, true )); +} + +// slotStartClicked +// ================ + +void ScanWidget::slotStartClicked( ) +{ if( !getOptions( )) + return; + + m_stopButton->setEnabled( true ); + m_startButton->setEnabled( false ); + + if( m_piping && !createPipes( )) + return; + + QStringList nmapOptions = buildNmapOptionsList( ); + m_nmapProcess = new KProcess; + + if( !m_piping ) + *m_nmapProcess << nmapOptions; + else + { nmapOptions << ">"; + nmapOptions << m_pipeStdout->name( ); + + nmapOptions << "2>"; + nmapOptions << m_pipeStderr->name( ); + + *m_nmapProcess << "kdesu"; + *m_nmapProcess << "-n"; + *m_nmapProcess << nmapOptions.join( " " ); + } + + QValueList<QCString> args = m_nmapProcess->args( ); + QString cmd; + QValueList<QCString>::iterator it; + + for( it = args.begin( ); it != args.end( ); ++it ) + cmd += *it + " "; + + cmd.stripWhiteSpace( ); + m_clearOutputButton->setEnabled( true ); + m_outputWidget->addOutput( OutputWidget::Stdin, cmd, cmd.length( )); + + emit( outputAvailable( true, true )); + connect( m_nmapProcess, SIGNAL( processExited( KProcess* )), SLOT( slotProcessExited( ))); + + if( !m_piping ) + { connect( m_nmapProcess, + SIGNAL( receivedStderr( KProcess*, char*, int )), + SLOT( slotReceivedStderr( KProcess*, char*, int ))); + + connect( m_nmapProcess, + SIGNAL( receivedStdout( KProcess*, char*, int )), + SLOT( slotReceivedStdout( KProcess*, char*, int ))); + } + + m_nmapProcess->start( KProcess::NotifyOnExit, KProcess::AllOutput ); + m_state = running; + emit( scanStarted( )); + + if( !m_piping ) + return; + + if( m_scanMonitor == NULL ) + m_scanMonitor = new ScanMonitor( this ); + + m_scanMonitor->setPipeFDs( m_pipeStderrFD, m_pipeStdoutFD ); + m_scanMonitor->start( ); +} + +// slotStopClicked +// =============== + +void ScanWidget::slotStopClicked( ) +{ m_stopButton->setEnabled( false ); + m_nmapProcess->kill( ); +} + +// slotTabChanged +// ============== + +void ScanWidget::slotTabChanged( QWidget* /* toWidget */) +{ if( !m_ignoreTabChanges ) + slotOptionsDirty( ); +} + +// slotTabChanged +// ============== + +void ScanWidget::slotTargetChanged( const QString& target ) +{ if( m_useTargetHost ) + emit( scanRename( target )); +} + +// updateStatusBarText +// =================== + +void ScanWidget::updateStatusBarText( ) +{ m_outputWidget->slotUpdateStatusBarText( ); +} + +// useTargetHost +// ============== + +void ScanWidget::useTargetHost( const bool b ) +{ m_useTargetHost = b; + + if( m_useTargetHost ) + emit( scanRename( m_commonWidget->getHostName( ))); +} + +// wrapText +// ======== + +void ScanWidget::wrapText( const bool wrap ) +{ m_outputWidget->setWordWrap( wrap ? QTextEdit::WidgetWidth : QTextEdit::NoWrap ); +} diff --git a/src/scanwidget.h b/src/scanwidget.h new file mode 100644 index 0000000..decb7cb --- /dev/null +++ b/src/scanwidget.h @@ -0,0 +1,172 @@ +/*************************************************************************** + * * + * Copyright (C) 2005, 2006 by Kevin Gilbert * + * [email protected] * + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef _SCANWIDGET_H_ +#define _SCANWIDGET_H_ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <qframe.h> +#include "global.h" + +// forward class definitions +// ========================= + +class CommonWidget; +class CompoundWidget; +class HTMLWidget; +class KConfig; +class KProcess; +class KTabWidget; +class LoggingOptions; +class OutputWidget; +class PAndSOptions; +class QFile; +class QLineEdit; +class QPushButton; +class QStringList; +class ScanMonitor; +class SimpleOptions; +class TimingWidget; + +// ScanWidget class definition +// =========================== + +class ScanWidget : public QFrame +{ Q_OBJECT + + public: + ScanWidget( const QString& scanName, + const bool useTargetHost, + QWidget* parent = NULL, + const char* name = NULL ); + virtual ~ScanWidget( ); + + enum State + { dormant, + finished, + running + }; + + void fileSave( ); + void fileSaveAs( ); + void ignoreTabChanges( const bool b ) { m_ignoreTabChanges = b; } + bool isDirty( ) const { return m_dirty; } + void profileAskAndSave( ); + void profileCopy( ); + void profileDelete( ); + void profileLoad( ); + QString profileName( ) const { return m_profileName; } + void profileRename( ); + void profileSave( ); + void profileSaveAs( ); + void readSettings( ); + void renameScan( const QString& newScanName ); + void saveSettings( ); + QString scanName( ) const { return m_scanName; } + void setProfileName( const QString& profileName ); + State state( ) const { return m_state; } + void state( const State s ) { m_state = s; } + void updateStatusBarText( ); + bool useTargetHost( ) const { return m_useTargetHost; } + void useTargetHost( const bool b ); + void wrapText( const bool wrap ); + + signals: + void displayHelp( const QString& ); + void errorLoadingLocalManPage( const QString& ); + void optionsDirty( ); + void outputAvailable( const bool, const bool ); + void scanRename( const QString& ); + void scanStarted( ); + void scanStopped( ScanWidget* ); + void setManPageActionStuff( const bool ); + void statusBarText( const QString& ); + + private slots: + void slotClearOutput( ); + void slotDisplayDocBook( const QString& anchor ); + void slotDisplayUnknown( ); + void slotFinaliseInitialisation( ); + void slotHideOptions( ); + void slotOptionsDirty( const bool dirty = true ); + void slotProcessExited( ); + void slotReceivedStderr( KProcess* process, char* buffer, int buflen ); + void slotReceivedStdout( KProcess* process, char* buffer, int buflen ); + void slotStartClicked( ); + void slotStopClicked( ); + void slotTabChanged( QWidget* toWidget ); + void slotTargetChanged( const QString& target ); + + private: + QStringList buildNmapOptionsList( ); + void closePipe( QFile*& pipe, int& pipeFD ); + void createLayout( ); + bool createPipe( const QString type, const QString& tempDir, QFile*& pipe, int& pipeFD ); + bool createPipes( ); + void customEvent( QCustomEvent* event ); + bool getOptions( ); + void getPortRanges( QStringList* portRanges ); + void initialiseManPage( ); + void profileRead( ); + void saveProfileName( ); + void setInitialValues( ); + + QPushButton* m_clearOutputButton; + int m_commonIndex; + CommonWidget* m_commonWidget; + int m_compoundIndex; + CompoundWidget* m_compoundWidget; + int m_currentTab; + bool m_dirty; + bool m_hideOptions; + QPushButton* m_hideOptionsButton; + int m_htmlIndex; + bool m_ignoreTabChanges; + int m_loggingIndex; + LoggingOptions* m_loggingWidget; + KProcess* m_nmapProcess; + OutputWidget* m_outputWidget; + int m_pAndSIndex; + PAndSOptions* m_pAndSWidget; + QFile* m_pipeStderr; + QFile* m_pipeStdout; + int m_pipeStderrFD; + int m_pipeStdoutFD; + bool m_piping; + QString m_profileName; + ScanMonitor* m_scanMonitor; + QString m_scanName; + int m_simpleIndex; + SimpleOptions* m_simpleWidget; + QPushButton* m_startButton; + State m_state; + QPushButton* m_stopButton; + KTabWidget* m_tabWidget; + int m_timingIndex; + TimingWidget* m_timingWidget; + bool m_useTargetHost; +}; + +#endif // _SCANWIDGET_H_ diff --git a/src/simpleoptions.cpp b/src/simpleoptions.cpp new file mode 100644 index 0000000..56df1a2 --- /dev/null +++ b/src/simpleoptions.cpp @@ -0,0 +1,247 @@ +/*************************************************************************** + * * + * Copyright (C) 2005, 2006 by Kevin Gilbert * + * [email protected] * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + ***************************************************************************/ + +#include <qcheckbox.h> +#include <qlabel.h> +#include <qlayout.h> + +#include <kconfig.h> +#include <kdebug.h> +#include <kglobal.h> +#include <klocale.h> + +#include "simpleoptions.h" +#include "whatsthis.h" + +// constructor +// =========== + +SimpleOptions::SimpleOptions( QWidget* parent, const char* name ) +: QWidget( parent, name ) +{ createLayout( ); +} + +// createLayout +// ============ + +void SimpleOptions::createLayout( ) +{ QGridLayout* gridLayout = new QGridLayout( this ); + + byte row = 1; + m_allPortsCheckBox = new QCheckBox( i18n( "All ports (--allports)" ), this, "all ports check" ); + m_fastScanCheckBox = new QCheckBox( i18n( "Fast Scan (-F)" ), this, "fast scan check" ); + m_ipV6CheckBox = new QCheckBox( i18n( "IPV6 support (-6)" ), this, "ipv6 check" ); + m_privilegedCheckBox = new QCheckBox( i18n( "Assume privileged (--privileged)" ), this, "privileged check" ); + m_noRandomPortsCheckBox = new QCheckBox( i18n( "No Random Ports (-r)" ), this, "no random ports check" ); + m_osDetectionCheckBox = new QCheckBox( i18n( "OS Detection (-O)" ), this, "os detection check" ); + m_osScanLimitCheckBox = new QCheckBox( i18n( "OS scan limit (--osscan_limit)" ), this, "os scan limit check" ); + m_packetTraceCheckBox = new QCheckBox( i18n( "Packet trace (--packet_trace)" ), this, "packet trace check" ); + m_prepackagedCheckBox = new QCheckBox( i18n( "Prepackaged options (-A)" ), this, "prepackaged check" ); + m_randomizeHostsCheckBox = new QCheckBox( i18n( "Randomize hosts (--randomize_hosts)" ), this, "randomize check" ); + m_sendEthCheckBox = new QCheckBox( i18n( "Send raw eth. packets (--send_eth)" ), this, "send eth check" ); + m_sendIPCheckBox = new QCheckBox( i18n( "Send raw IP packets (--send_ip)" ), this, "send ip check" ); + m_verboseCheckBox = new QCheckBox( i18n( "Verbose (-v)" ), this, "verbose check" ); + + row = 1; + gridLayout->addWidget( new QLabel( " ", this ), row, 1 ); + gridLayout->addWidget( m_allPortsCheckBox, row++, 3 ); + gridLayout->addWidget( new QLabel( " ", this ), row, 1 ); + gridLayout->addWidget( m_privilegedCheckBox, row++, 3 ); + gridLayout->addWidget( new QLabel( " ", this ), row, 1 ); + gridLayout->addWidget( m_fastScanCheckBox, row++, 3 ); + gridLayout->addWidget( new QLabel( " ", this ), row, 1 ); + gridLayout->addWidget( m_ipV6CheckBox, row++, 3 ); + gridLayout->addWidget( new QLabel( " ", this ), row, 1 ); + gridLayout->addWidget( m_noRandomPortsCheckBox, row++, 3 ); + byte rowBlock1 = row; + + row = 1; + gridLayout->addWidget( new QLabel( "#", this ), row, 5 ); + gridLayout->addWidget( m_osDetectionCheckBox, row++, 7 ); + gridLayout->addWidget( new QLabel( " ", this ), row, 5 ); + gridLayout->addWidget( m_osScanLimitCheckBox, row++, 7 ); + gridLayout->addWidget( new QLabel( " ", this ), row, 5 ); + gridLayout->addWidget( m_packetTraceCheckBox, row++, 7 ); + gridLayout->addWidget( new QLabel( " ", this ), row, 5 ); + gridLayout->addWidget( m_prepackagedCheckBox, row++, 7 ); + byte rowBlock2 = row; + + row = 1; + gridLayout->addWidget( new QLabel( " ", this ), row, 9 ); + gridLayout->addWidget( m_randomizeHostsCheckBox, row++, 11 ); + gridLayout->addWidget( new QLabel( " ", this ), row, 9 ); + gridLayout->addWidget( m_sendEthCheckBox, row++, 11 ); + gridLayout->addWidget( new QLabel( " ", this ), row, 9 ); + gridLayout->addWidget( m_sendIPCheckBox, row++, 11 ); + gridLayout->addWidget( new QLabel( " ", this ), row, 9 ); + gridLayout->addWidget( m_verboseCheckBox, row++, 11 ); + byte rowBlock3 = row; + + gridLayout->setColStretch( 0, 8 ); + gridLayout->setColStretch( 2, 1 ); + gridLayout->setColStretch( 4, 8 ); + gridLayout->setColStretch( 6, 1 ); + gridLayout->setColStretch( 8, 8 ); + gridLayout->setColStretch( 10, 1 ); + gridLayout->setColStretch( 12, 8 ); + + gridLayout->setRowStretch( 0, 10 ); + gridLayout->setRowStretch( _max_( rowBlock1, _max_( rowBlock2, rowBlock3 )) + 1, 10 ); +} + +// finaliseInitialisation +// ====================== + +void SimpleOptions::finaliseInitialisation( ) +{ WhatsThis* whatsThis = new WhatsThis( this ); + + connect( m_fastScanCheckBox, SIGNAL( clicked( )), SLOT( slotFastScanCheckBoxClicked( ))); + connect( whatsThis, SIGNAL( clicked( )), SLOT( slotWhatsThisClicked( ))); + + connect( m_allPortsCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_fastScanCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_ipV6CheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_noRandomPortsCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_osDetectionCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_osScanLimitCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_packetTraceCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_prepackagedCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_privilegedCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_randomizeHostsCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_sendEthCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_sendIPCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_verboseCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); +} + +// getOptions +// ========== + +bool SimpleOptions::getOptions( bool& needRoot ) +{ m_allPortsState = m_allPortsCheckBox->isChecked( ); + m_fastScanState = m_fastScanCheckBox->isChecked( ); + m_ipV6State = m_ipV6CheckBox->isChecked( ); + m_noRandomPortsState = m_noRandomPortsCheckBox->isChecked( ); + m_osDetectionState = m_osDetectionCheckBox->isChecked( ); + m_osScanLimitState = m_osScanLimitCheckBox->isChecked( ); + m_packetTraceState = m_packetTraceCheckBox->isChecked( ); + m_prepackagedState = m_prepackagedCheckBox->isChecked( ); + m_privilegedState = m_privilegedCheckBox->isChecked( ); + m_randomizeHostsState = m_randomizeHostsCheckBox->isChecked( ); + m_sendEthState = m_sendEthCheckBox->isChecked( ); + m_sendIPState = m_sendIPCheckBox->isChecked( ); + m_verboseState = m_verboseCheckBox->isChecked( ); + + needRoot = needRoot || m_osDetectionState; + return true; +} + +// readProfile +// =========== + +void SimpleOptions::readProfile( KConfig* config ) +{ m_allPortsState = config->readBoolEntry( "allPortsState" ); + m_fastScanState = config->readBoolEntry( "fastScanState" ); + m_ipV6State = config->readBoolEntry( "ipV6State" ); + m_noRandomPortsState = config->readBoolEntry( "noRandomPortsState" ); + m_osDetectionState = config->readBoolEntry( "osDetectionState" ); + m_osScanLimitState = config->readBoolEntry( "osScanLimitState" ); + m_packetTraceState = config->readBoolEntry( "packetTraceState" ); + m_prepackagedState = config->readBoolEntry( "prepackagedState" ); + m_privilegedState = config->readBoolEntry( "privilegedState" ); + m_randomizeHostsState = config->readBoolEntry( "randomizeHostsState" ); + m_sendEthState = config->readBoolEntry( "sendEthState" ); + m_sendIPState = config->readBoolEntry( "sendIPState" ); + m_verboseState = config->readBoolEntry( "verboseState" ); +} + +// saveProfile +// =========== + +void SimpleOptions::saveProfile( KConfig* config ) +{ config->writeEntry( "allPortsState", m_allPortsState ); + config->writeEntry( "fastScanState", m_fastScanState ); + config->writeEntry( "ipV6State", m_ipV6State ); + config->writeEntry( "noRandomPortsState", m_noRandomPortsState ); + config->writeEntry( "osDetectionState", m_osDetectionState ); + config->writeEntry( "osScanLimitState", m_osScanLimitState ); + config->writeEntry( "packetTraceState", m_packetTraceState ); + config->writeEntry( "prepackagedState", m_prepackagedState ); + config->writeEntry( "privilegedState", m_privilegedState ); + config->writeEntry( "randomizeHostsState", m_randomizeHostsState ); + config->writeEntry( "sendEthState", m_sendEthState ); + config->writeEntry( "sendIPState", m_sendIPState ); + config->writeEntry( "verboseState", m_verboseState ); +} + +// setInitialValues +// ================ + +void SimpleOptions::setInitialValues( ) +{ m_allPortsCheckBox->setChecked( m_allPortsState ); + m_fastScanCheckBox->setChecked( m_fastScanState ); + m_ipV6CheckBox->setChecked( m_ipV6State ); + m_noRandomPortsCheckBox->setChecked( m_noRandomPortsState ); + m_osDetectionCheckBox->setChecked(m_osDetectionState ); + m_osScanLimitCheckBox->setChecked(m_osScanLimitState ); + m_packetTraceCheckBox->setChecked( m_packetTraceState ); + m_prepackagedCheckBox->setChecked( m_prepackagedState ); + m_privilegedCheckBox->setChecked( m_privilegedState ); + m_randomizeHostsCheckBox->setChecked( m_randomizeHostsState ); + m_sendEthCheckBox->setChecked( m_sendEthState ); + m_sendIPCheckBox->setChecked( m_sendIPState ); + m_verboseCheckBox->setChecked( m_verboseState ); +} + +// slotDisableFastScan +// =================== + +void SimpleOptions::slotDisableFastScan( ) +{ m_fastScanCheckBox->setChecked( false ); +} + +// slotFastScanCheckBoxClicked +// =========================== + +void SimpleOptions::slotFastScanCheckBoxClicked( ) +{ if( m_fastScanCheckBox->isChecked( )) + emit( disablePortRanges( )); +} + +// slotWhatsThisClicked +// ==================== + +void SimpleOptions::slotWhatsThisClicked( ) +{ if( m_allPortsCheckBox->hasMouse( )) emit( displayHelp( "--allports" )); + else if( m_fastScanCheckBox->hasMouse( )) emit( displayHelp( "-F" )); + else if( m_ipV6CheckBox->hasMouse( )) emit( displayHelp( "-6" )); + else if( m_noRandomPortsCheckBox->hasMouse( )) emit( displayHelp( "-r" )); + else if( m_osDetectionCheckBox->hasMouse( )) emit( displayHelp( "-O" )); + else if( m_osScanLimitCheckBox->hasMouse( )) emit( displayHelp( "--osscan_limit" )); + else if( m_packetTraceCheckBox->hasMouse( )) emit( displayHelp( "--packet_trace" )); + else if( m_prepackagedCheckBox->hasMouse( )) emit( displayHelp( "-A" )); + else if( m_privilegedCheckBox->hasMouse( )) emit( displayHelp( "--privileged" )); + else if( m_randomizeHostsCheckBox->hasMouse( )) emit( displayHelp( "--randomize_hosts" )); + else if( m_sendEthCheckBox->hasMouse( )) emit( displayHelp( "--send_eth" )); + else if( m_sendIPCheckBox->hasMouse( )) emit( displayHelp( "--send_ip" )); + else if( m_verboseCheckBox->hasMouse( )) emit( displayHelp( "-v" )); + else emit( displayUnknown( )); +} diff --git a/src/simpleoptions.h b/src/simpleoptions.h new file mode 100644 index 0000000..009c35d --- /dev/null +++ b/src/simpleoptions.h @@ -0,0 +1,113 @@ +/*************************************************************************** + * * + * Copyright (C) 2005, 2006 by Kevin Gilbert * + * [email protected] * + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef _SIMPLEOPTIONS_H_ +#define _SIMPLEOPTIONS_H_ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <qwidget.h> +#include "global.h" + +// forward class definitions +// ========================= + +class QCheckBox; +class KConfig; + +// SimpleOptions class definition +// ============================== + +class SimpleOptions : public QWidget +{ Q_OBJECT + + public: + SimpleOptions( QWidget* parent, const char* name = NULL ); + + void finaliseInitialisation( ); + bool getOptions( bool& needRoot ); + void readProfile( KConfig* config ); + void saveProfile( KConfig* config ); + void setInitialValues( ); + + bool allPortsState( ) const { return m_allPortsState; } + bool fastScanState( ) const { return m_fastScanState; } + bool ipV6State( ) const { return m_ipV6State; } + bool noRandomPortsState( ) const { return m_noRandomPortsState; } + bool osDetectionState( ) const { return m_osDetectionState; } + bool osScanLimitState( ) const { return m_osScanLimitState; } + bool packetTraceState( ) const { return m_packetTraceState; } + bool prepackagedState( ) const { return m_prepackagedState; } + bool privilegedState( ) const { return m_privilegedState; } + bool randomizeHostsState( ) const { return m_randomizeHostsState; } + bool sendEthState( ) const { return m_sendEthState; } + bool sendIPState( ) const { return m_sendIPState; } + bool verboseState( ) const { return m_verboseState; } + + signals: + void disablePortRanges( ); + void displayDocBook( const QString& ); + void displayHelp( const QString& ); + void displayUnknown( ); + void optionsDirty( ); + + public slots: + void slotDisableFastScan( ); + + private slots: + void slotFastScanCheckBoxClicked( ); + void slotWhatsThisClicked( ); + + private: + void createLayout( ); + + QCheckBox* m_allPortsCheckBox; + bool m_allPortsState; + QCheckBox* m_fastScanCheckBox; + bool m_fastScanState; + QCheckBox* m_ipV6CheckBox; + bool m_ipV6State; + QCheckBox* m_noRandomPortsCheckBox; + bool m_noRandomPortsState; + QCheckBox* m_osDetectionCheckBox; + bool m_osDetectionState; + QCheckBox* m_osScanLimitCheckBox; + bool m_osScanLimitState; + QCheckBox* m_packetTraceCheckBox; + bool m_packetTraceState; + QCheckBox* m_prepackagedCheckBox; + bool m_prepackagedState; + QCheckBox* m_privilegedCheckBox; + bool m_privilegedState; + QCheckBox* m_randomizeHostsCheckBox; + bool m_randomizeHostsState; + QCheckBox* m_sendEthCheckBox; + bool m_sendEthState; + QCheckBox* m_sendIPCheckBox; + bool m_sendIPState; + QCheckBox* m_verboseCheckBox; + bool m_verboseState; +}; + +#endif // _SIMPLEOPTIONS_H_ diff --git a/src/stylesheetdialog.cpp b/src/stylesheetdialog.cpp new file mode 100644 index 0000000..94c351e --- /dev/null +++ b/src/stylesheetdialog.cpp @@ -0,0 +1,128 @@ +/*************************************************************************** + * * + * Copyright (C) 2005, 2006 by Kevin Gilbert * + * [email protected] * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + ***************************************************************************/ + +#include <qiconset.h> +#include <qlabel.h> +#include <qlayout.h> +#include <qlineedit.h> +#include <qlistbox.h> +#include <qpushbutton.h> +#include <qstring.h> +#include <qstringlist.h> + +#include <kdebug.h> +#include <kfiledialog.h> +#include <kglobalsettings.h> +#include <kiconloader.h> +#include <klocale.h> +#include <kmessagebox.h> + +#include "stylesheetdialog.h" + +// constructor +// =========== + +StylesheetDialog::StylesheetDialog( const QString& currentStylesheetURL, + const QStringList& stylesheetURLs, + QWidget* parent, + const char* name ) +: KDialogBase( Plain, "'man' stylesheet location", Ok | Cancel, Ok, parent, name ), + m_currentStylesheetURL( currentStylesheetURL ), + m_stylesheetURLs( stylesheetURLs ) +{ QGridLayout* layout = new QGridLayout( plainPage( )); + KIconLoader* iconLoader = KGlobal::iconLoader( ); + QIconSet fileOpenIconSet = iconLoader->loadIconSet( "fileopen", KIcon::Small ); + QPushButton* urlButton = new QPushButton( fileOpenIconSet, NULL, plainPage( ), "stylesheet url button" ); + m_urlLineEdit = new QLineEdit( plainPage( ), "stylesheet url line edit" ); + m_urlListBox = new QListBox( plainPage( ), "stylesheet url list box" ); + + m_urlListBox->insertStringList( stylesheetURLs ); + m_urlLineEdit->setMinimumWidth( int( 1.1 * m_urlListBox->maxItemWidth( ))); + m_urlLineEdit->setText( currentStylesheetURL ); + + layout->addWidget( new QLabel( "Stylesheet URL: ", plainPage( ), "url label" ), 1, 1, Qt::AlignRight ); + layout->addWidget( m_urlLineEdit, 1, 2 ); + layout->addWidget( urlButton, 1, 3 ); + layout->addWidget( new QLabel( "Known URLs: ", plainPage( ), "url label" ), 3, 1, Qt::AlignRight | Qt::AlignTop ); + layout->addWidget( m_urlListBox, 3, 2 ); + + layout->setColStretch( 0, 1 ); + layout->setColStretch( 2, 20 ); + layout->setColStretch( 4, 1 ); + + layout->setRowStretch( 0, 2 ); + layout->setRowStretch( 2, 1 ); + layout->setRowStretch( 3, 10 ); + layout->setRowStretch( 4, 2 ); + + connect( urlButton, SIGNAL( clicked( )), SLOT( slotURLButtonClicked( ))); + connect( m_urlListBox, SIGNAL( doubleClicked( QListBoxItem* )), SLOT( slotURLListBoxDoubleClicked( QListBoxItem* ))); +} + +// slotOk +// ====== + +void StylesheetDialog::slotOk( ) +{ QString currentStylesheetURL = m_urlLineEdit->text( ); + QStringList::Iterator it = m_stylesheetURLs.find( currentStylesheetURL ); + + if( it != m_stylesheetURLs.end( )) + m_stylesheetURLs.remove( it ); + + if( !QFile::exists( currentStylesheetURL )) + { KMessageBox::sorry( this, QString( i18n( "The stylesheet \"%1\" does not exist" )).arg( currentStylesheetURL ), i18n( "Nonexistant stylesheet" )); + QListBoxItem* item = m_urlListBox->findItem( currentStylesheetURL, Qt::ExactMatch ); + + if( item != NULL ) + { m_urlListBox->removeItem( m_urlListBox->index( item )); + emit( stylesheetRemoved( )); + } + + m_urlLineEdit->clear( ); + return; + } + + m_stylesheetURLs.push_front( currentStylesheetURL ); + KDialogBase::slotOk( ); +} + +// slotURLButtonClicked +// ==================== + +void StylesheetDialog::slotURLButtonClicked( ) +{ QString filter = "*.css|CSS files\n*.*|All files"; + QString startDir = (m_currentStylesheetURL.isEmpty( )) ? KGlobalSettings::documentPath( ) : m_currentStylesheetURL; + QString stylesheetURL = KFileDialog::getOpenFileName( startDir, filter, this, "url path dlg" ); + + if( stylesheetURL.isEmpty( )) + return; + + m_urlLineEdit->setText( stylesheetURL ); +} + +// slotURLListBoxDoubleClicked +// =========================== + +void StylesheetDialog::slotURLListBoxDoubleClicked( QListBoxItem* item ) +{ m_urlLineEdit->setText( item->text( )); + slotOk( ); +} diff --git a/src/stylesheetdialog.h b/src/stylesheetdialog.h new file mode 100644 index 0000000..50be040 --- /dev/null +++ b/src/stylesheetdialog.h @@ -0,0 +1,70 @@ +/*************************************************************************** + * * + * Copyright (C) 2005, 2006 by Kevin Gilbert * + * [email protected] * + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef _STYLESHEETDIALOG_H_ +#define _STYLESHEETDIALOG_H_ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <kdialogbase.h> +#include "global.h" + +// forward class definitions +// ========================= + +class QListBox; +class QLineEdit; +class QString; +class QStringList; + +// StylesheetDialog class definition +// ================================= + +class StylesheetDialog : public KDialogBase +{ Q_OBJECT + + public: + StylesheetDialog( const QString& currentStylesheetURL, + const QStringList& stylesheetURLs, + QWidget* parent = NULL, + const char* name = NULL ); + + QStringList stylesheetURLs( ) const { return m_stylesheetURLs; } + + signals: + void stylesheetRemoved( ); + + private slots: + void slotOk( ); + void slotURLButtonClicked( ); + void slotURLListBoxDoubleClicked( QListBoxItem* item ); + + private: + QString m_currentStylesheetURL; + QStringList m_stylesheetURLs; + QListBox* m_urlListBox; + QLineEdit* m_urlLineEdit; +}; + +#endif // _STYLESHEETDIALOG_H_ diff --git a/src/tabwidgetdata.cpp b/src/tabwidgetdata.cpp new file mode 100644 index 0000000..8fdcf0c --- /dev/null +++ b/src/tabwidgetdata.cpp @@ -0,0 +1,39 @@ +/*************************************************************************** + * * + * Copyright (C) 2005, 2006 by Kevin Gilbert * + * [email protected] * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + ***************************************************************************/ + +#include <qstring.h> +#include <qwidget.h> + +#include <kdebug.h> +#include <klocale.h> + +#include "tabwidgetdata.h" + +// constructor +// =========== + +TabWidgetData::TabWidgetData( const int index, const QString& title, QWidget* widget ) +: m_index( index ), + m_title( title ), + m_widget( widget ) +{ +} diff --git a/src/tabwidgetdata.h b/src/tabwidgetdata.h new file mode 100644 index 0000000..c72b3ff --- /dev/null +++ b/src/tabwidgetdata.h @@ -0,0 +1,49 @@ +/*************************************************************************** + * * + * Copyright (C) 2005, 2006 by Kevin Gilbert * + * [email protected] * + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef _TABWIDGETDATA_H_ +#define _TABWIDGETDATA_H_ + +// forward class definitions +// ========================= + +class QString; +class QWidget; + +// TabWidgetData class definition +// ============================== + +class TabWidgetData +{ public: + TabWidgetData( const int index, const QString& title, QWidget* widget ); + + int index( ) const { return m_index; } + QString title( ) const { return m_title; } + QWidget* widget( ) const { return m_widget; } + + private: + int m_index; + QString m_title; + QWidget* m_widget; +}; + +#endif // _TABWIDGETDATA_H_ diff --git a/src/tabwidgetptrlist.cpp b/src/tabwidgetptrlist.cpp new file mode 100644 index 0000000..1e5408c --- /dev/null +++ b/src/tabwidgetptrlist.cpp @@ -0,0 +1,47 @@ +/*************************************************************************** + * * + * Copyright (C) 2005, 2006 by Kevin Gilbert * + * [email protected] * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + ***************************************************************************/ + +#include <qptrcollection.h> + +#include <kdebug.h> +#include <klocale.h> + +#include "tabwidgetptrlist.h" + +// constructor +// =========== + +TabWidgetPtrList::TabWidgetPtrList( ) +{ setAutoDelete( true ); +} + +// compareItems +// ============ + +int TabWidgetPtrList::compareItems( QPtrCollection::Item item1, QPtrCollection::Item item2 ) +{ typedef TabWidgetData* DataPtr; + + if( DataPtr( item1 )->index( ) < DataPtr( item2 )->index( )) + return -1; + + return DataPtr( item1 )->index( ) != DataPtr( item2 )->index( ); +} diff --git a/src/tabwidgetptrlist.h b/src/tabwidgetptrlist.h new file mode 100644 index 0000000..56e835f --- /dev/null +++ b/src/tabwidgetptrlist.h @@ -0,0 +1,49 @@ +/*************************************************************************** + * * + * Copyright (C) 2005, 2006 by Kevin Gilbert * + * [email protected] * + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef _TABWIDGETPTRLIST_H_ +#define _TABWIDGETPTRLIST_H_ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <qptrlist.h> +#include "global.h" +#include "tabwidgetdata.h" + +// forward class definitions +// ========================= + +class QPtrCollection; + +// TabWidgetPtrList class definition +// ================================= + +class TabWidgetPtrList : public QPtrList<TabWidgetData> +{ public: + TabWidgetPtrList( ); + + int compareItems( QPtrCollection::Item item1, QPtrCollection::Item item2 ); +}; + +#endif // _TABWIDGETPTRLIST_H_ diff --git a/src/timingwidget.cpp b/src/timingwidget.cpp new file mode 100644 index 0000000..30f121b --- /dev/null +++ b/src/timingwidget.cpp @@ -0,0 +1,664 @@ +/*************************************************************************** + * * + * Copyright (C) 2005, 2006 by Kevin Gilbert * + * [email protected] * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + ***************************************************************************/ + +#include <qbuttongroup.h> +#include <qcheckbox.h> +#include <qiconset.h> +#include <qlabel.h> +#include <qlayout.h> +#include <qlineedit.h> +#include <qpushbutton.h> +#include <qradiobutton.h> + +#include <kconfig.h> +#include <kdebug.h> +#include <kglobal.h> +#include <kiconloader.h> +#include <klocale.h> +#include <kmessagebox.h> + +#include "timingwidget.h" +#include "whatsthis.h" + +// constructor +// =========== + +TimingWidget::TimingWidget( QWidget* parent, const char* name ) +: QWidget( parent, name ) +{ createLayout( ); +} + +// createLayout +// ============ + +void TimingWidget::createLayout( ) +{ QGridLayout* gridLayout = new QGridLayout( this ); + KIconLoader* iconLoader = KGlobal::iconLoader( ); + QIconSet clearLeftIconSet = iconLoader->loadIconSet( "clear_left", KIcon::Small ); + + byte row = 1; + QButtonGroup* timingGroupBox = new QButtonGroup( 7, Qt::Vertical, "Simple Timing", this, "timing group box" ); + m_defaultRadio = new QRadioButton( i18n( "Default" ), timingGroupBox, "default radio button" ); + m_aggressiveRadio = new QRadioButton( i18n( "Aggressive (-T4)" ), timingGroupBox, "aggressive radio button" ); + m_insaneRadio = new QRadioButton( i18n( "Insane (-T5)" ), timingGroupBox, "insane radio button" ); + m_normalRadio = new QRadioButton( i18n( "Normal (-T3)" ), timingGroupBox, "normal radio button" ); + m_paranoidRadio = new QRadioButton( i18n( "Paranoid (-T0)" ), timingGroupBox, "paranoid radio button" ); + m_politeRadio = new QRadioButton( i18n( "Polite (-T2)" ), timingGroupBox, "polite radio button" ); + m_sneakyRadio = new QRadioButton( i18n( "Sneaky (-T1)" ), timingGroupBox, "sneaky radio button" ); + gridLayout->addMultiCellWidget( timingGroupBox, row, row + 7, 1, 1 ); + row += 7; + byte rowBlock1 = row; + + m_hostTimeoutButton = new QPushButton( clearLeftIconSet, NULL, this, "host timeout button" ); + m_initialRTTTimeoutButton = new QPushButton( clearLeftIconSet, NULL, this, "initial rtt timeout button" ); + m_maxHostGroupButton = new QPushButton( clearLeftIconSet, NULL, this, "max host group button" ); + m_maxParallelismButton = new QPushButton( clearLeftIconSet, NULL, this, "max parallelism button" ); + m_maxRTTTimeoutButton = new QPushButton( clearLeftIconSet, NULL, this, "max rtt timeout button" ); + m_maxScanDelayButton = new QPushButton( clearLeftIconSet, NULL, this, "max scan delay button" ); + m_minHostGroupButton = new QPushButton( clearLeftIconSet, NULL, this, "min host group button" ); + m_minParallelismButton = new QPushButton( clearLeftIconSet, NULL, this, "min parallelism button" ); + m_minRTTTimeoutButton = new QPushButton( clearLeftIconSet, NULL, this, "min rtt timeout button" ); + m_scanDelayButton = new QPushButton( clearLeftIconSet, NULL, this, "min scan delay button" ); + + m_hostTimeoutCheckBox = new QCheckBox( i18n( "Host timeout (--host_timeout)" ), this, "host timeout checkbox" ); + m_initialRTTTimeoutCheckBox = new QCheckBox( i18n( "Initial RTT timeout (--initial_rtt_timeout)" ), this, "initial rtt timeout checkbox" ); + m_maxHostGroupCheckBox = new QCheckBox( i18n( "Max Host group (--max_hostgroup)" ), this, "max host group checkbox" ); + m_maxParallelismCheckBox = new QCheckBox( i18n( "Max Parallelism (--max_parallelism)" ), this, "max parallelism checkbox" ); + m_maxRTTTimeoutCheckBox = new QCheckBox( i18n( "Max RTT timeout (--max_rtt_timeout)" ), this, "max rtt timeout checkbox" ); + m_maxScanDelayCheckBox = new QCheckBox( i18n( "Max Scan delay (--max_scan_delay)" ), this, "max scan delay checkbox" ); + m_minHostGroupCheckBox = new QCheckBox( i18n( "Min Host group (--min_hostgroup)" ), this, "min host group checkbox" ); + m_minParallelismCheckBox = new QCheckBox( i18n( "Min Parallelism (--min_parallelism)" ), this, "min parallelism checkbox" ); + m_minRTTTimeoutCheckBox = new QCheckBox( i18n( "Min RTT timeout (--min_rtt_timeout)" ), this, "min rtt timeout checkbox" ); + m_scanDelayCheckBox = new QCheckBox( i18n( "Min Scan delay (--scan_delay)" ), this, "min scan delay checkbox" ); + + m_hostTimeoutLineEdit = new QLineEdit( this, "host timeout line edit" ); + m_initialRTTTimeoutLineEdit = new QLineEdit( this, "initial rtt timeout line edit" ); + m_maxHostGroupLineEdit = new QLineEdit( this, "max host group line edit" ); + m_maxParallelismLineEdit = new QLineEdit( this, "max parallelism line edit" ); + m_maxRTTTimeoutLineEdit = new QLineEdit( this, "max rtt timeout line edit" ); + m_maxScanDelayLineEdit = new QLineEdit( this, "max scan delay line edit" ); + m_minHostGroupLineEdit = new QLineEdit( this, "min host group line edit" ); + m_minParallelismLineEdit = new QLineEdit( this, "min parallelism line edit" ); + m_minRTTTimeoutLineEdit = new QLineEdit( this, "min rtt timeout line edit" ); + m_scanDelayLineEdit = new QLineEdit( this, "min scan delay line edit" ); + + m_hostTimeoutLineEdit->setInputMask( "999999" ); + m_initialRTTTimeoutLineEdit->setInputMask( "999999" ); + m_maxHostGroupLineEdit->setInputMask( "999999" ); + m_maxParallelismLineEdit->setInputMask( "999999" ); + m_maxRTTTimeoutLineEdit->setInputMask( "999999" ); + m_maxScanDelayLineEdit->setInputMask( "999999" ); + m_minHostGroupLineEdit->setInputMask( "999999" ); + m_minParallelismLineEdit->setInputMask( "999999" ); + m_minRTTTimeoutLineEdit->setInputMask( "999999" ); + m_scanDelayLineEdit->setInputMask( "999999" ); + + row = 1; + gridLayout->addWidget( m_hostTimeoutCheckBox, row, 3 ); + gridLayout->addWidget( m_hostTimeoutLineEdit, row, 4 ); + gridLayout->addWidget( m_hostTimeoutButton, row++, 5 ); + + gridLayout->addWidget( m_maxHostGroupCheckBox, row, 3 ); + gridLayout->addWidget( m_maxHostGroupLineEdit, row, 4 ); + gridLayout->addWidget( m_maxHostGroupButton, row++, 5 ); + + gridLayout->addWidget( m_minHostGroupCheckBox, row, 3 ); + gridLayout->addWidget( m_minHostGroupLineEdit, row, 4 ); + gridLayout->addWidget( m_minHostGroupButton, row++, 5 ); + + gridLayout->addWidget( m_maxParallelismCheckBox, row, 3 ); + gridLayout->addWidget( m_maxParallelismLineEdit, row, 4 ); + gridLayout->addWidget( m_maxParallelismButton, row++, 5 ); + + gridLayout->addWidget( m_minParallelismCheckBox, row, 3 ); + gridLayout->addWidget( m_minParallelismLineEdit, row, 4 ); + gridLayout->addWidget( m_minParallelismButton, row++, 5 ); + byte rowBlock2 = row; + + row = 1; + gridLayout->addWidget( m_initialRTTTimeoutCheckBox, row, 7 ); + gridLayout->addWidget( m_initialRTTTimeoutLineEdit, row, 8 ); + gridLayout->addWidget( m_initialRTTTimeoutButton, row++, 9 ); + + gridLayout->addWidget( m_maxRTTTimeoutCheckBox, row, 7 ); + gridLayout->addWidget( m_maxRTTTimeoutLineEdit, row, 8 ); + gridLayout->addWidget( m_maxRTTTimeoutButton, row++, 9 ); + + gridLayout->addWidget( m_minRTTTimeoutCheckBox, row, 7 ); + gridLayout->addWidget( m_minRTTTimeoutLineEdit, row, 8 ); + gridLayout->addWidget( m_minRTTTimeoutButton, row++, 9 ); + + gridLayout->addWidget( m_maxScanDelayCheckBox, row, 7 ); + gridLayout->addWidget( m_maxScanDelayLineEdit, row, 8 ); + gridLayout->addWidget( m_maxScanDelayButton, row++, 9 ); + + gridLayout->addWidget( m_scanDelayCheckBox, row, 7 ); + gridLayout->addWidget( m_scanDelayLineEdit, row, 8 ); + gridLayout->addWidget( m_scanDelayButton, row++, 9 ); + byte rowBlock3 = row; + + gridLayout->setColStretch( 0, 3 ); + gridLayout->setColStretch( 2, 3 ); + gridLayout->setColStretch( 4, 10 ); + gridLayout->setColStretch( 6, 3 ); + gridLayout->setColStretch( 8, 10 ); + gridLayout->setColStretch( 10, 3 ); + + gridLayout->setRowStretch( 0, 10 ); + gridLayout->setRowStretch( _max_( rowBlock1, _max_( rowBlock2, rowBlock3 )) + 1, 10 ); +} + +// finaliseInitialisation +// ====================== + +void TimingWidget::finaliseInitialisation( ) +{ WhatsThis* whatsThis = new WhatsThis( this ); + + connect( m_aggressiveRadio, SIGNAL( clicked( )), SLOT( slotAggressiveRadioClicked( ))); + connect( m_defaultRadio, SIGNAL( clicked( )), SLOT( slotDefaultRadioClicked( ))); + connect( m_hostTimeoutButton, SIGNAL( clicked( )), SLOT( slotHostTimeoutButtonClicked( ))); + connect( m_hostTimeoutCheckBox, SIGNAL( clicked( )), SLOT( slotHostTimeoutCheckBoxClicked( ))); + connect( m_initialRTTTimeoutButton, SIGNAL( clicked( )), SLOT( slotInitialRTTTimeoutButtonClicked( ))); + connect( m_initialRTTTimeoutCheckBox, SIGNAL( clicked( )), SLOT( slotInitialRTTTimeoutCheckBoxClicked( ))); + connect( m_insaneRadio, SIGNAL( clicked( )), SLOT( slotInsaneRadioClicked( ))); + connect( m_maxHostGroupButton, SIGNAL( clicked( )), SLOT( slotMaxHostGroupButtonClicked( ))); + connect( m_maxHostGroupCheckBox, SIGNAL( clicked( )), SLOT( slotMaxHostGroupCheckBoxClicked( ))); + connect( m_maxParallelismButton, SIGNAL( clicked( )), SLOT( slotMaxParallelismButtonClicked( ))); + connect( m_maxParallelismCheckBox, SIGNAL( clicked( )), SLOT( slotMaxParallelismCheckBoxClicked( ))); + connect( m_maxRTTTimeoutButton, SIGNAL( clicked( )), SLOT( slotMaxRTTTimeoutButtonClicked( ))); + connect( m_maxRTTTimeoutCheckBox, SIGNAL( clicked( )), SLOT( slotMaxRTTTimeoutCheckBoxClicked( ))); + connect( m_maxScanDelayButton, SIGNAL( clicked( )), SLOT( slotMaxScanDelayButtonClicked( ))); + connect( m_maxScanDelayCheckBox, SIGNAL( clicked( )), SLOT( slotMaxScanDelayCheckBoxClicked( ))); + connect( m_minHostGroupButton, SIGNAL( clicked( )), SLOT( slotMinHostGroupButtonClicked( ))); + connect( m_minHostGroupCheckBox, SIGNAL( clicked( )), SLOT( slotMinHostGroupCheckBoxClicked( ))); + connect( m_minParallelismButton, SIGNAL( clicked( )), SLOT( slotMinParallelismButtonClicked( ))); + connect( m_minParallelismCheckBox, SIGNAL( clicked( )), SLOT( slotMinParallelismCheckBoxClicked( ))); + connect( m_minRTTTimeoutButton, SIGNAL( clicked( )), SLOT( slotMinRTTTimeoutButtonClicked( ))); + connect( m_minRTTTimeoutCheckBox, SIGNAL( clicked( )), SLOT( slotMinRTTTimeoutCheckBoxClicked( ))); + connect( m_normalRadio, SIGNAL( clicked( )), SLOT( slotNormalRadioClicked( ))); + connect( m_paranoidRadio, SIGNAL( clicked( )), SLOT( slotParanoidRadioClicked( ))); + connect( m_politeRadio, SIGNAL( clicked( )), SLOT( slotPoliteRadioClicked( ))); + connect( m_scanDelayButton, SIGNAL( clicked( )), SLOT( slotScanDelayButtonClicked( ))); + connect( m_scanDelayCheckBox, SIGNAL( clicked( )), SLOT( slotScanDelayCheckBoxClicked( ))); + connect( m_sneakyRadio, SIGNAL( clicked( )), SLOT( slotSneakyRadioClicked( ))); + connect( whatsThis, SIGNAL( clicked( )), SLOT( slotWhatsThisClicked( ))); + + connect( m_aggressiveRadio, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_defaultRadio, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_hostTimeoutCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_hostTimeoutLineEdit, SIGNAL( textChanged( const QString& )), SIGNAL( optionsDirty( ))); + connect( m_initialRTTTimeoutCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_initialRTTTimeoutLineEdit, SIGNAL( textChanged( const QString& )), SIGNAL( optionsDirty( ))); + connect( m_insaneRadio, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_maxHostGroupCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_maxHostGroupLineEdit, SIGNAL( textChanged( const QString& )), SIGNAL( optionsDirty( ))); + connect( m_maxParallelismCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_maxParallelismLineEdit, SIGNAL( textChanged( const QString& )), SIGNAL( optionsDirty( ))); + connect( m_maxRTTTimeoutCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_maxRTTTimeoutLineEdit, SIGNAL( textChanged( const QString& )), SIGNAL( optionsDirty( ))); + connect( m_maxScanDelayCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_maxScanDelayLineEdit, SIGNAL( textChanged( const QString& )), SIGNAL( optionsDirty( ))); + connect( m_minHostGroupCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_minHostGroupLineEdit, SIGNAL( textChanged( const QString& )), SIGNAL( optionsDirty( ))); + connect( m_minParallelismCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_minParallelismLineEdit, SIGNAL( textChanged( const QString& )), SIGNAL( optionsDirty( ))); + connect( m_minRTTTimeoutCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_minRTTTimeoutLineEdit, SIGNAL( textChanged( const QString& )), SIGNAL( optionsDirty( ))); + connect( m_normalRadio, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_paranoidRadio, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_politeRadio, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_scanDelayCheckBox, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); + connect( m_scanDelayLineEdit, SIGNAL( textChanged( const QString& )), SIGNAL( optionsDirty( ))); + connect( m_sneakyRadio, SIGNAL( clicked( )), SIGNAL( optionsDirty( ))); +} + +// getOptions +// ========== + +bool TimingWidget::getOptions( ) +{ bool maxHostGroupState = m_maxHostGroupCheckBox->isChecked( ); + uint maxHostGroupValue = m_maxHostGroupLineEdit->text( ).toUInt( ); + bool maxParallelismState = m_maxParallelismCheckBox->isChecked( ); + uint maxParallelismValue = m_maxParallelismLineEdit->text( ).toUInt( ); + bool maxRTTTimeoutState = m_maxRTTTimeoutCheckBox->isChecked( ); + uint maxRTTTimeoutValue = m_maxRTTTimeoutLineEdit->text( ).toUInt( ); + bool maxScanDelayState = m_maxScanDelayCheckBox->isChecked( ); + uint maxScanDelayValue = m_maxScanDelayLineEdit->text( ).toUInt( ); + bool minHostGroupState = m_minHostGroupCheckBox->isChecked( ); + uint minHostGroupValue = m_minHostGroupLineEdit->text( ).toUInt( ); + bool minParallelismState = m_minParallelismCheckBox->isChecked( ); + uint minParallelismValue = m_minParallelismLineEdit->text( ).toUInt( ); + bool minRTTTimeoutState = m_minRTTTimeoutCheckBox->isChecked( ); + uint minRTTTimeoutValue = m_minRTTTimeoutLineEdit->text( ).toUInt( ); + bool scanDelayState = m_scanDelayCheckBox->isChecked( ); + uint scanDelayValue = m_scanDelayLineEdit->text( ).toUInt( ); + + if( minHostGroupValue > maxHostGroupValue ) + { KMessageBox::error( this, i18n( QString( "Min host group not < Max host group" )), i18n( "Host group error" )); + return false; + } + + if( minParallelismValue > maxParallelismValue ) + { KMessageBox::error( this, i18n( QString( "Min parallelism not < Max parallelism" )), i18n( "Parallelism error" )); + return false; + } + + if( minRTTTimeoutValue > maxRTTTimeoutValue ) + { KMessageBox::error( this, i18n( QString( "Min RTT timeout not < Max RTT timeout" )), i18n( "RTT timeout error" )); + return false; + } + + if( scanDelayValue > maxScanDelayValue ) + { KMessageBox::error( this, i18n( QString( "Min scan delay not < Max scan delay" )), i18n( "Scan delay error" )); + return false; + } + + m_hostTimeoutState = m_hostTimeoutCheckBox->isChecked( ); + m_hostTimeoutValue = m_hostTimeoutLineEdit->text( ).toUInt( ); + m_initialRTTTimeoutState = m_initialRTTTimeoutCheckBox->isChecked( ); + m_initialRTTTimeoutValue = m_initialRTTTimeoutLineEdit->text( ).toUInt( ); + m_maxHostGroupState = maxHostGroupState; + m_maxHostGroupValue = maxHostGroupValue; + m_maxParallelismState = maxParallelismState; + m_maxParallelismValue = maxParallelismValue; + m_maxRTTTimeoutState = maxRTTTimeoutState; + m_maxRTTTimeoutValue = maxRTTTimeoutValue; + m_maxScanDelayState = maxScanDelayState; + m_maxScanDelayValue = maxScanDelayValue; + m_minHostGroupState = minHostGroupState; + m_minHostGroupValue = minHostGroupValue; + m_minParallelismState = minParallelismState; + m_minParallelismValue = minParallelismValue; + m_minRTTTimeoutState = minRTTTimeoutState; + m_minRTTTimeoutValue = minRTTTimeoutValue; + m_scanDelayState = scanDelayState; + m_scanDelayValue = scanDelayValue; + + return true; +} + +// readProfile +// =========== + +void TimingWidget::readProfile( KConfig* config ) +{ m_hostTimeoutState = config->readBoolEntry( "hostTimeoutState" ); + m_hostTimeoutValue = config->readNumEntry( "hostTimeoutValue" ); + m_initialRTTTimeoutState = config->readBoolEntry( "initialRTTTimeoutState" ); + m_initialRTTTimeoutValue = config->readNumEntry( "initialRTTTimeoutValue" ); + m_maxHostGroupState = config->readBoolEntry( "maxHostGroupState" ); + m_maxHostGroupValue = config->readNumEntry( "maxHostGroupValue" ); + m_maxParallelismState = config->readBoolEntry( "maxParallelismState" ); + m_maxParallelismValue = config->readNumEntry( "maxParallelismValue" ); + m_maxRTTTimeoutState = config->readBoolEntry( "maxRTTTimeoutState" ); + m_maxRTTTimeoutValue = config->readNumEntry( "maxRTTTimeoutValue" ); + m_maxScanDelayState = config->readBoolEntry( "maxScanDelayState" ); + m_maxScanDelayValue = config->readNumEntry( "maxScanDelayValue" ); + m_minHostGroupState = config->readBoolEntry( "minHostGroupState" ); + m_minHostGroupValue = config->readNumEntry( "minHostGroupValue" ); + m_minParallelismState = config->readBoolEntry( "minParallelismState" ); + m_minParallelismValue = config->readNumEntry( "minParallelismValue" ); + m_minRTTTimeoutState = config->readBoolEntry( "minRTTTimeoutState" ); + m_minRTTTimeoutValue = config->readNumEntry( "minRTTTimeoutValue" ); + m_scanDelayState = config->readBoolEntry( "scanDelayState" ); + m_scanDelayValue = config->readNumEntry( "scanDelayValue" ); + + m_simpleTimingValue = Timing( config->readNumEntry( "simpleTimingValue", Normal_T3_Timing )); +} + +// saveProfile +// =========== + +void TimingWidget::saveProfile( KConfig* config ) +{ config->writeEntry( "hostTimeoutState", m_hostTimeoutState ); + config->writeEntry( "hostTimeoutValue", m_hostTimeoutValue ); + config->writeEntry( "initialRTTTimeoutState", m_initialRTTTimeoutState ); + config->writeEntry( "initialRTTTimeoutValue", m_initialRTTTimeoutValue ); + config->writeEntry( "maxHostGroupState", m_maxHostGroupState ); + config->writeEntry( "maxHostGroupValue", m_maxHostGroupValue ); + config->writeEntry( "maxParallelismState", m_maxParallelismState ); + config->writeEntry( "maxParallelismValue", m_maxParallelismValue ); + config->writeEntry( "maxRTTTimeoutState", m_maxRTTTimeoutState ); + config->writeEntry( "maxRTTTimeoutValue", m_maxRTTTimeoutValue ); + config->writeEntry( "maxScanDelayState", m_maxScanDelayState ); + config->writeEntry( "maxScanDelayValue", m_maxScanDelayValue ); + config->writeEntry( "minHostGroupState", m_minHostGroupState ); + config->writeEntry( "minHostGroupValue", m_minHostGroupValue ); + config->writeEntry( "minParallelismState", m_minParallelismState ); + config->writeEntry( "minParallelismValue", m_minParallelismValue ); + config->writeEntry( "minRTTTimeoutState", m_minRTTTimeoutState ); + config->writeEntry( "minRTTTimeoutValue", m_minRTTTimeoutValue ); + config->writeEntry( "scanDelayState", m_scanDelayState ); + config->writeEntry( "scanDelayValue", m_scanDelayValue ); + config->writeEntry( "simpleTimingValue", m_simpleTimingValue ); +} + +// setInitialValues +// ================ + +void TimingWidget::setInitialValues( ) +{ m_hostTimeoutCheckBox->setChecked( m_hostTimeoutState ); + m_hostTimeoutLineEdit->setEnabled( m_hostTimeoutState ); + m_hostTimeoutLineEdit->setText( QString::number( m_hostTimeoutValue )); + m_initialRTTTimeoutCheckBox->setChecked( m_initialRTTTimeoutState ); + m_initialRTTTimeoutLineEdit->setEnabled( m_initialRTTTimeoutState ); + m_initialRTTTimeoutLineEdit->setText( QString::number( m_initialRTTTimeoutValue )); + m_maxHostGroupCheckBox->setChecked( m_maxHostGroupState ); + m_maxHostGroupLineEdit->setEnabled( m_maxHostGroupState ); + m_maxHostGroupLineEdit->setText( QString::number( m_maxHostGroupValue )); + m_maxParallelismCheckBox->setChecked( m_maxParallelismState ); + m_maxParallelismLineEdit->setEnabled( m_maxParallelismState ); + m_maxParallelismLineEdit->setText( QString::number( m_maxParallelismValue )); + m_maxRTTTimeoutCheckBox->setChecked( m_maxRTTTimeoutState ); + m_maxRTTTimeoutLineEdit->setEnabled( m_maxRTTTimeoutState ); + m_maxRTTTimeoutLineEdit->setText( QString::number( m_maxRTTTimeoutValue )); + m_maxScanDelayCheckBox->setChecked( m_maxScanDelayState ); + m_maxScanDelayLineEdit->setEnabled( m_maxScanDelayState ); + m_maxScanDelayLineEdit->setText( QString::number( m_maxScanDelayValue )); + m_minHostGroupCheckBox->setChecked( m_minHostGroupState ); + m_minHostGroupLineEdit->setEnabled( m_minHostGroupState ); + m_minHostGroupLineEdit->setText( QString::number( m_minHostGroupValue )); + m_minParallelismCheckBox->setChecked( m_minParallelismState ); + m_minParallelismLineEdit->setEnabled( m_minParallelismState ); + m_minParallelismLineEdit->setText( QString::number( m_minParallelismValue )); + m_minRTTTimeoutCheckBox->setChecked( m_minRTTTimeoutState ); + m_minRTTTimeoutLineEdit->setEnabled( m_minRTTTimeoutState ); + m_minRTTTimeoutLineEdit->setText( QString::number( m_minRTTTimeoutValue )); + m_scanDelayCheckBox->setChecked( m_scanDelayState ); + m_scanDelayLineEdit->setEnabled( m_scanDelayState ); + m_scanDelayLineEdit->setText( QString::number( m_scanDelayValue )); + + switch( m_simpleTimingValue ) + { case Aggressive_T4_Timing: m_aggressiveRadio->setChecked( true ); break; + case Default_Timing: m_defaultRadio->setChecked( true ); break; + case Insane_T5_Timing: m_insaneRadio->setChecked( true ); break; + case Normal_T3_Timing: m_normalRadio->setChecked( true ); break; + case Paranoid_T0_Timing: m_paranoidRadio->setChecked( true ); break; + case Polite_T2_Timing: m_politeRadio->setChecked( true ); break; + case Sneaky_T1_Timing: m_sneakyRadio->setChecked( true ); break; + + default: + kdDebug( ) << "internal error - unknown simple timing value " << m_simpleTimingValue << endl; + ASSERT( false ); + } +} + +// simpleTiming +// ============ + +QString TimingWidget::simpleTiming( ) const +{ switch( m_simpleTimingValue ) + { case Aggressive_T4_Timing: return "Aggressive"; + case Default_Timing: return ""; + case Insane_T5_Timing: return "Insane"; + case Normal_T3_Timing: return "Normal"; + case Paranoid_T0_Timing: return "Paranoid"; + case Polite_T2_Timing: return "Polite"; + case Sneaky_T1_Timing: return "Sneaky"; + } + + kdDebug( ) << "internal error - unknown simple timing value " << m_simpleTimingValue << endl; + ASSERT( false ); + return QString::null; +} + +// slotAggressiveRadioClicked +// ========================== + +void TimingWidget::slotAggressiveRadioClicked( ) +{ m_simpleTimingValue = Aggressive_T4_Timing; +} + +// slotDefaultRadioClicked +// ======================= + +void TimingWidget::slotDefaultRadioClicked( ) +{ m_simpleTimingValue = Default_Timing; +} + +// slotHostTimeoutButtonClicked +// ============================ + +void TimingWidget::slotHostTimeoutButtonClicked( ) +{ m_hostTimeoutLineEdit->clear( ); +} + +// slotHostTimeoutCheckBoxClicked +// ============================== + +void TimingWidget::slotHostTimeoutCheckBoxClicked( ) +{ m_hostTimeoutButton->setEnabled( m_hostTimeoutCheckBox->isChecked( )); + m_hostTimeoutLineEdit->setEnabled( m_hostTimeoutCheckBox->isChecked( )); +} + +// slotInitialRTTTimeoutButtonClicked +// ================================== + +void TimingWidget::slotInitialRTTTimeoutButtonClicked( ) +{ m_initialRTTTimeoutLineEdit->clear( ); +} + +// slotInitialRTTTimeoutCheckBoxClicked +// ==================================== + +void TimingWidget::slotInitialRTTTimeoutCheckBoxClicked( ) +{ m_initialRTTTimeoutButton->setEnabled( m_initialRTTTimeoutCheckBox->isChecked( )); + m_initialRTTTimeoutLineEdit->setEnabled( m_initialRTTTimeoutCheckBox->isChecked( )); +} + +// slotInsaneRadioClicked +// ====================== + +void TimingWidget::slotInsaneRadioClicked( ) +{ m_simpleTimingValue = Insane_T5_Timing; +} + +// slotMaxHostGroupButtonClicked +// ============================= + +void TimingWidget::slotMaxHostGroupButtonClicked( ) +{ m_maxHostGroupLineEdit->clear( ); +} + +// slotMaxHostGroupCheckBoxClicked +// =============================== + +void TimingWidget::slotMaxHostGroupCheckBoxClicked( ) +{ m_maxHostGroupButton->setEnabled( m_maxHostGroupCheckBox->isChecked( )); + m_maxHostGroupLineEdit->setEnabled( m_maxHostGroupCheckBox->isChecked( )); +} + +// slotMaxParallelismButtonClicked +// =============================== + +void TimingWidget::slotMaxParallelismButtonClicked( ) +{ m_maxParallelismLineEdit->clear( ); +} + +// slotMaxParallelismCheckBoxClicked +// ================================= + +void TimingWidget::slotMaxParallelismCheckBoxClicked( ) +{ m_maxParallelismButton->setEnabled( m_maxParallelismCheckBox->isChecked( )); + m_maxParallelismLineEdit->setEnabled( m_maxParallelismCheckBox->isChecked( )); +} + +// slotMaxRTTTimeoutButtonClicked +// ============================== + +void TimingWidget::slotMaxRTTTimeoutButtonClicked( ) +{ m_maxRTTTimeoutLineEdit->clear( ); +} + +// slotMaxRTTTimeoutCheckBoxClicked +// ================================ + +void TimingWidget::slotMaxRTTTimeoutCheckBoxClicked( ) +{ m_maxRTTTimeoutButton->setEnabled( m_maxRTTTimeoutCheckBox->isChecked( )); + m_maxRTTTimeoutLineEdit->setEnabled( m_maxRTTTimeoutCheckBox->isChecked( )); +} + +// slotMaxScanDelayButtonClicked +// ============================= + +void TimingWidget::slotMaxScanDelayButtonClicked( ) +{ m_maxScanDelayLineEdit->clear( ); +} + +// slotMaxScanDelayCheckBoxClicked +// =============================== + +void TimingWidget::slotMaxScanDelayCheckBoxClicked( ) +{ m_maxScanDelayButton->setEnabled( m_maxScanDelayCheckBox->isChecked( )); + m_maxScanDelayLineEdit->setEnabled( m_maxScanDelayCheckBox->isChecked( )); +} + +// slotMinHostGroupButtonClicked +// ============================= + +void TimingWidget::slotMinHostGroupButtonClicked( ) +{ m_minHostGroupLineEdit->clear( ); +} + +// slotMinHostGroupCheckBoxClicked +// =============================== + +void TimingWidget::slotMinHostGroupCheckBoxClicked( ) +{ m_minHostGroupButton->setEnabled( m_minHostGroupCheckBox->isChecked( )); + m_minHostGroupLineEdit->setEnabled( m_minHostGroupCheckBox->isChecked( )); +} + +// slotMinParallelismButtonClicked +// =============================== + +void TimingWidget::slotMinParallelismButtonClicked( ) +{ m_minParallelismLineEdit->clear( ); +} + +// slotMinParallelismCheckBoxClicked +// ================================= + +void TimingWidget::slotMinParallelismCheckBoxClicked( ) +{ m_minParallelismButton->setEnabled( m_minParallelismCheckBox->isChecked( )); + m_minParallelismLineEdit->setEnabled( m_minParallelismCheckBox->isChecked( )); +} + +// slotMinRTTTimeoutButtonClicked +// ============================== + +void TimingWidget::slotMinRTTTimeoutButtonClicked( ) +{ m_minRTTTimeoutLineEdit->clear( ); +} + +// slotMinRTTTimeoutCheckBoxClicked +// ================================ + +void TimingWidget::slotMinRTTTimeoutCheckBoxClicked( ) +{ m_minRTTTimeoutButton->setEnabled( m_minRTTTimeoutCheckBox->isChecked( )); + m_minRTTTimeoutLineEdit->setEnabled( m_minRTTTimeoutCheckBox->isChecked( )); +} + +// slotNormalRadioClicked +// ====================== + +void TimingWidget::slotNormalRadioClicked( ) +{ m_simpleTimingValue = Normal_T3_Timing; +} + +// slotParanoidRadioClicked +// ======================== + +void TimingWidget::slotParanoidRadioClicked( ) +{ m_simpleTimingValue = Paranoid_T0_Timing; +} + +// slotPoliteRadioClicked +// ====================== + +void TimingWidget::slotPoliteRadioClicked( ) +{ m_simpleTimingValue = Polite_T2_Timing; +} + +// slotScanDelayButtonClicked +// ========================== + +void TimingWidget::slotScanDelayButtonClicked( ) +{ m_scanDelayLineEdit->clear( ); +} + +// slotScanDelayCheckBoxClicked +// ============================ + +void TimingWidget::slotScanDelayCheckBoxClicked( ) +{ m_scanDelayButton->setEnabled( m_scanDelayCheckBox->isChecked( )); + m_scanDelayLineEdit->setEnabled( m_scanDelayCheckBox->isChecked( )); +} + +// slotSneakyRadioClicked +// ====================== + +void TimingWidget::slotSneakyRadioClicked( ) +{ m_simpleTimingValue = Sneaky_T1_Timing; +} + +// slotWhatsThisClicked +// ==================== + +void TimingWidget::slotWhatsThisClicked( ) +{ if( m_aggressiveRadio->hasMouse( )) emit( displayHelp( "-T" )); + else if( m_defaultRadio->hasMouse( )) emit( displayDocBook( "timing_options" )); + else if( m_hostTimeoutButton->hasMouse( )) emit( displayHelp( "--host_timeout" )); + else if( m_hostTimeoutCheckBox->hasMouse( )) emit( displayHelp( "--host_timeout" )); + else if( m_hostTimeoutLineEdit->hasMouse( )) emit( displayHelp( "--host_timeout" )); + else if( m_initialRTTTimeoutButton->hasMouse( )) emit( displayHelp( "--initial_rtt_timeout" )); + else if( m_initialRTTTimeoutCheckBox->hasMouse( )) emit( displayHelp( "--initial_rtt_timeout" )); + else if( m_initialRTTTimeoutLineEdit->hasMouse( )) emit( displayHelp( "--initial_rtt_timeout" )); + else if( m_insaneRadio->hasMouse( )) emit( displayHelp( "-T" )); + else if( m_maxHostGroupButton->hasMouse( )) emit( displayHelp( "--max_hostgroup" )); + else if( m_maxHostGroupCheckBox->hasMouse( )) emit( displayHelp( "--max_hostgroup" )); + else if( m_maxHostGroupLineEdit->hasMouse( )) emit( displayHelp( "--max_hostgroup" )); + else if( m_maxParallelismButton->hasMouse( )) emit( displayHelp( "--max_parallelism" )); + else if( m_maxParallelismCheckBox->hasMouse( )) emit( displayHelp( "--max_parallelism" )); + else if( m_maxParallelismLineEdit->hasMouse( )) emit( displayHelp( "--max_parallelism" )); + else if( m_maxRTTTimeoutButton->hasMouse( )) emit( displayHelp( "--max_rtt_timeout" )); + else if( m_maxRTTTimeoutCheckBox->hasMouse( )) emit( displayHelp( "--max_rtt_timeout" )); + else if( m_maxRTTTimeoutLineEdit->hasMouse( )) emit( displayHelp( "--max_rtt_timeout" )); + else if( m_maxScanDelayButton->hasMouse( )) emit( displayHelp( "--max_scan_delay" )); + else if( m_maxScanDelayCheckBox->hasMouse( )) emit( displayHelp( "--max_scan_delay" )); + else if( m_maxScanDelayLineEdit->hasMouse( )) emit( displayHelp( "--max_scan_delay" )); + else if( m_minHostGroupButton->hasMouse( )) emit( displayHelp( "--min_hostgroup" )); + else if( m_minHostGroupCheckBox->hasMouse( )) emit( displayHelp( "--min_hostgroup" )); + else if( m_minHostGroupLineEdit->hasMouse( )) emit( displayHelp( "--min_hostgroup" )); + else if( m_minParallelismButton->hasMouse( )) emit( displayHelp( "--min_parallelism" )); + else if( m_minParallelismCheckBox->hasMouse( )) emit( displayHelp( "--min_parallelism" )); + else if( m_minParallelismLineEdit->hasMouse( )) emit( displayHelp( "--min_parallelism" )); + else if( m_minRTTTimeoutButton->hasMouse( )) emit( displayHelp( "--min_rtt_timeout" )); + else if( m_minRTTTimeoutCheckBox->hasMouse( )) emit( displayHelp( "--min_rtt_timeout" )); + else if( m_minRTTTimeoutLineEdit->hasMouse( )) emit( displayHelp( "--min_rtt_timeout" )); + else if( m_normalRadio->hasMouse( )) emit( displayHelp( "-T" )); + else if( m_paranoidRadio->hasMouse( )) emit( displayHelp( "-T" )); + else if( m_politeRadio->hasMouse( )) emit( displayHelp( "-T" )); + else if( m_scanDelayButton->hasMouse( )) emit( displayHelp( "--scan_delay" )); + else if( m_scanDelayCheckBox->hasMouse( )) emit( displayHelp( "--scan_delay" )); + else if( m_scanDelayLineEdit->hasMouse( )) emit( displayHelp( "--scan_delay" )); + else if( m_sneakyRadio->hasMouse( )) emit( displayHelp( "-T" )); + else emit( displayUnknown( )); +} diff --git a/src/timingwidget.h b/src/timingwidget.h new file mode 100644 index 0000000..943404e --- /dev/null +++ b/src/timingwidget.h @@ -0,0 +1,190 @@ +/*************************************************************************** + * * + * Copyright (C) 2005, 2006 by Kevin Gilbert * + * [email protected] * + * * + * 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. * + * * + ***************************************************************************/ +#ifndef _TIMINGWIDGET_H_ +#define _TIMINGWIDGET_H_ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <qwidget.h> +#include "global.h" + +// forward class definitions +// ========================= + +class KConfig; +class QCheckBox; +class QLineEdit; +class QPushButton; +class QRadioButton; + +// TimingWidget class definition +// ============================= + +class TimingWidget : public QWidget +{ Q_OBJECT + + public: + TimingWidget( QWidget* parent, const char* name = NULL ); + + void finaliseInitialisation( ); + bool getOptions( ); + void readProfile( KConfig* config ); + void saveProfile( KConfig* config ); + void setInitialValues( ); + QString simpleTiming( ) const; + + bool hostTimeoutState( ) const { return m_hostTimeoutState; } + uint hostTimeoutValue( ) const { return m_hostTimeoutValue; } + bool initialRTTTimeoutState( ) const { return m_initialRTTTimeoutState; } + uint initialRTTTimeoutValue( ) const { return m_initialRTTTimeoutValue; } + bool maxHostGroupState( ) const { return m_maxHostGroupState; } + uint maxHostGroupValue( ) const { return m_maxHostGroupValue; } + bool maxParallelismState( ) const { return m_maxParallelismState; } + uint maxParallelismValue( ) const { return m_maxParallelismValue; } + bool maxRTTTimeoutState( ) const { return m_maxRTTTimeoutState; } + uint maxRTTTimeoutValue( ) const { return m_maxRTTTimeoutValue; } + bool maxScanDelayState( ) const { return m_maxScanDelayState; } + uint maxScanDelayValue( ) const { return m_maxScanDelayValue; } + bool minHostGroupState( ) const { return m_minHostGroupState; } + uint minHostGroupValue( ) const { return m_minHostGroupValue; } + bool minParallelismState( ) const { return m_minParallelismState; } + uint minParallelismValue( ) const { return m_minParallelismValue; } + bool minRTTTimeoutState( ) const { return m_minRTTTimeoutState; } + uint minRTTTimeoutValue( ) const { return m_minRTTTimeoutValue; } + bool scanDelayState( ) const { return m_scanDelayState; } + uint scanDelayValue( ) const { return m_scanDelayValue; } + + signals: + void displayDocBook( const QString& ); + void displayHelp( const QString& ); + void displayUnknown( ); + void optionsDirty( ); + + private slots: + void slotAggressiveRadioClicked( ); + void slotDefaultRadioClicked( ); + void slotHostTimeoutButtonClicked( ); + void slotHostTimeoutCheckBoxClicked( ); + void slotInitialRTTTimeoutButtonClicked( ); + void slotInitialRTTTimeoutCheckBoxClicked( ); + void slotInsaneRadioClicked( ); + void slotMaxHostGroupButtonClicked( ); + void slotMaxHostGroupCheckBoxClicked( ); + void slotMaxParallelismButtonClicked( ); + void slotMaxParallelismCheckBoxClicked( ); + void slotMaxRTTTimeoutButtonClicked( ); + void slotMaxRTTTimeoutCheckBoxClicked( ); + void slotMaxScanDelayButtonClicked( ); + void slotMaxScanDelayCheckBoxClicked( ); + void slotMinHostGroupButtonClicked( ); + void slotMinHostGroupCheckBoxClicked( ); + void slotMinParallelismButtonClicked( ); + void slotMinParallelismCheckBoxClicked( ); + void slotMinRTTTimeoutButtonClicked( ); + void slotMinRTTTimeoutCheckBoxClicked( ); + void slotNormalRadioClicked( ); + void slotParanoidRadioClicked( ); + void slotPoliteRadioClicked( ); + void slotScanDelayButtonClicked( ); + void slotScanDelayCheckBoxClicked( ); + void slotSneakyRadioClicked( ); + void slotWhatsThisClicked( ); + + private: + void createLayout( ); + + // simple timing indices + // ===================== + + enum Timing + { Default_Timing, + Aggressive_T4_Timing, + Insane_T5_Timing, + Normal_T3_Timing, + Paranoid_T0_Timing, + Polite_T2_Timing, + Sneaky_T1_Timing + }; + + QRadioButton* m_aggressiveRadio; + QRadioButton* m_defaultRadio; + QPushButton* m_hostTimeoutButton; + QCheckBox* m_hostTimeoutCheckBox; + QLineEdit* m_hostTimeoutLineEdit; + bool m_hostTimeoutState; + uint m_hostTimeoutValue; + QPushButton* m_initialRTTTimeoutButton; + QCheckBox* m_initialRTTTimeoutCheckBox; + QLineEdit* m_initialRTTTimeoutLineEdit; + bool m_initialRTTTimeoutState; + uint m_initialRTTTimeoutValue; + QRadioButton* m_insaneRadio; + QPushButton* m_maxHostGroupButton; + QCheckBox* m_maxHostGroupCheckBox; + QLineEdit* m_maxHostGroupLineEdit; + bool m_maxHostGroupState; + uint m_maxHostGroupValue; + QPushButton* m_maxParallelismButton; + QCheckBox* m_maxParallelismCheckBox; + QLineEdit* m_maxParallelismLineEdit; + bool m_maxParallelismState; + uint m_maxParallelismValue; + QPushButton* m_maxRTTTimeoutButton; + QCheckBox* m_maxRTTTimeoutCheckBox; + QLineEdit* m_maxRTTTimeoutLineEdit; + bool m_maxRTTTimeoutState; + uint m_maxRTTTimeoutValue; + QPushButton* m_maxScanDelayButton; + QCheckBox* m_maxScanDelayCheckBox; + QLineEdit* m_maxScanDelayLineEdit; + bool m_maxScanDelayState; + uint m_maxScanDelayValue; + QPushButton* m_minHostGroupButton; + QCheckBox* m_minHostGroupCheckBox; + QLineEdit* m_minHostGroupLineEdit; + bool m_minHostGroupState; + uint m_minHostGroupValue; + QPushButton* m_minParallelismButton; + QCheckBox* m_minParallelismCheckBox; + QLineEdit* m_minParallelismLineEdit; + bool m_minParallelismState; + uint m_minParallelismValue; + QPushButton* m_minRTTTimeoutButton; + QCheckBox* m_minRTTTimeoutCheckBox; + QLineEdit* m_minRTTTimeoutLineEdit; + bool m_minRTTTimeoutState; + uint m_minRTTTimeoutValue; + QRadioButton* m_normalRadio; + QRadioButton* m_paranoidRadio; + QRadioButton* m_politeRadio; + QPushButton* m_scanDelayButton; + QCheckBox* m_scanDelayCheckBox; + QLineEdit* m_scanDelayLineEdit; + bool m_scanDelayState; + uint m_scanDelayValue; + Timing m_simpleTimingValue; + QRadioButton* m_sneakyRadio; +}; + +#endif // _TIMINGWIDGET_H_ diff --git a/src/whatsthis.cpp b/src/whatsthis.cpp new file mode 100644 index 0000000..5369a6b --- /dev/null +++ b/src/whatsthis.cpp @@ -0,0 +1,42 @@ +/*************************************************************************** + * * + * Copyright (C) 2005, 2006 by Kevin Gilbert * + * [email protected] * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + ***************************************************************************/ + +#include <kdebug.h> +#include <klocale.h> + +#include "whatsthis.h" + +// constructor +// =========== + +WhatsThis::WhatsThis( QWidget* widget ) +: QWhatsThis( widget ) +{ +} + +// text +// ==== + +QString WhatsThis::text( const QPoint& /*pos */) +{ emit( clicked( )); + return ""; +} diff --git a/src/whatsthis.h b/src/whatsthis.h new file mode 100644 index 0000000..37479a0 --- /dev/null +++ b/src/whatsthis.h @@ -0,0 +1,53 @@ +/*************************************************************************** + * * + * Copyright (C) 2005, 2006 by Kevin Gilbert * + * [email protected] * + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef _WHATSTHIS_H_ +#define _WHATSTHIS_H_ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <qobject.h> +#include <qwhatsthis.h> +#include "global.h" + +// forward class definitions +// ========================= + +class QPoint; + +// WhatsThis class definition +// ========================== + +class WhatsThis : public QObject, public QWhatsThis +{ Q_OBJECT + + public: + WhatsThis( QWidget* widget ); + QString text( const QPoint& pos ); + + signals: + void clicked( ); +}; + +#endif // _WHATSTHIS_H_ diff --git a/stamp-h.in b/stamp-h.in new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/stamp-h.in |